import{u as b,bJ as t,bI as f,bo as x,bx as g,by as A,r as o,q as c,j as a,D as y,b1 as h}from"./index-Cc-6WbPt.js";import{d as L,e as S,b as j,a as E}from"./scope.selectors-C6FB6Cbj.js";import{A as k}from"./ApiForm-MidHsa9h.js";const N=()=>{const{name:r}=b(),l=t(L),p=t(S),d=t(j),s=f(),e=x(),u=t(E);g(A.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(y,{}):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{N as default};
