var _=(t,r,n)=>{if(!r.has(t))throw TypeError("Cannot "+n)};var y=(t,r,n)=>(_(t,r,"read from private field"),n?n.call(t):r.get(t)),f=(t,r,n)=>{if(r.has(t))throw TypeError("Cannot add the same private member more than once");r instanceof WeakSet?r.add(t):r.set(t,n)},L=(t,r,n,d)=>(_(t,r,"write to private field"),d?d.call(t,n):r.set(t,n),n);var l=(t,r,n)=>(_(t,r,"access private method"),n);(function(t,r){typeof exports=="object"&&typeof module<"u"?r(exports):typeof define=="function"&&define.amd?define(["exports"],r):(t=typeof globalThis<"u"?globalThis:t||self,r(t["wc-clock"]={}))})(this,function(t){var k,m,p,u,v,g,E,b,x;"use strict";const r=`\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
\r
`,n={get componentName(){return"wc-clock"},get componentAttributes(){return{"minutes-ticks":"minutes-ticks","hours-ticks":"hours-ticks","time-zone":"time-zone","fixed-time":"fixed-time","hours-labels":"hours-labels"}},get componentTemplate(){const w=document.createElement("template");return w.innerHTML=r,w},get hoursLabels(){return Array.from({length:12},(w,T)=>T+1)},get fixedTime(){return[10,10,30]},get timeZone(){return"Europe/Paris"}},h=class h extends HTMLElement{constructor(){super();f(this,m);f(this,u);f(this,g);f(this,b);f(this,k,void 0);this.attachShadow({mode:"open"});const c=n.componentTemplate.content.cloneNode(!0);this.shadowRoot.append(c),this.hoursLabels=n.hoursLabels}static get tagName(){return n.componentName}static get attributes(){return n.componentAttributes}static get observedAttributes(){return Object.values(h.attributes)}connectedCallback(){l(this,m,p).call(this)}disconnectedCallback(){clearInterval(y(this,k))}attributeChangedCallback(c,o,e){switch(c){case h.attributes["hours-labels"]:this.hoursLabels=e===""?n.hoursLabels:e?e.split(","):[],l(this,g,E).call(this);break;case h.attributes["minutes-ticks"]:l(this,b,x).call(this,e===""?Array.from({length:60},(s,i)=>{if(i%5!=0)return i}).filter(Number):[],!1);break;case h.attributes["hours-ticks"]:l(this,b,x).call(this,e===""?Array.from({length:12},(s,i)=>i*5):[]);break;case h.attributes["time-zone"]:this.timeZone=Intl.supportedValuesOf("timeZone").includes(e)?e:n.timeZone,l(this,m,p).call(this);break;case h.attributes["fixed-time"]:this.fixedTime=e===""?n.fixedTime:e&&e.split(":").map(Number)||null,l(this,m,p).call(this);break}}};k=new WeakMap,m=new WeakSet,p=function(){clearInterval(y(this,k));const c=this.shadowRoot.getElementById("wc-clock__clock-hours-hand"),o=this.shadowRoot.getElementById("wc-clock__clock-minutes-hand"),e=this.shadowRoot.getElementById("wc-clock__clock-seconds-hand");if(this.fixedTime){let s=new Date;s.setHours(...this.fixedTime),l(this,u,v).call(this,{date:s,hourHand:c,minuteHand:o,secondHand:e})}else{let s=new Date(new Date().toLocaleString("en",{timeZone:this.timeZone}));l(this,u,v).call(this,{date:s,hourHand:c,minuteHand:o,secondHand:e}),L(this,k,setInterval(()=>{s=new Date(new Date().toLocaleString("en",{timeZone:this.timeZone})),l(this,u,v).call(this,{date:s,hourHand:c,minuteHand:o,secondHand:e})},1e3))}},u=new WeakSet,v=function({date:c,hourHand:o,minuteHand:e,secondHand:s}){let i=c.getHours(),a=c.getMinutes(),I=c.getSeconds(),$=6*a,j=6*I,R=30*i+a/2;o.style.transform=`rotate(${R}deg)`,e.style.transform=`rotate(${$}deg)`,s.style.transform=`rotate(${j}deg)`},g=new WeakSet,E=function(){const c=this.shadowRoot.getElementById("wc-clock__clock-labels");let o=12/this.hoursLabels.length^0;c.replaceChildren(...this.hoursLabels.map((e,s)=>{let i=document.createElement("span");return i.innerHTML=`${e}`,i.style.setProperty("--a",(s+1)*o),i}))},b=new WeakSet,x=function(c,o=!0){const e=this.shadowRoot.getElementById("wc-clock__clock-ticks");let s=e.querySelectorAll(`[id^=${o?"minutes":"hours"}-ticks]`);e.replaceChildren(...c.map(i=>{let a=document.createElement("span");return a.id=`${o?"hours":"minutes"}-ticks-${i}`,a.style.setProperty("--ta",i),a.style.setProperty("--clock-tick-color",`var( --clock-${o?"hours":"minutes"}-ticks-color)`),a.style.setProperty("--clock-tick-width",`var(--clock-${o?"hours":"minutes"}-ticks-width)`),a.style.setProperty("--clock-tick-height",`var(--clock-${o?"hours":"minutes"}-ticks-height)`),a}),...s)};let d=h;customElements.define(d.tagName,d),t.ClockComponent=d,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})});