@harperfast/harper-pro 5.0.0-beta.6 → 5.0.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/bin/cliOperations.js +3 -3
- package/core/bin/harper.js +1 -1
- package/core/bin/run.js +2 -2
- package/core/components/Application.ts +6 -3
- package/core/components/ApplicationScope.ts +1 -0
- package/core/components/componentLoader.ts +23 -12
- package/core/components/operations.js +13 -13
- package/core/components/operationsValidation.js +3 -3
- package/core/config/configUtils.js +20 -4
- package/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +3 -2
- package/core/resources/DatabaseTransaction.ts +67 -32
- package/core/resources/Resource.ts +17 -6
- package/core/resources/RocksTransactionLogStore.ts +8 -1
- package/core/resources/Table.ts +29 -10
- package/core/resources/analytics/write.ts +6 -0
- package/core/resources/databases.ts +3 -2
- package/core/security/jsLoader.ts +258 -129
- package/core/server/REST.ts +32 -13
- package/core/server/http.ts +6 -3
- package/core/server/itc/serverHandlers.js +1 -1
- package/core/static/defaultConfig.yaml +1 -1
- package/core/utility/hdbTerms.ts +1 -0
- package/core/utility/logging/harper_logger.js +22 -1
- package/core/utility/logging/readLog.js +2 -2
- package/core/utility/npmUtilities.js +2 -2
- package/core/validation/configValidator.js +16 -8
- package/core/validation/readLogValidator.js +2 -2
- package/dist/core/bin/cliOperations.js +3 -3
- package/dist/core/bin/cliOperations.js.map +1 -1
- package/dist/core/bin/harper.js +1 -1
- package/dist/core/bin/run.js +2 -2
- package/dist/core/bin/run.js.map +1 -1
- package/dist/core/components/Application.js +7 -2
- package/dist/core/components/Application.js.map +1 -1
- package/dist/core/components/ApplicationScope.js +1 -0
- package/dist/core/components/ApplicationScope.js.map +1 -1
- package/dist/core/components/componentLoader.js +21 -10
- package/dist/core/components/componentLoader.js.map +1 -1
- package/dist/core/components/operations.js +13 -13
- package/dist/core/components/operations.js.map +1 -1
- package/dist/core/components/operationsValidation.js +3 -3
- package/dist/core/components/operationsValidation.js.map +1 -1
- package/dist/core/config/configUtils.js +23 -3
- package/dist/core/config/configUtils.js.map +1 -1
- package/dist/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js +3 -2
- package/dist/core/dataLayer/harperBridge/lmdbBridge/lmdbUtility/initializePaths.js.map +1 -1
- package/dist/core/resources/DatabaseTransaction.js +71 -35
- package/dist/core/resources/DatabaseTransaction.js.map +1 -1
- package/dist/core/resources/Resource.js +11 -4
- package/dist/core/resources/Resource.js.map +1 -1
- package/dist/core/resources/RocksTransactionLogStore.js +8 -1
- package/dist/core/resources/RocksTransactionLogStore.js.map +1 -1
- package/dist/core/resources/Table.js +15 -10
- package/dist/core/resources/Table.js.map +1 -1
- package/dist/core/resources/analytics/write.js +6 -0
- package/dist/core/resources/analytics/write.js.map +1 -1
- package/dist/core/resources/databases.js +3 -2
- package/dist/core/resources/databases.js.map +1 -1
- package/dist/core/security/jsLoader.js +223 -116
- package/dist/core/security/jsLoader.js.map +1 -1
- package/dist/core/server/REST.js +30 -14
- package/dist/core/server/REST.js.map +1 -1
- package/dist/core/server/http.js +6 -1
- package/dist/core/server/http.js.map +1 -1
- package/dist/core/server/itc/serverHandlers.js +1 -1
- package/dist/core/server/itc/serverHandlers.js.map +1 -1
- package/dist/core/utility/hdbTerms.js +1 -0
- package/dist/core/utility/hdbTerms.js.map +1 -1
- package/dist/core/utility/logging/harper_logger.js +24 -1
- package/dist/core/utility/logging/harper_logger.js.map +1 -1
- package/dist/core/utility/logging/readLog.js +2 -2
- package/dist/core/utility/logging/readLog.js.map +1 -1
- package/dist/core/utility/npmUtilities.js +2 -2
- package/dist/core/utility/npmUtilities.js.map +1 -1
- package/dist/core/validation/configValidator.js +18 -8
- package/dist/core/validation/configValidator.js.map +1 -1
- package/dist/core/validation/readLogValidator.js +2 -2
- package/dist/core/validation/readLogValidator.js.map +1 -1
- package/dist/licensing/usageLicensing.js +16 -26
- package/dist/licensing/usageLicensing.js.map +1 -1
- package/dist/replication/nodeIdMapping.js +1 -1
- package/dist/replication/nodeIdMapping.js.map +1 -1
- package/dist/replication/replicationConnection.js +2 -2
- package/dist/replication/replicationConnection.js.map +1 -1
- package/licensing/usageLicensing.ts +22 -32
- package/npm-shrinkwrap.json +615 -614
- package/package.json +9 -6
- package/replication/nodeIdMapping.ts +1 -1
- package/replication/replicationConnection.ts +2 -2
- package/static/defaultConfig.yaml +3 -0
- package/studio/web/assets/{index-BckVDix4.js → index-CXQsBaYq.js} +5 -5
- package/studio/web/assets/{index-BckVDix4.js.map → index-CXQsBaYq.js.map} +1 -1
- package/studio/web/assets/{index.lazy-iG1_8dzm.js → index.lazy-C3Ejfvna.js} +2 -2
- package/studio/web/assets/{index.lazy-iG1_8dzm.js.map → index.lazy-C3Ejfvna.js.map} +1 -1
- package/studio/web/assets/{profile-CzjslUXv.js → profile-BbbbWJCN.js} +2 -2
- package/studio/web/assets/{profile-CzjslUXv.js.map → profile-BbbbWJCN.js.map} +1 -1
- package/studio/web/assets/{status-BP4TQJDR.js → status-CFe85l8C.js} +2 -2
- package/studio/web/assets/{status-BP4TQJDR.js.map → status-CFe85l8C.js.map} +1 -1
- package/studio/web/index.html +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.lazy-
|
|
2
|
-
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v}from"./cn-BnE9QzQD.js";import{$t as y,Bt as b,Ft as x,Gt as ee,Ht as S,It as te,Kt as C,Lt as w,Pt as T,Qt as ne,Rt as E,Ut as re,Vt as ie,Wt as D,qt as ae,zt as oe}from"./vendor-core-BY_ZlgBF.js";import{$i as se,$n as ce,$r as le,$t as ue,Ai as de,An as O,Ar as fe,At as pe,Bi as me,Bn as he,Br as ge,Bt as _e,Ci as ve,Cn as ye,Cr as be,Ct as xe,Di as Se,Dn as Ce,Dr as we,Dt as Te,Ei as Ee,En as De,Er as Oe,Et as ke,Fi as Ae,Fn as k,Fr as je,Ft as Me,Gi as Ne,Gn as Pe,Gr as Fe,Gt as Ie,Hi as Le,Hn as Re,Hr as ze,Ht as Be,Ii as A,In as Ve,Ir as He,It as Ue,Ji as We,Jn as Ge,Jr as Ke,Jt as qe,Ki as j,Kn as Je,Kr as Ye,Kt as Xe,Li as M,Ln as Ze,Lt as Qe,Mi as $e,Mn as et,Mr as tt,Mt as nt,Ni as rt,Nn as it,Nr as at,Nt as ot,Oi as st,On as ct,Or as lt,Ot as ut,Pn as dt,Pr as ft,Pt as pt,Qi as mt,Qn as N,Qr as ht,Qt as gt,Ri as _t,Rn as vt,Rr as yt,Rt as bt,Si as xt,Sn as St,Sr as Ct,St as wt,Ti as Tt,Tn as Et,Tr as Dt,Tt as Ot,Ui as kt,Un as At,Ur as jt,Ut as Mt,Vi as P,Vn as Nt,Vr as Pt,Vt as Ft,Wi as It,Wn as Lt,Wr as Rt,Wt as zt,Xi as Bt,Xn as Vt,Xr as Ht,Xt as Ut,Yi as F,Yn as Wt,Yr as Gt,Yt as Kt,Zi as qt,Zn as Jt,Zr as Yt,Zt as Xt,_i as Zt,_n as Qt,_r as $t,ai as en,an as tn,ar as nn,bi as rn,bn as an,br as on,bt as sn,ci as cn,cn as ln,cr as un,di as dn,dn as fn,dr as pn,ei as mn,en as hn,er as gn,fi as _n,fn as vn,fr as yn,gn as bn,gr as xn,hi as Sn,hn as Cn,hr as wn,ii as Tn,in as En,ir as Dn,ji as On,jn as kn,jr as An,jt as jn,ki as Mn,kn as Nn,kr as Pn,kt as Fn,li as In,ln as Ln,lr as Rn,mi as zn,mn as Bn,mr as Vn,ni as Hn,nn as Un,nr as Wn,oi as Gn,on as Kn,or as qn,pi as Jn,pn as Yn,pr as Xn,qi as I,qn as Zn,qr as Qn,qt as $n,ri as er,rn as tr,rr as nr,si as rr,sn as ir,sr as ar,ti as or,tn as sr,ui as cr,un as lr,ur,vi as dr,vn as fr,vr as pr,wi as mr,wn as hr,wr as gr,wt as _r,xi as vr,xn as yr,xr as br,xt as xr,yi as Sr,yn as Cr,yr as wr,yt as Tr,zi as L,zn as Er,zr as Dr,zt as Or}from"./vendor-react-DrZSc0Lm.js";import{c as kr,l as Ar,s as jr}from"./vendor-tanstack-D3CJwJKs.js";import"./vendor-misc-BBL3Mh21.js";import{a as Mr,i as Nr,n as Pr,r as Fr,t as R}from"./button-DWsEHYDp.js";import{i as Ir,r as Lr}from"./vendor-datadog-B4t4E5qd.js";import"./vendor-stripe-DzjP9RhF.js";import"./vendor-monaco-CLBN4H7U.js";import"./vendor-html-C0BzV7Np.js";import{t as Rr}from"./vendor-markdown-c5U0YRyN.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var z=e(se(),1),B=mt();function zr({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card`,className:g(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl py-4 shadow-deep`,e),...t})}function Br({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-header`,className:g(`flex flex-col gap-1.5 px-6`,e),...t})}function Vr({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-title`,className:g(`leading-none text-lg`,e),...t})}function Hr({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-description`,className:g(`text-muted-foreground text-xs`,e),...t})}function Ur({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-content`,className:g(`px-6`,e),...t})}function Wr(e){return e!==null&&!!e.username}function Gr(e){if(e&&!Wr(e)){let t=Object.keys(e.roles);if(t.length===1)return`/${t[0]}`}return`/`}function Kr({className:e,error:t,title:n,showReturnToHome:r,children:i}){let{user:a,isLoading:o}=Nr();return Gr(a),(0,B.jsxs)(zr,{className:g(`text-red p-5 border border-red rounded-md m-12 mt-36`,e),children:[(0,B.jsxs)(Br,{children:[(0,B.jsx)(Vr,{className:`text-2xl`,children:(0,B.jsx)(`h2`,{children:n??`Component Error`})}),(0,B.jsx)(Hr,{children:t.message})]}),(0,B.jsxs)(Ur,{children:[i,r!==!1&&(a&&!o?(0,B.jsx)(M,{to:`/`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Return to Home`]})}):(0,B.jsx)(M,{to:`/sign-in`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Go to Sign In Page`]})}))]})]})}function qr(){let{user:e,isLoading:t}=Nr();return Gr(e),(0,B.jsx)(`div`,{className:`flex items-center justify-center h-screen px-3`,children:(0,B.jsxs)(zr,{className:`text-red p-5 border border-red rounded-md w-full max-w-md`,children:[(0,B.jsx)(Br,{children:(0,B.jsx)(Vr,{className:`text-2xl`,children:(0,B.jsx)(`h2`,{children:`Sorry, Page Not Found`})})}),(0,B.jsx)(Ur,{children:e&&!t?(0,B.jsx)(M,{to:`/`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Return to Home`]})}):(0,B.jsx)(M,{to:`/sign-in`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Go Sign In Page`]})})})]})})}function Jr(){return`ontouchstart`in window||navigator.maxTouchPoints>0}function Yr(e){let t=`Error`,n=`We had some trouble!`;console.error(e);let r=e,i=e;if(typeof e==`string`?n=e:r?.response?.data?typeof r.response.data==`string`?n=r.response.data:r.response.data.error?n=r.response.data.error:r.response.data.message&&(n=r.response.data.message):i?.message&&(n=i.message),n.includes(`:`)){let e=n.split(`:`);t=e.shift(),n=e.join(`:`)}N.error(t,{description:n,action:{label:`Dismiss`,onClick:()=>N.dismiss()}})}var Xr=new jr({queryCache:new kr({onError:Yr}),mutationCache:new Ar({onError:Yr})});function Zr(e){return!!e}var Qr=!1,$r=!1;function ei(){(0,z.useEffect)(()=>{Qr||(Qr=!0,$r&&(Lr.init({applicationId:`f590deee-4bac-49b4-a202-3b6963d9721d`,clientToken:`pub27aa29cea521492f4fef73032f86a023`,site:`datadoghq.com`,service:`studio`,env:void 0,version:`v5.0.0-beta.6`,trackViewsManually:!0,trackUserInteractions:!0,sessionSampleRate:100,sessionReplaySampleRate:0,defaultPrivacyLevel:`mask`,plugins:[Vt()]}),Lr.onReady(()=>{Lr.startView({service:`studio`,version:`v5.0.0-beta.6`,name:window.location.pathname||`initial`})})))},[])}function ti(e){if(!$r)return;Lr.setUser({id:e.id,email:e.email,name:[e.firstname,e.lastname].filter(Boolean).join(` `)||void 0});let t=`hasLoggedInBefore:${e.id}`;localStorage.getItem(t)?Lr.addAction(`return_login`):(Lr.addAction(`first_time_login`),localStorage.setItem(t,`true`));let n=`lastLoginTimestamp:${e.id}`,r=localStorage.getItem(n),i=Date.now();if(r){let e=Math.floor((i-Number(r))/1e3);!Number.isNaN(e)&&e>=0&&Lr.addAction(`login_time_gap`,{value:e})}localStorage.setItem(n,String(i)),Lr.addAction(`login_success`,{userId:e.id})}function ni(){return(0,B.jsx)(B.Fragment,{children:(0,B.jsx)($e,{})})}var ri=Ae()({component:ni});function ii(){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 126.644 96`,width:24,height:24,children:(0,B.jsx)(`path`,{fill:`currentColor`,d:`M81.15,0c-1.2376,2.1973-2.3489,4.4704-3.3591,6.794-9.5975-1.4396-19.3718-1.4396-28.9945,0-.985-2.3236-2.1216-4.5967-3.3591-6.794-9.0166,1.5407-17.8059,4.2431-26.1405,8.0568C2.779,32.5304-1.6914,56.3725.5312,79.8863c9.6732,7.1476,20.5083,12.603,32.0505,16.0884,2.6014-3.4854,4.8998-7.1981,6.8698-11.0623-3.738-1.3891-7.3497-3.1318-10.8098-5.1523.9092-.6567,1.7932-1.3386,2.6519-1.9953,20.281,9.547,43.7696,9.547,64.0758,0,.8587.7072,1.7427,1.3891,2.6519,1.9953-3.4601,2.0457-7.0718,3.7632-10.835,5.1776,1.97,3.8642,4.2683,7.5769,6.8698,11.0623,11.5419-3.4854,22.3769-8.9156,32.0509-16.0631,2.626-27.2771-4.496-50.9172-18.817-71.8548C98.9811,4.2684,90.1918,1.5659,81.1752.0505l-.0252-.0505ZM42.2802,65.4144c-6.2383,0-11.4159-5.6575-11.4159-12.6535s4.9755-12.6788,11.3907-12.6788,11.5169,5.708,11.4159,12.6788c-.101,6.9708-5.026,12.6535-11.3907,12.6535ZM84.3576,65.4144c-6.2637,0-11.3907-5.6575-11.3907-12.6535s4.9755-12.6788,11.3907-12.6788,11.4917,5.708,11.3906,12.6788c-.101,6.9708-5.026,12.6535-11.3906,12.6535Z`})})}function ai(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`img`,{src:`/harper-studio_white.png`,alt:`Harper Studio`,className:`w-64 hidden md:inline-block`}),(0,B.jsx)(`img`,{src:`/HDBDogOnly.svg`,width:`50px`,height:`44px`,alt:`Harper`,className:`inline-block md:hidden`})]})}function oi({className:e,...t}){return(0,B.jsx)(`div`,{className:g(`absolute top-full left-0 isolate z-50 flex justify-center`),children:(0,B.jsx)(Ge,{"data-slot":`navigation-menu-viewport`,className:g(`origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]`,e),...t})})}function si({className:e,children:t,viewport:n=!0,...r}){return(0,B.jsxs)(Zn,{"data-slot":`navigation-menu`,"data-viewport":n,className:g(`group/navigation-menu relative flex max-w-max flex-1 items-center justify-center`,e),...r,children:[t,n&&(0,B.jsx)(oi,{})]})}function ci({className:e,...t}){return(0,B.jsx)(Lt,{"data-slot":`navigation-menu-item`,className:g(`relative`,e),...t})}function li({className:e,...t}){return(0,B.jsx)(Pe,{"data-slot":`navigation-menu-link`,className:g(`hover:text-white ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 flex flex-col gap-1 rounded-sm p-2 text-sm transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4`,e),...t})}function ui({className:e,...t}){return(0,B.jsx)(Je,{"data-slot":`navigation-menu-list`,className:g(`group flex flex-1 list-none items-center justify-center gap-1`,e),...t})}var di=ne(`inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-auto`,{variants:{variant:{default:`border-primary bg-primary/40 text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`border-secondary bg-secondary/40 text-secondary-foreground [a&]:hover:bg-secondary/90`,warning:`border-yellow bg-yellow/40 text-white [a&]:hover:bg-yellow/90`,success:`border-green bg-green/40 text-white [a&]:hover:bg-green/90`,destructive:`border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40`,outline:`text-white [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function fi(){return(0,B.jsx)(`a`,{href:`https://github.com/HarperFast/studio/releases`,target:`_blank`,rel:`noopener noreferrer`,children:(0,B.jsxs)(`span`,{className:g(di({variant:`default`}),`text-xs inline-block ml-2 align-text-top`),children:[`v5.0.0-beta.6`,` BETA`]})})}function pi(e,t,n){let{instanceId:r,clusterId:a}=P({strict:!1});return i({id:d,operationsUrl:e,port:t,secure:n})}function mi(e,t,n){let{instanceId:r,clusterId:a}=P({strict:!1});return{instanceClient:i({id:d,operationsUrl:e,port:t,secure:n}),entityType:`instance`}}function V(e,t,n){let r=P({strict:!1});return(0,z.useMemo)(()=>hi({...r,operationsUrl:e,port:t,secure:n}),[r,e,t,n])}function hi({instanceId:e,clusterId:t,operationsUrl:n,port:r,secure:a}){let o=d;if(!o)throw Error(`id could not be automatically calculated in useInstanceClientIdParams`);return{instanceClient:i({id:o,operationsUrl:n,port:r,secure:a}),entityId:o,entityType:`instance`}}function gi(){localStorage.clear()}function _i(){sessionStorage.clear()}async function vi(){m.setUserForEntity(d,null),Xr.getQueryCache().clear(),gi(),_i(),await Xr.invalidateQueries({refetchType:`none`})}async function yi(e){await m.signOutFromPotentiallyAuthenticatedInstances(),await h({...e,entityId:d})}function bi(){let e=pi();return j({mutationFn:()=>yi({instanceClient:e}),onSuccess:vi})}function xi(e){let{user:t}=Pr(),{organizationId:n}=P({strict:!1}),r=t?.roles?.[e??n];return!r?.permission&&!r?.organization?{update:!1,remove:!1}:r.permission?.super_user?{update:!0,remove:!0}:{update:r.organization.update,remove:r.organization.delete}}function Si(e){let{user:t}=Pr(),{organizationId:n}=P({strict:!1}),r=t?.roles?.[e??n];if(!r?.permission&&!r?.organization?.roles)return{create:!1,remove:!1,update:!1,view:!1};if(r.permission?.super_user)return{create:!0,remove:!0,update:!0,view:!0};let i=r.organization.roles;return{create:i.create,remove:i.delete,update:i.update,view:i.view}}function Ci(e,t){let{user:n}=Pr(),{organizationId:r,clusterId:i}=P({strict:!1});return wi(n,e??r,t??i)}function wi(e,t,n){let r=e?.roles?.[t];if(!r?.permission&&!r?.organization?.clusters)return{create:!1,remove:!1,update:!1,view:!1};if(r.permission?.super_user)return{create:!0,remove:!0,update:!0,view:!0};let i=r.organization.clusters.resources?.find(e=>e.id===n),a=r.organization.clusters;return{create:a.create,remove:i?i.delete:a.delete,update:i?i.update:a.update,view:i?i.view:a.view}}function Ti(e,t){let{user:n}=Pr(),{organizationId:r,clusterId:i}=P({strict:!1});return Ei(n,e??r,t??i)}function Ei(e,t,n){let r=e?.roles?.[t];if(!r?.permission&&!r?.organization?.clusters)return{create:!1,remove:!1,update:!1,view:!1};if(r.permission?.super_user)return{create:!0,remove:!0,update:!0,view:!0};let i=r.organization.clusters.resources?.find(e=>e.id===n)?.instances,a=r.organization.clusters;return{create:i?i.create:a.create,remove:i?i.delete:a.delete,update:i?i.update:a.update,view:i?i.view:a.view}}function Di(e){let{clusterId:t,instanceId:n}=P({strict:!1}),{user:r}=Fr(e??n??t),i=r?.role?.permission;return i?i.super_user===!0:!1}function Oi(e){let{clusterId:t,instanceId:n}=P({strict:!1}),{user:r}=Fr(e??n??t),i=r?.role?.permission;return i?i.super_user===!0||i.structure_user===!0:!1}function ki(e,t,n,r){let{clusterId:i,instanceId:a}=P({strict:!1}),{user:o}=Fr(e??a??i),s=o?.role?.permission;return s?s.super_user===!0||s.structure_user===!0?!0:s[t]?.tables?.[n][r]===!0:!1}var Ai={className:`text-white`};function ji(){let{mutate:e}=bi(),t=L(),{user:n}=Nr(),r=kt(),{organizationId:i}=P({strict:!1}),{update:a}=xi(i),{view:o}=Si(i),s=a,c=(0,z.useCallback)(()=>{e(void 0,{onSuccess:async()=>{N.success(`Success`,{description:`You have been signed out successfully.`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),t({to:`/sign-in`}),r.invalidate()}})},[e,r,t]),l=(0,z.useMemo)(()=>[!1,!1,!1,{to:`https://docs.harperdb.io/docs`,target:`_blank`,icon:(0,B.jsx)(Sr,{}),text:`Docs`,textBreakpoint:`md`},{to:`https://github.com/HarperFast/studio/issues`,target:`_blank`,icon:(0,B.jsx)(Zt,{}),text:`Report an Issue`,textBreakpoint:`lg`},{to:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,icon:(0,B.jsx)(ii,{}),text:`Discord`,textBreakpoint:`lg`},{onClick:c,icon:(0,B.jsx)(we,{}),text:`Sign Out`,textBreakpoint:`md`}].filter(Zr),[i,s,o,c]);return n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ii,{menuItems:l}),(0,B.jsx)(Pi,{menuItems:l})]}):(0,B.jsx)(Ni,{})}function Mi(e){return e.items!==void 0}function Ni(){return(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`inline-block`,children:[(0,B.jsx)(M,{to:`/sign-in`,children:(0,B.jsx)(ai,{})}),(0,B.jsx)(fi,{})]}),(0,B.jsx)(si,{children:(0,B.jsxs)(ui,{className:`text-grey-400`,children:[(0,B.jsx)(ci,{children:(0,B.jsx)(li,{asChild:!0,children:(0,B.jsxs)(M,{to:`https://docs.harperdb.io/docs`,target:`_blank`,rel:`noreferrer noopener`,className:`flex-row items-center`,children:[(0,B.jsx)(Sr,{}),` `,(0,B.jsx)(`span`,{className:`hidden md:inline-block`,children:`Docs`})]})})}),(0,B.jsx)(ci,{children:(0,B.jsx)(li,{asChild:!0,children:(0,B.jsxs)(M,{to:`/sign-in`,className:`flex-row items-center`,activeProps:Ai,children:[(0,B.jsx)(Pn,{}),` Sign In`]})})})]})})]})}function Pi({menuItems:e}){let{user:t}=Nr();return Gr(t),(0,B.jsx)(`div`,{className:`hidden md:block`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`inline-block`,children:[(0,B.jsx)(M,{to:`/`,children:(0,B.jsx)(ai,{})}),(0,B.jsx)(fi,{})]}),(0,B.jsx)(si,{children:(0,B.jsx)(ui,{className:`text-grey-400`,children:e.map(e=>Mi(e)?!!e.items.length&&(0,B.jsx)(`div`,{className:`bg-black rounded-2xl flex`,children:e.items.map(e=>(0,B.jsx)(Fi,{menuItem:e},e.text))},e.text):(0,B.jsx)(Fi,{menuItem:e},e.text))})})]})})}function Fi({menuItem:e}){return(0,B.jsx)(ci,{className:`text-gray-400 hover:text-white`,children:(0,B.jsx)(li,{asChild:!0,children:(0,B.jsxs)(M,{to:e.to,onClick:e.onClick,className:`flex-row items-center`,target:e.target,activeProps:e.to?Ai:void 0,children:[e.icon,(0,B.jsx)(`span`,{className:`hidden ${e.textBreakpoint}:inline-block`,children:e.text}),(0,B.jsx)(`span`,{className:`${e.textBreakpoint}:hidden`,children:`\xA0`})]})})})}function Ii({menuItems:e}){let{user:t}=Nr();Gr(t);let[n,r]=(0,z.useState)(!1),i=(0,z.useCallback)(()=>r(e=>!e),[]),a=(0,z.useCallback)(()=>r(!1),[]);return(0,B.jsxs)(`div`,{className:`md:hidden`,id:`mobile-menu`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(M,{to:`/`,children:(0,B.jsx)(ai,{})}),(0,B.jsx)(fi,{}),(0,B.jsxs)(`button`,{type:`button`,className:`shadow-xs text-grey-400 hover:text-white hover:bg-black-dark`,onClick:i,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:n?`Close menu`:`Open menu`}),n?(0,B.jsx)(ce,{}):(0,B.jsx)(Dt,{})]})]}),(0,B.jsx)(`div`,{className:`${n?`fixed`:`hidden`} top-40 bottom-0 left-0 right-0 bg-black-dark opacity-70`,onClick:a}),(0,B.jsx)(`div`,{className:`${n?`block`:`hidden`} md:hidden z-50 space-y-1 pb-3 bg-black-dark absolute left-0 top-full w-full rounded-b-md`,children:e.map(e=>Mi(e)?!!e.items.length&&(0,B.jsx)(`div`,{className:`bg-black pl-10 pr-2 py-2`,children:e.items.map(e=>(0,B.jsx)(Li,{menuItem:e,onClick:a},e.text))},e.text):(0,B.jsx)(Li,{menuItem:e,onClick:a},e.text))})]})}function Li({menuItem:e,onClick:t}){let n=(0,z.useCallback)(()=>{e.onClick?.(),t()},[e,t]);return(0,B.jsxs)(M,{to:e.to,onClick:n,target:e.target,className:`flex flex-row px-3 py-2 text-base font-medium rounded-md text-gray-400 hover:text-white`,activeProps:e.to?Ai:void 0,children:[e.icon,(0,B.jsx)(`span`,{className:`ml-4`,children:e.text})]})}function Ri(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-black-dark dark:bg-black-dark dark:border-b dark:border-black md:px-12`,children:(0,B.jsx)(ji,{})}),(0,B.jsxs)(`div`,{className:`pt-20 grid h-screen grid-cols-1 md:grid-cols-2`,children:[(0,B.jsx)(`section`,{className:`items-center justify-center hidden text-white md:flex px-6 fabricSignupTextContainer`,children:(0,B.jsx)(`img`,{className:`object-scale-down max-h-[calc(100vh-80px-40px)] min-h-115`,src:`/fabric-signup-text.png`,alt:`One Runtime: App, database, Cache and Messaging. Distributed by design, free to deploy, and live in minutes. Deploy!`})}),(0,B.jsx)(`section`,{className:`flex items-center justify-center px-6 bg-linear-(--purple-gradient) dark:bg-linear-(--black-dark-gradient)`,children:(0,B.jsx)($e,{})})]})]})}var zi;function Bi(){(0,z.useEffect)(()=>{},[])}var Vi=[`gmail.com`,`yahoo.com`,`hotmail.com`,`outlook.com`,`icloud.com`,`aol.com`,`protonmail.com`,`mail.com`,`zoho.com`,`yandex.com`,`gmx.com`,`live.com`,`msn.com`,`me.com`,`inbox.com`];function Hi(e){if(!e||!e.includes(`@`))return null;let t=e.split(`@`).pop()||``;if(!t)return null;for(let e of Vi)if(t===e||t.endsWith(`.`+e))return null;return t}var Ui=null;function Wi(){let e=L(),t=kt(),n=qt(),{redirect:i}=me({strict:!1});return(0,z.useEffect)(()=>{Ui||=(async function(){let a=await l().catch(()=>null);if(!a)N.error(`We were not able to verify your sign-in. Please try signing in again.`,{duration:1e4}),await e({to:`/sign-in`});else{m.setUserForEntity(d,a);let o=Gr(a);ti(a);let s=Hi(a.email);zi?.identify?.({username:a.email,type:`email`,...s?{company:s}:{}}),await n.invalidateQueries({queryKey:r,refetchType:`none`}),await t.invalidate(),await e({to:i?.startsWith(`/`)?i:o})}Ui=null})()},[]),(0,B.jsxs)(`div`,{className:`text-white w-lg flex flex-col gap-4`,children:[(0,B.jsxs)(`h1`,{className:`text-3xl font-light`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`text-2xl animate-flower-dance mr-4`,title:`Loading`,children:`🌼`}),`Checking...`]}),(0,B.jsx)(`div`,{className:`underline flex gap-4`,children:(0,B.jsx)(M,{className:`text-sm opacity-50 hover:text-blue-300`,to:`/sign-in`,children:`Try signing in again`})})]})}function Gi({delayDuration:e=0,...t}){return(0,B.jsx)(Nt,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ki({...e}){return(0,B.jsx)(Gi,{children:(0,B.jsx)(Re,{"data-slot":`tooltip`,...e})})}function qi({...e}){return(0,B.jsx)(At,{"data-slot":`tooltip-trigger`,...e})}function Ji({className:e,sideOffset:t=0,arrowClassName:n,children:r,...i}){return(0,B.jsx)(he,{children:(0,B.jsxs)(Er,{"data-slot":`tooltip-content`,sideOffset:t,className:g(`bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...i,children:[r,(0,B.jsx)(vt,{className:g(`bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`,n)})]})})}var Yi=new Map;function Xi(e){if(!e)return``;if(Yi.has(e))return Yi.get(e);let t=e.replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim();if(!t)return Yi.set(e,``),``;let n=t.match(/([A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|[0-9]+)/g);if(!n)return Yi.set(e,``),``;let r=[];for(let e=0;e<n.length;e++){let t=n[e],i=e+1<n.length?n[e+1]:void 0;/^[A-Z]{2,}$/.test(t)&&i&&/[A-Z]*s$/.test(i)||/^[A-Z]$/.test(t)&&i!==void 0&&/^[A-Z]s$/.test(i)?(r.push(t+i),e++):r.push(t)}let i=r.map(Zi).join(` `);return Yi.set(e,i),i}function Zi(e){return/^[A-Z]{2,3}s?$/.test(e)||/^[0-9]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Qi({restartRequired:e}){let t=st(),{organization:n,instance:r,cluster:i}=Mn({strict:!1});return(0,B.jsxs)(`div`,{role:`list`,className:`flex items-center space-x-2 xl:space-x-4 sm:max-w-9/10 max-w-[calc(100%-56px)]`,children:[[...(0,z.useMemo)(()=>{let e=t.pathname.split(`/`).filter(e=>e&&e.length>0),a=[(0,B.jsxs)(M,{to:`/`,children:[(0,B.jsx)(ft,{"aria-hidden":`true`,className:`size-5 shrink-0`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Home`})]},`home`)];for(let t=0;t<e.length;t++){let o=e[t];if(o===`instance`)continue;let s=`/${e.slice(0,t+1).join(`/`)}`,c=Xi(o);o===`databases`&&e.length===t+3?(c=e[t+2],t+=2):c.startsWith(`Org `)?c=n?.name||`Org`:c.startsWith(`Clu `)?(c=i?.name||`Cluster`,e[t+1]===`instance`&&(s+=`/instances`)):c.startsWith(`Ins `)?c=r?.name?.split(`.`)?.shift()||`Instance`:c===`Apis`&&(c=`APIs`),a.push((0,B.jsx)(`svg`,{fill:`currentColor`,viewBox:`0 0 20 20`,"aria-hidden":`true`,className:`size-5 shrink-0 text-grey`,children:(0,B.jsx)(`path`,{d:`M5.555 17.776l8-16 .894.448-8 16-.894-.448z`})}),(0,B.jsxs)(M,{to:s,className:`text-xs md:text-sm font-medium hover:text-grey truncate max-w-48`,children:[c,void 0]}))}return a},[t.pathname,i?.name,r?.name,n?.name])],e&&(0,B.jsxs)(Ki,{children:[(0,B.jsx)(qi,{asChild:!0,children:(0,B.jsxs)(`div`,{className:`text-xs italic text-muted-foreground`,children:[`* Restart `,(0,B.jsx)(`span`,{className:`hidden lg:inline-block`,children:`Requested`})]})}),(0,B.jsxs)(Ji,{side:`bottom`,children:[`This `,`Instance`,` is requesting a restart, when convenient, to apply your latest changes.`,(0,B.jsx)(`br`,{}),`You can do this from the Apps or Config pages.`]})]})]})}var H=it,$i=(0,z.createContext)({}),ea=(0,z.createContext)({});function ta(){let e=(0,z.useContext)($i),t=(0,z.useContext)(ea),{getFieldState:n}=Ve(),r=Ze({name:e.name}),i=n(e.name,r);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}}function U({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=ta();return(0,B.jsx)(Se,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function W({...e}){return(0,B.jsx)($i,{value:{name:e.name},children:(0,B.jsx)(et,{...e})})}function G({className:e,...t}){return(0,B.jsx)(ea,{value:{id:(0,z.useId)()},children:(0,B.jsx)(`div`,{"data-slot":`form-item`,className:g(`grid gap-2`,e),...t})})}function na({className:e,...t}){return(0,B.jsx)(kn,{"data-slot":`label`,className:g(`text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function K({className:e,...t}){let{error:n,formItemId:r}=ta();return(0,B.jsx)(na,{"data-slot":`form-label`,"data-error":!!n,className:g(`data-[error=true]:text-destructive`,e),htmlFor:r,...t})}function q({className:e,...t}){let{error:n,formMessageId:r}=ta(),i=n?String(n?.message):t.children;return i?(0,B.jsx)(`p`,{"data-slot":`form-message`,id:r,className:g(`text-destructive text-sm`,e),...t,children:i}):null}function J({className:e,type:t,...n}){return(0,B.jsx)(`input`,{type:t,"data-slot":`input`,className:g(`border-input file:text-foreground placeholder:text-muted-foreground selection:bg-purple
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index.lazy-C3Ejfvna.js","assets/rolldown-runtime-FhOqtrmT.js","assets/vendor-datadog-B4t4E5qd.js","assets/vendor-misc-BBL3Mh21.js","assets/vendor-markdown-c5U0YRyN.js","assets/vendor-html-C0BzV7Np.js","assets/vendor-core-BY_ZlgBF.js","assets/vendor-react-DrZSc0Lm.js","assets/vendor-monaco-CLBN4H7U.js","assets/vendor-charts-BUlf-q3q.js","assets/vendor-react-BlDLhtZc.css","assets/button-DWsEHYDp.js","assets/cn-BnE9QzQD.js","assets/index-DZem5S77.css","assets/mermaid.core-DIGLG1bK.js","assets/vendor-viz-DarjeQVn.js","assets/status-CFe85l8C.js","assets/profile-BbbbWJCN.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{_ as t,a as n,c as r,d as i,f as a,g as o,h as s,i as c,l,m as u,n as d,o as f,p,r as m,s as h,t as g,u as _,v}from"./cn-BnE9QzQD.js";import{$t as y,Bt as b,Ft as x,Gt as ee,Ht as S,It as te,Kt as C,Lt as w,Pt as T,Qt as ne,Rt as E,Ut as re,Vt as ie,Wt as D,qt as ae,zt as oe}from"./vendor-core-BY_ZlgBF.js";import{$i as se,$n as ce,$r as le,$t as ue,Ai as de,An as O,Ar as fe,At as pe,Bi as me,Bn as he,Br as ge,Bt as _e,Ci as ve,Cn as ye,Cr as be,Ct as xe,Di as Se,Dn as Ce,Dr as we,Dt as Te,Ei as Ee,En as De,Er as Oe,Et as ke,Fi as Ae,Fn as k,Fr as je,Ft as Me,Gi as Ne,Gn as Pe,Gr as Fe,Gt as Ie,Hi as Le,Hn as Re,Hr as ze,Ht as Be,Ii as A,In as Ve,Ir as He,It as Ue,Ji as We,Jn as Ge,Jr as Ke,Jt as qe,Ki as j,Kn as Je,Kr as Ye,Kt as Xe,Li as M,Ln as Ze,Lt as Qe,Mi as $e,Mn as et,Mr as tt,Mt as nt,Ni as rt,Nn as it,Nr as at,Nt as ot,Oi as st,On as ct,Or as lt,Ot as ut,Pn as dt,Pr as ft,Pt as pt,Qi as mt,Qn as N,Qr as ht,Qt as gt,Ri as _t,Rn as vt,Rr as yt,Rt as bt,Si as xt,Sn as St,Sr as Ct,St as wt,Ti as Tt,Tn as Et,Tr as Dt,Tt as Ot,Ui as kt,Un as At,Ur as jt,Ut as Mt,Vi as P,Vn as Nt,Vr as Pt,Vt as Ft,Wi as It,Wn as Lt,Wr as Rt,Wt as zt,Xi as Bt,Xn as Vt,Xr as Ht,Xt as Ut,Yi as F,Yn as Wt,Yr as Gt,Yt as Kt,Zi as qt,Zn as Jt,Zr as Yt,Zt as Xt,_i as Zt,_n as Qt,_r as $t,ai as en,an as tn,ar as nn,bi as rn,bn as an,br as on,bt as sn,ci as cn,cn as ln,cr as un,di as dn,dn as fn,dr as pn,ei as mn,en as hn,er as gn,fi as _n,fn as vn,fr as yn,gn as bn,gr as xn,hi as Sn,hn as Cn,hr as wn,ii as Tn,in as En,ir as Dn,ji as On,jn as kn,jr as An,jt as jn,ki as Mn,kn as Nn,kr as Pn,kt as Fn,li as In,ln as Ln,lr as Rn,mi as zn,mn as Bn,mr as Vn,ni as Hn,nn as Un,nr as Wn,oi as Gn,on as Kn,or as qn,pi as Jn,pn as Yn,pr as Xn,qi as I,qn as Zn,qr as Qn,qt as $n,ri as er,rn as tr,rr as nr,si as rr,sn as ir,sr as ar,ti as or,tn as sr,ui as cr,un as lr,ur,vi as dr,vn as fr,vr as pr,wi as mr,wn as hr,wr as gr,wt as _r,xi as vr,xn as yr,xr as br,xt as xr,yi as Sr,yn as Cr,yr as wr,yt as Tr,zi as L,zn as Er,zr as Dr,zt as Or}from"./vendor-react-DrZSc0Lm.js";import{c as kr,l as Ar,s as jr}from"./vendor-tanstack-D3CJwJKs.js";import"./vendor-misc-BBL3Mh21.js";import{a as Mr,i as Nr,n as Pr,r as Fr,t as R}from"./button-DWsEHYDp.js";import{i as Ir,r as Lr}from"./vendor-datadog-B4t4E5qd.js";import"./vendor-stripe-DzjP9RhF.js";import"./vendor-monaco-CLBN4H7U.js";import"./vendor-html-C0BzV7Np.js";import{t as Rr}from"./vendor-markdown-c5U0YRyN.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var z=e(se(),1),B=mt();function zr({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card`,className:g(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl py-4 shadow-deep`,e),...t})}function Br({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-header`,className:g(`flex flex-col gap-1.5 px-6`,e),...t})}function Vr({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-title`,className:g(`leading-none text-lg`,e),...t})}function Hr({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-description`,className:g(`text-muted-foreground text-xs`,e),...t})}function Ur({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`card-content`,className:g(`px-6`,e),...t})}function Wr(e){return e!==null&&!!e.username}function Gr(e){if(e&&!Wr(e)){let t=Object.keys(e.roles);if(t.length===1)return`/${t[0]}`}return`/`}function Kr({className:e,error:t,title:n,showReturnToHome:r,children:i}){let{user:a,isLoading:o}=Nr();return Gr(a),(0,B.jsxs)(zr,{className:g(`text-red p-5 border border-red rounded-md m-12 mt-36`,e),children:[(0,B.jsxs)(Br,{children:[(0,B.jsx)(Vr,{className:`text-2xl`,children:(0,B.jsx)(`h2`,{children:n??`Component Error`})}),(0,B.jsx)(Hr,{children:t.message})]}),(0,B.jsxs)(Ur,{children:[i,r!==!1&&(a&&!o?(0,B.jsx)(M,{to:`/`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Return to Home`]})}):(0,B.jsx)(M,{to:`/sign-in`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Go to Sign In Page`]})}))]})]})}function qr(){let{user:e,isLoading:t}=Nr();return Gr(e),(0,B.jsx)(`div`,{className:`flex items-center justify-center h-screen px-3`,children:(0,B.jsxs)(zr,{className:`text-red p-5 border border-red rounded-md w-full max-w-md`,children:[(0,B.jsx)(Br,{children:(0,B.jsx)(Vr,{className:`text-2xl`,children:(0,B.jsx)(`h2`,{children:`Sorry, Page Not Found`})})}),(0,B.jsx)(Ur,{children:e&&!t?(0,B.jsx)(M,{to:`/`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Return to Home`]})}):(0,B.jsx)(M,{to:`/sign-in`,children:(0,B.jsxs)(R,{children:[` `,(0,B.jsx)(mr,{}),` Go Sign In Page`]})})})]})})}function Jr(){return`ontouchstart`in window||navigator.maxTouchPoints>0}function Yr(e){let t=`Error`,n=`We had some trouble!`;console.error(e);let r=e,i=e;if(typeof e==`string`?n=e:r?.response?.data?typeof r.response.data==`string`?n=r.response.data:r.response.data.error?n=r.response.data.error:r.response.data.message&&(n=r.response.data.message):i?.message&&(n=i.message),n.includes(`:`)){let e=n.split(`:`);t=e.shift(),n=e.join(`:`)}N.error(t,{description:n,action:{label:`Dismiss`,onClick:()=>N.dismiss()}})}var Xr=new jr({queryCache:new kr({onError:Yr}),mutationCache:new Ar({onError:Yr})});function Zr(e){return!!e}var Qr=!1,$r=!1;function ei(){(0,z.useEffect)(()=>{Qr||(Qr=!0,$r&&(Lr.init({applicationId:`f590deee-4bac-49b4-a202-3b6963d9721d`,clientToken:`pub27aa29cea521492f4fef73032f86a023`,site:`datadoghq.com`,service:`studio`,env:void 0,version:`v5.0.0-beta.8`,trackViewsManually:!0,trackUserInteractions:!0,sessionSampleRate:100,sessionReplaySampleRate:0,defaultPrivacyLevel:`mask`,plugins:[Vt()]}),Lr.onReady(()=>{Lr.startView({service:`studio`,version:`v5.0.0-beta.8`,name:window.location.pathname||`initial`})})))},[])}function ti(e){if(!$r)return;Lr.setUser({id:e.id,email:e.email,name:[e.firstname,e.lastname].filter(Boolean).join(` `)||void 0});let t=`hasLoggedInBefore:${e.id}`;localStorage.getItem(t)?Lr.addAction(`return_login`):(Lr.addAction(`first_time_login`),localStorage.setItem(t,`true`));let n=`lastLoginTimestamp:${e.id}`,r=localStorage.getItem(n),i=Date.now();if(r){let e=Math.floor((i-Number(r))/1e3);!Number.isNaN(e)&&e>=0&&Lr.addAction(`login_time_gap`,{value:e})}localStorage.setItem(n,String(i)),Lr.addAction(`login_success`,{userId:e.id})}function ni(){return(0,B.jsx)(B.Fragment,{children:(0,B.jsx)($e,{})})}var ri=Ae()({component:ni});function ii(){return(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 126.644 96`,width:24,height:24,children:(0,B.jsx)(`path`,{fill:`currentColor`,d:`M81.15,0c-1.2376,2.1973-2.3489,4.4704-3.3591,6.794-9.5975-1.4396-19.3718-1.4396-28.9945,0-.985-2.3236-2.1216-4.5967-3.3591-6.794-9.0166,1.5407-17.8059,4.2431-26.1405,8.0568C2.779,32.5304-1.6914,56.3725.5312,79.8863c9.6732,7.1476,20.5083,12.603,32.0505,16.0884,2.6014-3.4854,4.8998-7.1981,6.8698-11.0623-3.738-1.3891-7.3497-3.1318-10.8098-5.1523.9092-.6567,1.7932-1.3386,2.6519-1.9953,20.281,9.547,43.7696,9.547,64.0758,0,.8587.7072,1.7427,1.3891,2.6519,1.9953-3.4601,2.0457-7.0718,3.7632-10.835,5.1776,1.97,3.8642,4.2683,7.5769,6.8698,11.0623,11.5419-3.4854,22.3769-8.9156,32.0509-16.0631,2.626-27.2771-4.496-50.9172-18.817-71.8548C98.9811,4.2684,90.1918,1.5659,81.1752.0505l-.0252-.0505ZM42.2802,65.4144c-6.2383,0-11.4159-5.6575-11.4159-12.6535s4.9755-12.6788,11.3907-12.6788,11.5169,5.708,11.4159,12.6788c-.101,6.9708-5.026,12.6535-11.3907,12.6535ZM84.3576,65.4144c-6.2637,0-11.3907-5.6575-11.3907-12.6535s4.9755-12.6788,11.3907-12.6788,11.4917,5.708,11.3906,12.6788c-.101,6.9708-5.026,12.6535-11.3906,12.6535Z`})})}function ai(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`img`,{src:`/harper-studio_white.png`,alt:`Harper Studio`,className:`w-64 hidden md:inline-block`}),(0,B.jsx)(`img`,{src:`/HDBDogOnly.svg`,width:`50px`,height:`44px`,alt:`Harper`,className:`inline-block md:hidden`})]})}function oi({className:e,...t}){return(0,B.jsx)(`div`,{className:g(`absolute top-full left-0 isolate z-50 flex justify-center`),children:(0,B.jsx)(Ge,{"data-slot":`navigation-menu-viewport`,className:g(`origin-top-center bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]`,e),...t})})}function si({className:e,children:t,viewport:n=!0,...r}){return(0,B.jsxs)(Zn,{"data-slot":`navigation-menu`,"data-viewport":n,className:g(`group/navigation-menu relative flex max-w-max flex-1 items-center justify-center`,e),...r,children:[t,n&&(0,B.jsx)(oi,{})]})}function ci({className:e,...t}){return(0,B.jsx)(Lt,{"data-slot":`navigation-menu-item`,className:g(`relative`,e),...t})}function li({className:e,...t}){return(0,B.jsx)(Pe,{"data-slot":`navigation-menu-link`,className:g(`hover:text-white ring-ring/10 dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 flex flex-col gap-1 rounded-sm p-2 text-sm transition-[color,box-shadow] focus-visible:ring-4 focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4`,e),...t})}function ui({className:e,...t}){return(0,B.jsx)(Je,{"data-slot":`navigation-menu-list`,className:g(`group flex flex-1 list-none items-center justify-center gap-1`,e),...t})}var di=ne(`inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-auto`,{variants:{variant:{default:`border-primary bg-primary/40 text-primary-foreground [a&]:hover:bg-primary/90`,secondary:`border-secondary bg-secondary/40 text-secondary-foreground [a&]:hover:bg-secondary/90`,warning:`border-yellow bg-yellow/40 text-white [a&]:hover:bg-yellow/90`,success:`border-green bg-green/40 text-white [a&]:hover:bg-green/90`,destructive:`border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40`,outline:`text-white [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function fi(){return(0,B.jsx)(`a`,{href:`https://github.com/HarperFast/studio/releases`,target:`_blank`,rel:`noopener noreferrer`,children:(0,B.jsxs)(`span`,{className:g(di({variant:`default`}),`text-xs inline-block ml-2 align-text-top`),children:[`v5.0.0-beta.8`,` BETA`]})})}function pi(e,t,n){let{instanceId:r,clusterId:a}=P({strict:!1});return i({id:d,operationsUrl:e,port:t,secure:n})}function mi(e,t,n){let{instanceId:r,clusterId:a}=P({strict:!1});return{instanceClient:i({id:d,operationsUrl:e,port:t,secure:n}),entityType:`instance`}}function V(e,t,n){let r=P({strict:!1});return(0,z.useMemo)(()=>hi({...r,operationsUrl:e,port:t,secure:n}),[r,e,t,n])}function hi({instanceId:e,clusterId:t,operationsUrl:n,port:r,secure:a}){let o=d;if(!o)throw Error(`id could not be automatically calculated in useInstanceClientIdParams`);return{instanceClient:i({id:o,operationsUrl:n,port:r,secure:a}),entityId:o,entityType:`instance`}}function gi(){localStorage.clear()}function _i(){sessionStorage.clear()}async function vi(){m.setUserForEntity(d,null),Xr.getQueryCache().clear(),gi(),_i(),await Xr.invalidateQueries({refetchType:`none`})}async function yi(e){await m.signOutFromPotentiallyAuthenticatedInstances(),await h({...e,entityId:d})}function bi(){let e=pi();return j({mutationFn:()=>yi({instanceClient:e}),onSuccess:vi})}function xi(e){let{user:t}=Pr(),{organizationId:n}=P({strict:!1}),r=t?.roles?.[e??n];return!r?.permission&&!r?.organization?{update:!1,remove:!1}:r.permission?.super_user?{update:!0,remove:!0}:{update:r.organization.update,remove:r.organization.delete}}function Si(e){let{user:t}=Pr(),{organizationId:n}=P({strict:!1}),r=t?.roles?.[e??n];if(!r?.permission&&!r?.organization?.roles)return{create:!1,remove:!1,update:!1,view:!1};if(r.permission?.super_user)return{create:!0,remove:!0,update:!0,view:!0};let i=r.organization.roles;return{create:i.create,remove:i.delete,update:i.update,view:i.view}}function Ci(e,t){let{user:n}=Pr(),{organizationId:r,clusterId:i}=P({strict:!1});return wi(n,e??r,t??i)}function wi(e,t,n){let r=e?.roles?.[t];if(!r?.permission&&!r?.organization?.clusters)return{create:!1,remove:!1,update:!1,view:!1};if(r.permission?.super_user)return{create:!0,remove:!0,update:!0,view:!0};let i=r.organization.clusters.resources?.find(e=>e.id===n),a=r.organization.clusters;return{create:a.create,remove:i?i.delete:a.delete,update:i?i.update:a.update,view:i?i.view:a.view}}function Ti(e,t){let{user:n}=Pr(),{organizationId:r,clusterId:i}=P({strict:!1});return Ei(n,e??r,t??i)}function Ei(e,t,n){let r=e?.roles?.[t];if(!r?.permission&&!r?.organization?.clusters)return{create:!1,remove:!1,update:!1,view:!1};if(r.permission?.super_user)return{create:!0,remove:!0,update:!0,view:!0};let i=r.organization.clusters.resources?.find(e=>e.id===n)?.instances,a=r.organization.clusters;return{create:i?i.create:a.create,remove:i?i.delete:a.delete,update:i?i.update:a.update,view:i?i.view:a.view}}function Di(e){let{clusterId:t,instanceId:n}=P({strict:!1}),{user:r}=Fr(e??n??t),i=r?.role?.permission;return i?i.super_user===!0:!1}function Oi(e){let{clusterId:t,instanceId:n}=P({strict:!1}),{user:r}=Fr(e??n??t),i=r?.role?.permission;return i?i.super_user===!0||i.structure_user===!0:!1}function ki(e,t,n,r){let{clusterId:i,instanceId:a}=P({strict:!1}),{user:o}=Fr(e??a??i),s=o?.role?.permission;return s?s.super_user===!0||s.structure_user===!0?!0:s[t]?.tables?.[n][r]===!0:!1}var Ai={className:`text-white`};function ji(){let{mutate:e}=bi(),t=L(),{user:n}=Nr(),r=kt(),{organizationId:i}=P({strict:!1}),{update:a}=xi(i),{view:o}=Si(i),s=a,c=(0,z.useCallback)(()=>{e(void 0,{onSuccess:async()=>{N.success(`Success`,{description:`You have been signed out successfully.`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),t({to:`/sign-in`}),r.invalidate()}})},[e,r,t]),l=(0,z.useMemo)(()=>[!1,!1,!1,{to:`https://docs.harperdb.io/docs`,target:`_blank`,icon:(0,B.jsx)(Sr,{}),text:`Docs`,textBreakpoint:`md`},{to:`https://github.com/HarperFast/studio/issues`,target:`_blank`,icon:(0,B.jsx)(Zt,{}),text:`Report an Issue`,textBreakpoint:`lg`},{to:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,icon:(0,B.jsx)(ii,{}),text:`Discord`,textBreakpoint:`lg`},{onClick:c,icon:(0,B.jsx)(we,{}),text:`Sign Out`,textBreakpoint:`md`}].filter(Zr),[i,s,o,c]);return n?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Ii,{menuItems:l}),(0,B.jsx)(Pi,{menuItems:l})]}):(0,B.jsx)(Ni,{})}function Mi(e){return e.items!==void 0}function Ni(){return(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`inline-block`,children:[(0,B.jsx)(M,{to:`/sign-in`,children:(0,B.jsx)(ai,{})}),(0,B.jsx)(fi,{})]}),(0,B.jsx)(si,{children:(0,B.jsxs)(ui,{className:`text-grey-400`,children:[(0,B.jsx)(ci,{children:(0,B.jsx)(li,{asChild:!0,children:(0,B.jsxs)(M,{to:`https://docs.harperdb.io/docs`,target:`_blank`,rel:`noreferrer noopener`,className:`flex-row items-center`,children:[(0,B.jsx)(Sr,{}),` `,(0,B.jsx)(`span`,{className:`hidden md:inline-block`,children:`Docs`})]})})}),(0,B.jsx)(ci,{children:(0,B.jsx)(li,{asChild:!0,children:(0,B.jsxs)(M,{to:`/sign-in`,className:`flex-row items-center`,activeProps:Ai,children:[(0,B.jsx)(Pn,{}),` Sign In`]})})})]})})]})}function Pi({menuItems:e}){let{user:t}=Nr();return Gr(t),(0,B.jsx)(`div`,{className:`hidden md:block`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsxs)(`div`,{className:`inline-block`,children:[(0,B.jsx)(M,{to:`/`,children:(0,B.jsx)(ai,{})}),(0,B.jsx)(fi,{})]}),(0,B.jsx)(si,{children:(0,B.jsx)(ui,{className:`text-grey-400`,children:e.map(e=>Mi(e)?!!e.items.length&&(0,B.jsx)(`div`,{className:`bg-black rounded-2xl flex`,children:e.items.map(e=>(0,B.jsx)(Fi,{menuItem:e},e.text))},e.text):(0,B.jsx)(Fi,{menuItem:e},e.text))})})]})})}function Fi({menuItem:e}){return(0,B.jsx)(ci,{className:`text-gray-400 hover:text-white`,children:(0,B.jsx)(li,{asChild:!0,children:(0,B.jsxs)(M,{to:e.to,onClick:e.onClick,className:`flex-row items-center`,target:e.target,activeProps:e.to?Ai:void 0,children:[e.icon,(0,B.jsx)(`span`,{className:`hidden ${e.textBreakpoint}:inline-block`,children:e.text}),(0,B.jsx)(`span`,{className:`${e.textBreakpoint}:hidden`,children:`\xA0`})]})})})}function Ii({menuItems:e}){let{user:t}=Nr();Gr(t);let[n,r]=(0,z.useState)(!1),i=(0,z.useCallback)(()=>r(e=>!e),[]),a=(0,z.useCallback)(()=>r(!1),[]);return(0,B.jsxs)(`div`,{className:`md:hidden`,id:`mobile-menu`,children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,B.jsx)(M,{to:`/`,children:(0,B.jsx)(ai,{})}),(0,B.jsx)(fi,{}),(0,B.jsxs)(`button`,{type:`button`,className:`shadow-xs text-grey-400 hover:text-white hover:bg-black-dark`,onClick:i,children:[(0,B.jsx)(`span`,{className:`sr-only`,children:n?`Close menu`:`Open menu`}),n?(0,B.jsx)(ce,{}):(0,B.jsx)(Dt,{})]})]}),(0,B.jsx)(`div`,{className:`${n?`fixed`:`hidden`} top-40 bottom-0 left-0 right-0 bg-black-dark opacity-70`,onClick:a}),(0,B.jsx)(`div`,{className:`${n?`block`:`hidden`} md:hidden z-50 space-y-1 pb-3 bg-black-dark absolute left-0 top-full w-full rounded-b-md`,children:e.map(e=>Mi(e)?!!e.items.length&&(0,B.jsx)(`div`,{className:`bg-black pl-10 pr-2 py-2`,children:e.items.map(e=>(0,B.jsx)(Li,{menuItem:e,onClick:a},e.text))},e.text):(0,B.jsx)(Li,{menuItem:e,onClick:a},e.text))})]})}function Li({menuItem:e,onClick:t}){let n=(0,z.useCallback)(()=>{e.onClick?.(),t()},[e,t]);return(0,B.jsxs)(M,{to:e.to,onClick:n,target:e.target,className:`flex flex-row px-3 py-2 text-base font-medium rounded-md text-gray-400 hover:text-white`,activeProps:e.to?Ai:void 0,children:[e.icon,(0,B.jsx)(`span`,{className:`ml-4`,children:e.text})]})}function Ri(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-black-dark dark:bg-black-dark dark:border-b dark:border-black md:px-12`,children:(0,B.jsx)(ji,{})}),(0,B.jsxs)(`div`,{className:`pt-20 grid h-screen grid-cols-1 md:grid-cols-2`,children:[(0,B.jsx)(`section`,{className:`items-center justify-center hidden text-white md:flex px-6 fabricSignupTextContainer`,children:(0,B.jsx)(`img`,{className:`object-scale-down max-h-[calc(100vh-80px-40px)] min-h-115`,src:`/fabric-signup-text.png`,alt:`One Runtime: App, database, Cache and Messaging. Distributed by design, free to deploy, and live in minutes. Deploy!`})}),(0,B.jsx)(`section`,{className:`flex items-center justify-center px-6 bg-linear-(--purple-gradient) dark:bg-linear-(--black-dark-gradient)`,children:(0,B.jsx)($e,{})})]})]})}var zi;function Bi(){(0,z.useEffect)(()=>{},[])}var Vi=[`gmail.com`,`yahoo.com`,`hotmail.com`,`outlook.com`,`icloud.com`,`aol.com`,`protonmail.com`,`mail.com`,`zoho.com`,`yandex.com`,`gmx.com`,`live.com`,`msn.com`,`me.com`,`inbox.com`];function Hi(e){if(!e||!e.includes(`@`))return null;let t=e.split(`@`).pop()||``;if(!t)return null;for(let e of Vi)if(t===e||t.endsWith(`.`+e))return null;return t}var Ui=null;function Wi(){let e=L(),t=kt(),n=qt(),{redirect:i}=me({strict:!1});return(0,z.useEffect)(()=>{Ui||=(async function(){let a=await l().catch(()=>null);if(!a)N.error(`We were not able to verify your sign-in. Please try signing in again.`,{duration:1e4}),await e({to:`/sign-in`});else{m.setUserForEntity(d,a);let o=Gr(a);ti(a);let s=Hi(a.email);zi?.identify?.({username:a.email,type:`email`,...s?{company:s}:{}}),await n.invalidateQueries({queryKey:r,refetchType:`none`}),await t.invalidate(),await e({to:i?.startsWith(`/`)?i:o})}Ui=null})()},[]),(0,B.jsxs)(`div`,{className:`text-white w-lg flex flex-col gap-4`,children:[(0,B.jsxs)(`h1`,{className:`text-3xl font-light`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`text-2xl animate-flower-dance mr-4`,title:`Loading`,children:`🌼`}),`Checking...`]}),(0,B.jsx)(`div`,{className:`underline flex gap-4`,children:(0,B.jsx)(M,{className:`text-sm opacity-50 hover:text-blue-300`,to:`/sign-in`,children:`Try signing in again`})})]})}function Gi({delayDuration:e=0,...t}){return(0,B.jsx)(Nt,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ki({...e}){return(0,B.jsx)(Gi,{children:(0,B.jsx)(Re,{"data-slot":`tooltip`,...e})})}function qi({...e}){return(0,B.jsx)(At,{"data-slot":`tooltip-trigger`,...e})}function Ji({className:e,sideOffset:t=0,arrowClassName:n,children:r,...i}){return(0,B.jsx)(he,{children:(0,B.jsxs)(Er,{"data-slot":`tooltip-content`,sideOffset:t,className:g(`bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance`,e),...i,children:[r,(0,B.jsx)(vt,{className:g(`bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`,n)})]})})}var Yi=new Map;function Xi(e){if(!e)return``;if(Yi.has(e))return Yi.get(e);let t=e.replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim();if(!t)return Yi.set(e,``),``;let n=t.match(/([A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|[0-9]+)/g);if(!n)return Yi.set(e,``),``;let r=[];for(let e=0;e<n.length;e++){let t=n[e],i=e+1<n.length?n[e+1]:void 0;/^[A-Z]{2,}$/.test(t)&&i&&/[A-Z]*s$/.test(i)||/^[A-Z]$/.test(t)&&i!==void 0&&/^[A-Z]s$/.test(i)?(r.push(t+i),e++):r.push(t)}let i=r.map(Zi).join(` `);return Yi.set(e,i),i}function Zi(e){return/^[A-Z]{2,3}s?$/.test(e)||/^[0-9]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function Qi({restartRequired:e}){let t=st(),{organization:n,instance:r,cluster:i}=Mn({strict:!1});return(0,B.jsxs)(`div`,{role:`list`,className:`flex items-center space-x-2 xl:space-x-4 sm:max-w-9/10 max-w-[calc(100%-56px)]`,children:[[...(0,z.useMemo)(()=>{let e=t.pathname.split(`/`).filter(e=>e&&e.length>0),a=[(0,B.jsxs)(M,{to:`/`,children:[(0,B.jsx)(ft,{"aria-hidden":`true`,className:`size-5 shrink-0`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Home`})]},`home`)];for(let t=0;t<e.length;t++){let o=e[t];if(o===`instance`)continue;let s=`/${e.slice(0,t+1).join(`/`)}`,c=Xi(o);o===`databases`&&e.length===t+3?(c=e[t+2],t+=2):c.startsWith(`Org `)?c=n?.name||`Org`:c.startsWith(`Clu `)?(c=i?.name||`Cluster`,e[t+1]===`instance`&&(s+=`/instances`)):c.startsWith(`Ins `)?c=r?.name?.split(`.`)?.shift()||`Instance`:c===`Apis`&&(c=`APIs`),a.push((0,B.jsx)(`svg`,{fill:`currentColor`,viewBox:`0 0 20 20`,"aria-hidden":`true`,className:`size-5 shrink-0 text-grey`,children:(0,B.jsx)(`path`,{d:`M5.555 17.776l8-16 .894.448-8 16-.894-.448z`})}),(0,B.jsxs)(M,{to:s,className:`text-xs md:text-sm font-medium hover:text-grey truncate max-w-48`,children:[c,void 0]}))}return a},[t.pathname,i?.name,r?.name,n?.name])],e&&(0,B.jsxs)(Ki,{children:[(0,B.jsx)(qi,{asChild:!0,children:(0,B.jsxs)(`div`,{className:`text-xs italic text-muted-foreground`,children:[`* Restart `,(0,B.jsx)(`span`,{className:`hidden lg:inline-block`,children:`Requested`})]})}),(0,B.jsxs)(Ji,{side:`bottom`,children:[`This `,`Instance`,` is requesting a restart, when convenient, to apply your latest changes.`,(0,B.jsx)(`br`,{}),`You can do this from the Apps or Config pages.`]})]})]})}var H=it,$i=(0,z.createContext)({}),ea=(0,z.createContext)({});function ta(){let e=(0,z.useContext)($i),t=(0,z.useContext)(ea),{getFieldState:n}=Ve(),r=Ze({name:e.name}),i=n(e.name,r);if(!e)throw Error(`useFormField should be used within <FormField>`);let{id:a}=t;return{id:a,name:e.name,formItemId:`${a}-form-item`,formDescriptionId:`${a}-form-item-description`,formMessageId:`${a}-form-item-message`,...i}}function U({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=ta();return(0,B.jsx)(Se,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function W({...e}){return(0,B.jsx)($i,{value:{name:e.name},children:(0,B.jsx)(et,{...e})})}function G({className:e,...t}){return(0,B.jsx)(ea,{value:{id:(0,z.useId)()},children:(0,B.jsx)(`div`,{"data-slot":`form-item`,className:g(`grid gap-2`,e),...t})})}function na({className:e,...t}){return(0,B.jsx)(kn,{"data-slot":`label`,className:g(`text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function K({className:e,...t}){let{error:n,formItemId:r}=ta();return(0,B.jsx)(na,{"data-slot":`form-label`,"data-error":!!n,className:g(`data-[error=true]:text-destructive`,e),htmlFor:r,...t})}function q({className:e,...t}){let{error:n,formMessageId:r}=ta(),i=n?String(n?.message):t.children;return i?(0,B.jsx)(`p`,{"data-slot":`form-message`,id:r,className:g(`text-destructive text-sm`,e),...t,children:i}):null}function J({className:e,type:t,...n}){return(0,B.jsx)(`input`,{type:t,"data-slot":`input`,className:g(`border-input file:text-foreground placeholder:text-muted-foreground selection:bg-purple
|
|
3
3
|
selection:text-primary-foreground
|
|
4
4
|
dark:aria-invalid:outline-destructive dark:aria-invalid:ring-destructive/50 ring-ring/10
|
|
5
5
|
dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 aria-invalid:outline-destructive/60
|
|
@@ -8,7 +8,7 @@ import{o as e}from"./rolldown-runtime-FhOqtrmT.js";import{_ as t,a as n,c as r,d
|
|
|
8
8
|
file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium
|
|
9
9
|
focus-visible:ring-1 focus-visible:outline-none focus-visible:ring-purple disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50
|
|
10
10
|
aria-invalid:focus-visible:ring-[1px] aria-invalid:focus-visible:outline-none md:text-sm dark:aria-invalid:focus-visible:ring-1`,e),...n})}var ra=[`RUNNING`],ia=[`TERMINATING`,`TERMINATED`,`REMOVED`];function aa(){return`https://fabric.harper.fast/#/?createCluster=`+encodeURIComponent(JSON.stringify({deploymentDescription:`Self-Hosted`,performanceDescription:`Self Supported and Managed`,instances:[{secure:String(location.protocol===`https:`),fqdn:location.hostname,port:parseInt(location.port,10)}]}))}async function oa({username:e,password:t,instanceClient:n,entityId:r}){let a={username:e,password:t};m.checkForBasicAuth(r)&&(n.defaults.auth=a,n.defaults.withCredentials=!1);let{data:{message:o}}=await n.post(`/`,{operation:`login`,username:e,password:t});if(!m.checkForBasicAuth(r))try{return{message:o,user:await f({instanceClient:n})}}catch(e){console.error(`Failed to get user after login, trying basic auth`,e)}try{n.defaults.auth=a,n.defaults.withCredentials=!1;let e=await f({instanceClient:n,auth:a});return m.flagForBasicAuth(r,a),{message:o,user:e}}catch(e){throw n.defaults.auth=void 0,n.defaults.withCredentials=!0,e}let s=i({id:r,forceFabricConnect:!0}),c=await f({instanceClient:s});return m.flagForFabricConnect(r,!0),{message:o,user:c,instanceClient:s}}function sa(){return j({mutationFn:oa})}function ca({cluster:e,instance:t,instanceParams:n}){let r=L(),i=kt(),{redirect:a}=me({strict:!1}),{mutate:o,isPending:s}=sa();return{isPending:s,submitForm:(0,z.useCallback)(async s=>{o({...s,...n},{onSuccess:async({message:n,user:o})=>{if(N.success(n),e?.instances?.length&&!t)for(let t of e.instances)m.setUserForEntity(t,o);let s=d;if(!s)throw Error(`Sign in failed due to missing cluster or instance.`);m.setUserForEntity(s,o),i.invalidate(),await r({to:a?.startsWith(`/`)?a:`/`})}})},[e,t,n,r,a,i,o])}}async function la(e){let{data:t}=await u.get(`/Cluster/${e}`);return t}function ua(e,t){return I({queryKey:[e],queryFn:()=>la(e),retry:!1,staleTime:1900,enabled:!!e,refetchInterval:t?t===!0?1e4:t:void 0})}var da=b({error:`Please enter a valid email address.`}).toLowerCase().trim(),fa=C().nonempty({error:`Please enter your password.`}),pa=C().nonempty({error:`Please enter a username.`}),ma=D({username:pa,password:fa}),ha=D({email:da,password:fa});function ga({entityId:e,instanceClient:t}){return I({queryKey:[e,`health`],queryFn:async()=>{try{return await t.get(`/health`),!0}catch{return!1}},retry:2,refetchInterval:5e3})}var _a=[`localhost`,`127.0.0.1`],va=function(e){return e.MixedLoopback=`MixedLoopback`,e.InsecureCookieOutsideChromeAndFirefox=`InsecureCookieOutsideChromeAndFirefox`,e}({});function ya(e,t,n){if(!n||!t||!e)return null;let r=new URL(n).hostname,i=_a.includes(t),a=_a.includes(r);if(i&&a&&r!==t)return va.MixedLoopback;if(!i&&a){let t=e.indexOf(`Chrome`)>=0,n=e.indexOf(`Firefox`)>=0;if(!t&&!n)return va.InsecureCookieOutsideChromeAndFirefox}return null}function ba(){let{clusterId:e,instanceId:t}=P({strict:!1}),{data:r}=F(ua(e,!0)),i=(0,z.useMemo)(()=>t&&r&&r?.instances?.find(e=>e.id===t)||void 0,[r,t]),a=(0,z.useMemo)(()=>r?.status&&ra.includes(r.status),[r?.status]),o=`instance`,s=(0,z.useMemo)(()=>r?i?(m.flagForFabricConnect(i.id,!1),c(i)):(m.flagForFabricConnect(r.id,!1),n(r)):null,[r,i]),l=V(s),u=(0,z.useMemo)(()=>s?.includes(`localhost`)||s?.includes(`127.0.0.1`),[s]),d=(0,z.useMemo)(()=>ya(navigator.userAgent,location.hostname,s),[s]),{data:f}=F(ga(l)),p=k({resolver:O(ma),defaultValues:{username:``,password:``}}),{control:h,handleSubmit:g}=p,{submitForm:_,isPending:v}=ca({cluster:r,instance:i,instanceParams:l});return!t&&r&&!r?.fqdn?(0,B.jsx)(_t,{to:`../instances`,replace:!0}):a&&r?.resetPassword?(0,B.jsx)(_t,{to:`/${r.organizationId}/${r.id}/finish-setup`,replace:!0}):!a&&r?.resetPassword?(0,B.jsx)(_t,{to:`/${r.organizationId}/${r.id}/starting-up`,replace:!0}):(0,B.jsxs)(B.Fragment,{children:[!1,(0,B.jsx)(`div`,{className:`h-screen items-center justify-center flex`,children:(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsxs)(`h2`,{className:`text-2xl font-light`,children:[`Sign in to Harper `,`Local`]}),(0,B.jsx)(H,{...p,children:(0,B.jsxs)(`form`,{id:`auth-${o}-signin-form`,name:`auth-${o}-signin-form`,onSubmit:g(_),className:`my-4`,children:[(0,B.jsx)(W,{control:h,name:`username`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Username`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{autoComplete:`username`,autoFocus:!0,type:`text`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:h,name:`password`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(R,{disabled:v,type:`submit`,variant:`submit`,className:`w-full my-2 rounded-full`,children:`Sign In`}),f===!1&&(0,B.jsxs)(`div`,{className:`p-4 mt-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300`,role:`alert`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:`Warning!`}),` This `,o,` is not responding to GET`,` `,(0,B.jsxs)(`a`,{href:`${s}health`,className:`underline`,target:`_blank`,children:[s,`health`]}),` `,`checks.`,(0,B.jsxs)(`ol`,{className:`list-decimal ml-8 mt-2`,children:[(0,B.jsx)(`li`,{children:`Is the server running?`}),(0,B.jsxs)(`li`,{children:[`Have you`,` `,(0,B.jsx)(`a`,{href:`https://docs.harperdb.io/docs/developers/security/configuration#cors`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`enabled CORS`}),` `,`for the operations API?`]}),u&&(0,B.jsxs)(`li`,{children:[`Have you allowed`,` `,(0,B.jsx)(`a`,{href:`https://www.google.com/search?q=How+do+I+enable+local+network+access+in+my+browser%3F`,className:`underline`,target:`_blank`,rel:`noreferrer`,children:`local network access`}),` `,`in your browser?`]})]})]}),d===va.MixedLoopback&&(0,B.jsxs)(`div`,{className:`p-4 mt-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300`,role:`alert`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:`Warning!`}),` `,`Your login might not work because you're mixing 127.0.0.1 and localhost. Pick one or the other.`]}),d===va.InsecureCookieOutsideChromeAndFirefox&&(0,B.jsxs)(`div`,{className:`p-4 mt-4 text-sm text-yellow-800 rounded-lg bg-yellow-50 dark:bg-gray-800 dark:text-yellow-300`,role:`alert`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:`Warning!`}),` `,`Your login might not work because your browser doesn't consider localhost to be secure, so it doesn't pass the cookies along. Firefox or Chromium based browsers should pass the cookies properly.`]}),(0,B.jsxs)(`div`,{className:`p-4 mt-4 text-sm rounded-lg bg-purple-950`,role:`alert`,children:[(0,B.jsx)(`span`,{className:`font-medium`,children:`Did you know?`}),` `,`You can add this instance to your Harper account to manage it remotely.`,(0,B.jsx)(`div`,{className:`text-center pt-2`,children:(0,B.jsx)(M,{to:aa(),target:`_blank`,children:(0,B.jsx)(R,{type:`button`,variant:`positive`,children:`Connect to Harper Fabric`})})})]})]})})]})})]})}async function xa({email:e}){let{data:t}=await u.post(`/ForgotPassword/`,{email:e});if(t)return t;throw Error(`Something went wrong`)}function Sa(){return j({mutationFn:e=>xa(e)})}var Ca=D({email:da});function wa(){let e=L(),{me:t}=me({strict:!1}),n=k({resolver:O(Ca),defaultValues:{email:t||``}}),r=n.watch(`email`),{setFocus:i,control:a,handleSubmit:o}=n;(0,z.useEffect)(()=>{i(`email`)},[i]);let{mutate:s,isPending:c}=Sa(),l=async t=>{s(t,{onSuccess:t=>{N.success(`Success`,{description:`${t}`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),e({to:`/sign-in`,search:{me:r}})}})};return(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsx)(`h2`,{className:`text-2xl font-light`,children:`Enter your account email`}),(0,B.jsx)(`p`,{className:`text-sm pt-1`,children:`If a matching account exists, we'll send you a password reset link.`}),(0,B.jsx)(H,{...n,children:(0,B.jsxs)(`form`,{id:`auth-forgot-password-form`,name:`auth-forgot-password-form`,onSubmit:o(l),className:`my-4`,children:[(0,B.jsx)(W,{control:a,name:`email`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-2`,children:[(0,B.jsx)(K,{children:`Email`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{disabled:c,type:`email`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(R,{type:`submit`,variant:`submit`,disabled:c,className:`w-full my-2 rounded-full`,children:`Send Password Reset Email`})]})}),(0,B.jsxs)(`div`,{className:`flex px-4 mt-4 underline place-content-between`,children:[(0,B.jsx)(M,{className:`text-sm hover:text-blue-300`,to:`/sign-in`,search:{me:r},children:`Sign in to your account`}),(0,B.jsx)(M,{className:`text-sm hover:text-blue-300`,to:`/sign-up`,search:{me:r},children:`Sign up for free`})]})]})}var Ta=async({token:e,password:t})=>{let{data:n}=await u.put(`/ResetPassword/`,{token:e,newPassword:t});return n};function Ea(){return j({mutationFn:e=>Ta(e)})}var Da=D({password:fa.min(8,{error:`Password must be at least 8 characters long.`}).max(50,{error:`Password cannot be longer than 50 characters.`}),confirmPassword:C()}).refine(e=>e.password===e.confirmPassword,{error:`Passwords do not match.`,path:[`confirmPassword`]});function Oa(){let{token:e}=me({strict:!1}),t=L();(0,z.useEffect)(()=>{e||t({to:`/sign-in`})},[e,t]);let n=k({resolver:O(Da),defaultValues:{password:``,confirmPassword:``}}),{setFocus:r,control:i,handleSubmit:a}=n;(0,z.useEffect)(()=>{r(`password`)},[r]);let{mutate:o,isPending:s}=Ea(),c=(0,z.useCallback)(async n=>{o({token:e,password:n.password},{onSuccess:()=>{N.success(`Success`,{description:`Your password has been reset successfully.`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),t({to:`/sign-in`})}})},[t,o,e]);return(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsx)(`h2`,{className:`text-2xl font-light`,children:`Reset Password`}),(0,B.jsx)(H,{...n,children:(0,B.jsxs)(`form`,{id:`auth-reset-password-form`,name:`auth-reset-password-form`,className:`my-4`,onSubmit:a(c),children:[(0,B.jsx)(W,{control:i,name:`password`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-2`,children:[(0,B.jsx)(K,{children:`New Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{disabled:s,type:`password`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:i,name:`confirmPassword`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-2`,children:[(0,B.jsx)(K,{children:`Confirm Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{disabled:s,type:`password`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(R,{variant:`submit`,type:`submit`,disabled:s,className:`w-full my-2 rounded-full`,children:`Submit New Password`})]})})]})}function ka({text:e,disabled:t,onClick:n}){return(0,B.jsx)(`a`,{href:`/oauth/github/login?redirect=%2F%23%2Fcheck-oauth`,onClick:n,children:(0,B.jsxs)(`button`,{className:y(`github-signin-btn`,t&&`opacity-50`),type:`button`,children:[(0,B.jsx)(yt,{className:`github-icon`}),e]})})}function Aa({text:e,disabled:t,onClick:n}){return(0,B.jsx)(`a`,{href:`/oauth/google/login?redirect=%2F%23%2Fcheck-oauth`,onClick:n,children:(0,B.jsxs)(`button`,{className:y(`gsi-material-button`,t&&`opacity-50`),type:`button`,children:[(0,B.jsx)(`div`,{className:`gsi-material-button-state`}),(0,B.jsxs)(`div`,{className:`gsi-material-button-content-wrapper`,children:[(0,B.jsx)(`div`,{className:`gsi-material-button-icon`,children:(0,B.jsxs)(`svg`,{version:`1.1`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 48 48`,xmlnsXlink:`http://www.w3.org/1999/xlink`,className:`block`,children:[(0,B.jsx)(`path`,{fill:`#EA4335`,d:`M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z`}),(0,B.jsx)(`path`,{fill:`#4285F4`,d:`M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z`}),(0,B.jsx)(`path`,{fill:`#FBBC05`,d:`M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z`}),(0,B.jsx)(`path`,{fill:`#34A853`,d:`M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z`}),(0,B.jsx)(`path`,{fill:`none`,d:`M0 0h48v48H0z`})]})}),(0,B.jsx)(`span`,{className:`gsi-material-button-contents`,children:e}),(0,B.jsx)(`span`,{className:`hidden`,children:e})]})]})})}function ja(){let e=L(),t=qt(),n=kt(),{redirect:i}=me({strict:!1}),{mutate:a,isPending:o}=Ma();return{isPending:o,submitForm:(0,z.useCallback)(o=>{a(o,{onSuccess:async a=>{m.setUserForEntity(d,a);let o=Gr(a);ti(a);let s=Hi(a.email);zi?.identify?.({username:a.email,type:`email`,...s?{company:s}:{}}),await t.invalidateQueries({queryKey:r,refetchType:`none`}),n.invalidate(),await e({to:i?.startsWith(`/`)?i:o})}})},[e,t,i,n,a])}}function Ma(){return j({mutationFn:e=>Na(e)})}async function Na({email:e,password:t}){let{data:n}=await u.post(`/Login/`,{email:e,password:t});if(n)return n;throw Error(`Something went wrong`)}function Pa(){let{me:e}=me({strict:!1}),t=k({resolver:O(ha),defaultValues:{email:e||``,password:``}}),{handleSubmit:n,control:r}=t,i=t.watch(`email`),{submitForm:a,isPending:o}=ja();return(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsx)(`h2`,{className:`text-2xl font-light`,children:`Sign in to Harper Fabric`}),(0,B.jsx)(H,{...t,children:(0,B.jsxs)(`form`,{id:`auth-signin-form`,name:`auth-signin-form`,onSubmit:n(a),className:`my-4`,children:[(0,B.jsx)(W,{control:r,name:`email`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Email`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`email`,autoFocus:!0,autoComplete:`email`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:r,name:`password`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,autoComplete:`current-password`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(R,{type:`submit`,variant:`submit`,className:`w-full my-2 rounded-full`,disabled:o,children:`Sign In`}),(0,B.jsxs)(`div`,{className:`flex px-4 mt-4 underline place-content-between`,children:[(0,B.jsx)(M,{className:`text-sm hover:text-blue-300`,to:`/sign-up`,search:{me:i},children:`Sign up for free`}),(0,B.jsx)(M,{className:`text-sm hover:text-blue-300`,to:`/forgot-password`,search:{me:i},children:`Forgot password?`})]})]})}),(0,B.jsx)(`hr`,{className:`border-gray-600 my-6`}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(Aa,{text:`Sign in with Google`}),(0,B.jsx)(ka,{text:`Sign in with GitHub`})]})]})}var Fa=/^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžæÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,'-]+$/u;async function Ia(e){let{data:t}=await u.post(`/User/`,e);if(t)return t;throw Error(`Something went wrong`)}function La(){return j({mutationFn:e=>Ia(e)})}var Ra=D({email:da.max(80,{error:`Email cannot be longer than 80 characters.`}),firstname:C().trim().min(2,{error:`Please enter your first name.`}).regex(Fa,{error:`First name can only contain letters, spaces, and hyphens.`}).max(40,{error:`First name cannot be longer than 40 characters.`}),lastname:C().trim().min(2,{error:`Please enter your last name.`}).regex(Fa,{error:`Last name can only contain letters, spaces, and hyphens.`}).max(80,{error:`Last name cannot be longer than 80 characters.`}),password:fa.min(8,{error:`Password must be at least 8 characters long.`}),confirmPassword:C(),acceptTerms:E().refine(e=>e===!0,{message:`You must accept the Privacy Policy and Terms of Service.`})}).refine(e=>e.password===e.confirmPassword,{error:`Passwords do not match.`,path:[`confirmPassword`]});function za(){let e=L(),{email:t,me:n}=me({strict:!1}),[r,i]=(0,z.useState)(!1),a=k({resolver:O(Ra),defaultValues:{firstname:``,lastname:``,email:n||t||``,password:``,confirmPassword:``,acceptTerms:!1}}),o=a.watch(`email`),s=a.watch(`acceptTerms`),{setFocus:c,control:l,handleSubmit:u}=a;(0,z.useEffect)(()=>{c(`firstname`)},[c]);let{mutate:d}=La(),f=(0,z.useCallback)(async t=>{let{confirmPassword:n,acceptTerms:r,...i}=t;d(i,{onSuccess:()=>{let t=Hi(i.email);zi?.identify?.({username:i.email,type:`email`,firstname:i.firstname,lastname:i.lastname,...t?{company:t}:{}}),e({to:`/verifying?email=`+encodeURIComponent(i.email)})}})},[e,d]),p=(0,z.useCallback)(e=>{if(!s)return i(!0),setTimeout(()=>i(!1),1e3),e.preventDefault(),!1},[s]),m=(0,B.jsx)(W,{control:l,name:`acceptTerms`,render:({field:e})=>(0,B.jsxs)(G,{className:`flex flex-row items-start space-x-3 space-y-0 p-1 transition-colors duration-300 ${r?`bg-red-500/20 animate-pulse rounded`:``}`,children:[(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`size-4 rounded border-gray-300 bg-white text-purple-600 focus:ring-purple-500`,checked:e.value,onChange:e.onChange})}),(0,B.jsxs)(`div`,{className:`space-y-1 leading-none`,children:[(0,B.jsxs)(K,{className:`text-xs font-normal`,children:[`I accept the`,` `,(0,B.jsx)(`a`,{href:`https://www.harper.fast/resources/privacy-policy`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,children:`Privacy Policy`}),` `,`and`,` `,(0,B.jsx)(`a`,{href:`https://www.harper.fast/resources/paas-terms-of-service`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,children:`Terms of Service`})]}),(0,B.jsx)(q,{})]})]})});return(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsx)(`h2`,{className:`text-2xl font-light`,children:`Sign up for Harper Fabric`}),(0,B.jsxs)(H,{...a,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-2 my-6`,children:[m,(0,B.jsx)(Aa,{text:`Sign up with Google`,disabled:!s,onClick:p}),(0,B.jsx)(ka,{text:`Sign up with GitHub`,disabled:!s,onClick:p})]}),(0,B.jsx)(`hr`,{className:`border-gray-600`}),(0,B.jsxs)(`form`,{id:`auth-signup-form`,name:`auth-signup-form`,onSubmit:u(f),className:`grid gap-4 my-4`,children:[(0,B.jsx)(W,{control:l,name:`firstname`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`First Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,autoCapitalize:`words`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:l,name:`lastname`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Last Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,autoCapitalize:`words`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:l,name:`email`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Email`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`email`,readOnly:!!t,disabled:!!t,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,autoComplete:`email`,autoCapitalize:`none`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:l,name:`password`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,autoComplete:`new-password`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:l,name:`confirmPassword`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Confirm Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,autoComplete:`new-password`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),m,(0,B.jsx)(R,{type:`submit`,variant:`submit`,className:`w-full rounded-full my-4`,children:`Sign Up For Free`})]})]}),(0,B.jsx)(`div`,{className:`flex px-4 mt-4 underline place-content-between`,children:(0,B.jsx)(M,{className:`m-auto text-sm hover:text-blue-300`,to:`/sign-in`,search:{me:o},children:`Already have an account? Sign in instead.`})})]})}var Ba=async({email:e})=>{let{data:t}=await u.post(`/ResendVerificationEmail/`,{email:e});return t};function Va(){return j({mutationFn:e=>Ba(e)})}var Ha=async e=>{let{data:t}=await u.put(`/VerifyEmail/`,{token:e.toString()});return t};function Ua(){return j({mutationFn:e=>Ha(e)})}var Wa=D({email:da});function Ga(){let e=L(),{mutate:t,isPending:n}=Va(),r=k({resolver:O(Wa),defaultValues:{email:``}}),i=r.watch(`email`),{setFocus:a,control:o,handleSubmit:s}=r;(0,z.useEffect)(()=>{a(`email`)},[a]);let c=(0,z.useCallback)(async n=>{t(n,{onSuccess:t=>{N.success(`Success`,{description:`${t}`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),e({to:`/sign-in`,search:{me:i}})}})},[i,e,t]);return(0,B.jsxs)(H,{...r,children:[(0,B.jsx)(`p`,{className:`text-sm py-2`,children:`Please Enter an Email`}),(0,B.jsxs)(`form`,{id:`auth-verify-email-form`,name:`auth-verify-email-form`,onSubmit:s(c),className:`my-4`,children:[(0,B.jsx)(W,{control:o,name:`email`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-2`,children:[(0,B.jsx)(K,{children:`Email`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{disabled:n,type:`email`,className:`bg-purple-400 border-purple-400 dark:bg-black dark:border-black`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(R,{type:`submit`,variant:`submit`,disabled:n,className:`w-full my-2 rounded-full`,children:`Send Verification Email`})]})]})}function Ka(){let{token:e}=me({strict:!1}),t=L(),{mutate:n,isPending:r}=Ua(),i=(0,z.useCallback)(e=>{n(e,{onSuccess:()=>{N.success(`Success`,{description:`Email verified successfully`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),t({to:`/sign-in`})}})},[n,t]);return(0,z.useEffect)(()=>{e&&i(e)},[i,e]),(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsx)(`h1`,{className:`text-3xl font-light`,children:`Verify Email`}),r?(0,B.jsx)(`p`,{className:`text-sm pt-1`,children:`Verifying email...`}):(0,B.jsx)(Ga,{})]})}function qa(){let{email:e}=me({strict:!1}),{mutate:t,isPending:n}=Va(),r=(0,z.useCallback)(n=>(n.preventDefault(),e&&t({email:e},{onSuccess:e=>{N.success(`Code Sent`,{description:`${e}`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}})}}),!1),[e,t]);return(0,B.jsxs)(`div`,{className:`text-white w-lg flex flex-col gap-4`,children:[(0,B.jsxs)(`h1`,{className:`text-3xl font-light`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`text-2xl animate-flower-dance mr-4`,title:`Loading`,children:`🌼`}),`Check your email!`]}),(0,B.jsxs)(`p`,{children:[`Your account has been created! You should receive an email with a link to `,(0,B.jsx)(`strong`,{children:`[Verify My Email]`}),`!`]}),(0,B.jsxs)(`p`,{children:[`From: `,(0,B.jsx)(`strong`,{children:`harper@notifications.harperfabric.com`})]}),(0,B.jsxs)(`p`,{children:[`To: `,(0,B.jsx)(`strong`,{children:e||`your email`})]}),(0,B.jsx)(`p`,{children:`Can you click it? Then we can carry on to more fun things!`}),(0,B.jsxs)(`div`,{className:`underline flex gap-4`,children:[(0,B.jsx)(M,{className:`text-sm hover:text-blue-300`,to:`/sign-in`,search:{me:e},children:`I did it, let me sign in!`}),(0,B.jsx)(M,{className:`text-sm opacity-50 hover:text-blue-300`,to:void 0,onClick:r,disabled:n,children:`Send me another code, please.`})]})]})}var Ja=A({getParentRoute:()=>ri,id:`_authLayout`,component:Ri}),Ya=A({getParentRoute:()=>Ja,path:`sign-in`,component:Pa,beforeLoad:({context:e,location:t})=>{let n=e.authentication[d]?.user;if(n){let e=t?.search,r=Gr(n);throw It({to:e?.redirect?.startsWith(`/`)?e.redirect:r})}}}),Xa=A({getParentRoute:()=>ri,path:`sign-in`,component:ba,beforeLoad:({context:e,location:t})=>{if(e.authentication.OverallAppSignIn?.user){let e=t?.search;throw It({to:e?.redirect?.startsWith(`/`)?e.redirect:`/`})}}}),Za=A({getParentRoute:()=>Ja,path:`sign-up`,component:za}),Qa=A({getParentRoute:()=>Ja,path:`forgot-password`,component:wa}),$a=A({getParentRoute:()=>Ja,path:`verify-email`,component:Ka}),eo=A({getParentRoute:()=>Ja,path:`verifying`,component:qa}),to=A({getParentRoute:()=>Ja,path:`check-oauth`,component:Wi}),no=A({getParentRoute:()=>Ja,path:`reset-password`,component:Oa});Ja.addChildren([Ya,Za,to,Qa,$a,eo,no]);var ro=[Xa];function io({children:e}){return(0,B.jsx)(`nav`,{className:`fixed top-20 w-full h-12 z-39 py-2 px-4 md:px-12 bg-grey-700`,children:(0,B.jsxs)(`div`,{className:`flex items-center h-full space-x-2`,children:[(0,B.jsx)(Qi,{}),e]})})}function ao(e){if(lo(e)||uo(e))return`warning`;if(oo(e))return`success`;switch(e){case`STOPPED`:return`secondary`;case`TERMINATING`:case`TERMINATED`:case`FAILED`:case`REMOVED`:case`ERROR`:return`destructive`;default:return`default`}}function oo(e){switch(e){case`RUNNING`:case`UPDATED`:return!0;default:return!1}}function so(e){switch(e){case`FAILED`:return!0;default:return!1}}function co(e){switch(e){case`TERMINATED`:return!0;default:return!1}}function lo(e){switch(e){case`CLONE_PENDING`:return!0;default:return!1}}function uo(e){switch(e){case`PROVISIONING`:case`CLONING`:case`CLONE_READY`:case`UPDATING_HDB_NODES`:case`UPDATING`:return!0;default:return!1}}function Y({...e}){return(0,B.jsx)(Ce,{"data-slot":`dialog`,...e})}function fo({...e}){return(0,B.jsx)(Nn,{"data-slot":`dialog-trigger`,...e})}function po({...e}){return(0,B.jsx)(De,{"data-slot":`dialog-portal`,...e})}function mo({className:e,...t}){return(0,B.jsx)(Et,{"data-slot":`dialog-overlay`,className:g(`data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black-dark/90`,e),...t})}function X({className:e,children:t,...n}){return(0,B.jsxs)(po,{"data-slot":`dialog-portal`,children:[(0,B.jsx)(mo,{}),(0,B.jsxs)(ye,{"data-slot":`dialog-content`,className:g(`bg-black data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] lg:max-w-2xl max-h-screen overflow-y-auto translate-x-[-50%] translate-y-[-50%] gap-4 rounded-md p-6 shadow-lg duration-200`,e),...n,children:[t,(0,B.jsxs)(St,{className:`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,B.jsx)(ce,{className:`text-white`}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function ho({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:g(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Z({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-footer`,className:g(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Q({className:e,...t}){return(0,B.jsx)(ct,{"data-slot":`dialog-title`,className:g(`text-lg leading-none text-white font-semibold`,e),...t})}function go({className:e,...t}){return(0,B.jsx)(hr,{"data-slot":`dialog-description`,className:g(`text-muted-foreground text-sm`,e),...t})}function _o({typeOfThingBeingDeleted:e,nameOfThingBeingDeleted:t,isModalOpen:n,hideDataLossWarning:r,setIsModalOpen:i,deletionConfirmed:a,deletionPending:o,trigger:s,presentParticiple:c=`Deleting`,transitiveVerb:l=`Delete`}){return(0,B.jsxs)(Y,{open:n,onOpenChange:i,children:[s&&(0,B.jsx)(fo,{asChild:!0,children:s}),(0,B.jsxs)(X,{className:`sm:max-w-[750px]`,children:[(0,B.jsxs)(ho,{children:[(0,B.jsxs)(Q,{children:[`Are you sure you want to `,l.toLowerCase(),` this `,e,`?`]}),(0,B.jsx)(go,{children:`This action cannot be undone.`})]}),!r&&(0,B.jsxs)(`div`,{className:`p-3 my-5 text-white rounded-md bg-amber-600`,children:[(0,B.jsxs)(`p`,{className:`flex space-x-1 font-semibold align-baseline`,children:[(0,B.jsx)(nr,{className:`inline-block size-5`}),` `,(0,B.jsx)(`span`,{children:`Warning`})]}),(0,B.jsxs)(`p`,{className:`pt-2 text-base`,children:[`By `,c.toLowerCase(),` `,e,` `,(0,B.jsx)(`span`,{className:`font-semibold`,children:t}),` `,`you will lose the data stored in it permanently.`]})]}),(0,B.jsx)(Z,{children:(0,B.jsxs)(`div`,{className:`flex justify-center space-x-5`,children:[(0,B.jsxs)(R,{className:`rounded-full`,onClick:()=>i(!1),children:[(0,B.jsx)(mr,{}),` Cancel`]}),(0,B.jsxs)(R,{variant:`destructive`,className:`rounded-full`,onClick:a,disabled:o,children:[(0,B.jsx)(Dn,{}),` `,l]})]})})]})]})}function vo({className:e,variant:t,asChild:n=!1,...r}){return(0,B.jsx)(n?Se:`span`,{"data-slot":`badge`,className:g(di({variant:t}),e),...r})}function yo({...e}){return(0,B.jsx)(Cr,{"data-slot":`dropdown-menu`,...e})}function bo({...e}){return(0,B.jsx)(yr,{"data-slot":`dropdown-menu-trigger`,...e})}function xo({className:e,sideOffset:t=4,...n}){return(0,B.jsx)(fr,{children:(0,B.jsx)(Bn,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:g(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-grey-700 p-1 shadow-md`,e),...n})})}function So({className:e,inset:t,variant:n=`default`,...r}){return(0,B.jsx)(Cn,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:g(`focus:bg-accent focus:text-grey data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r})}function Co({className:e,children:t,checked:n,...r}){return(0,B.jsxs)(Yn,{"data-slot":`dropdown-menu-checkbox-item`,className:g(`focus:bg-primary relative flex cursor-pointer items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),checked:n,...r,children:[(0,B.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(bn,{children:(0,B.jsx)(zn,{className:`size-4`})})}),t]})}function wo({className:e,inset:t,...n}){return(0,B.jsx)(Qt,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:g(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function To({className:e,...t}){return(0,B.jsx)(an,{"data-slot":`dropdown-menu-separator`,className:g(`bg-grey-700 -mx-1 my-1 h-px`,e),...t})}function Eo(e){return!!e?.plans?.[0]?.planId?.startsWith(`self-hosted`)}function Do({cluster:e}){let t=Fr(e.id),{view:n,update:r}=Ci(e.organizationId,e.id),i=!m.checkForFabricConnect(e.id)&&!!t.user;if(n){if(!e.fqdn)return(0,B.jsx)(M,{to:`/${e.organizationId}/${e.id}/instances`,className:`text-sm text-nowrap`,"aria-label":`View ${e.name}`,title:`View ${e.name}`,children:(0,B.jsxs)(`span`,{className:`py-2 hover:border-b-2`,children:[`Instances `,(0,B.jsx)(ve,{className:`inline-block`})]})});if(e.resetPassword)return r?(0,B.jsx)(M,{to:`/${e.organizationId}/${e.id}/finish-setup`,className:`text-sm text-nowrap`,"aria-label":`Set Password on ${e.name}`,title:`Set Password on ${e.name}`,children:(0,B.jsxs)(R,{variant:`positive`,className:`py-2 hover:border-b-2 animate-glow-pulse`,children:[`Finish Setup `,(0,B.jsx)(ve,{className:`inline-block`})]})}):(0,B.jsx)(`span`,{className:`py-2 text-nowrap`,children:`Pending Owner Setup`});if(!t.isLoading)return i?(0,B.jsx)(M,{to:`/${e.organizationId}/${e.id}/`,className:`text-sm text-nowrap`,"aria-label":`View ${e.name}`,title:`View ${e.name}`,children:(0,B.jsxs)(`span`,{className:`py-2 hover:border-b-2`,children:[`Direct Connect `,(0,B.jsx)(ve,{className:`inline-block`})]})}):r&&!Eo(e)?(0,B.jsx)(M,{to:`/${e.organizationId}/${e.id}/`,className:`text-sm text-nowrap`,"aria-label":`Connect to ${e.name}`,title:`Connect to ${e.name}`,children:(0,B.jsxs)(`span`,{className:`py-2 hover:border-b-2`,children:[`Fabric Connect `,(0,B.jsx)(ve,{className:`inline-block`})]})}):(0,B.jsx)(M,{to:`/${e.organizationId}/${e.id}/sign-in`,className:`text-sm text-nowrap`,"aria-label":`Sign In to ${e.name}`,title:`Sign In to ${e.name}`,children:(0,B.jsxs)(`span`,{className:`py-2 hover:border-b-2`,children:[`Direct Sign In `,(0,B.jsx)(ve,{className:`inline-block`})]})})}}function Oo(e,t){let n=[];if(e)for(let r of e)n.push(r[t]);return n}function ko({cluster:e,forceProgressBarVisible:t}){let[n,r]=(0,z.useState)(t||!1),{data:i}=F(ua(n&&e.id,2e3));(0,z.useEffect)(function(){(lo(e.status)||uo(e.status))&&r(!0)},[n,e.status,i?.instances]);let a=(0,z.useMemo)(()=>{let e=Oo(i?.plans??[],`planId`),t=i?.instances??[],n=0,r={},a=0,o={},s=0,c={},l=0,u={};for(let i of t){let t=i.status;!t||co(t)||(lo(t)?(n+=1,r[t]=`${n} ${Xi(t)}`):uo(t)?(a+=1,o[t]=`${a} ${Xi(t)}`):so(t)?(l+=1,u[t]=`${l} ${Xi(t)}`):!i.planId||!e.includes(i.planId)?(a+=1,o.DRAINING_TRAFFIC=`${a} ${Xi(`Draining Traffic`)}`):oo(t)&&(s+=1,c[t]=`${s} ${Xi(t)}`))}let d=n+a+s;return{pendingWidth:`${d===0?100:n===0?0:n/d*100}%`,updatingWidth:`${a===0?0:a/d*100}%`,failedWidth:`${l===0?0:l/d*100}%`,runningWidth:`${s===0?0:s/d*100}%`,text:[...Object.values(c).sort(),...Object.values(u).sort(),...Object.values(o).sort(),...Object.values(r).sort()].join(` · `)}},[i]);return n?(0,B.jsxs)(`div`,{className:`w-full text-center`,children:[(0,B.jsxs)(`div`,{className:`w-full h-2.5 rounded-full overflow-clip flex shadow`,children:[(0,B.jsx)(`div`,{style:{width:a.runningWidth},className:`grow bg-green/80 transition-[width] duration-1000 ease-in-out motion-reduce:transition-none`}),(0,B.jsx)(`div`,{style:{width:a.failedWidth},className:`grow bg-red/80 transition-[width] duration-1000 ease-in-out motion-reduce:transition-none`}),(0,B.jsx)(`div`,{style:{width:a.updatingWidth},className:`grow animate-pulse bg-yellow/80 transition-[width] duration-1000 ease-in-out motion-reduce:transition-none`}),(0,B.jsx)(`div`,{style:{width:a.pendingWidth},className:`grow bg-gray-600 transition-[width] duration-1000 ease-in-out motion-reduce:transition-none`})]}),a.text&&(0,B.jsx)(`div`,{className:`text-xs text-muted-foreground font-light mt-2`,children:a.text})]}):null}async function Ao(e){let{data:t}=await u.delete(`/Cluster/${e}`,{timeout:0});return t}function jo(){return j({mutationFn:e=>Ao(e)})}function Mo(...e){return(0,z.useMemo)(()=>e.map(e=>(()=>{navigator.clipboard.writeText(e),N.info(`Copied to clipboard!`,{icon:(0,B.jsx)(In,{}),duration:1e3})})),e)}function No(e){try{return e===`null`||e===`undefined`||e==null?null:JSON.parse(e)}catch(e){return console.error(`safeParse failed to parse value, returning null instead`,e),null}}function Po(e,t){return No(localStorage.getItem(e))??t}function Fo(e,t){t==null?localStorage.removeItem(e):localStorage.setItem(e,JSON.stringify(t))}function Io(e,t){let n=(0,z.useState)(Po(e,t)),[r]=n;return(0,z.useEffect)(()=>Fo(e,r),[e,r]),n}var Lo=function(e){return e.SavedClusterState=`SavedClusterState`,e}({});function Ro({cluster:e}){let t=kt(),r=qt(),i=(0,z.useMemo)(()=>n(e),[e]),a=pi(i),o=Fr(e.id),[,s]=Io(Lo.SavedClusterState,null),{view:c,update:l,remove:u,create:d}=Ci(e.organizationId,e.id),{mutate:f,isPending:p}=jo(),[g,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(!1),b=(0,z.useMemo)(()=>e.status&&ra.includes(e.status),[e.status]),x=Eo(e),ee=m.checkForFabricConnect(e.id),S=!ee&&!!o.user,te=(0,z.useMemo)(()=>e.status&&ia.includes(e.status),[e.status]),C=(0,z.useMemo)(()=>e.status&&so(e.status),[e.status]),w=(0,z.useCallback)(async()=>{_(!0);let t=await la(e.id).catch(e=>(console.error(`Failed to lookup cluster details, proceeding without checking instances.`,e),null));if(await h({entityId:e.id,instanceClient:a}),t?.instances?.length)for(let e of t.instances)m.setUserForEntity(e,null);m.setUserForEntity(e,null)},[e,a]),T=(0,z.useCallback)(()=>{s(e),t.navigate({to:`/${e.organizationId}/new-cluster`})},[e,t,s]),ne=(0,z.useCallback)(()=>y(!0),[]),E=(0,z.useCallback)(()=>{let n=e.organizationId;f(e.id,{onSuccess:async()=>{await r.invalidateQueries({queryKey:[n],refetchType:`active`}),await t.invalidate(),N.success(`Success`,{description:x?`Cluster successfully removed.`:`Cluster successfully terminated.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),y(!1)},onError:()=>{N.error(`Error`,{description:x?`Failed to remove cluster: ${e.name}`:`Failed to terminate cluster: ${e.name}.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),y(!1)}})},[t,e.organizationId,e.id,e.name,f,x,r]),re=e.domains?.[0]?.domain||e.fqdn,[ie,D]=Mo(`${re}`,`https://${re}`),ae=[b&&l&&!o.isLoading&&(!S||ee)&&(0,B.jsx)(M,{to:`${e.id}/sign-in`,disabled:g,children:(0,B.jsxs)(So,{children:[(0,B.jsx)(at,{className:`text-green`}),` Direct Sign In`]})},`sign-in`),b&&l&&(0,B.jsx)(M,{to:`${e.id}/edit`,disabled:g,children:(0,B.jsxs)(So,{children:[(0,B.jsx)(pn,{className:`text-purple-600`}),` Edit Scaling`]})},`edit`),b&&l&&!1,b&&c&&(0,B.jsx)(M,{to:`${e.id}/instances`,disabled:g,children:(0,B.jsxs)(So,{children:[(0,B.jsx)(ur,{className:`text-orange-300`}),` Instances`]})},`instances`),b&&c&&e.fqdn&&(0,B.jsxs)(So,{onClick:ie,disabled:g,children:[(0,B.jsx)(cn,{}),` Copy Host Name`]},`copy-host-name`),b&&c&&e.fqdn&&(0,B.jsxs)(So,{onClick:D,disabled:g,children:[(0,B.jsx)(cn,{}),` Copy API URL`]},`copy-api-url`),b&&c&&!!i&&!o.isLoading&&S&&(0,B.jsx)(So,{onClick:w,disabled:g,children:`Direct Sign Out`},`direct-sign-out`),C&&d&&(0,B.jsx)(So,{className:`focus:bg-green/70 focus:text-white`,onClick:T,children:`Try Again`},`try-again`),!te&&u&&(0,B.jsxs)(B.Fragment,{children:[b&&(0,B.jsx)(To,{}),(0,B.jsxs)(So,{className:`focus:bg-red/70 focus:text-white`,onClick:ne,children:[(0,B.jsx)(Dn,{className:`text-red-300`}),` `,x?`Remove`:`Terminate`]},`remove`)]})].filter(Zr);return(0,B.jsxs)(zr,{className:`relative h-full justify-between`,children:[(0,B.jsxs)(Br,{children:[(0,B.jsxs)(Hr,{className:`flex items-center justify-between`,children:[re?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`span`,{className:`truncate max-w-48`,children:re}),(0,B.jsx)(Hn,{onClick:ie,size:16,className:`cursor-pointer`}),(0,B.jsx)(`span`,{className:`grow`})]}):(0,B.jsx)(`span`,{children:`Self-Hosted`}),!te&&(0,B.jsxs)(yo,{children:[(0,B.jsx)(bo,{children:(0,B.jsx)(ht,{"aria-label":`Cluster options`})}),(0,B.jsxs)(xo,{children:[[...ae],!C&&(0,B.jsxs)(B.Fragment,{children:[ae.length>0&&(0,B.jsx)(To,{}),(0,B.jsx)(wo,{className:`text-gray-600 text-xs`,children:`Plans`}),e.plans?.slice(0,5)?.map(e=>(0,B.jsxs)(wo,{children:[e.planId,` / `,e.regionId,(0,B.jsx)(`br`,{}),`Auto Renewal `,(0,B.jsx)(vo,{variant:`success`,children:`ON`})]},e.planId+e.regionId)),!!e.plans?.length&&e.plans?.length>5&&(0,B.jsxs)(wo,{className:`italic text-muted-foreground`,children:[e.plans.length-5,` additional plans`]})]})]})]})]}),(0,B.jsx)(Vr,{children:(0,B.jsx)(`h2`,{children:e.name})})]}),(0,B.jsxs)(Ur,{className:`flex items-center justify-between gap-2`,children:[(0,B.jsx)(ko,{cluster:e}),b&&c&&(0,B.jsx)(Do,{cluster:e}),C&&e.status&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(vo,{variant:ao(e.status),children:Xi(e.status)}),(0,B.jsx)(`span`,{className:`text-xs`,children:`Click "..." to choose how to proceed.`})]})]}),(0,B.jsx)(_o,{typeOfThingBeingDeleted:`cluster`,transitiveVerb:x?`Remove`:`Terminate`,presentParticiple:x?`Removing`:`Terminating`,nameOfThingBeingDeleted:e.name,isModalOpen:v,hideDataLossWarning:x,setIsModalOpen:e=>y(e),deletionConfirmed:E,deletionPending:p})]})}function zo({overEmail:e}){return(0,B.jsx)(`a`,{href:e?`mailto:support@harperdb.io`:`https://discord.com/channels/1415002037439041710/1415002038286286994`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Contact us`})}function Bo({className:e,text:t,centered:n,...r}){return(0,B.jsxs)(`div`,{className:`text-white h-full w-full ${e||``} ${n?`flex flex-col items-center justify-center`:``}`,...r,children:[(0,B.jsx)(`img`,{src:`/HDBDogOnly.svg`,width:`100px`,height:`100px`,alt:`HDB Dog Logo Loading`,className:`inline-block`}),(0,B.jsx)(`p`,{className:`pt-4`,children:t||`Loading...`})]})}function Vo({children:e}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))] relative`,children:e})]})}async function Ho(e){let{data:t}=await u.get(`/Plan/`,{params:{organizationId:e}});return t}function Uo(e){return I({queryKey:[e,`instancePlan`],queryFn:()=>Ho(e),retry:!1})}async function Wo({organizationId:e,availableHosts:t}={}){let{data:n}=await u.get(`/Region/`,{params:{availableHosts:t,organizationId:e}});return n}function Go({organizationId:e,availableHosts:t}={}){return{queryKey:[e,`regionLocations`,t],queryFn:()=>Wo({organizationId:e,availableHosts:t}),retry:!1}}function Ko(e){return(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1}function qo(e){let t=e.split(`.`).map(Number);return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0}function Jo(e){return typeof e==`string`?/^(?:25[0-5]|2[0-4]\d|1?\d?\d)(?:\.(?:25[0-5]|2[0-4]\d|1?\d?\d)){3}$/.test(e):!1}function Yo(e,t){return e.instanceFqdn===t.instanceFqdn?e.operationsApiPort-t.operationsApiPort:Jo(e.instanceFqdn)&&Jo(t.instanceFqdn)?qo(e.instanceFqdn)-qo(t.instanceFqdn):e.instanceFqdn>t.instanceFqdn?1:-1}function Xo(e,t){let n={};for(let r of e){let e=r[t];if(e!==void 0)if(Array.isArray(e))for(let t of e)n[t]||(n[t]=[]),n[t].push(r);else n[e]||(n[e]=[]),n[e].push(r)}return n}function Zo(e,t){let n={};for(let r of e){let e=r[t];if(e!==void 0)if(Array.isArray(e))for(let t of e)n[t]=r;else n[e]=r}return n}function Qo(e,t,n){let r=Xo(e,t),i={};for(let e in r)i[e]=Zo(r[e],n);return i}function $o({width:e,className:t,animated:n,placeholder:r}){return(0,B.jsxs)(`div`,{className:y(`w-full bg-gray-200 rounded-full relative`,r?`h-6`:`h-2.5`),children:[r&&(0,B.jsx)(`div`,{className:`absolute top-0 h-full w-full font-bold text-xs flex flex-col items-center justify-center text-black/60 text-shadow-2xs`,children:r}),(0,B.jsx)(`div`,{className:y(`rounded-full`,r?`h-6`:`h-2.5`,!t?.includes(`bg-`)&&`bg-purple/40`,n&&`transition-[width] duration-1000 ease-in-out motion-reduce:transition-none`,t),style:{width:e}})]})}function es({duration:e,message:t,lateMessage:n}){let r=(0,z.useRef)(0),i=(0,z.useRef)(0),[a,o]=(0,z.useState)(!1),[s,c]=(0,z.useState)(`5%`),l=(0,z.useCallback)(function t(n){i.current||=n;let a=n-i.current,s=Math.min(a/e,1);c(Math.max(5,s*100)+`%`),s<1?r.current=requestAnimationFrame(t):o(!0)},[e]);return(0,z.useEffect)(()=>(r.current=requestAnimationFrame(l),()=>cancelAnimationFrame(r.current)),[l]),(0,B.jsxs)(B.Fragment,{children:[a?n:t,(0,B.jsx)($o,{width:s,animated:!1})]})}async function ts(e){let{data:t}=await u.post(`/Cluster/`,e,{timeout:0});return t}function ns(){return j({mutationFn:e=>ts(e)})}async function rs(e){let{data:t}=await u.put(`/Cluster/${e.id}`,{regionPlans:e.regionPlans},{timeout:0});return t}function is(){return j({mutationFn:e=>rs(e)})}async function as(e){let{data:t}=await u.get(`/Organization/${e}`);return t}function os(e){return I({queryKey:[e],queryFn:()=>as(e),retry:!1,refetchInterval:1e4})}var ss=`ENTERPRISE`;function cs(e,t){if(t<=0)return``;if(e.length<=t)return e;let n=e.split(`-`);if(n.length===1)return n[0].slice(0,t);let r=[n[0],...n.slice(1).map(e=>e.charAt(0))],i=r.join(`-`);if(i.length<=t)return i;let a=r.slice(1).join(``).length,o=r.length-1,s=t-a-o;if(s>0)return r[0]=r[0].slice(0,s),r.join(`-`);{let e=[],i=0;t>0&&(e.push(n[0].charAt(0)),i=1);for(let n=1;n<r.length&&i+2<=t;n++)e.push(r[n]),i+=2;return e.join(`-`)}}function ls(e,t,n=`-`){let r=t.split(n)[0];return e.findIndex(e=>e.startsWith(r))!==-1}function us(e){return e.replace(/[^a-zA-Z0-9]/g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase().replace(/-+/g,`-`).replace(/^-+|-+$/g,``)}async function ds(e){await u.put(`/Payment/`,e)}function fs(){return j({mutationFn:e=>ds(e)})}function ps(e){let{mutate:t}=fs();return(0,z.useCallback)((n,r)=>{t({paymentMethodId:typeof n==`string`?n:n.id,organizationId:e},{onSuccess:()=>{N.success(`Success! Your payment method has been saved.`),r(!0)},onError:()=>{N.error(`Failed to process payment method details. Please try another payment method.`),r(!1)}})},[t,e])}var ms=(0,z.createContext)(null);function hs(){return(0,z.useContext)(ms)}function gs({hasExistingBilling:e,onPaymentAdded:t,onSaveStateForBillingRedirect:n}){let{organizationId:r}=P({strict:!1}),i=vn(),a=hs(),o=fn(),[s,c]=(0,z.useState)(!1),l=ps(r),u=(0,z.useCallback)(()=>{t(!1)},[t]);return(0,B.jsxs)(`form`,{id:`billing-add-payment-method-form`,name:`billing-add-payment-method-form`,onSubmit:(0,z.useCallback)(async e=>{if(e.preventDefault(),!i||!o)return;c(!0),await o.submit(),n?.(!0);let s=await i.confirmSetup({clientSecret:a.clientSecret,elements:o,redirect:`if_required`,confirmParams:{return_url:`${window.location.origin}/#/${r}/billing/confirm`}});s.error?(console.error(s.error.message),N.error(s.error.message),c(!1),n?.(!1)):s.setupIntent.payment_method&&(l(s.setupIntent.payment_method,t),n?.(!1))},[o,t,n,r,l,i,a.clientSecret]),className:`max-w-xl`,children:[(0,B.jsx)(lr,{}),(0,B.jsx)(Ln,{options:{mode:`billing`}}),(0,B.jsxs)(`div`,{className:`mt-4 flex gap-8 items-center`,children:[(0,B.jsxs)(R,{disabled:!i||!o||s,variant:`submit`,className:`rounded-full`,children:[(0,B.jsx)(yn,{}),` Add Payment Method`]}),e&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`text-xs text-gray-600`,children:`Your existing payment method will be overwritten.`}),(0,B.jsx)(R,{variant:`defaultOutline`,type:`button`,onClick:u,children:`Cancel`})]})]})]})}async function _s(e){let{data:t}=await u.post(`/StripeAccount/`,e);return t}function vs(){return j({mutationFn:e=>_s(e)})}async function ys(e){let{data:t}=await u.post(`/Payment/`,{organizationId:e.organizationId});return t}function bs(){return j({mutationFn:e=>ys(e)})}function xs(e){let{enabled:t,existingStripeId:n,organizationId:r}=e,{mutate:i}=vs(),{mutate:a}=bs(),[o,s]=(0,z.useState)(void 0);return(0,z.useEffect)(()=>{},[i,t,n,a,(0,z.useCallback)(e=>{s(e.clientSecret)},[]),r]),o}function Ss({children:e}){let{organizationId:t}=P({strict:!1}),{data:n}=F(os(t)),r=xs({organizationId:t,enabled:!!n,existingStripeId:n?.stripeId});return(0,z.useMemo)(()=>({clientSecret:r||``,appearance:{theme:`night`}}),[r]),console.error(`No VITE_PUBLIC_STRIPE_KEY is configured for this environment.`),(0,B.jsx)(`div`,{className:`mt-20 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:`Setting up your billing is currently disabled. Please check back again later.`})}function Cs({onPaymentAdded:e,onSaveStateForBillingRedirect:t}){let{organizationId:n}=P({strict:!1}),{data:r}=F(os(n)),i=r?.billing,a=i?.paymentMethod;return(0,B.jsxs)(Ss,{children:[(0,B.jsx)(`div`,{className:`mt-2 mb-6`,children:!a&&`You currently have no payment method on file. Please fill out the secure form below.`}),(0,B.jsx)(gs,{hasExistingBilling:!!i,onSaveStateForBillingRedirect:t,onPaymentAdded:e})]})}var ws=function(e){return e.PASS=`pass`,e.FAIL=`fail`,e.PENDING=`pending`,e.ERROR=`error`,e}({});function Ts(e){switch(e){case ws.PASS:return`success`;case ws.FAIL:case ws.ERROR:return`destructive`;case ws.PENDING:default:return`default`}}function Es(e){switch(e){case ws.PASS:return`READY`;case ws.FAIL:case ws.ERROR:case ws.PENDING:default:return e.toUpperCase()}}function Ds(e,t){return`${String(e).padStart(2,`0`)}/${String(t%100).padStart(2,`0`)}`}function Os(e){let{onSaveStateForBillingRedirect:t,onReplacingPaymentMethod:n}=e??{},{organizationId:r}=P({strict:!1}),{update:i}=xi(r),{data:a,refetch:o}=F(os(r)),s=a?.billing?.paymentMethod,[c,l]=(0,z.useState)(!1),u=(0,z.useCallback)(()=>{l(!c),n?.(!c)},[n,c]),d=(0,z.useCallback)(e=>{l(!1),n?.(!1),e&&o()},[n,o]);return a?.type===`ENTERPRISE`?(0,B.jsxs)(`span`,{children:[`You are part of an enterprise organization! We don’t currently show your payment methods on this page. Want to explore your solution with Harper more? `,(0,B.jsx)(zo,{}),`, we would love to talk!`]}):s&&!c?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`mt-2`,children:[s.brand?.toUpperCase()??`Card`,` ending in `,s.last4??`••••`,s.expMonth&&s.expYear?(0,B.jsxs)(B.Fragment,{children:[`(exp `,Ds(s.expMonth,s.expYear),`)`]}):null,s.status?(0,B.jsxs)(B.Fragment,{children:[`—`,` `,(0,B.jsx)(vo,{variant:Ts(s.status),children:Es(s.status)})]}):null]}),i&&(0,B.jsx)(`div`,{className:`mt-2 mb-6`,children:(0,B.jsx)(R,{variant:`defaultOutline`,type:`button`,onClick:u,children:`Replace Payment Method`})})]}):i?(0,B.jsx)(Cs,{onSaveStateForBillingRedirect:t,onPaymentAdded:d}):(0,B.jsx)(`div`,{children:`This org doesn't have a payment method, and you don't have access to add one. Please contact your administrator.`})}function ks(e){return e!==void 0&&e>0}function As({clusterId:e,isPending:t,onGoBackToDetails:n,onSaveStateForBillingRedirect:r,onSubmit:i,organizationId:a,selectedPlan:o}){let{data:s}=F(os(a)),c=s?.billing,l=s?.type===ss,u=l||c?.paymentMethod?.status===ws.PASS,[d,f]=(0,z.useState)(!1),m=ks(o?.planLimits?.expirationMonths)&&o.planLimits.expirationMonths<1e3&&o.planLimits.expirationMonths,h=(0,B.jsx)(B.Fragment,{children:(0,B.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-3 max-w-xl`,children:[(0,B.jsxs)(R,{type:`button`,variant:`defaultOutline`,className:`rounded-full`,disabled:t,onClick:n,children:[(0,B.jsx)(mr,{}),` Back to Details`]}),(0,B.jsxs)(R,{disabled:t||!u||d,type:`submit`,variant:`submit`,className:`rounded-full`,onClick:i,children:[e?`Edit Cluster`:`Create New Cluster`,` `,(0,B.jsx)(ve,{})]})]})});if(l)return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`ul`,{className:`list-disc ml-6 max-w-lg`,children:[(0,B.jsx)(`li`,{children:`Reminder: you will be billed at your contracted rate for any additional infrastructure.`}),(0,B.jsxs)(`li`,{children:[`Your account representative can work with you to sort out more precise details, and to help accomplish your objectives with this cluster. `,(0,B.jsx)(zo,{overEmail:!0}),`, we are here to help.`]})]}),h]});let g=m&&`, or ${p(m,`month`,`months`)} elapse`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`ul`,{className:`list-disc ml-6 mb-6`,children:[(0,B.jsx)(`li`,{children:`You will be billed for this cluster today, and will receive a license for the block of usage you've requested.`}),e&&(0,B.jsx)(`li`,{children:`If you scale up, you'll be charged for the additional blocks you've purchased now, and your next auto renewal will be for all purchased blocks.`}),e&&(0,B.jsx)(`li`,{children:`If you remove a region, that region's usage block will not be used anymore (because it is specific to that region).`}),(0,B.jsxs)(`li`,{children:[`When that block is used up`,g,`, you will be automatically renewed.`]}),(0,B.jsx)(`li`,{children:`While refunds are not available, we’d be happy to assist you with troubleshooting.`}),(0,B.jsxs)(`li`,{children:[`We would love to work with you to sort out more precise details, and to help accomplish your objectives with this cluster. `,(0,B.jsx)(zo,{overEmail:!0}),`, we are here to help.`]})]}),(0,B.jsx)(`p`,{className:`text-muted-foreground text-sm mb-6`,children:`Payment method:`}),(0,B.jsx)(Os,{onSaveStateForBillingRedirect:r,onReplacingPaymentMethod:f}),h]})}function js({className:e}={}){return(0,B.jsx)(`div`,{className:(0,z.useMemo)(()=>y(`animate-pulse h-2.5 bg-gray-200 rounded-full dark:bg-gray-700`,!e?.includes(`mb-`)&&`mb-4 `,!e?.includes(`w-`)&&`w-48 `,e),[e])})}function Ms({...e}){return(0,B.jsx)(tr,{"data-slot":`select`,...e})}function Ns({...e}){return(0,B.jsx)(Ut,{"data-slot":`select-group`,...e})}function Ps({...e}){return(0,B.jsx)(ir,{"data-slot":`select-value`,...e})}function Fs({className:e,children:t,...n}){return(0,B.jsxs)(Kn,{"data-slot":`select-trigger`,className:g(`border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive flex h-9 w-fit items-center justify-between gap-2 rounded-md border bg-grey-700 px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 *:data-[slot=select-value]:truncate *:data-[slot=select-value]:block *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...n,children:[t,(0,B.jsx)(Xt,{asChild:!0,children:(0,B.jsx)(Jn,{className:`opacity-50 size-4`})})]})}function Is({className:e,children:t,position:n=`popper`,...r}){return(0,B.jsx)(Un,{children:(0,B.jsxs)(Kt,{"data-slot":`select-content`,className:g(`bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,B.jsx)(Rs,{}),(0,B.jsx)(ln,{className:g(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,B.jsx)(zs,{})]})})}function Ls({className:e,...t}){return(0,B.jsx)(sr,{"data-slot":`select-label`,className:g(`px-2 py-1.5 text-sm font-medium`,e),...t})}function $({className:e,children:t,...n}){return(0,B.jsxs)(gt,{"data-slot":`select-item`,className:g(`focus:bg-grey-200 focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,B.jsx)(hn,{children:t}),(0,B.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(ue,{children:(0,B.jsx)(zn,{className:`size-4`})})})]})}function Rs({className:e,...t}){return(0,B.jsx)(tn,{"data-slot":`select-scroll-up-button`,className:g(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(_n,{className:`size-4`})})}function zs({className:e,...t}){return(0,B.jsx)(En,{"data-slot":`select-scroll-down-button`,className:g(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(Jn,{className:`size-4`})})}var Bs=new RegExp(/^\d+/);function Vs(e,t){let n=parseInt(e.match(Bs)?.[0]||`0`,10),r=parseInt(t.match(Bs)?.[0]||`0`,10);return n===r?0:n>r?1:-1}var Hs=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],Us=[`secs`,`mins`,`hrs`],Ws={bytes:1e3,secs:60};function Gs(e,t,n){let r,i;switch(t){case`bytes`:r=Hs,i=Ws.bytes;break;case`secs`:r=Us,i=Ws.secs;break;default:return e}let a=r.indexOf(n);return a===-1?e:e/i**a}function Ks(e,t){let n,r;switch(e){case`bytes`:n=Hs,r=Ws.bytes;break;case`secs`:n=Us,r=Ws.secs;break;default:return e}let i=0;for(;t>=r&&i<n.length-1;)t/=r,i++;return n[i]}function qs(e,t=1){let n=e*t,r=Ks(`bytes`,n),i=Gs(n,`bytes`,r);return`${new Intl.NumberFormat().format(Math.round(i))} ${r}`}function Js(e){return new Intl.NumberFormat().format(e)}var Ys=[`K`,`M`,`B`,`T`,`Qa`,`Qi`,`Sx`,`Sp`,`Oc`,`No`,`Dc`];function Xs(e){let t=1e3,n=e;if(Math.abs(n)<t)return String(Math.round(n));let r=-1;do n/=t,++r;while(Math.round(Math.abs(n)*10)/10>=t&&r<Ys.length-1);return`${Js(Math.round(n))} ${Ys[r]}`}function Zs({selectedPlan:e,selectedRegion:t,isEnterprise:n}){let[r,i]=(0,z.useState)(!1),a=(0,z.useCallback)(()=>{i(!r)},[r,i]),o=e?.planLimits,s=e?.resourcesPerInstance,c=ks(o?.expirationMonths)&&o.expirationMonths<1e3&&o.expirationMonths,l=t?.purchasedBlockMultiplier??1,u=(0,z.useMemo)(()=>o?[ks(o.totalReadCount)&&{label:`Total Reads`,value:`${Xs(o.totalReadCount*l)} reads`},ks(o.totalReadsBytes)&&{label:`Total Read Transfer`,value:`${qs(o.totalReadsBytes*l)}`},ks(o.readsPerMinuteCount)&&{label:`Read Rate`,value:`${Xs(o.readsPerMinuteCount*60*l)}/min`},ks(o.readsPerMinuteBytes)&&{label:`Read Bandwidth`,value:`${qs(o.readsPerMinuteBytes*60*l)}/min`},ks(o.totalWriteCount)&&{label:`Total Writes`,value:`${Xs(o.totalWriteCount)} reads`},ks(o.totalWritesBytes)&&{label:`Total Write Transfer`,value:`${qs(o.totalWritesBytes)}`},ks(o.writesPerMinuteCount)&&{label:`Write Rate`,value:`${Xs(o.writesPerMinuteCount*60)}/min`},ks(o.writesPerMinuteBytes)&&{label:`Write Bandwidth`,value:`${qs(o.writesPerMinuteBytes*60)}/min`},ks(o.totalRealTimeMessageDeliveries)&&{label:`Total Real-Time Messages`,value:`${Xs(o.totalRealTimeMessageDeliveries*l)} messages`},ks(o.totalRealTimeMessageDeliveryBytes)&&{label:`Total Real-Time Message Transfer`,value:`${qs(o.totalRealTimeMessageDeliveryBytes*l)}`},ks(o.realTimeMessageDeliveriesPerMinute)&&{label:`Real-Time Message Rate`,value:`${Xs(o.realTimeMessageDeliveriesPerMinute*60*l)}/min`},ks(o.realTimeMessageDeliveryBytesPerMinute)&&{label:`Real-Time Message Bandwidth`,value:`${qs(o.realTimeMessageDeliveryBytesPerMinute*60*l)}/min`},ks(o.tlsHandshakes)&&{label:`TLS Handshakes`,value:`${Xs(o.tlsHandshakes*60*l)}`},ks(o.applicationComputeHours)&&{label:`Application Compute Hours`,value:`${Xs(o.applicationComputeHours*60*l)}`},!!s&&ks(s.storageGb)&&{label:`Storage`,value:`${qs(s.storageGb*1e9)}`},!!c&&{label:`Expiration`,value:p(c,`month`,`months`)},!!t?.id&&{label:`Region ID`,value:t.id},!!e?.id&&{label:`Plan ID`,value:e.id}].filter(Zr):[],[c,t,e,l]);if(!o)return``;if(!ks(o.totalReadCount))return`This plan has no usage limits.`;let d=n?` Pricing subject to contracted rate.`:` Beta pricing subject to change.`,f=ks(o.readsPerMinuteCount)?`${Xs(o.readsPerMinuteCount*l)} reads/min & `:``,m=ks(o.writesPerMinuteCount)?` ${Xs(o.writesPerMinuteCount)} writes/min & `:` `,h=ks(o.readsPerMinuteCount)?`in ${t?.region??``} region${t?` (${t?.id})`:``}`:`per server`,_=c?`, for ${p(c,`month`,`months`)}`:``,v=n?`for the contracted rate`:`for the price listed above`,y=c?` in ${p(c,`month`,`months`)} or`:``;return(0,B.jsxs)(G,{className:`basis-full`,children:[(0,B.jsxs)(K,{onClick:a,children:[(0,B.jsx)(`em`,{className:`text-muted-foreground`,children:e?.id}),` Purchasing usage block for `,f,Xs(o.totalReadCount*l),` total reads `,h,`,`,(0,B.jsx)(`br`,{className:`hidden sm:block`}),m,` `,Xs(o.totalWriteCount),` total writes`,_,`.`,d,(0,B.jsx)(`br`,{className:`block sm:hidden`}),(0,B.jsxs)(R,{type:`button`,variant:`link`,className:`text-white`,children:[`Learn More `,r?(0,B.jsx)(Tt,{}):(0,B.jsx)(ve,{})]})]}),(0,B.jsx)(U,{children:(0,B.jsxs)(`dl`,{className:g(`divide-y divide-black overflow-hidden transition-[max-height] duration-200 ease-in`,r?`max-h-fit`:`max-h-0`),children:[(0,B.jsxs)(`div`,{className:`text-sm mb-3 max-w-lg`,children:[`This plan licenses Harper for the usage limits below, `,v,`. The usage license expires`,y,` `,`when any usage limit is reached. New usage blocks are automatically purchased/billed as blocks are consumed.`]}),u.map((e,t)=>(0,B.jsxs)(`div`,{className:g(`px-4 py-1 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-3`,t%2==0&&`bg-gray-700`),children:[(0,B.jsx)(`dt`,{className:`text-sm/6 font-medium text-gray-300`,children:e.label}),(0,B.jsx)(`dd`,{className:`mt-1 text-sm/6 sm:col-span-2 sm:mt-0`,children:e.value})]},e.label))]})}),(0,B.jsx)(q,{})]})}function Qs({control:e,fieldArray:t,form:n,index:r,regionNameToLatencyToRegion:i,selectedPlan:a,isEnterprise:o}){let s=(0,z.useMemo)(()=>Object.keys(i).sort(),[i]),c=n.watch(`deploymentDescription`)?.startsWith(`Dedicated`),l=n.watch(`regionPlans.${r}.regionName`),u=n.watch(`regionPlans.${r}.latencyDescription`),d=(0,z.useMemo)(()=>Object.keys(i[l]||{}).sort(Vs).reverse(),[i,l]);(0,z.useEffect)(function(){if(l&&d?.length&&!d?.includes(u)){let e=u?.split(` `)[0].toLowerCase(),t=d.find(t=>e?t.split(` `)[0].toLowerCase()===e:!0)||d[0];n.setValue(`regionPlans.${r}.latencyDescription`,t),n.trigger()}},[d,n,r,u,l]);let f=(0,z.useCallback)(()=>{t?.remove(r),n.trigger()},[t,n,r]);return(0,B.jsxs)(`div`,{className:`md:col-span-6 col-span-3 p-4 rounded-md bg-accent gap-6 flex flex-wrap items-start`,children:[(0,B.jsx)(W,{control:e,name:`regionPlans.${r}.regionName`,render:({field:e})=>(0,B.jsxs)(G,{className:`flex-1`,children:[(0,B.jsxs)(K,{children:[`Region `,t.fields.length>1?r+1:``]}),(0,B.jsx)(U,{children:(0,B.jsxs)(Ms,{onValueChange:t=>{e.onChange(t),n.trigger()},...e,children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Choose Region`})}),(0,B.jsx)(Is,{children:(0,B.jsx)(Ns,{children:s.map(e=>(0,B.jsx)($,{value:e,children:e},e))})})]})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e,name:`regionPlans.${r}.latencyDescription`,render:({field:e})=>(0,B.jsxs)(G,{className:`flex-1`,children:[(0,B.jsxs)(K,{children:[`Estimated `,c?`P95`:`P90`,` Latency, Distribution`]}),(0,B.jsx)(U,{children:(0,B.jsxs)(Ms,{onValueChange:t=>{e.onChange(t),n.trigger()},...e,disabled:!d?.length,children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Choose Latency Tier`})}),(0,B.jsx)(Is,{children:(0,B.jsx)(Ns,{children:d.map(e=>(0,B.jsx)($,{value:e,children:e},e))})})]})}),(0,B.jsx)(q,{})]})}),t?.fields?.length&&t?.fields?.length>1&&(0,B.jsx)(`div`,{className:`flex-none mt-6`,children:(0,B.jsxs)(R,{type:`button`,variant:`destructiveOutline`,size:`sm`,onClick:f,children:[(0,B.jsx)(Dn,{}),` `,(0,B.jsx)(`span`,{className:`sr-only`,children:`Remove`})]})}),(0,B.jsx)(Zs,{selectedPlan:a,selectedRegion:i[l]?.[u],isEnterprise:o})]})}function $s({form:e,regionLocations:t,regionNameToLatencyToRegion:n,selectedPlan:r,totalPrice:i,isEnterprise:a}){let o=e.watch(`regionPlans`),s=dt({control:e.control,name:`regionPlans`}),c=(0,z.useMemo)(()=>{let e=o.map(e=>n?.[e.regionName]?.[e.latencyDescription]?.region);return i?t?.find(t=>!e.includes(t.region)):null},[t,n,o,i]),l=(0,z.useCallback)(()=>{c&&(s.append({regionName:c.region,latencyDescription:c.latencyDescription}),e.trigger())},[e,c,s]);return t?.length?(0,B.jsxs)(B.Fragment,{children:[s.fields.map((t,i)=>(0,B.jsx)(Qs,{control:e.control,fieldArray:s,form:e,index:i,regionNameToLatencyToRegion:n,selectedPlan:r,isEnterprise:a},t.id)),c&&(0,B.jsx)(`div`,{className:`md:col-span-6 col-span-3`,children:(0,B.jsxs)(R,{type:`button`,variant:`positiveOutline`,className:`rounded-full`,onClick:l,children:[(0,B.jsx)(pr,{}),`Add Additional Region Usage`]})})]}):(0,B.jsx)(`div`,{className:`md:col-span-6 col-span-3`,children:(0,B.jsx)(Kr,{className:`mt-0 m-0`,title:`No Regions Available`,showReturnToHome:!1,error:{message:(0,B.jsxs)(B.Fragment,{children:[`The deployment type you selected currently has no available regions. Please try a different deployment type, try again later, or `,(0,B.jsx)(zo,{}),`.`]})}})})}var ec=65535;function tc({control:e,fieldArray:t,form:n,index:r}){let i=(0,z.useCallback)(()=>{t?.remove(r)},[t,r]);return(0,B.jsxs)(`div`,{className:`md:col-span-6 col-span-3 p-4 rounded-md bg-accent gap-6 flex flex-wrap items-start`,children:[(0,B.jsx)(W,{control:e,name:`instances.${r}.secure`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsxs)(K,{children:[`Instance `,t.fields.length>1?r+1:``]}),(0,B.jsx)(U,{children:(0,B.jsxs)(Ms,{...e,onValueChange:t=>{e.onChange(t),n.trigger()},children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`https://`})}),(0,B.jsx)(Is,{children:(0,B.jsxs)(Ns,{children:[(0,B.jsx)($,{value:`true`,children:`https://`}),(0,B.jsx)($,{value:`false`,children:`http://`})]})})]})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e,name:`instances.${r}.fqdn`,render:({field:e})=>(0,B.jsxs)(G,{className:`flex-3`,children:[(0,B.jsx)(K,{children:`Host Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{...e,type:`text`,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e,name:`instances.${r}.port`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`Operations API Port`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{...e,type:`number`,min:0,max:ec,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:String(o),onChange:t=>{e.onChange(t.target.value?parseInt(t.target.value,10):void 0),n.trigger()}})}),(0,B.jsx)(q,{})]})}),t?.fields?.length&&t?.fields?.length>1&&(0,B.jsx)(`div`,{className:`flex-none mt-6`,children:(0,B.jsxs)(R,{type:`button`,variant:`destructiveOutline`,size:`sm`,onClick:i,children:[(0,B.jsx)(Dn,{}),` `,(0,B.jsx)(`span`,{className:`sr-only`,children:`Remove`})]})})]})}function nc({form:e}){let t=dt({control:e.control,name:`instances`}),n=(0,z.useCallback)(()=>{t.append({secure:`true`,fqdn:``,port:o})},[t]);return(0,B.jsxs)(B.Fragment,{children:[t.fields.map((n,r)=>(0,B.jsx)(tc,{control:e.control,fieldArray:t,form:e,index:r},n.id)),(0,B.jsx)(`div`,{className:`md:col-span-6 col-span-3`,children:(0,B.jsxs)(R,{type:`button`,variant:`positiveOutline`,className:`rounded-full`,onClick:n,children:[(0,B.jsx)(pr,{}),`Add Instance`]})})]})}var rc=/(^$|^(?:localhost|(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}|(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,})$)/i,ic=C().max(20,`Must be at most 20 characters long.`).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,`Can only contain lowercase letters, numbers and dashes. Must not start or end with a dash.`),ac=D({clusterName:C().nonempty(`Please enter a cluster name.`).max(255,`Cluster name cannot be longer than 255 characters long.`),abbreviatedName:ae([S(``),te(),ic]),fqdn:C().regex(rc,`Please enter a valid host name without the port or any path.`).optional(),deploymentDescription:C().nonempty(`Please select a deployment tier.`),performanceDescription:C().nonempty(`Please select a performance tier.`),regionPlans:w(D({regionName:C().nonempty(`Please select a region.`),latencyDescription:C().nonempty(`Please select a latency tier.`)})).max(50,{error:`A maximum of 50 regions can be selected for each cluster. `}),instances:w(D({secure:x([`true`,`false`]),fqdn:C().nonempty(`Please enter the host name of your instance.`).regex(rc,`Please enter a valid host name without the port or any path.`),port:re().min(0,`Positive thinking only, please.`).max(ec,`That port number is too high.`).optional()})).max(100,{error:`A maximum of 100 instances can be added to each cluster.`}),skipToBilling:E().optional(),sourceClusterId:C().optional()}),oc={Colocated:`Shared infrastructure for optimized value`,Dedicated:`Dedicated infrastructure for consistent performance`,"Self-Hosted":`Your own infrastructure`};function sc({calculatedNames:e,clusterId:t,deploymentToPerformanceToPlan:n,form:r,isPending:i,regionLocations:a,regionNameToLatencyToRegion:o,selectedDeployment:s,selectedPerformance:c,selectedPlan:l,totalPrice:u,isEnterprise:d}){let{isDirty:f,isValid:p}=Ze(),m=(0,z.useMemo)(()=>Object.keys(n[s]||{}).map(e=>{let t=e.slice(0,-1).split(`(`);if(t.length>1)return{performanceTier:e,name:t[0],description:t[1]};let n=e.split(` for `);return n.length>1?{performanceTier:e,name:n[0],description:`For `+n[1]}:{performanceTier:e,name:e,description:``}}),[n,s]),h=(0,z.useMemo)(()=>Object.keys(n).sort(),[n]);(0,z.useEffect)(function(){m?.length&&!m.find(e=>e.performanceTier===c)&&(r.setValue(`performanceDescription`,m[0].performanceTier),r.trigger())},[s,c,m,r]);let g=s===`Self-Hosted`;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`grid grid-cols-3 gap-6 text-white md:grid-cols-6`,children:[(0,B.jsx)(W,{control:r.control,name:`clusterName`,render:({field:e})=>(0,B.jsxs)(G,{className:`col-span-3 md:col-span-6`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Cluster Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{autoFocus:!0,type:`text`,maxLength:ac.shape.clusterName.maxLength,autoCapitalize:`words`,disabled:!!t,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:r.control,name:`deploymentDescription`,render:({field:e})=>(0,B.jsxs)(G,{className:`col-span-3`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Harper Deployment`}),(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(js,{}),children:(0,B.jsx)(U,{children:(0,B.jsxs)(Ms,{...e,disabled:!!t,onValueChange:t=>{e.onChange(t),r.trigger()},children:[(0,B.jsx)(Fs,{className:`w-full h-auto`,children:(0,B.jsx)(Ps,{placeholder:`Choose Tier`})}),(0,B.jsx)(Is,{children:(0,B.jsx)(Ns,{children:h.map(e=>(0,B.jsxs)($,{value:e,children:[(0,B.jsx)(`dt`,{className:`text-left font-bold text-sm/6`,children:e}),oc[e]&&(0,B.jsx)(`dd`,{className:`font-light`,children:oc[e]})]},e))})})]})})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:r.control,name:`performanceDescription`,render:({field:e})=>(0,B.jsxs)(G,{className:`col-span-3`,children:[(0,B.jsxs)(K,{className:`pb-1`,children:[s.startsWith(`Self`)?`Support`:`Performance`,` & Usage`]}),(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(js,{}),children:(0,B.jsx)(U,{children:(0,B.jsxs)(Ms,{...e,onValueChange:t=>{e.onChange(t),r.trigger()},disabled:!m?.length,children:[(0,B.jsx)(Fs,{className:`w-full h-auto`,children:(0,B.jsx)(Ps,{placeholder:`Choose Tier`})}),(0,B.jsx)(Is,{children:(0,B.jsx)(Ns,{children:m.map(e=>(0,B.jsxs)($,{value:e.performanceTier,children:[(0,B.jsx)(`dt`,{className:`text-left font-bold text-sm/6`,children:e.name}),e.description&&(0,B.jsx)(`dd`,{className:`font-light`,children:e.description})]},e.name))})})]})})}),(0,B.jsx)(q,{})]})}),g?(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(W,{control:r.control,name:`fqdn`,render:({field:e})=>(0,B.jsxs)(G,{className:`md:col-span-6 col-span-3`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Optional Cluster Load Balancer Host Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{...e,type:`text`,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:`example.your-company.com`,disabled:!!t})}),(0,B.jsx)(q,{})]})})}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(W,{control:r.control,name:`abbreviatedName`,render:({field:n})=>(0,B.jsxs)(G,{className:`col-span-3`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Host Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{...n,type:`text`,maxLength:ic.maxLength,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:e.suggestedAbbreviatedName,disabled:!!t})}),(0,B.jsx)(q,{})]})}),(0,B.jsxs)(G,{className:`col-span-3 `,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Full Host Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(`span`,{children:e.fullHostName})}),(0,B.jsx)(q,{})]})]}),g?(0,B.jsx)(nc,{form:r}):(0,B.jsx)($s,{form:r,regionLocations:a,regionNameToLatencyToRegion:o,selectedPlan:l,totalPrice:u,isEnterprise:d})]}),(0,B.jsx)(Z,{className:`mt-3 mb-12`,children:(0,B.jsxs)(R,{type:`submit`,variant:`submit`,className:`rounded-full`,disabled:i||t&&!f||!p,children:[u>0?`Confirm Payment Details`:t?`Edit Cluster`:`Create New Cluster`,(0,B.jsx)(ve,{})]})})]})}function cc(e){let{fqdn:t}=e,{secure:n,port:r}=e;return r||=o,r===443&&n===`false`&&(n=`true`),r===80&&n===`true`&&(n=`false`),`${n===`true`?`https`:`http`}://${t}${r===443||r===80?``:`:`+r}`.toLowerCase()}function lc(e,t,n){let r=e.find(e=>(n?!!e.priceUsd:!e.priceUsd)&&e.deploymentType===`colocated`)||e.find(e=>e.deploymentType===`colocated`)||e[0],i=r?.allowedRegionIds;if(r){let e=i?t.filter(e=>i.includes(e.id)):t,n=e.find(e=>e.region===`US`)||e[0];if(n)return{deploymentDescription:r.deploymentDescription,performanceDescription:r.performanceDescription,regionPlans:[{regionName:n.region,latencyDescription:n.latencyDescription}]}}return null}function uc(e,t,n){if(t&&n){let r=e.getValues();if(!r.deploymentDescription||!r.performanceDescription||!r.regionPlans.length){let i=lc(t,n);i&&(!r.deploymentDescription&&!r.performanceDescription&&(e.setValue(`deploymentDescription`,i.deploymentDescription),e.setValue(`performanceDescription`,i.performanceDescription)),r.regionPlans.length||e.setValue(`regionPlans`,i.regionPlans))}}}function dc({price:e}){return(0,B.jsx)(`span`,{className:`text-4xl`,children:new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).formatToParts(e||0).map((e,t)=>(0,B.jsx)(fc,{type:e.type,value:e.value},t))})}function fc({type:e,value:t}){switch(e){case`currency`:case`decimal`:case`fraction`:return(0,B.jsx)(`sup`,{className:`font-light text-xl`,children:t});default:return t}}function pc({alreadyUsingFree:e,clusterId:t,defaultValues:n,deploymentToPerformanceToPlan:r,organization:i,organizationId:a,planTypes:s,regionLocationsColocated:c,regionLocationsDedicated:l,setSavedClusterState:u,startOffOnBilling:d}){let f=L(),p=kt(),m=i?.type===ss,h=qt(),{mutate:g,isPending:_}=ns(),{mutate:v,isPending:b}=is(),[x,ee]=(0,z.useState)(d),S=(0,z.useMemo)(()=>Qo(c?.sort(Ko(`latencyDescription`))||[],`region`,`latencyDescription`),[c]),te=(0,z.useMemo)(()=>Qo(l?.sort(Ko(`latencyDescription`))||[],`region`,`latencyDescription`),[l]),C=(0,z.useCallback)((t,n)=>{let i=new Set,a=r?.[t.deploymentDescription]?.[t.performanceDescription];if(t.deploymentDescription===`Self-Hosted`)for(let e=0;e<t.instances.length;e++){let r=cc(t.instances[e]);i.has(r)?n.addIssue({code:`custom`,path:[`instances.${e}.fqdn`],message:`Every instance url must be unique!`}):i.add(r)}else{a?.priceUsd===0&&e&&n.addIssue({code:`custom`,path:[`performanceDescription`],message:`Only one free cluster is allowed per organization.`});let r=a?.deploymentDescription===`Dedicated`?te:S;for(let e=0;e<t.regionPlans.length;e++){let o=t.regionPlans[e],s=r[o.regionName]?.[o.latencyDescription];i.has(o.regionName)?n.addIssue({code:`custom`,path:[`regionPlans.${e}.regionName`],message:`You can only select a region once!`}):i.add(o.regionName),a?.allowedRegionIds?.length&&s?.id&&(a.allowedRegionIds.includes(s.id)?e>=1&&n.addIssue({code:`custom`,path:[`regionPlans.${e}.regionName`],message:`You can only select one region with this performance tier!`}):ls(a.allowedRegionIds,s.id)?n.addIssue({code:`custom`,path:[`regionPlans.${e}.latencyDescription`],message:`This latency is not available with the selected performance tier!`}):n.addIssue({code:`custom`,path:[`regionPlans.${e}.regionName`],message:`This region is not available with the selected performance tier!`}))}}},[e,S,te,r]),w=k({mode:`onChange`,resolver:O(ac.superRefine(C)),defaultValues:n}),[T,ne]=(0,z.useState)(!0);(0,z.useEffect)(()=>{T&&n&&(u(null),ne(!1))},[n,T,u]);let E=w.watch(`clusterName`),re=w.watch(`abbreviatedName`),ie=w.watch(`deploymentDescription`),D=w.watch(`performanceDescription`),ae=w.watch(`regionPlans`),oe=w.watch(`instances`),se=ie===`Dedicated`?te:S,ce=ie===`Dedicated`?l:c;(0,z.useEffect)(function(){let e=w.getValues();ie&&(ie===`Self-Hosted`?(e.abbreviatedName&&w.setValue(`abbreviatedName`,``),e.regionPlans.length&&w.setValue(`regionPlans`,[]),e.instances.length||w.setValue(`instances`,[{secure:`true`,fqdn:``,port:o}])):(e.fqdn&&w.setValue(`fqdn`,``),e.instances.length&&w.setValue(`instances`,[]),e.regionPlans.length||uc(w,s,ce)))},[w,s,ce,ie]);let le=(0,z.useMemo)(()=>{let e=cs(us(E),ic.maxLength);return{suggestedAbbreviatedName:e,fullHostName:`${re||e}.${i.subdomain||`your-org`}.harperfabric.com`}},[E,re,i]),ue=(0,z.useMemo)(()=>r?.[ie]?.[D],[r,ie,D]);(0,z.useEffect)(function(){let e=ue?.allowedRegionIds;if(e?.length&&ae?.length===1){let t=ae[0],n=se?.[t.regionName]?.[t.latencyDescription];if(!e.includes(n?.id)){let t=ce?.filter(t=>e.includes(t.id)),n=t?.find(e=>e.region===`US`)||t?.[0];n&&(w.setValue(`regionPlans.0.regionName`,n.region),w.setValue(`regionPlans.0.latencyDescription`,n.latencyDescription),w.trigger())}}},[ue,ae,w,se,ce]),(0,z.useEffect)(function(){if(ie!==`Self-Hosted`&&Object.keys(se).length&&ae.length)for(let e=0;e<ae.length;e++)se[ae[e].regionName]||w.setValue(`regionPlans.${e}.regionName`,``)},[w,se,ie,ae]);let de=ue?.priceUsd?ie===`Self-Hosted`?oe.length*ue.priceUsd:ae.reduce((e,t)=>{let n=se?.[t.regionName]?.[t.latencyDescription];return e+(n?ue.priceUsd*n.instanceCount/2:0)},0):0,fe=(0,z.useCallback)(({creating:e,deploymentDescription:t})=>N.message(e?`Creating Cluster`:`Updating Cluster`,{description:(0,B.jsx)(es,{message:`This may take a little bit, hold tight!`,lateMessage:`Still working on it... why don't you grab a coffee, and I'll let you know when it's done?`,duration:t===`Dedicated`?6e4:5e3}),duration:12e4}),[]),pe=(0,z.useCallback)(async({clusterId:e,sourceClusterId:t,creating:n,toastId:r,isSelfManaged:i})=>{if(t){let e=(await as(a)).clusters?.find(e=>e.id===t);so(e?.status)&&await Ao(t)}h.invalidateQueries({queryKey:[a],refetchType:`active`}),n||h.invalidateQueries({queryKey:[e],refetchType:`active`}),p.invalidate(),f(i?{to:`/${a}/${e}/instances`}:n?{to:`/${a}/${e}/starting-up`}:{to:`/${a}/${e}/scaling`}),w.reset(),N.success(n?`Cluster Created`:`Cluster Updated`,{id:r,description:i?void 0:n?`It is being provisioned now.`:`The updates are being provisioned now.`,duration:5e3})},[h,p,f,a,w]),me=(0,z.useCallback)(async()=>{let e=w.getValues(),n=[],i=r[e.deploymentDescription][e.performanceDescription],o=e.deploymentDescription===`Self-Hosted`;if(o)for(let t of e.instances)n.push({autoRenew:!0,instanceFqdn:t.fqdn,operationsApiPort:t.port||9925,operationsApiSecure:t.secure===`true`,planId:i.id});else for(let t of e.regionPlans){let e=se[t.regionName][t.latencyDescription];n.push({autoRenew:!0,planId:i.id,regionId:e.id})}u(null);let s=fe({creating:!t,deploymentDescription:e.deploymentDescription}),c=()=>N.dismiss(s);t?v({id:t,regionPlans:n},{onSuccess:t=>pe({clusterId:t.id,sourceClusterId:e.sourceClusterId,isSelfManaged:o,creating:!1,toastId:s}),onError:c}):g({abbreviatedName:o?void 0:e.abbreviatedName||le.suggestedAbbreviatedName,autoRenew:!0,fqdn:o&&e.fqdn||void 0,name:e.clusterName,organizationId:a,regionPlans:n},{onSuccess:t=>pe({clusterId:t.id,sourceClusterId:e.sourceClusterId,isSelfManaged:o,creating:!0,toastId:s}),onError:c})},[le.suggestedAbbreviatedName,t,r,w,pe,fe,a,se,u,v,g]),he=(0,z.useCallback)(()=>{if(de>0){ee(!0);return}return me()},[me,de]),ge=(0,z.useCallback)(e=>{u(e?{clusterId:t,...w.getValues(),skipToBilling:!0}:null)},[t,w,u]),_e=(0,z.useCallback)(()=>{ee(!1)},[]),ve=!m&&`mr-37.5`;return(0,B.jsxs)(B.Fragment,{children:[!m&&(0,B.jsxs)(`div`,{className:`absolute top-3 right-4 md:right-12 text-right`,children:[(0,B.jsx)(`dt`,{className:`font-light`,children:`Total Price`}),(0,B.jsx)(`dd`,{className:`font-bold`,children:(0,B.jsx)(dc,{price:de})})]}),(0,B.jsx)(H,{...w,children:x?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h1`,{className:y(`text-lg leading-none text-white font-semibold mb-4`,ve),children:`Cluster Billing`}),(0,B.jsx)(`p`,{className:y(`text-muted-foreground text-sm mb-2`,ve),children:`Please confirm the following billing details:`}),(0,B.jsx)(As,{clusterId:t,isPending:_||b,onGoBackToDetails:_e,onSaveStateForBillingRedirect:ge,onSubmit:me,organizationId:a,selectedPlan:ue})]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h1`,{className:y(`text-lg leading-none text-white font-semibold mb-4`,ve),children:`Cluster Configuration`}),(0,B.jsx)(`p`,{className:y(`text-muted-foreground text-sm mb-6`,ve),children:`Configure your Harper cluster and define deployment plans.`}),(0,B.jsx)(`form`,{id:`cluster-upsert-form`,name:`cluster-upsert-form`,onSubmit:w.handleSubmit(he),children:(0,B.jsx)(sc,{calculatedNames:le,clusterId:t,deploymentToPerformanceToPlan:r,form:w,isPending:_||b,regionLocations:ce,regionNameToLatencyToRegion:se,selectedDeployment:ie,selectedPerformance:D,selectedPlan:ue,totalPrice:de,isEnterprise:m})})]})})]})}function mc(e){return e?.clusterName!==void 0}function hc(){let{organizationId:e,clusterId:t}=P({strict:!1}),{create:n,update:r}=Ci(e),{organization:i,cluster:a}=Mn({strict:!1}),[o,s]=Io(Lo.SavedClusterState,null),{data:c}=F(Uo(e)),{data:l}=F(Go({availableHosts:!0,organizationId:e})),{data:u}=F(Go({organizationId:e})),d=(0,z.useMemo)(()=>{for(let e of i?.clusters??[])if(e.id!==a?.id&&c&&!co(e.status)&&!so(e.status)&&e.plans)for(let t of e.plans){let e=c.find(e=>e.id===t.planId);if(e?.priceUsd===0&&!e.id.startsWith(`self-hosted`))return!0}return!1},[a?.id,i?.clusters,c]),f=(0,z.useMemo)(()=>Qo(c?.sort(Ko(`priceUsd`))||[],`deploymentDescription`,`performanceDescription`),[c]),p=(0,z.useMemo)(()=>{if(!c||!l||!u||t&&!a)return null;let e=a;if(o){if(mc(o))return{...o,clusterName:o.clusterName||``,abbreviatedName:o.abbreviatedName||``,deploymentDescription:o.deploymentDescription||``,performanceDescription:o.performanceDescription||``,fqdn:o.fqdn||``,regionPlans:o.regionPlans||[],instances:o.instances||[]};e=o}let n=c?.find(e=>e.id===a?.plans?.[0].planId),r=[],i=[],s=n?.deploymentDescription===`Dedicated`?u:l,f=lc(c,s,d),p=!1;if(e){if(e.plans){for(let t of e.plans)if(t.regionId){let e=s.find(e=>e.id===t.regionId);e&&r.push({regionName:e.region,latencyDescription:e.latencyDescription})}}if(!r.length&&e.instances){let t=e.instances.filter(e=>e.status&&!ia.includes(e.status)).sort(Yo);for(let e of t)p=!0,i.push({fqdn:e.instanceFqdn,port:e.operationsApiPort,secure:e.operationsApiSecure?`true`:`false`})}}else f&&r.push(...f.regionPlans);return!p&&!r.length&&r.push({regionName:``,latencyDescription:``}),{sourceClusterId:e?.id,autoRenew:e?.plans?.[0]?.autoRenew??!0,clusterName:e?.name??``,abbreviatedName:e?.abbreviatedName??``,deploymentDescription:n?.deploymentDescription??f?.deploymentDescription??``,performanceDescription:n?.performanceDescription??f?.performanceDescription??``,fqdn:p?e?.fqdn??``:``,instances:i,regionPlans:r}},[d,a,t,c,l,u,o]);return!p||!i||!c||!l||!u?(0,B.jsx)(Vo,{children:(0,B.jsx)(Bo,{centered:!0,text:`Loading...`})}):(a?.id?!r:!n)?(0,B.jsx)(Vo,{children:(0,B.jsx)(Kr,{title:`Not Allowed`,error:{message:(0,B.jsxs)(B.Fragment,{children:[`You do not have permission to `,a?.id?`update`:`create`,` clusters in this org.`]})}})}):c.length===0?(0,B.jsx)(Vo,{children:(0,B.jsx)(Kr,{title:`Cluster ${t?`Modification`:`Creation`} Not Currently Allowed`,error:{message:(0,B.jsxs)(B.Fragment,{children:[`There are no available deployment types right now! Please try again later, or `,(0,B.jsx)(zo,{}),`.`]})}})}):(0,B.jsx)(Vo,{children:(0,B.jsx)(pc,{alreadyUsingFree:d,clusterId:t,defaultValues:p,deploymentToPerformanceToPlan:f,organization:i,organizationId:e,planTypes:c,regionLocationsColocated:l,regionLocationsDedicated:u,setSavedClusterState:s,startOffOnBilling:mc(o)&&o.skipToBilling===!0})})}var gc={FAILED:0,UPDATING:1,PROVISIONING:2,RUNNING:3,TERMINATED:4},_c=gc.RUNNING;function vc(e,t){return e.status===t.status?e.name.localeCompare(t.name):(e.status?gc[e.status]??_c:_c)-(t.status?gc[t.status]??_c:_c)}function yc(e,t){let n=t.toLowerCase();return t=>{for(let r of e){let e=t[r];if(e!=null)if(typeof e==`string`){if(e.toLowerCase().includes(n))return!0}else if(typeof e==`boolean`){if(e&&(n===`yes`||n===`true`||n===`1`)||!e&&(n===`no`||n===`false`||n===`0`))return!0}else throw Error(`curryFilterByFuzzySearch has not implemented support for `+typeof e+` fields yet!`)}return!1}}function bc(){let{organizationId:e}=P({strict:!1}),{create:t}=Ci(e),{data:n,isSuccess:r}=We(os(e)),[i]=Io(Lo.SavedClusterState,null),[a,o]=(0,z.useState)(``),s=(0,z.useCallback)(()=>o(``),[]),c=(0,z.useCallback)(e=>{o(e.currentTarget.value?.toLowerCase()||``)},[]),l=(0,z.useMemo)(()=>n?.clusters?.slice().filter(e=>!co(e.status)).sort(vc)||[],[n?.clusters]),u=(0,z.useMemo)(()=>l.filter(yc([`id`,`name`],a))||[],[a,l]);return n&&l.length===0&&t?(0,B.jsx)(hc,{}):i?(0,B.jsx)(_t,{to:`/${e}/new-cluster`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{children:r?(0,B.jsxs)(`div`,{className:`flex w-full justify-end gap-2`,children:[(0,B.jsx)(J,{placeholder:`Filter by name`,className:`inline-block w-full text-xs`,value:a,onChange:c}),t&&(0,B.jsx)(M,{to:`new-cluster`,children:(0,B.jsxs)(R,{variant:`positive`,accessKey:`n`,children:[(0,B.jsx)(pr,{}),` `,(0,B.jsxs)(`span`,{className:`hidden sm:inline-block`,children:[(0,B.jsx)(`u`,{children:`N`}),`ew `,(0,B.jsx)(`span`,{className:`hidden md:inline-block`,children:`Cluster`})]})]})})]}):null}),(0,B.jsx)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-12 mb-4`,children:[u.map(e=>(0,B.jsx)(`div`,{className:`col-span-1 md:col-span-4 lg:col-span-3 2xl:col-span-2`,children:(0,B.jsx)(Ro,{cluster:e})},e.id)),!u.length&&(0,B.jsxs)(`div`,{className:`col-span-1 md:col-span-12 text-center`,children:[(0,B.jsx)(`h2`,{className:`my-4 text-xl`,children:`No matches found.`}),(0,B.jsx)(R,{variant:`outline`,onClick:s,children:`Clear Filters`})]})]})})]})}function xc(){let e=URL.parse(location.href);return e?.hash?e.hash.startsWith(`#/`)?e.hash.slice(1):e.hash:`/`}function Sc(){return`/#`+xc()}function Cc(){let{organizationId:e}=P({strict:!1}),t=L(),n=new URLSearchParams(window.location.search).get(`setup_intent_client_secret`),{setup_intent_client_secret:r}=me({strict:!1}),[i]=Io(Lo.SavedClusterState,null),a=n||r,o=vn(),s=ps(e),c=(0,z.useCallback)(()=>{let e=i?i.clusterId?`../../${i.clusterId}/edit`:`../../new-cluster`:`../`;window.history.replaceState(null,``,Sc()),t({search:void 0,to:e})},[t,i]);return(0,z.useEffect)(()=>{!o||!a||!s||!e||!c||(async function(){try{let{setupIntent:e}=await o.retrieveSetupIntent(a);switch(e?.status){case`succeeded`:e.payment_method===null?(N.error(`Failed to process payment method details. Please try another payment method.`),c()):s(e.payment_method,c);break;case`processing`:N.warning(`Processing payment method. Please check back later.`),c();break;case`requires_payment_method`:N.error(`Failed to process payment method details. Please try another payment method.`),c();break;default:N.error(`Failed to process payment method details. Please try another payment method.`),c();break}}catch(e){console.error(e),N.error(`Failed to process payment method details. Please try another payment method.`),c()}})()},[a,c,e,s,o]),(0,B.jsx)(Bo,{centered:!0})}function wc(){return(0,B.jsx)(Ss,{children:(0,B.jsx)(Cc,{})})}function Tc({clusterId:e,instanceId:t,organizationId:n},r){return`/`+[n,e,t&&`instance`,t,r].filter(Zr).join(`/`)}var Ec=`flex items-center p-2 rounded-lg group`,Dc={className:`text-white hover:bg-gray-700`},Oc={className:`text-black bg-white pointer-events-none cursor-default`};function kc(){let{organizationId:e}=P({strict:!1}),{update:t}=xi(e);return t?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsxs)(`div`,{className:`md:grid gap-4 md:grid-cols-12 min-h-[calc(100vh-theme(spacing.36))] mb-12`,children:[(0,B.jsxs)(`section`,{className:`col-span-1 text-white md:col-span-4 lg:col-span-3 md:border-r-1 border-b md:border-b-0 md:pr-4 border-gray-700`,children:[(0,B.jsx)(Ac,{}),(0,B.jsx)(jc,{})]}),(0,B.jsx)(`section`,{className:`col-span-1 text-white md:col-span-8 lg:col-span-9`,children:(0,B.jsx)($e,{})})]})})]}):(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:`You don't have access to manage payments for this organization. Please contact your administrator.`})}function Ac(){let e=P({strict:!1});return(0,B.jsxs)(`div`,{className:`hidden md:block`,children:[(0,B.jsxs)(`span`,{className:Ec,children:[(0,B.jsx)(xn,{className:`inline-block`}),(0,B.jsx)(`h3`,{className:`ms-3 text-2xl font-extrabold dark:text-white`,children:`Billing`})]}),(0,B.jsxs)(`ul`,{className:`border-t border-gray-700 pt-4 mt-4 space-y-2`,children:[(0,B.jsx)(`li`,{children:(0,B.jsxs)(M,{to:Tc(e,`billing`),className:Ec,activeOptions:{exact:!0},inactiveProps:Dc,activeProps:Oc,children:[(0,B.jsx)(or,{className:`inline-block`}),` `,(0,B.jsx)(`span`,{className:`ms-3`,children:`Payment Method`})]})}),(0,B.jsx)(`li`,{children:(0,B.jsxs)(M,{to:Tc(e,`billing/invoices`),className:Ec,inactiveProps:Dc,activeProps:Oc,children:[(0,B.jsx)($t,{className:`inline-block`}),(0,B.jsx)(`span`,{className:`ms-3`,children:`Invoices & Payments`})]})})]})]})}function jc(){let e=P({strict:!1});return(0,B.jsxs)(`ul`,{className:`flex space-x-4 md:hidden py-2`,children:[(0,B.jsx)(`li`,{children:(0,B.jsxs)(M,{to:Tc(e,`billing`),className:Ec,activeOptions:{exact:!0},inactiveProps:Dc,activeProps:Oc,children:[(0,B.jsx)(or,{className:`inline-block`}),` `,(0,B.jsx)(`span`,{className:`ms-3`,children:`Payment Method`})]})}),(0,B.jsx)(`li`,{children:(0,B.jsxs)(M,{to:Tc(e,`billing/invoices`),className:Ec,inactiveProps:Dc,activeProps:Oc,children:[(0,B.jsx)($t,{className:`inline-block`}),` `,(0,B.jsx)(`span`,{className:`ms-3`,children:`Invoices & Payments`})]})})]})}function Mc({className:e,containerClassName:t,...n}){return(0,B.jsx)(`div`,{"data-slot":`table-container`,className:g(`relative w-full overflow-x-auto`,t),children:(0,B.jsx)(`table`,{"data-slot":`table`,className:g(`w-full caption-bottom text-sm`,e),...n})})}function Nc({className:e,...t}){return(0,B.jsx)(`thead`,{"data-slot":`table-header`,className:g(`[&_tr]:border-b`,e),...t})}function Pc({className:e,...t}){return(0,B.jsx)(`tbody`,{"data-slot":`table-body`,className:g(`[&_tr:last-child]:border-0`,e),...t})}function Fc({className:e,...t}){return(0,B.jsx)(`tr`,{"data-slot":`table-row`,className:g(`border-b border-grey-700 transition-colors`,e),...t})}function Ic({className:e,...t}){return(0,B.jsx)(`th`,{"data-slot":`table-head`,className:g(`h-10 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function Lc({header:e,onColumnClick:t,...n}){let r=(0,z.useCallback)(()=>{e.column.toggleSorting(e.column.getIsSorted()===`asc`);let n=e.column.getIsSorted()===!1||e.column.getIsSorted()!==`asc`;t?.(e.column.columnDef.accessorKey,n)},[e,t]),i=e.column.columnDef.enableSorting,a=e.column.columnDef.enableResizing,o=e.isPlaceholder?null:Mt(e.column.columnDef.header,e.getContext()),s=(0,z.useCallback)(()=>{e.column.resetSize()},[e]);return(0,B.jsx)(Ic,{...n,style:{width:`${e.getSize()}px`},className:i?`px-0`:`px-2`,children:(0,B.jsxs)(`div`,{className:`flex items-center justify-between`,children:[i?(0,B.jsxs)(R,{type:`button`,variant:`ghost`,className:g(`rounded-none`,!e.column.getIsSorted()||e.column.getIsSorted()===`asc`?`cursor-n-resize`:`cursor-s-resize`),onClick:r,children:[o,e.column.getIsSorted()===`asc`?(0,B.jsx)(vr,{}):e.column.getIsSorted()===`desc`?(0,B.jsx)(Tt,{}):(0,B.jsx)(xt,{className:`text-gray-600`})]}):o,a&&(0,B.jsx)(R,{type:`button`,variant:`ghost`,className:`cursor-col-resize`,onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),onDoubleClick:s,style:{transform:e.column.getIsResizing()?`translateX(${e.getContext().table.getState().columnSizingInfo.deltaOffset}px)`:``},children:(0,B.jsx)(He,{})})]})})}function Rc({className:e,...t}){return(0,B.jsx)(`td`,{"data-slot":`table-cell`,className:g(`align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function zc({columns:e,data:t,isFetching:n,onRowClick:r,onColumnClick:i,sortingState:a,children:o}){let s=zt({data:t,columns:e,getCoreRowModel:Xe(),getSortedRowModel:qe(),initialState:{sorting:a}});return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:`flex items-center justify-end space-x-2 pb-4`,children:[(0,B.jsx)(`div`,{className:`grow lg:hidden`}),o,(0,B.jsx)(`div`,{className:`grow hidden lg:visible`})]}),(0,B.jsxs)(Mc,{containerClassName:`rounded-md bg-black-dark`,children:[(0,B.jsx)(Nc,{children:s.getHeaderGroups().map(e=>(0,B.jsx)(Fc,{className:`border-none`,children:e.headers.map(e=>(0,B.jsx)(Lc,{header:e,onColumnClick:i},e.id))},e.id))}),(0,B.jsx)(Pc,{className:`bg-black border border-grey-700`,children:s.getRowModel().rows?.length?s.getRowModel().rows.map(e=>(0,B.jsx)(Fc,{"data-state":e.getIsSelected()&&`selected`,onClick:()=>r?.(e),className:g(`hover:bg-muted/10 data-[state=selected]:bg-muted`,r&&`cursor-pointer`),children:e.getVisibleCells().map(e=>(0,B.jsx)(Rc,{className:`py-2 px-2 overflow-x-hidden max-w-32 text-ellipsis whitespace-nowrap`,style:{width:`${e.column.getSize()}px`},children:Mt(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,B.jsx)(Fc,{children:(0,B.jsx)(Rc,{colSpan:e.length,className:`h-24 text-center`,children:n?(0,B.jsx)(`div`,{children:(0,B.jsx)(Bo,{className:`p-12`})}):(0,B.jsx)(`span`,{children:`No results.`})})})})]})]})}function Bc(e){switch(e){case`paid`:return`success`;case`void`:case`uncollectible`:return`destructive`;default:return`default`}}function Vc(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e)}function Hc(e,t){if(e<45)return`a few seconds ago`;if(e<120)return`a minute ago`;let n=Math.floor(e/60);if(n<60)return`${n} minutes ago`;if(n<120)return`an hour ago`;let r=Math.floor(e/3600);return r>48?new Date(t).toLocaleString():`${r} hours ago`}var Uc=[{header:`Invoice Id`,accessorKey:`id`,enableSorting:!1},{header:`Status`,accessorKey:`status`,enableSorting:!1,cell:({cell:e})=>(0,B.jsx)(vo,{variant:Bc(e.getValue()),children:e.getValue()})},{header:`Date`,accessorKey:`periodStart`,enableSorting:!1,cell:({cell:e})=>{let t=e.row.original.periodStart*1e3,n=e.row.original.periodEnd*1e3,r=(Date.now()-t)/1e3,i=(Date.now()-n)/1e3;return Math.abs(r-i)<1e3?Hc(r,t):[t?Hc(r,t):`-`,n?Hc(i,n):`-`].join(` to `)}},{header:`Amount Due`,accessorKey:`amountDue`,enableSorting:!1,cell:({cell:e})=>Vc(e.getValue()?e.getValue()/100:0)},{header:`Amount Paid`,accessorKey:`amountPaid`,enableSorting:!1,cell:({cell:e})=>Vc(e.getValue()?e.getValue()/100:0)},{header:`Lines`,accessorKey:`lines`,enableSorting:!1,cell:({cell:e})=>{let t=e.getValue(),n=[];for(let e of t)n.push(`${e.quantity}x ${e.description} @ ${Vc(e.amount/100)}`);return n.join(`
|
|
11
|
-
`)}}];function Wc(e){return(0,z.useCallback)(async()=>{N.loading(`Refreshing...`,{id:`refreshing`});let t=Date.now();await e(),Date.now()-t<500&&await a(500),N.success(`Refreshed!`,{id:`refreshing`})},[e])}async function Gc(e){let{data:t}=await u.get(`/Invoice/${e}`);return t}function Kc(e,t){return I({queryKey:[e,`invoices`],queryFn:()=>Gc(e),retry:!1,enabled:!!e,refetchInterval:t?1e4:void 0})}function qc(){let{organizationId:e}=P({strict:!1}),{data:t}=F(os(e)),{data:n,refetch:r,isLoading:i,isFetching:a,isRefetching:o}=F(Kc(t?.type!==`ENTERPRISE`&&t?.id,!1)),s=Wc(r);return t?.type===`ENTERPRISE`?(0,B.jsxs)(`span`,{children:[`You are part of an enterprise organization! We don’t currently show your invoices on this page. Want to explore your solution with Harper more? `,(0,B.jsx)(zo,{}),`, we would love to talk!`]}):i?(0,B.jsx)(Bo,{centered:!0}):!n||!n.length?(0,B.jsxs)(`span`,{children:[`Your invoices will be shown here once one is available! Want to explore your solution with Harper more?`,` `,(0,B.jsx)(zo,{overEmail:!0}),`, we would love to talk!`]}):(0,B.jsx)(zc,{data:n,columns:Uc,children:(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:s,accessKey:`r`,disabled:a||o,children:[(0,B.jsx)(wn,{}),(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]})})}function Jc(e){let t=A({getParentRoute:()=>e,path:`billing`,component:kc}),n=A({getParentRoute:()=>t,path:`/`,component:Os}),r=A({getParentRoute:()=>t,path:`invoices`,component:qc}),i=A({getParentRoute:()=>t,path:`confirm`,component:wc});return t.addChildren([n,r,i])}async function Yc(e){let{data:t}=await u.get(`/OrganizationRole/${e}`);return t}function Xc(e){return I({queryKey:[e,`roles`],queryFn:()=>Yc(e),retry:!1,refetchInterval:10*1e3})}var Zc=[{header:`Role Name`,accessorKey:`roleName`,enableSorting:!1},Ie().display({header:`Users Assigned`,enableSorting:!1,id:`userIds`,cell:e=>!e.row.original.userIds||e.row.original.userIds.length===0?`No users assigned`:e.row.original.userIds.length})];async function Qc(e){let{data:t}=await u.post(`/Role/`,e);return t}function $c(){return j({mutationFn:Qc})}var el=D({name:C().nonempty({error:`Please enter a role name.`}).regex(/^[a-zA-Z_]*$/,{error:`Role must contain only letters and underscores.`}).max(30,{error:`Role name cannot be longer than 30 characters.`}),update:E(),delete:E()});D({roles:D({create:E(),delete:E(),update:E(),view:E()}),clusters:D({create:E(),delete:E(),update:E(),view:E(),resources:w(D({id:C(),delete:E(),update:E(),view:E(),instances:D({create:E(),delete:E(),update:E(),view:E()})}))})});var tl={roles:{create:!0,view:!0,update:!0,delete:!0},clusters:{create:!0,view:!0,update:!0,delete:!0,resources:[]}};function nl({isModalOpen:e,setIsModalOpen:t}){let n=qt(),{organizationId:r}=P({strict:!1}),[i,a]=(0,z.useState)(!0),[o,s]=(0,z.useState)(JSON.stringify(tl,null,2)),{mutate:c,isPending:l}=$c(),u=k({resolver:O(el),defaultValues:{name:``,update:!1,delete:!1}}),d=(0,z.useCallback)(e=>{a(e.length===0)},[a]),f=(0,z.useCallback)(async e=>{let a=No(o);if(!a)return;let s={...e,...a,organizationId:r};e&&i&&c(s,{onSuccess:()=>{N.success(`Organization role added successfully!`),t(!1),n.invalidateQueries({queryKey:[r,`roles`],refetchType:`active`}),u.reset()},onError:e=>{N.error(`Failed to add organization role: ${e.message}`)}})},[i,o,c,u,n,t,r]);return(0,B.jsx)(Y,{onOpenChange:t,open:e,children:(0,B.jsxs)(X,{children:[(0,B.jsx)(Q,{children:`Add New Organization Role`}),(0,B.jsx)(go,{children:`Set the new organization role permissions.`}),(0,B.jsx)(H,{...u,children:(0,B.jsxs)(`form`,{id:`org-add-role-form`,name:`org-add-role-form`,className:`grid grid-cols-2 gap-4 my-4`,onSubmit:u.handleSubmit(f),children:[(0,B.jsx)(W,{control:u.control,name:`name`,render:({field:e})=>(0,B.jsxs)(G,{className:`col-span-2`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Role Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,className:``,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:u.control,name:`update`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Update Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:u.control,name:`delete`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Delete Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(`div`,{className:`col-span-2`,children:(0,B.jsx)(Be,{theme:`vs-dark`,height:`300px`,defaultLanguage:`json`,onValidate:d,onChange:e=>{e&&s(e)},defaultValue:JSON.stringify(tl,null,2)})}),(0,B.jsx)(Z,{className:`col-span-2`,children:(0,B.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,B.jsx)(R,{variant:`destructiveOutline`,className:`rounded-full`,type:`button`,onClick:()=>t(!1),disabled:l,children:`Cancel`}),(0,B.jsx)(R,{variant:`submit`,className:`rounded-full`,disabled:l||!i||!u.formState.isValid,children:`Save Changes`})]})})]})})]})})}async function rl({roleId:e}){let{data:t}=await u.delete(`/Role/${e}`,{id:e,deleted:!0});return t}function il(){return j({mutationFn:({roleId:e})=>rl({roleId:e})})}async function al({roleId:e,updatedRoleInfo:t}){let{data:n}=await u.put(`/Role/${e}`,t);return n}function ol(){return j({mutationFn:({roleId:e,updatedRoleInfo:t})=>al({roleId:e,updatedRoleInfo:t})})}function sl({organizationId:e,roleId:t}){return I({queryKey:[e,`roles`,t],queryFn:()=>cl(t),refetchInterval:10*1e3})}async function cl(e){let{data:t}=await u.get(`/Role/${e}`);return t}function ll({onRoleDeleteClick:e,setIsConfirmingRoleDeletion:t,isRoleDeletionPending:n}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Q,{children:`Confirm Role Deletion`}),(0,B.jsx)(go,{children:`Are you sure you want to delete this role? This action cannot be undone.`}),(0,B.jsxs)(Z,{children:[(0,B.jsx)(R,{type:`button`,variant:`defaultOutline`,className:`rounded-full`,onClick:()=>t(!1),children:`Cancel`}),(0,B.jsx)(R,{variant:`destructiveOutline`,className:`rounded-full`,onClick:e,disabled:n,children:n?`Deleting...`:`Delete Role`})]})]})}function ul({data:e,isModalOpen:t,closeModal:n}){let r=qt(),{data:i}=We(sl({roleId:e.id,organizationId:e.organizationId})),a=Pr(),o=a.user&&a.user?.roles?.[e.organizationId]?.role===e.roleName,{update:s,remove:c}=Si(e.organizationId),{mutate:l,isPending:u}=ol(),{mutate:d,isPending:f}=il(),[p,m]=(0,z.useState)(!1),h=k({resolver:O(el),defaultValues:{name:e.roleName,update:i.organization.update||!1,delete:i.organization.delete||!1}}),g=(0,z.useCallback)(()=>{d({roleId:e.id},{onSuccess:()=>{N.success(`Role deleted successfully!`),n(!0),h.reset()},onError:e=>{N.error(`Error`,{description:`Failed to delete role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}})}})},[e.id,d,h,n]),[_,v]=(0,z.useState)(!0),[y,b]=(0,z.useState)(JSON.stringify({roles:{...i.organization.roles},clusters:{...i.organization.clusters}},null,2)),x=(0,z.useCallback)(e=>{v(e.length===0)},[v]),ee=(0,z.useCallback)(async t=>{if(!s)return;let i=No(y);if(!i)return;let a={...t,...i,organizationId:e.organizationId};y&&_&&l({roleId:e.id,updatedRoleInfo:a},{onSuccess:async()=>{N.success(`Role updated successfully!`),await r.invalidateQueries({queryKey:[e.organizationId,`roles`,e.id]}),n(!1),h.reset()},onError:e=>{N.error(`Error`,{description:`Failed to update role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}})}})},[n,e.id,e.organizationId,h,_,r,i,s,y,l]);return(0,B.jsx)(Y,{onOpenChange:(0,z.useCallback)(()=>n(!1),[n]),open:t,children:(0,B.jsx)(X,{children:p?(0,B.jsx)(ll,{onRoleDeleteClick:g,setIsConfirmingRoleDeletion:m,isRoleDeletionPending:f}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Q,{children:[o||!s?`View`:`Edit`,` Organization Role "`,e.roleName,`"`]}),(0,B.jsx)(H,{...h,children:(0,B.jsxs)(`form`,{id:`org-edit-role-form`,name:`org-edit-role-form`,className:`grid grid-cols-2 gap-4 my-4`,onSubmit:h.handleSubmit(ee),children:[(0,B.jsx)(W,{control:h.control,name:`name`,render:({field:e})=>(0,B.jsxs)(G,{className:`col-span-2`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Role Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,className:``,...e,disabled:!0,readOnly:!0})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:h.control,name:`update`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Update Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,disabled:o||!s,readOnly:o||!s,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:h.control,name:`delete`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Delete Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,disabled:o||!s,readOnly:o||!s,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(`div`,{className:`col-span-2`,children:(0,B.jsx)(Be,{theme:`vs-dark`,height:`300px`,defaultLanguage:`json`,onValidate:x,onChange:e=>{e&&b(e)},options:o||!s?{readOnly:!0}:void 0,defaultValue:y})}),!o&&(c||s)&&(0,B.jsx)(Z,{className:`col-span-2`,children:(0,B.jsxs)(`div`,{className:`flex justify-between w-full`,children:[c&&(0,B.jsx)(R,{type:`button`,variant:`destructiveOutline`,className:`rounded-full`,onClick:()=>m(!0),disabled:u,children:`Delete Role`}),s&&(0,B.jsx)(R,{variant:`submit`,className:`rounded-full`,disabled:!_||u||!h.formState.isValid||!h.formState.isDirty,children:`Save Changes`})]})})]})})]})})})}function dl(){let e=L(),t=qt(),{organizationId:n,orgRoleId:r}=P({strict:!1}),{create:i}=Si(n),{data:a,refetch:o,isFetching:s,isRefetching:c}=We(Xc(n)),l=(0,z.useMemo)(()=>a&&a?.find(e=>e.id===r),[a,r]),u=!!r&&!!l,[d,f]=(0,z.useState)(!1),p=(0,z.useCallback)(async(i,a)=>{await e({to:[r?`..`:``,i].filter(Boolean).join(`/`)}),a&&await t.invalidateQueries({queryKey:[n,`roles`],refetchType:`active`})},[r,e,t]),m=(0,z.useCallback)(()=>{f(!0)},[f]),h=(0,z.useCallback)(e=>p(e.original.id,!1),[p]),g=(0,z.useCallback)(e=>p(void 0,e),[p]),_=Wc(o);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,B.jsxs)(z.Suspense,{fallback:(0,B.jsx)(Bo,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,B.jsxs)(zc,{data:a,columns:Zc,onRowClick:h,children:[(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:_,accessKey:`r`,disabled:s||c,children:[(0,B.jsx)(wn,{}),(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]}),i&&(0,B.jsxs)(R,{variant:`positiveOutline`,onClick:m,accessKey:`a`,disabled:d,children:[(0,B.jsx)(pr,{}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`u`,{children:`A`}),`dd`]})]})]}),i&&(0,B.jsx)(nl,{isModalOpen:d,setIsModalOpen:f}),u&&(0,B.jsx)(ul,{data:l,isModalOpen:u,closeModal:g})]})})]})}var fl=[{header:`User Id`,accessorKey:`id`,enableSorting:!1},{header:`Email`,accessorKey:`email`,enableSorting:!1},{header:`First Name`,accessorKey:`firstname`,enableSorting:!1},{header:`Last Name`,accessorKey:`lastname`,enableSorting:!1},Ie().display({header:`Roles`,enableSorting:!1,id:`roles`,cell:e=>e.row.original.roles?.map(e=>e.roleName)?.sort()?.join(`, `)}),{header:`Status`,accessorKey:`status`,enableSorting:!1},{header:`Verified`,accessorKey:`isVerified`,enableSorting:!1}],pl=T.object({email:da.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:T.string().nonempty({error:`Please select a role.`})});async function ml(e){let{data:t}=await u.post(`/OrganizationRole/`,e);return t}function hl(){return j({mutationFn:e=>ml(e)})}T.object({email:da.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:T.string().nonempty({error:`Please select a role.`})});async function gl(e){let{data:t}=await u.post(`/UserInvite/`,e);return t}function _l(){return j({mutationFn:e=>gl(e)})}function vl({isModalOpen:e,onChangesSaved:t,setIsModalOpen:n}){let{organizationId:r}=P({strict:!1}),{data:i}=We(Xc(r)),[a,o]=(0,z.useState)(!1),s=k({resolver:O(pl),defaultValues:{email:``,roleId:``}}),{mutate:c,isPending:l}=hl(),{mutate:u,isPending:d}=_l(),f=(0,z.useCallback)(async e=>{e&&(a?u:c)(e,{onSuccess:()=>{let r=e.roleId;s.reset(),s.setValue(`roleId`,r),t(),N.success(`User invited successfully!`),n(!1),o(!1)},onError:e=>{e?.status===404&&o(!0)}})},[c,s,u,t,n,a]);return(0,B.jsx)(Y,{onOpenChange:()=>{n(!1),o(!1),s.reset()},open:e,children:(0,B.jsx)(X,{"aria-describedby":void 0,children:(0,B.jsx)(H,{...s,children:(0,B.jsxs)(`form`,{id:`org-add-user-form`,name:`org-add-user-form`,onSubmit:s.handleSubmit(f),className:`grid gap-4 my-4`,children:[(0,B.jsx)(ho,{children:(0,B.jsx)(Q,{children:a?`Invite User`:`Add User`})}),(0,B.jsx)(W,{control:s.control,name:`email`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Email`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`email`,enterKeyHint:`next`,autoComplete:`email`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:s.control,name:`roleId`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Roles`}),(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(js,{}),children:(0,B.jsx)(U,{children:(0,B.jsxs)(Ms,{...e,onValueChange:t=>e.onChange(t),children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Choose Role`})}),(0,B.jsx)(Is,{children:(0,B.jsxs)(Ns,{children:[(0,B.jsx)(Ls,{children:`Role`}),i?.map(e=>(0,B.jsx)($,{value:e.id,children:e.roleName},e.id))]})})]})})}),(0,B.jsx)(q,{})]})}),a&&(0,B.jsxs)(go,{className:`p-3 my-5 text-white rounded-md bg-amber-600 flex`,children:[(0,B.jsx)(Oe,{className:`inline-block size-12 pr-2`}),(0,B.jsx)(`span`,{children:`This person doesn’t have a Fabric account. Do you want to invite them?`})]}),(0,B.jsx)(Z,{children:(0,B.jsx)(`div`,{className:`flex justify-between w-full`,children:(0,B.jsxs)(R,{type:`submit`,variant:`submit`,className:`rounded-full`,disabled:l||d,children:[(0,B.jsx)(yn,{}),` `,a?`Invite User`:`Add User`]})})})]})})})})}async function yl({roleId:e,userId:t}){let{data:n}=await u.delete(`/OrganizationRole/role/${e}/user/${t}`);return n}function bl(){return j({mutationFn:({roleId:e,userId:t})=>yl({roleId:e,userId:t})})}function xl(e){let[t,n]=(0,z.useState)(e||!1);return[t,(0,z.useCallback)(e=>{n(typeof e==`boolean`?e:e.target.checked)},[])]}function Sl({data:e,readOnly:t,canRemove:n,orgRole:r,selectedRoles:i,setChangesMade:a}){let{mutate:o,isPending:s}=hl(),{mutate:c,isPending:l}=bl(),u=!!i[r.roleName],[d,f]=(0,z.useState)(u),[p,m]=xl(u);return(0,z.useEffect)(()=>{p!==d&&(p?o({email:e.email,roleId:r.id},{onSuccess:()=>{f(p),a(!0),N.success(`Role added successfully`)}}):c({userId:e.id,roleId:r.id},{onSuccess:()=>{f(p),a(!0),N.success(`Role removed successfully`)}}))},[o,e.email,e.id,p,r.id,c,a,d]),(0,B.jsxs)(na,{className:`flex`,children:[(0,B.jsx)(J,{type:`checkbox`,className:`w-6`,disabled:t||s||l||!n&&p,checked:p,onChange:m}),(0,B.jsx)(`span`,{className:`pl-4 pr-8 flex-1 py-2.5`,children:r.roleName})]},r.id)}function Cl({closeModal:e,data:t,isModalOpen:n,onUserUpdated:r}){let{organizationId:i}=P({strict:!1}),a=Pr(),{update:o,remove:s}=Si(i),c=a.user?.email===t.email,{data:l}=We(Xc(i)),u=(0,z.useMemo)(()=>t.roles?Zo(t.roles,`roleName`):{},[t]),[d,f]=(0,z.useState)(!1);return(0,B.jsx)(Y,{onOpenChange:d?r:e,open:n,children:(0,B.jsxs)(X,{className:`sm:max-w-[750px]`,children:[(0,B.jsx)(ho,{children:(0,B.jsxs)(Q,{children:[o?`Edit `:`View `,` `,t.email,` `,c?`(yourself)`:``]})}),o&&(0,B.jsxs)(go,{children:[`To remove `,c?`your self`:`this user`,` from the organization, uncheck all of the boxes below.`]}),l.map(e=>(0,B.jsx)(Sl,{readOnly:!o,canRemove:s,data:t,orgRole:e,selectedRoles:u,setChangesMade:f},e.id))]})})}function wl(e,t){return e.email>t.email?1:-1}function Tl(){let e=L(),{organizationId:t,orgUserId:n}=P({strict:!1}),{update:r}=Si(t),{data:i,refetch:a,isFetching:o,isRefetching:s}=We(Xc(t)),c=(0,z.useMemo)(()=>{let e={};for(let t of i)if(t.users)for(let n of t.users)e[n.id]||(e[n.id]={...n,roles:[]}),e[n.id].roles.push(t);return Object.values(e).sort(wl)},[i]),l=(0,z.useMemo)(()=>c?.find(e=>e.id===n),[c,n]),u=(0,z.useCallback)(t=>{e({to:[n?`..`:``,t].filter(Boolean).join(`/`)})},[n,e]),d=!!n&&!!l,[f,p]=(0,z.useState)(!1),[m]=(0,z.useState)({attribute:`email`,descending:!1}),h=(0,z.useMemo)(()=>[{desc:m.descending,id:m.attribute}],[m]),g=(0,z.useCallback)(()=>{p(!0)},[p]),_=(0,z.useCallback)(()=>{a(),p(!1)},[a,p]),v=(0,z.useCallback)(e=>{u(e.original.id)},[u]),y=(0,z.useCallback)(()=>{u(void 0)},[u]),b=(0,z.useCallback)(()=>{a(),u(void 0)},[u,a]),x=Wc(a);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsxs)(z.Suspense,{fallback:(0,B.jsx)(Bo,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,B.jsxs)(zc,{data:c,isFetching:o||s,columns:fl,onRowClick:v,sortingState:h,children:[(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:x,accessKey:`r`,disabled:o||s,children:[(0,B.jsx)(wn,{}),` `,(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]}),r&&(0,B.jsxs)(R,{variant:`positiveOutline`,onClick:g,accessKey:`a`,disabled:f,children:[(0,B.jsx)(pr,{}),` `,(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`u`,{children:`A`}),`dd`]})]})]}),r&&(0,B.jsx)(vl,{isModalOpen:f,onChangesSaved:_,setIsModalOpen:p}),d&&(0,B.jsx)(Cl,{closeModal:y,data:l,isModalOpen:d,onUserUpdated:b})]})})]})}function El({organizationRole:e,onDeleteOrgModal:t}){let{organizationId:n,organizationName:r,roleName:i}=e,{remove:a,update:o}=xi(n),s=o,{view:c}=Si(n),l=(0,z.useCallback)(()=>{t(e)},[t,e]);return(0,B.jsxs)(zr,{className:`relative h-full justify-between`,children:[(0,B.jsxs)(Br,{children:[(0,B.jsxs)(Hr,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:n}),a&&(0,B.jsxs)(yo,{children:[(0,B.jsx)(bo,{className:`p-4 -m-4 -mr-6 hover:text-white`,children:(0,B.jsx)(ht,{"aria-label":`Options`})}),(0,B.jsxs)(xo,{children:[(0,B.jsx)(wo,{className:`text-gray-600 text-xs`,children:`Options`}),(0,B.jsx)(To,{}),(0,B.jsx)(M,{to:`${n}`,children:(0,B.jsx)(So,{children:`Clusters`})}),c&&(0,B.jsx)(M,{to:`${n}/roles`,children:(0,B.jsx)(So,{children:`Roles`})}),c&&(0,B.jsx)(M,{to:`${n}/users`,children:(0,B.jsx)(So,{children:`Users`})}),s&&(0,B.jsx)(M,{to:`${n}/billing`,children:(0,B.jsx)(So,{children:`Billing`})}),(0,B.jsx)(To,{}),a&&(0,B.jsx)(So,{className:`focus:bg-red/70 focus:text-white`,onClick:l,children:`Delete`})]})]})]}),(0,B.jsx)(Vr,{children:(0,B.jsx)(`h2`,{children:r})})]}),(0,B.jsxs)(Ur,{className:`flex justify-between`,children:[(0,B.jsx)(vo,{children:Xi(i)}),(0,B.jsx)(M,{to:n,className:`text-sm`,"aria-label":`View ${r}`,title:`View ${r}`,children:(0,B.jsxs)(`span`,{className:`py-2 transition-all duration-100 ease-in-out border-0 hover:border-b-2`,children:[`View `,(0,B.jsx)(ve,{className:`inline-block`})]})})]})]})}async function Dl(e){let{data:t}=await u.delete(`/Organization/${e}`);return t}function Ol(){return j({mutationFn:e=>Dl(e)})}async function kl(e){let{data:t}=await u.post(`/Organization/`,{...e});return t}function Al(){return j({mutationFn:e=>kl(e)})}var jl=C().max(62,{error:`Must be at most 62 characters long.`}).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,{error:`Please only use lowercase letters, digits and dashes (-) in the subdomain. Must not start or end with a dash.`}),Ml=D({name:C().max(255,{error:`Name cannot be longer than 255 characters.`}),subdomain:ae([S(``),te(),jl])});function Nl(){let{user:e}=Pr(),t=L(),n=k({resolver:O(Ml),defaultValues:{name:``,subdomain:``}}),{setFocus:i,watch:a}=n;(0,z.useEffect)(()=>{i(`name`)},[i]);let o=`${e?.firstname} ${e?.lastname} Org`,s=a(`name`)||o,c=a(`subdomain`),l=(0,z.useMemo)(()=>{let e=cs(us(s),jl.maxLength);return{suggestedSubdomain:e,fullHostName:`future-cluster-names.${c||e}.harperfabric.com`}},[s,c]),{mutate:u,isPending:f}=Al(),p=qt(),h=(0,z.useCallback)(async e=>{u({name:e.name||o,subdomain:e.subdomain||l.suggestedSubdomain},{onSuccess:e=>{p.invalidateQueries({queryKey:r,refetchType:`active`}),m.reloadUser(d),t({to:`/${e.id}`})}})},[l.suggestedSubdomain,p,u,o,t]);return(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(H,{...n,children:(0,B.jsxs)(`form`,{id:`org-add-form`,name:`org-add-form`,onSubmit:n.handleSubmit(h),className:`grid gap-6 text-white max-w-xl`,children:[(0,B.jsx)(W,{control:n.control,name:`name`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,maxLength:Ml.shape.name.maxLength,autoCapitalize:`words`,placeholder:o,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:n.control,name:`subdomain`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Subdomain`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,maxLength:jl.maxLength,autoCapitalize:`none`,placeholder:l.suggestedSubdomain,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Full Host Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(`span`,{children:l.fullHostName})}),(0,B.jsx)(q,{})]}),(0,B.jsx)(Z,{children:(0,B.jsxs)(R,{type:`submit`,variant:`submit`,className:`rounded-full`,disabled:f,children:[`Create New Organization `,(0,B.jsx)(ve,{})]})})]})})})}function Pl(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsx)(Nl,{})})]})}function Fl(){let e=qt(),{data:t}=We(_()),{mutate:n,isPending:r}=Ol(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(``),u=(0,z.useCallback)(()=>l(``),[]),d=(0,z.useMemo)(()=>{let e=t?.roles||{},n=Object.values(e);return Object.keys(e).map((e,t)=>({organizationId:e,organizationName:n[t].organizationName,roleName:n[t].role})).filter(yc([`organizationId`,`organizationName`],c)).sort((e,t)=>(e.organizationName||``)>(t.organizationName||``)?1:-1)||[]},[c,t?.roles]),f=(0,z.useCallback)(e=>{l(e.currentTarget.value?.toLowerCase()||``)},[]),p=(0,z.useCallback)(t=>{t?.organizationId&&n(t.organizationId,{onSuccess:()=>{N.success(`Success`,{description:`Organization successfully deleted.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),e.invalidateQueries({queryKey:[]}),a(!1)},onError:()=>a(!1)})},[n,e,a]),m=(0,z.useCallback)(e=>{s(e),a(!0)},[]),{createCluster:h}=me({strict:!1});return d.length===1&&!c.length&&h?(0,B.jsx)(_t,{to:`/${d[0].organizationId}/new-cluster`,replace:!0}):!d.length&&!c.length?(0,B.jsx)(Pl,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{children:(0,B.jsxs)(`div`,{className:`flex w-full justify-end gap-2`,children:[(0,B.jsx)(J,{placeholder:`Filter by name`,className:`inline-block w-full text-xs`,value:c,onChange:f}),(0,B.jsx)(M,{to:`/new-org`,children:(0,B.jsxs)(R,{variant:`positive`,accessKey:`n`,children:[(0,B.jsx)(pr,{}),(0,B.jsxs)(`span`,{className:`hidden sm:inline-block`,children:[(0,B.jsx)(`u`,{children:`N`}),`ew `,(0,B.jsx)(`span`,{className:`hidden md:inline-block`,children:`Organization`})]})]})})]})}),(0,B.jsx)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-12`,children:[d.map(e=>(0,B.jsx)(`div`,{className:`col-span-1 md:col-span-4 lg:col-span-3 2xl:col-span-2`,children:(0,B.jsx)(El,{organizationRole:e,onDeleteOrgModal:m})},e.organizationId)),!d.length&&(0,B.jsxs)(`div`,{className:`col-span-1 md:col-span-12 text-center`,children:[(0,B.jsx)(`h2`,{className:`my-4 text-xl`,children:`No matches found.`}),(0,B.jsx)(R,{variant:`outline`,onClick:u,children:`Clear Filters`})]})]})}),o&&(0,B.jsx)(_o,{typeOfThingBeingDeleted:`organization`,nameOfThingBeingDeleted:o.organizationName,isModalOpen:i,setIsModalOpen:()=>a(!1),deletionConfirmed:()=>p(o),deletionPending:r})]})}function Il(){let{isLoading:e}=Nr(),{createCluster:t}=me({strict:!1}),[,n]=Io(Lo.SavedClusterState,null);return(0,z.useEffect)(()=>{t&&n(t)},[t,n]),e?(0,B.jsx)(Bo,{className:`fixed z-50 translate-1/2`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-black-dark dark:bg-black-dark dark:border-b dark:border-black md:px-12`,children:(0,B.jsx)(ji,{})}),(0,B.jsx)(`main`,{children:(0,B.jsx)($e,{})})]})}var Ll=[`/`,`/forgot-password`,`/reset-password`,`/sign-in`,`/sign-up`,`/verify-email`];function Rl(){let e=xc();return!Ll.includes(e)&&{redirect:e}}var zl=A({getParentRoute:()=>ri,id:`_dashboardLayout`,component:Il,beforeLoad:({context:e})=>{let t=e.authentication[d];if(t&&!t.isLoading&&!t.user)throw It({to:`/sign-in`,search:Rl()})}}),Bl=A({getParentRoute:()=>zl,id:`_orgsLayout`});A({getParentRoute:()=>Bl,path:`/`,component:Fl}),A({getParentRoute:()=>Bl,path:`/new-org`,component:Pl});var Vl=A({getParentRoute:()=>Bl,path:`$organizationId`,beforeLoad:async e=>({organization:await e.context.queryClient.ensureQueryData(os(e.params.organizationId))})});A({getParentRoute:()=>Vl,path:`/roles`,component:dl}),A({getParentRoute:()=>Vl,path:`/roles/$orgRoleId`,component:dl}),A({getParentRoute:()=>Vl,path:`/users`,component:Tl}),A({getParentRoute:()=>Vl,path:`/users/$orgUserId`,component:Tl}),Jc(Vl);var Hl=A({getParentRoute:()=>Vl,id:`_clusterLayout`});A({getParentRoute:()=>Hl,path:`/`,component:bc}),A({getParentRoute:()=>Vl,path:`/new-cluster`,component:hc}),A({getParentRoute:()=>Wl,path:`/edit`,component:hc});function Ul(){return(0,B.jsx)($e,{})}var Wl=A({getParentRoute:()=>Hl,path:`$clusterId`,component:Ul,beforeLoad:async({context:e,params:t})=>({cluster:await e.queryClient.ensureQueryData(ua(t.clusterId))})});function Gl({children:e,className:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:y(`mt-32 px-4 py-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))] flex justify-center`,t),children:e})]})}var Kl=new Set([`com`,`co`,`org`,`net`,`edu`,`gov`,`mil`,`me`,`biz`,`info`,`ac`,`or`,`ne`,`go`,`lg`,`asn`,`id`,`nom`,`sch`,`ltd`,`plc`]);function ql(e){let t=e.split(`.`);if(t.length<=2)return`@`;let n=t[t.length-1],r=t[t.length-2],i=n.length===2&&Kl.has(r)?3:2;return t.length<=i?`@`:t.slice(0,-i).join(`.`)}function Jl({cluster:{fqdn:e},domain:{domain:t,id:n}}){let r=ql(t),[i,a,o]=Mo(r,e||``,n);return(0,B.jsxs)(`div`,{className:`grid gap-4 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap`,children:`This domain has been verified! Now to associate it with this cluster, add the following to your DNS registrar:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordName`,value:r,onClick:i}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:i,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordTarget`,value:e,onClick:a}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:a,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`domainId`,value:n,onClick:o}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:o,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]})}),(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap italic text-sm`,children:`Select this domain using the checkbox to the left, then click "Bind" in the top right to finish associating it with this cluster.`})]})}function Yl({certificate:e,domain:t,cluster:n}){let r=ql(t.domain),[i,a,o]=Mo(r,n.fqdn||``,t.id),s=(0,z.useMemo)(()=>e.issueDate&&!e.inProgress?{width:`100%`,color:`bg-green/80`,pulse:!1,text:`Certificate Issued`}:e.inProgress?{width:`100%`,color:`bg-yellow/80`,pulse:!0,text:`Generating Certificate...`}:{width:`100%`,color:`bg-gray-600`,pulse:!1,text:`Pending Certificate Generation...`},[e]);return(0,B.jsxs)(`div`,{className:`w-full max-w-2xl border border-border/50 rounded-md p-4 bg-gray-900/20`,children:[(0,B.jsxs)(`div`,{className:`mb-4`,children:[(0,B.jsx)(`div`,{className:`w-full h-1.5 rounded-full overflow-clip flex shadow-sm bg-gray-800`,children:(0,B.jsx)(`div`,{style:{width:s.width},className:`grow transition-[width] duration-1000 ease-in-out motion-reduce:transition-none ${s.color} ${s.pulse?`animate-pulse`:``}`})}),(0,B.jsx)(`div`,{className:`text-[10px] text-muted-foreground font-light mt-1 italic`,children:s.text})]}),(0,B.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] text-sm`,children:[(0,B.jsx)(`div`,{className:`col-span-1 text-xs text-muted-foreground`,children:`CNAME:`}),(0,B.jsxs)(`div`,{className:`col-span-1 flex gap-2 items-center flex-wrap`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 px-2 py-0.5 rounded text-xs`,children:[(0,B.jsx)(`span`,{className:`truncate max-w-[150px]`,title:r,children:r}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:i,title:`Copy Name`,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]}),(0,B.jsx)(Xl,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 px-2 py-0.5 rounded text-xs`,children:[(0,B.jsx)(`span`,{className:`truncate max-w-[200px]`,title:n.fqdn||``,children:n.fqdn}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:a,title:`Copy Target`,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]})]}),(0,B.jsx)(`div`,{className:`col-span-1 text-[10px] text-muted-foreground`,children:`Domain ID:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800/50 px-2 py-0.5 rounded text-[10px] text-muted-foreground italic`,children:[(0,B.jsx)(`span`,{className:`truncate max-w-[200px]`,children:t.id}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`h-3 w-3 p-0`,onClick:o,title:`Copy ID`,children:(0,B.jsx)(Hn,{className:`w-2.5 h-2.5`})})]})})]})]})}function Xl(){return(0,B.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`w-3 h-3 text-muted-foreground`,children:[(0,B.jsx)(`path`,{d:`M5 12h14`}),(0,B.jsx)(`path`,{d:`m12 5 7 7-7 7`})]})}function Zl(e){let{enabled:t,entityId:n,databaseName:r,tableName:i,searchAttribute:a,sort:o,pageIndex:s,pageSize:c,onlyIfCached:l}=e;return I({enabled:t,queryKey:[n,r,i,`search_by_value`,a,o.attribute||`default`,o.descending||!1,s||0,c||0,l],retry:!1,staleTime:6e4,gcTime:5e3,queryFn:()=>Ql(e)})}async function Ql({instanceClient:e,databaseName:t,tableName:n,searchAttribute:r,sort:i,pageIndex:a,pageSize:o,onlyIfCached:s,headers:c}){let l=i.attribute.length&&!(i.attribute===r&&!i.descending),u=await e.post(`/`,{operation:`search_by_value`,get_attributes:[`*`],database:t,table:n,search_attribute:r,search_value:`*`,sort:l?i:void 0,offset:a*o,limit:o,onlyIfCached:s,noCacheStore:s},{timeout:0,headers:c,validateStatus:e=>e>=200&&e<400||e===404});return u.status===404?{data:[]}:u}function $l(e){return I({queryKey:[e,`ChallengeCertificate`],queryFn:async()=>{if(!e)return[];let{data:t}=await Ql({searchAttribute:`domain`,entityId:e,databaseName:`data`,tableName:`ChallengeCertificate`,sort:{attribute:`domain`,descending:!0},enabled:!0,instanceClient:i({id:e,forceFabricConnect:!0}),onlyIfCached:!1,pageIndex:0,pageSize:100});return t},enabled:!!e,refetchInterval:5e3})}function eu(e){return F($l(e))}function tu({domain:{challengeToken:e,challengeTxtRecord:t,domain:n,id:r},cluster:{fqdn:i}}){let a=ql(n),[o,s,c,l,u]=Mo(t,e,a,i||``,r);return(0,B.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap`,children:`Prove that you own this domain by adding the following to your DNS registrar:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TXT`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`challengeName`,value:t,onClick:o}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:o,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Content:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`challengeToken`,value:e,onClick:s}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:s,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap mt-4`,children:`While you're at it, you should also add the CNAME record to point to this cluster:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordName`,value:a,onClick:c}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:c,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordTarget`,value:i,onClick:l}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:l,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`domainId`,value:r,onClick:u}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:u,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]})}),(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap mt-2`,children:`Then after your DNS TTL elapses, click the "Validate" button above.`})]})}async function nu({clusterId:e,domainIds:t,generateDomainCerts:n}){let{data:r}=await u.put(`/Cluster/${e}`,{domainIds:t,generateDomainCerts:n},{timeout:0});return r}function ru(){return j({mutationFn:e=>nu(e)})}T.object({domainId:T.string()});async function iu(e){let{data:t}=await u.delete(`/Domain/${e.domainId}`);return t}function au(){return j({mutationFn:e=>iu(e)})}function ou(e){return[...new Set(e)]}var su=Ie();function cu(e,t,n){let{data:r}=eu(e.id),i=(0,z.useMemo)(()=>!!r?.some(e=>!e.issueDate||e.inProgress),[r]),{mutate:a,isPending:o}=ru(),{mutate:s,isPending:c}=au(),l=o||c,u=(0,z.useCallback)((t,n)=>{if(!oo(e.status)){N.error(`Cluster is currently `+e.status,{description:`To bind a domain, it must be running.`});return}a({clusterId:e.id,domainIds:ou((e.domainIds?.slice()||[]).concat([t])),generateDomainCerts:n},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),N.success(`Domain bound!`+(n?` Certificates are being generated in the background now.`:``))}})},[a,e]),d=(0,z.useCallback)(t=>{s({domainId:t},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[e.organizationId,`domains`],refetchType:`active`}),N.success(`Domain removed!`)}})},[s]),f=(0,z.useCallback)(t=>{a({clusterId:e.id,domainIds:(e.domainIds?.slice()||[]).filter(e=>e!==t),generateDomainCerts:!1},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),N.success(`Domain unbound!`)}})},[s]);return(0,z.useMemo)(()=>[su.display({id:`select`,header:`Bind`,size:50,cell:r=>{let a=r.row.original;return a.status===`ACTIVE`&&!a.clusterId&&!Eo(e)?(0,B.jsx)(`label`,{className:`p-10 -m-10`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:t.includes(a.id),onChange:()=>n(a.id),disabled:l||i})}):null}}),su.display({header:`Domains`,id:`domain`,enableSorting:!1,size:150,cell:e=>{let t=e.row.original;return(0,B.jsxs)(Ki,{children:[(0,B.jsx)(qi,{asChild:!0,children:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{children:t.domain}),(0,B.jsx)(R,{variant:`destructiveGhost`,className:`text-muted-foreground text-xs`,disabled:l||!!t.clusterId,onClick:()=>d(t.id),children:`Remove Domain`})]})}),(0,B.jsx)(Ji,{side:`bottom`,align:`center`,children:t.clusterId?`To delete this domain, please unbind it from all clusters first.`:`Remember to clean up your DNS records!`})]})}}),su.display({header:`Next Steps`,enableSorting:!1,size:500,id:`nextSteps`,cell:t=>{let n=t.row.original,i=r?.find(e=>e.domain===n.domain);return n.status===`ACTIVE`&&n.clusterId?e.id===n.clusterId?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{children:`Bound to this cluster`}),i&&(!i.issueDate||i.inProgress)&&(0,B.jsx)(`div`,{className:`py-2`,children:(0,B.jsx)(Yl,{certificate:i,domain:n,cluster:e})}),(0,B.jsx)(R,{variant:`destructiveGhost`,className:`text-muted-foreground text-xs`,disabled:l,onClick:()=>f(n.id),children:`Unbind Domain`})]}):`Bound to cluster ${n.clusterId}`:n.status===`PENDING_VALIDATION`?(0,B.jsx)(tu,{domain:n,cluster:e}):Eo(e)?`Cannot be associated with this self-managed cluster.`:n.status===`ACTIVE`&&!n.clusterId?(0,B.jsx)(Jl,{cluster:e,domain:n}):n.status}})],[e,u,l,r,i,t,n])}var lu=T.object({domain:T.string(),organizationId:T.string()});async function uu(e){let{data:t}=await u.post(`/Domain/`,e);return t}function du(){return j({mutationFn:e=>uu(e)})}async function fu(e){let{data:t}=await u.post(`/Domain/${e}/validate`);return t}async function pu(e){let{data:t}=await u.get(`/Domain/?organizationId=${e}`);return t}function mu(e){return I({queryKey:[e,`domains`],queryFn:()=>pu(e)})}function hu(){let{organizationId:e,clusterId:t}=P({strict:!1}),{data:n}=We(ua(t,!0)),{update:r}=Si(e),{data:i,refetch:a,isFetching:o,isRefetching:s}=F(mu(e)),c=(0,z.useMemo)(()=>i?.filter(e=>e.status===`PENDING_VALIDATION`)||[],[i]),[l]=(0,z.useState)({attribute:`domain`,descending:!1}),u=(0,z.useMemo)(()=>[{desc:l.descending,id:l.attribute}],[l]),d=Wc(a),[f,m]=(0,z.useState)([]),h=(0,z.useCallback)(e=>{m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{mutate:g,isPending:_}=ru(),v=(0,z.useCallback)(()=>{if(!oo(n.status)){N.error(`Cluster is currently `+n.status,{description:`To bind a domain, it must be running.`});return}g({clusterId:n.id,domainIds:ou((n.domainIds?.slice()||[]).concat(f)),generateDomainCerts:!0},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[n.organizationId],refetchType:`active`}),N.success(`Domain(s) bound! Certificates are being generated in the background now.`),m([])}})},[n,f,g]),{mutateAsync:y,isPending:b}=du(),x=k({resolver:O(lu),defaultValues:{domain:``,organizationId:e}}),ee=(0,z.useCallback)(async e=>{if(e){let t=e.domain.split(/[,\s]+/).map(e=>e.trim()).filter(Boolean);for(let n of t)await y({...e,domain:n});x.reset(),await a(),N.success(`${p(t.length,`Domain`,`Domains`)} added! Please add the txt record above to your domain registrar.`)}},[y,x,a]),S=(0,z.useCallback)(async()=>{let e=`Validating ${p(c.length,`domain`,`domains`)}...`,t=`validatingDomains`,n=0,r=0;for(let i of c)try{N.loading(e,{description:`${n++} of ${c.length} checked`,id:t}),await fu(i.id)}catch{r+=1}r>0?N.error(`Validation failed!`,{description:`Please make sure the TXT record has been put in place. You may need to wait a bit for the DNS change to propagate.`,id:t}):(await a(),N.success(`Validation succeeded!`,{description:`Please take a look at the next steps for newly verified domains.`,id:t}))},[c]),te=cu(n,f,h),C=x.watch(`domain`),w=(0,z.useMemo)(()=>typeof C==`string`?C.trim().split(`.`).length===2:!1,[C]),T=(0,z.useCallback)(()=>{typeof C==`string`&&x.setValue(`domain`,`${C.trim()}, www.${C.trim()}`)},[C,x]);return(0,B.jsx)(zc,{data:i||[],isFetching:o||s,columns:te,sortingState:u,children:(0,B.jsxs)(`div`,{className:`w-full flex flex-col md:flex-row items-center md:justify-between md:space-x-2 space-y-2 md:space-y-0`,children:[r&&(0,B.jsx)(H,{...x,children:(0,B.jsxs)(`form`,{id:`cluster-add-domain-form`,name:`cluster-add-domain-form`,onSubmit:x.handleSubmit(ee),className:`flex gap-1 flex-col md:flex-row`,children:[(0,B.jsx)(W,{control:x.control,name:`domain`,render:({field:e})=>(0,B.jsxs)(G,{className:`flex-1`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`New Domain Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,enterKeyHint:`done`,autoComplete:`off`,...e})}),w&&(0,B.jsxs)(`div`,{className:`mt-1 flex gap-4`,children:[`Adding an apex domain?`,(0,B.jsx)(R,{variant:`positiveOutline`,type:`button`,onClick:T,children:`Add www as well`})]}),(0,B.jsx)(q,{children:(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`Type in a domain like example.com or your.example.com, and you'll be guided through validating and binding your cluster to it.`})})]})}),(0,B.jsxs)(`div`,{className:`flex-0 self-start flex gap-1 md:pt-6.5`,children:[(0,B.jsxs)(R,{type:`submit`,variant:`submit`,disabled:b,children:[(0,B.jsx)(pr,{}),` Add`]}),c.length>0&&(0,B.jsxs)(R,{variant:`positiveOutline`,onClick:S,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,B.jsx)(An,{}),` `,(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`u`,{children:`V`}),`alidate`]})]}),(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:d,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,B.jsx)(wn,{}),` `,(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]})]})]})}),f.length>0&&(0,B.jsx)(`div`,{className:`flex-0 self-start md:pt-6.5`,children:(0,B.jsxs)(R,{variant:`submit`,onClick:v,disabled:_,children:[(0,B.jsx)(yn,{}),` Bind `,p(f.length,`Domain`,`Domains`)]})})]})})}function gu(){return(0,B.jsx)(Gl,{className:`flex flex-col justify-start max-w-4xl`,children:(0,B.jsx)(hu,{})})}var _u=D({username:pa,role:C().nonempty({error:`Please select a role.`}),password:fa.min(8,{error:`Password must be at least 8 characters long.`}),confirmPassword:C()}).refine(e=>e.password===e.confirmPassword,{error:`Passwords do not match.`,path:[`confirmPassword`]});async function vu(e){await u.patch(`/ResetPasswordUpdater/${e}`)}async function yu(e){let{instanceClient:t,...n}=e,{data:r}=await t.post(`/`,{operation:`add_user`,...n});return r}function bu(){return j({mutationFn:yu})}async function xu({username:e,password:t,role:n,active:r,instanceClient:i}){let{data:a}=await i.post(`/`,{operation:`alter_user`,username:e,password:t,role:n,active:r});return a}function Su(){return j({mutationFn:xu})}async function Cu({username:e,instanceClient:t}){let{data:n}=await t.post(`/`,{operation:`drop_user`,username:e});return n}function wu(){return j({mutationFn:Cu})}async function Tu({clusterId:e,initialUsername:t,desiredUsername:n,newPassword:r,tempPassword:i,instanceClient:a}){if(!i)throw Error(`You may not have permission to set the password on this cluster.`);let o=a;try{let a=await oa({username:t,password:i,instanceClient:o,entityId:e});return a.instanceClient&&(o=a.instanceClient),n===`HDB_ADMIN`?await xu({username:n,password:r,instanceClient:o}):(await yu({username:n,password:r,role:`super_user`,active:!0,instanceClient:o}),await oa({username:n,password:r,instanceClient:o,entityId:e}),await Cu({username:s,instanceClient:o})),await vu(e),a}catch(t){throw await h({entityId:e,instanceClient:o}),t}}function Eu(){return j({mutationFn:Tu})}function Du(){let{user:e}=Pr(),{clusterId:t}=P({strict:!1}),{data:r}=F(ua(t,!0)),i=L(),a=(0,z.useMemo)(()=>n(r),[r]),o=pi(a),{redirect:c}=me({strict:!1}),l=kt(),u=k({resolver:O(_u),defaultValues:{confirmPassword:``,password:``,role:`super_user`,username:e?.email??``}}),{setFocus:d,control:f,handleSubmit:p}=u;(0,z.useEffect)(()=>{d(`password`)},[d]);let h=r?.instances?.find(e=>e.tempPassword)?.tempPassword,{mutate:g,isPending:_}=Eu(),v=(0,z.useCallback)(async e=>{if(!a){N.error(`Cluster is not yet fully loaded, please wait a moment before trying to sign in.`);return}g({instanceClient:o,clusterId:t,newPassword:e.password,tempPassword:h,initialUsername:s,desiredUsername:e.username},{onSuccess:async({message:e,user:t})=>{N.success(e),m.setUserForEntity(r,t),l.invalidate(),await i({to:c?.startsWith(`/`)?c:`../`})}})},[r,t,o,i,a,c,l,g,h]);return r&&!r.resetPassword?(0,B.jsx)(_t,{to:`../sign-in`,replace:!0}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`nav`,{className:`fixed top-20 w-full h-12 z-39 px-4 md:px-12 bg-grey-700 flex items-center`,children:(0,B.jsx)(Qi,{})}),(0,B.jsx)(`div`,{className:`items-center justify-center flex mt-32 py-4 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsx)(`h2`,{className:`text-2xl font-light`,children:`Create Admin User`}),(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:`You are ready to create your first user in your new cluster. These credentials belong to you alone, and you can create more users and roles once you create this first one.`}),(0,B.jsx)(H,{...u,children:(0,B.jsxs)(`form`,{id:`cluster-create-admin-form`,name:`cluster-create-admin-form`,onSubmit:p(v),className:`my-4`,children:[(0,B.jsx)(W,{control:f,name:`username`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Username`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{autoComplete:`username`,type:`text`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:f,name:`password`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:f,name:`confirmPassword`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Confirm Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(R,{disabled:_,type:`submit`,variant:`submit`,className:`w-full my-2 rounded-full`,children:`Create Admin User`})]})}),(0,B.jsxs)(`p`,{className:`text-muted-foreground flex gap-2 align-middle`,children:[(0,B.jsx)(Ee,{size:36,className:`flex-none`}),(0,B.jsx)(`span`,{children:`These credentials will be used to sign into your cluster directly, providing you a secure connection from your browser to your cluster.`})]})]})})]})}function Ou({columns:e,data:t}){let n=zt({data:t,columns:e,getCoreRowModel:Xe()});return(0,B.jsx)(`div`,{className:`bg-black-dark rounded-md`,children:(0,B.jsxs)(Mc,{children:[(0,B.jsx)(Nc,{children:n.getHeaderGroups().map(e=>(0,B.jsx)(Fc,{className:`border-none`,children:e.headers.map(e=>(0,B.jsx)(Ic,{className:`p-4`,style:{width:`${e.getSize()}%`},children:e.isPlaceholder?null:Mt(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,B.jsx)(Pc,{className:`bg-black`,children:n.getRowModel().rows?.length?n.getRowModel().rows.map(e=>(0,B.jsx)(Fc,{"data-state":e.getIsSelected()&&`selected`,className:`hover:bg-muted/10 data-[state=selected]:bg-muted`,children:e.getVisibleCells().map(e=>(0,B.jsx)(Rc,{className:`p-4`,style:{width:`${e.column.getSize()}%`},children:Mt(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,B.jsx)(Fc,{children:(0,B.jsx)(Rc,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})})}function ku(){return(0,B.jsx)(`div`,{className:`flex-col items-center justify-center px-16 space-y-3 text-center pt-30`,children:(0,B.jsx)(`p`,{children:`No instances found.`})})}function Au({isSelfManaged:e,instance:t}){let{user:n,isLoading:r}=Fr(t.id),i=pi((0,z.useMemo)(()=>c(t),[t])),{update:a}=Ti(),o=m.checkForFabricConnect(t.id),s=(0,z.useCallback)(async()=>{await h({instanceClient:i,entityId:t.id}),m.setUserForEntity(t,null)},[t,i]);return r||![`CLONE_READY`,`RUNNING`,`UPDATED`].includes(t.status)?(0,B.jsx)(fe,{className:`animate-spin`,color:`gray`}):!n||o?(0,B.jsxs)(`span`,{className:`flex gap-4`,children:[a&&!e&&(0,B.jsx)(M,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Connect to ${t.name} instance`,title:`Connect to ${t.name} instance`,children:(0,B.jsx)(R,{variant:`positiveOutline`,children:`Fabric Connect`})}),(0,B.jsx)(M,{to:`../instance/${t.id}/sign-in`,className:`text-sm`,"aria-label":`Sign in to ${t.name} instance`,title:`Sign in to ${t.name} instance`,children:(0,B.jsx)(R,{variant:a?`defaultOutline`:`positiveOutline`,children:`Direct Sign In`})})]}):(0,B.jsxs)(`span`,{className:`flex gap-4`,children:[(0,B.jsx)(M,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Go to ${t.name} instance`,title:`Go to ${t.name} instance`,children:(0,B.jsx)(R,{variant:`positiveOutline`,children:`Direct Connect`})}),(0,B.jsx)(R,{variant:`destructiveOutline`,className:`text-sm`,"aria-label":`Sign out from ${t.name} instance`,title:`Sign out from ${t.name} instance`,onClick:s,children:`Direct Sign Out`})]})}function ju(){let{clusterId:e}=P({strict:!1}),{data:t,isLoading:n}=F(ua(e,!0)),r=Eo(t),i=(0,z.useMemo)(()=>[{id:`instanceActions`,size:1,minSize:1,cell:e=>(0,B.jsx)(`div`,{className:`flex justify-end`,children:(0,B.jsx)(Au,{isSelfManaged:r,instance:e.row.original})})},r&&{accessorKey:`instanceFqdn`,size:90,header:`URL`,cell:e=>cc({secure:e.row.original.operationsApiSecure?`true`:`false`,port:e.row.original.operationsApiPort,fqdn:e.row.original.instanceFqdn})},!r&&{accessorKey:`name`,size:90,header:`Name`},!r&&{accessorKey:`status`,header:`Status`,size:1,minSize:1,cell:e=>{let t=e.getValue();return(0,B.jsx)(vo,{variant:ao(t),children:Xi(t)})}},!r&&{accessorKey:`version`,size:1,minSize:1,header:`Version`},!r&&{accessorKey:`storageGb`,size:1,minSize:1,header:`Storage`,cell:e=>qs(e.getValue(),1024**3)},!r&&{accessorKey:`cpuCores`,size:1,minSize:1,header:`Cores/Threads`,cell:e=>(0,B.jsxs)(B.Fragment,{children:[e.row.original.cpuCores,` / `,e.row.original.threads]})},!r&&{accessorKey:`memoryMb`,size:1,minSize:1,header:`Memory`,cell:e=>qs(e.getValue(),1024**2)}].filter(Zr),[r]),a=(0,z.useMemo)(()=>t?.instances?t.instances.filter(e=>e.status&&!ia.includes(e.status)).sort(Yo):[],[t]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsx)(zr,{className:`p-0 mt-4 min-h-96`,children:(0,B.jsx)(Ur,{className:`p-0 min-h-96`,children:n?(0,B.jsx)(js,{}):a.length?(0,B.jsx)(Ou,{data:a,columns:i}):(0,B.jsx)(ku,{})})})})]})}function Mu(){let{clusterId:e}=P({strict:!1}),{data:t,isLoading:n}=F(ua(e,2e3)),r=t?.status,i=(0,z.useMemo)(()=>r&&ra.includes(r),[r]);return n||!t?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsx)(js,{})}):i?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`All done!`}),(0,B.jsx)(ko,{cluster:t,forceProgressBarVisible:!0}),(0,B.jsx)(`p`,{children:`Your cluster finished updating, and is ready for interaction.`}),(0,B.jsx)(`div`,{className:`text-center`,children:(0,B.jsx)(Do,{cluster:t})})]})}):(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,B.jsx)(ko,{cluster:t,forceProgressBarVisible:!0}),(0,B.jsxs)(`p`,{children:[`Your cluster is updating with the latest changes. This includes waiting several minutes to let traffic drain safely.`,` `,(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`We will let you know when we are ready for you to connect! In the meantime, join us on`,` `,(0,B.jsx)(`a`,{href:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,children:`Discord`}),`! Get real-time help from our engineers, see feature drops early, and connect with others building on Fabric.`]})]})]})})}function Nu(){let e=kt(),{clusterId:t}=P({strict:!1}),{data:n,isLoading:r}=F(ua(t,2e3)),i=n?.status,a=(0,z.useMemo)(()=>i&&ra.includes(i),[i]),o=so(i),[,s]=Io(Lo.SavedClusterState,null),c=(0,z.useCallback)(()=>{s(n),e.navigate({to:`/${n.organizationId}/new-cluster`})},[n,e,s]);return r||!n?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsx)(js,{})}):o?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4 items-center`,children:[(0,B.jsx)(rr,{className:`w-24 h-24`}),(0,B.jsxs)(`span`,{children:[`Your cluster failed to successfully start. This is usually caused by temporary communication problems. Would you like to try again? We also get notified about these failures. `,(0,B.jsx)(zo,{}),` if you want more help.`]}),(0,B.jsx)(R,{type:`button`,variant:`positiveOutline`,onClick:c,children:`Try Again`})]})}):a?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`It's ready!`}),(0,B.jsx)(ko,{cluster:n,forceProgressBarVisible:!0}),(0,B.jsxs)(`p`,{children:[`Let's set up your secure, browser-to-cluster connection now.`,` `,(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Did you know during this step, you connect straight to your cluster, providing a private secure connection? That's `,(0,B.jsx)(`em`,{children:`Direct Connect`}),`! Once you create your user, you will have the option to`,` `,(0,B.jsx)(`em`,{children:`Fabric Connect`}),` from your Fabric account without having to sign in again.`]})]}),(0,B.jsx)(`div`,{className:`text-center`,children:(0,B.jsx)(Do,{cluster:n})})]})}):(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,B.jsx)(ko,{cluster:n,forceProgressBarVisible:!0}),(0,B.jsxs)(`p`,{children:[`Your cluster is spinning up with the latest changes, including your own DNS records and private connections. Please wait while we get everything going.`,` `,(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`We will let you know when we are ready for you to connect! In the meantime, join us on`,` `,(0,B.jsx)(`a`,{href:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,children:`Discord`}),`! Get real-time help from our engineers, see feature drops early, and connect with others building on Fabric.`]})]})]})})}A({getParentRoute:()=>Wl,path:`instances`,component:ju}),A({getParentRoute:()=>Wl,path:`starting-up`,component:Nu}),A({getParentRoute:()=>Wl,path:`scaling`,component:Mu}),A({getParentRoute:()=>Wl,path:`domains`,component:gu}),A({getParentRoute:()=>Wl,path:`sign-in`,component:ba,beforeLoad:({context:e,location:t,params:n})=>{let r=m.checkForFabricConnect(n.clusterId);if(e.authentication[n.clusterId]?.user&&!r){let e=t?.search;throw It({to:e?.redirect?.startsWith(`/`)?e.redirect:`../`})}}}),A({getParentRoute:()=>Wl,path:`instance/$instanceId/sign-in`,component:ba,beforeLoad:({context:e,location:t,params:n})=>{if(!(m.checkForFabricConnect(n.clusterId)||m.checkForFabricConnect(n.instanceId))&&e.authentication[n.instanceId]?.user){let e=t?.search;throw It({to:e?.redirect?.startsWith(`/`)?e.redirect:`../`})}}}),A({getParentRoute:()=>Wl,path:`finish-setup`,component:Du});function Pu(e){return A({getParentRoute:()=>e,path:`apis`}).lazy(()=>Ir(()=>import(`./index.lazy-iG1_8dzm.js`).then(e=>e.route),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])))}function Fu(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||e[i]!==t[i])return!1;return!0}function Iu(e,t){let[n,r]=(0,z.useState)(t),[i,a]=(0,z.useState)(e);return(0,z.useEffect)(()=>{Fu(n,t)||(r(t),a(e))},[n,t,e]),Fu(n,t)?[i,a]:[e,a]}var Lu={};function Ru(e,t,n){let r=(0,z.useCallback)((e,n)=>t(e,n),[n]);(0,z.useEffect)(()=>(Lu[e]||(Lu[e]=[]),Lu[e].push(r),function(){let t=Lu[e].indexOf(r);t>=0&&Lu[e].splice(t,1)}),[e,t,r])}function zu(e,t,n){let r=Lu[e];if(r)for(let e of r)e(t,n)}function Bu(e,t,n){return r=>zu(e,t,n??r)}function Vu(e,t,n){return(0,z.useCallback)(r=>zu(e,t,n??r),[e,t,n])}function Hu(e,t){return No(sessionStorage.getItem(String(e)))??t}function Uu(e,t){t==null?sessionStorage.removeItem(String(e)):sessionStorage.setItem(String(e),JSON.stringify(t))}function Wu(e,t){let n=Iu(Hu(e,t),[e]),[r,i]=n;return(0,z.useEffect)(()=>{Uu(e,r),zu(`Session:${e}`,r)},[e,r]),Ru(`Session:${e}`,function(e){r!==e&&i(e)},[r,e,t]),(0,z.useEffect)(function(){let n=n=>{n.key===e&&i(Hu(e,t))};return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}},[e,i,t]),n}function Gu(e,t=!1){let[n,r]=Wu(e,t),i=(0,z.useCallback)(e=>{e?.preventDefault?.(),r(e=>!e)},[r]),a=(0,z.useCallback)(e=>{e?.preventDefault?.(),r(!0)},[r]),o=(0,z.useCallback)(e=>{e?.preventDefault?.(),r(!1)},[r]);return(0,z.useMemo)(()=>({toggled:n,setToggled:r,toggle:i,toggleOn:a,toggleOff:o}),[i,r,o,a,n])}var Ku=(0,z.createContext)(null);function qu(){return(0,z.useContext)(Ku)}async function Ju({file:e,project:t,entityType:n,instanceClient:r}){let{data:i}=await r.post(`/`,{operation:`drop_component`,file:e||void 0,project:t,replicated:n===`cluster`});return i}function Yu(e){let t=(e||``)?.split(`.`);return t.length>1?t.slice(-1)[0]:``}function Xu(e){switch(Yu(e).toLowerCase()){case`jpg`:case`jpeg`:case`gif`:case`png`:case`pneg`:case`webp`:return!0;default:return!1}}async function Zu({instanceClient:e,file:t,project:n,encoding:r}){let{data:i}=await e.post(`/`,{operation:`get_component_file`,file:t,project:n,encoding:r??(Xu(t)?`base64`:`utf8`)});return{file:t,project:n,...i}}function Qu(e){return I({queryKey:$u(e),queryFn:()=>Zu(e),enabled:!!e.file&&!!e.project,retry:!1})}function $u(e){return[e.entityId,`get_component_file`,e.file,e.project,e.encoding]}async function ed({file:e,payload:t,project:n,entityType:r,instanceClient:i,encoding:a}){let{data:o}=await i.post(`/`,{operation:`set_component_file`,file:e,payload:t,project:n,encoding:a,replicated:r===`cluster`},{timeout:3e5});return o}function td(){return j({mutationFn:ed})}function nd(){let{reloadRootEntries:e,setFocusedItem:t,setSelectedItems:n}=qu(),r=V();return(0,z.useCallback)(async i=>{let a=!1,o=i.filter(e=>e.from!==e.to);if(o.length===0)return;let s=`Renaming ${p(o.length,`File`,`Files`)}`,c={duration:6e4,action:{label:`Cancel`,onClick:()=>{a=!0}}};c.id=N.loading(s,{...c,description:(0,B.jsx)($o,{animated:!0,width:`0%`})});let l=o.length*3,u=0;function d(){u+=1,N.loading(s,{...c,description:(0,B.jsx)($o,{animated:!0,width:(u===0?0:u/l*100)+`%`})})}for(let e of o){let t=e.from.split(`/`),n=t.shift(),i=t.join(`/`),o=e.to.split(`/`),s=o.shift(),c=o.join(`/`),l=await Zu({...r,file:i,project:n,encoding:`base64`});if(a||(d(),await ed({...r,file:c,project:s,encoding:`base64`,payload:l.message}),a)||(d(),await Ju({...r,file:i,project:n}),a))break;d()}u>=l?N.success(`Renamed ${p(o.length,`File`,`Files`)}`,{id:c.id,description:`All done!`,duration:3e3,action:{label:`OK`,onClick:()=>{}}}):N.warning(`Rename Cancelled`,{id:c.id,description:`${u} of ${l} steps completed.`,duration:1e4,action:{label:`OK`,onClick:()=>{}}}),e(),n(e=>{let t=e.slice();for(let e of o){let n=t.indexOf(e.from);n>=0?t.splice(n,1,e.to):t.push(e.to)}return t}),t(e=>{for(let t of o)if(e===t.from)return t.to;return e})},[r,e,t,n])}function rd(e,t){return e[t]!==void 0}function id(e){return t=>rd(t,e)}function ad(e,t){let[n,r]=(0,z.useState)({value:t});return Ru(e,(e,t)=>r({value:e,trigger:t}),[r]),n}function od(e,t,n){zu(e,t,n)}function sd(e,t,n){return r=>od(e,t,n??r)}function cd(e,t,n){return(0,z.useCallback)(r=>{od(e,t,n??r)},[e,t,n])}var ld=[{handleGlobal(e,t){if((t.cmd||t.ctrl)&&e===`Delete`)return od(`ShowDeleteDirectoryOrFileModal`,!0),!0},addEditorAction(e){return{id:`delete-file`,label:`Delete File`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.Delete],run:sd(`ShowDeleteDirectoryOrFileModal`,!0)}}},{handleGlobal(e,t){if(t.ctrl&&t.alt&&t.shift&&e===`˜`)return od(`ShowAddDirectoryOrFileModalType`,`directory`),!0},addEditorAction(e){return{id:`new-directory`,label:`New Directory`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyMod.Shift|e.KeyCode.KeyN],run:sd(`ShowAddDirectoryOrFileModalType`,`directory`)}}},{handleGlobal(e,t){if(t.ctrl&&e===`n`)return od(`ShowAddDirectoryOrFileModalType`,`file`),!0},addEditorAction(e){return{id:`new-file`,label:`New File`,keybindings:[e.KeyMod.WinCtrl|e.KeyCode.KeyN],run:sd(`ShowAddDirectoryOrFileModalType`,`file`)}}},{handleGlobal(e){if(e===`F2`)return od(`ShowRenameFileModal`,`file`),!0},addEditorAction(e){return{id:`rename-file`,label:`Rename File`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyCode.KeyR,e.KeyCode.F2],run:sd(`ShowRenameFileModal`,!0)}}},{addEditorAction(){return{id:`revert-file`,label:`Revert File`,run:Bu(`RevertChanges`,!0)}}},{handleGlobal(e,t){if(t.cmd&&e===`s`)return zu(`SaveFile`,!0),!0},addEditorAction(e){return{id:`save-file`,label:`Save Changes`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.KeyS],run:Bu(`SaveFile`,!0)}}}],ud=ld.filter(id(`addEditorAction`)),dd=ld.filter(id(`handleGlobal`));function fd(e){let[t,n]=e,r=ud.map(e=>t.addAction(e.addEditorAction(n)));return()=>{for(let e of r)e?.dispose()}}function pd(){(0,z.useEffect)(()=>(document.addEventListener(`keydown`,md),()=>{document.removeEventListener(`keydown`,md)}),[])}function md(e){let t={cmd:e.getModifierState(`Meta`),alt:e.getModifierState(`Alt`),shift:e.getModifierState(`Shift`),ctrl:e.getModifierState(`Control`)};for(let n of dd)if(n.handleGlobal(e.key,t)){e.preventDefault();return}}function hd(e){return e.split(`/`).pop()}function gd(...e){return e.flat(1).join(`/`)}function _d(e){return!!e?.entries}var vd=`__root__`,yd=`importedApplications`,bd=`newApplication`;function xd(e){let t={},n=[],r=[],i=[];for(let a of e)_d(a)?a.package?r.push(a.path):n.push(a.path):i.push(a.path),Sd(t,a);return t[vd]={index:vd,isFolder:!0,children:[bd,yd,...n,...i],data:void 0,canMove:!1,canRename:!1},t[yd]={index:yd,isFolder:!0,children:r,data:{name:`Imported Applications`,path:yd,package:yd,project:``,entries:[]},canMove:!1,canRename:!1},t[bd]={index:bd,isFolder:!1,data:{name:`New Application`,path:bd,project:``},canMove:!1,canRename:!1},{items:t,rootId:vd}}function Sd(e,t){let n=t.path;if(_d(t)){let r=t,i=[],a=[];for(let e of r.entries)_d(e)?i.push(e.path):a.push(e.path);e[n]={index:n,isFolder:!0,children:[...i,...a],data:t,canMove:!1,canRename:!1};for(let t of r.entries)Sd(e,t)}else e[n]={index:n,isFolder:!1,data:t,canMove:!t.package,canRename:!t.package}}function Cd(){let[e,t]=(0,z.useState)(!1),[n,r]=(0,z.useState)(void 0),i=(0,z.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`))return;let n=e.target;if(n instanceof Element&&n.classList.contains(`rct-tree-item-button-isFolder`)){let e=n.getAttribute(`data-rct-item-id`);!n.querySelector(`.packageIsLocked`)&&e&&e!==`importedApplications`&&e!==`newApplication`&&r(e=>e===n?e:(e?.classList?.remove?.(`rct-tree-item-title-container-dragging-over`),n.classList.add(`rct-tree-item-title-container-dragging-over`),n))}t(!0)},[]),a=(0,z.useCallback)(()=>{t(!1),r(e=>{e&&e.classList.remove(`rct-tree-item-title-container-dragging-over`)})},[]),o=(0,z.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`)||e.detail===1337)return;t(!1),n&&(n.classList.remove(`rct-tree-item-title-container-dragging-over`),r(void 0));let i=document.getElementById(`dropTarget`);return i?i.dispatchEvent(new DragEvent(`drop`,{bubbles:!0,detail:1337,cancelable:!0,dataTransfer:e.dataTransfer})):!1},[n]);return(0,z.useEffect)(()=>(document.addEventListener(`dragenter`,i),document.addEventListener(`dragover`,i),document.addEventListener(`dragleave`,a),document.addEventListener(`drop`,o),()=>{document.removeEventListener(`dragenter`,i),document.removeEventListener(`dragover`,i),document.removeEventListener(`dragleave`,a),document.removeEventListener(`drop`,o)}),[i,o,a]),(0,z.useMemo)(()=>({dragging:e,dragTarget:n}),[e,n])}function wd(e){return new Promise((t,n)=>{let r=new FileReader;r.onabort=n,r.onerror=n,r.onload=t,r.readAsDataURL(e)})}function Td(){let[e,n]=(0,z.useState)(``),{clusterId:r}=P({strict:!1}),{openedEntry:i,restrictPackageModification:a,reloadRootEntries:o,entryExists:s}=qu(),c=!!i&&!i.package&&!a,l=V(),{dragging:u,dragTarget:d}=Cd(),f=(d?.getAttribute?.(`data-rct-item-id`))?.split?.(`/`)?.pop?.(),h=i?.project,g=!1,_;if(i?.path){let e=i.path.split(`/`),t=_d(i);g=c&&(t?e.slice(1):e.slice(1,-1)).join(`/`),_=e[e.length-(t?1:2)]}let b=(0,z.useCallback)(async(e,t)=>{let r=d?.getAttribute?.(`data-rct-item-id`)?.split?.(`/`),i=r?.length?r[0]:c?h:!1,a=r?.length?r.slice(1).join(`/`):c?g:!1;if(i===!1||i===void 0||a===!1||a===void 0)return;let u=[],f=t.slice();for(let t of e){let e=Ed(a,t);t.name.startsWith(`.`)||t.relativePath?.includes(`/.`)?f.push({file:t,errors:[{message:`Sensitive files and folders starting with . are skipped.`,code:`dot-ignored`}]}):s(`${i}/${e}`)?f.push({file:t,errors:[{message:`${e} already exists`,code:`duplicate`}]}):u.push(t)}let m=!1,_=`uploading-files`,v={label:`Cancel`,onClick:()=>{m=!0}},y={label:`OK`,onClick:()=>void 0};n(`Uploading ${p(u.length,`file`,`files`)}...`);let b=u.reduce((e,t)=>e+t.size,0),x=0,ee=0;for(let e of u){ee+=1,N.loading(`Upload in progress...`,{id:_,descriptionClassName:`whitespace-pre`,description:`${ee} of ${p(u.length,`file`,`files`)}
|
|
11
|
+
`)}}];function Wc(e){return(0,z.useCallback)(async()=>{N.loading(`Refreshing...`,{id:`refreshing`});let t=Date.now();await e(),Date.now()-t<500&&await a(500),N.success(`Refreshed!`,{id:`refreshing`})},[e])}async function Gc(e){let{data:t}=await u.get(`/Invoice/${e}`);return t}function Kc(e,t){return I({queryKey:[e,`invoices`],queryFn:()=>Gc(e),retry:!1,enabled:!!e,refetchInterval:t?1e4:void 0})}function qc(){let{organizationId:e}=P({strict:!1}),{data:t}=F(os(e)),{data:n,refetch:r,isLoading:i,isFetching:a,isRefetching:o}=F(Kc(t?.type!==`ENTERPRISE`&&t?.id,!1)),s=Wc(r);return t?.type===`ENTERPRISE`?(0,B.jsxs)(`span`,{children:[`You are part of an enterprise organization! We don’t currently show your invoices on this page. Want to explore your solution with Harper more? `,(0,B.jsx)(zo,{}),`, we would love to talk!`]}):i?(0,B.jsx)(Bo,{centered:!0}):!n||!n.length?(0,B.jsxs)(`span`,{children:[`Your invoices will be shown here once one is available! Want to explore your solution with Harper more?`,` `,(0,B.jsx)(zo,{overEmail:!0}),`, we would love to talk!`]}):(0,B.jsx)(zc,{data:n,columns:Uc,children:(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:s,accessKey:`r`,disabled:a||o,children:[(0,B.jsx)(wn,{}),(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]})})}function Jc(e){let t=A({getParentRoute:()=>e,path:`billing`,component:kc}),n=A({getParentRoute:()=>t,path:`/`,component:Os}),r=A({getParentRoute:()=>t,path:`invoices`,component:qc}),i=A({getParentRoute:()=>t,path:`confirm`,component:wc});return t.addChildren([n,r,i])}async function Yc(e){let{data:t}=await u.get(`/OrganizationRole/${e}`);return t}function Xc(e){return I({queryKey:[e,`roles`],queryFn:()=>Yc(e),retry:!1,refetchInterval:10*1e3})}var Zc=[{header:`Role Name`,accessorKey:`roleName`,enableSorting:!1},Ie().display({header:`Users Assigned`,enableSorting:!1,id:`userIds`,cell:e=>!e.row.original.userIds||e.row.original.userIds.length===0?`No users assigned`:e.row.original.userIds.length})];async function Qc(e){let{data:t}=await u.post(`/Role/`,e);return t}function $c(){return j({mutationFn:Qc})}var el=D({name:C().nonempty({error:`Please enter a role name.`}).regex(/^[a-zA-Z_]*$/,{error:`Role must contain only letters and underscores.`}).max(30,{error:`Role name cannot be longer than 30 characters.`}),update:E(),delete:E()});D({roles:D({create:E(),delete:E(),update:E(),view:E()}),clusters:D({create:E(),delete:E(),update:E(),view:E(),resources:w(D({id:C(),delete:E(),update:E(),view:E(),instances:D({create:E(),delete:E(),update:E(),view:E()})}))})});var tl={roles:{create:!0,view:!0,update:!0,delete:!0},clusters:{create:!0,view:!0,update:!0,delete:!0,resources:[]}};function nl({isModalOpen:e,setIsModalOpen:t}){let n=qt(),{organizationId:r}=P({strict:!1}),[i,a]=(0,z.useState)(!0),[o,s]=(0,z.useState)(JSON.stringify(tl,null,2)),{mutate:c,isPending:l}=$c(),u=k({resolver:O(el),defaultValues:{name:``,update:!1,delete:!1}}),d=(0,z.useCallback)(e=>{a(e.length===0)},[a]),f=(0,z.useCallback)(async e=>{let a=No(o);if(!a)return;let s={...e,...a,organizationId:r};e&&i&&c(s,{onSuccess:()=>{N.success(`Organization role added successfully!`),t(!1),n.invalidateQueries({queryKey:[r,`roles`],refetchType:`active`}),u.reset()},onError:e=>{N.error(`Failed to add organization role: ${e.message}`)}})},[i,o,c,u,n,t,r]);return(0,B.jsx)(Y,{onOpenChange:t,open:e,children:(0,B.jsxs)(X,{children:[(0,B.jsx)(Q,{children:`Add New Organization Role`}),(0,B.jsx)(go,{children:`Set the new organization role permissions.`}),(0,B.jsx)(H,{...u,children:(0,B.jsxs)(`form`,{id:`org-add-role-form`,name:`org-add-role-form`,className:`grid grid-cols-2 gap-4 my-4`,onSubmit:u.handleSubmit(f),children:[(0,B.jsx)(W,{control:u.control,name:`name`,render:({field:e})=>(0,B.jsxs)(G,{className:`col-span-2`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Role Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,className:``,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:u.control,name:`update`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Update Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:u.control,name:`delete`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Delete Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(`div`,{className:`col-span-2`,children:(0,B.jsx)(Be,{theme:`vs-dark`,height:`300px`,defaultLanguage:`json`,onValidate:d,onChange:e=>{e&&s(e)},defaultValue:JSON.stringify(tl,null,2)})}),(0,B.jsx)(Z,{className:`col-span-2`,children:(0,B.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,B.jsx)(R,{variant:`destructiveOutline`,className:`rounded-full`,type:`button`,onClick:()=>t(!1),disabled:l,children:`Cancel`}),(0,B.jsx)(R,{variant:`submit`,className:`rounded-full`,disabled:l||!i||!u.formState.isValid,children:`Save Changes`})]})})]})})]})})}async function rl({roleId:e}){let{data:t}=await u.delete(`/Role/${e}`,{id:e,deleted:!0});return t}function il(){return j({mutationFn:({roleId:e})=>rl({roleId:e})})}async function al({roleId:e,updatedRoleInfo:t}){let{data:n}=await u.put(`/Role/${e}`,t);return n}function ol(){return j({mutationFn:({roleId:e,updatedRoleInfo:t})=>al({roleId:e,updatedRoleInfo:t})})}function sl({organizationId:e,roleId:t}){return I({queryKey:[e,`roles`,t],queryFn:()=>cl(t),refetchInterval:10*1e3})}async function cl(e){let{data:t}=await u.get(`/Role/${e}`);return t}function ll({onRoleDeleteClick:e,setIsConfirmingRoleDeletion:t,isRoleDeletionPending:n}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Q,{children:`Confirm Role Deletion`}),(0,B.jsx)(go,{children:`Are you sure you want to delete this role? This action cannot be undone.`}),(0,B.jsxs)(Z,{children:[(0,B.jsx)(R,{type:`button`,variant:`defaultOutline`,className:`rounded-full`,onClick:()=>t(!1),children:`Cancel`}),(0,B.jsx)(R,{variant:`destructiveOutline`,className:`rounded-full`,onClick:e,disabled:n,children:n?`Deleting...`:`Delete Role`})]})]})}function ul({data:e,isModalOpen:t,closeModal:n}){let r=qt(),{data:i}=We(sl({roleId:e.id,organizationId:e.organizationId})),a=Pr(),o=a.user&&a.user?.roles?.[e.organizationId]?.role===e.roleName,{update:s,remove:c}=Si(e.organizationId),{mutate:l,isPending:u}=ol(),{mutate:d,isPending:f}=il(),[p,m]=(0,z.useState)(!1),h=k({resolver:O(el),defaultValues:{name:e.roleName,update:i.organization.update||!1,delete:i.organization.delete||!1}}),g=(0,z.useCallback)(()=>{d({roleId:e.id},{onSuccess:()=>{N.success(`Role deleted successfully!`),n(!0),h.reset()},onError:e=>{N.error(`Error`,{description:`Failed to delete role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}})}})},[e.id,d,h,n]),[_,v]=(0,z.useState)(!0),[y,b]=(0,z.useState)(JSON.stringify({roles:{...i.organization.roles},clusters:{...i.organization.clusters}},null,2)),x=(0,z.useCallback)(e=>{v(e.length===0)},[v]),ee=(0,z.useCallback)(async t=>{if(!s)return;let i=No(y);if(!i)return;let a={...t,...i,organizationId:e.organizationId};y&&_&&l({roleId:e.id,updatedRoleInfo:a},{onSuccess:async()=>{N.success(`Role updated successfully!`),await r.invalidateQueries({queryKey:[e.organizationId,`roles`,e.id]}),n(!1),h.reset()},onError:e=>{N.error(`Error`,{description:`Failed to update role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>N.dismiss()}})}})},[n,e.id,e.organizationId,h,_,r,i,s,y,l]);return(0,B.jsx)(Y,{onOpenChange:(0,z.useCallback)(()=>n(!1),[n]),open:t,children:(0,B.jsx)(X,{children:p?(0,B.jsx)(ll,{onRoleDeleteClick:g,setIsConfirmingRoleDeletion:m,isRoleDeletionPending:f}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Q,{children:[o||!s?`View`:`Edit`,` Organization Role "`,e.roleName,`"`]}),(0,B.jsx)(H,{...h,children:(0,B.jsxs)(`form`,{id:`org-edit-role-form`,name:`org-edit-role-form`,className:`grid grid-cols-2 gap-4 my-4`,onSubmit:h.handleSubmit(ee),children:[(0,B.jsx)(W,{control:h.control,name:`name`,render:({field:e})=>(0,B.jsxs)(G,{className:`col-span-2`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`Role Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,className:``,...e,disabled:!0,readOnly:!0})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:h.control,name:`update`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Update Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,disabled:o||!s,readOnly:o||!s,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:h.control,name:`delete`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Can Delete Organization`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`checkbox`,className:`w-6 ml-2`,disabled:o||!s,readOnly:o||!s,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(`div`,{className:`col-span-2`,children:(0,B.jsx)(Be,{theme:`vs-dark`,height:`300px`,defaultLanguage:`json`,onValidate:x,onChange:e=>{e&&b(e)},options:o||!s?{readOnly:!0}:void 0,defaultValue:y})}),!o&&(c||s)&&(0,B.jsx)(Z,{className:`col-span-2`,children:(0,B.jsxs)(`div`,{className:`flex justify-between w-full`,children:[c&&(0,B.jsx)(R,{type:`button`,variant:`destructiveOutline`,className:`rounded-full`,onClick:()=>m(!0),disabled:u,children:`Delete Role`}),s&&(0,B.jsx)(R,{variant:`submit`,className:`rounded-full`,disabled:!_||u||!h.formState.isValid||!h.formState.isDirty,children:`Save Changes`})]})})]})})]})})})}function dl(){let e=L(),t=qt(),{organizationId:n,orgRoleId:r}=P({strict:!1}),{create:i}=Si(n),{data:a,refetch:o,isFetching:s,isRefetching:c}=We(Xc(n)),l=(0,z.useMemo)(()=>a&&a?.find(e=>e.id===r),[a,r]),u=!!r&&!!l,[d,f]=(0,z.useState)(!1),p=(0,z.useCallback)(async(i,a)=>{await e({to:[r?`..`:``,i].filter(Boolean).join(`/`)}),a&&await t.invalidateQueries({queryKey:[n,`roles`],refetchType:`active`})},[r,e,t]),m=(0,z.useCallback)(()=>{f(!0)},[f]),h=(0,z.useCallback)(e=>p(e.original.id,!1),[p]),g=(0,z.useCallback)(e=>p(void 0,e),[p]),_=Wc(o);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,B.jsxs)(z.Suspense,{fallback:(0,B.jsx)(Bo,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,B.jsxs)(zc,{data:a,columns:Zc,onRowClick:h,children:[(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:_,accessKey:`r`,disabled:s||c,children:[(0,B.jsx)(wn,{}),(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]}),i&&(0,B.jsxs)(R,{variant:`positiveOutline`,onClick:m,accessKey:`a`,disabled:d,children:[(0,B.jsx)(pr,{}),(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`u`,{children:`A`}),`dd`]})]})]}),i&&(0,B.jsx)(nl,{isModalOpen:d,setIsModalOpen:f}),u&&(0,B.jsx)(ul,{data:l,isModalOpen:u,closeModal:g})]})})]})}var fl=[{header:`User Id`,accessorKey:`id`,enableSorting:!1},{header:`Email`,accessorKey:`email`,enableSorting:!1},{header:`First Name`,accessorKey:`firstname`,enableSorting:!1},{header:`Last Name`,accessorKey:`lastname`,enableSorting:!1},Ie().display({header:`Roles`,enableSorting:!1,id:`roles`,cell:e=>e.row.original.roles?.map(e=>e.roleName)?.sort()?.join(`, `)}),{header:`Status`,accessorKey:`status`,enableSorting:!1},{header:`Verified`,accessorKey:`isVerified`,enableSorting:!1}],pl=T.object({email:da.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:T.string().nonempty({error:`Please select a role.`})});async function ml(e){let{data:t}=await u.post(`/OrganizationRole/`,e);return t}function hl(){return j({mutationFn:e=>ml(e)})}T.object({email:da.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:T.string().nonempty({error:`Please select a role.`})});async function gl(e){let{data:t}=await u.post(`/UserInvite/`,e);return t}function _l(){return j({mutationFn:e=>gl(e)})}function vl({isModalOpen:e,onChangesSaved:t,setIsModalOpen:n}){let{organizationId:r}=P({strict:!1}),{data:i}=We(Xc(r)),[a,o]=(0,z.useState)(!1),s=k({resolver:O(pl),defaultValues:{email:``,roleId:``}}),{mutate:c,isPending:l}=hl(),{mutate:u,isPending:d}=_l(),f=(0,z.useCallback)(async e=>{e&&(a?u:c)(e,{onSuccess:()=>{let r=e.roleId;s.reset(),s.setValue(`roleId`,r),t(),N.success(`User invited successfully!`),n(!1),o(!1)},onError:e=>{e?.status===404&&o(!0)}})},[c,s,u,t,n,a]);return(0,B.jsx)(Y,{onOpenChange:()=>{n(!1),o(!1),s.reset()},open:e,children:(0,B.jsx)(X,{"aria-describedby":void 0,children:(0,B.jsx)(H,{...s,children:(0,B.jsxs)(`form`,{id:`org-add-user-form`,name:`org-add-user-form`,onSubmit:s.handleSubmit(f),className:`grid gap-4 my-4`,children:[(0,B.jsx)(ho,{children:(0,B.jsx)(Q,{children:a?`Invite User`:`Add User`})}),(0,B.jsx)(W,{control:s.control,name:`email`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Email`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`email`,enterKeyHint:`next`,autoComplete:`email`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:s.control,name:`roleId`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Roles`}),(0,B.jsx)(z.Suspense,{fallback:(0,B.jsx)(js,{}),children:(0,B.jsx)(U,{children:(0,B.jsxs)(Ms,{...e,onValueChange:t=>e.onChange(t),children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Choose Role`})}),(0,B.jsx)(Is,{children:(0,B.jsxs)(Ns,{children:[(0,B.jsx)(Ls,{children:`Role`}),i?.map(e=>(0,B.jsx)($,{value:e.id,children:e.roleName},e.id))]})})]})})}),(0,B.jsx)(q,{})]})}),a&&(0,B.jsxs)(go,{className:`p-3 my-5 text-white rounded-md bg-amber-600 flex`,children:[(0,B.jsx)(Oe,{className:`inline-block size-12 pr-2`}),(0,B.jsx)(`span`,{children:`This person doesn’t have a Fabric account. Do you want to invite them?`})]}),(0,B.jsx)(Z,{children:(0,B.jsx)(`div`,{className:`flex justify-between w-full`,children:(0,B.jsxs)(R,{type:`submit`,variant:`submit`,className:`rounded-full`,disabled:l||d,children:[(0,B.jsx)(yn,{}),` `,a?`Invite User`:`Add User`]})})})]})})})})}async function yl({roleId:e,userId:t}){let{data:n}=await u.delete(`/OrganizationRole/role/${e}/user/${t}`);return n}function bl(){return j({mutationFn:({roleId:e,userId:t})=>yl({roleId:e,userId:t})})}function xl(e){let[t,n]=(0,z.useState)(e||!1);return[t,(0,z.useCallback)(e=>{n(typeof e==`boolean`?e:e.target.checked)},[])]}function Sl({data:e,readOnly:t,canRemove:n,orgRole:r,selectedRoles:i,setChangesMade:a}){let{mutate:o,isPending:s}=hl(),{mutate:c,isPending:l}=bl(),u=!!i[r.roleName],[d,f]=(0,z.useState)(u),[p,m]=xl(u);return(0,z.useEffect)(()=>{p!==d&&(p?o({email:e.email,roleId:r.id},{onSuccess:()=>{f(p),a(!0),N.success(`Role added successfully`)}}):c({userId:e.id,roleId:r.id},{onSuccess:()=>{f(p),a(!0),N.success(`Role removed successfully`)}}))},[o,e.email,e.id,p,r.id,c,a,d]),(0,B.jsxs)(na,{className:`flex`,children:[(0,B.jsx)(J,{type:`checkbox`,className:`w-6`,disabled:t||s||l||!n&&p,checked:p,onChange:m}),(0,B.jsx)(`span`,{className:`pl-4 pr-8 flex-1 py-2.5`,children:r.roleName})]},r.id)}function Cl({closeModal:e,data:t,isModalOpen:n,onUserUpdated:r}){let{organizationId:i}=P({strict:!1}),a=Pr(),{update:o,remove:s}=Si(i),c=a.user?.email===t.email,{data:l}=We(Xc(i)),u=(0,z.useMemo)(()=>t.roles?Zo(t.roles,`roleName`):{},[t]),[d,f]=(0,z.useState)(!1);return(0,B.jsx)(Y,{onOpenChange:d?r:e,open:n,children:(0,B.jsxs)(X,{className:`sm:max-w-[750px]`,children:[(0,B.jsx)(ho,{children:(0,B.jsxs)(Q,{children:[o?`Edit `:`View `,` `,t.email,` `,c?`(yourself)`:``]})}),o&&(0,B.jsxs)(go,{children:[`To remove `,c?`your self`:`this user`,` from the organization, uncheck all of the boxes below.`]}),l.map(e=>(0,B.jsx)(Sl,{readOnly:!o,canRemove:s,data:t,orgRole:e,selectedRoles:u,setChangesMade:f},e.id))]})})}function wl(e,t){return e.email>t.email?1:-1}function Tl(){let e=L(),{organizationId:t,orgUserId:n}=P({strict:!1}),{update:r}=Si(t),{data:i,refetch:a,isFetching:o,isRefetching:s}=We(Xc(t)),c=(0,z.useMemo)(()=>{let e={};for(let t of i)if(t.users)for(let n of t.users)e[n.id]||(e[n.id]={...n,roles:[]}),e[n.id].roles.push(t);return Object.values(e).sort(wl)},[i]),l=(0,z.useMemo)(()=>c?.find(e=>e.id===n),[c,n]),u=(0,z.useCallback)(t=>{e({to:[n?`..`:``,t].filter(Boolean).join(`/`)})},[n,e]),d=!!n&&!!l,[f,p]=(0,z.useState)(!1),[m]=(0,z.useState)({attribute:`email`,descending:!1}),h=(0,z.useMemo)(()=>[{desc:m.descending,id:m.attribute}],[m]),g=(0,z.useCallback)(()=>{p(!0)},[p]),_=(0,z.useCallback)(()=>{a(),p(!1)},[a,p]),v=(0,z.useCallback)(e=>{u(e.original.id)},[u]),y=(0,z.useCallback)(()=>{u(void 0)},[u]),b=(0,z.useCallback)(()=>{a(),u(void 0)},[u,a]),x=Wc(a);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsxs)(z.Suspense,{fallback:(0,B.jsx)(Bo,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,B.jsxs)(zc,{data:c,isFetching:o||s,columns:fl,onRowClick:v,sortingState:h,children:[(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:x,accessKey:`r`,disabled:o||s,children:[(0,B.jsx)(wn,{}),` `,(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]}),r&&(0,B.jsxs)(R,{variant:`positiveOutline`,onClick:g,accessKey:`a`,disabled:f,children:[(0,B.jsx)(pr,{}),` `,(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`u`,{children:`A`}),`dd`]})]})]}),r&&(0,B.jsx)(vl,{isModalOpen:f,onChangesSaved:_,setIsModalOpen:p}),d&&(0,B.jsx)(Cl,{closeModal:y,data:l,isModalOpen:d,onUserUpdated:b})]})})]})}function El({organizationRole:e,onDeleteOrgModal:t}){let{organizationId:n,organizationName:r,roleName:i}=e,{remove:a,update:o}=xi(n),s=o,{view:c}=Si(n),l=(0,z.useCallback)(()=>{t(e)},[t,e]);return(0,B.jsxs)(zr,{className:`relative h-full justify-between`,children:[(0,B.jsxs)(Br,{children:[(0,B.jsxs)(Hr,{className:`flex items-center justify-between`,children:[(0,B.jsx)(`span`,{className:`truncate`,children:n}),a&&(0,B.jsxs)(yo,{children:[(0,B.jsx)(bo,{className:`p-4 -m-4 -mr-6 hover:text-white`,children:(0,B.jsx)(ht,{"aria-label":`Options`})}),(0,B.jsxs)(xo,{children:[(0,B.jsx)(wo,{className:`text-gray-600 text-xs`,children:`Options`}),(0,B.jsx)(To,{}),(0,B.jsx)(M,{to:`${n}`,children:(0,B.jsx)(So,{children:`Clusters`})}),c&&(0,B.jsx)(M,{to:`${n}/roles`,children:(0,B.jsx)(So,{children:`Roles`})}),c&&(0,B.jsx)(M,{to:`${n}/users`,children:(0,B.jsx)(So,{children:`Users`})}),s&&(0,B.jsx)(M,{to:`${n}/billing`,children:(0,B.jsx)(So,{children:`Billing`})}),(0,B.jsx)(To,{}),a&&(0,B.jsx)(So,{className:`focus:bg-red/70 focus:text-white`,onClick:l,children:`Delete`})]})]})]}),(0,B.jsx)(Vr,{children:(0,B.jsx)(`h2`,{children:r})})]}),(0,B.jsxs)(Ur,{className:`flex justify-between`,children:[(0,B.jsx)(vo,{children:Xi(i)}),(0,B.jsx)(M,{to:n,className:`text-sm`,"aria-label":`View ${r}`,title:`View ${r}`,children:(0,B.jsxs)(`span`,{className:`py-2 transition-all duration-100 ease-in-out border-0 hover:border-b-2`,children:[`View `,(0,B.jsx)(ve,{className:`inline-block`})]})})]})]})}async function Dl(e){let{data:t}=await u.delete(`/Organization/${e}`);return t}function Ol(){return j({mutationFn:e=>Dl(e)})}async function kl(e){let{data:t}=await u.post(`/Organization/`,{...e});return t}function Al(){return j({mutationFn:e=>kl(e)})}var jl=C().max(62,{error:`Must be at most 62 characters long.`}).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/,{error:`Please only use lowercase letters, digits and dashes (-) in the subdomain. Must not start or end with a dash.`}),Ml=D({name:C().max(255,{error:`Name cannot be longer than 255 characters.`}),subdomain:ae([S(``),te(),jl])});function Nl(){let{user:e}=Pr(),t=L(),n=k({resolver:O(Ml),defaultValues:{name:``,subdomain:``}}),{setFocus:i,watch:a}=n;(0,z.useEffect)(()=>{i(`name`)},[i]);let o=`${e?.firstname} ${e?.lastname} Org`,s=a(`name`)||o,c=a(`subdomain`),l=(0,z.useMemo)(()=>{let e=cs(us(s),jl.maxLength);return{suggestedSubdomain:e,fullHostName:`future-cluster-names.${c||e}.harperfabric.com`}},[s,c]),{mutate:u,isPending:f}=Al(),p=qt(),h=(0,z.useCallback)(async e=>{u({name:e.name||o,subdomain:e.subdomain||l.suggestedSubdomain},{onSuccess:e=>{p.invalidateQueries({queryKey:r,refetchType:`active`}),m.reloadUser(d),t({to:`/${e.id}`})}})},[l.suggestedSubdomain,p,u,o,t]);return(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(H,{...n,children:(0,B.jsxs)(`form`,{id:`org-add-form`,name:`org-add-form`,onSubmit:n.handleSubmit(h),className:`grid gap-6 text-white max-w-xl`,children:[(0,B.jsx)(W,{control:n.control,name:`name`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,maxLength:Ml.shape.name.maxLength,autoCapitalize:`words`,placeholder:o,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:n.control,name:`subdomain`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Subdomain`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,maxLength:jl.maxLength,autoCapitalize:`none`,placeholder:l.suggestedSubdomain,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{className:`pb-1`,children:`Full Host Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(`span`,{children:l.fullHostName})}),(0,B.jsx)(q,{})]}),(0,B.jsx)(Z,{children:(0,B.jsxs)(R,{type:`submit`,variant:`submit`,className:`rounded-full`,disabled:f,children:[`Create New Organization `,(0,B.jsx)(ve,{})]})})]})})})}function Pl(){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsx)(Nl,{})})]})}function Fl(){let e=qt(),{data:t}=We(_()),{mutate:n,isPending:r}=Ol(),[i,a]=(0,z.useState)(!1),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(``),u=(0,z.useCallback)(()=>l(``),[]),d=(0,z.useMemo)(()=>{let e=t?.roles||{},n=Object.values(e);return Object.keys(e).map((e,t)=>({organizationId:e,organizationName:n[t].organizationName,roleName:n[t].role})).filter(yc([`organizationId`,`organizationName`],c)).sort((e,t)=>(e.organizationName||``)>(t.organizationName||``)?1:-1)||[]},[c,t?.roles]),f=(0,z.useCallback)(e=>{l(e.currentTarget.value?.toLowerCase()||``)},[]),p=(0,z.useCallback)(t=>{t?.organizationId&&n(t.organizationId,{onSuccess:()=>{N.success(`Success`,{description:`Organization successfully deleted.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>N.dismiss()}}),e.invalidateQueries({queryKey:[]}),a(!1)},onError:()=>a(!1)})},[n,e,a]),m=(0,z.useCallback)(e=>{s(e),a(!0)},[]),{createCluster:h}=me({strict:!1});return d.length===1&&!c.length&&h?(0,B.jsx)(_t,{to:`/${d[0].organizationId}/new-cluster`,replace:!0}):!d.length&&!c.length?(0,B.jsx)(Pl,{}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{children:(0,B.jsxs)(`div`,{className:`flex w-full justify-end gap-2`,children:[(0,B.jsx)(J,{placeholder:`Filter by name`,className:`inline-block w-full text-xs`,value:c,onChange:f}),(0,B.jsx)(M,{to:`/new-org`,children:(0,B.jsxs)(R,{variant:`positive`,accessKey:`n`,children:[(0,B.jsx)(pr,{}),(0,B.jsxs)(`span`,{className:`hidden sm:inline-block`,children:[(0,B.jsx)(`u`,{children:`N`}),`ew `,(0,B.jsx)(`span`,{className:`hidden md:inline-block`,children:`Organization`})]})]})})]})}),(0,B.jsx)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-12`,children:[d.map(e=>(0,B.jsx)(`div`,{className:`col-span-1 md:col-span-4 lg:col-span-3 2xl:col-span-2`,children:(0,B.jsx)(El,{organizationRole:e,onDeleteOrgModal:m})},e.organizationId)),!d.length&&(0,B.jsxs)(`div`,{className:`col-span-1 md:col-span-12 text-center`,children:[(0,B.jsx)(`h2`,{className:`my-4 text-xl`,children:`No matches found.`}),(0,B.jsx)(R,{variant:`outline`,onClick:u,children:`Clear Filters`})]})]})}),o&&(0,B.jsx)(_o,{typeOfThingBeingDeleted:`organization`,nameOfThingBeingDeleted:o.organizationName,isModalOpen:i,setIsModalOpen:()=>a(!1),deletionConfirmed:()=>p(o),deletionPending:r})]})}function Il(){let{isLoading:e}=Nr(),{createCluster:t}=me({strict:!1}),[,n]=Io(Lo.SavedClusterState,null);return(0,z.useEffect)(()=>{t&&n(t)},[t,n]),e?(0,B.jsx)(Bo,{className:`fixed z-50 translate-1/2`}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-black-dark dark:bg-black-dark dark:border-b dark:border-black md:px-12`,children:(0,B.jsx)(ji,{})}),(0,B.jsx)(`main`,{children:(0,B.jsx)($e,{})})]})}var Ll=[`/`,`/forgot-password`,`/reset-password`,`/sign-in`,`/sign-up`,`/verify-email`];function Rl(){let e=xc();return!Ll.includes(e)&&{redirect:e}}var zl=A({getParentRoute:()=>ri,id:`_dashboardLayout`,component:Il,beforeLoad:({context:e})=>{let t=e.authentication[d];if(t&&!t.isLoading&&!t.user)throw It({to:`/sign-in`,search:Rl()})}}),Bl=A({getParentRoute:()=>zl,id:`_orgsLayout`});A({getParentRoute:()=>Bl,path:`/`,component:Fl}),A({getParentRoute:()=>Bl,path:`/new-org`,component:Pl});var Vl=A({getParentRoute:()=>Bl,path:`$organizationId`,beforeLoad:async e=>({organization:await e.context.queryClient.ensureQueryData(os(e.params.organizationId))})});A({getParentRoute:()=>Vl,path:`/roles`,component:dl}),A({getParentRoute:()=>Vl,path:`/roles/$orgRoleId`,component:dl}),A({getParentRoute:()=>Vl,path:`/users`,component:Tl}),A({getParentRoute:()=>Vl,path:`/users/$orgUserId`,component:Tl}),Jc(Vl);var Hl=A({getParentRoute:()=>Vl,id:`_clusterLayout`});A({getParentRoute:()=>Hl,path:`/`,component:bc}),A({getParentRoute:()=>Vl,path:`/new-cluster`,component:hc}),A({getParentRoute:()=>Wl,path:`/edit`,component:hc});function Ul(){return(0,B.jsx)($e,{})}var Wl=A({getParentRoute:()=>Hl,path:`$clusterId`,component:Ul,beforeLoad:async({context:e,params:t})=>({cluster:await e.queryClient.ensureQueryData(ua(t.clusterId))})});function Gl({children:e,className:t}){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:y(`mt-32 px-4 py-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))] flex justify-center`,t),children:e})]})}var Kl=new Set([`com`,`co`,`org`,`net`,`edu`,`gov`,`mil`,`me`,`biz`,`info`,`ac`,`or`,`ne`,`go`,`lg`,`asn`,`id`,`nom`,`sch`,`ltd`,`plc`]);function ql(e){let t=e.split(`.`);if(t.length<=2)return`@`;let n=t[t.length-1],r=t[t.length-2],i=n.length===2&&Kl.has(r)?3:2;return t.length<=i?`@`:t.slice(0,-i).join(`.`)}function Jl({cluster:{fqdn:e},domain:{domain:t,id:n}}){let r=ql(t),[i,a,o]=Mo(r,e||``,n);return(0,B.jsxs)(`div`,{className:`grid gap-4 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap`,children:`This domain has been verified! Now to associate it with this cluster, add the following to your DNS registrar:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordName`,value:r,onClick:i}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:i,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordTarget`,value:e,onClick:a}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:a,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`domainId`,value:n,onClick:o}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:o,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]})}),(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap italic text-sm`,children:`Select this domain using the checkbox to the left, then click "Bind" in the top right to finish associating it with this cluster.`})]})}function Yl({certificate:e,domain:t,cluster:n}){let r=ql(t.domain),[i,a,o]=Mo(r,n.fqdn||``,t.id),s=(0,z.useMemo)(()=>e.issueDate&&!e.inProgress?{width:`100%`,color:`bg-green/80`,pulse:!1,text:`Certificate Issued`}:e.inProgress?{width:`100%`,color:`bg-yellow/80`,pulse:!0,text:`Generating Certificate...`}:{width:`100%`,color:`bg-gray-600`,pulse:!1,text:`Pending Certificate Generation...`},[e]);return(0,B.jsxs)(`div`,{className:`w-full max-w-2xl border border-border/50 rounded-md p-4 bg-gray-900/20`,children:[(0,B.jsxs)(`div`,{className:`mb-4`,children:[(0,B.jsx)(`div`,{className:`w-full h-1.5 rounded-full overflow-clip flex shadow-sm bg-gray-800`,children:(0,B.jsx)(`div`,{style:{width:s.width},className:`grow transition-[width] duration-1000 ease-in-out motion-reduce:transition-none ${s.color} ${s.pulse?`animate-pulse`:``}`})}),(0,B.jsx)(`div`,{className:`text-[10px] text-muted-foreground font-light mt-1 italic`,children:s.text})]}),(0,B.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] text-sm`,children:[(0,B.jsx)(`div`,{className:`col-span-1 text-xs text-muted-foreground`,children:`CNAME:`}),(0,B.jsxs)(`div`,{className:`col-span-1 flex gap-2 items-center flex-wrap`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 px-2 py-0.5 rounded text-xs`,children:[(0,B.jsx)(`span`,{className:`truncate max-w-[150px]`,title:r,children:r}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:i,title:`Copy Name`,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]}),(0,B.jsx)(Xl,{}),(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 px-2 py-0.5 rounded text-xs`,children:[(0,B.jsx)(`span`,{className:`truncate max-w-[200px]`,title:n.fqdn||``,children:n.fqdn}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:a,title:`Copy Target`,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]})]}),(0,B.jsx)(`div`,{className:`col-span-1 text-[10px] text-muted-foreground`,children:`Domain ID:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800/50 px-2 py-0.5 rounded text-[10px] text-muted-foreground italic`,children:[(0,B.jsx)(`span`,{className:`truncate max-w-[200px]`,children:t.id}),(0,B.jsx)(R,{type:`button`,variant:`ghost`,size:`sm`,className:`h-3 w-3 p-0`,onClick:o,title:`Copy ID`,children:(0,B.jsx)(Hn,{className:`w-2.5 h-2.5`})})]})})]})]})}function Xl(){return(0,B.jsxs)(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:`w-3 h-3 text-muted-foreground`,children:[(0,B.jsx)(`path`,{d:`M5 12h14`}),(0,B.jsx)(`path`,{d:`m12 5 7 7-7 7`})]})}function Zl(e){let{enabled:t,entityId:n,databaseName:r,tableName:i,searchAttribute:a,sort:o,pageIndex:s,pageSize:c,onlyIfCached:l}=e;return I({enabled:t,queryKey:[n,r,i,`search_by_value`,a,o.attribute||`default`,o.descending||!1,s||0,c||0,l],retry:!1,staleTime:6e4,gcTime:5e3,queryFn:()=>Ql(e)})}async function Ql({instanceClient:e,databaseName:t,tableName:n,searchAttribute:r,sort:i,pageIndex:a,pageSize:o,onlyIfCached:s,headers:c}){let l=i.attribute.length&&!(i.attribute===r&&!i.descending),u=await e.post(`/`,{operation:`search_by_value`,get_attributes:[`*`],database:t,table:n,search_attribute:r,search_value:`*`,sort:l?i:void 0,offset:a*o,limit:o,onlyIfCached:s,noCacheStore:s},{timeout:0,headers:c,validateStatus:e=>e>=200&&e<400||e===404});return u.status===404?{data:[]}:u}function $l(e){return I({queryKey:[e,`ChallengeCertificate`],queryFn:async()=>{if(!e)return[];let{data:t}=await Ql({searchAttribute:`domain`,entityId:e,databaseName:`data`,tableName:`ChallengeCertificate`,sort:{attribute:`domain`,descending:!0},enabled:!0,instanceClient:i({id:e,forceFabricConnect:!0}),onlyIfCached:!1,pageIndex:0,pageSize:100});return t},enabled:!!e,refetchInterval:5e3})}function eu(e){return F($l(e))}function tu({domain:{challengeToken:e,challengeTxtRecord:t,domain:n,id:r},cluster:{fqdn:i}}){let a=ql(n),[o,s,c,l,u]=Mo(t,e,a,i||``,r);return(0,B.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap`,children:`Prove that you own this domain by adding the following to your DNS registrar:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TXT`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`challengeName`,value:t,onClick:o}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:o,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Content:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`challengeToken`,value:e,onClick:s}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:s,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap mt-4`,children:`While you're at it, you should also add the CNAME record to point to this cluster:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordName`,value:a,onClick:c}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:c,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,B.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-700 rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`recordTarget`,value:i,onClick:l}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:l,children:(0,B.jsx)(Hn,{className:`w-3.5 h-3.5`})})]})}),(0,B.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,B.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1 bg-gray-800 rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,B.jsx)(`input`,{className:`bg-transparent border-none outline-none w-full cursor-text truncate`,type:`text`,readOnly:!0,name:`domainId`,value:r,onClick:u}),(0,B.jsx)(R,{type:`button`,size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:u,children:(0,B.jsx)(Hn,{className:`w-3 h-3`})})]})}),(0,B.jsx)(`div`,{className:`text-muted-foreground md:col-span-2 text-wrap mt-2`,children:`Then after your DNS TTL elapses, click the "Validate" button above.`})]})}async function nu({clusterId:e,domainIds:t,generateDomainCerts:n}){let{data:r}=await u.put(`/Cluster/${e}`,{domainIds:t,generateDomainCerts:n},{timeout:0});return r}function ru(){return j({mutationFn:e=>nu(e)})}T.object({domainId:T.string()});async function iu(e){let{data:t}=await u.delete(`/Domain/${e.domainId}`);return t}function au(){return j({mutationFn:e=>iu(e)})}function ou(e){return[...new Set(e)]}var su=Ie();function cu(e,t,n){let{data:r}=eu(e.id),i=(0,z.useMemo)(()=>!!r?.some(e=>!e.issueDate||e.inProgress),[r]),{mutate:a,isPending:o}=ru(),{mutate:s,isPending:c}=au(),l=o||c,u=(0,z.useCallback)((t,n)=>{if(!oo(e.status)){N.error(`Cluster is currently `+e.status,{description:`To bind a domain, it must be running.`});return}a({clusterId:e.id,domainIds:ou((e.domainIds?.slice()||[]).concat([t])),generateDomainCerts:n},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),N.success(`Domain bound!`+(n?` Certificates are being generated in the background now.`:``))}})},[a,e]),d=(0,z.useCallback)(t=>{s({domainId:t},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[e.organizationId,`domains`],refetchType:`active`}),N.success(`Domain removed!`)}})},[s]),f=(0,z.useCallback)(t=>{a({clusterId:e.id,domainIds:(e.domainIds?.slice()||[]).filter(e=>e!==t),generateDomainCerts:!1},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),N.success(`Domain unbound!`)}})},[s]);return(0,z.useMemo)(()=>[su.display({id:`select`,header:`Bind`,size:50,cell:r=>{let a=r.row.original;return a.status===`ACTIVE`&&!a.clusterId&&!Eo(e)?(0,B.jsx)(`label`,{className:`p-10 -m-10`,children:(0,B.jsx)(`input`,{type:`checkbox`,checked:t.includes(a.id),onChange:()=>n(a.id),disabled:l||i})}):null}}),su.display({header:`Domains`,id:`domain`,enableSorting:!1,size:150,cell:e=>{let t=e.row.original;return(0,B.jsxs)(Ki,{children:[(0,B.jsx)(qi,{asChild:!0,children:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{children:t.domain}),(0,B.jsx)(R,{variant:`destructiveGhost`,className:`text-muted-foreground text-xs`,disabled:l||!!t.clusterId,onClick:()=>d(t.id),children:`Remove Domain`})]})}),(0,B.jsx)(Ji,{side:`bottom`,align:`center`,children:t.clusterId?`To delete this domain, please unbind it from all clusters first.`:`Remember to clean up your DNS records!`})]})}}),su.display({header:`Next Steps`,enableSorting:!1,size:500,id:`nextSteps`,cell:t=>{let n=t.row.original,i=r?.find(e=>e.domain===n.domain);return n.status===`ACTIVE`&&n.clusterId?e.id===n.clusterId?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{children:`Bound to this cluster`}),i&&(!i.issueDate||i.inProgress)&&(0,B.jsx)(`div`,{className:`py-2`,children:(0,B.jsx)(Yl,{certificate:i,domain:n,cluster:e})}),(0,B.jsx)(R,{variant:`destructiveGhost`,className:`text-muted-foreground text-xs`,disabled:l,onClick:()=>f(n.id),children:`Unbind Domain`})]}):`Bound to cluster ${n.clusterId}`:n.status===`PENDING_VALIDATION`?(0,B.jsx)(tu,{domain:n,cluster:e}):Eo(e)?`Cannot be associated with this self-managed cluster.`:n.status===`ACTIVE`&&!n.clusterId?(0,B.jsx)(Jl,{cluster:e,domain:n}):n.status}})],[e,u,l,r,i,t,n])}var lu=T.object({domain:T.string(),organizationId:T.string()});async function uu(e){let{data:t}=await u.post(`/Domain/`,e);return t}function du(){return j({mutationFn:e=>uu(e)})}async function fu(e){let{data:t}=await u.post(`/Domain/${e}/validate`);return t}async function pu(e){let{data:t}=await u.get(`/Domain/?organizationId=${e}`);return t}function mu(e){return I({queryKey:[e,`domains`],queryFn:()=>pu(e)})}function hu(){let{organizationId:e,clusterId:t}=P({strict:!1}),{data:n}=We(ua(t,!0)),{update:r}=Si(e),{data:i,refetch:a,isFetching:o,isRefetching:s}=F(mu(e)),c=(0,z.useMemo)(()=>i?.filter(e=>e.status===`PENDING_VALIDATION`)||[],[i]),[l]=(0,z.useState)({attribute:`domain`,descending:!1}),u=(0,z.useMemo)(()=>[{desc:l.descending,id:l.attribute}],[l]),d=Wc(a),[f,m]=(0,z.useState)([]),h=(0,z.useCallback)(e=>{m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{mutate:g,isPending:_}=ru(),v=(0,z.useCallback)(()=>{if(!oo(n.status)){N.error(`Cluster is currently `+n.status,{description:`To bind a domain, it must be running.`});return}g({clusterId:n.id,domainIds:ou((n.domainIds?.slice()||[]).concat(f)),generateDomainCerts:!0},{onSuccess:()=>{Xr.invalidateQueries({queryKey:[n.organizationId],refetchType:`active`}),N.success(`Domain(s) bound! Certificates are being generated in the background now.`),m([])}})},[n,f,g]),{mutateAsync:y,isPending:b}=du(),x=k({resolver:O(lu),defaultValues:{domain:``,organizationId:e}}),ee=(0,z.useCallback)(async e=>{if(e){let t=e.domain.split(/[,\s]+/).map(e=>e.trim()).filter(Boolean);for(let n of t)await y({...e,domain:n});x.reset(),await a(),N.success(`${p(t.length,`Domain`,`Domains`)} added! Please add the txt record above to your domain registrar.`)}},[y,x,a]),S=(0,z.useCallback)(async()=>{let e=`Validating ${p(c.length,`domain`,`domains`)}...`,t=`validatingDomains`,n=0,r=0;for(let i of c)try{N.loading(e,{description:`${n++} of ${c.length} checked`,id:t}),await fu(i.id)}catch{r+=1}r>0?N.error(`Validation failed!`,{description:`Please make sure the TXT record has been put in place. You may need to wait a bit for the DNS change to propagate.`,id:t}):(await a(),N.success(`Validation succeeded!`,{description:`Please take a look at the next steps for newly verified domains.`,id:t}))},[c]),te=cu(n,f,h),C=x.watch(`domain`),w=(0,z.useMemo)(()=>typeof C==`string`?C.trim().split(`.`).length===2:!1,[C]),T=(0,z.useCallback)(()=>{typeof C==`string`&&x.setValue(`domain`,`${C.trim()}, www.${C.trim()}`)},[C,x]);return(0,B.jsx)(zc,{data:i||[],isFetching:o||s,columns:te,sortingState:u,children:(0,B.jsxs)(`div`,{className:`w-full flex flex-col md:flex-row items-center md:justify-between md:space-x-2 space-y-2 md:space-y-0`,children:[r&&(0,B.jsx)(H,{...x,children:(0,B.jsxs)(`form`,{id:`cluster-add-domain-form`,name:`cluster-add-domain-form`,onSubmit:x.handleSubmit(ee),className:`flex gap-1 flex-col md:flex-row`,children:[(0,B.jsx)(W,{control:x.control,name:`domain`,render:({field:e})=>(0,B.jsxs)(G,{className:`flex-1`,children:[(0,B.jsx)(K,{className:`pb-1`,children:`New Domain Name`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`text`,enterKeyHint:`done`,autoComplete:`off`,...e})}),w&&(0,B.jsxs)(`div`,{className:`mt-1 flex gap-4`,children:[`Adding an apex domain?`,(0,B.jsx)(R,{variant:`positiveOutline`,type:`button`,onClick:T,children:`Add www as well`})]}),(0,B.jsx)(q,{children:(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`Type in a domain like example.com or your.example.com, and you'll be guided through validating and binding your cluster to it.`})})]})}),(0,B.jsxs)(`div`,{className:`flex-0 self-start flex gap-1 md:pt-6.5`,children:[(0,B.jsxs)(R,{type:`submit`,variant:`submit`,disabled:b,children:[(0,B.jsx)(pr,{}),` Add`]}),c.length>0&&(0,B.jsxs)(R,{variant:`positiveOutline`,onClick:S,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,B.jsx)(An,{}),` `,(0,B.jsxs)(`span`,{children:[(0,B.jsx)(`u`,{children:`V`}),`alidate`]})]}),(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:d,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,B.jsx)(wn,{}),` `,(0,B.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,B.jsx)(`u`,{children:`R`}),`efresh`]})]})]})]})}),f.length>0&&(0,B.jsx)(`div`,{className:`flex-0 self-start md:pt-6.5`,children:(0,B.jsxs)(R,{variant:`submit`,onClick:v,disabled:_,children:[(0,B.jsx)(yn,{}),` Bind `,p(f.length,`Domain`,`Domains`)]})})]})})}function gu(){return(0,B.jsx)(Gl,{className:`flex flex-col justify-start max-w-4xl`,children:(0,B.jsx)(hu,{})})}var _u=D({username:pa,role:C().nonempty({error:`Please select a role.`}),password:fa.min(8,{error:`Password must be at least 8 characters long.`}),confirmPassword:C()}).refine(e=>e.password===e.confirmPassword,{error:`Passwords do not match.`,path:[`confirmPassword`]});async function vu(e){await u.patch(`/ResetPasswordUpdater/${e}`)}async function yu(e){let{instanceClient:t,...n}=e,{data:r}=await t.post(`/`,{operation:`add_user`,...n});return r}function bu(){return j({mutationFn:yu})}async function xu({username:e,password:t,role:n,active:r,instanceClient:i}){let{data:a}=await i.post(`/`,{operation:`alter_user`,username:e,password:t,role:n,active:r});return a}function Su(){return j({mutationFn:xu})}async function Cu({username:e,instanceClient:t}){let{data:n}=await t.post(`/`,{operation:`drop_user`,username:e});return n}function wu(){return j({mutationFn:Cu})}async function Tu({clusterId:e,initialUsername:t,desiredUsername:n,newPassword:r,tempPassword:i,instanceClient:a}){if(!i)throw Error(`You may not have permission to set the password on this cluster.`);let o=a;try{let a=await oa({username:t,password:i,instanceClient:o,entityId:e});return a.instanceClient&&(o=a.instanceClient),n===`HDB_ADMIN`?await xu({username:n,password:r,instanceClient:o}):(await yu({username:n,password:r,role:`super_user`,active:!0,instanceClient:o}),await oa({username:n,password:r,instanceClient:o,entityId:e}),await Cu({username:s,instanceClient:o})),await vu(e),a}catch(t){throw await h({entityId:e,instanceClient:o}),t}}function Eu(){return j({mutationFn:Tu})}function Du(){let{user:e}=Pr(),{clusterId:t}=P({strict:!1}),{data:r}=F(ua(t,!0)),i=L(),a=(0,z.useMemo)(()=>n(r),[r]),o=pi(a),{redirect:c}=me({strict:!1}),l=kt(),u=k({resolver:O(_u),defaultValues:{confirmPassword:``,password:``,role:`super_user`,username:e?.email??``}}),{setFocus:d,control:f,handleSubmit:p}=u;(0,z.useEffect)(()=>{d(`password`)},[d]);let h=r?.instances?.find(e=>e.tempPassword)?.tempPassword,{mutate:g,isPending:_}=Eu(),v=(0,z.useCallback)(async e=>{if(!a){N.error(`Cluster is not yet fully loaded, please wait a moment before trying to sign in.`);return}g({instanceClient:o,clusterId:t,newPassword:e.password,tempPassword:h,initialUsername:s,desiredUsername:e.username},{onSuccess:async({message:e,user:t})=>{N.success(e),m.setUserForEntity(r,t),l.invalidate(),await i({to:c?.startsWith(`/`)?c:`../`})}})},[r,t,o,i,a,c,l,g,h]);return r&&!r.resetPassword?(0,B.jsx)(_t,{to:`../sign-in`,replace:!0}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`nav`,{className:`fixed top-20 w-full h-12 z-39 px-4 md:px-12 bg-grey-700 flex items-center`,children:(0,B.jsx)(Qi,{})}),(0,B.jsx)(`div`,{className:`items-center justify-center flex mt-32 py-4 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,B.jsxs)(`div`,{className:`text-white w-xs`,children:[(0,B.jsx)(`h2`,{className:`text-2xl font-light`,children:`Create Admin User`}),(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:`You are ready to create your first user in your new cluster. These credentials belong to you alone, and you can create more users and roles once you create this first one.`}),(0,B.jsx)(H,{...u,children:(0,B.jsxs)(`form`,{id:`cluster-create-admin-form`,name:`cluster-create-admin-form`,onSubmit:p(v),className:`my-4`,children:[(0,B.jsx)(W,{control:f,name:`username`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Username`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{autoComplete:`username`,type:`text`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:f,name:`password`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:f,name:`confirmPassword`,render:({field:e})=>(0,B.jsxs)(G,{className:`my-4`,children:[(0,B.jsx)(K,{children:`Confirm Password`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`password`,...e})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(R,{disabled:_,type:`submit`,variant:`submit`,className:`w-full my-2 rounded-full`,children:`Create Admin User`})]})}),(0,B.jsxs)(`p`,{className:`text-muted-foreground flex gap-2 align-middle`,children:[(0,B.jsx)(Ee,{size:36,className:`flex-none`}),(0,B.jsx)(`span`,{children:`These credentials will be used to sign into your cluster directly, providing you a secure connection from your browser to your cluster.`})]})]})})]})}function Ou({columns:e,data:t}){let n=zt({data:t,columns:e,getCoreRowModel:Xe()});return(0,B.jsx)(`div`,{className:`bg-black-dark rounded-md`,children:(0,B.jsxs)(Mc,{children:[(0,B.jsx)(Nc,{children:n.getHeaderGroups().map(e=>(0,B.jsx)(Fc,{className:`border-none`,children:e.headers.map(e=>(0,B.jsx)(Ic,{className:`p-4`,style:{width:`${e.getSize()}%`},children:e.isPlaceholder?null:Mt(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,B.jsx)(Pc,{className:`bg-black`,children:n.getRowModel().rows?.length?n.getRowModel().rows.map(e=>(0,B.jsx)(Fc,{"data-state":e.getIsSelected()&&`selected`,className:`hover:bg-muted/10 data-[state=selected]:bg-muted`,children:e.getVisibleCells().map(e=>(0,B.jsx)(Rc,{className:`p-4`,style:{width:`${e.column.getSize()}%`},children:Mt(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,B.jsx)(Fc,{children:(0,B.jsx)(Rc,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})})}function ku(){return(0,B.jsx)(`div`,{className:`flex-col items-center justify-center px-16 space-y-3 text-center pt-30`,children:(0,B.jsx)(`p`,{children:`No instances found.`})})}function Au({isSelfManaged:e,instance:t}){let{user:n,isLoading:r}=Fr(t.id),i=pi((0,z.useMemo)(()=>c(t),[t])),{update:a}=Ti(),o=m.checkForFabricConnect(t.id),s=(0,z.useCallback)(async()=>{await h({instanceClient:i,entityId:t.id}),m.setUserForEntity(t,null)},[t,i]);return r||![`CLONE_READY`,`RUNNING`,`UPDATED`].includes(t.status)?(0,B.jsx)(fe,{className:`animate-spin`,color:`gray`}):!n||o?(0,B.jsxs)(`span`,{className:`flex gap-4`,children:[a&&!e&&(0,B.jsx)(M,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Connect to ${t.name} instance`,title:`Connect to ${t.name} instance`,children:(0,B.jsx)(R,{variant:`positiveOutline`,children:`Fabric Connect`})}),(0,B.jsx)(M,{to:`../instance/${t.id}/sign-in`,className:`text-sm`,"aria-label":`Sign in to ${t.name} instance`,title:`Sign in to ${t.name} instance`,children:(0,B.jsx)(R,{variant:a?`defaultOutline`:`positiveOutline`,children:`Direct Sign In`})})]}):(0,B.jsxs)(`span`,{className:`flex gap-4`,children:[(0,B.jsx)(M,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Go to ${t.name} instance`,title:`Go to ${t.name} instance`,children:(0,B.jsx)(R,{variant:`positiveOutline`,children:`Direct Connect`})}),(0,B.jsx)(R,{variant:`destructiveOutline`,className:`text-sm`,"aria-label":`Sign out from ${t.name} instance`,title:`Sign out from ${t.name} instance`,onClick:s,children:`Direct Sign Out`})]})}function ju(){let{clusterId:e}=P({strict:!1}),{data:t,isLoading:n}=F(ua(e,!0)),r=Eo(t),i=(0,z.useMemo)(()=>[{id:`instanceActions`,size:1,minSize:1,cell:e=>(0,B.jsx)(`div`,{className:`flex justify-end`,children:(0,B.jsx)(Au,{isSelfManaged:r,instance:e.row.original})})},r&&{accessorKey:`instanceFqdn`,size:90,header:`URL`,cell:e=>cc({secure:e.row.original.operationsApiSecure?`true`:`false`,port:e.row.original.operationsApiPort,fqdn:e.row.original.instanceFqdn})},!r&&{accessorKey:`name`,size:90,header:`Name`},!r&&{accessorKey:`status`,header:`Status`,size:1,minSize:1,cell:e=>{let t=e.getValue();return(0,B.jsx)(vo,{variant:ao(t),children:Xi(t)})}},!r&&{accessorKey:`version`,size:1,minSize:1,header:`Version`},!r&&{accessorKey:`storageGb`,size:1,minSize:1,header:`Storage`,cell:e=>qs(e.getValue(),1024**3)},!r&&{accessorKey:`cpuCores`,size:1,minSize:1,header:`Cores/Threads`,cell:e=>(0,B.jsxs)(B.Fragment,{children:[e.row.original.cpuCores,` / `,e.row.original.threads]})},!r&&{accessorKey:`memoryMb`,size:1,minSize:1,header:`Memory`,cell:e=>qs(e.getValue(),1024**2)}].filter(Zr),[r]),a=(0,z.useMemo)(()=>t?.instances?t.instances.filter(e=>e.status&&!ia.includes(e.status)).sort(Yo):[],[t]);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(io,{}),(0,B.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,B.jsx)(zr,{className:`p-0 mt-4 min-h-96`,children:(0,B.jsx)(Ur,{className:`p-0 min-h-96`,children:n?(0,B.jsx)(js,{}):a.length?(0,B.jsx)(Ou,{data:a,columns:i}):(0,B.jsx)(ku,{})})})})]})}function Mu(){let{clusterId:e}=P({strict:!1}),{data:t,isLoading:n}=F(ua(e,2e3)),r=t?.status,i=(0,z.useMemo)(()=>r&&ra.includes(r),[r]);return n||!t?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsx)(js,{})}):i?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`All done!`}),(0,B.jsx)(ko,{cluster:t,forceProgressBarVisible:!0}),(0,B.jsx)(`p`,{children:`Your cluster finished updating, and is ready for interaction.`}),(0,B.jsx)(`div`,{className:`text-center`,children:(0,B.jsx)(Do,{cluster:t})})]})}):(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,B.jsx)(ko,{cluster:t,forceProgressBarVisible:!0}),(0,B.jsxs)(`p`,{children:[`Your cluster is updating with the latest changes. This includes waiting several minutes to let traffic drain safely.`,` `,(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`We will let you know when we are ready for you to connect! In the meantime, join us on`,` `,(0,B.jsx)(`a`,{href:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,children:`Discord`}),`! Get real-time help from our engineers, see feature drops early, and connect with others building on Fabric.`]})]})]})})}function Nu(){let e=kt(),{clusterId:t}=P({strict:!1}),{data:n,isLoading:r}=F(ua(t,2e3)),i=n?.status,a=(0,z.useMemo)(()=>i&&ra.includes(i),[i]),o=so(i),[,s]=Io(Lo.SavedClusterState,null),c=(0,z.useCallback)(()=>{s(n),e.navigate({to:`/${n.organizationId}/new-cluster`})},[n,e,s]);return r||!n?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsx)(js,{})}):o?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4 items-center`,children:[(0,B.jsx)(rr,{className:`w-24 h-24`}),(0,B.jsxs)(`span`,{children:[`Your cluster failed to successfully start. This is usually caused by temporary communication problems. Would you like to try again? We also get notified about these failures. `,(0,B.jsx)(zo,{}),` if you want more help.`]}),(0,B.jsx)(R,{type:`button`,variant:`positiveOutline`,onClick:c,children:`Try Again`})]})}):a?(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`It's ready!`}),(0,B.jsx)(ko,{cluster:n,forceProgressBarVisible:!0}),(0,B.jsxs)(`p`,{children:[`Let's set up your secure, browser-to-cluster connection now.`,` `,(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Did you know during this step, you connect straight to your cluster, providing a private secure connection? That's `,(0,B.jsx)(`em`,{children:`Direct Connect`}),`! Once you create your user, you will have the option to`,` `,(0,B.jsx)(`em`,{children:`Fabric Connect`}),` from your Fabric account without having to sign in again.`]})]}),(0,B.jsx)(`div`,{className:`text-center`,children:(0,B.jsx)(Do,{cluster:n})})]})}):(0,B.jsx)(Gl,{className:`flex justify-center`,children:(0,B.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,B.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,B.jsx)(ko,{cluster:n,forceProgressBarVisible:!0}),(0,B.jsxs)(`p`,{children:[`Your cluster is spinning up with the latest changes, including your own DNS records and private connections. Please wait while we get everything going.`,` `,(0,B.jsxs)(`span`,{className:`text-muted-foreground`,children:[`We will let you know when we are ready for you to connect! In the meantime, join us on`,` `,(0,B.jsx)(`a`,{href:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,children:`Discord`}),`! Get real-time help from our engineers, see feature drops early, and connect with others building on Fabric.`]})]})]})})}A({getParentRoute:()=>Wl,path:`instances`,component:ju}),A({getParentRoute:()=>Wl,path:`starting-up`,component:Nu}),A({getParentRoute:()=>Wl,path:`scaling`,component:Mu}),A({getParentRoute:()=>Wl,path:`domains`,component:gu}),A({getParentRoute:()=>Wl,path:`sign-in`,component:ba,beforeLoad:({context:e,location:t,params:n})=>{let r=m.checkForFabricConnect(n.clusterId);if(e.authentication[n.clusterId]?.user&&!r){let e=t?.search;throw It({to:e?.redirect?.startsWith(`/`)?e.redirect:`../`})}}}),A({getParentRoute:()=>Wl,path:`instance/$instanceId/sign-in`,component:ba,beforeLoad:({context:e,location:t,params:n})=>{if(!(m.checkForFabricConnect(n.clusterId)||m.checkForFabricConnect(n.instanceId))&&e.authentication[n.instanceId]?.user){let e=t?.search;throw It({to:e?.redirect?.startsWith(`/`)?e.redirect:`../`})}}}),A({getParentRoute:()=>Wl,path:`finish-setup`,component:Du});function Pu(e){return A({getParentRoute:()=>e,path:`apis`}).lazy(()=>Ir(()=>import(`./index.lazy-C3Ejfvna.js`).then(e=>e.route),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])))}function Fu(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i of n)if(!r.includes(i)||e[i]!==t[i])return!1;return!0}function Iu(e,t){let[n,r]=(0,z.useState)(t),[i,a]=(0,z.useState)(e);return(0,z.useEffect)(()=>{Fu(n,t)||(r(t),a(e))},[n,t,e]),Fu(n,t)?[i,a]:[e,a]}var Lu={};function Ru(e,t,n){let r=(0,z.useCallback)((e,n)=>t(e,n),[n]);(0,z.useEffect)(()=>(Lu[e]||(Lu[e]=[]),Lu[e].push(r),function(){let t=Lu[e].indexOf(r);t>=0&&Lu[e].splice(t,1)}),[e,t,r])}function zu(e,t,n){let r=Lu[e];if(r)for(let e of r)e(t,n)}function Bu(e,t,n){return r=>zu(e,t,n??r)}function Vu(e,t,n){return(0,z.useCallback)(r=>zu(e,t,n??r),[e,t,n])}function Hu(e,t){return No(sessionStorage.getItem(String(e)))??t}function Uu(e,t){t==null?sessionStorage.removeItem(String(e)):sessionStorage.setItem(String(e),JSON.stringify(t))}function Wu(e,t){let n=Iu(Hu(e,t),[e]),[r,i]=n;return(0,z.useEffect)(()=>{Uu(e,r),zu(`Session:${e}`,r)},[e,r]),Ru(`Session:${e}`,function(e){r!==e&&i(e)},[r,e,t]),(0,z.useEffect)(function(){let n=n=>{n.key===e&&i(Hu(e,t))};return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}},[e,i,t]),n}function Gu(e,t=!1){let[n,r]=Wu(e,t),i=(0,z.useCallback)(e=>{e?.preventDefault?.(),r(e=>!e)},[r]),a=(0,z.useCallback)(e=>{e?.preventDefault?.(),r(!0)},[r]),o=(0,z.useCallback)(e=>{e?.preventDefault?.(),r(!1)},[r]);return(0,z.useMemo)(()=>({toggled:n,setToggled:r,toggle:i,toggleOn:a,toggleOff:o}),[i,r,o,a,n])}var Ku=(0,z.createContext)(null);function qu(){return(0,z.useContext)(Ku)}async function Ju({file:e,project:t,entityType:n,instanceClient:r}){let{data:i}=await r.post(`/`,{operation:`drop_component`,file:e||void 0,project:t,replicated:n===`cluster`});return i}function Yu(e){let t=(e||``)?.split(`.`);return t.length>1?t.slice(-1)[0]:``}function Xu(e){switch(Yu(e).toLowerCase()){case`jpg`:case`jpeg`:case`gif`:case`png`:case`pneg`:case`webp`:return!0;default:return!1}}async function Zu({instanceClient:e,file:t,project:n,encoding:r}){let{data:i}=await e.post(`/`,{operation:`get_component_file`,file:t,project:n,encoding:r??(Xu(t)?`base64`:`utf8`)});return{file:t,project:n,...i}}function Qu(e){return I({queryKey:$u(e),queryFn:()=>Zu(e),enabled:!!e.file&&!!e.project,retry:!1})}function $u(e){return[e.entityId,`get_component_file`,e.file,e.project,e.encoding]}async function ed({file:e,payload:t,project:n,entityType:r,instanceClient:i,encoding:a}){let{data:o}=await i.post(`/`,{operation:`set_component_file`,file:e,payload:t,project:n,encoding:a,replicated:r===`cluster`},{timeout:3e5});return o}function td(){return j({mutationFn:ed})}function nd(){let{reloadRootEntries:e,setFocusedItem:t,setSelectedItems:n}=qu(),r=V();return(0,z.useCallback)(async i=>{let a=!1,o=i.filter(e=>e.from!==e.to);if(o.length===0)return;let s=`Renaming ${p(o.length,`File`,`Files`)}`,c={duration:6e4,action:{label:`Cancel`,onClick:()=>{a=!0}}};c.id=N.loading(s,{...c,description:(0,B.jsx)($o,{animated:!0,width:`0%`})});let l=o.length*3,u=0;function d(){u+=1,N.loading(s,{...c,description:(0,B.jsx)($o,{animated:!0,width:(u===0?0:u/l*100)+`%`})})}for(let e of o){let t=e.from.split(`/`),n=t.shift(),i=t.join(`/`),o=e.to.split(`/`),s=o.shift(),c=o.join(`/`),l=await Zu({...r,file:i,project:n,encoding:`base64`});if(a||(d(),await ed({...r,file:c,project:s,encoding:`base64`,payload:l.message}),a)||(d(),await Ju({...r,file:i,project:n}),a))break;d()}u>=l?N.success(`Renamed ${p(o.length,`File`,`Files`)}`,{id:c.id,description:`All done!`,duration:3e3,action:{label:`OK`,onClick:()=>{}}}):N.warning(`Rename Cancelled`,{id:c.id,description:`${u} of ${l} steps completed.`,duration:1e4,action:{label:`OK`,onClick:()=>{}}}),e(),n(e=>{let t=e.slice();for(let e of o){let n=t.indexOf(e.from);n>=0?t.splice(n,1,e.to):t.push(e.to)}return t}),t(e=>{for(let t of o)if(e===t.from)return t.to;return e})},[r,e,t,n])}function rd(e,t){return e[t]!==void 0}function id(e){return t=>rd(t,e)}function ad(e,t){let[n,r]=(0,z.useState)({value:t});return Ru(e,(e,t)=>r({value:e,trigger:t}),[r]),n}function od(e,t,n){zu(e,t,n)}function sd(e,t,n){return r=>od(e,t,n??r)}function cd(e,t,n){return(0,z.useCallback)(r=>{od(e,t,n??r)},[e,t,n])}var ld=[{handleGlobal(e,t){if((t.cmd||t.ctrl)&&e===`Delete`)return od(`ShowDeleteDirectoryOrFileModal`,!0),!0},addEditorAction(e){return{id:`delete-file`,label:`Delete File`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.Delete],run:sd(`ShowDeleteDirectoryOrFileModal`,!0)}}},{handleGlobal(e,t){if(t.ctrl&&t.alt&&t.shift&&e===`˜`)return od(`ShowAddDirectoryOrFileModalType`,`directory`),!0},addEditorAction(e){return{id:`new-directory`,label:`New Directory`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyMod.Shift|e.KeyCode.KeyN],run:sd(`ShowAddDirectoryOrFileModalType`,`directory`)}}},{handleGlobal(e,t){if(t.ctrl&&e===`n`)return od(`ShowAddDirectoryOrFileModalType`,`file`),!0},addEditorAction(e){return{id:`new-file`,label:`New File`,keybindings:[e.KeyMod.WinCtrl|e.KeyCode.KeyN],run:sd(`ShowAddDirectoryOrFileModalType`,`file`)}}},{handleGlobal(e){if(e===`F2`)return od(`ShowRenameFileModal`,`file`),!0},addEditorAction(e){return{id:`rename-file`,label:`Rename File`,keybindings:[e.KeyMod.WinCtrl|e.KeyMod.Alt|e.KeyCode.KeyR,e.KeyCode.F2],run:sd(`ShowRenameFileModal`,!0)}}},{addEditorAction(){return{id:`revert-file`,label:`Revert File`,run:Bu(`RevertChanges`,!0)}}},{handleGlobal(e,t){if(t.cmd&&e===`s`)return zu(`SaveFile`,!0),!0},addEditorAction(e){return{id:`save-file`,label:`Save Changes`,keybindings:[e.KeyMod.CtrlCmd|e.KeyCode.KeyS],run:Bu(`SaveFile`,!0)}}}],ud=ld.filter(id(`addEditorAction`)),dd=ld.filter(id(`handleGlobal`));function fd(e){let[t,n]=e,r=ud.map(e=>t.addAction(e.addEditorAction(n)));return()=>{for(let e of r)e?.dispose()}}function pd(){(0,z.useEffect)(()=>(document.addEventListener(`keydown`,md),()=>{document.removeEventListener(`keydown`,md)}),[])}function md(e){let t={cmd:e.getModifierState(`Meta`),alt:e.getModifierState(`Alt`),shift:e.getModifierState(`Shift`),ctrl:e.getModifierState(`Control`)};for(let n of dd)if(n.handleGlobal(e.key,t)){e.preventDefault();return}}function hd(e){return e.split(`/`).pop()}function gd(...e){return e.flat(1).join(`/`)}function _d(e){return!!e?.entries}var vd=`__root__`,yd=`importedApplications`,bd=`newApplication`;function xd(e){let t={},n=[],r=[],i=[];for(let a of e)_d(a)?a.package?r.push(a.path):n.push(a.path):i.push(a.path),Sd(t,a);return t[vd]={index:vd,isFolder:!0,children:[bd,yd,...n,...i],data:void 0,canMove:!1,canRename:!1},t[yd]={index:yd,isFolder:!0,children:r,data:{name:`Imported Applications`,path:yd,package:yd,project:``,entries:[]},canMove:!1,canRename:!1},t[bd]={index:bd,isFolder:!1,data:{name:`New Application`,path:bd,project:``},canMove:!1,canRename:!1},{items:t,rootId:vd}}function Sd(e,t){let n=t.path;if(_d(t)){let r=t,i=[],a=[];for(let e of r.entries)_d(e)?i.push(e.path):a.push(e.path);e[n]={index:n,isFolder:!0,children:[...i,...a],data:t,canMove:!1,canRename:!1};for(let t of r.entries)Sd(e,t)}else e[n]={index:n,isFolder:!1,data:t,canMove:!t.package,canRename:!t.package}}function Cd(){let[e,t]=(0,z.useState)(!1),[n,r]=(0,z.useState)(void 0),i=(0,z.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`))return;let n=e.target;if(n instanceof Element&&n.classList.contains(`rct-tree-item-button-isFolder`)){let e=n.getAttribute(`data-rct-item-id`);!n.querySelector(`.packageIsLocked`)&&e&&e!==`importedApplications`&&e!==`newApplication`&&r(e=>e===n?e:(e?.classList?.remove?.(`rct-tree-item-title-container-dragging-over`),n.classList.add(`rct-tree-item-title-container-dragging-over`),n))}t(!0)},[]),a=(0,z.useCallback)(()=>{t(!1),r(e=>{e&&e.classList.remove(`rct-tree-item-title-container-dragging-over`)})},[]),o=(0,z.useCallback)(e=>{if(!e.dataTransfer?.types?.includes(`Files`)||e.detail===1337)return;t(!1),n&&(n.classList.remove(`rct-tree-item-title-container-dragging-over`),r(void 0));let i=document.getElementById(`dropTarget`);return i?i.dispatchEvent(new DragEvent(`drop`,{bubbles:!0,detail:1337,cancelable:!0,dataTransfer:e.dataTransfer})):!1},[n]);return(0,z.useEffect)(()=>(document.addEventListener(`dragenter`,i),document.addEventListener(`dragover`,i),document.addEventListener(`dragleave`,a),document.addEventListener(`drop`,o),()=>{document.removeEventListener(`dragenter`,i),document.removeEventListener(`dragover`,i),document.removeEventListener(`dragleave`,a),document.removeEventListener(`drop`,o)}),[i,o,a]),(0,z.useMemo)(()=>({dragging:e,dragTarget:n}),[e,n])}function wd(e){return new Promise((t,n)=>{let r=new FileReader;r.onabort=n,r.onerror=n,r.onload=t,r.readAsDataURL(e)})}function Td(){let[e,n]=(0,z.useState)(``),{clusterId:r}=P({strict:!1}),{openedEntry:i,restrictPackageModification:a,reloadRootEntries:o,entryExists:s}=qu(),c=!!i&&!i.package&&!a,l=V(),{dragging:u,dragTarget:d}=Cd(),f=(d?.getAttribute?.(`data-rct-item-id`))?.split?.(`/`)?.pop?.(),h=i?.project,g=!1,_;if(i?.path){let e=i.path.split(`/`),t=_d(i);g=c&&(t?e.slice(1):e.slice(1,-1)).join(`/`),_=e[e.length-(t?1:2)]}let b=(0,z.useCallback)(async(e,t)=>{let r=d?.getAttribute?.(`data-rct-item-id`)?.split?.(`/`),i=r?.length?r[0]:c?h:!1,a=r?.length?r.slice(1).join(`/`):c?g:!1;if(i===!1||i===void 0||a===!1||a===void 0)return;let u=[],f=t.slice();for(let t of e){let e=Ed(a,t);t.name.startsWith(`.`)||t.relativePath?.includes(`/.`)?f.push({file:t,errors:[{message:`Sensitive files and folders starting with . are skipped.`,code:`dot-ignored`}]}):s(`${i}/${e}`)?f.push({file:t,errors:[{message:`${e} already exists`,code:`duplicate`}]}):u.push(t)}let m=!1,_=`uploading-files`,v={label:`Cancel`,onClick:()=>{m=!0}},y={label:`OK`,onClick:()=>void 0};n(`Uploading ${p(u.length,`file`,`files`)}...`);let b=u.reduce((e,t)=>e+t.size,0),x=0,ee=0;for(let e of u){ee+=1,N.loading(`Upload in progress...`,{id:_,descriptionClassName:`whitespace-pre`,description:`${ee} of ${p(u.length,`file`,`files`)}
|
|
12
12
|
${e.name}
|
|
13
13
|
${qs(x)} of ${qs(b)}`,action:v});let t=Ed(a,e),n=(await wd(e)).target.result,r=n.indexOf(`base64,`);m?f.push({file:e,errors:[{message:`${t} cancelled`,code:`cancelled`}]}):(await ed({...l,file:t,project:i,encoding:`base64`,payload:n.slice(r+7)}),x+=e.size)}N.loading(`Reloading sidebar...`,{id:m?void 0:_,action:y,description:``}),await o(),f.length===0?e.length>0&&N.success(`Uploaded ${p(u.length,`file`,`files`)}!`,{id:_,action:y,description:``}):(console.log(f),N.error(m?`Cancelled uploads`:`Rejected uploads`,{id:m?void 0:_,action:y,descriptionClassName:`whitespace-pre overflow-y-auto`,description:f.slice(0,5).map(e=>e.errors.map(e=>e.message).join(`
|
|
14
14
|
`)).join(`
|
|
@@ -47,5 +47,5 @@ Check the console for the full list.`:``)})),n(``)},[d,c,h,g,s,l,o]),{getRootPro
|
|
|
47
47
|
focus-visible:ring-1
|
|
48
48
|
focus-visible:outline-1
|
|
49
49
|
focus-visible:ring-purple-200
|
|
50
|
-
aria-invalid:focus-visible:ring-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow-sm hover:bg-primary/90`,outline:`border bg-default border-primary border-2 text-white shadow-xs hover:-translate-y-1 transition duration-200 hover:bg-grey-700/40`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,sm:`h-8 px-1.5 min-w-8`,lg:`h-10 px-2.5 min-w-10`}},defaultVariants:{variant:`default`,size:`default`}});function Yh({className:e,variant:t,size:n,...r}){return(0,B.jsx)(xr,{"data-slot":`toggle`,className:g(Jh({variant:t,size:n,className:e})),...r})}function Xh(e){switch(e){case`warn`:return`warning`;case`notify`:return`success`;case`info`:case`debug`:case`trace`:case void 0:case`stdout`:return`secondary`;case`stderr`:case`error`:return`destructive`;default:return e}}var Zh=[`secondary`,`default`,`warning`,`outline`,`success`,`destructive`],Qh=0,$h=new Map,eg=e=>{if($h.has(e))return $h.get(e);Qh++;let t=Zh[Qh%Zh.length];return $h.set(e,t),t};function tg({columns:e,data:t,onRowClick:n}){let r=zt({data:t,columns:e,getCoreRowModel:Xe()});return(0,B.jsx)(`div`,{className:`rounded-md bg-black-dark logsTable`,children:(0,B.jsxs)(Mc,{className:`text-xs`,children:[(0,B.jsx)(Nc,{children:r.getHeaderGroups().map(e=>(0,B.jsx)(Fc,{className:`border-none`,children:e.headers.map(e=>(0,B.jsx)(Ic,{className:`p-4 max-w-96`,children:e.isPlaceholder?null:Mt(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,B.jsx)(Pc,{className:`bg-black`,children:r.getRowModel().rows?.length?r.getRowModel().rows.map(e=>(0,B.jsx)(Fc,{"data-state":e.getIsSelected()&&`selected`,className:g(`hover:bg-muted/10 data-[state=selected]:bg-muted max-w-full`,n&&`cursor-pointer`),onClick:()=>n?.(e),children:e.getVisibleCells().map(e=>(0,B.jsx)(Rc,{className:`p-1`,children:Mt(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,B.jsx)(Fc,{children:(0,B.jsx)(Rc,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})})}function ng(e){try{JSON.parse(e)}catch{return!1}return!0}function rg({setIsModalOpen:e,isModalOpen:t,data:n}){let r=n?eg(n.node):`default`;return(0,B.jsx)(Y,{onOpenChange:e,open:t,children:(0,B.jsxs)(X,{"aria-describedby":void 0,children:[(0,B.jsx)(ho,{children:(0,B.jsx)(Q,{children:`Edit Row`})}),n?(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 text-white`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`inline-block pr-2`,children:`Level:`}),(0,B.jsx)(vo,{variant:Xh(n.level),children:Xi(n.level)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Timestamp:`}),(0,B.jsx)(`p`,{className:`text-sm`,children:n.timestamp})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Thread:`}),(0,B.jsx)(`p`,{className:`text-sm`,children:n.thread})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Node:`}),(0,B.jsx)(vo,{variant:r,children:n.node})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Tags:`}),(0,B.jsx)(`p`,{className:`text-sm`,children:n.tags&&n.tags.length>0?(0,B.jsx)(`span`,{children:n.tags}):`N/A`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-lg font-bold`,children:`Message`}),(0,B.jsx)(Ft,{className:`w-full h-72`,language:ng(n.message)?`json`:`text`,theme:`vs-dark`,value:n.message,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1}})]})]}):(0,B.jsx)(Bo,{}),(0,B.jsx)(Z,{children:(0,B.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,B.jsxs)(R,{type:`button`,variant:`destructive`,className:`rounded-full`,children:[(0,B.jsx)(Dn,{}),` Delete Row`]}),(0,B.jsxs)(R,{variant:`submit`,className:`rounded-full`,children:[(0,B.jsx)(yn,{}),` Save Changes`]})]})})]})})}function ig({entityId:e,instanceClient:t,logFilters:n,replicated:r,isAutoRefreshEnabled:i}){return I({queryKey:[e,`read_log`,n.limit,n.level,n.from,n.until,r],queryFn:async()=>{let{data:e}=await t.post(`/`,{operation:`read_log`,start:0,replicated:r,limit:n.limit?parseInt(n.limit,10):void 0,level:n.level===`undefined`?void 0:n.level,from:n.from?new Date(n.from).toISOString():void 0,until:n.until?new Date(n.until).toISOString():void 0,order:`desc`});return e},retry:!1,refetchInterval:i?5e3:!1})}var ag=D({limit:C().optional(),level:x([`notify`,`error`,`warn`,`info`,`debug`,`trace`,`undefined`]).optional(),from:C().or(te()).optional(),until:C().or(te()).optional()});function og({form:e,resetFilters:t,submitFilters:n}){return(0,B.jsx)(`div`,{children:(0,B.jsx)(H,{...e,children:(0,B.jsxs)(`form`,{id:`instance-edit-log-filters-form`,name:`instance-edit-log-filters-form`,onSubmit:e.handleSubmit(n),className:`flex-col space-y-5`,children:[(0,B.jsx)(W,{control:e.control,name:`limit`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`Log Limit:`}),(0,B.jsxs)(Ms,{onValueChange:e.onChange,value:e.value,children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Select log limit`})}),(0,B.jsx)(Is,{children:(0,B.jsxs)(Ns,{children:[(0,B.jsx)($,{value:`1000`,children:`1000`}),(0,B.jsx)($,{value:`500`,children:`500`}),(0,B.jsx)($,{value:`250`,children:`250`}),(0,B.jsx)($,{value:`100`,children:`100`}),(0,B.jsx)($,{value:`10`,children:`10`})]})})]}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e.control,name:`level`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`Log Level:`}),(0,B.jsxs)(Ms,{onValueChange:e.onChange,value:e.value,children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Select log level`})}),(0,B.jsx)(Is,{children:(0,B.jsxs)(Ns,{children:[(0,B.jsx)($,{value:`undefined`,children:`All`}),(0,B.jsx)($,{value:`notify`,children:`Notify`}),(0,B.jsx)($,{value:`error`,children:`Error`}),(0,B.jsx)($,{value:`warn`,children:`Warn`}),(0,B.jsx)($,{value:`info`,children:`Info`}),(0,B.jsx)($,{value:`debug`,children:`Debug`}),(0,B.jsx)($,{value:`trace`,children:`Trace`})]})})]}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e.control,name:`from`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`Start Date:`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`datetime-local`,value:e.value,onChange:e.onChange})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e.control,name:`until`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`End Date:`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`datetime-local`,value:e.value,onChange:e.onChange})}),(0,B.jsx)(q,{})]})}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between space-x-2 mt-2`,children:[(0,B.jsx)(R,{type:`submit`,variant:`positiveOutline`,className:`grow`,children:`Apply Filters`}),(0,B.jsx)(R,{type:`reset`,variant:`destructiveOutline`,onClick:()=>t(),children:`Clear Filters`})]})]})})})}var sg={limit:`100`,level:`undefined`,from:``,until:``},cg=[{accessorKey:`level`,header:`Status`,cell:({row:e})=>{let{level:t}=e.original;return(0,B.jsx)(vo,{variant:Xh(t),children:Xi(t)})}},{accessorKey:`timestamp`,header:`Date`,cell:({row:e})=>{let{timestamp:t}=e.original;return(0,B.jsx)(`span`,{children:new Date(t).toLocaleDateString()})}},{accessorKey:`time`,header:`Time`,cell:({row:e})=>{let{timestamp:t}=e.original;return(0,B.jsx)(`span`,{children:new Date(t).toLocaleTimeString()})}},{accessorKey:`thread`,header:`Thread`},{accessorKey:`node`,header:`Node`,cell:({row:e})=>{let{node:t}=e.original,n=eg(t);return(0,B.jsx)(B.Fragment,{children:t?(0,B.jsxs)(Ki,{children:[(0,B.jsx)(qi,{asChild:!0,children:(0,B.jsxs)(vo,{variant:n,children:[t.split(`.`)[0],`...`]})}),(0,B.jsx)(Ji,{className:`bg-grey-700`,arrowClassName:`bg-grey-700 fill-grey-700`,children:t})]}):null})}},{accessorKey:`tags`,header:`Tags`},{accessorKey:`message`,header:`Message`,cell:({row:e})=>{let{message:t}=e.original;return e.getIsSelected(),(0,B.jsx)(`pre`,{children:(0,B.jsx)(`code`,{children:t})})}}],lg=(e,t)=>!e&&!t||!e||!t?!0:new Date(e)<=new Date(t);function ug(){let[e,t]=(0,z.useState)(sg),[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(),[o,s]=(0,z.useState)(!1),c=V(),{data:l,isLoading:u,refetch:d,isFetching:f}=F(ig({logFilters:e,...c,replicated:c.entityType===`cluster`,isAutoRefreshEnabled:o})),p=k({resolver:O(ag),defaultValues:sg,mode:`onChange`}),m=e=>{a(e.original),r(!0)},h=async e=>{if(!lg(e.from,e.until)){p.setError(`from`,{type:`onChange`,message:`Start date must be before end date`}),p.setError(`until`,{type:`onChange`,message:`End date must be after start date`});return}t(e)},g=async()=>{p.reset(),t(sg)},_=Wc(d);return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 text-white md:grid-cols-12`,children:[(0,B.jsxs)(`section`,{className:`col-span-1 md:col-span-4 lg:col-span-3 px-2 pt-4 md:pt-12`,children:[(0,B.jsx)(og,{form:p,resetFilters:g,submitFilters:h}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between space-x-2 mt-2`,children:[(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:_,disabled:f||u||o,className:`grow`,children:[(0,B.jsx)(wn,{}),`Refresh`]}),(0,B.jsxs)(Yh,{variant:`outline`,"aria-label":`Toggle Auto Refresh`,onPressedChange:s,children:[(0,B.jsx)(wn,{}),`Auto Refresh `,o?`On`:`Off`]})]})]}),(0,B.jsx)(`section`,{className:`col-span-1 md:col-span-8 lg:col-span-9`,children:u?(0,B.jsx)(`div`,{children:`Loading...`}):(0,B.jsx)(`div`,{children:(0,B.jsx)(tg,{columns:cg,data:l||[],onRowClick:m})})}),(0,B.jsx)(rg,{isModalOpen:n,setIsModalOpen:r,data:i})]})}function dg(e){return A({getParentRoute:()=>e,path:`logs`,component:ug})}function fg(e){return A({getParentRoute:()=>e,path:`status`,component:rt(async()=>Ir(()=>import(`./status-BP4TQJDR.js`),__vite__mapDeps([16,1,3,4,5,6,7,2,8,9,10,12])),`StatusIndex`)})}function pg(e){let t=Kh(e),n=[dg(t),...sp(t),Pu(t),fg(t),zm(t),zh(t)];return t.addChildren(n)}A({getParentRoute:()=>zl,path:`profile`,component:rt(async()=>Ir(()=>import(`./profile-CzjslUXv.js`),__vite__mapDeps([17,1,3,4,5,6,7,2,8,9,10,11,12])),`ProfileIndex`)});var mg=ri.addChildren([...ro,zl.addChildren([pg(`local`)])]);function hg({routeTree:e=mg,authentication:t}){return On({routeTree:e,history:Ne(),defaultNotFoundComponent:qr,defaultErrorComponent:Kr,defaultPreload:Jr()?!1:`intent`,trailingSlash:`never`,defaultPreloadStaleTime:0,scrollRestoration:!0,context:{queryClient:Xr,authentication:t||{}}})}function gg(){let e=Mr();return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(de,{router:hg({authentication:e}),context:{authentication:e}}),!1]})}var _g=({...e})=>(0,B.jsx)(Jt,{className:`toaster group`,toastOptions:{classNames:{toast:`group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg`,description:`group-[.toast]:text-muted-foreground`,actionButton:`group-[.toast]:bg-primary group-[.toast]:text-primary-foreground font-medium`,cancelButton:`group-[.toast]:bg-muted group-[.toast]:text-muted-foreground font-medium`}},...e}),vg=!1,yg=!1;function bg(){(0,z.useEffect)(()=>{vg||(vg=!0,yg&&(function(e,t,n,r,i){e[r]=e[r]||[],e[r].push({"gtm.start":new Date().getTime(),event:`gtm.js`});let a=t.getElementsByTagName(n)[0],o=t.createElement(n),s=r===`dataLayer`?``:`&l=${r}`;o.async=!0,o.src=`https://www.googletagmanager.com/gtm.js?id=`+i+s,a.parentNode.insertBefore(o,a)})(window,document,`script`,`dataLayer`,`GTM-5QQX432`))},[])}function xg(){return Bi(),ei(),bg(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Bt,{client:Xr,children:[(0,B.jsx)(gg,{}),(0,B.jsx)(sn,{buttonPosition:`bottom-right`})]}),(0,B.jsx)(_g,{richColors:!0})]})}(0,Tr().createRoot)(document.getElementById(`root`),{onUncaughtError:(e,t)=>{Wt(e,t),console.error(`Uncaught error:`,e,t)},onCaughtError:(e,t)=>{Wt(e,t),console.error(`Caught error:`,e,t)},onRecoverableError:(e,t)=>{Wt(e,t),console.warn(`Recoverable error:`,e,t)}}).render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(xg,{})}));export{V as A,K as C,U as D,W as E,Kr as M,H as O,q as S,G as T,js as _,Mf as a,la as b,qs as c,Ms as d,Is as f,Ps as g,Fs as h,Sp as i,Zr as j,vi as k,Ks as l,$ as m,Lp as n,Ld as o,Ns as p,Ip as r,Hc as s,Bh as t,Gs as u,$o as v,na as w,J as x,Bo as y};
|
|
51
|
-
//# sourceMappingURL=index-
|
|
50
|
+
aria-invalid:focus-visible:ring-0`,{variants:{variant:{default:`bg-primary text-primary-foreground shadow-sm hover:bg-primary/90`,outline:`border bg-default border-primary border-2 text-white shadow-xs hover:-translate-y-1 transition duration-200 hover:bg-grey-700/40`},size:{default:`h-9 px-4 py-2 has-[>svg]:px-3`,sm:`h-8 px-1.5 min-w-8`,lg:`h-10 px-2.5 min-w-10`}},defaultVariants:{variant:`default`,size:`default`}});function Yh({className:e,variant:t,size:n,...r}){return(0,B.jsx)(xr,{"data-slot":`toggle`,className:g(Jh({variant:t,size:n,className:e})),...r})}function Xh(e){switch(e){case`warn`:return`warning`;case`notify`:return`success`;case`info`:case`debug`:case`trace`:case void 0:case`stdout`:return`secondary`;case`stderr`:case`error`:return`destructive`;default:return e}}var Zh=[`secondary`,`default`,`warning`,`outline`,`success`,`destructive`],Qh=0,$h=new Map,eg=e=>{if($h.has(e))return $h.get(e);Qh++;let t=Zh[Qh%Zh.length];return $h.set(e,t),t};function tg({columns:e,data:t,onRowClick:n}){let r=zt({data:t,columns:e,getCoreRowModel:Xe()});return(0,B.jsx)(`div`,{className:`rounded-md bg-black-dark logsTable`,children:(0,B.jsxs)(Mc,{className:`text-xs`,children:[(0,B.jsx)(Nc,{children:r.getHeaderGroups().map(e=>(0,B.jsx)(Fc,{className:`border-none`,children:e.headers.map(e=>(0,B.jsx)(Ic,{className:`p-4 max-w-96`,children:e.isPlaceholder?null:Mt(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,B.jsx)(Pc,{className:`bg-black`,children:r.getRowModel().rows?.length?r.getRowModel().rows.map(e=>(0,B.jsx)(Fc,{"data-state":e.getIsSelected()&&`selected`,className:g(`hover:bg-muted/10 data-[state=selected]:bg-muted max-w-full`,n&&`cursor-pointer`),onClick:()=>n?.(e),children:e.getVisibleCells().map(e=>(0,B.jsx)(Rc,{className:`p-1`,children:Mt(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,B.jsx)(Fc,{children:(0,B.jsx)(Rc,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})})}function ng(e){try{JSON.parse(e)}catch{return!1}return!0}function rg({setIsModalOpen:e,isModalOpen:t,data:n}){let r=n?eg(n.node):`default`;return(0,B.jsx)(Y,{onOpenChange:e,open:t,children:(0,B.jsxs)(X,{"aria-describedby":void 0,children:[(0,B.jsx)(ho,{children:(0,B.jsx)(Q,{children:`Edit Row`})}),n?(0,B.jsxs)(`div`,{className:`flex flex-col gap-3 text-white`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`inline-block pr-2`,children:`Level:`}),(0,B.jsx)(vo,{variant:Xh(n.level),children:Xi(n.level)})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Timestamp:`}),(0,B.jsx)(`p`,{className:`text-sm`,children:n.timestamp})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Thread:`}),(0,B.jsx)(`p`,{className:`text-sm`,children:n.thread})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Node:`}),(0,B.jsx)(vo,{variant:r,children:n.node})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{children:`Tags:`}),(0,B.jsx)(`p`,{className:`text-sm`,children:n.tags&&n.tags.length>0?(0,B.jsx)(`span`,{children:n.tags}):`N/A`})]}),(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h3`,{className:`text-lg font-bold`,children:`Message`}),(0,B.jsx)(Ft,{className:`w-full h-72`,language:ng(n.message)?`json`:`text`,theme:`vs-dark`,value:n.message,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1}})]})]}):(0,B.jsx)(Bo,{}),(0,B.jsx)(Z,{children:(0,B.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,B.jsxs)(R,{type:`button`,variant:`destructive`,className:`rounded-full`,children:[(0,B.jsx)(Dn,{}),` Delete Row`]}),(0,B.jsxs)(R,{variant:`submit`,className:`rounded-full`,children:[(0,B.jsx)(yn,{}),` Save Changes`]})]})})]})})}function ig({entityId:e,instanceClient:t,logFilters:n,replicated:r,isAutoRefreshEnabled:i}){return I({queryKey:[e,`read_log`,n.limit,n.level,n.from,n.until,r],queryFn:async()=>{let{data:e}=await t.post(`/`,{operation:`read_log`,start:0,replicated:r,limit:n.limit?parseInt(n.limit,10):void 0,level:n.level===`undefined`?void 0:n.level,from:n.from?new Date(n.from).toISOString():void 0,until:n.until?new Date(n.until).toISOString():void 0,order:`desc`});return e},retry:!1,refetchInterval:i?5e3:!1})}var ag=D({limit:C().optional(),level:x([`notify`,`error`,`warn`,`info`,`debug`,`trace`,`undefined`]).optional(),from:C().or(te()).optional(),until:C().or(te()).optional()});function og({form:e,resetFilters:t,submitFilters:n}){return(0,B.jsx)(`div`,{children:(0,B.jsx)(H,{...e,children:(0,B.jsxs)(`form`,{id:`instance-edit-log-filters-form`,name:`instance-edit-log-filters-form`,onSubmit:e.handleSubmit(n),className:`flex-col space-y-5`,children:[(0,B.jsx)(W,{control:e.control,name:`limit`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`Log Limit:`}),(0,B.jsxs)(Ms,{onValueChange:e.onChange,value:e.value,children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Select log limit`})}),(0,B.jsx)(Is,{children:(0,B.jsxs)(Ns,{children:[(0,B.jsx)($,{value:`1000`,children:`1000`}),(0,B.jsx)($,{value:`500`,children:`500`}),(0,B.jsx)($,{value:`250`,children:`250`}),(0,B.jsx)($,{value:`100`,children:`100`}),(0,B.jsx)($,{value:`10`,children:`10`})]})})]}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e.control,name:`level`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`Log Level:`}),(0,B.jsxs)(Ms,{onValueChange:e.onChange,value:e.value,children:[(0,B.jsx)(Fs,{className:`w-full`,children:(0,B.jsx)(Ps,{placeholder:`Select log level`})}),(0,B.jsx)(Is,{children:(0,B.jsxs)(Ns,{children:[(0,B.jsx)($,{value:`undefined`,children:`All`}),(0,B.jsx)($,{value:`notify`,children:`Notify`}),(0,B.jsx)($,{value:`error`,children:`Error`}),(0,B.jsx)($,{value:`warn`,children:`Warn`}),(0,B.jsx)($,{value:`info`,children:`Info`}),(0,B.jsx)($,{value:`debug`,children:`Debug`}),(0,B.jsx)($,{value:`trace`,children:`Trace`})]})})]}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e.control,name:`from`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`Start Date:`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`datetime-local`,value:e.value,onChange:e.onChange})}),(0,B.jsx)(q,{})]})}),(0,B.jsx)(W,{control:e.control,name:`until`,render:({field:e})=>(0,B.jsxs)(G,{children:[(0,B.jsx)(K,{children:`End Date:`}),(0,B.jsx)(U,{children:(0,B.jsx)(J,{type:`datetime-local`,value:e.value,onChange:e.onChange})}),(0,B.jsx)(q,{})]})}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between space-x-2 mt-2`,children:[(0,B.jsx)(R,{type:`submit`,variant:`positiveOutline`,className:`grow`,children:`Apply Filters`}),(0,B.jsx)(R,{type:`reset`,variant:`destructiveOutline`,onClick:()=>t(),children:`Clear Filters`})]})]})})})}var sg={limit:`100`,level:`undefined`,from:``,until:``},cg=[{accessorKey:`level`,header:`Status`,cell:({row:e})=>{let{level:t}=e.original;return(0,B.jsx)(vo,{variant:Xh(t),children:Xi(t)})}},{accessorKey:`timestamp`,header:`Date`,cell:({row:e})=>{let{timestamp:t}=e.original;return(0,B.jsx)(`span`,{children:new Date(t).toLocaleDateString()})}},{accessorKey:`time`,header:`Time`,cell:({row:e})=>{let{timestamp:t}=e.original;return(0,B.jsx)(`span`,{children:new Date(t).toLocaleTimeString()})}},{accessorKey:`thread`,header:`Thread`},{accessorKey:`node`,header:`Node`,cell:({row:e})=>{let{node:t}=e.original,n=eg(t);return(0,B.jsx)(B.Fragment,{children:t?(0,B.jsxs)(Ki,{children:[(0,B.jsx)(qi,{asChild:!0,children:(0,B.jsxs)(vo,{variant:n,children:[t.split(`.`)[0],`...`]})}),(0,B.jsx)(Ji,{className:`bg-grey-700`,arrowClassName:`bg-grey-700 fill-grey-700`,children:t})]}):null})}},{accessorKey:`tags`,header:`Tags`},{accessorKey:`message`,header:`Message`,cell:({row:e})=>{let{message:t}=e.original;return e.getIsSelected(),(0,B.jsx)(`pre`,{children:(0,B.jsx)(`code`,{children:t})})}}],lg=(e,t)=>!e&&!t||!e||!t?!0:new Date(e)<=new Date(t);function ug(){let[e,t]=(0,z.useState)(sg),[n,r]=(0,z.useState)(!1),[i,a]=(0,z.useState)(),[o,s]=(0,z.useState)(!1),c=V(),{data:l,isLoading:u,refetch:d,isFetching:f}=F(ig({logFilters:e,...c,replicated:c.entityType===`cluster`,isAutoRefreshEnabled:o})),p=k({resolver:O(ag),defaultValues:sg,mode:`onChange`}),m=e=>{a(e.original),r(!0)},h=async e=>{if(!lg(e.from,e.until)){p.setError(`from`,{type:`onChange`,message:`Start date must be before end date`}),p.setError(`until`,{type:`onChange`,message:`End date must be after start date`});return}t(e)},g=async()=>{p.reset(),t(sg)},_=Wc(d);return(0,B.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 text-white md:grid-cols-12`,children:[(0,B.jsxs)(`section`,{className:`col-span-1 md:col-span-4 lg:col-span-3 px-2 pt-4 md:pt-12`,children:[(0,B.jsx)(og,{form:p,resetFilters:g,submitFilters:h}),(0,B.jsxs)(`div`,{className:`flex items-center justify-between space-x-2 mt-2`,children:[(0,B.jsxs)(R,{variant:`defaultOutline`,onClick:_,disabled:f||u||o,className:`grow`,children:[(0,B.jsx)(wn,{}),`Refresh`]}),(0,B.jsxs)(Yh,{variant:`outline`,"aria-label":`Toggle Auto Refresh`,onPressedChange:s,children:[(0,B.jsx)(wn,{}),`Auto Refresh `,o?`On`:`Off`]})]})]}),(0,B.jsx)(`section`,{className:`col-span-1 md:col-span-8 lg:col-span-9`,children:u?(0,B.jsx)(`div`,{children:`Loading...`}):(0,B.jsx)(`div`,{children:(0,B.jsx)(tg,{columns:cg,data:l||[],onRowClick:m})})}),(0,B.jsx)(rg,{isModalOpen:n,setIsModalOpen:r,data:i})]})}function dg(e){return A({getParentRoute:()=>e,path:`logs`,component:ug})}function fg(e){return A({getParentRoute:()=>e,path:`status`,component:rt(async()=>Ir(()=>import(`./status-CFe85l8C.js`),__vite__mapDeps([16,1,3,4,5,6,7,2,8,9,10,12])),`StatusIndex`)})}function pg(e){let t=Kh(e),n=[dg(t),...sp(t),Pu(t),fg(t),zm(t),zh(t)];return t.addChildren(n)}A({getParentRoute:()=>zl,path:`profile`,component:rt(async()=>Ir(()=>import(`./profile-BbbbWJCN.js`),__vite__mapDeps([17,1,3,4,5,6,7,2,8,9,10,11,12])),`ProfileIndex`)});var mg=ri.addChildren([...ro,zl.addChildren([pg(`local`)])]);function hg({routeTree:e=mg,authentication:t}){return On({routeTree:e,history:Ne(),defaultNotFoundComponent:qr,defaultErrorComponent:Kr,defaultPreload:Jr()?!1:`intent`,trailingSlash:`never`,defaultPreloadStaleTime:0,scrollRestoration:!0,context:{queryClient:Xr,authentication:t||{}}})}function gg(){let e=Mr();return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(de,{router:hg({authentication:e}),context:{authentication:e}}),!1]})}var _g=({...e})=>(0,B.jsx)(Jt,{className:`toaster group`,toastOptions:{classNames:{toast:`group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg`,description:`group-[.toast]:text-muted-foreground`,actionButton:`group-[.toast]:bg-primary group-[.toast]:text-primary-foreground font-medium`,cancelButton:`group-[.toast]:bg-muted group-[.toast]:text-muted-foreground font-medium`}},...e}),vg=!1,yg=!1;function bg(){(0,z.useEffect)(()=>{vg||(vg=!0,yg&&(function(e,t,n,r,i){e[r]=e[r]||[],e[r].push({"gtm.start":new Date().getTime(),event:`gtm.js`});let a=t.getElementsByTagName(n)[0],o=t.createElement(n),s=r===`dataLayer`?``:`&l=${r}`;o.async=!0,o.src=`https://www.googletagmanager.com/gtm.js?id=`+i+s,a.parentNode.insertBefore(o,a)})(window,document,`script`,`dataLayer`,`GTM-5QQX432`))},[])}function xg(){return Bi(),ei(),bg(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(Bt,{client:Xr,children:[(0,B.jsx)(gg,{}),(0,B.jsx)(sn,{buttonPosition:`bottom-right`})]}),(0,B.jsx)(_g,{richColors:!0})]})}(0,Tr().createRoot)(document.getElementById(`root`),{onUncaughtError:(e,t)=>{Wt(e,t),console.error(`Uncaught error:`,e,t)},onCaughtError:(e,t)=>{Wt(e,t),console.error(`Caught error:`,e,t)},onRecoverableError:(e,t)=>{Wt(e,t),console.warn(`Recoverable error:`,e,t)}}).render((0,B.jsx)(z.StrictMode,{children:(0,B.jsx)(xg,{})}));export{V as A,K as C,U as D,W as E,Kr as M,H as O,q as S,G as T,js as _,Mf as a,la as b,qs as c,Ms as d,Is as f,Ps as g,Fs as h,Sp as i,Zr as j,vi as k,Ks as l,$ as m,Lp as n,Ld as o,Ns as p,Ip as r,Hc as s,Bh as t,Gs as u,$o as v,na as w,J as x,Bo as y};
|
|
51
|
+
//# sourceMappingURL=index-CXQsBaYq.js.map
|