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