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