!function(){"use strict";var t=window.ctFrontend;window.jQuery;const{days_label:e,hours_label:n,min_label:a,sec_label:o}=blc_woo_extra_product_sale_countdown;let s=null;const r=function(t){const e=new Date(t).getTime()-(new Date).getTime();return{days:Math.floor(e/864e5),hours:Math.floor(e%864e5/36e5),minutes:Math.floor(e%36e5/6e4),seconds:Math.floor(e%6e4/1e3),dateDiff:e}},c=function(t){clearInterval(s);const d=document.querySelector(".ct-product-sale-countdown");if(!d.querySelector("[data-date]"))return function(t,s){if(!t)return;const{days:c,hours:d,minutes:l,seconds:u}=r(s);t.insertAdjacentHTML("beforeend",`<div data-date="${s}">\n    <span><b>${`${c}`.padStart(2,"0")}</b><small>${e}</small></span>\n    <span><b>${`${d}`.padStart(2,"0")}</b><small>${n}</small></span>\n    <span><b>${`${l}`.padStart(2,"0")}</b><small>${a}</small></span>\n    <span><b>${`${u}`.padStart(2,"0")}</b><small>${o}</small></span>\n  </div>`)}(d,t),void setTimeout(function(){c(t)});s=setInterval(function(){const{days:e,hours:n,minutes:a,seconds:o,dateDiff:c}=r(t);[e,n,a,o].forEach(function(t,e){const n=d.querySelector(`span:nth-of-type(${e+1}) b`);n&&(n.innerHTML=`${t}`.padStart(2,"0"))}),c<=1e3&&clearInterval(s)},1e3)},d=function(){const t=document.querySelector(".ct-product-sale-countdown [data-date]");t&&t.remove()};(0,t.registerDynamicChunk)("blocksy_ext_woo_extra_countdown",{mount:function(t,{event:e,eventData:n}){if("reset_data"===e.type||"found_variation"===e.type){var a;if(n)null!==(a=n.date_on_sale_to)&&void 0!==a&&a.date?c(n.date_on_sale_to.date):d();else d();return}const o=document.querySelector(".product .ct-product-sale-countdown [data-date]");o&&c(o.dataset.date)}})}();