1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[38244],{41765:function(e,t,r){r(44962),r(78557),r(90076),r(83994),r(82367);var n=r(4113),s=r(36300),a=r(46782),i=r(38490),o=r(9164),l=r(34789),c=(r(69177),Object.create(HTMLDivElement.prototype));function u(e){var t=e.detail.command;"end"===t?(o.A.focusLast(this,"."+this.getAttribute("data-navcommands")),e.preventDefault(),e.stopPropagation()):"pageup"===t?(o.A.moveFocus(e.target,this,"."+this.getAttribute("data-navcommands"),-12),e.preventDefault(),e.stopPropagation()):"pagedown"===t&&(o.A.moveFocus(e.target,this,"."+this.getAttribute("data-navcommands"),12),e.preventDefault(),e.stopPropagation())}c.createdCallback=function(){this.classList.add("emby-scroller")},c.scrollToBeginning=function(){this.scroller&&this.scroller.slideTo(0,!0)},c.toStart=function(e,t){this.scroller&&this.scroller.toStart(e,t)},c.toCenter=function(e,t){this.scroller&&this.scroller.toCenter(e,t)},c.scrollToPosition=function(e,t){this.scroller&&this.scroller.slideTo(e,t)},c.getScrollPosition=function(){if(this.scroller)return this.scroller.getScrollPosition()},c.getScrollSize=function(){if(this.scroller)return this.scroller.getScrollSize()},c.getScrollEventName=function(){if(this.scroller)return this.scroller.getScrollEventName()},c.getScrollSlider=function(){if(this.scroller)return this.scroller.getScrollSlider()},c.addScrollEventListener=function(e,t){this.scroller&&s.Ay.addEventListener(this.scroller.getScrollFrame(),this.scroller.getScrollEventName(),e,t)},c.removeScrollEventListener=function(e,t){this.scroller&&s.Ay.removeEventListener(this.scroller.getScrollFrame(),this.scroller.getScrollEventName(),e,t)},c.attachedCallback=function(){this.getAttribute("data-navcommands")&&i.default.on(this,u);var e="false"!==this.getAttribute("data-horizontal"),t=this.querySelector(".scrollSlider");e&&(t.style["white-space"]="nowrap");var c,d,h=a.A.desktop&&e&&"false"!==this.getAttribute("data-scrollbuttons"),f={horizontal:e,mouseDragging:1,mouseWheel:"false"!==this.getAttribute("data-mousewheel"),touchDragging:1,slidee:t,scrollBy:200,speed:e?270:240,elasticBounds:1,dragHandle:1,autoImmediate:!0,skipSlideToWhenVisible:"true"===this.getAttribute("data-skipfocuswhenvisible"),dispatchScrollEvent:h||"true"===this.getAttribute("data-scrollevent"),hideScrollbar:h||"true"===this.getAttribute("data-hidescrollbar"),allowNativeSmoothScroll:"true"===this.getAttribute("data-allownativesmoothscroll")&&!h,allowNativeScroll:!h,forceHideScrollbars:h,requireAnimation:h&&l.A.edge};this.scroller=new n.A(this,f),this.scroller.init(),this.scroller.reload(),a.A.tv&&this.getAttribute("data-centerfocus")&&(c=this.scroller,s.Ay.addEventListener(this,"focus",(function(e){var t=o.A.focusableParent(e.target);t&&c.toCenter(t)}),{capture:!0,passive:!0})),h&&(d=this,r.e(49275).then(r.bind(r,49275)).then((function(){d.insertAdjacentHTML("beforebegin",'<div is="emby-scrollbuttons" class="emby-scrollbuttons padded-right"></div>')})))},c.pause=function(){var e=this.headroom;e&&e.pause()},c.resume=function(){var e=this.headroom;e&&e.resume()},c.detachedCallback=function(){this.getAttribute("data-navcommands")&&i.default.off(this,u);var e=this.headroom;e&&(e.destroy(),this.headroom=null);var t=this.scroller;t&&(t.destroy(),this.scroller=null)},document.registerElement("emby-scroller",{prototype:c,extends:"div"})},52824:function(e,t,r){r.r(t);var n=r(62540),s=r(63696),a=r(9055),i=r(5898),o=r(89166),l=r(46782),c=r(65242),u=r(71286),d=r(44797),h=(r(79845),r(10353),r(41765),function(e,t,r,n){return new(r||(r=Promise))((function(s,a){function i(e){try{l(n.next(e))}catch(e){a(e)}}function o(e){try{l(n.throw(e))}catch(e){a(e)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,o)}l((n=n.apply(e,t||[])).next())}))}),f=function(e,t){var r,n,s,a={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(l){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(a=0)),a;)try{if(r=1,n&&(s=2&o[0]?n.return:o[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,o[1])).done)return s;switch(n=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((s=(s=a.trys).length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){a.label=o[1];break}if(6===o[0]&&a.label<s[1]){a.label=s[1],s=o;break}if(s&&a.label<s[2]){a.label=s[2],a.ops.push(o);break}s[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,l])}}};t.default=function(){var e,t=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,s,a=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(n=a.next()).done;)i.push(n.value)}catch(e){s={error:e}}finally{try{n&&!n.done&&(r=a.return)&&r.call(a)}finally{if(s)throw s.error}}return i}((0,a.ok)(),1)[0],v=parseInt(null!==(e=t.get("tab"))&&void 0!==e?e:"0",10),b=(0,s.useMemo)((function(){return h(void 0,void 0,void 0,(function(){return f(this,(function(e){switch(e.label){case 0:return[4,Promise.all([r.e(45642),r.e(45568),r.e(73233),r.e(68603)]).then(r.bind(r,73233))];case 1:return[2,e.sent().default]}}))}))}),[]),m=(0,s.useMemo)((function(){return r.e(25091).then(r.bind(r,25091))}),[]),g=(0,s.useRef)(),p=(0,s.useMemo)((function(){return[]}),[]),y=(0,s.useRef)(document),A=(0,s.useRef)(null),S=function(){return[{name:i.Ay.translate("Home")},{name:i.Ay.translate("Favorites")}]},E=function(){var e;return null===(e=A.current)||void 0===e?void 0:e.querySelectorAll(".tabContent")},x=(0,s.useCallback)((function(e){if(null==e)throw new Error("index cannot be null");var t="";switch(e){case 0:t="hometab";break;case 1:t="favorites"}return r(7062)("./".concat(t)).then((function(t){var r,n=t.default,s=p[e];return s||(s=new n(null===(r=A.current)||void 0===r?void 0:r.querySelector(".tabContent[data-index='"+e+"']"),null),p[e]=s),s}))}),[p]),w=(0,s.useCallback)((function(e,t){x(e).then((function(e){var r=!e.refreshed;e.onResume({autoFocus:null==t&&l.A.tv,refresh:r}),e.refreshed=!0,g.current=e})).catch((function(e){console.error("[Home] failed to get tab controller",e)}))}),[x]),k=(0,s.useCallback)((function(e){var t=parseInt(e.detail.selectedTabIndex,10),r=e.detail.previousIndex,n=null==r?null:p[r];(null==n?void 0:n.onPause)&&n.onPause(),w(t,r)}),[w,p]),C=(0,s.useCallback)((function(){return h(void 0,void 0,void 0,(function(){return f(this,(function(e){switch(e.label){case 0:return[4,m];case 1:return e.sent().setTabs(A.current,v,S,E,null,k,!1),[2]}}))}))}),[v,m,k]),L=(0,s.useCallback)((function(){return h(void 0,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:return h(void 0,void 0,void 0,(function(){return f(this,(function(e){switch(e.label){case 0:return[4,b];case 1:return e.sent().setTitle(null),[2]}}))})),(0,o.gJ)(),(e=g.current)?[3,2]:[4,m];case 1:return t.sent().selectedTabIndex(v),[3,3];case 2:(null==e?void 0:e.onResume)&&e.onResume({}),t.label=3;case 3:return y.current.querySelector(".skinHeader").classList.add("noHomeButtonHeader"),[2]}}))}))}),[v,m]),T=(0,s.useCallback)((function(){var e=g.current;(null==e?void 0:e.onPause)&&e.onPause(),y.current.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")}),[]),I=(0,s.useCallback)((function(){C(),L()}),[L,C]);return(0,s.useEffect)((function(){var e;return(null===(e=y.current)||void 0===e?void 0:e.querySelector(".headerTabs"))&&I(),function(){T()}}),[T,I]),(0,s.useEffect)((function(){var e=y.current;return e&&d.A.on(e,u.B.HEADER_RENDERED,I),function(){e&&d.A.off(e,u.B.HEADER_RENDERED,I)}}),[I]),(0,n.jsx)("div",{ref:A,children:(0,n.jsxs)(c.A,{id:"indexPage",className:"mainAnimatedPage homePage libraryPage allLibraryPage backdropPage pageWithAbsoluteTabs withTabs",isBackButtonEnabled:!1,backDropType:"movie,series,book",children:[(0,n.jsx)("div",{className:"tabContent pageTabContent",id:"homeTab","data-index":"0",children:(0,n.jsx)("div",{className:"sections"})}),(0,n.jsx)("div",{className:"tabContent pageTabContent",id:"favoritesTab","data-index":"1",children:(0,n.jsx)("div",{className:"sections"})})]})})}},79845:function(e,t,r){r(96054),r(69177);var n=r(36300),s=r(4113),a=r(34789),i=r(9164),o=r(46782),l=Object.create(HTMLDivElement.prototype),c="emby-tab-button",u=c+"-active";function d(e){e.classList.add(u)}function h(e,t,r){var n;e.dispatchEvent(new CustomEvent("beforetabchange",{detail:{selectedTabIndex:t,previousIndex:r}})),null!=r&&r!==t&&(n=null)&&n.classList.remove("is-active")}function f(e){var t=this,r=t.querySelector("."+u),s=n.Ay.parentWithClass(e.target,c);if(s&&s!==r){r&&r.classList.remove(u);var a=r?parseInt(r.getAttribute("data-index"),10):null;d(s);var i=parseInt(s.getAttribute("data-index"),10);h(t,i,a),setTimeout((function(){t.selectedTabIndex=i,t.dispatchEvent(new CustomEvent("tabchange",{detail:{selectedTabIndex:i,previousIndex:a}}))}),120),t.scroller&&t.scroller.toCenter(s,!1)}}function v(e){var t=n.Ay.parentWithClass(e.target,c);t&&this.scroller&&this.scroller.toCenter(t,!1)}function b(e){var t=e.target.parentNode.querySelector(".lastFocused");t&&t.classList.remove("lastFocused"),e.target.classList.add("lastFocused")}function m(e){return e.querySelector("."+u)}function g(e,t){for(var r=e[t];r;){if(r.classList.contains(c)&&!r.classList.contains("hide"))return r;r=r[t]}return null}l.createdCallback=function(){this.classList.contains("emby-tabs")||(this.classList.add("emby-tabs"),this.classList.add("focusable"),n.Ay.addEventListener(this,"click",f,{passive:!0}),o.A.tv&&n.Ay.addEventListener(this,"focusin",v,{passive:!0}),n.Ay.addEventListener(this,"focusout",b))},l.focus=function(){var e=this.querySelector("."+u),t=this.querySelector(".lastFocused");t?i.A.focus(t):e?i.A.focus(e):i.A.autoFocus(this)},l.refresh=function(){this.scroller&&this.scroller.reload()},l.attachedCallback=function(){!function(e){if(!e.scroller){var t=e.querySelector(".emby-tabs-slider");t?(e.scroller=new s.A(e,{horizontal:1,itemNav:0,mouseDragging:1,touchDragging:1,slidee:t,smart:!0,releaseSwing:!0,scrollBy:200,speed:120,elasticBounds:1,dragHandle:1,dynamicHandle:1,clickBar:1,hiddenScroll:!0,requireAnimation:!a.A.safari,allowNativeSmoothScroll:!0}),e.scroller.init()):(e.classList.add("scrollX"),e.classList.add("hiddenScrollX"),e.classList.add("smoothScrollX"))}}(this);var e=this.querySelector("."+u),t=e?parseInt(e.getAttribute("data-index"),10):parseInt(this.getAttribute("data-index")||"0",10);if(-1!==t){this.selectedTabIndex=t;var r=this.querySelectorAll("."+c)[t];r&&d(r)}this.readyFired||(this.readyFired=!0,this.dispatchEvent(new CustomEvent("ready",{})))},l.detachedCallback=function(){this.scroller&&(this.scroller.destroy(),this.scroller=null),n.Ay.removeEventListener(this,"click",f,{passive:!0}),o.A.tv&&n.Ay.removeEventListener(this,"focusin",v,{passive:!0})},l.selectedIndex=function(e,t){var r=this;if(null==e)return r.selectedTabIndex||0;var n=r.selectedIndex();r.selectedTabIndex=e;var s=r.querySelectorAll("."+c);if(n===e||!1===t){h(r,e,n),r.dispatchEvent(new CustomEvent("tabchange",{detail:{selectedTabIndex:e}}));var a=s[n];d(s[e]),n!==e&&a&&a.classList.remove(u)}else f.call(r,{target:s[e]})},l.selectNext=function(){var e=g(m(this),"nextSibling");e&&f.call(this,{target:e})},l.selectPrevious=function(){var e=g(m(this),"previousSibling");e&&f.call(this,{target:e})},l.triggerBeforeTabChange=function(){h(this,this.selectedIndex())},l.triggerTabChange=function(){this.dispatchEvent(new CustomEvent("tabchange",{detail:{selectedTabIndex:this.selectedIndex()}}))},l.setTabEnabled=function(e,t){var r=this.querySelector('.emby-tab-button[data-index="'+e+'"]');t?r.classList.remove("hide"):r.classList.remove("add")},document.registerElement("emby-tabs",{prototype:l,extends:"div"})}}]); |