import{U as te,ak as p,aU as A,aW as s,aa as h,aH as ye,ax as _e,aM as Ae,z as pe,bG as J,x as ge,F as Te,aQ as y}from"./index-CdDWujxk.js";/** * Vue 3 Carousel 0.3.1 * (c) 2023 * @license MIT */const d={itemsToShow:1,itemsToScroll:1,modelValue:0,transition:300,autoplay:0,snapAlign:"center",wrapAround:!1,throttle:16,pauseAutoplayOnHover:!1,mouseDrag:!0,touchDrag:!0,dir:"ltr",breakpoints:void 0,i18n:{ariaNextSlide:"Navigate to next slide",ariaPreviousSlide:"Navigate to previous slide",ariaNavigateToSlide:"Navigate to slide {slideNumber}",ariaGallery:"Gallery",itemXofY:"Item {currentSlide} of {slidesCount}",iconArrowUp:"Arrow pointing upwards",iconArrowDown:"Arrow pointing downwards",iconArrowRight:"Arrow pointing to the right",iconArrowLeft:"Arrow pointing to the left"}},me={itemsToShow:{default:d.itemsToShow,type:Number},itemsToScroll:{default:d.itemsToScroll,type:Number},wrapAround:{default:d.wrapAround,type:Boolean},throttle:{default:d.throttle,type:Number},snapAlign:{default:d.snapAlign,validator(e){return["start","end","center","center-even","center-odd"].includes(e)}},transition:{default:d.transition,type:Number},breakpoints:{default:d.breakpoints,type:Object},autoplay:{default:d.autoplay,type:Number},pauseAutoplayOnHover:{default:d.pauseAutoplayOnHover,type:Boolean},modelValue:{default:void 0,type:Number},mouseDrag:{default:d.mouseDrag,type:Boolean},touchDrag:{default:d.touchDrag,type:Boolean},dir:{default:d.dir,validator(e){return["rtl","ltr"].includes(e)}},i18n:{default:d.i18n,type:Object},settings:{default(){return{}},type:Object}};function ke({config:e,slidesCount:n}){const{snapAlign:t,wrapAround:r,itemsToShow:l=1}=e;if(r)return Math.max(n-1,0);let o;switch(t){case"start":o=n-l;break;case"end":o=n-1;break;case"center":case"center-odd":o=n-Math.ceil((l-.5)/2);break;case"center-even":o=n-Math.ceil(l/2);break;default:o=0;break}return Math.max(o,0)}function Ce({config:e,slidesCount:n}){const{wrapAround:t,snapAlign:r,itemsToShow:l=1}=e;let o=0;if(t||l>n)return o;switch(r){case"start":o=0;break;case"end":o=l-1;break;case"center":case"center-odd":o=Math.floor((l-1)/2);break;case"center-even":o=Math.floor((l-2)/2);break;default:o=0;break}return o}function K({val:e,max:n,min:t}){return n<t?e:Math.min(Math.max(e,t),n)}function Me({config:e,currentSlide:n,slidesCount:t}){const{snapAlign:r,wrapAround:l,itemsToShow:o=1}=e;let g=n;switch(r){case"center":case"center-odd":g-=(o-1)/2;break;case"center-even":g-=(o-2)/2;break;case"end":g-=o-1;break}return l?g:K({val:g,max:t-o,min:0})}function he(e){return e?e.reduce((n,t)=>{var r;return t.type===Te?[...n,...he(t.children)]:((r=t.type)===null||r===void 0?void 0:r.name)==="CarouselSlide"?[...n,t]:n},[]):[]}function V({val:e,max:n,min:t=0}){return e>n?V({val:e-(n+1),max:n,min:t}):e<t?V({val:e+(n+1),max:n,min:t}):e}function Ne(e,n){let t;return n?function(...r){const l=this;t||(e.apply(l,r),t=!0,setTimeout(()=>t=!1,n))}:e}function Oe(e,n){let t;return function(...r){t&&clearTimeout(t),t=setTimeout(()=>{e(...r),t=null},n)}}function Se(e="",n={}){return Object.entries(n).reduce((t,[r,l])=>t.replace(`{${r}}`,String(l)),e)}var je=te({name:"ARIA",setup(){const e=p("config",A(Object.assign({},d))),n=p("currentSlide",s(0)),t=p("slidesCount",s(0));return()=>h("div",{class:["carousel__liveregion","carousel__sr-only"],"aria-live":"polite","aria-atomic":"true"},Se(e.i18n.itemXofY,{currentSlide:n.value+1,slidesCount:t.value}))}}),De=te({name:"Carousel",props:me,setup(e,{slots:n,emit:t,expose:r}){var l;const o=s(null),g=s([]),u=s(0),v=s(0),i=A(Object.assign({},d));let S=Object.assign({},d),w;const c=s((l=e.modelValue)!==null&&l!==void 0?l:0),M=s(0),E=s(0),_=s(0),O=s(0);let N,U;y("config",i),y("slidesCount",v),y("currentSlide",c),y("maxSlide",_),y("minSlide",O),y("slideWidth",u);function X(){w=Object.assign({},e.breakpoints),S=Object.assign(Object.assign(Object.assign({},S),e),{i18n:Object.assign(Object.assign({},S.i18n),e.i18n),breakpoints:void 0}),ne(S)}function I(){if(!w||!Object.keys(w).length)return;const a=Object.keys(w).map(f=>Number(f)).sort((f,x)=>+x-+f);let m=Object.assign({},S);a.some(f=>{const x=window.matchMedia(`(min-width: ${f}px)`).matches;return x&&(m=Object.assign(Object.assign({},m),w[f])),x}),ne(m)}function ne(a){Object.entries(a).forEach(([m,f])=>i[m]=f)}const ae=Oe(()=>{I(),j()},16);function j(){if(!o.value)return;const a=o.value.getBoundingClientRect();u.value=a.width/i.itemsToShow}function $(){v.value<=0||(E.value=Math.ceil((v.value-1)/2),_.value=ke({config:i,slidesCount:v.value}),O.value=Ce({config:i,slidesCount:v.value}),i.wrapAround||(c.value=K({val:c.value,max:_.value,min:O.value})))}ye(()=>{_e(()=>j()),setTimeout(()=>j(),1e3),I(),le(),window.addEventListener("resize",ae,{passive:!0}),t("init")}),Ae(()=>{U&&clearTimeout(U),N&&clearInterval(N),window.removeEventListener("resize",ae,{passive:!0})});let b=!1;const D={x:0,y:0},P={x:0,y:0},T=A({x:0,y:0}),R=s(!1),z=s(!1),be=()=>{R.value=!0},we=()=>{R.value=!1};function ie(a){["INPUT","TEXTAREA","SELECT"].includes(a.target.tagName)||(b=a.type==="touchstart",b||a.preventDefault(),!(!b&&a.button!==0||k.value)&&(D.x=b?a.touches[0].clientX:a.clientX,D.y=b?a.touches[0].clientY:a.clientY,document.addEventListener(b?"touchmove":"mousemove",oe,!0),document.addEventListener(b?"touchend":"mouseup",re,!0)))}const oe=Ne(a=>{z.value=!0,P.x=b?a.touches[0].clientX:a.clientX,P.y=b?a.touches[0].clientY:a.clientY;const m=P.x-D.x,f=P.y-D.y;T.y=f,T.x=m},i.throttle);function re(){const a=i.dir==="rtl"?-1:1,m=Math.sign(T.x)*.4,f=Math.round(T.x/u.value+m)*a;if(f&&!b){const x=G=>{G.stopPropagation(),window.removeEventListener("click",x,!0)};window.addEventListener("click",x,!0)}C(c.value-f),T.x=0,T.y=0,z.value=!1,document.removeEventListener(b?"touchmove":"mousemove",oe,!0),document.removeEventListener(b?"touchend":"mouseup",re,!0)}function le(){!i.autoplay||i.autoplay<=0||(N=setInterval(()=>{i.pauseAutoplayOnHover&&R.value||B()},i.autoplay))}function se(){N&&(clearInterval(N),N=null),le()}const k=s(!1);function C(a){const m=i.wrapAround?a:K({val:a,max:_.value,min:O.value});c.value===m||k.value||(t("slide-start",{slidingToIndex:a,currentSlideIndex:c.value,prevSlideIndex:M.value,slidesCount:v.value}),k.value=!0,M.value=c.value,c.value=m,U=setTimeout(()=>{if(i.wrapAround){const f=V({val:m,max:_.value,min:0});f!==c.value&&(c.value=f,t("loop",{currentSlideIndex:c.value,slidingToIndex:a}))}t("update:modelValue",c.value),t("slide-end",{currentSlideIndex:c.value,prevSlideIndex:M.value,slidesCount:v.value}),k.value=!1,se()},i.transition))}function B(){C(c.value+i.itemsToScroll)}function Y(){C(c.value-i.itemsToScroll)}const ue={slideTo:C,next:B,prev:Y};y("nav",ue),y("isSliding",k);const ce=pe(()=>Me({config:i,currentSlide:c.value,slidesCount:v.value}));y("slidesToScroll",ce);const xe=pe(()=>{const a=i.dir==="rtl"?-1:1,m=ce.value*u.value*a;return{transform:`translateX(${T.x-m}px)`,transition:`${k.value?i.transition:0}ms`,margin:i.wrapAround?`0 -${v.value*u.value}px`:"",width:"100%"}});function de(){X(),I(),$(),j(),se()}Object.keys(me).forEach(a=>{["modelValue"].includes(a)||J(()=>e[a],de)}),J(()=>e.modelValue,a=>{a!==c.value&&C(Number(a))}),J(v,$),t("before-init"),X();const ve={config:i,slidesCount:v,slideWidth:u,next:B,prev:Y,slideTo:C,currentSlide:c,maxSlide:_,minSlide:O,middleSlide:E};r({updateBreakpointsConfigs:I,updateSlidesData:$,updateSlideWidth:j,initDefaultConfigs:X,restartCarousel:de,slideTo:C,next:B,prev:Y,nav:ue,data:ve});const H=n.default||n.slides,W=n.addons,fe=A(ve);return()=>{const a=he(H==null?void 0:H(fe)),m=(W==null?void 0:W(fe))||[];a.forEach((F,Q)=>F.props.index=Q);let f=a;if(i.wrapAround){const F=a.map((q,L)=>ge(q,{index:-a.length+L,isClone:!0,key:`clone-before-${L}`})),Q=a.map((q,L)=>ge(q,{index:a.length+L,isClone:!0,key:`clone-after-${L}`}));f=[...F,...a,...Q]}g.value=a,v.value=Math.max(a.length,1);const x=h("ol",{class:"carousel__track",style:xe.value,onMousedownCapture:i.mouseDrag?ie:null,onTouchstartPassiveCapture:i.touchDrag?ie:null},f),G=h("div",{class:"carousel__viewport"},x);return h("section",{ref:o,class:{carousel:!0,"is-sliding":k.value,"is-dragging":z.value,"is-hover":R.value,"carousel--rtl":i.dir==="rtl"},dir:i.dir,"aria-label":i.i18n.ariaGallery,tabindex:"0",onMouseenter:be,onMouseleave:we},[G,m,h(je)])}}}),Z;(function(e){e.arrowUp="arrowUp",e.arrowDown="arrowDown",e.arrowRight="arrowRight",e.arrowLeft="arrowLeft"})(Z||(Z={}));const Le={arrowUp:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z",arrowDown:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z",arrowRight:"M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z",arrowLeft:"M15.41 16.59L10.83 12l4.58-4.59L14 6l-6 6 6 6 1.41-1.41z"};function Ee(e){return e in Z}const ee=e=>{const n=p("config",A(Object.assign({},d))),t=String(e.name),r=`icon${t.charAt(0).toUpperCase()+t.slice(1)}`;if(!t||typeof t!="string"||!Ee(t))return;const l=Le[t],o=h("path",{d:l}),g=n.i18n[r]||e.title||t,u=h("title",g);return h("svg",{class:"carousel__icon",viewBox:"0 0 24 24",role:"img","aria-label":g},[u,o])};ee.props={name:String,title:String};const Pe=(e,{slots:n,attrs:t})=>{const{next:r,prev:l}=n||{},o=p("config",A(Object.assign({},d))),g=p("maxSlide",s(1)),u=p("minSlide",s(1)),v=p("currentSlide",s(1)),i=p("nav",{}),{dir:S,wrapAround:w,i18n:c}=o,M=S==="rtl",E=h("button",{type:"button",class:["carousel__prev",!w&&v.value<=u.value&&"carousel__prev--disabled",t==null?void 0:t.class],"aria-label":c.ariaPreviousSlide,onClick:i.prev},(l==null?void 0:l())||h(ee,{name:M?"arrowRight":"arrowLeft"})),_=h("button",{type:"button",class:["carousel__next",!w&&v.value>=g.value&&"carousel__next--disabled",t==null?void 0:t.class],"aria-label":c.ariaNextSlide,onClick:i.next},(r==null?void 0:r())||h(ee,{name:M?"arrowLeft":"arrowRight"}));return[E,_]},Re=()=>{const e=p("config",A(Object.assign({},d))),n=p("maxSlide",s(1)),t=p("minSlide",s(1)),r=p("currentSlide",s(1)),l=p("nav",{}),o=u=>V({val:r.value,max:n.value,min:0})===u,g=[];for(let u=t.value;u<n.value+1;u++){const v=h("button",{type:"button",class:{"carousel__pagination-button":!0,"carousel__pagination-button--active":o(u)},"aria-label":Se(e.i18n.ariaNavigateToSlide,{slideNumber:u+1}),onClick:()=>l.slideTo(u)}),i=h("li",{class:"carousel__pagination-item",key:u},v);g.push(i)}return h("ol",{class:"carousel__pagination"},g)};var Be=te({name:"CarouselSlide",props:{index:{type:Number,default:1},isClone:{type:Boolean,default:!1}},setup(e,{slots:n}){const t=p("config",A(Object.assign({},d))),r=p("currentSlide",s(0)),l=p("slidesToScroll",s(0)),o=p("isSliding",s(!1)),g=()=>e.index===r.value,u=()=>e.index===r.value-1,v=()=>e.index===r.value+1,i=()=>{const S=Math.floor(l.value),w=Math.ceil(l.value+t.itemsToShow-1);return e.index>=S&&e.index<=w};return()=>{var S;return h("li",{style:{width:`${100/t.itemsToShow}%`},class:{carousel__slide:!0,"carousel__slide--clone":e.isClone,"carousel__slide--visible":i(),"carousel__slide--active":g(),"carousel__slide--prev":u(),"carousel__slide--next":v(),"carousel__slide--sliding":o.value},"aria-hidden":!i()},(S=n.default)===null||S===void 0?void 0:S.call(n))}}});export{De as C,Pe as N,Re as P,Be as S};