import{u as b,bK as t,bI as f,bp as x,bx as g,r as o,s as c,j as a,L as A,b4 as y,by as L}from"./index-C1DmWO_C.js";import{d as h,e as S,b as j,a as E}from"./scope.selectors-C6FB6Cbj.js";import{A as K}from"./ApiForm-BwB4nygF.js";const N=()=>{const{name:r}=b(),p=t(h),l=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 p||d||!n?a.jsx(A,{}):a.jsxs(a.Fragment,{children:[a.jsx(y,{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:l,onSubmit:m})]})};export{N as default};
