import{u as x,bX as t,bW as f,bx as b,bG as g,bH as A,r as o,x as c,j as a,L,aJ as h}from"./index-DNBEEyYo.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-Boe5ApZi.js";const v=()=>{const{name:r}=x(),l=t(y),p=t(S),d=t(j),s=f(),e=b(),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(L,{}):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};
