1import{g as a,i as n}from"./theme-scripts-1790236810.js";class o extends HTMLElement{constructor(){super(),this.initializeMessages()}async initializeMessages(){try{this.storeCountry=this.dataset.storeCountry||null;const t=await a();this.filterMessagesByRegion(t),this.initAnimation()}catch(t){console.error("Error initializing announcement bar:",t)}}filterMessagesByRegion(t){this.querySelectorAll(".text-animation-slider__item").forEach(e=>{const s=e.dataset.countries;s==="global"||this.isMessageValidForRegion(s,t)||e.remove()})}matchesRegion(t,e){return e?n(e,t)||t===e:!1}isMessageValidForRegion(t,e){const s=window.storeSelectorConfig?.regions;switch(t){case"global":return!0;case"unsupported":return!s||!e?!1:!Object.values(s).some(i=>i.countryCodes.includes(e));default:return this.matchesRegion(t,e)||this.matchesRegion(t,this.storeCountry)}}initAnimation(){if(this.animateContainer=this.querySelector(".text-animation-slider__container"),!!this.animateContainer&&(this.animateSlider=this.querySelector(".text-animation-slider__slider"),this.animatedItems=this.animateSlider.querySelectorAll(".text-animation-slider__item"),!!this.animatedItems.length)){if(this.animatedItems.length===1){const t=this.animatedItems[0];t.style.transition="none",t.style.transform="translate3d(0, 0, 0)",t.classList.add("active");return}this.animatedItems[0].classList.add("active","animated"),this.animateTextTimeout=null,this.animateTextTimeoutResize=null,this.firstLoad=!0,this.paused=!1,this.manualControl=!1,this.autoRotate=this.dataset.autoRotate!=="false",this.animateDuration=parseInt(this.dataset.speed||this.animateSlider.dataset.delay,10)||5e3,this.animatedItems.length>1&&(this.addEventListener("mouseenter",()=>this.pauseAnimation()),this.addEventListener("mouseleave",()=>this.resumeAnimation()),this.addEventListener("focusin",()=>this.pauseAnimation()),this.addEventListener("focusout",()=>this.resumeAnimation())),this.prevBtn=this.querySelector("[data-announcement-prev]"),this.nextBtn=this.querySelector("[data-announcement-next]"),this.animatedItems.length>1&&(this.prevBtn&&this.prevBtn.classList.remove("tw-hidden"),this.nextBtn&&this.nextBtn.classList.remove("tw-hidden"),this.prevBtn&&this.prevBtn.addEventListener("click",()=>{this.stopAutoRotate(),this.goToPrev()}),this.nextBtn&&this.nextBtn.addEventListener("click",()=>{this.stopAutoRotate(),this.goToNext()}),this.autoRotate&&this.animate())}}goToNext(){const t=this.animateSlider.querySelector(".active");if(!t)return;const e=t.nextElementSibling||this.animateSlider.firstElementChild;this.transitionTo(t,e)}goToPrev(){const t=this.animateSlider.querySelector(".active");if(!t)return;const e=t.previousElementSibling||this.animateSlider.lastElementChild;this.transitionTo(t,e,!0)}transitionTo(t,e,s=!1){const i={noAnimation:"animated",animateIn:"animate-in",animateOut:"animate-out",active:"active"};t.classList.add(i.animateOut),t.classList.remove(i.active,i.noAnimation,i.animateIn),e.classList.remove(i.animateOut,i.noAnimation),e.classList.add(i.active,i.animateIn)}clearTimer(){this.animateTextTimeout&&(clearTimeout(this.animateTextTimeout),this.animateTextTimeout=null)}stopAutoRotate(){this.manualControl=!0,this.clearTimer()}pauseAnimation(){this.paused||(this.paused=!0,this.clearTimer())}resumeAnimation(){this.paused&&(this.paused=!1,this.autoRotate&&!this.manualControl&&this.animate())}animate(){this.clearTimer(),this.animateTextTimeout=setTimeout(()=>{this.animateTextTimeout=null,!this.paused&&(this.goToNext(),this.firstLoad=!1,this.animate())},this.animateDuration)}disconnectedCallback(){this.animateTextTimeout&&clearTimeout(this.animateTextTimeout),this.animateTextTimeoutResize&&clearTimeout(this.animateTextTimeoutResize)}}customElements.define("announcement-bar",o); 2//# sourceMappingURL=/cdn/shop/t/33/assets/novicell_announcement-bar-17902368102.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.