import{C as u,m as r,q as S,n as m,t as p,d as h,D,v,E as w,G as C,k as H,y as g}from"./index.879f7421.js";function P(e,n){const{days:i}=n;let{hours:s,minutes:c,seconds:l,milliseconds:t}=n;if(e.includes("DD")?e=e.replace("DD",u(i)):s+=i*24,e.includes("HH")?e=e.replace("HH",u(s)):c+=s*60,e.includes("mm")?e=e.replace("mm",u(c)):l+=c*60,e.includes("ss")?e=e.replace("ss",u(l)):t+=l*1e3,e.includes("S")){const a=u(t,3);e.includes("SSS")?e=e.replace("SSS",a):e.includes("SS")?e=e.replace("SS",a.slice(0,2)):e=e.replace("S",a.charAt(0))}return e}const[k,x]=r("count-down"),N={time:S(0),format:m("HH:mm:ss"),autoStart:p,millisecond:Boolean};var y=h({name:k,props:N,emits:["change","finish"],setup(e,{emit:n,slots:i}){const{start:s,pause:c,reset:l,current:t}=D({time:+e.time,millisecond:e.millisecond,onChange:o=>n("change",o),onFinish:()=>n("finish")}),a=v(()=>P(e.format,t.value)),d=()=>{l(+e.time),e.autoStart&&s()};return w(()=>e.time,d,{immediate:!0}),C({start:s,pause:c,reset:d}),()=>H("div",{role:"timer",class:x()},[i.default?i.default(t.value):a.value])}});const F=g(y);export{F as C};
