!function(l,e){"function"==typeof define&&define.amd?define(["jquery"],e):e(l.jQuery)}(this,function(l){"use strict";var e={data:{index:0,name:"scrollbar"},macosx:/mac/i.test(navigator.platform),mobile:/android|webos|iphone|ipad|ipod|blackberry/i.test(navigator.userAgent),overlay:null,scroll:null,scrolls:[],webkit:/webkit/i.test(navigator.userAgent)&&!/edge\/\d+/i.test(navigator.userAgent)};e.scrolls.add=function(l){this.remove(l).push(l)},e.scrolls.remove=function(e){for(;l.inArray(e,this)>=0;)this.splice(l.inArray(e,this),1);return this};var o={autoScrollSize:!0,autoUpdate:!0,debug:!1,disableBodyScroll:!1,duration:200,ignoreMobile:!1,ignoreOverlay:!1,scrollStep:30,showArrows:!1,stepScrolling:!0,scrollx:null,scrolly:null,onDestroy:null,onInit:null,onScroll:null,onUpdate:null},s=function(s){var r;e.scroll||(e.overlay=!((r=c(!0)).height||r.width),e.scroll=c(),n(),l(window).resize(function(){var l=!1;if(e.scroll&&(e.scroll.height||e.scroll.width)){var o=c();o.height===e.scroll.height&&o.width===e.scroll.width||(e.scroll=o,l=!0)}n(l)})),this.container=s,this.namespace=".scrollbar_"+e.data.index++,this.options=l.extend({},o,window.jQueryScrollbarOptions||{}),this.scrollTo=null,this.scrollx={},this.scrolly={},s.data(e.data.name,this),e.scrolls.add(this)};s.prototype={destroy:function(){if(this.wrapper){this.container.removeData(e.data.name),e.scrolls.remove(this);var o=this.container.scrollLeft(),s=this.container.scrollTop();this.container.insertBefore(this.wrapper).css({height:"",margin:"","max-height":""}).removeClass("scroll-content scroll-scrollx_visible scroll-scrolly_visible").off(this.namespace).scrollLeft(o).scrollTop(s),this.scrollx.scroll.removeClass("scroll-scrollx_visible").find("div").andSelf().off(this.namespace),this.scrolly.scroll.removeClass("scroll-scrolly_visible").find("div").andSelf().off(this.namespace),this.wrapper.remove(),l(document).add("body").off(this.namespace),l.isFunction(this.options.onDestroy)&&this.options.onDestroy.apply(this,[this.container])}},init:function(o){var s=this,r=this.container,t=this.containerWrapper||r,i=this.namespace,n=l.extend(this.options,o||{}),c={x:this.scrollx,y:this.scrolly},d=this.wrapper,h={scrollLeft:r.scrollLeft(),scrollTop:r.scrollTop()};if(e.mobile&&n.ignoreMobile||e.overlay&&n.ignoreOverlay||e.macosx&&!e.webkit)return!1;if(d)t.css({height:"auto","margin-bottom":-1*e.scroll.height+"px","margin-right":-1*e.scroll.width+"px","max-height":""});else{if(this.wrapper=d=l("
").addClass("scroll-wrapper").addClass(r.attr("class")).css("position","absolute"==r.css("position")?"absolute":"relative").insertBefore(r).append(r),r.is("textarea")&&(this.containerWrapper=t=l("
").insertBefore(r).append(r),d.addClass("scroll-textarea")),t.addClass("scroll-content").css({height:"auto","margin-bottom":-1*e.scroll.height+"px","margin-right":-1*e.scroll.width+"px","max-height":""}),r.on("scroll"+i,function(e){l.isFunction(n.onScroll)&&n.onScroll.call(s,{maxScroll:c.y.maxScrollOffset,scroll:r.scrollTop(),size:c.y.size,visible:c.y.visible},{maxScroll:c.x.maxScrollOffset,scroll:r.scrollLeft(),size:c.x.size,visible:c.x.visible}),c.x.isVisible&&c.x.scroll.bar.css("left",r.scrollLeft()*c.x.kx+"px"),c.y.isVisible&&c.y.scroll.bar.css("top",r.scrollTop()*c.y.kx+"px")}),d.on("scroll"+i,function(){d.scrollTop(0).scrollLeft(0)}),n.disableBodyScroll){var p=function(l){a(l)?c.y.isVisible&&c.y.mousewheel(l):c.x.isVisible&&c.x.mousewheel(l)};d.on("MozMousePixelScroll"+i,p),d.on("mousewheel"+i,p),e.mobile&&d.on("touchstart"+i,function(e){var o=e.originalEvent.touches&&e.originalEvent.touches[0]||e,s=o.pageX,t=o.pageY,n=r.scrollLeft(),c=r.scrollTop();l(document).on("touchmove"+i,function(l){var e=l.originalEvent.targetTouches&&l.originalEvent.targetTouches[0]||l;r.scrollLeft(n+s-e.pageX),r.scrollTop(c+t-e.pageY),l.preventDefault()}),l(document).on("touchend"+i,function(){l(document).off(i)})})}l.isFunction(n.onInit)&&n.onInit.apply(this,[r])}l.each(c,function(e,o){var t=null,d=1,h="x"===e?"scrollLeft":"scrollTop",p=n.scrollStep,u=function(){var l=r[h]();r[h](l+p),1==d&&l+p>=f&&(l=r[h]()),-1==d&&l+p<=f&&(l=r[h]()),r[h]()==l&&t&&t()},f=0;o.scroll||(o.scroll=s._getScroll(n["scroll"+e]).addClass("scroll-"+e),n.showArrows&&o.scroll.addClass("scroll-element_arrows_visible"),o.mousewheel=function(l){if(!o.isVisible||"x"===e&&a(l))return!0;if("y"===e&&!a(l))return c.x.mousewheel(l),!0;var t=-1*l.originalEvent.wheelDelta||l.originalEvent.detail,i=o.size-o.visible-o.offset;return(t>0&&f0)&&((f+=t)<0&&(f=0),f>i&&(f=i),s.scrollTo=s.scrollTo||{},s.scrollTo[h]=f,setTimeout(function(){s.scrollTo&&(r.stop().animate(s.scrollTo,240,"linear",function(){f=r[h]()}),s.scrollTo=null)},1)),l.preventDefault(),!1},o.scroll.on("MozMousePixelScroll"+i,o.mousewheel).on("mousewheel"+i,o.mousewheel).on("mouseenter"+i,function(){f=r[h]()}),o.scroll.find(".scroll-arrow, .scroll-element_track").on("mousedown"+i,function(i){if(1!=i.which)return!0;d=1;var c={eventOffset:i["x"===e?"pageX":"pageY"],maxScrollValue:o.size-o.visible-o.offset,scrollbarOffset:o.scroll.bar.offset()["x"===e?"left":"top"],scrollbarSize:o.scroll.bar["x"===e?"outerWidth":"outerHeight"]()},a=0,v=0;return l(this).hasClass("scroll-arrow")?(d=l(this).hasClass("scroll-arrow_more")?1:-1,p=n.scrollStep*d,f=d>0?c.maxScrollValue:0):(d=c.eventOffset>c.scrollbarOffset+c.scrollbarSize?1:c.eventOffset','
','
','
','
','
','
','
','
',"
","
",'
','
','
',"
",'
','
',"
","
","
"].join(""),simple:['
','
','
','
','
',"
","
"].join("")};return o[e]&&(e=o[e]),e||(e=o.simple),e="string"==typeof e?l(e).appendTo(this.wrapper):l(e),l.extend(e,{bar:e.find(".scroll-bar"),size:e.find(".scroll-element_size"),track:e.find(".scroll-element_track")}),e},_handleMouseDown:function(e,o){var s=this.namespace;return l(document).on("blur"+s,function(){l(document).add("body").off(s),e&&e()}),l(document).on("dragstart"+s,function(l){return l.preventDefault(),!1}),l(document).on("mouseup"+s,function(){l(document).add("body").off(s),e&&e()}),l("body").on("selectstart"+s,function(l){return l.preventDefault(),!1}),o&&o.preventDefault(),!1},_updateScroll:function(o,s){var r=this.container,t=this.containerWrapper||r,i="scroll-scroll"+o+"_visible",n="x"===o?this.scrolly:this.scrollx,c=parseInt(this.container.css("x"===o?"left":"top"),10)||0,a=this.wrapper,d=s.size,h=s.visible+c;s.isVisible=d-h>1,s.isVisible?(s.scroll.addClass(i),n.scroll.addClass(i),t.addClass(i)):(s.scroll.removeClass(i),n.scroll.removeClass(i),t.removeClass(i)),"y"===o&&(r.is("textarea")||d").css(l.extend({},s)),e.data.outer=l("
").css(l.extend({left:"-1000px",overflow:"scroll",position:"absolute",top:"-1000px"},s)).append(e.data.inner).appendTo("body")}return e.data.outer.scrollLeft(1e3).scrollTop(1e3),{height:Math.ceil(e.data.outer.offset().top-e.data.inner.offset().top||0),width:Math.ceil(e.data.outer.offset().left-e.data.inner.offset().left||0)}}function a(l){var e=l.originalEvent;return(!e.axis||e.axis!==e.HORIZONTAL_AXIS)&&!e.wheelDeltaX}window.angular&&(i=window.angular).module("jQueryScrollbar",[]).provider("jQueryScrollbar",function(){var l=o;return{setOptions:function(e){i.extend(l,e)},$get:function(){return{options:i.copy(l)}}}}).directive("jqueryScrollbar",["jQueryScrollbar","$parse",function(l,e){return{restrict:"AC",link:function(o,s,r){var t=e(r.jqueryScrollbar)(o);s.scrollbar(t||l.options).on("$destroy",function(){s.scrollbar("destroy")})}}}])});