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