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