!function(){"use strict";var t=function(t){this.types=["d","h","i","s"],this.elements={},this.remaining={total:0,s:0,i:0,h:0,d:0},this.init=function(){if(this.finish=t.getAttribute("data-finish"),this.finish){if(this.useZero=t.getAttribute("data-zero"),this.endtime=new Date(this.finish),this.endTimeDate=Date.parse(this.endtime),this.endTimeDate-this.nowDate()<=0)return t.parentElement.remove();this.makeElements(),requestAnimationFrame(this.updateClock)}},this.nowDate=function(){return Date.parse(new Date)},this.makeElements=function(){this.types.forEach((e=>{this.elements[e]=t.querySelector(`.--${e} .__number`)}))},this.getTimeRemaining=function(){this.remaining.total=this.endTimeDate-this.nowDate(),this.remaining.s=Math.floor(this.remaining.total/1e3%60),this.remaining.i=Math.floor(this.remaining.total/1e3/60%60),this.remaining.h=Math.floor(this.remaining.total/36e5%24),this.remaining.d=Math.floor(this.remaining.total/864e5)},this.updateClock=()=>{this.getTimeRemaining(),Object.keys(this.elements).forEach((t=>{if(this.elements[t]){var e=this.remaining[t];this.useZero&&(e="d"===t?this.remaining.d:("0"+this.remaining[t]).slice(-2)),this.elements[t].setAttribute("data-val",e)}})),this.remaining.total<=0||requestAnimationFrame(this.updateClock)},this.init()},e=function(e){(e||document).querySelectorAll(".rey-countDown").forEach((e=>{new t(e)}))};document.addEventListener("rey-DOMContentLoaded",(function(t){e()})),rey.hooks.addAction("after_quickview_effect",(function(t){e(t)})),rey.hooks.addAction("ajaxfilters/finished",(function(t){e(t)})),rey.hooks.addAction("product/loaded",(function(t){t.forEach((t=>{e(t)}))}))}();