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,st=5;var n={CREATED:1,MOUNTED:2,IDLE:3,MOVING:F,SCROLLING:st,DRAGGING:6,DESTROYED:7};function _(t){t.length=0}function M(t,...n){return t.bind(null,...n)}const u=setTimeout,at=()=>{};function v(t){return requestAnimationFrame(t)}function e(t,n){return typeof n===t}function ft(t){return!o(t)&&e("object",t)}const i=Array.isArray,m=M(e,"function"),T=M(e,"string"),lt=(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 b(t){return i(t)?t:[t]}function p(t,n){b(t).forEach(n)}function w(t,n){return t.push(...b(n)),t}const r=Array.prototype;function c(t,n,e){return r.slice.call(t,n,e)}function N(t,n){return r.includes.call(t,n)}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 z(t,...n){t&&t.append(...n)}function A(t,...n){t&&t.before(...n)}function dt(t,n){return y(t)&&t.matches(n)}function x(t,n){const e=t?c(t.children):[];return n?e.filter(t=>dt(t,n)):e}function vt(t,n){return n?x(t,n)[0]:t.firstElementChild}const $=Object.assign,S=Object.keys;function s(n,e,t){n&&(t?S(n).reverse():S(n)).forEach(t=>{"__proto__"!==t&&e(n[t],t)})}function h(e,...t){return t.forEach(t=>{s(t,(t,n)=>{i(t)?t=t.slice():ft(t)&&(t=h({},ft(e[n])?e[n]:{},t)),e[n]=t})}),e}function k(n,t){p(t||S(n),t=>{delete n[t]})}function D(t,e){p(t,n=>{p(e,t=>{n&&n.removeAttribute(t)})})}function I(e,n,i){ft(n)?s(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&&z(e,t),t}function j(t,n,e){if(lt(e))return getComputedStyle(t)[n];o(e)||(t.style[n]=""+e)}function ht(t,n){j(t,"display",n)}function gt(t){y(t)&&t.focus({preventScroll:!0})}function P(t,n){return t.getAttribute(n)}function pt(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 vt((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 mt(t,n){return n&&t?c(t.querySelectorAll(n)):[]}function Y(t,n){O(t,n,!1)}function yt(t){return t.timeStamp}function B(t){return T(t)?t:t?t+"px":""}const{min:q,max:bt,floor:wt,ceil:xt,abs:H,sign:St}=Math;function kt(t,n,e){return H(t-n)<e}function Et(t,n,e,i){var o=q(n,e),n=bt(n,e);return i?o<t&&t<n:o<=t&&t<=n}function J(t,n,e){var i=q(n,e),n=bt(n,e);return q(bt(i,t),n)}function zt(t,...n){return n.reduce((t,n)=>t.replace("%s",""+n),t)}function At(t,n=2){return(""+t).padStart(n,"0")}const $t={};function a(t,n){p(t,t=>{T(t)&&t.split(" ").forEach(n)})}function f(n,e){const i=[];for(let t=n.length-1;0<=t;t--)e(n[t])&&i.push(...n.splice(t,1));return i}function Lt(t){const o=t||[],r=t?{}:void 0;return{bind:function(n,t,e,i){a(t,t=>{n.addEventListener(t,e,i),o.push([n.removeEventListener.bind(n,t,e,i),r])})},create:M(Lt,o),destroy:function(){r?f(o,t=>t[1]===r).forEach(t=>{t[0]()}):(o.forEach(t=>{t[0]()}),_(o))}}}function l(t){const i=t||[],o=t?{}:void 0;return{on:function(t,n){a(t,t=>{i.push([t,n,o])})},off:function(t,e){a(t,n=>{f(i,t=>t[0]===n&&(!e||t[1]===e)&&t[2]===o).forEach(_)})},emit:function(n,...e){i.slice().forEach(t=>{t[0]===n&&t[1](...e)})},create:M(l,i),destroy:function(){o?f(i,t=>t[2]===o).forEach(_):(i.forEach(_),_(i))}}}function Pt(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 d(t){let n=t;return{set:function(t){n=t},is:function(t){return N(b(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",bn=yn+"--prev",wn=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:bn,next:wn,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.create(),{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"),b=P(u,et),w=-1<e,x=vt(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,zt(v.slideX,(w?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())!==pt(u,it)&&(O(u,it,e),I(u,Qt,l&&e||""),o(e?Ct:Dt,L)),e=$(),n=!e&&(!A()||w),r.state.is([F,st])||I(u,nn,n||""),I(mt(u,f.focusableNodes||""),nt,n?-1:""),g&&I(u,nt,n?-1:0),e!==pt(u,Pn)&&(O(u,Pn,e),o(e?It:Mt,L)),e||document.activeElement!==u||(n=s.Slides.getAt(r.index))&&gt(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])<=xt(e[t?o:i])&&wt(e[t?i:o])<=xt(n[o]))}const L={index:i,slideIndex:e,slide:u,container:x,isClone:w,mount:function(){w||(u.id=a.id+"-slide"+At(i+1),I(u,tt,h?"tabpanel":"group"),I(u,on,v.slide),I(u,et,b||zt(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,b||"")},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=w||!f.rewind&&!r.is(rt)?e:q(e,r.length-e))<=n}};return L};const jn=fn+"-interval";const ct={passive:!1,capture:!0};const Fn=fn+"-lazy",Gn=Fn+"-srcset",Xn=`[${Fn}], [${Gn}]`;const Wn=[" ","Enter"];const Yn={Breakpoints:(i,t,o,n)=>{const r=i["state"],u=o.breakpoints||{},c=o.reducedMotion||{},s=Lt(),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]:{}),{});k(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;S(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):k(o,S(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=vt(d,"."+vn),In(d&&v,"A track/list element is missing."),w(a,x(v,`.${hn}:not(.${gn})`)),$(s,{root:u,track:d,list:v,slides:a,arrows:y(mn),pagination:y(xn),prev:y(bn),next:y(wn),bar:y(kn),toggle:y(En)});var{role:t="region"}=e,n=u.id||function(t){return""+t+At($t[t]=($t[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=b(ln),l=b(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 b(t){return[t+"--"+e.type,t+"--"+e.direction,e.drag&&t+"--draggable",e.isNavigation&&t+"--nav",t===ln&&it]}return $(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)?dt(t.slide,n):N(b(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=>Et(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?A(e,t):z(f,t),C(t,u.classes.slide);{var e=t,i=M(c,Tt);const o=mt(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 b(){p=e.direction===Kt,j(l,"maxWidth",B(e.width)),j(d,c("paddingLeft"),x(!1)),j(d,c("paddingRight"),x(!0)),w(!0)}function w(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]||(ft(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(){b(),r(window,"resize load",function(t,n){const e=Pt(n||0,t,void 0,1);return()=>{e.isPaused()&&e.start()}}(M(u,Tt))),o([Q,V],b),o(Tt,w)},resize:w,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;)w(r,r);w(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"+At(n+1),e}(t.slide,n);e?A(r[0].slide,i):z(a.list,i),w(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)?lt(t)&&(n=(n=s[r("fixedWidth")]&&e.Layout.slideSize(0))&&xt(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 b,w,x;function S(){n.Controller.isBusy()||(n.Scroll.cancel(),z(u.index),a.update())}function k(){s(3),c(_t,...w),x&&x()}function E(){o(F)&&w&&(A(P(),!0),b.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*(xt(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(){b=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),w=[n,e,t],x=o,s(F),c(U,n,e,t),b.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=!lt(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 b(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=kt(e,t,1)||0===n;y=1,n=r?0:n||bt(H(t-e)/1.5,800),m=i,p=Pt(n,w,M(x,e,t,o),1),a(st),s(Rt),p.start()}function w(){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&&b(d(v(!0)),600,!1,m,!0))}function S(){p&&p.cancel()}function i(){p&&!p.isPaused()&&(S(),w())}return{mount:function(){e(U,S),e([Q,V],i)},destroy:S,scroll:b,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,b=m,w,x,S;function k(){w=d(!0),x=r.perMove,S=r.perPage,y=P();var t=v?y:w-1,t=J(m,0,t);(b=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,b,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&&!kt(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)&&Et(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||!Et(0,t,n,!0)&&!Et(y,n,t,!0)?h?e?t<0?-(w%S||S):w: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+w)%w||0:t}function P(){let t=w-(D()||h&&x?1:S);for(;v&&0<t--;)if(f(w-1)!==f(t)){t++;break}return J(t,0,w-1)}function _(t){return J(D()?t:S*t,0,y)}function O(t){return D()?q(t,y):wt((t>=y?w-1:t)/S)}function C(t){t!==m&&(b=m,m=t)}function D(){return!lt(r.focus)||r.isNavigation}function I(){return o.state.is([F,st])&&!!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?b: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 b(){var{arrows:t=!0}=n;!t||h&&g||(v=l||R("div",c.arrows),h=k(!0),g=k(!1),p=!0,z(v,h,g),l||A(d,v)),h&&g&&($(y,{prev:h,next:g}),ht(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,w)}function w(){x(),b()}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:b,destroy:x,update:E}},Autoplay:(t,n,e,i)=>{const{on:o,bind:r,emit:u}=i,{interval:c=5e3,pauseOnHover:s=!0,pauseOnFocus:a=!0,resetProgress:f=!0}=e,l=Pt(c,t.go.bind(t,">"),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,b="pause"===p;function w(){d()&&n.Slides.isEnough()&&(l.start(!f),y=m=b=!1,k(),u(Gt))}function x(t=!0){b=!!t,k(),d()||(l.pause(),u(Xt))}function S(){b||(m||y?x(!1):w())}function k(){g&&(O(g,it,!b),I(g,et,e.i18n[b?"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",()=>{b?w():x(!0)}),o([U,Rt,V],l.rewind),o(U,E),g&&I(g,Vt,v.track.id),b||w(),k())},destroy:l.cancel,play:w,pause:x,isPaused:d}},Drag:(a,f,l,t)=>{const{on:n,emit:d,bind:e}=t,v=t.create(),h=a["state"],{Move:u,Scroll:g,Controller:p,Elements:{track:o},Breakpoints:{reduce:m}}=f,{resolve:i,orient:y}=f.Direction,{getPosition:b,exceededLimit:w}=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,dt(e,`.${Sn}, .`+yn)||i&&dt(e,i)||!n&&t.button||(p.isBusy()?W(t,!0):($=n?o:window,k=h.is([F,st]),s=null,x=D(t),v.bind($,Tn,R,ct),v.bind($,Nn,L,ct),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(w()||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=w()),(r||n)&&P(t),z=!0,d("dragging"),W(t)):(r=t,H(_(r))>H(_(r,!0))&&(k=(n=t,e=l.dragMinThreshold,i=ft(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 b()+St(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(w(!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=b()}function _(t,n){return D(t,n)-D(C(t),n)}function O(t){return yt(t)-yt(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,at,ct),e(o,Nn,at,ct),e(o,Mn,N,ct),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=>{mt(i.slide,Xn).forEach(t=>{var n=P(t,Fn),e=P(t,Gn);n===t.src&&e===t.srcset||(e=vt(n=t.parentElement,"."+zn)||R("span",o.classes.spinner,n),f.push([t,i,e]),t.src||ht(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,Fn)),I(n,"srcset",P(n,Gn)),D(n,[Fn,Gn])}function h(t,n){var[e,i]=t;Y(i.slide,_n),"error"!==n.type?(X(t[2]),ht(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:b,getIndex:i,go:w}=y,u=t.Direction["resolve"],x=m["pagination"],S=[];let k,E;function z(){k&&(X(x?c(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&&(gt(o.button),w(">"+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&&ht(x,n?"":"none"),n){v([U,Rt,Z],P);var n=l.length,{classes:e,i18n:i,perPage:o,paginationKeyboard:r=!0}=d,u=b()?y.getEnd()+1:xt(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=!b()&&1<o?i.pageX:i.slideX;g(s,"click",()=>{w(">"+t)}),r&&g(s,"keydown",M(A,t)),I(c,tt,"presentation"),I(s,tt,"tab"),I(s,Vt,f.join(" ")),I(s,et,zt(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.create(),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.create();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(Wn,n.key)&&(l(t),W(n))}return{setup:M(t.Breakpoints.set,{slideFocus:lt(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=yt(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,ct),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=Pt(90,M(a,!1));function a(t){I(r,un,t),t?(z(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 Bn={type:"slide",speed:400,perPage:1,easing:"cubic-bezier(0.25, 1, 0.5, 1)",drag:!0,direction:"ltr",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"}},qn=(t,n,e,i)=>{const o=n["Slides"];function r(){o.forEach(t=>{t.style("transform",`translateX(-${100*t.index}%)`)})}return{mount:function(){i.on([K,V],r)},start:function(t,n){o.style("transition",`opacity ${e.speed}ms `+e.easing),u(n)},cancel:at}},Hn=(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 Jn{static defaults={};static STATES=n;root;event=function t(n=Lt(),e=l()){return $({},n,e,{create:function(){return t(n.create(),e.create())},destroy:function(){n.destroy(),e.destroy()}})}();Components={};state=d(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)||""},Bn,Jn.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)?qn:Hn),this.e=t,s($({},Yn,this.e,{Transition:this.i}),(t,n)=>{const e=t(this,i,this.t,this.event.create());(i[n]=e).setup&&e.setup()}),s(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)):(s(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