/*!@license
* Infragistics.Web.ClientUI Scroll 21.2.12
*
* Copyright (c) 2011-2022 Infragistics Inc.
*
* http://www.infragistics.com/
*
* Depends on:
* jquery.js
* jquery.ui-1.9.0.js
* jquery.ui.widget.js
* infragistics.util.js
* infragistics.util.jquery.js
* infragistics.ui.widget.js
*/
"use strict";(function(factory){if(typeof define==="function"&&define.amd){define(["./infragistics.ui.widget"],factory)}else{return factory(jQuery)}})(function($){/*!@license
* Infragistics.Web.ClientUI Scroll localization resources 21.2.12
*
* Copyright (c) 2011-2022 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
(function($){$.ig=$.ig||{};$.ig.Scroll=$.ig.Scroll||{};$.ig.locale=$.ig.locale||{};$.ig.locale.en=$.ig.locale.en||{};$.ig.locale.en.Scroll={errorNoElementLink:"Element that is being linked does not exists.",errorNoScrollbarLink:"Scrollbar element that is being linked does not exists."};$.ig.Scroll.locale=$.ig.Scroll.locale||$.ig.locale.en.Scroll;return $.ig.locale.en.Scroll})($);var setPointerCaptureFName=typeof Element.prototype.msSetPointerCapture==="function"?"msSetPointerCapture":"setPointerCapture",releasePointerCaptureFName=typeof Element.prototype.msReleasePointerCapture==="function"?"msReleasePointerCapture":"releasePointerCapture";$.widget("ui.igScroll",$.ui.igWidget,{options:{alwaysVisible:false,scrollbarType:"custom",minThumbSize:15,modifyDOM:true,scrollHeight:null,scrollWidth:null,scrollTop:0,scrollLeft:0,wheelStep:50,smallIncrementStep:40,bigIncrementStep:null,smoothing:false,smoothingStep:1,smoothingDuration:1,inertiaStep:1,inertiaDuration:1,swipeToleranceX:30,inertiaDeltaX:1.25,inertiaDeltaY:2,syncedElemsH:[],syncedElemsV:[],scrollbarH:null,scrollbarV:null,scrollOnlyHBar:false,scrollOnlyVBar:false,scrollbarHParent:null,scrollbarVParent:null},events:{rendered:null,scrolling:null,scrolled:null,thumbDragStart:null,thumbDragMove:null,thumbDragEnd:null,resizing:null,resized:null},css:{scrollableElem:"igscroll-scrollable",touchScrollableElem:"igscroll-touchscrollable",scrollContent:"igscroll-content",scrollContainer:"igscroll-container",nativeVScrollOuter:"igscroll-vnative-outer",nativeVScrollOuterSingle:"igscroll-vnative-outer-single",nativeVScrollInner:"igscroll-vnative-inner",nativeHScrollOuter:"igscroll-hnative-outer",nativeHScrollOuterSingle:"igscroll-hnative-outer-single",nativeHScrollInner:"igscroll-hnative-inner",nativeScrollFiller:"igscroll-filler",verticalScrollContainer:"igscroll-vcontainer",verticalScrollTrack:"igscroll-vtrack",verticalScrollTrackSingleScrollbar:"igscroll-vtrack-single",verticalScrollArrow:"igscroll-varrow",verticalScrollArrowHidden:"igscroll-varrow-hidden",verticalScrollArrowUp:"igscroll-uparrow",verticalScrollArrowDown:"igscroll-downarrow",verticalScrollArrowDownSingleScrollbar:"igscroll-downarrow-single",verticalScrollThumbDrag:"igscroll-vdrag",verticalScrollThumbDragThin:"igscroll-vdrag-thin",verticalScrollThumbDragHidden:"igscroll-vdrag-hidden",verticalScrollThumbDragBig:"igscroll-vdrag-big",horizontalScrollContainer:"igscroll-hcontainer",horizontalScrollTrack:"igscroll-htrack",horizontalScrollTrackSingleScrollbar:"igscroll-htrack-single",horizontalScrollArrow:"igscroll-harrow",horizontalScrollArrowHidden:"igscroll-harrow-hidden",horizontalScrollArrowLeft:"igscroll-leftarrow",horizontalScrollArrowRight:"igscroll-rightarrow",horizontalScrollArrowRightSingleScrollbar:"igscroll-rightarrow-single",horizontalScrollThumbDrag:"igscroll-hdrag",horizontalScrollThumbDragThin:"igscroll-hdrag-thin",horizontalScrollThumbDragHidden:"igscroll-hdrag-hidden",horizontalScrollThumbDragBig:"igscroll-hdrag-big",disabledSelection:"igscroll-select-disabled",syncedElemContentV:"igscroll-vsynced-content",syncedElemContentH:"igscroll-hsynced-content"},refresh:function(){this._elemWidth=this.element.width();this._elemHeight=this.element.height();if(this.options.modifyDOM){this._container.css({width:this._elemWidth+"px",height:this._elemHeight+"px"})}this._contentWidth=this._getContentWidth();this._percentInViewH=this._elemWidth/this._contentWidth;this._isScrollableH=this._percentInViewH<1;this._contentHeight=this._getContentHeight();this._percentInViewV=this._elemHeight/this._contentHeight;this._isScrollableV=this._percentInViewV<1;this._refreshScrollbars();return this.element},_create:function(){var elem=this.element;this._bKeyboardNavigation=true;this._renderVerticalScrollbar=true;this._renderHorizontalScrollbar=true;this._bMixedEnvironment=$.ig.util.getScrollWidth()>0||!$.ig.util.isTouchDevice();this._linkedHElems=[];this._linkedVElems=[];this._linkedHBar=null;this._linkedVBar=null;this._elemWidth=elem.width();this._elemHeight=elem.height();this._showScrollbarsAnimId=0;this._hideScrollbarID=0;this._toSimpleScrollbarsID=0;this._touchInertiaAnimID=0;this._mOverContainer=false;this._mOverScrollbars=false;this._scrollFromSyncContentH=false;this._scrollFromSyncContentV=false;this._bInternalScroll=false;this._cancelScrolling=false;this._cancelThumbDrag=false;this._numSmoothAnimation=0;elem.addClass(this.css.touchScrollableElem);if(this.options.modifyDOM){elem.addClass(this.css.scrollableElem);this._content=$("<div id='"+elem.attr("id")+"_content'/>").addClass(this.css.scrollContent).appendTo(elem).append(elem.contents());this._container=$("<div id='"+elem.attr("id")+"_container'/>").addClass(this.css.scrollContainer).css({width:this._elemWidth+"px",height:this._elemHeight+"px"}).insertBefore(this._content).append(this._content);this._container.data("containerName","scrollContainer");if(this.element.attr("tabindex")){this._container.attr("tabindex",this.element.attr("tabindex"))}}else{this._container=elem;this._content=$(elem.children()[0]);this._contentX=null}this._contentHeight=this._content[0].scrollHeight;this._contentWidth=this._content[0].scrollWidth;this._percentInViewH=this._elemWidth/this._contentWidth;this._percentInViewV=this._elemHeight/this._contentHeight;this._isScrollableV=this._percentInViewV<1;this._isScrollableH=this._percentInViewH<1;this._initOptions(this.options);this._startX=0;this._startY=0;this._touchStartX=0;this._touchStartY=0;this._moving=false;this._evts={scroll:$.proxy(this._onScrollContainer,this),wheel:$.proxy(this._onWheelContainer,this),DOMMouseScroll:$.proxy(this._onWheelContainer,this),pointerdown:$.proxy(this._onPointerDownContainer,this),pointerup:$.proxy(this._onPointerUpContainer,this),MSPointerDown:$.proxy(this._onPointerDownContainer,this),MSGestureStart:$.proxy(this._onMSGestureStartContainer,this),MSGestureChange:$.proxy(this._onMSGestureChangeContainer,this),MSGestureEnd:$.proxy(this._onMSGestureEndContainer,this),touchstart:$.proxy(this._onTouchStartContainer,this),touchmove:$.proxy(this._onTouchMoveContainer,this),touchend:$.proxy(this._onTouchEndContainer,this),mouseenter:$.proxy(this._onMouseEnterContainer,this),mouseleave:$.proxy(this._onMouseLeaveContainer,this),keydown:$.proxy(this._onKeyDown,this)};this._container.on(this._evts);$(window).on("resize.igscroll_"+this.element[0].id,$.proxy(this._onDimensionsChange,this));if(typeof MutationObserver==="function"){this._observer=new MutationObserver($.proxy(this._onElementMutation,this));this._observer.observe(this.element[0],{attributes:true})}this._updateScrollBarsVisibility();this._hideScrollbars();if(this.options.alwaysVisible){if($.ig.util.isTouchDevice()){this._showScrollbars(true)}else{this._showScrollbars(false)}}else{this._showScrollbars(true,2e3)}this._trigger("rendered",null,{owner:this})},_initOptions:function(scrollOptions){if(scrollOptions){if(typeof scrollOptions.syncedElemsH[0]!=="undefined"){this._linkElementsH(scrollOptions.syncedElemsH)}if(typeof scrollOptions.syncedElemsV[0]!=="undefined"){this._linkElementsV(scrollOptions.syncedElemsV)}if(scrollOptions.scrollbarH!==null){this._bindHScrollbar(scrollOptions.scrollbarH)}if(scrollOptions.scrollbarV!==null){this._bindVScrollbar(scrollOptions.scrollbarV)}if(scrollOptions.scrollHeight!==null){this._setScrollHeight(scrollOptions.scrollHeight)}if(scrollOptions.scrollWidth!==null){this._setScrollWidth(scrollOptions.scrollWidth)}if(scrollOptions.scrollTop!==0){this._scrollTop(scrollOptions.scrollTop,false)}if(scrollOptions.scrollLeft!==0){this._scrollLeft(scrollOptions.scrollLeft,false)}}},changeLocale:function(){},_setOption:function(key,value){this._super(key,value);if(key==="alwaysVisible"){if(value===true){if($.ig.util.isTouchDevice()){this._showScrollbars(true)}else{this._showScrollbars(false)}}}if(key==="scrollbarType"){this._removeScrollbars();if(value!=="none"){this._updateScrollBarsVisibility();this._updateScrollbarsPos(this._getContentPositionX(),this._getContentPositionY())}}if(key==="minThumbSize"&&this.options.scrollbarType==="custom"){this._refreshScrollbars()}if(key==="scrollTop"){this._scrollTop(value,true)}if(key==="scrollLeft"){this._scrollLeft(value,true)}if(key==="scrollHeight"){this._setScrollHeight(value);this._refreshScrollbars();this._updateScrollbarsPos(this._getContentPositionX(),this._getContentPositionY())}if(key==="scrollWidth"){this._setScrollWidth(value);this._refreshScrollbars();this._updateScrollbarsPos(this._getContentPositionX(),this._getContentPositionY())}if(key==="syncedElemsH"){this._linkElementsH(value)}if(key==="syncedElemsV"){this._linkElementsV(value)}if(key==="scrollbarH"){this._bindHScrollbar(value)}if(key==="scrollbarV"){this._bindVScrollbar(value)}},option:function(optionName,value){if(optionName==="scrollTop"&&value===undefined){return this._scrollTop(null,true)}if(optionName==="scrollLeft"&&value===undefined){return this._scrollLeft(null,true)}if(optionName==="scrollHeight"&&value===undefined){return this._getContentHeight()}if(optionName==="scrollWidth"&&value===undefined){return this._getContentWidth()}return this._super(optionName,value)},_getContainerHeight:function(){return Math.ceil(this._container.height())},_getContainerWidth:function(){return Math.ceil(this._container.width())},_getContentHeight:function(){var attached=!!this._content[0].parentNode;if(this.options.scrollHeight!==null){return this.options.scrollHeight}else{if($.ig.util.isIE&&attached){return Math.ceil(this._content[0].getBoundingClientRect().height)}else{return Math.ceil(this._content.outerHeight())}}},_getContentWidth:function(){var attached=!!this._content[0].parentNode;if(this.options.scrollWidth!==null){return this.options.scrollWidth}else{if($.ig.util.isIE&&attached){return Math.ceil(this._content[0].getBoundingClientRect().width)}else{return Math.ceil(this._content.outerWidth())}}},_getContentPositionX:function(){if($.ig.util.isTouchDevice()&&!this._bMixedEnvironment){var posX=0;if(this._contentX){posX=-this._getTransform3dValueX(this._contentX)}else{posX=-this._getTransform3dValueX(this._content)}return posX}else{return this._container.scrollLeft()}},_getContentPositionY:function(){if($.ig.util.isTouchDevice()&&!this._bMixedEnvironment){var posY=-this._getTransform3dValueY(this._content);return posY}else{return this._container.scrollTop()}},_getTransform3dValueX:function(jqElem){var matrix,values,posX;if(jqElem.css("-webkit-transform")){matrix=jqElem.css("-webkit-transform");values=matrix?matrix.match(/-?[\d\.]+/g):undefined;posX=values?Number(values[4]):0}else if(jqElem.css("-moz-transform")){matrix=jqElem.css("-moz-transform");values=matrix?matrix.match(/-?[\d\.]+/g):undefined;posX=values?Number(values[4]):0}else if(jqElem.css("-ms-transform")){matrix=jqElem.css("-ms-transform");values=matrix?matrix.match(/-?[\d\.]+/g):undefined;posX=values?Number(values[13]):0}return posX},_getTransform3dValueY:function(jqElem){var matrix,values,posY;if(jqElem.css("-webkit-transform")){matrix=jqElem.css("-webkit-transform");values=matrix?matrix.match(/-?[\d\.]+/g):undefined;posY=values?Number(values[5]):0}else if(jqElem.css("-moz-transform")){matrix=jqElem.css("-moz-transform");values=matrix?matrix.match(/-?[\d\.]+/g):undefined;posY=values?Number(values[5]):0}else if(jqElem.css("-ms-transform")){matrix=jqElem.css("-ms-transform");values=matrix?matrix.match(/-?[\d\.]+/g):undefined;posY=values?Number(values[14]):0}return posY},_getScrollbarVPosition:function(){if(this._linkedVBar){return this._linkedVBar.scrollTop()}else{return this._getContentPositionY()}},_getScrollbarHPosition:function(){if(this._linkedHBar){return this._linkedHBar.scrollLeft()}else{return this._getContentPositionX()}},_scrollLeft:function(val,triggerEvents,bSyncElems){if(val==="undefined"||val===null){return this._getContentPositionX()}cancelAnimationFrame(this._touchInertiaAnimID);if($.ig.util.isTouchDevice()&&!this._bMixedEnvironment){var posY=this._getContentPositionY();this._scrollTouchToXY(val,posY,triggerEvents,bSyncElems)}else{this._scrollToX(val,triggerEvents,bSyncElems)}if(triggerEvents){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:true})}return this},_scrollTop:function(val,triggerEvents,bSyncElems){if(val==="undefined"||val===null){return this._getContentPositionY()}cancelAnimationFrame(this._touchInertiaAnimID);if($.ig.util.isTouchDevice()&&!this._bMixedEnvironment){var posX=this._getContentPositionX();this._scrollTouchToXY(posX,val,triggerEvents,bSyncElems)}else{this._scrollToY(val,triggerEvents,bSyncElems)}if(triggerEvents&&!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:false})}return this},_setScrollWidth:function(inWidth){this._elemWidth=this._getContainerWidth();this._contentWidth=inWidth;this._percentInViewH=this._elemWidth/this._contentWidth;this._isScrollableH=this._percentInViewH<1;if(this.options.modifyDOM){this._content.css("width",inWidth+"px")}return this.element},_setScrollHeight:function(inHeight){this._elemHeight=this._container.innerHeight();this._contentHeight=inHeight;this._percentInViewV=this._elemHeight/this._contentHeight;this._isScrollableV=this._percentInViewV<1;if(this.options.modifyDOM){this._content.css("height",inHeight+"px")}return this.element},_refreshScrollbars:function(){var css=this.css,nativeScrollSize=$.ig.util.getScrollWidth();this._elemHeight=this.element.height();this._elemWidth=this.element.width();if(this.options.scrollbarType==="custom"&&this._vBarTrack&&this._vBarDrag){this._vDragHeight=this._calculateVDragHeight();this._vBarDrag.css("height",this._vDragHeight+"%");if(this._percentInViewH>=1){this._vBarTrack.addClass(css.verticalScrollTrackSingleScrollbar);this._vBarArrowDown.addClass(css.verticalScrollArrowDownSingleScrollbar)}else{this._vBarTrack.removeClass(css.verticalScrollTrackSingleScrollbar);this._vBarArrowDown.removeClass(css.verticalScrollArrowDownSingleScrollbar)}}else if(this.options.scrollbarType==="native"&&this._vBarContainer&&this._vBarDrag){this._vDragHeight=this._content.height();this._vBarDrag.css("height",this._vDragHeight+"px");if(this._percentInViewH>=1&&!this._vBarContainer.hasClass(css.nativeVScrollOuterSingle)){this._vBarContainer.css("bottom","");this._vBarContainer.addClass(this.css.nativeVScrollOuterSingle)}else if(this._percentInViewH<1&&this._vBarContainer.hasClass(css.nativeVScrollOuterSingle)){this._vBarContainer.removeClass(css.nativeVScrollOuterSingle);this._vBarContainer.css("bottom",nativeScrollSize+"px")}}if(this.options.scrollbarType==="custom"&&this._hBarTrack&&this._hBarDrag){this._hDragWidth=this._calculateHDragWidth();this._hBarDrag.css("width",this._hDragWidth+"%");if(this._percentInViewV>=1){this._hBarTrack.addClass(css.horizontalScrollTrackSingleScrollbar);this._hBarArrowRight.addClass(css.horizontalScrollArrowRightSingleScrollbar)}else{this._hBarTrack.removeClass(css.horizontalScrollTrackSingleScrollbar);this._hBarArrowRight.removeClass(css.horizontalScrollArrowRightSingleScrollbar)}}else if(this.options.scrollbarType==="native"&&this._hBarContainer&&this._hBarDrag){this._hDragWidth=this._content.width();this._hBarDrag.css("width",this._hDragWidth+"px");if(this._percentInViewV>=1&&!this._hBarContainer.hasClass(css.nativeHScrollOuterSingle)){this._hBarContainer.css("right","");this._hBarContainer.addClass(css.nativeHScrollOuterSingle)}else if(this._percentInViewV<1&&this._hBarContainer.hasClass(css.nativeHScrollOuterSingle)){this._hBarContainer.removeClass(css.nativeHScrollOuterSingle);this._hBarContainer.css("right",nativeScrollSize+"px")}}this._updateScrollBarsVisibility();this._updateScrollbarsPos(this._getContentPositionX(),this._getContentPositionY())},_linkElementsH:function(inElements){this._linkedHElems=[];if(inElements){for(var index=0;index<inElements.length;index++){var elemObject=$(inElements[index]);if(elemObject.length){if(this.options.modifyDOM&&elemObject.data("igScroll")===undefined){$("<div id='"+elemObject.attr("id")+"_content'/>").addClass(this.css.syncedElemContentH).appendTo(elemObject).append(elemObject.contents())}this._linkedHElems.push(elemObject)}else{throw new Error(this._getLocaleValue("errorNoElementLink"))}}}return this._linkedHElems},_linkElementsV:function(inElements){this._linkedVElems=[];if(inElements){for(var index=0;index<inElements.length;index++){var elemObject=$(inElements[index]);if(elemObject.length){if(this.options.modifyDOM&&elemObject.data("igScroll")===undefined){$("<div id='"+elemObject.attr("id")+"_content'/>").addClass(this.css.syncedElemContentV).appendTo(elemObject).append(elemObject.contents())}this._linkedVElems.push(elemObject)}else{throw new Error(this._getLocaleValue("errorNoElementLink"))}}}return this._linkedVElems},_bindHScrollbar:function(inElement){var self=this;if(inElement){var elemObject=$(inElement);if(elemObject.length){elemObject.on({scroll:function(e){var ignoreSync=self._ignoreHScrollBarEvents;self._ignoreHScrollBarEvents=false;if(ignoreSync||self.options.scrollOnlyHBar){return false}else{if(self._bMixedEnvironment){self._syncContentX(e.target,false);self._syncElemsX(e.target,false)}else{self._syncContentX(e.target,true);self._syncElemsX(e.target,true)}}}});if(this._linkedHBar&&this._linkedHBar[0]!==elemObject[0]){this._linkedHBar.off()}this._linkedHBar=elemObject}else{throw new Error(this._getLocaleValue("errorNoScrollbarLink"))}}return this._linkedHBar},_bindVScrollbar:function(inElement){var self=this;if(inElement){var elemObject=$(inElement);if(elemObject.length){elemObject.on({scroll:function(e){var ignoreSync=self._ignoreVScrollBarEvents;self._ignoreVScrollBarEvents=false;if(ignoreSync||self.options.scrollOnlyVBar){return false}else{if(self._bMixedEnvironment){self._syncContentY(e.target,false);self._syncElemsY(e.target,false)}else{self._syncContentY(e.target,true);self._syncElemsY(e.target,true)}}}});if(this._linkedVBar&&this._linkedVBar[0]!==elemObject[0]){this._linkedVBar.off()}this._linkedVBar=elemObject}else{throw new Error(this._getLocaleValue("errorNoScrollbarLink"))}}return this._linkedVBar},_clampAxisCoords:function(target,min,max){if(target===undefined||target<min){target=min}else if(target>max){target=max}return target},_scrollToXY:function(destX,destY,triggerEvents){var curPosX=this._getContentPositionX(),curPosY=this._getContentPositionY();destX=this._clampAxisCoords(destX,0,Math.max(this._getContentWidth()-this._getContainerWidth(),0));destY=this._clampAxisCoords(destY,0,Math.max(this._getContentHeight()-this._getContainerHeight(),0));if(triggerEvents){var bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:destX-curPosX!==0,stepX:destX-curPosX,stepY:destY-curPosY});if(!bNoCancel){this._cancelScrolling=true;return{x:0,y:0}}}var scrolledX,scrolledY;scrolledX=this._scrollToX(destX,false);scrolledY=this._scrollToY(destY,false);return{x:scrolledX,y:scrolledY}},_scrollToX:function(destX,triggerEvents,bSyncElems){if(!this._isScrollableH&&!this.options.scrollOnlyHBar){return 0}var curPosX;if(this.options.scrollOnlyHBar){curPosX=this._getScrollbarHPosition()}else{curPosX=this._getContentPositionX()}destX=this._clampAxisCoords(destX,0,this._getContentWidth()-this._getContainerWidth());if(triggerEvents){var bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:true,stepX:destX-curPosX,stepY:0});if(!bNoCancel){this._cancelScrolling=true;return 0}}this._bInternalScroll=true;if(this.options.scrollOnlyHBar){this._moveHBarX(destX)}else{this._container.scrollLeft(destX);if(bSyncElems===undefined||bSyncElems===true){this._syncElemsX(this._container[0],false)}}var curPosY;if(this.options.scrollOnlyVBar){curPosY=this._getScrollbarVPosition()}else{curPosY=this._getContentPositionY()}this._updateScrollbarsPos(destX,curPosY,true);return destX-curPosX},_scrollToY:function(destY,triggerEvents,bSyncElems){if(!this._isScrollableV&&!this.options.scrollOnlyVBar){return 0}var curPosY,endOffsetEdge=0;if(this.options.scrollOnlyVBar){curPosY=this._getScrollbarVPosition()}else{curPosY=this._getContentPositionY()}if($.ig.util.isEdge){if(destY<0){endOffsetEdge=-1}else{endOffsetEdge=destY>this._getContentHeight()-this._getContainerHeight()?1:0}}destY=this._clampAxisCoords(destY,0,this._getContentHeight()-this._getContainerHeight());if(triggerEvents){var bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:false,stepX:0,stepY:destY-curPosY});if(!bNoCancel){this._cancelScrolling=!bNoCancel;return 0}}this._bInternalScroll=true;if(this.options.scrollOnlyVBar){this._moveVBarY(destY)}else{if($.ig.util.isIE&&Math.abs(destY-curPosY)<=1){return 0}this._container.scrollTop(destY+endOffsetEdge);if(bSyncElems===undefined||bSyncElems===true){this._syncElemsY(this._container[0],false)}}var curPosX;if(this.options.scrollOnlyHBar){curPosX=this._getScrollbarHPosition()}else{curPosX=this._getContentPositionX()}this._updateScrollbarsPos(curPosX,destY,true);return destY-curPosY},_smoothWheelScrollY:function(deltaY){var self=this,smoothingStep=this.options.smoothingStep,smoothingDuration=this.options.smoothingDuration,animationId;var x=-1;if(this.options.scrollOnlyVBar){this._nextY=this._getScrollbarVPosition()}else{this._nextY=this._getContentPositionY()}function inertiaStep(){if(x>1){cancelAnimationFrame(animationId);self._numSmoothAnimation-=1;if(!self._numSmoothAnimation&&!self._cancelScrolling){self._trigger("scrolled",null,{owner:self,smallIncrement:0,bigIncrement:0,horizontal:false})}return}self._nextY+=(-3*x*x+3)*deltaY*2*smoothingStep;if(self._bMixedEnvironment){self._scrollToY(self._nextY,true)}else{var curPosX=0;if(self.options.scrollOnlyHBar){curPosX=self._getScrollbarVPosition()}else{curPosX=self._getContentPositionY()}self._scrollTouchToXY(curPosX,self._nextY,true)}x+=.08*(1/smoothingDuration);animationId=requestAnimationFrame(inertiaStep)}this._numSmoothAnimation+=1;animationId=requestAnimationFrame(inertiaStep)},_applyTransformOnScrollTop:function(){var startX=-this._container.scrollLeft(),startY=-this._container.scrollTop();if(startX===0&&startY===0){return}if(this._contentX){startX+=this._getTransform3dValueX(this._contentX)}else{startX+=this._getTransform3dValueX(this._content)}startY+=this._getTransform3dValueY(this._content);this._scrollToXY(0,0,false);this._scrollTouchToXY(-startX,-startY,false)},_scrollTouchToXY:function(destX,destY,triggerEvents,bSyncElems){var bNoCancel,curPosX=this._getContentPositionX(),curPosY=this._getContentPositionY();destX=this._clampAxisCoords(destX,0,Math.max(this._getContentWidth()-this._getContainerWidth(),0));destY=this._clampAxisCoords(destY,0,Math.max(this._getContentHeight()-this._getContainerHeight(),0));if(triggerEvents){bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:destX-curPosX!==0,stepX:destX-curPosX,stepY:destY-curPosY});if(!bNoCancel){this._cancelScrolling=true;return{x:0,y:0}}}if(this.options.scrollOnlyVBar){this._scrollToY(destY,false);if(this.options.scrollOnlyHBar){this._scrollToX(destX)}else{if(this._contentX){this._contentX.css({"-webkit-transform":"translate3d("+-destX+"px, 0px, 0px)"});this._syncElemsX(this._contentX,true,-destX,true)}else{this._content.css({"-webkit-transform":"translate3d("+-destX+"px, 0px, 0px)"});this._syncElemsX(this._content,true,-destX,true)}}destY=this._getScrollbarVPosition();this._updateScrollbarsPos(destX,destY);return{x:destX-curPosX,y:destY-curPosY}}var distanceLeftX=-destX;var distanceTopY=-destY;if(!this.options.scrollOnlyVBar&&!this.options.scrollOnlyHBar){this._content.css({"-webkit-transform":"translate3d("+distanceLeftX+"px,"+distanceTopY+"px, 0px)"})}if(bSyncElems===undefined||bSyncElems===true){this._syncElemsX(this._content,true);this._syncElemsY(this._content,true)}this._updateScrollbarsPos(destX,destY);this._syncHBar(this._content,true);this._syncVBar(this._content,true);return{x:destX-curPosX,y:destY-curPosY}},_inertiaInit:function(speedX,speedY,bDefaultScroll){var self=this,x=0,stepModifer=this.options.inertiaStep,inertiaDuration=this.options.inertiaDuration;if(this.options.scrollOnlyVBar){this._nextY=this._getScrollbarVPosition()}else{this._nextY=this._getContentPositionY()}if(this.options.scrollOnlyHBar){this._nextX=this._getScrollbarHPosition()}else{this._nextX=this._getContentPositionX()}function inertiaStep(){if(x>6){self._hideScrollbars();cancelAnimationFrame(self._touchInertiaAnimID);if(!self._cancelScrolling){self._trigger("scrolled",null,{owner:self,smallIncrement:0,bigIncrement:0,horizontal:null})}return}if(Math.abs(speedX)>Math.abs(speedY)){x+=.05/(1*inertiaDuration)}else{x+=.05/(1*inertiaDuration)}if(x<=1){if(Math.abs(speedY)<=Math.abs(speedX)*self.options.inertiaDeltaY){self._nextX+=1*speedX*15*stepModifer}if(Math.abs(speedY)>=Math.abs(speedX)*self.options.inertiaDeltaX){self._nextY+=1*speedY*15*stepModifer}}else{if(Math.abs(speedY)<=Math.abs(speedX)*self.options.inertiaDeltaY){self._nextX+=Math.abs(2/(x+.55)-.3)*speedX*15*stepModifer}if(Math.abs(speedY)>=Math.abs(speedX)*self.options.inertiaDeltaX){self._nextY+=Math.abs(2/(x+.55)-.3)*speedY*15*stepModifer}}if(bDefaultScroll){self._scrollToXY(self._nextX,self._nextY,true)}else{self._scrollTouchToXY(self._nextX,self._nextY,true)}self._touchInertiaAnimID=requestAnimationFrame(inertiaStep)}this._touchInertiaAnimID=requestAnimationFrame(inertiaStep)},_getSpeedSlope:function(inLastFiveSpeeds){if(inLastFiveSpeeds.length===0){return 1}if(inLastFiveSpeeds.length<5){return-1}var numPoints=inLastFiveSpeeds.length,sumXY=0,sumX=0,sumY=0,sumXX=0;for(var pointIndex=0;pointIndex<numPoints;pointIndex++){var pointX=pointIndex,pointY=Math.abs(inLastFiveSpeeds[pointIndex]);sumXY+=pointX*pointY;sumX+=pointX;sumY+=pointY;sumXX+=pointX*pointX}var slopeAngle=(numPoints*sumXY-sumX*sumY)/(numPoints*sumXX-sumX*sumX);return slopeAngle},_syncContentX:function(baseElem,useTransform){var destX;if(useTransform){destX=-baseElem.scrollLeft;var destY=-this._getContentPositionY();this._content.css({"-webkit-transform":"translate3d("+destX+"px,"+destY+"px, 0px)"})}else{destX=baseElem.scrollLeft;this._scrollFromSyncContentH=true;this._container.scrollLeft(destX)}},_syncContentY:function(baseElem,useTransform){var destY;if(useTransform){var destX=this._getContentPositionX();destY=-baseElem.scrollTop;this._content.css({"-webkit-transform":"translate3d("+destX+"px,"+destY+"px, 0px)"})}else{destY=baseElem.scrollTop;this._scrollFromSyncContentV=true;this._container.scrollTop(destY)}},_syncElemsX:function(baseElem,useTransform,inDestX,useDestination){var destX,index;if(!baseElem&&!useDestination){return}if(useTransform){if(!useDestination){var matrix=this._content.css("-webkit-transform");var values=matrix?matrix.match(/-?[\d\.]+/g):undefined;destX=values?Number(values[4]):-this._getContentPositionX()}else{destX=inDestX}if(this._linkedHElems.length>0){for(index=0;index<this._linkedHElems.length;index++){var matrixElem=this._linkedHElems[index].css("-webkit-transform");var valuesElem=matrixElem?matrixElem.match(/-?[\d\.]+/g):undefined;var destY=valuesElem?Number(valuesElem[5]):0;if(this._linkedHElems[index].data("igScroll")!==undefined&&this._linkedHElems[index].data("igScroll").options.modifyDOM){this._linkedHElems[index].data("igScroll")._scrollLeft(-destX,true,false)}else if(this.options.modifyDOM){this._linkedHElems[index].find(".igscroll-hsynced-content").css({"-webkit-transform":"translate3d("+destX+"px, "+destY+"px, 0px)"})}else{this._linkedHElems[index].css({"-webkit-transform":"translate3d("+destX+"px, "+destY+"px, 0px)"})}}}}else{destX=baseElem.scrollLeft;if(this._linkedHElems.length>0){for(index=0;index<this._linkedHElems.length;index++){if(this._linkedHElems[index].length){if(this._linkedHElems[index].data("igScroll")!==undefined&&this._linkedHElems[index].data("igScroll").options.modifyDOM){this._linkedHElems[index].find(".igscroll-container").scrollLeft(destX)}else if(this.options.modifyDOM){this._linkedHElems[index].scrollLeft(destX)}else{if(this._linkedHElems[index].parent().data("igScroll")!==undefined){this._linkedHElems[index].parent().data("igScroll")._scrollFromSyncContentH=true}this._linkedHElems[index][0].parentElement.scrollLeft=destX}}}}}},_syncElemsY:function(baseElem,useTransform,inDestY,useDestination){var destY,index;if(!baseElem&&!useDestination){return}if(useTransform){if(!useDestination){var matrix=this._content.css("-webkit-transform");var values=matrix?matrix.match(/-?[\d\.]+/g):undefined;destY=values?Number(values[5]):-this._getContentPositionY()}else{destY=inDestY}if(this._linkedVElems.length>0){for(index=0;index<this._linkedVElems.length;index++){var matrixElem=this._linkedVElems[index].css("-webkit-transform");var valuesElem=matrixElem?matrixElem.match(/-?[\d\.]+/g):undefined;var destX=valuesElem?Number(valuesElem[4]):0;if(this._linkedVElems[index].data("igScroll")!==undefined&&this._linkedVElems[index].data("igScroll").options.modifyDOM){this._linkedVElems[index].data("igScroll")._scrollTop(-destY,true,false)}else if(this.options.modifyDOM){this._linkedVElems[index].find(".igscroll-vsynced-content").css({"-webkit-transform":"translate3d("+destX+"px,"+destY+"px, 0px)"})}else{this._linkedVElems[index].css({"-webkit-transform":"translate3d("+destX+"px,"+destY+"px, 0px)"})}}}}else{destY=baseElem.scrollTop;if(this._linkedVElems.length>0){for(index=0;index<this._linkedVElems.length;index++){if(this._linkedVElems[index].length){if(this._linkedVElems[index].data("igScroll")!==undefined&&this._linkedVElems[index].data("igScroll").options.modifyDOM){this._linkedVElems[index].find(".igscroll-container").scrollTop(destY)}else if(this.options.modifyDOM){this._linkedVElems[index].scrollTop(destY)}else{if(this._linkedVElems[index].parent().data("igScroll")!==undefined){this._linkedVElems[index].parent().data("igScroll")._scrollFromSyncContentV=true}this._linkedVElems[index][0].parentElement.scrollTop=destY}}}}}},_syncHBar:function(baseElem,useTransform){var destX;if(useTransform){destX=this._getContentPositionX()}else{destX=baseElem.scrollLeft}if(this._linkedHBar){this._ignoreHScrollBarEvents=true;this._linkedHBar.scrollLeft(destX)}},_syncVBar:function(baseElem,useTransform){var destY;if(useTransform){destY=this._getContentPositionY()}else{destY=baseElem.scrollTop}if(this._linkedVBar){this._ignoreVScrollBarEvents=true;this._linkedVBar.scrollTop(destY)}},_moveHBarX:function(destX){if(this._linkedHBar){this._linkedHBar.scrollLeft(destX)}},_moveVBarY:function(destY){if(this._linkedVBar){this._linkedVBar.scrollTop(destY)}},_onKeyDown:function(event){if(this._bKeyboardNavigation){var keyCode=event.keyCode,curPosX,curPosY,scrollStep=0,horizontal=false,evtArgs={owner:this,smallIncrement:0,bigIncrement:0,horizontal:false,stepX:0,stepY:0};if(this.options.scrollOnlyHBar){curPosX=this._getScrollbarHPosition()}else{curPosX=this._getContentPositionX()}if(this.options.scrollOnlyVBar){curPosY=this._getScrollbarVPosition()}else{curPosY=this._getContentPositionY()}if(keyCode===$.ui.keyCode.DOWN){scrollStep=this.options.smallIncrementStep;evtArgs.stepY=scrollStep;evtArgs.smallIncrement=1}else if(keyCode===$.ui.keyCode.UP){scrollStep=-this.options.smallIncrementStep;evtArgs.stepY=scrollStep;evtArgs.smallIncrement=-1}else if(keyCode===$.ui.keyCode.RIGHT){horizontal=true;scrollStep=this.options.smallIncrementStep;evtArgs.stepX=scrollStep;evtArgs.smallIncrement=1}else if(keyCode===$.ui.keyCode.LEFT){horizontal=true;scrollStep=-this.options.smallIncrementStep;evtArgs.stepX=scrollStep;evtArgs.smallIncrement=-1}else if(keyCode===$.ui.keyCode.PAGE_UP){scrollStep=this.options.bigIncrementStep===null?-this._elemHeight:-this.options.bigIncrementStep;evtArgs.stepY=scrollStep;evtArgs.bigIncrement=-1}else if(keyCode===$.ui.keyCode.PAGE_DOWN){scrollStep=this.options.bigIncrementStep===null?this._elemHeight:this.options.bigIncrementStep;evtArgs.stepY=scrollStep;evtArgs.bigIncrement=1}else if(keyCode===$.ui.keyCode.SPACE&&!event.shiftKey){scrollStep=this.options.bigIncrementStep===null?this._elemHeight:this.options.bigIncrementStep;
evtArgs.stepY=scrollStep;evtArgs.bigIncrement=1}else if(keyCode===$.ui.keyCode.SPACE&&event.shiftKey){scrollStep=this.options.bigIncrementStep===null?-this._elemHeight:-this.options.bigIncrementStep;evtArgs.stepY=scrollStep;evtArgs.bigIncrement=-1}var bNoCancel=this._trigger("scrolling",null,evtArgs);if(bNoCancel){if(horizontal){this._scrollLeft(curPosX+scrollStep,false)}else{this._scrollTop(curPosY+scrollStep,false)}this._trigger("scrolled",null,{owner:this,smallIncrement:evtArgs.smallIncrement,bigIncrement:evtArgs.bigIncrement,horizontal:horizontal})}}},_onScrollContainer:function(){if(!this._bMixedEnvironment){this._applyTransformOnScrollTop()}if(!this._scrollFromSyncContentV){this._syncElemsY(this._container[0],!this._bMixedEnvironment);if(!this.options.scrollOnlyVBar){this._syncVBar(this._container[0],!this._bMixedEnvironment)}}else{this._scrollFromSyncContentV=false}if(!this._scrollFromSyncContentH){this._syncElemsX(this._container[0],!this._bMixedEnvironment);if(!this.options.scrollOnlyHBar){this._syncHBar(this._container[0],!this._bMixedEnvironment)}}else{this._scrollFromSyncContentH=false}if(!this._bInternalScroll){var posX,posY;if(this.options.scrollOnlyHBar){posX=this._getScrollbarHPosition()}else{posX=this._getContentPositionX()}if(this.options.scrollOnlyVBar){posY=this._getScrollbarVPosition()}else{posY=this._getContentPositionY()}this._updateScrollbarsPos(posX,posY)}else{this._bInternalScroll=false}return false},_onWheelContainer:function(event){if(event.ctrlKey===true){return true}var evt=event.originalEvent,scrollDeltaX=0,scrollDeltaY=0,scrollStep=this.options.wheelStep,minWheelStep=1/this.options.wheelStep,scrolledY;cancelAnimationFrame(this._touchInertiaAnimID);if(!this._bMixedEnvironment){this._applyTransformOnScrollTop()}if(this.options.scrollOnlyHBar){this._startX=this._getScrollbarHPosition()}else{this._startX=this._getContentPositionX()}if(this.options.scrollOnlyVBar){this._startY=this._getScrollbarVPosition()}else{this._startY=this._getContentPositionY()}if(evt.wheelDeltaX){scrollDeltaX=-evt.wheelDeltaX/120;if(-minWheelStep<scrollDeltaX&&scrollDeltaX<minWheelStep){scrollDeltaX=Math.sign(scrollDeltaX)*minWheelStep}}else if(evt.deltaX){scrollDeltaX=this._clampAxisCoords(evt.deltaX,-1,1)}if(evt.wheelDeltaY){scrollDeltaY=-evt.wheelDeltaY/120;if(-minWheelStep<scrollDeltaY&&scrollDeltaY<minWheelStep){scrollDeltaY=Math.sign(scrollDeltaY)*minWheelStep}}else if(evt.deltaY){scrollDeltaY=this._clampAxisCoords(evt.deltaY,-1,1)}if(this.options.smoothing){if(scrollDeltaX){this._scrollToX(this._startX+scrollDeltaX*scrollStep,true)}else{this._smoothWheelScrollY(scrollDeltaY)}}else{if(this._bMixedEnvironment){scrolledY=this._scrollToXY(this._startX+scrollDeltaX*scrollStep,this._startY+scrollDeltaY*scrollStep,true).y}else{scrolledY=this._scrollTouchToXY(this._startX,this._startY+scrollDeltaY*scrollStep,true).y}if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:false})}return!scrolledY}return false},_onPointerDownContainer:function(event){var evt=event.originalEvent;if(!evt||evt.pointerType!==2&&evt.pointerType!=="touch"||typeof MSGesture!=="function"){return true}event.target[setPointerCaptureFName](this._pointer=evt.pointerId);if(!this._gestureObject){this._gestureObject=new MSGesture;this._gestureObject.target=this._container[0]}this._gestureObject.addPointer(this._pointer)},_onPointerUpContainer:function(event){if(!this._pointer){return true}event.target[releasePointerCaptureFName](this._pointer);delete this._pointer},_onMSGestureStartContainer:function(event){if(this.options.scrollOnlyVBar){this._startX=this._getScrollbarHPosition();this._startY=this._getScrollbarVPosition()}else{this._startX=this._getContentPositionX();this._startY=this._getContentPositionY()}this._touchStartX=event.originalEvent.screenX;this._touchStartY=event.originalEvent.screenY;this._moving=true;this._totalMovedX=0;this._offsetRecorded=false;this._offsetDirection=0},_onMSGestureChangeContainer:function(event){var touchPos=event.originalEvent,destX=this._startX+this._touchStartX-touchPos.screenX,destY=this._startY+this._touchStartY-touchPos.screenY;this._totalMovedX=this._touchStartX-touchPos.screenX;if(Math.abs(this._totalMovedX)<this.options.swipeToleranceX&&!this._offsetRecorded){if(this._bMixedEnvironment){this._scrollToXY(this._startX,destY,true)}else{this._scrollTouchToXY(this._startX,destY,true)}}else{if(!this._offsetRecorded){this._offsetDirection=Math.sign(destX-this._startX);this._offsetRecorded=true}if(this._bMixedEnvironment){this._scrollToXY(destX-this._offsetDirection*this.options.swipeToleranceX,destY,true)}else{this._scrollTouchToXY(destX-this._offsetDirection*this.options.swipeToleranceX,destY,true)}}this._moving=true},_onMSGestureEndContainer:function(){this._moving=false},_onTouchStartContainer:function(event){if(event.isDefaultPrevented()||typeof MSGesture==="function"){return}cancelAnimationFrame(this._touchInertiaAnimID);var touch=event.originalEvent.touches[0];if(this.options.scrollOnlyHBar){this._startX=this._getScrollbarHPosition()}else{this._startX=this._getContentPositionX()}if(this.options.scrollOnlyVBar){this._startY=this._getScrollbarVPosition()}else{this._startY=this._getContentPositionY()}this._touchStartX=touch.pageX;this._touchStartY=touch.pageY;this._speedDecreasing=false;this._lastTouchEnd=(new Date).getTime();this._lastTouchX=touch.pageX;this._lastTouchY=touch.pageY;this._savedSpeedsX=[];this._savedSpeedsY=[];this._totalMovedX=0;this._offsetRecorded=false;this._offsetDirection=0;this._igScollTouchPrevented=false},_onTouchMoveContainer:function(event){if(event.isDefaultPrevented()||this._igScollTouchPrevented||typeof MSGesture==="function"){this._igScollTouchPrevented=false;return}var touch=event.originalEvent.touches[0];var destX=this._startX+(this._touchStartX-touch.pageX)*Math.sign(this.options.inertiaStep);var destY=this._startY+(this._touchStartY-touch.pageY)*Math.sign(this.options.inertiaStep);var speedSlopeX=this._getSpeedSlope(this._savedSpeedsX);var speedSlopeY=this._getSpeedSlope(this._savedSpeedsY);if(speedSlopeY>-.1||speedSlopeX>-.1){this._speedDecreasing=true}else{this._speedDecreasing=false}var timeFromLastTouch=(new Date).getTime()-this._lastTouchEnd;if(timeFromLastTouch!==0&&timeFromLastTouch<100){var speedX=(this._lastTouchX-touch.pageX)/timeFromLastTouch;var speedY=(this._lastTouchY-touch.pageY)/timeFromLastTouch;if(this._savedSpeedsX.length<5){this._savedSpeedsX.push(speedX)}else{this._savedSpeedsX.shift();this._savedSpeedsX.push(speedX)}if(this._savedSpeedsY.length<5){this._savedSpeedsY.push(speedY)}else{this._savedSpeedsY.shift();this._savedSpeedsY.push(speedY)}}this._lastTouchEnd=(new Date).getTime();this._lastMovedX=this._lastTouchX-touch.pageX;this._lastMovedY=this._lastTouchY-touch.pageY;this._lastTouchX=touch.pageX;this._lastTouchY=touch.pageY;this._totalMovedX+=this._lastMovedX;var scrolledXY;if(Math.abs(this._totalMovedX)<this.options.swipeToleranceX&&!this._offsetRecorded){if(navigator.userAgent.indexOf("Firefox")>-1||this._bMixedEnvironment){scrolledXY=this._scrollToXY(this._startX,destY,true)}else{scrolledXY=this._scrollTouchToXY(this._startX,destY,true)}}else{if(!this._offsetRecorded){this._offsetDirection=Math.sign(destX-this._startX);this._offsetRecorded=true}if(navigator.userAgent.indexOf("Firefox")>-1||this._bMixedEnvironment){scrolledXY=this._scrollToXY(destX-this._offsetDirection*this.options.swipeToleranceX,destY,true)}else{scrolledXY=this._scrollTouchToXY(destX-this._offsetDirection*this.options.swipeToleranceX,destY,true)}}if(scrolledXY.x===0&&scrolledXY.y===0){this._igScollTouchPrevented=true}if(!this._igScollTouchPrevented&&event.cancelable){this._showScrollbars(true);event.preventDefault()}},_onTouchEndContainer:function(event){if(event.isDefaultPrevented()||typeof MSGesture==="function"){return}var speedX=0;var speedY=0;for(var i=0;i<this._savedSpeedsX.length;i++){speedX+=this._savedSpeedsX[i];speedY+=this._savedSpeedsY[i]}speedX=this._savedSpeedsX.length?speedX/this._savedSpeedsX.length:0;speedY=this._savedSpeedsX.length?speedY/this._savedSpeedsY.length:0;if((Math.abs(speedX)>.1||Math.abs(speedY)>.1)&&(Math.abs(this._lastMovedX)>2||Math.abs(this._lastMovedY)>2)){this._showScrollbars(true);this._inertiaInit(speedX,speedY,this._bMixedEnvironment)}else{this._hideScrollbars();if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:null})}}},_onMouseEnterContainer:function(){this._mOverContainer=true;cancelAnimationFrame(this._showScrollbarsAnimId);clearTimeout(this._hideScrollbarID);if(!this._toSimpleScrollbarsID&&!this._bMouseDownH&&!this._bMouseDownV){this._showScrollbars(true)}},_onMouseLeaveContainer:function(){var self=this;this._mOverContainer=false;if(!this._bMouseDownV&&!this._bMouseDownH){clearTimeout(this._toSimpleScrollbarsID);this._toSimpleScrollbarsID=0;this._hideScrollbarID=setTimeout(function(){self._hideScrollbars()},2e3)}},_onDimensionsChange:function(){var bNoCancel,evtArgs={owner:this};bNoCancel=this._trigger("resizing",null,evtArgs);if(bNoCancel){this.refresh();this._trigger("resized",null,evtArgs)}},_onElementMutation:function(mutations){for(var index=0;index<mutations.length;index++){if(mutations[index].attributeName==="style"&&(this._elemWidth!==this.element.width()||this._elemHeight!==this.element.height())){this._onDimensionsChange()}}},_updateScrollBarsVisibility:function(){var bRenderScrollbarV=this._isScrollableV&&this._renderVerticalScrollbar,bRenderScrollbarH=this._isScrollableH&&this._renderHorizontalScrollbar,bRemoveScrollbarV=(!this._isScrollableV||!this._renderVerticalScrollbar)&&this._vBarContainer,bRemoveScrollbarH=(!this._isScrollableH||!this._renderHorizontalScrollbar)&&this._hBarContainer;if(this.options.scrollbarType==="none"){return}if(this.options.scrollbarType==="native"){if(bRenderScrollbarV&&!this._vBarContainer){this._initNativeScrollBarV(bRenderScrollbarH)}else if(bRemoveScrollbarV){this._removeVerticalScrollbar()}if(bRenderScrollbarH&&!this._hBarContainer){this._initNativeScrollBarH(bRenderScrollbarV)}else if(bRemoveScrollbarH){this._removeHorizontalScrollbar()}if((!this._vBarContainer||!this._hBarContainer)&&this._desktopFiller){this._desktopFiller.remove();this._desktopFiller=null}}else if(this.options.scrollbarType==="custom"){if(bRenderScrollbarV&&!this._vBarContainer){this._initCustomScrollBarV(bRenderScrollbarH)}else if(bRemoveScrollbarV){this._removeVerticalScrollbar()}if(bRenderScrollbarH&&!this._hBarContainer){this._initCustomScrollBarH(bRenderScrollbarV)}else if(bRemoveScrollbarH){this._removeHorizontalScrollbar()}if($.ig.util.isTouchDevice()){this._toSimpleScrollbars()}}},_initNativeScrollBarV:function(bRenderScrollbarH){var css=this.css,nativeScrollSize=$.ig.util.getScrollWidth();this._vBarContainer=$("<div id='"+this.element.attr("id")+"_vBar'></div>").addClass(css.nativeVScrollOuter);if(!bRenderScrollbarH){this._vBarContainer.addClass(css.nativeVScrollOuterSingle)}else{this._vBarContainer.css("bottom",nativeScrollSize+"px")}this._vDragHeight=this._content.height();this._vBarDrag=$("<div id='"+this.element.attr("id")+"_vBar_inner'></div>").addClass(css.nativeVScrollInner).css("height",this._vDragHeight+"px");if(this.options.scrollbarVParent){this._vBarContainer.append(this._vBarDrag).appendTo(this.options.scrollbarVParent)}else{this._vBarContainer.append(this._vBarDrag).appendTo(this._container[0].parentElement)}if($.ig.util.getScrollHeight()>0&&this.options.modifyDOM){this._content.css("padding-right",nativeScrollSize+"px")}if(bRenderScrollbarH&&this._bMixedEnvironment&&!this._desktopFiller){this._desktopFiller=$("<div id='"+this.element.attr("id")+"_scrollbarFiller'></div>").addClass(css.nativeScrollFiller).css("height",nativeScrollSize+"px").css("width",nativeScrollSize+"px");this._desktopFiller.appendTo(this._container[0].parentElement)}this._vBarContainer.scrollTop(this._getContentPositionY());this._setOption("scrollbarV",this._vBarContainer)},_initNativeScrollBarH:function(bRenderScrollbarV){var css=this.css,nativeScrollSize=$.ig.util.getScrollWidth();this._hBarContainer=$("<div id='"+this.element.attr("id")+"_hBar'></div>").addClass(css.nativeHScrollOuter);if(!bRenderScrollbarV){this._hBarContainer.addClass(css.nativeHScrollOuterSingle)}else{this._hBarContainer.css("right",nativeScrollSize+"px")}this._hDragWidth=this._content.width();this._hBarDrag=$("<div id='"+this.element.attr("id")+"_hBar_inner'></div>").addClass(css.nativeHScrollInner).css("width",this._hDragWidth+"px");if(this.options.scrollbarHParent){this._hBarContainer.append(this._hBarDrag).appendTo(this.options.scrollbarHParent)}else{this._hBarContainer.append(this._hBarDrag).appendTo(this._container[0].parentElement)}if(nativeScrollSize>0&&this.options.modifyDOM){this._content.css("padding-bottom",nativeScrollSize+"px")}if(bRenderScrollbarV&&this._bMixedEnvironment&&!this._desktopFiller){this._desktopFiller=$("<div id='"+this.element.attr("id")+"_scrollbarFiller'></div>").addClass(css.nativeScrollFiller).css("height",nativeScrollSize+"px").css("width",nativeScrollSize+"px");this._desktopFiller.appendTo(this._container[0].parentElement)}this._hBarContainer.scrollLeft(this._getContentPositionX());this._setOption("scrollbarH",this._hBarContainer)},_removeScrollbars:function(){this._removeVerticalScrollbar();this._removeHorizontalScrollbar();if(this._desktopFiller){this._desktopFiller.remove();this._desktopFiller=null;this._content.css("padding-right","0px").css("padding-bottom","0px")}},_removeVerticalScrollbar:function(){if(this._vBarContainer){this._vBarContainer.remove();this._vBarContainer=null;this._vDragHeight=null;this._vBarDrag=null;this._vBarTrack=null;if(this.options.modifyDOM&&this.options.scrollbarType==="native"){this._content.css("padding-right","")}}if(this._onMouseMoveVDragHandler){$("body").off("mousemove.igscroll_"+this.element[0].id,this._onMouseMoveVDragHandler)}if(this._onMouseUpVScrollbarHandler){$(window).off("mouseup.igscroll_"+this.element[0].id,this._onMouseUpVScrollbarHandler)}},_removeHorizontalScrollbar:function(){if(this._hBarContainer){this._hBarContainer.remove();this._hBarContainer=null;this._hDragHeight=null;this._hBarDrag=null;this._hBarTrack=null;if(this.options.modifyDOM&&this.options.scrollbarType==="native"){this._content.css("padding-bottom","")}}if(this._onMouseMoveHDragHandler){$("body").off("mousemove.igscroll_"+this.element[0].id,this._onMouseMoveHDragHandler)}if(this._onMouseUpHScrollbarHandler){$(window).off("mouseup.igscroll_"+this.element[0].id,this._onMouseUpHScrollbarHandler)}},_initCustomScrollBarV:function(bRenderScrollbarH){var css=this.css;this._vBarContainer=$("<div id='"+this.element.attr("id")+"_vBar'></div>").addClass(css.verticalScrollContainer);this._vBarArrowUp=$("<div id='"+this.element.attr("id")+"_vBar_arrowUp'></div>").addClass(css.verticalScrollArrow).addClass(css.verticalScrollArrowUp);this._vBarTrack=$("<div id='"+this.element.attr("id")+"_vBar_track'></div>").addClass(css.verticalScrollTrack);this._vBarArrowDown=$("<div id='"+this.element.attr("id")+"_vBar_arrowDown'></div>").addClass(css.verticalScrollArrow).addClass(css.verticalScrollArrowDown);if(!bRenderScrollbarH){this._vBarTrack.addClass(css.verticalScrollTrackSingleScrollbar);this._vBarArrowDown.addClass(css.verticalScrollArrowDownSingleScrollbar)}if(this.options.scrollbarVParent){this._vBarContainer.append(this._vBarArrowUp).append(this._vBarTrack.append(this._vBarDrag)).append(this._vBarArrowDown).appendTo(this.options.scrollbarVParent)}else{this._vBarContainer.append(this._vBarArrowUp).append(this._vBarTrack.append(this._vBarDrag)).append(this._vBarArrowDown).appendTo(this._container[0].parentElement)}this._vDragHeight=this._calculateVDragHeight();this._vBarDrag=$("<span id='"+this.element.attr("id")+"_vBar_drag'></span>").addClass(css.verticalScrollThumbDrag+" "+css.verticalScrollThumbDragThin).css("height",this._vDragHeight+"%");if(this.options.scrollbarVParent){this._vBarTrack.append(this._vBarDrag)}else{this._vBarTrack.append(this._vBarDrag)}this._bindCustomScrollBarV()},_calculateVDragHeight:function(){var dragHeightPx,minSize=parseInt(this.options.minThumbSize,10);dragHeightPx=this._vBarTrack.height()/this._contentHeight*this._vBarTrack.height();dragHeightPx=dragHeightPx<minSize?minSize:dragHeightPx;return dragHeightPx/this._vBarTrack.height()*100},_bindCustomScrollBarV:function(){this._holdTimeoutID=0;this._bMouseDownV=false;this._bUseArrowUp=false;this._bUseArrowDown=false;this._mouseLastY=0;this._dragLastY=0;this._bUseVDrag=false;this._bUseVTrack=false;this._lastBigIncDirV=0;this._mTrackLastPosV=0;if(this._vBarArrowUp){this._vBarArrowUp.on({mousedown:$.proxy(this._onMouseDownArrowUp,this),mouseup:$.proxy(this._onMouseUpArrowUp,this),mouseover:$.proxy(this._onMouseOverArrowUp,this),mouseout:$.proxy(this._onMouseOutScrollbarArrow,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._vBarArrowDown){this._vBarArrowDown.on({mousedown:$.proxy(this._onMouseDownArrowDown,this),mouseup:$.proxy(this._onMouseUpArrowDown,this),mouseover:$.proxy(this._onMouseOverArrowDown,this),mouseout:$.proxy(this._onMouseOutScrollbarArrow,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._vBarDrag){this._vBarDrag.on({mousedown:$.proxy(this._onMouseDownVDrag,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._vBarTrack){this._vBarTrack.on({mousedown:$.proxy(this._onMouseDownVTrack,this),mousemove:$.proxy(this._onMouseMoveVTrack,this),mouseup:$.proxy(this._onMouseUpVTrack,this),mouseout:$.proxy(this._onMouseOutVTrack,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._vBarContainer){this._vBarContainer.on({dragstart:$.proxy(this._onDragStartElem,this),wheel:$.proxy(this._onWheelContainer,this),mouseenter:$.proxy(this._onMouseEnterScrollbarElem,this),mouseleave:$.proxy(this._onMouseLeaveScrollbarElem,this)})}this._onMouseMoveVDragHandler=$.proxy(this._onMouseMoveVDrag,this);this._onMouseUpVScrollbarHandler=$.proxy(this._onMouseUpVScrollbar,this);$("body").on("mousemove.igscroll_"+this.element[0].id,this._onMouseMoveVDragHandler);$(window).on("mouseup.igscroll_"+this.element[0].id,this._onMouseUpVScrollbarHandler)},_scrollTimeoutY:function(step,bSmallIncement){var curPosY=this._getContentPositionY();if(curPosY===0&&step<=0||curPosY===this._getContentHeight()-this._getContainerHeight()&&step>=0){return}var bNoCancel,eventArgs={owner:this,smallIncrement:0,bigIncrement:0,horizontal:false,stepX:0,stepY:step};if(bSmallIncement){eventArgs.smallIncrement=Math.sign(step)}else{var dragStartY=this._getTransform3dValueY(this._vBarDrag);if(this._mTrackLastPosV>dragStartY&&this._mTrackLastPosV<dragStartY+this._vDragHeight){return}eventArgs.bigIncrement=Math.sign(step);this._lastBigIncDirV=Math.sign(step)}bNoCancel=this._trigger("scrolling",null,eventArgs);this._cancelScrolling=!bNoCancel;if(bNoCancel){this._scrollTop(curPosY+step,false);var self=this;this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutY(step,bSmallIncement)},50)}},_onMouseDownArrowUp:function(){var scrollStep=-this.options.smallIncrementStep,curPosY=this._getContentPositionY();if(curPosY===0){scrollStep=0}var bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:-1,bigIncrement:0,horizontal:false,stepX:0,stepY:scrollStep});this._cancelScrolling=!bNoCancel;if(bNoCancel){this._bMouseDownV=true;this._bUseArrowUp=true;this._scrollTop(curPosY+scrollStep,false);var self=this;this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutY(scrollStep,true)},250)}},_onMouseUpArrowUp:function(){this._bMouseDownV=false;this._bUseArrowUp=true;clearTimeout(this._holdTimeoutID)},_onMouseOverArrowUp:function(){if(this._bMouseDownV&&this._bUseArrowUp){this._scrollTimeoutY(-40,true)}},_onMouseOutScrollbarArrow:function(){clearTimeout(this._holdTimeoutID)},_onMouseDownArrowDown:function(){var scrollStep=this.options.smallIncrementStep,curPosY=this._getContentPositionY();if(curPosY===this._getContentHeight()-this._getContainerHeight()){scrollStep=0}var bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:1,bigIncrement:0,horizontal:false,stepX:0,stepY:scrollStep});this._cancelScrolling=!bNoCancel;if(bNoCancel){this._bMouseDownV=true;this._bUseArrowDown=true;this._scrollTop(curPosY+scrollStep,false);var self=this;this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutY(scrollStep,true)},250)}},_onMouseUpArrowDown:function(){this._bMouseDownV=false;this._bUseArrowDown=true;clearTimeout(this._holdTimeoutID)},_onMouseOverArrowDown:function(){if(this._bMouseDownV&&this._bUseArrowDown){this._scrollTimeoutY(40,true)}},_onMouseDownVDrag:function(event){this._bMouseDownV=true;this._mouseLastY=event.pageY;this._bUseVDrag=true;this._bUseHDrag=false;this._trigger("thumbDragStart",null,{owner:this,horizontal:false});this._disableContentSelection()},_onMouseDownVTrack:function(event){if(event.target.id===this._vBarDrag[0].id){return true}this._bUseVTrack=true;var self=this,dragStartY=this._getTransform3dValueY(this._vBarDrag),curPosY=this._getContentPositionY(),scrollStep=this.options.bigIncrementStep===null?this._elemHeight:this.options.bigIncrementStep,bNoCancel;this._mTrackLastPosV=event.offsetY;if(event.offsetY>dragStartY+this._vDragHeight){this._lastBigIncDirV=1;bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:1,horizontal:false,stepX:0,stepY:scrollStep});this._cancelScrolling=!bNoCancel;if(bNoCancel){this._scrollTop(curPosY+scrollStep,false);this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutY(scrollStep,false)},250)}}else if(event.offsetY<dragStartY){this._lastBigIncDirV=-1;bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:-1,horizontal:false,stepX:0,stepY:-scrollStep});if(bNoCancel){this._scrollTop(curPosY-scrollStep,false);this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutY(-scrollStep,false)},250)}}},_onMouseMoveVTrack:function(event){if(this._bUseVTrack){this._mTrackLastPosV=event.offsetY}},_onMouseUpVTrack:function(){clearTimeout(this._holdTimeoutID);if(this._bUseVTrack&&!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:this._lastBigIncDirV,horizontal:false})}this._bUseVTrack=false},_onMouseOutVTrack:function(){clearTimeout(this._holdTimeoutID);if(this._bUseVTrack&&!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:this._lastBigIncDirV,horizontal:false})}this._bUseVTrack=false},_onMouseMoveVDrag:function(event){if(!this._bMouseDownV||!this._bUseVDrag){return true}if(this._bUseVDrag){var curPosY=this._getContentPositionY(),offset=event.pageY-this._mouseLastY,dragbPosY=this._dragLastY,nextPosY;nextPosY=(dragbPosY+offset)/(this._vBarTrack.height()-this._vBarDrag.height())*(this._getContentHeight()-this.element.height());nextPosY=this._clampAxisCoords(nextPosY,0,Math.max(this._getContentHeight()-this._getContainerHeight(),0));var bNoCancel=this._trigger("thumbDragMove",null,{owner:this,horizontal:false,stepX:0,stepY:nextPosY-curPosY});this._cancelThumbDrag=!bNoCancel;if(bNoCancel){this._scrollToY(nextPosY,true);this._mouseLastY=event.pageY;this._dragLastY=dragbPosY+offset}}},_onMouseUpVScrollbar:function(){var self=this;if(this._bUseArrowUp){this._bUseArrowUp=false;if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:-1,bigIncrement:0,horizontal:false})}}if(this._bUseArrowDown){this._bUseArrowDown=false;if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:1,bigIncrement:0,horizontal:false})}}if(this._bMouseDownV&&!this._mOverScrollbars&&!this._mOverContainer){this._hideScrollbarID=setTimeout(function(){self._hideScrollbars()},2e3)}else if(this._bMouseDownV&&!this._mOverScrollbars&&this._mOverContainer){this._toSimpleScrollbarsID=setTimeout(function(){self._toSimpleScrollbars();self._toSimpleScrollbarsID=0},2e3)}this._bMouseDownV=false;if(this._bUseVDrag){this._dragLastY=this._getTransform3dValueY(this._vBarDrag);if(!this._cancelThumbDrag){this._trigger("thumbDragEnd",null,{owner:this,horizontal:false})}if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:true})}this._enableContentSelection()}this._bUseVDrag=false},_initCustomScrollBarH:function(bRenderScrollbarV){var css=this.css;this._hBarContainer=$("<div id='"+this.element.attr("id")+"_hBar'></div>").addClass(css.horizontalScrollContainer);this._hBarArrowLeft=$("<div id='"+this.element.attr("id")+"_hBar_arrowLeft'></div>").addClass(css.horizontalScrollArrow).addClass(css.horizontalScrollArrowLeft);this._hBarTrack=$("<div id='"+this.element.attr("id")+"_hBar_track'></div>").addClass(css.horizontalScrollTrack);this._hBarArrowRight=$("<div id='"+this.element.attr("id")+"_hBar_arrowRight'></div>").addClass(css.horizontalScrollArrow).addClass(css.horizontalScrollArrowRight);if(!bRenderScrollbarV){this._hBarTrack.addClass(css.horizontalScrollTrackSingleScrollbar);this._hBarArrowRight.addClass(css.horizontalScrollArrowRightSingleScrollbar)}if(this.options.scrollbarHParent){this._hBarContainer.append(this._hBarArrowLeft).append(this._hBarTrack.append(this._hBarDrag)).append(this._hBarArrowRight).appendTo(this.options.scrollbarHParent)}else{this._hBarContainer.append(this._hBarArrowLeft).append(this._hBarTrack.append(this._hBarDrag)).append(this._hBarArrowRight).appendTo(this._container[0].parentElement)}this._hDragWidth=this._calculateHDragWidth();this._hBarDrag=$("<span id='"+this.element.attr("id")+"_hBar_drag'></span>").addClass(css.horizontalScrollThumbDrag+" "+css.horizontalScrollThumbDragThin).css("width",this._hDragWidth+"%");if(this.options.scrollbarHParent){this._hBarTrack.append(this._hBarDrag)}else{this._hBarTrack.append(this._hBarDrag)}this._bindCustomScrollBarH()},_calculateHDragWidth:function(){var dragWidthPx,minSize=parseInt(this.options.minThumbSize,10);dragWidthPx=this._hBarTrack.width()/this._contentWidth*this._hBarTrack.width();dragWidthPx=dragWidthPx<minSize?minSize:dragWidthPx;return dragWidthPx/this._hBarTrack.width()*100},_bindCustomScrollBarH:function(){this._holdTimeoutID=0;this._bMouseDownH=false;this._bUseArrowLeft=false;this._bUseArrowRight=false;this._bUseHDrag=false;this._mouseLastX=0;this._dragLastX=0;this._bUseHTrack=false;this._lastBigIncDirH=0;this._mTrackLastPosH=0;if(this._hBarArrowLeft){this._hBarArrowLeft.on({mousedown:$.proxy(this._onMouseDownArrowLeft,this),mouseup:$.proxy(this._onMouseUpArrowLeft,this),mouseover:$.proxy(this._onMouseOverArrowLeft,this),mouseout:$.proxy(this._onMouseOutScrollbarArrow,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._hBarArrowRight){this._hBarArrowRight.on({mousedown:$.proxy(this._onMouseDownArrowRight,this),mouseup:$.proxy(this._onMouseUpArrowRight,this),mouseover:$.proxy(this._onMouseOverArrowRight,this),mouseout:$.proxy(this._onMouseOutScrollbarArrow,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._hBarDrag){this._hBarDrag.on({mousedown:$.proxy(this._onMouseDownHDrag,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._hBarTrack){this._hBarTrack.on({mousedown:$.proxy(this._onMouseDownHTrack,this),mousemove:$.proxy(this._onMouseMoveHTrack,this),mouseup:$.proxy(this._onMouseUpHTrack,this),mouseout:$.proxy(this._onMouseOutHTrack,this),touchstart:$.proxy(this._onTouchStartScrollbarElem,this)})}if(this._hBarContainer){this._hBarContainer.on({dragstart:$.proxy(this._onDragStartElem,this),wheel:$.proxy(this._onWheelContainer,this),mouseenter:$.proxy(this._onMouseEnterScrollbarElem,this),mouseleave:$.proxy(this._onMouseLeaveScrollbarElem,this)})}this._onMouseMoveHDragHandler=$.proxy(this._onMouseMoveHDrag,this);this._onMouseUpHScrollbarHandler=$.proxy(this._onMouseUpHScrollbar,this);$("body").on("mousemove.igscroll_"+this.element[0].id,this._onMouseMoveHDragHandler);$(window).on("mouseup.igscroll_"+this.element[0].id,this._onMouseUpHScrollbarHandler)},_scrollTimeoutX:function(step,bSmallIncement){var curPosX=this._getContentPositionX();if(curPosX===0&&step<=0||curPosX===this._getContentWidth()-this._getContainerWidth()&&step>=0){return}var self=this,bNoCancel,eventArgs={owner:self,smallIncrement:0,bigIncrement:0,horizontal:true,stepX:step,stepY:0};if(bSmallIncement){eventArgs.smallIncrement=Math.sign(step)}else{var dragStartX=this._getTransform3dValueX(this._hBarDrag);if(this._mTrackLastPosH>dragStartX&&this._mTrackLastPosH<dragStartX+this._hDragWidth){return}eventArgs.bigIncrement=Math.sign(step);this._lastBigIncDirH=Math.sign(step)}bNoCancel=this._trigger("scrolling",null,eventArgs);this._cancelScrolling=!bNoCancel;if(bNoCancel){var curPosY=this._getContentPositionX();this._scrollLeft(curPosY+step,false);this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutX(step,bSmallIncement)},50)}},_onMouseDownArrowLeft:function(){var scrollStep=-this.options.smallIncrementStep,curPosX=this._getContentPositionX();if(curPosX===0){scrollStep=0}var bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:-1,bigIncrement:0,horizontal:true,stepX:scrollStep,stepY:0});this._cancelScrolling=!bNoCancel;if(bNoCancel){this._bMouseDownH=true;this._bUseArrowLeft=true;this._scrollLeft(curPosX+scrollStep,false);var self=this;this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutX(scrollStep,true)},250)}},_onMouseUpArrowLeft:function(){this._bMouseDownH=false;this._bUseArrowLeft=false;clearTimeout(this._holdTimeoutID);if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:-1,bigIncrement:0,horizontal:true})}},_onMouseOverArrowLeft:function(){if(this._bMouseDownH&&this._bUseArrowLeft){this._scrollTimeoutX(-40,true)}},_onMouseDownArrowRight:function(){var scrollStep=this.options.smallIncrementStep,curPosX=this._getContentPositionX();if(curPosX===this._getContentWidth()-this._getContainerWidth()){scrollStep=0}var bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:1,bigIncrement:0,horizontal:true,stepX:scrollStep,stepY:0});this._cancelScrolling=!bNoCancel;if(bNoCancel){this._bMouseDownH=true;this._bUseArrowRight=true;this._scrollLeft(curPosX+scrollStep,false);var self=this;this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutX(scrollStep,true)},250)}},_onMouseUpArrowRight:function(){this._bMouseDownH=false;this._bUseArrowRight=false;clearTimeout(this._holdTimeoutID);if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:1,bigIncrement:0,horizontal:true})}},_onMouseOverArrowRight:function(){if(this._bMouseDownH&&this._bUseArrowRight){this._scrollTimeoutX(40,true)}},_onMouseDownHDrag:function(event){this._bMouseDownH=true;this._mouseLastX=event.pageX;this._bUseVDrag=false;this._bUseHDrag=true;this._trigger("thumbDragStart",null,{owner:this,horizontal:true});this._disableContentSelection()},_onMouseDownHTrack:function(event){if(event.target.id===this._hBarDrag[0].id){return true}this._bUseHTrack=true;var self=this,dragStartX=this._getTransform3dValueX(this._hBarDrag),curPosX=this._getContentPositionX(),scrollStep=this.options.bigIncrementStep===null?this._elemWidth:this.options.bigIncrementStep,bNoCancel;this._mTrackLastPosH=event.offsetX;if(event.offsetX>dragStartX+this._hDragWidth){this._lastBigIncDirH=1;bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:1,horizontal:true,stepX:scrollStep,stepY:0});if(bNoCancel){this._scrollLeft(curPosX+scrollStep,false);this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutX(scrollStep,false)},250)}}else if(event.offsetX<dragStartX){this._lastBigIncDirH=-1;bNoCancel=this._trigger("scrolling",null,{owner:this,smallIncrement:0,bigIncrement:-1,horizontal:true,stepX:-scrollStep,stepY:0});if(bNoCancel){this._scrollLeft(curPosX-scrollStep,false);this._holdTimeoutID=setTimeout(function(){self._scrollTimeoutX(-scrollStep,false)},250)}}this._cancelScrolling=!bNoCancel},_onMouseMoveHTrack:function(event){
if(this._bUseVTrack){this._mTrackLastPosH=event.offsetX}},_onMouseUpHTrack:function(){clearTimeout(this._holdTimeoutID);if(this._bUseHTrack&&!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:this._lastBigIncDirH,horizontal:true})}this._bUseHTrack=false},_onMouseOutHTrack:function(){clearTimeout(this._holdTimeoutID);if(this._bUseHTrack&&!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:this._lastBigIncDirH,horizontal:true})}this._bUseHTrack=false},_onMouseMoveHDrag:function(evt){if(!this._bMouseDownH||!this._bUseHDrag){return true}if(this._bUseHDrag){var curPosX=this._getContentPositionX(),offset=evt.pageX-this._mouseLastX,dragbPosX=this._dragLastX,nextPostX;nextPostX=(dragbPosX+offset)/(this._hBarTrack.width()-this._hBarDrag.width())*(this._getContentWidth()-this.element.width());nextPostX=this._clampAxisCoords(nextPostX,0,Math.max(this._getContentWidth()-this._getContainerWidth(),0));var bNoCancel=this._trigger("thumbDragMove",null,{owner:this,horizontal:true,stepX:nextPostX-curPosX,stepY:0});if(bNoCancel){this._scrollToX(nextPostX,true);this._mouseLastX=evt.pageX;this._dragLastX=dragbPosX+offset}}},_onMouseUpHScrollbar:function(){var self=this;if(this._bUseArrowLeft){this._bUseArrowLeft=false;if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:-1,bigIncrement:0,horizontal:true})}}if(this._bUseArrowRight){this._bUseArrowRight=false;if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:1,bigIncrement:0,horizontal:true})}}if(this._bMouseDownH&&!this._mOverScrollbars&&!this._mOverContainer){this._hideScrollbarID=setTimeout(function(){self._hideScrollbars()},2e3)}else if(this._bMouseDownH&&!this._mOverScrollbars&&this._mOverContainer){this._toSimpleScrollbarsID=setTimeout(function(){self._toSimpleScrollbars();self._toSimpleScrollbarsID=0},2e3)}this._bMouseDownH=false;if(this._bUseHDrag){this._dragLastX=this._getTransform3dValueX(this._hBarDrag);if(!this._cancelThumbDrag){this._trigger("thumbDragEnd",null,{owner:this,horizontal:true})}if(!this._cancelScrolling){this._trigger("scrolled",null,{owner:this,smallIncrement:0,bigIncrement:0,horizontal:true})}this._enableContentSelection()}this._bUseHDrag=false},_showScrollbars:function(bSimple,hideAfter){var self=this;if(this.options.scrollbarType!=="custom"){return}if(bSimple){this._hideScrollbarArrows();if(this._vBarDrag&&this._percentInViewV<1){this._vBarDrag.removeClass(this.css.verticalScrollThumbDragHidden).addClass(this.css.verticalScrollThumbDragThin)}if(this._hBarDrag&&this._percentInViewH<1){this._hBarDrag.removeClass(this.css.horizontalScrollThumbDragHidden).addClass(this.css.horizontalScrollThumbDragThin)}}else{this._showScrollbarArrows();if(this._vBarDrag&&this._percentInViewV<1){this._vBarDrag.removeClass(this.css.verticalScrollThumbDragHidden).removeClass(this.css.verticalScrollThumbDragThin).addClass(this.css.verticalScrollThumbDragBig)}if(this._hBarDrag&&this._percentInViewH<1){this._hBarDrag.removeClass(this.css.horizontalScrollThumbDragHidden).removeClass(this.css.horizontalScrollThumbDragThin).addClass(this.css.horizontalScrollThumbDragBig)}}if(hideAfter){this._hideScrollbarID=setTimeout(function(){self._hideScrollbars()},hideAfter)}},_updateScrollbarsPos:function(destX,destY){if(this.options.scrollbarType!=="custom"){return}var self=this,animationID,calculatedDest;function updateCSS(){if(self._hBarDrag){calculatedDest=destX/(self._contentWidth-self.element.width())*(self._hBarTrack.width()-self._hBarDrag.width());self._hBarDrag.css("-webkit-transform","translate3d("+calculatedDest+"px, 0px, 0px)").css("-moz-transform","translate3d("+calculatedDest+"px, 0px, 0px)").css("-ms-transform","translate3d("+calculatedDest+"px, 0px, 0px)");if(!self._bUseHDrag){self._dragLastX=calculatedDest}}if(self._vBarDrag){calculatedDest=destY/(self._contentHeight-self.element.height())*(self._vBarTrack.height()-self._vBarDrag.height());self._vBarDrag.css("-webkit-transform","translate3d(0px, "+calculatedDest+"px, 0px)").css("-moz-transform","translate3d(0px, "+calculatedDest+"px, 0px)").css("-ms-transform","translate3d(0px, "+calculatedDest+"px, 0px)");if(!self._bUseVDrag){self._dragLastY=calculatedDest}}}animationID=requestAnimationFrame(updateCSS)},_hideScrollbars:function(){if(this.options.scrollbarType!=="custom"||this.options.alwaysVisible||!this._vBarDrag&&!this._hBarDrag){return}if(this._vBarDrag&&this._percentInViewV<1){this._vBarDrag.removeClass(this.css.verticalScrollThumbDragThin).removeClass(this.css.verticalScrollThumbDragBig).addClass(this.css.verticalScrollThumbDragHidden)}if(this._hBarDrag&&this._percentInViewH<1){this._hBarDrag.removeClass(this.css.horizontalScrollThumbDragThin).removeClass(this.css.horizontalScrollThumbDragBig).addClass(this.css.horizontalScrollThumbDragHidden)}this._hideScrollbarArrows()},_toSimpleScrollbars:function(){if(this._vBarDrag&&this._percentInViewV<1){this._vBarDrag.removeClass(this.css.verticalScrollThumbDragBig).addClass(this.css.verticalScrollThumbDragThin)}if(this._hBarDrag&&this._percentInViewH<1){this._hBarDrag.removeClass(this.css.horizontalScrollThumbDragBig).addClass(this.css.horizontalScrollThumbDragThin)}this._hideScrollbarArrows()},_showScrollbarArrows:function(){if(this._vBarDrag&&this._percentInViewV<1){this._vBarArrowUp.removeClass(this.css.verticalScrollArrowHidden).addClass(this.css.verticalScrollArrow);this._vBarArrowDown.removeClass(this.css.verticalScrollArrowHidden).addClass(this.css.verticalScrollArrow)}if(this._hBarDrag&&this._percentInViewH<1){this._hBarArrowLeft.removeClass(this.css.horizontalScrollArrowHidden).addClass(this.css.horizontalScrollArrow);this._hBarArrowRight.removeClass(this.css.horizontalScrollArrowHidden).addClass(this.css.horizontalScrollArrow)}},_hideScrollbarArrows:function(){if(this._vBarDrag&&this._percentInViewV<1){this._vBarArrowUp.removeClass(this.css.verticalScrollArrow).addClass(this.css.verticalScrollArrowHidden);this._vBarArrowDown.removeClass(this.css.verticalScrollArrow).addClass(this.css.verticalScrollArrowHidden)}if(this._hBarDrag&&this._percentInViewH<1){this._hBarArrowLeft.removeClass(this.css.horizontalScrollArrow).addClass(this.css.horizontalScrollArrowHidden);this._hBarArrowRight.removeClass(this.css.horizontalScrollArrow).addClass(this.css.horizontalScrollArrowHidden)}},_onMouseEnterScrollbarElem:function(){this._mOverScrollbars=true;clearTimeout(this._hideScrollbarID);clearTimeout(this._toSimpleScrollbarsID);this._toSimpleScrollbarsID=0;this._showScrollbars(false)},_onMouseLeaveScrollbarElem:function(){var self=this;this._mOverScrollbars=false;if(!this._bMouseDownV&&!this._bMouseDownH){this._hideScrollbarID=setTimeout(function(){self._hideScrollbars()},2e3);this._toSimpleScrollbarsID=setTimeout(function(){self._toSimpleScrollbars();self._toSimpleScrollbarsID=0},2e3)}},_onTouchStartScrollbarElem:function(){return false},_disableContentSelection:function(){this._container.addClass(this.css.disabledSelection)},_enableContentSelection:function(){this._container.removeClass(this.css.disabledSelection)},_onDragStartElem:function(event){event.preventDefault()},destroy:function(){cancelAnimationFrame(this._touchInertiaAnimID);cancelAnimationFrame(this._showScrollbarsAnimId);clearTimeout(this._hideScrollbarID);clearTimeout(this._toSimpleScrollbarsID);clearTimeout(this._holdTimeoutID);if(typeof MutationObserver==="function"){this._observer.disconnect()}if(this._evts){this.element.off(this._evts);delete this._evts;if(this._hBarDrag){this._hBarDrag.remove()}if(this._hBarContainer){this._hBarContainer.remove()}if(this._vBarDrag){this._vBarDrag.remove()}if(this._vBarContainer){this._vBarContainer.remove()}$("body").off("mousemove.igscroll_"+this.element[0].id);$(window).off("mouseup.igscroll_"+this.element[0].id);$(window).off("resize.igscroll_"+this.element[0].id);this._superApply(arguments)}return this}});$.extend($.ui.igScroll,{version:"21.2.12"});$(document).on("iggridrendered igtreegridrendered",function(event,args){var container=args.owner.scrollContainer();if(container.length===0&&args.owner.container){container=args.owner.container().find("[data-scroll]").eq(0)}if(container.length!==0){container.igScroll({modifyDOM:false,scrollbarType:"none"});container.data("igScroll")._bKeyboardNavigation=false}});return $});