import{aR as b,r as c,f as i,c as h,V as P,b7 as f,Z as _,g as C,e as y,bg as I,b0 as L,b2 as u,aX as M,j as e,a_ as S,K as j,aT as d,ci as k,a,O as g,aY as v}from"./index-d6499a22.js";import{s as K,a as N,b as D}from"./scope.selectors-1aab3a9c.js";import{c as E}from"./utils-2832fe88.js";import"./useCurrentProject-b23444be.js";import"./useProject-0d0fdeb3.js";import"./FileUploaderButton-c4f1b533.js";import"./useDownload-7167ff3b.js";import"./props-01648cd9.js";import"./zipObj-e651182a.js";const R={td:{whiteSpace:"nowrap",textAlign:"left",pr:0},"td:nth-of-type(1)":{pl:"20px"},"td:nth-of-type(6)":{pr:"20px",svg:{fontSize:"14px"}},">table>tbody>tr:first-of-type":{mb:"0px"}},V=(t,n)=>{const s=b(),o=c.useMemo(()=>t.map(({scope:r})=>[i,n.length===r.length?h:i,i,h,h,P]),[t,n]),p=c.useMemo(()=>t.map(({name:r,scope:l,prefix:x,created:m,modified:w})=>[{children:r},{...l.length===n.length?{children:"full scope",gray:!0}:{children:E(l.map(A=>A.toLowerCase()).join(", "),65)}},{children:x},{gray:!0,children:f(new Date(m),"yyyy-MM-dd")},{gray:!0,children:f(new Date(w),"yyyy-MM-dd")},{intent:"ghost",icon:_.edit,tooltip:"Edit",onClick:()=>s(C(y.account.api.edit,"",{name:r}))}]),[t,s,n]);return c.useMemo(()=>[o,p],[o,p])},T=c.memo(I),q=()=>{const t=L(),n=u(K),s=u(N).sort((x,m)=>x.name.localeCompare(m.name));M(v.api);const o=b(),p=u(D),[r,l]=V(s,n);return c.useEffect(()=>{t.api.fetch(),t.scope.fetch()},[t]),p?e.jsx(S,{}):s.length?e.jsxs(e.Fragment,{children:[e.jsxs(j,{width:"1000px",title:"API keys",contentProps:{pb:0,overflow:"auto"},actions:e.jsx(d,{href:"https://docs.hopsworks.ai/".concat(k.docsVersion,"/user_guides/projects/api_key/create_api_key/"),external:!0,target:"_blank",p:0,intent:"inline",children:"documentation↗"}),children:[e.jsxs(a,{mb:"25x",children:[e.jsxs(a,{width:"100%",children:[e.jsx(i,{primary:!0,children:s.length}),e.jsx(i,{ml:"5px",children:s.length>1?" API keys":" API key"})]}),e.jsx(d,{minWidth:"105px",onClick:()=>o(y.account.api.create),children:"New API key"})]}),e.jsx(g,{mt:"20px",mx:"-20px",sx:R,children:e.jsx(T,{legend:["name","scope","API key prefix","creation","modification"],middleColumn:1,groupComponents:r,groupProps:l})})]}),e.jsx(g,{sx:{height:"20px",width:"100%",backgroundColor:"grayShade3",opacity:0},children:"invisible block margin"})]}):e.jsxs(j,{title:"API keys",actions:e.jsx(d,{href:"https://docs.hopsworks.ai/".concat(k.docsVersion,"/user_guides/projects/api_key/create_api_key/"),target:"_blank",external:!0,p:0,intent:"inline",children:"documentation↗"}),children:[e.jsxs(a,{mb:"25x",children:[e.jsxs(a,{width:"100%",children:[e.jsx(i,{primary:!0,children:"0"}),e.jsx(i,{ml:"5px",children:"API keys"})]}),e.jsx(d,{minWidth:"105px",onClick:()=>o(y.account.api.create),children:"New API key"})]}),e.jsx(g,{mt:"20px",mx:"-20px",children:e.jsx(a,{height:"50px",mt:"30px",justifyContent:"center",children:e.jsx(h,{fontSize:"18px",gray:!0,children:"No API keys defined"})})})]})};export{q as default};
