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