const e=require("../_util/type.js"),t=require("../_util/omit.js"),n=require("../_util/props-util/initDefaultProps.js"),r=require("./Statistic.js"),i=require("./utils.js");let a=require("vue");var o=1e3/30;function s(e){return new Date(e).getTime()}var c=()=>({...r.statisticProps(),value:e.someType([Number,String,Object]),format:String,onFinish:Function,onChange:Function}),l=(0,a.defineComponent)({compatConfig:{MODE:3},name:`AStatisticCountdown`,props:n.default(c(),{format:`HH:mm:ss`}),setup(e,{emit:n,slots:c}){let l=(0,a.ref)(),u=(0,a.ref)(),d=()=>{let{value:t}=e;s(t)>=Date.now()?f():p()},f=()=>{if(l.value)return;let t=s(e.value);l.value=setInterval(()=>{u.value.$forceUpdate(),t>Date.now()&&n(`change`,t-Date.now()),d()},o)},p=()=>{let{value:t}=e;l.value&&(clearInterval(l.value),l.value=void 0,s(t)<Date.now()&&n(`finish`))},m=({value:t,config:n})=>{let{format:r}=e;return i.formatCountdown(t,{...n,format:r})},h=e=>e;return(0,a.onMounted)(()=>{d()}),(0,a.onUpdated)(()=>{d()}),(0,a.onBeforeUnmount)(()=>{p()}),()=>{let n=e.value;return(0,a.createVNode)(r.default,{ref:u,...t.default(e,[`onFinish`,`onChange`]),value:n,valueRender:h,formatter:m},c)}}});exports.countdownProps=c,exports.default=l;