import{e as L,c as A,m as x,g as D,i as B,n as I,b as k}from"./swiper-lfl8oNG_.js";function N(T,e,b,m){return T.params.createElements&&Object.keys(m).forEach(p=>{if(!b[p]&&b.auto===!0){let v=L(T.el,`.${m[p]}`)[0];v||(v=A("div",m[p]),v.className=m[p],T.el.append(v)),b[p]=v,e[p]=v}}),b}function V(T){let{swiper:e,extendParams:b,on:m,emit:p}=T;b({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),e.navigation={nextEl:null,prevEl:null};function v(s){let n;return s&&typeof s=="string"&&e.isElement&&(n=e.el.querySelector(s),n)?n:(s&&(typeof s=="string"&&(n=[...document.querySelectorAll(s)]),e.params.uniqueNavElements&&typeof s=="string"&&n&&n.length>1&&e.el.querySelectorAll(s).length===1?n=e.el.querySelector(s):n&&n.length===1&&(n=n[0])),s&&!n?s:n)}function y(s,n){const r=e.params.navigation;s=x(s),s.forEach(i=>{i&&(i.classList[n?"add":"remove"](...r.disabledClass.split(" ")),i.tagName==="BUTTON"&&(i.disabled=n),e.params.watchOverflow&&e.enabled&&i.classList[e.isLocked?"add":"remove"](r.lockClass))})}function h(){const{nextEl:s,prevEl:n}=e.navigation;if(e.params.loop){y(n,!1),y(s,!1);return}y(n,e.isBeginning&&!e.params.rewind),y(s,e.isEnd&&!e.params.rewind)}function f(s){s.preventDefault(),!(e.isBeginning&&!e.params.loop&&!e.params.rewind)&&(e.slidePrev(),p("navigationPrev"))}function a(s){s.preventDefault(),!(e.isEnd&&!e.params.loop&&!e.params.rewind)&&(e.slideNext(),p("navigationNext"))}function t(){const s=e.params.navigation;if(e.params.navigation=N(e,e.originalParams.navigation,e.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!(s.nextEl||s.prevEl))return;let n=v(s.nextEl),r=v(s.prevEl);Object.assign(e.navigation,{nextEl:n,prevEl:r}),n=x(n),r=x(r);const i=(c,o)=>{c&&c.addEventListener("click",o==="next"?a:f),!e.enabled&&c&&c.classList.add(...s.lockClass.split(" "))};n.forEach(c=>i(c,"next")),r.forEach(c=>i(c,"prev"))}function d(){let{nextEl:s,prevEl:n}=e.navigation;s=x(s),n=x(n);const r=(i,c)=>{i.removeEventListener("click",c==="next"?a:f),i.classList.remove(...e.params.navigation.disabledClass.split(" "))};s.forEach(i=>r(i,"next")),n.forEach(i=>r(i,"prev"))}m("init",()=>{e.params.navigation.enabled===!1?l():(t(),h())}),m("toEdge fromEdge lock unlock",()=>{h()}),m("destroy",()=>{d()}),m("enable disable",()=>{let{nextEl:s,prevEl:n}=e.navigation;if(s=x(s),n=x(n),e.enabled){h();return}[...s,...n].filter(r=>!!r).forEach(r=>r.classList.add(e.params.navigation.lockClass))}),m("click",(s,n)=>{let{nextEl:r,prevEl:i}=e.navigation;r=x(r),i=x(i);const c=n.target;if(e.params.navigation.hideOnClick&&!i.includes(c)&&!r.includes(c)){if(e.pagination&&e.params.pagination&&e.params.pagination.clickable&&(e.pagination.el===c||e.pagination.el.contains(c)))return;let o;r.length?o=r[0].classList.contains(e.params.navigation.hiddenClass):i.length&&(o=i[0].classList.contains(e.params.navigation.hiddenClass)),p(o===!0?"navigationShow":"navigationHide"),[...r,...i].filter(E=>!!E).forEach(E=>E.classList.toggle(e.params.navigation.hiddenClass))}});const u=()=>{e.el.classList.remove(...e.params.navigation.navigationDisabledClass.split(" ")),t(),h()},l=()=>{e.el.classList.add(...e.params.navigation.navigationDisabledClass.split(" ")),d()};Object.assign(e.navigation,{enable:u,disable:l,update:h,init:t,destroy:d})}function R(T){let{swiper:e,extendParams:b,on:m}=T;b({thumbs:{swiper:null,multipleActiveThumbs:!0,autoScrollOffset:0,slideThumbActiveClass:"swiper-slide-thumb-active",thumbsContainerClass:"swiper-thumbs"}});let p=!1,v=!1;e.thumbs={swiper:null};function y(){const a=e.thumbs.swiper;if(!a||a.destroyed)return;const t=a.clickedIndex,d=a.clickedSlide;if(d&&d.classList.contains(e.params.thumbs.slideThumbActiveClass)||typeof t>"u"||t===null)return;let u;a.params.loop?u=parseInt(a.clickedSlide.getAttribute("data-swiper-slide-index"),10):u=t,e.params.loop?e.slideToLoop(u):e.slideTo(u)}function h(){const{thumbs:a}=e.params;if(p)return!1;p=!0;const t=e.constructor;if(a.swiper instanceof t)e.thumbs.swiper=a.swiper,Object.assign(e.thumbs.swiper.originalParams,{watchSlidesProgress:!0,slideToClickedSlide:!1}),Object.assign(e.thumbs.swiper.params,{watchSlidesProgress:!0,slideToClickedSlide:!1}),e.thumbs.swiper.update();else if(B(a.swiper)){const d=Object.assign({},a.swiper);Object.assign(d,{watchSlidesProgress:!0,slideToClickedSlide:!1}),e.thumbs.swiper=new t(d),v=!0}return e.thumbs.swiper.el.classList.add(e.params.thumbs.thumbsContainerClass),e.thumbs.swiper.on("tap",y),!0}function f(a){const t=e.thumbs.swiper;if(!t||t.destroyed)return;const d=t.params.slidesPerView==="auto"?t.slidesPerViewDynamic():t.params.slidesPerView;let u=1;const l=e.params.thumbs.slideThumbActiveClass;if(e.params.slidesPerView>1&&!e.params.centeredSlides&&(u=e.params.slidesPerView),e.params.thumbs.multipleActiveThumbs||(u=1),u=Math.floor(u),t.slides.forEach(r=>r.classList.remove(l)),t.params.loop||t.params.virtual&&t.params.virtual.enabled)for(let r=0;r<u;r+=1)L(t.slidesEl,`[data-swiper-slide-index="${e.realIndex+r}"]`).forEach(i=>{i.classList.add(l)});else for(let r=0;r<u;r+=1)t.slides[e.realIndex+r]&&t.slides[e.realIndex+r].classList.add(l);const s=e.params.thumbs.autoScrollOffset,n=s&&!t.params.loop;if(e.realIndex!==t.realIndex||n){const r=t.activeIndex;let i,c;if(t.params.loop){const o=t.slides.filter(E=>E.getAttribute("data-swiper-slide-index")===`${e.realIndex}`)[0];i=t.slides.indexOf(o),c=e.activeIndex>e.previousIndex?"next":"prev"}else i=e.realIndex,c=i>e.previousIndex?"next":"prev";n&&(i+=c==="next"?s:-1*s),t.visibleSlidesIndexes&&t.visibleSlidesIndexes.indexOf(i)<0&&(t.params.centeredSlides?i>r?i=i-Math.floor(d/2)+1:i=i+Math.floor(d/2)-1:i>r&&t.params.slidesPerGroup,t.slideTo(i,a?0:void 0))}}m("beforeInit",()=>{const{thumbs:a}=e.params;if(!(!a||!a.swiper))if(typeof a.swiper=="string"||a.swiper instanceof HTMLElement){const t=D(),d=()=>{const l=typeof a.swiper=="string"?t.querySelector(a.swiper):a.swiper;if(l&&l.swiper)a.swiper=l.swiper,h(),f(!0);else if(l){const s=n=>{a.swiper=n.detail[0],l.removeEventListener("init",s),h(),f(!0),a.swiper.update(),e.update()};l.addEventListener("init",s)}return l},u=()=>{if(e.destroyed)return;d()||requestAnimationFrame(u)};requestAnimationFrame(u)}else h(),f(!0)}),m("slideChange update resize observerUpdate",()=>{f()}),m("setTransition",(a,t)=>{const d=e.thumbs.swiper;!d||d.destroyed||d.setTransition(t)}),m("beforeDestroy",()=>{const a=e.thumbs.swiper;!a||a.destroyed||v&&a.destroy()}),Object.assign(e.thumbs,{init:h,update:f})}function q(T){let{swiper:e,extendParams:b,emit:m,once:p}=T;b({freeMode:{enabled:!1,momentum:!0,momentumRatio:1,momentumBounce:!0,momentumBounceRatio:1,momentumVelocityRatio:1,sticky:!1,minimumVelocity:.02}});function v(){if(e.params.cssMode)return;const f=e.getTranslate();e.setTranslate(f),e.setTransition(0),e.touchEventsData.velocities.length=0,e.freeMode.onTouchEnd({currentPos:e.rtl?e.translate:-e.translate})}function y(){if(e.params.cssMode)return;const{touchEventsData:f,touches:a}=e;f.velocities.length===0&&f.velocities.push({position:a[e.isHorizontal()?"startX":"startY"],time:f.touchStartTime}),f.velocities.push({position:a[e.isHorizontal()?"currentX":"currentY"],time:I()})}function h(f){let{currentPos:a}=f;if(e.params.cssMode)return;const{params:t,wrapperEl:d,rtlTranslate:u,snapGrid:l,touchEventsData:s}=e,r=I()-s.touchStartTime;if(a<-e.minTranslate()){e.slideTo(e.activeIndex);return}if(a>-e.maxTranslate()){e.slides.length<l.length?e.slideTo(l.length-1):e.slideTo(e.slides.length-1);return}if(t.freeMode.momentum){if(s.velocities.length>1){const g=s.velocities.pop(),w=s.velocities.pop(),O=g.position-w.position,P=g.time-w.time;e.velocity=O/P,e.velocity/=2,Math.abs(e.velocity)<t.freeMode.minimumVelocity&&(e.velocity=0),(P>150||I()-g.time>300)&&(e.velocity=0)}else e.velocity=0;e.velocity*=t.freeMode.momentumVelocityRatio,s.velocities.length=0;let i=1e3*t.freeMode.momentumRatio;const c=e.velocity*i;let o=e.translate+c;u&&(o=-o);let E=!1,S;const M=Math.abs(e.velocity)*20*t.freeMode.momentumBounceRatio;let C;if(o<e.maxTranslate())t.freeMode.momentumBounce?(o+e.maxTranslate()<-M&&(o=e.maxTranslate()-M),S=e.maxTranslate(),E=!0,s.allowMomentumBounce=!0):o=e.maxTranslate(),t.loop&&t.centeredSlides&&(C=!0);else if(o>e.minTranslate())t.freeMode.momentumBounce?(o-e.minTranslate()>M&&(o=e.minTranslate()+M),S=e.minTranslate(),E=!0,s.allowMomentumBounce=!0):o=e.minTranslate(),t.loop&&t.centeredSlides&&(C=!0);else if(t.freeMode.sticky){let g;for(let w=0;w<l.length;w+=1)if(l[w]>-o){g=w;break}Math.abs(l[g]-o)<Math.abs(l[g-1]-o)||e.swipeDirection==="next"?o=l[g]:o=l[g-1],o=-o}if(C&&p("transitionEnd",()=>{e.loopFix()}),e.velocity!==0){if(u?i=Math.abs((-o-e.translate)/e.velocity):i=Math.abs((o-e.translate)/e.velocity),t.freeMode.sticky){const g=Math.abs((u?-o:o)-e.translate),w=e.slidesSizesGrid[e.activeIndex];g<w?i=t.speed:g<2*w?i=t.speed*1.5:i=t.speed*2.5}}else if(t.freeMode.sticky){e.slideToClosest();return}t.freeMode.momentumBounce&&E?(e.updateProgress(S),e.setTransition(i),e.setTranslate(o),e.transitionStart(!0,e.swipeDirection),e.animating=!0,k(d,()=>{!e||e.destroyed||!s.allowMomentumBounce||(m("momentumBounce"),e.setTransition(t.speed),setTimeout(()=>{e.setTranslate(S),k(d,()=>{!e||e.destroyed||e.transitionEnd()})},0))})):e.velocity?(m("_freeModeNoMomentumRelease"),e.updateProgress(o),e.setTransition(i),e.setTranslate(o),e.transitionStart(!0,e.swipeDirection),e.animating||(e.animating=!0,k(d,()=>{!e||e.destroyed||e.transitionEnd()}))):e.updateProgress(o),e.updateActiveIndex(),e.updateSlidesClasses()}else if(t.freeMode.sticky){e.slideToClosest();return}else t.freeMode&&m("_freeModeNoMomentumRelease");(!t.freeMode.momentum||r>=t.longSwipesMs)&&(m("_freeModeStaticRelease"),e.updateProgress(),e.updateActiveIndex(),e.updateSlidesClasses())}Object.assign(e,{freeMode:{onTouchStart:v,onTouchMove:y,onTouchEnd:h}})}export{V as N,R as T,q as f};