(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@vueuse/core")):typeof define=="function"&&define.amd?define(["exports","vue","@vueuse/core"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.index={},n.Vue,n.core))})(this,function(n,e,f){"use strict";const g={startVal:{type:Number,default:0},endVal:{type:Number,default:0},duration:{type:Number,default:1500},autoplay:{type:Boolean,default:!0},decimals:{type:Number,default:0,validator(t){return t>=0}},prefix:{type:String,default:""},suffix:{type:String,default:""},separator:{type:String,default:","},decimal:{type:String,default:"."},color:{type:String},useEasing:{type:Boolean,default:!0},transition:{type:String,default:"linear"}},S="G",h=e.defineComponent({name:`${S}CountTo`,props:g,emits:["onStarted","onFinished"],setup(t,{emit:i}){const o=e.ref(t.startVal),s=e.ref(!1);let u=f.useTransition(o);const y=e.computed(()=>$(e.unref(u)));e.watchEffect(()=>{o.value=t.startVal}),e.watch([()=>t.startVal,()=>t.endVal],()=>{t.autoplay&&d()}),e.onMounted(()=>{t.autoplay&&d()});function d(){m(),o.value=t.endVal}function _(){o.value=t.startVal,m()}function m(){u=f.useTransition(o,{disabled:s,duration:t.duration,onFinished:()=>i("onFinished"),onStarted:()=>i("onStarted"),...t.useEasing?{transition:f.TransitionPresets[t.transition]}:{}})}function N(a){return typeof a=="number"}function $(a){if(!a&&a!==0)return"";const{decimals:C,decimal:B,separator:c,suffix:E,prefix:F}=t;a=Number(a).toFixed(C),a+="";const p=a.split(".");let l=p[0];const k=p.length>1?B+p[1]:"",x=/(\d+)(\d{3})/;if(c&&!N(c))for(;x.test(l);)l=l.replace(x,"$1"+c+"$2");return F+l+k+E}return{value:y,start:d,reset:_}}}),T=(t,i)=>{const o=t.__vccOpts||t;for(const[s,u]of i)o[s]=u;return o};function b(t,i,o,s,u,y){return e.openBlock(),e.createElementBlock("span",{style:e.normalizeStyle({color:t.color})},e.toDisplayString(t.value),5)}const r=T(h,[["render",b]]);r.install=function(t,i){t.component(i||r.name,r)};const V={title:"CountTo 数字动画",category:"数据描述",status:"100%",install(t){t.component(r.name,r)}};n.CountTo=r,n.default=V,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
