import{isEmpty,humanSize}from"../../base/helpers.mjs";import{MenuController}from"../menu.mjs";import{DownloadModelsFormView}from"../../forms/enfugue/models.mjs";class DownloadModelsController extends MenuController{static modelDownloadWindowWidth=400;static modelDownloadWindowHeight=275;static menuName="Download Models";static menuIcon="fa-solid fa-cloud-arrow-down";static menuShortcut="d";async onClick(){this.showModelDownloader()}async showModelDownloader(){if(!isEmpty(this.modelDownloaderWindow))return void this.modelDownloadWindow.focus();let o=new DownloadModelsFormView(this.config);o.onSubmit((async l=>{o.clearError();try{await this.model.post("/download",null,null,l);this.notify("info","Download Queued","The download was successfully queued, it will begin shortly."),this.modelDownloadWindow.remove(),this.modelDownloadWindow=null}catch(l){o.setError(l),o.enable()}})),this.modelDownloadWindow=await this.spawnWindow("Download Model",o,this.constructor.modelDownloadWindowWidth,this.constructor.modelDownloadWindowHeight)}}export{DownloadModelsController as MenuController};
