alpine-splide
Version:
The Alpine component for Splide.
8 lines (7 loc) • 31.9 kB
JavaScript
function Ke(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Hr(t,r,e){return r&&Ke(t.prototype,r),e&&Ke(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var je="(prefers-reduced-motion: reduce)",Rt=1,Ur=2,It=3,Nt=4,Ft=5,ne=6,ie=7,Br={CREATED:Rt,MOUNTED:Ur,IDLE:It,MOVING:Nt,SCROLLING:Ft,DRAGGING:ne,DESTROYED:ie};function ct(t){t.length=0}function gt(t,r,e){return Array.prototype.slice.call(t,r,e)}function z(t){return t.bind.apply(t,[null].concat(gt(arguments,1)))}var qe=setTimeout,pe=function(){};function Ze(t){return requestAnimationFrame(t)}function ae(t,r){return typeof r===t}function Gt(t){return!Le(t)&&ae("object",t)}var Te=Array.isArray,Je=z(ae,"function"),Et=z(ae,"string"),Wt=z(ae,"undefined");function Le(t){return t===null}function Qe(t){return t instanceof HTMLElement}function zt(t){return Te(t)?t:[t]}function tt(t,r){zt(t).forEach(r)}function be(t,r){return t.indexOf(r)>-1}function se(t,r){return t.push.apply(t,zt(r)),t}function lt(t,r,e){t&&tt(r,function(n){n&&t.classList[e?"add":"remove"](n)})}function st(t,r){lt(t,Et(r)?r.split(" "):r,!0)}function Ht(t,r){tt(r,t.appendChild.bind(t))}function Ce(t,r){tt(t,function(e){var n=(r||e).parentNode;n&&n.insertBefore(e,r)})}function Ut(t,r){return Qe(t)&&(t.msMatchesSelector||t.matches).call(t,r)}function tr(t,r){var e=t?gt(t.children):[];return r?e.filter(function(n){return Ut(n,r)}):e}function Bt(t,r){return r?tr(t,r)[0]:t.firstElementChild}var $t=Object.keys;function pt(t,r,e){return t&&(e?$t(t).reverse():$t(t)).forEach(function(n){n!=="__proto__"&&r(t[n],n)}),t}function Yt(t){return gt(arguments,1).forEach(function(r){pt(r,function(e,n){t[n]=r[n]})}),t}function mt(t){return gt(arguments,1).forEach(function(r){pt(r,function(e,n){Te(e)?t[n]=e.slice():Gt(e)?t[n]=mt({},Gt(t[n])?t[n]:{},e):t[n]=e})}),t}function er(t,r){tt(r||$t(t),function(e){delete t[e]})}function ot(t,r){tt(t,function(e){tt(r,function(n){e&&e.removeAttribute(n)})})}function V(t,r,e){Gt(r)?pt(r,function(n,a){V(t,a,n)}):tt(t,function(n){Le(e)||e===""?ot(n,r):n.setAttribute(r,String(e))})}function Ot(t,r,e){var n=document.createElement(t);return r&&(Et(r)?st(n,r):V(n,r)),e&&Ht(e,n),n}function nt(t,r,e){if(Wt(e))return getComputedStyle(t)[r];Le(e)||(t.style[r]=""+e)}function Xt(t,r){nt(t,"display",r)}function rr(t){t.setActive&&t.setActive()||t.focus({preventScroll:!0})}function it(t,r){return t.getAttribute(r)}function nr(t,r){return t&&t.classList.contains(r)}function et(t){return t.getBoundingClientRect()}function Tt(t){tt(t,function(r){r&&r.parentNode&&r.parentNode.removeChild(r)})}function ir(t){return Bt(new DOMParser().parseFromString(t,"text/html").body)}function ft(t,r){t.preventDefault(),r&&(t.stopPropagation(),t.stopImmediatePropagation())}function ar(t,r){return t&&t.querySelector(r)}function Re(t,r){return r?gt(t.querySelectorAll(r)):[]}function vt(t,r){lt(t,r,!1)}function Ie(t){return t.timeStamp}function Lt(t){return Et(t)?t:t?t+"px":""}var Kt="splide",Ne="data-"+Kt;function jt(t,r){if(!t)throw new Error("["+Kt+"] "+(r||""))}var St=Math.min,oe=Math.max,ue=Math.floor,qt=Math.ceil,J=Math.abs;function sr(t,r,e){return J(t-r)<e}function ce(t,r,e,n){var a=St(r,e),v=oe(r,e);return n?a<t&&t<v:a<=t&&t<=v}function wt(t,r,e){var n=St(r,e),a=oe(r,e);return St(oe(n,t),a)}function Oe(t){return+(t>0)-+(t<0)}function we(t,r){return tt(r,function(e){t=t.replace("%s",""+e)}),t}function De(t){return t<10?"0"+t:""+t}var or={};function $r(t){return""+t+De(or[t]=(or[t]||0)+1)}function ur(){var t=[];function r(i,u,c,f){a(i,u,function(s,m,d){var h="addEventListener"in s,o=h?s.removeEventListener.bind(s,m,c,f):s.removeListener.bind(s,c);h?s.addEventListener(m,c,f):s.addListener(c),t.push([s,m,d,c,o])})}function e(i,u,c){a(i,u,function(f,s,m){t=t.filter(function(d){return d[0]===f&&d[1]===s&&d[2]===m&&(!c||d[3]===c)?(d[4](),!1):!0})})}function n(i,u,c){var f,s=!0;return typeof CustomEvent=="function"?f=new CustomEvent(u,{bubbles:s,detail:c}):(f=document.createEvent("CustomEvent"),f.initCustomEvent(u,s,!1,c)),i.dispatchEvent(f),f}function a(i,u,c){tt(i,function(f){f&&tt(u,function(s){s.split(" ").forEach(function(m){var d=m.split(".");c(f,d[0],d[1])})})})}function v(){t.forEach(function(i){i[4]()}),ct(t)}return{bind:r,unbind:e,dispatch:n,destroy:v}}var bt="mounted",cr="ready",_t="move",Zt="moved",lr="click",Yr="active",Xr="inactive",Kr="visible",jr="hidden",X="refresh",Q="updated",Jt="resize",Pe="resized",qr="drag",Zr="dragging",Jr="dragged",xe="scroll",Dt="scrolled",Qr="overflow",fr="destroy",tn="arrows:mounted",en="arrows:updated",rn="pagination:mounted",nn="pagination:updated",vr="navigation:mounted",dr="autoplay:play",an="autoplay:playing",hr="autoplay:pause",gr="lazyload:loaded",Er="sk",mr="sh",le="ei";function B(t){var r=t?t.event.bus:document.createDocumentFragment(),e=ur();function n(v,i){e.bind(r,zt(v).join(" "),function(u){i.apply(i,Te(u.detail)?u.detail:[])})}function a(v){e.dispatch(r,v,gt(arguments,1))}return t&&t.event.on(fr,e.destroy),Yt(e,{bus:r,on:n,off:z(e.unbind,r),emit:a})}function fe(t,r,e,n){var a=Date.now,v,i=0,u,c=!0,f=0;function s(){if(!c){if(i=t?St((a()-v)/t,1):1,e&&e(i),i>=1&&(r(),v=a(),n&&++f>=n))return d();u=Ze(s)}}function m(S){S||o(),v=a()-(S?i*t:0),c=!1,u=Ze(s)}function d(){c=!0}function h(){v=a(),i=0,e&&e(i)}function o(){u&&cancelAnimationFrame(u),i=0,u=0,c=!0}function l(S){t=S}function _(){return c}return{start:m,rewind:h,pause:d,cancel:o,set:l,isPaused:_}}function sn(t){var r=t;function e(a){r=a}function n(a){return be(zt(a),r)}return{set:e,is:n}}function on(t,r){var e=fe(r||0,t,null,1);return function(){e.isPaused()&&e.start()}}function un(t,r,e){var n=t.state,a=e.breakpoints||{},v=e.reducedMotion||{},i=ur(),u=[];function c(){var o=e.mediaQuery==="min";$t(a).sort(function(l,_){return o?+l-+_:+_-+l}).forEach(function(l){s(a[l],"("+(o?"min":"max")+"-width:"+l+"px)")}),s(v,je),m()}function f(o){o&&i.destroy()}function s(o,l){var _=matchMedia(l);i.bind(_,"change",m),u.push([o,_])}function m(){var o=n.is(ie),l=e.direction,_=u.reduce(function(S,E){return mt(S,E[1].matches?E[0]:{})},{});er(e),h(_),e.destroy?t.destroy(e.destroy==="completely"):o?(f(!0),t.mount()):l!==e.direction&&t.refresh()}function d(o){matchMedia(je).matches&&(o?mt(e,v):er(e,$t(v)))}function h(o,l,_){mt(e,o),l&&mt(Object.getPrototypeOf(e),o),(_||!n.is(Rt))&&t.emit(Q,e)}return{setup:c,destroy:f,reduce:d,set:h}}var ve="Arrow",de=ve+"Left",he=ve+"Right",Sr=ve+"Up",_r=ve+"Down";var yr="rtl",ge="ttb",Me={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:[Sr,he],ArrowRight:[_r,de]};function cn(t,r,e){function n(v,i,u){u=u||e.direction;var c=u===yr&&!i?1:u===ge?0:-1;return Me[v]&&Me[v][c]||v.replace(/width|left|right/i,function(f,s){var m=Me[f.toLowerCase()][c]||f;return s>0?m.charAt(0).toUpperCase()+m.slice(1):m})}function a(v){return v*(e.direction===yr?1:-1)}return{resolve:n,orient:a}}var dt="role",Pt="tabindex",ln="disabled",at="aria-",Qt=at+"controls",Ar=at+"current",pr=at+"selected",rt=at+"label",Ve=at+"labelledby",Tr=at+"hidden",ke=at+"orientation",te=at+"roledescription",Lr=at+"live",br=at+"busy",Cr=at+"atomic",Fe=[dt,Pt,ln,Qt,Ar,rt,Ve,Tr,ke,te],ut=Kt+"__",yt="is-",Ge=Kt,Rr=ut+"track",fn=ut+"list",Ee=ut+"slide",Ir=Ee+"--clone",vn=Ee+"__container",We=ut+"arrows",me=ut+"arrow",Nr=me+"--prev",Or=me+"--next",Se=ut+"pagination",wr=Se+"__page",dn=ut+"progress",hn=dn+"__bar",ze=ut+"toggle",ai=ze+"__play",si=ze+"__pause",gn=ut+"spinner",En=ut+"sr",mn=yt+"initialized",Ct=yt+"active",Dr=yt+"prev",Pr=yt+"next",He=yt+"visible",Ue=yt+"loading",xr=yt+"focus-in",Mr=yt+"overflow",Sn=[Ct,He,Dr,Pr,Ue,xr,Mr],_n={slide:Ee,clone:Ir,arrows:We,arrow:me,prev:Nr,next:Or,pagination:Se,page:wr,spinner:gn};function yn(t,r){if(Je(t.closest))return t.closest(r);for(var e=t;e&&e.nodeType===1&&!Ut(e,r);)e=e.parentElement;return e}var An=5,Vr=200,kr="touchstart mousedown",Be="touchmove mousemove",$e="touchend touchcancel mouseup click";function pn(t,r,e){var n=B(t),a=n.on,v=n.bind,i=t.root,u=e.i18n,c={},f=[],s=[],m=[],d,h,o;function l(){g(),D(),E()}function _(){a(X,S),a(X,l),a(Q,E),v(document,kr+" keydown",function(A){o=A.type==="keydown"},{capture:!0}),v(i,"focusin",function(){lt(i,xr,!!o)})}function S(A){var I=Fe.concat("style");ct(f),vt(i,s),vt(d,m),ot([d,h],I),ot(i,A?I:["style",te])}function E(){vt(i,s),vt(d,m),s=x(Ge),m=x(Rr),st(i,s),st(d,m),V(i,rt,e.label),V(i,Ve,e.labelledby)}function g(){d=R("."+Rr),h=Bt(d,"."+fn),jt(d&&h,"A track/list element is missing."),se(f,tr(h,"."+Ee+":not(."+Ir+")")),pt({arrows:We,pagination:Se,prev:Nr,next:Or,bar:hn,toggle:ze},function(A,I){c[I]=R("."+A)}),Yt(c,{root:i,track:d,list:h,slides:f})}function D(){var A=i.id||$r(Kt),I=e.role;i.id=A,d.id=d.id||A+"-track",h.id=h.id||A+"-list",!it(i,dt)&&i.tagName!=="SECTION"&&I&&V(i,dt,I),V(i,te,u.carousel),V(h,dt,"presentation")}function R(A){var I=ar(i,A);return I&&yn(I,"."+Ge)===i?I:void 0}function x(A){return[A+"--"+e.type,A+"--"+e.direction,e.drag&&A+"--draggable",e.isNavigation&&A+"--nav",A===Ge&&Ct]}return Yt(c,{setup:l,mount:_,destroy:S})}var xt="slide",Mt="loop",ee="fade";function Tn(t,r,e,n){var a=B(t),v=a.on,i=a.emit,u=a.bind,c=t.Components,f=t.root,s=t.options,m=s.isNavigation,d=s.updateOnMove,h=s.i18n,o=s.pagination,l=s.slideFocus,_=c.Direction.resolve,S=it(n,"style"),E=it(n,rt),g=e>-1,D=Bt(n,"."+vn),R;function x(){g||(n.id=f.id+"-slide"+De(r+1),V(n,dt,o?"tabpanel":"group"),V(n,te,h.slide),V(n,rt,E||we(h.slideLabel,[r+1,t.length]))),A()}function A(){u(n,"click",z(i,lr,P)),u(n,"keydown",z(i,Er,P)),v([Zt,mr,Dt],T),v(vr,F),d&&v(_t,w)}function I(){R=!0,a.destroy(),vt(n,Sn),ot(n,Fe),V(n,"style",S),V(n,rt,E||"")}function F(){var O=t.splides.map(function(p){var N=p.splide.Components.Slides.getAt(r);return N?N.slide.id:""}).join(" ");V(n,rt,we(h.slideX,(g?e:r)+1)),V(n,Qt,O),V(n,dt,l?"button":""),l&&ot(n,te)}function w(){R||T()}function T(){if(!R){var O=t.index;L(),b(),lt(n,Dr,r===O-1),lt(n,Pr,r===O+1)}}function L(){var O=k();O!==nr(n,Ct)&&(lt(n,Ct,O),V(n,Ar,m&&O||""),i(O?Yr:Xr,P))}function b(){var O=$(),p=!O&&(!k()||g);if(t.state.is([Nt,Ft])||V(n,Tr,p||""),V(Re(n,s.focusableNodes||""),Pt,p?-1:""),l&&V(n,Pt,p?-1:0),O!==nr(n,He)&&(lt(n,He,O),i(O?Kr:jr,P)),!O&&document.activeElement===n){var N=c.Slides.getAt(t.index);N&&rr(N.slide)}}function M(O,p,N){nt(N&&D||n,O,p)}function k(){var O=t.index;return O===r||s.cloneStatus&&O===e}function $(){if(t.is(ee))return k();var O=et(c.Elements.track),p=et(n),N=_("left",!0),G=_("right",!0);return ue(O[N])<=qt(p[N])&&ue(p[G])<=qt(O[G])}function U(O,p){var N=J(O-r);return!g&&(s.rewind||t.is(Mt))&&(N=St(N,t.length-N)),N<=p}var P={index:r,slideIndex:e,slide:n,container:D,isClone:g,mount:x,destroy:I,update:T,style:M,isWithin:U};return P}function Ln(t,r,e){var n=B(t),a=n.on,v=n.emit,i=n.bind,u=r.Elements,c=u.slides,f=u.list,s=[];function m(){d(),a(X,h),a(X,d)}function d(){c.forEach(function(T,L){l(T,L,-1)})}function h(){R(function(T){T.destroy()}),ct(s)}function o(){R(function(T){T.update()})}function l(T,L,b){var M=Tn(t,L,b,T);M.mount(),s.push(M),s.sort(function(k,$){return k.index-$.index})}function _(T){return T?x(function(L){return!L.isClone}):s}function S(T){var L=r.Controller,b=L.toIndex(T),M=L.hasFocus()?1:e.perPage;return x(function(k){return ce(k.index,b,b+M-1)})}function E(T){return x(T)[0]}function g(T,L){tt(T,function(b){if(Et(b)&&(b=ir(b)),Qe(b)){var M=c[L];M?Ce(b,M):Ht(f,b),st(b,e.classes.slide),I(b,z(v,Jt))}}),v(X)}function D(T){Tt(x(T).map(function(L){return L.slide})),v(X)}function R(T,L){_(L).forEach(T)}function x(T){return s.filter(Je(T)?T:function(L){return Et(T)?Ut(L.slide,T):be(zt(T),L.index)})}function A(T,L,b){R(function(M){M.style(T,L,b)})}function I(T,L){var b=Re(T,"img"),M=b.length;M?b.forEach(function(k){i(k,"load error",function(){--M||L()})}):L()}function F(T){return T?c.length:s.length}function w(){return s.length>e.perPage}return{mount:m,destroy:h,update:o,register:l,get:_,getIn:S,getAt:E,add:g,remove:D,forEach:R,filter:x,style:A,getLength:F,isEnough:w}}function bn(t,r,e){var n=B(t),a=n.on,v=n.bind,i=n.emit,u=r.Slides,c=r.Direction.resolve,f=r.Elements,s=f.root,m=f.track,d=f.list,h=u.getAt,o=u.style,l,_,S;function E(){g(),v(window,"resize load",on(z(i,Jt))),a([Q,X],g),a(Jt,D)}function g(){l=e.direction===ge,nt(s,"maxWidth",Lt(e.width)),nt(m,c("paddingLeft"),R(!1)),nt(m,c("paddingRight"),R(!0)),D(!0)}function D(P){var O=et(s);(P||_.width!==O.width||_.height!==O.height)&&(nt(m,"height",x()),o(c("marginRight"),Lt(e.gap)),o("width",I()),o("height",F(),!0),_=O,i(Pe),S!==(S=U())&&(lt(s,Mr,S),i(Qr,S)))}function R(P){var O=e.padding,p=c(P?"right":"left");return O&&Lt(O[p]||(Gt(O)?0:O))||"0px"}function x(){var P="";return l&&(P=A(),jt(P,"height or heightRatio is missing."),P="calc("+P+" - "+R(!1)+" - "+R(!0)+")"),P}function A(){return Lt(e.height||et(d).width*e.heightRatio)}function I(){return e.autoWidth?null:Lt(e.fixedWidth)||(l?"":w())}function F(){return Lt(e.fixedHeight)||(l?e.autoHeight?null:w():A())}function w(){var P=Lt(e.gap);return"calc((100%"+(P&&" + "+P)+")/"+(e.perPage||1)+(P&&" - "+P)+")"}function T(){return et(d)[c("width")]}function L(P,O){var p=h(P||0);return p?et(p.slide)[c("width")]+(O?0:k()):0}function b(P,O){var p=h(P);if(p){var N=et(p.slide)[c("right")],G=et(d)[c("left")];return J(N-G)+(O?0:k())}return 0}function M(P){return b(t.length-1)-b(0)+L(0,P)}function k(){var P=h(0);return P&&parseFloat(nt(P.slide,c("marginRight")))||0}function $(P){return parseFloat(nt(m,c("padding"+(P?"Right":"Left"))))||0}function U(){return t.is(ee)||M(!0)>T()}return{mount:E,resize:D,listSize:T,slideSize:L,sliderSize:M,totalSize:b,getPadding:$,isOverflow:U}}var Cn=2;function Rn(t,r,e){var n=B(t),a=n.on,v=r.Elements,i=r.Slides,u=r.Direction.resolve,c=[],f;function s(){a(X,m),a([Q,Jt],h),(f=_())&&(o(f),r.Layout.resize(!0))}function m(){d(),s()}function d(){Tt(c),ct(c),n.destroy()}function h(){var S=_();f!==S&&(f<S||!S)&&n.emit(X)}function o(S){var E=i.get().slice(),g=E.length;if(g){for(;E.length<S;)se(E,E);se(E.slice(-S),E.slice(0,S)).forEach(function(D,R){var x=R<S,A=l(D.slide,R);x?Ce(A,E[0].slide):Ht(v.list,A),se(c,A),i.register(A,R-S+(x?0:g),D.index)})}}function l(S,E){var g=S.cloneNode(!0);return st(g,e.classes.clone),g.id=t.root.id+"-clone"+De(E+1),g}function _(){var S=e.clones;if(!t.is(Mt))S=0;else if(Wt(S)){var E=e[u("fixedWidth")]&&r.Layout.slideSize(0),g=E&&qt(et(v.track)[u("width")]/E);S=g||e[u("autoWidth")]&&t.length||e.perPage*Cn}return S}return{mount:s,destroy:d}}function In(t,r,e){var n=B(t),a=n.on,v=n.emit,i=t.state.set,u=r.Layout,c=u.slideSize,f=u.getPadding,s=u.totalSize,m=u.listSize,d=u.sliderSize,h=r.Direction,o=h.resolve,l=h.orient,_=r.Elements,S=_.list,E=_.track,g;function D(){g=r.Transition,a([bt,Pe,Q,X],R)}function R(){r.Controller.isBusy()||(r.Scroll.cancel(),A(t.index),r.Slides.update())}function x(p,N,G,j){p!==N&&P(p>G)&&(T(),I(w(M(),p>G),!0)),i(Nt),v(_t,N,G,p),g.start(N,function(){i(It),v(Zt,N,G,p),j&&j()})}function A(p){I(b(p,!0))}function I(p,N){if(!t.is(ee)){var G=N?p:F(p);nt(S,"transform","translate"+o("X")+"("+G+"px)"),p!==G&&v(mr)}}function F(p){if(t.is(Mt)){var N=L(p),G=N>r.Controller.getEnd(),j=N<0;(j||G)&&(p=w(p,G))}return p}function w(p,N){var G=p-U(N),j=d();return p-=l(j*(qt(J(G)/j)||1))*(N?1:-1),p}function T(){I(M(),!0),g.cancel()}function L(p){for(var N=r.Slides.get(),G=0,j=1/0,K=0;K<N.length;K++){var ht=N[K].index,y=J(b(ht,!0)-p);if(y<=j)j=y,G=ht;else break}return G}function b(p,N){var G=l(s(p-1)-$(p));return N?k(G):G}function M(){var p=o("left");return et(S)[p]-et(E)[p]+l(f(!1))}function k(p){return e.trimSpace&&t.is(xt)&&(p=wt(p,0,l(d(!0)-m()))),p}function $(p){var N=e.focus;return N==="center"?(m()-c(p,!0))/2:+N*c(p)||0}function U(p){return b(p?r.Controller.getEnd():0,!!e.trimSpace)}function P(p){var N=l(w(M(),p));return p?N>=0:N<=S[o("scrollWidth")]-et(E)[o("width")]}function O(p,N){N=Wt(N)?M():N;var G=p!==!0&&l(N)<l(U(!1)),j=p!==!1&&l(N)>l(U(!0));return G||j}return{mount:D,move:x,jump:A,translate:I,shift:w,cancel:T,toIndex:L,toPosition:b,getPosition:M,getLimit:U,exceededLimit:O,reposition:R}}function Nn(t,r,e){var n=B(t),a=n.on,v=n.emit,i=r.Move,u=i.getPosition,c=i.getLimit,f=i.toPosition,s=r.Slides,m=s.isEnough,d=s.getLength,h=e.omitEnd,o=t.is(Mt),l=t.is(xt),_=z(M,!1),S=z(M,!0),E=e.start||0,g,D=E,R,x,A;function I(){F(),a([Q,X,le],F),a(Pe,w)}function F(){R=d(!0),x=e.perMove,A=e.perPage,g=P();var y=wt(E,0,h?g:R-1);y!==E&&(E=y,i.reposition())}function w(){g!==P()&&v(le)}function T(y,W,Z){if(!ht()){var Y=b(y),q=U(Y);q>-1&&(W||q!==E)&&(G(q),i.move(Y,q,D,Z))}}function L(y,W,Z,Y){r.Scroll.scroll(y,W,Z,function(){var q=U(i.toIndex(u()));G(h?St(q,g):q),Y&&Y()})}function b(y){var W=E;if(Et(y)){var Z=y.match(/([+\-<>])(\d+)?/)||[],Y=Z[1],q=Z[2];Y==="+"||Y==="-"?W=k(E+ +(""+Y+(+q||1)),E):Y===">"?W=q?O(+q):_(!0):Y==="<"&&(W=S(!0))}else W=o?y:wt(y,0,g);return W}function M(y,W){var Z=x||(K()?1:A),Y=k(E+Z*(y?-1:1),E,!(x||K()));return Y===-1&&l&&!sr(u(),c(!y),1)?y?0:g:W?Y:U(Y)}function k(y,W,Z){if(m()||K()){var Y=$(y);Y!==y&&(W=y,y=Y,Z=!1),y<0||y>g?!x&&(ce(0,y,W,!0)||ce(g,W,y,!0))?y=O(p(y)):o?y=Z?y<0?-(R%A||A):R:y:e.rewind?y=y<0?g:0:y=-1:Z&&y!==W&&(y=O(p(W)+(y<W?-1:1)))}else y=-1;return y}function $(y){if(l&&e.trimSpace==="move"&&y!==E)for(var W=u();W===f(y,!0)&&ce(y,0,t.length-1,!e.rewind);)y<E?--y:++y;return y}function U(y){return o?(y+R)%R||0:y}function P(){for(var y=R-(K()||o&&x?1:A);h&&y-- >0;)if(f(R-1,!0)!==f(y,!0)){y++;break}return wt(y,0,R-1)}function O(y){return wt(K()?y:A*y,0,g)}function p(y){return K()?St(y,g):ue((y>=g?R-1:y)/A)}function N(y){var W=i.toIndex(y);return l?wt(W,0,g):W}function G(y){y!==E&&(D=E,E=y)}function j(y){return y?D:E}function K(){return!Wt(e.focus)||e.isNavigation}function ht(){return t.state.is([Nt,Ft])&&!!e.waitForTransition}return{mount:I,go:T,scroll:L,getNext:_,getPrev:S,getAdjacent:M,getEnd:P,setIndex:G,getIndex:j,toIndex:O,toPage:p,toDest:N,hasFocus:K,isBusy:ht}}var On="http://www.w3.org/2000/svg",wn="m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z",_e=40;function Dn(t,r,e){var n=B(t),a=n.on,v=n.bind,i=n.emit,u=e.classes,c=e.i18n,f=r.Elements,s=r.Controller,m=f.arrows,d=f.track,h=m,o=f.prev,l=f.next,_,S,E={};function g(){R(),a(Q,D)}function D(){x(),g()}function R(){var L=e.arrows;L&&!(o&&l)&&F(),o&&l&&(Yt(E,{prev:o,next:l}),Xt(h,L?"":"none"),st(h,S=We+"--"+e.direction),L&&(A(),T(),V([o,l],Qt,d.id),i(tn,o,l)))}function x(){n.destroy(),vt(h,S),_?(Tt(m?[o,l]:h),o=l=null):ot([o,l],Fe)}function A(){a([bt,Zt,X,Dt,le],T),v(l,"click",z(I,">")),v(o,"click",z(I,"<"))}function I(L){s.go(L,!0)}function F(){h=m||Ot("div",u.arrows),o=w(!0),l=w(!1),_=!0,Ht(h,[o,l]),!m&&Ce(h,d)}function w(L){var b='<button class="'+u.arrow+" "+(L?u.prev:u.next)+'" type="button"><svg xmlns="'+On+'" viewBox="0 0 '+_e+" "+_e+'" width="'+_e+'" height="'+_e+'" focusable="false"><path d="'+(e.arrowPath||wn)+'" />';return ir(b)}function T(){if(o&&l){var L=t.index,b=s.getPrev(),M=s.getNext(),k=b>-1&&L<b?c.last:c.prev,$=M>-1&&L>M?c.first:c.next;o.disabled=b<0,l.disabled=M<0,V(o,rt,k),V(l,rt,$),i(en,o,l,b,M)}}return{arrows:E,mount:g,destroy:x,update:T}}var Pn=Ne+"-interval";function xn(t,r,e){var n=B(t),a=n.on,v=n.bind,i=n.emit,u=fe(e.interval,t.go.bind(t,">"),A),c=u.isPaused,f=r.Elements,s=r.Elements,m=s.root,d=s.toggle,h=e.autoplay,o,l,_=h==="pause";function S(){h&&(E(),d&&V(d,Qt,f.track.id),_||g(),x())}function E(){e.pauseOnHover&&v(m,"mouseenter mouseleave",function(F){o=F.type==="mouseenter",R()}),e.pauseOnFocus&&v(m,"focusin focusout",function(F){l=F.type==="focusin",R()}),d&&v(d,"click",function(){_?g():D(!0)}),a([_t,xe,X],u.rewind),a(_t,I)}function g(){c()&&r.Slides.isEnough()&&(u.start(!e.resetProgress),l=o=_=!1,x(),i(dr))}function D(F){F===void 0&&(F=!0),_=!!F,x(),c()||(u.pause(),i(hr))}function R(){_||(o||l?D(!1):g())}function x(){d&&(lt(d,Ct,!_),V(d,rt,e.i18n[_?"play":"pause"]))}function A(F){var w=f.bar;w&&nt(w,"width",F*100+"%"),i(an,F)}function I(F){var w=r.Slides.getAt(F);u.set(w&&+it(w.slide,Pn)||e.interval)}return{mount:S,destroy:u.cancel,play:g,pause:D,isPaused:c}}function Mn(t,r,e){var n=B(t),a=n.on;function v(){e.cover&&(a(gr,z(u,!0)),a([bt,Q,X],z(i,!0)))}function i(c){r.Slides.forEach(function(f){var s=Bt(f.container||f.slide,"img");s&&s.src&&u(c,s,f)})}function u(c,f,s){s.style("background",c?'center/cover no-repeat url("'+f.src+'")':"",!0),Xt(f,c?"none":"")}return{mount:v,destroy:z(i,!1)}}var Vn=10,kn=600,Fn=.6,Gn=1.5,Wn=800;function zn(t,r,e){var n=B(t),a=n.on,v=n.emit,i=t.state.set,u=r.Move,c=u.getPosition,f=u.getLimit,s=u.exceededLimit,m=u.translate,d=t.is(xt),h,o,l=1;function _(){a(_t,D),a([Q,X],R)}function S(A,I,F,w,T){var L=c();if(D(),F&&(!d||!s())){var b=r.Layout.sliderSize(),M=Oe(A)*b*ue(J(A)/b)||0;A=u.toPosition(r.Controller.toDest(A%b))+M}var k=sr(L,A,1);l=1,I=k?0:I||oe(J(A-L)/Gn,Wn),o=w,h=fe(I,E,z(g,L,A,T),1),i(Ft),v(xe),h.start()}function E(){i(It),o&&o(),v(Dt)}function g(A,I,F,w){var T=c(),L=A+(I-A)*x(w),b=(L-T)*l;m(T+b),d&&!F&&s()&&(l*=Fn,J(b)<Vn&&S(f(s(!0)),kn,!1,o,!0))}function D(){h&&h.cancel()}function R(){h&&!h.isPaused()&&(D(),E())}function x(A){var I=e.easingFunc;return I?I(A):1-Math.pow(1-A,4)}return{mount:_,destroy:D,scroll:S,cancel:R}}var Vt={passive:!1,capture:!0};function Hn(t,r,e){var n=B(t),a=n.on,v=n.emit,i=n.bind,u=n.unbind,c=t.state,f=r.Move,s=r.Scroll,m=r.Controller,d=r.Elements.track,h=r.Media.reduce,o=r.Direction,l=o.resolve,_=o.orient,S=f.getPosition,E=f.exceededLimit,g,D,R,x,A,I=!1,F,w,T;function L(){i(d,Be,pe,Vt),i(d,$e,pe,Vt),i(d,kr,M,Vt),i(d,"click",U,{capture:!0}),i(d,"dragstart",ft),a([bt,Q],b)}function b(){var C=e.drag;Xe(!C),x=C==="free"}function M(C){if(F=!1,!w){var H=q(C);Y(C.target)&&(H||!C.button)&&(m.isBusy()?ft(C,!0):(T=H?d:window,A=c.is([Nt,Ft]),R=null,i(T,Be,k,Vt),i(T,$e,$,Vt),f.cancel(),s.cancel(),P(C)))}}function k(C){if(c.is(ne)||(c.set(ne),v(qr)),C.cancelable)if(A){f.translate(g+Z(K(C)));var H=ht(C)>Vr,At=I!==(I=E());(H||At)&&P(C),F=!0,v(Zr),ft(C)}else N(C)&&(A=p(C),ft(C))}function $(C){c.is(ne)&&(c.set(It),v(Jr)),A&&(O(C),ft(C)),u(T,Be,k),u(T,$e,$),A=!1}function U(C){!w&&F&&ft(C,!0)}function P(C){R=D,D=C,g=S()}function O(C){var H=G(C),At=j(H),kt=e.rewind&&e.rewindByDrag;h(!1),x?m.scroll(At,0,e.snap):t.is(ee)?m.go(_(Oe(H))<0?kt?"<":"-":kt?">":"+"):t.is(xt)&&I&&kt?m.go(E(!0)?">":"<"):m.go(m.toDest(At),!0),h(!0)}function p(C){var H=e.dragMinThreshold,At=Gt(H),kt=At&&H.mouse||0,zr=(At?H.touch:+H)||10;return J(K(C))>(q(C)?zr:kt)}function N(C){return J(K(C))>J(K(C,!0))}function G(C){if(t.is(Mt)||!I){var H=ht(C);if(H&&H<Vr)return K(C)/H}return 0}function j(C){return S()+Oe(C)*St(J(C)*(e.flickPower||600),x?1/0:r.Layout.listSize()*(e.flickMaxPages||1))}function K(C,H){return W(C,H)-W(y(C),H)}function ht(C){return Ie(C)-Ie(y(C))}function y(C){return D===C&&R||D}function W(C,H){return(q(C)?C.changedTouches[0]:C)["page"+l(H?"Y":"X")]}function Z(C){return C/(I&&t.is(xt)?An:1)}function Y(C){var H=e.noDrag;return!Ut(C,"."+wr+", ."+me)&&(!H||!Ut(C,H))}function q(C){return typeof TouchEvent!="undefined"&&C instanceof TouchEvent}function Wr(){return A}function Xe(C){w=C}return{mount:L,disable:Xe,isDragging:Wr}}var Un={Spacebar:" ",Right:he,Left:de,Up:Sr,Down:_r};function Ye(t){return t=Et(t)?t:t.key,Un[t]||t}var Fr="keydown";function Bn(t,r,e){var n=B(t),a=n.on,v=n.bind,i=n.unbind,u=t.root,c=r.Direction.resolve,f,s;function m(){d(),a(Q,h),a(Q,d),a(_t,l)}function d(){var S=e.keyboard;S&&(f=S==="global"?window:u,v(f,Fr,_))}function h(){i(f,Fr)}function o(S){s=S}function l(){var S=s;s=!0,qe(function(){s=S})}function _(S){if(!s){var E=Ye(S);E===c(de)?t.go("<"):E===c(he)&&t.go(">")}}return{mount:m,destroy:h,disable:o}}var re=Ne+"-lazy",ye=re+"-srcset",$n="["+re+"], ["+ye+"]";function Yn(t,r,e){var n=B(t),a=n.on,v=n.off,i=n.bind,u=n.emit,c=e.lazyLoad==="sequential",f=[Zt,Dt],s=[];function m(){e.lazyLoad&&(d(),a(X,d))}function d(){ct(s),h(),c?S():(v(f),a(f,o),o())}function h(){r.Slides.forEach(function(E){Re(E.slide,$n).forEach(function(g){var D=it(g,re),R=it(g,ye);if(D!==g.src||R!==g.srcset){var x=e.classes.spinner,A=g.parentElement,I=Bt(A,"."+x)||Ot("span",x,A);s.push([g,E,I]),g.src||Xt(g,"none")}})})}function o(){s=s.filter(function(E){var g=e.perPage*((e.preloadPages||1)+1)-1;return E[1].isWithin(t.index,g)?l(E):!0}),s.length||v(f)}function l(E){var g=E[0];st(E[1].slide,Ue),i(g,"load error",z(_,E)),V(g,"src",it(g,re)),V(g,"srcset",it(g,ye)),ot(g,re),ot(g,ye)}function _(E,g){var D=E[0],R=E[1];vt(R.slide,Ue),g.type!=="error"&&(Tt(E[2]),Xt(D,""),u(gr,D,R),u(Jt)),c&&S()}function S(){s.length&&l(s.shift())}return{mount:m,destroy:z(ct,s),check:o}}function Xn(t,r,e){var n=B(t),a=n.on,v=n.emit,i=n.bind,u=r.Slides,c=r.Elements,f=r.Controller,s=f.hasFocus,m=f.getIndex,d=f.go,h=r.Direction.resolve,o=c.pagination,l=[],_,S;function E(){g(),a([Q,X,le],E);var w=e.pagination;o&&Xt(o,w?"":"none"),w&&(a([_t,xe,Dt],F),D(),F(),v(rn,{list:_,items:l},I(t.index)))}function g(){_&&(Tt(o?gt(_.children):_),vt(_,S),ct(l),_=null),n.destroy()}function D(){var w=t.length,T=e.classes,L=e.i18n,b=e.perPage,M=s()?f.getEnd()+1:qt(w/b);_=o||Ot("ul",T.pagination,c.track.parentElement),st(_,S=Se+"--"+A()),V(_,dt,"tablist"),V(_,rt,L.select),V(_,ke,A()===ge?"vertical":"");for(var k=0;k<M;k++){var $=Ot("li",null,_),U=Ot("button",{class:T.page,type:"button"},$),P=u.getIn(k).map(function(p){return p.slide.id}),O=!s()&&b>1?L.pageX:L.slideX;i(U,"click",z(R,k)),e.paginationKeyboard&&i(U,"keydown",z(x,k)),V($,dt,"presentation"),V(U,dt,"tab"),V(U,Qt,P.join(" ")),V(U,rt,we(O,k+1)),V(U,Pt,-1),l.push({li:$,button:U,page:k})}}function R(w){d(">"+w,!0)}function x(w,T){var L=l.length,b=Ye(T),M=A(),k=-1;b===h(he,!1,M)?k=++w%L:b===h(de,!1,M)?k=(--w+L)%L:b==="Home"?k=0:b==="End"&&(k=L-1);var $=l[k];$&&(rr($.button),d(">"+k),ft(T,!0))}function A(){return e.paginationDirection||e.direction}function I(w){return l[f.toPage(w)]}function F(){var w=I(m(!0)),T=I(m());if(w){var L=w.button;vt(L,Ct),ot(L,pr),V(L,Pt,-1)}if(T){var b=T.button;st(b,Ct),V(b,pr,!0),V(b,Pt,"")}v(nn,{list:_,items:l},w,T)}return{items:l,mount:E,destroy:g,getAt:I,update:F}}var Kn=[" ","Enter"];function jn(t,r,e){var n=e.isNavigation,a=e.slideFocus,v=[];function i(){t.splides.forEach(function(o){o.isParent||(f(t,o.splide),f(o.splide,t))}),n&&s()}function u(){v.forEach(function(o){o.destroy()}),ct(v)}function c(){u(),i()}function f(o,l){var _=B(o);_.on(_t,function(S,E,g){l.go(l.is(Mt)?g:S)}),v.push(_)}function s(){var o=B(t),l=o.on;l(lr,d),l(Er,h),l([bt,Q],m),v.push(o),o.emit(vr,t.splides)}function m(){V(r.Elements.list,ke,e.direction===ge?"vertical":"")}function d(o){t.go(o.index)}function h(o,l){be(Kn,Ye(l))&&(d(o),ft(l))}return{setup:z(r.Media.set,{slideFocus:Wt(a)?n:a},!0),mount:i,destroy:u,remount:c}}function qn(t,r,e){var n=B(t),a=n.bind,v=0;function i(){e.wheel&&a(r.Elements.track,"wheel",u,Vt)}function u(f){if(f.cancelable){var s=f.deltaY,m=s<0,d=Ie(f),h=e.wheelMinThreshold||0,o=e.wheelSleep||0;J(s)>h&&d-v>o&&(t.go(m?"<":">"),v=d),c(m)&&ft(f)}}function c(f){return!e.releaseWheel||t.state.is(Nt)||r.Controller.getAdjacent(f)!==-1}return{mount:i}}var Zn=90;function Jn(t,r,e){var n=B(t),a=n.on,v=r.Elements.track,i=e.live&&!e.isNavigation,u=Ot("span",En),c=fe(Zn,z(s,!1));function f(){i&&(d(!r.Autoplay.isPaused()),V(v,Cr,!0),u.textContent="\u2026",a(dr,z(d,!0)),a(hr,z(d,!1)),a([Zt,Dt],z(s,!0)))}function s(h){V(v,br,h),h?(Ht(v,u),c.start()):(Tt(u),c.cancel())}function m(){ot(v,[Lr,Cr,br]),Tt(u)}function d(h){i&&V(v,Lr,h?"off":"polite")}return{mount:f,disable:d,destroy:m}}var Qn=Object.freeze({__proto__:null,Media:un,Direction:cn,Elements:pn,Slides:Ln,Layout:bn,Clones:Rn,Move:In,Controller:Nn,Arrows:Dn,Autoplay:xn,Cover:Mn,Scroll:zn,Drag:Hn,Keyboard:Bn,LazyLoad:Yn,Pagination:Xn,Sync:jn,Wheel:qn,Live:Jn}),ti={prev:"Previous slide",next:"Next slide",first:"Go to first slide",last:"Go to last slide",slideX:"Go to slide %s",pageX:"Go to page %s",play:"Start autoplay",pause:"Pause autoplay",carousel:"carousel",slide:"slide",select:"Select a slide to show",slideLabel:"%s of %s"},ei={type:"slide",role:"region",speed:400,perPage:1,cloneStatus:!0,arrows:!0,pagination:!0,paginationKeyboard:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",live:!0,classes:_n,i18n:ti,reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}};function ri(t,r,e){var n=r.Slides;function a(){B(t).on([bt,X],v)}function v(){n.forEach(function(u){u.style("transform","translateX(-"+100*u.index+"%)")})}function i(u,c){n.style("transition","opacity "+e.speed+"ms "+e.easing),qe(c)}return{mount:a,start:i,cancel:pe}}function ni(t,r,e){var n=r.Move,a=r.Controller,v=r.Scroll,i=r.Elements.list,u=z(nt,i,"transition"),c;function f(){B(t).bind(i,"transitionend",function(h){h.target===i&&c&&(m(),c())})}function s(h,o){var l=n.toPosition(h,!0),_=n.getPosition(),S=d(h);J(l-_)>=1&&S>=1?e.useScroll?v.scroll(l,S,!1,o):(u("transform "+S+"ms "+e.easing),n.translate(l,!0),c=o):(n.jump(h),o())}function m(){u(""),v.cancel()}function d(h){var o=e.rewindSpeed;if(t.is(xt)&&o){var l=a.getIndex(!0),_=a.getEnd();if(l===0&&h>=_||l>=_&&h===0)return o}return e.speed}return{mount:f,start:s,cancel:m}}var ii=function(){function t(e,n){this.event=B(),this.Components={},this.state=sn(Rt),this.splides=[],this._o={},this._E={};var a=Et(e)?ar(document,e):e;jt(a,a+" is invalid."),this.root=a,n=mt({label:it(a,rt)||"",labelledby:it(a,Ve)||""},ei,t.defaults,n||{});try{mt(n,JSON.parse(it(a,Ne)))}catch{jt(!1,"Invalid JSON")}this._o=Object.create(mt({},n))}var r=t.prototype;return r.mount=function(n,a){var v=this,i=this.state,u=this.Components;jt(i.is([Rt,ie]),"Already mounted!"),i.set(Rt),this._C=u,this._T=a||this._T||(this.is(ee)?ri:ni),this._E=n||this._E;var c=Yt({},Qn,this._E,{Transition:this._T});return pt(c,function(f,s){var m=f(v,u,v._o);u[s]=m,m.setup&&m.setup()}),pt(u,function(f){f.mount&&f.mount()}),this.emit(bt),st(this.root,mn),i.set(It),this.emit(cr),this},r.sync=function(n){return this.splides.push({splide:n}),n.splides.push({splide:this,isParent:!0}),this.state.is(It)&&(this._C.Sync.remount(),n.Components.Sync.remount()),this},r.go=function(n){return this._C.Controller.go(n),this},r.on=function(n,a){return this.event.on(n,a),this},r.off=function(n){return this.event.off(n),this},r.emit=function(n){var a;return(a=this.event).emit.apply(a,[n].concat(gt(arguments,1))),this},r.add=function(n,a){return this._C.Slides.add(n,a),this},r.remove=function(n){return this._C.Slides.remove(n),this},r.is=function(n){return this._o.type===n},r.refresh=function(){return this.emit(X),this},r.destroy=function(n){n===void 0&&(n=!0);var a=this.event,v=this.state;return v.is(Rt)?B(this).on(cr,this.destroy.bind(this,n)):(pt(this._C,function(i){i.destroy&&i.destroy(n)},!0),a.emit(fr),a.destroy(),n&&ct(this.splides),v.set(ie)),this},Hr(t,[{key:"options",get:function(){return this._o},set:function(n){this._C.Media.set(n,!0,!0)}},{key:"length",get:function(){return this._C.Slides.getLength(!0)}},{key:"index",get:function(){return this._C.Controller.getIndex()}}]),t}(),Ae=ii;Ae.defaults={};Ae.STATES=Br;function Gr(t={}){return{config:{options:{},buildMarkup:!1,...t},splide:null,get index(){return this.splide?this.splide.index:0},init(){this.splideInit()},splideInit(){let r=this.$root;this.$refs.slider&&(r=this.$refs.slider),this.config.buildMarkup&&this.buildMarkup(r),this.splide=new Ae(r,this.config.options),this.splide.mount()},buildMarkup(r){r.classList.add("splide"),[...r.children].forEach(i=>{i.classList.add("splide__slide")});let n=r.innerHTML,v=r.firstElementChild.tagName==="LI"?"ul":"div";r.innerHTML=`<div class="splide__track"><${v} class="splide__list">${n}</${v}></div>`}}}document.addEventListener("alpine:init",()=>{window.Alpine.data("Splide",Gr)});
/*!
* Splide.js
* Version : 4.1.2
* License : MIT
* Copyright: 2022 Naotoshi Fujita
*/