Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@better-scroll/core

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@better-scroll/core - npm Package Compare versions

Comparing version 2.0.0-alpha.13 to 2.0.0-alpha.14

2

dist/core.min.js

@@ -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=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)e.hasOwnProperty(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 l=function(){return(l=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 s(t){console.error("[BScroll warn]: "+t)}var o="undefined"!=typeof window,n=o&&navigator.userAgent.toLowerCase(),r=n&&/wechatdevtools/.test(n),h=n&&0<n.indexOf("android");function p(){return window.performance&&window.performance.now?window.performance.now()+window.performance.timing.navigationStart:+new Date}function a(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];for(var i=0;i<e.length;i++){var s=e[i];for(var n in s)t[n]=s[n]}return t}function c(t){return null==t}var u=o&&document.createElement("div").style,f=function(){if(!o)return!1;var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t)if(void 0!==u[t[e]])return e;return!1}();function d(t){return!1===f?t:"standard"===f?"transitionEnd"===t?"transitionend":t:f+t.charAt(0).toUpperCase()+t.substr(1)}function v(t){return"string"==typeof t?document.querySelector(t):t}function m(t,e,o,i){t.addEventListener(e,o,{passive:!1,capture:!!i})}function y(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}function g(t){for(var e=0,o=0;t;)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}f&&"standard"!==f&&f.toLowerCase();var k=d("transform"),T=d("transition"),b=o&&d("perspective")in u,P=o&&("ontouchstart"in window||r),w=o&&T in u,S={transform:k,transition:T,transitionTimingFunction:d("transitionTimingFunction"),transitionDuration:d("transitionDuration"),transitionDelay:d("transitionDelay"),transformOrigin:d("transformOrigin"),transitionEnd:d("transitionEnd")},E={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function B(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 D(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}function Y(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,a({bubbles:n,cancelable:r},s))}catch(t){h()}else h();function h(){(i=document.createEvent("Event")).initEvent(e,n,r),a(i,s)}i.forwardedTouchEvent=!0,i._constructed=!0,t.target.dispatchEvent(i)}var X={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}}},x=o&&window;function L(){}function M(t){}var C=o?x.requestAnimationFrame||x.webkitRequestAnimationFrame||x.mozRequestAnimationFrame||x.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||100/60)/2)}:L,O=o?x.cancelAnimationFrame||x.webkitCancelAnimationFrame||x.mozCancelAnimationFrame||x.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:L,z={enumerable:!0,configurable:!0,get:M,set:M};var A,H,F,N,R,K,j,_,I,W,V,q,U=(Z.prototype.on=function(t,e,o){return void 0===o&&(o=this),this._checkInTypes(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},Z.prototype.once=function(o,i,s){var n=this;void 0===s&&(s=this),this._checkInTypes(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},Z.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this._checkInTypes(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}},Z.prototype.trigger=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this._checkInTypes(t);var i=this.events[t];if(i){for(var s,n=i.length,r=i.slice(),h=0;h<n;h++){var a=r[h],c=a[0],l=a[1];if(c&&!0===(s=c.apply(l,e)))break}return s}},Z.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},Z.prototype.destroy=function(){this.events={},this.eventTypes={}},Z.prototype._checkInTypes=function(t){var e=this.eventTypes;e[t]===t||s('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e)+"]")},Z);function Z(t){this.events={},this.eventTypes={},this.registerType(t)}(H=A||(A={}))[H.Positive=1]="Positive",H[H.Negative=-1]="Negative",H[H.Default=0]="Default",(N=F||(F={})).Default="",N.Horizontal="horizontal",N.Vertical="vertical",N.None="none",(K=R||(R={})).None="",K.Horizontal="horizontal",K.Vertical="vertical",(_=j||(j={}))[_.Touch=1]="Touch",_[_.Mouse=2]="Mouse",(W=I||(I={}))[W.Left=0]="Left",W[W.Middle=1]="Middle",W[W.Right=2]="Right",(q=V||(V={}))[q.Default=0]="Default",q[q.Throttle=1]="Throttle",q[q.Normal=2]="Normal",q[q.Realtime=3]="Realtime";var G=($.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},$.prototype.process=function(){return this.translateZ=this.HWCompositing&&b?" translateZ(0)":"",this.useTransition=this.useTransition&&w,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.scrollX=this.eventPassthrough!==R.Horizontal&&this.scrollX,this.scrollY=this.eventPassthrough!==R.Vertical&&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},$);function $(){this.startX=0,this.startY=0,this.scrollX=!1,this.scrollY=!0,this.freeScroll=!1,this.directionLockThreshold=5,this.eventPassthrough=R.None,this.click=!1,this.dblclick=!1,this.tap="",this.bounce={top:!0,bottom:!0,left:!0,right:!0},this.bounceTime=800,this.momentum=!0,this.momentumLimitTime=300,this.momentumLimitDistance=15,this.swipeTime=2500,this.swipeBounceTime=500,this.deceleration=.0015,this.flickLimitTime=200,this.flickLimitDistance=100,this.resizePolling=60,this.probeType=V.Default,this.stopPropagation=!1,this.preventDefault=!0,this.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},this.HWCompositing=!0,this.useTransition=!0,this.bindToWrapper=!1,this.disableMouse=P,this.autoBlur=!0}var J=(Q.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},Q.prototype.addDOMEvents=function(){this.handleDOMEvents(m)},Q.prototype.removeDOMEvents=function(){this.handleDOMEvents(y)},Q.prototype.handleDOMEvents=function(e){var o=this,i=this.wrapper;this.events.forEach(function(t){e(i,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()}var tt=(et.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=this.wrapper,s=e?i:window;this.startClickRegister=new J(i,[{name:o?"touchstart":"mousedown",handler:this.start.bind(this)},{name:"click",handler:this.click.bind(this),capture:!0}]),this.moveEndRegister=new J(s,[{name:o?"touchmove":"mousemove",handler:this.move.bind(this)},{name:o?"touchend":"mouseup",handler:this.end.bind(this)},{name:o?"touchcancel":"mouseup",handler:this.end.bind(this)}])},et.prototype.beforeHandler=function(t){var e=this.options,o=e.preventDefault,i=e.stopPropagation,s=e.preventDefaultException;o&&!D(t.target,s)&&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=E[t.type];if(!(this.initiated&&this.initiated!==e||(this.setInitiated(e),e===j.Mouse&&t.button!==I.Left||this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)))){this.beforeHandler(t);var o=t.touches?t.touches[0]:t;this.pointX=o.pageX,this.pointY=o.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)}},et.prototype.move=function(t){if(E[t.type]===this.initiated){this.beforeHandler(t);var e=t.touches?t.touches[0]:t,o=e.pageX-this.pointX,i=e.pageY-this.pointY;if(this.pointX=e.pageX,this.pointY=e.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:i,e:t})){var 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;(r>document.documentElement.clientWidth-this.options.momentumLimitDistance||r<this.options.momentumLimitDistance||h<this.options.momentumLimitDistance||h>document.documentElement.clientHeight-this.options.momentumLimitDistance)&&this.end(t)}}},et.prototype.end=function(t){E[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t),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.startClickRegister.destroy(),this.moveEndRegister.destroy(),this.hooks.destroy()},et);function et(t,e){this.wrapper=t,this.options=e,this.hooks=new U(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}var ot={x:["translateX","px"],y:["translateY","px"]},it=(st.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null)[S.transform].split(")")[0].split(", ");return{x:+(t[12]||t[4]),y:+(t[13]||t[5])}},st.prototype.translate=function(s){var n=[];Object.keys(s).forEach(function(t){if(ot[t]){var e=ot[t][0];if(e){var o=ot[t][1],i=s[t];n.push(e+"("+i+o+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,n,s),this.style[S.transform]=""+n.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,s)},st.prototype.destroy=function(){this.hooks.destroy()},st);function st(t){this.content=t,this.style=t.style,this.hooks=new U(["beforeTranslate","translate"])}var nt=(rt.prototype.translate=function(t){this.translater.translate(t)},rt.prototype.setPending=function(t){this.pending=t},rt.prototype.setForceStopped=function(t){this.forceStopped=t},rt.prototype.destroy=function(){this.hooks.destroy(),O(this.timer)},rt);function rt(t,e,o){this.content=t,this.translater=e,this.options=o,this.hooks=new U(["move","end","beforeForceStop","forceStop","time","timeFunction"]),this.style=t.style}var ht,at=(e(ct,ht=nt),ct.prototype.startProbe=function(){var e=this,o=function(){var t=e.translater.getComputedPosition();e.hooks.trigger(e.hooks.eventTypes.move,t),e.pending?e.timer=C(o):e.hooks.trigger(e.hooks.eventTypes.end,t)};O(this.timer),this.timer=C(o)},ct.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[S.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},ct.prototype.transitionTimingFunction=function(t){this.style[S.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},ct.prototype.move=function(t,e,o,i,s){this.setPending(0<o&&(t.x!==e.x||t.y!==e.y)),this.transitionTimingFunction(i),this.transitionTime(o),this.translate(e),o&&this.options.probeType===V.Realtime&&this.startProbe(),o||s||(this.hooks.trigger(this.hooks.eventTypes.move,e),this.hooks.trigger(this.hooks.eventTypes.end,e))},ct.prototype.stop=function(){if(this.pending){this.setPending(!1),O(this.timer);var t=this.translater.getComputedPosition(),e=t.x,o=t.y;if(this.transitionTime(),this.translate({x:e,y:o}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:e,y:o}))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:e,y:o})}},ct);function ct(){return null!==ht&&ht.apply(this,arguments)||this}var lt,pt=(e(ut,lt=nt),ut.prototype.move=function(t,e,o,i,s){if(!o){if(this.translate(e),s)return;return this.hooks.trigger(this.hooks.eventTypes.move,e),void this.hooks.trigger(this.hooks.eventTypes.end,e)}this.animate(t,e,o,i)},ut.prototype.animate=function(n,r,e,o){var h=this,a=p(),c=a+e,l=function(){var t=p();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=(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),h.pending&&(h.timer=C(l)),h.options.probeType===V.Realtime&&h.hooks.trigger(h.hooks.eventTypes.move,s)};this.setPending(!0),O(this.timer),l()},ut.prototype.stop=function(){if(this.pending){this.setPending(!1),O(this.timer);var t=this.translater.getComputedPosition();if(this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,t))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,t)}},ut);function ut(){return null!==lt&&lt.apply(this,arguments)||this}var ft,dt,vt,mt,yt,gt,kt=(Tt.prototype.start=function(){this.direction=A.Default,this.movingDirection=A.Default,this.dist=0},Tt.prototype.move=function(t){t=this.hasScroll?t:0,this.movingDirection=0<t?A.Negative:t<0?A.Positive:A.Default;var e=this.currentPos+t;return(e>this.minScrollPos||e<this.maxScrollPos)&&(e=e>this.minScrollPos&&this.options.bounces[0]||e<this.maxScrollPos&&this.options.bounces[1]?this.currentPos+t/3:e>this.minScrollPos?this.minScrollPos:this.maxScrollPos),e},Tt.prototype.end=function(t){var e={duration:0},o=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&t<this.options.momentumLimitTime&&o>this.options.momentumLimitDistance){var i=this.direction===A.Negative&&this.options.bounces[0]||this.direction===A.Positive&&this.options.bounces[1]?this.wrapperSize:0;e=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,i,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,e);return e},Tt.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},Tt.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.direction=0<t?A.Negative:t<0?A.Positive:A.Default},Tt.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=B(this.wrapper);this.wrapperSize=s[e];var n=B(this.content);this.contentSize=n[e],this.relativeOffset=n[o],i&&(this.relativeOffset-=s[o]),this.minScrollPos=0,this.maxScrollPos=this.wrapperSize-this.contentSize,this.maxScrollPos<0&&(this.maxScrollPos-=this.relativeOffset,this.minScrollPos=-this.relativeOffset),this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,this.hasScroll||(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize),this.direction=0},Tt.prototype.updatePosition=function(t){this.currentPos=t},Tt.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},Tt.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos);return{position:t,inBoundary:t===this.getCurrentPos()}},Tt.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},Tt.prototype.updateStartPos=function(){this.startPos=this.currentPos},Tt.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},Tt.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},Tt.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},Tt.prototype.destroy=function(){this.hooks.destroy()},Tt);function Tt(t,e){this.wrapper=t,this.options=e,this.hooks=new U(["momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0}(gt=yt||(yt={})).Yes="yes",gt.No="no";var bt=((ft={})[yt.Yes]=function(t){return!0},ft[yt.No]=function(t){return t.preventDefault(),!1},ft),Pt=((dt={})[F.Horizontal]=((vt={})[yt.Yes]=R.Horizontal,vt[yt.No]=R.Vertical,vt),dt[F.Vertical]=((mt={})[yt.Yes]=R.Vertical,mt[yt.No]=R.Horizontal,mt),dt),wt=(St.prototype.reset=function(){this.directionLocked=F.Default},St.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},St.prototype.adjustDelta=function(t,e){return this.directionLocked===F.Horizontal?e=0:this.directionLocked===F.Vertical&&(t=0),{deltaX:t,deltaY:e}},St.prototype.computeDirectionLock=function(t,e){this.directionLocked!==F.Default||this.freeScroll||(t>e+this.directionLockThreshold?this.directionLocked=F.Horizontal:e>=t+this.directionLockThreshold?this.directionLocked=F.Vertical:this.directionLocked=F.None)},St.prototype.handleEventPassthrough=function(t){var e=Pt[this.directionLocked];if(e){if(this.eventPassthrough===e[yt.Yes])return bt[yt.Yes](t);if(this.eventPassthrough===e[yt.No])return bt[yt.No](t)}return!1},St);function St(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var Et=(Bt.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)})},Bt.prototype.handleStart=function(t){var e=p();this.moved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.stop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},Bt.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=p();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)}},Bt.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),this.options.probeType===V.Throttle&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>V.Throttle&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},Bt.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},Bt.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=p();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},Bt.prototype.handleClick=function(t){D(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},Bt.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},Bt.prototype.refresh=function(){this.endTime=0},Bt.prototype.destroy=function(){this.hooks.destroy()},Bt);function Bt(t,e,o,i,s){this.hooks=new U(["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 wt(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}function Dt(o,t,e,i){var s=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime"].reduce(function(t,e){return t[e]=o[e],t},{});return s.scrollable=o[t],s.bounces=e,s.rect=i,s}function Yt(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,[o].concat(t))})})}var Xt=(xt.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},xt.prototype.bindTranslater=function(){var e=this,t=this.translater.hooks;t.on(t.eventTypes.beforeTranslate,function(t){e.options.translateZ&&t.push(e.options.translateZ)}),t.on(t.eventTypes.translate,function(t){e.updatePositions(t),e.togglePointerEvents(!1)})},xt.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))}),Yt(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}])},xt.prototype.bindActions=function(){var s=this,o=this.actions;Yt(o.hooks,this.hooks,[{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:o.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:o.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:o.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:o.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),o.hooks.on(o.hooks.eventTypes.end,function(t,e){return s.hooks.trigger(s.hooks.eventTypes.touchEnd,e),!!s.hooks.trigger(s.hooks.eventTypes.end,e)||(!o.moved&&s.checkClick(t)?(s.animater.setForceStopped(!1),s.hooks.trigger(s.hooks.eventTypes.scrollCancel),!0):(s.animater.setForceStopped(!1),!!s.resetPosition(s.options.bounceTime,X.bounce)||void 0))}),o.hooks.on(o.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.hooks.trigger(s.hooks.eventTypes.scrollEnd,t)})},xt.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)return!0},xt.prototype.momentum=function(t,e){var o={time:0,easing:X.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=c(i.destination)?o.newX:i.destination,o.newY=c(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=X.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},xt.prototype.checkClick=function(t){var e=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return!0;if(e)return!1;var o=this.options.dblclick,i=!1;if(o&&this.lastClickTime){var s=o.delay,n=void 0===s?300:s;p()-this.lastClickTime<n&&(i=!0,function(t){Y(t,"dblclick")}(t))}return this.options.tap&&function(t,e){var o=document.createEvent("Event");o.initEvent(e,!0,!0),o.pageX=t.pageX,o.pageY=t.pageY,t.target.dispatchEvent(o)}(t,this.options.tap),this.options.click&&!D(t.target,this.options.preventDefaultException)&&Y(t),this.lastClickTime=i?null:p(),!0},xt.prototype.resize=function(){var t=this;this.actions.enabled&&(h&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.refresh()},this.options.resizePolling))},xt.prototype.transitionEnd=function(t){t.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,X.bounce)||(this.animater.setPending(!1),this.options.probeType!==V.Realtime&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},xt.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++)e[i].style.pointerEvents=o},xt.prototype.refresh=function(){this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=g(this.wrapper)},xt.prototype.scrollBy=function(t,e,o,i){void 0===o&&(o=0);var s=this.getCurrentPos(),n=s.x,r=s.y;i=i||X.bounce,t+=n,e+=r,this.scrollTo(t,e,o,i)},xt.prototype.scrollTo=function(t,e,o,i,s,n){void 0===o&&(o=0),void 0===s&&(s={start:{},end:{}}),i=i||X.bounce;var r=this.options.useTransition?i.style:i.fn,h=this.getCurrentPos(),a=l({x:h.x,y:h.y},s.start),c=l({x:t,y:e},s.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,c),!this.hooks.trigger(this.hooks.eventTypes.ignoreDisMoveForSamePos)&&a.x===c.x&&a.y===c.y||this.animater.move(a,c,o,r,n)},xt.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=v(t),h=g(r);function a(t,e,o,i){return t-=e,t=i.adjustPosition(t-o)}o=n(o,r.offsetWidth,this.wrapper.offsetWidth),i=n(i,r.offsetWidth,this.wrapper.offsetWidth),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)},xt.prototype.resetPosition=function(t,e){void 0===t&&(t=0),e=e||X.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||(this.scrollTo(i,r,t,e),0))},xt.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},xt.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},xt.prototype.enable=function(){this.actions.enabled=!0},xt.prototype.disable=function(){O(this.animater.timer),this.actions.enabled=!1},xt.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},xt);function xt(t,e){this.hooks=new U(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","refresh","touchEnd","end","flick","scrollCancel","momentum","scrollTo","ignoreDisMoveForSamePos","scrollToElement"]),this.wrapper=t,this.content=t.children[0],this.options=e;var o=this.options.bounce,i=o.left,s=void 0===i||i,n=o.right,r=void 0===n||n,h=o.top,a=void 0===h||h,c=o.bottom,l=void 0===c||c;this.scrollBehaviorX=new kt(t,Dt(e,"scrollX",[s,r],{size:"width",position:"left"})),this.scrollBehaviorY=new kt(t,Dt(e,"scrollY",[a,l],{size:"height",position:"top"})),this.translater=new it(this.content),this.animater=function(t,e,o){var i=o.useTransition,s={};return Object.defineProperty(s,"probeType",{enumerable:!0,configurable:!1,get:function(){return o.probeType}}),i?new at(t,e,s):new pt(t,e,s)}(this.content,this.translater,this.options),this.actionsHandler=new tt(t,function(o){return["click","bindToWrapper","disableMouse","preventDefault","stopPropagation","preventDefaultException"].reduce(function(t,e){return t[e]=o[e],t},{})}(this.options)),this.actions=new Et(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var p=this.resize.bind(this);this.resizeRegister=new J(window,[{name:"orientationchange",handler:p},{name:"resize",handler:p}]),this.transitionEndRegister=new J(this.content,[{name:S.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}var Lt,Mt,Ct=[{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.scrollTo",key:"scrollTo"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];(Mt=Lt||(Lt={})).Pre="pre",Mt.Post="post";var Ot,zt=(e(At,Ot=U),At.use=function(e){var t=e.pluginName;return this.plugins.some(function(t){return e===t.ctor})||(c(t)?s("Plugin Class must specify plugin's name in static property by 'pluginName' field."):this.pluginsMap[t]?s("This plugin has been registered, maybe you need change plugin's name"):(this.pluginsMap[t]=!0,this.plugins.push({name:t,enforce:e.enforce,ctor:e}))),this},At.prototype.init=function(t){this.wrapper=t,this.scroller=new Xt(t,this.options),this.eventBubbling(),this.handleAutoBlur(),this.innerRefresh(),this.scroller.scrollTo(this.options.startX,this.options.startY),this.enable(),this.proxy(Ct),this.applyPlugins()},At.prototype.applyPlugins=function(){var o=this,i=this.options;this.constructor.plugins.sort(function(t,e){var o,i=((o={})[Lt.Pre]=-1,o[Lt.Post]=1,o);return(t.enforce?i[t.enforce]:0)-(e.enforce?i[e.enforce]:0)}).forEach(function(t){var e=t.ctor;i[t.name]&&"function"==typeof e&&(o.plugins[t.name]=new e(o))})},At.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.scrollStart,function(){var t=document.activeElement;!t||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName||t.blur()})},At.prototype.eventBubbling=function(){Yt(this.scroller.hooks,this,["beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick"])},At.prototype.innerRefresh=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},At.prototype.proxy=function(t){var i=this;t.forEach(function(t){var e=t.key,o=t.sourceKey;!function(t,e,o){z.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,e)},z.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,e,t)},Object.defineProperty(t,o,z)}(i,o,e)})},At.prototype.refresh=function(){this.innerRefresh(),this.scroller.resetPosition()},At.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},At.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},At.prototype.destroy=function(){this.scroller.destroy(),this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy)},At.prototype.eventRegister=function(t){this.registerType(t)},At.version="2.0.0",At.plugins=[],At.pluginsMap={},At);function At(t,e){var o=Ot.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=v(t);return i?i.children[0]?(o.plugins={},o.options=(new G).merge(e).process(),o.hooks=new U(["init","refresh","enable","disable","destroy"]),o.init(i)):s("The wrapper need at least one child element to be scroller."):s("Can not resolve the wrapper DOM."),o}t.Options=G,t.default=zt,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=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)e.hasOwnProperty(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 l=function(){return(l=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 s(t){console.error("[BScroll warn]: "+t)}var o="undefined"!=typeof window,n=o&&navigator.userAgent.toLowerCase(),r=n&&/wechatdevtools/.test(n),h=n&&0<n.indexOf("android");function p(){return window.performance&&window.performance.now?window.performance.now()+window.performance.timing.navigationStart:+new Date}function a(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];for(var i=0;i<e.length;i++){var s=e[i];for(var n in s)t[n]=s[n]}return t}function c(t){return null==t}var u=o&&document.createElement("div").style,f=function(){if(!o)return!1;var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t)if(void 0!==u[t[e]])return e;return!1}();function d(t){return!1===f?t:"standard"===f?"transitionEnd"===t?"transitionend":t:f+t.charAt(0).toUpperCase()+t.substr(1)}function v(t){return"string"==typeof t?document.querySelector(t):t}function m(t,e,o,i){t.addEventListener(e,o,{passive:!1,capture:!!i})}function y(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}function g(t){for(var e=0,o=0;t;)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}f&&"standard"!==f&&f.toLowerCase();var k=d("transform"),T=d("transition"),b=o&&d("perspective")in u,P=o&&("ontouchstart"in window||r),w=o&&T in u,S={transform:k,transition:T,transitionTimingFunction:d("transitionTimingFunction"),transitionDuration:d("transitionDuration"),transitionDelay:d("transitionDelay"),transformOrigin:d("transformOrigin"),transitionEnd:d("transitionEnd")},E={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function B(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 D(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}function Y(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,a({bubbles:n,cancelable:r},s))}catch(t){h()}else h();function h(){(i=document.createEvent("Event")).initEvent(e,n,r),a(i,s)}i.forwardedTouchEvent=!0,i._constructed=!0,t.target.dispatchEvent(i)}var X={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}}},x=o&&window;function L(){}function M(t){}var C=o?x.requestAnimationFrame||x.webkitRequestAnimationFrame||x.mozRequestAnimationFrame||x.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||100/60)/2)}:L,O=o?x.cancelAnimationFrame||x.webkitCancelAnimationFrame||x.mozCancelAnimationFrame||x.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:L,z={enumerable:!0,configurable:!0,get:M,set:M};var H,A,F,N,R,K,_,j,I,V,W,q,U=(Z.prototype.on=function(t,e,o){return void 0===o&&(o=this),this._checkInTypes(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},Z.prototype.once=function(o,i,s){var n=this;void 0===s&&(s=this),this._checkInTypes(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},Z.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this._checkInTypes(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}},Z.prototype.trigger=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this._checkInTypes(t);var i=this.events[t];if(i){for(var s,n=i.length,r=i.slice(),h=0;h<n;h++){var a=r[h],c=a[0],l=a[1];if(c&&!0===(s=c.apply(l,e)))break}return s}},Z.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},Z.prototype.destroy=function(){this.events={},this.eventTypes={}},Z.prototype._checkInTypes=function(t){var e=this.eventTypes;e[t]===t||s('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e)+"]")},Z);function Z(t){this.events={},this.eventTypes={},this.registerType(t)}(A=H||(H={}))[A.Positive=1]="Positive",A[A.Negative=-1]="Negative",A[A.Default=0]="Default",(N=F||(F={})).Default="",N.Horizontal="horizontal",N.Vertical="vertical",N.None="none",(K=R||(R={})).None="",K.Horizontal="horizontal",K.Vertical="vertical",(j=_||(_={}))[j.Touch=1]="Touch",j[j.Mouse=2]="Mouse",(V=I||(I={}))[V.Left=0]="Left",V[V.Middle=1]="Middle",V[V.Right=2]="Right",(q=W||(W={}))[q.Default=0]="Default",q[q.Throttle=1]="Throttle",q[q.Normal=2]="Normal",q[q.Realtime=3]="Realtime";var G=($.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},$.prototype.process=function(){return this.translateZ=this.HWCompositing&&b?" translateZ(0)":"",this.useTransition=this.useTransition&&w,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.scrollX=this.eventPassthrough!==R.Horizontal&&this.scrollX,this.scrollY=this.eventPassthrough!==R.Vertical&&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},$);function $(){this.startX=0,this.startY=0,this.scrollX=!1,this.scrollY=!0,this.freeScroll=!1,this.directionLockThreshold=5,this.eventPassthrough=R.None,this.click=!1,this.dblclick=!1,this.tap="",this.bounce={top:!0,bottom:!0,left:!0,right:!0},this.bounceTime=800,this.momentum=!0,this.momentumLimitTime=300,this.momentumLimitDistance=15,this.swipeTime=2500,this.swipeBounceTime=500,this.deceleration=.0015,this.flickLimitTime=200,this.flickLimitDistance=100,this.resizePolling=60,this.probeType=W.Default,this.stopPropagation=!1,this.preventDefault=!0,this.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},this.HWCompositing=!0,this.useTransition=!0,this.bindToWrapper=!1,this.disableMouse=P,this.autoBlur=!0}var J=(Q.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},Q.prototype.addDOMEvents=function(){this.handleDOMEvents(m)},Q.prototype.removeDOMEvents=function(){this.handleDOMEvents(y)},Q.prototype.handleDOMEvents=function(e){var o=this,i=this.wrapper;this.events.forEach(function(t){e(i,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()}var tt=(et.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=this.wrapper,s=e?i:window;this.startClickRegister=new J(i,[{name:o?"touchstart":"mousedown",handler:this.start.bind(this)},{name:"click",handler:this.click.bind(this),capture:!0}]),this.moveEndRegister=new J(s,[{name:o?"touchmove":"mousemove",handler:this.move.bind(this)},{name:o?"touchend":"mouseup",handler:this.end.bind(this)},{name:o?"touchcancel":"mouseup",handler:this.end.bind(this)}])},et.prototype.beforeHandler=function(t){var e=this.options,o=e.preventDefault,i=e.stopPropagation,s=e.preventDefaultException;o&&!D(t.target,s)&&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=E[t.type];if(!(this.initiated&&this.initiated!==e||(this.setInitiated(e),e===_.Mouse&&t.button!==I.Left||this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)))){this.beforeHandler(t);var o=t.touches?t.touches[0]:t;this.pointX=o.pageX,this.pointY=o.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)}},et.prototype.move=function(t){if(E[t.type]===this.initiated){this.beforeHandler(t);var e=t.touches?t.touches[0]:t,o=e.pageX-this.pointX,i=e.pageY-this.pointY;if(this.pointX=e.pageX,this.pointY=e.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:i,e:t})){var 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;(r>document.documentElement.clientWidth-this.options.momentumLimitDistance||r<this.options.momentumLimitDistance||h<this.options.momentumLimitDistance||h>document.documentElement.clientHeight-this.options.momentumLimitDistance)&&this.end(t)}}},et.prototype.end=function(t){E[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t),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.startClickRegister.destroy(),this.moveEndRegister.destroy(),this.hooks.destroy()},et);function et(t,e){this.wrapper=t,this.options=e,this.hooks=new U(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}var ot={x:["translateX","px"],y:["translateY","px"]},it=(st.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null)[S.transform].split(")")[0].split(", ");return{x:+(t[12]||t[4]),y:+(t[13]||t[5])}},st.prototype.translate=function(s){var n=[];Object.keys(s).forEach(function(t){if(ot[t]){var e=ot[t][0];if(e){var o=ot[t][1],i=s[t];n.push(e+"("+i+o+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,n,s),this.style[S.transform]=""+n.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,s)},st.prototype.destroy=function(){this.hooks.destroy()},st);function st(t){this.content=t,this.style=t.style,this.hooks=new U(["beforeTranslate","translate"])}var nt=(rt.prototype.translate=function(t){this.translater.translate(t)},rt.prototype.setPending=function(t){this.pending=t},rt.prototype.setForceStopped=function(t){this.forceStopped=t},rt.prototype.destroy=function(){this.hooks.destroy(),O(this.timer)},rt);function rt(t,e,o){this.content=t,this.translater=e,this.options=o,this.hooks=new U(["move","end","beforeForceStop","forceStop","time","timeFunction"]),this.style=t.style}var ht,at=(e(ct,ht=nt),ct.prototype.startProbe=function(){var e=this,o=function(){var t=e.translater.getComputedPosition();e.hooks.trigger(e.hooks.eventTypes.move,t),e.pending?e.timer=C(o):e.hooks.trigger(e.hooks.eventTypes.end,t)};O(this.timer),this.timer=C(o)},ct.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[S.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},ct.prototype.transitionTimingFunction=function(t){this.style[S.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},ct.prototype.move=function(t,e,o,i,s){this.setPending(0<o&&(t.x!==e.x||t.y!==e.y)),this.transitionTimingFunction(i),this.transitionTime(o),this.translate(e),o&&this.options.probeType===W.Realtime&&this.startProbe(),o||(this._reflow=this.content.offsetHeight),o||s||(this.hooks.trigger(this.hooks.eventTypes.move,e),this.hooks.trigger(this.hooks.eventTypes.end,e))},ct.prototype.stop=function(){if(this.pending){this.setPending(!1),O(this.timer);var t=this.translater.getComputedPosition(),e=t.x,o=t.y;if(this.transitionTime(),this.translate({x:e,y:o}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:e,y:o}))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:e,y:o})}},ct);function ct(){return null!==ht&&ht.apply(this,arguments)||this}var lt,pt=(e(ut,lt=nt),ut.prototype.move=function(t,e,o,i,s){if(!o){if(this.translate(e),this._reflow=this.content.offsetHeight,s)return;return this.hooks.trigger(this.hooks.eventTypes.move,e),void this.hooks.trigger(this.hooks.eventTypes.end,e)}this.animate(t,e,o,i)},ut.prototype.animate=function(n,r,e,o){var h=this,a=p(),c=a+e,l=function(){var t=p();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=(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),h.pending&&(h.timer=C(l)),h.options.probeType===W.Realtime&&h.hooks.trigger(h.hooks.eventTypes.move,s)};this.setPending(!0),O(this.timer),l()},ut.prototype.stop=function(){if(this.pending){this.setPending(!1),O(this.timer);var t=this.translater.getComputedPosition();if(this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,t))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,t)}},ut);function ut(){return null!==lt&&lt.apply(this,arguments)||this}var ft,dt,vt,mt,yt,gt,kt=(Tt.prototype.start=function(){this.direction=H.Default,this.movingDirection=H.Default,this.dist=0},Tt.prototype.move=function(t){t=this.hasScroll?t:0,this.movingDirection=0<t?H.Negative:t<0?H.Positive:H.Default;var e=this.currentPos+t;return(e>this.minScrollPos||e<this.maxScrollPos)&&(e=e>this.minScrollPos&&this.options.bounces[0]||e<this.maxScrollPos&&this.options.bounces[1]?this.currentPos+t/3:e>this.minScrollPos?this.minScrollPos:this.maxScrollPos),e},Tt.prototype.end=function(t){var e={duration:0},o=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&t<this.options.momentumLimitTime&&o>this.options.momentumLimitDistance){var i=this.direction===H.Negative&&this.options.bounces[0]||this.direction===H.Positive&&this.options.bounces[1]?this.wrapperSize:0;e=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,i,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,e);return e},Tt.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},Tt.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.direction=0<t?H.Negative:t<0?H.Positive:H.Default},Tt.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=B(this.wrapper);this.wrapperSize=s[e];var n=B(this.content);this.contentSize=n[e],this.relativeOffset=n[o],i&&(this.relativeOffset-=s[o]),this.minScrollPos=0,this.maxScrollPos=this.wrapperSize-this.contentSize,this.maxScrollPos<0&&(this.maxScrollPos-=this.relativeOffset,this.minScrollPos=-this.relativeOffset),this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,this.hasScroll||(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize),this.direction=0},Tt.prototype.updatePosition=function(t){this.currentPos=t},Tt.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},Tt.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos);return{position:t,inBoundary:t===this.getCurrentPos()}},Tt.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},Tt.prototype.updateStartPos=function(){this.startPos=this.currentPos},Tt.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},Tt.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},Tt.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},Tt.prototype.destroy=function(){this.hooks.destroy()},Tt);function Tt(t,e){this.wrapper=t,this.options=e,this.hooks=new U(["momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0}(gt=yt||(yt={})).Yes="yes",gt.No="no";var bt=((ft={})[yt.Yes]=function(t){return!0},ft[yt.No]=function(t){return t.preventDefault(),!1},ft),Pt=((dt={})[F.Horizontal]=((vt={})[yt.Yes]=R.Horizontal,vt[yt.No]=R.Vertical,vt),dt[F.Vertical]=((mt={})[yt.Yes]=R.Vertical,mt[yt.No]=R.Horizontal,mt),dt),wt=(St.prototype.reset=function(){this.directionLocked=F.Default},St.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},St.prototype.adjustDelta=function(t,e){return this.directionLocked===F.Horizontal?e=0:this.directionLocked===F.Vertical&&(t=0),{deltaX:t,deltaY:e}},St.prototype.computeDirectionLock=function(t,e){this.directionLocked!==F.Default||this.freeScroll||(t>e+this.directionLockThreshold?this.directionLocked=F.Horizontal:e>=t+this.directionLockThreshold?this.directionLocked=F.Vertical:this.directionLocked=F.None)},St.prototype.handleEventPassthrough=function(t){var e=Pt[this.directionLocked];if(e){if(this.eventPassthrough===e[yt.Yes])return bt[yt.Yes](t);if(this.eventPassthrough===e[yt.No])return bt[yt.No](t)}return!1},St);function St(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var Et=(Bt.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)})},Bt.prototype.handleStart=function(t){var e=p();this.moved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.stop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},Bt.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=p();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)}},Bt.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),this.options.probeType===W.Throttle&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>W.Throttle&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},Bt.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},Bt.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=p();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},Bt.prototype.handleClick=function(t){D(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},Bt.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},Bt.prototype.refresh=function(){this.endTime=0},Bt.prototype.destroy=function(){this.hooks.destroy()},Bt);function Bt(t,e,o,i,s){this.hooks=new U(["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 wt(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}function Dt(o,t,e,i){var s=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime"].reduce(function(t,e){return t[e]=o[e],t},{});return s.scrollable=o[t],s.bounces=e,s.rect=i,s}function Yt(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,[o].concat(t))})})}var Xt=(xt.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},xt.prototype.bindTranslater=function(){var e=this,t=this.translater.hooks;t.on(t.eventTypes.beforeTranslate,function(t){e.options.translateZ&&t.push(e.options.translateZ)}),t.on(t.eventTypes.translate,function(t){e.updatePositions(t),e.togglePointerEvents(!1)})},xt.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))}),Yt(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}])},xt.prototype.bindActions=function(){var s=this,o=this.actions;Yt(o.hooks,this.hooks,[{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:o.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:o.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:o.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:o.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),o.hooks.on(o.hooks.eventTypes.end,function(t,e){return s.hooks.trigger(s.hooks.eventTypes.touchEnd,e),!!s.hooks.trigger(s.hooks.eventTypes.end,e)||(!o.moved&&s.checkClick(t)?(s.animater.setForceStopped(!1),s.hooks.trigger(s.hooks.eventTypes.scrollCancel),!0):(s.animater.setForceStopped(!1),!!s.resetPosition(s.options.bounceTime,X.bounce)||void 0))}),o.hooks.on(o.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.hooks.trigger(s.hooks.eventTypes.scrollEnd,t)})},xt.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)return!0},xt.prototype.momentum=function(t,e){var o={time:0,easing:X.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=c(i.destination)?o.newX:i.destination,o.newY=c(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=X.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},xt.prototype.checkClick=function(t){var e=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return!0;if(e)return!1;var o=this.options.dblclick,i=!1;if(o&&this.lastClickTime){var s=o.delay,n=void 0===s?300:s;p()-this.lastClickTime<n&&(i=!0,function(t){Y(t,"dblclick")}(t))}return this.options.tap&&function(t,e){var o=document.createEvent("Event");o.initEvent(e,!0,!0),o.pageX=t.pageX,o.pageY=t.pageY,t.target.dispatchEvent(o)}(t,this.options.tap),this.options.click&&!D(t.target,this.options.preventDefaultException)&&Y(t),this.lastClickTime=i?null:p(),!0},xt.prototype.resize=function(){var t=this;this.actions.enabled&&(h&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.refresh()},this.options.resizePolling))},xt.prototype.transitionEnd=function(t){t.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,X.bounce)||(this.animater.setPending(!1),this.options.probeType!==W.Realtime&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},xt.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++)e[i].style.pointerEvents=o},xt.prototype.refresh=function(){this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=g(this.wrapper)},xt.prototype.scrollBy=function(t,e,o,i){void 0===o&&(o=0);var s=this.getCurrentPos(),n=s.x,r=s.y;i=i||X.bounce,t+=n,e+=r,this.scrollTo(t,e,o,i)},xt.prototype.scrollTo=function(t,e,o,i,s,n){void 0===o&&(o=0),void 0===s&&(s={start:{},end:{}}),i=i||X.bounce;var r=this.options.useTransition?i.style:i.fn,h=this.getCurrentPos(),a=l({x:h.x,y:h.y},s.start),c=l({x:t,y:e},s.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,c),!this.hooks.trigger(this.hooks.eventTypes.ignoreDisMoveForSamePos)&&a.x===c.x&&a.y===c.y||this.animater.move(a,c,o,r,n)},xt.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=v(t),h=g(r);function a(t,e,o,i){return t-=e,t=i.adjustPosition(t-o)}o=n(o,r.offsetWidth,this.wrapper.offsetWidth),i=n(i,r.offsetHeight,this.wrapper.offsetHeight),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)},xt.prototype.resetPosition=function(t,e){void 0===t&&(t=0),e=e||X.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||(this.scrollTo(i,r,t,e),0))},xt.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},xt.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},xt.prototype.enable=function(){this.actions.enabled=!0},xt.prototype.disable=function(){O(this.animater.timer),this.actions.enabled=!1},xt.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},xt);function xt(t,e){this.hooks=new U(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","refresh","touchEnd","end","flick","scrollCancel","momentum","scrollTo","ignoreDisMoveForSamePos","scrollToElement"]),this.wrapper=t,this.content=t.children[0],this.options=e;var o=this.options.bounce,i=o.left,s=void 0===i||i,n=o.right,r=void 0===n||n,h=o.top,a=void 0===h||h,c=o.bottom,l=void 0===c||c;this.scrollBehaviorX=new kt(t,Dt(e,"scrollX",[s,r],{size:"width",position:"left"})),this.scrollBehaviorY=new kt(t,Dt(e,"scrollY",[a,l],{size:"height",position:"top"})),this.translater=new it(this.content),this.animater=function(t,e,o){var i=o.useTransition,s={};return Object.defineProperty(s,"probeType",{enumerable:!0,configurable:!1,get:function(){return o.probeType}}),i?new at(t,e,s):new pt(t,e,s)}(this.content,this.translater,this.options),this.actionsHandler=new tt(t,function(o){return["click","bindToWrapper","disableMouse","preventDefault","stopPropagation","preventDefaultException"].reduce(function(t,e){return t[e]=o[e],t},{})}(this.options)),this.actions=new Et(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var p=this.resize.bind(this);this.resizeRegister=new J(window,[{name:"orientationchange",handler:p},{name:"resize",handler:p}]),this.transitionEndRegister=new J(this.content,[{name:S.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}var Lt,Mt,Ct=[{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.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];(Mt=Lt||(Lt={})).Pre="pre",Mt.Post="post";var Ot,zt=(e(Ht,Ot=U),Ht.use=function(e){var t=e.pluginName;return this.plugins.some(function(t){return e===t.ctor})||(c(t)?s("Plugin Class must specify plugin's name in static property by 'pluginName' field."):this.pluginsMap[t]?s("This plugin has been registered, maybe you need change plugin's name"):(this.pluginsMap[t]=!0,this.plugins.push({name:t,enforce:e.enforce,ctor:e}))),this},Ht.prototype.init=function(t){this.wrapper=t,this.scroller=new Xt(t,this.options),this.eventBubbling(),this.handleAutoBlur(),this.innerRefresh(),this.scroller.scrollTo(this.options.startX,this.options.startY),this.enable(),this.proxy(Ct),this.applyPlugins()},Ht.prototype.applyPlugins=function(){var o=this,i=this.options;this.constructor.plugins.sort(function(t,e){var o,i=((o={})[Lt.Pre]=-1,o[Lt.Post]=1,o);return(t.enforce?i[t.enforce]:0)-(e.enforce?i[e.enforce]:0)}).forEach(function(t){var e=t.ctor;i[t.name]&&"function"==typeof e&&(o.plugins[t.name]=new e(o))})},Ht.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.scrollStart,function(){var t=document.activeElement;!t||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName||t.blur()})},Ht.prototype.eventBubbling=function(){Yt(this.scroller.hooks,this,["beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick"])},Ht.prototype.innerRefresh=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},Ht.prototype.proxy=function(t){var i=this;t.forEach(function(t){var e=t.key,o=t.sourceKey;!function(t,e,o){z.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,e)},z.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,e,t)},Object.defineProperty(t,o,z)}(i,o,e)})},Ht.prototype.refresh=function(){this.innerRefresh(),this.scroller.resetPosition()},Ht.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},Ht.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},Ht.prototype.destroy=function(){this.scroller.destroy(),this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy)},Ht.prototype.eventRegister=function(t){this.registerType(t)},Ht.version="2.0.0",Ht.plugins=[],Ht.pluginsMap={},Ht);function Ht(t,e){var o=Ot.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=v(t);return i?i.children[0]?(o.plugins={},o.options=(new G).merge(e).process(),o.hooks=new U(["init","refresh","enable","disable","destroy"]),o.init(i)):s("The wrapper need at least one child element to be scroller."):s("Can not resolve the wrapper DOM."),o}t.Options=G,t.default=zt,Object.defineProperty(t,"__esModule",{value:!0})}),"undefined"!=typeof window&&window.BScroll&&(window.BScroll=window.BScroll.default);

@@ -16,2 +16,3 @@ import EventEmitter from '../base/EventEmitter';

forceStopped: boolean;
_reflow: number;
[key: string]: any;

@@ -18,0 +19,0 @@ constructor(content: HTMLElement, translater: Translater, options: {

{
"name": "@better-scroll/core",
"version": "2.0.0-alpha.13",
"version": "2.0.0-alpha.14",
"description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny",

@@ -34,5 +34,5 @@ "author": {

"dependencies": {
"@better-scroll/shared-utils": "^2.0.0-alpha.13"
"@better-scroll/shared-utils": "^2.0.0-alpha.14"
},
"gitHead": "db91783299b9bdb8f57cfc4a9896d6ca98defc93"
"gitHead": "bcec4e9e0ba8708a24b428d1c251484751669437"
}

@@ -22,2 +22,7 @@ import Base from './Base'

this.translate(endPoint)
// if we change content's transformY in a tick
// such as: 0 -> 50px -> 0
// transitionend will not be triggered
// so we forceupdate by reflow
this._reflow = this.content.offsetHeight
// no need to dispatch move and end when slient

@@ -24,0 +29,0 @@ if (isSlient) return

@@ -16,2 +16,3 @@ import EventEmitter from '../base/EventEmitter'

forceStopped: boolean
_reflow: number
[key: string]: any

@@ -18,0 +19,0 @@

@@ -51,3 +51,2 @@ import {

// TODO when probeType is not Realtime, need to dispatch scroll ?
if (time && this.options.probeType === Probe.Realtime) {

@@ -57,3 +56,10 @@ this.startProbe()

// when time is 0
// if we change content's transformY in a tick
// such as: 0 -> 50px -> 0
// transitionend will not be triggered
// so we forceupdate by reflow
if (!time) {
this._reflow = this.content.offsetHeight
}
// no need to dispatch move and end when slient

@@ -60,0 +66,0 @@ if (!time && !isSlient) {

@@ -71,2 +71,10 @@ export const propertiesConfig = [

{
sourceKey: 'scroller.scrollBy',
key: 'scrollBy'
},
{
sourceKey: 'scroller.scrollToElement',
key: 'scrollToElement'
},
{
sourceKey: 'scroller.resetPosition',

@@ -73,0 +81,0 @@ key: 'resetPosition'

@@ -465,4 +465,4 @@ import ActionsHandler from '../base/ActionsHandler'

offsetY,
targetEle.offsetWidth,
this.wrapper.offsetWidth
targetEle.offsetHeight,
this.wrapper.offsetHeight
)

@@ -469,0 +469,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc