splide.min.js 26 KB

12345678
  1. function _t(n,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}
  2. /*!
  3. * Splide.js
  4. * Version : 3.0.0
  5. * License : MIT
  6. * Copyright: 2021 Naotoshi Fujita
  7. */
  8. var n,t;n=this,t=function(){"use strict";var m="splide",f="data-"+m,w=1,n={CREATED:w,MOUNTED:2,IDLE:3,MOVING:4,DESTROYED:5};function _(n){n.length=0}function b(n){return!u(n)&&"object"==typeof n}function r(n){return Array.isArray(n)}function M(n){return"string"==typeof n}function u(n){return null===n}function y(n){return n instanceof HTMLElement}function x(n){return n instanceof HTMLButtonElement}function k(n){return r(n)?n:[n]}function A(n,t){k(n).forEach(t)}function E(n,t){return-1<n.indexOf(t)}function L(n,t){return n.push.apply(n,k(t)),n}var o=Array.prototype;function i(n,t,i){return o.slice.call(n,t,i)}function a(n,t){return i(n).filter(t)[0]}function S(t,n,i){t&&A(n,function(n){n&&t.classList[i?"add":"remove"](n)})}function z(n,t){S(n,t,!0)}function R(n,t){A(t,n.appendChild.bind(n))}function P(n,i){A(n,function(n){var t=i.parentNode;t&&t.insertBefore(n,i)})}function O(n,t){return(n.msMatchesSelector||n.matches).call(n,t)}function D(n,t){return n?i(n.children).filter(function(n){return O(n,t)}):[]}function T(n,t){return t?D(n,t)[0]:n.firstElementChild}function e(n,t){if(n)for(var i=Object.keys(n),r=0;r<i.length;r++){var u=i[r];if("__proto__"!==u&&!1===t(n[u],u))break}return n}function W(r){for(var n=arguments.length,t=new Array(1<n?n-1:0),i=1;i<n;i++)t[i-1]=arguments[i];return t.forEach(function(i){e(i,function(n,t){r[t]=i[t]})}),r}function s(i,n){return e(n,function(n,t){r(n)?i[t]=n.slice():b(n)?i[t]=s(b(i[t])?i[t]:{},n):i[t]=n}),i}function F(t,n){t&&A(n,function(n){t.removeAttribute(n)})}function I(i,n,t){b(n)?e(n,function(n,t){I(i,t,n)}):u(t)?F(i,n):i.setAttribute(n,String(t))}function j(n,t,i){n=document.createElement(n);return t&&(M(t)||r(t)?z:I)(n,t),i&&R(i,n),n}function B(n,t){if(M(t))return r(n)?null:getComputedStyle(n)[t];e(t,function(t,i){u(t)||A(n,function(n){n&&(n.style[i]=""+t)})})}function C(n,t){B(n,{display:t})}function g(n,t){return n.getAttribute(t)}function X(n,t){return n&&n.classList.contains(t)}function G(n){return T((new DOMParser).parseFromString(n,"text/html").body)}function H(n,t){n.preventDefault(),t&&(n.stopPropagation(),n.stopImmediatePropagation())}function N(n,t){return n&&n.querySelector(t)}function U(n,t){return i(n.querySelectorAll(t))}function Y(n){return n.getBoundingClientRect()}function q(n){A(n,function(n){n&&n.parentNode&&n.parentNode.removeChild(n)})}function J(n,t){S(n,t,!1)}function K(n){return M(n)?n:n?n+"px":""}function V(n,t){if(void 0===t&&(t=""),!n)throw new Error("["+m+"] "+t)}function c(n){setTimeout(n)}function l(){}function v(n){return requestAnimationFrame(n)}function Q(n,t,i,r){var u=Math.min(t,i),i=Math.max(t,i);return r?u<n&&n<i:u<=n&&n<=i}var d=Math.max,h=Math.min;function Z(n,t,i){var r=h(t,i),i=d(t,i);return h(d(r,n),i)}function $(n){return(0<n)-(n<0)}var nn=Math.min,tn=Math.max,rn=Math.floor,un=Math.ceil,on=Math.abs;Math.round;function en(t,n){return A(n,function(n){t=t.replace("%s",""+n)}),t}function cn(n){return n<10?"0"+n:""+n}var fn={};var p={marginRight:["marginBottom","marginLeft"],width:["height"],autoWidth:["autoHeight"],fixedWidth:["fixedHeight"],paddingLeft:["paddingTop","paddingRight"],paddingRight:["paddingBottom","paddingLeft"],left:["top","right"],right:["bottom","left"],x:["y"],X:["Y"],pageX:["pageY"],ArrowLeft:["ArrowUp","ArrowRight"],ArrowRight:["ArrowDown","ArrowLeft"]};var an=m,sn=m+"__slider",ln=m+"__track",dn=m+"__list",vn=m+"__slide",hn=vn+"--clone",gn=vn+"__container",pn=m+"__arrows",t=m+"__arrow",mn=t+"--prev",yn=t+"--next",wn=m+"__pagination",_n=m+"__progress",bn=_n+"__bar",xn=m+"__autoplay",kn=m+"__play",Mn=m+"__pause",An="is-active",En="is-prev",Ln="is-next",Sn="is-visible",zn="is-loading",Rn=[An,Sn,En,Ln,zn],Pn="mounted",On="move",Dn="moved",Tn="click",Wn="active",Fn="inactive",In="visible",jn="hidden",Bn="slide:keydown",Cn="refresh",Xn="undated",Gn="resize",Hn="resized",Nn="scrolled",Un="destroy",Yn="lazyload:loaded";function qn(){var o={};function r(n,r){t(n,function(n,t){var i=o[n];o[n]=i&&i.filter(function(n){return n.n?n.n!==r:n.t!==t})})}function t(n,t){k(n).join(" ").split(" ").forEach(function(n){n=n.split(".");t(n[0],n[1])})}return{on:function(n,i,r,u){void 0===u&&(u=10),t(n,function(n,t){o[n]=o[n]||[],L(o[n],{i:n,r:i,t:t,u:u,n:r}).sort(function(n,t){return n.u-t.u})})},off:r,offBy:function(i){e(o,function(n,t){r(t,i)})},emit:function(n){var t=arguments;(o[n]||[]).forEach(function(n){n.r.apply(n,i(t,1))})},destroy:function(){o={}}}}function Jn(n){var r=n.event,u={},o=[];function t(n,t){e(n,t,function(t,i){o=o.filter(function(n){return n[0]!==t||n[1]!==i||(t.removeEventListener(i,n[2],n[3]),!1)})})}function e(n,t,i){A(n,function(n){n&&t.split(" ").forEach(i.bind(null,n))})}function i(){o=o.filter(function(n){return t(n[0],n[1])}),r.offBy(u)}return r.on(Un,i,u),{on:function(n,t,i){r.on(n,t,u,i)},off:function(n){r.off(n,u)},emit:r.emit,bind:function(n,t,i,r){e(n,t,function(n,t){o.push([n,t,i,r]),n.addEventListener(t,i,r)})},unbind:t,destroy:i}}function Kn(t,i,r,u){var o,n,e=Date.now,c=0,f=!0,a=0;function s(){var n;f||(n=e()-o,t<=n?(c=1,o=e()):c=n/t,r&&r(c),1===c&&(i(),u&&++a>=u)?l():v(s))}function l(){f=!0}function d(){cancelAnimationFrame(n),f=!(n=c=0)}return{start:function(n){n||d(),o=e()-(n?c*t:0),f=!1,v(s)},rewind:function(){o=e(),c=0,r&&r(c)},pause:l,cancel:d,isPaused:function(){return f}}}function Vn(n){var t=n;return{set:function(n){t=n},is:function(n){return E(k(n),t)}}}function Qn(i,r){var u;return function(){var n=arguments,t=this;u||(u=Kn(r||0,function(){i.apply(t,n),u=null},null,1)).start()}}var Zn="role",$n="aria-controls",nt="aria-current",tt="aria-label",it="aria-hidden",rt="tabindex",ut=[Zn,$n,nt,tt,it,rt,"disabled"],ot="slide",et="loop",ct="fade";function ft(u,i,r,o){var n=Jn(u),e=n.on,c=n.emit,f=n.bind,t=n.destroy,a=u.Components,s=u.root,l=u.options,d=l.isNavigation,v=l.updateOnMove,h=a.Direction.resolve,g=-1<r,p=T(o,"."+gn);function m(){var n=u.index;!function(n){n!==X(o,An)&&(S(o,An,n),d&&I(o,nt,n||null),c(n?Wn:Fn,this))}.call(this,y()),function(n){I(o,it,!n||null),I(o,rt,n&&l.slideFocus?0:null),n!==X(o,Sn)&&(S(o,Sn,n),c(n?In:jn,this))}.call(this,function(){if(u.is(ct))return y();var n=Y(a.Elements.track),t=Y(o),i=h("left"),r=h("right");return rn(n[i])<=t[i]&&t[r]<=un(n[r])}()),S(o,En,i===n-1),S(o,Ln,i===n+1)}function y(){return u.index===i}return{index:i,slideIndex:r,slide:o,container:p,isClone:g,mount:function(){var t=this;!function(){g||(o.id=s.id+"-slide"+cn(i+1));{var n,t;d&&(x(o)||I(o,Zn,"button"),t=g?r:i,n=en(l.i18n.slideX,t+1),t=u.splides.map(function(n){return n.root.id}).join(" "),I(o,tt,n),I(o,$n,t))}}(),f(o,"click keydown",function(n){c("click"===n.type?Tn:Bn,t,n)}),e([Pn,Dn,Xn,Nn,v?On:""],m.bind(this)),e(Hn,function(){u.state.is(w)||m.call(this)}.bind(this))},destroy:function(){t(),J(o,Rn),F(o,ut)},rule:function(n,t,i){i="#"+o.id+(p&&i?" > ."+gn:""),a.Style.rule(i,n,t)},isWithin:function(n,t){return n=on(n-i),(n=!u.is(ot)&&!g?nn(n,u.length-n):n)<=t}}}var at="touchmove mousemove",st="touchend touchcancel mouseup mouseleave";var lt=["Left","Right","Up","Down"];var dt=f+"-lazy",vt=dt+"-srcset",ht="["+dt+"], ["+vt+"]";var gt=[" ","Enter","Spacebar"];var pt=Object.freeze({__proto__:null,Options:function(t,n,i){var r,u,o;function e(n){n&&removeEventListener("resize",c)}function c(){var n=a(u,function(n){return n[1].matches})||[];n[0]!==o&&function(n){n=i.breakpoints[n]||r;n.destroy?(t.options=r,t.destroy("completely"===n.destroy)):(t.state.is(5)&&(e(!0),t.mount()),t.options=n)}(o=n[0])}return{setup:function(){try{s(i,JSON.parse(g(t.root,f)))}catch(n){V(!1,n.message)}r=s({},i)},mount:function(){var n=i.breakpoints;n&&(u=Object.keys(n).sort(function(n,t){return+n-+t}).map(function(n){return[n,matchMedia("("+(i.mediaQuery||"max")+"-width:"+n+"px)")]}),addEventListener("resize",c),c())},destroy:e}},Direction:function(n,t,r){return{resolve:function(n,t){var i=r.direction;return p[n]["rtl"!==i||t?"ttb"===i?0:-1:1]||n},orient:function(n){return n*("rtl"===r.direction?1:-1)}}},Elements:function(n,t,i){var r,u,o,e,c=Jn(n).on,f=n.root,a={},s=[];function l(){var n;!function(){u=T(f,"."+sn),o=N(f,"."+ln),e=T(o,"."+dn),V(o&&e,"Missing a track/list element."),L(s,D(e,"."+vn+":not(."+hn+")"));var n=g("."+xn),t=g("."+pn);W(a,{root:f,slider:u,track:o,list:e,slides:s,arrows:t,prev:N(t,"."+mn),next:N(t,"."+yn),bar:N(g("."+_n),"."+bn),play:N(n,"."+kn),pause:N(n,"."+Mn)})}(),n=f.id||function(n){return""+n+cn(fn[n]=(fn[n]||0)+1)}(m),f.id=n,o.id=o.id||n+"-track",e.id=e.id||n+"-list",z(f,r=p())}function d(){_(s),J(f,r)}function v(){d(),l()}function h(){J(f,r),z(f,r=p())}function g(n){return T(f,n)||T(u,n)}function p(){return[an+"--"+i.type,an+"--"+i.direction,i.drag&&an+"--draggable",i.isNavigation&&an+"--nav",An]}return W(a,{setup:l,mount:function(){c(Cn,v),c(Xn,h)},destroy:d})},Style:function(){var n,u;function r(t,n,i){var r=u.cssRules,r=a(r,function(n){return o(n)&&n.selectorText===t})||r[u.insertRule(t+"{}",0)];o(r)&&(r.style[n]=""+i)}function o(n){return n instanceof CSSStyleRule}return{mount:function(){n=j("style",{},document.head),u=n.sheet},destroy:function(){q(n),u=null},rule:r,ruleBy:function(n,t,i){r("#"+(y(n)?n.id:n),t,i)}}},Slides:function(r,u,o){var n=Jn(r),t=n.on,e=n.emit,c=n.bind,f=(n=u.Elements).slides,a=n.list,s=[];function i(){f.forEach(function(n,t){v(n,t,-1)})}function l(){g(function(n){n.destroy()}),_(s)}function d(){l(),i()}function v(n,t,i){n=ft(r,t,i,n);n.mount(),s.push(n)}function h(n){return n?p(function(n){return!n.isClone}):s}function g(n,t){h(t).forEach(n)}function p(t){return s.filter("function"==typeof t?t:function(n){return M(t)?O(n.slide,t):E(k(t),n.index)})}return{mount:function(){i(),t(Cn,d)},destroy:l,register:v,get:h,getIn:function(n){var t=u.Controller,i=t.toIndex(n),r=t.hasFocus()?1:o.perPage;return p(function(n){return Q(n.index,i,i+r-1)})},getAt:function(n){return p(n)[0]},add:function(n,u){A(n,function(n){var t,i,r;y(n=M(n)?G(n):n)&&((t=f[u])?P(n,t):R(a,n),z(n,o.classes.slide),n=n,i=e.bind(null,Gn),n=U(n,"img"),(r=n.length)?n.forEach(function(n){c(n,"load error",function(){--r||i()})}):i())}),e(Cn)},remove:function(n){q(p(n).map(function(n){return n.slide})),e(Cn)},forEach:g,filter:p,rule:function(t,i,r){g(function(n){n.rule(t,i,r)})},getLength:function(n){return(n?f:s).length},isEnough:function(){return s.length>o.perPage}}},Clones:function(c,n,f){var t,a,i=Jn(c),r=i.on,u=i.emit,s=n.Elements,l=n.Slides,o=n.Direction.resolve,d=[];function e(){(t=p())&&function(u){var o=l.get().slice(),e=o.length;if(e){for(a=0;o.length<u;)L(o,o);o.slice(-u).concat(o.slice(0,u)).forEach(function(n,t){var i=t<u,r=function(n){n=n.cloneNode(!0);return z(n,f.classes.clone),n.id=c.root.id+"-clone"+cn(++a),n}(n.slide);i?P(r,o[0].slide):R(s.list,r),L(d,r),l.register(r,t-u+(i?0:e),n.index)})}}(t)}function v(){q(d),_(d)}function h(){v(),e()}function g(){t!==p()&&u(Cn)}function p(){var n,t=f.clones;return c.is(et)?t||(t=((n=f[o("fixedWidth")])&&un(Y(s.track)[o("width")]/n)||f[o("autoWidth")]&&c.length||f.perPage)*(f.drag?(f.flickMaxPages||1)+1:2)):t=0,t}return{mount:function(){e(),r(Cn,h),r([Xn,Gn],g)},destroy:v}},Layout:function(n,t,i){var r=(n=Jn(n)).on,u=n.bind,o=n.emit,e=t.Slides,c=t.Style.ruleBy,f=t.Direction.resolve,a=(t=t.Elements).root,s=t.track,l=t.list,d=e.getAt,v="ttb"===i.direction;function h(){c(a,"maxWidth",K(i.width)),c(s,f("paddingLeft"),m(!1)),c(s,f("paddingRight"),m(!0)),e.rule(f("marginRight"),K(i.gap)),e.rule("width",i.autoWidth?"":K(i.fixedWidth)||(v?"":w())),p(),g()}function g(){c(s,"height",function(){var n="";{var t,i;v&&(V(n=y(),'"height" or "heightRatio" is missing.'),t=m(!1),i=m(!0),(t||i)&&(n="calc("+n,n+=(t?" - "+t:"")+(i?" - "+i:"")+")"))}return n}()),i.heightRatio&&p(),o(Hn)}function p(){e.rule("height",K(i.fixedHeight)||(v?i.autoHeight?"":w():y()),!0)}function m(n){var t=i.padding,n=f(n?"right":"left",!0);return t?K(t[n]||(b(t)?"0":t)):""}function y(){return K(i.height||Y(l).width*i.heightRatio)}function w(){var n=K(i.gap);return"calc((100%"+(n&&" + "+n)+")/"+(i.perPage||1)+(n&&" - "+n)+")"}function _(){var n=d(0);return n&&parseFloat(B(n.slide,f("marginRight")))||0}return{mount:function(){h(),u(window,"resize load",Qn(o.bind(this,Gn))),r([Xn,Cn],h),r(Gn,g)},listSize:function(){return Y(l)[f("width")]},slideSize:function(n,t){return(n=d(n||0))?Y(n.slide)[f("width")]+(t?0:_()):0},sliderSize:function(){var n=d(0),t=d(e.getLength(!0)-1);return n&&t?Y(t.slide)[f("right")]-Y(n.slide)[f("left")]:0},totalSize:function(n,t){var i=d(n);if(i){n=Y(i.slide)[f("right")],i=Y(l)[f("left")];return on(n-i)+(t?0:_())}return 0},getPadding:function(n){return parseFloat(B(s,f("padding"+(n?"Right":"Left"),!0)))||0}}},Move:function(u,c,o){var e,f,n=Jn(u),t=n.on,a=n.emit,r=(n=c.Layout).slideSize,i=n.getPadding,s=n.totalSize,l=n.listSize,d=n.sliderSize,v=(n=c.Direction).resolve,h=n.orient,g=(n=c.Elements).list,p=n.track,m=0,y=0;function w(){"free"!==o.drag?_(u.index):(o[v("fixedWidth")]||o[v("autoWidth")]||b(l()*y),L(m)&&b(M(!0)))}function _(n){b(x(n,!0))}function b(n){m=function(n){{var t,i,r;!e&&u.is(et)&&(t=n-m,i=E(n),r=L(n),(i&&0<t||r&&t<0)&&(n+=h(d()*(i?1:-1))))}return n}(n),y=m/l(),c.Style.ruleBy(g,"transform","translate"+v("X")+"("+m+"px)")}function x(n,t){var i,i=h(s(n-1)-(i=n,"center"!==(n=o.focus)?(+n||0)*r(i):(l()-r(i,!0))/2));return t?function(n){o.trimSpace&&u.is(ot)&&(n=Z(n,0,h(d()-l())));return n}(i):i}function k(){var n=v("left");return Y(g)[n]-Y(p)[n]+h(i(!1))}function M(n){var t=!!o.trimSpace;return x(n?c.Controller.getEnd():0,t)}function A(){return!(!e&&!f)}function E(n,t){return h(n)+(t||0)<h(M(!1))}function L(n,t){return h(n)+(t||0)>h(M(!0))}return{mount:function(){t([Gn,Xn,Cn],w)},move:function(n,t,i){var r;A()||(r=k(),e=n!==t,f=o.waitForTransition,u.state.set(4),a(On,t,i,n),c.Transition.start(n,function(){!function(n,t,i,r){e&&(_(t),e=!1);f=!1,u.state.set(3),a(Dn,t,i,n),"move"===o.trimSpace&&n!==i&&r===k()&&c.Controller.go(i<n?">":"<")}(n,t,i,r)}))},jump:_,translate:b,cancel:function(){b(k()),c.Transition.cancel()},toIndex:function(n){for(var t=c.Slides.get(),i=0,r=1/0,u=0;u<t.length;u++){var o=t[u].index,e=on(x(o)-n);if(!(e<r))break;r=e,i=o}return i},toPosition:x,getPosition:k,getLimit:M,isBusy:A,isExceededMin:E,isExceededMax:L,isExceeded:function(){return E(m)||L(m)}}},Controller:function(n,t,u){var o,e,c,i=Jn(n).on,r=t.Move,f=(t=t.Slides).isEnough,a=t.getLength,s=n.is(et),l=u.start||0,d=l;function v(){o=a(!0),e=u.perMove,c=u.perPage}function h(n){return p(!1,n)}function g(n){return p(!0,n)}function p(n,t){n=m(l+(e||k()?1:c)*(n?-1:1),l);return t?n:w(n)}function m(n,t,i){var r;return f()?(r=y(),n<0||r<n?n=Q(0,n,t,!0)||Q(r,t,n,!0)?_(b(n)):s?e?n:n<0?-(o%c||c):o:u.rewind?n<0?r:0:-1:s||i||n===t||(n=_(b(t)+(n<t?-1:1)))):n=-1,n}function y(){var n=o-c;return(k()||s&&e)&&(n=o-1),tn(n,0)}function w(n){return s?f()?n%o+(n<0?o:0):-1:n}function _(n){return Z(k()?n:c*n,0,y())}function b(n){return k()||(n=Q(n,o-c,o-1)?o-1:n,n=rn(n/c)),n}function x(n){n!==l&&(d=l,l=n)}function k(){return!(void 0===u.focus)||u.isNavigation}return{mount:function(){v(),r.jump(l),i([Xn,Cn],v),i(Nn,function(){x(r.toIndex(r.getPosition()))},0)},go:function(n,t){var i=function(n){var t=l;{var i,r;M(n)?(r=n.match(/([+\-<>])(\d+)?/)||[],i=r[1],r=r[2],"+"===i||"-"===i?t=m(l+ +(""+i+(+r||1)),l,!0):">"===i?t=r?_(+r):h(!0):"<"===i&&(t=g(!0))):t=s?Z(n,-c,o+c-1):Z(n,0,y())}return t}(n);-1<(n=w(i))&&!r.isBusy()&&(t||n!==l)&&(x(n),r.move(i,n,d))},getNext:h,getPrev:g,getEnd:y,setIndex:x,getIndex:function(n){return n?d:l},toIndex:_,toPage:b,hasFocus:k}},Arrows:function(u,n,i){var r,o=(t=Jn(u)).on,e=t.bind,c=t.emit,f=i.classes,a=i.i18n,t=n.Elements,s=n.Controller,l=t.slider,d=t.track,v=t.arrows,h=t.prev,g=t.next,p={};function m(){var n,t;i.arrows&&(h&&g||(n="slider"===i.arrows&&l?l:u.root,v=j("div",f.arrows),h=y(!0),g=y(!1),r=!0,R(v,[h,g]),P(v,T(n)))),h&&g&&(p.prev?C(v,!1===i.arrows?"none":""):(I(h,$n,d.id),I(g,$n,d.id),p.prev=h,p.next=g,t=s.go,o([Pn,On,Xn,Cn,Nn],w),e(g,"click",function(){t(">")}),e(h,"click",function(){t("<")}),c("arrows:mounted",h,g)))}function y(n){return G('<button class="'+f.arrow+" "+(n?f.prev:f.next)+'" type="button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 40 40" width="40" height="40"><path d="'+(i.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 w(){var n=u.index,t=s.getPrev(),i=s.getNext(),r=-1<t&&n<t?a.last:a.prev,n=-1<i&&i<n?a.first:a.next;h.disabled=t<0,g.disabled=i<0,I(h,tt,r),I(g,tt,n),c("arrows:updated",h,g,t,i)}return{arrows:p,mount:function(){m(),o(Xn,m)},destroy:function(){r?q(v):(F(h,ut),F(g,ut))}}},Autoplay:function(n,t,i){var r,u,o,e=Jn(n),c=e.on,f=e.bind,a=e.emit,s=(e=t.Elements).root,l=e.track,d=e.bar,v=e.play,h=e.pause,g=Kn(i.interval,n.go.bind(n,">"),function(n){a("autoplay:playing",n),d&&B(d,{width:100*n+"%"})}),p=g.isPaused;function m(n){var t=n?h:v;t&&(x(t)||I(t,Zn,"button"),I(t,$n,l.id),I(t,tt,i.i18n[n?"pause":"play"]),f(t,"click",n?w:y))}function y(){p()&&t.Slides.isEnough()&&(g.start(!i.resetProgress),r=u=!1,a("autoplay:play"))}function w(n){void 0===n&&(n=!0),p()||(g.pause(),a("autoplay:pause")),o=n}function _(){o||(r||u?w(!1):y())}return{mount:function(){var n=i.autoplay;n&&(m(!0),m(!1),function(){i.pauseOnHover&&f(s,"mouseenter mouseleave",function(n){r="mouseenter"===n.type,_()});i.pauseOnFocus&&f(s,"focusin focusout",function(n){u="focusin"===n.type,_()});c([On,"scroll",Cn],g.rewind)}(),"pause"!==n&&y())},destroy:g.cancel,play:y,pause:w,isPaused:p}},Cover:function(n,t,i){var r=Jn(n).on;function u(i){t.Slides.forEach(function(n){var t=T(n.container||n.slide,"img");t&&t.src&&o(i,t,n)})}function o(n,t,i){i.rule("background",n?'center/cover no-repeat url("'+t.src+'")':"",!0),C(t,n?"none":"")}return{mount:function(){i.cover&&(r(Yn,function(n,t){o(!0,n,t)}),r([Pn,Xn,Cn],u.bind(null,!0)))},destroy:function(){u(!1)}}},Scroll:function(c,n,f){var i,t=Jn(c),r=t.on,a=t.emit,s=n.Move,l=s.getPosition,d=s.getLimit;function v(r,n,u){var t,o=l(),e=1;n=n||(t=on(r-o),tn(t/1.2,800)),g(),i=Kn(n,h,function(n){var t=l(),i=(o+(r-o)*(i=n,(n=f.easingFunc)?n(i):1-Math.pow(1-i,4))-l())*e;s.translate(t+i),c.is(ot)&&!u&&s.isExceeded()&&(e*=.6,on(i)<10&&(i=s.isExceededMin(l()),v(d(!i),600,!0)))},1),a("scroll"),i.start()}function h(){a(Nn)}function g(){i&&i.cancel()}function u(){i&&!i.isPaused()&&(g(),h())}return{mount:function(){r(On,g),r([Xn,Cn],u)},destroy:g,scroll:v,cancel:u}},Drag:function(r,n,i){var u,o,e,c,f,a,s,l,t,d,v=Jn(r),h=v.emit,g=v.bind,p=v.unbind,m=n.Elements.track,y=(v=n.Direction).resolve,w=v.orient,_=n.Layout.listSize,b=(v=n.Controller).go,x=v.getEnd,k=n.Move,M=n.Scroll,A=k.translate,E=k.toIndex,L=k.getPosition,S=k.isExceeded,z=r.is(ot),R=r.is(ct),P="free"===i.drag;function O(n){l="mousedown"===n.type,t=l?window:m,l&&n.button||(k.isBusy()?H(n):(g(t,at,D),g(t,st,T),k.cancel(),M.cancel(),u=W(n)))}function D(n){var t;n.cancelable?(t=i.dragMinThreshold||15,(l||on(W(n)-u)>t)&&(g(m,"click",function(n){p(m,"click"),H(n,!0)},{capture:s=!0}),h("drag")),s&&(function(n){var t=n.timeStamp;(!o||50<t-o||S()!==d)&&(e=L(),c=W(n),f=t);d=S(),o=t,a=n,R||A(e+function(n){return n/(d&&z?5:1)}(W(n)-c));h("dragging")}(n),H(n,!0))):T(n)}function T(n){p(t,at+" "+st),s=!1,a&&(function(n){n=function(n){if(r.is(et)||!S()){var t=W(a)-c,i=a.timeStamp-f,n=n.timeStamp-o<50;if(i&&n)return t/i}return 0}(n);R?b(r.index+w($(n))):(n=function(n){var t=i.flickPower||600;return L()+$(n)*nn(on(n)*t,P?1/0:_()*(i.flickMaxPages||1))}(n),P?M.scroll(n):b(function(n){n=E(n);return z?Z(n,0,x()):n}(n),!0));o=0,h("dragged")}(n),a=null)}function W(n){return(l?n:n.touches[0])[y("pageX")]}return{mount:function(){i.drag&&g(m,"touchstart mousedown",O)}}},Keyboard:function(t,n,i){var r,u=Jn(t),o=u.on,e=u.bind,c=u.unbind,f=n.Elements.root,a=n.Direction.resolve;function s(){var n=i.keyboard,n=void 0===n?"global":n;n&&("focused"===n?I(r=f,rt,0):r=window,e(r,"keydown",function(n){n=n.key,n=E(lt,n)?"Arrow"+n:n;n===a("ArrowLeft")?t.go("<"):n===a("ArrowRight")&&t.go(">")}))}function l(){r&&(c(r,"keydown"),y(r)&&F(r,rt))}return{mount:function(){s(),o(Xn,function(){l(),s()})},destroy:l}},LazyLoad:function(t,n,o){var i=Jn(t),r=i.on,u=i.off,e=i.bind,c=i.emit,f="sequential"===o.lazyLoad,a=[],s=0;function l(){s=0,a=[]}function d(){(a=a.filter(function(n){return!n.o.isWithin(t.index,o.perPage*((o.preloadPages||1)+1))||v(n)})).length||u(Dn)}function v(t){var i=t.e;z(t.o.slide,zn),e(i,"load error",function(n){!function(n,t){var i=n.o;J(i.slide,zn),t||(q(n.c),C(n.e,""),c(Yn,n.e,i),c(Gn));f&&h()}(t,"error"===n.type)}),["src","srcset"].forEach(function(n){t[n]&&(I(i,n,t[n]),F(i,"src"===n?dt:vt))})}function h(){s<a.length&&v(a[s++])}return{mount:function(){o.lazyLoad&&(r([Pn,Cn],function(){l(),n.Slides.forEach(function(u){U(u.slide,ht).forEach(function(n){var t,i=g(n,dt),r=g(n,vt);i===n.src&&r===n.srcset||(I(t=j("span",o.classes.spinner,n.parentElement),Zn,"presentation"),a.push({e:n,o:u,src:i,srcset:r,c:t}),C(n,"none"))})}),f&&h()}),f||r([Pn,Cn,Dn],d))},destroy:l}},Pagination:function(f,a,s){var l,n=Jn(f),t=n.on,d=n.emit,v=n.bind,i=n.unbind,h=a.Slides,g=(n=a.Controller).go,r=n.toPage,p=n.hasFocus,u=n.getIndex,m=[];function o(){e(),s.pagination&&h.isEnough()&&(function(){var n=f.length,o=s.classes,e=s.i18n,c=s.perPage,t=a.Elements,i=t.slider,t=t.root,t="slider"===s.pagination&&i?i:t,r=p()?n:un(n/c);l=j("ul",o.pagination,t);for(var u=0;u<r;u++)!function(n){var t=j("li",null,l),i=j("button",{class:o.page,type:"button"},t),r=h.getIn(n).map(function(n){return n.slide.id}),u=!p()&&1<c?e.pageX:e.slideX;v(i,"click",function(){g(">"+n)}),I(i,$n,r.join(" ")),I(i,tt,en(u,n+1)),d("pagination:page",l,t,i,n),m.push({li:t,button:i,page:n})}(u)}(),d("pagination:mounted",{list:l,items:m},c(f.index)),y())}function e(){l&&(q(l),m.forEach(function(n){i(n.button,"click")}),_(m),l=null)}function c(n){return m[r(n)]}function y(){var n=c(u(!0)),t=c(u());n&&(J(n.button,An),F(n.button,nt)),t&&(z(t.button,An),I(t.button,nt,!0)),d("pagination:updated",{list:l,items:m},n,t)}return{items:m,mount:function(){o(),t([Xn,Cn],o),t([On,Nn],y)},destroy:e,getAt:c}},Sync:function(i,n,r){var u=i.splides;return{mount:function(){var o,n,t;r.isNavigation?(n=Jn(i),t=n.on,n=n.emit,t(Tn,function(n){i.go(n.index)}),t(Bn,function(n,t){E(gt,t.key)&&(i.go(n.index),H(t))}),n("navigation:mounted",i.splides)):(o=[],u.concat(i).forEach(function(r,n,u){Jn(r).on(On,function(t,n,i){u.forEach(function(n){n===r||E(o,r)||(o.push(n),n.go(n.is(et)?i:t))}),_(o)})}))}}},Wheel:function(i,n,t){var r=Jn(i).bind;function u(n){var t=n.deltaY;t&&(i.go(t<0?"<":">"),H(n))}return{mount:function(){t.wheel&&r(n.Elements.track,"wheel",u)}}}}),mt={type:"slide",speed:400,waitForTransition:!0,perPage:1,arrows:!0,pagination:!0,interval:5e3,pauseOnHover:!0,pauseOnFocus:!0,resetProgress:!0,easing:"cubic-bezier(.42,.65,.27,.99)",drag:!0,direction:"ltr",slideFocus:!0,trimSpace:!0,classes:{slide:vn,clone:hn,arrows:pn,arrow:t,prev:mn,next:yn,pagination:wn,page:wn+"__page",spinner:m+"__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"}};function yt(n,r,t){var i=Jn(n).on,u=r.Style.ruleBy;return{mount:function(){i([Pn,Cn],function(){c(function(){r.Slides.forEach(function(n){u(n.slide,"transition","opacity "+t.speed+"ms "+t.easing)})})})},start:function(n,t){var i=r.Elements.track;u(i,"height",K(Y(i).height)),c(function(){t(),u(i,"height","")})},cancel:l}}function wt(o,t,e){var c,n=Jn(o).bind,f=t.Move,a=t.Controller,i=t.Elements.list;function r(){s("")}function s(n){t.Style.ruleBy(i,"transition",n)}return{mount:function(){n(i,"transitionend",function(n){n.target===i&&c&&(r(),c())})},start:function(n,t){var i=f.toPosition(n,!0),r=f.getPosition(),u=function(n){var t=e.rewindSpeed;if(o.is(ot)&&t){var i=a.getIndex(!0),r=a.getEnd();if(0===i&&r<=n||r<=i&&0===n)return t}return e.speed}(n);1<=on(i-r)&&1<=u?(s("transform "+u+"ms "+e.easing),f.translate(i),c=t):(f.jump(n),t())},cancel:r}}wn=function(){function i(n,t){this.event=qn(),this.Components={},this.state=Vn(w),this.splides=[],this.f={},this.a={};n=M(n)?N(document,n):n;V(n,n+" is invalid."),this.root=n,s(mt,i.defaults),s(s(this.f,mt),t||{})}var n,t,r=i.prototype;return r.mount=function(n,t){var i=this;this.state.set(w),this.s=t||this.s||(this.is(ct)?yt:wt),this.a=n||this.a;var n=W({},pt,this.a,{Transition:this.s}),r=this.Components;return e(n,function(n,t){n=n(i,i.Components,i.f);(r[t]=n).setup&&n.setup()}),e(r,function(n){n.mount&&n.mount()}),e(r,function(n){n.mounted&&n.mounted()}),this.emit(Pn),z(this.root,"is-initialized"),this.state.set(3),this.emit("ready"),this},r.sync=function(n){return this.splides.push(n),n.splides.push(this),this},r.go=function(n){this.Components.Controller.go(n)},r.on=function(n,t){return this.event.on(n,t),this},r.off=function(n){return this.event.off(n),this},r.emit=function(n){for(var t,i=arguments.length,r=new Array(1<i?i-1:0),u=1;u<i;u++)r[u-1]=arguments[u];return(t=this.event).emit.apply(t,[n].concat(r)),this},r.add=function(n,t){return this.Components.Slides.add(n,t),this},r.remove=function(n){return this.Components.Slides.remove(n),this},r.is=function(n){return this.f.type===n},r.refresh=function(){return this.emit(Cn),this},r.destroy=function(t){var n=this.event,i=this.state;return i.is(w)?n.on("ready",this.destroy.bind(this,t),this):(e(this.Components,function(n){n.destroy&&n.destroy(t)}),n.emit(Un),n.destroy(),_(this.splides),i.set(5)),this},n=i,(r=[{key:"options",get:function(){return this.f},set:function(n){var t=this.f;s(t,n),this.state.is(w)||this.emit(Xn,t)}},{key:"length",get:function(){return this.Components.Slides.getLength(!0)}},{key:"index",get:function(){return this.Components.Controller.getIndex()}}])&&_t(n.prototype,r),t&&_t(n,t),i}();return wn.defaults={},wn.STATES=n,wn},"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();