(()=>{"use strict";const t=class{constructor(t,e){if(t){if(this.element=t,this.texts=this.element.querySelectorAll(".ablocks-dynamic-text"),this.index=0,this.intervalId=null,this.isLoop="true"===e.isloop||!0===e.isloop,this.highlightDuration=parseInt(e.duration)||2e3,this.txtWrapper=this.element.querySelector(".ablocks-animated-text-wrapper"),this.txtWrapper){const t=Array.from(this.texts).reduce((t,e)=>Math.max(t,e.offsetWidth),0);this.txtWrapper.style.minWidth=`${t}px`}0!==this.texts.length&&(this.texts[0].classList.add("ablocks-dynamic-text-active"),setTimeout(()=>{this.texts.forEach((t,e)=>{0===e?t.classList.add("ablocks-dynamic-text-active"):t.classList.remove("ablocks-dynamic-text-active")})},100),this.startRotation(),document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this)))}}startRotation(){this.stopRotation(),this.intervalId=setInterval(()=>{this.index!==this.texts.length-1||this.isLoop?(this.texts[this.index].classList.remove("ablocks-dynamic-text-active"),this.index++,this.index>=this.texts.length&&this.isLoop&&(this.index=0),this.texts[this.index].classList.add("ablocks-dynamic-text-active")):this.stopRotation()},this.highlightDuration)}stopRotation(){this.intervalId&&(clearInterval(this.intervalId),this.intervalId=null)}handleVisibilityChange(){document.hidden?this.stopRotation():this.startRotation()}},e=class{constructor(t,e){t&&(this.element=t,this.texts=t.querySelectorAll(".ablocks-dynamic-text"),this.currentIndex=0,this.isLoop="true"===e.isloop||!0===e.isloop,this.highlightDuration=parseInt(e.duration)||2e3,this.timeoutId=null,0!==this.texts.length&&(this.texts.forEach(t=>t.classList.remove("ablocks-headline-text-active")),this.showNextText(),document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this))))}showNextText(){this.stopRotation(),this.texts.forEach(t=>{t.classList.remove("ablocks-headline-text-active"),t.querySelectorAll(".ablocks-dynamic-letter").forEach(t=>{t.classList.remove("ablocks-animation-in"),t.offsetWidth})});const t=this.texts[this.currentIndex],e=t.querySelectorAll(".ablocks-dynamic-letter");e.length>0?this.typeSpeed=this.highlightDuration/e.length:this.typeSpeed=this.highlightDuration;let i=0;const s=setInterval(()=>{i<e.length?(e[i].classList.add("ablocks-animation-in"),i++):clearInterval(s)},this.typeSpeed);t.classList.add("ablocks-headline-text-active"),this.currentIndex===this.texts.length-1&&!this.isLoop||(this.currentIndex=(this.currentIndex+1)%this.texts.length,this.timeoutId=setTimeout(()=>this.showNextText(),this.highlightDuration))}stopRotation(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleVisibilityChange(){document.hidden?this.stopRotation():this.showNextText()}},i=class{constructor(t,e){t&&(this.element=t,this.texts=t.querySelectorAll(".ablocks-dynamic-text"),this.currentIndex=0,this.isLoop="true"===e.isloop||!0===e.isloop,this.highlightDuration=parseInt(e.duration)||2e3,this.timeoutId=null,0!==this.texts.length&&(this.texts.forEach(t=>t.classList.remove("ablocks-headline-text-active")),this.showNextText(),document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this))))}showNextText(){this.stopRotation(),this.texts.forEach(t=>{t.classList.remove("ablocks-headline-text-active"),t.querySelectorAll(".ablocks-dynamic-letter").forEach(t=>{t.classList.remove("ablocks-animation-in")})});const t=this.texts[this.currentIndex],e=t.querySelectorAll(".ablocks-dynamic-letter");e.length>0?this.typeSpeed=this.highlightDuration/e.length:this.typeSpeed=this.highlightDuration;let i=0;const s=setInterval(()=>{i<e.length?(e[i].classList.add("ablocks-animation-in"),i++):clearInterval(s)},this.typeSpeed);t.classList.add("ablocks-headline-text-active"),this.currentIndex===this.texts.length-1&&!this.isLoop||(this.currentIndex=(this.currentIndex+1)%this.texts.length,this.timeoutId=setTimeout(()=>this.showNextText(),this.highlightDuration))}stopRotation(){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleVisibilityChange(){document.hidden?this.stopRotation():this.showNextText()}};document.addEventListener("DOMContentLoaded",()=>{!function(){const s=document.querySelectorAll(".ablocks-animated-text"),o=(t,e)=>e.some(e=>t.classList.contains(e));s.forEach(s=>{const h=s.closest(".ablocks-block--heading").dataset;o(s,["ablocks-rotate-slide-down","ablocks-rotate-clip","ablocks-rotate-drop-in","ablocks-rotate-flip","ablocks-rotate-slide"])&&new t(s,h),o(s,["ablocks-rotate-typing"])&&new i(s,h),o(s,["ablocks-rotate-swirl"])&&new e(s,h)})}()})})();