import{u as b,bh as t,bf as f,b4 as x,bb as g,r as o,q as c,j as a,L as A,b6 as h,bc as L}from"./index-CK33qGU_.js";import{d as y,e as S,b as j,a as E}from"./scope.selectors-C6FB6Cbj.js";import{A as k}from"./ApiForm-BibKU_LP.js";const v=()=>{const{name:r}=b(),l=t(y),p=t(S),d=t(j),s=f(),e=x(),u=t(E);g(L.editAPI);const n=u.find(({name:i})=>i===r);o.useEffect(()=>(s.api.fetch(),s.scope.fetch(),()=>{s.api.clear()}),[s]);const m=o.useCallback(async i=>{await s.api.edit({data:i}),e(c.account.api.list)},[s,e]);return l||d||!n?a.jsx(A,{}):a.jsxs(a.Fragment,{children:[a.jsx(h,{mb:"15px",ml:"-12px",intent:"inline",alignSelf:"flex-start",onClick:()=>e(c.account.api.list),children:"⇽ all API keys"}),a.jsx(k,{isEdit:!0,initialData:n,isLoading:p,onSubmit:m})]})};export{v as default};
