import{df as b,dg as I,dh as v,d as R,cY as S,r as V,U as N,p as A,bX as T}from"./index-f5a86b16-1706882452509.js";var F=1/0,x=17976931348623157e292;function p(t){if(!t)return t===0?t:0;if(t=b(t),t===F||t===-F){var e=t<0?-1:1;return e*x}return t===t?t:0}function E(t){var e=p(t),a=e%1;return e===e?a?e-a:e:0}var U=I.isFinite,_=Math.min;function B(t){var e=Math[t];return function(a,n){if(a=b(a),n=n==null?0:_(E(n),292),n&&U(a)){var r=(v(a)+"e").split("e"),i=e(r[0]+"e"+(+r[1]+n));return r=(v(i)+"e").split("e"),+(r[0]+"e"+(+r[1]-n))}return e(a)}}var L=B("round");const O=L,P=t=>1-Math.pow(1-t,5);function X(t){const{from:e,to:a,duration:n,onUpdate:r,onFinish:i}=t,u=()=>{const c=performance.now(),s=Math.min(c-d,n),f=e+(a-e)*P(s/n);if(s===n){i();return}r(f),requestAnimationFrame(u)},d=performance.now();u()}const Y={to:{type:Number,default:0},precision:{type:Number,default:0},showSeparator:Boolean,locale:String,from:{type:Number,default:0},active:{type:Boolean,default:!0},duration:{type:Number,default:2e3},onFinish:Function},q=R({name:"NumberAnimation",props:Y,setup(t){const{localeRef:e}=S("name"),{duration:a}=t,n=V(t.from),r=N(()=>{const{locale:o}=t;return o!==void 0?o:e.value});let i=!1;const u=o=>{n.value=o},d=()=>{var o;n.value=t.to,i=!1,(o=t.onFinish)===null||o===void 0||o.call(t)},c=(o=t.from,m=t.to)=>{i=!0,n.value=t.from,o!==m&&X({from:o,to:m,duration:a,onUpdate:u,onFinish:d})},s=N(()=>{var o;const l=O(n.value,t.precision).toFixed(t.precision).split("."),h=new Intl.NumberFormat(r.value),g=(o=h.formatToParts(.5).find(y=>y.type==="decimal"))===null||o===void 0?void 0:o.value,M=t.showSeparator?h.format(Number(l[0])):l[0],w=l[1];return{integer:M,decimal:w,decimalSeparator:g}});function f(){i||c()}return A(()=>{T(()=>{t.active&&c()})}),Object.assign({formattedValue:s},{play:f})},render(){const{formattedValue:{integer:t,decimal:e,decimalSeparator:a}}=this;return[t,e?a:null,e]}});export{q as N};
