define(["appHeader","homescreenSettings","connectionManager","userSettingsBuilder","userSettings","layoutManager","dom","globalize","loading","listViewStyle","emby-scroller","emby-select"],function(appHeader,HomeScreenSettings,connectionManager,userSettingsBuilder,currentUserSettings,layoutManager,dom,globalize,loading){"use strict";return function(view,params){var settingsInstance,apiClient=connectionManager.getApiClient(params.serverId),userId=params.userId||apiClient.getCurrentUserId(),userSettings=userId===apiClient.getCurrentUserId()?currentUserSettings:new userSettingsBuilder;view.addEventListener("viewshow",function(e){e.detail.isRestored;settingsInstance?settingsInstance.loadData():settingsInstance=new HomeScreenSettings({serverId:apiClient.serverId(),userId:userId,element:view.querySelector(".settingsContainer"),userSettings:userSettings,enableSaveButton:!1,enableSaveConfirmation:!1,autoFocus:!0})}),view.addEventListener("viewbeforehide",function(){settingsInstance&&settingsInstance.submit()}),view.addEventListener("viewdestroy",function(){settingsInstance&&(settingsInstance.destroy(),settingsInstance=null)})}});