1import{d as b,r as k,i as R,c as h,b as I,e as i,g as $,G as g,I as y,x as T,t as w,H as p,a as P}from"./Log-Doit1wRw.js";import{F as A,m as C,$ as _,ag as N,c as x,ah as U,l as V,p as O,r as D,D as B,E as F}from"./UniqueID-DtPsK7aS.js";import{_ as L}from"./_plugin-vue_export-helper-BBVhB0HT.js";var j=V("timer").parts("root","area","control","item","itemValue","itemLabel","actionTrigger","separator"),m=j.build(),H=e=>e.ids?.root??`timer:${e.id}:root`,K=e=>e.ids?.area??`timer:${e.id}:area`,E=new Set(["start","pause","resume","reset","restart"]);function G(e,t){const{state:r,send:n,computed:s,scope:l}=e,u=r.matches("running"),a=r.matches("paused"),v=s("time"),d=s("formattedTime"),o=s("progressPercent");return{running:u,paused:a,time:v,formattedTime:d,progressPercent:o,start(){n({type:"START"})},pause(){n({type:"PAUSE"})},resume(){n({type:"RESUME"})},reset(){n({type:"RESET"})},restart(){n({type:"RESTART"})},getRootProps(){return t.element({id:H(l),...m.root.attrs})},getAreaProps(){return t.element({role:"timer",id:K(l),"aria-label":`${v.days} days ${d.hours}:${d.minutes}:${d.seconds}`,"aria-atomic":!0,...m.area.attrs})},getControlProps(){return t.element({...m.control.attrs})},getItemProps(c){const M=v[c.type];return t.element({...m.item.attrs,"data-type":c.type,style:{"--value":M}})},getItemLabelProps(c){return t.element({...m.itemLabel.attrs,"data-type":c.type})},getItemValueProps(c){return t.element({...m.itemValue.attrs,"data-type":c.type})},getSeparatorProps(){return t.element({"aria-hidden":!0,...m.separator.attrs})},getActionTriggerProps(c){if(!E.has(c.action))throw new Error(`[zag-js] Invalid action: ${c.action}. Must be one of: ${Array.from(E).join(", ")}`);return t.button({...m.actionTrigger.attrs,hidden:U(c.action,{start:()=>u||a,pause:()=>!u,reset:()=>!u&&!a,resume:()=>!a,restart:()=>!1}),type:"button",onClick(M){M.defaultPrevented||n({type:c.action.toUpperCase()})}})}}}var q=A({props({props:e}){return X(e),{interval:1e3,startMs:0,...e}},initialState({prop:e}){return e("autoStart")?"running":"idle"},context({prop:e,bindable:t}){return{currentMs:t(()=>({defaultValue:e("startMs")}))}},watch({track:e,send:t,prop:r}){e([()=>r("startMs")],()=>{t({type:"RESTART"})})},on:{RESTART:{target:"running:temp",actions:["resetTime"]}},computed:{time:({context:e})=>J(e.get("currentMs")),formattedTime:({computed:e})=>W(e("time")),progressPercent:C(({context:e,prop:t})=>[e.get("currentMs"),t("targetMs"),t("startMs"),t("countdown")],([e,t=0,r,n])=>{const s=n?S(e,t,r):S(e,r,t);return x(s,0,1)})},states:{idle:{on:{START:{target:"running"},RESET:{actions:["resetTime"]}}},"running:temp":{effects:["waitForNextTick"],on:{CONTINUE:{target:"running"}}},running:{effects:["keepTicking"],on:{PAUSE:{target:"paused"},TICK:[{target:"idle",guard:"hasReachedTarget",actions:["invokeOnComplete"]},{actions:["updateTime","invokeOnTick"]}],RESET:{actions:["resetTime"]}}},paused:{on:{RESUME:{target:"running"},RESET:{target:"idle",actions:["resetTime"]}}}},implementations:{effects:{keepTicking({prop:e,send:t}){return N(({deltaMs:r})=>{t({type:"TICK",deltaMs:r})},e("interval"))},waitForNextTick({send:e}){return _(()=>{e({type:"CONTINUE"})},0)}},actions:{updateTime({context:e,prop:t,event:r}){const n=t("countdown")?-1:1,s=Q(r.deltaMs,t("interval"));e.set("currentMs",l=>{const u=l+n*s;let a=t("targetMs");return a==null&&t("countdown")&&(a=0),t("countdown")&&a!=null?Math.max(u,a):!t("countdown")&&a!=null?Math.min(u,a):u})},resetTime({context:e,prop:t}){let r=t("targetMs");r==null&&t("countdown")&&(r=0),e.set("currentMs",t("startMs")??0)},invokeOnTick({context:e,prop:t,computed:r}){t("onTick")?.({value:e.get("currentMs"),time:r("time"),formattedTime:r("formattedTime")})},invokeOnComplete({prop:e}){e("onComplete")?.()}},guards:{hasReachedTarget:({context:e,prop:t})=>{let r=t("targetMs");if(r==null&&t("countdown")&&(r=0),r==null)return!1;const n=e.get("currentMs");return t("countdown")?n<=r:n>=r}}}});function J(e){const t=Math.max(0,e),r=t%1e3,n=Math.floor(t/1e3)%60,s=Math.floor(t/(1e3*60))%60,l=Math.floor(t/(1e3*60*60))%24;return{days:Math.floor(t/(1e3*60*60*24)),hours:l,minutes:s,seconds:n,milliseconds:r}}function S(e,t,r){const n=r-t;return n===0?0:(e-t)/n}function f(e,t=2){return e.toString().padStart(t,"0")}function Q(e,t){return Math.floor(e/t)*t}function W(e){const{days:t,hours:r,minutes:n,seconds:s}=e;return{days:f(t),hours:f(r),minutes:f(n),seconds:f(s),milliseconds:f(e.milliseconds,3)}}function X(e){const{startMs:t,targetMs:r,countdown:n,interval:s}=e;if(s!=null&&(typeof s!="number"||s<=0))throw new Error(`[timer] Invalid interval: ${s}. Must be a positive number.`);if(t!=null&&(typeof t!="number"||t<0))throw new Error(`[timer] Invalid startMs: ${t}. Must be a non-negative number.`);if(r!=null&&(typeof r!="number"||r<0))throw new Error(`[timer] Invalid targetMs: ${r}. Must be a non-negative number.`);if(n&&t!=null&&r!=null&&t<=r)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than targetMs (${r}).`);if(!n&&t!=null&&r!=null&&t>=r)throw new Error(`[timer] Invalid stopwatch configuration: startMs (${t}) must be less than targetMs (${r}).`);if(n&&r==null&&t!=null&&t<=0)throw new Error(`[timer] Invalid countdown configuration: startMs (${t}) must be greater than 0 when no targetMs is provided.`)}O()(["autoStart","countdown","getRootNode","id","ids","interval","onComplete","onTick","startMs","targetMs"]);const Y={key:0,style:{"min-height":"58px"}},Z={class:"segment stack"},z=["data-day-chars"],tt={class:"segment stack"},et={class:"segment stack"},rt={class:"segment stack"},nt=b({__name:"AlloyTimer",props:{duration:{default:"0"},currentDate:{}},setup(e){const t=e,r=`timer_${D()}`,n=Number.parseInt(t.duration,10),s=Math.max(Math.round(n/1e3)*1e3,0),l=k(!1),u=B(q,{id:r,countdown:!0,autoStart:!0,interval:1e3,startMs:s,onComplete(){l.value=!0}}),a=R(()=>G(u,F));function v(d){const o=Number.parseInt(d,10);return o>9?o>99?"3":"2":"1"}return(d,o)=>(P(),h("div",null,[l.value?(P(),h("div",Y,[i("div",{id:r}),$(d.$slots,"complete",{},void 0,!0)])):I("",!0),l.value?I("",!0):(P(),h("div",g(y({key:1},a.value.getRootProps())),[i("div",y({class:"countdown"},a.value.getAreaProps()),[i("div",Z,[i("div",y(a.value.getItemProps({type:"days"}),{"data-day-chars":v(a.value.formattedTime.days)}),w(a.value.formattedTime.days),17,z),o[0]||(o[0]=T(" Days ",-1))]),i("div",g(p(a.value.getSeparatorProps())),":",16),i("div",tt,[i("div",g(p(a.value.getItemProps({type:"hours"}))),w(a.value.formattedTime.hours),17),o[1]||(o[1]=T(" Hours ",-1))]),i("div",g(p(a.value.getSeparatorProps())),":",16),i("div",et,[i("div",g(p(a.value.getItemProps({type:"minutes"}))),w(a.value.formattedTime.minutes),17),o[2]||(o[2]=T(" Minutes ",-1))]),i("div",g(p(a.value.getSeparatorProps())),":",16),i("div",rt,[i("div",g(p(a.value.getItemProps({type:"seconds"}))),null,16),o[3]||(o[3]=T(" Seconds ",-1))])],16)],16))]))}}),it=L(nt,[["__scopeId","data-v-26d5b372"]]);export{it as A};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.