vuescroll
Version:
A beautiful scrollbar based on Vue.js for PC and mobile.
3 lines (2 loc) • 48.6 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):e.vuescroll=t(e.Vue)}(this,function(r){"use strict";r=r&&r.hasOwnProperty("default")?r.default:r;var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e},i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function l(e,t){for(var o in t="object"===(void 0===t?"undefined":i(t))&&t||{},e)t[o]="object"===i(e[o])?l(e[o],t[o]={}):e[o];return t}function c(e,t){for(var o in t=t||{},e)"object"===i(e[o])?void 0===t[o]?(t[o]={},l(e[o],t[o])):c(e[o],t[o]):void 0===t[o]&&(t[o]=e[o]);return t}function s(e,t,o,i){var l=null;(o[t]||"function"==typeof o)&&(i=i||t,"function"==typeof o&&(l=o),Object.defineProperty(e,t,{get:l||function(){return o[i]},configurable:!0}))}var a=void 0;function u(e,t,o){var i=3<arguments.length&&void 0!==arguments[3]&&arguments[3];"on"==(4<arguments.length&&void 0!==arguments[4]?arguments[4]:"on")?e.addEventListener(t,o,i):e.removeEventListener(t,o,i)}var _=function(e){console.error("[vuescroll] "+e)},h=function(e){console.warn("[vuescroll] "+e)};function d(e,t){var o=!1;if(!e||!t)return o;for(;e.parentNode!==t&&9!==e.parentNode.nodeType&&!e.parentNode._isVuescroll;)e=e.parentNode;return e.parentNode==t&&(o=!0),o}var o=/(.*?)px/;function p(e){var t=o.exec(e);return t&&t[1]}function f(){return"ontouchstart"in window}function m(e){var t,o=document.documentElement.style;return e.opera&&"[object Opera]"===Object.prototype.toString.call(opera)?t="presto":"MozAppearance"in o?t="gecko":"WebkitAppearance"in o?t="webkit":"string"==typeof navigator.cpuClass&&(t="trident"),{trident:"ms",gecko:"moz",webkit:"webkit",presto:"O"}[t]}function v(e,t){var o="-"+m(window)+"-"+t,i=document.createElement("div");return i.style[e]=o,i.style[e]==o&&o}function g(){var e=navigator.userAgent.toLowerCase();return-1!==e.indexOf("msie")||-1!==e.indexOf("trident")||-1!==e.indexOf(" edge/")}function b(e,t,o,i){var l=(t=t[0]?t[0]:t).componentOptions&&t.componentOptions.tag||t.tag,r=t.componentOptions||t.data||{};return t.componentOptions&&(i.nativeOn=i.on,r.props=r.propsData,delete i.on,delete i.propsData),e(l,n({},i,r),o)}function S(e){var t=e.$parent;return!t._isVuescrollRoot&&t&&(t=t.$parent),t}function y(e,t){return function(e,t){if(e.hasResized)return;var o="display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; padding: 0; margin: 0; opacity: 0; z-index: -1000; pointer-events: none;",i=document.createElement("div");i.style.cssText=o;var l=document.createElement("object");l.style.cssText=o,l.type="text/html",l.tabIndex=-1,l.onload=function(){u(l.contentDocument.defaultView,"resize",t)},g()||(l.data="about:blank");i.isResizeElm=!0,i.appendChild(l),e.appendChild(i),g()&&(l.data="about:blank");return function(){l.contentDocument&&u(l.contentDocument.defaultView,"resize",t,"off"),e.removeChild(i),e.hasResized=!1}}(e,t)}var T=["slide","native","pure-native"],L=function(){},e=["mergedOptions.vuescroll.pullRefresh.tips","mergedOptions.vuescroll.pushLoad.tips","mergedOptions.rail","mergedOptions.bar"],w={vuescroll:{mode:"native",sizeStrategy:"percent",pullRefresh:{enable:!1,tips:{deactive:"Pull to Refresh",active:"Release to Refresh",start:"Refreshing...",beforeDeactive:"Refresh Successfully!"}},pushLoad:{enable:!1,tips:{deactive:"Push to Load",active:"Release to Load",start:"Loading...",beforeDeactive:"Load Successfully!"}},paging:!1,zooming:!0,snapping:{enable:!1,width:100,height:100},scroller:{bouncing:!0,locking:!0,minZoom:.5,maxZoom:3,speedMultiplier:1,penetrationDeceleration:.03,penetrationAcceleration:.08,preventDefault:!0}},scrollPanel:{initialScrollY:!1,initialScrollX:!1,scrollingX:!0,scrollingY:!0,speed:300,easing:void 0},scrollContent:{padding:!1},rail:{vRail:{width:"6px",pos:"right",background:"#01a99a",opacity:0},hRail:{height:"6px",pos:"bottom",background:"#01a99a",opacity:0}},bar:{showDelay:500,vBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1},hBar:{background:"#00a650",keepShow:!1,opacity:1,hover:!1}}};var t={data:function(){return{shouldStopRender:!1,mergedOptions:{vuescroll:{},scrollPanel:{},scrollContent:{},rail:{},bar:{}}}},created:function(){(function(){var t=this;if("vueScroll"===t.$options.name){var e=c(t.$vuescrollConfig,{}),o=c(w,e);t.$options.propsData.ops=t.$options.propsData.ops||{},Object.keys(t.$options.propsData.ops).forEach(function(e){s(t.mergedOptions,e,t.$options.propsData.ops)}),c(o,t.mergedOptions),s(t.mergedOptions.scrollContent,"paddPos",function(){return"padding-"+t.mergedOptions.rail.vRail.pos}),s(t.mergedOptions.scrollContent,"paddValue",function(){return t.mergedOptions.rail.vRail.width})}}).call(this),this._isVuescrollRoot=!0,this.renderError=function(e){var t=!1,o=e.vuescroll,i=e.scrollPanel;~T.indexOf(o.mode)||(_('The vuescroll\'s option "mode" should be one of the '+T),t=!0),o.paging==o.snapping.enable&&o.paging&&(o.pullRefresh||o.pushLoad)&&_("paging, snapping, (pullRefresh with pushLoad) can only one of them to be true.");var l=i.initialScrollY,r=i.initialScrollX;return l&&!String(l).match(/^\d+(\.\d+)?(%)?$/)&&_("The prop `initialScrollY` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),r&&!String(r).match(/^\d+(\.\d+)?(%)?$/)&&_("The prop `initialScrollX` should be a percent number like 10% or an exact number that greater than or equal to 0 like 100."),t}(this.mergedOptions)}};function x(t,o){return function(e){return o(t,e)}}function D(e,t){var o=null;return"easeInQuad"===e&&(o=t*t),"easeOutQuad"===e&&(o=t*(2-t)),"easeInOutQuad"===e&&(o=t<.5?2*t*t:(4-2*t)*t-1),"easeInCubic"===e&&(o=t*t*t),"easeOutCubic"===e&&(o=--t*t*t+1),"easeInOutCubic"===e&&(o=t<.5?4*t*t*t:(t-1)*(2*t-2)*(2*t-2)+1),"easeInQuart"===e&&(o=t*t*t*t),"easeOutQuart"===e&&(o=1- --t*t*t*t),"easeInOutQuart"===e&&(o=t<.5?8*t*t*t*t:1-8*--t*t*t*t),"easeInQuint"===e&&(o=t*t*t*t*t),"easeOutQuint"===e&&(o=1+--t*t*t*t*t),"easeInOutQuint"===e&&(o=t<.5?16*t*t*t*t*t:1+16*--t*t*t*t*t),o||t}var z=Date.now||function(){return+new Date},O={},P=1,C={effect:{}},A=null;A="undefined"!=typeof window?window:{},C.effect.Animate={requestAnimationFrame:function(e){var o=e.requestAnimationFrame||e.webkitRequestAnimationFrame||e.mozRequestAnimationFrame||e.oRequestAnimationFrame,t=!!o;if(o&&!/requestAnimationFrame\(\)\s*\{\s*\[native code\]\s*\}/i.test(o.toString())&&(t=!1),t)return function(e,t){o(e,t)};var i={},l=1,r=null,n=+new Date;return function(e){var t=l++;return i[t]=e,requestCount++,null===r&&(r=setInterval(function(){var e=+new Date,t=i;for(var o in i={},requestCount=0,t)t.hasOwnProperty(o)&&(t[o](e),n=e);2500<e-n&&(clearInterval(r),r=null)},1e3/60)),t}}(A),stop:function(e){var t=null!=O[e];return t&&(O[e]=null),t},isRunning:function(e){return null!=O[e]},start:function(s,a,c,u,_,h){var d=z(),p=d,f=0,m=0,v=P++;if(h||(h=document.body),v%20==0){var e={};for(var t in O)e[t]=!0;O=e}return O[v]=!0,C.effect.Animate.requestAnimationFrame(function e(t){var o=!0!==t,i=z();if(!O[v]||a&&!a(v))return O[v]=null,void(c&&c(60-m/((i-d)/1e3),v,!1));if(o)for(var l=Math.round((i-p)/(1e3/60))-1,r=0;r<Math.min(l,4);r++)e(!0),m++;u&&1<(f=(i-d)/u)&&(f=1);var n=_?_(f):f;!1!==s(n,i,o)&&1!==f||!o?o&&(p=i,C.effect.Animate.requestAnimationFrame(e,h)):(O[v]=null,c&&c(60-m/((i-d)/1e3),v,1===f||null==u))},h),v}};var E={};function B(e,t){var o=void 0;return o=(o=/(-?\d+(?:\.\d+?)?)%$/.exec(e))?t*(o=o[1]-0)/100:e-0}var M={mounted:function(){E[this._uid]=this},beforeDestroy:function(){delete E[this._uid]},methods:{scrollTo:function(e){var t=e.x,o=e.y,i=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],l=2<arguments.length&&void 0!==arguments[2]&&arguments[2];t=void 0===t?this.vuescroll.state.internalScrollLeft||0:B(t,this.scrollPanelElm.scrollWidth),o=void 0===o?this.vuescroll.state.internalScrollTop||0:B(o,this.scrollPanelElm.scrollHeight),this.internalScrollTo(t,o,i,l)},scrollBy:function(e){var t=e.dx,o=void 0===t?0:t,i=e.dy,l=void 0===i?0:i,r=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],n=this.vuescroll.state,s=n.internalScrollLeft,a=void 0===s?0:s,c=n.internalScrollTop,u=void 0===c?0:c;o&&(a+=B(o,this.scrollPanelElm.scrollWidth)),l&&(u+=B(l,this.scrollPanelElm.scrollHeight)),this.internalScrollTo(a,u,r)},zoomBy:function(e,t,o,i,l){"slide"==this.mode?this.scroller.zoomBy(e,t,o,i,l):h("zoomBy and zoomTo are only for slide mode!")},zoomTo:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1],o=arguments[2],i=arguments[3],l=arguments[4];"slide"==this.mode?this.scroller.zoomTo(e,t,o,i,l):h("zoomBy and zoomTo are only for slide mode!")},getCurrentPage:function(){if("slide"==this.mode&&this.mergedOptions.vuescroll.paging)return this.scroller.getCurrentPage();h("getCurrentPage and goToPage are only for slide mode and paging is enble!")},goToPage:function(e){var t=1<arguments.length&&void 0!==arguments[1]&&arguments[1];"slide"==this.mode&&this.mergedOptions.vuescroll.paging?this.scroller.goToPage(e,t):h("getCurrentPage and goToPage are only for slide mode and paging is enble!")},triggerRefreshOrLoad:function(e){if("slide"==this.mode){var t=this.mergedOptions.vuescroll.pullRefresh.enable,o=this.mergedOptions.vuescroll.pushLoad.enable;if("refresh"!=e||t)if("load"!=e||o)if("refresh"===e||"load"===e){if("start"!=this.vuescroll.state[e+"Stage"])return this.scroller.triggerRefreshOrLoad(e),!0}else h("param must be one of load and refresh!");else h("load must be enabled!");else h("refresh must be enabled!")}else h("You can only use triggerRefreshOrLoad in slide mode!")},getCurrentviewDom:function(){for(var e,t,o,i,l,r,n,s,a,c,u=this,_=("slide"==this.mode||"pure-native"==this.mode?this.scrollPanelElm:this.scrollContentElm).children,h=[],d=0;d<_.length;d++){var p=_.item(d);void 0,e=p.getBoundingClientRect(),t=e.left,o=e.top,i=e.width,l=e.height,r=u.$el.getBoundingClientRect(),n=r.left,s=r.top,a=r.height,c=r.width,0<t-n+i&&t-n<c&&0<o-s+l&&o-s<a&&!p.isResizeElm&&h.push(p)}return h},internalScrollTo:function(e,t,o,i){var l=this;if("native"==this.mode||"pure-native"==this.mode)if(o){!function(t,o,i,e,l,r){var n=t.scrollTop,s=t.scrollLeft,a=s,c=n;n+i<0&&(i=-n);var u=t.scrollHeight;u<n+i&&(i=u-n),s+o<0&&(o=-s),s+o>t.scrollWidth&&(o=t.scrollWidth-s);var _=x(l,D);C.effect.Animate.start(function(e){a=s+o*e,c=n+i*e,t.scrollTop=Math.floor(c),t.scrollLeft=Math.floor(a)},function(){return Math.abs(c-n)<=Math.abs(i)||Math.abs(a-s)<=Math.abs(o)},r,e,_)}(this.$refs.scrollPanel.$el,e-this.$refs.scrollPanel.$el.scrollLeft,t-this.$refs.scrollPanel.$el.scrollTop,this.mergedOptions.scrollPanel.speed,this.mergedOptions.scrollPanel.easing,function(){l.updateBarStateAndEmitEvent("handle-scroll-complete")})}else this.$refs.scrollPanel.$el.scrollTop=t,this.$refs.scrollPanel.$el.scrollLeft=e;else"slide"==this.mode&&this.scroller.scrollTo(e,t,o,void 0,i)},scrollIntoView:function(e){var t=!(1<arguments.length&&void 0!==arguments[1])||arguments[1],o=this.$el;if("string"==typeof e&&(e=o.querySelector(e)),d(e,o)){var i=this.$el.getBoundingClientRect(),l=i.left,r=i.top,n=e.getBoundingClientRect(),s=l-n.left,a=r-n.top;this.scrollBy({dx:-s,dy:-a},t)}else h("The element or selector you passed is not the element of Vuescroll, please pass the element that is in Vuescroll to scrollIntoView API. ")},refresh:function(){this.refreshInternalStatus()}}},$={methods:{updateNativeModeBarState:function(){var e=this.scrollPanelElm,t=this.$el,o="percent"==this.mergedOptions.vuescroll.sizeStrategy,i=o?t.clientWidth:p(this.vuescroll.state.width),l=o?t.clientHeight:p(this.vuescroll.state.height),r=100*l/e.scrollHeight,n=100*i/e.scrollWidth;this.bar.vBar.state.posValue=100*e.scrollTop/l,this.bar.hBar.state.posValue=100*e.scrollLeft/i,this.bar.vBar.state.size=r<100?r+"%":0,this.bar.hBar.state.size=n<100?n+"%":0}}},k=null,R=null;function X(e,t){for(var o in this.__callback=e,this.options={scrollingX:!0,scrollingY:!0,animating:!0,animationDuration:250,bouncing:!0,locking:!0,paging:!1,snapping:!1,zooming:!1,minZoom:.5,maxZoom:3,speedMultiplier:1,scrollingComplete:L,animatingEasing:"easeOutCubic",noAnimatingEasing:"easeInOutCubic",penetrationDeceleration:.03,penetrationAcceleration:.08},t)this.options[o]=t[o];k=x(this.options.animatingEasing,D),R=x(this.options.noAnimatingEasing,D)}var Y={__isSingleTouch:!1,__isTracking:!1,__didDecelerationComplete:!1,__isGesturing:!1,__isDragging:!1,__isDecelerating:!1,__isAnimating:!1,__clientLeft:0,__clientTop:0,__clientWidth:0,__clientHeight:0,__contentWidth:0,__contentHeight:0,__snapWidth:100,__snapHeight:100,__refreshHeight:null,__loadHeight:null,__refreshActive:!1,__refreshActivate:null,__refreshBeforeDeactivate:null,__refreshDeactivate:null,__refreshStart:null,__loadActive:null,__loadActivate:null,__loadBeforeDeactivate:null,__loadDeactivate:null,__loadStart:null,__zoomLevel:1,__scrollLeft:0,__scrollTop:0,__maxScrollLeft:0,__maxScrollTop:0,__scheduledLeft:0,__scheduledTop:0,__scheduledZoom:0,__currentPageX:null,__currentPageY:null,__totalXPage:null,__totalYPage:null,__disable:!1,__lastTouchLeft:null,__lastTouchTop:null,__lastTouchMove:null,__positions:null,__minDecelerationScrollLeft:null,__minDecelerationScrollTop:null,__maxDecelerationScrollLeft:null,__maxDecelerationScrollTop:null,__decelerationVelocityX:null,__decelerationVelocityY:null,setDimensions:function(e,t,o,i){var l=4<arguments.length&&void 0!==arguments[4]?arguments[4]:trye,r=this;e===+e&&(r.__clientWidth=e),t===+t&&(r.__clientHeight=t),o===+o&&(r.__contentWidth=o),i===+i&&(r.__contentHeight=i),r.__computeScrollMax(),r.scrollTo(r.__scrollLeft,r.__scrollTop,l)},setPosition:function(e,t){this.__clientLeft=e||0,this.__clientTop=t||0},setSnapSize:function(e,t){this.__snapWidth=e,this.__snapHeight=t},activatePullToRefresh:function(e,t){var o=t.activateCallback,i=t.deactivateCallback,l=t.startCallback,r=t.beforeDeactivateCallback,n=this;n.__refreshHeight=e,n.__refreshActivate=o,n.__refreshBeforeDeactivate=r,n.__refreshDeactivate=i,n.__refreshStart=l},activatePushToLoad:function(e,t){var o=t.activateCallback,i=t.deactivateCallback,l=t.startCallback,r=t.beforeDeactivateCallback,n=this;n.__loadHeight=e,n.__loadActivate=o,n.__loadBeforeDeactivate=r,n.__loadDeactivate=i,n.__loadStart=l},triggerRefreshOrLoad:function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"refresh",t=this.__isDecelerating;t&&(C.effect.Animate.stop(t),this.__isDecelerating=!1),"refresh"==e?(this.__publish(this.__scrollLeft,-this.__refreshHeight,this.__zoomLevel,!0),this.__refreshStart&&(this.__refreshStart(),this.__refreshActive=!0)):(this.__publish(this.__scrollLeft,this.__maxScrollTop+this.__loadHeight,this.__zoomLevel,!0),this.__loadStart&&(this.__loadStart(),this.__loadActive=!0))},finishRefreshOrLoad:function(){var e=this;e.__refreshBeforeDeactivate&&e.__refreshActive?(e.__refreshActive=!1,e.__refreshBeforeDeactivate(function(){e.__refreshDeactivate&&e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__refreshDeactivate&&e.__refreshActive&&(e.__refreshActive=!1,e.__refreshDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)),e.__loadBeforeDeactivate&&e.__loadActive?(e.__loadActive=!1,e.__loadBeforeDeactivate(function(){e.__loadDeactivate&&e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0)})):e.__loadDeactivate&&e.__loadActive&&(e.__loadActive=!1,e.__loadDeactivate(),e.scrollTo(e.__scrollLeft,e.__scrollTop,!0))},getValues:function(){return{left:this.__scrollLeft,top:this.__scrollTop,zoom:this.__zoomLevel}},getScrollMax:function(){return{left:this.__maxScrollLeft,top:this.__maxScrollTop}},zoomTo:function(e,t,o,i,l){var r=this;if(!r.options.zooming)throw new Error("Zooming is not enabled!");l&&(r.__zoomComplete=l),r.__isDecelerating&&(C.effect.Animate.stop(r.__isDecelerating),r.__isDecelerating=!1);var n=r.__zoomLevel;null==o&&(o=r.__clientWidth/2),null==i&&(i=r.__clientHeight/2),e=Math.max(Math.min(e,r.options.maxZoom),r.options.minZoom),r.__computeScrollMax(e);var s=(o+r.__scrollLeft)*e/n-o,a=(i+r.__scrollTop)*e/n-i;s>r.__maxScrollLeft?s=r.__maxScrollLeft:s<0&&(s=0),a>r.__maxScrollTop?a=r.__maxScrollTop:a<0&&(a=0),r.__publish(s,a,e,t)},zoomBy:function(e,t,o,i,l){this.zoomTo(this.__zoomLevel*e,t,o,i,l)},scrollTo:function(e,t,o,i,l){var r=this;if(r.__isDecelerating&&(C.effect.Animate.stop(r.__isDecelerating),r.__isDecelerating=!1),null!=i&&i!==r.__zoomLevel){if(!r.options.zooming)throw new Error("Zooming is not enabled!");e*=i,t*=i,r.__computeScrollMax(i)}else i=r.__zoomLevel;r.options.scrollingX||l?r.options.paging?e=Math.round(e/r.__clientWidth)*r.__clientWidth:r.options.snapping&&(e=Math.round(e/r.__snapWidth)*r.__snapWidth):e=r.__scrollLeft,r.options.scrollingY||l?r.options.paging?t=Math.round(t/r.__clientHeight)*r.__clientHeight:r.options.snapping&&(t=Math.round(t/r.__snapHeight)*r.__snapHeight):t=r.__scrollTop,e=Math.max(Math.min(r.__maxScrollLeft,e),0),t=Math.max(Math.min(r.__maxScrollTop,t),0),e===r.__scrollLeft&&t===r.__scrollTop&&(o=!1),r.__isTracking||r.__publish(e,t,i,o)},scrollBy:function(e,t,o){var i=this,l=i.__isAnimating?i.__scheduledLeft:i.__scrollLeft,r=i.__isAnimating?i.__scheduledTop:i.__scrollTop;i.scrollTo(l+(e||0),r+(t||0),o)},getCurrentPage:function(){return this.__computePage(),{x:this.__currentPageX,y:this.__currentPageY}},goToPage:function(e,t){var o=e.x,i=e.y;isNaN(o)&&(o=1),isNaN(i)&&(i=1),this.scrollTo((o-1)*this.__clientWidth,(i-1)*this.__clientHeight,t)},doMouseZoom:function(e,t,o,i){var l=0<e?.97:1.03;return this.zoomTo(this.__zoomLevel*l,!1,o-this.__clientLeft,i-this.__clientTop)},doTouchStart:function(e,t){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var o,i,l=this;l.__interruptedAnimation=!0,l.__isDecelerating&&(C.effect.Animate.stop(l.__isDecelerating),l.__isDecelerating=!1,l.__interruptedAnimation=!0),l.__isAnimating&&(C.effect.Animate.stop(l.__isAnimating),l.__isAnimating=!1,l.__interruptedAnimation=!0);var r=1===e.length;r?(o=e[0].pageX,i=e[0].pageY):(o=Math.abs(e[0].pageX+e[1].pageX)/2,i=Math.abs(e[0].pageY+e[1].pageY)/2),l.__initialTouchLeft=o,l.__initialTouchTop=i,l.__zoomLevelStart=l.__zoomLevel,l.__lastTouchLeft=o,l.__lastTouchTop=i,l.__lastTouchMove=t,l.__lastScale=1,l.__enableScrollX=!r&&l.options.scrollingX,l.__enableScrollY=!r&&l.options.scrollingY,l.__isTracking=!0,l.__didDecelerationComplete=!1,l.__isDragging=!r,l.__isSingleTouch=r,l.__positions=[]},doTouchMove:function(e,t,o){if(null==e.length)throw new Error("Invalid touch list: "+e);if(t instanceof Date&&(t=t.valueOf()),"number"!=typeof t)throw new Error("Invalid timestamp value: "+t);var i=this;if(i.__isTracking){var l,r;2===e.length?(l=Math.abs(e[0].pageX+e[1].pageX)/2,r=Math.abs(e[0].pageY+e[1].pageY)/2):(l=e[0].pageX,r=e[0].pageY);var n=i.__positions;if(i.__isDragging){var s=l-i.__lastTouchLeft,a=r-i.__lastTouchTop,c=i.__scrollLeft,u=i.__scrollTop,_=i.__zoomLevel;if(null!=o&&i.options.zooming){var h=_;if(_=_/i.__lastScale*o,h!==(_=Math.max(Math.min(_,i.options.maxZoom),i.options.minZoom))){var d=l-i.__clientLeft,p=r-i.__clientTop;c=(d+c)*_/h-d,u=(p+u)*_/h-p,i.__computeScrollMax(_)}}if(i.__enableScrollX){c-=s*this.options.speedMultiplier;var f=i.__maxScrollLeft;(f<c||c<0)&&(i.options.bouncing?c+=s/2*this.options.speedMultiplier:c=f<c?f:0)}if(i.__enableScrollY){u-=a*this.options.speedMultiplier;var m=i.__maxScrollTop;(m<u||u<0)&&(i.options.bouncing?(u+=a/2*this.options.speedMultiplier,i.__enableScrollX||null==i.__refreshHeight&&null==i.__loadHeight||(!i.__refreshActive&&u<=-i.__refreshHeight?(i.__refreshActive=!0,i.__refreshActivate&&i.__refreshActivate()):i.__refreshActive&&u>-i.__refreshHeight?(i.__refreshActive=!1,i.__refreshDeactivate&&i.__refreshDeactivate()):!i.__loadActive&&u>=i.__maxScrollTop+i.__loadHeight?(i.__loadActive=!0,i.__loadActivate&&i.__loadActivate()):i.__refreshActive&&u<i.__maxScrollTop+i.__loadHeight&&(i.__loadActive=!1,i.__loadDeactivate&&i.__loadDeactivate()))):u=m<u?m:0)}60<n.length&&n.splice(0,30),n.push(c,u,t),i.__publish(c,u,_)}else{var v=i.options.locking?3:0,g=Math.abs(l-i.__initialTouchLeft),b=Math.abs(r-i.__initialTouchTop);i.__enableScrollX=i.options.scrollingX&&v<=g,i.__enableScrollY=i.options.scrollingY&&v<=b,n.push(i.__scrollLeft,i.__scrollTop,t),i.__isDragging=(i.__enableScrollX||i.__enableScrollY)&&(5<=g||5<=b),i.__isDragging&&(i.__interruptedAnimation=!1)}i.__lastTouchLeft=l,i.__lastTouchTop=r,i.__lastTouchMove=t,i.__lastScale=o}},doTouchEnd:function(e){if(e instanceof Date&&(e=e.valueOf()),"number"!=typeof e)throw new Error("Invalid timestamp value: "+e);var t=this;if(t.__isTracking){if(t.__isTracking=!1,t.__isDragging)if(t.__isDragging=!1,t.__isSingleTouch&&t.options.animating&&e-t.__lastTouchMove<=100){for(var o=t.__positions,i=o.length-1,l=i,r=i;0<r&&o[r]>t.__lastTouchMove-100;r-=3)l=r;if(l!==i){var n=o[i]-o[l],s=t.__scrollLeft-o[l-2],a=t.__scrollTop-o[l-1];t.__decelerationVelocityX=s/n*(1e3/60),t.__decelerationVelocityY=a/n*(1e3/60);var c=t.options.paging||t.options.snapping?4:1;Math.abs(t.__decelerationVelocityX)>c||Math.abs(t.__decelerationVelocityY)>c?t.__refreshActive||t.__loadActive||t.__startDeceleration(e):t.__scrollComplete()}else t.__scrollComplete()}else 100<e-t.__lastTouchMove&&t.__scrollComplete();t.__isDecelerating||(t.__refreshActive&&t.__refreshStart?(t.__publish(t.__scrollLeft,-t.__refreshHeight,t.__zoomLevel,!0),t.__refreshStart&&t.__refreshStart()):t.__loadActive&&t.__loadStart?(t.__publish(t.__scrollLeft,t.__maxScrollTop+t.__loadHeight,t.__zoomLevel,!0),t.__loadStart&&t.__loadStart()):((t.__interruptedAnimation||t.__isDragging)&&t.__scrollComplete(),t.scrollTo(t.__scrollLeft,t.__scrollTop,!0,t.__zoomLevel),t.__refreshActive?(t.__refreshActive=!1,t.__refreshDeactivate&&t.__refreshDeactivate()):t.__loadActive&&(t.__loadActive=!1,t.__loadDeactivate&&t.__loadDeactivate()))),t.__positions.length=0}},onScroll:L,stop:function(){this.__disable=!0},start:function(){self.__disable=!0},__publish:function(e,t,o,i){var l=this;if(!l.__disable){isNaN(e)&&(e=this.__scrollLeft),isNaN(t)&&(t=this.__scrollTop);var r=l.__isAnimating;if(r&&(C.effect.Animate.stop(r),l.__isAnimating=!1),i&&l.options.animating){l.__scheduledLeft=e,l.__scheduledTop=t,l.__scheduledZoom=o;var n=l.__scrollLeft,s=l.__scrollTop,a=l.__zoomLevel,c=e-n,u=t-s,_=o-a;l.__isAnimating=C.effect.Animate.start(function(e,t,o){o&&(l.__scrollLeft=n+c*e,l.__scrollTop=s+u*e,l.__zoomLevel=a+_*e,l.__callback&&(l.__callback(l.__scrollLeft,l.__scrollTop,l.__zoomLevel),l.onScroll()))},function(e){return l.__isAnimating===e},function(e,t,o){t===l.__isAnimating&&(l.__isAnimating=!1),(l.__didDecelerationComplete||o)&&l.__scrollComplete(),l.options.zooming&&(l.__computeScrollMax(),l.__zoomComplete&&(l.__zoomComplete(),l.__zoomComplete=null))},l.options.animationDuration,r?k:R)}else l.__scheduledLeft=l.__scrollLeft=e,l.__scheduledTop=l.__scrollTop=t,l.__scheduledZoom=l.__zoomLevel=o,l.__callback&&(l.__callback(e,t,o),l.onScroll()),l.options.zooming&&(l.__computeScrollMax(),l.__zoomComplete&&(l.__zoomComplete(),l.__zoomComplete=null))}},__computeScrollMax:function(e){var t=this;null==e&&(e=t.__zoomLevel),t.__maxScrollLeft=Math.max(t.__contentWidth*e-t.__clientWidth,0),t.__maxScrollTop=Math.max(t.__contentHeight*e-t.__clientHeight,0)},__computePage:function(){var e=this,t=e.__clientWidth,o=e.__clientHeight,i=e.__scrollLeft,l=e.__scrollTop;e.__totalXPage=Math.ceil(e.__contentWidth/t),e.__currentPageX=Math.ceil(i/t+1),e.__totalYPage=Math.ceil(e.__contentHeight/o),e.__currentPageY=Math.ceil(l/o+1)},__scrollComplete:function(){this.options.scrollingComplete()},__startDeceleration:function(){var i=this;if(i.options.paging){var e=Math.max(Math.min(i.__scrollLeft,i.__maxScrollLeft),0),t=Math.max(Math.min(i.__scrollTop,i.__maxScrollTop),0),o=i.__clientWidth,l=i.__clientHeight;i.__minDecelerationScrollLeft=Math.floor(e/o)*o,i.__minDecelerationScrollTop=Math.floor(t/l)*l,i.__maxDecelerationScrollLeft=Math.ceil(e/o)*o,i.__maxDecelerationScrollTop=Math.ceil(t/l)*l}else i.__minDecelerationScrollLeft=0,i.__minDecelerationScrollTop=0,i.__maxDecelerationScrollLeft=i.__maxScrollLeft,i.__maxDecelerationScrollTop=i.__maxScrollTop;var r=i.options.snapping?4:.001;i.__isDecelerating=C.effect.Animate.start(function(e,t,o){i.__stepThroughDeceleration(o)},function(){var e=Math.abs(i.__decelerationVelocityX)>=r||Math.abs(i.__decelerationVelocityY)>=r;return e||(i.__didDecelerationComplete=!0),e},function(){i.__isDecelerating&&(i.__isDecelerating=!1,i.__didDecelerationComplete&&i.__scrollComplete(),i.scrollTo(i.__scrollLeft,i.__scrollTop,i.options.snapping))})},__stepThroughDeceleration:function(e){var t=this,o=t.__scrollLeft+t.__decelerationVelocityX,i=t.__scrollTop+t.__decelerationVelocityY;if(!t.options.bouncing){var l=Math.max(Math.min(t.__maxDecelerationScrollLeft,o),t.__minDecelerationScrollLeft);l!==o&&(o=l,t.__decelerationVelocityX=0);var r=Math.max(Math.min(t.__maxDecelerationScrollTop,i),t.__minDecelerationScrollTop);r!==i&&(i=r,t.__decelerationVelocityY=0)}if(e?t.__publish(o,i,t.__zoomLevel):(t.__scrollLeft=o,t.__scrollTop=i),!t.options.paging){t.__decelerationVelocityX*=.95,t.__decelerationVelocityY*=.95}if(t.options.bouncing){var n=0,s=0,a=t.options.penetrationDeceleration,c=t.options.penetrationAcceleration;o<t.__minDecelerationScrollLeft?n=t.__minDecelerationScrollLeft-o:o>t.__maxDecelerationScrollLeft&&(n=t.__maxDecelerationScrollLeft-o),i<t.__minDecelerationScrollTop?s=t.__minDecelerationScrollTop-i:i>t.__maxDecelerationScrollTop&&(s=t.__maxDecelerationScrollTop-i),0!==n&&(n*t.__decelerationVelocityX<=0?t.__decelerationVelocityX+=n*a:t.__decelerationVelocityX=n*c),0!==s&&(s*t.__decelerationVelocityY<=0?t.__decelerationVelocityY+=s*a:t.__decelerationVelocityY=s*c)}}};for(var H in Y)X.prototype[H]=Y[H];function V(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var W=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e};var I={vertical:{size:"height",opsSize:"width",posName:"top",opposName:"bottom",page:"pageY",scroll:"scrollTop",scrollSize:"scrollHeight",offset:"offsetHeight",client:"clientY",axis:"Y"},horizontal:{size:"width",opsSize:"height",posName:"left",opposName:"right",page:"pageX",scroll:"scrollLeft",scrollSize:"scrollWidth",offset:"offsetWidth",client:"clientX",axis:"X"}};function N(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}var j={},q=/rgb\(/,Z=/rgb\((.*)\)/;function F(e,t,o){var i="vertical"===o?"Y":"X",l=o.charAt(0)+"Bar",r=o.charAt(0)+"Rail";return!t.bar[l].state.size||!t.mergedOptions.scrollPanel["scrolling"+i]||"pure-native"==t.mode||t.refreshLoad&&"vertical"!==o&&"slide"===t.mode?null:e("bar",{props:{type:o,ops:{bar:t.mergedOptions.bar[l],rail:t.mergedOptions.rail[r]},state:t.bar[l].state},on:{setBarClick:t.setBarClick},ref:o+"Bar"})}function Q(e,t){var o={ref:"scrollPanel",style:{},class:[],nativeOn:{scroll:t.handleScroll},props:{ops:t.mergedOptions.scrollPanel}};if("native"==t.mode){o.class.push("__native"),t.mergedOptions.scrollPanel.scrollingY?o.style.overflowY=t.bar.vBar.state.size?"scroll":"":o.style.overflowY="hidden",t.mergedOptions.scrollPanel.scrollingX?o.style.overflowX=t.bar.hBar.state.size?"scroll":"":o.style.overflowX="hidden";var i=function(){if(r.prototype.$isServer)return 0;if(void 0!==a)return a;var e=document.createElement("div");e.style.visibility="hidden",e.style.width="100px",e.style.position="absolute",e.style.top="-9999px",document.body.appendChild(e);var t=e.offsetWidth;e.style.overflow="scroll";var o=document.createElement("div");o.style.width="100%",e.appendChild(o);var i=o.offsetWidth;return e.parentNode.removeChild(e),a=t-i}();i||"pure-native"==t.mergedOptions.vuescroll.mode?(t.bar.vBar.state.size&&t.mergedOptions.scrollPanel.scrollingY&&(o.style.marginRight="-"+i+"px"),t.bar.hBar.state.size&&t.mergedOptions.scrollPanel.scrollingX&&(o.style.height="calc(100% + "+i+"px)")):o.class.push("__hidebar"),o.style.transformOrigin="",o.style.transform=""}else if("slide"==t.mode){o.class.push("__slide");var l=v("width","fit-content");l?o.style.width=l:o.display="inline-block"}else"pure-native"==t.mode&&(o.class.push("__pure-native"),t.mergedOptions.scrollPanel.scrollingY?o.style.overflowY="auto":o.style.overflowY="hidden",t.mergedOptions.scrollPanel.scrollingX?o.style.overflowX="auto":o.style.overflowX="hidden");return e("scrollPanel",o,[function(e,t){{if("native"==e.mode)return[(r=t,n=e,r("scrollContent",{props:{ops:n.mergedOptions.scrollContent}},[[n.$slots.default]]))];if("slide"==e.mode){var o=[e.$slots.default];if(e.mergedOptions.vuescroll.pullRefresh.enable){var i=null;i=G(t,e,"refresh"),o.unshift(t("div",{class:"vuescroll-refresh",ref:"refreshDom",key:"refshDom"},[[i,e.pullRefreshTip]]))}if(e.mergedOptions.vuescroll.pushLoad.enable){var l=null;l=G(t,e,"load"),o.push(t("div",{class:"vuescroll-load",ref:"loadDom",key:"loadDom"},[[l,e.pushLoadTip]]))}return o}if("pure-native"==e.mode)return[e.$slots.default]}var r,n}(t,e)])}function G(e,t,o){var i=t.vuescroll.state[o+"Stage"],l=null;if(l=t.$slots[o+"-"+i])return l[0];switch(i){case"deactive":l=e("svg",{attrs:{version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 1000 1000","enable-background":"new 0 0 1000 1000",xmlSpace:"preserve"}},[e("metadata",[" Svg Vector Icons : http://www.sfont.cn "]),e("g",[e("g",{attrs:{transform:"matrix(1 0 0 -1 0 1008)"}},[e("path",{attrs:{d:"M10,543l490,455l490-455L885,438L570,735.5V18H430v717.5L115,438L10,543z"}})])])]);break;case"start":if(g()){l=null;break}l=e("svg",{attrs:{version:"1.1",id:"loader-1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 50 50",xmlSpace:"preserve"},style:"enable-background:new 0 0 50 50;"},[e("path",{attrs:{fill:"#000",d:"M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"}},[e("animateTransform",{attrs:{attributeType:"xml",attributeName:"transform",type:"rotate",from:"0 25 25",to:"360 25 25",dur:"0.6s",repeatCount:"indefinite"}})])]);break;case"active":l=e("svg",{attrs:{version:"1.1",xmlns:"http://www.w3.org/2000/svg",xmlnsXlink:"http://www.w3.org/1999/xlink",x:"0px",y:"0px",viewBox:"0 0 1000 1000","enable-background":"new 0 0 1000 1000",xmlSpace:"preserve"}},[e("metadata",[" Svg Vector Icons : http://www.sfont.cn "]),e("g",[e("g",{attrs:{transform:"matrix(1 0 0 -1 0 1008)"}},[e("path",{attrs:{d:"M500,18L10,473l105,105l315-297.5V998h140V280.5L885,578l105-105L500,18z"}})])])])}return l}var J={name:"vueScroll",components:{bar:{name:"bar",props:{ops:{type:Object,required:!0},state:{type:Object,required:!0},type:{type:String,required:!0}},computed:{bar:function(){return I[this.type]}},render:function(e){var t,o,i=this,l=function(e,t){var o=e+"&"+t;if(j[o])return j[o];var i=document.createElement("div");i.style.background=e,document.body.appendChild(i);var l=window.getComputedStyle(i).backgroundColor;return document.body.removeChild(i),q.test(l)?j[o]="rgba("+Z.exec(l)[1]+", "+t+")":e}(i.ops.rail.background,i.ops.rail.opacity),r={style:(N(t={},i.bar.size,i.state.size),N(t,"background",i.ops.bar.background),N(t,"opacity",i.state.opacity),N(t,"transform","translate"+I[i.type].axis+"("+i.state.posValue+"%)"),t),class:"vuescroll-"+i.type+"-bar",ref:"inner",on:{}};return i.ops.bar.hover&&(r.on.mouseenter=function(){i.$el.style.background=i.ops.hover},r.on.mouseleave=function(){i.$el.style.background=i.ops.background}),f()?r.on.touchstart=function(o){function t(e){if(o.axisStartPos){var t=(e.touches[0][o.bar.client]-o.$el.getBoundingClientRect()[o.bar.posName]-o.axisStartPos)/o.$el[o.bar.offset];parent.scrollTo(N({},o.bar.axis.toLowerCase(),parent.$refs.scrollPanel.$el[o.bar.scrollSize]*t),!1)}}function i(){o.$emit("setBarClick",!1),document.onselectstart=null,o.$parent.hideBar(),o.axisStartPos=0,u(document,"touchmove",t,!1,"off"),u(document,"touchend",i,!1,"off")}return function(e){e.stopImmediatePropagation(),e.preventDefault(),document.onselectstart=function(){return!1},o.axisStartPos=e.touches[0][o.bar.client]-o.$refs.inner.getBoundingClientRect()[o.bar.posName],o.$emit("setBarClick",!0),u(document,"touchmove",t),u(document,"touchend",i)}}(this):r.on.mousedown=function(o){var i=S(o);function t(e){if(o.axisStartPos){var t=(e[o.bar.client]-o.$el.getBoundingClientRect()[o.bar.posName]-o.axisStartPos)/o.$el[o.bar.offset];i.scrollTo(N({},o.bar.axis.toLowerCase(),i.$refs.scrollPanel.$el[o.bar.scrollSize]*t),!1)}}function l(){o.$emit("setBarClick",!1),document.onselectstart=null,i.hideBar(),o.axisStartPos=0,u(document,"mousemove",t,!1,"off"),u(document,"mouseup",l,!1,"off")}return function(e){e.stopImmediatePropagation(),document.onselectstart=function(){return!1},o.axisStartPos=e[o.bar.client]-o.$refs.inner.getBoundingClientRect()[o.bar.posName],o.$emit("setBarClick",!0),u(document,"mousemove",t),u(document,"mouseup",l)}}(this),e("div",{class:"vuescroll-"+i.type+"-rail",style:(o={borderRadius:i.ops.rail[i.bar.opsSize],background:l},N(o,i.bar.opsSize,i.ops.rail[i.bar.opsSize]),N(o,i.ops.rail.pos,"2px"),o),on:{click:function(e){(function(e){var t=S(this),o=this.bar,i=o.client,l=o.offset,r=o.posName,n=o.axis,s=this.$refs.inner[l],a=(e[i]-e.currentTarget.getBoundingClientRect()[r]-s/2)/e.currentTarget[l];t.scrollTo(N({},n.toLowerCase(),100*a+"%"))}).call(i,e)}}},[e("div",r)])}},scrollContent:{name:"scrollContent",functional:!0,props:{ops:{type:Object},state:{type:Object,default:function(){return{}}}},render:function(e,t){var o=t.props,i=t.slots,l=t.parent,r=c(o.state.style,{});r.position="relative";var n=v("width","fit-content");n?r.width=n:r.display="inline-block",r.boxSizing="border-box",o.ops.padding&&(r[o.ops.paddPos]=o.ops.paddValue);var s={style:r,ref:"scrollContent",class:"vuescroll-content"},a=l.$slots["scroll-content"];return a?b(e,a,i().default,s):e("div",s,[i().default])}},scrollPanel:{name:"scrollPanel",props:{ops:{type:Object,required:!0}},methods:{updateInitialScroll:function(){var e=0,t=0,o=S(this);this.ops.initialScrollX&&(e=this.ops.initialScrollX),this.ops.initialScrollY&&(t=this.ops.initialScrollY),(e||t)&&o.scrollTo({x:e,y:t})}},mounted:function(){var e=this;setTimeout(function(){e._isDestroyed||e.updateInitialScroll()},0)},render:function(e){var t={class:["vuescroll-panel"]},o=S(this).$slots["scroll-panel"];return o?b(e,o,this.$slots.default,t):e("div",t,[[this.$slots.default]])}}},props:{ops:{type:Object}},mixins:[t,M,$,{methods:{updateScroller:function(){var e=this.$el.clientWidth,t=this.$el.clientHeight,o=this.scrollPanelElm.scrollWidth,i=this.scrollPanelElm.scrollHeight,l=0;if(this.mergedOptions.vuescroll.pullRefresh.enable){var r=this.$refs.refreshDom.elm||this.$refs.refreshDom;l=r.offsetHeight,r.style.marginTop||(r.style.marginTop=-l+"px")}this.mergedOptions.vuescroll.pushLoad.enable&&(i-=(this.$refs.loadDom.elm||this.$refs.loadDom).offsetHeight);this.scroller.setDimensions(e,t,o,i,!1)},registryScroller:function(){var t=this,e=this.mergedOptions.vuescroll.scroller.preventDefault,o=this.mergedOptions.vuescroll.paging,i=this.mergedOptions.vuescroll.snapping.enable,l=!this.refreshLoad&&!o&&!i&&this.mergedOptions.vuescroll.zooming,r=this.mergedOptions.scrollPanel,n=r.scrollingY,s=r.scrollingX;this.scroller=new X(function(i,e,l,t){var o=null,r=null;"string"==typeof i&&(r="vertical"==i?(o=0)||t:(o=t)&&0);var n=m(e),s=document.createElement("div"),a=n+"Perspective",c="transform";return void 0!==s.style[a]?"string"==typeof i?V({},c,"translate3d("+o+l+","+r+l+",0)"):function(e,t,o){i.style[c]="translate3d("+-e+l+","+-t+l+",0) scale("+o+")"}:void 0!==s.style[c]?"string"==typeof i?V({},c,"translate("+o+l+","+r+l+")"):function(e,t,o){i.style[c]="translate("+-e+l+","+-t+l+") scale("+o+")"}:void 0}(this.scrollPanelElm,window,"px"),W({},this.mergedOptions.vuescroll.scroller,{zooming:l,scrollingY:n,scrollingX:s&&!this.refreshLoad,animationDuration:this.mergedOptions.scrollPanel.speed,paging:o,snapping:i,scrollingComplete:function(){t.updateBarStateAndEmitEvent("handle-scroll-complete")}})),i&&this.scroller.setSnapSize(this.mergedOptions.vuescroll.snapping.width,this.mergedOptions.vuescroll.snapping.height);var a=this.$el.getBoundingClientRect();this.scroller.setPosition(a.left+this.$el.clientLeft,a.top+this.$el.clientTop);var c=function(e,t,o,i,l){var r=null;function n(e){e.touches[0]&&e.touches[0].target&&e.touches[0].target.tagName.match(/input|textarea|select/i)||(o("mousedown"),t.doTouchStart(e.touches,e.timeStamp),l&&e.preventDefault(),document.addEventListener("touchmove",s,{passive:!1}))}function s(e){o("mousemove"),t.doTouchMove(e.touches,e.timeStamp,e.scale),e.preventDefault()}function a(e){o("mouseup"),t.doTouchEnd(e.timeStamp),document.removeEventListener("touchmove",s)}function c(e){t.doTouchEnd(e.timeStamp)}function u(e){e.target.tagName.match(/input|textarea|select/i)||(o("mousedown"),t.doTouchStart([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),l&&e.preventDefault(),p=!0)}function _(e){p&&(o("mousemove"),t.doTouchMove([{pageX:e.pageX,pageY:e.pageY}],e.timeStamp),p=!0)}function h(e){p&&(o("mouseup"),t.doTouchEnd(e.timeStamp),p=!1)}function d(e){t.doMouseZoom(e.detail?-120*e.detail:e.wheelDelta,e.timeStamp,e.pageX,e.pageY)}if("ontouchstart"in window)e.addEventListener("touchstart",n,!1),document.addEventListener("touchend",a,!1),document.addEventListener("touchcancel",c,!1),r=function(){e.removeEventListener("touchstart",n,!1),document.removeEventListener("touchend",a,!1),document.removeEventListener("touchcancel",c,!1)};else{var p=!1;e.addEventListener("mousedown",u,!1),document.addEventListener("mousemove",_,!1),document.addEventListener("mouseup",h,!1),i&&e.addEventListener(-1<navigator.userAgent.indexOf("Firefox")?"DOMMouseScroll":"mousewheel",d,!1),r=function(){e.removeEventListener("mousedown",u,!1),document.removeEventListener("mousemove",_,!1),document.removeEventListener("mouseup",h,!1),e.removeEventListener(-1<navigator.userAgent.indexOf("Firefox")?"DOMMouseScroll":"mousewheel",d,!1)}}return t.onScroll=function(){o("onscroll")},r}(this.$el,this.scroller,function(e){switch(e){case"mousedown":t.vuescroll.state.isDragging=!0;break;case"onscroll":t.handleScroll(!1);break;case"mouseup":t.vuescroll.state.isDragging=!1}},l,e);return this.mergedOptions.vuescroll.pullRefresh.enable&&this.registryEvent("refresh"),this.mergedOptions.vuescroll.pushLoad.enable&&this.registryEvent("load"),this.updateScroller(),c},updateSlideModeBarState:function(){var e,t,o=this.$el,i=this.scroller,l=0,r=0,n=this.$el.clientHeight,s=this.$el.clientHeight,a=n+this.scroller.__maxScrollLeft,c=s+this.scroller.__maxScrollTop,u=n<a&&this.mergedOptions.scrollPanel.scrollingX,_=s<c&&this.mergedOptions.scrollPanel.scrollingY;u&&(i.__scrollLeft<0?l=-i.__scrollLeft:i.__scrollLeft>i.__maxScrollLeft&&(l=i.__scrollLeft-i.__maxScrollLeft)),_&&(i.__scrollTop<0?r=-i.__scrollTop:i.__scrollTop>i.__maxScrollTop&&(r=i.__scrollTop-i.__maxScrollTop)),e=100*s/(c+r),t=100*n/(a+l);var h=Math.min(Math.max(0,i.__scrollTop),i.__maxScrollTop),d=Math.min(Math.max(0,i.__scrollLeft),i.__maxScrollLeft);this.bar.vBar.state.posValue=100*(h+r)/o.clientHeight,this.bar.hBar.state.posValue=100*(d+l)/o.clientWidth,i.__scrollLeft<0&&(this.bar.hBar.state.posValue=0),i.__scrollTop<0&&(this.bar.vBar.state.posValue=0),this.bar.vBar.state.size=e<100?e+"%":0,this.bar.hBar.state.size=t<100?t+"%":0},registryEvent:function(e){var t,o,i,l,r,n,s,a,c,u="refresh"==e?"refreshDom":"loadDom",_="refresh"==e?this.scroller.activatePullToRefresh:this.scroller.activatePushToLoad,h="refresh"==e?"refreshStage":"loadStage",d=this.$refs[u].elm||this.$refs[u],p=(t=e,o=h,l=d,r=(i=this).$listeners,n=function(){i.vuescroll.state[o]="active"},s=function(){i.vuescroll.state[o]="deactive"},a=function(){i.vuescroll.state[o]="start",setTimeout(function(){i.scroller.finishRefreshOrLoad()},2e3)},c=function(e){i.vuescroll.state[o]="beforeDeactive",setTimeout(function(){e()},500)},r[t+"-activate"]&&(n=function(){i.vuescroll.state[o]="active",i.$emit(t+"-activate",i,l)}),r[t+"-before-deactivate"]&&(c=function(e){i.vuescroll.state[o]="beforeDeactive",i.$emit(t+"-before-deactivate",i,l,e.bind(i.scroller))}),r[t+"-deactivate"]&&(s=function(){i.vuescroll.state[o]="deactive",i.$emit(t+"-deactivate",i,l)}),r[t+"-start"]&&(a=function(){i.vuescroll.state[o]="start",i.$emit(t+"-start",i,l,i.scroller.finishRefreshOrLoad.bind(i.scroller))}),{activateCallback:n,deactivateCallback:s,startCallback:a,beforeDeactivateCallback:c}),f=d.offsetHeight;_.bind(this.scroller)(f,p)}}}],mounted:function(){var e=this;this.renderError||(this.initVariables(),this.initWatchOpsChange(),this.refreshInternalStatus(),this.$nextTick(function(){e._isDestroyed||(e.updateBarStateAndEmitEvent(),e.scrollToAnchor())},0))},beforeDestroy:function(){this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.destroyResize&&(this.destroyResize(),this.destroyResize=null)},data:function(){return{vuescroll:{state:{isDragging:!1,isClickingBar:!1,pointerLeave:!0,internalScrollTop:0,internalScrollLeft:0,posX:null,posY:null,refreshStage:"deactive",loadStage:"deactive",height:"100%",width:"100%"}},bar:{vBar:{state:{posValue:0,size:0,opacity:0}},hBar:{state:{posValue:0,size:0,opacity:0}},renderError:!1}}},render:function(e){var t=this;if(t.renderError)return e("div",[[t.$slots.default]]);var o={style:{height:t.vuescroll.state.height,width:t.vuescroll.state.width,padding:0},class:"vuescroll"};f()?o.on={touchstart:function(){t.vuescroll.state.pointerLeave=!1,t.updateBarStateAndEmitEvent()},touchend:function(){t.vuescroll.state.pointerLeave=!0,t.hideBar()},touchmove:function(){t.vuescroll.state.pointerLeave=!1,t.updateBarStateAndEmitEvent()}}:o.on={mouseenter:function(){t.vuescroll.state.pointerLeave=!1,t.updateBarStateAndEmitEvent()},mouseleave:function(){t.vuescroll.state.pointerLeave=!0,t.hideBar()},mousemove:function(){t.vuescroll.state.pointerLeave=!1,t.updateBarStateAndEmitEvent()}};var i=this.$slots["scroll-container"],l=[Q(e,t),F(e,t,"vertical"),F(e,t,"horizontal")];return i?b(e,i,l,o):e("div",o,[l])},computed:{scrollPanelElm:function(){return this.$refs.scrollPanel._isVue?this.$refs.scrollPanel.$el:this.$refs.scrollPanel},scrollContentElm:function(){return this.$refs.scrollContent._isVue?this.$refs.scrollContent.$el:this.$refs.scrollContent},mode:function(){return this.mergedOptions.vuescroll.mode},pullRefreshTip:function(){return this.mergedOptions.vuescroll.pullRefresh.tips[this.vuescroll.state.refreshStage]},pushLoadTip:function(){return this.mergedOptions.vuescroll.pushLoad.tips[this.vuescroll.state.loadStage]},refreshLoad:function(){return this.mergedOptions.vuescroll.pullRefresh.enable||this.mergedOptions.vuescroll.pushLoad.enable}},methods:{updateBarStateAndEmitEvent:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null;if("native"==this.mode||"pure-native"==this.mode)this.updateNativeModeBarState();else if("slide"==this.mode){if(!this.scroller)return;this.updateSlideModeBarState()}e&&this.emitEvent(e,t),this.showAndDefferedHideBar()},updateMode:function(){var e=this.vuescroll.state.internalScrollLeft,t=this.vuescroll.state.internalScrollTop;this.destroyScroller&&(this.scroller.stop(),this.destroyScroller(),this.destroyScroller=null),"slide"==this.mode?this.destroyScroller=this.registryScroller():"native"!=this.mode&&"pure-native"!=this.mode||(this.scrollPanelElm.style.transform="",this.scrollPanelElm.style.transformOrigin=""),this.scrollTo({x:e,y:t},!1,!0)},handleScroll:function(e){this.recordCurrentPos(),this.updateBarStateAndEmitEvent("handle-scroll",e)},setBarClick:function(e){this.vuescroll.state.isClickingBar=e},showAndDefferedHideBar:function(){var e=this;this.showBar(),this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=0),this.timeoutId=setTimeout(function(){e.timeoutId=0,e.hideBar()},this.mergedOptions.bar.showDelay)},emitEvent:function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,o=this.scrollPanelElm,i=o.scrollHeight,l=o.scrollWidth,r=o.clientHeight,n=o.clientWidth,s=o.scrollTop,a=o.scrollLeft,c={type:"vertical"},u={type:"horizontal"};"slide"==this.mode&&(i=this.scroller.__contentHeight,l=this.scroller.__contentWidth,s=this.scroller.__scrollTop,a=this.scroller.__scrollLeft,r=this.$el.clientHeight,n=this.$el.clientWidth),c.process=Math.min(s/(i-r),1),u.process=Math.min(a/(l-n),1),c.barSize=this.bar.vBar.state.size,u.barSize=this.bar.hBar.state.size,c.scrollTop=s,u.scrollLeft=a,c.directionY=this.vuescroll.state.posY,u.directionX=this.vuescroll.state.posX,this.$emit(e,c,u,t)},showBar:function(){this.bar.vBar.state.opacity=this.mergedOptions.bar.vBar.opacity,this.bar.hBar.state.opacity=this.mergedOptions.bar.hBar.opacity},hideBar:function(){this.vuescroll.state.isDragging||(this.mergedOptions.bar.vBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.vBar.state.opacity=0),this.mergedOptions.bar.hBar.keepShow||this.vuescroll.state.isClickingBar||!this.vuescroll.state.pointerLeave||(this.bar.hBar.state.opacity=0))},registryResize:function(){var t=this;this.destroyResize&&this.destroyResize();var e=null;"slide"==this.mode||"pure-native"==this.mode?e=this.scrollPanelElm:"native"==this.mode&&(e=this.scrollContentElm);var o=function(){t.updateBarStateAndEmitEvent(),"slide"==t.mode&&t.updateScroller()};window.addEventListener("resize",o,!1);var i=y(e,function(){var e={};"slide"==t.mode?(t.updateScroller(),e.width=t.scroller.__contentWidth,e.height=t.scroller.__contentHeight):"native"!=t.mode&&"pure-native"!=t.mode||(e.width=t.scrollPanelElm.scrollWidth,e.height=t.scrollPanelElm.scrollHeight),t.updateBarStateAndEmitEvent("handle-resize",e)});this.destroyResize=function(){window.removeEventListener("resize",o,!1),i()}},registryParentResize:function(){this.destroyParentDomResize=y(this.$el.parentNode,this.useNumbericSize)},useNumbericSize:function(){var e=this.$el.parentNode,t=e.style.position;t&&"static"!=t||(this.$el.parentNode.style.position="relative"),this.vuescroll.state.height=e.offsetHeight+"px",this.vuescroll.state.width=e.offsetWidth+"px"},usePercentSize:function(){this.vuescroll.state.height="100%",this.vuescroll.state.width="100%"},setVsSize:function(){"number"==this.mergedOptions.vuescroll.sizeStrategy?(this.useNumbericSize(),this.registryParentResize()):"percent"==this.mergedOptions.vuescroll.sizeStrategy&&(this.destroyParentDomResize&&(this.destroyParentDomResize(),this.destroyParentDomResize=null),this.usePercentSize())},recordCurrentPos:function(){var e=this.mode;this.mode!==this.lastMode&&(e=this.lastMode,this.lastMode=this.mode);var t=this.vuescroll.state,o=function(e,t){var o={};switch(e){case"native":case"pure-native":o={x:t.scrollPanelElm.scrollLeft,y:t.scrollPanelElm.scrollTop};break;case"slide":o={x:t.scroller.__scrollLeft,y:t.scroller.__scrollTop}}return o}(e,this),i=t.internalScrollLeft,l=t.internalScrollTop;t.posX=0<i-o.x?"right":i-o.x<0?"left":null,t.posY=0<l-o.y?"up":l-o.y<0?"down":null,t.internalScrollLeft=o.x,t.internalScrollTop=o.y},refreshInternalStatus:function(){this.setVsSize(),this.registryResize(),this.updateMode(),this.updateBarStateAndEmitEvent()},initWatchOpsChange:function(){var t=this,o={deep:!0,sync:!0};this.$watch("mergedOptions",function(){t.recordCurrentPos(),setTimeout(function(){if(1==t.isSmallChangeThisTick)return t.isSmallChangeThisTick=!1,void t.updateBarStateAndEmitEvent();t.refreshInternalStatus()},0)},o),e.forEach(function(e){t.$watch(e,function(){t.isSmallChangeThisTick=!0},o)})},scrollToAnchor:function(){var e=window.location.hash;if(e&&(!(e=e.slice(e.lastIndexOf("#")))||/^#[a-zA-Z_]\d*$/.test(e))){var t=document.querySelector(e);!d(t,this.$el)||this.mergedOptions.scrollPanel.initialScrollY||this.mergedOptions.scrollPanel.initialScrollX||this.scrollIntoView(t)}},initVariables:function(){this.lastMode=this.mode,this.$el._isVuescroll=!0}}},K={install:function(e){e.component(J.name,J),e.prototype.$vuescrollConfig=c(w,{})},version:"4.6.9",refreshAll:function(){for(var e in E)E[e].refresh()}};return"undefined"!=typeof window&&window.Vue&&r.use(K),K});
//# sourceMappingURL=vuescroll.min.js.map