You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
87 KiB
2 lines
87 KiB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).BetterScroll={})}(this,function(t){"use strict";var s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o])})(t,e)};function e(t,e){function o(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var a=function(){return(a=Object.assign||function(t){for(var e,o=1,s=arguments.length;o<s;o++)for(var i in e=arguments[o])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t}).apply(this,arguments)};function r(t,n,h,l){return new(h=h||Promise)(function(o,e){function s(t){try{r(l.next(t))}catch(t){e(t)}}function i(t){try{r(l.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?o(t.value):((e=t.value)instanceof h?e:new h(function(t){t(e)})).then(s,i)}r((l=l.apply(t,n||[])).next())})}function n(o,s){var i,r,n,h={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;h;)try{if(i=1,r&&(n=2&e[0]?r.return:e[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,e[1])).done)return n;switch(r=0,n&&(e=[2&e[0],n.value]),e[0]){case 0:case 1:n=e;break;case 4:return h.label++,{value:e[1],done:!1};case 5:h.label++,r=e[1],e=[0];continue;case 7:e=h.ops.pop(),h.trys.pop();continue;default:if(!(n=0<(n=h.trys).length&&n[n.length-1])&&(6===e[0]||2===e[0])){h=0;continue}if(3===e[0]&&(!n||e[1]>n[0]&&e[1]<n[3])){h.label=e[1];break}if(6===e[0]&&h.label<n[1]){h.label=n[1],n=e;break}if(n&&h.label<n[2]){h.label=n[2],h.ops.push(e);break}n[2]&&h.ops.pop(),h.trys.pop();continue}e=s.call(o,h)}catch(t){e=[6,t],r=0}finally{i=n=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function p(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;for(var s=Array(t),i=0,e=0;e<o;e++)for(var r=arguments[e],n=0,h=r.length;n<h;n++,i++)s[i]=r[n];return s}var i=[{sourceKey:"scroller.scrollBehaviorX.currentPos",key:"x"},{sourceKey:"scroller.scrollBehaviorY.currentPos",key:"y"},{sourceKey:"scroller.scrollBehaviorX.hasScroll",key:"hasHorizontalScroll"},{sourceKey:"scroller.scrollBehaviorY.hasScroll",key:"hasVerticalScroll"},{sourceKey:"scroller.scrollBehaviorX.contentSize",key:"scrollerWidth"},{sourceKey:"scroller.scrollBehaviorY.contentSize",key:"scrollerHeight"},{sourceKey:"scroller.scrollBehaviorX.maxScrollPos",key:"maxScrollX"},{sourceKey:"scroller.scrollBehaviorY.maxScrollPos",key:"maxScrollY"},{sourceKey:"scroller.scrollBehaviorX.minScrollPos",key:"minScrollX"},{sourceKey:"scroller.scrollBehaviorY.minScrollPos",key:"minScrollY"},{sourceKey:"scroller.scrollBehaviorX.movingDirection",key:"movingDirectionX"},{sourceKey:"scroller.scrollBehaviorY.movingDirection",key:"movingDirectionY"},{sourceKey:"scroller.scrollBehaviorX.direction",key:"directionX"},{sourceKey:"scroller.scrollBehaviorY.direction",key:"directionY"},{sourceKey:"scroller.actions.enabled",key:"enabled"},{sourceKey:"scroller.animater.pending",key:"pending"},{sourceKey:"scroller.animater.stop",key:"stop"},{sourceKey:"scroller.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];function h(t){console.error("[BScroll warn]: "+t)}var l="undefined"!=typeof window,o=l&&navigator.userAgent.toLowerCase(),c=!(!o||!/wechatdevtools/.test(o)),u=o&&0<o.indexOf("android"),d=function(){if("string"!=typeof o)return!1;var t=/os (\d\d?_\d(_\d)?)/.exec(o);if(!t)return!1;var e=t[1].split("_").map(function(t){return parseInt(t,10)});return!!(13<=e[0]&&4<=e[1])}();function f(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var g=function(t,e){for(var o in e)t[o]=e[o];return t};function y(t){return null==t}function v(t,e,o){return t<e?e:o<t?o:t}var m=l&&document.createElement("div").style,k=function(){if(!l)return!1;for(var t=0,e=[{key:"standard",value:"transform"},{key:"webkit",value:"webkitTransform"},{key:"Moz",value:"MozTransform"},{key:"O",value:"OTransform"},{key:"ms",value:"msTransform"}];t<e.length;t++){var o=e[t];if(void 0!==m[o.value])return o.key}return!1}();function T(t){return!1===k?t:"standard"===k?"transitionEnd"===t?"transitionend":t:k+t.charAt(0).toUpperCase()+t.substr(1)}function b(t){return"string"==typeof t?document.querySelector(t):t}function P(t,e,o,s){t.addEventListener(e,o,{passive:!1,capture:!!s})}function w(t,e,o,s){t.removeEventListener(e,o,{capture:!!s})}function S(t){for(var e=0,o=0;t;)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}var x=k&&"standard"!==k?"-"+k.toLowerCase()+"-":"",M=T("transform"),Y=T("transition"),B=l&&T("perspective")in m,E=l&&("ontouchstart"in window||c),D=l&&Y in m,X={transform:M,transition:Y,transitionTimingFunction:T("transitionTimingFunction"),transitionDuration:T("transitionDuration"),transitionDelay:T("transitionDelay"),transformOrigin:T("transformOrigin"),transitionEnd:T("transitionEnd"),transitionProperty:T("transitionProperty")},O={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function H(t){if(t instanceof window.SVGElement){var e=t.getBoundingClientRect();return{top:e.top,left:e.left,width:e.width,height:e.height}}return{top:t.offsetTop,left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight}}function z(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}var C=z;function F(t,e){var o;void 0===e&&(e="click"),"mouseup"===t.type?o=t:"touchend"!==t.type&&"touchcancel"!==t.type||(o=t.changedTouches[0]);var s,i={};o&&(i.screenX=o.screenX||0,i.screenY=o.screenY||0,i.clientX=o.clientX||0,i.clientY=o.clientY||0);var r=!0,n=!0;if("undefined"!=typeof MouseEvent)try{s=new MouseEvent(e,g({bubbles:r,cancelable:n},i))}catch(t){h()}else h();function h(){(s=document.createEvent("Event")).initEvent(e,r,n),g(s,i)}s.forwardedTouchEvent=!0,s._constructed=!0,t.target.dispatchEvent(s)}function L(t,e){t.removeChild(e)}function I(t,e){return new RegExp("(^|\\s)"+e+"(\\s|$)").test(t.className)}var _={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(t){return 1+--t*t*t*t*t}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(t){return t*(2-t)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(t){return 1- --t*t*t*t}}},A=l&&window;function N(){}function W(t){}var R=l?A.requestAnimationFrame||A.webkitRequestAnimationFrame||A.mozRequestAnimationFrame||A.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||100/60)/2)}:N,K=l?A.cancelAnimationFrame||A.webkitCancelAnimationFrame||A.mozCancelAnimationFrame||A.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:N,U={enumerable:!0,configurable:!0,get:W,set:W};var V=(j.prototype.on=function(t,e,o){return void 0===o&&(o=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},j.prototype.once=function(o,s,i){var r=this;void 0===i&&(i=this),this.hasType(o);var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r.off(o,n),s.apply(i,t)};return n.fn=s,this.on(o,n),this},j.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),!e)return this.events[t]=[],this;var o=this.events[t];if(!o)return this;for(var s=o.length;s--;)(o[s][0]===e||o[s][0]&&o[s][0].fn===e)&&o.splice(s,1);return this}},j.prototype.trigger=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this.hasType(t);var s=this.events[t];if(s)for(var i,r=s.length,n=p(s),h=0;h<r;h++){var l=n[h],a=l[0],c=l[1];if(a&&!0===(i=a.apply(c,e)))return i}},j.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},j.prototype.destroy=function(){this.events={},this.eventTypes={}},j.prototype.hasType=function(t){var e=this.eventTypes;e[t]===t||h('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e).map(function(t){return JSON.stringify(t)})+"]")},j);function j(t){this.events={},this.eventTypes={},this.registerType(t)}var Z=(q.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},q.prototype.addDOMEvents=function(){this.handleDOMEvents(P)},q.prototype.removeDOMEvents=function(){this.handleDOMEvents(w)},q.prototype.handleDOMEvents=function(e){var o=this,s=this.wrapper;this.events.forEach(function(t){e(s,t.name,o,!!t.capture)})},q.prototype.handleEvent=function(e){var o=e.type;this.events.some(function(t){return t.name===o&&(t.handler(e),!0)})},q);function q(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}function $(){}var G,J=(e(Q,G=$),Q.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},Q.prototype.process=function(){return this.translateZ=this.HWCompositing&&B?" translateZ(1px)":"",this.useTransition=this.useTransition&&D,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.resolveBounce(),this.scrollX="horizontal"!==this.eventPassthrough&&this.scrollX,this.scrollY="vertical"!==this.eventPassthrough&&this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=!!this.freeScroll||this.scrollX,this.scrollY=!!this.freeScroll||this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},Q.prototype.resolveBounce=function(){var t=this.bounce;"boolean"==typeof t&&(this.bounce=function(t,e){void 0===e&&(e=!0);var o={};return t.forEach(function(t){o[t]=e}),o}(["top","right","bottom","left"],t))},Q);function Q(){var t=G.call(this)||this;return t.startX=0,t.startY=0,t.scrollX=!1,t.scrollY=!0,t.freeScroll=!1,t.directionLockThreshold=5,t.eventPassthrough="",t.click=!1,t.dblclick=!1,t.tap="",t.bounce={top:!0,bottom:!0,left:!0,right:!0},t.bounceTime=800,t.momentum=!0,t.momentumLimitTime=300,t.momentumLimitDistance=15,t.swipeTime=2500,t.swipeBounceTime=500,t.deceleration=.0015,t.flickLimitTime=200,t.flickLimitDistance=100,t.resizePolling=60,t.probeType=0,t.stopPropagation=!1,t.preventDefault=!0,t.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},t.tagException={tagName:/^TEXTAREA$/},t.HWCompositing=!0,t.useTransition=!0,t.bindToWrapper=!1,t.bindToTarget=!1,t.disableMouse=E,t.disableTouch=!E,t.autoBlur=!0,t.autoEndDistance=5,t.outOfBoundaryDampingFactor=1/3,t}var tt=(et.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,s=t.disableTouch,i=t.click,r=this.wrapper,n=e?r:window,h=[],l=[],a=!s,c=!o;i&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),a&&(h.push({name:"touchstart",handler:this.start.bind(this)}),l.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),c&&(h.push({name:"mousedown",handler:this.start.bind(this)}),l.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new Z(r,h),this.targetEventRegister=new Z(n,l)},et.prototype.beforeHandler=function(t,e){var o=this.options,s=o.preventDefault,i=o.stopPropagation,r=o.preventDefaultException;!{start:function(){return s&&!z(t.target,r)},end:function(){return s&&!z(t.target,r)},move:function(){return s}}[e]()||t.preventDefault(),i&&t.stopPropagation()},et.prototype.setInitiated=function(t){void 0===t&&(t=0),this.initiated=t},et.prototype.start=function(t){var e,o=O[t.type];this.initiated&&this.initiated!==o||(this.setInitiated(o),C(t.target,this.options.tagException)?this.setInitiated():2===o&&0!==t.button||this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)||(this.beforeHandler(t,"start"),e=t.touches?t.touches[0]:t,this.pointX=e.pageX,this.pointY=e.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)))},et.prototype.move=function(t){var e,o,s,i,r,n,h,l;O[t.type]===this.initiated&&(this.beforeHandler(t,"move"),o=(e=t.touches?t.touches[0]:t).pageX-this.pointX,s=e.pageY-this.pointY,this.pointX=e.pageX,this.pointY=e.pageY,this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:s,e:t})||(i=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,r=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,n=this.pointX-i,h=this.pointY-r,l=this.options.autoEndDistance,(n>document.documentElement.clientWidth-l||h>document.documentElement.clientHeight-l||n<l||h<l)&&this.end(t)))},et.prototype.end=function(t){O[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},et.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},et.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},et);function et(t,e){this.wrapper=t,this.options=e,this.hooks=new V(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}var ot={x:["translateX","px"],y:["translateY","px"]},st=(it.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null)[X.transform].split(")")[0].split(", ");return{x:+(t[12]||t[4]),y:+(t[13]||t[5])}},it.prototype.translate=function(i){var r=[];Object.keys(i).forEach(function(t){var e,o,s;!ot[t]||(e=ot[t][0])&&(o=ot[t][1],s=i[t],r.push(e+"("+s+o+")"))}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,r,i),this.style[X.transform]=r.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,i)},it.prototype.destroy=function(){this.hooks.destroy()},it);function it(t){this.content=t,this.style=t.style,this.hooks=new V(["beforeTranslate","translate"])}var rt=(nt.prototype.translate=function(t){this.translater.translate(t)},nt.prototype.setPending=function(t){this.pending=t},nt.prototype.setForceStopped=function(t){this.forceStopped=t},nt.prototype.destroy=function(){this.hooks.destroy(),K(this.timer)},nt);function nt(t,e,o){this.content=t,this.translater=e,this.options=o,this.timer=0,this.hooks=new V(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.style=t.style}var ht,lt=(e(at,ht=rt),at.prototype.startProbe=function(){var e=this,o=function(){var t=e.translater.getComputedPosition();e.hooks.trigger(e.hooks.eventTypes.move,t),e.pending||e.forceStopped||e.hooks.trigger(e.hooks.eventTypes.end,t),e.pending&&(e.timer=R(o))};K(this.timer),o()},at.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[X.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},at.prototype.transitionTimingFunction=function(t){this.style[X.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},at.prototype.transitionProperty=function(){this.style[X.transitionProperty]=X.transform},at.prototype.move=function(t,e,o,s){this.setPending(0<o),this.transitionTimingFunction(s),this.transitionProperty(),this.transitionTime(o),this.translate(e),o&&3===this.options.probeType&&this.startProbe(),o||(this._reflow=this.content.offsetHeight,this.hooks.trigger(this.hooks.eventTypes.move,e),this.hooks.trigger(this.hooks.eventTypes.end,e))},at.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),K(this.timer);var e=this.translater.getComputedPosition(),o=e.x,s=e.y;if(this.transitionTime(),this.translate({x:o,y:s}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:o,y:s}))return!0;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:o,y:s})}return t},at.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},at);function at(){return null!==ht&&ht.apply(this,arguments)||this}var ct,pt=(e(ut,ct=rt),ut.prototype.move=function(t,e,o,s){if(!o)return this.translate(e),this.hooks.trigger(this.hooks.eventTypes.move,e),void this.hooks.trigger(this.hooks.eventTypes.end,e);this.animate(t,e,o,s)},ut.prototype.animate=function(r,n,e,o){var h=this,l=f(),a=l+e,c=function(){var t=f();if(a<=t)return h.translate(n),h.hooks.trigger(h.hooks.eventTypes.move,n),void h.hooks.trigger(h.hooks.eventTypes.end,n);var s=o((t-l)/e),i={};Object.keys(n).forEach(function(t){var e=r[t],o=n[t];i[t]=(o-e)*s+e}),h.translate(i),3===h.options.probeType&&h.hooks.trigger(h.hooks.eventTypes.move,i),h.pending&&(h.timer=R(c)),h.pending||h.forceStopped||(console.log(h.forceStopped),h.hooks.trigger(h.hooks.eventTypes.end,n))};this.setPending(!0),K(this.timer),c()},ut.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),K(this.timer);var e=this.translater.getComputedPosition();if(this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,e))return!0;this.hooks.trigger(this.hooks.eventTypes.forceStop,e)}return t},ut.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},ut);function ut(){return null!==ct&&ct.apply(this,arguments)||this}var dt,ft,gt,yt,vt=(mt.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},mt.prototype.move=function(t){return t=this.hasScroll?t:0,this.setMovingDirection(t),this.performDampingAlgorithm(t,this.options.outOfBoundaryDampingFactor)},mt.prototype.setMovingDirection=function(t){this.movingDirection=0<t?-1:t<0?1:0},mt.prototype.setDirection=function(t){this.direction=0<t?-1:t<0?1:0},mt.prototype.performDampingAlgorithm=function(t,e){var o=this.currentPos+t;return(o>this.minScrollPos||o<this.maxScrollPos)&&(o=o>this.minScrollPos&&this.options.bounces[0]||o<this.maxScrollPos&&this.options.bounces[1]?this.currentPos+t*e:o>this.minScrollPos?this.minScrollPos:this.maxScrollPos),o},mt.prototype.end=function(t){var e,o={duration:0},s=Math.abs(this.currentPos-this.startPos);return this.options.momentum&&t<this.options.momentumLimitTime&&s>this.options.momentumLimitDistance?(e=-1===this.direction&&this.options.bounces[0]||1===this.direction&&this.options.bounces[1]?this.wrapperSize:0,o=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,e,this.options):{destination:this.currentPos,duration:0}):this.hooks.trigger(this.hooks.eventTypes.end,o),o},mt.prototype.momentum=function(t,e,o,s,i,r,n){void 0===n&&(n=this.options);var h=t-e,l=Math.abs(h)/o,a=n.deceleration,c=n.swipeBounceTime,p={destination:t+l/a*(h<0?-1:1),duration:n.swipeTime,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,p,h),p.destination<s?(p.destination=r?Math.max(s-r/4,s-r/p.rate*l):s,p.duration=c):p.destination>i&&(p.destination=r?Math.min(i+r/4,i+r/p.rate*l):i,p.duration=c),p.destination=Math.round(p.destination),p},mt.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.setDirection(t)},mt.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,s="static"===window.getComputedStyle(this.wrapper,null).position,i=H(this.wrapper);this.wrapperSize=i[e];var r=H(this.content);this.contentSize=r[e],this.relativeOffset=r[o],s&&(this.relativeOffset-=i[o]),this.computeBoundary(),this.setDirection(0)},mt.prototype.computeBoundary=function(){this.hooks.trigger(this.hooks.eventTypes.beforeComputeBoundary);var t={minScrollPos:0,maxScrollPos:this.wrapperSize-this.contentSize};t.maxScrollPos<0&&(t.maxScrollPos-=this.relativeOffset,t.minScrollPos=-this.relativeOffset),this.hooks.trigger(this.hooks.eventTypes.computeBoundary,t),this.minScrollPos=t.minScrollPos,this.maxScrollPos=t.maxScrollPos,this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,this.hasScroll||(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize)},mt.prototype.updatePosition=function(t){this.currentPos=t},mt.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},mt.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos);return{position:t,inBoundary:t===this.getCurrentPos()}},mt.prototype.adjustPosition=function(t){var e=Math.round(t);return!this.hasScroll||e>this.minScrollPos?e=this.minScrollPos:e<this.maxScrollPos&&(e=this.maxScrollPos),e},mt.prototype.updateStartPos=function(){this.startPos=this.currentPos},mt.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},mt.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},mt.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},mt.prototype.destroy=function(){this.hooks.destroy()},mt);function mt(t,e){this.wrapper=t,this.options=e,this.hooks=new V(["beforeComputeBoundary","computeBoundary","momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0,this.refresh()}var kt=((dt={}).yes=function(t){return!0},dt.no=function(t){return t.preventDefault(),!1},dt),Tt=((ft={}).horizontal=((gt={}).yes="horizontal",gt.no="vertical",gt),ft.vertical=((yt={}).yes="vertical",yt.no="horizontal",yt),ft),bt=(Pt.prototype.reset=function(){this.directionLocked=""},Pt.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},Pt.prototype.adjustDelta=function(t,e){return"horizontal"===this.directionLocked?e=0:"vertical"===this.directionLocked&&(t=0),{deltaX:t,deltaY:e}},Pt.prototype.computeDirectionLock=function(t,e){""!==this.directionLocked||this.freeScroll||(t>e+this.directionLockThreshold?this.directionLocked="horizontal":e>=t+this.directionLockThreshold?this.directionLocked="vertical":this.directionLocked="none")},Pt.prototype.handleEventPassthrough=function(t){var e=Tt[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return kt.yes(t);if(this.eventPassthrough===e.no)return kt.no(t)}return!1},Pt);function Pt(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var wt=(St.prototype.bindActionsHandler=function(){var i=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(t){return!i.enabled||i.handleStart(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(t){var e=t.deltaX,o=t.deltaY,s=t.e;return!i.enabled||i.handleMove(e,o,s)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(t){return!i.enabled||i.handleEnd(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(t){i.enabled&&!t._constructed&&i.handleClick(t)})},St.prototype.handleStart=function(t){var e=f();this.moved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.doStop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},St.prototype.handleMove=function(t,e,o){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,o)){var s=this.scrollBehaviorX.getAbsDist(t),i=this.scrollBehaviorY.getAbsDist(e),r=f();if(this.checkMomentum(s,i,r))return!0;if(this.directionLockAction.checkMovingDirection(s,i,o))return this.actionsHandler.setInitiated(),!0;var n=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.move(n.deltaX),l=this.scrollBehaviorY.move(n.deltaY);this.moved||(this.moved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.animater.translate({x:h,y:l}),this.dispatchScroll(r)}},St.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),1===this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),1<this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},St.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},St.prototype.handleEnd=function(t){if(!this.hooks.trigger(this.hooks.eventTypes.beforeEnd,t)){var e=this.getCurrentPos();if(this.scrollBehaviorX.updateDirection(),this.scrollBehaviorY.updateDirection(),this.hooks.trigger(this.hooks.eventTypes.end,t,e))return!0;this.animater.translate(e),this.endTime=f();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},St.prototype.handleClick=function(t){z(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},St.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},St.prototype.refresh=function(){this.endTime=0},St.prototype.destroy=function(){this.hooks.destroy()},St);function St(t,e,o,s,i){this.hooks=new V(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=o,this.animater=s,this.options=i,this.directionLockAction=new bt(i.directionLockThreshold,i.freeScroll,i.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}function xt(o,t,e,s){var i=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor"].reduce(function(t,e){return t[e]=o[e],t},{});return i.scrollable=!!o[t],i.bounces=e,i.rect=s,i}function Mt(s,i,t){t.forEach(function(t){var e,o;"string"==typeof t?e=o=t:(e=t.source,o=t.target),s.on(e,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return i.trigger.apply(i,p([o],t))})})}var Yt=(Bt.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},Bt.prototype.bindTranslater=function(){var o=this,t=this.translater.hooks;t.on(t.eventTypes.beforeTranslate,function(t){o.options.translateZ&&t.push(o.options.translateZ)}),t.on(t.eventTypes.translate,function(t){var e=o.getCurrentPos();o.updatePositions(t),t.x===e.x&&t.y===e.y||o.togglePointerEvents(!1)})},Bt.prototype.bindAnimater=function(){var e=this;this.animater.hooks.on(this.animater.hooks.eventTypes.end,function(t){e.resetPosition(e.options.bounceTime)||(e.animater.setPending(!1),e.hooks.trigger(e.hooks.eventTypes.scrollEnd,t))}),Mt(this.animater.hooks,this.hooks,[{source:this.animater.hooks.eventTypes.move,target:this.hooks.eventTypes.scroll},{source:this.animater.hooks.eventTypes.forceStop,target:this.hooks.eventTypes.scrollEnd}])},Bt.prototype.bindActions=function(){var i=this,r=this.actions;Mt(r.hooks,this.hooks,[{source:r.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:r.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:r.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:r.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:r.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:r.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),r.hooks.on(r.hooks.eventTypes.end,function(t,e){return i.hooks.trigger(i.hooks.eventTypes.touchEnd,e),!!i.hooks.trigger(i.hooks.eventTypes.end,e)||(!r.moved&&i.checkClick(t)?(i.hooks.trigger(i.hooks.eventTypes.scrollCancel),!0):i.resetPosition(i.options.bounceTime,_.bounce)?(i.animater.setForceStopped(!1),!0):void 0)}),r.hooks.on(r.hooks.eventTypes.scrollEnd,function(t,e){var o=Math.abs(t.x-i.scrollBehaviorX.startPos),s=Math.abs(t.y-i.scrollBehaviorY.startPos);i.checkFlick(e,o,s)?i.hooks.trigger(i.hooks.eventTypes.flick):i.momentum(t,e)||(!i.animater.forceStopped||r.moved?i.hooks.trigger(i.hooks.eventTypes.scrollEnd,t):i.animater.setForceStopped(!1))})},Bt.prototype.checkFlick=function(t,e,o){if(1<this.hooks.events.flick.length&&t<this.options.flickLimitTime&&e<this.options.flickLimitDistance&&o<this.options.flickLimitDistance&&(1<o||1<e))return!0},Bt.prototype.momentum=function(t,e){var o={time:0,easing:_.swiper,newX:t.x,newY:t.y},s=this.scrollBehaviorX.end(e),i=this.scrollBehaviorY.end(e);if(o.newX=y(s.destination)?o.newX:s.destination,o.newY=y(i.destination)?o.newY:i.destination,o.time=Math.max(s.duration,i.duration),this.hooks.trigger(this.hooks.eventTypes.momentum,o,this),o.newX!==t.x||o.newY!==t.y)return(o.newX>this.scrollBehaviorX.minScrollPos||o.newX<this.scrollBehaviorX.maxScrollPos||o.newY>this.scrollBehaviorY.minScrollPos||o.newY<this.scrollBehaviorY.maxScrollPos)&&(o.easing=_.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},Bt.prototype.checkClick=function(t){var e,o,s,i=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return this.animater.setForceStopped(!1),!0;if(i)return!1;var r,n,h=this.options.dblclick,l=!1;return h&&this.lastClickTime&&(n=void 0===(r=h.delay)?300:r,f()-this.lastClickTime<n&&(l=!0,F(t,"dblclick"))),this.options.tap&&(e=t,o=this.options.tap,(s=document.createEvent("Event")).initEvent(o,!0,!0),s.pageX=e.pageX,s.pageY=e.pageY,e.target.dispatchEvent(s)),this.options.click&&!z(t.target,this.options.preventDefaultException)&&F(t),this.lastClickTime=l?null:f(),!0},Bt.prototype.resize=function(){var t=this;this.actions.enabled&&(u&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.hooks.trigger(t.hooks.eventTypes.resize)},this.options.resizePolling))},Bt.prototype.transitionEnd=function(t){t.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,_.bounce)||(this.animater.setPending(!1),3!==this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},Bt.prototype.togglePointerEvents=function(t){void 0===t&&(t=!0);for(var e=this.content.children.length?this.content.children:[this.content],o=t?"auto":"none",s=0;s<e.length;s++){var i=e[s];i.isBScrollContainer||(i.style.pointerEvents=o)}},Bt.prototype.refresh=function(){this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=S(this.wrapper)},Bt.prototype.scrollBy=function(t,e,o,s){void 0===o&&(o=0);var i=this.getCurrentPos(),r=i.x,n=i.y;s=s||_.bounce,t+=r,e+=n,this.scrollTo(t,e,o,s)},Bt.prototype.scrollTo=function(t,e,o,s,i){void 0===o&&(o=0),void 0===s&&(s=_.bounce),void 0===i&&(i={start:{},end:{}});var r=this.options.useTransition?s.style:s.fn,n=this.getCurrentPos(),h=a({x:n.x,y:n.y},i.start),l=a({x:t,y:e},i.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,l),function(t,e){for(var o=0,s=Object.keys(t);o<s.length;o++){var i=s[o];if(t[i]!==e[i])return}return 1}(h,l)||this.animater.move(h,l,o,r)},Bt.prototype.scrollToElement=function(t,e,o,s,i){function r(t,e,o){return"number"==typeof t?t:t?Math.round(e/2-o/2):0}var n=b(t),h=S(n);o=r(o,n.offsetWidth,this.wrapper.offsetWidth),s=r(s,n.offsetHeight,this.wrapper.offsetHeight);function l(t,e,o,s){return t-=e,t=s.adjustPosition(t-o)}h.left=l(h.left,this.wrapperOffset.left,o,this.scrollBehaviorX),h.top=l(h.top,this.wrapperOffset.top,s,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,n,h)||this.scrollTo(h.left,h.top,e,i)},Bt.prototype.resetPosition=function(t,e){void 0===t&&(t=0),void 0===e&&(e=_.bounce);var o=this.scrollBehaviorX.checkInBoundary(),s=o.position,i=o.inBoundary,r=this.scrollBehaviorY.checkInBoundary(),n=r.position,h=r.inBoundary;return(!i||!h)&&(d&&(this._reflow=this.content.offsetHeight),this.scrollTo(s,n,t,e),!0)},Bt.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},Bt.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},Bt.prototype.enable=function(){this.actions.enabled=!0},Bt.prototype.disable=function(){K(this.animater.timer),this.actions.enabled=!1},Bt.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},Bt);function Bt(t,e){this.resizeTimeout=0,this.hooks=new V(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","resize","touchEnd","end","flick","scrollCancel","momentum","scrollTo","scrollToElement","beforeRefresh"]),this.wrapper=t,this.content=t.children[0],this.options=e;var o,s,i,r,n,h,l=this.options.bounce,a=l.left,c=void 0===a||a,p=l.right,u=void 0===p||p,d=l.top,f=void 0===d||d,g=l.bottom,y=void 0===g||g;this.scrollBehaviorX=new vt(t,xt(e,"scrollX",[c,u],{size:"width",position:"left"})),this.scrollBehaviorY=new vt(t,xt(e,"scrollY",[f,y],{size:"height",position:"top"})),this.translater=new st(this.content),this.animater=(o=this.content,s=this.translater,i=this.options,r=i.useTransition,n={},Object.defineProperty(n,"probeType",{enumerable:!0,configurable:!1,get:function(){return i.probeType}}),new(r?lt:pt)(o,s,n)),this.actionsHandler=new tt(this.options.bindToTarget?this.content:t,(h=this.options,["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException","autoEndDistance"].reduce(function(t,e){return t[e]=h[e],t},{}))),this.actions=new wt(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var v=this.resize.bind(this);this.resizeRegister=new Z(window,[{name:"orientationchange",handler:v},{name:"resize",handler:v}]),this.transitionEndRegister=new Z(this.content,[{name:X.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}var Et,Dt=(e(Xt,Et=V),Xt.use=function(e){var t=e.pluginName;return Xt.plugins.some(function(t){return e===t.ctor})||(y(t)?h("Plugin Class must specify plugin's name in static property by 'pluginName' field."):Xt.pluginsMap[t]?h("This plugin has been registered, maybe you need change plugin's name"):(Xt.pluginsMap[t]=!0,Xt.plugins.push({name:t,applyOrder:e.applyOrder,ctor:e}))),Xt},Xt.prototype.init=function(t){var e=this;(this.wrapper=t).isBScrollContainer=!0,this.scroller=new Yt(t,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,function(){e.refresh()}),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(i),this.applyPlugins(),this.refreshWithoutReset();var o=this.options,s={x:o.startX,y:o.startY};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,s)||this.scroller.scrollTo(s.x,s.y)},Xt.prototype.applyPlugins=function(){var o=this,s=this.options;Xt.plugins.sort(function(t,e){var o,s=((o={}).pre=-1,o.post=1,o);return(t.applyOrder?s[t.applyOrder]:0)-(e.applyOrder?s[e.applyOrder]:0)}).forEach(function(t){var e=t.ctor;s[t.name]&&"function"==typeof e&&(o.plugins[t.name]=new e(o))})},Xt.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,function(){var t=document.activeElement;!t||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName||t.blur()})},Xt.prototype.eventBubbling=function(){Mt(this.scroller.hooks,this,[this.eventTypes.beforeScrollStart,this.eventTypes.scrollStart,this.eventTypes.scroll,this.eventTypes.scrollEnd,this.eventTypes.scrollCancel,this.eventTypes.touchEnd,this.eventTypes.flick])},Xt.prototype.refreshWithoutReset=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},Xt.prototype.proxy=function(t){var n=this;t.forEach(function(t){var e,o,s,i=t.key,r=t.sourceKey;e=n,o=r,s=i,U.get=function(){return function(t,e){for(var o=e.split("."),s=0;s<o.length-1;s++)if("object"!=typeof(t=t[o[s]])||!t)return;var i=o.pop();return"function"==typeof t[i]?function(){return t[i].apply(t,arguments)}:t[i]}(this,o)},U.set=function(t){!function(t,e,o){for(var s,i=e.split("."),r=0;r<i.length-1;r++)t[s=i[r]]||(t[s]={}),t=t[s];t[i.pop()]=o}(this,o,t)},Object.defineProperty(e,s,U)})},Xt.prototype.refresh=function(){this.refreshWithoutReset(),this.scroller.resetPosition()},Xt.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},Xt.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},Xt.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},Xt.prototype.eventRegister=function(t){this.registerType(t)},Xt.plugins=[],Xt.pluginsMap={},Xt);function Xt(t,e){var o=Et.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,s=b(t);return s?s.children[0]?(o.plugins={},o.options=(new J).merge(e).process(),o.hooks=new V(["refresh","enable","disable","destroy","beforeInitialScrollTo"]),o.init(s)):h("The wrapper need at least one child element to be scroller."):h("Can not resolve the wrapper DOM."),o}function Ot(t,e){return new Dt(t,e)}Ot.use=Dt.use,Ot.plugins=Dt.plugins,Ot.pluginsMap=Dt.pluginsMap;var Ht=Ot,zt=(Ct.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.registerEvent()},Ct.prototype.handleBScroll=function(){this.scroll.registerType(["alterOptions","mousewheelStart","mousewheelMove","mousewheelEnd"])},Ct.prototype.handleOptions=function(){var t=!0===this.scroll.options.mouseWheel?{}:this.scroll.options.mouseWheel;this.mouseWheelOpt=g({speed:20,invert:!1,easeTime:300,discreteTime:400,throttleTime:0,dampingFactor:.1},t)},Ct.prototype.handleHooks=function(){this.hooksFn=[],this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},Ct.prototype.registerEvent=function(){this.eventRegister=new Z(this.scroll.scroller.wrapper,[{name:"wheel",handler:this.wheelHandler.bind(this)},{name:"mousewheel",handler:this.wheelHandler.bind(this)},{name:"DOMMouseScroll",handler:this.wheelHandler.bind(this)}])},Ct.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},Ct.prototype.wheelHandler=function(t){var e;this.scroll.enabled&&(this.beforeHandler(t),this.wheelStart||(this.wheelStartHandler(t),this.wheelStart=!0),e=this.getWheelDelta(t),this.wheelMoveHandler(e),this.wheelEndDetector(e))},Ct.prototype.wheelStartHandler=function(t){this.cleanCache();var e=this.scroll.scroller,o=e.scrollBehaviorX,s=e.scrollBehaviorY;o.setMovingDirection(0),s.setMovingDirection(0),o.setDirection(0),s.setDirection(0),this.scroll.trigger(this.scroll.eventTypes.alterOptions,this.mouseWheelOpt),this.scroll.trigger(this.scroll.eventTypes.mousewheelStart)},Ct.prototype.cleanCache=function(){this.deltaCache=[]},Ct.prototype.wheelMoveHandler=function(t){var e,o,s,i,r,n,h,l=this,a=this.mouseWheelOpt,c=a.throttleTime,p=a.dampingFactor;c&&this.wheelMoveTimer?this.deltaCache.push(t):(e=this.deltaCache.reduce(function(t,e){return{x:t.x+e.x,y:t.y+e.y}},{x:0,y:0}),this.cleanCache(),s=(o=this.scroll.scroller).scrollBehaviorX,i=o.scrollBehaviorY,s.setMovingDirection(-t.directionX),i.setMovingDirection(-t.directionY),s.setDirection(t.x),i.setDirection(t.y),r=s.performDampingAlgorithm(Math.round(t.x)+e.x,p),n=i.performDampingAlgorithm(Math.round(t.y)+e.x,p),this.scroll.trigger(this.scroll.eventTypes.mousewheelMove,{x:r,y:n})||(h=this.getEaseTime(),r===this.scroll.x&&n===this.scroll.y||this.scroll.scrollTo(r,n,h)),c&&(this.wheelMoveTimer=window.setTimeout(function(){l.wheelMoveTimer=0},c)))},Ct.prototype.wheelEndDetector=function(t){var e=this;window.clearTimeout(this.wheelEndTimer),this.wheelEndTimer=window.setTimeout(function(){e.wheelStart=!1,window.clearTimeout(e.wheelMoveTimer),e.wheelMoveTimer=0,e.scroll.trigger(e.scroll.eventTypes.mousewheelEnd,t)},this.mouseWheelOpt.discreteTime)},Ct.prototype.getWheelDelta=function(t){var e=this.mouseWheelOpt,o=e.speed,s=0,i=0,r=e.invert?-1:1;switch(!0){case"deltaX"in t:i=1===t.deltaMode?(s=-t.deltaX*o,-t.deltaY*o):(s=-t.deltaX,-t.deltaY);break;case"wheelDeltaX"in t:s=t.wheelDeltaX/120*o,i=t.wheelDeltaY/120*o;break;case"wheelDelta"in t:s=i=t.wheelDelta/120*o;break;case"detail"in t:s=i=-t.detail/3*o}return s*=r,i*=r,this.scroll.hasVerticalScroll||(s=i,i=0),this.scroll.hasHorizontalScroll||(s=0),{x:s,y:i,directionX:0<s?-1:s<0?1:0,directionY:0<i?-1:i<0?1:0}},Ct.prototype.beforeHandler=function(t){var e=this.scroll.options,o=e.preventDefault,s=e.stopPropagation,i=e.preventDefaultException;o&&!z(t.target,i)&&t.preventDefault(),s&&t.stopPropagation()},Ct.prototype.getEaseTime=function(){var t=this.mouseWheelOpt.easeTime;return t<100&&h("easeTime should be greater than 100.If mouseWheel easeTime is too small,scrollEnd will be triggered many times."),Math.max(t,100)},Ct.prototype.destroy=function(){this.eventRegister.destroy(),window.clearTimeout(this.wheelEndTimer),window.clearTimeout(this.wheelMoveTimer),this.hooksFn.forEach(function(t){var e=t[0],o=t[1],s=t[2];e.off(o,s)})},Ct.pluginName="mouseWheel",Ct.applyOrder="pre",Ct);function Ct(t){this.scroll=t,this.wheelEndTimer=0,this.wheelMoveTimer=0,this.wheelStart=!1,this.init()}var Ft=(Lt.prototype.init=function(){this.handleMutationObserver(),this.handleHooks()},Lt.prototype.handleMutationObserver=function(){var e=this;"undefined"!=typeof MutationObserver?(this.observer=new MutationObserver(function(t){e.mutationObserverHandler(t,0)}),this.startObserve(this.observer)):this.checkDOMUpdate()},Lt.prototype.handleHooks=function(){var t=this;this.hooksFn=[],this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.enable,function(){t.stopObserver&&t.init()}),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.disable,function(){t.stopObserve()}),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.destroy,function(){t.destroy()})},Lt.prototype.mutationObserverHandler=function(t,e){var o=this;if(!this.shouldNotRefresh()){for(var s=!1,i=!1,r=0;r<t.length;r++){var n=t[r];if("attributes"!==n.type){s=!0;break}if(n.target!==this.scroll.scroller.content){i=!0;break}}s?this.scroll.refresh():i&&(clearTimeout(e),e=window.setTimeout(function(){o.shouldNotRefresh()||o.scroll.refresh()},60))}},Lt.prototype.startObserve=function(t){t.observe(this.scroll.scroller.content,{attributes:!0,childList:!0,subtree:!0})},Lt.prototype.shouldNotRefresh=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY,s=e.currentPos>e.minScrollPos||e.currentPos<e.maxScrollPos||o.currentPos>o.minScrollPos||o.currentPos<o.maxScrollPos;return t.animater.pending||s},Lt.prototype.checkDOMUpdate=function(){var o=this,s=this.scroll.scroller.content,i=H(s),r=i.width,n=i.height,h=function(){setTimeout(function(){var t,e;o.stopObserver||(t=(i=H(s)).width,e=i.height,r===t&&n===e||o.scroll.refresh(),r=t,n=e,h())},1e3)};h()},Lt.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},Lt.prototype.stopObserve=function(){this.stopObserver=!0,this.observer&&this.observer.disconnect()},Lt.prototype.destroy=function(){this.stopObserve(),this.hooksFn.forEach(function(t){var e=t[0],o=t[1],s=t[2];e.off(o,s)}),this.hooksFn.length=0},Lt.pluginName="observeDOM",Lt);function Lt(t){this.scroll=t,this.stopObserver=!1,this.init()}var It=[{key:"finishPullDown",name:"finishPullDown"},{key:"openPullDown",name:"openPullDown"},{key:"closePullDown",name:"closePullDown"},{key:"autoPullDownRefresh",name:"autoPullDownRefresh"}].map(function(t){return{key:t.key,sourceKey:"plugins.pullDownRefresh."+t.name}}),_t="pullingDown",At=(Nt.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullDownRefresh),this.handleHooks(),this.watch()},Nt.prototype.handleBScroll=function(){this.scroll.registerType([_t]),this.scroll.proxy(It)},Nt.prototype.handleOptions=function(t){void 0===t&&(t={}),t=!0===t?{}:t;this.options=g({threshold:90,stop:40},t),this.scroll.options.probeType=3},Nt.prototype.handleHooks=function(){var e=this;this.hooksFn=[];var t=this.scroll.scroller,o=t.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY=o.minScrollPos,this.registerHooks(o.hooks,o.hooks.eventTypes.computeBoundary,function(t){0<t.maxScrollPos&&(t.maxScrollPos=-1),t.minScrollPos=e.currentMinScrollY}),this.scroll.eventTypes.alterOptions&&(this.registerHooks(this.scroll,this.scroll.eventTypes.alterOptions,function(t){t.discreteTime=300,t.easeTime=350}),this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelEnd,function(){t.hooks.trigger(t.hooks.eventTypes.end)}))},Nt.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},Nt.prototype.watch=function(){var t=this.scroll.scroller;this.watching=!0,this.registerHooks(t.hooks,t.hooks.eventTypes.end,this.checkPullDown)},Nt.prototype.unwatch=function(){var t=this.scroll.scroller;this.watching=!1,t.hooks.off(t.hooks.eventTypes.end,this.checkPullDown)},Nt.prototype.checkPullDown=function(){var t=this.options,e=t.threshold,o=t.stop;return!(-1!==this.scroll.directionY||this.scroll.y<e)&&(this.pulling||(this.modifyBehaviorYBoundary(o),this.pulling=!0,this.scroll.trigger(_t)),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,_.bounce),this.pulling)},Nt.prototype.modifyBehaviorYBoundary=function(t){var e=this.scroll.scroller.scrollBehaviorY;this.cachedOriginanMinScrollY=e.minScrollPos,this.currentMinScrollY=t,e.computeBoundary()},Nt.prototype.finishPullDown=function(){var t=this.scroll.scroller.scrollBehaviorY;this.currentMinScrollY=this.cachedOriginanMinScrollY,t.computeBoundary(),this.pulling=!1,this.scroll.resetPosition(this.scroll.options.bounceTime,_.bounce)},Nt.prototype.openPullDown=function(t){void 0===t&&(t={}),this.handleOptions(t),this.watching||this.watch()},Nt.prototype.closePullDown=function(){this.unwatch()},Nt.prototype.autoPullDownRefresh=function(){var t=this.options,e=t.threshold,o=t.stop;!this.pulling&&this.watching&&(this.pulling=!0,this.modifyBehaviorYBoundary(o),this.scroll.scrollTo(this.scroll.x,e),this.scroll.trigger(_t),this.scroll.scrollTo(this.scroll.x,o,this.scroll.options.bounceTime,_.bounce))},Nt.pluginName="pullDownRefresh",Nt);function Nt(t){this.scroll=t,this.pulling=!1,this.init()}var Wt=[{key:"finishPullUp",name:"finishPullUp"},{key:"openPullUp",name:"openPullUp"},{key:"closePullUp",name:"closePullUp"},{key:"autoPullUpLoad",name:"autoPullUpLoad"}].map(function(t){return{key:t.key,sourceKey:"plugins.pullUpLoad."+t.name}}),Rt="pullingUp",Kt=(Ut.prototype.init=function(){this.handleBScroll(),this.handleOptions(this.scroll.options.pullUpLoad),this.handleHooks(),this.watch()},Ut.prototype.handleBScroll=function(){this.scroll.registerType([Rt]),this.scroll.proxy(Wt)},Ut.prototype.handleOptions=function(t){void 0===t&&(t={}),t=!0===t?{}:t;this.options=g({threshold:0},t),this.scroll.options.probeType=3},Ut.prototype.handleHooks=function(){this.hooksFn=[];var t=this.scroll.scroller.scrollBehaviorY;this.registerHooks(t.hooks,t.hooks.eventTypes.computeBoundary,function(t){0<t.maxScrollPos&&(t.maxScrollPos=-1)})},Ut.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},Ut.prototype.watch=function(){this.watching||(this.watching=!0,this.registerHooks(this.scroll,this.scroll.eventTypes.scroll,this.checkPullUp))},Ut.prototype.unwatch=function(){this.watching=!1,this.scroll.off(this.scroll.eventTypes.scroll,this.checkPullUp)},Ut.prototype.checkPullUp=function(t){var e=this,o=this.options.threshold;1===this.scroll.movingDirectionY&&t.y<=this.scroll.maxScrollY+o&&(this.pulling=!0,this.scroll.once(this.scroll.eventTypes.scrollEnd,function(){e.pulling=!1}),this.unwatch(),this.scroll.trigger(Rt))},Ut.prototype.finishPullUp=function(){var t=this;this.scroll.scroller.scrollBehaviorY.setMovingDirection(0),this.pulling?this.scroll.once(this.scroll.eventTypes.scrollEnd,function(){t.watch()}):this.watch()},Ut.prototype.openPullUp=function(t){void 0===t&&(t={}),this.handleOptions(t),this.watch()},Ut.prototype.closePullUp=function(){this.unwatch()},Ut.prototype.autoPullUpLoad=function(){var t,e=this.options.threshold,o=this.scroll.scroller.scrollBehaviorY;!this.pulling&&this.watching&&(t=o.maxScrollPos+e+-1,this.scroll.scroller.scrollBehaviorY.setMovingDirection(-1),this.scroll.scrollTo(this.scroll.x,t,this.scroll.options.bounceTime))},Ut.pluginName="pullUpLoad",Ut);function Ut(t){this.scroll=t,this.pulling=!1,this.watching=!1,this.init()}var Vt=(jt.prototype._start=function(t){var e,o;this.bscroll.scroller.actions.enabled&&(e=t.touches?t.touches[0]:t,t.preventDefault(),t.stopPropagation(),this.initiated=!0,this.moved=!1,this.lastPoint=e[this.indicator.keysMap.pointPos],o=this.bscroll.options.disableMouse,this.moveEventRegister=new Z(window,[{name:o?"touchmove":"mousemove",handler:this._move.bind(this)}]),this.hooks.trigger("touchStart"))},jt.prototype._move=function(t){var e=(t.touches?t.touches[0]:t)[this.indicator.keysMap.pointPos];t.preventDefault(),t.stopPropagation();var o=e-this.lastPoint;if(this.lastPoint=e,!this.moved)return this.hooks.trigger("touchMove",this.moved,o),void(this.moved=!0);this.hooks.trigger("touchMove",this.moved,o)},jt.prototype._end=function(t){this.initiated&&(this.initiated=!1,t.preventDefault(),t.stopPropagation(),this.moveEventRegister.destroy(),this.hooks.trigger("touchEnd",this.moved))},jt.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister&&this.moveEventRegister.destroy(),this.endEventRegister.destroy()},jt);function jt(t,e){this.indicator=t,this.options=e,this.bscroll=t.bscroll,this.startEventRegister=new Z(this.indicator.el,[{name:e.disableMouse?"touchstart":"mousedown",handler:this._start.bind(this)}]),this.endEventRegister=new Z(window,[{name:e.disableMouse?"touchend":"mouseup",handler:this._end.bind(this)}]),this.hooks=new V(["touchStart","touchMove","touchEnd"])}var Zt=(qt.prototype._listenHooks=function(t,e){var o,s,i=this,r=this.bscroll,n=r,h=r.scroller.translater.hooks,l=r.scroller.animater.hooks;this._listen(n,"refresh",this.refresh),this._listen(h,"translate",this.updatePosAndSize),this._listen(l,"time",function(t){i.setTransitionTime(t)}),this._listen(l,"timeFunction",function(t){i.setTransitionTimingFunction(t)}),t&&(this._listen(n,"scrollEnd",function(){i.fade()}),this._listen(n,"scrollStart",function(){i.fade(!0)}),r.eventTypes.mousewheelStart&&r.eventTypes.mousewheelEnd&&(this._listen(n,"mousewheelStart",function(){i.fade(!0)}),this._listen(n,"mousewheelEnd",function(){i.fade()}))),e&&(o=this.bscroll.options.disableMouse,this.eventHandler=new Vt(this,{disableMouse:o}),s=this.eventHandler.hooks,this._listen(s,"touchStart",this.startHandler),this._listen(s,"touchMove",this.moveHandler),this._listen(s,"touchEnd",this.endHandler))},qt.prototype._getKeysMap=function(){return"vertical"===this.direction?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScroll:"maxScrollY",pos:"y",pointPos:"pageY",translate:"translateY"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScroll:"maxScrollX",pos:"x",pointPos:"pageX",translate:"translateX"}},qt.prototype.fade=function(t){var e=t?250:500;this.wrapperStyle[X.transitionDuration]=e+"ms",this.wrapperStyle.opacity=t?"1":"0",this.visible=t?1:0},qt.prototype.refresh=function(){var t,e,o,s,i=this.keysMap.hasScroll;this._setShowBy(this.bscroll[i])&&(e=(t=this.keysMap).wrapperSize,o=t.scrollerSize,s=t.maxScroll,this.keyVals=this._refreshKeyValues(this.wrapper[e],this.bscroll[o],this.bscroll[s]),this.updatePosAndSize({x:this.bscroll.x,y:this.bscroll.y}))},qt.prototype._setShowBy=function(t){return t?!(this.wrapper.style.display=""):!(this.wrapper.style.display="none")},qt.prototype._refreshKeyValues=function(t,e,o){var s=Math.max(Math.round(t*t/(e||t||1)),8),i=t-s;return{initialSize:s,maxPos:i,sizeRatio:i/o}},qt.prototype.updatePosAndSize=function(t){var e=this._refreshPosAndSizeValue(t,this.keyVals),o=e.pos,s=e.size;this.curPos=o,this._refreshPosAndSizeStyle(s,o)},qt.prototype._refreshPosAndSizeValue=function(t,e){var o,s=this.keysMap.pos,i=e.sizeRatio,r=e.initialSize,n=e.maxPos,h=Math.round(i*t[s]);return h<0?(o=Math.max(r+3*h,8),h=0):n<h?h=n+r-(o=Math.max(r-3*(h-n),8)):o=r,{pos:h,size:o}},qt.prototype._refreshPosAndSizeStyle=function(t,e){var o=this.keysMap,s=o.translate,i=o.size;this.elStyle[i]=t+"px",this.elStyle[X.transform]=s+"("+e+"px)"+this.bscroll.options.translateZ},qt.prototype.setTransitionTime=function(t){void 0===t&&(t=0),this.elStyle[X.transitionDuration]=t+"ms"},qt.prototype.setTransitionTimingFunction=function(t){this.elStyle[X.transitionTimingFunction]=t},qt.prototype.startHandler=function(){this.setTransitionTime(),this.bscroll.trigger("beforeScrollStart")},qt.prototype.moveHandler=function(t,e){t||this.bscroll.trigger("scrollStart");var o=this._calScrollDesPos(this.curPos,e,this.keyVals);"vertical"===this.direction?this.bscroll.scrollTo(this.bscroll.x,o):this.bscroll.scrollTo(o,this.bscroll.y),this.bscroll.trigger("scroll",{x:this.bscroll.x,y:this.bscroll.y})},qt.prototype._calScrollDesPos=function(t,e,o){var s=o.maxPos,i=o.sizeRatio,r=t+e;return r<0?r=0:s<r&&(r=s),Math.round(r/i)},qt.prototype.endHandler=function(t){t&&this.bscroll.trigger("scrollEnd",{x:this.bscroll.x,y:this.bscroll.y})},qt.prototype.destroy=function(){this.options.interactive&&this.eventHandler.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),this.hooksHandlers.forEach(function(t){var e=t[0],o=t[1],s=t[2];e.off(o,s)}),this.hooksHandlers.length=0},qt.prototype._listen=function(t,e,o){t.on(e,o,this),this.hooksHandlers.push([t,e,o])},qt);function qt(t,e){this.bscroll=t,this.options=e,this.keyVals={sizeRatio:1,maxPos:0,initialSize:0},this.curPos=0,this.hooksHandlers=[],this.wrapper=e.wrapper,this.wrapperStyle=this.wrapper.style,this.el=this.wrapper.children[0],this.elStyle=this.el.style,this.bscroll=t,this.direction=e.direction,this.keysMap=this._getKeysMap(),e.fade?(this.visible=0,this.wrapperStyle.opacity="0"):this.visible=1,this._listenHooks(e.fade,e.interactive),this.refresh()}var $t=(Gt.prototype.createIndicators=function(o){var s,i=this,t=o.options.scrollbar,e=t.fade,r=void 0===e||e,n=t.interactive,h=void 0!==n&&n,l={scrollX:"horizontal",scrollY:"vertical"},a=[];return Object.keys(l).forEach(function(t){var e=l[t];o.options[t]&&(s={wrapper:i.createIndicatorElement(e),direction:e,fade:r,interactive:h},o.wrapper.appendChild(s.wrapper),a.push(new Zt(o,s)))}),a},Gt.prototype.createIndicatorElement=function(t){var e=document.createElement("div"),o=document.createElement("div");return e.style.cssText="position:absolute;z-index:9999;pointerEvents:none",o.style.cssText="box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;",o.className="bscroll-indicator","horizontal"===t?(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",o.style.height="100%",e.className="bscroll-horizontal-scrollbar"):(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",o.style.width="100%",e.className="bscroll-vertical-scrollbar"),e.style.cssText+=";overflow:hidden",e.appendChild(o),e},Gt.prototype.destroy=function(){for(var t=0,e=this.indicators;t<e.length;t++){e[t].destroy()}},Gt.pluginName="scrollbar",Gt);function Gt(t){this.indicators=[],this.indicators=this.createIndicators(t),t.on(t.eventTypes.destroy,this.destroy,this)}var Jt=(Qt.prototype.init=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY;this.wrapperWidth=e.wrapperSize,this.wrapperHeight=o.wrapperSize,this.scrollerHeight=o.contentSize,this.scrollerWidth=e.contentSize,this.pages=this.buildPagesMatrix(this.wrapperWidth,this.wrapperHeight),this.pageLengthOfX=this.pages?this.pages.length:0,this.pageLengthOfY=this.pages&&this.pages[0]?this.pages[0].length:0},Qt.prototype.getPageStats=function(t,e){return this.pages[t][e]},Qt.prototype.getNearestPageIndex=function(t,e){for(var o=0,s=0,i=this.pages.length;o<i-1&&!(t>=this.pages[o][0].cx);o++);for(i=this.pages[o].length;s<i-1&&!(e>=this.pages[0][s].cy);s++);return{pageX:o,pageY:s}},Qt.prototype.buildPagesMatrix=function(t,e){for(var o,s,i=[],r=0,n=0,h=this.scroll.scroller.scrollBehaviorX.maxScrollPos,l=this.scroll.scroller.scrollBehaviorY.maxScrollPos,a=Math.round(t/2),c=Math.round(e/2);r>-this.scrollerWidth;){for(i[n]=[],o=s=0;o>-this.scrollerHeight;)i[n][s]={x:Math.max(r,h),y:Math.max(o,l),width:t,height:e,cx:r-a,cy:o-c},o-=e,s++;r-=t,n++}return i},Qt);function Qt(t){this.scroll=t,this.init()}var te={pageX:0,pageY:0,x:0,y:0},ee=(oe.prototype.refresh=function(){this.pagesMatrix=new Jt(this.scroll);var t=this.currentPage,e=t.pageX,o=t.pageY,s=this.pagesMatrix.getPageStats(e,o),i=s.x,r=s.y;this.currentPage={pageX:e,pageY:o,x:i,y:r},this.checkSlideLoop()},oe.prototype.setCurrentPage=function(t){this.currentPage=t},oe.prototype.getInternalPage=function(t,e){t>=this.pagesMatrix.pageLengthOfX?t=this.pagesMatrix.pageLengthOfX-1:t<0&&(t=0),e>=this.pagesMatrix.pageLengthOfY?e=this.pagesMatrix.pageLengthOfY-1:e<0&&(e=0);var o=this.pagesMatrix.getPageStats(t,e);return{pageX:t,pageY:e,x:o.x,y:o.y}},oe.prototype.getInitialPage=function(){var t=this.loopX?1:0,e=this.loopY?1:0,o=this.currentPage.pageX||t,s=this.currentPage.pageY||e,i=this.pagesMatrix.getPageStats(o,s);return{pageX:o,pageY:s,x:i.x,y:i.y}},oe.prototype.getExposedPage=function(){var t=g({},this.currentPage);return this.loopX&&(t.pageX=this.fixedPage(t.pageX,this.pagesMatrix.pageLengthOfX-2)),this.loopY&&(t.pageY=this.fixedPage(t.pageY,this.pagesMatrix.pageLengthOfY-2)),t},oe.prototype.getWillChangedPage=function(t){return t=g({},t),this.loopX&&(t.pageX=this.fixedPage(t.pageX,this.pagesMatrix.pageLengthOfX-2),t.x=this.pagesMatrix.getPageStats(t.pageX+1,0).x),this.loopY&&(t.pageY=this.fixedPage(t.pageY,this.pagesMatrix.pageLengthOfY-2),t.y=this.pagesMatrix.getPageStats(0,t.pageY+1).y),t},oe.prototype.fixedPage=function(t,e){for(var o=[],s=0;s<e;s++)o.push(s);return o.unshift(e-1),o.push(0),o[t]},oe.prototype.getPageStats=function(){return this.pagesMatrix.getPageStats(this.currentPage.pageX,this.currentPage.pageY)},oe.prototype.getValidPageIndex=function(t,e){var o=this.pagesMatrix.pageLengthOfX-1,s=this.pagesMatrix.pageLengthOfY-1,i=0,r=0;return this.loopX&&(t+=1,i+=1,--o),this.loopY&&(e+=1,r+=1,--s),{pageX:t=v(t,i,o),pageY:e=v(e,r,s)}},oe.prototype.nextPageIndex=function(){return this.getPageIndexByDirection("positive")},oe.prototype.prevPageIndex=function(){return this.getPageIndexByDirection("negative")},oe.prototype.nearestPage=function(t,e,o,s){var i=this.pagesMatrix.getNearestPageIndex(t,e),r=i.pageX,n=i.pageY;return r===this.currentPage.pageX&&(r=v(r+=o,0,this.pagesMatrix.pageLengthOfX-1)),n===this.currentPage.pageY&&(n=v(n+=s,0,this.pagesMatrix.pageLengthOfY-1)),{x:this.pagesMatrix.getPageStats(r,0).x,y:this.pagesMatrix.getPageStats(0,n).y,pageX:r,pageY:n}},oe.prototype.resetLoopPage=function(){if(this.loopX){if(0===this.currentPage.pageX)return{pageX:this.pagesMatrix.pageLengthOfX-2,pageY:this.currentPage.pageY};if(this.currentPage.pageX===this.pagesMatrix.pageLengthOfX-1)return{pageX:1,pageY:this.currentPage.pageY}}if(this.loopY){if(0===this.currentPage.pageY)return{pageX:this.currentPage.pageX,pageY:this.pagesMatrix.pageLengthOfY-2};if(this.currentPage.pageY===this.pagesMatrix.pageLengthOfY-1)return{pageX:this.currentPage.pageX,pageY:1}}},oe.prototype.getPageIndexByDirection=function(t){var e=this.currentPage.pageX,o=this.currentPage.pageY;return this.slideX&&(e="negative"===t?e-1:e+1),this.slideY&&(o="negative"===t?o-1:o+1),{pageX:e,pageY:o}},oe.prototype.checkSlideLoop=function(){this.needLoop=this.slideOptions.loop,1<this.pagesMatrix.pageLengthOfX&&(this.slideX=!0),this.pagesMatrix.pages[0]&&1<this.pagesMatrix.pageLengthOfY&&(this.slideY=!0),this.loopX=this.needLoop&&this.slideX,this.loopY=this.needLoop&&this.slideY,this.slideX&&this.slideY&&h("slide does not support two direction at the same time.")},oe);function oe(t,e){this.scroll=t,this.slideOptions=e,this.slideX=!1,this.slideY=!1,this.currentPage=g({},te)}var se=[{key:"next",name:"next"},{key:"prev",name:"prev"},{key:"goToPage",name:"goToPage"},{key:"getCurrentPage",name:"getCurrentPage"}].map(function(t){return{key:t.key,sourceKey:"plugins.slide."+t.name}}),ie=(re.prototype.satisfyInitialization=function(){return!(this.scroll.scroller.content.children.length<=0)||(h("slide need at least one slide page to be initialised.please check your DOM layout."),!1)},re.prototype.init=function(){this.willChangeToPage=g({},te),this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.createPages()},re.prototype.createPages=function(){this.pages=new ee(this.scroll,this.options)},re.prototype.handleBScroll=function(){this.scroll.registerType(["slideWillChange"]),this.scroll.proxy(se)},re.prototype.handleOptions=function(){var t=!0===this.scroll.options.slide?{}:this.scroll.options.slide,e={loop:!0,threshold:.1,speed:400,easing:_.bounce,listenFlick:!0,autoplay:!0,interval:3e3};this.options=g(e,t)},re.prototype.handleLoop=function(){var t;!this.options.loop||1<(t=this.scroll.scroller.content).children.length&&this.cloneFirstAndLastSlidePage(t)},re.prototype.handleHooks=function(){var e=this,t=this.scroll.hooks,o=this.scroll.scroller.hooks,s=this.options.listenFlick;this.hooksFn=[],this.registerHooks(this.scroll,this.scroll.eventTypes.beforeScrollStart,this.pausePlay),this.registerHooks(this.scroll,this.scroll.eventTypes.scrollEnd,this.modifyCurrentPage),this.registerHooks(this.scroll,this.scroll.eventTypes.scrollEnd,this.startPlay),this.scroll.eventTypes.mousewheelMove&&(this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelMove,function(){return!0}),this.registerHooks(this.scroll,this.scroll.eventTypes.mousewheelEnd,function(t){1!==t.directionX&&1!==t.directionY||e.next(),-1!==t.directionX&&-1!==t.directionY||e.prev()})),this.registerHooks(t,t.eventTypes.refresh,this.refreshHandler),this.registerHooks(t,t.eventTypes.destroy,this.destroy),this.registerHooks(o,o.eventTypes.beforeRefresh,function(){e.handleLoop(),e.setSlideInlineStyle()}),this.registerHooks(o,o.eventTypes.momentum,this.modifyScrollMetaHandler),this.registerHooks(o,o.eventTypes.beforeStart,this.setTouchFlag),this.registerHooks(o,o.eventTypes.scroll,this.scrollMoving),this.registerHooks(o,o.eventTypes.checkClick,this.startPlay),s&&this.registerHooks(o,o.eventTypes.flick,this.flickHandler)},re.prototype.startPlay=function(){var t=this,e=this.options,o=e.interval;e.autoplay&&(clearTimeout(this.autoplayTimer),this.autoplayTimer=window.setTimeout(function(){t.next()},o))},re.prototype.pausePlay=function(){this.options.autoplay&&clearTimeout(this.autoplayTimer)},re.prototype.setSlideInlineStyle=function(){var t=this.scroll.scroller,l=t.content,a=t.wrapper,c=this.scroll.options;[{direction:"scrollX",sizeType:"offsetWidth",styleType:"width"},{direction:"scrollY",sizeType:"offsetHeight",styleType:"height"}].forEach(function(t){var e=t.direction,o=t.sizeType,s=t.styleType;if(c[e]){for(var i=a[o],r=l.children,n=r.length,h=0;h<n;h++){r[h].style[s]=i+"px"}l.style[s]=i*n+"px"}})},re.prototype.next=function(t,e){var o=this.pages.nextPageIndex(),s=o.pageX,i=o.pageY;this.goTo(s,i,t,e)},re.prototype.prev=function(t,e){var o=this.pages.prevPageIndex(),s=o.pageX,i=o.pageY;this.goTo(s,i,t,e)},re.prototype.goToPage=function(t,e,o,s){var i=this.pages.getValidPageIndex(t,e);i&&this.goTo(i.pageX,i.pageY,o,s)},re.prototype.getCurrentPage=function(){return this.pages.getExposedPage()},re.prototype.nearestPage=function(t,e){var o=this.scroll.scroller,s=o.scrollBehaviorX,i=o.scrollBehaviorY,r=s.absStartPos,n=s.maxScrollPos,h=s.minScrollPos,l=s.direction,a=i.absStartPos,c=i.maxScrollPos,p=i.minScrollPos,u=i.direction,d=!0;return Math.abs(t-r)<=this.thresholdX&&Math.abs(e-a)<=this.thresholdY&&(d=!1),d?this.pages.nearestPage(v(t,n,h),v(e,c,p),l,u):this.pages.currentPage},re.prototype.refreshHandler=function(){var e,o=this;this.satisfyInitialization()&&(this.pages.refresh(),this.computeThreshold(),e=this.pages.getInitialPage(),this.initialised?this.goTo(e.pageX,e.pageY,0):this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(t){o.initialised=!0,t.x=e.x,t.y=e.y,o.pages.setCurrentPage(e)}),this.startPlay())},re.prototype.computeThreshold=function(){var t,e,o,s=this.options.threshold;s%1==0?(this.thresholdX=s,this.thresholdY=s):(e=(t=this.pages.getPageStats()).width,o=t.height,this.thresholdX=Math.round(e*s),this.thresholdY=Math.round(o*s))},re.prototype.cloneFirstAndLastSlidePage=function(t){this.initialised&&this.removeClonedSlidePage(t);var e,o,s,i,r,n=t.children;e=n[n.length-1].cloneNode(!0),(r=(o=t).firstChild)?(s=e,(i=r).parentNode.insertBefore(s,i)):o.appendChild(e),t.appendChild(n[1].cloneNode(!0))},re.prototype.removeClonedSlidePage=function(t){var e=t.children;2<e.length&&(L(t,e[e.length-1]),L(t,e[0]))},re.prototype.modifyCurrentPage=function(){if(this.isTouching=!1,this.options.loop)if(this.resetLooping)this.resetLooping=!1;else{var t=this.pages.resetLoopPage();if(t)return this.resetLooping=!0,this.goTo(t.pageX,t.pageY,0),!0;this.pageWillChangeTo(this.pages.currentPage)}},re.prototype.goTo=function(t,e,o,s){var i,r,n,h,l,a=this.pages.getInternalPage(t,e);a&&(i=s||this.options.easing||_.bounce,r=a.x,n=a.y,h=r-this.scroll.scroller.scrollBehaviorX.currentPos,l=n-this.scroll.scroller.scrollBehaviorY.currentPos,(h||l)&&(o=void 0===o?this.getEaseTime(h,l):o,this.pages.setCurrentPage(a),this.pageWillChangeTo(this.pages.currentPage),this.scroll.scroller.scrollTo(r,n,o,i)))},re.prototype.flickHandler=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY,s=e.currentPos,i=e.startPos,r=e.direction,n=o.currentPos,h=o.startPos,l=o.direction,a=this.pages.currentPage,c=a.pageX,p=a.pageY,u=this.getEaseTime(s-i,n-h);this.goTo(c+r,p+l,u)},re.prototype.getEaseTime=function(t,e){return this.options.speed||Math.max(Math.max(Math.min(Math.abs(t),1e3),Math.min(Math.abs(e),1e3)),300)},re.prototype.modifyScrollMetaHandler=function(t){var e=this.nearestPage(t.newX,t.newY);t.time=this.getEaseTime(t.newX-e.x,t.newY-e.y),t.newX=e.x,t.newY=e.y,t.easing=this.options.easing||_.bounce,this.pages.setCurrentPage(e),this.pageWillChangeTo(this.pages.currentPage)},re.prototype.scrollMoving=function(t){var e;this.isTouching&&(e=this.nearestPage(t.x,t.y),this.pageWillChangeTo(e))},re.prototype.pageWillChangeTo=function(t){var e,o,s=this.pages.getWillChangedPage(t);e=this.willChangeToPage,o=s,e.pageX===o.pageX&&e.pageY===o.pageY||(this.willChangeToPage=s,this.scroll.trigger(this.scroll.eventTypes.slideWillChange,this.willChangeToPage))},re.prototype.setTouchFlag=function(){this.isTouching=!0},re.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},re.prototype.destroy=function(){var t=this.scroll.scroller.content,e=this.options,o=e.loop,s=e.autoplay;o&&this.removeClonedSlidePage(t),s&&clearTimeout(this.autoplayTimer),this.hooksFn.forEach(function(t){var e=t[0],o=t[1],s=t[2];e.eventTypes[o]&&e.off(o,s)}),this.hooksFn.length=0},re.pluginName="slide",re);function re(t){this.scroll=t,this.resetLooping=!1,this.isTouching=!1,this.autoplayTimer=0,this.satisfyInitialization()&&this.init()}var ne=[{key:"wheelTo",name:"wheelTo"},{key:"getSelectedIndex",name:"getSelectedIndex"}].map(function(t){return{key:t.key,sourceKey:"plugins.wheel."+t.name}}),he=4,le=(ae.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.refreshBoundary(),this.handleSelectedIndex()},ae.prototype.handleBScroll=function(){this.scroll.proxy(ne)},ae.prototype.handleOptions=function(){var t=!0===this.scroll.options.wheel?{}:this.scroll.options.wheel;this.options=g({wheelWrapperClass:"wheel-scroll",wheelItemClass:"wheel-item",rotate:25,adjustTime:400,selectedIndex:0,wheelDisabledItemClass:"wheel-disabled-item"},t)},ae.prototype.handleHooks=function(){var o=this,t=this.scroll.scroller,e=t.actionsHandler,s=t.scrollBehaviorX,i=t.scrollBehaviorY,r=t.animater;this.scroll.hooks.on(this.scroll.hooks.eventTypes.beforeInitialScrollTo,function(t){t.x=0,t.y=-(o.selectedIndex*o.itemHeight)}),t.hooks.on(t.hooks.eventTypes.checkClick,function(){var t=Array.prototype.slice.call(o.items,0).indexOf(o.target);return-1===t||o.wheelToAfterClick(t,o.options.adjustTime,_.swipe),!0}),t.hooks.on(t.hooks.eventTypes.scrollTo,function(t){t.y=o.findNearestValidWheel(t.y).y}),t.hooks.on(t.hooks.eventTypes.scrollToElement,function(t,e){return!I(t,o.options.wheelItemClass)||void(e.top=o.findNearestValidWheel(e.top).y)}),e.hooks.on(e.hooks.eventTypes.beforeStart,function(t){o.target=t.target}),s.hooks.on(s.hooks.eventTypes.computeBoundary,function(t){t.maxScrollPos=0,t.minScrollPos=0}),i.hooks.on(i.hooks.eventTypes.computeBoundary,function(t){o.items=o.scroll.scroller.content.children,o.checkWheelAllDisabled(),o.itemHeight=0<o.items.length?i.contentSize/o.items.length:0,t.maxScrollPos=-o.itemHeight*(o.items.length-1),t.minScrollPos=0}),i.hooks.on(i.hooks.eventTypes.momentum,function(t,e){t.rate=he,t.destination=o.findNearestValidWheel(t.destination).y;e<1e3&&(t.duration=Math.max(800,e/1e3*o.scroll.options.swipeTime))}),i.hooks.on(i.hooks.eventTypes.end,function(t){var e=o.findNearestValidWheel(i.currentPos);t.destination=e.y,t.duration=o.options.adjustTime,o.selectedIndex=e.index}),r.hooks.on(r.hooks.eventTypes.time,function(t){o.transitionDuration(t)}),r.hooks.on(r.hooks.eventTypes.timeFunction,function(t){o.timeFunction(t)}),r.hooks.on(r.hooks.eventTypes.beforeForceStop,function(t){var e=t.y;return o.target=o.items[o.findNearestValidWheel(e).index],!0}),r.hooks.on(r.hooks.eventTypes.callStop,function(){var t,e=Array.prototype.slice.call(o.items,0).indexOf(o.target);0<e&&(t=-(e*o.itemHeight),r.translate({x:0,y:t}))}),r.translater.hooks.on(r.translater.hooks.eventTypes.translate,function(t){o.rotateX(t.y),o.selectedIndex=o.findNearestValidWheel(t.y).index})},ae.prototype.refreshBoundary=function(){var t=this.scroll.scroller,e=t.scrollBehaviorX,o=t.scrollBehaviorY;e.refresh(),o.refresh()},ae.prototype.handleSelectedIndex=function(){this.selectedIndex=this.options.selectedIndex},ae.prototype.getSelectedIndex=function(){return this.selectedIndex},ae.prototype.wheelTo=function(t,e,o){void 0===t&&(t=0),void 0===e&&(e=0);var s=-t*this.itemHeight,i=Math.round(this.scroll.y);return this.scroll.scrollTo(0,s,e,o),s===i},ae.prototype.wheelToAfterClick=function(t,e,o){var s;void 0===t&&(t=0),void 0===e&&(e=0),this.wheelTo(t,e,o)&&(s=this.scroll.scroller.hooks).trigger(s.eventTypes.scrollEnd)},ae.prototype.transitionDuration=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[X.transitionDuration]=t+"ms"},ae.prototype.timeFunction=function(t){for(var e=0;e<this.items.length;e++)this.items[e].style[X.transitionTimingFunction]=t},ae.prototype.rotateX=function(t){for(var e=this.options.rotate,o=void 0===e?25:e,s=0;s<this.items.length;s++){var i=(o*(t/this.itemHeight+s)).toFixed(3);this.items[s].style[X.transform]="rotateX("+i+"deg)"}},ae.prototype.findNearestValidWheel=function(t){t=0<t?0:t<this.scroll.maxScrollY?this.scroll.maxScrollY:t;for(var e=Math.abs(Math.round(-t/this.itemHeight)),o=e,s=this.items,i=this.options.wheelDisabledItemClass;0<=e&&I(s[e],i);)e--;if(e<0)for(e=o;e<=s.length-1&&I(s[e],i);)e++;return e===s.length&&(e=o),{index:this.wheelItemsAllDisabled?-1:e,y:-e*this.itemHeight}},ae.prototype.checkWheelAllDisabled=function(){var t=this.options.wheelDisabledItemClass,e=this.items;this.wheelItemsAllDisabled=!0;for(var o=0;o<e.length;o++)if(!I(e[o],t)){this.wheelItemsAllDisabled=!1;break}},ae.pluginName="wheel",ae);function ae(t){this.scroll=t,this.init()}var ce=[{key:"zoomTo",name:"zoomTo"}].map(function(t){return{key:t.key,sourceKey:"plugins.zoom."+t.name}}),pe=(ue.prototype.init=function(){this.handleBScroll(),this.handleOptions(),this.handleHooks(),this.tryInitialZoomTo(this.zoomOpt)},ue.prototype.zoomTo=function(t,e,o,s){var i=this.resolveOrigin(e,o),r={x:i.originX,y:i.originY,baseScale:this.scale};this._doZoomTo(t,r,s,!0)},ue.prototype.handleBScroll=function(){this.scroll.proxy(ce),this.scroll.registerType(["beforeZoomStart","zoomStart","zooming","zoomEnd"])},ue.prototype.handleOptions=function(){var t=!0===this.scroll.options.zoom?{}:this.scroll.options.zoom;this.zoomOpt=g({start:1,min:1,max:4,initialOrigin:[0,0],minimalZoomDistance:5,bounceTime:800},t)},ue.prototype.handleHooks=function(){var s=this,t=this.scroll,e=this.scroll.scroller;this.wrapper=this.scroll.scroller.wrapper,this.scaleElement=this.scroll.scroller.content,this.scaleElement.style[X.transformOrigin]="0 0",this.scaleElementInitSize=H(this.scaleElement);var o=e.scrollBehaviorX,i=e.scrollBehaviorY;this.hooksFn=[],this.registerHooks(t.hooks,t.hooks.eventTypes.beforeInitialScrollTo,function(){return!0}),this.registerHooks(o.hooks,o.hooks.eventTypes.beforeComputeBoundary,function(){o.contentSize=Math.floor(s.scaleElementInitSize.width*s.scale)}),this.registerHooks(i.hooks,i.hooks.eventTypes.beforeComputeBoundary,function(){i.contentSize=Math.floor(s.scaleElementInitSize.height*s.scale)}),this.registerHooks(e.actions.hooks,e.actions.hooks.eventTypes.start,function(t){var e=t.touches&&t.touches.length||0;s.fingersOperation(e),2===e&&s.zoomStart(t)}),this.registerHooks(e.actions.hooks,e.actions.hooks.eventTypes.beforeMove,function(t){var e=t.touches&&t.touches.length||0;if(s.fingersOperation(e),2===e)return s.zoom(t),!0}),this.registerHooks(e.actions.hooks,e.actions.hooks.eventTypes.beforeEnd,function(t){if(2===s.fingersOperation())return s.zoomEnd(),!0}),this.registerHooks(e.translater.hooks,e.translater.hooks.eventTypes.beforeTranslate,function(t,e){var o=e.scale?e.scale:s.prevScale;s.prevScale=o,t.push("scale("+o+")")}),this.registerHooks(e.hooks,e.hooks.eventTypes.scrollEnd,function(){2===s.fingersOperation()&&s.scroll.trigger(s.scroll.eventTypes.zoomEnd,{scale:s.scale})}),this.registerHooks(this.scroll.hooks,"destroy",this.destroy)},ue.prototype.tryInitialZoomTo=function(t){var e=t.start,o=t.initialOrigin;this.zoomTo(e,o[0],o[1],0)},ue.prototype.fingersOperation=function(t){if("number"!=typeof t)return this.numberOfFingers;this.numberOfFingers=t},ue.prototype._doZoomTo=function(t,e,o,s){var i=this;void 0===o&&(o=this.zoomOpt.bounceTime),void 0===s&&(s=!1);var r,n,h,l,a=this.zoomOpt,c=a.min,p=a.max,u=this.scale,d=v(t,c,p);0!==o?0<o&&(n=f(),h=n+o,(l=function(){var t=f();if(h<=t)return i.scroll.trigger(i.scroll.eventTypes.zooming,{scale:d}),void K(r);var e=_.bounce.fn((t-n)/o)*(d-u)+u;i.scroll.trigger(i.scroll.eventTypes.zooming,{scale:e}),r=R(l)})()):i.scroll.trigger(i.scroll.eventTypes.zooming,{scale:d}),this.fingersOperation(2),this._zoomTo(d,u,e,o,s)},ue.prototype._zoomTo=function(t,e,o,s,i){void 0===i&&(i=!1);var r=t/o.baseScale;this.setScale(t);var n=this.scroll.scroller,h=n.scrollBehaviorX,l=n.scrollBehaviorY;this.resetBoundaries([h,l]);var a=this.getNewPos(o.x,r,h,!0,i),c=this.getNewPos(o.y,r,l,!0,i);h.currentPos===Math.round(a)&&l.currentPos===Math.round(c)&&t===e||n.scrollTo(a,c,s,_.bounce,{start:{scale:e},end:{scale:t}})},ue.prototype.resolveOrigin=function(t,e){var o=this.scroll.scroller,s=o.scrollBehaviorX,i=o.scrollBehaviorY,r={left:function(){return 0},top:function(){return 0},right:function(){return s.contentSize},bottom:function(){return i.contentSize},center:function(t){return(0===t?s.contentSize:i.contentSize)/2}};return{originX:"number"==typeof t?t:r[t](0),originY:"number"==typeof e?e:r[e](1)}},ue.prototype.zoomStart=function(t){var e=t.touches[0],o=t.touches[1];this.startDistance=this.getFingerDistance(t),this.startScale=this.scale;var s,i,r=(s=this.wrapper,{left:-((i=s.getBoundingClientRect()).left+window.pageXOffset),top:-(i.top+window.pageYOffset)}),n=r.left,h=r.top;this.origin={x:Math.abs(e.pageX+o.pageX)/2+n-this.scroll.x,y:Math.abs(e.pageY+o.pageY)/2+h-this.scroll.y,baseScale:this.startScale},this.scroll.trigger(this.scroll.eventTypes.beforeZoomStart)},ue.prototype.zoom=function(t){var e,o,s,i,r,n,h,l=this.getFingerDistance(t);!this.zoomed&&Math.abs(l-this.startDistance)<this.zoomOpt.minimalZoomDistance||(o=(e=this.dampingScale(l/this.startDistance*this.startScale))/this.startScale,this.setScale(e),this.zoomed||(this.zoomed=!0,this.scroll.trigger(this.scroll.eventTypes.zoomStart)),i=(s=this.scroll.scroller).scrollBehaviorX,r=s.scrollBehaviorY,n=this.getNewPos(this.origin.x,o,i,!1,!1),h=this.getNewPos(this.origin.y,o,r,!1,!1),this.scroll.trigger(this.scroll.eventTypes.zooming,{scale:this.scale}),s.translater.translate({x:n,y:h,scale:e}))},ue.prototype.zoomEnd=function(){this.zoomed&&(this.shouldRebound()?this._doZoomTo(this.scale,this.origin,this.zoomOpt.bounceTime):this.scroll.trigger(this.scroll.eventTypes.zoomEnd,{scale:this.scale}))},ue.prototype.getFingerDistance=function(t){var e,o,s=t.touches[0],i=t.touches[1],r=Math.abs(s.pageX-i.pageX),n=Math.abs(s.pageY-i.pageY);return e=r,o=n,Math.sqrt(e*e+o*o)},ue.prototype.shouldRebound=function(){var t=this.zoomOpt,e=t.min,o=t.max,s=this.scale;if(s!==v(s,e,o))return!0;var i=this.scroll.scroller,r=i.scrollBehaviorX,n=i.scrollBehaviorY;this.resetBoundaries([r,n]);var h=r.checkInBoundary().inBoundary,l=r.checkInBoundary().inBoundary;return!(h&&l)},ue.prototype.dampingScale=function(t){var e=this.zoomOpt,o=e.min,s=e.max;return t<o?t=.5*o*Math.pow(2,t/o):s<t&&(t=2*s*Math.pow(.5,s/t)),t},ue.prototype.setScale=function(t){this.scale=t},ue.prototype.resetBoundaries=function(t){t.forEach(function(t){return t.computeBoundary()})},ue.prototype.getNewPos=function(t,e,o,s,i){void 0===i&&(i=!1);var r=t-t*e+(i?o.currentPos:o.startPos);return s&&(r=v(r,o.maxScrollPos,o.minScrollPos)),0<r?Math.floor(r):Math.ceil(r)},ue.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},ue.prototype.destroy=function(){this.hooksFn.forEach(function(t){var e=t[0],o=t[1],s=t[2];e.off(o,s)}),this.hooksFn.length=0},ue.pluginName="zoom",ue);function ue(t){this.scroll=t,this.scale=1,this.prevScale=1,this.init()}var de={duplicateClick:function(t){var e=t[0],o=t[1];e.options.click&&o.options.click&&(o.options.click=!1)},nestedScroll:function(o){var t=o[0],e=o[1],s=t.options.scrollX,i=t.options.scrollY,r=e.options.scrollX,n=e.options.scrollY;s!==r&&i!==n||(o.forEach(function(t,e){var l=o[(e+1)%2];t.on(t.eventTypes.beforeScrollStart,function(){var t,e,o,s,i,r,n,h;l.pending&&(l.stop(),l.resetPosition()),e=ve(t=l),o=e.hasHorizontalScroll,s=e.hasVerticalScroll,i=t.scroller,r=i.actions,n=i.scrollBehaviorX,h=i.scrollBehaviorY,r.startTime=+new Date,s?h.startPos=h.currentPos:o&&(n.startPos=n.currentPos),l.disable()}),t.on(t.eventTypes.touchEnd,function(){l.enable()})}),e.on(e.eventTypes.scrollStart,function(){!function(t){var e=ve(t),o=e.hasHorizontalScroll,s=e.hasVerticalScroll,i=t.scroller,r=i.scrollBehaviorX,n=i.scrollBehaviorY,h=t.x>=t.minScrollX&&-1===r.movingDirection,l=t.x<=t.maxScrollX&&1===r.movingDirection,a=t.y>=t.minScrollY&&-1===n.movingDirection,c=t.y<=t.maxScrollY&&1===n.movingDirection;{if(s)return a||c;if(o)return h||l}return!1}(e)||(e.disable(),t.enable())}))}},fe=(ge.prototype.setup=function(t){this.appendBScroll(t),this.handleContainRelationship(),this.handleCompatible()},ge.prototype.addHooks=function(t){var e=this;t.on("destroy",function(){e.teardown(t)})},ge.prototype.teardown=function(t){this.removeBScroll(t),this.handleContainRelationship(),this.handleCompatible()},ge.prototype.appendBScroll=function(t){this.stores.push(t)},ge.prototype.removeBScroll=function(t){var e=this.stores.indexOf(t);-1!==e&&(t.wrapper.isBScrollContainer=void 0,this.stores.splice(e,1))},ge.prototype.handleContainRelationship=function(){var t=this.stores;if(t.length<=1)t[0]&&t[0].__parentInfo&&(t[0].__parentInfo=void 0);else for(var e,o,s,i=0;i<t.length;i++){o=(e=t[i]).wrapper;for(var r=0;r<t.length;r++){var n,h=(s=t[r]).wrapper;e!==s&&h.contains(o)&&(e.__parentInfo?(n=ye(o,h))<e.__parentInfo.depth&&(e.__parentInfo={parent:s,depth:n}):e.__parentInfo={parent:s,depth:ye(o,h)})}}},ge.prototype.handleCompatible=function(){var t=this.availableBScrolls(),o=["duplicateClick","nestedScroll"];t.forEach(function(e){o.forEach(function(t){de[t](e)})})},ge.prototype.availableBScrolls=function(){return this.stores.filter(function(t){return!!t.__parentInfo}).map(function(t){return[t.__parentInfo.parent,t]})},ge.pluginName="nestedScroll",ge);function ge(t){var e=ge.nestedScroll;return e instanceof ge||((e=ge.nestedScroll=this).stores=[]),e.setup(t),e.addHooks(t),e}function ye(t,e){for(var o=0,s=t.parentNode;s&&s!==e;)o++,s=s.parentNode;return o}function ve(t){return{hasHorizontalScroll:t.hasHorizontalScroll,hasVerticalScroll:t.hasVerticalScroll}}var me=(ke.prototype.calculate=function(t,e){var o=t-this.lastPos;this.lastPos=t;var s=this.getDirection(o),i=this.calculateIndex(0,t,e),r=this.calculateIndex(i,t+this.wrapperHeight,e);return 1===s?(i-=10,r+=30):(i-=30,r+=10),i<0&&(i=0),{start:i,end:r}},ke.prototype.getDirection=function(t){var e;if(0<t)e=1;else{if(!(t<0))return this.lastDirection;e=0}return this.lastDirection=e},ke.prototype.calculateIndex=function(t,e,o){if(e<=0)return t;for(var s=t,i=o[s]&&-1!==o[s].pos?o[s].pos:0,r=0;s<o.length&&o[s].pos<e;)i=o[s].pos,s++;return s===o.length&&(r=Math.floor((e-i)/this.tombstoneHeight)),s+=r},ke);function ke(t,e){this.wrapperHeight=t,this.tombstoneHeight=e,this.lastDirection=1,this.lastPos=0}var Te=function(){this.data=null,this.dom=null,this.tombstone=null,this.width=0,this.height=0,this.pos=0},be=(Pe.prototype.update=function(o){return r(this,void 0,void 0,function(){var e;return n(this,function(t){return this.hasMore||(o=Math.min(o,this.list.length)),o>this.list.length&&(e=o-this.list.length,this.addEmptyData(e)),[2,this.checkToFetch(o)]})})},Pe.prototype.add=function(t){for(var e=0;e<t.length;e++)this.list[this.loadedNum]?this.list[this.loadedNum]=a(a({},this.list[this.loadedNum]),{data:t[e]}):this.list[this.loadedNum]={data:t[e]},this.loadedNum++;return this.list},Pe.prototype.addEmptyData=function(t){for(var e=0;e<t;e++)this.list.push(new Te);return this.list},Pe.prototype.fetch=function(o){return r(this,void 0,void 0,function(){var e;return n(this,function(t){switch(t.label){case 0:return this.fetching?[2,[]]:(this.fetching=!0,[4,this.fetchFn(o)]);case 1:return e=t.sent(),this.fetching=!1,[2,e]}})})},Pe.prototype.checkToFetch=function(i){return r(this,void 0,void 0,function(){var e,o,s;return n(this,function(t){switch(t.label){case 0:return this.hasMore?i<=this.loadedNum?[2]:(e=i-this.loadedNum,[4,this.fetch(e)]):[2];case 1:return(o=t.sent())instanceof Array&&o.length?(this.add(o),s=this.onFetchFinish(this.list,!0),[2,this.checkToFetch(s)]):("boolean"==typeof o&&!1===o&&(this.hasMore=!1,this.list.splice(this.loadedNum),this.onFetchFinish(this.list,!1)),[2])}})})},Pe.prototype.getList=function(){return this.list},Pe);function Pe(t,e,o){this.fetchFn=e,this.onFetchFinish=o,this.loadedNum=0,this.fetching=!1,this.hasMore=!0,this.list=t||[]}var we=(Se.isTombstone=function(t){return!(!t||!t.classList)&&t.classList.contains("tombstone")},Se.prototype.getSize=function(){var t;this.initialed||((t=this.create()).style.position="absolute",document.body.appendChild(t),t.style.display="",this.height=t.offsetHeight,this.width=t.offsetWidth,document.body.removeChild(t),this.cached.push(t))},Se.prototype.getOne=function(){var t=this.cached.pop();if(t){var e=t.style;return e.display="",e.opacity="1",e[X.transform]="",e[X.transition]="",t}return this.create()},Se.prototype.recycle=function(t){for(var e=0,o=t;e<o.length;e++){var s=o[e];s.style.display="none",this.cached.push(s)}return this.cached},Se.prototype.recycleOne=function(t){return this.cached.push(t),this.cached},Se);function Se(t){this.create=t,this.cached=[],this.width=0,this.height=0,this.initialed=!1,this.getSize()}var xe=(Me.prototype.update=function(t,e,o){e>=t.length&&(e=t.length-1),o>t.length&&(o=t.length),this.collectUnusedDom(t,e,o),this.createDom(t,e,o),this.cacheHeight(t,e,o);var s=this.positionDom(t,e,o);return{start:e,startPos:s.startPos,startDelta:s.startDelta,end:o,endPos:s.endPos}},Me.prototype.collectUnusedDom=function(t,e,o){for(var s,i=0;i<t.length;i++){i!==e?t[i].dom&&(s=t[i].dom,we.isTombstone(s)?(this.tombstone.recycleOne(s),s.style.display="none"):this.unusedDom.push(s),t[i].dom=null):i=o-1}return t},Me.prototype.createDom=function(t,e,o){for(var s=e;s<o;s++){var i=t[s].dom,r=t[s].data;if(i){if(!we.isTombstone(i)||!r)continue;t[s].tombstone=i,t[s].dom=null}(i=r?this.renderFn(r,this.unusedDom.pop()):this.tombstone.getOne()).style.position="absolute",t[s].dom=i,t[s].pos=-1,this.content.appendChild(i)}},Me.prototype.cacheHeight=function(t,e,o){for(var s=e;s<o;s++)t[s].data&&!t[s].height&&(t[s].height=t[s].dom.offsetHeight)},Me.prototype.positionDom=function(t,e,o){for(var s=this,i=[],r=this.getStartPos(t,e,o),n=r.start,h=r.delta,l=n,a=e;a<o;a++){var c,p=t[a].tombstone;p&&((c=p.style)[X.transition]=x+"transform 200ms, opacity 200ms",c[X.transform]="translateY("+l+"px)",c.opacity="0",t[a].tombstone=null,i.push(p)),t[a].dom&&t[a].pos!==l&&(t[a].dom.style[X.transform]="translateY("+l+"px)",t[a].pos=l),l+=t[a].height||this.tombstone.height}var u=window.setTimeout(function(){s.tombstone.recycle(i)},200);return this.timers.push(u),{startPos:n,startDelta:h,endPos:l}},Me.prototype.getStartPos=function(t,e,o){if(t[e]&&-1!==t[e].pos)return{start:t[e].pos,delta:0};for(var s=-1===t[0].pos?0:t[0].pos,i=0;i<e;i++)s+=t[i].height||this.tombstone.height;for(var r=s,n=e;n<o;n++)if(!we.isTombstone(t[n].dom)&&-1!==t[n].pos){s=t[n].pos;break}var h=n;if(h<o)for(;e<h;)s-=t[h-1].height,h--;return{start:s,delta:r-s}},Me.prototype.removeTombstone=function(){for(var t=this.content.querySelectorAll(".tombstone"),e=t.length-1;0<=e;e--)this.content.removeChild(t[e])},Me.prototype.destroy=function(){this.removeTombstone(),this.timers.forEach(function(t){clearTimeout(t)})},Me);function Me(t,e,o){this.content=t,this.renderFn=e,this.tombstone=o,this.unusedDom=[],this.timers=[]}var Ye=(Be.prototype.init=function(){this.handleOptions();var t=this.options,e=t.fetch,o=t.render,s=t.createTombstone;this.tombstone=new we(s),this.indexCalculator=new me(this.scroll.scroller.scrollBehaviorY.wrapperSize,this.tombstone.height),this.domManager=new xe(this.scroll.scroller.content,o,this.tombstone),this.dataManager=new be([],e,this.onFetchFinish.bind(this)),this.scroll.on(this.scroll.eventTypes.destroy,this.destroy,this),this.scroll.on(this.scroll.eventTypes.scroll,this.update,this);var i=this.scroll.scroller.scrollBehaviorY;i.hooks.on(i.hooks.eventTypes.computeBoundary,this.modifyBoundary,this),this.update({y:0})},Be.prototype.modifyBoundary=function(t){t.maxScrollPos=-2e3},Be.prototype.handleOptions=function(){var t=this.scroll.options.infinity;t&&("function"!=typeof t.fetch&&h("Infinity plugin need fetch Function to new data."),"function"!=typeof t.render&&h("Infinity plugin need render Function to render each item."),"function"!=typeof t.render&&h("Infinity plugin need createTombstone Function to create tombstone."),this.options=t),this.scroll.options.probeType=3},Be.prototype.update=function(t){var e=Math.round(-t.y),o=this.indexCalculator.calculate(e,this.dataManager.getList()),s=o.start,i=o.end;this.start=s,this.end=i,this.dataManager.update(i),this.updateDom(this.dataManager.getList())},Be.prototype.onFetchFinish=function(t,e){var o=this.updateDom(t).end;return e||(this.domManager.removeTombstone(),this.scroll.scroller.animater.stop(),this.scroll.resetPosition()),o},Be.prototype.updateDom=function(t){var e=this.domManager.update(t,this.start,this.end),o=e.end,s=e.startPos,i=e.endPos,r=e.startDelta;return r&&(this.scroll.minScrollY=r),i>this.scroll.maxScrollY&&(this.scroll.maxScrollY=-(i-this.scroll.scroller.scrollBehaviorY.wrapperSize)),{end:o,startPos:s,endPos:i}},Be.prototype.destroy=function(){for(var t=this.scroll.scroller,e=t.content,o=t.scrollBehaviorY;e.firstChild;)e.removeChild(e.firstChild);this.domManager.destroy(),this.scroll.off("scroll",this.update),this.scroll.off("destroy",this.destroy),o.hooks.off(o.hooks.eventTypes.computeBoundary)},Be.pluginName="infinity",Be);function Be(t){this.scroll=t,this.start=0,this.end=0,this.init()}var Ee=(De.prototype.handleHooks=function(){var t=this;this.hooksFn=[];function e(t,e){e.options.scrollable&&0<t.maxScrollPos&&(t.minScrollPos=e.wrapperSize-e.contentSize,t.maxScrollPos=0)}var o=this.scroll.scroller,s=o.scrollBehaviorX,i=o.scrollBehaviorY;this.registerHooks(s.hooks,s.hooks.eventTypes.computeBoundary,function(t){e(t,s)}),this.registerHooks(i.hooks,i.hooks.eventTypes.computeBoundary,function(t){e(t,i)}),this.registerHooks(this.scroll.hooks,this.scroll.hooks.eventTypes.destroy,function(){t.destroy()})},De.prototype.destroy=function(){this.hooksFn.forEach(function(t){var e=t[0],o=t[1],s=t[2];e.off(o,s)}),this.hooksFn.length=0},De.prototype.registerHooks=function(t,e,o){t.on(e,o,this),this.hooksFn.push([t,e,o])},De.pluginName="movable",De);function De(t){this.scroll=t,this.handleHooks()}Ht.use(zt).use(Ft).use(At).use(Kt).use($t).use(ie).use(le).use(pe).use(fe).use(Ye).use(Ee),t.Behavior=vt,t.CustomOptions=$,t.InfinityScroll=Ye,t.MouseWheel=zt,t.Movable=Ee,t.NestedScroll=fe,t.ObserveDom=Ft,t.PullDownRefresh=At,t.PullUpLoad=Kt,t.ScrollBar=$t,t.Slide=ie,t.Wheel=le,t.Zoom=pe,t.createBScroll=Ot,t.default=Ht,Object.defineProperty(t,"__esModule",{value:!0})});
|