import{k as mt,j as i,t as _t,m as C,n as O,p as t,q as Q,i as U,v as vt,s as V,A as w,x as W}from"./web.Os7kOAdY.js";import{g as X,t as St}from"./i18n-runtime._BAkvU05.js";var ht=w('<div class=panel style=display:flex;flex-direction:column;gap:18px><section class=panel style=padding:14px><h3 style="margin:0 0 10px;font-size:14px;color:var(--muted)"></h3><div class=tool-grid-2><div class=tool-field><span class=tool-label></span><input class=tool-input type=number min=0></div><div class=tool-field><span class=tool-label></span><input class=tool-input type=number min=0 max=59></div></div><div class=tool-actions style=margin-top:10px><button class="tool-btn is-primary"></button><button class=tool-btn></button><button class=tool-btn></button></div><pre class=tool-pre style=margin-top:10px;font-size:32px;text-align:center></pre></section><section class=panel style=padding:14px><h3 style="margin:0 0 10px;font-size:14px;color:var(--muted)"></h3><div class=tool-actions><button class="tool-btn is-primary"></button><button class=tool-btn></button><button class=tool-btn></button><button class=tool-btn></button></div><pre class=tool-pre style=margin-top:10px;font-size:32px;text-align:center;font-family:ui-monospace,monospace></pre><!$><!/>'),yt=w('<ul style="list-style:none;margin:10px 0 0;padding:0;display:flex;flex-direction:column;gap:4px;max-height:200px;overflow:auto">'),Ct=w("<li style=display:flex;justify-content:space-between;font-family:ui-monospace,monospace;font-size:13px;color:var(--muted)><span>#<!$><!/></span><span>");const wt=n=>`${String(Math.floor(n/60)).padStart(2,"0")}:${String(n%60).padStart(2,"0")}`,Y=n=>{const o=Math.floor(n/1e3),e=Math.floor(n%1e3/10);return`${String(Math.floor(o/60)).padStart(2,"0")}:${String(o%60).padStart(2,"0")}.${String(e).padStart(2,"0")}`};function It(){const[n,o]=i(X(),{equals:!1}),e=l=>St(l,n());_t(()=>{const l=a=>{const c=a.detail?.locale;c&&o(c)};window.addEventListener("taitan:locale-change",l),o(X()),V(()=>window.removeEventListener("taitan:locale-change",l))});const[M,Z]=i("5"),[k,tt]=i("0"),[p,g]=i(0),[et,x]=i(!1);let d=null;const r=()=>{d&&(clearInterval(d),d=null)},lt=()=>{if(r(),x(!1),p()<=0){const l=parseInt(M())||0,a=parseInt(k())||0;g(l*60+a)}p()<=0||(d=setInterval(()=>{g(l=>l-1),p()<=0&&(r(),x(!0))},1e3))},[$,I]=i(0),[b,E]=i([]);let u=null,z=0;const f=()=>{u&&(clearInterval(u),u=null)},nt=()=>{f(),z=Date.now()-$(),u=setInterval(()=>I(Date.now()-z),30)},st=()=>{f(),I(0),E([])},it=()=>{$()>0&&E(l=>[$(),...l])};return V(()=>{r(),f()}),(()=>{var l=C(ht),a=l.firstChild,c=a.firstChild,L=c.nextSibling,D=L.firstChild,T=D.firstChild,R=T.nextSibling,at=D.nextSibling,j=at.firstChild,q=j.nextSibling,N=L.nextSibling,m=N.firstChild,_=m.nextSibling,A=_.nextSibling,ot=N.nextSibling,H=a.nextSibling,P=H.firstChild,B=P.nextSibling,v=B.firstChild,S=v.nextSibling,h=S.nextSibling,F=h.nextSibling,G=B.nextSibling,rt=G.nextSibling,[ct,pt]=O(rt.nextSibling);return t(c,()=>e("倒计时")),t(T,()=>e("分")),R.$$input=s=>Z(s.currentTarget.value),t(j,()=>e("秒")),q.$$input=s=>tt(s.currentTarget.value),m.$$click=lt,t(m,()=>e("开始")),_.$$click=r,t(_,()=>e("暂停")),A.$$click=()=>{r(),g(0),x(!1)},t(A,()=>e("重置")),t(ot,(()=>{var s=Q(()=>!!et());return()=>s()?"时间到！":wt(p())})()),t(P,()=>e("秒表")),v.$$click=nt,t(v,()=>e("开始")),S.$$click=f,t(S,()=>e("暂停")),h.$$click=st,t(h,()=>e("重置")),F.$$click=it,t(F,()=>e("计次")),t(G,()=>Y($())),t(H,(()=>{var s=Q(()=>b().length>0);return()=>s()&&(()=>{var J=C(yt);return t(J,()=>b().map((dt,$t)=>(()=>{var K=C(Ct),y=K.firstChild,ut=y.firstChild,ft=ut.nextSibling,[gt,xt]=O(ft.nextSibling),bt=y.nextSibling;return t(y,()=>b().length-$t,gt,xt),t(bt,()=>Y(dt)),K})())),J})()})(),ct,pt),U(()=>W(R,"value",M())),U(()=>W(q,"value",k())),vt(),l})()}mt(["input","click"]);export{It as default};
