define(["./homescreensettings","connectionManager","userSettingsBuilder","userSettings","listViewStyle","emby-scroller","emby-select"],function(HomeScreenSettings,connectionManager,userSettingsBuilder,currentUserSettings){"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)})}});