define(["subtitleSettings","userSettingsBuilder"],function(SubtitleSettings,userSettingsBuilder){"use strict";return function(view,params){var subtitleSettingsInstance,userId=params.userId||ApiClient.getCurrentUserId(),userSettings=new userSettingsBuilder;view.addEventListener("viewshow",function(){subtitleSettingsInstance||(subtitleSettingsInstance=new SubtitleSettings({serverId:ApiClient.serverId(),userId:userId,element:view.querySelector(".settingsContainer"),userSettings:userSettings,enableSaveButton:!AppInfo.enableAutoSave,enableSaveConfirmation:!AppInfo.enableAutoSave})),subtitleSettingsInstance.loadData()}),view.addEventListener("viewbeforehide",function(){AppInfo.enableAutoSave&&subtitleSettingsInstance&&subtitleSettingsInstance.submit()}),view.addEventListener("viewdestroy",function(){subtitleSettingsInstance&&(subtitleSettingsInstance.destroy(),subtitleSettingsInstance=null)})}});