define(["exports","./../modules/viewmanager/baseview.js","./../modules/loading/loading.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-checkbox/emby-checkbox.js","./../modules/emby-elements/emby-select/emby-select.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/approuter.js"],function(_exports,_baseview,_loading,_embyButton,_embyCheckbox,_embySelect,_embyScroller,_approuter){function save(page){_loading.default.show();var apiClient=ApiClient;apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function(config){config.PreferredMetadataLanguage=page.querySelector(".selectLanguage").value,config.MetadataCountryCode=page.querySelector(".selectCountry").value,apiClient.ajax({type:"POST",data:config,url:apiClient.getUrl("Startup/Configuration")}).then(function(){_loading.default.hide(),_approuter.default.show("wizard/wizardremoteaccess.html")})})}function reloadData(page,config,cultures,countries){!function(select,languages){var html="";html+="<option value=''></option>";for(var i=0,length=languages.length;i<length;i++){var culture=languages[i];html+="<option value='"+culture.TwoLetterISOLanguageName+"'>"+culture.DisplayName+"</option>"}select.innerHTML=html}(page.querySelector(".selectLanguage"),cultures);var cultures=page.querySelector(".selectCountry"),allCountries=countries,html="";html+="<option value=''></option>";for(var i=0,length=allCountries.length;i<length;i++){var culture=allCountries[i];html+="<option value='"+culture.TwoLetterISORegionName+"'>"+culture.DisplayName+"</option>"}cultures.innerHTML=html,page.querySelector(".selectLanguage").value=config.PreferredMetadataLanguage,page.querySelector(".selectCountry").value=config.MetadataCountryCode,_loading.default.hide()}function onSubmit(e){return save(this),e.preventDefault(),!1}function View(view,params){_baseview.default.apply(this,arguments),view.querySelector(".wizardSettingsForm").addEventListener("submit",onSubmit)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,require(["css!wizard/wizard.css"]),Object.assign(View.prototype,_baseview.default.prototype),View.prototype.onResume=function(options){var page,promise1,promise2,apiClient;_baseview.default.prototype.onResume.apply(this,arguments),page=this.view,_loading.default.show(),promise1=(apiClient=ApiClient).getJSON(apiClient.getUrl("Startup/Configuration")),promise2=apiClient.getCultures(),apiClient=apiClient.getCountries(),Promise.all([promise1,promise2,apiClient]).then(function(responses){reloadData(page,responses[0],responses[1],responses[2])})};_exports.default=View});