()
| 754 | } |
| 755 | |
| 756 | function saveInputState() { |
| 757 | const state = { |
| 758 | methodText: $("methodText")?.value ?? "", |
| 759 | provider: normalizeProviderValue(providerInput?.value ?? "gemini"), |
| 760 | imageProvider: normalizeImageProviderValue(imageProviderInput?.value ?? "same"), |
| 761 | imageModel: imageModelInput?.value ?? "", |
| 762 | svgModel: svgModelInput?.value ?? "", |
| 763 | apiKey: $("apiKey")?.value ?? "", |
| 764 | baseUrl: baseUrlInput?.value ?? DEFAULT_CUSTOM_BASE_URL, |
| 765 | imageApiKey: imageApiKeyInput?.value ?? "", |
| 766 | imageBaseUrl: imageBaseUrlInput?.value ?? DEFAULT_CUSTOM_BASE_URL, |
| 767 | optimizeIterations: $("optimizeIterations")?.value ?? "0", |
| 768 | imageSize: imageSizeInput?.value ?? "4K", |
| 769 | upscaleEnabled: upscaleEnabled?.checked ?? true, |
| 770 | samBackend: samBackend?.value ?? "roboflow", |
| 771 | samPrompt: samPrompt?.value ?? "icon,person,robot,animal", |
| 772 | samApiKey: samApiKeyInput?.value ?? "", |
| 773 | referencePath: uploadedReferencePath, |
| 774 | referenceUrl: referencePreview?.src ?? "", |
| 775 | referenceStatus: referenceStatus?.textContent ?? "", |
| 776 | }; |
| 777 | try { |
| 778 | window.sessionStorage.setItem(INPUT_STATE_KEY, JSON.stringify(state)); |
| 779 | } catch (_err) { |
| 780 | // Ignore storage failures (e.g. private mode / quota) |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | function applyInputState() { |
| 785 | const state = loadInputState(); |
no test coverage detected