define(["../list/list","appRouter","itemHelper","scripts/taskbutton","dom","globalize","mainTabsManager","require","emby-linkbutton","emby-itemscontainer","cardStyle"],function(ListPage,appRouter,itemHelper,taskButton,dom,globalize,mainTabsManager,require){"use strict";function addVirtualFolder(e){var view=this.closest(".view");require(["medialibrarycreator"],function(medialibrarycreator){(new medialibrarycreator).show({collectionTypeOptions:function(){var options=[{name:"",value:""},{value:"movies",message:getLink("MovieLibraryHelp","https://github.com/MediaBrowser/Wiki/wiki/Movie%20naming")},{value:"music"},{value:"tvshows",message:getLink("TvLibraryHelp","https://github.com/MediaBrowser/Wiki/wiki/TV%20naming")}];options.push({value:"audiobooks"}),options.push({value:"books",message:getLink("BookLibraryHelp","https://github.com/MediaBrowser/Wiki/wiki/Book%20naming")}),options.push({value:"games",message:globalize.translate("MessageGamePluginRequired")}),options.push({value:"musicvideos"}),options.push({value:"homevideos"}),options.push({name:globalize.translate("MixedContent"),value:"mixed",message:globalize.translate("MessageUnsetContentHelp")});for(var i=1,length=options.length;i<length;i++)options[i].name||(options[i].name=itemHelper.getContentTypeName(options[i].value));return options}().filter(function(f){return!f.hidden}),refresh:"true"===view.getAttribute("data-refreshlibrary")}).then(function(hasChanges){hasChanges&&view.querySelector(".itemsContainer").notifyRefreshNeeded(!0)})})}function getLink(text,url){return globalize.translate(text,'<a is="emby-linkbutton" class="button-link" href="'+url+'" target="_blank" data-autohide="true">',"</a>")}function getTabs(){return[{href:"librarysetup/library.html",name:globalize.translate("HeaderLibraries")},{href:"librarysetup/advanced.html",name:globalize.translate("TabAdvanced")}]}function onViewShow(e){this.classList.contains("withTabs")&&mainTabsManager.setTabs(this,0,getTabs),this.querySelector(".btnRefresh")&&taskButton({mode:"on",progressElem:this.querySelector(".refreshProgress"),taskKey:"RefreshLibrary",button:this.querySelector(".btnRefresh")})}function onWizardNextClick(){appRouter.show("wizard/wizardsettings.html")}function LibrarySetupPage(view,params){params.serverId=ApiClient.serverId(),this.supportsPlayback=!1,this.supportsViewSettings=!1;var addScanButton=this.enableAlphaNumericShortcuts=!1;-1===window.location.href.toString().toLowerCase().indexOf("wizard")&&(view.classList.add("withTabs"),view.setAttribute("data-refreshlibrary","true"),addScanButton=!0),ListPage.call(this,view,params),this.itemsContainer.refreshOnItemUpdated=!0,view.addEventListener("viewshow",onViewShow);var btnWizardNext=view.querySelector(".btnWizardNext");btnWizardNext&&btnWizardNext.addEventListener("click",onWizardNextClick),function(view,addScanButton){var sibling=view.querySelector(".listTotalRecordCount"),html='<button is="emby-button" type="button" class="raised raised-mini btnNewLibrary submit" style="margin-left:.5em;" title="'+globalize.translate("HeaderNewLibrary")+'" aria-label="'+globalize.translate("HeaderNewLibrary")+'"><i class="md-icon button-icon button-icon-left">&#xE145;</i><span>'+globalize.translate("HeaderNewLibrary")+"</span></button>";addScanButton&&(html+='<button is="emby-button" type="button" class="raised raised-mini btnRefresh submit" style="margin-left:.5em;" title="'+globalize.translate("HeaderScanLibraryFiles")+'" aria-label="'+globalize.translate("HeaderScanLibraryFiles")+'"><i class="md-icon button-icon button-icon-left">refresh</i><span>'+globalize.translate("HeaderScanLibraryFiles")+"</span></button>",html+='<progress max="100" min="0" class="refreshProgress hide" style="margin-left:1em;"></progress>');sibling.insertAdjacentHTML("afterend",html)}(view,addScanButton),view.querySelector(".btnNewLibrary").addEventListener("click",addVirtualFolder)}return Object.assign(LibrarySetupPage.prototype,ListPage.prototype),LibrarySetupPage.prototype.getItems=function(query){return ApiClient.getVirtualFolders(query)},LibrarySetupPage.prototype.getSettingsKey=function(){return"libraries"},LibrarySetupPage.prototype.getEmptyListMessage=function(){return Promise.resolve("")},LibrarySetupPage.prototype.getItemCountText=function(numItems){return 1===numItems?globalize.translate("OneLibrary"):globalize.translate("LibraryCountValue",numItems)},LibrarySetupPage.prototype.setTitle=function(){},LibrarySetupPage.prototype.getCardOptions=function(items,settings){var options=ListPage.prototype.getCardOptions.apply(this,arguments);return options=Object.assign(options,{shape:"backdrop",fields:["Name","CollectionType","LibraryFolders"],centerText:!0,overlayText:!1,multiSelect:!1,action:"edit",cardLayout:!0,hoverPlayButton:!1,defaultBackground:!0,showParentTitle:!1,draggable:!1})},LibrarySetupPage.prototype.getSortMenuOptions=function(){return[]},LibrarySetupPage.prototype.getVisibleFilters=function(){return[]},LibrarySetupPage});