(()=>{var t={81772(t){void 0===TCB_Front.js_modules.countdown&&TCB_Front.setModuleLoadedStatus("countdown",!1),((e,s)=>{if(TCB_Front.isModuleLoaded("countdown"))return;window.addEventListener("load",()=>{s.$body.find(".tve-countdown").each((t,s)=>{new n(e(s),!!TCB_Front.Utils.isEditorPage())})}),e(window).on("tcb_after_dom_ready",()=>{e(".tve-countdown").each((t,s)=>{new n(e(s),!!TCB_Front.Utils.isEditorPage())})}),e(window).on("tve_after_content_toggle",(t,s)=>{TCB_Front.Utils.isEditorPage()||s.find(".tve-countdown").each((t,s)=>{const i=e(s).data("tcb.countdown");i&&i.isVisible()&&i.handleOverflow()})});const i=["days","hours","minutes","seconds"];let a;class n{$el=e();eventDate=new Date;$_days=e();$_hours=e();$_minutes=e();$_seconds=e();daysChanged=!1;hoursChanged=!1;minutesChanged=!1;secondsChanged=!1;daysValue=0;hoursValue=0;minutesValue=0;secondsValue=0;daysPrev=0;hoursPrev=0;minutesPrev=0;secondsPrev=0;isEvergreen=!1;isEditor=!1;interval;anim="";cfg={};isNoRestart=0;cookie;constructor(t,e){if(!e&&a||(a=s.getDisplayType()),!t.data("tcb.countdown")||e){const i=new Date,a=e&&TVE.Components?TVE.Components.countdown.timezone:t.attr("data-timezone");if(this.isEditor=e,this.$el=t,this.readDomData(),this.isEvergreen=this.$el.hasClass("tve-countdown-evergreen"),this.isNoRestart=parseInt(this.$el.attr("data-norestart")),this.isUltimatumCampaign="1"===this.$el.attr("data-ultimatum-campaign"),this.eventDate=new Date(`${this.$el.attr("data-date")}T${this.$el.attr("data-hour")}:${this.$el.attr("data-min")}:${this.$el.attr("data-sec")||"00"}${a}`),this.isEditor?(this.addMutationListener(),this.$el.closest(".thrive-shortcode-html").length&&this.$el.attr("data-keep-css_id",1)):this.isVisible()&&setTimeout(()=>{this.handleOverflow()},1e3),this.isEvergreen){const t=!(this.isEditor||"true"===s.queryString.get("preview"));if(this.eventDate=new Date,this.cookie=s.getCookie(this.$el.attr("data-id")),this.cookie&&t)this.cookie=this.cookie.split("-"),this.eventDate.setTime(new Date(this.cookie[0],this.cookie[1]-1,this.cookie[2],this.cookie[3],this.cookie[4],this.cookie[5]));else{const e=this.$el.attr("data-date"),s=parseInt(this.$el.attr("data-day")||0),n=parseInt(this.$el.attr("data-hour")||0),o=parseInt(this.$el.attr("data-min")||0),r=parseInt(this.$el.attr("data-sec")||0);let h=null;if(this.isUltimatumCampaign&&e){const t=String(n).padStart(2,"0"),s=String(o).padStart(2,"0"),i=String(r).padStart(2,"0");h=new Date(`${e}T${t}:${s}:${i}${a}`)}else{const t=24*s*3600*1e3+3600*n*1e3+60*o*1e3+1e3*r;h=new Date(i.getTime()+t)}if(this.eventDate.setTime(h),t){const t=`${this.eventDate.getFullYear()}-${this.eventDate.getMonth()+1}-${this.eventDate.getDate()}-${this.eventDate.getHours()}-${this.eventDate.getMinutes()}-${this.eventDate.getSeconds()}`;let e=new Date("2030-01-01");if(!this.isNoRestart){const t=new Date(this.eventDate.getTime());e=t.setDate(this.eventDate.getDate()+parseInt(this.$el.attr("data-expday"))),e=t.setHours(this.eventDate.getHours()+parseInt(this.$el.attr("data-exphour"))),e=new Date(e)}TCB_Front.setCookie(this.$el.attr("data-id"),t,{expires:e})}}}!this.isEditor&&(i>=this.eventDate||isNaN(this.eventDate.getTime()))?this.finish():(this.onStateChange(),this.anim&&"function"==typeof this[`render${this.anim}`]&&this[`render${this.anim}`](),this.isEditor||(this.interval=setInterval(this.onStateChange.bind(this),1e3))),t.data("tcb.countdown",this)}}isVisible(){const t=this.$el.closest(".tve_p_lb_background, .tl-lb-target"),e=this.$el.offset();let s=this.$el.is(":visible");return t.length&&!t.hasClass("tve_lb_open")&&(s=!1),s&&e.left<0&&(s=!1),s}finish(){if(i.forEach(t=>{this[`update${this.anim}`]("00","00",this[`$_${t}`])}),!this.isEditor){this.$el.addClass("expired"),clearInterval(this.interval);const t=e.Event("tve.countdown-finished");this.$el.trigger(t)}}onStateChange(){this.updateValues(),this.updateDom(),this.daysValue<=0&&this.hoursValue<=0&&this.minutesValue<=0&&this.secondsValue<=0&&(this.daysValue=this.hoursValue=this.minutesValue=this.secondsValue=0,this.finish())}renderDefault(){i.forEach(t=>{let e=this[`${t}Value`].toString();1===e.length&&(e=`0${e}`),this[`$_${t}`].html(`<div class="t-digit-part"><span>${e}</span></div>`)})}renderSlideDown(){const t=function(t,s){return e(`<span class="t-slide-part-digit" data-index="${t}"><span class="part-p ct-d-placeholder">&nbsp;&nbsp;</span><span class="part-${t}">${s}</span></span>`)};i.forEach(s=>{let i=this[`${s}Value`].toString();const a=e('<div class="t-digit-part"></div>');1===i.length&&(i=`0${i}`);for(let e=0;e<i.length;e++)a.append(t(i.length-e,i[e]));this[`$_${s}`].html(`<div class="t-digit-part"><span class="t-digits" >${a[0].innerHTML}</span></div>`)})}renderFlipTile(){i.forEach(t=>{let e=this[`${t}Value`].toString();1===e.length&&(e=`0${e}`);const i={"--digits-number":e.length,"--digit-width-percent":""+(e.length>2?.55:.65)};s.inlineCssVariable(this[`$_${t}`],i),this[`$_${t}`].html('<div class="flip-clock__card t-digit-part"><span class="card__top"></span><span class="card__bottom"></span><span class="card__back"><span class="card__bottom"></span></span></div>'),this.updateFlipTile(e,new Array(e.length).fill(0).join(""),this[`$_${t}`])})}updateDefault(t,e,s){s.find("span").text(t)}updateSlideDown(t,e,s){const i=s.find(".t-digit-part"),a=(t,e)=>{if(t.html()===e)return t;t.removeClass("next").css("display","");const s=t.clone().removeClass("go-down").addClass("next").html(e);return t.before(s).next(".go-down").remove(),t.addClass("go-down"),setTimeout(function(){s.addClass("go-down")},20),setTimeout(function(){t[0].style.setProperty("display","none","important")},220),t};i.removeClass("tcb-permanently-hidden");for(let e=0;e<i.length-t.length;e++)i.filter(`[data-index="${i.length-e}"]`).addClass("tcb-permanently-hidden");for(let e=0;e<t.length;e++){const i=t.length-e,n=s.find(`.part-${i}`);n.length&&a(n.first(),t[e])}}updateFlipTile(t,e,s){const i=s.find(".card__top"),a=s.find(".card__bottom"),n=s.find(".card__back"),o=s.find(".card__back .card__bottom");Number(e)>=0&&(n.attr("data-value",e),a.attr("data-value",e)),i.html(t),o.attr("data-value",t),s.removeClass("flip"),s[0].offsetWidth,s.addClass("flip")}readDomData(){const t=this.$el.attr("data-anim")||"default";this.anim=t.charAt(0).toUpperCase()+t.slice(1),this.parseConfig(),i.forEach((t,e)=>{const s=this.$el.find(`.tve-countdown-${t}`);let n=!1;if(this[`$_${t}`]=s.find(".tve-countdown-digit"),s.toggleClass("tcb-permanently-hidden",!this.cfg[t]),this.cfg[t]&&this.cfg[a])for(let t=e+1;t<i.length;t++)this.cfg[i[t]]&&(n=!0);s.next(".tve-countdown-tile-separator").toggleClass("tcb-permanently-hidden",!n)})}updateDom(){i.forEach(t=>{if(this[`${t}Changed`]){let e=this[`${t}Value`].toString(),s=this[`${t}Prev`].toString();1===e.length&&(e=`0${e}`),1===s.length&&(s=`0${s}`),this[`update${this.anim}`](e,s,this[`$_${t}`])}})}updateValues(){const t=new Date;i.forEach(t=>{this[`${t}Prev`]=this[`${t}Value`]}),this.secondsValue=Math.floor((this.eventDate.getTime()-t.getTime())/1e3),this.minutesValue=Math.floor(this.secondsValue/60),this.secondsValue=this.secondsValue%60,this.hoursValue=Math.floor(this.minutesValue/60),this.minutesValue=this.minutesValue%60,this.daysValue=Math.floor(this.hoursValue/24),this.hoursValue=this.hoursValue%24,this.cfg.days||(this.hoursValue+=24*this.daysValue),this.cfg.hours||(this.minutesValue+=60*this.hoursValue),this.cfg.minutes||(this.secondsValue+=60*this.minutesValue),i.forEach(t=>{this[`${t}Changed`]=this[`${t}Value`]!==this[`${t}Prev`]})}parseConfig(){this.cfg=s.Utils.jsonParse(this.$el,"data-visible",null,{days:!0,minutes:!0,hours:!0,seconds:!0})}handleOverflow(){if(this.$el[0].parentNode&&this.$el.find(".tve-countdown-content").length&&!this.$el.hasClass("expired")){let t=this.$el.find(".tve-countdown-content")[0].offsetWidth;const e=this.$el.parent().width();if(t+=parseInt(this.$el.css("padding-left"))+parseInt(this.$el.css("padding-right")),e<t){let s=e/t*parseInt(getComputedStyle(this.$el[0]).getPropertyValue("--tve-countdown-size").replace("px",""));this.isEditor?TVE.Components.countdown.handleOverflow(this.$el,s):(s=Math.max(s,20),this.$el[0].style.setProperty("--tve-countdown-size",`${s}px`,"important"))}}}addMutationListener(){let t;const e=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(this.handleOverflow.bind(this))};if(window.ResizeObserver&&!this.$el.data("resize-observer")){const t=new ResizeObserver(e);this.$el.data("resize-observer",t),t.observe(this.$el[0]);const s=new MutationObserver(t=>{Array.from(t).forEach(t=>{"attributes"===t.type&&["class","data-value","id"].includes(t.attributeName)||t.target.classList.contains("tve-countdown")&&"attributes"===t.type&&!["data-visible","data-resize"].includes(t.attributeName)||TVE._.debounce(e,100)})});s.observe(this.$el[0],{attributes:!0}),this.$el.find(".tve-countdown-data .tcb-plain-text, .tve-countdown-data span").each((t,e)=>{s.observe(e,{attributes:!0})})}}}window.TCB_Front.Countdown=n,t.exports=n,TCB_Front.setModuleLoadedStatus("countdown",!0)})(ThriveGlobal.$j,TCB_Front)}},e={};!function s(i){var a=e[i];if(void 0!==a)return a.exports;var n=e[i]={exports:{}};return t[i](n,n.exports,s),n.exports}(81772)})();