1const Q=(n,u)=>{if(new IntersectionObserver((D,e)=>{D.forEach(y=>{y.intersectionRatio>0&&(u(n),e.disconnect())})}).observe(n),!u)return new Promise(D=>u=D)},_=n=>n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth,Y=n=>window.matchMedia("(min-width: 1024px)").matches&&parseInt(n.dataset.carouselPerView)||1;function Z(n,u,D){if(n.classList.contains("carousel-initialized"))return;parseInt(n.style.getPropertyValue("--peek"));const e=n.querySelector(".carousel"),y=n.querySelector(".indicators"),r=Array.from(n.querySelectorAll(".carousel-item")),C=r.length-1,v=n.querySelector(".nav.prev"),L=n.querySelector(".nav.next"),s=Y(n);let l=0,w=null,f=!1,T=!1,W=0,x=0,b=0,V=0,B=0,R=!1,E=0;const j=new Boolean(n.dataset.carouselUseDragDesktop),A=5;Q(e,()=>{z(),S()});const k=t=>{const o=Math.floor(t/s)*s;if(o<0||o>C)return;f=!0,l=o,u&&u(l);const i=r[l],a=e.getBoundingClientRect(),d=i.getBoundingClientRect(),p=d.width*s/2,m=a.width/2,g=d.left-a.left+e.scrollLeft-m+p;e.scrollTo({left:g,behavior:"smooth"}),S();const M=setTimeout(()=>{f=!1},1e3);e.addEventListener("scrollend",()=>{clearTimeout(M),f=!1},{once:!0})},O=t=>{f=!0,t=="previous"&&l>0&&k(l-s),t=="next"&&l<C&&k(l+s),u&&u(l)},S=()=>{if(r.forEach((t,o)=>{t.classList.toggle("active",o===l)}),y&&y.querySelectorAll("button").forEach((t,o,i)=>{if(t.classList.toggle("active",o===l),i.length/s<=5)return;const a=Math.abs(o-l),d=2*s;t.classList.toggle("small",a>=d);const h=3*s;t.classList.toggle("smaller",a>=h);const p=4*s;t.classList.toggle("smallest",a>=p)}),!_(e)){v==null||v.classList.add("unavailable"),L==null||L.classList.add("unavailable");return}v&&v.classList.toggle("unavailable",l===0),L&&L.classList.toggle("unavailable",l>=r.length-s)},G=t=>{if(E>A)return t.preventDefault(),t.stopPropagation(),t.stopImmediatePropagation(),!1},J=t=>{t.button&&t.button!==0||t.target.closest(".indicators")||(T=!0,R=!1,E=0,f=!0,W=t.clientX||t.pageX,x=e.scrollLeft,b=W,B=Date.now(),V=0,e.style.scrollSnapType="none",e.style.cursor="grabbing",e.style.scrollBehavior="auto",document.addEventListener("mousemove",H,{passive:!1}),document.addEventListener("mouseup",I),document.addEventListener("pointercancel",I),t.preventDefault())},H=t=>{if(!T)return;t.preventDefault();const o=t.clientX||t.pageX,i=Date.now(),a=o-W,d=i-B;d>0&&(V=(o-b)/d);const h=x-a;e.scrollLeft=Math.max(0,Math.min(h,e.scrollWidth-e.clientWidth));const p=Math.abs(o-b);E+=p,Math.abs(a)>3&&(R=!0),b=o,B=i,F()},U=(t,o=300)=>{const i=r[t+1];if(!i)return;f=!0,e.style.scrollSnapType="none",e.style.scrollBehavior="auto",i.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"});const a=setTimeout(()=>{d()},o+200),d=()=>{clearTimeout(a),setTimeout(()=>{e.style.scrollSnapType="x mandatory",e.style.scrollBehavior="smooth",f=!1},100)};e.addEventListener("scrollend",d,{once:!0})},I=t=>{var o;if(T){if(T=!1,e.style.cursor="grab",document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",I),document.removeEventListener("pointercancel",I),R){const i=e.scrollLeft,a=i-x,d=Math.abs(a),h=V*150;if(Math.abs(h)>50){const m=i-h,g=e.scrollWidth-e.clientWidth,M=Math.max(0,Math.min(m,g));let c;if(M>=g*.95)c=Math.floor((r.length-1)/s)*s;else{const X=M/g,q=Math.round(X*(r.length-1));c=Math.floor(q/s)*s}c=Math.max(0,Math.min(c,Math.floor((r.length-1)/s)*s)),U(c,400)}else{const m=e.scrollWidth-e.clientWidth,M=(((o=r[0])==null?void 0:o.offsetWidth)||0)*s*.25;let c;i>=m*.9?c=Math.floor((r.length-1)/s)*s:i<=m*.1?c=0:d>M?a>0?c=Math.min(l+s,Math.floor((r.length-1)/s)*s):c=Math.max(l-s,0):c=l,c=Math.floor(c/s)*s,U(c,250)}t.preventDefault()}else setTimeout(()=>{e.style.scrollBehavior="smooth",e.style.scrollSnapType="x mandatory",f=!1},50),E=0;E>A&&setTimeout(()=>{E=0},100)}},z=()=>{r.length<=0||r.length<=s||_(e)&&(y.innerHTML="",r.forEach((t,o)=>{const i=document.createElement("button");i.addEventListener("click",()=>{k(o)}),i.classList.toggle("d-none",o%s!==0),y.appendChild(i)}))};z(),v==null||v.addEventListener("click",()=>{O("previous")}),L==null||L.addEventListener("click",()=>{O("next")}),j&&(e.addEventListener("mousedown",J),e.addEventListener("dragstart",t=>t.preventDefault()),e.addEventListener("click",G,!0)),D&&r.forEach((t,o)=>{t.addEventListener("click",()=>{l=o,D(l),S()})});const F=()=>{const t=r[0];if(!t)return;const i=t.getBoundingClientRect().width,d=i*s*.5,h=e.getBoundingClientRect(),p=h.left+h.width/2;let m=0,g=1/0;r.forEach((M,c)=>{if(c%s!==0)return;const X=M.getBoundingClientRect(),q=i*Math.min(s,r.length-c),K=X.left+q/2,P=Math.abs(K-p);P<d&&P<g&&(g=P,m=c)}),m!==l&&(l=m,u&&u(l),requestAnimationFrame(S))};e.addEventListener("scroll",()=>{f||(w&&clearTimeout(w),w=setTimeout(()=>{f||F()},10))}),S(),n.classList.add("carousel-initialized")}function $(){document.querySelectorAll(".carousel-widget").forEach(n=>Z(n))}document.addEventListener("DOMContentLoaded",$);export{$ as h,Z as i};
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.