import{isEmpty,deepClone}from"../../base/helpers.mjs";import{FormView}from"../base.mjs";import{CheckboxInputView,NumberInputView,OutputScaleInputView,UpscaleAmountInputView,UpscaleMethodsInputView,UpscaleDiffusionIterativeControlnetInputView,UpscaleDiffusionPromptInputView,UpscaleDiffusionNegativePromptInputView,UpscaleDiffusionStepsInputView,UpscaleDiffusionStrengthInputView,UpscaleDiffusionPipelineInputView,UpscaleDiffusionGuidanceScaleInputView}from"../input.mjs";class UpscaleFormView extends FormView{static autoSubmit=!0;static collapseFieldSets=!0;static fieldSets={Upscaling:{outscale:{label:"Output Scale",class:OutputScaleInputView}},"Upscale Methods":{upscale:{label:"Upscale Methods",class:UpscaleMethodsInputView},upscaleIterative:{label:"Use Iterative Upscaling",class:CheckboxInputView,config:{tooltip:"Instead of directly upscaling to the target amount, double in size repeatedly until the image reaches the target size. For example, when this is checked and the upscale amount is 4×, there will be two upscale steps, 8× will be three, and 16× will be four."}},upscaleDiffusion:{label:"Diffuse Upscaled Samples",class:CheckboxInputView,config:{tooltip:"After upscaling the image use the the algorithm chosen above, use the image as input to another invocation of Stable Diffusion."}}},"Upscale Diffusion":{upscalePipeline:{label:"Pipeline",class:UpscaleDiffusionPipelineInputView},upscaleDiffusionControlnet:{label:"ControlNet",class:UpscaleDiffusionIterativeControlnetInputView},upscaleDiffusionPrompt:{label:"Detail Prompt",class:UpscaleDiffusionPromptInputView},upscaleDiffusionNegativePrompt:{label:"Detail Negative Prompt",class:UpscaleDiffusionNegativePromptInputView},upscaleDiffusionSteps:{label:"Inference Steps",class:UpscaleDiffusionStepsInputView},upscaleDiffusionStrength:{label:"Denoising Strength",class:UpscaleDiffusionStrengthInputView},upscaleDiffusionGuidanceScale:{label:"Guidance Scale",class:UpscaleDiffusionGuidanceScaleInputView},upscaleDiffusionChunkingSize:{label:"Chunk Size",class:NumberInputView,config:{minimum:32,maximum:512,step:8,value:128,tooltip:"The number of pixels to move the frame by during diffusion. Smaller values produce better results, but take longer."}},upscaleDiffusionChunkingBlur:{label:"Chunk Blur",class:NumberInputView,config:{minimum:32,maximum:512,step:8,value:128,tooltip:"The number of pixels to feather the edges of the frame by during diffusion. Smaller values result in more pronounced lines, and large values result in a smoother overall image."}},upscaleDiffusionScaleChunkingSize:{label:"Scale Chunk Size with Iteration",class:CheckboxInputView,config:{value:!0,tooltip:"Scale the chunking size ×2 with each iteration of upscaling, with a maximum size of ½ the size of the model."}},upscaleDiffusionScaleChunkingBlur:{label:"Scale Chunk Blur with Iteration",class:CheckboxInputView,config:{value:!0,tooltip:"Scale the chunking blur ×2 with each iteration of upscaling, with a maximum size of ½ the size of the model."}}}};static fieldSetConditions={"Upscale Methods":e=>parseInt(e.outscale)>1,"Upscale Diffusion":e=>parseInt(e.outscale)>1&&e.upscaleDiffusion}}class QuickUpscaleFormView extends FormView{static showCancel=!0;static fieldSets={"Upscale Amount":{outscale:{class:UpscaleAmountInputView}},"Upscale Methods":UpscaleFormView.fieldSets["Upscale Methods"],"Upscale Diffusion":UpscaleFormView.fieldSets["Upscale Diffusion"]};static collapseFieldSets=["Upscale Methods","Upscale Diffusion"];static fieldSetConditions={"Upscale Diffusion":e=>e.upscaleDiffusion}}class QuickDownscaleFormView extends FormView{static showCancel=!0;static fieldSets={"Downscale Amount":{downscale:{class:UpscaleAmountInputView,config:{tooltip:"Select the amount of downscaling to apply. Downscaling is performed via repeated bi-linear sampling."}}}}}export{UpscaleFormView,QuickUpscaleFormView,QuickDownscaleFormView};
