module.exports=[12788,a=>{"use strict";var b=a.i(87924),c=a.i(72131);function d(){let[a,d]=(0,c.useState)(""),[e,f]=(0,c.useState)(null),[g,h]=(0,c.useState)(!1),[i,j]=(0,c.useState)("free"),[k,l]=(0,c.useState)(!1),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(null);async function q(){if(a){l(!0),p(null);try{let b=await fetch("/api/settings",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({claudeApiKey:a})}),c=await b.json();b.ok?p({type:"success",text:"API key is valid!"}):p({type:"error",text:c.error})}catch{p({type:"error",text:"Test failed"})}l(!1)}}async function r(){if(a){n(!0),p(null);try{let b=await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({claudeApiKey:a})});if(b.ok)p({type:"success",text:"API key saved!"}),h(!0),f("sk-ant-•••••"+a.slice(-4)),d("");else{let a=await b.json();p({type:"error",text:a.error})}}catch{p({type:"error",text:"Save failed"})}n(!1)}}return(0,c.useEffect)(()=>{fetch("/api/settings").then(a=>a.json()).then(a=>{h(a.hasKey),f(a.maskedKey),j(a.plan)}).catch(console.error)},[]),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-sm font-semibold text-[var(--color-text-secondary)]",children:"Settings"}),(0,b.jsx)("h1",{className:"font-display text-3xl font-bold",children:"Workspace settings"}),(0,b.jsx)("p",{className:"text-[var(--color-text-secondary)]",children:"Manage your Claude API key and workspace configuration."})]}),(0,b.jsxs)("div",{className:"rounded-2xl border border-[var(--color-border-light)] bg-white p-6 shadow-sm",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"font-semibold",children:"Claude API Key (BYOK)"}),(0,b.jsx)("p",{className:"text-sm text-[var(--color-text-secondary)]",children:"Keys are encrypted server-side. Never exposed to the client."})]}),(0,b.jsxs)("span",{className:"rounded-full bg-[var(--color-bg-soft)] px-3 py-1 text-xs font-semibold text-[var(--color-bg-brand)]",children:[i," plan"]})]}),g&&(0,b.jsxs)("div",{className:"mt-4 rounded-xl bg-[var(--color-bg-soft)] px-4 py-3 text-sm",children:["Current key: ",(0,b.jsx)("code",{className:"font-mono",children:e})]}),o&&(0,b.jsx)("div",{className:`mt-4 rounded-xl px-4 py-3 text-sm ${"success"===o.type?"bg-green-50 text-green-700":"bg-red-50 text-red-600"}`,children:o.text}),(0,b.jsxs)("div",{className:"mt-4 flex flex-col gap-3 md:flex-row md:items-center",children:[(0,b.jsx)("input",{type:"password",value:a,onChange:a=>d(a.target.value),placeholder:g?"Enter new key to replace...":"sk-ant-...",className:"input flex-1"}),(0,b.jsx)("button",{onClick:q,disabled:!a||k,className:"inline-flex items-center justify-center rounded-xl bg-[var(--color-bg-brand)] px-4 py-2 text-sm font-semibold text-white transition hover:bg-[var(--color-bg-brand-light)] disabled:opacity-50",children:k?"Testing...":"Test connection"}),(0,b.jsx)("button",{onClick:r,disabled:!a||m,className:"inline-flex items-center justify-center rounded-xl border border-[var(--color-border-subtle)] px-4 py-2 text-sm font-semibold transition hover:bg-[var(--color-bg-soft)] disabled:opacity-50",children:m?"Saving...":"Save key"})]})]})]})}a.s(["default",()=>d])}];

//# sourceMappingURL=src_app_%28app%29_dashboard_settings_page_tsx_a5efbeb6._.js.map