var e=Object.defineProperty,s=Object.defineProperties,t=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable,a=(s,t,r)=>t in s?e(s,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[t]=r;import{l as i,c as l,j as c,h as u,ae as m,z as d,A as h,C as p,O as f,P as y,a7 as b,a8 as v}from"./vue-vendor-o3p-Y_v4.js";import{_ as O}from"./index-DuMLoKSq.js";const j=O({props:{time:{type:Number,default:0},isMilliSecond:{type:Boolean,default:!1}},setup(e,d){let h=null;const p=i({days:0,hours:0,mins:0,seconds:0,total:0,curTime:0}),f=l(()=>e.isMilliSecond?Math.round(+e.time/1e3):Math.round(+e.time));c(()=>{p.curTime=Date.now(),y(f.value)}),u(()=>f.value,()=>{p.curTime=Date.now(),y(f.value)});const y=e=>{if(p.total=e,h&&clearTimeout(h),e<=0)return void d.emit("finish");const{dd:s,hh:t,mm:r,ss:o}=(e=>{if(!e)return{ss:0};let s=e;const t=s%60;if(s=(s-t)/60,s<1)return{ss:t};const r=s%60;if(s=(s-r)/60,s<1)return{mm:r,ss:t};const o=s%24;return s=(s-o)/24,s<1?{hh:o,mm:r,ss:t}:{dd:s,hh:o,mm:r,ss:t}})(e);p.days=s||0,p.hours=t||0,p.mins=r||0,p.seconds=o||0,h=setTimeout(()=>{const s=Date.now(),t=Math.floor((s-p.curTime)/1e3),r=t>1?t:1;p.curTime=s,y(e-r)},1e3)};return b=((e,s)=>{for(var t in s||(s={}))o.call(s,t)&&a(e,t,s[t]);if(r)for(var t of r(s))n.call(s,t)&&a(e,t,s[t]);return e})({},m(p)),s(b,t({duration:f}));var b}},[["render",function(e,s,t,r,o,n){return h(),d("div",null,[p(e.$slots,"default",b(v({d:e.days,h:e.hours,m:e.mins,s:e.seconds,hh:`00${e.hours}`.slice(-2),mm:`00${e.mins}`.slice(-2),ss:`00${e.seconds}`.slice(-2),total:e.total})),()=>[f(y(e.days)+"天"+y(`00${e.hours}`.slice(-2))+"时 "+y(`00${e.mins}`.slice(-2))+":"+y(`00${e.seconds}`.slice(-2)),1)])])}]]);export{j as _};