From edc22c047dbe9b246c0760b1073c9b08e5721c1b Mon Sep 17 00:00:00 2001 From: Johnny Bouder Date: Thu, 7 Nov 2024 13:35:26 -0500 Subject: [PATCH] Add id to logo for testing. Update selectors. --- jhub_apps/static/js/index.js | 2 +- jhub_apps/tests/tests_e2e/test_integration.py | 13 +++++++------ ui/src/components/navigation/navigation.tsx | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/jhub_apps/static/js/index.js b/jhub_apps/static/js/index.js index 387d3bd2..f4706158 100644 --- a/jhub_apps/static/js/index.js +++ b/jhub_apps/static/js/index.js @@ -192,4 +192,4 @@ Error generating stack: `+s.message+` Copyright (c) 2018 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames -*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",i=0;i{const r=uU("button-group",t);return f.jsx("ul",{id:e,className:r,children:P.Children.map(n,(o,s)=>f.jsx("li",{className:"button-group-item",children:o},s))})};var Ay={},fU=ct;Object.defineProperty(Ay,"__esModule",{value:!0});var Py=Ay.default=void 0,dU=fU(ut()),pU=f;Py=Ay.default=(0,dU.default)((0,pU.jsx)("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddRounded");var gy={},vU=ct;Object.defineProperty(gy,"__esModule",{value:!0});var j3=gy.default=void 0,hU=vU(ut()),mU=f;j3=gy.default=(0,hU.default)((0,mU.jsx)("path",{d:"M18.3 5.71a.9959.9959 0 0 0-1.41 0L12 10.59 7.11 5.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"}),"CloseRounded");const AU=({variables:e,setVariables:t})=>{const[n,r]=P.useState([]),o=l=>{if(!l||l.length===0)return null;const c={};return l.forEach(u=>{u.key&&(c[u.key]=u.value)}),c},s=(l,c)=>{const u=[...n];c.target.name==="key"?u[l].key=c.target.value:u[l].value=c.target.value,r(u),t(o(u))},i=()=>{r([...n,{key:"",value:""}])},a=l=>{const c=[...n];c.splice(l,1),r(c),t(o(c))};return P.useEffect(()=>{e&&n.length===0&&r(()=>{const l=[];for(const[c,u]of Object.entries(e))l.push({key:c,value:u});return l})},[e,n.length]),f.jsx(qe,{id:"environment-variables",children:f.jsxs(to,{children:[n.length>0?f.jsx(nt,{sx:{pb:"16px"},children:n.map((l,c)=>f.jsxs(to,{direction:"row",gap:1,sx:{pb:"16px"},children:[f.jsx(nt,{sx:{width:"100%"},children:f.jsx(Es,{id:`environment-variable-key-${c}`,name:"key",label:"Key",placeholder:"Key",value:l.key,onChange:u=>s(c,u)})}),f.jsx(nt,{sx:{width:"100%"},children:f.jsx(Es,{id:`environment-variable-value-${c}`,name:"value",label:"Value",placeholder:"Value",value:l.value,onChange:u=>s(c,u)})}),f.jsx(nt,{children:f.jsx(Zn,{sx:{mt:"7px"},onClick:()=>a(c),"aria-label":"Remove",children:f.jsx(j3,{})})})]},`environment-variable-row-${c}`))}):f.jsx(f.Fragment,{}),f.jsx(nt,{children:f.jsx(at,{variant:"contained",color:"secondary",startIcon:f.jsx(Py,{}),onClick:i,sx:{},children:"Add Variable"})})]})})};var yy={},PU=ct;Object.defineProperty(yy,"__esModule",{value:!0});var z3=yy.default=void 0,gU=PU(ut()),yU=f;z3=yy.default=(0,gU.default)((0,yU.jsx)("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1"}),"HomeRounded");var by={},bU=ct;Object.defineProperty(by,"__esModule",{value:!0});var Bd=by.default=void 0,xU=bU(ut()),wU=f;Bd=by.default=(0,xU.default)((0,wU.jsx)("path",{d:"M8.12 9.29 12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7a.9959.9959 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0"}),"KeyboardArrowDownRounded");var xy={},HU=ct;Object.defineProperty(xy,"__esModule",{value:!0});var Vd=xy.default=void 0,jU=HU(ut()),zU=f;Vd=xy.default=(0,jU.default)((0,zU.jsx)("path",{d:"M8.12 14.71 12 10.83l3.88 3.88c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L12.7 8.71a.9959.9959 0 0 0-1.41 0L6.7 13.3c-.39.39-.39 1.02 0 1.41.39.38 1.03.39 1.42 0"}),"KeyboardArrowUpRounded");var wy={},OU=ct;Object.defineProperty(wy,"__esModule",{value:!0});var O3=wy.default=void 0,CU=OU(ut()),DU=f;O3=wy.default=(0,CU.default)((0,DU.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");Q(ha)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingLeft:e.spacing(4),paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));const SU=Q(ha)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));Q(d9)(({theme:e})=>({paddingLeft:e.spacing(4)}));const TU=({...e})=>{const t=yr(),[n,r]=Oe.useState(null),o=!!n,s=e6(t.breakpoints.down("sm")),{window:i}=e,[a,l]=P.useState(!s),[c]=Ee(Do),[,u]=Ee(no),[d,p]=P.useState([]),[y,h]=P.useState([]),[m,b]=P.useState([]),[A]=Ee(bl),{isLoading:v,error:g,data:w}=Pn({queryKey:["app-state"],queryFn:()=>Lt.get("/server/").then(C=>C.data).then(C=>C),enabled:!!c}),{isLoading:H,error:z,data:j}=Pn({queryKey:["service-data"],queryFn:()=>Lt.get("/services/").then(C=>C.data).then(C=>C),enabled:!!c}),O=()=>{l(C=>!C)};P.useEffect(()=>{!v&&w&&c&&h(()=>r3(w,c.name))},[v,w,c]),P.useEffect(()=>{!H&&j&&c&&(p(()=>e3(j,c.name).filter(C=>!vg.includes(C.name))),b(()=>t3(j,c.name)))},[H,j,c]),P.useEffect(()=>{u(z?z.message:g?g.message:void 0)},[z,g,u]),P.useEffect(()=>{l(!s)},[s]);const D=f.jsxs(qe,{children:[f.jsx(Um,{children:f.jsx(El,{disablePadding:!0,sx:{mt:10},children:f.jsxs(d9,{sx:{px:"1.5rem",mx:".5rem",backgroundColor:t.palette.primary.light,borderRadius:"8px",position:"relative",display:"flex",alignItems:"center","&::before":{content:'""',position:"absolute",left:0,top:0,bottom:0,width:"8px",backgroundColor:t.palette.primary.main,borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px"},"&:hover":{backgroundColor:t.palette.gray[50],"&::before":{backgroundColor:t.palette.primary.main}}},onClick:()=>Wo(`${Gt}`),children:[f.jsx(Y6,{sx:{minWidth:"auto",mr:"8px",display:"flex",alignItems:"center"},children:f.jsx(z3,{sx:{color:t.palette.common.black,width:"28px",height:"28px"}})}),f.jsx(ha,{primary:f.jsx(Qe,{variant:"body1",sx:{fontSize:"16px",fontWeight:600,lineHeight:"1.2",position:"relative",top:"2px"},children:"Home"})})]})})}),f.jsxs(Um,{sx:{px:1},children:[f.jsx(El,{disablePadding:!0,children:f.jsx(SU,{primary:"Services",disableTypography:!0,sx:{px:"24px",py:"4px",fontSize:"14px",textTransform:"uppercase",fontWeight:600,color:"rgba(15 16 21 / 60%)"}})}),y.map((C,B)=>f.jsx(El,{disablePadding:!0,children:f.jsx(rc,{href:C.url,sx:{borderRadius:"4px",textDecoration:"none",display:"block",width:"100%",px:"24px",py:"4px",color:"rgb(15 16 21 / 87%)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",textDecoration:"none"}},children:f.jsx(ha,{primary:f.jsx(Qe,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:C.name})})})},B)),m.map((C,B)=>f.jsx(El,{disablePadding:!0,children:f.jsx(rc,{href:C.url,sx:{borderRadius:"4px",textDecoration:"none",display:"block",width:"100%",px:"24px",py:"4px",color:"rgb(15 16 21 / 87%)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",textDecoration:"none"}},children:f.jsx(ha,{primary:f.jsx(Qe,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:C.name})})})},B)),d.map((C,B)=>f.jsx(El,{disablePadding:!0,children:f.jsx(rc,{href:C.url,sx:{borderRadius:"4px",textDecoration:"none",display:"block",width:"100%",px:"24px",py:"4px",color:"rgb(15 16 21 / 87%)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",textDecoration:"none"}},children:f.jsx(ha,{primary:f.jsx(Qe,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:C.name})})})},B))]})]});return f.jsxs(qe,{sx:{flexGrow:1},hidden:A,children:[f.jsx(UD,{id:"app-bar",position:"fixed",sx:{zIndex:C=>C.zIndex.drawer+1,backgroundColor:C=>C.palette.common.white},children:f.jsxs(j9,{id:"toolbar",children:[f.jsx(Zn,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:O,sx:{mr:2,display:{sm:"none"}},children:f.jsx(O3,{})}),f.jsx(qe,{component:"div",sx:{flexGrow:1,display:{xs:"none",sm:"block"}},children:f.jsx(rc,{href:Gt,children:f.jsx("img",{src:hG(),alt:"logo",height:"28"})})}),f.jsxs(qe,{sx:{display:{xs:"none",sm:"block"}},children:[f.jsxs(at,{id:"profile-menu-btn",className:"button-menu","aria-controls":o?"profile-menu-list":void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:C=>r(C.currentTarget),endIcon:o?f.jsx(Vd,{}):f.jsx(Bd,{}),sx:{"&:hover":{backgroundColor:t.palette.gray[50]}},children:[c==null?void 0:c.name," ",(c==null?void 0:c.admin)&&f.jsx(wu,{label:"admin",size:"small",className:"chip",sx:{marginLeft:t.spacing(1)}})]}),f.jsxs(tu,{id:"profile-menu-list",anchorEl:n,open:o,onClose:()=>r(null),MenuListProps:{"aria-labelledby":"profile-menu-btn"},sx:{marginTop:"20px"},children:[f.jsx(mo,{onClick:()=>Wo(`${Gt}/token`),sx:{width:"180px"},children:"Tokens"}),(c==null?void 0:c.admin)&&f.jsx(mo,{onClick:()=>Wo(`${Gt}/admin`),children:"Admin"}),f.jsx(mo,{onClick:()=>Wo(`${Gt}/logout`),children:"Logout"})]})]})]})}),f.jsx("nav",{children:f.jsx(cE,{container:i!==void 0?()=>i().document.body:void 0,variant:"persistent",open:a,onClose:O,ModalProps:{keepMounted:!0},sx:{"& .MuiDrawer-paper":{boxSizing:"border-box",width:224,boxShadow:1}},children:D})})]})},RU=({severity:e="error",message:t,onClose:n})=>f.jsx("div",{className:"alert-wrapper",children:f.jsx(QP,{id:"alert-notification",severity:e,onClose:n,children:t})}),kU=e=>{let t;switch(e){case"Ready":t={bgcolor:"rgb(255, 255, 255)",border:"1px solid rgb(46, 125, 50)",color:"rgb(46, 125, 50)"};break;case"Pending":t={bgcolor:"rgb(234, 181, 78)",color:"black"};break;case"Running":t={bgcolor:"rgb(46, 125, 50)",color:"white"};break;case"Unknown":default:t={bgcolor:"rgb(121, 121, 124)",color:"white"};break}return t},C3=({status:e,additionalInfo:t,app:n,size:r="small"})=>{const[,o]=Ee(kv),[,s]=Ee(Ev),i=()=>e==="Running"&&t?f.jsx(f.Fragment,{children:n&&!n.shared?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:"chip-label-info",style:{position:"relative",top:"1px"},children:[e," on ",t]}),f.jsx(Zn,{onClick:a=>{a.preventDefault(),a.stopPropagation(),o(n),s(!0)},"aria-label":"Stop",sx:{pl:0,position:"relative",top:0,left:"6px"},color:"inherit",disabled:n.shared,children:f.jsx(Lv,{sx:{fontSize:"16px"}})})]}):f.jsx("span",{children:e})}):e||"Default";return f.jsx(wu,{label:i(),className:e!=="Running"||!t||n!=null&&n.shared?"chip-base":"",size:r,sx:{fontWeight:600,fontSize:"12px",...kU(e)}})};var Hy={},EU=ct;Object.defineProperty(Hy,"__esModule",{value:!0});var D3=Hy.default=void 0,MU=EU(ut()),LU=f;D3=Hy.default=(0,MU.default)((0,LU.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var jy={},XU=ct;Object.defineProperty(jy,"__esModule",{value:!0});var S3=jy.default=void 0,NU=XU(ut()),BU=f;S3=jy.default=(0,NU.default)((0,BU.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-1 16H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v12c0 .55-.45 1-1 1m-4.44-6.19-2.35 3.02-1.56-1.88c-.2-.25-.58-.24-.78.01l-1.74 2.23c-.26.33-.02.81.39.81h8.98c.41 0 .65-.47.4-.8l-2.55-3.39c-.19-.26-.59-.26-.79 0"}),"CropOriginalRounded");var zy={},VU=ct;Object.defineProperty(zy,"__esModule",{value:!0});var T3=zy.default=void 0,IU=VU(ut()),WU=f;T3=zy.default=(0,IU.default)((0,WU.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error");var Oy={},JU=ct;Object.defineProperty(Oy,"__esModule",{value:!0});var R3=Oy.default=void 0,FU=JU(ut()),YU=f;R3=Oy.default=(0,FU.default)((0,YU.jsx)("path",{d:"M10 16h4c.55 0 1-.45 1-1v-5h1.59c.89 0 1.34-1.08.71-1.71L12.71 3.7a.9959.9959 0 0 0-1.41 0L6.71 8.29c-.63.63-.19 1.71.7 1.71H9v5c0 .55.45 1 1 1m-4 2h12c.55 0 1 .45 1 1s-.45 1-1 1H6c-.55 0-1-.45-1-1s.45-1 1-1"}),"UploadRounded");const qU=({id:e,name:t,currentImage:n,setCurrentImage:r,currentFile:o,setCurrentFile:s,...i})=>{const a=yr(),[l,c]=P.useState(!1),[u,d]=P.useState(!1),[p,y]=P.useState(void 0),h=P.useRef(null),m=j=>{j.preventDefault(),c(!0)},b=j=>{j.preventDefault(),c(!0)},A=j=>{j.preventDefault(),c(!1)},v=j=>{j.preventDefault(),c(!1);const O=j.dataTransfer.files[0];s(O)},g=j=>{if(!j.target.files)return;const O=5*1024*1024;if(j.target.files[0].size>O){y("File size exceeds 5MB.");return}const D=j.target.files[0];s(D),y(void 0)},w=j=>{j.preventDefault(),d(!0)},H=j=>{j.preventDefault();const O=h.current;O&&O.click()},z=j=>{j.preventDefault();const O=h.current;O&&(O.value="",s(void 0),r(void 0))};return P.useEffect(()=>{const j=h.current;if(j&&j.files&&j.files.length>0){const O=j.files[0];s(O)}},[h,s]),f.jsxs(qe,{id:`thumbnail-${e}`,className:"thumbnail",sx:{display:"flex",flexDirection:"column",columnGap:"24px",width:"100%",border:"none"},children:[p?f.jsxs(qe,{sx:{display:"flex",alignItems:"center",backgroundColor:"#FDEDED",color:a.palette.error.main,padding:"8px",borderRadius:"4px",marginBottom:"16px"},children:[f.jsx(T3,{sx:{marginRight:"8px"}}),f.jsx(Qe,{variant:"body2",sx:{flexGrow:1,width:"100%",color:a.palette.gray.main},children:f.jsxs("span",{className:"error-msg",children:[f.jsx("span",{className:"weight600",children:"File is too large."})," Maximum file size is 5MB."]})}),f.jsx(Zn,{size:"small",onClick:()=>y(void 0),sx:{color:a.palette.gray.main},children:f.jsx(D3,{})})]}):null,f.jsxs(qe,{id:`thumbnail-body-${e}`,className:`thumbnail-body ${l?"dragging":""} ${o||n?"selected":""}`,onDragOver:m,onDragEnter:b,onDragLeave:A,onDrop:v,sx:{display:"flex",flexDirection:"row",columnGap:"24px",height:"180px"},children:[f.jsxs(qe,{className:"thumbnail-dropzone",sx:{height:"130px",backgroundColor:"#90969c",borderRadius:"4px"},children:[o||n?f.jsx(qe,{sx:{margin:"auto auto"},children:f.jsx("img",{src:o?URL.createObjectURL(o):n,alt:"App thumbnail",title:"Click to view image",className:"thumbnail-img",style:{maxWidth:"225px",maxHeight:"130px",borderRadius:"4px",cursor:"pointer"},onClick:w})}):f.jsx(qe,{tabIndex:0,title:"Select an image",className:"thumbnail-icon-container",sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"225px",height:"130px",cursor:"pointer","&:focus":{outlineColor:a.palette.primary.main}},onClick:H,children:f.jsx(S3,{sx:{width:"64px",height:"64px",color:a.palette.common.white}})}),f.jsx("input",{ref:h,id:e,name:t,type:"file",accept:"image/*",onChange:g,style:{display:"none"},...i})]}),f.jsxs(qe,{sx:{display:"flex",flexDirection:"column",rowGap:"16px"},children:[f.jsxs(qe,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},columnGap:"16px",rowGap:"12px",height:"40px"},children:[f.jsx(at,{id:"upload-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(R3,{}),onClick:H,sx:{width:"100%",maxWidth:"170px"},children:"Select an image"}),o||n?f.jsx(at,{id:"remove-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(Mv,{}),onClick:z,hidden:!o&&!n,sx:{width:"100%",maxWidth:"170px"},children:"Remove image"}):f.jsx(f.Fragment,{})]}),f.jsx(Qe,{variant:"body1",sx:{color:"#0F101599",width:"340px",display:{xs:"none",md:"block"}},children:"Recommended size: 225x130 | JPG, PNG, Max size: 5MB"})]})]}),f.jsx(tc,{onClose:()=>d(!1),open:u,children:f.jsx("img",{src:o?URL.createObjectURL(o):n,alt:"App thumbnail"})})]})};var Cy={},ZU=ct;Object.defineProperty(Cy,"__esModule",{value:!0});var Nv=Cy.default=void 0,GU=ZU(ut()),UU=f;Nv=Cy.default=(0,GU.default)((0,UU.jsx)("path",{d:"M19 11H7.83l4.88-4.88c.39-.39.39-1.03 0-1.42a.9959.9959 0 0 0-1.41 0l-6.59 6.59c-.39.39-.39 1.02 0 1.41l6.59 6.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L7.83 13H19c.55 0 1-.45 1-1s-.45-1-1-1"}),"ArrowBackRounded");const Bv=Q("p")(()=>({maxWidth:600,paddingBottom:"30px"})),QU=()=>{const[e]=Ee(bl);return f.jsx(qe,{className:"container",children:f.jsxs(to,{children:[f.jsx(nt,{hidden:e,children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(at,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Nv,{}),onClick:()=>Wo(Gt),children:"Back To Home"})})}),f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"Deploy a new app"}),f.jsxs(Bv,{children:["Begin your project by entering the details below. For more information about deploying an app,"," ",f.jsx("a",{href:"https://jhub-apps.nebari.dev/docs/category/create-apps",target:"_blank",rel:"noopener noreferrer",className:"form-paragraph-link",children:"visit our docs"}),"."]})]}),f.jsx(nt,{children:f.jsx(g3,{})})]})})},KU=()=>{const[e]=Ee(bl),[t]=ju(),n=t.get("id");return f.jsx(qe,{className:"container",children:f.jsxs(to,{children:[f.jsx(nt,{hidden:e,children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(at,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Nv,{}),onClick:()=>Wo(Gt),children:"Back To Home"})})}),f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"Edit app"}),f.jsxs(Bv,{children:["Edit your app details here. For more information on editing your app,"," ",f.jsx("a",{href:"https://jhub-apps.nebari.dev/docs/reference/create-app-form",target:"_blank",rel:"noopener noreferrer",className:"form-paragraph-link",children:"visit our docs"}),"."]})]}),f.jsx(nt,{children:f.jsx(f.Fragment,{children:n?f.jsx(g3,{id:n}):f.jsx(f.Fragment,{children:"No app found."})})})]})})};var Dy={},_U=ct;Object.defineProperty(Dy,"__esModule",{value:!0});var k3=Dy.default=void 0,$U=_U(ut()),eQ=f;k3=Dy.default=(0,$U.default)((0,eQ.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check");var Sy={},tQ=ct;Object.defineProperty(Sy,"__esModule",{value:!0});var E3=Sy.default=void 0,nQ=tQ(ut()),rQ=f;E3=Sy.default=(0,nQ.default)((0,rQ.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search");var Ty={},oQ=ct;Object.defineProperty(Ty,"__esModule",{value:!0});var M3=Ty.default=void 0,sQ=oQ(ut()),iQ=f;M3=Ty.default=(0,sQ.default)((0,iQ.jsx)("path",{d:"M4.25 5.61C6.57 8.59 10 13 10 13v5c0 1.1.9 2 2 2s2-.9 2-2v-5s3.43-4.41 5.75-7.39c.51-.66.04-1.61-.8-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAltRounded");var Ry={},aQ=ct;Object.defineProperty(Ry,"__esModule",{value:!0});var L3=Ry.default=void 0,lQ=aQ(ut()),cQ=f;L3=Ry.default=(0,lQ.default)((0,cQ.jsx)("path",{d:"M4 18h4c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1M3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1m1 6h10c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1"}),"SortRounded");var ky={},uQ=ct;Object.defineProperty(ky,"__esModule",{value:!0});var X3=ky.default=void 0,fQ=uQ(ut()),dQ=f;X3=ky.default=(0,fQ.default)((0,dQ.jsx)("path",{d:"M11 21H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h6zm2 0h6c1.1 0 2-.9 2-2v-7h-8zm8-11V5c0-1.1-.9-2-2-2h-6v7z"}),"SpaceDashboard");var Ey={},pQ=ct;Object.defineProperty(Ey,"__esModule",{value:!0});var N3=Ey.default=void 0,vQ=pQ(ut()),hQ=f;N3=Ey.default=(0,vQ.default)((0,hQ.jsx)("path",{d:"M21 8H3V4h18zm0 2H3v4h18zm0 6H3v4h18z"}),"TableRows");const mQ=Q(at)(({theme:e})=>({color:e.palette.common.black,borderColor:e.palette.common.black,"&:hover":{color:e.palette.common.black,borderColor:e.palette.common.black},marginRight:"16px"})),AQ=({data:e,currentUser:t,isGridViewActive:n,toggleView:r,setApps:o})=>{const[s]=Ee(Y5),[i,a]=Oe.useState(null),[l,c]=Oe.useState(null),u=!!i,d=!!l,[p,y]=Ee(q5),[h,m]=Ee(G5),[b,A]=Ee(U5),[v,g]=Ee(Q5),[w,H]=P.useState(0),{data:z,isLoading:j}=Pn({queryKey:["app-frameworks"],queryFn:()=>Lt.get("/frameworks/").then(L=>L.data)}),O=L=>{const G=L.target.value;p.includes(G)?y(E=>E.filter(V=>V!==G)):y(E=>[...E,G])},D=L=>{m(L)},C=L=>{A(L),o(Jf(e,t,s,h,p,L,v)),c(null)},B=L=>{const G=L.target.value;v.includes(G)?g(E=>E.filter(V=>V!==G)):g(E=>[...E,G])},R=()=>{a(null),o(Jf(e,t,s,h,p,b,v))},k=()=>{y([]),m("Any"),g([])},J=P.useCallback(()=>Jf(e,t,s,h,p,b,v).length,[e,t,s,h,p,b,v]);return P.useEffect(()=>{H(J())},[J]),f.jsxs(xo,{container:!0,spacing:2,paddingBottom:"32px",children:[f.jsx(xo,{item:!0,xs:12,md:4,children:f.jsxs(nt,{sx:{pb:0},children:[f.jsx(mQ,{id:"filters-btn",variant:"text",color:"secondary",onClick:L=>a(L.currentTarget),startIcon:f.jsx(M3,{}),sx:{fontSize:"16px",fontWeight:600,top:"-8px",background:"none"},endIcon:u?f.jsx(Vd,{}):f.jsx(Bd,{}),disabled:j||!1,children:"Filters"}),f.jsx(tu,{id:"filters-list",anchorEl:i,open:u,onClose:()=>a(null),MenuListProps:{"aria-labelledby":"filters-btn",style:{paddingTop:0,paddingBottom:0},sx:{".MuiFormLabel-root":{fontSize:"14px"},".MuiFormControlLabel-label":{fontSize:"14px"}}},children:f.jsxs(qe,{component:"form",name:"filters-form",id:"filters-form",sx:{width:"450px",px:"16px",pb:0,mt:3},children:[f.jsx(Nf,{id:"frameworks-label",sx:{py:"16px",fontWeight:600},children:"Frameworks"}),f.jsx(qe,{children:z==null?void 0:z.map(L=>f.jsx(ii,{control:f.jsx(Jb,{value:L.display_name}),label:L.display_name,sx:{width:"120px","& > :last-child":{minWidth:"100%"}},onClick:O,checked:p.includes(L.display_name)},L.name))}),f.jsx(rl,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Nf,{id:"server-statuses-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Server Status"}),f.jsx(qe,{children:WX.map(L=>f.jsx(ii,{control:f.jsx(Jb,{value:L}),label:L,onClick:B,checked:v.includes(L)},L))}),f.jsx(rl,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Nf,{id:"ownership-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Ownership"}),f.jsx(qe,{children:f.jsx(Km,{"aria-labelledby":"ownership-label",defaultValue:"any",name:"ownership-group",sx:{"& .MuiFormControlLabel-root":{pb:"3px"}},row:!0,children:VX.map(L=>f.jsx(ii,{control:f.jsx(Qm,{value:L}),label:L,onClick:()=>D(L),checked:h===L},L))})}),f.jsx(qe,{sx:{backgroundColor:"#EEE",p:1,pt:.75,mx:-2,width:"auto",fontSize:"14px"},children:f.jsxs(ic,{children:[f.jsx(at,{id:"clear-filters-btn","data-testid":"clear-filters-btn",variant:"text",sx:{color:"#0F1015",display:"flex",alignItems:"center"},size:"small",onClick:k,children:"Clear"}),f.jsxs(at,{id:"apply-filters-btn",variant:"contained",size:"small",onClick:R,sx:{px:"none !important",minWidth:"20px"},children:["Show ",w," results"]})]})})]})})]})}),f.jsxs(xo,{container:!0,item:!0,xs:8,md:8,direction:"row",sx:{display:"flex",justifyContent:"flex-end",flexWrap:"nowrap"},children:[f.jsx(nt,{children:f.jsxs(qe,{sx:{display:"flex",flexDirection:"row"},children:[f.jsxs(at,{id:"sort-by-btn",variant:"text",color:"secondary",onClick:L=>c(L.currentTarget),sx:{position:"relative",bottom:"8px",fontSize:"16px",fontWeight:600,color:"common.black",mr:"24px"},endIcon:d?f.jsx(Vd,{}):f.jsx(Bd,{}),children:[f.jsx(L3,{sx:{position:"relative",marginRight:"8px"}}),b]}),f.jsx(tu,{id:"sort-by-list",anchorEl:l,open:d,onClose:()=>c(null),MenuListProps:{"aria-labelledby":"sort-by-btn"},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{transform:"translateX(-85px)",".MuiFormControlLabel-label":{fontSize:"14px"}},children:f.jsx(qe,{component:"form",name:"sort-by-form",sx:{px:"16px",width:"220px"},children:f.jsx(Km,{defaultValue:"any",name:"sort-by-group","aria-describedby":"sort-by-label",children:IX.map(L=>f.jsx(ii,{control:f.jsx(Qm,{value:L}),label:L,onClick:()=>C(L),checked:b===L},L))})})})]})}),f.jsx(nt,{children:f.jsxs(qe,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around",border:"1px solid #DFDFE0",borderRadius:"4px",position:"relative",top:"-6px"},children:[f.jsx(at,{onClick:r,disabled:n,"aria-label":"Grid View",sx:{color:"inherit",backgroundColor:n?"#E8E8EA":"transparent",boxShadow:"none",padding:"5px",minWidth:"auto",borderRadius:"4px 0px 0px 4px",borderRight:"1px solid #DFDFE0","&:hover":{backgroundColor:n?"#E8E8EA":"transparent",boxShadow:"none"}},children:f.jsx(X3,{sx:{color:n?"#2E2F33":"#76777B"}})}),f.jsx(at,{onClick:r,disabled:!n,"aria-label":"Table View",sx:{color:"inherit",backgroundColor:n?"transparent":"#E8E8EA",boxShadow:"none",borderRadius:"0px 4px 4px 0px",padding:"5px",minWidth:"auto","&:hover":{backgroundColor:n?"transparent":"#E8E8EA",boxShadow:"none"}},children:f.jsx(N3,{sx:{color:n?"#76777B":"#2E2F33"}})})]})})]})]})},PQ=({apps:e})=>f.jsx(f.Fragment,{children:e.map((t,n)=>P.createElement(kA,{...t,key:`app-${t.id}-${n}`,title:t.name,serverStatus:t.status,lastModified:t.last_activity,isPublic:t.public,isShared:t.shared,app:t}))});var My={},gQ=ct;Object.defineProperty(My,"__esModule",{value:!0});var B3=My.default=void 0,yQ=gQ(ut()),bQ=f;B3=My.default=(0,yQ.default)((0,bQ.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M9.5 14.67V9.33c0-.79.88-1.27 1.54-.84l4.15 2.67c.61.39.61 1.29 0 1.68l-4.15 2.67c-.66.43-1.54-.05-1.54-.84"}),"PlayCircleRounded");const xQ=({apps:e})=>{const[,t]=P.useState(""),[n,r]=P.useState(e),[,o]=Ee(no),[,s]=Ee(kv),[,i]=Ee(Qg),[,a]=Ee(Ev),[,l]=Ee(Kg),c=e.map(d=>d.status);P.useEffect(()=>{c&&t(c.join(", "))},[c,o]),P.useEffect(()=>{r(e)},[e]);const u=(d,p)=>d?f.jsx(Ov,{"data-testid":"PublicRoundedIcon",fontSize:"small",className:"align-vertical-center"}):p?f.jsx(zv,{"data-testid":"GroupRoundedIcon",fontSize:"small",className:"align-vertical-center"}):f.jsx(Wg,{"data-testid":"LockRoundedIcon",fontSize:"small",className:"align-vertical-center"});return f.jsx(f.Fragment,{children:f.jsx(qe,{sx:{height:"100%",width:"100%"},children:f.jsx(H9,{component:Ar,children:f.jsxs(x9,{sx:{minWidth:650},"aria-label":"App table",children:[f.jsx(cX,{children:f.jsxs(jd,{className:"app-header",children:[f.jsx(En,{children:"Name"}),f.jsx(En,{children:"Status"}),f.jsx(En,{children:"Created by"}),f.jsx(En,{children:"Tags"}),f.jsx(En,{children:"Actions"})]})}),f.jsx(w9,{children:n.map(d=>f.jsxs(jd,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[f.jsxs(En,{component:"th",scope:"row",children:[u(d.public,d.shared),f.jsx("span",{className:"inline relative icon-text",children:d.name})]}),f.jsx(En,{children:f.jsx(C3,{status:d.status,size:"medium"})}),f.jsx(En,{children:d.username}),f.jsx(En,{children:f.jsx(wu,{label:d.framework,variant:"outlined",size:"medium"})}),f.jsxs(En,{children:[d.status==="Running"?f.jsx(at,{onClick:()=>{a(!0),s(d)},"aria-label":"Stop",color:"inherit",size:"small",className:"action-button","data-testid":"StopCircleRoundedIcon",disabled:d.shared,children:f.jsx(Lv,{})}):f.jsx(at,{onClick:()=>{i(!0),s(d)},"aria-label":"Start",color:"inherit",size:"small",className:"action-button","data-testid":"PlayCircleRoundedIcon",disabled:d.status==="Pending"||d.status==="Unknown",style:{borderRadius:"50%",minWidth:"none"},children:f.jsx(B3,{})}),f.jsx(at,{onClick:()=>window.location.href=`${tv}/edit-app?id=${d.id}`,"aria-label":"Edit",color:"inherit",size:"small",className:"action-button","data-testid":"EditRoundedIcon",disabled:d.shared,style:{borderRadius:"50%",minWidth:"none"},children:f.jsx(ey,{})}),f.jsx(at,{onClick:()=>{l(!0),s(d)},"aria-label":"Delete",color:"inherit",size:"small",className:"action-button","data-testid":"DeleteRoundedIcon",disabled:d.shared,style:{borderRadius:"50%",minWidth:"none"},children:f.jsx(Mv,{})})]})]},d.id))})]})})})})},wQ=()=>{const[e,t]=P.useState([]),[,n]=P.useState(""),[r]=Ee(Do),[o,s]=P.useState(!1),[,i]=Ee(no),[a,l]=P.useState(!0),[,c]=Ee(Y5),[u]=Ee(q5),[d]=Ee(G5),[,p]=Ee(no),[y]=Ee(U5),[h]=Ee(Q5),m=()=>l(w=>!w),{isLoading:b,error:A,data:v}=Pn({queryKey:["app-state"],queryFn:()=>Lt.get("/server/").then(w=>w.data).then(w=>w),enabled:!!r}),g=w=>{const H=w.target;c(H.value),v&&r&&t(Jf(v,r,H.value,d,u,y,h))};return P.useEffect(()=>{const w=e.map(H=>H.status);w&&n(w.join(", "))},[e,p,n]),P.useEffect(()=>{if(!b&&v){const w=n3(v,"all",(r==null?void 0:r.name)??"").map(H=>({...H,status:oy(H)})).sort((H,z)=>H.last_activity>z.last_activity?-1:1);t(w)}},[b,v,r]),P.useEffect(()=>{i(A?A.message:void 0)},[A,i]),f.jsx(f.Fragment,{children:f.jsx(qe,{children:f.jsxs(to,{children:[f.jsx(nt,{children:f.jsxs(xo,{container:!0,spacing:2,alignItems:"center",children:[f.jsx(xo,{item:!0,xs:12,md:4,sx:{padding:"0"},children:f.jsx(nt,{children:f.jsx(Qe,{component:"h2",variant:"h6",children:"App Library"})})}),f.jsxs(xo,{alignItems:"center",container:!0,item:!0,xs:12,md:8,direction:"row",sx:{display:"flex",flexWrap:"nowrap",justifyContent:{xs:"flex-start",md:"flex-end"}},children:[f.jsx(nt,{children:f.jsx(Es,{id:"search",size:"small",placeholder:"Search Apps...","aria-label":"Search for an app",onChange:g,onFocus:()=>s(!0),onBlur:()=>s(!1),sx:{my:"0",width:{sm:"200px",md:"300px",lg:"600px"},mr:"16px",color:"rgba(15, 16, 21, 0.56)",backgroundColor:"#fff","& .MuiOutlinedInput-root":{"& fieldset":{borderColor:"rgba(15, 16, 21, 0.12)"},"&:hover fieldset":{borderColor:"rgba(15, 16, 21, 0.56)"},"&.Mui-focused fieldset":{borderColor:"#ba18da"}}},InputProps:{startAdornment:f.jsx(cg,{position:"start",children:!o&&f.jsx(E3,{style:{fill:"rgba(15, 16, 21, 0.56)"}})})}})}),f.jsx(nt,{children:f.jsx(at,{id:"create-app",variant:"contained",color:"primary",size:"large",startIcon:f.jsx(Py,{}),onClick:()=>{window.location.href=`${tv}/create-app`},children:"Deploy App"})})]})]})}),f.jsx(nt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(rl,{})}),f.jsx(nt,{children:v&&r?f.jsx(AQ,{data:v,currentUser:r,setApps:t,isGridViewActive:a,toggleView:m}):f.jsx(f.Fragment,{})}),f.jsx(nt,{children:f.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,rowGap:2,justifyContent:"flex-start",paddingBottom:"48px"},children:b?f.jsx("div",{className:"font-bold",children:"Loading..."}):e.length>0?a?f.jsx(PQ,{apps:e}):f.jsx(xQ,{apps:e}):f.jsx("div",{children:"No apps available"})})})]})})})},HQ=({services:e,apps:t})=>f.jsxs(f.Fragment,{children:[t.map((n,r)=>P.createElement(kA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1,app:n})),e.map((n,r)=>P.createElement(kA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1}))]}),jQ=()=>{const[e]=Ee(Do),[,t]=Ee(no),[n,r]=P.useState([]),[o,s]=P.useState([]),{isLoading:i,error:a,data:l}=Pn({queryKey:["service-data"],queryFn:()=>Lt.get("/services/").then(p=>p.data).then(p=>p),enabled:!!e}),{isLoading:c,error:u,data:d}=Pn({queryKey:["app-state"],queryFn:()=>Lt.get("/server/").then(p=>p.data).then(p=>p),enabled:!!e});return P.useEffect(()=>{!i&&l&&e&&r(()=>t3(l,e.name))},[i,l,e]),P.useEffect(()=>{!c&&d&&e&&s(()=>r3(d,e.name))},[c,d,e]),P.useEffect(()=>{t(a?a.message:u?u.message:void 0)},[a,u,t]),f.jsx(qe,{children:f.jsxs(to,{children:[f.jsx(nt,{children:f.jsx(xo,{container:!0,spacing:2,children:f.jsx(xo,{item:!0,xs:12,md:4,children:f.jsx(nt,{children:f.jsx(Qe,{component:"h2",variant:"h6",children:"Quick Access"})})})})}),f.jsx(nt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(rl,{})}),f.jsx(nt,{children:f.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"16px",justifyContent:"flex-start",paddingBottom:"48px"},children:i||c?f.jsx("div",{className:"font-bold",children:"Loading..."}):n.length>0||o.length>0?f.jsx(HQ,{services:n,apps:o}):f.jsx("div",{children:"No services available"})})})]})})},zQ=()=>f.jsx(Uf,{sx:{backgroundColor:"green",color:"white",borderRadius:"50%",padding:"2px"},children:f.jsx(k3,{})}),kw=()=>{const[,e]=Ee(no),[t,n]=Ee(kv),[r]=Ee(Do),[o,s]=P.useState(null),[i,a]=Ee(Qg),[l,c]=Ee(Ev),[u,d]=Ee(Kg),[p,y]=Ee(K5),[h,m]=P.useState(!1),b=nv(),[A,v]=P.useState(!1),[g,w]=P.useState(""),[H,z]=P.useState("success"),j=async({id:T})=>await Lt.post(`/server/${T}`),O=async({id:T,remove:K})=>await Lt.delete(`/server/${T}`,{params:{remove:K}}),{data:D}=Pn({queryKey:["app-form",o],queryFn:()=>Lt.get(`/server/${o}`).then(T=>T.data),enabled:!!o}),{data:C}=Pn({queryKey:["current-user"],queryFn:()=>Lt.get("/user").then(T=>T.data),enabled:!0}),{mutate:B}=ol({mutationFn:j,retry:1}),{mutate:R}=ol({mutationFn:O,retry:1}),k=()=>{const T=(t==null?void 0:t.id)||"";m(!0),R({id:T,remove:!0},{onSuccess:async()=>{m(!1),d(!1),b.invalidateQueries({queryKey:["app-state"]}),w("App deleted successfully"),v(!0)},onError:async K=>{m(!1),e(K.message)}})},J=T=>typeof T=="object"&&T!==null&&"response"in T,L=async()=>{const T=(t==null?void 0:t.id)||"";if(m(!0),a(!1),y(!1),(t==null?void 0:t.shared)&&!(C!=null&&C.admin)){m(!1),w("You don't have permission to start this app. Please ask the owner to start it."),z("error"),v(!0);return}B({id:T},{onSuccess:async()=>{m(!1),b.invalidateQueries({queryKey:["app-state"]}),w("App started successfully"),z("success"),v(!0)},onError:Z=>{var se;if(m(!1),J(Z)){const ee=(se=Z.response)==null?void 0:se.status;w(ee===403?"You don't have permission to start this app. Please ask the owner to start it.":ee===404?"App not found (404).":ee===500?"Internal server error (500).":"An unknown server error occurred.")}else w("An unknown error occurred.");z("error"),v(!0)}})},q=async()=>{const T=(t==null?void 0:t.id)||"";if(m(!0),c(!1),(t==null?void 0:t.shared)&&!(C!=null&&C.admin)){m(!1),w("You don't have permission to stop this app. Please ask the owner to stop it."),z("error"),v(!0);return}R({id:T,remove:!1},{onSuccess:()=>{m(!1),b.invalidateQueries({queryKey:["app-state"]}),w("Server stopped successfully"),z("success"),v(!0)},onError:Z=>{var se;if(m(!1),J(Z)){const ee=(se=Z.response)==null?void 0:se.status;w(ee===403?"You don't have permission to stop this app. Please ask the owner to stop it.":ee===404?"App not found (404).":ee===500?"Internal server error (500).":"An unknown server error occurred.")}else w("An unknown error occurred.");z("error"),v(!0)}})},G=async()=>{if(!r||!t){m(!1);return}window.location.assign(mG(r,t))},E=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"card-dialog-body-wrapper",children:[f.jsxs("p",{className:"card-dialog-body",children:["Are you sure you want to start ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]}),f.jsx("p",{className:"card-dialog-note",children:"This action starts a new server that consumes resources."})]}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>a(!1),sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"start-btn","data-testid":"start-btn",variant:"contained",color:"primary",onClick:L,disabled:h,children:"Start"})]})]}),V=f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"card-dialog-body-wrapper",children:f.jsxs("p",{className:"card-dialog-body",children:["Are you sure you want to stop ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]})}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn",variant:"text",color:"primary",onClick:()=>c(!1),sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"stop-btn",variant:"contained",color:"primary",onClick:q,disabled:h,children:"Stop"})]})]}),W=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"card-dialog-body-wrapper",children:[f.jsxs("p",{className:"card-dialog-body",children:["Are you sure you want to delete ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]}),f.jsx("p",{className:"card-dialog-note",children:"This action is permanent and cannot be reversed."})]}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>d(!1),sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"delete-btn","data-testid":"delete-btn",variant:"contained",color:"error",onClick:k,disabled:h,children:"Delete"})]})]}),de=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"card-dialog-body-wrapper",children:[f.jsxs("p",{className:"card-dialog-body",children:["Would you like to start ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]}),f.jsx("p",{className:"card-dialog-note",children:"This action starts a new server that consumes resources."})]}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>{Nh(),y(!1)},sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"start-btn","data-testid":"start-btn",variant:"contained",color:"primary",onClick:()=>{Nh(),PG((t==null?void 0:t.name)||"")?G():L()},disabled:h,children:"Start"})]})]});return P.useEffect(()=>{if(D&&!D.started&&o){let T=D.user_options.display_name;!T&&o==="lab"?T="JupyterLab":!T&&o==="vscode"&&(T="VSCode"),n({id:o,name:T,framework:D.user_options.framework,url:D.url,ready:D.ready,public:D.user_options.public,shared:!1,last_activity:new Date(D.last_activity),status:"Ready"}),y(!0),Nh()}},[D,o,y,n]),P.useEffect(()=>{const T=gG();T&&s(T)},[s]),f.jsxs(qe,{sx:{flexGrow:1},className:"container",children:[f.jsx(xo,{container:!0,spacing:2,paddingBottom:"24px",children:f.jsx(xo,{item:!0,xs:12,md:2,children:f.jsx(nt,{children:f.jsx(Qe,{component:"h1",variant:"h5",children:"Home"})})})}),f.jsx(jQ,{}),f.jsx(wQ,{}),i&&f.jsxs(tc,{open:i,onClose:()=>a(!1),"data-testid":"StartModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700},children:"Start App"}),f.jsx(af,{sx:{padding:"0px"},children:E})]}),l&&f.jsxs(tc,{open:l,onClose:()=>c(!1),"data-testid":"StopModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700,pb:1},children:"Stop App"}),f.jsx(af,{sx:{padding:"0px"},children:V})]}),u&&f.jsxs(tc,{open:u,onClose:()=>d(!1),"data-testid":"DeleteModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700},children:"Delete App"}),f.jsx(af,{sx:{padding:"0px"},children:W})]}),p&&f.jsxs(tc,{open:p,onClose:()=>y(!1),"data-testid":"StartNotRunningModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700},children:"Server Not Running"}),f.jsx(af,{sx:{padding:"0px"},children:de})]}),f.jsx(gL,{open:A,autoHideDuration:6e3,onClose:()=>v(!1),anchorOrigin:{vertical:"top",horizontal:"center"},sx:{top:"90px !important"},children:f.jsx(QP,{onClose:()=>v(!1),severity:H,icon:H==="success"?f.jsx(zQ,{}):f.jsx(ma,{}),sx:{width:"100%",fontFamily:"Inter, sans-serif",fontWeight:600,backgroundColor:H==="success"?"#D1FAE5":"#FEE2E2",color:H==="success"?"#065F46":"#B91C1C"},children:g})})]})},OQ=()=>{const[e,t]=Oe.useState(null),[n]=Ee(Do),{data:r}=Pn({queryKey:["app-form",e],queryFn:()=>Lt.get(`/server/${e}`).then(o=>o.data),enabled:!!e});return P.useEffect(()=>{if(n){const o=window.location.pathname.replace(/\/$/,"").split("/").pop();o&&t(o)}},[n]),P.useEffect(()=>{r&&(r!=null&&r.started?window.location.assign(window.location.href.replace("/hub","")):r!=null&&r.pending&&n&&e?window.location.assign(AG(n,e)):(r!=null&&r.stopped&&e&&yG(e),window.location.assign(Gt)))},[r,e,n]),f.jsx(qe,{sx:{margin:"auto auto"},children:f.jsx(sg,{})})};function CQ(e){return Se("MuiLoadingButton",e)}const ko=Te("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),DQ=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],SQ=e=>{const{loading:t,loadingPosition:n,classes:r}=e,o={root:["root",t&&"loading"],startIcon:[t&&`startIconLoading${$(n)}`],endIcon:[t&&`endIconLoading${$(n)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${$(n)}`]},s=Re(o,CQ,r);return x({},r,s)},TQ=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",RQ=Q(at,{shouldForwardProp:e=>TQ(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${ko.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${ko.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>x({[`& .${ko.startIconLoadingStart}, & .${ko.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},e.loadingPosition==="center"&&{transition:t.transitions.create(["background-color","box-shadow","border-color"],{duration:t.transitions.duration.short}),[`&.${ko.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${ko.startIconLoadingStart}, & .${ko.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${ko.startIconLoadingStart}, & .${ko.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),kQ=Q("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.loadingIndicator,t[`loadingIndicator${$(n.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>x({position:"absolute",visibility:"visible",display:"flex"},t.loadingPosition==="start"&&(t.variant==="outlined"||t.variant==="contained")&&{left:t.size==="small"?10:14},t.loadingPosition==="start"&&t.variant==="text"&&{left:6},t.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled},t.loadingPosition==="end"&&(t.variant==="outlined"||t.variant==="contained")&&{right:t.size==="small"?10:14},t.loadingPosition==="end"&&t.variant==="text"&&{right:6},t.loadingPosition==="start"&&t.fullWidth&&{position:"relative",left:-10},t.loadingPosition==="end"&&t.fullWidth&&{position:"relative",right:-10})),EQ=P.forwardRef(function(t,n){const r=P.useContext(r9),o=dp(r,t),s=ke({props:o,name:"MuiLoadingButton"}),{children:i,disabled:a=!1,id:l,loading:c=!1,loadingIndicator:u,loadingPosition:d="center",variant:p="text"}=s,y=fe(s,DQ),h=Ho(l),m=u??f.jsx(sg,{"aria-labelledby":h,color:"inherit",size:16}),b=x({},s,{disabled:a,loading:c,loadingIndicator:m,loadingPosition:d,variant:p}),A=SQ(b),v=c?f.jsx(kQ,{className:A.loadingIndicator,ownerState:b,children:m}):null;return f.jsxs(RQ,x({disabled:a||c,id:h,ref:n},y,{variant:p,classes:A,ownerState:b,children:[b.loadingPosition==="end"?i:v,b.loadingPosition==="end"?v:i]}))}),MQ=()=>{const[e]=ju(),t=xg(),n=nv(),[r,o]=P.useState(!1),[s]=Ee(Do),[,i]=Ee(no),[a,l]=Ee(W5),[c]=Ee(I5),[u]=Ee(F5),[d]=Ee(J5),[,p]=Ee(no),[y,h]=Oe.useState((a==null?void 0:a.profile)||""),[m]=Ee(bl),b=e.get("id"),{data:A,isLoading:v,error:g}=Pn({queryKey:["server-types"],queryFn:()=>Lt.get("/spawner-profiles/").then(C=>C.data).then(C=>C),enabled:!!s}),w=C=>{h(C),a&&l({...a,profile:C})},H=C=>{var k,J;C.preventDefault();const B=(a==null?void 0:a.display_name)||"",R={servername:c||B,user_options:{jhub_app:!0,display_name:(a==null?void 0:a.display_name)||"",description:(a==null?void 0:a.description)||"",framework:(a==null?void 0:a.framework)||"",thumbnail:(a==null?void 0:a.thumbnail)||"",filepath:(a==null?void 0:a.filepath)||"",conda_env:(a==null?void 0:a.conda_env)||"",env:RA(a==null?void 0:a.env),custom_command:(a==null?void 0:a.custom_command)||"",profile:(a==null?void 0:a.profile)||"",public:(a==null?void 0:a.is_public)||!1,share_with:{users:((k=a==null?void 0:a.share_with)==null?void 0:k.users)||[],groups:((J=a==null?void 0:a.share_with)==null?void 0:J.groups)||[]},keep_alive:(a==null?void 0:a.keep_alive)||!1}};o(!0),b?D(R,{onSuccess:async()=>{n.invalidateQueries({queryKey:["app-state"]}),window.location.assign(Gt)},onError:async L=>{o(!1),p(L.message)}}):O(R,{onSuccess:async L=>{const q=s==null?void 0:s.name;if(q&&(L==null?void 0:L.length)>1){const G=L[1];m?t(`/success?id=${G}`):window.location.assign(`/hub/spawn-pending/${q}/${G}`)}},onError:async L=>{o(!1),p(L.message)}})},z=async({servername:C,user_options:B})=>{const R={accept:"application/json","Content-Type":"multipart/form-data"},k=new FormData;return k.append("data",JSON.stringify({servername:C,user_options:B})),u&&k.append("thumbnail",u),(await Lt.post("/server",k,{headers:R})).data},j=async({servername:C,user_options:B})=>{const R={accept:"application/json","Content-Type":"multipart/form-data"},k=new FormData;return k.append("data",JSON.stringify({servername:C,user_options:B})),u?k.append("thumbnail",u):d&&k.append("thumbnail_data_url",d),(await Lt.put(`/server/${C}`,k,{headers:R})).data},{mutate:O}=ol({mutationFn:z,retry:1}),{mutate:D}=ol({mutationFn:j,retry:1});return P.useEffect(()=>{i(g?g.message:void 0)},[g,i]),f.jsx(qe,{className:"container",children:f.jsxs(to,{children:[f.jsx(nt,{hidden:m,children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(at,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Nv,{}),onClick:()=>Wo(Gt),children:"Back To Home"})})}),f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"Server Type"}),f.jsxs(Bv,{children:["Please select the appropriate server for your app. For more information on server types,"," ",f.jsx("span",{children:f.jsx("a",{href:"https://www.nebari.dev/docs/welcome",target:"_blank",rel:"noopener noreferrer",className:"form-paragraph-link",children:"visit our docs"})}),"."]})]}),f.jsx(nt,{children:v?f.jsx("div",{className:"font-bold center",children:"Loading..."}):A&&A.length>0?f.jsxs("form",{className:"form",onSubmit:H,children:[f.jsx(na,{sx:{pb:"36px"},children:f.jsx(Km,{children:A==null?void 0:A.map((C,B)=>f.jsx(s9,{className:"server-type-card",onClick:()=>w(C.slug),tabIndex:0,children:f.jsxs(qm,{children:[f.jsx(ii,{value:C.slug,id:C.slug,control:f.jsx(Qm,{checked:y?y===C.slug:B===0}),label:C.display_name},C.slug),f.jsx("p",{children:C.description})]})},`server-type-card-${C.slug}`))})}),f.jsx("hr",{}),f.jsxs("div",{className:"button-section",children:[f.jsx("div",{className:"prev",children:f.jsx(at,{id:"cancel-btn",type:"button",variant:"text",color:"primary",onClick:()=>t(b?`/edit-app?id=${b}`:"/create-app"),children:"Back"})}),f.jsx("div",{className:"next",children:f.jsx(EQ,{id:"submit-btn",type:"submit",variant:"contained",color:"primary",loading:r,children:b?"Save":"Deploy App"})})]})]}):f.jsx("div",{children:"No servers available"})})]})})},LQ=()=>f.jsxs(qe,{id:"stop-pending",className:"container",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",padding:"20px",children:[f.jsxs(qe,{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",children:[f.jsxs(Qe,{variant:"h5",component:"h1",gutterBottom:!0,sx:{paddingBottom:"0 !important"},children:["Thank you for your patience",f.jsx("br",{}),"We are stopping your application, you may start it again when we have finished"]}),f.jsx(sg,{style:{color:"#a020f0",margin:"20px 0"}})]}),f.jsxs(qe,{sx:{marginTop:"4rem"},children:[f.jsx(Qe,{variant:"body1",gutterBottom:!0,children:"You may return to the Application Screen at any time"}),f.jsx(at,{id:"back-btn",variant:"contained",color:"primary",style:{backgroundColor:"#a020f0"},onClick:()=>Wo(`${Gt}`),children:"Back To Home"})]})]}),XQ=()=>{const[e]=Ee(Do),[t]=ju(),n=e==null?void 0:e.name,r=t.get("id")||"",o=s=>{s.preventDefault(),window.parent.open(`${Gt}/spawn-pending/${n}/${r}`,"_blank")};return P.useEffect(()=>{window.scrollTo(0,0)},[]),f.jsx(qe,{className:"container",sx:{height:"100ch",display:"flex"},children:f.jsx(to,{children:f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"App Submitted Successfully!"}),f.jsxs(Bv,{children:["To view the status of your app deployment, please click"," ",f.jsx("a",{href:"#",onClick:o,className:"form-paragraph-link",children:"here"}),"."]})]})})})},NQ=()=>{const[e]=ju(),[,t]=Ee(qZ),[,n]=Ee(Do),[,r]=Ee(Z5),[o,s]=Ee(no),[i,a]=Ee(bl),{error:l,data:c}=Pn({queryKey:["user-state"],queryFn:()=>Lt.get("/user").then(p=>p.data).then(p=>p)}),{error:u,data:d}=Pn({queryKey:["server-types"],queryFn:()=>Lt.get("/spawner-profiles/").then(p=>p.data).then(p=>p)});return P.useEffect(()=>{l?s(l.message):u&&s(u.message)},[l,u,s]),P.useEffect(()=>{t(fG())},[t]),P.useEffect(()=>{c&&n({...c})},[c,n]),P.useEffect(()=>{d&&r([...d])},[d,r]),P.useEffect(()=>{e.get("headless")==="true"&&a(!0)},[e]),f.jsxs("div",{children:[f.jsx(TU,{}),f.jsxs(qe,{component:"main",sx:{flexGrow:1,pt:i?1:9,pl:{xs:1,sm:i?1:33},pr:1,backgroundColor:"#fafbfc"},children:[o?f.jsx(RU,{message:o,onClose:()=>s(void 0)}):f.jsx(f.Fragment,{}),f.jsxs(lB,{children:[f.jsx(Lo,{path:"/home",element:f.jsx(kw,{})}),f.jsx(Lo,{path:"/user/:id/*",element:f.jsx(OQ,{})}),f.jsx(Lo,{path:"/create-app",element:f.jsx(QU,{})}),f.jsx(Lo,{path:"/edit-app",element:f.jsx(KU,{})}),f.jsx(Lo,{path:"/server-types",element:f.jsx(MQ,{})}),f.jsx(Lo,{path:"/stop-pending",element:f.jsx(LQ,{})}),f.jsx(Lo,{path:"/success",element:f.jsx(XQ,{})}),f.jsx(Lo,{path:"/",element:f.jsx(kw,{})})]})]})]})},Wr={50:"#FAFBFC",100:"#2491FF",200:"#2491FF",300:"#2491FF",400:"#2491FF",500:"#005EA2",600:"#1A4480",700:"#1A4480",800:"#1A4480",900:"#162E51"},$t={50:"rgba(0, 0, 0, .08)",100:"#E1E3E4",200:"#EEEEEE",300:"#E0E0E0",400:"#90969C",500:"#5B5F63",600:"#44474A",700:"#3C3C3B",800:"#242628",900:"#1A1C1D"},Us="#BA18DA",Wh="#BA18DA10",Ew="#9B00CE",_i="#18817A",BQ="#18817A10",VQ="#12635E",IQ="#D72D47",WQ="#F66A0A",Jr="#FFFFFF",Pf="#0F1015",gf="#0F101561",JQ=$t[100],Zl=Ap({typography:{fontFamily:'"Inter", sans-serif',h1:{letterSpacing:"-1.5px",fontSize:"96px"},h2:{letterSpacing:"0.5px",fontSize:"60px"},h3:{letterSpacing:"0px",fontSize:"48px"},h4:{letterSpacing:"0.25px",fontSize:"34px"},h5:{letterSpacing:"0px",fontSize:"24px",fontWeight:600,paddingBottom:"16px"},h6:{letterSpacing:"0.15px",fontSize:"20px",fontWeight:700,paddingBottom:"16px"},subtitle1:{letterSpacing:"0.15px",fontSize:"16px",fontWeight:600,paddingBottom:"24px"},subtitle2:{letterSpacing:"0.1px",fontSize:"14px",fontWeight:500,paddingBottom:"24px"},body1:{letterSpacing:"0.15px",fontSize:"16px"},body2:{letterSpacing:"0.17px",fontSize:"14px"},caption:{letterSpacing:"0.4px"},overline:{letterSpacing:"1px",fontSize:"12px"}},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,style:{textTransform:"none",textWrap:"nowrap"}}},MuiFormControl:{defaultProps:{fullWidth:!0,sx:{marginBottom:"24px"}}},MuiTextField:{defaultProps:{autoComplete:"off",fullWidth:!0,sx:{marginBottom:"0"}}},MuiSelect:{defaultProps:{fullWidth:!0}}}}),FQ=Ap(Zl,{palette:{primary:Zl.palette.augmentColor({color:{light:Wh,main:Us,dark:Ew,contrastText:Jr},name:"primary"}),secondary:Zl.palette.augmentColor({color:{light:BQ,main:_i,dark:VQ,contrastText:Jr},name:"secondary"}),blue:Zl.palette.augmentColor({color:{50:Wr[50],100:Wr[100],200:Wr[200],300:Wr[300],400:Wr[400],500:Wr[500],600:Wr[600],700:Wr[700],800:Wr[800],900:Wr[900]},name:"blue"}),gray:Zl.palette.augmentColor({color:{light:$t[300],lighter:JQ,main:$t[500],dark:$t[700],contrastText:Pf,50:$t[50],100:$t[100],200:$t[200],300:$t[300],400:$t[400],500:$t[500],600:$t[600],700:$t[700],800:$t[800],900:$t[900]},name:"gray"}),warning:{main:WQ,contrastText:Jr},error:{main:IQ,contrastText:Jr},info:{main:Wr,contrastText:Jr},success:{main:_i[500],contrastText:Jr},common:{black:Pf,white:Jr}},components:{MuiButton:{variants:[{props:{variant:"contained",color:"primary"},style:{backgroundColor:`${Us}`,fontWeight:700,"&:hover":{backgroundColor:`${Ew}`},"&:disabled":{color:gf}}},{props:{variant:"contained",color:"secondary"},style:{backgroundColor:$t[200],border:`1px solid ${$t[200]}`,color:Pf,fontWeight:600,"&:hover":{backgroundColor:$t[300],border:`1px solid ${$t[300]}`},"&:disabled":{color:gf,borderColor:"transparent"}}},{props:{variant:"contained",color:"error"},style:{fontWeight:600}},{props:{variant:"outlined",color:"primary"},style:{backgroundColor:Jr,border:`2px solid ${Us}`,color:`${Us}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Jr,borderWidth:2,border:`2px solid ${Us}`,color:`${Us}`}}},{props:{variant:"outlined",color:"secondary"},style:{backgroundColor:Jr,border:`2px solid ${_i}`,color:`${_i}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Jr,borderWidth:2,border:`2px solid ${_i}`,color:`${_i}`}}},{props:{variant:"text",color:"primary"},style:{color:`${Us}`,"&:hover":{backgroundColor:`${Wh}`},"&:focus":{backgroundColor:`${Wh}`},"&:disabled":{color:gf}}},{props:{variant:"text",color:"secondary"},style:{color:Pf,"&:hover":{backgroundColor:`${$t[50]}`},"&:focus":{backgroundColor:`${$t[50]}`},"&:disabled":{color:gf}}}]}}}),YQ=new URL(window.location.href),qQ=new rN;fA.createRoot(document.getElementById("root")).render(f.jsx(Oe.StrictMode,{children:f.jsx(dB,{basename:YQ.pathname.indexOf("hub")===-1?tv:Gt,children:f.jsx(rq,{children:f.jsxs(Mz,{theme:FQ,children:[f.jsx(Hk,{}),f.jsx(lN,{client:qQ,children:f.jsx(NQ,{})})]})})})})); +*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",i=0;i{const r=uU("button-group",t);return f.jsx("ul",{id:e,className:r,children:P.Children.map(n,(o,s)=>f.jsx("li",{className:"button-group-item",children:o},s))})};var Ay={},fU=ct;Object.defineProperty(Ay,"__esModule",{value:!0});var Py=Ay.default=void 0,dU=fU(ut()),pU=f;Py=Ay.default=(0,dU.default)((0,pU.jsx)("path",{d:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1"}),"AddRounded");var gy={},vU=ct;Object.defineProperty(gy,"__esModule",{value:!0});var j3=gy.default=void 0,hU=vU(ut()),mU=f;j3=gy.default=(0,hU.default)((0,mU.jsx)("path",{d:"M18.3 5.71a.9959.9959 0 0 0-1.41 0L12 10.59 7.11 5.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"}),"CloseRounded");const AU=({variables:e,setVariables:t})=>{const[n,r]=P.useState([]),o=l=>{if(!l||l.length===0)return null;const c={};return l.forEach(u=>{u.key&&(c[u.key]=u.value)}),c},s=(l,c)=>{const u=[...n];c.target.name==="key"?u[l].key=c.target.value:u[l].value=c.target.value,r(u),t(o(u))},i=()=>{r([...n,{key:"",value:""}])},a=l=>{const c=[...n];c.splice(l,1),r(c),t(o(c))};return P.useEffect(()=>{e&&n.length===0&&r(()=>{const l=[];for(const[c,u]of Object.entries(e))l.push({key:c,value:u});return l})},[e,n.length]),f.jsx(qe,{id:"environment-variables",children:f.jsxs(to,{children:[n.length>0?f.jsx(nt,{sx:{pb:"16px"},children:n.map((l,c)=>f.jsxs(to,{direction:"row",gap:1,sx:{pb:"16px"},children:[f.jsx(nt,{sx:{width:"100%"},children:f.jsx(Es,{id:`environment-variable-key-${c}`,name:"key",label:"Key",placeholder:"Key",value:l.key,onChange:u=>s(c,u)})}),f.jsx(nt,{sx:{width:"100%"},children:f.jsx(Es,{id:`environment-variable-value-${c}`,name:"value",label:"Value",placeholder:"Value",value:l.value,onChange:u=>s(c,u)})}),f.jsx(nt,{children:f.jsx(Zn,{sx:{mt:"7px"},onClick:()=>a(c),"aria-label":"Remove",children:f.jsx(j3,{})})})]},`environment-variable-row-${c}`))}):f.jsx(f.Fragment,{}),f.jsx(nt,{children:f.jsx(at,{variant:"contained",color:"secondary",startIcon:f.jsx(Py,{}),onClick:i,sx:{},children:"Add Variable"})})]})})};var yy={},PU=ct;Object.defineProperty(yy,"__esModule",{value:!0});var z3=yy.default=void 0,gU=PU(ut()),yU=f;z3=yy.default=(0,gU.default)((0,yU.jsx)("path",{d:"M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1"}),"HomeRounded");var by={},bU=ct;Object.defineProperty(by,"__esModule",{value:!0});var Bd=by.default=void 0,xU=bU(ut()),wU=f;Bd=by.default=(0,xU.default)((0,wU.jsx)("path",{d:"M8.12 9.29 12 13.17l3.88-3.88c.39-.39 1.02-.39 1.41 0 .39.39.39 1.02 0 1.41l-4.59 4.59c-.39.39-1.02.39-1.41 0L6.7 10.7a.9959.9959 0 0 1 0-1.41c.39-.38 1.03-.39 1.42 0"}),"KeyboardArrowDownRounded");var xy={},HU=ct;Object.defineProperty(xy,"__esModule",{value:!0});var Vd=xy.default=void 0,jU=HU(ut()),zU=f;Vd=xy.default=(0,jU.default)((0,zU.jsx)("path",{d:"M8.12 14.71 12 10.83l3.88 3.88c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L12.7 8.71a.9959.9959 0 0 0-1.41 0L6.7 13.3c-.39.39-.39 1.02 0 1.41.39.38 1.03.39 1.42 0"}),"KeyboardArrowUpRounded");var wy={},OU=ct;Object.defineProperty(wy,"__esModule",{value:!0});var O3=wy.default=void 0,CU=OU(ut()),DU=f;O3=wy.default=(0,CU.default)((0,DU.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");Q(ha)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingLeft:e.spacing(4),paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));const SU=Q(ha)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));Q(d9)(({theme:e})=>({paddingLeft:e.spacing(4)}));const TU=({...e})=>{const t=yr(),[n,r]=Oe.useState(null),o=!!n,s=e6(t.breakpoints.down("sm")),{window:i}=e,[a,l]=P.useState(!s),[c]=Ee(Do),[,u]=Ee(no),[d,p]=P.useState([]),[y,h]=P.useState([]),[m,b]=P.useState([]),[A]=Ee(bl),{isLoading:v,error:g,data:w}=Pn({queryKey:["app-state"],queryFn:()=>Lt.get("/server/").then(C=>C.data).then(C=>C),enabled:!!c}),{isLoading:H,error:z,data:j}=Pn({queryKey:["service-data"],queryFn:()=>Lt.get("/services/").then(C=>C.data).then(C=>C),enabled:!!c}),O=()=>{l(C=>!C)};P.useEffect(()=>{!v&&w&&c&&h(()=>r3(w,c.name))},[v,w,c]),P.useEffect(()=>{!H&&j&&c&&(p(()=>e3(j,c.name).filter(C=>!vg.includes(C.name))),b(()=>t3(j,c.name)))},[H,j,c]),P.useEffect(()=>{u(z?z.message:g?g.message:void 0)},[z,g,u]),P.useEffect(()=>{l(!s)},[s]);const D=f.jsxs(qe,{children:[f.jsx(Um,{children:f.jsx(El,{disablePadding:!0,sx:{mt:10},children:f.jsxs(d9,{sx:{px:"1.5rem",mx:".5rem",backgroundColor:t.palette.primary.light,borderRadius:"8px",position:"relative",display:"flex",alignItems:"center","&::before":{content:'""',position:"absolute",left:0,top:0,bottom:0,width:"8px",backgroundColor:t.palette.primary.main,borderTopLeftRadius:"8px",borderBottomLeftRadius:"8px"},"&:hover":{backgroundColor:t.palette.gray[50],"&::before":{backgroundColor:t.palette.primary.main}}},onClick:()=>Wo(`${Gt}`),children:[f.jsx(Y6,{sx:{minWidth:"auto",mr:"8px",display:"flex",alignItems:"center"},children:f.jsx(z3,{sx:{color:t.palette.common.black,width:"28px",height:"28px"}})}),f.jsx(ha,{primary:f.jsx(Qe,{variant:"body1",sx:{fontSize:"16px",fontWeight:600,lineHeight:"1.2",position:"relative",top:"2px"},children:"Home"})})]})})}),f.jsxs(Um,{sx:{px:1},children:[f.jsx(El,{disablePadding:!0,children:f.jsx(SU,{primary:"Services",disableTypography:!0,sx:{px:"24px",py:"4px",fontSize:"14px",textTransform:"uppercase",fontWeight:600,color:"rgba(15 16 21 / 60%)"}})}),y.map((C,B)=>f.jsx(El,{disablePadding:!0,children:f.jsx(rc,{href:C.url,sx:{borderRadius:"4px",textDecoration:"none",display:"block",width:"100%",px:"24px",py:"4px",color:"rgb(15 16 21 / 87%)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",textDecoration:"none"}},children:f.jsx(ha,{primary:f.jsx(Qe,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:C.name})})})},B)),m.map((C,B)=>f.jsx(El,{disablePadding:!0,children:f.jsx(rc,{href:C.url,sx:{borderRadius:"4px",textDecoration:"none",display:"block",width:"100%",px:"24px",py:"4px",color:"rgb(15 16 21 / 87%)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",textDecoration:"none"}},children:f.jsx(ha,{primary:f.jsx(Qe,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:C.name})})})},B)),d.map((C,B)=>f.jsx(El,{disablePadding:!0,children:f.jsx(rc,{href:C.url,sx:{borderRadius:"4px",textDecoration:"none",display:"block",width:"100%",px:"24px",py:"4px",color:"rgb(15 16 21 / 87%)","&:hover":{backgroundColor:"rgba(0, 0, 0, 0.04)",textDecoration:"none"}},children:f.jsx(ha,{primary:f.jsx(Qe,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:C.name})})})},B))]})]});return f.jsxs(qe,{sx:{flexGrow:1},hidden:A,children:[f.jsx(UD,{id:"app-bar",position:"fixed",sx:{zIndex:C=>C.zIndex.drawer+1,backgroundColor:C=>C.palette.common.white},children:f.jsxs(j9,{id:"toolbar",children:[f.jsx(Zn,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:O,sx:{mr:2,display:{sm:"none"}},children:f.jsx(O3,{})}),f.jsx(qe,{component:"div",sx:{flexGrow:1,display:{xs:"none",sm:"block"}},children:f.jsx(rc,{href:Gt,children:f.jsx("img",{id:"app-logo",src:hG(),alt:"logo",height:"28"})})}),f.jsxs(qe,{sx:{display:{xs:"none",sm:"block"}},children:[f.jsxs(at,{id:"profile-menu-btn",className:"button-menu","aria-controls":o?"profile-menu-list":void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:C=>r(C.currentTarget),endIcon:o?f.jsx(Vd,{}):f.jsx(Bd,{}),sx:{"&:hover":{backgroundColor:t.palette.gray[50]}},children:[c==null?void 0:c.name," ",(c==null?void 0:c.admin)&&f.jsx(wu,{label:"admin",size:"small",className:"chip",sx:{marginLeft:t.spacing(1)}})]}),f.jsxs(tu,{id:"profile-menu-list",anchorEl:n,open:o,onClose:()=>r(null),MenuListProps:{"aria-labelledby":"profile-menu-btn"},sx:{marginTop:"20px"},children:[f.jsx(mo,{onClick:()=>Wo(`${Gt}/token`),sx:{width:"180px"},children:"Tokens"}),(c==null?void 0:c.admin)&&f.jsx(mo,{onClick:()=>Wo(`${Gt}/admin`),children:"Admin"}),f.jsx(mo,{onClick:()=>Wo(`${Gt}/logout`),children:"Logout"})]})]})]})}),f.jsx("nav",{children:f.jsx(cE,{container:i!==void 0?()=>i().document.body:void 0,variant:"persistent",open:a,onClose:O,ModalProps:{keepMounted:!0},sx:{"& .MuiDrawer-paper":{boxSizing:"border-box",width:224,boxShadow:1}},children:D})})]})},RU=({severity:e="error",message:t,onClose:n})=>f.jsx("div",{className:"alert-wrapper",children:f.jsx(QP,{id:"alert-notification",severity:e,onClose:n,children:t})}),kU=e=>{let t;switch(e){case"Ready":t={bgcolor:"rgb(255, 255, 255)",border:"1px solid rgb(46, 125, 50)",color:"rgb(46, 125, 50)"};break;case"Pending":t={bgcolor:"rgb(234, 181, 78)",color:"black"};break;case"Running":t={bgcolor:"rgb(46, 125, 50)",color:"white"};break;case"Unknown":default:t={bgcolor:"rgb(121, 121, 124)",color:"white"};break}return t},C3=({status:e,additionalInfo:t,app:n,size:r="small"})=>{const[,o]=Ee(kv),[,s]=Ee(Ev),i=()=>e==="Running"&&t?f.jsx(f.Fragment,{children:n&&!n.shared?f.jsxs(f.Fragment,{children:[f.jsxs("span",{className:"chip-label-info",style:{position:"relative",top:"1px"},children:[e," on ",t]}),f.jsx(Zn,{onClick:a=>{a.preventDefault(),a.stopPropagation(),o(n),s(!0)},"aria-label":"Stop",sx:{pl:0,position:"relative",top:0,left:"6px"},color:"inherit",disabled:n.shared,children:f.jsx(Lv,{sx:{fontSize:"16px"}})})]}):f.jsx("span",{children:e})}):e||"Default";return f.jsx(wu,{label:i(),className:e!=="Running"||!t||n!=null&&n.shared?"chip-base":"",size:r,sx:{fontWeight:600,fontSize:"12px",...kU(e)}})};var Hy={},EU=ct;Object.defineProperty(Hy,"__esModule",{value:!0});var D3=Hy.default=void 0,MU=EU(ut()),LU=f;D3=Hy.default=(0,MU.default)((0,LU.jsx)("path",{d:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"}),"Close");var jy={},XU=ct;Object.defineProperty(jy,"__esModule",{value:!0});var S3=jy.default=void 0,NU=XU(ut()),BU=f;S3=jy.default=(0,NU.default)((0,BU.jsx)("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-1 16H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h12c.55 0 1 .45 1 1v12c0 .55-.45 1-1 1m-4.44-6.19-2.35 3.02-1.56-1.88c-.2-.25-.58-.24-.78.01l-1.74 2.23c-.26.33-.02.81.39.81h8.98c.41 0 .65-.47.4-.8l-2.55-3.39c-.19-.26-.59-.26-.79 0"}),"CropOriginalRounded");var zy={},VU=ct;Object.defineProperty(zy,"__esModule",{value:!0});var T3=zy.default=void 0,IU=VU(ut()),WU=f;T3=zy.default=(0,IU.default)((0,WU.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"Error");var Oy={},JU=ct;Object.defineProperty(Oy,"__esModule",{value:!0});var R3=Oy.default=void 0,FU=JU(ut()),YU=f;R3=Oy.default=(0,FU.default)((0,YU.jsx)("path",{d:"M10 16h4c.55 0 1-.45 1-1v-5h1.59c.89 0 1.34-1.08.71-1.71L12.71 3.7a.9959.9959 0 0 0-1.41 0L6.71 8.29c-.63.63-.19 1.71.7 1.71H9v5c0 .55.45 1 1 1m-4 2h12c.55 0 1 .45 1 1s-.45 1-1 1H6c-.55 0-1-.45-1-1s.45-1 1-1"}),"UploadRounded");const qU=({id:e,name:t,currentImage:n,setCurrentImage:r,currentFile:o,setCurrentFile:s,...i})=>{const a=yr(),[l,c]=P.useState(!1),[u,d]=P.useState(!1),[p,y]=P.useState(void 0),h=P.useRef(null),m=j=>{j.preventDefault(),c(!0)},b=j=>{j.preventDefault(),c(!0)},A=j=>{j.preventDefault(),c(!1)},v=j=>{j.preventDefault(),c(!1);const O=j.dataTransfer.files[0];s(O)},g=j=>{if(!j.target.files)return;const O=5*1024*1024;if(j.target.files[0].size>O){y("File size exceeds 5MB.");return}const D=j.target.files[0];s(D),y(void 0)},w=j=>{j.preventDefault(),d(!0)},H=j=>{j.preventDefault();const O=h.current;O&&O.click()},z=j=>{j.preventDefault();const O=h.current;O&&(O.value="",s(void 0),r(void 0))};return P.useEffect(()=>{const j=h.current;if(j&&j.files&&j.files.length>0){const O=j.files[0];s(O)}},[h,s]),f.jsxs(qe,{id:`thumbnail-${e}`,className:"thumbnail",sx:{display:"flex",flexDirection:"column",columnGap:"24px",width:"100%",border:"none"},children:[p?f.jsxs(qe,{sx:{display:"flex",alignItems:"center",backgroundColor:"#FDEDED",color:a.palette.error.main,padding:"8px",borderRadius:"4px",marginBottom:"16px"},children:[f.jsx(T3,{sx:{marginRight:"8px"}}),f.jsx(Qe,{variant:"body2",sx:{flexGrow:1,width:"100%",color:a.palette.gray.main},children:f.jsxs("span",{className:"error-msg",children:[f.jsx("span",{className:"weight600",children:"File is too large."})," Maximum file size is 5MB."]})}),f.jsx(Zn,{size:"small",onClick:()=>y(void 0),sx:{color:a.palette.gray.main},children:f.jsx(D3,{})})]}):null,f.jsxs(qe,{id:`thumbnail-body-${e}`,className:`thumbnail-body ${l?"dragging":""} ${o||n?"selected":""}`,onDragOver:m,onDragEnter:b,onDragLeave:A,onDrop:v,sx:{display:"flex",flexDirection:"row",columnGap:"24px",height:"180px"},children:[f.jsxs(qe,{className:"thumbnail-dropzone",sx:{height:"130px",backgroundColor:"#90969c",borderRadius:"4px"},children:[o||n?f.jsx(qe,{sx:{margin:"auto auto"},children:f.jsx("img",{src:o?URL.createObjectURL(o):n,alt:"App thumbnail",title:"Click to view image",className:"thumbnail-img",style:{maxWidth:"225px",maxHeight:"130px",borderRadius:"4px",cursor:"pointer"},onClick:w})}):f.jsx(qe,{tabIndex:0,title:"Select an image",className:"thumbnail-icon-container",sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",width:"225px",height:"130px",cursor:"pointer","&:focus":{outlineColor:a.palette.primary.main}},onClick:H,children:f.jsx(S3,{sx:{width:"64px",height:"64px",color:a.palette.common.white}})}),f.jsx("input",{ref:h,id:e,name:t,type:"file",accept:"image/*",onChange:g,style:{display:"none"},...i})]}),f.jsxs(qe,{sx:{display:"flex",flexDirection:"column",rowGap:"16px"},children:[f.jsxs(qe,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},columnGap:"16px",rowGap:"12px",height:"40px"},children:[f.jsx(at,{id:"upload-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(R3,{}),onClick:H,sx:{width:"100%",maxWidth:"170px"},children:"Select an image"}),o||n?f.jsx(at,{id:"remove-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(Mv,{}),onClick:z,hidden:!o&&!n,sx:{width:"100%",maxWidth:"170px"},children:"Remove image"}):f.jsx(f.Fragment,{})]}),f.jsx(Qe,{variant:"body1",sx:{color:"#0F101599",width:"340px",display:{xs:"none",md:"block"}},children:"Recommended size: 225x130 | JPG, PNG, Max size: 5MB"})]})]}),f.jsx(tc,{onClose:()=>d(!1),open:u,children:f.jsx("img",{src:o?URL.createObjectURL(o):n,alt:"App thumbnail"})})]})};var Cy={},ZU=ct;Object.defineProperty(Cy,"__esModule",{value:!0});var Nv=Cy.default=void 0,GU=ZU(ut()),UU=f;Nv=Cy.default=(0,GU.default)((0,UU.jsx)("path",{d:"M19 11H7.83l4.88-4.88c.39-.39.39-1.03 0-1.42a.9959.9959 0 0 0-1.41 0l-6.59 6.59c-.39.39-.39 1.02 0 1.41l6.59 6.59c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L7.83 13H19c.55 0 1-.45 1-1s-.45-1-1-1"}),"ArrowBackRounded");const Bv=Q("p")(()=>({maxWidth:600,paddingBottom:"30px"})),QU=()=>{const[e]=Ee(bl);return f.jsx(qe,{className:"container",children:f.jsxs(to,{children:[f.jsx(nt,{hidden:e,children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(at,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Nv,{}),onClick:()=>Wo(Gt),children:"Back To Home"})})}),f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"Deploy a new app"}),f.jsxs(Bv,{children:["Begin your project by entering the details below. For more information about deploying an app,"," ",f.jsx("a",{href:"https://jhub-apps.nebari.dev/docs/category/create-apps",target:"_blank",rel:"noopener noreferrer",className:"form-paragraph-link",children:"visit our docs"}),"."]})]}),f.jsx(nt,{children:f.jsx(g3,{})})]})})},KU=()=>{const[e]=Ee(bl),[t]=ju(),n=t.get("id");return f.jsx(qe,{className:"container",children:f.jsxs(to,{children:[f.jsx(nt,{hidden:e,children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(at,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Nv,{}),onClick:()=>Wo(Gt),children:"Back To Home"})})}),f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"Edit app"}),f.jsxs(Bv,{children:["Edit your app details here. For more information on editing your app,"," ",f.jsx("a",{href:"https://jhub-apps.nebari.dev/docs/reference/create-app-form",target:"_blank",rel:"noopener noreferrer",className:"form-paragraph-link",children:"visit our docs"}),"."]})]}),f.jsx(nt,{children:f.jsx(f.Fragment,{children:n?f.jsx(g3,{id:n}):f.jsx(f.Fragment,{children:"No app found."})})})]})})};var Dy={},_U=ct;Object.defineProperty(Dy,"__esModule",{value:!0});var k3=Dy.default=void 0,$U=_U(ut()),eQ=f;k3=Dy.default=(0,$U.default)((0,eQ.jsx)("path",{d:"M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"}),"Check");var Sy={},tQ=ct;Object.defineProperty(Sy,"__esModule",{value:!0});var E3=Sy.default=void 0,nQ=tQ(ut()),rQ=f;E3=Sy.default=(0,nQ.default)((0,rQ.jsx)("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14"}),"Search");var Ty={},oQ=ct;Object.defineProperty(Ty,"__esModule",{value:!0});var M3=Ty.default=void 0,sQ=oQ(ut()),iQ=f;M3=Ty.default=(0,sQ.default)((0,iQ.jsx)("path",{d:"M4.25 5.61C6.57 8.59 10 13 10 13v5c0 1.1.9 2 2 2s2-.9 2-2v-5s3.43-4.41 5.75-7.39c.51-.66.04-1.61-.8-1.61H5.04c-.83 0-1.3.95-.79 1.61"}),"FilterAltRounded");var Ry={},aQ=ct;Object.defineProperty(Ry,"__esModule",{value:!0});var L3=Ry.default=void 0,lQ=aQ(ut()),cQ=f;L3=Ry.default=(0,lQ.default)((0,cQ.jsx)("path",{d:"M4 18h4c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1M3 7c0 .55.45 1 1 1h16c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1m1 6h10c.55 0 1-.45 1-1s-.45-1-1-1H4c-.55 0-1 .45-1 1s.45 1 1 1"}),"SortRounded");var ky={},uQ=ct;Object.defineProperty(ky,"__esModule",{value:!0});var X3=ky.default=void 0,fQ=uQ(ut()),dQ=f;X3=ky.default=(0,fQ.default)((0,dQ.jsx)("path",{d:"M11 21H5c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h6zm2 0h6c1.1 0 2-.9 2-2v-7h-8zm8-11V5c0-1.1-.9-2-2-2h-6v7z"}),"SpaceDashboard");var Ey={},pQ=ct;Object.defineProperty(Ey,"__esModule",{value:!0});var N3=Ey.default=void 0,vQ=pQ(ut()),hQ=f;N3=Ey.default=(0,vQ.default)((0,hQ.jsx)("path",{d:"M21 8H3V4h18zm0 2H3v4h18zm0 6H3v4h18z"}),"TableRows");const mQ=Q(at)(({theme:e})=>({color:e.palette.common.black,borderColor:e.palette.common.black,"&:hover":{color:e.palette.common.black,borderColor:e.palette.common.black},marginRight:"16px"})),AQ=({data:e,currentUser:t,isGridViewActive:n,toggleView:r,setApps:o})=>{const[s]=Ee(Y5),[i,a]=Oe.useState(null),[l,c]=Oe.useState(null),u=!!i,d=!!l,[p,y]=Ee(q5),[h,m]=Ee(G5),[b,A]=Ee(U5),[v,g]=Ee(Q5),[w,H]=P.useState(0),{data:z,isLoading:j}=Pn({queryKey:["app-frameworks"],queryFn:()=>Lt.get("/frameworks/").then(L=>L.data)}),O=L=>{const G=L.target.value;p.includes(G)?y(E=>E.filter(V=>V!==G)):y(E=>[...E,G])},D=L=>{m(L)},C=L=>{A(L),o(Jf(e,t,s,h,p,L,v)),c(null)},B=L=>{const G=L.target.value;v.includes(G)?g(E=>E.filter(V=>V!==G)):g(E=>[...E,G])},R=()=>{a(null),o(Jf(e,t,s,h,p,b,v))},k=()=>{y([]),m("Any"),g([])},J=P.useCallback(()=>Jf(e,t,s,h,p,b,v).length,[e,t,s,h,p,b,v]);return P.useEffect(()=>{H(J())},[J]),f.jsxs(xo,{container:!0,spacing:2,paddingBottom:"32px",children:[f.jsx(xo,{item:!0,xs:12,md:4,children:f.jsxs(nt,{sx:{pb:0},children:[f.jsx(mQ,{id:"filters-btn",variant:"text",color:"secondary",onClick:L=>a(L.currentTarget),startIcon:f.jsx(M3,{}),sx:{fontSize:"16px",fontWeight:600,top:"-8px",background:"none"},endIcon:u?f.jsx(Vd,{}):f.jsx(Bd,{}),disabled:j||!1,children:"Filters"}),f.jsx(tu,{id:"filters-list",anchorEl:i,open:u,onClose:()=>a(null),MenuListProps:{"aria-labelledby":"filters-btn",style:{paddingTop:0,paddingBottom:0},sx:{".MuiFormLabel-root":{fontSize:"14px"},".MuiFormControlLabel-label":{fontSize:"14px"}}},children:f.jsxs(qe,{component:"form",name:"filters-form",id:"filters-form",sx:{width:"450px",px:"16px",pb:0,mt:3},children:[f.jsx(Nf,{id:"frameworks-label",sx:{py:"16px",fontWeight:600},children:"Frameworks"}),f.jsx(qe,{children:z==null?void 0:z.map(L=>f.jsx(ii,{control:f.jsx(Jb,{value:L.display_name}),label:L.display_name,sx:{width:"120px","& > :last-child":{minWidth:"100%"}},onClick:O,checked:p.includes(L.display_name)},L.name))}),f.jsx(rl,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Nf,{id:"server-statuses-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Server Status"}),f.jsx(qe,{children:WX.map(L=>f.jsx(ii,{control:f.jsx(Jb,{value:L}),label:L,onClick:B,checked:v.includes(L)},L))}),f.jsx(rl,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Nf,{id:"ownership-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Ownership"}),f.jsx(qe,{children:f.jsx(Km,{"aria-labelledby":"ownership-label",defaultValue:"any",name:"ownership-group",sx:{"& .MuiFormControlLabel-root":{pb:"3px"}},row:!0,children:VX.map(L=>f.jsx(ii,{control:f.jsx(Qm,{value:L}),label:L,onClick:()=>D(L),checked:h===L},L))})}),f.jsx(qe,{sx:{backgroundColor:"#EEE",p:1,pt:.75,mx:-2,width:"auto",fontSize:"14px"},children:f.jsxs(ic,{children:[f.jsx(at,{id:"clear-filters-btn","data-testid":"clear-filters-btn",variant:"text",sx:{color:"#0F1015",display:"flex",alignItems:"center"},size:"small",onClick:k,children:"Clear"}),f.jsxs(at,{id:"apply-filters-btn",variant:"contained",size:"small",onClick:R,sx:{px:"none !important",minWidth:"20px"},children:["Show ",w," results"]})]})})]})})]})}),f.jsxs(xo,{container:!0,item:!0,xs:8,md:8,direction:"row",sx:{display:"flex",justifyContent:"flex-end",flexWrap:"nowrap"},children:[f.jsx(nt,{children:f.jsxs(qe,{sx:{display:"flex",flexDirection:"row"},children:[f.jsxs(at,{id:"sort-by-btn",variant:"text",color:"secondary",onClick:L=>c(L.currentTarget),sx:{position:"relative",bottom:"8px",fontSize:"16px",fontWeight:600,color:"common.black",mr:"24px"},endIcon:d?f.jsx(Vd,{}):f.jsx(Bd,{}),children:[f.jsx(L3,{sx:{position:"relative",marginRight:"8px"}}),b]}),f.jsx(tu,{id:"sort-by-list",anchorEl:l,open:d,onClose:()=>c(null),MenuListProps:{"aria-labelledby":"sort-by-btn"},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},sx:{transform:"translateX(-85px)",".MuiFormControlLabel-label":{fontSize:"14px"}},children:f.jsx(qe,{component:"form",name:"sort-by-form",sx:{px:"16px",width:"220px"},children:f.jsx(Km,{defaultValue:"any",name:"sort-by-group","aria-describedby":"sort-by-label",children:IX.map(L=>f.jsx(ii,{control:f.jsx(Qm,{value:L}),label:L,onClick:()=>C(L),checked:b===L},L))})})})]})}),f.jsx(nt,{children:f.jsxs(qe,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around",border:"1px solid #DFDFE0",borderRadius:"4px",position:"relative",top:"-6px"},children:[f.jsx(at,{onClick:r,disabled:n,"aria-label":"Grid View",sx:{color:"inherit",backgroundColor:n?"#E8E8EA":"transparent",boxShadow:"none",padding:"5px",minWidth:"auto",borderRadius:"4px 0px 0px 4px",borderRight:"1px solid #DFDFE0","&:hover":{backgroundColor:n?"#E8E8EA":"transparent",boxShadow:"none"}},children:f.jsx(X3,{sx:{color:n?"#2E2F33":"#76777B"}})}),f.jsx(at,{onClick:r,disabled:!n,"aria-label":"Table View",sx:{color:"inherit",backgroundColor:n?"transparent":"#E8E8EA",boxShadow:"none",borderRadius:"0px 4px 4px 0px",padding:"5px",minWidth:"auto","&:hover":{backgroundColor:n?"transparent":"#E8E8EA",boxShadow:"none"}},children:f.jsx(N3,{sx:{color:n?"#76777B":"#2E2F33"}})})]})})]})]})},PQ=({apps:e})=>f.jsx(f.Fragment,{children:e.map((t,n)=>P.createElement(kA,{...t,key:`app-${t.id}-${n}`,title:t.name,serverStatus:t.status,lastModified:t.last_activity,isPublic:t.public,isShared:t.shared,app:t}))});var My={},gQ=ct;Object.defineProperty(My,"__esModule",{value:!0});var B3=My.default=void 0,yQ=gQ(ut()),bQ=f;B3=My.default=(0,yQ.default)((0,bQ.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M9.5 14.67V9.33c0-.79.88-1.27 1.54-.84l4.15 2.67c.61.39.61 1.29 0 1.68l-4.15 2.67c-.66.43-1.54-.05-1.54-.84"}),"PlayCircleRounded");const xQ=({apps:e})=>{const[,t]=P.useState(""),[n,r]=P.useState(e),[,o]=Ee(no),[,s]=Ee(kv),[,i]=Ee(Qg),[,a]=Ee(Ev),[,l]=Ee(Kg),c=e.map(d=>d.status);P.useEffect(()=>{c&&t(c.join(", "))},[c,o]),P.useEffect(()=>{r(e)},[e]);const u=(d,p)=>d?f.jsx(Ov,{"data-testid":"PublicRoundedIcon",fontSize:"small",className:"align-vertical-center"}):p?f.jsx(zv,{"data-testid":"GroupRoundedIcon",fontSize:"small",className:"align-vertical-center"}):f.jsx(Wg,{"data-testid":"LockRoundedIcon",fontSize:"small",className:"align-vertical-center"});return f.jsx(f.Fragment,{children:f.jsx(qe,{sx:{height:"100%",width:"100%"},children:f.jsx(H9,{component:Ar,children:f.jsxs(x9,{sx:{minWidth:650},"aria-label":"App table",children:[f.jsx(cX,{children:f.jsxs(jd,{className:"app-header",children:[f.jsx(En,{children:"Name"}),f.jsx(En,{children:"Status"}),f.jsx(En,{children:"Created by"}),f.jsx(En,{children:"Tags"}),f.jsx(En,{children:"Actions"})]})}),f.jsx(w9,{children:n.map(d=>f.jsxs(jd,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[f.jsxs(En,{component:"th",scope:"row",children:[u(d.public,d.shared),f.jsx("span",{className:"inline relative icon-text",children:d.name})]}),f.jsx(En,{children:f.jsx(C3,{status:d.status,size:"medium"})}),f.jsx(En,{children:d.username}),f.jsx(En,{children:f.jsx(wu,{label:d.framework,variant:"outlined",size:"medium"})}),f.jsxs(En,{children:[d.status==="Running"?f.jsx(at,{onClick:()=>{a(!0),s(d)},"aria-label":"Stop",color:"inherit",size:"small",className:"action-button","data-testid":"StopCircleRoundedIcon",disabled:d.shared,children:f.jsx(Lv,{})}):f.jsx(at,{onClick:()=>{i(!0),s(d)},"aria-label":"Start",color:"inherit",size:"small",className:"action-button","data-testid":"PlayCircleRoundedIcon",disabled:d.status==="Pending"||d.status==="Unknown",style:{borderRadius:"50%",minWidth:"none"},children:f.jsx(B3,{})}),f.jsx(at,{onClick:()=>window.location.href=`${tv}/edit-app?id=${d.id}`,"aria-label":"Edit",color:"inherit",size:"small",className:"action-button","data-testid":"EditRoundedIcon",disabled:d.shared,style:{borderRadius:"50%",minWidth:"none"},children:f.jsx(ey,{})}),f.jsx(at,{onClick:()=>{l(!0),s(d)},"aria-label":"Delete",color:"inherit",size:"small",className:"action-button","data-testid":"DeleteRoundedIcon",disabled:d.shared,style:{borderRadius:"50%",minWidth:"none"},children:f.jsx(Mv,{})})]})]},d.id))})]})})})})},wQ=()=>{const[e,t]=P.useState([]),[,n]=P.useState(""),[r]=Ee(Do),[o,s]=P.useState(!1),[,i]=Ee(no),[a,l]=P.useState(!0),[,c]=Ee(Y5),[u]=Ee(q5),[d]=Ee(G5),[,p]=Ee(no),[y]=Ee(U5),[h]=Ee(Q5),m=()=>l(w=>!w),{isLoading:b,error:A,data:v}=Pn({queryKey:["app-state"],queryFn:()=>Lt.get("/server/").then(w=>w.data).then(w=>w),enabled:!!r}),g=w=>{const H=w.target;c(H.value),v&&r&&t(Jf(v,r,H.value,d,u,y,h))};return P.useEffect(()=>{const w=e.map(H=>H.status);w&&n(w.join(", "))},[e,p,n]),P.useEffect(()=>{if(!b&&v){const w=n3(v,"all",(r==null?void 0:r.name)??"").map(H=>({...H,status:oy(H)})).sort((H,z)=>H.last_activity>z.last_activity?-1:1);t(w)}},[b,v,r]),P.useEffect(()=>{i(A?A.message:void 0)},[A,i]),f.jsx(f.Fragment,{children:f.jsx(qe,{children:f.jsxs(to,{children:[f.jsx(nt,{children:f.jsxs(xo,{container:!0,spacing:2,alignItems:"center",children:[f.jsx(xo,{item:!0,xs:12,md:4,sx:{padding:"0"},children:f.jsx(nt,{children:f.jsx(Qe,{component:"h2",variant:"h6",children:"App Library"})})}),f.jsxs(xo,{alignItems:"center",container:!0,item:!0,xs:12,md:8,direction:"row",sx:{display:"flex",flexWrap:"nowrap",justifyContent:{xs:"flex-start",md:"flex-end"}},children:[f.jsx(nt,{children:f.jsx(Es,{id:"search",size:"small",placeholder:"Search Apps...","aria-label":"Search for an app",onChange:g,onFocus:()=>s(!0),onBlur:()=>s(!1),sx:{my:"0",width:{sm:"200px",md:"300px",lg:"600px"},mr:"16px",color:"rgba(15, 16, 21, 0.56)",backgroundColor:"#fff","& .MuiOutlinedInput-root":{"& fieldset":{borderColor:"rgba(15, 16, 21, 0.12)"},"&:hover fieldset":{borderColor:"rgba(15, 16, 21, 0.56)"},"&.Mui-focused fieldset":{borderColor:"#ba18da"}}},InputProps:{startAdornment:f.jsx(cg,{position:"start",children:!o&&f.jsx(E3,{style:{fill:"rgba(15, 16, 21, 0.56)"}})})}})}),f.jsx(nt,{children:f.jsx(at,{id:"create-app",variant:"contained",color:"primary",size:"large",startIcon:f.jsx(Py,{}),onClick:()=>{window.location.href=`${tv}/create-app`},children:"Deploy App"})})]})]})}),f.jsx(nt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(rl,{})}),f.jsx(nt,{children:v&&r?f.jsx(AQ,{data:v,currentUser:r,setApps:t,isGridViewActive:a,toggleView:m}):f.jsx(f.Fragment,{})}),f.jsx(nt,{children:f.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,rowGap:2,justifyContent:"flex-start",paddingBottom:"48px"},children:b?f.jsx("div",{className:"font-bold",children:"Loading..."}):e.length>0?a?f.jsx(PQ,{apps:e}):f.jsx(xQ,{apps:e}):f.jsx("div",{children:"No apps available"})})})]})})})},HQ=({services:e,apps:t})=>f.jsxs(f.Fragment,{children:[t.map((n,r)=>P.createElement(kA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1,app:n})),e.map((n,r)=>P.createElement(kA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1}))]}),jQ=()=>{const[e]=Ee(Do),[,t]=Ee(no),[n,r]=P.useState([]),[o,s]=P.useState([]),{isLoading:i,error:a,data:l}=Pn({queryKey:["service-data"],queryFn:()=>Lt.get("/services/").then(p=>p.data).then(p=>p),enabled:!!e}),{isLoading:c,error:u,data:d}=Pn({queryKey:["app-state"],queryFn:()=>Lt.get("/server/").then(p=>p.data).then(p=>p),enabled:!!e});return P.useEffect(()=>{!i&&l&&e&&r(()=>t3(l,e.name))},[i,l,e]),P.useEffect(()=>{!c&&d&&e&&s(()=>r3(d,e.name))},[c,d,e]),P.useEffect(()=>{t(a?a.message:u?u.message:void 0)},[a,u,t]),f.jsx(qe,{children:f.jsxs(to,{children:[f.jsx(nt,{children:f.jsx(xo,{container:!0,spacing:2,children:f.jsx(xo,{item:!0,xs:12,md:4,children:f.jsx(nt,{children:f.jsx(Qe,{component:"h2",variant:"h6",children:"Quick Access"})})})})}),f.jsx(nt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(rl,{})}),f.jsx(nt,{children:f.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:"16px",justifyContent:"flex-start",paddingBottom:"48px"},children:i||c?f.jsx("div",{className:"font-bold",children:"Loading..."}):n.length>0||o.length>0?f.jsx(HQ,{services:n,apps:o}):f.jsx("div",{children:"No services available"})})})]})})},zQ=()=>f.jsx(Uf,{sx:{backgroundColor:"green",color:"white",borderRadius:"50%",padding:"2px"},children:f.jsx(k3,{})}),kw=()=>{const[,e]=Ee(no),[t,n]=Ee(kv),[r]=Ee(Do),[o,s]=P.useState(null),[i,a]=Ee(Qg),[l,c]=Ee(Ev),[u,d]=Ee(Kg),[p,y]=Ee(K5),[h,m]=P.useState(!1),b=nv(),[A,v]=P.useState(!1),[g,w]=P.useState(""),[H,z]=P.useState("success"),j=async({id:T})=>await Lt.post(`/server/${T}`),O=async({id:T,remove:K})=>await Lt.delete(`/server/${T}`,{params:{remove:K}}),{data:D}=Pn({queryKey:["app-form",o],queryFn:()=>Lt.get(`/server/${o}`).then(T=>T.data),enabled:!!o}),{data:C}=Pn({queryKey:["current-user"],queryFn:()=>Lt.get("/user").then(T=>T.data),enabled:!0}),{mutate:B}=ol({mutationFn:j,retry:1}),{mutate:R}=ol({mutationFn:O,retry:1}),k=()=>{const T=(t==null?void 0:t.id)||"";m(!0),R({id:T,remove:!0},{onSuccess:async()=>{m(!1),d(!1),b.invalidateQueries({queryKey:["app-state"]}),w("App deleted successfully"),v(!0)},onError:async K=>{m(!1),e(K.message)}})},J=T=>typeof T=="object"&&T!==null&&"response"in T,L=async()=>{const T=(t==null?void 0:t.id)||"";if(m(!0),a(!1),y(!1),(t==null?void 0:t.shared)&&!(C!=null&&C.admin)){m(!1),w("You don't have permission to start this app. Please ask the owner to start it."),z("error"),v(!0);return}B({id:T},{onSuccess:async()=>{m(!1),b.invalidateQueries({queryKey:["app-state"]}),w("App started successfully"),z("success"),v(!0)},onError:Z=>{var se;if(m(!1),J(Z)){const ee=(se=Z.response)==null?void 0:se.status;w(ee===403?"You don't have permission to start this app. Please ask the owner to start it.":ee===404?"App not found (404).":ee===500?"Internal server error (500).":"An unknown server error occurred.")}else w("An unknown error occurred.");z("error"),v(!0)}})},q=async()=>{const T=(t==null?void 0:t.id)||"";if(m(!0),c(!1),(t==null?void 0:t.shared)&&!(C!=null&&C.admin)){m(!1),w("You don't have permission to stop this app. Please ask the owner to stop it."),z("error"),v(!0);return}R({id:T,remove:!1},{onSuccess:()=>{m(!1),b.invalidateQueries({queryKey:["app-state"]}),w("Server stopped successfully"),z("success"),v(!0)},onError:Z=>{var se;if(m(!1),J(Z)){const ee=(se=Z.response)==null?void 0:se.status;w(ee===403?"You don't have permission to stop this app. Please ask the owner to stop it.":ee===404?"App not found (404).":ee===500?"Internal server error (500).":"An unknown server error occurred.")}else w("An unknown error occurred.");z("error"),v(!0)}})},G=async()=>{if(!r||!t){m(!1);return}window.location.assign(mG(r,t))},E=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"card-dialog-body-wrapper",children:[f.jsxs("p",{className:"card-dialog-body",children:["Are you sure you want to start ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]}),f.jsx("p",{className:"card-dialog-note",children:"This action starts a new server that consumes resources."})]}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>a(!1),sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"start-btn","data-testid":"start-btn",variant:"contained",color:"primary",onClick:L,disabled:h,children:"Start"})]})]}),V=f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"card-dialog-body-wrapper",children:f.jsxs("p",{className:"card-dialog-body",children:["Are you sure you want to stop ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]})}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn",variant:"text",color:"primary",onClick:()=>c(!1),sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"stop-btn",variant:"contained",color:"primary",onClick:q,disabled:h,children:"Stop"})]})]}),W=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"card-dialog-body-wrapper",children:[f.jsxs("p",{className:"card-dialog-body",children:["Are you sure you want to delete ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]}),f.jsx("p",{className:"card-dialog-note",children:"This action is permanent and cannot be reversed."})]}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>d(!1),sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"delete-btn","data-testid":"delete-btn",variant:"contained",color:"error",onClick:k,disabled:h,children:"Delete"})]})]}),de=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"card-dialog-body-wrapper",children:[f.jsxs("p",{className:"card-dialog-body",children:["Would you like to start ",f.jsx("b",{children:t==null?void 0:t.name}),"?"]}),f.jsx("p",{className:"card-dialog-note",children:"This action starts a new server that consumes resources."})]}),f.jsxs(ic,{className:"card-dialog-button-group",children:[f.jsx(at,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>{Nh(),y(!1)},sx:{fontWeight:700},children:"Cancel"}),f.jsx(at,{id:"start-btn","data-testid":"start-btn",variant:"contained",color:"primary",onClick:()=>{Nh(),PG((t==null?void 0:t.name)||"")?G():L()},disabled:h,children:"Start"})]})]});return P.useEffect(()=>{if(D&&!D.started&&o){let T=D.user_options.display_name;!T&&o==="lab"?T="JupyterLab":!T&&o==="vscode"&&(T="VSCode"),n({id:o,name:T,framework:D.user_options.framework,url:D.url,ready:D.ready,public:D.user_options.public,shared:!1,last_activity:new Date(D.last_activity),status:"Ready"}),y(!0),Nh()}},[D,o,y,n]),P.useEffect(()=>{const T=gG();T&&s(T)},[s]),f.jsxs(qe,{sx:{flexGrow:1},className:"container",children:[f.jsx(xo,{container:!0,spacing:2,paddingBottom:"24px",children:f.jsx(xo,{item:!0,xs:12,md:2,children:f.jsx(nt,{children:f.jsx(Qe,{component:"h1",variant:"h5",children:"Home"})})})}),f.jsx(jQ,{}),f.jsx(wQ,{}),i&&f.jsxs(tc,{open:i,onClose:()=>a(!1),"data-testid":"StartModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700},children:"Start App"}),f.jsx(af,{sx:{padding:"0px"},children:E})]}),l&&f.jsxs(tc,{open:l,onClose:()=>c(!1),"data-testid":"StopModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700,pb:1},children:"Stop App"}),f.jsx(af,{sx:{padding:"0px"},children:V})]}),u&&f.jsxs(tc,{open:u,onClose:()=>d(!1),"data-testid":"DeleteModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700},children:"Delete App"}),f.jsx(af,{sx:{padding:"0px"},children:W})]}),p&&f.jsxs(tc,{open:p,onClose:()=>y(!1),"data-testid":"StartNotRunningModal",sx:{".MuiPaper-root":{width:"444px"}},children:[f.jsx(lf,{sx:{fontWeight:700},children:"Server Not Running"}),f.jsx(af,{sx:{padding:"0px"},children:de})]}),f.jsx(gL,{open:A,autoHideDuration:6e3,onClose:()=>v(!1),anchorOrigin:{vertical:"top",horizontal:"center"},sx:{top:"90px !important"},children:f.jsx(QP,{onClose:()=>v(!1),severity:H,icon:H==="success"?f.jsx(zQ,{}):f.jsx(ma,{}),sx:{width:"100%",fontFamily:"Inter, sans-serif",fontWeight:600,backgroundColor:H==="success"?"#D1FAE5":"#FEE2E2",color:H==="success"?"#065F46":"#B91C1C"},children:g})})]})},OQ=()=>{const[e,t]=Oe.useState(null),[n]=Ee(Do),{data:r}=Pn({queryKey:["app-form",e],queryFn:()=>Lt.get(`/server/${e}`).then(o=>o.data),enabled:!!e});return P.useEffect(()=>{if(n){const o=window.location.pathname.replace(/\/$/,"").split("/").pop();o&&t(o)}},[n]),P.useEffect(()=>{r&&(r!=null&&r.started?window.location.assign(window.location.href.replace("/hub","")):r!=null&&r.pending&&n&&e?window.location.assign(AG(n,e)):(r!=null&&r.stopped&&e&&yG(e),window.location.assign(Gt)))},[r,e,n]),f.jsx(qe,{sx:{margin:"auto auto"},children:f.jsx(sg,{})})};function CQ(e){return Se("MuiLoadingButton",e)}const ko=Te("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),DQ=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],SQ=e=>{const{loading:t,loadingPosition:n,classes:r}=e,o={root:["root",t&&"loading"],startIcon:[t&&`startIconLoading${$(n)}`],endIcon:[t&&`endIconLoading${$(n)}`],loadingIndicator:["loadingIndicator",t&&`loadingIndicator${$(n)}`]},s=Re(o,CQ,r);return x({},r,s)},TQ=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",RQ=Q(at,{shouldForwardProp:e=>TQ(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${ko.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${ko.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>x({[`& .${ko.startIconLoadingStart}, & .${ko.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0}},e.loadingPosition==="center"&&{transition:t.transitions.create(["background-color","box-shadow","border-color"],{duration:t.transitions.duration.short}),[`&.${ko.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${ko.startIconLoadingStart}, & .${ko.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${ko.startIconLoadingStart}, & .${ko.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),kQ=Q("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.loadingIndicator,t[`loadingIndicator${$(n.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>x({position:"absolute",visibility:"visible",display:"flex"},t.loadingPosition==="start"&&(t.variant==="outlined"||t.variant==="contained")&&{left:t.size==="small"?10:14},t.loadingPosition==="start"&&t.variant==="text"&&{left:6},t.loadingPosition==="center"&&{left:"50%",transform:"translate(-50%)",color:(e.vars||e).palette.action.disabled},t.loadingPosition==="end"&&(t.variant==="outlined"||t.variant==="contained")&&{right:t.size==="small"?10:14},t.loadingPosition==="end"&&t.variant==="text"&&{right:6},t.loadingPosition==="start"&&t.fullWidth&&{position:"relative",left:-10},t.loadingPosition==="end"&&t.fullWidth&&{position:"relative",right:-10})),EQ=P.forwardRef(function(t,n){const r=P.useContext(r9),o=dp(r,t),s=ke({props:o,name:"MuiLoadingButton"}),{children:i,disabled:a=!1,id:l,loading:c=!1,loadingIndicator:u,loadingPosition:d="center",variant:p="text"}=s,y=fe(s,DQ),h=Ho(l),m=u??f.jsx(sg,{"aria-labelledby":h,color:"inherit",size:16}),b=x({},s,{disabled:a,loading:c,loadingIndicator:m,loadingPosition:d,variant:p}),A=SQ(b),v=c?f.jsx(kQ,{className:A.loadingIndicator,ownerState:b,children:m}):null;return f.jsxs(RQ,x({disabled:a||c,id:h,ref:n},y,{variant:p,classes:A,ownerState:b,children:[b.loadingPosition==="end"?i:v,b.loadingPosition==="end"?v:i]}))}),MQ=()=>{const[e]=ju(),t=xg(),n=nv(),[r,o]=P.useState(!1),[s]=Ee(Do),[,i]=Ee(no),[a,l]=Ee(W5),[c]=Ee(I5),[u]=Ee(F5),[d]=Ee(J5),[,p]=Ee(no),[y,h]=Oe.useState((a==null?void 0:a.profile)||""),[m]=Ee(bl),b=e.get("id"),{data:A,isLoading:v,error:g}=Pn({queryKey:["server-types"],queryFn:()=>Lt.get("/spawner-profiles/").then(C=>C.data).then(C=>C),enabled:!!s}),w=C=>{h(C),a&&l({...a,profile:C})},H=C=>{var k,J;C.preventDefault();const B=(a==null?void 0:a.display_name)||"",R={servername:c||B,user_options:{jhub_app:!0,display_name:(a==null?void 0:a.display_name)||"",description:(a==null?void 0:a.description)||"",framework:(a==null?void 0:a.framework)||"",thumbnail:(a==null?void 0:a.thumbnail)||"",filepath:(a==null?void 0:a.filepath)||"",conda_env:(a==null?void 0:a.conda_env)||"",env:RA(a==null?void 0:a.env),custom_command:(a==null?void 0:a.custom_command)||"",profile:(a==null?void 0:a.profile)||"",public:(a==null?void 0:a.is_public)||!1,share_with:{users:((k=a==null?void 0:a.share_with)==null?void 0:k.users)||[],groups:((J=a==null?void 0:a.share_with)==null?void 0:J.groups)||[]},keep_alive:(a==null?void 0:a.keep_alive)||!1}};o(!0),b?D(R,{onSuccess:async()=>{n.invalidateQueries({queryKey:["app-state"]}),window.location.assign(Gt)},onError:async L=>{o(!1),p(L.message)}}):O(R,{onSuccess:async L=>{const q=s==null?void 0:s.name;if(q&&(L==null?void 0:L.length)>1){const G=L[1];m?t(`/success?id=${G}`):window.location.assign(`/hub/spawn-pending/${q}/${G}`)}},onError:async L=>{o(!1),p(L.message)}})},z=async({servername:C,user_options:B})=>{const R={accept:"application/json","Content-Type":"multipart/form-data"},k=new FormData;return k.append("data",JSON.stringify({servername:C,user_options:B})),u&&k.append("thumbnail",u),(await Lt.post("/server",k,{headers:R})).data},j=async({servername:C,user_options:B})=>{const R={accept:"application/json","Content-Type":"multipart/form-data"},k=new FormData;return k.append("data",JSON.stringify({servername:C,user_options:B})),u?k.append("thumbnail",u):d&&k.append("thumbnail_data_url",d),(await Lt.put(`/server/${C}`,k,{headers:R})).data},{mutate:O}=ol({mutationFn:z,retry:1}),{mutate:D}=ol({mutationFn:j,retry:1});return P.useEffect(()=>{i(g?g.message:void 0)},[g,i]),f.jsx(qe,{className:"container",children:f.jsxs(to,{children:[f.jsx(nt,{hidden:m,children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(at,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Nv,{}),onClick:()=>Wo(Gt),children:"Back To Home"})})}),f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"Server Type"}),f.jsxs(Bv,{children:["Please select the appropriate server for your app. For more information on server types,"," ",f.jsx("span",{children:f.jsx("a",{href:"https://www.nebari.dev/docs/welcome",target:"_blank",rel:"noopener noreferrer",className:"form-paragraph-link",children:"visit our docs"})}),"."]})]}),f.jsx(nt,{children:v?f.jsx("div",{className:"font-bold center",children:"Loading..."}):A&&A.length>0?f.jsxs("form",{className:"form",onSubmit:H,children:[f.jsx(na,{sx:{pb:"36px"},children:f.jsx(Km,{children:A==null?void 0:A.map((C,B)=>f.jsx(s9,{className:"server-type-card",onClick:()=>w(C.slug),tabIndex:0,children:f.jsxs(qm,{children:[f.jsx(ii,{value:C.slug,id:C.slug,control:f.jsx(Qm,{checked:y?y===C.slug:B===0}),label:C.display_name},C.slug),f.jsx("p",{children:C.description})]})},`server-type-card-${C.slug}`))})}),f.jsx("hr",{}),f.jsxs("div",{className:"button-section",children:[f.jsx("div",{className:"prev",children:f.jsx(at,{id:"cancel-btn",type:"button",variant:"text",color:"primary",onClick:()=>t(b?`/edit-app?id=${b}`:"/create-app"),children:"Back"})}),f.jsx("div",{className:"next",children:f.jsx(EQ,{id:"submit-btn",type:"submit",variant:"contained",color:"primary",loading:r,children:b?"Save":"Deploy App"})})]})]}):f.jsx("div",{children:"No servers available"})})]})})},LQ=()=>f.jsxs(qe,{id:"stop-pending",className:"container",display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",padding:"20px",children:[f.jsxs(qe,{display:"flex",flexDirection:"column",alignItems:"center",textAlign:"center",children:[f.jsxs(Qe,{variant:"h5",component:"h1",gutterBottom:!0,sx:{paddingBottom:"0 !important"},children:["Thank you for your patience",f.jsx("br",{}),"We are stopping your application, you may start it again when we have finished"]}),f.jsx(sg,{style:{color:"#a020f0",margin:"20px 0"}})]}),f.jsxs(qe,{sx:{marginTop:"4rem"},children:[f.jsx(Qe,{variant:"body1",gutterBottom:!0,children:"You may return to the Application Screen at any time"}),f.jsx(at,{id:"back-btn",variant:"contained",color:"primary",style:{backgroundColor:"#a020f0"},onClick:()=>Wo(`${Gt}`),children:"Back To Home"})]})]}),XQ=()=>{const[e]=Ee(Do),[t]=ju(),n=e==null?void 0:e.name,r=t.get("id")||"",o=s=>{s.preventDefault(),window.parent.open(`${Gt}/spawn-pending/${n}/${r}`,"_blank")};return P.useEffect(()=>{window.scrollTo(0,0)},[]),f.jsx(qe,{className:"container",sx:{height:"100ch",display:"flex"},children:f.jsx(to,{children:f.jsxs(nt,{children:[f.jsx(Qe,{component:"h1",variant:"h5",children:"App Submitted Successfully!"}),f.jsxs(Bv,{children:["To view the status of your app deployment, please click"," ",f.jsx("a",{href:"#",onClick:o,className:"form-paragraph-link",children:"here"}),"."]})]})})})},NQ=()=>{const[e]=ju(),[,t]=Ee(qZ),[,n]=Ee(Do),[,r]=Ee(Z5),[o,s]=Ee(no),[i,a]=Ee(bl),{error:l,data:c}=Pn({queryKey:["user-state"],queryFn:()=>Lt.get("/user").then(p=>p.data).then(p=>p)}),{error:u,data:d}=Pn({queryKey:["server-types"],queryFn:()=>Lt.get("/spawner-profiles/").then(p=>p.data).then(p=>p)});return P.useEffect(()=>{l?s(l.message):u&&s(u.message)},[l,u,s]),P.useEffect(()=>{t(fG())},[t]),P.useEffect(()=>{c&&n({...c})},[c,n]),P.useEffect(()=>{d&&r([...d])},[d,r]),P.useEffect(()=>{e.get("headless")==="true"&&a(!0)},[e]),f.jsxs("div",{children:[f.jsx(TU,{}),f.jsxs(qe,{component:"main",sx:{flexGrow:1,pt:i?1:9,pl:{xs:1,sm:i?1:33},pr:1,backgroundColor:"#fafbfc"},children:[o?f.jsx(RU,{message:o,onClose:()=>s(void 0)}):f.jsx(f.Fragment,{}),f.jsxs(lB,{children:[f.jsx(Lo,{path:"/home",element:f.jsx(kw,{})}),f.jsx(Lo,{path:"/user/:id/*",element:f.jsx(OQ,{})}),f.jsx(Lo,{path:"/create-app",element:f.jsx(QU,{})}),f.jsx(Lo,{path:"/edit-app",element:f.jsx(KU,{})}),f.jsx(Lo,{path:"/server-types",element:f.jsx(MQ,{})}),f.jsx(Lo,{path:"/stop-pending",element:f.jsx(LQ,{})}),f.jsx(Lo,{path:"/success",element:f.jsx(XQ,{})}),f.jsx(Lo,{path:"/",element:f.jsx(kw,{})})]})]})]})},Wr={50:"#FAFBFC",100:"#2491FF",200:"#2491FF",300:"#2491FF",400:"#2491FF",500:"#005EA2",600:"#1A4480",700:"#1A4480",800:"#1A4480",900:"#162E51"},$t={50:"rgba(0, 0, 0, .08)",100:"#E1E3E4",200:"#EEEEEE",300:"#E0E0E0",400:"#90969C",500:"#5B5F63",600:"#44474A",700:"#3C3C3B",800:"#242628",900:"#1A1C1D"},Us="#BA18DA",Wh="#BA18DA10",Ew="#9B00CE",_i="#18817A",BQ="#18817A10",VQ="#12635E",IQ="#D72D47",WQ="#F66A0A",Jr="#FFFFFF",Pf="#0F1015",gf="#0F101561",JQ=$t[100],Zl=Ap({typography:{fontFamily:'"Inter", sans-serif',h1:{letterSpacing:"-1.5px",fontSize:"96px"},h2:{letterSpacing:"0.5px",fontSize:"60px"},h3:{letterSpacing:"0px",fontSize:"48px"},h4:{letterSpacing:"0.25px",fontSize:"34px"},h5:{letterSpacing:"0px",fontSize:"24px",fontWeight:600,paddingBottom:"16px"},h6:{letterSpacing:"0.15px",fontSize:"20px",fontWeight:700,paddingBottom:"16px"},subtitle1:{letterSpacing:"0.15px",fontSize:"16px",fontWeight:600,paddingBottom:"24px"},subtitle2:{letterSpacing:"0.1px",fontSize:"14px",fontWeight:500,paddingBottom:"24px"},body1:{letterSpacing:"0.15px",fontSize:"16px"},body2:{letterSpacing:"0.17px",fontSize:"14px"},caption:{letterSpacing:"0.4px"},overline:{letterSpacing:"1px",fontSize:"12px"}},components:{MuiButtonBase:{defaultProps:{disableRipple:!0,style:{textTransform:"none",textWrap:"nowrap"}}},MuiFormControl:{defaultProps:{fullWidth:!0,sx:{marginBottom:"24px"}}},MuiTextField:{defaultProps:{autoComplete:"off",fullWidth:!0,sx:{marginBottom:"0"}}},MuiSelect:{defaultProps:{fullWidth:!0}}}}),FQ=Ap(Zl,{palette:{primary:Zl.palette.augmentColor({color:{light:Wh,main:Us,dark:Ew,contrastText:Jr},name:"primary"}),secondary:Zl.palette.augmentColor({color:{light:BQ,main:_i,dark:VQ,contrastText:Jr},name:"secondary"}),blue:Zl.palette.augmentColor({color:{50:Wr[50],100:Wr[100],200:Wr[200],300:Wr[300],400:Wr[400],500:Wr[500],600:Wr[600],700:Wr[700],800:Wr[800],900:Wr[900]},name:"blue"}),gray:Zl.palette.augmentColor({color:{light:$t[300],lighter:JQ,main:$t[500],dark:$t[700],contrastText:Pf,50:$t[50],100:$t[100],200:$t[200],300:$t[300],400:$t[400],500:$t[500],600:$t[600],700:$t[700],800:$t[800],900:$t[900]},name:"gray"}),warning:{main:WQ,contrastText:Jr},error:{main:IQ,contrastText:Jr},info:{main:Wr,contrastText:Jr},success:{main:_i[500],contrastText:Jr},common:{black:Pf,white:Jr}},components:{MuiButton:{variants:[{props:{variant:"contained",color:"primary"},style:{backgroundColor:`${Us}`,fontWeight:700,"&:hover":{backgroundColor:`${Ew}`},"&:disabled":{color:gf}}},{props:{variant:"contained",color:"secondary"},style:{backgroundColor:$t[200],border:`1px solid ${$t[200]}`,color:Pf,fontWeight:600,"&:hover":{backgroundColor:$t[300],border:`1px solid ${$t[300]}`},"&:disabled":{color:gf,borderColor:"transparent"}}},{props:{variant:"contained",color:"error"},style:{fontWeight:600}},{props:{variant:"outlined",color:"primary"},style:{backgroundColor:Jr,border:`2px solid ${Us}`,color:`${Us}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Jr,borderWidth:2,border:`2px solid ${Us}`,color:`${Us}`}}},{props:{variant:"outlined",color:"secondary"},style:{backgroundColor:Jr,border:`2px solid ${_i}`,color:`${_i}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Jr,borderWidth:2,border:`2px solid ${_i}`,color:`${_i}`}}},{props:{variant:"text",color:"primary"},style:{color:`${Us}`,"&:hover":{backgroundColor:`${Wh}`},"&:focus":{backgroundColor:`${Wh}`},"&:disabled":{color:gf}}},{props:{variant:"text",color:"secondary"},style:{color:Pf,"&:hover":{backgroundColor:`${$t[50]}`},"&:focus":{backgroundColor:`${$t[50]}`},"&:disabled":{color:gf}}}]}}}),YQ=new URL(window.location.href),qQ=new rN;fA.createRoot(document.getElementById("root")).render(f.jsx(Oe.StrictMode,{children:f.jsx(dB,{basename:YQ.pathname.indexOf("hub")===-1?tv:Gt,children:f.jsx(rq,{children:f.jsxs(Mz,{theme:FQ,children:[f.jsx(Hk,{}),f.jsx(lN,{client:qQ,children:f.jsx(NQ,{})})]})})})})); diff --git a/jhub_apps/tests/tests_e2e/test_integration.py b/jhub_apps/tests/tests_e2e/test_integration.py index d3f48acc..0548d6d7 100644 --- a/jhub_apps/tests/tests_e2e/test_integration.py +++ b/jhub_apps/tests/tests_e2e/test_integration.py @@ -51,9 +51,9 @@ def test_panel_app_creation(playwright: Playwright, with_server_options) -> None page.goto(BASE_URL) sign_in_and_authorize(page, username=f"admin-{app_suffix}", password="password") # Verify that the page is loaded - logo = page.get_by_alt_text("logo").last() + logo = page.locator("id=app-logo") expect(logo).to_be_visible() - profile_menu = page.locator("id=profile-menu-btn").last() + profile_menu = page.locator("id=profile-menu-btn") expect(profile_menu).to_be_visible() page_title = page.locator("h1") expect(page_title).to_have_text("Home") @@ -97,16 +97,17 @@ def create_app( ): logger.info("Creating App") # Verify that the page is loaded - logo = page.get_by_alt_text("logo").last() + logo = page.locator("id=app-logo") expect(logo).to_be_visible() - profile_menu = page.locator("id=profile-menu-btn").last() + profile_menu = page.locator("id=profile-menu-btn") expect(profile_menu).to_be_visible() - page_title = page.locator("h1") - expect(page_title).to_have_text("Deploy a new app") + # Deploy App deploy_button = page.get_by_role("button", name="Deploy App") expect(deploy_button).to_be_visible() deploy_button.click() + page_title = page.locator("h1") + expect(page_title).to_have_text("Deploy a new app") logger.info("Fill App display Name") display_name_field = page.get_by_label("*Name") expect(display_name_field).to_be_visible() diff --git a/ui/src/components/navigation/navigation.tsx b/ui/src/components/navigation/navigation.tsx index 0062585e..56849aa7 100644 --- a/ui/src/components/navigation/navigation.tsx +++ b/ui/src/components/navigation/navigation.tsx @@ -371,7 +371,7 @@ export const TopNavigation = ({ ...props }): React.ReactElement => { sx={{ flexGrow: 1, display: { xs: 'none', sm: 'block' } }} > - logo +