import{isEmpty}from"../../base/helpers.mjs";import{ImageEditorNodeOptionsFormView}from"../../forms/enfugue/image-editor.mjs";import{NodeView}from"../base.mjs";class ImageEditorNodeView extends NodeView{static canMerge=!1;static nodeTypeName="Base";static canFlipHeader=!0;static minHeight=32;static minWidth=32;static snapSize=8;static padding=8;static edgeHandlerTolerance=8;static hideHeader=!0;static closeText="Remove";static nodeButtons={options:{icon:"fa-solid fa-sliders",tooltip:"Show/Hide Options",shortcut:"o",callback:function(){this.toggleOptions()}}};static optionsFormView=ImageEditorNodeOptionsFormView;async updateOptions(t){this.prompt=t.prompt,this.negativePrompt=t.negativePrompt,this.guidanceScale=t.guidanceScale,this.inferenceSteps=t.inferenceSteps,this.scaleToModelSize=t.scaleToModelSize,this.removeBackground=t.removeBackground}async toggleOptions(){if(isEmpty(this.optionsForm)){this.optionsForm=new this.constructor.optionsFormView(this.config),this.optionsForm.onSubmit((t=>this.updateOptions(t)));let t=await this.optionsForm.getNode();this.optionsForm.setValues(this.getState(),!1),this.node.find("enfugue-node-contents").append(t)}else this.optionsForm.hidden?this.optionsForm.show():this.optionsForm.hide()}async setState(t){await super.setState(t),this.updateOptions(t),isEmpty(this.optionsForm)||this.optionsForm.setValues(t)}getState(t=!0){let e=super.getState();return e.prompt=this.prompt||null,e.negativePrompt=this.negativePrompt||null,e.guidanceScale=this.guidanceScale||null,e.inferenceSteps=this.inferenceSteps||null,e.removeBackground=this.removeBackground||!1,e.scaleToModelSize=this.scaleToModelSize||!1,e}}export{ImageEditorNodeView};
