!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).AnyScroll=e()}(this,(function(){"use strict";var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])})(e,n)};function e(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n=function(){return(n=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function r(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,o,i=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(t){o={error:t}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function i(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(o(arguments[e]));return t}var a=function(){function t(){this.__map={}}return t.prototype.beforeEach=function(t){this.__interceptor=t},t.prototype.on=function(t,e){var n,o,i=Array.isArray(t)?t:[t];try{for(var a=r(i),c=a.next();!c.done;c=a.next()){var u=c.value;this.__map[u]=this.__map[u]||[];var s=this.__map[u];s&&s.push(e)}}catch(t){n={error:t}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}return this},t.prototype.emit=function(t,e){var n=this;void 0!==this.__interceptor?this.__interceptor(this,(function(){n.__emit(t,e)})):this.__emit(t,e)},t.prototype.__emit=function(t,e){var n,o,i=this.__map[t];if(Array.isArray(i)&&(null==i?void 0:i.length))try{for(var a=r(i),c=a.next();!c.done;c=a.next())(0,c.value)(e)}catch(t){n={error:t}}finally{try{c&&!c.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}this.event=e},t.prototype.off=function(t,e){var n=this.__map[t];if(void 0!==n)if(void 0===e)delete this.__map[t];else{var r=n.findIndex((function(t){return t===e}));n.splice(r,1)}},t.prototype.destroy=function(){this.__map={}},t}(),c=Object.prototype.toString;var u,s,l="clientX",f="clientY",p="start",v="move",d="cancel",h="end",m="computed",y="touchstart",g="touchend",_="touchcancel",E="mouseup",x="mousemove",b="mousedown";!function(t){t[t.POSSIBLE=0]="POSSIBLE",t[t.RECOGNIZED=1]="RECOGNIZED",t[t.FAILED=2]="FAILED",t[t.CANCELLED=3]="CANCELLED",t[t.START=4]="START",t[t.MOVE=5]="MOVE",t[t.END=1]="END"}(u||(u={}));var w=((s={})[u.START]="start",s[u.MOVE]="move",s[u.END]="end",s[u.CANCELLED]="cancel",s);function T(t){return w[t]}function S(t,e,n){var r,o,i,a,c,s,l,f={1:(r={},r[u.POSSIBLE]=(o={},o.move=u.START,o),r[u.START]=(i={},i.move=u.MOVE,i.end=u.END,i.cancel=u.CANCELLED,i),r[u.MOVE]=(a={},a.move=u.MOVE,a.end=u.END,a.cancel=u.CANCELLED,a),r),0:(c={},c[u.START]=(s={},s.move=u.FAILED,s.end=u.END,s.cancel=u.CANCELLED,s),c[u.MOVE]=(l={},l.start=u.FAILED,l.move=u.FAILED,l.end=u.END,l.cancel=u.CANCELLED,l),c)}[Number(t)][e];return void 0!==f&&f[n]||u.POSSIBLE}function L(t){[u.RECOGNIZED,u.CANCELLED,u.FAILED].includes(t.state)&&(t.state=u.POSSIBLE)}function C(t){return[u.START,u.MOVE].includes(t)}function D(t){if(t.disabled)return t.state=u.POSSIBLE,!0}function O(t,e){return n(n(n({},t),e),{state:u.POSSIBLE,disabled:!1})}function R(t){return Math.round(100*t)/100}function M(){var t,e,r,o,i=0;return function(a){if(t=e,void 0!==a){var c=function(t,e){var n=t.phase,r=t.points,o=t.changedPoints,i=t.nativeEvent,a=r.length,c=p===n,u=h===n&&0===a||d===n,s=Date.now(),l=A(r)||A(o),f=l.x,v=l.y,m=i.currentTarget;return Object.assign(t,{id:e,x:f,y:v,timestamp:s,isStart:c,isEnd:u,pointLength:a,currentTarget:m,getOffset:function(t){void 0===t&&(t=m);var e=t.getBoundingClientRect();return{x:f-Math.round(e.left),y:v-Math.round(e.top)}}})}(a,i=Number.MAX_SAFE_INTEGER>i?++i:1);e=c;var u=c.isStart,s=c.pointLength;return u&&(r=c,t=void 0,o=1<s?c:void 0),n(n({},c),{prevInput:t,startMultiInput:o,startInput:r})}}}function A(t){var e=t.length;if(0<e){if(1===e){var n=t[0],r=n.clientX,o=n.clientY;return{x:Math.round(r),y:Math.round(o)}}var i=t.reduce((function(t,e){return t.x+=e[l],t.y+=e[f],t}),{x:0,y:0});return{x:Math.round(i.x/e),y:Math.round(i.y/e)}}}function I(t,e,n,r){n.target,n.currentTarget,n.type;var o,i=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]])}return n}(n,["target","currentTarget","type"]);return document.createEvent?(o=document.createEvent("HTMLEvents")).initEvent(t,null==r?void 0:r.bubbles,null==r?void 0:r.cancelable):o=new Event(t,r),Object.assign(o,i,{match:function(){return n.targets&&0<n.targets.length&&n.targets.every((function(t){return o.currentTarget.contains(t)}))}}),e.dispatchEvent(o)}var X=[y,"touchmove",g,_],Y={domEvents:{bubbles:!0,cancelable:!0},preventDefault:function(t){if(t.target&&"tagName"in t.target){var e=t.target.tagName;return!/^(?:INPUT|TEXTAREA|BUTTON|SELECT)$/.test(e)}return!1}},N=function(t){function o(e,r){var o,i=t.call(this)||this;i.__computeFunctionList=[],i.__computeFunctionCreatorList=[],i.__pluginContexts=[],i.el=e,i.__options=n(n({},Y),r);var a,c,u,s,l=function(t){var e=M();return function(n){var r=[],o=[];Array.from(n.touches).forEach((function(e){var n=e.clientX,i=e.clientY,a=e.target;(null==t?void 0:t.contains(a))&&(r.push(a),o.push({clientX:n,clientY:i,target:a}))}));var i=Array.from(n.changedTouches).map((function(t){return{clientX:t.clientX,clientY:t.clientY,target:t.target}}));return e({phase:n.type.replace("touch",""),changedPoints:i,points:o,nativeEvent:n,target:n.target,targets:r})}}(i.el),f=(c=!1,u=null,s=M(),function(t){var e,n=t.clientX,r=t.clientY,o=t.type,i=t.button,l=t.target,f=[{clientX:n,clientY:r,target:l}];if(b===o&&0===i)u=l,c=!0,e=p;else{if(!c)return;x===o?e=v:E===o&&(f=[],e=h,c=!1)}var d=a||[{clientX:n,clientY:r,target:l}];if(a=[{clientX:n,clientY:r,target:l}],void 0!==e)return s({phase:e,changedPoints:d,points:f,target:u,targets:[u],nativeEvent:t})});if(i.__inputCreatorMap=((o={})[y]=l,o.touchmove=l,o[g]=l,o[_]=l,o[b]=f,o[x]=f,o[E]=f,o),void 0!==e){e.style.webkitTapHighlightColor="rgba(0,0,0,0)";var d=!1;try{var m={};Object.defineProperty(m,"passive",{get:function(){d=!0}}),window.addEventListener("_",(function(){}),m)}catch(t){}i.on("u",function(t,e,n){return X.forEach((function(r){t.addEventListener(r,e,n)})),t.addEventListener(b,e,n),window.addEventListener(x,e,n),window.addEventListener(E,e,n),function(){X.forEach((function(n){t.removeEventListener(n,e)})),t.removeEventListener(b,e,n),window.removeEventListener(x,e,n),window.removeEventListener(E,e,n)}}(e,i.catchEvent.bind(i),!(!1!==i.__options.preventDefault||!d)&&{passive:!0}))}return i}return e(o,t),o.prototype.use=function(t,e){this.__pluginContexts.push(t(this,e))},o.prototype.catchEvent=function(t){var e=this.__inputCreatorMap[t.type](t);if(void 0!==e){var r=function(){return t.preventDefault()};(function(t,e){var n=e.preventDefault;return function(t){return"[object Function]"===c.call(t)}(n)?n(t):!!n})(t,this.__options)&&r(),this.emit("input",e),this.emit2("at:"+e.phase,e,{});var o={};this.__computeFunctionList.forEach((function(t){var n=t(e,o);if(void 0!==n)for(var r in n)o[r]=n[r]})),this.emit(m,n(n(n({},e),o),{stopPropagation:function(){return t.stopPropagation()},stopImmediatePropagation:function(){return t.stopImmediatePropagation()},preventDefault:r}))}},o.prototype.compute=function(t,e){var n,o;try{for(var i=r(t),a=i.next();!a.done;a=i.next()){var c=a.value;this.__computeFunctionCreatorList.includes(c)||(this.__computeFunctionCreatorList.push(c),this.__computeFunctionList.push(c()))}}catch(t){n={error:t}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(n)throw n.error}}this.on(m,e)},o.prototype.beforeEach=function(e){var r=this;t.prototype.beforeEach.call(this,(function(t,o){var i;void 0===(null===(i=t.c)||void 0===i?void 0:i.name)?o():e(n(n({},t.c),{event:r.event}),o)}))},o.prototype.get=function(t){return this.__pluginContexts.find((function(e){return t===e.name}))},o.prototype.set=function(t){this.__options=n(n({},this.__options),t)},o.prototype.emit2=function(t,e,r){this.c=r,this.emit(t,n(n({},e),{type:t})),this.emit("at:after",n(n({},e),{name:t}));var o=e.target,i=this.__options.domEvents;i&&void 0!==this.el&&o&&(I(t,o,e,i),I("at:after",o,n(n({},e),{name:t}),i))},o.prototype.destroy=function(){this.emit("u"),t.prototype.destroy.call(this)},o}(a),P=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},j=function(t){return t/Math.PI*180},F=function(t,e){var n=function(t,e){var n=P(t)*P(e);if(0===n)return 0;var r=function(t,e){return t.x*e.x+t.y*e.y}(t,e)/n;return r>1&&(r=1),Math.acos(r)}(t,e);return function(t,e){return t.x*e.y-e.x*t.y}(t,e)>0&&(n*=-1),j(n)},z=function(t,e){return Math.abs(t)>=Math.abs(e)?0<t?"right":"left":0<e?"down":"up"};function V(){var t=0,e=0;return function(n,r){var o=r.prevVecotr,i=r.startVecotr,a=r.activeVecotr;return a&&(e=Math.round(F(a,o)),t=Math.round(F(a,i))),{angle:t,deltaAngle:e}}}function B(){return function(t){var e=t.prevInput,n=0,r=0,o=0;if(void 0!==e&&(n=t.x-e.x,r=t.y-e.y,0!==n||0!==r)){var i=Math.sqrt(Math.pow(n,2)+Math.pow(r,2));o=Math.round(j(Math.acos(Math.abs(n)/i)))}return{deltaX:n,deltaY:r,deltaXYAngle:o}}}function k(){var t,e=0,n=0,r=0,o=0,i=0;return function(a){var c=a.phase,u=a.startInput;return p===c?(e=0,n=0,r=0,o=0,i=0):v===c&&(e=Math.round(a.points[0][l]-u.points[0][l]),n=Math.round(a.points[0][f]-u.points[0][f]),r=Math.abs(e),o=Math.abs(n),i=Math.round(P({x:r,y:o})),t=z(e,n)),{displacementX:e,displacementY:n,distanceX:r,distanceY:o,distance:i,overallDirection:t}}}function G(){var t=1,e=1;return function(n,r){var o=r.prevVecotr,i=r.startVecotr,a=r.activeVecotr;return a&&(t=R(P(a)/P(o)),e=R(P(a)/P(i))),{scale:e,deltaScale:t}}}function Z(){var t,e,n=0,r=0,o=0,i=0;return function(a){if(void 0!==a){e=e||a.startInput;var c=a.timestamp-e.timestamp;if(16<c){var u=a.x-e.x,s=a.y-e.y;o=Math.round(u/c*100)/100,i=Math.round(s/c*100)/100,n=Math.abs(o),r=Math.abs(i),t=z(u,s)||t,e=a}}return{velocityX:n,velocityY:r,speedX:o,speedY:i,direction:t}}}function q(){var t=0;return function(e){var n=e.phase;return p===n&&(t=e.pointLength),{maxPointLength:t}}}function H(t){return{x:t.points[1][l]-t.points[0][l],y:t.points[1][f]-t.points[0][f]}}function U(){var t,e,n;return function(r){var o=r.prevInput,i=r.startMultiInput;return void 0!==i&&void 0!==o&&r.id!==i.id&&1<o.pointLength&&1<r.pointLength&&(t=H(i),e=H(o),n=H(r)),{startVecotr:t,prevVecotr:e,activeVecotr:n}}}var W={name:"tap",pointLength:1,tapTimes:1,waitNextTapTime:300,maxDistance:2,maxDistanceFromPrevTap:9,maxPressTime:250};function $(t,e){var n,r,o,i=O(W,e),a=0;function c(){a=0,n=void 0,r=void 0}return t.compute([k,q],(function(e){if(!D(i)){var s,l,f,p,v=e.phase,d=e.x,m=e.y;h===v&&(i.state=u.POSSIBLE,s=e.startInput,l=e.pointLength,f=e.timestamp-s.timestamp,p=e.distance,e.maxPointLength===i.pointLength&&0===l&&i.maxDistance>=p&&i.maxPressTime>f?(clearTimeout(o),function(t,e){if(void 0!==n){var r=P({x:t.x-n.x,y:t.y-n.y});return n=t,e.maxDistanceFromPrevTap>=r}return n=t,!0}({x:d,y:m},i)&&function(t){var e=performance.now();if(void 0===r)return r=e,!0;var n=e-r;return r=e,n<t}(i.waitNextTapTime)?a++:a=1,0==a%i.tapTimes?(i.state=u.RECOGNIZED,t.emit2(i.name,e,i),c()):o=setTimeout((function(){i.state=u.FAILED,c()}),i.waitNextTapTime)):(c(),i.state=u.FAILED))}})),i}var J={name:"pan",threshold:10,pointLength:1};function K(t,e){var n=O(J,e);return t.compute([Z,k,B],(function(e){if(L(n),!D(n)){var r,o,i,a,c,u=(r=e.pointLength,o=e.distance,i=e.direction,a=e.phase,(C(c=n.state)||n.threshold<=o)&&n.pointLength===r&&void 0!==i||C(c)&&h===a);if(n.state=S(u,n.state,e.phase),u){var s=n.name;t.emit2(s,e,n),t.emit2(s+T(n.state),e,n)}}})),n}var Q={name:"swipe",threshold:10,velocity:.3,pointLength:1};function tt(t,e){var n=O(Q,e);return t.compute([k,Z,q],(function(e){if(n.state=u.POSSIBLE,!n.disabled&&function(){if(h!==e.phase)return!1;var t=e.velocityX,r=e.velocityY,o=e.distance;return e.maxPointLength===n.pointLength&&0===e.points.length&&n.threshold<o&&n.velocity<Math.max(t,r)}()){var r=n.name;n.state=u.RECOGNIZED,t.emit2(r,e,n),t.emit2(r+e.direction,e,n)}})),n}var et={name:"press",pointLength:1,maxDistance:9,minPressTime:251};function nt(t,e){var n=O(et,e),r=0;return t.compute([k],(function(e){if(!D(n)){var o,i=e.phase,a=e.startInput,c=e.pointLength;if(p===i&&n.pointLength===c)L(n),clearTimeout(r),r=setTimeout((function(){n.state=u.RECOGNIZED,t.emit2(n.name,e,n)}),n.minPressTime);else if(h===i&&u.RECOGNIZED===n.state)t.emit2(n.name+"up",e,n);else if(u.RECOGNIZED!==n.state){var s=e.timestamp-a.timestamp;(!((o=e.distance)&&n.maxDistance>o)||n.minPressTime>s&&[h,d].includes(i))&&(clearTimeout(r),n.state=u.FAILED)}}})),n}var rt={name:"pinch",threshold:0,pointLength:2};function ot(t,e){var n=O(rt,e);return t.compute([U,G],(function(e){if(L(n),!D(n)){var r,o,i,a,c=(r=e.pointLength,o=e.scale,i=e.deltaScale,a=e.phase,n.pointLength===r&&(void 0!==o&&void 0!==i&&n.threshold<Math.abs(o-1)||C(n.state))||C(n.state)&&[h,d].includes(a));n.state=S(c,n.state,e.phase);var u=n.name;c&&t.emit2(u,e,n);var s=T(n.state);s&&t.emit2(u+s,e,n)}})),n}var it={name:"rotate",threshold:0,pointLength:2};function at(t,e){var n=O(it,e);return t.compute([U,V],(function(e){if(!D(n)){L(n);var r,o,i,a=(r=e.pointLength,o=e.angle,i=e.phase,n.pointLength===r&&(n.threshold<Math.abs(o)||C(n.state))||C(n.state)&&[h,d].includes(i));n.state=S(a,n.state,e.phase);var c=n.name;a&&t.emit2(c,e,n);var u=T(n.state);u&&t.emit2(c+u,e,n)}})),n}var ct=function(t){function n(e,n){var r=t.call(this,e,n)||this;return r.use($),r.use(K),r.use(tt),r.use(nt),r.use(ot),r.use(at),r}return e(n,t),n.version="2.0.0-alpha.3",n.STATE_POSSIBLE=u.POSSIBLE,n.STATE_START=u.START,n.STATE_MOVE=u.MOVE,n.STATE_END=u.END,n.STATE_CANCELLED=u.CANCELLED,n.STATE_FAILED=u.FAILED,n.STATE_RECOGNIZED=u.RECOGNIZED,n.tap=$,n.pan=K,n.swipe=tt,n.press=nt,n.rotate=at,n.pinch=ot,n}(N),ut="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},st={exports:{}},lt={exports:{}};(function(){var t,e,n,r,o,i;"undefined"!=typeof performance&&null!==performance&&performance.now?lt.exports=function(){return performance.now()}:"undefined"!=typeof process&&null!==process&&process.hrtime?(lt.exports=function(){return(t()-o)/1e6},e=process.hrtime,r=(t=function(){var t;return 1e9*(t=e())[0]+t[1]})(),i=1e9*process.uptime(),o=r-i):Date.now?(lt.exports=function(){return Date.now()-n},n=Date.now()):(lt.exports=function(){return(new Date).getTime()-n},n=(new Date).getTime())}).call(ut);for(var ft=lt.exports,pt="undefined"==typeof window?ut:window,vt=["moz","webkit"],dt="AnimationFrame",ht=pt["request"+dt],mt=pt["cancel"+dt]||pt["cancelRequest"+dt],yt=0;!ht&&yt<vt.length;yt++)ht=pt[vt[yt]+"Request"+dt],mt=pt[vt[yt]+"Cancel"+dt]||pt[vt[yt]+"CancelRequest"+dt];if(!ht||!mt){var gt=0,_t=0,Et=[];ht=function(t){if(0===Et.length){var e=ft(),n=Math.max(0,1e3/60-(e-gt));gt=n+e,setTimeout((function(){var t=Et.slice(0);Et.length=0;for(var e=0;e<t.length;e++)if(!t[e].cancelled)try{t[e].callback(gt)}catch(t){setTimeout((function(){throw t}),0)}}),Math.round(n))}return Et.push({handle:++_t,callback:t,cancelled:!1}),_t},mt=function(t){for(var e=0;e<Et.length;e++)Et[e].handle===t&&(Et[e].cancelled=!0)}}st.exports=function(t){return ht.call(pt,t)},st.exports.cancel=function(){mt.apply(pt,arguments)},st.exports.polyfill=function(t){t||(t=pt),t.requestAnimationFrame=ht,t.cancelAnimationFrame=mt};var xt=st.exports;var bt=function(t,e,n){return t==t&&(void 0!==n&&(t=t<=n?t:n),void 0!==e&&(t=t>=e?t:e)),t},wt=/\s/;var Tt=function(t){for(var e=t.length;e--&&wt.test(t.charAt(e)););return e},St=/^\s+/;var Lt=function(t){return t?t.slice(0,Tt(t)+1).replace(St,""):t};var Ct=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},Dt="object"==typeof ut&&ut&&ut.Object===Object&&ut,Ot="object"==typeof self&&self&&self.Object===Object&&self,Rt=(Dt||Ot||Function("return this")()).Symbol,Mt=Rt,At=Object.prototype,It=At.hasOwnProperty,Xt=At.toString,Yt=Mt?Mt.toStringTag:void 0;var Nt=function(t){var e=It.call(t,Yt),n=t[Yt];try{t[Yt]=void 0;var r=!0}catch(t){}var o=Xt.call(t);return r&&(e?t[Yt]=n:delete t[Yt]),o},Pt=Object.prototype.toString;var jt=Nt,Ft=function(t){return Pt.call(t)},zt=Rt?Rt.toStringTag:void 0;var Vt=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":zt&&zt in Object(t)?jt(t):Ft(t)},Bt=function(t){return null!=t&&"object"==typeof t};var kt=Lt,Gt=Ct,Zt=function(t){return"symbol"==typeof t||Bt(t)&&"[object Symbol]"==Vt(t)},qt=/^[-+]0x[0-9a-f]+$/i,Ht=/^0b[01]+$/i,Ut=/^0o[0-7]+$/i,Wt=parseInt;var $t=function(t){if("number"==typeof t)return t;if(Zt(t))return NaN;if(Gt(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Gt(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=kt(t);var n=Ht.test(t);return n||Ut.test(t)?Wt(t.slice(2),n?2:8):qt.test(t)?NaN:+t},Jt=bt,Kt=$t;var Qt=function(t,e,n){return void 0===n&&(n=e,e=void 0),void 0!==n&&(n=(n=Kt(n))==n?n:0),void 0!==e&&(e=(e=Kt(e))==e?e:0),Jt(Kt(t),e,n)},te=Math.max,ee=Math.min;var ne=$t;var re=function(t,e,n){return t>=ee(e,n)&&t<te(e,n)},oe=function(t){return t?(t=ne(t))===1/0||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0},ie=$t;var ae,ce=function(t,e,n){return e=oe(e),void 0===n?(n=e,e=0):n=oe(n),t=ie(t),re(t,e,n)};function ue(t,e){return"x"in t||"y"in t?[t.x||e[0],t.y||e[1]]:he((function(n){return t[n]||e[n]}))}!function(t){t.X="x",t.Y="y"}(ae||(ae={}));var se=[ae.X,ae.Y];function le(t,e){for(var n in e)t.style[n]=e[n]||""}function fe(t){var e,n=document.createElement("div");return t&&(e=n.classList).add.apply(e,i(t)),n}function pe(t,e){void 0===e&&(e=1),le(t,{opacity:String(e)})}function ve(t,e){void 0===e&&(e=!0);e?"none"===t.style.display&&le(t,{display:""}):le(t,{display:"none"})}function de(t){return 1-Math.pow(1-t,3)}function he(t){return[t(0),t(1)]}function me(t,e,n,r){void 0===r&&(r=de);var o=i(t),a=i(e),c=Date.now(),u=-1,s=function(){},l=a.map((function(t,e){return t-o[e]}));return[function t(e){u=xt((function(){var i=(Date.now()-c)/n,u=r(i);if(1>i){var f=o.map((function(t,e){return t+l[e]*u}));e(f),t(e)}else e(a),s()}))},function(){xt.cancel(u)},function(t){s=t}]}function ye(t,e,n){void 0===n&&(n=.1);var r=e-t;return.1<Math.abs(r)?e-((1-n)*r|0):e}var ge=window.ResizeObserver,_e=window.MutationObserver,Ee=function(t){function r(e,n){var r=t.call(this)||this;r.xy=[0,0],r.minXY=[0,0],r.maxXY=[0,0],r.wrapSize=[0,0],r.contentSize=[0,0],r.targets=[],r.isScrolling=!1,r.__scrollEndTimeId=-1,r.__dampScrollRafId=-1,r.__stopScroll=function(){},r.el=e,r.wrapRef=n;var o=n.options;if(r.__options=o,le(e,{position:"absolute"}),n.on("beforeUpdate",(function(){r.update()})),ge){var i=new ge((function(){r.update()}));i.observe(e),r.on("beforeDestroy",(function(){i.disconnect()}))}else if(_e){r.update();var a=new _e((function(){r.update()}));a.observe(e,{childList:!0,subtree:!0}),r.on("beforeDestroy",(function(){a.disconnect()}))}return r}return e(r,t),r.prototype.set=function(t){this.__options=n(n({},this.__options),t),this.update()},r.prototype.update=function(){var t=this.el,e=t.offsetWidth,n=t.offsetHeight,r=t.clientWidth,o=t.clientHeight,i=t.scrollWidth,a=t.scrollHeight;this.wrapSize=[this.wrapRef.size[0],this.wrapRef.size[1]],this.contentSize=[e-r+i,n-o+a],this.maxXY=this.__options.maxXY?this.__options.maxXY(this):[Math.max(0,this.contentSize[0]-this.wrapSize[0]),Math.max(0,this.contentSize[1]-this.wrapSize[1])],this.minXY=this.__options.minXY?this.__options.minXY(this):[0,0],this.emit("updated",this)},r.prototype.stop=function(){var t=this;this.isScrolling&&this.xy.every((function(e,n){return ce(e,t.minXY[n],t.maxXY[n])}))&&this.emit("scroll-end",this.xy),this.isScrolling=!1,xt.cancel(this.__dampScrollRafId),this.__stopScroll()},r.prototype.snap=function(){var t=this,e=he((function(e){return Qt(t.xy[e],t.minXY[e],t.maxXY[e])}));this.dampScroll(e)},r.prototype.moveTo=function(t){var e=this,n=this.__options,r=n.allow,i=n.overflowDistance;if(!r.includes(!0))return this.xy;clearTimeout(this.__scrollEndTimeId);var a=ue(t,this.xy),c=he((function(t){return r[t]&&void 0!==a[t]?Qt(a[t],e.minXY[t]-i,e.maxXY[t]+i):e.xy[t]}));if(!this.xy.some((function(t,e){return t!==c[e]})))return this.xy;he((function(t){return e.xy[t]=c[t]}));var u=o(this.xy,2),s=u[0],l=u[1],f=this.targets,p=f[0];return this.emit("scroll",{targets:f,target:p,x:s,y:l}),this.__options.render(this.el,[-this.xy[0],-this.xy[1]]),this.xy},r.prototype.scrollTo=function(t,e,n){var r=this;void 0===e&&(e=1e3);var i=ue(t,this.xy),a=this.__options.overflowDistance;this.stop(),this.isScrolling=!0;var c=he((function(t){return Qt(i[t],r.minXY[t]-a,r.maxXY[t]+a)})),u=o(me(this.xy,c,e,n),3),s=u[0],l=u[1],f=u[2];s(this.moveTo.bind(this)),this.__stopScroll=l,f((function(){r.snap(),r.isScrolling=!1}))},r.prototype.scrollToElement=function(t,e,n,r){var o=this;void 0===e&&(e=[0,0]),void 0===n&&(n=1e3),void 0===r&&(r=de);var i=ue(e,[0,0]);console.log(i);var a=this.wrapRef.el.getBoundingClientRect(),c=t.getBoundingClientRect(),u=c.x,s=c.y,l=he((function(t){return o.xy[t]+[u,s][t]-[a.x,a.y][t]+i[t]}));this.scrollTo(l,n,r)},r.prototype.dampScroll=function(t,e){var n=this,r=ue(t,this.xy),o=this.__options,a=o.overflowDistance,c=o.allow;if(!he((function(t){return!c[t]||r[t]===n.xy[t]})).every((function(t){return t}))){xt.cancel(this.__dampScrollRafId);var u=i(r);!function t(n){n.isScrolling=!0;var r=n.xy,o=n.minXY,i=n.maxXY,s=he((function(t){if(!c[t])return r[t];var s=ye(n.xy[t],u[t],e);if(s>=i[t]+a)u[t]=i[t];else if(s<=o[t]-a)u[t]=o[t];else{if(s!==u[t])return s;r[t]>i[t]?u[t]=i[t]:r[t]<o[t]&&(u[t]=o[t])}return ye(n.xy[t],u[t],e)}));n.moveTo(s),he((function(t){return c[t]&&u[t]!==s[t]})).some((function(t){return t}))?n.__dampScrollRafId=xt((function(){t(n)})):(n.isScrolling=!1,n.emit("scroll-end",n.xy))}(this)}},r.prototype.destroy=function(){t.prototype.destroy.call(this)},r}(a),xe=window.setTimeout,be=window.ResizeObserver,we={overflowDistance:100,damping:.1,allow:[!0,!0],render:function(t,e){var n=o(e,2);le(t,{transform:"translate3d("+n[0]+"px, "+n[1]+"px,0)"})}},Te=function(t){function o(e,r){var o=t.call(this)||this;if(o.size=[0,0],o.targets=[],o.__contentRefList=[],o.el=e,o.options=n(n({},we),r),le(e,{position:"relative",overflow:"hidden"}),Array.from(e.children).forEach((function(t){var e=new Ee(t,o);e.on("scroll",(function(t){o.emit("scroll",t)})),e.on("scroll-end",(function(t){o.emit("scroll-end",t)})),e.on("updated",(function(t){o.emit("updated",t)})),o.on("beforeDestroy",(function(){e.destroy()})),o.__contentRefList.push(e)})),o.__currentContentRef=o.getContentRef(),be){var i=new be(o.update.bind(o));i.observe(e),o.on("beforeDestroy",(function(){i.disconnect()}))}else o.update();var a=new ct(e);o.at=a,a.on(["panstart","panmove"],(function(t){var e=o.__currentContentRef;if(null!==e){o.targets=t.targets;var n=t.deltaX,r=t.deltaY,i=e.xy;e.moveTo([i[0]-n,i[1]-r])}})),a.on("panend",(function(t){null!==o.__currentContentRef&&(o.__currentContentRef.__scrollEndTimeId=xe((function(){null!==o.__currentContentRef&&(o.targets=t.targets,o.emit("scroll-end",o.__currentContentRef.xy))}),16))})),a.on("at:start",(function(t){var e;o.emit("at:start");var n=t.target;o.__currentContentRef=o.getContentRef(n),null===(e=o.__currentContentRef)||void 0===e||e.stop()})),a.on("at:end",(function(){var t;o.emit("at:end"),null===(t=o.__currentContentRef)||void 0===t||t.snap()}));var c=a.get("swipe");return c&&(c.velocity=1),a.on("swipe",(function(t){var e=o.__currentContentRef;if(null!==e){o.targets=t.targets;var n=200*t.speedX,r=200*t.speedY;e.dampScroll([e.xy[0]-n,e.xy[1]-r])}})),a.on("at:after",(function(t){o.emit(t.name,t)})),o}return e(o,t),o.prototype.update=function(){var t=this.el,e=t.clientWidth,n=t.clientHeight;this.size=[e,n],this.emit("beforeUpdate",this.size)},o.prototype.getContentRef=function(t){var e,n,o=this.__contentRefList;if(void 0===t)return this.__currentContentRef||o[o.length-1];if("number"==typeof t)return o[Number(t)]||null;try{for(var i=r(o),a=i.next();!a.done;a=i.next()){var c=a.value;if(c.el.contains(t))return c}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return this.__currentContentRef},o.prototype.active=function(t){this.__currentContentRef=t},o.prototype.moveTo=function(t){var e;return null===(e=this.__currentContentRef)||void 0===e?void 0:e.moveTo(t)},o.prototype.scrollTo=function(t,e,n){var r;void 0===e&&(e=1e3),null===(r=this.__currentContentRef)||void 0===r||r.scrollTo(t,e,n)},o.prototype.scrollToElement=function(t,e,n,r){var o;null===(o=this.__currentContentRef)||void 0===o||o.scrollToElement(t,e,n,r)},o.prototype.dampScroll=function(t,e){var n;void 0===e&&(e=this.options.damping),null===(n=this.__currentContentRef)||void 0===n||n.dampScroll(t,e)},o.prototype.stop=function(){var t;null===(t=this.__currentContentRef)||void 0===t||t.stop()},o.prototype.destroy=function(){this.emit("beforeDestroy"),this.at.destroy(),t.prototype.destroy.call(this)},o}(a),Se=function(t){function n(e,n){return t.call(this,e,n)||this}return e(n,t),n.prototype.use=function(t,e){t(this,e)},n}(Te),Le={exports:{}},Ce=[],De=[];function Oe(t,e){if(e=e||{},void 0===t)throw new Error("insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).");var n,r=!0===e.prepend?"prepend":"append",o=void 0!==e.container?e.container:document.querySelector("head"),i=Ce.indexOf(o);return-1===i&&(i=Ce.push(o)-1,De[i]={}),void 0!==De[i]&&void 0!==De[i][r]?n=De[i][r]:(n=De[i][r]=function(){var t=document.createElement("style");return t.setAttribute("type","text/css"),t}(),"prepend"===r?o.insertBefore(n,o.childNodes[0]):o.appendChild(n)),65279===t.charCodeAt(0)&&(t=t.substr(1,t.length)),n.styleSheet?n.styleSheet.cssText+=t:n.textContent+=t,n}Le.exports=Oe;var Re=Le.exports.insertCss=Oe,Me=window.setTimeout;function Ae(t){var e=t.options.allow,n=[-1,-1],r=!1;Re("\n.scroll-bar-track{\n    right:0;\n    bottom:0;\n    background: rgba(177,177,177,0.6);\n    transition:opacity .5s ease-out;\n}\n\n.scroll-bar-track > .scroll-bar-thumb{\n    width: 8px;\n    height: 8px;\n    background: rgba(55,55,55,0.6);\n    border-radius:4px;\n}\n\n.scroll-bar-track-x{\n    left:0;\n    height:8px;\n}\n\n.scroll-bar-track-y{\n    top:0;\n    width:8px;\n}\n");var a=he((function(n){var o=se[n],u=function(t,e){void 0===e&&(e=ae.X);var n=fe(["scroll-bar-track","scroll-bar-track-"+e]),r=fe(["scroll-bar-thumb","scroll-bar-thumb-"+e]);return n.appendChild(r),t.appendChild(n),n}(t.el,o),s=new Te(u,{allow:[ae.X===o,ae.Y===o],overflowDistance:0});return le(s.el,{position:"absolute"}),s.on("panstart",(function(){r=!0})),s.on("at:start",(function(){c(t,a,e)})),s.on("scroll",(function(){if(r){var e=s.getContentRef(),o=t.getContentRef();if(null!==o){var a=i(o.xy);a[n]=-e.xy[n]*o.contentSize[n]/s.size[n],o.moveTo(a)}}})),s.at.on("tap",(function(t){var e=s.getContentRef();if(null!==e&&t.target===s.el){r=!0;var o=s.el.getBoundingClientRect(),i=o.x,a=o.y,c=e.contentSize,u=[0,0];u[n]=[i,a][n]-[t.x,t.y][n]+c[n]/2,e.dampScroll(u)}})),s}));function c(t,e,r){var a=t.getContentRef(),c=a.contentSize,u=a.minXY,s=a.maxXY,l=t.size;he((function(t){var f,p=e[t],v=p.el;if(r[t])if(ve(v),c[t]>l[t]){pe(v,1),clearTimeout(n[t]),n[t]=Me((function(){pe(v,0)}),1e3);var d=e[t].getContentRef();if(null!==d){var h=o(function(t,e,n,r,o){var i=1,a=e/n*e;o>=t?i=1-(o-t)/e:r<t&&(i=1-(t-r)/e);return[a*=i,-t/(r-o)*(e-a)]}(a.xy[t],l[t],c[t],s[t],u[t]),2),m=h[0],y=h[1];le(p.getContentRef().el,((f={})[["width","height"][t]]=m+"px",f)),d.update(),d.maxXY[t]=0,d.minXY[t]=Math.min(0,m-p.size[t]);var g=i(d.xy);g[t]=y,d.moveTo(g)}}else ve(v,!1);else ve(v,!1)}))}t.on("updated",(function(){c(t,a,e)})),t.on(["scroll","resize"],(function(){c(t,a,e)})),t.at.on("at:start",(function(){r=!1,c(t,a,e)})),t.on("beforeDestroy",(function(){a.forEach((function(t){var e;t.destroy(),null===(e=t.el.parentElement)||void 0===e||e.removeChild(t.el)}))}))}var Ie=window.setTimeout;function Xe(t){var e=t.options.allow,r=function(t,e){var r,i,a=0,c=0;function u(u){var s=o(function(t,e,n){void 0===e&&(e=40),void 0===n&&(n=800);var r=t.deltaX,o=t.deltaY,i=t.deltaMode;return i==t.DOM_DELTA_LINE?(r*=e,o*=e):i==t.DOM_DELTA_PAGE&&(r*=n,o*=n),[r,o]}(u),2),l=s[0],f=s[1];function p(r,o){var i=n({target:u.target,deltaX:l,deltaY:f,type:r},o),a=new Event("wheel"+r);e(i),t.dispatchEvent(a)}c+=l,a+=f,clearTimeout(i),i=Ie((function(){var t=Date.now()-r,e=c/t,n=a/t;r=void 0,c=0,a=0,p("end",{vx:e,vy:n})}),16),p(void 0===r?"start":"move"),r=Date.now()}return t.addEventListener("wheel",u),function(){t.removeEventListener("wheel",u)}}(t.el,(function(n){var r=n.type,o=n.deltaX,i=n.deltaY,a=n.vx,c=n.vy,u=n.target,s=t.getContentRef(u);if(null!==s){t.active(s);var l=e[0]&&(!e[1]||o),f=i||o,p=c||a,v=s.xy;if(t.targets=[u],"start"===r&&s.stop(),"move"===r||"start"===r){var d=l?[v[0]+f,v[1]]:[v[0],v[1]+f];t.dampScroll(d)}else if("end"===r){d=l?[v[0]+5*p,v[1]]:[v[0],v[1]+30*Math.ceil(p)];t.dampScroll(d)}}}));t.on("beforeDestroy",r)}return function(t){function n(e,n){var r=t.call(this,e,n)||this;return Ae(r),Xe(r),r}return e(n,t),n}(Se)}));
