splide.min.js 28 KB

12345678
  1. /*!
  2. * Splide.js
  3. * Version : 4.1.3
  4. * License : MIT
  5. * Copyright: 2022 Naotoshi Fujita
  6. */
  7. var t,n;t=this,n=function(){"use strict";const g="(prefers-reduced-motion: reduce)";const F=4,ct=5;var n={CREATED:1,MOUNTED:2,IDLE:3,MOVING:F,SCROLLING:ct,DRAGGING:6,DESTROYED:7};function _(t){t.length=0}function M(t,...n){return t.bind(null,...n)}const c=setTimeout,st=()=>{};function v(t){return requestAnimationFrame(t)}function e(t,n){return typeof n===t}function at(t){return!o(t)&&e("object",t)}const i=Array.isArray,m=M(e,"function"),T=M(e,"string"),ft=(M(e,"boolean"),M(e,"undefined"));function o(t){return null===t}function y(t){try{return t instanceof(t.ownerDocument.defaultView||window).HTMLElement}catch(t){return!1}}function w(t){return i(t)?t:[t]}function p(t,n){w(t).forEach(n)}function b(t,n){return t.push(...w(n)),t}const r=Array.prototype;function s(t,n,e){return r.slice.call(t,n,e)}function N(t,n){return r.includes.call(t,n)}function a(t,n){if(!t)throw new Error(n)}const z=Object.assign,x=Object.keys;function u(n,e,t){n&&(t?x(n).reverse():x(n)).forEach(t=>{"__proto__"!==t&&e(n[t],t)})}function h(e,...t){return t.forEach(t=>{u(t,(t,n)=>{i(t)?t=t.slice():at(t)&&(t=h({},at(e[n])?e[n]:{},t)),e[n]=t})}),e}function S(n,t){p(t||x(n),t=>{delete n[t]})}function O(n,t,e){n&&p(T(t)?t.split(" "):t,t=>{t&&n.classList.toggle(t,e)})}function C(t,n){O(t,n,!0)}function A(t,...n){t&&t.append(...n)}function $(t,...n){t&&t.before(...n)}function lt(t,n){return y(t)&&t.matches(n)}function k(t,n){const e=t?s(t.children):[];return n?e.filter(t=>lt(t,n)):e}function dt(t,n){return n?k(t,n)[0]:t.firstElementChild}function D(t,e){p(t,n=>{p(e,t=>{n&&n.removeAttribute(t)})})}function I(e,n,i){at(n)?u(n,(t,n)=>{I(e,n,t)}):p(e,t=>{o(i)||""===i?D(t,n):t.setAttribute(n,String(i))})}function R(t,n,e){t=document.createElement(t);return n&&(T(n)?C:I)(t,n),e&&A(e,t),t}function j(t,n,e){if(ft(e))return getComputedStyle(t)[n];o(e)||(t.style[n]=""+e)}function vt(t,n){j(t,"display",n)}function ht(t){y(t)&&t.focus({preventScroll:!0})}function P(t,n){return t.getAttribute(n)}function gt(t,n){return!!t&&t.classList.contains(n)}function G(t){return t.getBoundingClientRect()}function X(t){p(t,t=>{t&&t.parentNode&&t.parentNode.removeChild(t)})}function L(t){return dt((new DOMParser).parseFromString(t,"text/html").body)}function W(t,n){t.preventDefault(),n&&(t.stopPropagation(),t.stopImmediatePropagation())}function E(t,n){return t&&t.querySelector(n)}function pt(t,n){return n&&t?s(t.querySelectorAll(n)):[]}function Y(t,n){O(t,n,!1)}function mt(t){return t.timeStamp}function B(t){return T(t)?t:t?t+"px":""}const{min:q,max:yt,floor:wt,ceil:bt,abs:H,sign:xt}=Math;function St(t,n,e){return H(t-n)<e}function kt(t,n,e,i){var o=q(n,e),n=yt(n,e);return i?o<t&&t<n:o<=t&&t<=n}function J(t,n,e){var i=q(n,e),n=yt(n,e);return q(yt(i,t),n)}function Et(t,...n){return n.reduce((t,n)=>t.replace("%s",""+n),t)}function zt(t,n=2){return(""+t).padStart(n,"0")}const At={};function f(t,n){p(t,t=>{T(t)&&t.split(" ").forEach(n)})}function $t(t){const o=t||new Set,r=t?{}:void 0;let u;return{bind:function(n,t,e,i){a(!u),f(t,t=>{n.addEventListener(t,e,i),o.add([n.removeEventListener.bind(n,t,e,i),r])})},lock:M($t,o),destroy:function(t){o.forEach(t=>{r&&t[1]!==r||(t[0](),o.delete(t))}),u=t}}}function l(t){const e=t||{},i=t?{}:void 0;let o;function r(t){return e[t]||[]}return{on:function(t,n){a(!o),f(t,t=>{e[t]=b(r(t),[[n,i]])})},off:function(t,n){f(t,t=>{e[t]=r(t).filter(t=>!((!n||t[0]===n)&&t[1]===i))})},emit:function(t,...n){r(t).forEach(t=>t[0]&&t[0](...n))},lock:M(l,e),destroy:function(t){u(e,(t,n)=>{e[n]=t.filter(t=>{var n=!i||t[1]===i;return n&&_(t),!n})}),i||S(e),o=t}}}function d(n=$t(),e=l()){return z({},n,e,{lock:function(){return d(n.lock(),e.lock())},destroy:function(t){n.destroy(t),e.destroy(t)}})}function Lt(n,t,e,i){const o=Date["now"];let r,u=0,c,s=!0,a=0;function f(){if(!s){if(u=n?q((o()-r)/n,1):1,e&&e(u),1<=u&&(t(),r=o(),i&&++a>=i))return l();c=v(f)}}function l(){s=!0}function d(){c&&cancelAnimationFrame(c),u=0,c=0,s=!0}return{start:function(t){t||d(),r=o()-(t?u*n:0),s=!1,c=v(f)},rewind:function(){r=o(),u=0,e&&e(u)},pause:l,cancel:d,set:function(t){n=t},isPaused:function(){return s}}}function Pt(t){let n=t;return{set:function(t){n=t},is:function(t){return N(w(t),n)}}}const K="mounted",U="move",_t="moved",Ot="click",Ct="active",Dt="inactive",It="visible",Mt="hidden",V="refresh",Q="updated",Tt="resize",Nt="resized",Rt="scroll",Z="scrolled",jt="overflow",Ft="navigation:mounted",Gt="autoplay:play",Xt="autoplay:pause",Wt="_sk",Yt="_sh",Bt="_ei",qt="!overflow";const Ht="ArrowLeft",Jt="ArrowRight";const Kt="ttb",Ut={width:["height"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],Y:["X"],ArrowLeft:["ArrowUp",Jt],ArrowRight:["ArrowDown",Ht]};const tt="role",nt="tabindex";const Vt="aria-controls",Qt="aria-current",Zt="aria-selected",et="aria-label",tn="aria-labelledby",nn="aria-hidden",en="aria-orientation",on="aria-roledescription",rn="aria-live",un="aria-busy",cn="aria-atomic",sn=[tt,nt,"disabled",Vt,Qt,et,tn,nn,en,on],an="splide",fn="data-"+an;var t=an+"__";const ln=an,dn=t+"track",vn=t+"list",hn=t+"slide",gn=hn+"--clone",pn=hn+"__container",mn=t+"arrows",yn=t+"arrow",wn=yn+"--prev",bn=yn+"--next",xn=t+"pagination",Sn=xn+"__page",kn=t+"progress"+"__bar",En=t+"toggle",zn=t+"spinner",An=t+"sr",it="is-active",$n="is-prev",Ln="is-next",Pn="is-visible",_n="is-loading",On="is-focus-in",Cn="is-overflow",Dn=[it,Pn,$n,Ln,_n,On,Cn];t={slide:hn,clone:gn,arrows:mn,arrow:yn,prev:wn,next:bn,pagination:xn,page:Sn,spinner:zn};function In(t,n){if(!t)throw new Error(`[${an}] `+(n||""))}const Mn="touchstart mousedown",Tn="touchmove mousemove",Nn="touchend touchcancel mouseup click";const ot="slide",rt="loop",ut="fade",Rn=(r,i,e,u)=>{const t=r.event.lock(),{on:n,emit:o,bind:c}=t,{Components:s,root:a,options:f}=r,{isNavigation:l,updateOnMove:d,i18n:v,pagination:h,slideFocus:g}=f,p=s["Elements"],m=s.Direction["resolve"],y=P(u,"style"),w=P(u,et),b=-1<e,x=dt(u,"."+pn);let S;function k(){var t=r.splides.map(t=>{t=t.splide.Components.Slides.getAt(i);return t?t.slide.id:""}).join(" ");I(u,et,Et(v.slideX,(b?e:i)+1)),I(u,Vt,t),I(u,tt,g?"button":""),g&&D(u,on)}function E(){S||z()}function z(){var t,n,e;S||(t=r["index"],(e=A())!==gt(u,it)&&(O(u,it,e),I(u,Qt,l&&e||""),o(e?Ct:Dt,L)),e=$(),n=!e&&(!A()||b),r.state.is([F,ct])||I(u,nn,n||""),I(pt(u,f.focusableNodes||""),nt,n?-1:""),g&&I(u,nt,n?-1:0),e!==gt(u,Pn)&&(O(u,Pn,e),o(e?It:Mt,L)),e||document.activeElement!==u||(n=s.Slides.getAt(r.index))&&ht(n.slide),O(u,$n,i===t-1),O(u,Ln,i===t+1))}function A(){var t=r["index"],{cloneStatus:n=!0}=f;return t===i||n&&t===e}function $(t){var n,e,i,o;return r.is(ut)?A():(n=G(p.track),e=G(u),i=m("left",!0),o=m("right",!0),wt(n[i])<=bt(e[t?o:i])&&wt(e[t?i:o])<=bt(n[o]))}const L={index:i,slideIndex:e,slide:u,container:x,isClone:b,mount:function(){b||(u.id=a.id+"-slide"+zt(i+1),I(u,tt,h?"tabpanel":"group"),I(u,on,v.slide),I(u,et,w||Et(v.slideLabel,i+1,r.length))),c(u,"click",M(o,Ot,L)),c(u,"keydown",M(o,Wt,L)),n([_t,Yt,Z],z),n(Ft,k),d&&n(U,E)},destroy:function(){S=!0,t.destroy(),Y(u,Dn),D(u,sn),I(u,"style",y),I(u,et,w||"")},update:z,style:function(t,n,e){j(e&&x||u,t,n)},isVisible:$,isWithin:function(t,n){let e=H(t-i);return(e=b||!f.rewind&&!r.is(rt)?e:q(e,r.length-e))<=n}};return L};const jn=fn+"-interval";const Fn={passive:!1,capture:!0};const Gn=fn+"-lazy",Xn=Gn+"-srcset",Wn=`[${Gn}], [${Xn}]`;const Yn=[" ","Enter"];const Bn={Breakpoints:(i,t,o,n)=>{const r=i["state"],u=o.breakpoints||{},c=o.reducedMotion||{},s=$t(),a=[];function f(t){t&&s.destroy()}function l(t,n){const e=matchMedia(n);s.bind(e,"change",d),a.push([t,()=>e.matches])}function d(){var t=r.is(7),n=o.direction,e=a.reduce((t,n)=>h(t,n[1]()?n[0]:{}),{});S(o),v(e,!1,!r.is(1)),o.destroy?i.destroy("completely"===o.destroy):t?(f(!0),i.mount()):n!==o.direction&&i.refresh()}function v(t,n,e){h(o,t),n&&h(Object.getPrototypeOf(o),t),e&&i.emit(Q,o)}return{setup:function(){const e="min"===o.mediaQuery;x(u).sort((t,n)=>e?+t-+n:+n-+t).forEach(t=>{t!==qt&&l(u[t],`(${e?"min":"max"}-width:${t}px)`)}),u[qt]&&(a.push([u[qt],()=>t.Layout&&!t.Layout.isOverflow()]),n.on(jt,d)),l(c,g),d()},destroy:f,reduce:function(t){matchMedia(g).matches&&(t?h(o,c):S(o,x(c)))},set:v}},Direction:(t,n,o)=>{function e(t,n,e=o.direction){const i="rtl"!==e||n?e===Kt?0:-1:1;return Ut[t]&&Ut[t][i]||t.replace(/width|left|right/i,(t,n)=>{const e=Ut[t.toLowerCase()][i]||t;return 0<n?e.charAt(0).toUpperCase()+e.slice(1):e})}return{resolve:e,orient:function(t,n=o.direction){return t*("rtl"===n?1:-1)},left:M(e,"left"),right:M(e,"right"),width:M(e,"width")}},Elements:(t,n,e,i)=>{const{on:o,bind:r}=i,u=t["root"],c=e["i18n"],s={},a=[];let f=[],l=[],d,v,h;function g(){d=y(dn),v=dt(d,"."+vn),In(d&&v,"A track/list element is missing."),b(a,k(v,`.${hn}:not(.${gn})`)),z(s,{root:u,track:d,list:v,slides:a,arrows:y(mn),pagination:y(xn),prev:y(wn),next:y(bn),bar:y(kn),toggle:y(En)});var{role:t="region"}=e,n=u.id||function(t){return""+t+zt(At[t]=(At[t]||0)+1)}(an);u.id=n,d.id=d.id||n+"-track",v.id=v.id||n+"-list",!P(u,tt)&&"SECTION"!==u.tagName&&t&&I(u,tt,t),I(u,on,c.carousel),I(v,tt,"presentation"),m()}function p(t){var n=sn.concat("style");_(a),Y(u,f),Y(d,l),D([d,v],n),D(u,t?n:["style",on])}function m(){Y(u,f),Y(d,l),f=w(ln),l=w(dn),C(u,f),C(d,l),I(u,et,e.label),I(u,tn,e.labelledby)}function y(t){var n,e,t=E(u,"."+t);return t&&(n=t,e="."+ln,n.closest(e)===u)?t:void 0}function w(t){return[t+"--"+e.type,t+"--"+e.direction,e.drag&&t+"--draggable",e.isNavigation&&t+"--nav",t===ln&&it]}return z(s,{setup:g,mount:function(){o(V,p),o(V,g),o(Q,m),r(document,Mn+" keydown",t=>{h="keydown"===t.type},{capture:!0}),r(u,"focusin",()=>{O(u,On,!!h)})},destroy:p})},Slides:(o,r,u,t)=>{const{on:n,emit:c,bind:s}=t,{slides:a,list:f}=r.Elements,l=[];function e(){a.forEach((t,n)=>d(t,n,-1))}function i(){h(t=>t.destroy()),_(l)}function d(t,n,e){const i=Rn(o,n,e,t);i.mount(),l.push(i),l.sort((t,n)=>t.index-n.index)}function v(t){return t?g(t=>!t.isClone):l}function h(t,n){v(n).forEach(t)}function g(n){return l.filter(m(n)?n:t=>T(n)?lt(t.slide,n):N(w(n),t.index))}return{mount:function(){e(),n(V,i),n(V,e)},destroy:i,update:function(){h(t=>t.update())},register:d,get:v,getIn:function(t){const n=r["Controller"],e=n.toIndex(t),i=n.hasFocus()?1:u.perPage;return g(t=>kt(t.index,e,e+i-1))},getAt:function(t){return g(t)[0]},add:function(t,n){p(t,t=>{if(y(t=T(t)?L(t):t)){var e=a[n];e?$(e,t):A(f,t),C(t,u.classes.slide);{var e=t,i=M(c,Tt);const o=pt(e,"img");let n=o["length"];n?o.forEach(t=>{s(t,"load error",()=>{--n||i()})}):i()}}}),c(V)},remove:function(t){X(g(t).map(t=>t.slide)),c(V)},forEach:h,filter:g,style:function(n,e,i){h(t=>t.style(n,e,i))},getLength:function(t){return(t?a:l).length},isEnough:function(){return l.length>u.perPage}}},Layout:(n,i,e,t)=>{const{on:o,bind:r,emit:u}=t;t=i.Slides;const{resolve:c,left:s,right:a,width:f}=i.Direction,{root:l,track:d,list:v}=i.Elements,{getAt:h,style:g}=t;let p,m,y;function w(){p=e.direction===Kt,j(l,"maxWidth",B(e.width)),j(d,c("paddingLeft"),x(!1)),j(d,c("paddingRight"),x(!0)),b(!0)}function b(t){var n=G(l);!t&&m.width===n.width&&m.height===n.height||(j(d,"height",function(){let t="";p&&(In(t=S(),"height or heightRatio is missing."),t=`calc(${t} - ${x(!1)} - ${x(!0)})`);return t}()),g(c("marginRight"),B(e.gap)),g("width",e.autoWidth?null:B(e.fixedWidth)||(p?"":k())),g("height",B(e.fixedHeight)||(p?e.autoHeight?null:k():S()),!0),m=n,u(Nt),y!==(y=P())&&(O(l,Cn,y),u(jt,y)))}function x(t){var n=e["padding"],t=(t?a:s)();return n&&B(n[t]||(at(n)?0:n))||"0px"}function S(){return B(e.height||G(v).width*e.heightRatio)}function k(){var t=B(e.gap);return`calc((100%${t&&" + "+t})/${e.perPage||1}${t&&" - "+t})`}function E(t){return t?v[c("scrollWidth")]:G(v)[f()]}function z(t=0,n){t=h(t);return(t?G(t.slide)[f()]:0)+(n?0:L())}function A(t,n){var e=i.Slides.get()[0],t=h(t);return e&&t?H(G(t.slide)[a()]-G(e.slide)[s()])+(n?0:L()):0}function $(t){return A(n.length-1)-A(0)+z(0,t)}function L(){var t=h(0),n=h(1);return t&&n?(t=G(t.slide),H(G(n.slide)[s()]-t[s()])-t[f()]):0}function P(){return n.is(ut)||$(!0)>E()}return{mount:function(){w(),r(window,"resize load",function(t,n){const e=Lt(n||0,t,void 0,1);return()=>{e.isPaused()&&e.start()}}(M(u,Tt))),o([Q,V],w),o(Tt,b)},resize:b,trackSize:function(){return G(d)[f()]},listSize:E,slideSize:z,sliderSize:$,totalSize:A,getPadding:function(t){return parseFloat(j(d,c("padding"+(t?"Right":"Left"))))||0},isOverflow:P}},Clones:(c,e,s,n)=>{const t=n["on"],{Elements:a,Slides:f,Layout:{resize:i,trackSize:o}}=e,r=e.Direction["resolve"],l=[];let d;function u(){if(t(V,v),t([Q,Tt],g),d=p()){{var o=d;const r=f.get().slice(),u=r["length"];if(u){for(;r.length<o;)b(r,r);b(r.slice(-o),r.slice(0,o)).forEach((t,n)=>{var e=n<o,i=function(t,n){const e=t.cloneNode(!0);return C(e,s.classes.clone),e.id=c.root.id+"-clone"+zt(n+1),e}(t.slide,n);e?$(r[0].slide,i):A(a.list,i),b(l,i),f.register(i,n-o+(e?0:u),t.index)})}}i(!0)}}function v(){h(),u(),i(!0)}function h(){X(l),_(l),n.destroy()}function g(){var t=p();d!==t&&(d<t||!t)&&(t||c.go(0),n.emit(V))}function p(){let t=s["clones"];var n;return c.is(rt)?ft(t)&&(n=(n=s[r("fixedWidth")]&&e.Layout.slideSize(0))&&bt(o()/n),t=n||s[r("autoWidth")]&&c.length||2*s.perPage):t=0,t}return{mount:u,destroy:h}},Move:(u,n,i,t)=>{const{on:e,emit:c}=t,{set:s,is:o}=u.state,a=n["Slides"],{slideSize:r,getPadding:f,listSize:l,sliderSize:d,totalSize:v,trackSize:h}=n.Layout,{resolve:g,orient:p}=n.Direction,{list:m,track:y}=n.Elements;let w,b,x;function S(){n.Controller.isBusy()||(n.Scroll.cancel(),z(u.index),a.update())}function k(){s(3),c(_t,...b),x&&x()}function E(){o(F)&&b&&(A(P(),!0),w.cancel(),k())}function z(t){A(L(t))}function A(t,n){u.is(ut)||(n=n?t:function(t){{var n;!u.is(rt)||(n=p(t)-p(P()))&&C(0<n,t)&&(t=$(t,0<n))}return t}(t),j(m,"transform",`translate${g("X")}(${n}px)`),t!==n&&c(Yt))}function $(t,n){var e=t-_(n),i=d();return t-=p(i*(bt(H(e)/i)||1))*(n?1:-1)}function L(t){let n=p(v(t-1)-(t=t,"center"===(e=i.focus)?(l()-r(t,!0))/2:+e*r(t)||0));var e;return n=i.trimSpace&&u.is(ot)?J(n,0,p(d(!0)-l())):n}function P(){var t=g("left");return G(m)[t]-G(y)[t]+p(f(!1))}function _(t){return L(t?n.Controller.getEnd():0)}function O(t){var n=f(!1),e=p($(P(),t));return t?n<=e:e<=l(!0)-h()+n}function C(t,n=P()){var e=!0!==t&&p(n)<p(_(!1)),t=!1!==t&&p(n)>p(_(!0));return e||t}return{mount:function(){w=n.Transition,e([K,Nt,Q,V],S)},move:function(t,n,e,i,o){E();var r=t!==n?n<t:i;(t!==n||C(i))&&O(r)&&A($(P(),r),!0),b=[n,e,t],x=o,s(F),c(U,n,e,t),w.start(n,k)},jump:z,translate:A,shift:$,cancel:E,toIndex:function(n){var e=a.get();let i=0,o=1/0;for(let t=0;t<e.length;t++){var r=e[t].index,u=H(L(r)-n);if(!(u<=o))break;o=u,i=r}return i},toPosition:L,getPosition:P,getRate:function(t){var n,e,i,o=!ft(t);let r;return u.is(ut)?r=(o?t:u.index)/(u.length-1):(n=u.is(rt),o=p(o?L(t):P()),t=p(_(!1)),e=p(_(!0)),i=d(),r=(o-t)%i/(n?i:e-t)||0,n&&r<0&&(r+=1)),J(r,0,1)},getLimit:_,exceededLimit:C,reposition:S,canShift:O}},Scroll:(t,u,c,n)=>{const{on:e,emit:s}=n,{set:a}=t["state"],f=u["Move"],{getPosition:l,getLimit:d,exceededLimit:v,translate:h}=f,g=t.is(ot);let p,m,y=1;function w(t,n,e,i,o){S();var t=function(t,n){{var e;!n||g&&v()||(n=t%u.Layout.sliderSize(),e=f.toPosition(u.Controller.toDest(n)),t-=n-e)}return t}(t,e),e=l(),r=St(e,t,1)||0===n;y=1,n=r?0:n||yt(H(t-e)/1.5,800),m=i,p=Lt(n,b,M(x,e,t,o),1),a(ct),s(Rt),p.start()}function b(){a(3),m&&m(),s(Z)}function x(t,n,e,i){const{easingFunc:o=t=>1-Math.pow(1-t,4)}=c;var r=l(),n=(t+(n-t)*o(i)-r)*y;h(r+n),s("scrolling"),g&&!e&&v()&&(y*=.6,H(n)<10&&w(d(v(!0)),600,!1,m,!0))}function S(){p&&p.cancel()}function i(){p&&!p.isPaused()&&(S(),b())}return{mount:function(){e(U,S),e([Q,V],i)},destroy:S,scroll:w,cancel:i}},Controller:(o,i,r,t)=>{const{on:n,emit:e}=t,{Move:u,Scroll:c}=i,{getPosition:s,getLimit:a,toPosition:f}=u,{isEnough:l,getLength:d}=i.Slides,v=r["omitEnd"],h=o.is(rt),g=o.is(ot);var t=M(A,!1),p=M(A,!0);let m=r.start||0,y,w=m,b,x,S;function k(){b=d(!0),x=r.perMove,S=r.perPage,y=P();var t=v?y:b-1,t=J(m,0,t);(w=t)!==m&&(m=t,u.reposition())}function E(){y!==P()&&e(Bt)}function z(t,n){var e,i,o;I()||([t,e]=function(t){let n=m,e=!0;if(T(t)){const[,o,r]=t.match(/([+-]|>>?|<<?)(-?\d+)?/)||[];var i=(...t)=>N(t,o);e=i("+",">",">>"),i("+","-")?n=$(m+ +(""+o+(+r||1)),m):i(">","<")?n=r?_(+r):A(!e,!0):i(">>","<<")&&(n=r?+r||0:e?y:0)}else n=h?t:J(t,0,y);return[n,e]}(t),o=t===(i=L(t))||u.exceededLimit(!e)||u.canShift(e),-1<i&&o&&(c.cancel(),C(i),u.move(t,i,w,e,n)))}function A(t,n){var e=x||(D()?1:S),e=$(m+e*(t?-1:1),m,!(x||D()));return-1===e&&g&&!St(s(),a(!t),1)?t?0:y:n?e:L(e)}function $(t,n,e){var i;return l()||D()?((i=function(t){if(g&&"move"===r.trimSpace&&t!==m)for(var n=s();n===f(t)&&kt(t,0,o.length-1,!r.rewind);)t<m?--t:++t;return t}(t))!==t&&(n=t,t=i,e=!1),t<0||t>y?t=x||!kt(0,t,n,!0)&&!kt(y,n,t,!0)?h?e?t<0?-(b%S||S):b:t:r.rewind?t<0?y:0:-1:_(O(t)):e&&t!==n&&(t=_(O(n)+(t<n?-1:1)))):t=-1,t}function L(t){return h?(t+b)%b||0:t}function P(){let t=b-(D()||h&&x?1:S);for(;v&&0<t--;)if(!St(f(b-1),f(t),.01)){t++;break}return J(t,0,b-1)}function _(t){return J(D()?t:S*t,0,y)}function O(t){return D()?q(t,y):wt((t>=y?b-1:t)/S)}function C(t){t!==m&&(w=m,m=t)}function D(){return!ft(r.focus)||r.isNavigation}function I(){return o.state.is([F,ct])&&!!r.waitForTransition}return{mount:function(){k(),n([Q,V,Bt],k),n(Nt,E)},go:z,jump:function(t){const n=i.Breakpoints["set"];var e=r["speed"];n({speed:0}),z(t),n({speed:e})},scroll:function(t,n,e,i){c.scroll(t,n,e,()=>{var t=L(u.toIndex(s()));C(v?q(t,y):t),i&&i()})},getNext:t,getPrev:p,getAdjacent:A,getEnd:P,setIndex:C,getIndex:function(t){return t?w:m},toIndex:_,toPage:O,toDest:function(t){return t=u.toIndex(t),g?J(t,0,y):t},hasFocus:D,isBusy:I}},Arrows:(o,t,n,e)=>{const{on:i,bind:r,emit:u}=e,{classes:c,i18n:s}=n,{Elements:a,Controller:f}=t,{arrows:l,track:d}=a;let v=l,h=a.prev,g=a.next,p,m;const y={};function w(){var{arrows:t=!0}=n;!t||h&&g||(v=l||R("div",c.arrows),h=k(!0),g=k(!1),p=!0,A(v,h,g),l||$(d,v)),h&&g&&(z(y,{prev:h,next:g}),vt(v,t?"":"none"),C(v,m=mn+"--"+n.direction),t&&(i([K,_t,V,Z,Bt],E),r(g,"click",M(S,">")),r(h,"click",M(S,"<")),E(),I([h,g],Vt,d.id),u("arrows:mounted",h,g))),i(Q,b)}function b(){x(),w()}function x(){e.destroy(),Y(v,m),p?(X(l?[h,g]:v),h=g=null):D([h,g],sn)}function S(t){f.go(t)}function k(t){return L(`<button class="${c.arrow} ${t?c.prev:c.next}" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="${n.arrowPath||"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"}" />`)}function E(){var t,n,e,i;h&&g&&(i=o.index,t=f.getPrev(),n=f.getNext(),e=-1<t&&i<t?s.last:s.prev,i=-1<n&&n<i?s.first:s.next,h.disabled=t<0,g.disabled=n<0,I(h,et,e),I(g,et,i),u("arrows:updated",h,g,t,n))}return{arrows:y,mount:w,destroy:x,update:E}},Autoplay:(t,n,e,i)=>{const{on:o,bind:r,emit:u}=i,{interval:c,pauseOnHover:s=!0,pauseOnFocus:a=!0,resetProgress:f=!0}=e,l=Lt(c,()=>t.go(">"),function(t){var n=v["bar"];n&&j(n,"width",100*t+"%"),u("autoplay:playing",t)}),d=l["isPaused"],{Elements:v,Elements:{root:h,toggle:g}}=n,p=e["autoplay"];let m,y,w="pause"===p;function b(){d()&&n.Slides.isEnough()&&(l.start(!f),y=m=w=!1,k(),u(Gt))}function x(t=!0){w=!!t,k(),d()||(l.pause(),u(Xt))}function S(){w||(m||y?x(!1):b())}function k(){g&&(O(g,it,!w),I(g,et,e.i18n[w?"play":"pause"]))}function E(t){t=n.Slides.getAt(t);l.set(t&&+P(t.slide,jn)||e.interval)}return{mount:function(){p&&(s&&r(h,"mouseenter mouseleave",t=>{m="mouseenter"===t.type,S()}),a&&r(h,"focusin focusout",t=>{y="focusin"===t.type,S()}),g&&r(g,"click",()=>{w?b():x(!0)}),o([U,Rt,V],l.rewind),o(U,E),g&&I(g,Vt,v.track.id),w||b(),k())},destroy:l.cancel,play:b,pause:x,isPaused:d}},Drag:(a,f,l,t)=>{const{on:n,emit:d,bind:e}=t,v=t.lock(),h=a["state"],{Move:u,Scroll:g,Controller:p,Elements:{track:o},Breakpoints:{reduce:m}}=f,{resolve:i,orient:y}=f.Direction,{getPosition:w,exceededLimit:b}=u;let x,c,r,s,S,k,E=!1,z,A,$;function T(){var t=l["drag"];M(!t),S="free"===t}function N(t){var n,e,i;z=!1,A||(n=I(t),e=t.target,i=l.noDrag,lt(e,`.${Sn}, .`+yn)||i&&lt(e,i)||!n&&t.button||(p.isBusy()?W(t,!0):($=n?o:window,k=h.is([F,ct]),s=null,x=D(t),v.bind($,Tn,R,Fn),v.bind($,Nn,L,Fn),u.cancel(),g.cancel(),P(t))))}function R(t){if(h.is(6)||(h.set(6),d("drag")),function(t){if(l.releaseTouch&&a.is(ot)&&I(t)){var n=a["index"],t=_(t);if(b()||0===n&&0<t||n===a.length-1&&t<0)return 1}return}(t))return L(t);var n,e,i,o,r;t.cancelable&&(k?(u.translate(c+_(t)/(E&&a.is(ot)?5:1)),r=200<O(t),n=E!==(E=b()),(r||n)&&P(t),z=!0,d("dragging"),W(t)):(r=t,H(_(r))>H(_(r,!0))&&(k=(n=t,e=l.dragMinThreshold,i=at(e),o=i&&e.mouse||0,i=(i?e.touch:+e)||10,H(_(n))>(I(n)?i:o)),W(t))))}function L(t){if(h.is(6)&&(h.set(3),d("dragged")),k){{var n=t;const e=p["go"],{updateOnDragged:i=!0}=l,o=function(t){if(a.is(rt)||!E){var n=O(t);if(n&&n<200)return _(t)/n}return 0}(n),r=function(t){return w()+xt(t)*q(H(t)*(l.flickPower||600),S?1/0:f.Layout.listSize()*(l.flickMaxPages||1))}(o),u=0<y(D(n)-x),c=l.rewind&&l.rewindByDrag,s=(i?p:g).scroll;m(!1),S?s(r,void 0,l.snap):a.is(ut)?e(u?c?">":"+":c?"<":"-"):a.is(ot)&&E&&c?e(b(!0)?">":"<"):e((u?">>":"<<")+p.toDest(r));m(!0)}W(t)}v.destroy(),k=!1,E=!1}function j(t){!A&&z&&W(t,!0)}function P(t){s=r,r=t,c=w()}function _(t,n){return D(t,n)-D(C(t),n)}function O(t){return mt(t)-mt(C(t))}function C(t){return r===t&&s||r}function D(t,n){return(I(t)?t.changedTouches[0]:t)["page"+i(n?"Y":"X")]}function I(t){return"undefined"!=typeof TouchEvent&&t instanceof TouchEvent}function M(t){A=t}return{mount:function(){e(o,Tn,st,Fn),e(o,Nn,st,Fn),e(o,Mn,N,Fn),e(o,"click",j,{capture:!0}),e(o,"dragstart",W),n([K,Q],T)},disable:M,isDragging:function(){return k}}},Keyboard:(n,t,e,i)=>{const o=i["destroy"],r=t.Direction["resolve"];function u(){var t=e["keyboard"];o(),t&&i.bind("global"===t?window:n.root,"keydown",c),i.on(Q,u)}function c(t){t.key===r(Ht)?(n.go("<"),W(t,!0)):t.key===r(Jt)&&(n.go(">"),W(t,!0))}return{mount:u,destroy:o,disable:function(t){(t?o:u)()}}},LazyLoad:(e,t,o,n)=>{const{on:i,off:r,bind:u,emit:c}=n,s="sequential"===o.lazyLoad,a=[_t,Z];let f=[];function l(){_(f),t.Slides.forEach(i=>{pt(i.slide,Wn).forEach(t=>{var n=P(t,Gn),e=P(t,Xn);n===t.src&&e===t.srcset||(e=dt(n=t.parentElement,"."+zn)||R("span",o.classes.spinner,n),f.push([t,i,e]),t.src||vt(t,"none"))})}),(s?g:(r(a),i(a,d),d))()}function d(){(f=f.filter(t=>{var n=o.perPage*((o.preloadPages||1)+1)-1;return!t[1].isWithin(e.index,n)||v(t)})).length||r(a)}function v(t){var[n]=t;C(t[1].slide,_n),u(n,"load error",M(h,t)),I(n,"src",P(n,Gn)),I(n,"srcset",P(n,Xn)),D(n,[Gn,Xn])}function h(t,n){var[e,i]=t;Y(i.slide,_n),"error"!==n.type?(X(t[2]),vt(e,""),c("lazyload:loaded",e,i),c(Tt)):c("lazyload:error",e,i),s&&g()}function g(){f.length&&v(f.shift())}return{mount:function(){o.lazyLoad&&(l(),i(V,l))},destroy:M(_,f),check:d}},Pagination:(l,t,d,n)=>{const{on:v,emit:h,bind:g}=n,{Slides:p,Elements:m,Controller:y}=t,{hasFocus:w,getIndex:i,go:b}=y,u=t.Direction["resolve"],x=m["pagination"],S=[];let k,E;function z(){k&&(X(x?s(k.children):k),Y(k,E),_(S),k=null),n.destroy()}function A(t,n){var e=S["length"],i=n["key"],o=$();let r=-1;i===u(Jt,!1,o)?r=++t%e:i===u(Ht,!1,o)?r=(--t+e)%e:"Home"===i?r=0:"End"===i&&(r=e-1);o=S[r];o&&(ht(o.button),b(">"+r),W(n,!0))}function $(){return d.paginationDirection||d.direction}function L(t){return S[y.toPage(t)]}function P(){var t,n=L(i(!0)),e=L(i());n&&(t=n["button"],Y(t,it),D(t,Zt),I(t,nt,-1)),e&&(t=e["button"],C(t,it),I(t,Zt,!0),I(t,nt,"")),h("pagination:updated",{list:k,items:S},n,e)}return{items:S,mount:function t(){z(),v([Q,V,Bt],t);var{pagination:n=!0}=d;if(x&&vt(x,n?"":"none"),n){v([U,Rt,Z],P);var n=l.length,{classes:e,i18n:i,perPage:o,paginationKeyboard:r=!0}=d,u=w()?y.getEnd()+1:bt(n/o),n=$();C(k=x||R("ul",e.pagination,m.track.parentElement),E=xn+"--"+n),I(k,tt,"tablist"),I(k,et,i.select),I(k,en,n===Kt?"vertical":"");for(let t=0;t<u;t++){var c=R("li",null,k),s=R("button",{class:e.page,type:"button"},c);const f=p.getIn(t).map(t=>t.slide.id);var a=!w()&&1<o?i.pageX:i.slideX;g(s,"click",()=>b(">"+t)),r&&g(s,"keydown",M(A,t)),I(c,tt,"presentation"),I(s,tt,"tab"),I(s,Vt,f.join(" ")),I(s,et,Et(a,t+1)),I(s,nt,-1),S.push({li:c,button:s,page:t})}P(),h("pagination:mounted",{list:k,items:S},L(l.index))}},destroy:z,getAt:L,update:P}},Sync:(e,t,n,i)=>{const{isNavigation:o,slideFocus:r}=n,u=[];function c(){if(e.splides.forEach(t=>{t.isParent||(a(e,t.splide),a(t.splide,e))}),o){const t=i.lock(),n=t["on"];n(Ot,l),n(Wt,d),n([K,Q],f),u.push(t),t.emit(Ft,e.splides)}}function s(){u.forEach(t=>t.destroy()),_(u)}function a(t,i){const n=t.event.lock();n.on(U,(t,n,e)=>{i.index!==t&&i.go(i.is(rt)?e:t)}),u.push(n)}function f(){I(t.Elements.list,en,n.direction===Kt?"vertical":"")}function l(t){e.go(t.index)}function d(t,n){N(Yn,n.key)&&(l(t),W(n))}return{setup:M(t.Breakpoints.set,{slideFocus:ft(r)?o:r},!0),mount:c,destroy:s,remount:function(){s(),c()}}},Wheel:(u,c,s,n)=>{let a=0;function e(t){var n,e,i,o,r;t.cancelable&&(e=(n=function(t){var{wheelAxis:n="y"}=s,{deltaX:t,deltaY:e}=t,t=N(n,"x")?c.Direction.orient(-t):0,n=N(n,"y")?e:0;return t||n}(t))<0,i=mt(t),r=s.wheelMinThreshold||0,o=s.wheelSleep||0,H(n)>r&&i-a>o&&(u.go(n<0?"<":">"),a=i),r=e,s.releaseWheel&&!u.state.is(F)&&-1===c.Controller.getAdjacent(r)||W(t))}return{mount:function t(){n.destroy(),s.wheel&&n.bind(c.Elements.track,"wheel",e,Fn),n.on(Q,t)}}},Live:(t,n,e,i)=>{const o=i["on"],r=n.Elements["track"];var{live:i=!0}=e;const u=i&&!e.isNavigation,c=R("span",An),s=Lt(90,M(a,!1));function a(t){I(r,un,t),t?(A(r,c),s.start()):(X(c),s.cancel())}function f(t){u&&I(r,rn,t?"off":"polite")}return{mount:function(){u&&(f(!n.Autoplay.isPaused()),I(r,cn,!0),c.textContent="…",o(Gt,M(f,!0)),o(Xt,M(f,!1)),o([_t,Z],M(a,!0)))},disable:f,destroy:function(){D(r,[rn,cn,un]),X(c)}}}};const qn={type:"slide",speed:400,perPage:1,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",interval:5e3,trimSpace:!0,focusableNodes:"a, button, textarea, input, select, iframe",classes:t,i18n:{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"},reducedMotion:{speed:0,rewindSpeed:0,autoplay:"pause"}},Hn=(t,n,e,i)=>{const{Slides:o,Direction:r}=n;function u(){o.forEach(t=>{t.style("transform",`translateX(${r.orient(100*t.index)}%)`)})}return{mount:function(){i.on([K,V],u)},start:function(t,n){o.style("transition",`opacity ${e.speed}ms `+e.easing),c(n)},cancel:st}},Jn=(r,t,u,n)=>{const{Move:c,Controller:s,Scroll:a}=t,e=t.Elements["list"],f=M(j,e,"transition");let l;function i(){f(""),a.cancel()}return{mount:function(){n.bind(e,"transitionend",t=>{t.target===e&&l&&(i(),l())})},start:function(t,n){var e=c.toPosition(t),i=c.getPosition(),o=function(t){var n=u["rewindSpeed"];if(r.is(ot)&&n){var e=s.getIndex(!0),i=s.getEnd();if(0===e&&i<=t||i<=e&&0===t)return n}return u.speed}(t);1<=H(e-i)&&1<=o?u.useScroll?a.scroll(e,o,!1,n):(f(`transform ${o}ms `+u.easing),c.translate(e,!0),l=n):(c.jump(t),n())},cancel:i}};return class Kn{static defaults={};static STATES=n;static Extensions={};root;event=d();Components={};state=Pt(1);splides=[];t={};n;e={};i;constructor(t,n={}){In(t=T(t)?E(document,t):t,t+" is invalid."),n=h({label:P(this.root=t,et)||"",labelledby:P(t,tn)||""},qn,Kn.defaults,n);try{h(n,JSON.parse(P(t,fn)))}catch(t){In(!1,"Invalid JSON")}this.t=Object.create(h({},n))}mount(t=this.e,n=this.i){const{state:e,Components:i}=this;return In(e.is([1,7]),"Already mounted!"),e.set(1),this.n=i,this.i=n||(this.is(ut)?Hn:Jn),this.e=t,u(z({},Bn,this.e,{Transition:this.i}),(t,n)=>{const e=t(this,i,this.t,this.event.lock());(i[n]=e).setup&&e.setup()}),u(i,t=>{t.mount&&t.mount()}),this.emit(K),C(this.root,"is-initialized"),e.set(3),this.emit("ready"),this}sync(t){return this.splides.push({splide:t}),t.splides.push({splide:this,isParent:!0}),this.state.is(3)&&(this.n.Sync.remount(),t.Components.Sync.remount()),this}go(t){return this.n.Controller.go(t),this}jump(t){return this.n.Controller.jump(t),this}on(t,n){return this.event.on(t,n),this}off(t,n){return this.event.off(t,n),this}emit(t,...n){return this.event.emit(t,...n),this}add(t,n){return this.n.Slides.add(t,n),this}remove(t){return this.n.Slides.remove(t),this}is(t){return this.t.type===t}refresh(){return this.emit(V),this}destroy(n=!0){const{event:t,state:e}=this;return e.is(1)?this.on("ready",this.destroy.bind(this,n)):(u(this.n,t=>{t.destroy&&t.destroy(n)},!0),t.emit("destroy"),t.destroy(),n&&_(this.splides),e.set(7)),this}get options(){return this.t}set options(t){this.n.Breakpoints.set(t,!0,!0)}get length(){return this.n.Slides.getLength(!0)}get index(){return this.n.Controller.getIndex()}}},"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).Splide=n();
  8. //# sourceMappingURL=splide.min.js.map