import{u as f,b2 as t,b0 as x,aR as g,aX as A,r as o,e as c,j as s,a_ as b,aT as h,aY as y}from"./index-d6499a22.js";import{d as L,e as S,b as j,a as E}from"./scope.selectors-1aab3a9c.js";import{A as k}from"./ApiForm-f528afc5.js";const v=()=>{const{name:r}=f(),l=t(L),p=t(S),d=t(j),a=x(),e=g(),u=t(E);A(y.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(b,{}):s.jsxs(s.Fragment,{children:[s.jsx(h,{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};
