1if(!customElements.get("slide-show")){class SlideShow extends HTMLElement{constructor(){super(),window.initLazyScript(this,this.init.bind(this))}init(){this.slideshow=this.querySelector(".slideshow"),this.slides=this.querySelectorAll(".slideshow__slide"),this.nav=this.querySelector(".slideshow-nav"),this.pagination=this.querySelector(".slideshow-pagination"),this.rtl=document.dir==="rtl",this.currentIndex=0,this.swipeThreshold=80,this.wheelSensitivity=15,this.nav&&(this.counterCurrent=this.querySelector(".slideshow-nav__counter-current"),this.nav.addEventListener("click",this.handleNavClick.bind(this))),this.pagination&&(this.pageBtns=this.querySelectorAll(".page-btn"),this.pagination.addEventListener("click",this.handlePaginationClick.bind(this))),theme.device.hasTouch&&(this.slideshow.addEventListener("touchstart",this.handleTouchStart.bind(this),{passive:!0}),this.slideshow.addEventListener("touchmove",debounce(this.handleTouchMove.bind(this),200),{passive:!0})),this.slideshow.addEventListener("wheel",this.handleWheel.bind(this),{passive:!1}),this.slideshow.addEventListener("keydown",this.handleKeyDown.bind(this)),this.slideshow.addEventListener("transitionend",SlideShow.handleTransitionend),this.setSlideVisibility(),this.dataset.autoplay==="true"&&this.initAutoPlay()}initAutoPlay(){this.autoplayEnabled=!0,this.autoplaySpeed=this.dataset.speed*1e3,this.addEventListener("mouseover",this.pauseAutoplay.bind(this)),this.addEventListener("mouseleave",this.resumeAutoplay.bind(this)),this.slideshow.addEventListener("focusin",this.pauseAutoplay.bind(this)),this.slideshow.addEventListener("focusout",this.resumeAutoplay.bind(this)),this.addObserver(),this.startAutoplay()}handleNavClick(evt){if(evt.target.matches(".autoplay-btn")){this.togglePlayState(evt);return}evt.target.name==="next"?this.showNextSlide():evt.target.name==="prev"&&this.showPrevSlide()}handlePaginationClick(evt){evt.target.matches(".page-btn")&&(this.autoplayTimeLeft=this.autoplaySpeed,this.setActiveSlide(Number(evt.target.dataset.index)))}handleWheel(evt){evt.deltaX!==0&&evt.preventDefault();const isHorizontal=Math.abs(evt.deltaX)>Math.abs(evt.deltaY),isHorizontalSignificant=Math.abs(evt.deltaX)>this.wheelSensitivity;isHorizontal&&isHorizontalSignificant&&(evt.deltaX>0?this.showNextSlide():this.showPrevSlide())}handleKeyDown(evt){(evt.key==="ArrowLeft"||evt.key==="ArrowRight")&&(evt.preventDefault(),evt.key==="ArrowRight"&&this.showNextSlide(),evt.key==="ArrowLeft"&&this.showPrevSlide())}handleTouchStart(evt){this.touchStart=evt.changedTouches[0].screenX}handleTouchMove(evt){const touchEnd=evt.changedTouches[0].screenX;touchEnd<this.touchStart-this.swipeThreshold&&(this.rtl?this.showPrevSlide():this.showNextSlide()),touchEnd>this.touchStart+this.swipeThreshold&&(this.rtl?this.showNextSlide():this.showPrevSlide())}static handleTransitionend(evt){evt.target.matches(".has-motion")&&evt.target.classList.remove("transition-out")}showNextSlide(){let index=this.currentIndex+1;index===this.slides.length&&(index=0),this.setActiveSlide(index,"next")}showPrevSlide(){let index=this.currentIndex-1;index<0&&(index=this.slides.length-1),this.setActiveSlide(index,"prev")}setActiveSlide(slideIndex,slideDirection){if(slideIndex===this.currentIndex)return;clearTimeout(this.setActiveSlideTimeoutId),clearTimeout(this.autoplayTimer);let dir=slideDirection||(slideIndex<this.currentIndex?"prev":"next");this.rtl&&(dir=dir==="next"?"prev":"next"),this.dataset.direction=dir,this.slides[this.currentIndex].classList.add("transition-out"),this.setActiveSlideTimeoutId=setTimeout(()=>{this.slideshow.scrollTo({left:this.slides[slideIndex].offsetLeft,behavior:"auto"}),this.slides[slideIndex].classList.add("is-active"),this.slides[this.currentIndex].classList.remove("is-active","transition-out");const transitionedEl=this.slides[this.currentIndex].querySelector(".has-motion");transitionedEl&&transitionedEl.classList.add("transition-out"),this.autoplayEnabled&&(this.autoplayStartTime=Date.now()),this.counterCurrent&&(this.counterCurrent.textContent=slideIndex+1),this.currentIndex=slideIndex,this.setSlideVisibility(),this.updatePagination(),this.autoplayEnabled&&!this.autoplayPaused&&(this.autoplayTimeLeft=this.autoplaySpeed,this.autoplayTimer=setTimeout(this.showNextSlide.bind(this),this.autoplaySpeed))},200)}updatePagination(){this.pagination&&this.pageBtns.forEach((el,index)=>{index===this.currentIndex?el.setAttribute("aria-current","true"):el.removeAttribute("aria-current")})}stopAutoplay(){this.setSlideshowState("paused"),clearTimeout(this.autoplayTimer)}startAutoplay(){this.autoplayTimeLeft=null,this.autoplayStartTime=Date.now(),clearTimeout(this.autoplayTimer),this.autoplayTimer=setTimeout(this.showNextSlide.bind(this),this.autoplaySpeed),this.setSlideshowState("running")}pauseAutoplay(){!this.autoplayEnabled||this.autoplayPaused||(this.stopAutoplay(),this.autoplayTimeLeft?this.autoplayTimeLeft-=Date.now()-this.resumedTime:this.autoplayTimeLeft=this.autoplaySpeed-(Date.now()-this.autoplayStartTime))}resumeAutoplay(){!this.autoplayEnabled||!this.autoplayPaused||(this.resumedTime=Date.now(),this.autoplayTimer=setTimeout(this.showNextSlide.bind(this),this.autoplayTimeLeft),this.setSlideshowState("running"))}addObserver(){if(!("IntersectionObserver"in window))return;new IntersectionObserver(entries=>
1{entries.forEach(entry=>{entry.isIntersecting?this.resumeAutoplay():this.pauseAutoplay()})}).observe(this)}setSlideVisibility(){this.slides.forEach((el,index)=>{const btns=el.querySelectorAll("a");index===this.currentIndex?(el.setAttribute("aria-hidden","false"),el.removeAttribute("tabindex"),btns.forEach(btn=>{btn.removeAttribute("tabindex")})):(el.setAttribute("aria-hidden","true"),el.setAttribute("tabindex","-1"),btns.forEach(btn=>{btn.setAttribute("tabindex","-1")}))})}setSlideshowState(state){this.style.setProperty("--play-state",state),this.slideshow.setAttribute("aria-live",state==="running"?"off":"polite"),this.autoplayPaused=state==="paused"}togglePlayState(evt){evt.target.classList.toggle("is-paused"),this.autoplayEnabled=!this.autoplayEnabled,this.dataset.autoplay=this.autoplayEnabled?"true":"false",this.autoplayEnabled?this.startAutoplay():this.stopAutoplay()}}customElements.define("slide-show",SlideShow)} 2//# sourceMappingURL=/cdn/shop/t/21/assets/slideshow.js.map?v=169499975384019479451778575617
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.