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