define(["exports","./../../layoutmanager.js","./../../scroller/smoothscroller.js","./../../headroom/headroom.js","./../../customelementupgrade.js","./../../skinviewmanager.js"],function(_exports,_layoutmanager,_smoothscroller,_headroom,_customelementupgrade,_skinviewmanager){function onInit(){this.classList.add("emby-scroller")}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0;var embyScrollButtonsLoaded,headerElement=document.querySelector(".skinHeader");function loadEmbyScrollButtons(){return embyScrollButtonsLoaded?Promise.resolve():(embyScrollButtonsLoaded=!0,Emby.importModule("./modules/emby-elements/emby-scrollbuttons/emby-scrollbuttons.js"))}function onScrollButtonsLoaded(scroller){var parent=scroller;(parent="self"!==scroller.getAttribute("data-scrollbuttonparent")?parent.parentNode:parent).insertAdjacentHTML("afterbegin",'
')}_layoutmanager.default.tv||loadEmbyScrollButtons();var EmbyScroller=function(_HTMLDivElement){function EmbyScroller(){var _this,self=_this=_HTMLDivElement.call(this)||this;return onInit.call(self),babelHelpers.possibleConstructorReturn(_this,self)}return babelHelpers.inherits(EmbyScroller,_HTMLDivElement),babelHelpers.createClass(EmbyScroller,[{key:"connectedCallback",value:function(){onInit.call(this);var scroller,horizontal="false"!==this.getAttribute("data-horizontal"),slider=this.querySelector(".scrollSlider"),bindHeaderValue=(horizontal&&(slider.style["white-space"]="nowrap"),this.getAttribute("data-bindheader")),bindHeaderValue="true"===bindHeaderValue||_layoutmanager.default.tv&&"tv"===bindHeaderValue,enableScrollButtons=!_layoutmanager.default.tv&&(horizontal||"x"===this.getAttribute("data-scrollbuttonstype"))&&"false"!==this.getAttribute("data-scrollbuttons"),focusScroll="true"===(focusScroll=this.getAttribute("data-focusscroll"))?"adaptive":"false"===focusScroll?null:focusScroll||("false"!==this.getAttribute("data-centerfocus")?"adaptive":null),forceScrollbar=(this.isPrimaryScroller=bindHeaderValue||"true"===this.getAttribute("data-primaryscroller"),"true"===this.getAttribute("data-forcescrollbar")),slider={horizontal:horizontal,mouseWheel:"false"!==this.getAttribute("data-mousewheel"),touchDragging:1,slidee:slider,dragHandle:1,hideScrollbar:enableScrollButtons&&horizontal||!forceScrollbar&&null,forceScrollbar:enableScrollButtons&&horizontal||forceScrollbar,allowNativeSmoothScroll:"true"===this.getAttribute("data-allownativesmoothscroll"),focusScroll:focusScroll,focusScrollOffsetLeft:this.getAttribute("data-focusscrolloffsetleft")||this.getAttribute("data-focusscrolloffset")||null,focusScrollOffsetTop:this.getAttribute("data-focusscrolloffsettop")||this.getAttribute("data-focusscrolloffset")||null,forceNativeScroll:"true"===this.getAttribute("data-forcenativescroll"),forceSmoothScroll:"true"===this.getAttribute("data-forcesmoothscroll"),dualScroll:"true"===this.getAttribute("data-dualscroll"),miniScrollbar:"true"===this.getAttribute("data-miniscrollbar"),autoStartEdge:horizontal||this.isPrimaryScroller},forceScrollbar=(slider.dualScroll&&(slider.autoStartEdge=!1),horizontal||this.isPrimaryScroller||(slider.adaptiveBorderYStart=0),this.getAttribute("data-adaptiveborder")),focusScroll=(forceScrollbar&&(slider.adaptiveBorderXStart=slider.adaptiveBorderXEnd=slider.adaptiveBorderYStart=slider.adaptiveBorderYEnd=parseInt(forceScrollbar)),this.getAttribute("data-adaptiveborderxstart")),horizontal=(focusScroll&&(slider.adaptiveBorderXStart=parseInt(focusScroll)),this.getAttribute("data-adaptiveborderystart")),forceScrollbar=(horizontal&&(slider.adaptiveBorderYStart=parseInt(horizontal)),this.getAttribute("data-adaptiveborderxend")),focusScroll=(forceScrollbar&&(slider.adaptiveBorderXEnd=parseInt(forceScrollbar)),this.getAttribute("data-adaptiveborderyend"));focusScroll&&(slider.adaptiveBorderYEnd=parseInt(focusScroll)),this.scroller=new _smoothscroller.default(this,slider),this.scroller.init(),bindHeaderValue&&(horizontal=this,_skinviewmanager.default.getSkinOptions().disableHeadRoom||((forceScrollbar=new _headroom.default({scroller:horizontal,element:headerElement,enableScrollingStatus:!0})).init(),horizontal.headroom=forceScrollbar)),enableScrollButtons&&(scroller=this,_layoutmanager.default.tv||(embyScrollButtonsLoaded?onScrollButtonsLoaded(scroller):loadEmbyScrollButtons().then(function(){onScrollButtonsLoaded(scroller)}))),this.__upgraded=!0,this.dispatchEvent(new CustomEvent("upgraded",{cancelable:!1}))}},{key:"disconnectedCallback",value:function(){var headroom=this.headroom,headroom=(headroom&&(headroom.destroy(),this.headroom=null),this.scroller);headroom&&(headroom.destroy(),this.scroller=null)}},{key:"pause",value:function(){this.paused=!0;var headroom=this.headroom;headroom&&headroom.pause()}},{key:"beginResume",value:function(){this.paused=!1;var headroom=this.headroom;headroom&&headroom.beginResume()}},{key:"resume",value:function(){this.paused=!1;var headroom=this.headroom;headroom?headroom.resume():this.isPrimaryScroller&&(headerElement.classList.add("headroom-scrolling"),headerElement.classList.remove("headroom-hidden"))}},{key:"getScrollSize",value:function(){if(this.scroller)return this.scroller.getScrollSize()}},{key:"getScrollWidth",value:function(){if(this.scroller)return this.scroller.getScrollWidth()}},{key:"getScrollHeight",value:function(){if(this.scroller)return this.scroller.getScrollHeight()}},{key:"getScrollPosition",value:function(){if(this.scroller)return this.scroller.getScrollPosition()}},{key:"getLastScrollPosition",value:function(){if(this.scroller)return this.scroller.getLastScrollPosition()}},{key:"isNativeScroll",value:function(){if(this.scroller)return this.scroller.isNativeScroll()}},{key:"getScrollLeft",value:function(){if(this.scroller)return this.scroller.getScrollLeft()}},{key:"getScrollTop",value:function(){if(this.scroller)return this.scroller.getScrollTop()}},{key:"getScrollContainerBoundingClientRect",value:function(){if(this.scroller)return this.scroller.getScrollContainerBoundingClientRect()}},{key:"getScrollSlider",value:function(){if(this.scroller)return this.scroller.getScrollSlider()}},{key:"scrollToBeginning",value:function(scrollOptions){if(this.scroller)return(scrollOptions=scrollOptions||{}).position=0,this.scroller.scrollToPosition(scrollOptions)}},{key:"toStart",value:function(elem,scrollOptions){this.scroller&&this.scroller.toStart(elem,scrollOptions)}},{key:"toCenter",value:function(elem,scrollOptions){this.scroller&&this.scroller.toCenter(elem,scrollOptions)}},{key:"scrollToElement",value:function(elem,scrollOptions){this.scroller&&this.scroller.scrollToElement(elem,scrollOptions)}},{key:"scrollToPosition",value:function(pos){if(this.scroller)return this.scroller.scrollToPosition(pos)}},{key:"addScrollEventListener",value:function(fn,options){this.scroller&&this.scroller.addScrollEventListener(fn,options)}},{key:"removeScrollEventListener",value:function(fn,options){this.scroller&&this.scroller.removeScrollEventListener(fn,options)}},{key:"scrollBackwards",value:function(){this.scroller&&this.scroller.scrollBackwards()}},{key:"scrollForwards",value:function(){this.scroller&&this.scroller.scrollForwards()}},{key:"scrollBy",value:function(delta,scrollOptions){this.scroller&&this.scroller.scrollBy(delta,scrollOptions)}},{key:"addResizeObserver",value:function(fn){this.scroller&&this.scroller.addResizeObserver(fn)}},{key:"removeResizeObserver",value:function(fn){this.scroller&&this.scroller.removeResizeObserver(fn)}},{key:"getScrollMultiplier",value:function(){if(this.scroller)return this.scroller.getScrollMultiplier()}},{key:"getScrollLeftMultiplier",value:function(){if(this.scroller)return this.scroller.getScrollLeftMultiplier()}},{key:"getScrollTopMultiplier",value:function(){if(this.scroller)return this.scroller.getScrollTopMultiplier()}},{key:"getPadding",value:function(){if(this.scroller)return this.scroller.getPadding()}},{key:"getElementPosition",value:function(element,horizontal,scrollOptions){if(this.scroller)return this.scroller.getElementPosition(element,horizontal,scrollOptions)}},{key:"notifyResized",value:function(){if(this.scroller)return this.scroller.notifyResized()}},{key:"setHeaderBindingEnabled",value:function(enabled){this.headroom&&!this.paused&&(enabled?(this.headroom.beginResume({}),this.headroom.resume({})):(this.headroom.pause(),this.headroom.clearTransform()))}},{key:"setFocusScroll",value:function(focusScroll){this.scroller&&(null==focusScroll&&(focusScroll="adaptive"),this.scroller.options)&&(this.scroller.options.focusScroll=focusScroll)}},{key:"setFocusScrollOffsetLeft",value:function(val){this.scroller&&this.scroller.options&&(this.scroller.options.focusScrollOffsetLeft=val)}}])}(babelHelpers.wrapNativeSuper(HTMLDivElement));EmbyScroller.upgradeElement=function(elem){Object.assign(elem,EmbyScroller.prototype);for(var names=Object.getOwnPropertyNames(EmbyScroller.prototype),i=0,length=names.length;i