import{isEmpty}from"../../base/helpers.mjs";import{FormView}from"../../view/forms/base.mjs";import{NumberInputView,FloatInputView}from"../../view/forms/input.mjs";import{Controller}from"../base.mjs";class GenerationForm extends FormView{static autoSubmit=!0;static collapseFieldSets=!0;static fieldSets={Generation:{samples:{label:"Samples",class:NumberInputView,config:{min:1,max:8,value:1,step:1,tooltip:"The number of concurrent samples to generate. Each sample linearly increases the amount of VRAM required, but only logarithmically increases the inference time."}},seed:{label:"Seed",class:NumberInputView,config:{tooltip:"The initialization value for the random number generator. Set this to a number to produce consistent results with every invocation."}}}}}class GenerationController extends Controller{getState(){return{generation:this.generationForm.values}}getDefaultState(){return{generation:{samples:1,seed:null}}}setState(e){isEmpty(e.generation)||this.generationForm.setValues(e.generation).then((()=>this.generationForm.submit()))}async initialize(){this.generationForm=new GenerationForm(this.config),this.generationForm.onSubmit((async e=>{this.engine.samples=e.samples,this.engine.seed=e.seed})),this.application.sidebar.addChild(this.generationForm)}}export{GenerationController as SidebarController};
