"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[729,732],{27325:function(e,s,t){t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},88507:function(e,s,t){t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},81260:function(e,s,t){t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},65134:function(e,s,t){t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},47603:function(e,s,t){t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]])},28586:function(e,s,t){t.d(s,{Z:function(){return r}});/**
 * @license lucide-react v0.407.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */let r=(0,t(60998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},1812:function(e,s,t){t.d(s,{X:function(){return l}});var r=t(85893),n=t(67294);let a=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},l=e=>{let{error:s,title:t="Error",onDismiss:l}=e,[o,i]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{s&&i(!1)},[s]),!s||o)return null;let c="string"==typeof s?s:a(s);return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsxs)("div",{className:"text-sm text-red-800",children:[(0,r.jsxs)("strong",{children:[t,":"]})," ",c]})})]}),(0,r.jsx)("button",{onClick:()=>{i(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},35443:function(e,s,t){t.r(s),t.d(s,{Workspaces:function(){return R},getWorkspaceClusters:function(){return M},getWorkspaceManagedJobs:function(){return P}});var r=t(85893),n=t(67294),a=t(11163),l=t(17324),o=t(37673),i=t(68764),c=t(30803),d=t(55739),u=t(1272),m=t(91360);t(53850);var h=t(1812),x=t(13626),p=t(81260),g=t(65134),f=t(47603),j=t(470),w=t(23001),v=t(9243),y=t(6378),k=t(51214),b=t(36856),C=t(47145),N=t(94545),Z=t(93225),L=t(23266),E=t(68969),S=t(41664),z=t.n(S);async function M(e){try{return(await y.ZP.get(L.getClusters)||[]).filter(s=>s.workspace===e)}catch(t){let s="Error fetching clusters for workspace ".concat(e,": ").concat(t);throw console.error(s),Error(s)}}async function P(e){try{let s=await y.ZP.get(E.getManagedJobs,[{allUsers:!0,skipFinished:!0}]);return{jobs:((null==s?void 0:s.jobs)||[]).filter(s=>s.workspace===e)}}catch(t){let s="Error fetching managed jobs for workspace ".concat(e,": ").concat(t);throw console.error(s),Error(s)}}let D=e=>{let{isPrivate:s}=e;return s?(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300",children:"Private"}):(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-300",children:"Public"})};function R(){let[e,s]=(0,n.useState)([]),[t,S]=(0,n.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[M,P]=(0,n.useState)(!0),[R,J]=(0,n.useState)(!0),[W,F]=(0,n.useState)(null),[T,I]=(0,n.useState)(null),[O,A]=(0,n.useState)(!0),[V,q]=(0,n.useState)({key:"name",direction:"asc"}),[B,H]=(0,n.useState)(""),[K,_]=(0,n.useState)(!1),[U,X]=(0,n.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[$,G]=(0,n.useState)({open:!1,message:"",userName:""}),[Q,Y]=(0,n.useState)(null),[ee,es]=(0,n.useState)(!1),[et,er]=(0,n.useState)(null),[en,ea]=(0,n.useState)(null),el=(0,a.useRouter)(),eo=(0,w.X)(),ei=async()=>{if(Q&&Date.now()-Q.timestamp<3e5)return Q;es(!0);try{let e=await C.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),t={role:s.role,name:s.name,timestamp:Date.now()};return Y(t),es(!1),t}catch(e){throw es(!1),e}},ec=async(e,s)=>{try{let t=await ei();if("admin"!==t.role)return G({open:!0,message:e,userName:t.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),G({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},ed=(0,n.useCallback)(async(e,t)=>{try{let t=await y.ZP.get(L.getClusters),r={},n=0;e.forEach(e=>{r[e]={totalClusterCount:0,runningClusterCount:0}}),(t||[]).forEach(e=>{let s=e.workspace||"default";r[s]||(r[s]={totalClusterCount:0,runningClusterCount:0}),r[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(r[s].runningClusterCount++,n++)}),s(e=>e.map(e=>{var s,t;return{...e,totalClusterCount:(null===(s=r[e.name])||void 0===s?void 0:s.totalClusterCount)||0,runningClusterCount:(null===(t=r[e.name])||void 0===t?void 0:t.runningClusterCount)||0}})),S(e=>({...e,runningClusters:n,totalClusters:(t||[]).length}))}catch(e){console.error("Error fetching clusters:",e)}finally{P(!1)}},[]),eu=(0,n.useCallback)(async e=>{try{let t=await y.ZP.get(E.getManagedJobs,[{allUsers:!0,skipFinished:!0}]),r=(null==t?void 0:t.jobs)||[],n={},a=new Set(v.statusGroups.active),l=0;e.forEach(e=>{n[e]={managedJobsCount:0}}),r.forEach(e=>{let s=e.workspace||"default";n[s]||(n[s]={managedJobsCount:0}),a.has(e.status)&&(n[s].managedJobsCount++,l++)}),s(e=>e.map(e=>{var s;return{...e,managedJobsCount:(null===(s=n[e.name])||void 0===s?void 0:s.managedJobsCount)||0}})),S(e=>({...e,managedJobs:l}))}catch(e){console.error("Error fetching jobs:",e)}finally{J(!1)}},[]),em=(0,n.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0},{showLoadingIndicators:t=!0}=e;t&&(P(!0),J(!0));try{let e=await y.ZP.get(l.getWorkspaces);F(e);let r=Object.keys(e),n=r.map(async e=>{try{let s=await y.ZP.get(l.getEnabledClouds,[e]);return{wsName:e,enabledClouds:s}}catch(s){return console.error("Error fetching enabled clouds for ".concat(e,":"),s),{wsName:e,enabledClouds:[]}}}),a=await Promise.all(n),o={};a.forEach(e=>{let{wsName:s,enabledClouds:t}=e;o[s]=t});let i=r.map(e=>({name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:Array.isArray(o[e])?o[e]:[]})).sort((e,s)=>e.name.localeCompare(s.name));s(i),O&&t&&A(!1);let c=ed(r,o),d=eu(r);await Promise.all([c,d])}catch(e){console.error("Error fetching workspace data:",e),O&&(s([]),S({runningClusters:0,totalClusters:0,managedJobs:0})),t&&(P(!1),J(!1)),O&&t&&A(!1)}},[O,ed,eu]);(0,n.useEffect)(()=>{(async()=>{await b.ZP.preloadForPage("workspaces"),await em({showLoadingIndicators:!0}),I(new Date)})();let e=setInterval(()=>{"visible"===window.document.visibilityState&&em({showLoadingIndicators:!1})},k.nb.REFRESH_INTERVAL);return()=>clearInterval(e)},[em]);let eh=(0,n.useCallback)(async()=>{P(!0),J(!0),y.ZP.invalidate(l.getWorkspaces),y.ZP.invalidateFunction(l.getEnabledClouds),y.ZP.invalidate(L.getClusters),y.ZP.invalidateFunction(E.getManagedJobs);try{await C.x.fetch("/check",{},"POST"),await em({showLoadingIndicators:!1}),I(new Date)}catch(e){console.error("Error during sky check refresh:",e)}finally{P(!1),J(!1)}},[em]);(0,n.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"r"===e.key&&(e.preventDefault(),eh())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[eh]);let ex=e=>{let s="asc";V.key===e&&"asc"===V.direction&&(s="desc"),q({key:e,direction:s})},ep=e=>V.key===e?"asc"===V.direction?" ↑":" ↓":"",eg=n.useMemo(()=>{if(!e)return[];let s=e;if(B&&""!==B.trim()){let t=B.toLowerCase().trim();s=e.filter(e=>!!(e.name.toLowerCase().includes(t)||e.clouds.some(e=>{let s=Z.Z2[e.toLowerCase()]||e;return e.toLowerCase().includes(t)||s.toLowerCase().includes(t)}))||!!(!0===((null==W?void 0:W[e.name])||{}).private?"private":"public").includes(t))}return(0,N.R0)(s,V.key,V.direction)},[e,V,B,W]),ef=e=>{ec("cannot delete workspace",()=>{X({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},ej=async()=>{if(U.workspaceToDelete){X(e=>({...e,deleting:!0,error:null}));try{await (0,l.zl)(U.workspaceToDelete),ea('Workspace "'.concat(U.workspaceToDelete,'" deleted successfully!')),X({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),y.ZP.invalidate(l.getWorkspaces),y.ZP.invalidate(L.getClusters),y.ZP.invalidateFunction(E.getManagedJobs),await em({showLoadingIndicators:!0})}catch(e){console.error("Error deleting workspace:",e),X(e=>({...e,deleting:!1,error:null})),er(e)}}},ew=()=>{X({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})},ev=e=>{ec("cannot edit workspace",()=>{el.push("/workspaces/".concat(e))})};return O&&0===e.length?(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(d.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"fixed top-20 right-4 z-[9999] max-w-md",children:[en&&(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:en})})]}),(0,r.jsx)("div",{className:"ml-auto pl-3",children:(0,r.jsxs)("button",{type:"button",onClick:()=>ea(null),className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100",children:[(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,r.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})]})}),(0,r.jsx)(h.X,{error:et,title:"Error",onDismiss:()=>er(null)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2 h-5",children:[(0,r.jsx)("div",{className:"text-base flex items-center",children:(0,r.jsx)("span",{className:"text-sky-blue leading-none",children:"Workspaces"})}),(0,r.jsxs)("div",{className:"flex items-center",children:[(M||R)&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(d.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Loading..."})]}),!M&&!R&&T&&(0,r.jsx)(j.$3,{timestamp:T,className:"mr-2"}),(0,r.jsxs)("button",{onClick:eh,disabled:M||R,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(x.Z,{className:"h-4 w-4 mr-1.5"}),!eo&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,r.jsx)("input",{type:"text",placeholder:"Filter workspaces",value:B,onChange:e=>H(e.target.value),className:"h-8 w-full px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-1 focus:ring-sky-500 focus:border-sky-500 outline-none"}),B&&(0,r.jsx)("button",{onClick:()=>H(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear search",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("button",{onClick:()=>{ec("cannot create workspace",()=>{el.push("/workspace/new")})},disabled:ee,className:"ml-4 bg-sky-600 hover:bg-sky-700 text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200",title:"Create Workspace",children:ee?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{children:"Create Workspace"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.Z,{className:"h-4 w-4 mr-2"}),"Create Workspace"]})})]}),0!==e.length||O?(0,r.jsx)(o.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(i.iA,{className:"min-w-full",children:[(0,r.jsx)(i.xD,{children:(0,r.jsxs)(i.SC,{children:[(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ex("name"),children:["Workspace",ep("name")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ex("runningClusterCount"),children:["Running Clusters ",ep("runningClusterCount")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ex("managedJobsCount"),children:["Jobs",ep("managedJobsCount")]}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Enabled infra"}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Actions"})]})}),(0,r.jsx)(i.RM,{children:O&&0===eg.length?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(d.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):eg.length>0?eg.map(e=>{let s=!0===((null==W?void 0:W[e.name])||{}).private;return(0,r.jsxs)(i.SC,{className:"hover:bg-gray-50",children:[(0,r.jsxs)(i.pj,{className:"",children:[(0,r.jsx)("button",{onClick:()=>ev(e.name),disabled:ee,className:"text-blue-600 hover:text-blue-600 hover:underline text-left",children:e.name}),(0,r.jsx)("span",{className:"ml-2",children:(0,r.jsx)(D,{isPrivate:s})})]}),(0,r.jsx)(i.pj,{children:(0,r.jsx)("button",{onClick:()=>{el.push({pathname:"/clusters",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 bg-gray-100 text-gray-700 rounded text-sm",children:M?(0,r.jsx)(d.Z,{size:12}):e.runningClusterCount})})}),(0,r.jsx)(i.pj,{children:(0,r.jsx)("button",{onClick:()=>{el.push({pathname:"/jobs",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 bg-gray-100 text-gray-700 rounded text-sm",children:R?(0,r.jsx)(d.Z,{size:12}):e.managedJobsCount})})}),(0,r.jsx)(i.pj,{children:e.clouds.length>0?[...e.clouds].sort().map((s,t)=>{let n=Z.Z2[s.toLowerCase()]||s;return(0,r.jsxs)("span",{children:[(0,r.jsx)(z(),{href:"/infra",className:"inline-flex items-center px-2 py-1 rounded text-sm bg-sky-100 text-sky-800 hover:bg-sky-200 hover:text-sky-900 transition-colors duration-200",children:n}),t<e.clouds.length-1&&" "]},s)}):(0,r.jsx)("span",{className:"text-gray-500 text-sm",children:"-"})}),(0,r.jsxs)(i.pj,{children:[(0,r.jsx)(c.z,{variant:"ghost",size:"sm",onClick:()=>ev(e.name),disabled:ee,className:"text-gray-600 hover:text-gray-800 mr-1",children:(0,r.jsx)(g.Z,{className:"w-4 h-4"})}),(0,r.jsx)(c.z,{variant:"ghost",size:"sm",onClick:()=>ef(e.name),disabled:"default"===e.name||ee,title:"default"===e.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:(0,r.jsx)(f.Z,{className:"w-4 h-4"})})]})]},e.name)}):(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:"No workspaces found"})})})]})})}):(0,r.jsxs)("div",{className:"text-center py-10",children:[(0,r.jsx)("p",{className:"text-lg text-gray-600",children:"No workspaces found."}),(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-2",children:"Create a cluster to see its workspace here."})]}),W&&(0,r.jsx)(m.Vq,{open:K,onOpenChange:_,children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md md:max-w-lg lg:max-w-xl xl:max-w-2xl w-full max-h-[90vh] flex flex-col",children:[(0,r.jsx)(m.fK,{children:(0,r.jsx)(m.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,r.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:u.ZP.dump(W,{indent:2})})})]})}),(0,r.jsx)(m.Vq,{open:$.open,onOpenChange:e=>{G(s=>({...s,open:e})),e||er(null)},children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,r.jsxs)(m.fK,{children:[(0,r.jsx)(m.$N,{children:"Permission Denied"}),(0,r.jsx)(m.Be,{children:ee?(0,r.jsxs)("div",{className:"flex items-center py-2",children:[(0,r.jsx)(d.Z,{size:16,className:"mr-2"}),(0,r.jsx)("span",{children:"Checking permissions..."})]}):(0,r.jsx)(r.Fragment,{children:$.userName?(0,r.jsxs)(r.Fragment,{children:[$.userName," is logged in as non-admin and ",$.message,"."]}):$.message})})]}),(0,r.jsx)(m.cN,{children:(0,r.jsx)(c.z,{variant:"outline",onClick:()=>G(e=>({...e,open:!1})),disabled:ee,children:"OK"})})]})}),(0,r.jsx)(m.Vq,{open:U.confirmOpen,onOpenChange:e=>{e||(ew(),er(null))},children:(0,r.jsxs)(m.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(m.fK,{children:[(0,r.jsx)(m.$N,{children:"Delete Workspace"}),(0,r.jsxs)(m.Be,{children:['Are you sure you want to delete workspace "',U.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,r.jsxs)(m.cN,{children:[(0,r.jsx)(c.z,{variant:"outline",onClick:ew,disabled:U.deleting,children:"Cancel"}),(0,r.jsx)(c.z,{variant:"destructive",onClick:ej,disabled:U.deleting,children:U.deleting?"Deleting...":"Delete"})]})]})})]})}k.nb.REFRESH_INTERVAL},23001:function(e,s,t){t.d(s,{X:function(){return n}});var r=t(67294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let s=()=>{t(window.innerWidth<e)};return s(),window.addEventListener("resize",s),()=>{window.removeEventListener("resize",s)}},[e]),s}},55988:function(e,s,t){t.d(s,{j:function(){return a}});var r=t(85893);t(67294);var n=t(23800);function a(e){let{name:s,context:t={},fallback:a=null,wrapperClassName:l=""}=e,o=(0,n.dL)(s);return 0===o.length?a:(0,r.jsx)("div",{className:l||void 0,children:o.map(e=>{let s=e.component;return(0,r.jsx)(s,{...t},e.id)})})}}}]);