define(["loading","dom","appRouter","emby-button","emby-select","css!./wizard"],function(loading,dom,appRouter){"use strict";function onSubmit(e){return function(page){loading.show();var apiClient=ApiClient;apiClient.getJSON(apiClient.getUrl("Startup/Configuration")).then(function(config){config.UICulture=page.querySelector("#selectLocalizationLanguage").value,apiClient.ajax({type:"POST",data:config,url:apiClient.getUrl("Startup/Configuration")}).then(function(){appRouter.show("wizard/wizarduser.html")})})}(this.closest(".page")),e.preventDefault(),e.stopPropagation(),!1}return function(view){view.querySelector(".wizardStartForm").addEventListener("submit",onSubmit),view.addEventListener("viewshow",function(){loading.show();var page=this,apiClient=ApiClient,promise1=apiClient.getJSON(apiClient.getUrl("Startup/Configuration")),promise2=apiClient.getJSON(apiClient.getUrl("Localization/Options"));Promise.all([promise1,promise2]).then(function(responses){!function(page,config,languageOptions){var selectLocalizationLanguage=page.querySelector("#selectLocalizationLanguage");selectLocalizationLanguage.innerHTML=languageOptions.map(function(l){return'<option value="'+l.Value+'">'+l.Name+"</option>"}),selectLocalizationLanguage.value=config.UICulture,loading.hide()}(page,responses[0],responses[1])})})}});