import{d as k,p as n,f as q,b7 as P,B as v,b as w,aP as E,a as o,o as R,c as $,t as z,W as B,Y as H,b9 as M,_ as N,__tla as U}from"./index-b2b3c6c4.js";let y,W=Promise.all([(()=>{try{return U}catch{}})()]).then(async()=>{y=N(k({name:"CountTo",__name:"CountTo",props:{startVal:n.number.def(0),endVal:n.number.def(2021),duration:n.number.def(3e3),autoplay:n.bool.def(!0),decimals:n.number.validate(i=>i>=0).def(0),decimal:n.string.def("."),separator:n.string.def(","),prefix:n.string.def(""),suffix:n.string.def(""),useEasing:n.bool.def(!0),easingFn:{type:Function,default:(i,p,m,d)=>m*(1-Math.pow(2,-10*i/d))*1024/1023+p}},emits:["mounted","callback"],setup(i,{expose:p,emit:m}){const{getPrefixCls:d}=H(),A=d("count-to"),t=i,b=m,V=e=>{const{decimals:s,decimal:u,separator:l,suffix:r,prefix:C}=t;e=Number(e).toFixed(s);const _=(e+="").split(".");let c=_[0];const h=_.length>1?u+_[1]:"",T=/(\d+)(\d{3})/;if(l&&!M(l))for(;T.test(c);)c=c.replace(T,"$1"+l+"$2");return C+c+h+r},a=q({localStartVal:t.startVal,displayValue:V(t.startVal),printVal:null,paused:!1,localDuration:t.duration,startTime:null,timestamp:null,remaining:null,rAF:null}),D=P(a,"displayValue");v(()=>{t.autoplay&&F(),b("mounted")});const f=w(()=>t.startVal>t.endVal);E([()=>t.startVal,()=>t.endVal],()=>{t.autoplay&&F()});const F=()=>{const{startVal:e,duration:s}=t;a.localStartVal=e,a.startTime=null,a.localDuration=s,a.paused=!1,a.rAF=requestAnimationFrame(g)},S=()=>{cancelAnimationFrame(a.rAF)},x=()=>{a.startTime=null,a.localDuration=+a.remaining,a.localStartVal=+a.printVal,requestAnimationFrame(g)},g=e=>{const{useEasing:s,easingFn:u,endVal:l}=t;a.startTime||(a.startTime=e),a.timestamp=e;const r=e-a.startTime;a.remaining=a.localDuration-r,s?o(f)?a.printVal=a.localStartVal-u(r,0,a.localStartVal-l,a.localDuration):a.printVal=u(r,a.localStartVal,l-a.localStartVal,a.localDuration):o(f)?a.printVal=a.localStartVal-(a.localStartVal-l)*(r/a.localDuration):a.printVal=a.localStartVal+(l-a.localStartVal)*(r/a.localDuration),o(f)?a.printVal=a.printVal<l?l:a.printVal:a.printVal=a.printVal>l?l:a.printVal,a.displayValue=V(a.printVal),r<a.localDuration?a.rAF=requestAnimationFrame(g):b("callback")};return p({pauseResume:()=>{a.paused?(x(),a.paused=!1):(S(),a.paused=!0)},reset:()=>{a.startTime=null,cancelAnimationFrame(a.rAF),a.displayValue=V(t.startVal)},start:F,pause:S}),(e,s)=>(R(),$("span",{class:B(o(A))},z(o(D)),3))}}),[["__file","/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-admin/src/components/CountTo/src/CountTo.vue"]])});export{y as _,W as __tla};
