!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t(e["happy-scroll"]={},e.Vue$)}(this,function(e,t){"use strict";function n(e,t,n){document.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}function i(e,t,n){document.addEventListener?e.removeEventListener(t,n):e.detachEvent("on"+t,n)}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){return t={exports:{}},e(t,t.exports),t.exports}function s(){var e={},t=0,n=0,i=0;return{add:function(o,r){r||(r=o,o=0),o>n?n=o:o(e||14))return t=n,!0}},f=function(e,t,n){var i,o,r,s,a,l=function l(){var c=(new Date).getTime()-s;c=0?i=setTimeout(l,t-c):(i=null,n||(a=e.apply(r,o),i||(r=o=null)))};return function(){r=this,o=arguments,s=(new Date).getTime();var c=n&&!i;return i||(i=setTimeout(l,t)),c&&(a=e.apply(r,o),r=o=null),a}},p={render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{ref:"stripContainer",staticClass:"happy-scroll-strip",class:[e.horizontal?"happy-scroll-strip--horizontal":"happy-scroll-strip--vertical"],style:[e.initLocation],on:{"!wheel":function(t){return t.stopPropagation(),e.handlerWheel(t)}}},[n("div",{ref:"strip",staticClass:"happy-scroll-bar",style:[e.translate,o({},e.config.sizeAttr,e.length+"px"),e.initSize,{background:e.color},{opacity:e.isOpacity}],on:{mousedown:function(t){return t.stopPropagation(),e.handlerMouseDown(t)}}})])},staticRenderFns:[],name:"happy-scroll-strip",props:{horizontal:Boolean,left:Boolean,top:Boolean,move:{type:Number,default:0},size:{type:[Number,String],default:4},minLengthV:{type:Number,default:40},minLengthH:{type:Number,default:40},color:{type:String,default:"rgba(51,51,51,0.2)"},throttle:{type:Number,default:14}},data:function(){return{config:{},startMove:!1,binded:!1,length:0,percentage:0,maxOffset:0,currentOffset:0,moveThrottle:u(this.throttle)}},watch:{currentOffset:function(e){0===e?this.emitLocationEvent("start",0):e===this.maxOffset&&this.emitLocationEvent("end",e/this.percentage)}},computed:{initSize:function(){return o({},this.horizontal?"height":"width",this.size+"px")},isOpacity:function(){return this.percentage<1?1:0},translate:function(){var e=this.move*this.percentage;if(this.$refs.stripContainer)return e<0&&(e=0),e>this.maxOffset&&(e=this.maxOffset),this.currentOffset=e,{transform:this.config.translate+"("+e+"px)"}},initLocation:function(){return this.horizontal?this.top?{top:0,bottom:"auto"}:"":this.left?{left:0,right:"auto"}:""}},methods:{emitLocationEvent:function(e,t){var n=this.horizontal?"horizontal":"vertical";this.$emit(n+"-"+e,t)},computeStrip:function(e,t){var n=this.$refs.stripContainer[this.config.client];this.length=n*(t/e);var i=this.horizontal?this.minLengthH:this.minLengthV;i<1&&(i*=n),this.length=this.lengththis.maxOffset&&(e=this.maxOffset),t&&e>0&&e4?e:void 0}())},t.isLegacyOpera=function(){return!!window.opera}}),x=r(function(e){(e.exports={}).getOption=function(e,t,n){var i=e[t];return void 0!==i&&null!==i||void 0===n?i:n}}),z=function(e){function t(){for(h=!0;d.size();){var e=d;d=s(),e.process()}h=!1}function n(){c=o(t)}function i(e){return clearTimeout(e)}function o(e){return function(e){return setTimeout(e,0)}(e)}var r=(e=e||{}).reporter,a=x.getOption(e,"async",!0),l=x.getOption(e,"auto",!0);l&&!a&&(r&&r.warn("Invalid options combination. auto=true and async=false is invalid. Setting async=true."),a=!0);var c,d=s(),h=!1;return{add:function(e,t){!h&&l&&a&&0===d.size()&&n(),d.add(e,t)},force:function(e){h||(void 0===e&&(e=a),c&&(i(c),c=null),e?n():t())}}},E="_erd",L={initState:function(e){return e[E]={},a(e)},getState:a,cleanState:function(e){delete e[E]}},H=function(e){function t(e){return o(e).object}var n=(e=e||{}).reporter,i=e.batchProcessor,o=e.stateHandler.getState;if(!n)throw new Error("Missing required dependency: reporter.");return{makeDetectable:function(e,t,r){r||(r=t,t=e,e=null),e=e||{},w.isIE(8)?r(t):function(e,t){function r(){function i(){if("static"===l.position){e.style.position="relative";var t=function(e,t,n,i){var o=n[i];"auto"!==o&&"0"!==function(e){return e.replace(/[^-\d\.]/g,"")}(o)&&(e.warn("An element that is positioned static has style."+i+"="+o+" which is ignored due to the static positioning. The element will need to be positioned relative, so the style."+i+" will be set to 0. Element: ",t),t.style[i]=0)};t(n,e,l,"top"),t(n,e,l,"right"),t(n,e,l,"bottom"),t(n,e,l,"left")}}""!==l.position&&(i(l),a=!0);var r=document.createElement("object");r.style.cssText=s,r.tabIndex=-1,r.type="text/html",r.onload=function(){function n(e,t){e.contentDocument?t(e.contentDocument):setTimeout(function(){n(e,t)},100)}a||i(),n(this,function(n){t(e)})},w.isIE()||(r.data="about:blank"),e.appendChild(r),o(e).object=r,w.isIE()&&(r.data="about:blank")}var s="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;",a=!1,l=window.getComputedStyle(e),c=e.offsetWidth,d=e.offsetHeight;o(e).startSize={width:c,height:d},i?i.add(r):r()}(t,r)},addListener:function(e,n){function i(){n(e)}if(!t(e))throw new Error("Element is not detectable by this strategy.");w.isIE(8)?(o(e).object={proxy:i},e.attachEvent("onresize",i)):t(e).contentDocument.defaultView.addEventListener("resize",i)},uninstall:function(e){w.isIE(8)?e.detachEvent("onresize",o(e).object.proxy):e.removeChild(t(e)),delete o(e).object}}},C=g.forEach,T=function(e){function t(e){e.className+=" "+h+"_animation_active"}function n(e,t,n){if(e.addEventListener)e.addEventListener(t,n);else{if(!e.attachEvent)return s.error("[scroll] Don't know how to add event listeners.");e.attachEvent("on"+t,n)}}function i(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n);else{if(!e.detachEvent)return s.error("[scroll] Don't know how to remove event listeners.");e.detachEvent("on"+t,n)}}function o(e){return l(e).container.childNodes[0].childNodes[0].childNodes[0]}function r(e){return l(e).container.childNodes[0].childNodes[0].childNodes[1]}var s=(e=e||{}).reporter,a=e.batchProcessor,l=e.stateHandler.getState,c=e.idHandler;if(!a)throw new Error("Missing required dependency: batchProcessor");if(!s)throw new Error("Missing required dependency: reporter.");var d=function(){var e=document.createElement("div");e.style.cssText="position: absolute; width: 1000px; height: 1000px; visibility: hidden; margin: 0; padding: 0;";var t=document.createElement("div");t.style.cssText="position: absolute; width: 500px; height: 500px; overflow: scroll; visibility: none; top: -1500px; left: -1500px; visibility: hidden; margin: 0; padding: 0;",t.appendChild(e),document.body.insertBefore(t,document.body.firstChild);var n=500-t.clientWidth,i=500-t.clientHeight;return document.body.removeChild(t),{width:n,height:i}}(),h="erd_scroll_detection_container";return function(e,t){if(!document.getElementById(e)){var n=t+"_animation",i="/* Created by the element-resize-detector library. */\n";i+="."+t+" > div::-webkit-scrollbar { display: none; }\n\n",i+="."+t+"_animation_active { -webkit-animation-duration: 0.1s; animation-duration: 0.1s; -webkit-animation-name: "+n+"; animation-name: "+n+"; }\n",i+="@-webkit-keyframes "+n+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }\n",function(t,n){n=n||function(e){document.head.appendChild(e)};var i=document.createElement("style");i.innerHTML=t,i.id=e,n(i)}(i+="@keyframes "+n+" { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }")}}("erd_scroll_detection_scrollbar_style",h),{makeDetectable:function(e,i,u){function f(){if(e.debug){var t=Array.prototype.slice.call(arguments);if(t.unshift(c.get(i),"Scroll: "),s.log.apply)s.log.apply(null,t);else for(var n=0;ni&&(n=e.biggerMoveH.toLocaleLowerCase()),"start"===n&&(e.moveY=0,e.slideYChange(e.moveY)),"end"===n&&(e.moveY=t.clientHeight,e.slideYChange(e.moveY)),i=t.clientHeight,n="",t.clientWidtho&&(n=e.biggerMoveV.toLocaleLowerCase()),"start"===n&&(e.moveX=0,e.slideXChange(e.moveX)),"end"===n&&(e.moveX=t.clientWidth,e.slideXChange(e.moveX)),o=t.clientWidth})}},setContainerSize:function(){this.initSize={width:this.$refs["happy-scroll"].clientWidth+20+"px",height:this.$refs["happy-scroll"].clientHeight+20+"px"}},checkScrollMode:function(){if(void 0===k._happyJS._isScrollNotUseSpace){var e=this.$slots.default[0].elm,t=this.$refs.container;(e.offsetHeight>t.clientHeight||e.offsetWidth>t.clientWidth)&&(t.offsetWidth>t.clientWidth||t.offsetHeight>t.clientHeight?k._happyJS._isScrollNotUseSpace=!1:k._happyJS._isScrollNotUseSpace=!0,this.isScrollNotUseSpace=k._happyJS._isScrollNotUseSpace)}}},beforeCreate:function(){var e=k._happyJS=k._happyJS||{};this.isScrollNotUseSpace=e._isScrollNotUseSpace},created:function(){this.updateSyncScroll=f(function(){this.$emit("update:scrollTop",this.moveY),this.$emit("update:scrollLeft",this.moveX)},this.throttle)},mounted:function(){var e=this;this.setContainerSize(),this.$nextTick(function(){e.computeStripX(),e.computeStripY(),e.checkScrollMode(),e.initBrowserSize(),e.$nextTick(function(){e.scrollTop&&(e.$refs.container.scrollTop=+e.scrollTop),e.scrollLeft&&(e.$refs.container.scrollLeft=+e.scrollLeft)})}),this.resizeListener(),this.$watch("browserHSize",this.setContainerSize),this.$watch("browserVSize",this.setContainerSize)}};"undefined"!=typeof window&&window.Vue&&Vue.component("happy-scroll",N);var O={install:function(e){e.component("happy-scroll",N)},version:"2.1.1"};e.default=O,e.HappyScroll=N,e.version="2.1.1",Object.defineProperty(e,"__esModule",{value:!0})}); //# sourceMappingURL=happy-scroll.min.js.map