import{isEmpty,isEquivalent,sleep}from"../../base/helpers.mjs";import{ElementBuilder}from"../../base/builder.mjs";import{View}from"../../view/base.mjs";import{MenuController}from"../menu.mjs";import{StableVideoDiffusionFormView}from"../../forms/enfugue/animation.mjs";const E=new ElementBuilder({});class StableVideoController extends MenuController{static stableVideoWindowWidth=400;static stableVideoWindowHeight=1030;static menuName="Stable Video (SVD)";static menuIcon="fa-solid fa-video";static menuShortcut="v";async onClick(){this.showStableVideo()}async showStableVideo(){if(!isEmpty(this.stableVideoWindow))return void this.stableVideoWindow.focus();let e=new StableVideoDiffusionFormView(this.config);e.onSubmit((async i=>{e.clearError();try{let t=await this.model.post("/invoke/svd",null,null,i);if(isEmpty(t.uuid))throw"Response did not contain a result.";this.engine.enableStop(),this.engine.startSample=!0,this.engine.canvasInvocation(t.uuid,!0),this.notify("info","Success","Invocation queued, it will begin shortly."),e.enable()}catch(i){e.setError(i),e.enable()}})),this.stableVideoWindow=await this.spawnWindow("Stable Video Diffusion",e,this.constructor.stableVideoWindowWidth,this.constructor.stableVideoWindowHeight),this.stableVideoWindow.onClose((()=>{this.stableVideoWindow=null}))}}export{StableVideoController as MenuController};
