import{u as k}from"./widget-qjKd4HCd.js";import{t as l,M as y}from"./timezones-CFlADjC_.js";import{b as L,c as m,h as d,t as c,z as a,E as u,H as f,u as S,l as M,x,y as D}from"./vue-y3KLWBaS.js";import{n as O}from"./app-JmgyQoR0.js";const P={key:0,class:"label"},B={class:"time"},N={key:1,class:"label"},p="digitalClock",V=L({__name:"digital-clock",props:{widget:{}},emits:["updateProps"],setup(b,{expose:w,emit:_}){const g={transparent:{type:"boolean",default:!1},fontSize:{type:"number",default:1.5,step:.1},showMs:{type:"boolean",default:!0},showLabel:{type:"boolean",default:!0},timezone:{type:"enum",default:null,enum:[...l.map(t=>({label:t.name,value:t.name.toLowerCase()})),{label:"(auto)",value:null}]}},i=b,v=_,{widgetProps:e,configure:z}=k(p,g,i,v),h=m(()=>{var t,o,n;return(n=e.timezone===null?(t=l.find(r=>r.name.toLowerCase()===Intl.DateTimeFormat().resolvedOptions().timeZone.toLowerCase()))==null?void 0:t.abbrev:(o=l.find(r=>r.name.toLowerCase()===e.timezone))==null?void 0:o.abbrev)!=null?n:"?"}),s=m(()=>{var t,o;return e.timezone===null?0-new Date().getTimezoneOffset():(o=(t=l.find(n=>n.name.toLowerCase()===e.timezone))==null?void 0:t.offset)!=null?o:0}),C=m(()=>(s.value>=0?"+":"-")+Math.floor(s.value/60).toString().padStart(2,"0")+":"+(s.value%60).toString().padStart(2,"0"));return w({name:p,configure:z,id:i.widget?i.widget.id:null}),(t,o)=>(d(),c("div",{class:x(["mkw-digitalClock _monospace",{_panel:!a(e).transparent}]),style:D({fontSize:`${a(e).fontSize}em`})},[a(e).showLabel?(d(),c("div",P,u(h.value),1)):f("",!0),S("div",B,[M(y,{"show-ms":a(e).showMs,offset:s.value},null,8,["show-ms","offset"])]),a(e).showLabel?(d(),c("div",N,u(C.value),1)):f("",!0)],6))}}),F=O(V,[["__scopeId","data-v-a0fd15b1"]]);export{F as default};
