import{K as e,Nt as t,Ut as n,Zt as r,nn as i}from"./branding-B7dW-jsD.js";import{k as a,n as o,r as s}from"./index-B6j-NK0t.js";import{t as c}from"./HeaderApp-Aqs89_qS.js";import{t as l}from"./use-document-meta-Ds8yu_o4.js";import{t as u}from"./api-toast-D3el9g6G.js";import{t as d}from"./textarea-DKN6SDmt.js";import{t as f}from"./actions-BmIoCnCe.js";var p=i(r(),1),m=t();function h(){let t=n(),[r,i]=(0,p.useState)(``),[h,g]=(0,p.useState)(``),[_,v]=(0,p.useState)(!1);l({title:`New Secret`,description:`Create a new encrypted secret.`});function y(){v(!0),u(f({key:r.trim(),value:h.trim()}),{loading:`Creating secret...`,success:`Secret created`,error:`Failed to create secret`}).then(()=>t(`/secrets`)).catch(()=>{}).finally(()=>v(!1))}let b=r.trim().length>0&&h.trim().length>0&&!_;return(0,m.jsx)(c,{title:`New Secret`,description:`Create a new encrypted secret.`,children:(0,m.jsx)(o,{className:`max-w-lg shadow-none`,children:(0,m.jsx)(s,{className:`p-6`,children:(0,m.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),b&&y()},className:`space-y-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`secret-key`,className:`text-sm font-medium`,children:`Key`}),(0,m.jsx)(a,{id:`secret-key`,placeholder:`e.g., STRIPE_SECRET_KEY`,value:r,onChange:e=>i(e.target.value),className:`mt-1 font-mono`,"aria-describedby":`key-hint`,autoComplete:`off`,autoCapitalize:`characters`,spellCheck:!1}),(0,m.jsx)(`p`,{id:`key-hint`,className:`text-xs text-muted-foreground mt-1`,children:`Use uppercase letters, digits, and underscores (e.g. MY_SECRET)`})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`secret-value`,className:`text-sm font-medium`,children:`Value`}),(0,m.jsx)(d,{id:`secret-value`,placeholder:`Enter the secret value (API key, token, etc.)`,value:h,onChange:e=>g(e.target.value),className:`mt-1 min-h-[6rem]`,autoComplete:`off`,spellCheck:!1}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Store tokens, API keys, passwords, or any sensitive data`})]}),(0,m.jsxs)(`div`,{className:`flex gap-3 pt-2`,children:[(0,m.jsx)(e,{type:`button`,variant:`outline`,onClick:()=>t(`/secrets`),children:`Cancel`}),(0,m.jsx)(e,{type:`submit`,disabled:!b,children:_?`Creating...`:`Create Secret`})]})]})})})})}export{h as Component};