import{k as ke,j as c,t as Ee,h as X,m as k,n as s,p as e,q as Z,i as $,v as Le,A as L,x as g,s as Me}from"./web.Os7kOAdY.js";import{g as ee,t as Te}from"./i18n-runtime._BAkvU05.js";var ze=L('<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=date></div><div class=tool-field><span class=tool-label></span><input class=tool-input type=date></div></div><!$><!/></section><section class=panel style=padding:14px><h3 style="margin:0 0 10px;font-size:14px;color:var(--muted)"></h3><div class=tool-field><span class=tool-label></span><input class=tool-input type=date></div><div class=tool-grid-2 style=margin-top:10px><div class=tool-field><span class=tool-label></span><input class=tool-input type=number></div><div class=tool-field><span class=tool-label></span><select class=tool-input><option value=d></option><option value=w></option><option value=m></option><option value=y></option></select></div></div><!$><!/>'),Ne=L("<pre class=tool-pre style=margin-top:10px;font-size:18px;text-align:center><!$><!/> <!$><!/><!$><!/> <!$><!/><!$><!/> <!$><!/>"),Ie=L("<pre class=tool-pre style=margin-top:10px;font-size:18px;text-align:center><!$><!/> · <!$><!/>");const E=()=>new Date().toISOString().slice(0,10);function Fe(){const[te,M]=c(ee(),{equals:!1}),n=l=>Te(l,te());Ee(()=>{const l=t=>{const o=t.detail?.locale;o&&M(o)};window.addEventListener("taitan:locale-change",l),M(ee()),Me(()=>window.removeEventListener("taitan:locale-change",l))});const[b,le]=c(E()),[v,ne]=c(E()),[f,ie]=c(E()),[T,ae]=c("7"),[z,se]=c("d"),p=X(()=>{if(!b()||!v())return null;const l=new Date(b()),t=new Date(v()),o=Math.abs(t.getTime()-l.getTime()),r=Math.round(o/864e5),_=Math.floor(r/7),u=r%7;return{days:r,weeks:_,remDays:u}}),S=X(()=>{if(!f())return null;const l=parseInt(T());if(isNaN(l))return null;const t=new Date(f());switch(z()){case"d":t.setDate(t.getDate()+l);break;case"w":t.setDate(t.getDate()+l*7);break;case"m":t.setMonth(t.getMonth()+l);break;case"y":t.setFullYear(t.getFullYear()+l);break}return{date:t.toISOString().slice(0,10),weekday:t.toLocaleDateString("zh-CN",{weekday:"long"})}});return(()=>{var l=k(ze),t=l.firstChild,o=t.firstChild,r=o.nextSibling,_=r.firstChild,u=_.firstChild,N=u.nextSibling,oe=_.nextSibling,I=oe.firstChild,O=I.nextSibling,re=r.nextSibling,[ce,de]=s(re.nextSibling),q=t.nextSibling,F=q.firstChild,R=F.nextSibling,Y=R.firstChild,j=Y.nextSibling,A=R.nextSibling,B=A.firstChild,H=B.firstChild,P=H.nextSibling,$e=B.nextSibling,U=$e.firstChild,h=U.nextSibling,G=h.firstChild,J=G.nextSibling,K=J.nextSibling,ge=K.nextSibling,pe=A.nextSibling,[_e,ue]=s(pe.nextSibling);return e(o,()=>n("日期间隔")),e(u,()=>n("开始日期")),N.addEventListener("change",i=>le(i.currentTarget.value)),e(I,()=>n("结束日期")),O.addEventListener("change",i=>ne(i.currentTarget.value)),e(t,(()=>{var i=Z(()=>!!p());return()=>i()&&(()=>{var a=k(Ne),m=a.firstChild,[d,y]=s(m.nextSibling),C=d.nextSibling,w=C.nextSibling,[x,D]=s(w.nextSibling),xe=x.nextSibling,[Q,be]=s(xe.nextSibling),ve=Q.nextSibling,fe=ve.nextSibling,[V,Se]=s(fe.nextSibling),he=V.nextSibling,[W,me]=s(he.nextSibling),ye=W.nextSibling,Ce=ye.nextSibling,[we,De]=s(Ce.nextSibling);return e(a,()=>p().days,d,y),e(a,()=>n("天 ≈"),x,D),e(a,()=>p().weeks,Q,be),e(a,()=>n("周"),V,Se),e(a,()=>p().remDays,W,me),e(a,()=>n("天"),we,De),a})()})(),ce,de),e(F,()=>n("日期偏移")),e(Y,()=>n("基准日期")),j.addEventListener("change",i=>ie(i.currentTarget.value)),e(H,()=>n("偏移量（可负）")),P.$$input=i=>ae(i.currentTarget.value),e(U,()=>n("单位")),h.addEventListener("change",i=>se(i.currentTarget.value)),e(G,()=>n("天")),e(J,()=>n("周")),e(K,()=>n("月")),e(ge,()=>n("年")),e(q,(()=>{var i=Z(()=>!!S());return()=>i()&&(()=>{var a=k(Ie),m=a.firstChild,[d,y]=s(m.nextSibling),C=d.nextSibling,w=C.nextSibling,[x,D]=s(w.nextSibling);return e(a,()=>S().date,d,y),e(a,()=>S().weekday,x,D),a})()})(),_e,ue),$(()=>g(N,"value",b())),$(()=>g(O,"value",v())),$(()=>g(j,"value",f())),$(()=>g(P,"value",T())),$(()=>g(h,"value",z())),Le(),l})()}ke(["input"]);export{Fe as default};
