import { x as head, c as escape_html, e as ensure_array_like } from './dev-BNpEUZI3.js';
import 'node:module';
import { C as Card } from './Tabs-DzG6Bn9a.js';
import { B as Button, a as Select, I as Input } from './ui-DR8zOSpC.js';

//#region src/routes/keys/+page.svelte
function _page($$renderer, $$props) {
	$$renderer.component(($$renderer) => {
		let formOpen = false;
		let formProvider = "anthropic";
		let formLabel = "";
		let formApiKey = "";
		let formSubmitting = false;
		let toastMessages = [];
		const PROVIDER_OPTIONS = [
			{
				value: "anthropic",
				label: "Anthropic"
			},
			{
				value: "openai",
				label: "OpenAI"
			},
			{
				value: "gemini",
				label: "Gemini"
			},
			{
				value: "moonshot",
				label: "Moonshot"
			},
			{
				value: "openrouter",
				label: "OpenRouter"
			},
			{
				value: "bedrock",
				label: "AWS Bedrock"
			},
			{
				value: "deepseek",
				label: "DeepSeek"
			},
			{
				value: "xai",
				label: "xAI"
			},
			{
				value: "groq",
				label: "Groq"
			},
			{
				value: "kimi-code",
				label: "Kimi Code"
			},
			{
				value: "ollama",
				label: "Ollama"
			}
		];
		let $$settled = true;
		let $$inner_renderer;
		function $$render_inner($$renderer) {
			head("1vi3pl9", $$renderer, ($$renderer) => {
				$$renderer.title(($$renderer) => {
					$$renderer.push(`<title>Credentials — CLEO Studio</title>`);
				});
			});
			$$renderer.push(`<section class="keys-page svelte-1vi3pl9"><header class="page-header svelte-1vi3pl9"><div><h1 class="svelte-1vi3pl9">Credential pool</h1> <p class="muted svelte-1vi3pl9">Manage the unified LLM credential pool. Secrets are write-only — values are never returned
        to the browser.</p></div> `);
			Button($$renderer, {
				variant: "primary",
				onclick: () => formOpen = !formOpen,
				children: ($$renderer) => {
					$$renderer.push(`<!---->${escape_html(formOpen ? "Cancel" : "Add credential")}`);
				}});
			$$renderer.push(`<!----></header> `);
			if (formOpen) {
				$$renderer.push("<!--[0-->");
				Card($$renderer, {
					padding: "cozy",
					children: ($$renderer) => {
						$$renderer.push(`<form class="add-form svelte-1vi3pl9">`);
						Select($$renderer, {
							label: "Provider",
							name: "provider",
							options: PROVIDER_OPTIONS,
							get value() {
								return formProvider;
							},
							set value($$value) {
								formProvider = $$value;
								$$settled = false;
							}
						});
						$$renderer.push(`<!----> `);
						Input($$renderer, {
							label: "Label",
							name: "label",
							placeholder: "e.g. work-pri or personal-1",
							required: true,
							get value() {
								return formLabel;
							},
							set value($$value) {
								formLabel = $$value;
								$$settled = false;
							}
						});
						$$renderer.push(`<!----> `);
						Input($$renderer, {
							label: "API key",
							name: "apiKey",
							type: "password",
							placeholder: "paste the raw key — never displayed again",
							required: true,
							description: "Stored at 0600 in ~/.cleo/llm-credentials.json; the API will never echo it back.",
							get value() {
								return formApiKey;
							},
							set value($$value) {
								formApiKey = $$value;
								$$settled = false;
							}
						});
						$$renderer.push(`<!----> `);
						$$renderer.push("<!--[-1-->");
						$$renderer.push(`<!--]--> <div class="form-actions svelte-1vi3pl9">`);
						Button($$renderer, {
							type: "submit",
							loading: formSubmitting,
							disabled: formSubmitting,
							children: ($$renderer) => {
								$$renderer.push(`<!---->Save credential`);
							}});
						$$renderer.push(`<!----></div></form>`);
					}});
			} else $$renderer.push("<!--[-1-->");
			$$renderer.push(`<!--]--> `);
			if (toastMessages.length > 0) {
				$$renderer.push("<!--[0-->");
				$$renderer.push(`<ul class="toasts svelte-1vi3pl9" aria-live="polite"><!--[-->`);
				const each_array = ensure_array_like(toastMessages);
				for (let idx = 0, $$length = each_array.length; idx < $$length; idx++) {
					let msg = each_array[idx];
					$$renderer.push(`<li class="svelte-1vi3pl9"><span>${escape_html(msg)}</span> <button type="button" class="toast-close svelte-1vi3pl9">×</button></li>`);
				}
				$$renderer.push(`<!--]--></ul>`);
			} else $$renderer.push("<!--[-1-->");
			$$renderer.push(`<!--]--> `);
			{
				$$renderer.push("<!--[0-->");
				$$renderer.push(`<p class="muted svelte-1vi3pl9">Loading credentials…</p>`);
			}
			$$renderer.push(`<!--]--></section>`);
		}
		do {
			$$settled = true;
			$$inner_renderer = $$renderer.copy();
			$$render_inner($$inner_renderer);
		} while (!$$settled);
		$$renderer.subsume($$inner_renderer);
	});
}

export { _page as default };
//# sourceMappingURL=_page.svelte-C3aIui4o.js.map
