splide.min.js 29 KB

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