define(["exports","./../modules/viewmanager/basesettingsview.js","./../modules/common/globalize.js","./../modules/emby-elements/emby-scroller/emby-scroller.js","./../modules/emby-elements/emby-select/emby-select.js","./../modules/emby-elements/emby-button/emby-button.js","./../modules/emby-elements/emby-button/paper-icon-button-light.js","./../modules/emby-elements/emby-input/emby-input.js","./../modules/emby-elements/emby-checkbox/emby-checkbox.js","./../modules/emby-elements/emby-premierecontainer/emby-premierecontainer.js","./../modules/emby-apiclient/events.js","./../modules/emby-apiclient/connectionmanager.js","./../modules/common/servicelocator.js","./../modules/common/textencoding.js"],function(_exports,_basesettingsview,_globalize,_embyScroller,_embySelect,_embyButton,_paperIconButtonLight,_embyInput,_embyCheckbox,_embyPremierecontainer,_events,_connectionmanager,_servicelocator,_textencoding){function loadForm(page){return page.querySelector(".uploadServerList").innerHTML=_connectionmanager.default.getSavedServers().map(function(s){return'<label><input type="checkbox" is="emby-checkbox" class="chkUploadServer" data-id="'+s.Id+'"/><span>'+_textencoding.default.htmlEncode(s.Name)+"</span></label>"}).join(""),_servicelocator.cameraUpload.getAvailableFolders().then(function(allFolders){!function(page,folders){page.querySelector(".uploadFolderList").innerHTML=folders.map(function(s){return'<label><input type="checkbox" is="emby-checkbox" class="chkUploadFolder" data-id="'+s.Id+'"/><span>'+_textencoding.default.htmlEncode(s.Name)+"</span></label>"}).join("")}(page,allFolders)})}function View(view,params){_basesettingsview.default.apply(this,arguments),this.progressContainer=view.querySelector(".progressContainer"),this.itemProgressBarForeground=view.querySelector(".itemProgressBarForeground"),this.progressDescription=view.querySelector(".progressDescription"),view.querySelector(".premiereInfo").innerHTML=_globalize.default.translate("FeatureRequiresEmbyPremiere",'<a href="https://emby.media/premiere" data-preset="premiereinfo" is="emby-linkbutton" type="button" class="button-link">',"</a>"),view.querySelector(".uploadServerList").addEventListener("change",function(e){var page;return(page=view).querySelector(".chkUploadServer:checked")?page.querySelector(".fldUploadFolders").classList.remove("hide"):page.querySelector(".fldUploadFolders").classList.add("hide"),e.preventDefault(),!1}),view.querySelector("form").addEventListener("submit",function(e){return e.preventDefault(),!1}),this.boundOnUploadProgress=function(e,progressInfo){var numItems=progressInfo.numItems||0,numItemsComplete=progressInfo.numItemsComplete||0,progressInfo=progressInfo.totalPercentComplete||0;this.itemProgressBarForeground.style.width=progressInfo+"%",this.progressDescription.innerHTML=_globalize.default.translate("UploadingNumItems",numItemsComplete+1,numItems),numItems&&progressInfo<100?this.progressContainer.classList.remove("hide"):this.progressContainer.classList.add("hide")}.bind(this)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Object.assign(View.prototype,_basesettingsview.default.prototype),View.prototype.onResume=function(options){_basesettingsview.default.prototype.onResume.apply(this,arguments),_events.default.on(_servicelocator.cameraUpload,"progress",this.boundOnUploadProgress),_servicelocator.cameraUpload.setProgressUpdatesEnabled(!0),_servicelocator.cameraUpload.start()},View.prototype.loadSettingsInternal=function(){var instance=this;return loadForm(this.view).then(function(){instance.loadAutoSettings()})},View.prototype.onPause=function(){_basesettingsview.default.prototype.onPause.apply(this,arguments),this.boundOnUploadProgress&&_events.default.off(_servicelocator.cameraUpload,"progress",this.boundOnUploadProgress),_servicelocator.cameraUpload.setProgressUpdatesEnabled(!1),_servicelocator.cameraUpload.start()},View.prototype.destroy=function(){_basesettingsview.default.prototype.destroy.apply(this,arguments),this.boundOnUploadProgress&&(_events.default.off(_servicelocator.cameraUpload,"progress",this.boundOnUploadProgress),this.boundOnUploadProgress=null),this.progressContainer=null,this.itemProgressBarForeground=null,this.progressDescription=null};_exports.default=View});