From 43fcc8c0cf1086b2251a77387b80a595eefba499 Mon Sep 17 00:00:00 2001 From: Johnny Bouder <61591423+jbouder@users.noreply.github.com> Date: Thu, 13 Jun 2024 13:15:57 -0400 Subject: [PATCH] Fix Design Bugs (#338) * Fix sort button and icon spacing. * Fix search bar spacing. * Fix sort button styling. --- jhub_apps/static/css/index.css | 2 +- jhub_apps/static/js/index.js | 2 +- ui/src/index.css | 2 +- ui/src/pages/home/apps-section/app-filters/app-filters.tsx | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/jhub_apps/static/css/index.css b/jhub_apps/static/css/index.css index 76a0d59d..3b7f8169 100644 --- a/jhub_apps/static/css/index.css +++ b/jhub_apps/static/css/index.css @@ -1 +1 @@ -.context-menu{background-color:#fff;border:1px solid #e6e6e6;border-radius:50%;box-shadow:0 3px 5px -1px #0003,0 6px 10px #00000024,0 1px 18px #0000001f;color:#1b1b1b;cursor:pointer;display:block;height:24px;position:absolute;right:8px;top:8px;width:24px;z-index:2}.context-menu button{top:-11px;right:21px}.context-menu button:hover,.context-menu button:focus{background-color:transparent}.context-menu-list{width:151px}.card{height:241px;width:286px;border-radius:.25rem;box-shadow:0 1px 2px #d2d2cfb3}.card.service{height:224px}.card.service .card-content-content{height:93px}.card>a{text-decoration:none}#card-test-app{position:relative}.card-content-header{position:relative;display:flex;justify-content:center;align-items:center;height:130px;padding:33px 0;overflow:hidden;background:linear-gradient(90deg,#fff,#ece9e6 95.83%)}.card-content-header img{max-width:100%;max-height:100%;object-fit:contain}.card-content-header .img-overlay,.card-content-header .img-overlay-service{position:relative;display:inline-block}.card-content-header .img-overlay:after{content:"";object-fit:contain;position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff40;pointer-events:none}.card-content-header .chip-container{position:absolute;display:flex;align-items:center;left:8px!important;top:8px!important;z-index:2}.card-content-content{position:relative;z-index:111;height:110px}.menu-chip{margin-right:4px}.card-content-container:not(.no-hover){background:#fff;position:relative;overflow:hidden}.card-content-container{background:#fff;position:relative;overflow:hidden;transition:all .5s ease-in-out}.card-content-container:not(.app-service){padding:12px 0 0}.card-content-container.app-service{top:16px}.card-content-content .card-inner-content{position:relative;padding-top:1px}.card-title{max-width:190px;overflow:hidden}.card-author{max-height:0;opacity:0;overflow:hidden;letter-spacing:.4px}.card-description{max-height:25px;max-width:240px;overflow:hidden;text-overflow:ellipsis;display:block;text-wrap:nowrap}.card-content-container-hover-1:hover{transform:translateY(-25%);height:120px}.card-content-container-hover-2:hover{transform:translateY(-30%);height:140px}.card-content-container-hover-3:hover{transform:translateY(-35%);height:160px}.card-content-container-hover-4:hover{transform:translateY(-40%);height:180px}.card-content-container-hover-5:hover{transform:translateY(-45%);height:200px}.card-content-container:hover .card-description{max-height:100px;text-wrap:wrap;overflow:visible}.card-content-container:hover .card-author:not(.no-hover){opacity:1;max-height:30px}.card-content-content .content{padding:.5rem 1rem 1rem}.card-content-content .card-inner-content .iconic{font-size:1rem!important;position:relative;top:2px;margin-right:8px}.card-content-content .card-content-container .card-title{font-size:1rem!important;font-weight:700!important;display:inline}.card-content-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block}@media screen and (max-width: 600px){.card{width:100%}}.form{max-width:600px}.form>.button-section{width:100%;margin:16px 0}.form>.button-section>.prev{float:left}.form>.button-section>.next{float:right}.form-paragraph{max-width:600px}.form-paragraph-link{color:var(--link-text-color);text-decoration:underline}.form-breadcrumb{margin:0 0 16px}@media screen and (max-width: 768px){.form{max-width:unset}}.description_text-field{position:relative;padding:15px}.placeholder-text{position:absolute;top:10px;left:10px;color:#000000de;transition:all .2s;pointer-events:none}.description-container:focus-within{border-color:purple}.description-container:focus-within .placeholder-text{top:-10px;left:10px;background:#fff;padding:0 5px;font-size:.8em;color:purple}.description-container:not(:empty) .placeholder-text{visibility:hidden}.description_text-field:empty:before{content:attr(data-placeholder);color:#00000091;pointer-events:none;display:block}.description_text-field:empty:focus:before{content:attr(data-placeholder)}.description_text-field--not-empty+label{color:#000}.description-label{position:absolute;left:10px;top:16px;font-size:12px;transition:all .2s ease-in-out;background:#fff;padding:0 5px;color:#00000091;pointer-events:none}.description_text-field--not-empty+.description-label,.description_text-field:focus+.description-label{top:-8px;font-size:.75rem;color:#ba18da}.description_text-field:not(:empty):before{display:none}.description_text-field:before{content:attr(data-placeholder);position:absolute;left:15px;top:16px;color:#090a0991!important;pointer-events:none;display:block}.description_text-field:focus:before{content:""}.form-control{position:relative;width:100%;border:1px solid #ccc!important;border-radius:4px;transition:border-color .3s}.form-control:hover{border-color:#000!important}.form-control:focus-within{border:2px solid #ba18da!important}.form-helper-text{display:none;color:inherit;font-size:1rem;position:absolute;right:0;bottom:-30px}.exceeding-characters{color:red}.form-control.outer-div{height:125px!important;margin-bottom:0}.description_text-field,.overlay-text{outline:none;width:100%;padding:20px 10px 10px;box-sizing:border-box;border:1px solid #ccc;font-family:Inter,sans-serif;font-size:16px;line-height:20px;overflow:hidden;background-color:transparent}.overlay-text{position:absolute;top:1px;left:1px;bottom:1px;pointer-events:none;color:transparent;white-space:pre-wrap;overflow:hidden;z-index:5;overflow-wrap:break-word}.description_text-field,.overlay-text{outline:none;padding:20px 10px 10px;box-sizing:border-box;border:none;font-family:Inter,sans-serif;font-size:16px;line-height:20px;background-color:transparent;resize:none;height:125px!important}.overlay-text{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;color:transparent;white-space:pre-wrap;overflow:hidden;z-index:5}.description-label{position:absolute;top:-15px;left:8px;transform:translateY(50%);color:#00000091;background-color:transparent;transition:all .2s ease;pointer-events:none}.description_text-field:focus+.description-label,.description_text-field:not(:empty)+.description-label{top:-8px;font-size:.75rem;color:#ba18da}.description_text-field:not(:focus):not(:placeholder-shown)+.description-label{color:#0f0!important}.form-control:focus-within .form-helper-text{display:block}.description-label{position:absolute;left:10px;transition:transform .3s ease,color .3s ease;transform-origin:left top;color:#0000008a;pointer-events:none}.textarea-container:focus-within .description-label,.description-label.label-float{transform:translateY(5px);font-size:12px;font-weight:500;color:#ba18da}#app-sharing .MuiTablePagination-selectLabel,#app-sharing .MuiTablePagination-input,#app-sharing .MuiTablePagination-displayedRows{display:none}.MuiTablePagination-root{border-bottom:0!important}.button-group{display:flex;flex-direction:row;justify-content:flex-end}.button-group-item{margin:.25rem;list-style:none}.alert-wrapper{width:100%;padding:0 30px 25px}.card-content-header .chip-container span.MuiChip-label{padding-right:2px}.card-content-header .chip-container .chip-base span.MuiChip-label{padding-right:8px}.thumbnail-body.selected{background-color:transparent}.thumbnail-body.dragging{border:2px dashed var(--primary)}#filters-list{position:absolute;top:3px!important}.align-vertical-center{vertical-align:middle;position:relative;top:-6px}.icon-button{padding:0 20px!important}.icon-text{padding-left:.5rem;position:relative;top:-3px}.actions{padding:0}.actions .action-button{min-width:0px;padding:0 24px}.actions .action-button:hover{background-color:transparent;border-radius:50%}.actions button.button-icon{min-width:0px!important}.actions button.button-icon:hover{background-color:transparent;border-radius:50%}.action-button{min-width:0px!important;border-radius:50%!important;margin:0 1rem!important}.truncate{width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.MuiDataGrid-menuIcon.base-Popper-root.MuiDataGrid-menu{display:none}.app-header th{font-weight:600}.h5{font-family:Inter,sans-serif;font-size:24px;font-style:normal;font-weight:600;line-height:133.4%}.server-type-card{margin:8px 0;cursor:pointer}.server-type-card:hover{background:var(--gray-lightest)}.server-type-card:focus{outline:2px solid var(--primary)}.server-type-card p{font-size:14px}:root{--primary-light: #ba18da10;--primary: #ba18da;--primary-dark: #9b00ce;--secondary-light: #20aaa110;--secondary: #18817a;--secondary-dark: #12635e;--white: #ffffff;--black: #000000;--gray-lightest: #f0f0f0;--gray-lighter: #e6e6e6;--gray-light: #adadad;--gray: #757575;--gray-dark: #454545;--gray-darker: #171717;--gray-darkest: #5c5c5c;--success: #00a91c;--success-light: #ecf3ec;--warning: #ffbe2e;--warning-light: #fde68a;--error: #d54309;--error-light: #f4e3db;--info: #00bde3;--info-light: #e7f6f8;--text-color: #1c1d26;--link-text-color: #276be9}html{background:#fafafa}main{margin:24px 0}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}h1{font-size:30px;font-weight:700;padding:0 0 8px}h2{font-size:20px}hr{color:var(--gray-lightest)}p{font-size:16px}a{color:var(--link-text-color);text-decoration:none}.container{margin-left:auto;margin-right:auto;padding-left:30px;padding-right:30px}.container:before{content:unset}.grid-heading-left{width:120px;display:flex;justify-content:flex-start}.grid-heading-left>h2,.grid-heading-right>h2{font-weight:700;white-space:nowrap}.grid-heading-right{width:120px;display:flex;justify-content:flex-end}.grid-spacer{position:relative;top:12px}.font-bold{font-weight:700}#search{padding:10px 12px}@media only screen and (min-width: 1537px){.grid-spacer{width:1460px}}@media only screen and (min-width: 1537px) and (max-width: 1920px){.grid-spacer{width:1160px}}@media only screen and (min-width: 1281px) and (max-width: 1536px){.grid-spacer{width:960px}}@media only screen and (min-width: 1025px) and (max-width: 1280px){.grid-spacer{width:660px}}@media only screen and (min-width: 769px) and (max-width: 1024px){.grid-spacer{width:460px}}@media only screen and (min-width: 641px) and (max-width: 768px){h1{padding-bottom:24px}.grid-spacer{width:320px}#create-app{width:150px}}@media only screen and (max-width: 640px){.container{padding-left:15px;padding-right:15px}h1{padding-bottom:24px}.grid-heading-center,.grid-heading-right,.grid-heading-right>h2{display:none}#create-app{width:150px}} +.context-menu{background-color:#fff;border:1px solid #e6e6e6;border-radius:50%;box-shadow:0 3px 5px -1px #0003,0 6px 10px #00000024,0 1px 18px #0000001f;color:#1b1b1b;cursor:pointer;display:block;height:24px;position:absolute;right:8px;top:8px;width:24px;z-index:2}.context-menu button{top:-11px;right:21px}.context-menu button:hover,.context-menu button:focus{background-color:transparent}.context-menu-list{width:151px}.card{height:241px;width:286px;border-radius:.25rem;box-shadow:0 1px 2px #d2d2cfb3}.card.service{height:224px}.card.service .card-content-content{height:93px}.card>a{text-decoration:none}#card-test-app{position:relative}.card-content-header{position:relative;display:flex;justify-content:center;align-items:center;height:130px;padding:33px 0;overflow:hidden;background:linear-gradient(90deg,#fff,#ece9e6 95.83%)}.card-content-header img{max-width:100%;max-height:100%;object-fit:contain}.card-content-header .img-overlay,.card-content-header .img-overlay-service{position:relative;display:inline-block}.card-content-header .img-overlay:after{content:"";object-fit:contain;position:absolute;top:0;left:0;right:0;bottom:0;background:#ffffff40;pointer-events:none}.card-content-header .chip-container{position:absolute;display:flex;align-items:center;left:8px!important;top:8px!important;z-index:2}.card-content-content{position:relative;z-index:111;height:110px}.menu-chip{margin-right:4px}.card-content-container:not(.no-hover){background:#fff;position:relative;overflow:hidden}.card-content-container{background:#fff;position:relative;overflow:hidden;transition:all .5s ease-in-out}.card-content-container:not(.app-service){padding:12px 0 0}.card-content-container.app-service{top:16px}.card-content-content .card-inner-content{position:relative;padding-top:1px}.card-title{max-width:190px;overflow:hidden}.card-author{max-height:0;opacity:0;overflow:hidden;letter-spacing:.4px}.card-description{max-height:25px;max-width:240px;overflow:hidden;text-overflow:ellipsis;display:block;text-wrap:nowrap}.card-content-container-hover-1:hover{transform:translateY(-25%);height:120px}.card-content-container-hover-2:hover{transform:translateY(-30%);height:140px}.card-content-container-hover-3:hover{transform:translateY(-35%);height:160px}.card-content-container-hover-4:hover{transform:translateY(-40%);height:180px}.card-content-container-hover-5:hover{transform:translateY(-45%);height:200px}.card-content-container:hover .card-description{max-height:100px;text-wrap:wrap;overflow:visible}.card-content-container:hover .card-author:not(.no-hover){opacity:1;max-height:30px}.card-content-content .content{padding:.5rem 1rem 1rem}.card-content-content .card-inner-content .iconic{font-size:1rem!important;position:relative;top:2px;margin-right:8px}.card-content-content .card-content-container .card-title{font-size:1rem!important;font-weight:700!important;display:inline}.card-content-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:inline-block}@media screen and (max-width: 600px){.card{width:100%}}.form{max-width:600px}.form>.button-section{width:100%;margin:16px 0}.form>.button-section>.prev{float:left}.form>.button-section>.next{float:right}.form-paragraph{max-width:600px}.form-paragraph-link{color:var(--link-text-color);text-decoration:underline}.form-breadcrumb{margin:0 0 16px}@media screen and (max-width: 768px){.form{max-width:unset}}.description_text-field{position:relative;padding:15px}.placeholder-text{position:absolute;top:10px;left:10px;color:#000000de;transition:all .2s;pointer-events:none}.description-container:focus-within{border-color:purple}.description-container:focus-within .placeholder-text{top:-10px;left:10px;background:#fff;padding:0 5px;font-size:.8em;color:purple}.description-container:not(:empty) .placeholder-text{visibility:hidden}.description_text-field:empty:before{content:attr(data-placeholder);color:#00000091;pointer-events:none;display:block}.description_text-field:empty:focus:before{content:attr(data-placeholder)}.description_text-field--not-empty+label{color:#000}.description-label{position:absolute;left:10px;top:16px;font-size:12px;transition:all .2s ease-in-out;background:#fff;padding:0 5px;color:#00000091;pointer-events:none}.description_text-field--not-empty+.description-label,.description_text-field:focus+.description-label{top:-8px;font-size:.75rem;color:#ba18da}.description_text-field:not(:empty):before{display:none}.description_text-field:before{content:attr(data-placeholder);position:absolute;left:15px;top:16px;color:#090a0991!important;pointer-events:none;display:block}.description_text-field:focus:before{content:""}.form-control{position:relative;width:100%;border:1px solid #ccc!important;border-radius:4px;transition:border-color .3s}.form-control:hover{border-color:#000!important}.form-control:focus-within{border:2px solid #ba18da!important}.form-helper-text{display:none;color:inherit;font-size:1rem;position:absolute;right:0;bottom:-30px}.exceeding-characters{color:red}.form-control.outer-div{height:125px!important;margin-bottom:0}.description_text-field,.overlay-text{outline:none;width:100%;padding:20px 10px 10px;box-sizing:border-box;border:1px solid #ccc;font-family:Inter,sans-serif;font-size:16px;line-height:20px;overflow:hidden;background-color:transparent}.overlay-text{position:absolute;top:1px;left:1px;bottom:1px;pointer-events:none;color:transparent;white-space:pre-wrap;overflow:hidden;z-index:5;overflow-wrap:break-word}.description_text-field,.overlay-text{outline:none;padding:20px 10px 10px;box-sizing:border-box;border:none;font-family:Inter,sans-serif;font-size:16px;line-height:20px;background-color:transparent;resize:none;height:125px!important}.overlay-text{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;color:transparent;white-space:pre-wrap;overflow:hidden;z-index:5}.description-label{position:absolute;top:-15px;left:8px;transform:translateY(50%);color:#00000091;background-color:transparent;transition:all .2s ease;pointer-events:none}.description_text-field:focus+.description-label,.description_text-field:not(:empty)+.description-label{top:-8px;font-size:.75rem;color:#ba18da}.description_text-field:not(:focus):not(:placeholder-shown)+.description-label{color:#0f0!important}.form-control:focus-within .form-helper-text{display:block}.description-label{position:absolute;left:10px;transition:transform .3s ease,color .3s ease;transform-origin:left top;color:#0000008a;pointer-events:none}.textarea-container:focus-within .description-label,.description-label.label-float{transform:translateY(5px);font-size:12px;font-weight:500;color:#ba18da}#app-sharing .MuiTablePagination-selectLabel,#app-sharing .MuiTablePagination-input,#app-sharing .MuiTablePagination-displayedRows{display:none}.MuiTablePagination-root{border-bottom:0!important}.button-group{display:flex;flex-direction:row;justify-content:flex-end}.button-group-item{margin:.25rem;list-style:none}.alert-wrapper{width:100%;padding:0 30px 25px}.card-content-header .chip-container span.MuiChip-label{padding-right:2px}.card-content-header .chip-container .chip-base span.MuiChip-label{padding-right:8px}.thumbnail-body.selected{background-color:transparent}.thumbnail-body.dragging{border:2px dashed var(--primary)}#filters-list{position:absolute;top:3px!important}.align-vertical-center{vertical-align:middle;position:relative;top:-6px}.icon-button{padding:0 20px!important}.icon-text{padding-left:.5rem;position:relative;top:-3px}.actions{padding:0}.actions .action-button{min-width:0px;padding:0 24px}.actions .action-button:hover{background-color:transparent;border-radius:50%}.actions button.button-icon{min-width:0px!important}.actions button.button-icon:hover{background-color:transparent;border-radius:50%}.action-button{min-width:0px!important;border-radius:50%!important;margin:0 1rem!important}.truncate{width:140px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.MuiDataGrid-menuIcon.base-Popper-root.MuiDataGrid-menu{display:none}.app-header th{font-weight:600}.h5{font-family:Inter,sans-serif;font-size:24px;font-style:normal;font-weight:600;line-height:133.4%}.server-type-card{margin:8px 0;cursor:pointer}.server-type-card:hover{background:var(--gray-lightest)}.server-type-card:focus{outline:2px solid var(--primary)}.server-type-card p{font-size:14px}:root{--primary-light: #ba18da10;--primary: #ba18da;--primary-dark: #9b00ce;--secondary-light: #20aaa110;--secondary: #18817a;--secondary-dark: #12635e;--white: #ffffff;--black: #000000;--gray-lightest: #f0f0f0;--gray-lighter: #e6e6e6;--gray-light: #adadad;--gray: #757575;--gray-dark: #454545;--gray-darker: #171717;--gray-darkest: #5c5c5c;--success: #00a91c;--success-light: #ecf3ec;--warning: #ffbe2e;--warning-light: #fde68a;--error: #d54309;--error-light: #f4e3db;--info: #00bde3;--info-light: #e7f6f8;--text-color: #1c1d26;--link-text-color: #276be9}html{background:#fafafa}main{margin:24px 0}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}h1{font-size:30px;font-weight:700;padding:0 0 8px}h2{font-size:20px}hr{color:var(--gray-lightest)}p{font-size:16px}a{color:var(--link-text-color);text-decoration:none}.container{margin-left:auto;margin-right:auto;padding-left:30px;padding-right:30px}.container:before{content:unset}.grid-heading-left{width:120px;display:flex;justify-content:flex-start}.grid-heading-left>h2,.grid-heading-right>h2{font-weight:700;white-space:nowrap}.grid-heading-right{width:120px;display:flex;justify-content:flex-end}.grid-spacer{position:relative;top:12px}.font-bold{font-weight:700}#search{padding:10px 0}@media only screen and (min-width: 1537px){.grid-spacer{width:1460px}}@media only screen and (min-width: 1537px) and (max-width: 1920px){.grid-spacer{width:1160px}}@media only screen and (min-width: 1281px) and (max-width: 1536px){.grid-spacer{width:960px}}@media only screen and (min-width: 1025px) and (max-width: 1280px){.grid-spacer{width:660px}}@media only screen and (min-width: 769px) and (max-width: 1024px){.grid-spacer{width:460px}}@media only screen and (min-width: 641px) and (max-width: 768px){h1{padding-bottom:24px}.grid-spacer{width:320px}#create-app{width:150px}}@media only screen and (max-width: 640px){.container{padding-left:15px;padding-right:15px}h1{padding-bottom:24px}.grid-heading-center,.grid-heading-right,.grid-heading-right>h2{display:none}#create-app{width:150px}} diff --git a/jhub_apps/static/js/index.js b/jhub_apps/static/js/index.js index b31a60b1..8bde0eb4 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=YQ("button-group",t);return f.jsx("ul",{id:e,className:r,children:y.Children.map(n,(o,s)=>f.jsx("li",{className:"button-group-item",children:o},s))})};var c8={},qQ=vt;Object.defineProperty(c8,"__esModule",{value:!0});var u8=c8.default=void 0,ZQ=qQ(ht()),GQ=f;u8=c8.default=(0,ZQ.default)((0,GQ.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 f8={},UQ=vt;Object.defineProperty(f8,"__esModule",{value:!0});var x3=f8.default=void 0,QQ=UQ(ht()),KQ=f;x3=f8.default=(0,QQ.default)((0,KQ.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 _Q=({variables:e,setVariables:t})=>{const[n,r]=y.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 y.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(et,{id:"environment-variables",children:f.jsxs(yo,{children:[n.length>0?f.jsx(rt,{sx:{pb:"16px"},children:n.map((l,c)=>f.jsxs(yo,{direction:"row",gap:1,sx:{pb:"16px"},children:[f.jsx(rt,{sx:{width:"100%"},children:f.jsx(zs,{id:`environment-variable-key-${c}`,name:"key",label:"Key",placeholder:"Key",value:l.key,onChange:u=>s(c,u)})}),f.jsx(rt,{sx:{width:"100%"},children:f.jsx(zs,{id:`environment-variable-value-${c}`,name:"value",label:"Value",placeholder:"Value",value:l.value,onChange:u=>s(c,u)})}),f.jsx(rt,{children:f.jsx(lr,{sx:{mt:"7px"},onClick:()=>a(c),"aria-label":"Remove",children:f.jsx(x3,{})})})]},`environment-variable-row-${c}`))}):f.jsx(f.Fragment,{}),f.jsx(rt,{children:f.jsx(ft,{variant:"contained",color:"secondary",startIcon:f.jsx(u8,{}),onClick:i,sx:{},children:"Add Variable"})})]})})};var d8={},$Q=vt;Object.defineProperty(d8,"__esModule",{value:!0});var w3=d8.default=void 0,eK=$Q(ht()),tK=f;w3=d8.default=(0,eK.default)((0,tK.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 p8={},nK=vt;Object.defineProperty(p8,"__esModule",{value:!0});var Ld=p8.default=void 0,rK=nK(ht()),oK=f;Ld=p8.default=(0,rK.default)((0,oK.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 v8={},sK=vt;Object.defineProperty(v8,"__esModule",{value:!0});var Xd=v8.default=void 0,iK=sK(ht()),aK=f;Xd=v8.default=(0,iK.default)((0,aK.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 h8={},lK=vt;Object.defineProperty(h8,"__esModule",{value:!0});var H3=h8.default=void 0,cK=lK(ht()),uK=f;H3=h8.default=(0,cK.default)((0,uK.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");U(ia)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingLeft:e.spacing(4),paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));const fK=U(ia)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));U(a9)(({theme:e})=>({paddingLeft:e.spacing(4)}));const dK=({...e})=>{const t=Er(),[n,r]=Ce.useState(null),o=!!n,s=aM(t.breakpoints.down("sm")),{window:i}=e,[a,l]=y.useState(!s),[c]=Je(Di),[,u]=Je(Kr),[d,p]=y.useState([]),[m,v]=y.useState([]),[g,w]=y.useState([]),{isLoading:A,error:h,data:P}=cr({queryKey:["app-state"],queryFn:()=>Qt.get("/server/").then(D=>D.data).then(D=>D),enabled:!!c}),{isLoading:x,error:j,data:z}=cr({queryKey:["service-data"],queryFn:()=>Qt.get("/services/").then(D=>D.data).then(D=>D),enabled:!!c}),H=()=>{l(D=>!D)};y.useEffect(()=>{!A&&P&&c&&v(()=>T5(P,c.name))},[A,P,c]),y.useEffect(()=>{!x&&z&&c&&(p(()=>C5(z,c.name).filter(D=>!ag.includes(D.name))),w(()=>D5(z,c.name)))},[x,z,c]),y.useEffect(()=>{u(j?j.message:h?h.message:void 0)},[j,h,u]),y.useEffect(()=>{l(!s)},[s]);const O=f.jsxs(et,{children:[f.jsx(Um,{children:f.jsx(xl,{disablePadding:!0,sx:{mt:10},children:f.jsxs(a9,{sx:{px:"1.5rem",mx:".5rem",backgroundColor:t.palette.gray.lighter,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.light,"&::before":{backgroundColor:t.palette.primary.main}}},onClick:()=>hs(`${ir}`),children:[f.jsx(dL,{sx:{minWidth:"auto",mr:"8px",display:"flex",alignItems:"center"},children:f.jsx(w3,{sx:{color:t.palette.common.black,width:"28px",height:"28px"}})}),f.jsx(ia,{primary:f.jsx(gt,{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(xl,{disablePadding:!0,children:f.jsx(fK,{primary:"Services",disableTypography:!0,sx:{px:"24px",py:"4px",fontSize:"14px",textTransform:"uppercase",fontWeight:600,color:"rgba(15 16 21 / 60%)"}})}),m.map((D,S)=>f.jsx(xl,{disablePadding:!0,children:f.jsx(Fl,{href:D.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(ia,{primary:f.jsx(gt,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:D.name})})})},S)),g.map((D,S)=>f.jsx(xl,{disablePadding:!0,children:f.jsx(Fl,{href:D.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(ia,{primary:f.jsx(gt,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:D.name})})})},S)),d.map((D,S)=>f.jsx(xl,{disablePadding:!0,children:f.jsx(Fl,{href:D.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(ia,{primary:f.jsx(gt,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:D.name})})})},S))]})]});return f.jsxs(et,{sx:{flexGrow:1},children:[f.jsx(aS,{position:"fixed",sx:{zIndex:D=>D.zIndex.drawer+1,backgroundColor:D=>D.palette.common.black},children:f.jsxs(w9,{children:[f.jsx(lr,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:H,sx:{mr:2,display:{sm:"none"}},children:f.jsx(H3,{})}),f.jsx(et,{component:"div",sx:{flexGrow:1,display:{xs:"none",sm:"block"}},children:f.jsx(Fl,{href:ir,children:f.jsx("img",{src:RG(),alt:"logo",height:"28"})})}),f.jsxs(et,{sx:{display:{xs:"none",sm:"block"}},children:[f.jsxs(ft,{id:"profile-menu-btn","aria-controls":o?"profile-menu-list":void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:D=>r(D.currentTarget),endIcon:o?f.jsx(Xd,{}):f.jsx(Ld,{}),sx:{color:t.palette.common.white,fontWeight:700},children:[c==null?void 0:c.name," ",c!=null&&c.admin?"(admin)":""]}),f.jsxs(Wc,{id:"profile-menu-list",anchorEl:n,open:o,onClose:()=>r(null),MenuListProps:{"aria-labelledby":"profile-menu-btn"},sx:{marginTop:"20px"},children:[f.jsx(js,{onClick:()=>hs(`${ir}/token`),sx:{width:"180px"},children:"Tokens"}),(c==null?void 0:c.admin)&&f.jsx(js,{onClick:()=>hs(`${ir}/admin`),children:"Admin"}),f.jsx(js,{onClick:()=>hs(`${ir}/logout`),children:"Logout"})]})]})]})}),f.jsx("nav",{children:f.jsx(s6,{container:i!==void 0?()=>i().document.body:void 0,variant:"persistent",open:a,onClose:H,ModalProps:{keepMounted:!0},sx:{"& .MuiDrawer-paper":{boxSizing:"border-box",width:224,boxShadow:1}},children:O})})]})},pK=({severity:e="error",message:t,onClose:n})=>f.jsx("div",{className:"alert-wrapper",children:t?f.jsx(j2,{id:"alert-notification",severity:e,onClose:n,children:t}):f.jsx(f.Fragment,{})}),vK=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},j3=({status:e,additionalInfo:t,app:n,size:r="small"})=>{const[,o]=Je(Ov),[,s]=Je(Cv),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(lr,{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(Sv,{sx:{fontSize:"16px"}})})]}):f.jsx("span",{children:e})}):e||"Default";return f.jsx(qp,{label:i(),className:e!=="Running"||!t||n!=null&&n.shared?"chip-base":"",size:r,sx:{fontWeight:600,fontSize:"12px",...vK(e)}})};var m8={},hK=vt;Object.defineProperty(m8,"__esModule",{value:!0});var z3=m8.default=void 0,mK=hK(ht()),AK=f;z3=m8.default=(0,mK.default)((0,AK.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 A8={},PK=vt;Object.defineProperty(A8,"__esModule",{value:!0});var O3=A8.default=void 0,gK=PK(ht()),yK=f;O3=A8.default=(0,gK.default)((0,yK.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 bK=({id:e,name:t,currentImage:n,setCurrentImage:r,currentFile:o,setCurrentFile:s,...i})=>{const a=Er(),[l,c]=y.useState(!1),[u,d]=y.useState(!1),[p,m]=y.useState(void 0),v=y.useRef(null),g=H=>{H.preventDefault(),c(!0)},w=H=>{H.preventDefault(),c(!0)},A=H=>{H.preventDefault(),c(!1)},h=H=>{H.preventDefault(),c(!1);const O=H.dataTransfer.files[0];s(O)},P=H=>{if(!H.target.files)return;const O=5*1024*1024;if(H.target.files[0].size>O){m("File size exceeds 5MB.");return}const D=H.target.files[0];s(D),m(void 0)},x=H=>{H.preventDefault(),d(!0)},j=H=>{H.preventDefault();const O=v.current;O&&O.click()},z=H=>{H.preventDefault();const O=v.current;O&&(O.value="",s(void 0),r(void 0))};return y.useEffect(()=>{const H=v.current;if(H&&H.files&&H.files.length>0){const O=H.files[0];s(O)}},[v,s]),f.jsxs(et,{id:`thumbnail-${e}`,className:"thumbnail",sx:{display:"flex",flexDirection:"row",columnGap:"24px",width:"500px",height:"180px",border:"none"},children:[f.jsxs(et,{id:`thumbnail-body-${e}`,className:`thumbnail-body ${l?"dragging":""} ${o||n?"selected":""}`,onDragOver:g,onDragEnter:w,onDragLeave:A,onDrop:h,sx:{height:"130px",backgroundColor:"#90969c",borderRadius:"4px"},children:[o||n?f.jsx(et,{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:x})}):f.jsx(et,{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:j,children:f.jsx(z3,{sx:{width:"64px",height:"64px",color:a.palette.common.white}})}),f.jsx("input",{ref:v,id:e,name:t,type:"file",accept:"image/*",onChange:P,style:{display:"none"},...i})]}),f.jsxs(et,{sx:{display:"flex",flexDirection:"column",rowGap:"16px"},children:[f.jsxs(et,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},columnGap:"16px",rowGap:"12px",height:"40px"},children:[f.jsx(ft,{id:"upload-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(O3,{}),onClick:j,sx:{width:"100%",maxWidth:"170px"},children:"Select an image"}),o||n?f.jsx(ft,{id:"remove-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(Dv,{}),onClick:z,hidden:!o&&!n,sx:{width:"100%",maxWidth:"170px"},children:"Remove image"}):f.jsx(f.Fragment,{})]}),f.jsx(gt,{variant:"body1",sx:{color:"#0F101599",width:"340px",display:{xs:"none",md:"block"}},children:"Recommended size: 225x130 | JPG, PNG, Max size: 5MB"}),p?f.jsx(gt,{variant:"body2",sx:{color:a.palette.error.main},children:p}):f.jsx(f.Fragment,{})]}),f.jsx(Sf,{onClose:()=>d(!1),open:u,children:f.jsx("img",{src:o?URL.createObjectURL(o):n,alt:"App thumbnail"})})]})};var P8={},xK=vt;Object.defineProperty(P8,"__esModule",{value:!0});var Xv=P8.default=void 0,wK=xK(ht()),HK=f;Xv=P8.default=(0,wK.default)((0,HK.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 g8=U("h1")(()=>({fontSize:"24px",fontWeight:700,paddingBottom:"16px"})),y8=U("p")(()=>({maxWidth:600,paddingBottom:"30px"})),jK=()=>f.jsx(et,{className:"container",children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(ft,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Xv,{}),onClick:()=>hs(ir),children:"Back To Home"})})}),f.jsxs(rt,{children:[f.jsx(g8,{children:"Create a new app"}),f.jsxs(y8,{children:["Begin your project by entering the details below. For more information about creating an 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(rt,{children:f.jsx(m3,{})})]})}),zK=()=>{const[e]=G9(),t=e.get("id");return f.jsx(et,{className:"container",children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(ft,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Xv,{}),onClick:()=>hs(ir),children:"Back To Home"})})}),f.jsxs(rt,{children:[f.jsx(g8,{className:"form-heading",children:"Edit app"}),f.jsxs(y8,{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(rt,{children:f.jsx(f.Fragment,{children:t?f.jsx(m3,{id:t}):f.jsx(f.Fragment,{children:"No app found."})})})]})})};var b8={},OK=vt;Object.defineProperty(b8,"__esModule",{value:!0});var C3=b8.default=void 0,CK=OK(ht()),DK=f;C3=b8.default=(0,CK.default)((0,DK.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 x8={},SK=vt;Object.defineProperty(x8,"__esModule",{value:!0});var D3=x8.default=void 0,TK=SK(ht()),RK=f;D3=x8.default=(0,TK.default)((0,RK.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 w8={},EK=vt;Object.defineProperty(w8,"__esModule",{value:!0});var S3=w8.default=void 0,kK=EK(ht()),MK=f;S3=w8.default=(0,kK.default)((0,MK.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 H8={},LK=vt;Object.defineProperty(H8,"__esModule",{value:!0});var T3=H8.default=void 0,XK=LK(ht()),NK=f;T3=H8.default=(0,XK.default)((0,NK.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 j8={},BK=vt;Object.defineProperty(j8,"__esModule",{value:!0});var R3=j8.default=void 0,VK=BK(ht()),IK=f;R3=j8.default=(0,VK.default)((0,IK.jsx)("path",{d:"M21 8H3V4h18zm0 2H3v4h18zm0 6H3v4h18z"}),"TableRows");const WK=U(ft)(({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"})),JK=({data:e,currentUser:t,isGridViewActive:n,toggleView:r,setApps:o})=>{const[s]=Je(y5),[i,a]=Ce.useState(null),[l,c]=Ce.useState(null),u=!!i,d=!!l,[p,m]=Je(b5),[v,g]=Je(w5),[w,A]=Je(H5),[h,P]=Je(j5),[x,j]=y.useState(0),{data:z,isLoading:H}=cr({queryKey:["app-frameworks"],queryFn:()=>Qt.get("/frameworks/").then(R=>R.data)}),O=R=>{const Z=R.target.value;p.includes(Z)?m(E=>E.filter(I=>I!==Z)):m(E=>[...E,Z])},D=R=>{g(R)},S=R=>{A(R),o(kf(e,t,s,v,p,R,h)),c(null)},W=R=>{const Z=R.target.value;h.includes(Z)?P(E=>E.filter(I=>I!==Z)):P(E=>[...E,Z])},T=()=>{a(null),o(kf(e,t,s,v,p,w,h))},M=()=>{m([]),g("Any"),P([])},J=y.useCallback(()=>kf(e,t,s,v,p,w,h).length,[e,t,s,v,p,w,h]);return y.useEffect(()=>{j(J())},[J]),f.jsxs(mo,{container:!0,spacing:2,paddingBottom:"32px",children:[f.jsx(mo,{item:!0,xs:12,md:4,children:f.jsxs(rt,{sx:{pb:0},children:[f.jsx(WK,{id:"filters-btn",variant:"text",color:"secondary",onClick:R=>a(R.currentTarget),startIcon:f.jsx(D3,{}),sx:{fontSize:"16px",fontWeight:600,top:"-8px",background:"none"},endIcon:u?f.jsx(Xd,{}):f.jsx(Ld,{}),disabled:H||!1,children:"Filters"}),f.jsx(Wc,{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(et,{component:"form",name:"filters-form",id:"filters-form",sx:{width:"450px",px:"16px",pb:0,mt:3},children:[f.jsx(Tf,{id:"frameworks-label",sx:{py:"16px",fontWeight:600},children:"Frameworks"}),f.jsx(et,{children:z==null?void 0:z.map(R=>f.jsx(Us,{control:f.jsx(kb,{value:R.display_name}),label:R.display_name,sx:{width:"120px","& > :last-child":{minWidth:"100%"}},onClick:O,checked:p.includes(R.display_name)},R.name))}),f.jsx(Vc,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Tf,{id:"server-statuses-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Server Status"}),f.jsx(et,{children:TB.map(R=>f.jsx(Us,{control:f.jsx(kb,{value:R}),label:R,onClick:W,checked:h.includes(R)},R))}),f.jsx(Vc,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Tf,{id:"ownership-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Ownership"}),f.jsx(et,{children:f.jsx(Km,{"aria-labelledby":"ownership-label",defaultValue:"any",name:"ownership-group",row:!0,children:DB.map(R=>f.jsx(Us,{control:f.jsx(Qm,{value:R}),label:R,onClick:()=>D(R),checked:v===R},R))})}),f.jsx(et,{sx:{backgroundColor:"#EEE",p:1,pt:.75,mx:-2,width:"auto",fontSize:"14px"},children:f.jsxs(Vf,{children:[f.jsx(ft,{id:"clear-filters-btn","data-testid":"clear-filters-btn",variant:"text",sx:{color:"#0F1015",display:"flex",alignItems:"center"},size:"small",onClick:M,children:"Clear"}),f.jsxs(ft,{id:"apply-filters-btn",variant:"contained",size:"small",onClick:T,sx:{px:"none !important",minWidth:"20px"},children:["Show ",x," results"]})]})})]})})]})}),f.jsxs(mo,{container:!0,item:!0,xs:8,md:8,direction:"row",sx:{display:"flex",justifyContent:"flex-end",flexWrap:"nowrap"},children:[f.jsx(rt,{children:f.jsxs(et,{sx:{display:"flex",flexDirection:"row"},children:[f.jsxs(ft,{id:"sort-by-btn",variant:"text",color:"secondary",onClick:R=>c(R.currentTarget),sx:{position:"relative",bottom:"8px",fontSize:"16px",fontWeight:600,width:"180px",color:"common.black",px:0,mr:1.5},endIcon:d?f.jsx(Xd,{}):f.jsx(Ld,{}),children:[f.jsx(S3,{sx:{position:"relative",marginRight:"4px"}}),w]}),f.jsx(Wc,{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(et,{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:SB.map(R=>f.jsx(Us,{control:f.jsx(Qm,{value:R}),label:R,onClick:()=>S(R),checked:w===R},R))})})})]})}),f.jsx(rt,{children:f.jsxs(et,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around",border:"1px solid #DFDFE0",borderRadius:"4px",position:"relative",top:"-6px"},children:[f.jsx(ft,{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(T3,{sx:{color:n?"#2E2F33":"#76777B"}})}),f.jsx(ft,{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(R3,{sx:{color:n?"#76777B":"#2E2F33"}})})]})})]})]})},FK=({apps:e})=>f.jsx(f.Fragment,{children:e.map((t,n)=>y.createElement(jA,{...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 z8={},YK=vt;Object.defineProperty(z8,"__esModule",{value:!0});var E3=z8.default=void 0,qK=YK(ht()),ZK=f;E3=z8.default=(0,qK.default)((0,ZK.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 GK=({apps:e})=>{const[,t]=y.useState(""),[n,r]=y.useState(e),[,o]=Je(Kr),[,s]=Je(Ov),[,i]=Je(Lg),[,a]=Je(Cv),[,l]=Je(Xg),c=e.map(d=>d.status);y.useEffect(()=>{c?t(c.join(", ")):o("Server status id undefined.")},[c,o]),y.useEffect(()=>{r(e)},[e]);const u=(d,p)=>d?f.jsx(zv,{"data-testid":"PublicRoundedIcon",fontSize:"small",className:"align-vertical-center"}):p?f.jsx(jv,{"data-testid":"GroupRoundedIcon",fontSize:"small",className:"align-vertical-center"}):f.jsx(Eg,{"data-testid":"LockRoundedIcon",fontSize:"small",className:"align-vertical-center"});return f.jsx(f.Fragment,{children:f.jsx(et,{sx:{height:"100%",width:"100%"},children:f.jsx(x9,{component:Dr,children:f.jsxs(y9,{sx:{minWidth:650},"aria-label":"App table",children:[f.jsx(FN,{children:f.jsxs(yd,{className:"app-header",children:[f.jsx(Sn,{children:"Name"}),f.jsx(Sn,{children:"Status"}),f.jsx(Sn,{children:"Created by"}),f.jsx(Sn,{children:"Tags"}),f.jsx(Sn,{children:"Actions"})]})}),f.jsx(b9,{children:n.map(d=>f.jsxs(yd,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[f.jsxs(Sn,{component:"th",scope:"row",children:[u(d.public,d.shared),f.jsx("span",{className:"inline relative icon-text",children:d.name})]}),f.jsx(Sn,{children:f.jsx(j3,{status:d.status,size:"medium"})}),f.jsx(Sn,{children:d.username}),f.jsx(Sn,{children:f.jsx(qp,{label:d.framework,variant:"outlined",size:"medium"})}),f.jsxs(Sn,{children:[d.status==="Running"?f.jsx(ft,{onClick:()=>{a(!0),s(d)},"aria-label":"Stop",color:"inherit",size:"small",className:"action-button","data-testid":"StopCircleRoundedIcon",disabled:d.shared,children:f.jsx(Sv,{})}):f.jsx(ft,{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(E3,{})}),f.jsx(ft,{onClick:()=>window.location.href=`${ev}/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(Vg,{})}),f.jsx(ft,{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(Dv,{})})]})]},d.id))})]})})})})},UK=()=>{const[e,t]=y.useState([]),[,n]=y.useState(""),[r]=Je(Di),[o,s]=y.useState(!1),[,i]=Je(Kr),[a,l]=y.useState(!0),[,c]=Je(y5),[u]=Je(b5),[d]=Je(w5),[,p]=Je(Kr),[m]=Je(H5),[v]=Je(j5),g=()=>l(j=>!j);y.useEffect(()=>{const j=e?e.map(z=>z.status):[];j?n(j.join(", ")):p("Server status id undefined.")},[e,p,n]);const{isLoading:w,error:A,data:h}=cr({queryKey:["app-state"],queryFn:()=>Qt.get("/server/").then(j=>j.data).then(j=>j),enabled:!!r}),P=e?e.map(j=>j.status):[];y.useEffect(()=>{P?n(P.join(", ")):p("Server status id undefined.")},[P,p]);const x=j=>{const z=j.target;c(z.value),h&&r&&t(kf(h,r,z.value,d,u,m,v))};return y.useEffect(()=>{if(!w&&h){const j=S5(h,"all",(r==null?void 0:r.name)??"").map(z=>({...z,status:Fg(z)})).sort((z,H)=>z.last_activity>H.last_activity?-1:1);t(j)}},[w,h,r]),y.useEffect(()=>{i(A?A.message:void 0)},[A,i]),f.jsx(f.Fragment,{children:f.jsx(et,{children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsxs(mo,{container:!0,spacing:2,alignItems:"center",children:[f.jsx(mo,{item:!0,xs:12,md:4,sx:{padding:"0"},children:f.jsx(rt,{children:f.jsx("h2",{children:"App Library"})})}),f.jsxs(mo,{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(rt,{children:f.jsx(zs,{id:"search",size:"small",placeholder:"Search Apps...","aria-label":"Search for an app",onChange:x,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(s9,{position:"start",children:!o&&f.jsx(C3,{style:{fill:"rgba(15, 16, 21, 0.56)"}})})}})}),f.jsx(rt,{children:f.jsx(ft,{id:"create-app",variant:"contained",color:"primary",size:"large",startIcon:f.jsx(u8,{}),onClick:()=>{window.location.href=`${ev}/create-app`},children:"Create App"})})]})]})}),f.jsx(rt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(Vc,{})}),f.jsx(rt,{children:h&&r?f.jsx(JK,{data:h,currentUser:r,setApps:t,isGridViewActive:a,toggleView:g}):f.jsx(f.Fragment,{})}),f.jsx(rt,{children:f.jsx(et,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,rowGap:2,justifyContent:"flex-start",paddingBottom:"48px"},children:w?f.jsx("div",{className:"font-bold",children:"Loading..."}):e.length>0?a?f.jsx(FK,{apps:e}):f.jsx(GK,{apps:e}):f.jsx("div",{children:"No apps available"})})})]})})})},QK=({services:e,apps:t})=>f.jsxs(f.Fragment,{children:[t.map((n,r)=>y.createElement(jA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1,app:n})),e.map((n,r)=>y.createElement(jA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1}))]}),KK=()=>{const[e]=Je(Di),[,t]=Je(Kr),[n,r]=y.useState([]),[o,s]=y.useState([]),{isLoading:i,error:a,data:l}=cr({queryKey:["service-data"],queryFn:()=>Qt.get("/services/").then(p=>p.data).then(p=>p),enabled:!!e}),{isLoading:c,error:u,data:d}=cr({queryKey:["app-state"],queryFn:()=>Qt.get("/server/").then(p=>p.data).then(p=>p),enabled:!!e});return y.useEffect(()=>{!i&&l&&e&&r(()=>D5(l,e.name))},[i,l,e]),y.useEffect(()=>{!c&&d&&e&&s(()=>T5(d,e.name))},[c,d,e]),y.useEffect(()=>{t(a?a.message:u?u.message:void 0)},[a,u,t]),f.jsx(et,{children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx(mo,{container:!0,spacing:2,children:f.jsx(mo,{item:!0,xs:12,md:4,children:f.jsx(rt,{children:f.jsx("h2",{children:"Quick Access"})})})})}),f.jsx(rt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(Vc,{})}),f.jsx(rt,{children:f.jsx(et,{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(QK,{services:n,apps:o}):f.jsx("div",{children:"No services available"})})})]})})},gw=()=>{const[,e]=Je(Kr),[t]=Je(Ov),[n,r]=Je(Lg),[o,s]=Je(Cv),[i,a]=Je(Xg),[l,c]=y.useState(!1),u=tv(),d=async({id:j})=>{try{return await Qt.post(`/server/${j}`)}catch(z){console.error("There was an error!",z),e(z.toString())}},p=async({id:j,remove:z})=>{try{return await Qt.delete(`/server/${j}`,{params:{remove:z}})}catch(H){console.error("There was an error!",H),e(H.toString())}},{mutate:m}=Za({mutationFn:d,retry:1}),{mutate:v}=Za({mutationFn:p,retry:1}),g=()=>{const j=(t==null?void 0:t.id)||"";c(!0),v({id:j,remove:!0},{onSuccess:async()=>{c(!1),a(!1),u.invalidateQueries({queryKey:["app-state"]})},onError:async z=>{c(!1),e(z.message)}})},w=async()=>{const j=(t==null?void 0:t.id)||"";try{c(!0),await m({id:j},{onSuccess:async()=>{r(!1),u.invalidateQueries({queryKey:["app-state"]})},onError:z=>{e(z.message)}})}catch(z){console.error("Error in handleStart",z),e(z.message)}finally{c(!1)}},A=async()=>{const j=(t==null?void 0:t.id)||"";c(!0);try{v({id:j,remove:!1},{onSuccess:()=>{s(!1),u.invalidateQueries({queryKey:["app-state"]})},onError:z=>{e(z.message)}})}catch(z){z instanceof Error?e(z.message):console.error("An unknown error occurred",z)}finally{c(!1)}},h=f.jsxs(f.Fragment,{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.jsxs(Vf,{children:[f.jsx(ft,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>r(!1),children:"Cancel"}),f.jsx(ft,{id:"start-btn","data-testid":"start-btn",variant:"contained",color:"primary",onClick:w,disabled:l,children:"Start"})]})]}),P=f.jsxs(f.Fragment,{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(Vf,{children:[f.jsx(ft,{id:"cancel-btn",variant:"text",color:"primary",onClick:()=>s(!1),children:"Cancel"}),f.jsx(ft,{id:"stop-btn",variant:"contained",color:"primary",onClick:A,disabled:l,children:"Stop"})]})]}),x=f.jsxs(f.Fragment,{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}),"? This action is permanent and cannot be reversed."]}),f.jsxs(Vf,{children:[f.jsx(ft,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>a(!1),children:"Cancel"}),f.jsx(ft,{id:"delete-btn","data-testid":"delete-btn",variant:"contained",color:"error",onClick:g,disabled:l,children:"Delete"})]})]});return f.jsxs(et,{sx:{flexGrow:1},className:"container",children:[f.jsx(mo,{container:!0,spacing:2,paddingBottom:"32px",children:f.jsx(mo,{item:!0,xs:12,md:2,children:f.jsx(rt,{children:f.jsx("h1",{className:"h5",children:"Home"})})})}),f.jsx(KK,{}),f.jsx(UK,{}),n&&f.jsxs(Sf,{open:n,onClose:()=>r(!1),"data-testid":"StartModal",children:[f.jsxs(gh,{children:["Start ",t==null?void 0:t.name]}),f.jsx(Ph,{children:h})]}),o&&f.jsxs(Sf,{open:o,onClose:()=>s(!1),"data-testid":"StopModal",children:[f.jsxs(gh,{children:["Stop ",t==null?void 0:t.name]}),f.jsx(Ph,{children:P})]}),i&&f.jsxs(Sf,{open:i,onClose:()=>a(!1),"data-testid":"DeleteModal",children:[f.jsxs(gh,{children:["Delete ",t==null?void 0:t.name]}),f.jsx(Ph,{children:x})]})]})};function _K(e){return De("MuiLoadingButton",e)}const $K=Se("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),Oo=$K,e_=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],t_=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=Te(o,_K,r);return b({},r,s)},n_=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",r_=U(ft,{shouldForwardProp:e=>n_(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${Oo.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${Oo.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>b({[`& .${Oo.startIconLoadingStart}, & .${Oo.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}),[`&.${Oo.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${Oo.startIconLoadingStart}, & .${Oo.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${Oo.startIconLoadingStart}, & .${Oo.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),o_=U("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.loadingIndicator,t[`loadingIndicator${_(n.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>b({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})),s_=y.forwardRef(function(t,n){const r=y.useContext(F2),o=up(r,t),s=Re({props:o,name:"MuiLoadingButton"}),{children:i,disabled:a=!1,id:l,loading:c=!1,loadingIndicator:u,loadingPosition:d="center",variant:p="text"}=s,m=ue(s,e_),v=Po(l),g=u??f.jsx(ik,{"aria-labelledby":v,color:"inherit",size:16}),w=b({},s,{disabled:a,loading:c,loadingIndicator:g,loadingPosition:d,variant:p}),A=t_(w),h=c?f.jsx(o_,{className:A.loadingIndicator,ownerState:w,children:g}):null;return f.jsxs(r_,b({disabled:a||c,id:v,ref:n},m,{variant:p,classes:A,ownerState:w,children:[w.loadingPosition==="end"?i:h,w.loadingPosition==="end"?h:i]}))}),i_=s_,a_=()=>{const[e]=G9(),t=pg(),n=tv(),[r,o]=y.useState(!1),[s]=Je(Di),[,i]=Je(Kr),[a,l]=Je(A5),[c]=Je(m5),[u]=Je(g5),[d]=Je(P5),[,p]=Je(Kr),[m,v]=Ce.useState((a==null?void 0:a.profile)||""),g=e.get("id"),{data:w,isLoading:A,error:h}=cr({queryKey:["server-types"],queryFn:()=>Qt.get("/spawner-profiles/").then(D=>D.data).then(D=>D),enabled:!!s}),P=D=>{v(D),a&&l({...a,profile:D})},x=D=>{var T,M;D.preventDefault();const S=(a==null?void 0:a.display_name)||"",W={servername:c||S,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:HA(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:((T=a==null?void 0:a.share_with)==null?void 0:T.users)||[],groups:((M=a==null?void 0:a.share_with)==null?void 0:M.groups)||[]},keep_alive:(a==null?void 0:a.keep_alive)||!1}};o(!0),g?O(W,{onSuccess:async()=>{n.invalidateQueries({queryKey:["app-state"]}),window.location.assign(ir)},onError:async J=>{o(!1),p(J.message)}}):H(W,{onSuccess:async J=>{const R=s==null?void 0:s.name;if(R&&(J==null?void 0:J.length)>1){const Y=J[1];window.location.assign(`/hub/spawn-pending/${R}/${Y}`)}},onError:async J=>{o(!1),p(J.message)}})},j=async({servername:D,user_options:S})=>{const W={accept:"application/json","Content-Type":"multipart/form-data"},T=new FormData;return T.append("data",JSON.stringify({servername:D,user_options:S})),u&&T.append("thumbnail",u),(await Qt.post("/server",T,{headers:W})).data},z=async({servername:D,user_options:S})=>{const W={accept:"application/json","Content-Type":"multipart/form-data"},T=new FormData;return T.append("data",JSON.stringify({servername:D,user_options:S})),u?T.append("thumbnail",u):d&&T.append("thumbnail_data_url",d),(await Qt.put(`/server/${D}`,T,{headers:W})).data},{mutate:H}=Za({mutationFn:j,retry:1}),{mutate:O}=Za({mutationFn:z,retry:1});return y.useEffect(()=>{i(h?h.message:void 0)},[h,i]),f.jsx(et,{className:"container",children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(ft,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Xv,{}),onClick:()=>hs(ir),children:"Back To Home"})})}),f.jsxs(rt,{children:[f.jsx(g8,{children:"Server Type"}),f.jsxs(y8,{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(rt,{children:A?f.jsx("div",{className:"font-bold center",children:"Loading..."}):w&&w.length>0?f.jsxs("form",{className:"form",onSubmit:x,children:[f.jsx(qi,{sx:{pb:"36px"},children:f.jsx(Km,{children:w==null?void 0:w.map((D,S)=>f.jsx(q2,{className:"server-type-card",onClick:()=>P(D.slug),tabIndex:0,children:f.jsxs(Ym,{children:[f.jsx(Us,{value:D.slug,id:D.slug,control:f.jsx(Qm,{checked:m?m===D.slug:S===0}),label:D.display_name},D.slug),f.jsx("p",{children:D.description})]})},`server-type-card-${D.slug}`))})}),f.jsx("hr",{}),f.jsxs("div",{className:"button-section",children:[f.jsx("div",{className:"prev",children:f.jsx(ft,{id:"cancel-btn",type:"button",variant:"text",color:"primary",onClick:()=>t(g?`/edit-app?id=${g}`:"/create-app"),children:"Back"})}),f.jsx("div",{className:"next",children:f.jsx(i_,{id:"submit-btn",type:"submit",variant:"contained",color:"primary",loading:r,children:g?"Save":"Create App"})})]})]}):f.jsx("div",{children:"No servers available"})})]})})},l_=()=>{const[,e]=Je(cG),[,t]=Je(Di),[,n]=Je(x5),[r,o]=Je(Kr),{error:s,data:i}=cr({queryKey:["user-state"],queryFn:()=>Qt.get("/user").then(c=>c.data).then(c=>c)}),{error:a,data:l}=cr({queryKey:["server-types"],queryFn:()=>Qt.get("/spawner-profiles/").then(c=>c.data).then(c=>c)});return y.useEffect(()=>{s?o(s.message):a&&o(a.message)},[s,a,o]),y.useEffect(()=>{e(CG())},[e]),y.useEffect(()=>{i&&t({...i})},[i,t]),y.useEffect(()=>{l&&n([...l])},[l,n]),f.jsxs("div",{children:[f.jsx(dK,{}),f.jsxs(et,{component:"main",sx:{flexGrow:1,pt:9,pl:{xs:1,sm:33},pr:1,backgroundColor:"#FAFAFA"},children:[r?f.jsx(pK,{message:r,onClose:()=>o(void 0)}):f.jsx(f.Fragment,{}),f.jsxs(eI,{children:[f.jsx(Yi,{path:"/home",element:f.jsx(gw,{})}),f.jsx(Yi,{path:"/create-app",element:f.jsx(jK,{})}),f.jsx(Yi,{path:"/edit-app",element:f.jsx(zK,{})}),f.jsx(Yi,{path:"/server-types",element:f.jsx(a_,{})}),f.jsx(Yi,{path:"/",element:f.jsx(gw,{})})]})]})]})},c_={50:"#2491FF",100:"#2491FF",200:"#2491FF",300:"#2491FF",400:"#2491FF",500:"#005EA2",600:"#1A4480",700:"#1A4480",800:"#1A4480",900:"#162E51"},Gt={50:"#0F10150A",100:"#E1E3E4",200:"#EEEEEE",300:"#E0E0E0",400:"#90969C",500:"#5B5F63",600:"#44474A",700:"#3C3C3B",800:"#242628",900:"#1A1C1D"},Bs="#BA18DA",Ih="#BA18DA10",yw="#9B00CE",Ii="#18817A",u_="#18817A10",f_="#12635E",d_="#D72D47",p_="#F66A0A",Nr="#FFFFFF",uf="#0F1015",ff="#0F101561",v_=Gt[100],df=hp({typography:{fontFamily:'"Inter", sans-serif'},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}}}}),h_=hp(df,{palette:{primary:df.palette.augmentColor({color:{light:Ih,main:Bs,dark:yw,contrastText:Nr},name:"primary"}),secondary:df.palette.augmentColor({color:{light:u_,main:Ii,dark:f_,contrastText:Nr},name:"secondary"}),gray:df.palette.augmentColor({color:{light:Gt[300],lighter:v_,main:Gt[500],dark:Gt[700],contrastText:uf,50:Gt[50],100:Gt[100],200:Gt[200],300:Gt[300],400:Gt[400],500:Gt[500],600:Gt[600],700:Gt[700],800:Gt[800],900:Gt[900]},name:"gray"}),warning:{main:p_,contrastText:Nr},error:{main:d_,contrastText:Nr},info:{main:c_,contrastText:Nr},success:{main:Ii[500],contrastText:Nr},common:{black:uf,white:Nr}},components:{MuiButton:{variants:[{props:{variant:"contained",color:"primary"},style:{backgroundColor:`${Bs}`,fontWeight:700,"&:hover":{backgroundColor:`${yw}`},"&:disabled":{color:ff}}},{props:{variant:"contained",color:"secondary"},style:{backgroundColor:Gt[200],border:`1px solid ${Gt[200]}`,color:uf,fontWeight:600,"&:hover":{backgroundColor:Gt[300],border:`1px solid ${Gt[300]}`},"&:disabled":{color:ff,borderColor:"transparent"}}},{props:{variant:"contained",color:"error"},style:{fontWeight:600}},{props:{variant:"outlined",color:"primary"},style:{backgroundColor:Nr,border:`2px solid ${Bs}`,color:`${Bs}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Nr,borderWidth:2,border:`2px solid ${Bs}`,color:`${Bs}`}}},{props:{variant:"outlined",color:"secondary"},style:{backgroundColor:Nr,border:`2px solid ${Ii}`,color:`${Ii}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Nr,borderWidth:2,border:`2px solid ${Ii}`,color:`${Ii}`}}},{props:{variant:"text",color:"primary"},style:{color:`${Bs}`,"&:hover":{backgroundColor:`${Ih}`},"&:focus":{backgroundColor:`${Ih}`},"&:disabled":{color:ff}}},{props:{variant:"text",color:"secondary"},style:{color:uf,"&:hover":{backgroundColor:`${Gt[50]}`},"&:focus":{backgroundColor:`${Gt[50]}`},"&:disabled":{color:ff}}}]}}}),m_=new URL(window.location.href),A_=new ZB;uA.createRoot(document.getElementById("root")).render(f.jsx(Ce.StrictMode,{children:f.jsx(oI,{basename:m_.pathname.indexOf("hub")===-1?ev:ir,children:f.jsx(UZ,{children:f.jsxs(Nz,{theme:h_,children:[f.jsx(uk,{}),f.jsx(_B,{client:A_,children:f.jsx(l_,{})})]})})})})); +*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",i=0;i{const r=YQ("button-group",t);return f.jsx("ul",{id:e,className:r,children:y.Children.map(n,(o,s)=>f.jsx("li",{className:"button-group-item",children:o},s))})};var c8={},qQ=vt;Object.defineProperty(c8,"__esModule",{value:!0});var u8=c8.default=void 0,ZQ=qQ(ht()),GQ=f;u8=c8.default=(0,ZQ.default)((0,GQ.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 f8={},UQ=vt;Object.defineProperty(f8,"__esModule",{value:!0});var x3=f8.default=void 0,QQ=UQ(ht()),KQ=f;x3=f8.default=(0,QQ.default)((0,KQ.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 _Q=({variables:e,setVariables:t})=>{const[n,r]=y.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 y.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(et,{id:"environment-variables",children:f.jsxs(yo,{children:[n.length>0?f.jsx(rt,{sx:{pb:"16px"},children:n.map((l,c)=>f.jsxs(yo,{direction:"row",gap:1,sx:{pb:"16px"},children:[f.jsx(rt,{sx:{width:"100%"},children:f.jsx(zs,{id:`environment-variable-key-${c}`,name:"key",label:"Key",placeholder:"Key",value:l.key,onChange:u=>s(c,u)})}),f.jsx(rt,{sx:{width:"100%"},children:f.jsx(zs,{id:`environment-variable-value-${c}`,name:"value",label:"Value",placeholder:"Value",value:l.value,onChange:u=>s(c,u)})}),f.jsx(rt,{children:f.jsx(lr,{sx:{mt:"7px"},onClick:()=>a(c),"aria-label":"Remove",children:f.jsx(x3,{})})})]},`environment-variable-row-${c}`))}):f.jsx(f.Fragment,{}),f.jsx(rt,{children:f.jsx(ft,{variant:"contained",color:"secondary",startIcon:f.jsx(u8,{}),onClick:i,sx:{},children:"Add Variable"})})]})})};var d8={},$Q=vt;Object.defineProperty(d8,"__esModule",{value:!0});var w3=d8.default=void 0,eK=$Q(ht()),tK=f;w3=d8.default=(0,eK.default)((0,tK.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 p8={},nK=vt;Object.defineProperty(p8,"__esModule",{value:!0});var Ld=p8.default=void 0,rK=nK(ht()),oK=f;Ld=p8.default=(0,rK.default)((0,oK.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 v8={},sK=vt;Object.defineProperty(v8,"__esModule",{value:!0});var Xd=v8.default=void 0,iK=sK(ht()),aK=f;Xd=v8.default=(0,iK.default)((0,aK.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 h8={},lK=vt;Object.defineProperty(h8,"__esModule",{value:!0});var H3=h8.default=void 0,cK=lK(ht()),uK=f;H3=h8.default=(0,cK.default)((0,uK.jsx)("path",{d:"M3 18h18v-2H3zm0-5h18v-2H3zm0-7v2h18V6z"}),"Menu");U(ia)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingLeft:e.spacing(4),paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));const fK=U(ia)(({theme:e})=>({fontWeight:400,fontSize:"16px",paddingTop:e.spacing(1),paddingBottom:e.spacing(1)}));U(a9)(({theme:e})=>({paddingLeft:e.spacing(4)}));const dK=({...e})=>{const t=Er(),[n,r]=Ce.useState(null),o=!!n,s=aM(t.breakpoints.down("sm")),{window:i}=e,[a,l]=y.useState(!s),[c]=Je(Di),[,u]=Je(Kr),[d,p]=y.useState([]),[m,v]=y.useState([]),[g,w]=y.useState([]),{isLoading:A,error:h,data:P}=cr({queryKey:["app-state"],queryFn:()=>Qt.get("/server/").then(D=>D.data).then(D=>D),enabled:!!c}),{isLoading:x,error:j,data:z}=cr({queryKey:["service-data"],queryFn:()=>Qt.get("/services/").then(D=>D.data).then(D=>D),enabled:!!c}),H=()=>{l(D=>!D)};y.useEffect(()=>{!A&&P&&c&&v(()=>T5(P,c.name))},[A,P,c]),y.useEffect(()=>{!x&&z&&c&&(p(()=>C5(z,c.name).filter(D=>!ag.includes(D.name))),w(()=>D5(z,c.name)))},[x,z,c]),y.useEffect(()=>{u(j?j.message:h?h.message:void 0)},[j,h,u]),y.useEffect(()=>{l(!s)},[s]);const O=f.jsxs(et,{children:[f.jsx(Um,{children:f.jsx(xl,{disablePadding:!0,sx:{mt:10},children:f.jsxs(a9,{sx:{px:"1.5rem",mx:".5rem",backgroundColor:t.palette.gray.lighter,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.light,"&::before":{backgroundColor:t.palette.primary.main}}},onClick:()=>hs(`${ir}`),children:[f.jsx(dL,{sx:{minWidth:"auto",mr:"8px",display:"flex",alignItems:"center"},children:f.jsx(w3,{sx:{color:t.palette.common.black,width:"28px",height:"28px"}})}),f.jsx(ia,{primary:f.jsx(gt,{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(xl,{disablePadding:!0,children:f.jsx(fK,{primary:"Services",disableTypography:!0,sx:{px:"24px",py:"4px",fontSize:"14px",textTransform:"uppercase",fontWeight:600,color:"rgba(15 16 21 / 60%)"}})}),m.map((D,S)=>f.jsx(xl,{disablePadding:!0,children:f.jsx(Fl,{href:D.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(ia,{primary:f.jsx(gt,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:D.name})})})},S)),g.map((D,S)=>f.jsx(xl,{disablePadding:!0,children:f.jsx(Fl,{href:D.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(ia,{primary:f.jsx(gt,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:D.name})})})},S)),d.map((D,S)=>f.jsx(xl,{disablePadding:!0,children:f.jsx(Fl,{href:D.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(ia,{primary:f.jsx(gt,{variant:"body2",sx:{fontSize:"1rem",color:"rgb(15 16 21 / 87%)"},children:D.name})})})},S))]})]});return f.jsxs(et,{sx:{flexGrow:1},children:[f.jsx(aS,{position:"fixed",sx:{zIndex:D=>D.zIndex.drawer+1,backgroundColor:D=>D.palette.common.black},children:f.jsxs(w9,{children:[f.jsx(lr,{color:"inherit","aria-label":"open drawer",edge:"start",onClick:H,sx:{mr:2,display:{sm:"none"}},children:f.jsx(H3,{})}),f.jsx(et,{component:"div",sx:{flexGrow:1,display:{xs:"none",sm:"block"}},children:f.jsx(Fl,{href:ir,children:f.jsx("img",{src:RG(),alt:"logo",height:"28"})})}),f.jsxs(et,{sx:{display:{xs:"none",sm:"block"}},children:[f.jsxs(ft,{id:"profile-menu-btn","aria-controls":o?"profile-menu-list":void 0,"aria-haspopup":"true","aria-expanded":o?"true":void 0,onClick:D=>r(D.currentTarget),endIcon:o?f.jsx(Xd,{}):f.jsx(Ld,{}),sx:{color:t.palette.common.white,fontWeight:700},children:[c==null?void 0:c.name," ",c!=null&&c.admin?"(admin)":""]}),f.jsxs(Wc,{id:"profile-menu-list",anchorEl:n,open:o,onClose:()=>r(null),MenuListProps:{"aria-labelledby":"profile-menu-btn"},sx:{marginTop:"20px"},children:[f.jsx(js,{onClick:()=>hs(`${ir}/token`),sx:{width:"180px"},children:"Tokens"}),(c==null?void 0:c.admin)&&f.jsx(js,{onClick:()=>hs(`${ir}/admin`),children:"Admin"}),f.jsx(js,{onClick:()=>hs(`${ir}/logout`),children:"Logout"})]})]})]})}),f.jsx("nav",{children:f.jsx(s6,{container:i!==void 0?()=>i().document.body:void 0,variant:"persistent",open:a,onClose:H,ModalProps:{keepMounted:!0},sx:{"& .MuiDrawer-paper":{boxSizing:"border-box",width:224,boxShadow:1}},children:O})})]})},pK=({severity:e="error",message:t,onClose:n})=>f.jsx("div",{className:"alert-wrapper",children:t?f.jsx(j2,{id:"alert-notification",severity:e,onClose:n,children:t}):f.jsx(f.Fragment,{})}),vK=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},j3=({status:e,additionalInfo:t,app:n,size:r="small"})=>{const[,o]=Je(Ov),[,s]=Je(Cv),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(lr,{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(Sv,{sx:{fontSize:"16px"}})})]}):f.jsx("span",{children:e})}):e||"Default";return f.jsx(qp,{label:i(),className:e!=="Running"||!t||n!=null&&n.shared?"chip-base":"",size:r,sx:{fontWeight:600,fontSize:"12px",...vK(e)}})};var m8={},hK=vt;Object.defineProperty(m8,"__esModule",{value:!0});var z3=m8.default=void 0,mK=hK(ht()),AK=f;z3=m8.default=(0,mK.default)((0,AK.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 A8={},PK=vt;Object.defineProperty(A8,"__esModule",{value:!0});var O3=A8.default=void 0,gK=PK(ht()),yK=f;O3=A8.default=(0,gK.default)((0,yK.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 bK=({id:e,name:t,currentImage:n,setCurrentImage:r,currentFile:o,setCurrentFile:s,...i})=>{const a=Er(),[l,c]=y.useState(!1),[u,d]=y.useState(!1),[p,m]=y.useState(void 0),v=y.useRef(null),g=H=>{H.preventDefault(),c(!0)},w=H=>{H.preventDefault(),c(!0)},A=H=>{H.preventDefault(),c(!1)},h=H=>{H.preventDefault(),c(!1);const O=H.dataTransfer.files[0];s(O)},P=H=>{if(!H.target.files)return;const O=5*1024*1024;if(H.target.files[0].size>O){m("File size exceeds 5MB.");return}const D=H.target.files[0];s(D),m(void 0)},x=H=>{H.preventDefault(),d(!0)},j=H=>{H.preventDefault();const O=v.current;O&&O.click()},z=H=>{H.preventDefault();const O=v.current;O&&(O.value="",s(void 0),r(void 0))};return y.useEffect(()=>{const H=v.current;if(H&&H.files&&H.files.length>0){const O=H.files[0];s(O)}},[v,s]),f.jsxs(et,{id:`thumbnail-${e}`,className:"thumbnail",sx:{display:"flex",flexDirection:"row",columnGap:"24px",width:"500px",height:"180px",border:"none"},children:[f.jsxs(et,{id:`thumbnail-body-${e}`,className:`thumbnail-body ${l?"dragging":""} ${o||n?"selected":""}`,onDragOver:g,onDragEnter:w,onDragLeave:A,onDrop:h,sx:{height:"130px",backgroundColor:"#90969c",borderRadius:"4px"},children:[o||n?f.jsx(et,{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:x})}):f.jsx(et,{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:j,children:f.jsx(z3,{sx:{width:"64px",height:"64px",color:a.palette.common.white}})}),f.jsx("input",{ref:v,id:e,name:t,type:"file",accept:"image/*",onChange:P,style:{display:"none"},...i})]}),f.jsxs(et,{sx:{display:"flex",flexDirection:"column",rowGap:"16px"},children:[f.jsxs(et,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},columnGap:"16px",rowGap:"12px",height:"40px"},children:[f.jsx(ft,{id:"upload-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(O3,{}),onClick:j,sx:{width:"100%",maxWidth:"170px"},children:"Select an image"}),o||n?f.jsx(ft,{id:"remove-thumbnail-btn",variant:"contained",color:"secondary",startIcon:f.jsx(Dv,{}),onClick:z,hidden:!o&&!n,sx:{width:"100%",maxWidth:"170px"},children:"Remove image"}):f.jsx(f.Fragment,{})]}),f.jsx(gt,{variant:"body1",sx:{color:"#0F101599",width:"340px",display:{xs:"none",md:"block"}},children:"Recommended size: 225x130 | JPG, PNG, Max size: 5MB"}),p?f.jsx(gt,{variant:"body2",sx:{color:a.palette.error.main},children:p}):f.jsx(f.Fragment,{})]}),f.jsx(Sf,{onClose:()=>d(!1),open:u,children:f.jsx("img",{src:o?URL.createObjectURL(o):n,alt:"App thumbnail"})})]})};var P8={},xK=vt;Object.defineProperty(P8,"__esModule",{value:!0});var Xv=P8.default=void 0,wK=xK(ht()),HK=f;Xv=P8.default=(0,wK.default)((0,HK.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 g8=U("h1")(()=>({fontSize:"24px",fontWeight:700,paddingBottom:"16px"})),y8=U("p")(()=>({maxWidth:600,paddingBottom:"30px"})),jK=()=>f.jsx(et,{className:"container",children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(ft,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Xv,{}),onClick:()=>hs(ir),children:"Back To Home"})})}),f.jsxs(rt,{children:[f.jsx(g8,{children:"Create a new app"}),f.jsxs(y8,{children:["Begin your project by entering the details below. For more information about creating an 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(rt,{children:f.jsx(m3,{})})]})}),zK=()=>{const[e]=G9(),t=e.get("id");return f.jsx(et,{className:"container",children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(ft,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Xv,{}),onClick:()=>hs(ir),children:"Back To Home"})})}),f.jsxs(rt,{children:[f.jsx(g8,{className:"form-heading",children:"Edit app"}),f.jsxs(y8,{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(rt,{children:f.jsx(f.Fragment,{children:t?f.jsx(m3,{id:t}):f.jsx(f.Fragment,{children:"No app found."})})})]})})};var b8={},OK=vt;Object.defineProperty(b8,"__esModule",{value:!0});var C3=b8.default=void 0,CK=OK(ht()),DK=f;C3=b8.default=(0,CK.default)((0,DK.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 x8={},SK=vt;Object.defineProperty(x8,"__esModule",{value:!0});var D3=x8.default=void 0,TK=SK(ht()),RK=f;D3=x8.default=(0,TK.default)((0,RK.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 w8={},EK=vt;Object.defineProperty(w8,"__esModule",{value:!0});var S3=w8.default=void 0,kK=EK(ht()),MK=f;S3=w8.default=(0,kK.default)((0,MK.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 H8={},LK=vt;Object.defineProperty(H8,"__esModule",{value:!0});var T3=H8.default=void 0,XK=LK(ht()),NK=f;T3=H8.default=(0,XK.default)((0,NK.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 j8={},BK=vt;Object.defineProperty(j8,"__esModule",{value:!0});var R3=j8.default=void 0,VK=BK(ht()),IK=f;R3=j8.default=(0,VK.default)((0,IK.jsx)("path",{d:"M21 8H3V4h18zm0 2H3v4h18zm0 6H3v4h18z"}),"TableRows");const WK=U(ft)(({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"})),JK=({data:e,currentUser:t,isGridViewActive:n,toggleView:r,setApps:o})=>{const[s]=Je(y5),[i,a]=Ce.useState(null),[l,c]=Ce.useState(null),u=!!i,d=!!l,[p,m]=Je(b5),[v,g]=Je(w5),[w,A]=Je(H5),[h,P]=Je(j5),[x,j]=y.useState(0),{data:z,isLoading:H}=cr({queryKey:["app-frameworks"],queryFn:()=>Qt.get("/frameworks/").then(R=>R.data)}),O=R=>{const Z=R.target.value;p.includes(Z)?m(E=>E.filter(I=>I!==Z)):m(E=>[...E,Z])},D=R=>{g(R)},S=R=>{A(R),o(kf(e,t,s,v,p,R,h)),c(null)},W=R=>{const Z=R.target.value;h.includes(Z)?P(E=>E.filter(I=>I!==Z)):P(E=>[...E,Z])},T=()=>{a(null),o(kf(e,t,s,v,p,w,h))},M=()=>{m([]),g("Any"),P([])},J=y.useCallback(()=>kf(e,t,s,v,p,w,h).length,[e,t,s,v,p,w,h]);return y.useEffect(()=>{j(J())},[J]),f.jsxs(mo,{container:!0,spacing:2,paddingBottom:"32px",children:[f.jsx(mo,{item:!0,xs:12,md:4,children:f.jsxs(rt,{sx:{pb:0},children:[f.jsx(WK,{id:"filters-btn",variant:"text",color:"secondary",onClick:R=>a(R.currentTarget),startIcon:f.jsx(D3,{}),sx:{fontSize:"16px",fontWeight:600,top:"-8px",background:"none"},endIcon:u?f.jsx(Xd,{}):f.jsx(Ld,{}),disabled:H||!1,children:"Filters"}),f.jsx(Wc,{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(et,{component:"form",name:"filters-form",id:"filters-form",sx:{width:"450px",px:"16px",pb:0,mt:3},children:[f.jsx(Tf,{id:"frameworks-label",sx:{py:"16px",fontWeight:600},children:"Frameworks"}),f.jsx(et,{children:z==null?void 0:z.map(R=>f.jsx(Us,{control:f.jsx(kb,{value:R.display_name}),label:R.display_name,sx:{width:"120px","& > :last-child":{minWidth:"100%"}},onClick:O,checked:p.includes(R.display_name)},R.name))}),f.jsx(Vc,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Tf,{id:"server-statuses-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Server Status"}),f.jsx(et,{children:TB.map(R=>f.jsx(Us,{control:f.jsx(kb,{value:R}),label:R,onClick:W,checked:h.includes(R)},R))}),f.jsx(Vc,{sx:{mt:"24px",mb:"16px"}}),f.jsx(Tf,{id:"ownership-label",sx:{pb:"16px",fontSize:"14px",fontWeight:600},children:"Ownership"}),f.jsx(et,{children:f.jsx(Km,{"aria-labelledby":"ownership-label",defaultValue:"any",name:"ownership-group",row:!0,children:DB.map(R=>f.jsx(Us,{control:f.jsx(Qm,{value:R}),label:R,onClick:()=>D(R),checked:v===R},R))})}),f.jsx(et,{sx:{backgroundColor:"#EEE",p:1,pt:.75,mx:-2,width:"auto",fontSize:"14px"},children:f.jsxs(Vf,{children:[f.jsx(ft,{id:"clear-filters-btn","data-testid":"clear-filters-btn",variant:"text",sx:{color:"#0F1015",display:"flex",alignItems:"center"},size:"small",onClick:M,children:"Clear"}),f.jsxs(ft,{id:"apply-filters-btn",variant:"contained",size:"small",onClick:T,sx:{px:"none !important",minWidth:"20px"},children:["Show ",x," results"]})]})})]})})]})}),f.jsxs(mo,{container:!0,item:!0,xs:8,md:8,direction:"row",sx:{display:"flex",justifyContent:"flex-end",flexWrap:"nowrap"},children:[f.jsx(rt,{children:f.jsxs(et,{sx:{display:"flex",flexDirection:"row"},children:[f.jsxs(ft,{id:"sort-by-btn",variant:"text",color:"secondary",onClick:R=>c(R.currentTarget),sx:{position:"relative",bottom:"8px",fontSize:"16px",fontWeight:600,color:"common.black",mr:"24px"},endIcon:d?f.jsx(Xd,{}):f.jsx(Ld,{}),children:[f.jsx(S3,{sx:{position:"relative",marginRight:"8px"}}),w]}),f.jsx(Wc,{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(et,{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:SB.map(R=>f.jsx(Us,{control:f.jsx(Qm,{value:R}),label:R,onClick:()=>S(R),checked:w===R},R))})})})]})}),f.jsx(rt,{children:f.jsxs(et,{sx:{display:"flex",alignItems:"center",justifyContent:"space-around",border:"1px solid #DFDFE0",borderRadius:"4px",position:"relative",top:"-6px"},children:[f.jsx(ft,{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(T3,{sx:{color:n?"#2E2F33":"#76777B"}})}),f.jsx(ft,{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(R3,{sx:{color:n?"#76777B":"#2E2F33"}})})]})})]})]})},FK=({apps:e})=>f.jsx(f.Fragment,{children:e.map((t,n)=>y.createElement(jA,{...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 z8={},YK=vt;Object.defineProperty(z8,"__esModule",{value:!0});var E3=z8.default=void 0,qK=YK(ht()),ZK=f;E3=z8.default=(0,qK.default)((0,ZK.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 GK=({apps:e})=>{const[,t]=y.useState(""),[n,r]=y.useState(e),[,o]=Je(Kr),[,s]=Je(Ov),[,i]=Je(Lg),[,a]=Je(Cv),[,l]=Je(Xg),c=e.map(d=>d.status);y.useEffect(()=>{c?t(c.join(", ")):o("Server status id undefined.")},[c,o]),y.useEffect(()=>{r(e)},[e]);const u=(d,p)=>d?f.jsx(zv,{"data-testid":"PublicRoundedIcon",fontSize:"small",className:"align-vertical-center"}):p?f.jsx(jv,{"data-testid":"GroupRoundedIcon",fontSize:"small",className:"align-vertical-center"}):f.jsx(Eg,{"data-testid":"LockRoundedIcon",fontSize:"small",className:"align-vertical-center"});return f.jsx(f.Fragment,{children:f.jsx(et,{sx:{height:"100%",width:"100%"},children:f.jsx(x9,{component:Dr,children:f.jsxs(y9,{sx:{minWidth:650},"aria-label":"App table",children:[f.jsx(FN,{children:f.jsxs(yd,{className:"app-header",children:[f.jsx(Sn,{children:"Name"}),f.jsx(Sn,{children:"Status"}),f.jsx(Sn,{children:"Created by"}),f.jsx(Sn,{children:"Tags"}),f.jsx(Sn,{children:"Actions"})]})}),f.jsx(b9,{children:n.map(d=>f.jsxs(yd,{sx:{"&:last-child td, &:last-child th":{border:0}},children:[f.jsxs(Sn,{component:"th",scope:"row",children:[u(d.public,d.shared),f.jsx("span",{className:"inline relative icon-text",children:d.name})]}),f.jsx(Sn,{children:f.jsx(j3,{status:d.status,size:"medium"})}),f.jsx(Sn,{children:d.username}),f.jsx(Sn,{children:f.jsx(qp,{label:d.framework,variant:"outlined",size:"medium"})}),f.jsxs(Sn,{children:[d.status==="Running"?f.jsx(ft,{onClick:()=>{a(!0),s(d)},"aria-label":"Stop",color:"inherit",size:"small",className:"action-button","data-testid":"StopCircleRoundedIcon",disabled:d.shared,children:f.jsx(Sv,{})}):f.jsx(ft,{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(E3,{})}),f.jsx(ft,{onClick:()=>window.location.href=`${ev}/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(Vg,{})}),f.jsx(ft,{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(Dv,{})})]})]},d.id))})]})})})})},UK=()=>{const[e,t]=y.useState([]),[,n]=y.useState(""),[r]=Je(Di),[o,s]=y.useState(!1),[,i]=Je(Kr),[a,l]=y.useState(!0),[,c]=Je(y5),[u]=Je(b5),[d]=Je(w5),[,p]=Je(Kr),[m]=Je(H5),[v]=Je(j5),g=()=>l(j=>!j);y.useEffect(()=>{const j=e?e.map(z=>z.status):[];j?n(j.join(", ")):p("Server status id undefined.")},[e,p,n]);const{isLoading:w,error:A,data:h}=cr({queryKey:["app-state"],queryFn:()=>Qt.get("/server/").then(j=>j.data).then(j=>j),enabled:!!r}),P=e?e.map(j=>j.status):[];y.useEffect(()=>{P?n(P.join(", ")):p("Server status id undefined.")},[P,p]);const x=j=>{const z=j.target;c(z.value),h&&r&&t(kf(h,r,z.value,d,u,m,v))};return y.useEffect(()=>{if(!w&&h){const j=S5(h,"all",(r==null?void 0:r.name)??"").map(z=>({...z,status:Fg(z)})).sort((z,H)=>z.last_activity>H.last_activity?-1:1);t(j)}},[w,h,r]),y.useEffect(()=>{i(A?A.message:void 0)},[A,i]),f.jsx(f.Fragment,{children:f.jsx(et,{children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsxs(mo,{container:!0,spacing:2,alignItems:"center",children:[f.jsx(mo,{item:!0,xs:12,md:4,sx:{padding:"0"},children:f.jsx(rt,{children:f.jsx("h2",{children:"App Library"})})}),f.jsxs(mo,{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(rt,{children:f.jsx(zs,{id:"search",size:"small",placeholder:"Search Apps...","aria-label":"Search for an app",onChange:x,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(s9,{position:"start",children:!o&&f.jsx(C3,{style:{fill:"rgba(15, 16, 21, 0.56)"}})})}})}),f.jsx(rt,{children:f.jsx(ft,{id:"create-app",variant:"contained",color:"primary",size:"large",startIcon:f.jsx(u8,{}),onClick:()=>{window.location.href=`${ev}/create-app`},children:"Create App"})})]})]})}),f.jsx(rt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(Vc,{})}),f.jsx(rt,{children:h&&r?f.jsx(JK,{data:h,currentUser:r,setApps:t,isGridViewActive:a,toggleView:g}):f.jsx(f.Fragment,{})}),f.jsx(rt,{children:f.jsx(et,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,rowGap:2,justifyContent:"flex-start",paddingBottom:"48px"},children:w?f.jsx("div",{className:"font-bold",children:"Loading..."}):e.length>0?a?f.jsx(FK,{apps:e}):f.jsx(GK,{apps:e}):f.jsx("div",{children:"No apps available"})})})]})})})},QK=({services:e,apps:t})=>f.jsxs(f.Fragment,{children:[t.map((n,r)=>y.createElement(jA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1,app:n})),e.map((n,r)=>y.createElement(jA,{...n,key:`app-${n.id}-${r}`,title:n.name,serverStatus:n.status,isAppCard:!1}))]}),KK=()=>{const[e]=Je(Di),[,t]=Je(Kr),[n,r]=y.useState([]),[o,s]=y.useState([]),{isLoading:i,error:a,data:l}=cr({queryKey:["service-data"],queryFn:()=>Qt.get("/services/").then(p=>p.data).then(p=>p),enabled:!!e}),{isLoading:c,error:u,data:d}=cr({queryKey:["app-state"],queryFn:()=>Qt.get("/server/").then(p=>p.data).then(p=>p),enabled:!!e});return y.useEffect(()=>{!i&&l&&e&&r(()=>D5(l,e.name))},[i,l,e]),y.useEffect(()=>{!c&&d&&e&&s(()=>T5(d,e.name))},[c,d,e]),y.useEffect(()=>{t(a?a.message:u?u.message:void 0)},[a,u,t]),f.jsx(et,{children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx(mo,{container:!0,spacing:2,children:f.jsx(mo,{item:!0,xs:12,md:4,children:f.jsx(rt,{children:f.jsx("h2",{children:"Quick Access"})})})})}),f.jsx(rt,{sx:{pt:"16px",pb:"24px"},children:f.jsx(Vc,{})}),f.jsx(rt,{children:f.jsx(et,{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(QK,{services:n,apps:o}):f.jsx("div",{children:"No services available"})})})]})})},gw=()=>{const[,e]=Je(Kr),[t]=Je(Ov),[n,r]=Je(Lg),[o,s]=Je(Cv),[i,a]=Je(Xg),[l,c]=y.useState(!1),u=tv(),d=async({id:j})=>{try{return await Qt.post(`/server/${j}`)}catch(z){console.error("There was an error!",z),e(z.toString())}},p=async({id:j,remove:z})=>{try{return await Qt.delete(`/server/${j}`,{params:{remove:z}})}catch(H){console.error("There was an error!",H),e(H.toString())}},{mutate:m}=Za({mutationFn:d,retry:1}),{mutate:v}=Za({mutationFn:p,retry:1}),g=()=>{const j=(t==null?void 0:t.id)||"";c(!0),v({id:j,remove:!0},{onSuccess:async()=>{c(!1),a(!1),u.invalidateQueries({queryKey:["app-state"]})},onError:async z=>{c(!1),e(z.message)}})},w=async()=>{const j=(t==null?void 0:t.id)||"";try{c(!0),await m({id:j},{onSuccess:async()=>{r(!1),u.invalidateQueries({queryKey:["app-state"]})},onError:z=>{e(z.message)}})}catch(z){console.error("Error in handleStart",z),e(z.message)}finally{c(!1)}},A=async()=>{const j=(t==null?void 0:t.id)||"";c(!0);try{v({id:j,remove:!1},{onSuccess:()=>{s(!1),u.invalidateQueries({queryKey:["app-state"]})},onError:z=>{e(z.message)}})}catch(z){z instanceof Error?e(z.message):console.error("An unknown error occurred",z)}finally{c(!1)}},h=f.jsxs(f.Fragment,{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.jsxs(Vf,{children:[f.jsx(ft,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>r(!1),children:"Cancel"}),f.jsx(ft,{id:"start-btn","data-testid":"start-btn",variant:"contained",color:"primary",onClick:w,disabled:l,children:"Start"})]})]}),P=f.jsxs(f.Fragment,{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(Vf,{children:[f.jsx(ft,{id:"cancel-btn",variant:"text",color:"primary",onClick:()=>s(!1),children:"Cancel"}),f.jsx(ft,{id:"stop-btn",variant:"contained",color:"primary",onClick:A,disabled:l,children:"Stop"})]})]}),x=f.jsxs(f.Fragment,{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}),"? This action is permanent and cannot be reversed."]}),f.jsxs(Vf,{children:[f.jsx(ft,{id:"cancel-btn","data-testid":"cancel-btn",variant:"text",color:"primary",onClick:()=>a(!1),children:"Cancel"}),f.jsx(ft,{id:"delete-btn","data-testid":"delete-btn",variant:"contained",color:"error",onClick:g,disabled:l,children:"Delete"})]})]});return f.jsxs(et,{sx:{flexGrow:1},className:"container",children:[f.jsx(mo,{container:!0,spacing:2,paddingBottom:"32px",children:f.jsx(mo,{item:!0,xs:12,md:2,children:f.jsx(rt,{children:f.jsx("h1",{className:"h5",children:"Home"})})})}),f.jsx(KK,{}),f.jsx(UK,{}),n&&f.jsxs(Sf,{open:n,onClose:()=>r(!1),"data-testid":"StartModal",children:[f.jsxs(gh,{children:["Start ",t==null?void 0:t.name]}),f.jsx(Ph,{children:h})]}),o&&f.jsxs(Sf,{open:o,onClose:()=>s(!1),"data-testid":"StopModal",children:[f.jsxs(gh,{children:["Stop ",t==null?void 0:t.name]}),f.jsx(Ph,{children:P})]}),i&&f.jsxs(Sf,{open:i,onClose:()=>a(!1),"data-testid":"DeleteModal",children:[f.jsxs(gh,{children:["Delete ",t==null?void 0:t.name]}),f.jsx(Ph,{children:x})]})]})};function _K(e){return De("MuiLoadingButton",e)}const $K=Se("MuiLoadingButton",["root","loading","loadingIndicator","loadingIndicatorCenter","loadingIndicatorStart","loadingIndicatorEnd","endIconLoadingEnd","startIconLoadingStart"]),Oo=$K,e_=["children","disabled","id","loading","loadingIndicator","loadingPosition","variant"],t_=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=Te(o,_K,r);return b({},r,s)},n_=e=>e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"&&e!=="classes",r_=U(ft,{shouldForwardProp:e=>n_(e)||e==="classes",name:"MuiLoadingButton",slot:"Root",overridesResolver:(e,t)=>[t.root,t.startIconLoadingStart&&{[`& .${Oo.startIconLoadingStart}`]:t.startIconLoadingStart},t.endIconLoadingEnd&&{[`& .${Oo.endIconLoadingEnd}`]:t.endIconLoadingEnd}]})(({ownerState:e,theme:t})=>b({[`& .${Oo.startIconLoadingStart}, & .${Oo.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}),[`&.${Oo.loading}`]:{color:"transparent"}},e.loadingPosition==="start"&&e.fullWidth&&{[`& .${Oo.startIconLoadingStart}, & .${Oo.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginRight:-8}},e.loadingPosition==="end"&&e.fullWidth&&{[`& .${Oo.startIconLoadingStart}, & .${Oo.endIconLoadingEnd}`]:{transition:t.transitions.create(["opacity"],{duration:t.transitions.duration.short}),opacity:0,marginLeft:-8}})),o_=U("span",{name:"MuiLoadingButton",slot:"LoadingIndicator",overridesResolver:(e,t)=>{const{ownerState:n}=e;return[t.loadingIndicator,t[`loadingIndicator${_(n.loadingPosition)}`]]}})(({theme:e,ownerState:t})=>b({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})),s_=y.forwardRef(function(t,n){const r=y.useContext(F2),o=up(r,t),s=Re({props:o,name:"MuiLoadingButton"}),{children:i,disabled:a=!1,id:l,loading:c=!1,loadingIndicator:u,loadingPosition:d="center",variant:p="text"}=s,m=ue(s,e_),v=Po(l),g=u??f.jsx(ik,{"aria-labelledby":v,color:"inherit",size:16}),w=b({},s,{disabled:a,loading:c,loadingIndicator:g,loadingPosition:d,variant:p}),A=t_(w),h=c?f.jsx(o_,{className:A.loadingIndicator,ownerState:w,children:g}):null;return f.jsxs(r_,b({disabled:a||c,id:v,ref:n},m,{variant:p,classes:A,ownerState:w,children:[w.loadingPosition==="end"?i:h,w.loadingPosition==="end"?h:i]}))}),i_=s_,a_=()=>{const[e]=G9(),t=pg(),n=tv(),[r,o]=y.useState(!1),[s]=Je(Di),[,i]=Je(Kr),[a,l]=Je(A5),[c]=Je(m5),[u]=Je(g5),[d]=Je(P5),[,p]=Je(Kr),[m,v]=Ce.useState((a==null?void 0:a.profile)||""),g=e.get("id"),{data:w,isLoading:A,error:h}=cr({queryKey:["server-types"],queryFn:()=>Qt.get("/spawner-profiles/").then(D=>D.data).then(D=>D),enabled:!!s}),P=D=>{v(D),a&&l({...a,profile:D})},x=D=>{var T,M;D.preventDefault();const S=(a==null?void 0:a.display_name)||"",W={servername:c||S,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:HA(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:((T=a==null?void 0:a.share_with)==null?void 0:T.users)||[],groups:((M=a==null?void 0:a.share_with)==null?void 0:M.groups)||[]},keep_alive:(a==null?void 0:a.keep_alive)||!1}};o(!0),g?O(W,{onSuccess:async()=>{n.invalidateQueries({queryKey:["app-state"]}),window.location.assign(ir)},onError:async J=>{o(!1),p(J.message)}}):H(W,{onSuccess:async J=>{const R=s==null?void 0:s.name;if(R&&(J==null?void 0:J.length)>1){const Y=J[1];window.location.assign(`/hub/spawn-pending/${R}/${Y}`)}},onError:async J=>{o(!1),p(J.message)}})},j=async({servername:D,user_options:S})=>{const W={accept:"application/json","Content-Type":"multipart/form-data"},T=new FormData;return T.append("data",JSON.stringify({servername:D,user_options:S})),u&&T.append("thumbnail",u),(await Qt.post("/server",T,{headers:W})).data},z=async({servername:D,user_options:S})=>{const W={accept:"application/json","Content-Type":"multipart/form-data"},T=new FormData;return T.append("data",JSON.stringify({servername:D,user_options:S})),u?T.append("thumbnail",u):d&&T.append("thumbnail_data_url",d),(await Qt.put(`/server/${D}`,T,{headers:W})).data},{mutate:H}=Za({mutationFn:j,retry:1}),{mutate:O}=Za({mutationFn:z,retry:1});return y.useEffect(()=>{i(h?h.message:void 0)},[h,i]),f.jsx(et,{className:"container",children:f.jsxs(yo,{children:[f.jsx(rt,{children:f.jsx("div",{className:"form-breadcrumb",children:f.jsx(ft,{id:"back-btn",type:"button",variant:"text",color:"primary",startIcon:f.jsx(Xv,{}),onClick:()=>hs(ir),children:"Back To Home"})})}),f.jsxs(rt,{children:[f.jsx(g8,{children:"Server Type"}),f.jsxs(y8,{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(rt,{children:A?f.jsx("div",{className:"font-bold center",children:"Loading..."}):w&&w.length>0?f.jsxs("form",{className:"form",onSubmit:x,children:[f.jsx(qi,{sx:{pb:"36px"},children:f.jsx(Km,{children:w==null?void 0:w.map((D,S)=>f.jsx(q2,{className:"server-type-card",onClick:()=>P(D.slug),tabIndex:0,children:f.jsxs(Ym,{children:[f.jsx(Us,{value:D.slug,id:D.slug,control:f.jsx(Qm,{checked:m?m===D.slug:S===0}),label:D.display_name},D.slug),f.jsx("p",{children:D.description})]})},`server-type-card-${D.slug}`))})}),f.jsx("hr",{}),f.jsxs("div",{className:"button-section",children:[f.jsx("div",{className:"prev",children:f.jsx(ft,{id:"cancel-btn",type:"button",variant:"text",color:"primary",onClick:()=>t(g?`/edit-app?id=${g}`:"/create-app"),children:"Back"})}),f.jsx("div",{className:"next",children:f.jsx(i_,{id:"submit-btn",type:"submit",variant:"contained",color:"primary",loading:r,children:g?"Save":"Create App"})})]})]}):f.jsx("div",{children:"No servers available"})})]})})},l_=()=>{const[,e]=Je(cG),[,t]=Je(Di),[,n]=Je(x5),[r,o]=Je(Kr),{error:s,data:i}=cr({queryKey:["user-state"],queryFn:()=>Qt.get("/user").then(c=>c.data).then(c=>c)}),{error:a,data:l}=cr({queryKey:["server-types"],queryFn:()=>Qt.get("/spawner-profiles/").then(c=>c.data).then(c=>c)});return y.useEffect(()=>{s?o(s.message):a&&o(a.message)},[s,a,o]),y.useEffect(()=>{e(CG())},[e]),y.useEffect(()=>{i&&t({...i})},[i,t]),y.useEffect(()=>{l&&n([...l])},[l,n]),f.jsxs("div",{children:[f.jsx(dK,{}),f.jsxs(et,{component:"main",sx:{flexGrow:1,pt:9,pl:{xs:1,sm:33},pr:1,backgroundColor:"#FAFAFA"},children:[r?f.jsx(pK,{message:r,onClose:()=>o(void 0)}):f.jsx(f.Fragment,{}),f.jsxs(eI,{children:[f.jsx(Yi,{path:"/home",element:f.jsx(gw,{})}),f.jsx(Yi,{path:"/create-app",element:f.jsx(jK,{})}),f.jsx(Yi,{path:"/edit-app",element:f.jsx(zK,{})}),f.jsx(Yi,{path:"/server-types",element:f.jsx(a_,{})}),f.jsx(Yi,{path:"/",element:f.jsx(gw,{})})]})]})]})},c_={50:"#2491FF",100:"#2491FF",200:"#2491FF",300:"#2491FF",400:"#2491FF",500:"#005EA2",600:"#1A4480",700:"#1A4480",800:"#1A4480",900:"#162E51"},Gt={50:"#0F10150A",100:"#E1E3E4",200:"#EEEEEE",300:"#E0E0E0",400:"#90969C",500:"#5B5F63",600:"#44474A",700:"#3C3C3B",800:"#242628",900:"#1A1C1D"},Bs="#BA18DA",Ih="#BA18DA10",yw="#9B00CE",Ii="#18817A",u_="#18817A10",f_="#12635E",d_="#D72D47",p_="#F66A0A",Nr="#FFFFFF",uf="#0F1015",ff="#0F101561",v_=Gt[100],df=hp({typography:{fontFamily:'"Inter", sans-serif'},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}}}}),h_=hp(df,{palette:{primary:df.palette.augmentColor({color:{light:Ih,main:Bs,dark:yw,contrastText:Nr},name:"primary"}),secondary:df.palette.augmentColor({color:{light:u_,main:Ii,dark:f_,contrastText:Nr},name:"secondary"}),gray:df.palette.augmentColor({color:{light:Gt[300],lighter:v_,main:Gt[500],dark:Gt[700],contrastText:uf,50:Gt[50],100:Gt[100],200:Gt[200],300:Gt[300],400:Gt[400],500:Gt[500],600:Gt[600],700:Gt[700],800:Gt[800],900:Gt[900]},name:"gray"}),warning:{main:p_,contrastText:Nr},error:{main:d_,contrastText:Nr},info:{main:c_,contrastText:Nr},success:{main:Ii[500],contrastText:Nr},common:{black:uf,white:Nr}},components:{MuiButton:{variants:[{props:{variant:"contained",color:"primary"},style:{backgroundColor:`${Bs}`,fontWeight:700,"&:hover":{backgroundColor:`${yw}`},"&:disabled":{color:ff}}},{props:{variant:"contained",color:"secondary"},style:{backgroundColor:Gt[200],border:`1px solid ${Gt[200]}`,color:uf,fontWeight:600,"&:hover":{backgroundColor:Gt[300],border:`1px solid ${Gt[300]}`},"&:disabled":{color:ff,borderColor:"transparent"}}},{props:{variant:"contained",color:"error"},style:{fontWeight:600}},{props:{variant:"outlined",color:"primary"},style:{backgroundColor:Nr,border:`2px solid ${Bs}`,color:`${Bs}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Nr,borderWidth:2,border:`2px solid ${Bs}`,color:`${Bs}`}}},{props:{variant:"outlined",color:"secondary"},style:{backgroundColor:Nr,border:`2px solid ${Ii}`,color:`${Ii}`,fontWeight:700,textTransform:"none","&:hover":{backgroundColor:Nr,borderWidth:2,border:`2px solid ${Ii}`,color:`${Ii}`}}},{props:{variant:"text",color:"primary"},style:{color:`${Bs}`,"&:hover":{backgroundColor:`${Ih}`},"&:focus":{backgroundColor:`${Ih}`},"&:disabled":{color:ff}}},{props:{variant:"text",color:"secondary"},style:{color:uf,"&:hover":{backgroundColor:`${Gt[50]}`},"&:focus":{backgroundColor:`${Gt[50]}`},"&:disabled":{color:ff}}}]}}}),m_=new URL(window.location.href),A_=new ZB;uA.createRoot(document.getElementById("root")).render(f.jsx(Ce.StrictMode,{children:f.jsx(oI,{basename:m_.pathname.indexOf("hub")===-1?ev:ir,children:f.jsx(UZ,{children:f.jsxs(Nz,{theme:h_,children:[f.jsx(uk,{}),f.jsx(_B,{client:A_,children:f.jsx(l_,{})})]})})})})); diff --git a/ui/src/index.css b/ui/src/index.css index 39b60751..bbf7f1c3 100644 --- a/ui/src/index.css +++ b/ui/src/index.css @@ -118,7 +118,7 @@ a { /* Misc */ #search { - padding: 10px 12px; + padding: 10px 0; } @media only screen and (min-width: 1537px) { diff --git a/ui/src/pages/home/apps-section/app-filters/app-filters.tsx b/ui/src/pages/home/apps-section/app-filters/app-filters.tsx index 6387ffbe..188daad8 100644 --- a/ui/src/pages/home/apps-section/app-filters/app-filters.tsx +++ b/ui/src/pages/home/apps-section/app-filters/app-filters.tsx @@ -405,10 +405,8 @@ export const AppFilters = ({ bottom: '8px', fontSize: '16px', fontWeight: 600, - width: '180px', color: 'common.black', - px: 0, - mr: 1.5, + mr: '24px', }} endIcon={ sortByOpen ? ( @@ -418,7 +416,7 @@ export const AppFilters = ({ ) } > - + {currentSortValue}