!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e(require("jquery")):e(jQuery)}(function(e){e.fn.jScrollPane=function(t){function o(t,o){var s,n,r,i,a,l,c,p,u,d,f,h,j,g,v,m,w,y,k,b,C,T,S,B,D,x,H,P,A,W,Y,z,M,X,R=this,I=!0,F=!0,L=!1,V=!1,q=t.clone(!1,!1).empty(),O=e.fn.mwheelIntent?"mwheelIntent.jsp":"mousewheel.jsp";function E(o){var b,I,F,L,V,q,ae,le,ce,pe,ue,de,fe,he,je,ge,ve=!1,me=!1;if(s=o,void 0===n)V=t.scrollTop(),q=t.scrollLeft(),t.css({overflow:"hidden",padding:0}),r=t.innerWidth()+M,i=t.innerHeight(),t.width(r),n=e('
').css("padding",z).append(t.children()),a=e('
').css({width:r+"px",height:i+"px"}).append(n).appendTo(t);else{if(t.css("width",""),a.css({width:"auto",height:"auto"}),n.css("position","static"),ae=t.innerWidth()+M,le=t.innerHeight(),n.css("position","absolute"),ve=s.stickToBottom&&((pe=c-i)>20&&pe-re()<10),me=s.stickToRight&&((ce=l-r)>20&&ce-ne()<10),L=ae!==r||le!==i,r=ae,i=le,a.css({width:r,height:i}),!L&&X==l&&n.outerHeight()==c)return void t.width(r);X=l,n.css("width",""),t.width(r),a.find(">.jspVerticalBar,>.jspHorizontalBar").remove().end()}n.css("overflow","auto"),l=o.contentWidth?o.contentWidth:n[0].scrollWidth,c=n[0].scrollHeight,n.css("overflow",""),p=l/r,d=(u=c/i)>1||s.alwaysShowVScroll,(f=p>1||s.alwaysShowHScroll)||d?(t.addClass("jspScrollable"),(b=s.maintainPosition&&(g||w))&&(I=ne(),F=re()),d&&(a.append(e('
').append(e('
'),e('
').append(e('
').append(e('
'),e('
'))),e('
'))),y=a.find(">.jspVerticalBar"),k=y.find(">.jspTrack"),h=k.find(">.jspDrag"),s.showArrows&&(S=e('').on("mousedown.jsp",Q(0,-1)).on("click.jsp",ie),B=e('').on("mousedown.jsp",Q(0,1)).on("click.jsp",ie),s.arrowScrollOnHover&&(S.on("mouseover.jsp",Q(0,-1,S)),B.on("mouseover.jsp",Q(0,1,B))),K(k,s.verticalArrowPositions,S,B)),C=i,a.find(">.jspVerticalBar>.jspCap:visible,>.jspVerticalBar>.jspArrow").each(function(){C-=e(this).outerHeight()}),h.on("mouseenter",function(){h.addClass("jspHover")}).on("mouseleave",function(){h.removeClass("jspHover")}).on("mousedown.jsp",function(t){e("html").on("dragstart.jsp selectstart.jsp",ie),h.addClass("jspActive");var o=t.pageY-h.position().top;return e("html").on("mousemove.jsp",function(e){J(e.pageY-o,!1)}).on("mouseup.jsp mouseleave.jsp",$),!1}),G()),f&&(a.append(e('
').append(e('
'),e('
').append(e('
').append(e('
'),e('
'))),e('
'))),D=a.find(">.jspHorizontalBar"),x=D.find(">.jspTrack"),v=x.find(">.jspDrag"),s.showArrows&&(A=e('').on("mousedown.jsp",Q(-1,0)).on("click.jsp",ie),W=e('').on("mousedown.jsp",Q(1,0)).on("click.jsp",ie),s.arrowScrollOnHover&&(A.on("mouseover.jsp",Q(-1,0,A)),W.on("mouseover.jsp",Q(1,0,W))),K(x,s.horizontalArrowPositions,A,W)),v.on("mouseenter",function(){v.addClass("jspHover")}).on("mouseleave",function(){v.removeClass("jspHover")}).on("mousedown.jsp",function(t){e("html").on("dragstart.jsp selectstart.jsp",ie),v.addClass("jspActive");var o=t.pageX-v.position().left;return e("html").on("mousemove.jsp",function(e){_(e.pageX-o,!1)}).on("mouseup.jsp mouseleave.jsp",$),!1}),H=a.innerWidth(),N()),function(){if(f&&d){var t=x.outerHeight(),o=k.outerWidth();C-=t,e(D).find(">.jspCap:visible,>.jspArrow").each(function(){H+=e(this).outerWidth()}),H-=o,i-=o,r-=t,x.parent().append(e('
').css("width",t+"px")),G(),N()}f&&n.width(a.outerWidth()-M+"px");c=n.outerHeight(),u=c/i,f&&((P=Math.ceil(1/p*H))>s.horizontalDragMaxWidth?P=s.horizontalDragMaxWidth:Ps.verticalDragMaxHeight?T=s.verticalDragMaxHeight:T5||Math.abs(he-t.pageY)>5,o==w&&s==g}}).on("touchend.jsp",function(e){ge=!1}).on("click.jsp-touchclick",function(e){if(je)return je=!1,!1}),s.enableKeyboardNavigation&&function(){var o,r,l=[];f&&l.push(D[0]);d&&l.push(y[0]);n.on("focus.jsp",function(){t.focus()}),t.attr("tabindex",0).off("keydown.jsp keypress.jsp").on("keydown.jsp",function(t){if(t.target===this||l.length&&e(t.target).closest(l).length){var s=w,n=g;switch(t.keyCode){case 40:case 38:case 34:case 32:case 33:case 39:case 37:o=t.keyCode,p();break;case 35:te(c-i),o=null;break;case 36:te(0),o=null}return!(r=t.keyCode==o&&s!=w||n!=g)}}).on("keypress.jsp",function(t){if(t.keyCode==o&&p(),t.target===this||l.length&&e(t.target).closest(l).length)return!r}),s.hideFocus?(t.css("outline","none"),"hideFocus"in a[0]&&t.attr("hideFocus",!0)):(t.css("outline",""),"hideFocus"in a[0]&&t.attr("hideFocus",!1));function p(){var e=w,t=g;switch(o){case 40:R.scrollByY(s.keyboardSpeed,!1);break;case 38:R.scrollByY(-s.keyboardSpeed,!1);break;case 34:case 32:R.scrollByY(i*s.scrollPagePercent,!1);break;case 33:R.scrollByY(-i*s.scrollPagePercent,!1);break;case 39:R.scrollByX(s.keyboardSpeed,!1);break;case 37:R.scrollByX(-s.keyboardSpeed,!1)}return r=e!=w||t!=g}}(),s.clickOnTrack&&function(){U(),d&&k.on("mousedown.jsp",function(t){if(void 0===t.originalTarget||t.originalTarget==t.currentTarget){var o,n=e(this),r=n.offset(),a=t.pageY-r.top-g,l=!0,p=function(){var e=n.offset(),r=t.pageY-e.top-T/2,d=i*s.scrollPagePercent,f=j*d/(c-i);if(a<0)g-f>r?R.scrollByY(-d):J(r);else{if(!(a>0))return void u();g+fi?R.scrollByX(-d):_(i);else{if(!(a>0))return void u();w+f1){var t,o,s=escape(location.hash.substr(1));try{t=e("#"+s+', a[name="'+s+'"]')}catch(e){return}t.length&&n.find(s)&&(0===a.scrollTop()?o=setInterval(function(){a.scrollTop()>0&&(se(t,!0),e(document).scrollTop(a.position().top),clearInterval(o))},50):(se(t,!0),e(document).scrollTop(a.position().top)))}}(),s.hijackInternalLinks&&function(){if(e(document.body).data("jspHijack"))return;e(document.body).data("jspHijack",!0),e(document.body).delegate('a[href*="#"]',"click",function(t){var o,s,n,r,i,a=this.href.substr(0,this.href.indexOf("#")),l=location.href;if(-1!==location.href.indexOf("#")&&(l=location.href.substr(0,location.href.indexOf("#"))),a===l){o=escape(this.href.substr(this.href.indexOf("#")+1));try{s=e("#"+o+', a[name="'+o+'"]')}catch(e){return}s.length&&(n=s.closest(".jspScrollable"),n.data("jsp").scrollToElement(s,!0),n[0].scrollIntoView&&(r=e(window).scrollTop(),((i=s.offset().top)r+e(window).height())&&n[0].scrollIntoView()),t.preventDefault())}})}()):(t.removeClass("jspScrollable"),n.css({top:0,left:0,width:a.width()-M}),a.off(O),n.find(":input,a").off("focus.jsp"),t.attr("tabindex","-1").removeAttr("tabindex").off("keydown.jsp keypress.jsp"),n.off(".jsp"),U()),s.autoReinitialise&&!Y?Y=setInterval(function(){E(s)},s.autoReinitialiseDelay):!s.autoReinitialise&&Y&&clearInterval(Y),V&&t.scrollTop(0)&&te(V,!1),q&&t.scrollLeft(0)&&oe(q,!1),t.trigger("jsp-initialised",[f||d])}function G(){k.height(C+"px"),g=0,b=s.verticalGutter+k.outerWidth(),n.width(r-b-M);try{0===y.position().left&&n.css("margin-left",b+"px")}catch(e){}}function N(){a.find(">.jspHorizontalBar>.jspCap:visible,>.jspHorizontalBar>.jspArrow").each(function(){H-=e(this).outerWidth()}),x.width(H+"px"),w=0}function K(e,t,o,s){var n,r="before",i="after";"os"==t&&(t=/Mac/.test(navigator.platform)?"after":"split"),t==r?i=t:t==i&&(r=t,n=o,o=s,s=n),e[r](o)[i](s)}function Q(t,o,n){return function(){return function(t,o,n,r){n=e(n).addClass("jspActive");var i,a,l=!0,c=function(){0!==t&&R.scrollByX(t*s.arrowButtonSpeed),0!==o&&R.scrollByY(o*s.arrowButtonSpeed),a=setTimeout(c,l?s.initialDelay:s.arrowRepeatFreq),l=!1};c(),i=r?"mouseout.jsp":"mouseup.jsp",(r=r||e("html")).on(i,function(){n.removeClass("jspActive"),a&&clearTimeout(a),a=null,r.off(i)})}(t,o,this,n),this.blur(),!1}}function U(){x&&x.off("mousedown.jsp"),k&&k.off("mousedown.jsp")}function $(){e("html").off("dragstart.jsp selectstart.jsp mousemove.jsp mouseup.jsp mouseleave.jsp"),h&&h.removeClass("jspActive"),v&&v.removeClass("jspActive")}function J(o,n){if(d){o<0?o=0:o>j&&(o=j);var r=new e.Event("jsp-will-scroll-y");if(t.trigger(r,[o]),!r.isDefaultPrevented()){var a=o||0,l=0===a,p=a==j,u=-(o/j)*(c-i);void 0===n&&(n=s.animateScroll),n?R.animate(h,"top",o,Z,function(){t.trigger("jsp-user-scroll-y",[-u,l,p])}):(h.css("top",o),Z(o),t.trigger("jsp-user-scroll-y",[-u,l,p]))}}}function Z(e){void 0===e&&(e=h.position().top),a.scrollTop(0);var o,r,l=0===(g=e||0),p=g==j,u=-(e/j)*(c-i);I==l&&L==p||(I=l,L=p,t.trigger("jsp-arrow-change",[I,L,F,V])),o=l,r=p,s.showArrows&&(S[o?"addClass":"removeClass"]("jspDisabled"),B[r?"addClass":"removeClass"]("jspDisabled")),n.css("top",u),t.trigger("jsp-scroll-y",[-u,l,p]).trigger("scroll")}function _(o,n){if(f){o<0?o=0:o>m&&(o=m);var i=new e.Event("jsp-will-scroll-x");if(t.trigger(i,[o]),!i.isDefaultPrevented()){var a=o||0,c=0===a,p=a==m,u=-(o/m)*(l-r);void 0===n&&(n=s.animateScroll),n?R.animate(v,"left",o,ee,function(){t.trigger("jsp-user-scroll-x",[-u,c,p])}):(v.css("left",o),ee(o),t.trigger("jsp-user-scroll-x",[-u,c,p]))}}}function ee(e){void 0===e&&(e=v.position().left),a.scrollTop(0);var o,i,c=0===(w=e||0),p=w==m,u=-(e/m)*(l-r);F==c&&V==p||(F=c,V=p,t.trigger("jsp-arrow-change",[I,L,F,V])),o=c,i=p,s.showArrows&&(A[o?"addClass":"removeClass"]("jspDisabled"),W[i?"addClass":"removeClass"]("jspDisabled")),n.css("left",u),t.trigger("jsp-scroll-x",[-u,c,p]).trigger("scroll")}function te(e,t){J(e/(c-i)*j,t)}function oe(e,t){_(e/(l-r)*m,t)}function se(t,o,n){var l,c,p,u,d,f,h,j,g,v=0,m=0;try{l=e(t)}catch(e){return}for(c=l.outerHeight(),p=l.outerWidth(),a.scrollTop(0),a.scrollLeft(0);!l.is(".jspPane");)if(v+=l.position().top,m+=l.position().left,l=l.offsetParent(),/^body|html$/i.test(l[0].nodeName))return;f=(u=re())+i,vf&&(j=v-i+c+s.horizontalGutter),isNaN(j)||te(j,n),h=(d=ne())+r,mh&&(g=m-r+p+s.horizontalGutter),isNaN(g)||oe(g,n)}function ne(){return-n.position().left}function re(){return-n.position().top}function ie(){return!1}"border-box"===t.css("box-sizing")?(z=0,M=0):(z=t.css("paddingTop")+" "+t.css("paddingRight")+" "+t.css("paddingBottom")+" "+t.css("paddingLeft"),M=(parseInt(t.css("paddingLeft"),10)||0)+(parseInt(t.css("paddingRight"),10)||0)),e.extend(R,{reinitialise:function(t){E(t=e.extend({},s,t))},scrollToElement:function(e,t,o){se(e,t,o)},scrollTo:function(e,t,o){oe(e,o),te(t,o)},scrollToX:function(e,t){oe(e,t)},scrollToY:function(e,t){te(e,t)},scrollToPercentX:function(e,t){oe(e*(l-r),t)},scrollToPercentY:function(e,t){te(e*(c-i),t)},scrollBy:function(e,t,o){R.scrollByX(e,o),R.scrollByY(t,o)},scrollByX:function(e,t){_((ne()+Math[e<0?"floor":"ceil"](e))/(l-r)*m,t)},scrollByY:function(e,t){J((re()+Math[e<0?"floor":"ceil"](e))/(c-i)*j,t)},positionDragX:function(e,t){_(e,t)},positionDragY:function(e,t){J(e,t)},animate:function(e,t,o,n,r){var i={};i[t]=o,e.animate(i,{duration:s.animateDuration,easing:s.animateEase,queue:!1,step:n,complete:r})},getContentPositionX:function(){return ne()},getContentPositionY:function(){return re()},getContentWidth:function(){return l},getContentHeight:function(){return c},getPercentScrolledX:function(){return ne()/(l-r)},getPercentScrolledY:function(){return re()/(c-i)},getIsScrollableH:function(){return f},getIsScrollableV:function(){return d},getContentPane:function(){return n},scrollToBottom:function(e){J(j,e)},hijackInternalLinks:e.noop,destroy:function(){var e,o;e=re(),o=ne(),t.removeClass("jspScrollable").off(".jsp"),n.off(".jsp"),t.replaceWith(q.append(n.children())),q.scrollTop(e),q.scrollLeft(o),Y&&clearInterval(Y)}}),E(o)}return t=e.extend({},e.fn.jScrollPane.defaults,t),e.each(["arrowButtonSpeed","trackClickSpeed","keyboardSpeed"],function(){t[this]=t[this]||t.speed}),this.each(function(){var s=e(this),n=s.data("jsp");n?n.reinitialise(t):(e("script",s).filter('[type="text/javascript"],:not([type])').remove(),n=new o(s,t),s.data("jsp",n))})},e.fn.jScrollPane.defaults={showArrows:!1,maintainPosition:!0,stickToBottom:!1,stickToRight:!1,clickOnTrack:!0,autoReinitialise:!1,autoReinitialiseDelay:500,verticalDragMinHeight:0,verticalDragMaxHeight:99999,horizontalDragMinWidth:0,horizontalDragMaxWidth:99999,contentWidth:void 0,animateScroll:!1,animateDuration:300,animateEase:"linear",hijackInternalLinks:!1,verticalGutter:4,horizontalGutter:4,mouseWheelSpeed:3,arrowButtonSpeed:0,arrowRepeatFreq:50,arrowScrollOnHover:!1,trackClickSpeed:0,trackClickRepeatFreq:70,verticalArrowPositions:"split",horizontalArrowPositions:"split",enableKeyboardNavigation:!0,hideFocus:!1,keyboardSpeed:0,initialDelay:300,speed:30,scrollPagePercent:.8,alwaysShowVScroll:!1,alwaysShowHScroll:!1}});