@better-scroll/core
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,1 +0,1 @@ | ||
!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).BScroll={})}(this,function(t){"use strict";var i=function(t,e){return(i=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}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var c=function(){return(c=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};function p(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;for(var i=Array(t),s=0,e=0;e<o;e++)for(var n=arguments[e],r=0,h=n.length;r<h;r++,s++)i[s]=n[r];return i}var s=[{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 n(t){console.error("[BScroll warn]: "+t)}var r="undefined"!=typeof window,o=r&&navigator.userAgent.toLowerCase(),h=!(!o||!/wechatdevtools/.test(o)),a=o&&0<o.indexOf("android"),l=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 u(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var d=function(t,e){for(var o in e)t[o]=e[o];return t};function f(t){return null==t}var v=r&&document.createElement("div").style,y=function(){if(!r)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!==v[o.value])return o.key}return!1}();function m(t){return!1===y?t:"standard"===y?"transitionEnd"===t?"transitionend":t:y+t.charAt(0).toUpperCase()+t.substr(1)}function g(t){return"string"==typeof t?document.querySelector(t):t}function k(t,e,o,i){t.addEventListener(e,o,{passive:!1,capture:!!i})}function T(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}function b(t){for(var e=0,o=0;t;)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}y&&"standard"!==y&&y.toLowerCase();var P=m("transform"),S=m("transition"),w=r&&m("perspective")in v,E=r&&("ontouchstart"in window||h),B=r&&S in v,D={transform:P,transition:S,transitionTimingFunction:m("transitionTimingFunction"),transitionDuration:m("transitionDuration"),transitionDelay:m("transitionDelay"),transformOrigin:m("transformOrigin"),transitionEnd:m("transitionEnd"),transitionProperty:m("transitionProperty")},X={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function Y(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 x(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}var O=x;function M(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 i,s={};o&&(s.screenX=o.screenX||0,s.screenY=o.screenY||0,s.clientX=o.clientX||0,s.clientY=o.clientY||0);var n=!0,r=!0;if("undefined"!=typeof MouseEvent)try{i=new MouseEvent(e,d({bubbles:n,cancelable:r},s))}catch(t){h()}else h();function h(){(i=document.createEvent("Event")).initEvent(e,n,r),d(i,s)}i.forwardedTouchEvent=!0,i._constructed=!0,t.target.dispatchEvent(i)}var C={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}}},L=r&&window;function z(){}function A(t){}var F=r?L.requestAnimationFrame||L.webkitRequestAnimationFrame||L.mozRequestAnimationFrame||L.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||100/60)/2)}:z,H=r?L.cancelAnimationFrame||L.webkitCancelAnimationFrame||L.mozCancelAnimationFrame||L.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:z,K={enumerable:!0,configurable:!0,get:A,set:A};var R=(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,i,s){var n=this;void 0===s&&(s=this),this.hasType(o);var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];n.off(o,r),i.apply(s,t)};return r.fn=i,this.on(o,r),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 i=o.length;i--;)(o[i][0]===e||o[i][0]&&o[i][0].fn===e)&&o.splice(i,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 i=this.events[t];if(i)for(var s,n=i.length,r=p(i),h=0;h<n;h++){var a=r[h],c=a[0],l=a[1];if(c&&!0===(s=c.apply(l,e)))return s}},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||n('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 _=(I.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},I.prototype.addDOMEvents=function(){this.handleDOMEvents(k)},I.prototype.removeDOMEvents=function(){this.handleDOMEvents(T)},I.prototype.handleDOMEvents=function(e){var o=this,i=this.wrapper;this.events.forEach(function(t){e(i,t.name,o,!!t.capture)})},I.prototype.handleEvent=function(e){var o=e.type;this.events.some(function(t){return t.name===o&&(t.handler(e),!0)})},I);function I(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}function W(){}var N,q=(e(U,N=W),U.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},U.prototype.process=function(){return this.translateZ=this.HWCompositing&&w?" translateZ(1px)":"",this.useTransition=this.useTransition&&B,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},U.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))},U);function U(){var t=N.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 Z=(V.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=t.disableTouch,s=t.click,n=this.wrapper,r=e?n:window,h=[],a=[],c=!i,l=!o;s&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),c&&(h.push({name:"touchstart",handler:this.start.bind(this)}),a.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),l&&(h.push({name:"mousedown",handler:this.start.bind(this)}),a.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new _(n,h),this.targetEventRegister=new _(r,a)},V.prototype.beforeHandler=function(t,e){var o=this.options,i=o.preventDefault,s=o.stopPropagation,n=o.preventDefaultException;!{start:function(){return i&&!x(t.target,n)},end:function(){return i&&!x(t.target,n)},move:function(){return i}}[e]()||t.preventDefault(),s&&t.stopPropagation()},V.prototype.setInitiated=function(t){void 0===t&&(t=0),this.initiated=t},V.prototype.start=function(t){var e,o=X[t.type];this.initiated&&this.initiated!==o||(this.setInitiated(o),O(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)))},V.prototype.move=function(t){var e,o,i,s,n,r,h,a;X[t.type]===this.initiated&&(this.beforeHandler(t,"move"),o=(e=t.touches?t.touches[0]:t).pageX-this.pointX,i=e.pageY-this.pointY,this.pointX=e.pageX,this.pointY=e.pageY,this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:i,e:t})||(s=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,n=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,r=this.pointX-s,h=this.pointY-n,a=this.options.autoEndDistance,(r>document.documentElement.clientWidth-a||h>document.documentElement.clientHeight-a||r<a||h<a)&&this.end(t)))},V.prototype.end=function(t){X[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},V.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},V.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},V);function V(t,e){this.wrapper=t,this.options=e,this.hooks=new R(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}var $={x:["translateX","px"],y:["translateY","px"]},G=(J.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null)[D.transform].split(")")[0].split(", ");return{x:+(t[12]||t[4]),y:+(t[13]||t[5])}},J.prototype.translate=function(s){var n=[];Object.keys(s).forEach(function(t){var e,o,i;!$[t]||(e=$[t][0])&&(o=$[t][1],i=s[t],n.push(e+"("+i+o+")"))}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,n,s),this.style[D.transform]=n.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,s)},J.prototype.destroy=function(){this.hooks.destroy()},J);function J(t){this.content=t,this.style=t.style,this.hooks=new R(["beforeTranslate","translate"])}var Q=(tt.prototype.translate=function(t){this.translater.translate(t)},tt.prototype.setPending=function(t){this.pending=t},tt.prototype.setForceStopped=function(t){this.forceStopped=t},tt.prototype.destroy=function(){this.hooks.destroy(),H(this.timer)},tt);function tt(t,e,o){this.content=t,this.translater=e,this.options=o,this.timer=0,this.hooks=new R(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.style=t.style}var et,ot=(e(it,et=Q),it.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=F(o))};H(this.timer),o()},it.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[D.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},it.prototype.transitionTimingFunction=function(t){this.style[D.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},it.prototype.transitionProperty=function(){this.style[D.transitionProperty]=D.transform},it.prototype.move=function(t,e,o,i){this.setPending(0<o),this.transitionTimingFunction(i),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))},it.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),H(this.timer);var e=this.translater.getComputedPosition(),o=e.x,i=e.y;if(this.transitionTime(),this.translate({x:o,y:i}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:o,y:i}))return!0;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:o,y:i})}return t},it.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},it);function it(){return null!==et&&et.apply(this,arguments)||this}var st,nt=(e(rt,st=Q),rt.prototype.move=function(t,e,o,i){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,i)},rt.prototype.animate=function(n,r,e,o){var h=this,a=u(),c=a+e,l=function(){var t=u();if(c<=t)return h.translate(r),h.hooks.trigger(h.hooks.eventTypes.move,r),void h.hooks.trigger(h.hooks.eventTypes.end,r);var i=o((t-a)/e),s={};Object.keys(r).forEach(function(t){var e=n[t],o=r[t];s[t]=(o-e)*i+e}),h.translate(s),3===h.options.probeType&&h.hooks.trigger(h.hooks.eventTypes.move,s),h.pending&&(h.timer=F(l)),h.pending||h.forceStopped||(console.log(h.forceStopped),h.hooks.trigger(h.hooks.eventTypes.end,r))};this.setPending(!0),H(this.timer),l()},rt.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),H(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},rt.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},rt);function rt(){return null!==st&&st.apply(this,arguments)||this}var ht,at,ct,lt,pt=(ut.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},ut.prototype.move=function(t){return t=this.hasScroll?t:0,this.setMovingDirection(t),this.performDampingAlgorithm(t,this.options.outOfBoundaryDampingFactor)},ut.prototype.setMovingDirection=function(t){this.movingDirection=0<t?-1:t<0?1:0},ut.prototype.setDirection=function(t){this.direction=0<t?-1:t<0?1:0},ut.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},ut.prototype.end=function(t){var e,o={duration:0},i=Math.abs(this.currentPos-this.startPos);return this.options.momentum&&t<this.options.momentumLimitTime&&i>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},ut.prototype.momentum=function(t,e,o,i,s,n,r){void 0===r&&(r=this.options);var h=t-e,a=Math.abs(h)/o,c=r.deceleration,l=r.swipeBounceTime,p={destination:t+a/c*(h<0?-1:1),duration:r.swipeTime,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,p,h),p.destination<i?(p.destination=n?Math.max(i-n/4,i-n/p.rate*a):i,p.duration=l):p.destination>s&&(p.destination=n?Math.min(s+n/4,s+n/p.rate*a):s,p.duration=l),p.destination=Math.round(p.destination),p},ut.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.setDirection(t)},ut.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=Y(this.wrapper);this.wrapperSize=s[e];var n=Y(this.content);this.contentSize=n[e],this.relativeOffset=n[o],i&&(this.relativeOffset-=s[o]),this.computeBoundary(),this.setDirection(0)},ut.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)},ut.prototype.updatePosition=function(t){this.currentPos=t},ut.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},ut.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos);return{position:t,inBoundary:t===this.getCurrentPos()}},ut.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},ut.prototype.updateStartPos=function(){this.startPos=this.currentPos},ut.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},ut.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},ut.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},ut.prototype.destroy=function(){this.hooks.destroy()},ut);function ut(t,e){this.wrapper=t,this.options=e,this.hooks=new R(["beforeComputeBoundary","computeBoundary","momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0,this.refresh()}var dt=((ht={}).yes=function(t){return!0},ht.no=function(t){return t.preventDefault(),!1},ht),ft=((at={}).horizontal=((ct={}).yes="horizontal",ct.no="vertical",ct),at.vertical=((lt={}).yes="vertical",lt.no="horizontal",lt),at),vt=(yt.prototype.reset=function(){this.directionLocked=""},yt.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},yt.prototype.adjustDelta=function(t,e){return"horizontal"===this.directionLocked?e=0:"vertical"===this.directionLocked&&(t=0),{deltaX:t,deltaY:e}},yt.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")},yt.prototype.handleEventPassthrough=function(t){var e=ft[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return dt.yes(t);if(this.eventPassthrough===e.no)return dt.no(t)}return!1},yt);function yt(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var mt=(gt.prototype.bindActionsHandler=function(){var s=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(t){return!s.enabled||s.handleStart(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(t){var e=t.deltaX,o=t.deltaY,i=t.e;return!s.enabled||s.handleMove(e,o,i)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(t){return!s.enabled||s.handleEnd(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(t){s.enabled&&!t._constructed&&s.handleClick(t)})},gt.prototype.handleStart=function(t){var e=u();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)},gt.prototype.handleMove=function(t,e,o){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,o)){var i=this.scrollBehaviorX.getAbsDist(t),s=this.scrollBehaviorY.getAbsDist(e),n=u();if(this.checkMomentum(i,s,n))return!0;if(this.directionLockAction.checkMovingDirection(i,s,o))return this.actionsHandler.setInitiated(),!0;var r=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.move(r.deltaX),a=this.scrollBehaviorY.move(r.deltaY);this.moved||(this.moved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.animater.translate({x:h,y:a}),this.dispatchScroll(n)}},gt.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())},gt.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},gt.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=u();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},gt.prototype.handleClick=function(t){x(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},gt.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},gt.prototype.refresh=function(){this.endTime=0},gt.prototype.destroy=function(){this.hooks.destroy()},gt);function gt(t,e,o,i,s){this.hooks=new R(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=o,this.animater=i,this.options=s,this.directionLockAction=new vt(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}function kt(o,t,e,i){var s=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor"].reduce(function(t,e){return t[e]=o[e],t},{});return s.scrollable=!!o[t],s.bounces=e,s.rect=i,s}function Tt(i,s,t){t.forEach(function(t){var e,o;"string"==typeof t?e=o=t:(e=t.source,o=t.target),i.on(e,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return s.trigger.apply(s,p([o],t))})})}var bt=(Pt.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},Pt.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)})},Pt.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))}),Tt(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}])},Pt.prototype.bindActions=function(){var s=this,n=this.actions;Tt(n.hooks,this.hooks,[{source:n.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:n.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:n.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:n.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:n.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:n.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),n.hooks.on(n.hooks.eventTypes.end,function(t,e){return s.hooks.trigger(s.hooks.eventTypes.touchEnd,e),!!s.hooks.trigger(s.hooks.eventTypes.end,e)||(!n.moved&&s.checkClick(t)?(s.hooks.trigger(s.hooks.eventTypes.scrollCancel),!0):s.resetPosition(s.options.bounceTime,C.bounce)?(s.animater.setForceStopped(!1),!0):void 0)}),n.hooks.on(n.hooks.eventTypes.scrollEnd,function(t,e){var o=Math.abs(t.x-s.scrollBehaviorX.startPos),i=Math.abs(t.y-s.scrollBehaviorY.startPos);s.checkFlick(e,o,i)?s.hooks.trigger(s.hooks.eventTypes.flick):s.momentum(t,e)||(!s.animater.forceStopped||n.moved?s.hooks.trigger(s.hooks.eventTypes.scrollEnd,t):s.animater.setForceStopped(!1))})},Pt.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},Pt.prototype.momentum=function(t,e){var o={time:0,easing:C.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=f(i.destination)?o.newX:i.destination,o.newY=f(s.destination)?o.newY:s.destination,o.time=Math.max(i.duration,s.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=C.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},Pt.prototype.checkClick=function(t){var e,o,i,s=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return this.animater.setForceStopped(!1),!0;if(s)return!1;var n,r,h=this.options.dblclick,a=!1;return h&&this.lastClickTime&&(r=void 0===(n=h.delay)?300:n,u()-this.lastClickTime<r&&(a=!0,M(t,"dblclick"))),this.options.tap&&(e=t,o=this.options.tap,(i=document.createEvent("Event")).initEvent(o,!0,!0),i.pageX=e.pageX,i.pageY=e.pageY,e.target.dispatchEvent(i)),this.options.click&&!x(t.target,this.options.preventDefaultException)&&M(t),this.lastClickTime=a?null:u(),!0},Pt.prototype.resize=function(){var t=this;this.actions.enabled&&(a&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.hooks.trigger(t.hooks.eventTypes.resize)},this.options.resizePolling))},Pt.prototype.transitionEnd=function(t){t.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,C.bounce)||(this.animater.setPending(!1),3!==this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},Pt.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",i=0;i<e.length;i++){var s=e[i];s.isBScrollContainer||(s.style.pointerEvents=o)}},Pt.prototype.refresh=function(){this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=b(this.wrapper)},Pt.prototype.scrollBy=function(t,e,o,i){void 0===o&&(o=0);var s=this.getCurrentPos(),n=s.x,r=s.y;i=i||C.bounce,t+=n,e+=r,this.scrollTo(t,e,o,i)},Pt.prototype.scrollTo=function(t,e,o,i,s){void 0===o&&(o=0),void 0===i&&(i=C.bounce),void 0===s&&(s={start:{},end:{}});var n=this.options.useTransition?i.style:i.fn,r=this.getCurrentPos(),h=c({x:r.x,y:r.y},s.start),a=c({x:t,y:e},s.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,a),function(t,e){for(var o=0,i=Object.keys(t);o<i.length;o++){var s=i[o];if(t[s]!==e[s])return}return 1}(h,a)||this.animater.move(h,a,o,n)},Pt.prototype.scrollToElement=function(t,e,o,i,s){function n(t,e,o){return"number"==typeof t?t:t?Math.round(e/2-o/2):0}var r=g(t),h=b(r);o=n(o,r.offsetWidth,this.wrapper.offsetWidth),i=n(i,r.offsetHeight,this.wrapper.offsetHeight);function a(t,e,o,i){return t-=e,t=i.adjustPosition(t-o)}h.left=a(h.left,this.wrapperOffset.left,o,this.scrollBehaviorX),h.top=a(h.top,this.wrapperOffset.top,i,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,r,h)||this.scrollTo(h.left,h.top,e,s)},Pt.prototype.resetPosition=function(t,e){void 0===t&&(t=0),void 0===e&&(e=C.bounce);var o=this.scrollBehaviorX.checkInBoundary(),i=o.position,s=o.inBoundary,n=this.scrollBehaviorY.checkInBoundary(),r=n.position,h=n.inBoundary;return(!s||!h)&&(l&&(this._reflow=this.content.offsetHeight),this.scrollTo(i,r,t,e),!0)},Pt.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},Pt.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},Pt.prototype.enable=function(){this.actions.enabled=!0},Pt.prototype.disable=function(){H(this.animater.timer),this.actions.enabled=!1},Pt.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},Pt);function Pt(t,e){this.resizeTimeout=0,this.hooks=new R(["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,i,s,n,r,h,a=this.options.bounce,c=a.left,l=void 0===c||c,p=a.right,u=void 0===p||p,d=a.top,f=void 0===d||d,v=a.bottom,y=void 0===v||v;this.scrollBehaviorX=new pt(t,kt(e,"scrollX",[l,u],{size:"width",position:"left"})),this.scrollBehaviorY=new pt(t,kt(e,"scrollY",[f,y],{size:"height",position:"top"})),this.translater=new G(this.content),this.animater=(o=this.content,i=this.translater,s=this.options,n=s.useTransition,r={},Object.defineProperty(r,"probeType",{enumerable:!0,configurable:!1,get:function(){return s.probeType}}),new(n?ot:nt)(o,i,r)),this.actionsHandler=new Z(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 mt(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var m=this.resize.bind(this);this.resizeRegister=new _(window,[{name:"orientationchange",handler:m},{name:"resize",handler:m}]),this.transitionEndRegister=new _(this.content,[{name:D.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}var St,wt=(e(Et,St=R),Et.use=function(e){var t=e.pluginName;return Et.plugins.some(function(t){return e===t.ctor})||(f(t)?n("Plugin Class must specify plugin's name in static property by 'pluginName' field."):Et.pluginsMap[t]?n("This plugin has been registered, maybe you need change plugin's name"):(Et.pluginsMap[t]=!0,Et.plugins.push({name:t,applyOrder:e.applyOrder,ctor:e}))),Et},Et.prototype.init=function(t){var e=this;(this.wrapper=t).isBScrollContainer=!0,this.scroller=new bt(t,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,function(){e.refresh()}),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(s),this.applyPlugins(),this.refreshWithoutReset();var o=this.options,i={x:o.startX,y:o.startY};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,i)||this.scroller.scrollTo(i.x,i.y)},Et.prototype.applyPlugins=function(){var o=this,i=this.options;Et.plugins.sort(function(t,e){var o,i=((o={}).pre=-1,o.post=1,o);return(t.applyOrder?i[t.applyOrder]:0)-(e.applyOrder?i[e.applyOrder]:0)}).forEach(function(t){var e=t.ctor;i[t.name]&&"function"==typeof e&&(o.plugins[t.name]=new e(o))})},Et.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()})},Et.prototype.eventBubbling=function(){Tt(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])},Et.prototype.refreshWithoutReset=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},Et.prototype.proxy=function(t){var r=this;t.forEach(function(t){var e,o,i,s=t.key,n=t.sourceKey;e=r,o=n,i=s,K.get=function(){return function(t,e){for(var o=e.split("."),i=0;i<o.length-1;i++)if("object"!=typeof(t=t[o[i]])||!t)return;var s=o.pop();return"function"==typeof t[s]?function(){return t[s].apply(t,arguments)}:t[s]}(this,o)},K.set=function(t){!function(t,e,o){for(var i,s=e.split("."),n=0;n<s.length-1;n++)t[i=s[n]]||(t[i]={}),t=t[i];t[s.pop()]=o}(this,o,t)},Object.defineProperty(e,i,K)})},Et.prototype.refresh=function(){this.refreshWithoutReset(),this.scroller.resetPosition()},Et.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},Et.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},Et.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},Et.prototype.eventRegister=function(t){this.registerType(t)},Et.plugins=[],Et.pluginsMap={},Et);function Et(t,e){var o=St.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=g(t);return i?i.children[0]?(o.plugins={},o.options=(new q).merge(e).process(),o.hooks=new R(["refresh","enable","disable","destroy","beforeInitialScrollTo"]),o.init(i)):n("The wrapper need at least one child element to be scroller."):n("Can not resolve the wrapper DOM."),o}function Bt(t,e){return new wt(t,e)}Bt.use=wt.use,Bt.plugins=wt.plugins,Bt.pluginsMap=wt.pluginsMap;var Dt=Bt;t.Behavior=pt,t.CustomOptions=W,t.createBScroll=Bt,t.default=Dt,Object.defineProperty(t,"__esModule",{value:!0})}),"undefined"!=typeof window&&window.BScroll&&(window.BScroll=window.BScroll.default); | ||
!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).BScroll={})}(this,function(t){"use strict";var i=function(t,e){return(i=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}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var c=function(){return(c=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};function p(){for(var t=0,e=0,o=arguments.length;e<o;e++)t+=arguments[e].length;for(var i=Array(t),s=0,e=0;e<o;e++)for(var n=arguments[e],r=0,h=n.length;r<h;r++,s++)i[s]=n[r];return i}var s=[{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 n(t){console.error("[BScroll warn]: "+t)}var r="undefined"!=typeof window,o=r&&navigator.userAgent.toLowerCase(),h=!(!o||!/wechatdevtools/.test(o)),a=o&&0<o.indexOf("android"),l=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 u(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}var d=function(t,e){for(var o in e)t[o]=e[o];return t};function f(t){return null==t}var v=r&&document.createElement("div").style,y=function(){if(!r)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!==v[o.value])return o.key}return!1}();function m(t){return!1===y?t:"standard"===y?"transitionEnd"===t?"transitionend":t:y+t.charAt(0).toUpperCase()+t.substr(1)}function g(t){return"string"==typeof t?document.querySelector(t):t}function k(t,e,o,i){t.addEventListener(e,o,{passive:!1,capture:!!i})}function T(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}function b(t){for(var e=0,o=0;t;)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}y&&"standard"!==y&&y.toLowerCase();var P=m("transform"),S=m("transition"),w=r&&m("perspective")in v,E=r&&("ontouchstart"in window||h),B=r&&S in v,D={transform:P,transition:S,transitionTimingFunction:m("transitionTimingFunction"),transitionDuration:m("transitionDuration"),transitionDelay:m("transitionDelay"),transformOrigin:m("transformOrigin"),transitionEnd:m("transitionEnd"),transitionProperty:m("transitionProperty")},X={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function Y(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 x(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}var O=x;function M(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 i,s={};o&&(s.screenX=o.screenX||0,s.screenY=o.screenY||0,s.clientX=o.clientX||0,s.clientY=o.clientY||0);var n=!0,r=!0;if("undefined"!=typeof MouseEvent)try{i=new MouseEvent(e,d({bubbles:n,cancelable:r},s))}catch(t){h()}else h();function h(){(i=document.createEvent("Event")).initEvent(e,n,r),d(i,s)}i.forwardedTouchEvent=!0,i._constructed=!0,t.target.dispatchEvent(i)}var C={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}}},L=r&&window;function z(){}function A(t){}var F=r?L.requestAnimationFrame||L.webkitRequestAnimationFrame||L.mozRequestAnimationFrame||L.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||100/60)/2)}:z,H=r?L.cancelAnimationFrame||L.webkitCancelAnimationFrame||L.mozCancelAnimationFrame||L.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:z,K={enumerable:!0,configurable:!0,get:A,set:A};var R=(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,i,s){var n=this;void 0===s&&(s=this),this.hasType(o);var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];n.off(o,r),i.apply(s,t)};return r.fn=i,this.on(o,r),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 i=o.length;i--;)(o[i][0]===e||o[i][0]&&o[i][0].fn===e)&&o.splice(i,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 i=this.events[t];if(i)for(var s,n=i.length,r=p(i),h=0;h<n;h++){var a=r[h],c=a[0],l=a[1];if(c&&!0===(s=c.apply(l,e)))return s}},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||n('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 _=(I.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},I.prototype.addDOMEvents=function(){this.handleDOMEvents(k)},I.prototype.removeDOMEvents=function(){this.handleDOMEvents(T)},I.prototype.handleDOMEvents=function(e){var o=this,i=this.wrapper;this.events.forEach(function(t){e(i,t.name,o,!!t.capture)})},I.prototype.handleEvent=function(e){var o=e.type;this.events.some(function(t){return t.name===o&&(t.handler(e),!0)})},I);function I(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}function W(){}var N,q=(e(U,N=W),U.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},U.prototype.process=function(){return this.translateZ=this.HWCompositing&&w?" translateZ(1px)":"",this.useTransition=this.useTransition&&B,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},U.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))},U);function U(){var t=N.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 Z=(V.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=t.disableTouch,s=t.click,n=this.wrapper,r=e?n:window,h=[],a=[],c=!i,l=!o;s&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),c&&(h.push({name:"touchstart",handler:this.start.bind(this)}),a.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),l&&(h.push({name:"mousedown",handler:this.start.bind(this)}),a.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new _(n,h),this.targetEventRegister=new _(r,a)},V.prototype.beforeHandler=function(t,e){var o=this.options,i=o.preventDefault,s=o.stopPropagation,n=o.preventDefaultException;!{start:function(){return i&&!x(t.target,n)},end:function(){return i&&!x(t.target,n)},move:function(){return i}}[e]()||t.preventDefault(),s&&t.stopPropagation()},V.prototype.setInitiated=function(t){void 0===t&&(t=0),this.initiated=t},V.prototype.start=function(t){var e,o=X[t.type];this.initiated&&this.initiated!==o||(this.setInitiated(o),O(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)))},V.prototype.move=function(t){var e,o,i,s,n,r,h,a;X[t.type]===this.initiated&&(this.beforeHandler(t,"move"),o=(e=t.touches?t.touches[0]:t).pageX-this.pointX,i=e.pageY-this.pointY,this.pointX=e.pageX,this.pointY=e.pageY,this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:i,e:t})||(s=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,n=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,r=this.pointX-s,h=this.pointY-n,a=this.options.autoEndDistance,(r>document.documentElement.clientWidth-a||h>document.documentElement.clientHeight-a||r<a||h<a)&&this.end(t)))},V.prototype.end=function(t){X[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},V.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},V.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},V);function V(t,e){this.wrapper=t,this.options=e,this.hooks=new R(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}var $={x:["translateX","px"],y:["translateY","px"]},G=(J.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null)[D.transform].split(")")[0].split(", ");return{x:+(t[12]||t[4]),y:+(t[13]||t[5])}},J.prototype.translate=function(s){var n=[];Object.keys(s).forEach(function(t){var e,o,i;!$[t]||(e=$[t][0])&&(o=$[t][1],i=s[t],n.push(e+"("+i+o+")"))}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,n,s),this.style[D.transform]=n.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,s)},J.prototype.destroy=function(){this.hooks.destroy()},J);function J(t){this.content=t,this.style=t.style,this.hooks=new R(["beforeTranslate","translate"])}var Q=(tt.prototype.translate=function(t){this.translater.translate(t)},tt.prototype.setPending=function(t){this.pending=t},tt.prototype.setForceStopped=function(t){this.forceStopped=t},tt.prototype.destroy=function(){this.hooks.destroy(),H(this.timer)},tt);function tt(t,e,o){this.content=t,this.translater=e,this.options=o,this.timer=0,this.hooks=new R(["move","end","beforeForceStop","forceStop","callStop","time","timeFunction"]),this.style=t.style}var et,ot=(e(it,et=Q),it.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=F(o))};H(this.timer),o()},it.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[D.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},it.prototype.transitionTimingFunction=function(t){this.style[D.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},it.prototype.transitionProperty=function(){this.style[D.transitionProperty]=D.transform},it.prototype.move=function(t,e,o,i){this.setPending(0<o),this.transitionTimingFunction(i),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))},it.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),H(this.timer);var e=this.translater.getComputedPosition(),o=e.x,i=e.y;if(this.transitionTime(),this.translate({x:o,y:i}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:o,y:i}))return!0;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:o,y:i})}return t},it.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},it);function it(){return null!==et&&et.apply(this,arguments)||this}var st,nt=(e(rt,st=Q),rt.prototype.move=function(t,e,o,i){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,i)},rt.prototype.animate=function(n,r,e,o){var h=this,a=u(),c=a+e,l=function(){var t=u();if(c<=t)return h.translate(r),h.hooks.trigger(h.hooks.eventTypes.move,r),void h.hooks.trigger(h.hooks.eventTypes.end,r);var i=o((t-a)/e),s={};Object.keys(r).forEach(function(t){var e=n[t],o=r[t];s[t]=(o-e)*i+e}),h.translate(s),3===h.options.probeType&&h.hooks.trigger(h.hooks.eventTypes.move,s),h.pending&&(h.timer=F(l)),h.pending||h.forceStopped||h.hooks.trigger(h.hooks.eventTypes.end,r)};this.setPending(!0),H(this.timer),l()},rt.prototype.doStop=function(){var t=this.pending;if(this.setForceStopped(!1),t){this.setPending(!1),H(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},rt.prototype.stop=function(){this.doStop()&&this.hooks.trigger(this.hooks.eventTypes.callStop)},rt);function rt(){return null!==st&&st.apply(this,arguments)||this}var ht,at,ct,lt,pt=(ut.prototype.start=function(){this.dist=0,this.setMovingDirection(0),this.setDirection(0)},ut.prototype.move=function(t){return t=this.hasScroll?t:0,this.setMovingDirection(t),this.performDampingAlgorithm(t,this.options.outOfBoundaryDampingFactor)},ut.prototype.setMovingDirection=function(t){this.movingDirection=0<t?-1:t<0?1:0},ut.prototype.setDirection=function(t){this.direction=0<t?-1:t<0?1:0},ut.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},ut.prototype.end=function(t){var e,o={duration:0},i=Math.abs(this.currentPos-this.startPos);return this.options.momentum&&t<this.options.momentumLimitTime&&i>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},ut.prototype.momentum=function(t,e,o,i,s,n,r){void 0===r&&(r=this.options);var h=t-e,a=Math.abs(h)/o,c=r.deceleration,l=r.swipeBounceTime,p={destination:t+a/c*(h<0?-1:1),duration:r.swipeTime,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,p,h),p.destination<i?(p.destination=n?Math.max(i-n/4,i-n/p.rate*a):i,p.duration=l):p.destination>s&&(p.destination=n?Math.min(s+n/4,s+n/p.rate*a):s,p.duration=l),p.destination=Math.round(p.destination),p},ut.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.setDirection(t)},ut.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=Y(this.wrapper);this.wrapperSize=s[e];var n=Y(this.content);this.contentSize=n[e],this.relativeOffset=n[o],i&&(this.relativeOffset-=s[o]),this.computeBoundary(),this.setDirection(0)},ut.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)},ut.prototype.updatePosition=function(t){this.currentPos=t},ut.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},ut.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos);return{position:t,inBoundary:t===this.getCurrentPos()}},ut.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},ut.prototype.updateStartPos=function(){this.startPos=this.currentPos},ut.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},ut.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},ut.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},ut.prototype.destroy=function(){this.hooks.destroy()},ut);function ut(t,e){this.wrapper=t,this.options=e,this.hooks=new R(["beforeComputeBoundary","computeBoundary","momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0,this.refresh()}var dt=((ht={}).yes=function(t){return!0},ht.no=function(t){return t.preventDefault(),!1},ht),ft=((at={}).horizontal=((ct={}).yes="horizontal",ct.no="vertical",ct),at.vertical=((lt={}).yes="vertical",lt.no="horizontal",lt),at),vt=(yt.prototype.reset=function(){this.directionLocked=""},yt.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},yt.prototype.adjustDelta=function(t,e){return"horizontal"===this.directionLocked?e=0:"vertical"===this.directionLocked&&(t=0),{deltaX:t,deltaY:e}},yt.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")},yt.prototype.handleEventPassthrough=function(t){var e=ft[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return dt.yes(t);if(this.eventPassthrough===e.no)return dt.no(t)}return!1},yt);function yt(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var mt=(gt.prototype.bindActionsHandler=function(){var s=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(t){return!s.enabled||s.handleStart(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(t){var e=t.deltaX,o=t.deltaY,i=t.e;return!s.enabled||s.handleMove(e,o,i)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(t){return!s.enabled||s.handleEnd(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(t){s.enabled&&!t._constructed&&s.handleClick(t)})},gt.prototype.handleStart=function(t){var e=u();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)},gt.prototype.handleMove=function(t,e,o){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,o)){var i=this.scrollBehaviorX.getAbsDist(t),s=this.scrollBehaviorY.getAbsDist(e),n=u();if(this.checkMomentum(i,s,n))return!0;if(this.directionLockAction.checkMovingDirection(i,s,o))return this.actionsHandler.setInitiated(),!0;var r=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.move(r.deltaX),a=this.scrollBehaviorY.move(r.deltaY);this.moved||(this.moved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.animater.translate({x:h,y:a}),this.dispatchScroll(n)}},gt.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())},gt.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},gt.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=u();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},gt.prototype.handleClick=function(t){x(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},gt.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},gt.prototype.refresh=function(){this.endTime=0},gt.prototype.destroy=function(){this.hooks.destroy()},gt);function gt(t,e,o,i,s){this.hooks=new R(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=o,this.animater=i,this.options=s,this.directionLockAction=new vt(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}function kt(o,t,e,i){var s=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime","outOfBoundaryDampingFactor"].reduce(function(t,e){return t[e]=o[e],t},{});return s.scrollable=!!o[t],s.bounces=e,s.rect=i,s}function Tt(i,s,t){t.forEach(function(t){var e,o;"string"==typeof t?e=o=t:(e=t.source,o=t.target),i.on(e,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return s.trigger.apply(s,p([o],t))})})}var bt=(Pt.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},Pt.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)})},Pt.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))}),Tt(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}])},Pt.prototype.bindActions=function(){var s=this,n=this.actions;Tt(n.hooks,this.hooks,[{source:n.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:n.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:n.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:n.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:n.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:n.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),n.hooks.on(n.hooks.eventTypes.end,function(t,e){return s.hooks.trigger(s.hooks.eventTypes.touchEnd,e),!!s.hooks.trigger(s.hooks.eventTypes.end,e)||(!n.moved&&s.checkClick(t)?(s.hooks.trigger(s.hooks.eventTypes.scrollCancel),!0):s.resetPosition(s.options.bounceTime,C.bounce)?(s.animater.setForceStopped(!1),!0):void 0)}),n.hooks.on(n.hooks.eventTypes.scrollEnd,function(t,e){var o=Math.abs(t.x-s.scrollBehaviorX.startPos),i=Math.abs(t.y-s.scrollBehaviorY.startPos);s.checkFlick(e,o,i)?s.hooks.trigger(s.hooks.eventTypes.flick):s.momentum(t,e)||(!s.animater.forceStopped||n.moved?s.hooks.trigger(s.hooks.eventTypes.scrollEnd,t):s.animater.setForceStopped(!1))})},Pt.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},Pt.prototype.momentum=function(t,e){var o={time:0,easing:C.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=f(i.destination)?o.newX:i.destination,o.newY=f(s.destination)?o.newY:s.destination,o.time=Math.max(i.duration,s.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=C.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},Pt.prototype.checkClick=function(t){var e,o,i,s=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return this.animater.setForceStopped(!1),!0;if(s)return!1;var n,r,h=this.options.dblclick,a=!1;return h&&this.lastClickTime&&(r=void 0===(n=h.delay)?300:n,u()-this.lastClickTime<r&&(a=!0,M(t,"dblclick"))),this.options.tap&&(e=t,o=this.options.tap,(i=document.createEvent("Event")).initEvent(o,!0,!0),i.pageX=e.pageX,i.pageY=e.pageY,e.target.dispatchEvent(i)),this.options.click&&!x(t.target,this.options.preventDefaultException)&&M(t),this.lastClickTime=a?null:u(),!0},Pt.prototype.resize=function(){var t=this;this.actions.enabled&&(a&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.hooks.trigger(t.hooks.eventTypes.resize)},this.options.resizePolling))},Pt.prototype.transitionEnd=function(t){t.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,C.bounce)||(this.animater.setPending(!1),3!==this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},Pt.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",i=0;i<e.length;i++){var s=e[i];s.isBScrollContainer||(s.style.pointerEvents=o)}},Pt.prototype.refresh=function(){this.hooks.trigger(this.hooks.eventTypes.beforeRefresh),this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=b(this.wrapper)},Pt.prototype.scrollBy=function(t,e,o,i){void 0===o&&(o=0);var s=this.getCurrentPos(),n=s.x,r=s.y;i=i||C.bounce,t+=n,e+=r,this.scrollTo(t,e,o,i)},Pt.prototype.scrollTo=function(t,e,o,i,s){void 0===o&&(o=0),void 0===i&&(i=C.bounce),void 0===s&&(s={start:{},end:{}});var n=this.options.useTransition?i.style:i.fn,r=this.getCurrentPos(),h=c({x:r.x,y:r.y},s.start),a=c({x:t,y:e},s.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,a),function(t,e){for(var o=0,i=Object.keys(t);o<i.length;o++){var s=i[o];if(t[s]!==e[s])return}return 1}(h,a)||this.animater.move(h,a,o,n)},Pt.prototype.scrollToElement=function(t,e,o,i,s){function n(t,e,o){return"number"==typeof t?t:t?Math.round(e/2-o/2):0}var r=g(t),h=b(r);o=n(o,r.offsetWidth,this.wrapper.offsetWidth),i=n(i,r.offsetHeight,this.wrapper.offsetHeight);function a(t,e,o,i){return t-=e,t=i.adjustPosition(t-o)}h.left=a(h.left,this.wrapperOffset.left,o,this.scrollBehaviorX),h.top=a(h.top,this.wrapperOffset.top,i,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,r,h)||this.scrollTo(h.left,h.top,e,s)},Pt.prototype.resetPosition=function(t,e){void 0===t&&(t=0),void 0===e&&(e=C.bounce);var o=this.scrollBehaviorX.checkInBoundary(),i=o.position,s=o.inBoundary,n=this.scrollBehaviorY.checkInBoundary(),r=n.position,h=n.inBoundary;return(!s||!h)&&(l&&(this._reflow=this.content.offsetHeight),this.scrollTo(i,r,t,e),!0)},Pt.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},Pt.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},Pt.prototype.enable=function(){this.actions.enabled=!0},Pt.prototype.disable=function(){H(this.animater.timer),this.actions.enabled=!1},Pt.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},Pt);function Pt(t,e){this.resizeTimeout=0,this.hooks=new R(["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,i,s,n,r,h,a=this.options.bounce,c=a.left,l=void 0===c||c,p=a.right,u=void 0===p||p,d=a.top,f=void 0===d||d,v=a.bottom,y=void 0===v||v;this.scrollBehaviorX=new pt(t,kt(e,"scrollX",[l,u],{size:"width",position:"left"})),this.scrollBehaviorY=new pt(t,kt(e,"scrollY",[f,y],{size:"height",position:"top"})),this.translater=new G(this.content),this.animater=(o=this.content,i=this.translater,s=this.options,n=s.useTransition,r={},Object.defineProperty(r,"probeType",{enumerable:!0,configurable:!1,get:function(){return s.probeType}}),new(n?ot:nt)(o,i,r)),this.actionsHandler=new Z(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 mt(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var m=this.resize.bind(this);this.resizeRegister=new _(window,[{name:"orientationchange",handler:m},{name:"resize",handler:m}]),this.transitionEndRegister=new _(this.content,[{name:D.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}var St,wt=(e(Et,St=R),Et.use=function(e){var t=e.pluginName;return Et.plugins.some(function(t){return e===t.ctor})||(f(t)?n("Plugin Class must specify plugin's name in static property by 'pluginName' field."):Et.pluginsMap[t]?n("This plugin has been registered, maybe you need change plugin's name"):(Et.pluginsMap[t]=!0,Et.plugins.push({name:t,applyOrder:e.applyOrder,ctor:e}))),Et},Et.prototype.init=function(t){var e=this;(this.wrapper=t).isBScrollContainer=!0,this.scroller=new bt(t,this.options),this.scroller.hooks.on(this.scroller.hooks.eventTypes.resize,function(){e.refresh()}),this.eventBubbling(),this.handleAutoBlur(),this.enable(),this.proxy(s),this.applyPlugins(),this.refreshWithoutReset();var o=this.options,i={x:o.startX,y:o.startY};this.hooks.trigger(this.hooks.eventTypes.beforeInitialScrollTo,i)||this.scroller.scrollTo(i.x,i.y)},Et.prototype.applyPlugins=function(){var o=this,i=this.options;Et.plugins.sort(function(t,e){var o,i=((o={}).pre=-1,o.post=1,o);return(t.applyOrder?i[t.applyOrder]:0)-(e.applyOrder?i[e.applyOrder]:0)}).forEach(function(t){var e=t.ctor;i[t.name]&&"function"==typeof e&&(o.plugins[t.name]=new e(o))})},Et.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()})},Et.prototype.eventBubbling=function(){Tt(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])},Et.prototype.refreshWithoutReset=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},Et.prototype.proxy=function(t){var r=this;t.forEach(function(t){var e,o,i,s=t.key,n=t.sourceKey;e=r,o=n,i=s,K.get=function(){return function(t,e){for(var o=e.split("."),i=0;i<o.length-1;i++)if("object"!=typeof(t=t[o[i]])||!t)return;var s=o.pop();return"function"==typeof t[s]?function(){return t[s].apply(t,arguments)}:t[s]}(this,o)},K.set=function(t){!function(t,e,o){for(var i,s=e.split("."),n=0;n<s.length-1;n++)t[i=s[n]]||(t[i]={}),t=t[i];t[s.pop()]=o}(this,o,t)},Object.defineProperty(e,i,K)})},Et.prototype.refresh=function(){this.refreshWithoutReset(),this.scroller.resetPosition()},Et.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},Et.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},Et.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},Et.prototype.eventRegister=function(t){this.registerType(t)},Et.plugins=[],Et.pluginsMap={},Et);function Et(t,e){var o=St.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=g(t);return i?i.children[0]?(o.plugins={},o.options=(new q).merge(e).process(),o.hooks=new R(["refresh","enable","disable","destroy","beforeInitialScrollTo"]),o.init(i)):n("The wrapper need at least one child element to be scroller."):n("Can not resolve the wrapper DOM."),o}function Bt(t,e){return new wt(t,e)}Bt.use=wt.use,Bt.plugins=wt.plugins,Bt.pluginsMap=wt.pluginsMap;var Dt=Bt;t.Behavior=pt,t.CustomOptions=W,t.createBScroll=Bt,t.default=Dt,Object.defineProperty(t,"__esModule",{value:!0})}),"undefined"!=typeof window&&window.BScroll&&(window.BScroll=window.BScroll.default); |
{ | ||
"name": "@better-scroll/core", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny", | ||
@@ -34,5 +34,5 @@ "author": { | ||
"dependencies": { | ||
"@better-scroll/shared-utils": "^2.0.1" | ||
"@better-scroll/shared-utils": "^2.0.2" | ||
}, | ||
"gitHead": "42b020dc47403cc0a2a7143d60e47b4a63b4d157" | ||
"gitHead": "ddaa875797f975b69e58bc66c65735e14b5a46a3" | ||
} |
@@ -8,3 +8,3 @@ import Base from './Base' | ||
EaseFn, | ||
Probe | ||
Probe, | ||
} from '@better-scroll/shared-utils' | ||
@@ -52,3 +52,3 @@ | ||
const newPoint = {} as TranslaterPoint | ||
Object.keys(endPoint).forEach(key => { | ||
Object.keys(endPoint).forEach((key) => { | ||
const startValue = startPoint[key] | ||
@@ -71,3 +71,2 @@ const endValue = endPoint[key] | ||
if (!this.pending && !this.forceStopped) { | ||
console.log(this.forceStopped) | ||
this.hooks.trigger(this.hooks.eventTypes.end, endPoint) | ||
@@ -74,0 +73,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340202
9009