import{ElementBuilder}from"../../base/builder.mjs";import{FormView}from"../base.mjs";import{PromptInputView,NumberInputView,CheckboxInputView,RepeatableInputView,TextInputView}from"../input.mjs";const E=new ElementBuilder;class SubmitPromptInputView extends PromptInputView{async keyPressed(e){await super.keyPressed(e),"Enter"===e.code&&e.ctrlKey&&this.form.shortcutSubmit()}}class PromptsFormView extends FormView{constructor(e,t){super(e,t),this.shortcutSubmitCallbacks=[]}static autoSubmit=!0;static fieldSets={Prompts:{usePromptTravel:{label:"Use Prompt Travel",class:CheckboxInputView,config:{tooltip:"When enabled, you can change prompts throughout an animation using a timeline interface. When disabled, the same problem will be used throughout the entire animation."}},prompt:{label:"Prompt",class:SubmitPromptInputView},negativePrompt:{label:"Negative Prompt",class:SubmitPromptInputView}}};onShortcutSubmit(e){this.shortcutSubmitCallbacks.push(e)}async shortcutSubmit(){await this.submit();for(let e of this.shortcutSubmitCallbacks)await e()}}class PromptTravelFormView extends FormView{static autoSubmit=!0;static fieldSets={Prompts:{positive:{label:"Prompt",class:SubmitPromptInputView},negative:{label:"Negative Prompt",class:SubmitPromptInputView}},Weight:{weight:{class:NumberInputView,config:{min:.01,value:1,step:.01,tooltip:"The weight of this prompt. It is recommended to keep your highest-weight prompt at 1.0 and scale others relative to that, but this is unconstrained."}}},"Frame Timing":{start:{class:NumberInputView,config:{min:1,value:1,step:1,tooltip:"The starting frame for this prompt."}},end:{class:NumberInputView,config:{min:1,value:16,step:1,tooltip:"The ending frame for this prompt."}}}}}class CaptionInputView extends RepeatableInputView{static memberClass=TextInputView;static minimumItems=1}class CaptionUpsampleFormView extends FormView{static description="Use this tool to transform a prompt into a more descriptive one using a large language model.<br /><br />At present, the only available model is <a href='https://huggingface.co/HuggingFaceH4/zephyr-7b-alpha' target='_blank'>HuggingFace's 7-billion parameter Zephyr model</a>, licensed under the <a href='https://choosealicense.com/licenses/mit/' target='_blank'>MIT License.</a> This requires approximately 10Gb of hard-drive space and 12Gb of VRAM. Other open-source models will be available in the future.<br /><br />This tool follows your safety checker settings. When safety checking is disabled, this model can produce problematic outputs when prompted to do so; user discretion is advised.";static fieldSets={Prompts:{prompts:{class:CaptionInputView}},"Captions Per Prompt":{num_results_per_prompt:{class:NumberInputView,config:{min:1,value:1,step:1}}}};async build(){let e=await super.build();return e.prepend(E.p().content(this.constructor.description)),e}}export{PromptsFormView,PromptTravelFormView,CaptionUpsampleFormView};
