(()=>{"use strict";function e(e){const t=new Date,n=new Date(e);if(Number.isNaN(n.getTime()))return 0;const o=n.getTime()-t.getTime();return o<=0?0:Math.floor(o/1e3)}function t(e){const t=e=>String(e).padStart(2,"0"),n=Math.floor(e/86400),o=Math.floor(e%86400/3600),r=Math.floor(e%3600/60),s=e%60;return{days:t(n),hours:t(o),minutes:t(r),seconds:t(s)}}function n(e){let t=e;for(;t.lastElementChild;)t=t.lastElementChild;return t}function o({days_dom:e,hours_dom:t,minutes_dom:o,seconds_dom:r,time:s}){e&&(n(e).innerHTML=s.days),t&&(n(t).innerHTML=s.hours),o&&(n(o).innerHTML=s.minutes),r&&(n(r).innerHTML=s.seconds)}window.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll(".countdown-container").forEach(n=>{let r=n.dataset.countdown;r&&e(r)?(n.setAttribute("data-show_finished_message","false"),function(n){if(!n)return null;const r=n.dataset.countdown;if(!r)return null;let s=e(r);if(0==s)return null;const u=n.querySelector(".countdown-value-days"),d=n.querySelector(".countdown-value-hours"),a=n.querySelector(".countdown-value-minutes"),i=n.querySelector(".countdown-value-seconds");let l=setInterval(()=>{if(s<1)try{return n.setAttribute("data-show_finished_message","true"),clearInterval(l)}catch(e){return clearInterval(l)}s-=1;let e=t(s);o({days_dom:u,hours_dom:d,minutes_dom:a,seconds_dom:i,time:e})},1e3),c=t(s);o({days_dom:u,hours_dom:d,minutes_dom:a,seconds_dom:i,time:c})}(n)):n.setAttribute("data-show_finished_message","true"),n.classList.remove("front")})})})();