var k=Object.defineProperty;var q=i=>{throw TypeError(i)};var D=(i,e,t)=>e in i?k(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var x=(i,e,t)=>D(i,typeof e!="symbol"?e+"":e,t),O=(i,e,t)=>e.has(i)||q("Cannot "+t);var r=(i,e,t)=>(O(i,e,"read from private field"),t?t.call(i):e.get(i)),T=(i,e,t)=>e.has(i)?q("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),H=(i,e,t,s)=>(O(i,e,"write to private field"),s?s.call(i,t):e.set(i,t),t);var l,c,b;const n=class n{static init(){return r(n,l)||H(n,l,new n),r(n,l).initCarousels(document),r(n,l)}static reInit(e=document){if(!r(n,l)){n.init();return}r(n,l).initCarousels(e)}static cleanupHoverZones(e){const t=r(n,c).get(e);t&&(t.abort(),r(n,c).delete(e))}static addHoverNavigationZones(e,t){if(!t.slides||t.slides.length<=1||e.querySelector(".fct-hover-zone")||!window.matchMedia("(hover: hover)").matches)return;const s=r(n,c).get(e);s&&s.abort();const o=new AbortController;r(n,c).set(e,o);const a=document.createElement("div"),d=document.createElement("div");a.className="fct-hover-zone fct-hover-left",d.className="fct-hover-zone fct-hover-right";const h=e.querySelector(".swiper-wrapper");if(h){const g=h.offsetHeight+"px";a.style.height=g,d.style.height=g}let f=!1;const v=g=>{f||(f=!0,g==="prev"?t.slidePrev():t.slideNext(),setTimeout(()=>{f=!1},n.SLIDE_THROTTLE_MS))};a.addEventListener("mouseenter",()=>{v("prev")},{signal:o.signal}),d.addEventListener("mouseenter",()=>{v("next")},{signal:o.signal}),e.appendChild(a),e.appendChild(d)}initCarousels(e=document){if(!e||!e.querySelectorAll)return;const t=e.querySelectorAll(".swiper.fct-product-carousel[data-fluent-cart-product-carousel]");t.length&&t.forEach(s=>{if(s.swiper)return;let o={};try{o=JSON.parse(s.getAttribute("data-carousel-settings")||"{}")}catch{}const a=Math.max(1,Number(o.slidesToShow||3)),d=Number(o.spaceBetween||16),h=s.querySelector(".swiper-button-next"),f=s.querySelector(".swiper-button-prev"),v=s.querySelector(".swiper-pagination"),g=o.pagination==="yes"||o.dots==="yes",Z={bullets:"bullets",dots:"bullets",fraction:"fraction",progress:"progressbar",segmented:"custom"},w=o.autoplay||"no",A=w==="yes"||w==="hover"?{delay:Number(o.autoplayDelay||3e3),disableOnInteraction:!1,pauseOnMouseEnter:w==="yes"}:!1;let L=!1;if(g&&v){const p=Z[o.paginationType]||"bullets";L={el:v,clickable:!0,type:p},o.paginationType==="segmented"&&(L.renderCustom=function(E,u,y){let N="";for(let S=1;S<=y;S++){let C="swiper-pagination-segment";S<u?C+=" is-completed":S===u&&(C+=" is-active"),N+=`<div class="${C}"></div>`}return N+=`<span class="segment-counter">${u} / ${y}</span>`,N})}const V={slidesPerView:a,spaceBetween:d,loop:o.infinite==="yes",grabCursor:!0,watchOverflow:!0,observer:!0,observeParents:!0,rtl:document.documentElement.dir==="rtl",autoplay:A,on:{init(p){o.autoplay==="hover"&&p.autoplay.stop()}},navigation:o.arrows==="yes"&&h&&f?{nextEl:h,prevEl:f}:!1,pagination:L,breakpoints:{0:{slidesPerView:1},640:{slidesPerView:Math.min(2,a)},1024:{slidesPerView:Math.min(3,a)},1280:{slidesPerView:a}}},m=new Swiper(s,V);if(w==="hover"&&m.autoplay){const p=r(n,b).get(s);p&&p.abort();const E=new AbortController;r(n,b).set(s,E);const u=s.querySelector(".swiper-wrapper"),y=s.closest(".fct-product-carousel-wrapper");u&&u.addEventListener("mouseenter",()=>{m.autoplay.start()},{signal:E.signal}),y&&y.addEventListener("mouseleave",()=>{m.autoplay.stop()},{signal:E.signal})}w==="hover"&&n.addHoverNavigationZones(s,m),s.swiper=m})}};l=new WeakMap,c=new WeakMap,b=new WeakMap,T(n,l,null),x(n,"SLIDE_THROTTLE_MS",350),T(n,c,new WeakMap),T(n,b,new WeakMap);let M=n;window.FluentCartProductCarousel=M;document.addEventListener("DOMContentLoaded",()=>{M.init()});
