1class a{constructor(t){this.element=t,this.targetDate=new Date(t.getAttribute("data-target-date")),this.interval=null,this.init()}init(){this.update(),this.interval=setInterval(()=>this.update(),1e3)}update(){const t=new Date,e=this.targetDate-t;if(e<=0){this.stop(),this.displayComplete();return}const s=this.calculateTimeUnits(e);this.displayTime(s)}calculateTimeUnits(t){const e=Math.floor(t/1e3%60),s=Math.floor(t/(1e3*60)%60),n=Math.floor(t/(1e3*60*60)%24),i=Math.floor(t/(1e3*60*60*24));return{days:this.padZero(i),hours:this.padZero(n),minutes:this.padZero(s),seconds:this.padZero(e)}}padZero(t){return String(t).padStart(2,"0")}displayTime(t){Object.entries(t).forEach(([e,s])=>{const n=this.element.querySelector(`[data-unit="${e}"]`);n&&n.textContent!==s&&(n.style.opacity="0.5",setTimeout(()=>{n.textContent=s,n.style.opacity="1"},50))})}displayComplete(){this.displayTime({days:"00",hours:"00",minutes:"00",seconds:"00"}),this.element.classList.add("countdown-complete"),this.element.dispatchEvent(new CustomEvent("countdownComplete"))}stop(){this.interval&&(clearInterval(this.interval),this.interval=null)}destroy(){this.stop()}}const r=()=>{const o=document.querySelectorAll(".countdown-timer"),t=[];return o.forEach(e=>{const s=new a(e);t.push(s)}),t};export{r as default};
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.