define(["exports","./../../modules/viewmanager/baseview.js","./../../modules/loading/loading.js","./../../modules/common/globalize.js","./../../modules/emby-elements/emby-input/emby-input.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/emby-elements/emby-button/paper-icon-button-light.js","./../../modules/maintabsmanager.js","./../../modules/formhelper.js"],function(_exports,_baseview,_loading,_globalize,_embyInput,_embyButton,_embyCheckbox,_embySelect,_embyScroller,_paperIconButtonLight,_maintabsmanager,_formhelper){function onSubmit(e){_loading.default.show();var form=this;return ApiClient.getNamedConfiguration("sync").then(function(config){config.TemporaryPath=form.querySelector(".txtSyncTempPath").value,config.TranscodingCpuCoreLimit=parseInt(form.querySelector(".selectThreadCount").value),config.EnableFullSpeedTranscoding=form.querySelector(".chkEnableFullSpeedConversion").checked,ApiClient.updateNamedConfiguration("sync",config).then(_formhelper.default.handleConfigurationSavedResponse)}),e.preventDefault(),e.stopPropagation(),!1}function getConvertTabs(){return[{href:"conversions?mode=convert",name:_globalize.default.translate("Conversions")},{href:"serverdownloadsettings?mode=convert",name:_globalize.default.translate("Settings")}]}function getDownloadTabs(){return[{href:"serverdownloads",name:_globalize.default.translate("Downloads")},{href:"serverdownloadsettings",name:_globalize.default.translate("Settings")}]}function View(view,params){_baseview.default.apply(this,arguments),view.querySelector(".btnSelectSyncTempPath").addEventListener("click",function(){require(["directorybrowser"],function(directoryBrowser){var picker=new directoryBrowser;picker.show({callback:function(path){path&&(view.querySelector(".txtSyncTempPath").value=path),picker.close()},validateWriteable:!0})})}),view.querySelector("form").addEventListener("submit",onSubmit)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(View.prototype,_baseview.default.prototype),View.prototype.onResume=function(options){_baseview.default.prototype.onResume.apply(this,arguments),_loading.default.show(),_maintabsmanager.default.setTabs(this.view,1,"convert"===this.params.mode?getConvertTabs:getDownloadTabs);var page=this.view;ApiClient.getNamedConfiguration("sync").then(function(config){!function(page,config){page.querySelector(".txtSyncTempPath").value=config.TemporaryPath||"",page.querySelector(".selectThreadCount").value=config.TranscodingCpuCoreLimit,page.querySelector(".chkEnableFullSpeedConversion").checked=config.EnableFullSpeedTranscoding,_loading.default.hide()}(page,config)})},_exports.default=View});