define(["layoutManager","appFooter-shared","viewManager","apphost","connectionManager","events","globalize","browser","require","dom","appRouter","emby-tabs"],function(layoutManager,appFooter,viewManager,appHost,connectionManager,events,globalize,browser,require,dom,appRouter){"use strict";function setMode(mode){if(mode!==currentMode){var tabs=instance;if(tabs){currentMode=mode;var elem=tabs.element;mode===serverMode?(setServerTabs(),elem.classList.add("dockedtabs-servertabs")):mode===libraryMode?(setLibraryTabs(),elem.classList.remove("dockedtabs-servertabs")):mode!==hiddenMode&&elem.classList.remove("dockedtabs-servertabs"),mode===hiddenMode?tabs.hide():tabs.show()}}}function setLibraryTabs(){setTabs([{name:globalize.translate("sharedcomponents#Home"),icon:"&#xE88A;",href:"home.html"},{name:globalize.translate("sharedcomponents#LiveTV"),icon:"&#xE7FB;",href:"userprofiles.html"},{name:globalize.translate("sharedcomponents#Downloads"),active:!0,icon:"&#xE871;",href:"dashboard.html"},{name:globalize.translate("sharedcomponents#Library"),icon:"&#xE2C7;",href:"library.html"},{name:globalize.translate("sharedcomponents#More"),icon:"&#xE5D2;",href:"servermenu/servermenu.html"}])}function setServerTabs(){setTabs([{name:globalize.translate("sharedcomponents#Home"),icon:"&#xE88A;",href:"home.html"},{name:globalize.translate("sharedcomponents#Dashboard"),active:!0,icon:"&#xE871;",href:"dashboard.html"},{name:globalize.translate("sharedcomponents#Users"),icon:"&#xE7FB;",href:"userprofiles.html"},{name:globalize.translate("sharedcomponents#Library"),icon:"&#xE2C7;",href:"library.html"},{name:globalize.translate("sharedcomponents#More"),icon:"&#xE5D2;",href:"servermenu/servermenu.html"}])}function setTabs(tabs){var html='<div is="emby-tabs" class="dockedtabs-tabs" data-selectionbar="false">';html+=tabs.map(function(tab,index){var active=tab.active?" emby-tab-button-active":"";return'<a is="emby-linkbutton" href="'+tab.href+'" class="dockedtabs-tab-button emby-tab-button'+active+'" data-index="'+index+'">                <div class="dockedtabs-tab-button-foreground emby-button-foreground"><i class="dockedtabs-tab-button-icon md-icon">'+tab.icon+"</i><div>"+tab.name+"</div></div></a>"}).join(""),html+="</div>",instance.element.innerHTML=html}function onViewShow(e){var view=e.target;setMode(layoutManager.mobile?view.classList.contains("type-interior")?serverMode:(view.classList.contains("standalonePage"),hiddenMode):hiddenMode)}function render(options){var elem=document.createElement("div");elem.classList.add("hide"),elem.classList.add("dockedtabs"),elem.classList.add("dockedtabs-bottom");return elem.innerHTML="",appFooter.add(elem),elem}function DockedTabs(options){var self=this;instance=self,self.element=render(options),events.on(connectionManager,"localusersignedin",function(e){onViewShow({target:viewManager.currentView()})}),events.on(connectionManager,"localusersignedout",function(){self.hide()}),document.addEventListener("viewshow",onViewShow)}require(["css!./dockedtabs"]);var instance,hiddenMode=0,serverMode=1,libraryMode=2,currentMode=hiddenMode;return DockedTabs.prototype.destroy=function(){document.removeEventListener("viewshow",onViewShow);var self=this;self.element;self.element=null},DockedTabs.prototype.show=function(){this.element.classList.remove("hide")},DockedTabs.prototype.hide=function(){this.element.classList.add("hide")},new DockedTabs({}),DockedTabs});