define(["exports","./../modules/viewmanager/basesettingsview.js","./../modules/common/globalize.js","./../modules/emby-elements/emby-input/emby-input.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-select/emby-select.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/emby-elements/emby-slider/emby-slider.js","./../modules/emby-elements/emby-toggle/emby-toggle.js","./../modules/emby-elements/emby-premierecontainer/emby-premierecontainer.js","./../modules/skinmanager.js","./../modules/common/servicelocator.js","./../modules/emby-apiclient/events.js"],function(_exports,_basesettingsview,_globalize,_embyInput,_embyButton,_embySelect,_embyScroller,_embySlider,_embyToggle,_embyPremierecontainer,_skinmanager,_servicelocator,_events){function fillThemes(select,isSettings){for(var mainThemeValue,themes=_skinmanager.default.getThemes(),defaultFound=!1,i=0,length=themes.length;i<length;i++){var theme=themes[i],value=theme.id;(theme.isDefault&&!isSettings||theme.isSettingsDefault&&isSettings)&&(defaultFound=!(value="")),theme.value=value}isSettings&&(mainThemeValue=isSettings&&!defaultFound?"":"maintheme",(themes=themes.filter(function(e){return!e.skipForSettingsthemes})).unshift({name:_globalize.default.translate("SameAsMainTheme"),id:"maintheme",value:mainThemeValue,isSettingsDefault:_servicelocator.appHost.supports("multiserver")})),select.innerHTML=themes.map(function(t){return'<option value="'+t.value+'">'+t.name+"</option>"}).join("")}function showHideThemeSettingsButton(btnThemeSettings){var controller=_skinmanager.default.getCurrentThemeController();null!=controller&&controller.hasSettings&&controller.hasSettings()?btnThemeSettings.classList.remove("hide"):btnThemeSettings.classList.add("hide")}function showThemeSettings(){var controller=_skinmanager.default.getCurrentThemeController();null!=controller&&controller.hasSettings&&controller.hasSettings()&&controller.showSettings()}function View(view,params){_basesettingsview.default.apply(this,arguments),view.querySelector("form").addEventListener("submit",function(e){return e.preventDefault(),!1}.bind(this));for(var elem,key,featurePremiereInfo=view.querySelectorAll(".featurePremiereInfo"),i=0,length=featurePremiereInfo.length;i<length;i++)elem=featurePremiereInfo[i],key="FeatureRequiresEmbyPremiere",_servicelocator.appHost.supports("externallinks")&&_servicelocator.appHost.supports("externalpremium")?elem.innerHTML=_globalize.default.translate(key,'<a is="emby-linkbutton" href="https://emby.media/premiere" data-preset="premiereinfo" target="_blank" class="button-link">',"</a>"):elem.innerHTML=_globalize.default.translate(key,"","");var selectTheme=view.querySelector(".selectTheme"),selectSettingsTheme=view.querySelector(".selectSettingsTheme"),btnThemeSettings=view.querySelector(".btnThemeSettings");btnThemeSettings.addEventListener("click",showThemeSettings),fillThemes(selectTheme),fillThemes(selectSettingsTheme,!0),showHideThemeSettingsButton(btnThemeSettings),this.boundonThemeLoaded=function(){showHideThemeSettingsButton(this.view.querySelector(".btnThemeSettings"))}.bind(this),_events.default.on(_skinmanager.default,"themeloaded",this.boundonThemeLoaded)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(View.prototype,_basesettingsview.default.prototype),View.prototype.loadSettingsInternal=function(){return this.loadAutoSettings()},View.prototype.getUserConfigurationUserId=function(){return this.params.userId||this.getApiClient().getCurrentUserId()},View.prototype.destroy=function(){_basesettingsview.default.prototype.destroy.apply(this,arguments),this.boundonThemeLoaded&&(_events.default.off(_skinmanager.default,"themeloaded",this.boundonThemeLoaded),this.boundonThemeLoaded=null)};_exports.default=View});