import{r as n,b2 as i,b0 as m,fH as j,aR as S,j as e,a_ as A,a as k,f as l,O as c,fI as L,cO as K,a3 as b,a4 as I,aT as v,e as w}from"./index-d6499a22.js";import{s as C,c as E,d as D}from"./scope.selectors-1aab3a9c.js";import{r as F}from"./randomString-cc3f6d7b.js";const G=()=>{const[s,o]=n.useState(),t=i(C),u=i(E),f=i(D),a=m(),[x,y]=n.useState(!0);return n.useEffect(()=>{a.scope.fetch()},[a.scope]),n.useEffect(()=>{async function h(){var p,d;const g={name:`default_apiKey_${F().substring(5)}`,scope:t},r=await a.api.create({data:g});(p=r.data)!=null&&p.key&&o((d=r.data)==null?void 0:d.key)}t&&t.length>0&&h()},[a.api,t]),j(u||f,100,y),{apiKey:s,isLoading:x}},N=()=>{const{apiKey:s,isLoading:o}=G(),t=S();return o?e.jsx(A,{}):e.jsxs(k,{flexDirection:"column",width:"830px",mt:"140px",children:[e.jsx(l,{fontSize:"18px",fontFamily:"Inter",fontWeight:"bold",textAlign:"center",children:"Save your Api key"}),e.jsx(c,{mt:"40px",sx:{div:{borderStyle:"none"}},children:e.jsxs(L,{children:[s&&e.jsx(l,{fontSize:"12px",fontFamily:"Inter",fontWeight:"500",mb:"20px",children:"Copy this API key and paste it directly in your code to connect to Hopsworks"}),e.jsx(c,{children:s?e.jsx(K,{height:"auto",copyButton:!0,title:"API key",language:"shell",content:s}):e.jsx(c,{children:e.jsx(b,{width:"100%",type:I.error,content:"Failed to generate Api key",cta:e.jsx(v,{onClick:()=>{t(w.account.api.list)},intent:"inline",children:"Go to Api keys"})})})})]})})]})};export{N as default};
