1import{E as b}from"./embla-carousel.esm-CMPFBS9o.js";import{g as v}from"./index-D3jsOSc0.js";import{S as E}from"./ScrollToPlugin-CZpAVE0J.js";v.registerPlugin(E);class q{constructor(t){this.emblaNode=t,this.viewportNode=this.emblaNode.querySelector("[data-js='product-main-carousel__viewport']"),this.prevButtonNode=this.emblaNode.querySelector("[data-js='product-main-carousel__prev']"),this.nextButtonNode=this.emblaNode.querySelector("[data-js='product-main-carousel__next']"),this.dotNodes=document.querySelectorAll("[data-main-carousel='product-main-carousel__pagination']"),this.miniEmblaNode=document.querySelector("[data-js='product-mini-carousel']"),this.miniViewportNode=this.miniEmblaNode.querySelector("[data-js='product-mini-carousel__viewport']"),this.miniPrevButtonNode=this.miniEmblaNode.querySelector("[data-js='product-mini-carousel__prev']"),this.miniNextButtonNode=this.miniEmblaNode.querySelector("[data-js='product-mini-carousel__next']"),this.miniSlides=this.miniEmblaNode.querySelectorAll('[data-js="product-mini-carousel__slide"]'),this.images=this.emblaNode.querySelectorAll('[data-js="product-main-carousel__slide"]'),this.scrollContainer=this.emblaNode.querySelector("[data-js='product-main-carousel__container']")}init(){const t=b(this.viewportNode,{axis:"x",align:"start",loop:!1,startIndex:0,breakpoints:{"(min-width: 1024px)":{active:!1}}}),i=b(this.miniViewportNode,{axis:"y",align:"start",loop:!1,startIndex:0,inViewThreshold:1}),N=e=>{v.to(this.scrollContainer,{scrollTo:this.images[e]})},p=()=>{t.canScrollPrev()?this.prevButtonNode.removeAttribute("disabled"):this.prevButtonNode.setAttribute("disabled","disabled"),t.canScrollNext()?this.nextButtonNode.removeAttribute("disabled"):this.nextButtonNode.setAttribute("disabled","disabled")},f=()=>{const e=t.selectedScrollSnap();this.images.forEach((o,m)=>{const s=o.querySelector("video");s&&(m===e?s.play().catch(()=>{}):s.pause())})},l=()=>{p(),window.innerWidth<1024&&f()};this.dotNodes.forEach((e,o)=>{e.addEventListener("click",()=>N(o),!1)}),this.prevButtonNode.addEventListener("click",e=>{t.scrollPrev()}),this.nextButtonNode.addEventListener("click",e=>{t.scrollNext()}),t.on("init",l).on("reInit",l).on("select",l),window.addEventListener("main-image-changed",e=>{t&&window.innerWidth<1024&&t.scrollTo(0)});const x=()=>{i.canScrollPrev()?this.miniPrevButtonNode.removeAttribute("disabled"):this.miniPrevButtonNode.setAttribute("disabled","disabled"),i.canScrollNext()?this.miniNextButtonNode.removeAttribute("disabled"):this.miniNextButtonNode.setAttribute("disabled","disabled")},d=()=>{x()};this.miniPrevButtonNode.addEventListener("click",e=>{i.scrollPrev()}),this.miniNextButtonNode.addEventListener("click",e=>{i.scrollNext()}),i.on("init",d).on("reInit",d).on("select",d);let r;const S=()=>{const e={root:this.viewportNode,rootMargin:"10px",threshold:.5};r=new IntersectionObserver((o,m)=>{o.forEach(s=>{let h=Number(s.target.id);const a=s.target.querySelector("video");if(s.isIntersecting){let n=h;a&&a.play().catch(()=>{}),i.scrollTo(n),i.slidesInView().includes(n)||i.scrollTo(n),this.dotNodes.forEach((c,w)=>{w===n&&(c.dataset.active="")})}else a&&a.pause(),this.dotNodes.forEach((n,c)=>{c===h&&delete n.dataset.active})})},e),this.images.forEach(o=>{r.observe(o)})},g=()=>{r&&(r.disconnect(),r=null)},u=()=>{window.matchMedia("(min-width: 1024px)").matches?r||S():g()};u(),window.addEventListener("resize",u)}}export{q as default};
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.