import{r as s,j as t}from"./vendor-react-wBh_31cN.js";import{u as p,j as A}from"./vendor-redux-CJZrIb6x.js";import{B as S}from"./back-button-zYdlGpWP.js";import{c as j,d as y}from"./scope.selectors-C6FB6Cbj.js";import{aq as g,r as m}from"./index-BKr2rJhV.js";import{u as h}from"./useTitle-DQo_L6Ox.js";import{t as k}from"./titles-CzjGGAB3.js";import{A as L}from"./ApiForm-BH7Yr1dz.js";import{A as b}from"./ApiKeyPopup-DBt32lUN.js";import{a as C,u as P}from"./vendor-router-D1GqFWiT.js";import"./vendor-icons-BUUmD6ht.js";import"./vendor-utils-OeoE2qq_.js";import"./vendor-radix-BRyWS4bQ.js";import"./vendor-grid-CeFlDWv4.js";import"./callout-Dd8FkTQe.js";import"./checkbox-group-pCQMTuNu.js";import"./checkbox-DbZXziG0.js";import"./label-Dnebucx5.js";import"./confirmation-dialog-DFt7ZgUQ.js";import"./input-H6_qmzms.js";import"./useCopyToClipboard-3DFwhniW.js";import"./useNotifier-BCEAoFCf.js";import"./notifications-x-pTFTQl.js";import"./toast-3g7Fh-a0.js";import"./date-picker-DuYl6sUN.js";import"./popover-DNRIgB96.js";import"./editable-select-Co_-YcCr.js";import"./index.esm-CAGtek53.js";import"./yup-XkUC3UEH.js";import"./card-DISTA6Ay.js";import"./card-link-CAhlzNs_.js";import"./getHopsDoc-BWSxyuXn.js";import"./addDays-DjM7nKyN.js";import"./code-BepIAQDJ.js";const pt=()=>{const c=p(j),n=p(y),{state:i={}}=C(),[u,l]=s.useState(""),[f,e]=s.useState(!1),o=A(),a=P();h(k.createAPI),s.useEffect(()=>(o.scope.fetch(),()=>{o.api.clear()}),[o]);const d=s.useCallback(async x=>{const{data:r}=await o.api.create({data:x});r!=null&&r.key&&(l(r.key),e(!0))},[o]);return n?t.jsx(g,{}):t.jsxs(t.Fragment,{children:[t.jsx(b,{isOpen:f,onClose:()=>e(!1),onSave:()=>a((i==null?void 0:i.redirectUrl)??m.account.api.list),createdKey:u}),t.jsx(S,{className:"mb-3 self-start",onClick:()=>a(m.account.api.list),children:"All API keys"}),t.jsx(L,{isLoading:c,onSubmit:d})]})};export{pt as default};
