harper 5.2.0-alpha.4 → 5.2.0-alpha.5
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/npm-shrinkwrap.json +388 -558
- package/package.json +3 -3
- package/studio/web/assets/{Chat-D4FIaBu7.js → Chat-Cv_2paZE.js} +2 -2
- package/studio/web/assets/{Chat-D4FIaBu7.js.map → Chat-Cv_2paZE.js.map} +1 -1
- package/studio/web/assets/{FloatingChat-DGUC3L4r.js → FloatingChat-CPyPIcVR.js} +4 -4
- package/studio/web/assets/{FloatingChat-DGUC3L4r.js.map → FloatingChat-CPyPIcVR.js.map} +1 -1
- package/studio/web/assets/{applications-D8Am9ikM.js → applications-C0jT2vdZ.js} +2 -2
- package/studio/web/assets/{applications-D8Am9ikM.js.map → applications-C0jT2vdZ.js.map} +1 -1
- package/studio/web/assets/{index-HGL4WHdb.js → index-D_GKOkhn.js} +6 -6
- package/studio/web/assets/{index-HGL4WHdb.js.map → index-D_GKOkhn.js.map} +1 -1
- package/studio/web/assets/{index.lazy-Dk5j1AoQ.js → index.lazy-CAmCIA65.js} +4 -4
- package/studio/web/assets/{index.lazy-Dk5j1AoQ.js.map → index.lazy-CAmCIA65.js.map} +1 -1
- package/studio/web/assets/{profile-7bu_CF1f.js → profile-CaF-4aZe.js} +2 -2
- package/studio/web/assets/{profile-7bu_CF1f.js.map → profile-CaF-4aZe.js.map} +1 -1
- package/studio/web/assets/{setComponentFile-MfYm9F94.js → setComponentFile-DLW1DHCt.js} +2 -2
- package/studio/web/assets/{setComponentFile-MfYm9F94.js.map → setComponentFile-DLW1DHCt.js.map} +1 -1
- package/studio/web/assets/{setup-SKA4UhdE.js → setup-TGCErIhq.js} +2 -2
- package/studio/web/assets/{setup-SKA4UhdE.js.map → setup-TGCErIhq.js.map} +1 -1
- package/studio/web/assets/{status-DetVLUxR.js → status-DG0Maoao.js} +2 -2
- package/studio/web/assets/{status-DetVLUxR.js.map → status-DG0Maoao.js.map} +1 -1
- package/studio/web/assets/{swagger-ui-react-DLeYARY2.js → swagger-ui-react-8T4SgQ1m.js} +2 -2
- package/studio/web/assets/{swagger-ui-react-DLeYARY2.js.map → swagger-ui-react-8T4SgQ1m.js.map} +1 -1
- package/studio/web/assets/{tsMode-DGO-jIF7.js → tsMode-DJ6Sl24Q.js} +2 -2
- package/studio/web/assets/{tsMode-DGO-jIF7.js.map → tsMode-DJ6Sl24Q.js.map} +1 -1
- package/studio/web/assets/{useEntityRestURL-4M2i6bo4.js → useEntityRestURL-JO2mfWTQ.js} +2 -2
- package/studio/web/assets/{useEntityRestURL-4M2i6bo4.js.map → useEntityRestURL-JO2mfWTQ.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/setup-
|
|
2
|
-
import{a as e,r as t,t as n}from"./rolldown-runtime-CNC7AqOf.js";import{_ as r,a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,s as g,t as _,u as v,v as y}from"./button-i10JPNcp.js";import{A as b,M as x,_ as S,a as C,b as w,c as T,f as E,g as ee,k as D,l as O,m as k,n as A,o as te,r as ne,v as re,x as ie}from"./vendor-core-vIXn_E4D.js";import{A as j,B as ae,C as M,D as oe,E as se,F as ce,I as le,M as ue,N,O as de,P as fe,S as pe,_ as P,a as me,b as he,c as ge,d as _e,f as ve,g as ye,i as be,j as F,k as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as ke,u as Ae,v as I,w as je,x as L,y as Me}from"./vendor-tanstack-Dl75hT33.js";import{a as Ne,i as Pe,t as Fe}from"./vendor-datadog-DBn-aOxh.js";import{r as Ie,t as Le}from"./vendor-react-B36dp27u.js";import{a as Re,i as ze,n as Be,o as Ve,r as He,t as Ue}from"./useAuth-BOaK3koG.js";import{$ as We,A as Ge,At as Ke,B as qe,Bt as Je,C as Ye,Ct as Xe,D as Ze,Dt as Qe,E as $e,Et as et,F as tt,Ft as nt,G as rt,H as it,I as at,It as ot,J as st,K as ct,L as lt,Lt as ut,M as dt,Mt as ft,N as pt,Nt as mt,O as ht,Ot as gt,P as _t,Pt as vt,Q as yt,R as bt,Rt as xt,S as St,St as Ct,T as wt,Tt,U as Et,V as Dt,W as Ot,X as kt,Y as At,Z as jt,at as Mt,b as Nt,bt as Pt,ct as Ft,dt as It,et as Lt,ft as Rt,ht as zt,it as Bt,j as Vt,jt as Ht,k as Ut,kt as Wt,lt as Gt,mt as Kt,nt as qt,ot as Jt,pt as Yt,q as Xt,rt as Zt,st as Qt,tt as $t,ut as en,v as tn,w as nn,wt as R,x as rn,xt as an,y as on,yt as z,z as sn,zt as B}from"./vendor-ui-Bm4W8wqw.js";import{a as cn,i as ln,n as un,r as dn,t as fn}from"./card-hTrVZWnN.js";import{t as V}from"./createLucideIcon-B49W6uF4.js";import{a as pn,i as mn,n as hn,r as gn,t as _n}from"./x-Bru-nCti.js";import{t as vn}from"./errorText-NpBmvk9I.js";import{n as yn}from"./queryClient-DK1L0t7F.js";import{i as bn,n as xn,r as Sn,t as Cn}from"./localStorageKeys-D_mgWLDC.js";import{h as wn,n as Tn}from"./editor.api2-4ndOupAA.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)}})();function En(e){return e!==null&&!!e.username}function Dn(e){if(e&&!En(e)){let t=Object.keys(e.roles);if(t.length===1)return`/${t[0]}`}return`/`}var On=V(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),kn=V(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),An=V(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),jn=V(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Mn=V(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Nn=V(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Pn=V(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Fn=V(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),In=V(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Ln=V(`book-open-text`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),Rn=V(`brush-cleaning`,[[`path`,{d:`m16 22-1-4`,key:`1ow2iv`}],[`path`,{d:`M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1`,key:`11gii7`}],[`path`,{d:`M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z`,key:`bju7h4`}],[`path`,{d:`m8 22 1-4`,key:`s3unb`}]]),zn=V(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),Bn=V(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Vn=V(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Hn=V(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Un=V(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wn=V(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Gn=V(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Kn=V(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qn=V(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),Jn=V(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Yn=V(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),Xn=V(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),Zn=V(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),Qn=V(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),$n=V(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),er=V(`columns-3-cog`,[[`path`,{d:`M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5`,key:`1g2yzs`}],[`path`,{d:`m14.3 19.6 1-.4`,key:`11sv9r`}],[`path`,{d:`M15 3v7.5`,key:`7lm50a`}],[`path`,{d:`m15.2 16.9-.9-.3`,key:`1t7mvx`}],[`path`,{d:`m16.6 21.7.3-.9`,key:`1j67ps`}],[`path`,{d:`m16.8 15.3-.4-1`,key:`1ei7r6`}],[`path`,{d:`m19.1 15.2.3-.9`,key:`18r7jp`}],[`path`,{d:`m19.6 21.7-.4-1`,key:`z2vh2`}],[`path`,{d:`m20.7 16.8 1-.4`,key:`19m87a`}],[`path`,{d:`m21.7 19.4-.9-.3`,key:`1qgwi9`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),tr=V(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),nr=V(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),rr=V(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ir=V(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ar=V(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),or=V(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),sr=V(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),cr=V(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),lr=V(`funnel-plus`,[[`path`,{d:`M13.354 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14v6a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341l1.218-1.348`,key:`8mvsmf`}],[`path`,{d:`M16 6h6`,key:`1dogtp`}],[`path`,{d:`M19 3v6`,key:`1ytpjt`}]]),ur=V(`funnel-x`,[[`path`,{d:`M12.531 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14v6a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341l.427-.473`,key:`ol2ft2`}],[`path`,{d:`m16.5 3.5 5 5`,key:`15e6fa`}],[`path`,{d:`m21.5 3.5-5 5`,key:`m0lwru`}]]),dr=V(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),fr=V(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),pr=V(`git-graph`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v6`,key:`158jrl`}],[`circle`,{cx:`5`,cy:`18`,r:`3`,key:`104gr9`}],[`path`,{d:`M12 3v18`,key:`108xh3`}],[`circle`,{cx:`19`,cy:`6`,r:`3`,key:`108a5v`}],[`path`,{d:`M16 15.7A9 9 0 0 0 19 9`,key:`1e3vqb`}]]),mr=V(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),hr=V(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),gr=V(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),_r=V(`handshake`,[[`path`,{d:`m11 17 2 2a1 1 0 1 0 3-3`,key:`efffak`}],[`path`,{d:`m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4`,key:`9pr0kb`}],[`path`,{d:`m21 3 1 11h-2`,key:`1tisrp`}],[`path`,{d:`M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3`,key:`1uvwmv`}],[`path`,{d:`M3 4h8`,key:`1ep09j`}]]),vr=V(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),yr=V(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),br=V(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),xr=V(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Sr=V(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Cr=V(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),wr=V(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Tr=V(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Er=V(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Dr=V(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Or=V(`mail-warning`,[[`path`,{d:`M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5`,key:`e61zoh`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M20 14v4`,key:`1hm744`}],[`path`,{d:`M20 22v.01`,key:`12bgn6`}]]),kr=V(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Ar=V(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),jr=V(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Mr=V(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),Nr=V(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Pr=V(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Fr=V(`notepad-text`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`16`,height:`18`,x:`4`,y:`4`,rx:`2`,key:`1u9h20`}],[`path`,{d:`M8 10h6`,key:`3oa6kw`}],[`path`,{d:`M8 14h8`,key:`1fgep2`}],[`path`,{d:`M8 18h5`,key:`17enja`}]]),Ir=V(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Lr=V(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Rr=V(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),zr=V(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Br=V(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Vr=V(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Hr=V(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Ur=V(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Wr=V(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Gr=V(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Kr=V(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qr=V(`shield-x`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m14.5 9.5-5 5`,key:`17q4r4`}],[`path`,{d:`m9.5 9.5 5 5`,key:`18nt4w`}]]),Jr=V(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Yr=V(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Xr=V(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Zr=V(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),Qr=V(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),$r=V(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),ei=V(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ti=V(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),ni=V(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ri=V(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ii=V(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ai=V(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),oi=V(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),si=V(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),H=Ie();function ci({className:e,error:t,title:n,showReturnToHome:r,children:i}){let{user:a,isLoading:o}=Re();return Dn(a),(0,H.jsxs)(fn,{className:p(`text-red p-5 border border-red rounded-md m-12 mt-36`,e),children:[(0,H.jsxs)(ln,{children:[(0,H.jsx)(cn,{className:`text-2xl`,children:(0,H.jsx)(`h2`,{children:n??`Component Error`})}),(0,H.jsx)(dn,{children:t.message})]}),(0,H.jsxs)(un,{children:[i,r!==!1&&(a&&!o?(0,H.jsx)(I,{to:`/`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Return to Home`]})}):(0,H.jsx)(I,{to:`/sign-in`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Go to Sign In Page`]})}))]})]})}function li(){let{user:e,isLoading:t}=Re();return Dn(e),(0,H.jsx)(`div`,{className:`flex items-center justify-center h-screen px-3`,children:(0,H.jsxs)(fn,{className:`text-red p-5 border border-red rounded-md w-full max-w-md`,children:[(0,H.jsx)(ln,{children:(0,H.jsx)(cn,{className:`text-2xl`,children:(0,H.jsx)(`h2`,{children:`Sorry, Page Not Found`})})}),(0,H.jsx)(un,{children:e&&!t?(0,H.jsx)(I,{to:`/`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Return to Home`]})}):(0,H.jsx)(I,{to:`/sign-in`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Go Sign In Page`]})})})]})})}function ui(){return`ontouchstart`in window||navigator.maxTouchPoints>0}function di(e){return!!e}var U=e(Ne(),1),fi=!1;function pi(){(0,U.useEffect)(()=>{fi||=!0},[])}function mi(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Se,{}),(0,H.jsx)(Ee,{})]})}var hi=ye()({component:mi});function gi(){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 126.644 96`,width:24,height:24,children:(0,H.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 _i(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`img`,{src:`/harper-studio_white.png`,alt:`Harper Studio`,className:`w-64 hidden md:inline-block`}),(0,H.jsx)(`img`,{src:`/HDBDogOnly.svg`,width:`50px`,height:`44px`,alt:`Harper`,className:`inline-block md:hidden`})]})}function vi(){let[e,t]=(0,U.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return(0,U.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),n=e=>t(e.matches?`dark`:`light`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var yi=(0,U.createContext)([`system`,()=>{}]);function bi({children:e}){let[t,n]=xn(Cn.Theme,`system`),r=vi();return(0,U.useEffect)(()=>{let e=t===`dark`||t===`system`&&r===`dark`;document.documentElement.classList.toggle(`dark`,e)},[t,r]),(0,H.jsx)(yi.Provider,{value:[t,n],children:e})}function xi(){return(0,U.useContext)(yi)}var Si=[{value:`light`,icon:(0,H.jsx)(Xr,{className:`size-4`}),label:`Light`},{value:`system`,icon:(0,H.jsx)(Nr,{className:`size-4`}),label:`System`},{value:`dark`,icon:(0,H.jsx)(Pr,{className:`size-4`}),label:`Dark`}];function Ci(){let[e,t]=xi();return(0,H.jsx)(`div`,{className:`flex items-center bg-muted dark:bg-black rounded-xl p-0.5 gap-0.5`,children:Si.map(({value:n,icon:r,label:i})=>(0,H.jsx)(`button`,{type:`button`,title:i,onClick:()=>t(n),className:`p-1.5 rounded-lg transition-colors ${e===n?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`}`,children:r},n))})}function wi({className:e,...t}){return(0,H.jsx)(`div`,{className:p(`absolute top-full left-0 isolate z-50 flex justify-center`),children:(0,H.jsx)(ut,{"data-slot":`navigation-menu-viewport`,className:p(`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 Ti({className:e,children:t,viewport:n=!0,...r}){return(0,H.jsxs)(ot,{"data-slot":`navigation-menu`,"data-viewport":n,className:p(`group/navigation-menu relative flex max-w-max flex-1 items-center justify-center`,e),...r,children:[t,n&&(0,H.jsx)(wi,{})]})}function Ei({className:e,...t}){return(0,H.jsx)(mt,{"data-slot":`navigation-menu-item`,className:p(`relative`,e),...t})}function Di({className:e,...t}){return(0,H.jsx)(vt,{"data-slot":`navigation-menu-link`,className:p(`hover:text-foreground dark: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 Oi({className:e,...t}){return(0,H.jsx)(nt,{"data-slot":`navigation-menu-list`,className:p(`group flex flex-1 list-none items-center justify-center gap-1`,e),...t})}function ki({delayDuration:e=0,...t}){return(0,H.jsx)(Ke,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ai({...e}){return(0,H.jsx)(ki,{children:(0,H.jsx)(Ht,{"data-slot":`tooltip`,...e})})}function ji({...e}){return(0,H.jsx)(ft,{"data-slot":`tooltip-trigger`,...e})}function Mi({className:e,sideOffset:t=0,arrowClassName:n,children:r,...i}){return(0,H.jsx)(Wt,{children:(0,H.jsxs)(gt,{"data-slot":`tooltip-content`,sideOffset:t,className:p(`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,H.jsx)(Qe,{className:p(`bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`,n)})]})})}var Ni=D(`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-foreground [a&]:hover:bg-yellow/90`,success:`border-green bg-green/40 text-foreground [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-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function Pi(){let e=`v5.2.0-alpha.4`;return(0,H.jsx)(`a`,{href:e.startsWith(`v`)?`https://github.com/HarperFast/studio/releases/tag/${e}`:`https://github.com/HarperFast/studio/releases`,target:`_blank`,rel:`noopener noreferrer`,children:(0,H.jsxs)(`span`,{className:p(Ni({variant:`default`}),`text-xs inline-block ml-2 align-text-top`),children:[e,` BETA`]})})}function Fi(e={}){let{instanceId:t,clusterId:n}=M({strict:!1});return h({id:u,...e})}function Ii(e={}){let{instanceId:t,clusterId:n}=M({strict:!1});return{instanceClient:h({id:u,...e}),entityType:`instance`}}function W(e={}){let{instanceId:t,clusterId:n}=M({strict:!1});return(0,U.useMemo)(()=>Li({instanceId:t,clusterId:n,...e}),[e.instanceId??t,e.clusterId??n,e.operationsUrl,e.port,e.secure,e.disableFabricConnect,e.forceFabricConnect])}function Li({instanceId:e,clusterId:t,...n}){let r=u;if(!r)throw Error(`id could not be automatically calculated in useInstanceClientIdParams`);return{instanceClient:h({id:r,...n}),entityId:r,entityType:`instance`}}function Ri(){localStorage.clear()}function zi(){sessionStorage.clear()}async function Bi(){i.setUserForEntity(u,null),yn.getQueryCache().clear(),Ri(),zi(),await yn.invalidateQueries({refetchType:`none`})}async function Vi(e){await i.signOutFromPotentiallyAuthenticatedInstances(),await d({...e,entityId:u})}function Hi(){let e=Fi();return j({mutationFn:()=>Vi({instanceClient:e}),onSuccess:Bi})}var Ui={className:`text-foreground dark:text-white font-semibold`};function Wi(){let{mutate:e}=Hi(),t=L(),{user:n}=Re(),r=se(),i=(0,U.useCallback)(()=>{e(void 0,{onSuccess:async()=>{B.success(`Success`,{description:`You have been signed out successfully.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),t({to:`/sign-in`}),r.invalidate()}})},[e,r,t]),a=(0,U.useMemo)(()=>[!1,{to:`https://docs.harperdb.io/docs`,target:`_blank`,icon:(0,H.jsx)(Ln,{}),text:`Docs`,textBreakpoint:`md`},{to:`https://github.com/HarperFast/studio/issues`,target:`_blank`,icon:(0,H.jsx)(zn,{}),text:`Report an Issue`,textBreakpoint:`lg`},{to:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,icon:(0,H.jsx)(gi,{}),text:`Discord`,textBreakpoint:`lg`},{onClick:i,icon:(0,H.jsx)(Dr,{}),text:`Sign Out`,textBreakpoint:`md`}].filter(di),[i]);return n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Yi,{menuItems:a}),(0,H.jsx)(qi,{menuItems:a})]}):(0,H.jsx)(Ki,{})}function Gi(e){return e.items!==void 0}function Ki(){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`inline-block`,children:[(0,H.jsx)(I,{to:`/sign-in`,children:(0,H.jsx)(_i,{})}),(0,H.jsx)(Pi,{})]}),(0,H.jsx)(Ti,{children:(0,H.jsxs)(Oi,{className:`text-muted-foreground dark:text-grey-400`,children:[(0,H.jsx)(Ei,{children:(0,H.jsx)(Di,{asChild:!0,children:(0,H.jsxs)(I,{to:`https://docs.harperdb.io/docs`,target:`_blank`,rel:`noreferrer noopener`,className:`flex-row items-center`,children:[(0,H.jsx)(Ln,{}),` `,(0,H.jsx)(`span`,{className:`hidden md:inline-block`,children:`Docs`})]})})}),(0,H.jsx)(Ei,{children:(0,H.jsx)(Ci,{})}),(0,H.jsx)(Ei,{children:(0,H.jsx)(Di,{asChild:!0,children:(0,H.jsxs)(I,{to:`/sign-in`,className:`flex-row items-center`,activeProps:Ui,children:[(0,H.jsx)(Er,{}),` Sign In`]})})})]})})]})}function qi({menuItems:e}){let{user:t}=Re();return Dn(t),(0,H.jsx)(`div`,{className:`hidden md:[@media(hover:hover)]:block xl:block`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`inline-block`,children:[(0,H.jsx)(I,{to:`/`,children:(0,H.jsx)(_i,{})}),(0,H.jsx)(Pi,{})]}),(0,H.jsx)(Ti,{children:(0,H.jsxs)(Oi,{className:`text-muted-foreground dark:text-grey-400`,children:[e.map(e=>Gi(e)?!!e.items.length&&(0,H.jsx)(`div`,{className:`bg-muted dark:bg-black rounded-2xl flex`,children:e.items.map(e=>(0,H.jsx)(Ji,{menuItem:e},e.text))},e.text):(0,H.jsx)(Ji,{menuItem:e},e.text)),(0,H.jsx)(Ei,{children:(0,H.jsx)(Ci,{})})]})})]})})}function Ji({menuItem:e}){return(0,H.jsx)(Ei,{className:`text-muted-foreground dark:text-gray-400 hover:text-foreground dark:hover:text-white`,children:(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(Di,{asChild:!0,children:(0,H.jsxs)(I,{to:e.to,onClick:e.onClick,"aria-label":e.text,className:`flex-row items-center`,target:e.target,activeProps:e.to?Ui:void 0,children:[e.icon,(0,H.jsx)(`span`,{className:`hidden ${e.textBreakpoint}:inline-block`,children:e.text}),(0,H.jsx)(`span`,{className:`${e.textBreakpoint}:hidden`,children:`\xA0`})]})})}),(0,H.jsx)(Mi,{side:`bottom`,className:`${e.textBreakpoint}:hidden`,children:e.text})]})})}function Yi({menuItems:e}){let{user:t}=Re();Dn(t);let[n,r]=(0,U.useState)(!1),i=(0,U.useCallback)(()=>r(e=>!e),[]),a=(0,U.useCallback)(()=>r(!1),[]);return(0,H.jsxs)(`div`,{className:`md:[@media(hover:hover)]:hidden xl:hidden`,id:`mobile-menu`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(I,{to:`/`,children:(0,H.jsx)(_i,{})}),(0,H.jsx)(Pi,{}),(0,H.jsxs)(`button`,{type:`button`,className:`shadow-xs text-muted-foreground dark:text-grey-400 hover:text-foreground dark:hover:text-white hover:bg-muted dark:hover:bg-black-dark`,onClick:i,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:n?`Close menu`:`Open menu`}),n?(0,H.jsx)(_n,{}):(0,H.jsx)(jr,{})]})]}),(0,H.jsx)(`div`,{className:`${n?`fixed`:`hidden`} top-40 bottom-0 left-0 right-0 bg-foreground/20 dark:bg-black-dark dark:opacity-70`,onClick:a}),(0,H.jsxs)(`div`,{className:`${n?`block`:`hidden`} md:hidden z-50 space-y-1 pb-3 bg-card border-b border-border dark:bg-black-dark dark:border-none absolute left-0 top-full w-full rounded-b-md`,children:[(0,H.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,H.jsx)(Ci,{})}),e.map(e=>Gi(e)?!!e.items.length&&(0,H.jsx)(`div`,{className:`bg-muted dark:bg-black pl-10 pr-2 py-2`,children:e.items.map(e=>(0,H.jsx)(Xi,{menuItem:e,onClick:a},e.text))},e.text):(0,H.jsx)(Xi,{menuItem:e,onClick:a},e.text))]})]})}function Xi({menuItem:e,onClick:t}){let n=(0,U.useCallback)(()=>{e.onClick?.(),t()},[e,t]);return(0,H.jsxs)(I,{to:e.to,onClick:n,target:e.target,className:`flex flex-row px-3 py-2 text-base font-medium rounded-md text-muted-foreground dark:text-gray-400 hover:text-foreground dark:hover:text-white`,activeProps:e.to?Ui:void 0,children:[e.icon,(0,H.jsx)(`span`,{className:`ml-4`,children:e.text})]})}function Zi(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-gradient-to-r from-violet-100 to-white border-b border-violet-200 dark:from-purple-950 dark:to-zinc-900 dark:border-purple-950 md:px-12`,children:(0,H.jsx)(Wi,{})}),(0,H.jsxs)(`div`,{className:`pt-20 h-screen grid grid-cols-1 md:grid-cols-2`,children:[(0,H.jsx)(`section`,{"aria-label":`Harper Fabric overview`,className:`items-center justify-center hidden text-white md:flex px-6 fabricSignupTextContainer`,children:(0,H.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,H.jsx)(`main`,{className:`overflow-y-auto px-6 bg-white dark:bg-linear-(--black-dark-gradient) border-l border-border dark:border-none`,children:(0,H.jsx)(`div`,{className:`min-h-full flex items-start justify-center py-12`,children:(0,H.jsx)(Ee,{})})})]})]})}var Qi;function $i(){(0,U.useEffect)(()=>{},[])}var ea=[`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 ta(e){if(!e||!e.includes(`@`))return null;let t=e.split(`@`).pop()||``;if(!t)return null;for(let e of ea)if(t===e||t.endsWith(`.`+e))return null;return t}var na=`utm_`;function ra(e){let t=new URLSearchParams(e),n=Array.from(t.keys()).filter(e=>e.toLowerCase().startsWith(na));if(n.length===0)return e;for(let e of n)t.delete(e);let r=t.toString();return r?`?${r}`:``}function ia(){if(typeof location>`u`||typeof history>`u`)return;let{search:e,pathname:t,hash:n,origin:r}=location,i=ra(e);i!==e&&history.replaceState(history.state,``,`${r}${t}${i}${n}`)}var aa=null;function oa(){let e=L(),t=se(),n=le(),{redirect:r}=pe({strict:!1});return(0,U.useEffect)(()=>{aa||=(async function(){let a=await o().catch(()=>null);if(!a)B.error(`We were not able to verify your sign-in. Please try signing in again.`,{duration:1e4}),await e({to:`/sign-in`});else{i.setUserForEntity(u,a),ia();let o=Dn(a),s=ta(a.email);Qi?.identify?.({username:a.email,type:`email`,...s?{company:s}:{}}),await n.invalidateQueries({queryKey:v,refetchType:`none`}),await t.invalidate(),await e({to:r?.startsWith(`/`)?r:o})}aa=null})()},[]),(0,H.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-foreground dark:text-white w-lg flex flex-col gap-4`,children:[(0,H.jsxs)(`h1`,{className:`text-3xl font-light`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-2xl animate-flower-dance mr-4`,title:`Loading`,children:`🌼`}),`Checking...`]}),(0,H.jsx)(`div`,{className:`underline flex gap-4`,children:(0,H.jsx)(I,{className:`text-sm opacity-50 text-muted-foreground hover:text-foreground dark:text-inherit dark:hover:text-blue-300`,to:`/sign-in`,children:`Try signing in again`})})]})}var sa=new Map;function ca(e){if(!e)return``;if(sa.has(e))return sa.get(e);let t=e.replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim();if(!t)return sa.set(e,``),``;let n=t.match(/([A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|[0-9]+)/g);if(!n)return sa.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(la).join(` `);return sa.set(e,i),i}function la(e){return/^[A-Z]{2,3}s?$/.test(e)||/^[0-9]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function ua({restartRequired:e}){let t=Ae(),{organization:n,instance:r,cluster:i}=Me({strict:!1});return(0,H.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,U.useMemo)(()=>{let e=t.pathname.split(`/`).filter(e=>e&&e.length>0),a=[(0,H.jsxs)(I,{to:`/`,children:[(0,H.jsx)(vr,{"aria-hidden":`true`,className:`size-5 shrink-0`}),(0,H.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=ca(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,H.jsx)(`svg`,{fill:`currentColor`,viewBox:`0 0 20 20`,"aria-hidden":`true`,className:`size-5 shrink-0 text-grey`,children:(0,H.jsx)(`path`,{d:`M5.555 17.776l8-16 .894.448-8 16-.894-.448z`})},a.length+`-dash`),(0,H.jsx)(I,{to:s,className:`text-xs md:text-sm font-medium hover:text-grey truncate max-w-48`,children:c},s))}return a},[t.pathname,i?.name,r?.name,n?.name]),e&&(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(`div`,{className:`text-xs italic text-muted-foreground`,children:[`* Restart `,(0,H.jsx)(`span`,{className:`hidden lg:inline-block`,children:`Requested`})]})}),(0,H.jsxs)(Mi,{side:`bottom`,children:[`This `,`Instance`,` is requesting a restart, when convenient, to apply your latest changes.`,(0,H.jsx)(`br`,{}),`You can do this from the Apps or Config pages.`]})]})]})}var G=Ct,da=(0,U.createContext)({}),fa=(0,U.createContext)({});function pa(){let e=(0,U.useContext)(da),t=(0,U.useContext)(fa),{getFieldState:n}=Tt(),r=et({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 K({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=pa();return(0,H.jsx)(Je,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function q({...e}){return(0,H.jsx)(da,{value:{name:e.name},children:(0,H.jsx)(an,{...e})})}function J({className:e,...t}){return(0,H.jsx)(fa,{value:{id:(0,U.useId)()},children:(0,H.jsx)(`div`,{"data-slot":`form-item`,className:p(`grid gap-2`,e),...t})})}function ma({className:e,...t}){return(0,H.jsx)(Pt,{"data-slot":`label`,className:p(`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 Y({className:e,...t}){let{error:n,formItemId:r}=pa();return(0,H.jsx)(ma,{"data-slot":`form-label`,"data-error":!!n,className:p(`data-[error=true]:text-destructive`,e),htmlFor:r,...t})}function X({className:e,...t}){let{error:n,formMessageId:r}=pa(),i=n?String(n?.message):t.children;return i?(0,H.jsx)(`p`,{"data-slot":`form-message`,id:r,className:p(`text-destructive text-sm`,e),...t,children:i}):null}function Z({className:e,type:t,...n}){return(0,H.jsx)(`input`,{type:t,"data-slot":`input`,className:p(`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/setup-TGCErIhq.js","assets/vendor-datadog-DBn-aOxh.js","assets/rolldown-runtime-CNC7AqOf.js","assets/editor.api2-4ndOupAA.js","assets/editor-Br_kD0ds.css","assets/dist-DHjL6trB.js","assets/editor.api-CeFEtu5G.js","assets/index.lazy-CAmCIA65.js","assets/button-i10JPNcp.js","assets/vendor-core-vIXn_E4D.js","assets/vendor-tanstack-Dl75hT33.js","assets/vendor-react-B36dp27u.js","assets/vendor-ui-Bm4W8wqw.js","assets/useEntityRestURL-JO2mfWTQ.js","assets/index-BFYFtDGD.css","assets/applications-C0jT2vdZ.js","assets/useAuth-BOaK3koG.js","assets/card-hTrVZWnN.js","assets/createLucideIcon-B49W6uF4.js","assets/x-Bru-nCti.js","assets/tabs-Bp4JTzdg.js","assets/setComponentFile-DLW1DHCt.js","assets/queryClient-DK1L0t7F.js","assets/errorText-NpBmvk9I.js","assets/localStorageKeys-D_mgWLDC.js","assets/applications-DNZhsH95.css","assets/jsonMode-DD1NLQKv.js","assets/workers-uOo7WLaa.js","assets/lspLanguageFeatures-ira2aEJh.js","assets/tsMode-DJ6Sl24Q.js","assets/FloatingChat-CPyPIcVR.js","assets/react-SMksfEpE.js","assets/status-DG0Maoao.js","assets/linear-Clj7BvYC.js","assets/string-f6JzSHaO.js","assets/defaultLocale-C8Fc0cco.js","assets/init-Cs1-1e_z.js","assets/ordinal-BeZAVUpG.js","assets/time-V48BpMN7.js","assets/band-CcbG6rPL.js","assets/path-BWPyau1x.js","assets/math-Bi_r_ZWc.js","assets/array-BifhSqXX.js","assets/isArrayLikeObject-BuP4GVJp.js","assets/line-D7sRByN6.js","assets/react-redux-DGXfzMhm.js","assets/getAnalytics-CmXDoq4g.js","assets/profile-CaF-4aZe.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,r as t,t as n}from"./rolldown-runtime-CNC7AqOf.js";import{_ as r,a as i,c as a,d as o,f as s,g as c,h as l,i as u,l as d,m as f,n as p,o as m,p as h,s as g,t as _,u as v,v as y}from"./button-i10JPNcp.js";import{A as b,M as x,_ as S,a as C,b as w,c as T,f as E,g as ee,k as D,l as O,m as k,n as A,o as te,r as ne,v as re,x as ie}from"./vendor-core-vIXn_E4D.js";import{A as j,B as ae,C as M,D as oe,E as se,F as ce,I as le,M as ue,N,O as de,P as fe,S as pe,_ as P,a as me,b as he,c as ge,d as _e,f as ve,g as ye,i as be,j as F,k as xe,l as Se,m as Ce,n as we,o as Te,p as Ee,r as De,s as Oe,t as ke,u as Ae,v as I,w as je,x as L,y as Me}from"./vendor-tanstack-Dl75hT33.js";import{a as Ne,i as Pe,t as Fe}from"./vendor-datadog-DBn-aOxh.js";import{r as Ie,t as Le}from"./vendor-react-B36dp27u.js";import{a as Re,i as ze,n as Be,o as Ve,r as He,t as Ue}from"./useAuth-BOaK3koG.js";import{$ as We,A as Ge,At as Ke,B as qe,Bt as Je,C as Ye,Ct as Xe,D as Ze,Dt as Qe,E as $e,Et as et,F as tt,Ft as nt,G as rt,H as it,I as at,It as ot,J as st,K as ct,L as lt,Lt as ut,M as dt,Mt as ft,N as pt,Nt as mt,O as ht,Ot as gt,P as _t,Pt as vt,Q as yt,R as bt,Rt as xt,S as St,St as Ct,T as wt,Tt,U as Et,V as Dt,W as Ot,X as kt,Y as At,Z as jt,at as Mt,b as Nt,bt as Pt,ct as Ft,dt as It,et as Lt,ft as Rt,ht as zt,it as Bt,j as Vt,jt as Ht,k as Ut,kt as Wt,lt as Gt,mt as Kt,nt as qt,ot as Jt,pt as Yt,q as Xt,rt as Zt,st as Qt,tt as $t,ut as en,v as tn,w as nn,wt as R,x as rn,xt as an,y as on,yt as z,z as sn,zt as B}from"./vendor-ui-Bm4W8wqw.js";import{a as cn,i as ln,n as un,r as dn,t as fn}from"./card-hTrVZWnN.js";import{t as V}from"./createLucideIcon-B49W6uF4.js";import{a as pn,i as mn,n as hn,r as gn,t as _n}from"./x-Bru-nCti.js";import{t as vn}from"./errorText-NpBmvk9I.js";import{n as yn}from"./queryClient-DK1L0t7F.js";import{i as bn,n as xn,r as Sn,t as Cn}from"./localStorageKeys-D_mgWLDC.js";import{h as wn,n as Tn}from"./editor.api2-4ndOupAA.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)}})();function En(e){return e!==null&&!!e.username}function Dn(e){if(e&&!En(e)){let t=Object.keys(e.roles);if(t.length===1)return`/${t[0]}`}return`/`}var On=V(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),kn=V(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),An=V(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),jn=V(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),Mn=V(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),Nn=V(`arrow-up-down`,[[`path`,{d:`m21 16-4 4-4-4`,key:`f6ql7i`}],[`path`,{d:`M17 20V4`,key:`1ejh1v`}],[`path`,{d:`m3 8 4-4 4 4`,key:`11wl7u`}],[`path`,{d:`M7 4v16`,key:`1glfcx`}]]),Pn=V(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),Fn=V(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),In=V(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Ln=V(`book-open-text`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M16 12h2`,key:`7q9ll5`}],[`path`,{d:`M16 8h2`,key:`msurwy`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}],[`path`,{d:`M6 12h2`,key:`32wvfc`}],[`path`,{d:`M6 8h2`,key:`30oboj`}]]),Rn=V(`brush-cleaning`,[[`path`,{d:`m16 22-1-4`,key:`1ow2iv`}],[`path`,{d:`M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1`,key:`11gii7`}],[`path`,{d:`M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z`,key:`bju7h4`}],[`path`,{d:`m8 22 1-4`,key:`s3unb`}]]),zn=V(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),Bn=V(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),Vn=V(`chart-pie`,[[`path`,{d:`M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z`,key:`pzmjnu`}],[`path`,{d:`M21.21 15.89A10 10 0 1 1 8 2.83`,key:`k2fpak`}]]),Hn=V(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Un=V(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),Wn=V(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Gn=V(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Kn=V(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qn=V(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),Jn=V(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),Yn=V(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),Xn=V(`clipboard`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}]]),Zn=V(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),Qn=V(`cloud-download`,[[`path`,{d:`M12 13v8l-4-4`,key:`1f5nwf`}],[`path`,{d:`m12 21 4-4`,key:`1lfcce`}],[`path`,{d:`M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284`,key:`ui1hmy`}]]),$n=V(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),er=V(`columns-3-cog`,[[`path`,{d:`M10.5 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v5.5`,key:`1g2yzs`}],[`path`,{d:`m14.3 19.6 1-.4`,key:`11sv9r`}],[`path`,{d:`M15 3v7.5`,key:`7lm50a`}],[`path`,{d:`m15.2 16.9-.9-.3`,key:`1t7mvx`}],[`path`,{d:`m16.6 21.7.3-.9`,key:`1j67ps`}],[`path`,{d:`m16.8 15.3-.4-1`,key:`1ei7r6`}],[`path`,{d:`m19.1 15.2.3-.9`,key:`18r7jp`}],[`path`,{d:`m19.6 21.7-.4-1`,key:`z2vh2`}],[`path`,{d:`m20.7 16.8 1-.4`,key:`19m87a`}],[`path`,{d:`m21.7 19.4-.9-.3`,key:`1qgwi9`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),tr=V(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),nr=V(`credit-card`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`2`,key:`ynyp8z`}],[`line`,{x1:`2`,x2:`22`,y1:`10`,y2:`10`,key:`1b3vmo`}]]),rr=V(`database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),ir=V(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),ar=V(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),or=V(`eye-off`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),sr=V(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),cr=V(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),lr=V(`funnel-plus`,[[`path`,{d:`M13.354 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14v6a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341l1.218-1.348`,key:`8mvsmf`}],[`path`,{d:`M16 6h6`,key:`1dogtp`}],[`path`,{d:`M19 3v6`,key:`1ytpjt`}]]),ur=V(`funnel-x`,[[`path`,{d:`M12.531 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14v6a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341l.427-.473`,key:`ol2ft2`}],[`path`,{d:`m16.5 3.5 5 5`,key:`15e6fa`}],[`path`,{d:`m21.5 3.5-5 5`,key:`m0lwru`}]]),dr=V(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),fr=V(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),pr=V(`git-graph`,[[`circle`,{cx:`5`,cy:`6`,r:`3`,key:`1qnov2`}],[`path`,{d:`M5 9v6`,key:`158jrl`}],[`circle`,{cx:`5`,cy:`18`,r:`3`,key:`104gr9`}],[`path`,{d:`M12 3v18`,key:`108xh3`}],[`circle`,{cx:`19`,cy:`6`,r:`3`,key:`108a5v`}],[`path`,{d:`M16 15.7A9 9 0 0 0 19 9`,key:`1e3vqb`}]]),mr=V(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),hr=V(`grip-horizontal`,[[`circle`,{cx:`12`,cy:`9`,r:`1`,key:`124mty`}],[`circle`,{cx:`19`,cy:`9`,r:`1`,key:`1ruzo2`}],[`circle`,{cx:`5`,cy:`9`,r:`1`,key:`1a8b28`}],[`circle`,{cx:`12`,cy:`15`,r:`1`,key:`1e56xg`}],[`circle`,{cx:`19`,cy:`15`,r:`1`,key:`1a92ep`}],[`circle`,{cx:`5`,cy:`15`,r:`1`,key:`5r1jwy`}]]),gr=V(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),_r=V(`handshake`,[[`path`,{d:`m11 17 2 2a1 1 0 1 0 3-3`,key:`efffak`}],[`path`,{d:`m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4`,key:`9pr0kb`}],[`path`,{d:`m21 3 1 11h-2`,key:`1tisrp`}],[`path`,{d:`M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3`,key:`1uvwmv`}],[`path`,{d:`M3 4h8`,key:`1ep09j`}]]),vr=V(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`r6nss1`}]]),yr=V(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),br=V(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),xr=V(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),Sr=V(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Cr=V(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),wr=V(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Tr=V(`lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Er=V(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Dr=V(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Or=V(`mail-warning`,[[`path`,{d:`M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5`,key:`e61zoh`}],[`path`,{d:`m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7`,key:`1ocrg3`}],[`path`,{d:`M20 14v4`,key:`1hm744`}],[`path`,{d:`M20 22v.01`,key:`12bgn6`}]]),kr=V(`map-pin`,[[`path`,{d:`M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0`,key:`1r0f0z`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}]]),Ar=V(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),jr=V(`menu`,[[`path`,{d:`M4 5h16`,key:`1tepv9`}],[`path`,{d:`M4 12h16`,key:`1lakjw`}],[`path`,{d:`M4 19h16`,key:`1djgab`}]]),Mr=V(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),Nr=V(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Pr=V(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Fr=V(`notepad-text`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`16`,height:`18`,x:`4`,y:`4`,rx:`2`,key:`1u9h20`}],[`path`,{d:`M8 10h6`,key:`3oa6kw`}],[`path`,{d:`M8 14h8`,key:`1fgep2`}],[`path`,{d:`M8 18h5`,key:`17enja`}]]),Ir=V(`package`,[[`path`,{d:`M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z`,key:`1a0edw`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}]]),Lr=V(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Rr=V(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),zr=V(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),Br=V(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Vr=V(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Hr=V(`scale`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`path`,{d:`m19 8 3 8a5 5 0 0 1-6 0zV7`,key:`zcdpyk`}],[`path`,{d:`M3 7h1a17 17 0 0 0 8-2 17 17 0 0 0 8 2h1`,key:`1yorad`}],[`path`,{d:`m5 8 3 8a5 5 0 0 1-6 0zV7`,key:`eua70x`}],[`path`,{d:`M7 21h10`,key:`1b0cd5`}]]),Ur=V(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Wr=V(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),Gr=V(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Kr=V(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),qr=V(`shield-x`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m14.5 9.5-5 5`,key:`17q4r4`}],[`path`,{d:`m9.5 9.5 5 5`,key:`18nt4w`}]]),Jr=V(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),Yr=V(`square-pen`,[[`path`,{d:`M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7`,key:`1m0v6g`}],[`path`,{d:`M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z`,key:`ohrbg2`}]]),Xr=V(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),Zr=V(`table-2`,[[`path`,{d:`M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18`,key:`gugj83`}]]),Qr=V(`table`,[[`path`,{d:`M12 3v18`,key:`108xh3`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}],[`path`,{d:`M3 15h18`,key:`5xshup`}]]),$r=V(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),ei=V(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),ti=V(`ticket`,[[`path`,{d:`M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z`,key:`qn84l0`}],[`path`,{d:`M13 5v2`,key:`dyzc3o`}],[`path`,{d:`M13 17v2`,key:`1ont0d`}],[`path`,{d:`M13 11v2`,key:`1wjjxi`}]]),ni=V(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ri=V(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),ii=V(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ai=V(`user`,[[`path`,{d:`M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2`,key:`975kel`}],[`circle`,{cx:`12`,cy:`7`,r:`4`,key:`17ys0d`}]]),oi=V(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),si=V(`zap`,[[`path`,{d:`M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z`,key:`1xq2db`}]]),H=Ie();function ci({className:e,error:t,title:n,showReturnToHome:r,children:i}){let{user:a,isLoading:o}=Re();return Dn(a),(0,H.jsxs)(fn,{className:p(`text-red p-5 border border-red rounded-md m-12 mt-36`,e),children:[(0,H.jsxs)(ln,{children:[(0,H.jsx)(cn,{className:`text-2xl`,children:(0,H.jsx)(`h2`,{children:n??`Component Error`})}),(0,H.jsx)(dn,{children:t.message})]}),(0,H.jsxs)(un,{children:[i,r!==!1&&(a&&!o?(0,H.jsx)(I,{to:`/`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Return to Home`]})}):(0,H.jsx)(I,{to:`/sign-in`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Go to Sign In Page`]})}))]})]})}function li(){let{user:e,isLoading:t}=Re();return Dn(e),(0,H.jsx)(`div`,{className:`flex items-center justify-center h-screen px-3`,children:(0,H.jsxs)(fn,{className:`text-red p-5 border border-red rounded-md w-full max-w-md`,children:[(0,H.jsx)(ln,{children:(0,H.jsx)(cn,{className:`text-2xl`,children:(0,H.jsx)(`h2`,{children:`Sorry, Page Not Found`})})}),(0,H.jsx)(un,{children:e&&!t?(0,H.jsx)(I,{to:`/`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Return to Home`]})}):(0,H.jsx)(I,{to:`/sign-in`,children:(0,H.jsxs)(_,{children:[` `,(0,H.jsx)(jn,{}),` Go Sign In Page`]})})})]})})}function ui(){return`ontouchstart`in window||navigator.maxTouchPoints>0}function di(e){return!!e}var U=e(Ne(),1),fi=!1;function pi(){(0,U.useEffect)(()=>{fi||=!0},[])}function mi(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Se,{}),(0,H.jsx)(Ee,{})]})}var hi=ye()({component:mi});function gi(){return(0,H.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 126.644 96`,width:24,height:24,children:(0,H.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 _i(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`img`,{src:`/harper-studio_white.png`,alt:`Harper Studio`,className:`w-64 hidden md:inline-block`}),(0,H.jsx)(`img`,{src:`/HDBDogOnly.svg`,width:`50px`,height:`44px`,alt:`Harper`,className:`inline-block md:hidden`})]})}function vi(){let[e,t]=(0,U.useState)(()=>window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`);return(0,U.useEffect)(()=>{let e=window.matchMedia(`(prefers-color-scheme: dark)`),n=e=>t(e.matches?`dark`:`light`);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}var yi=(0,U.createContext)([`system`,()=>{}]);function bi({children:e}){let[t,n]=xn(Cn.Theme,`system`),r=vi();return(0,U.useEffect)(()=>{let e=t===`dark`||t===`system`&&r===`dark`;document.documentElement.classList.toggle(`dark`,e)},[t,r]),(0,H.jsx)(yi.Provider,{value:[t,n],children:e})}function xi(){return(0,U.useContext)(yi)}var Si=[{value:`light`,icon:(0,H.jsx)(Xr,{className:`size-4`}),label:`Light`},{value:`system`,icon:(0,H.jsx)(Nr,{className:`size-4`}),label:`System`},{value:`dark`,icon:(0,H.jsx)(Pr,{className:`size-4`}),label:`Dark`}];function Ci(){let[e,t]=xi();return(0,H.jsx)(`div`,{className:`flex items-center bg-muted dark:bg-black rounded-xl p-0.5 gap-0.5`,children:Si.map(({value:n,icon:r,label:i})=>(0,H.jsx)(`button`,{type:`button`,title:i,onClick:()=>t(n),className:`p-1.5 rounded-lg transition-colors ${e===n?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`}`,children:r},n))})}function wi({className:e,...t}){return(0,H.jsx)(`div`,{className:p(`absolute top-full left-0 isolate z-50 flex justify-center`),children:(0,H.jsx)(ut,{"data-slot":`navigation-menu-viewport`,className:p(`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 Ti({className:e,children:t,viewport:n=!0,...r}){return(0,H.jsxs)(ot,{"data-slot":`navigation-menu`,"data-viewport":n,className:p(`group/navigation-menu relative flex max-w-max flex-1 items-center justify-center`,e),...r,children:[t,n&&(0,H.jsx)(wi,{})]})}function Ei({className:e,...t}){return(0,H.jsx)(mt,{"data-slot":`navigation-menu-item`,className:p(`relative`,e),...t})}function Di({className:e,...t}){return(0,H.jsx)(vt,{"data-slot":`navigation-menu-link`,className:p(`hover:text-foreground dark: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 Oi({className:e,...t}){return(0,H.jsx)(nt,{"data-slot":`navigation-menu-list`,className:p(`group flex flex-1 list-none items-center justify-center gap-1`,e),...t})}function ki({delayDuration:e=0,...t}){return(0,H.jsx)(Ke,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}function Ai({...e}){return(0,H.jsx)(ki,{children:(0,H.jsx)(Ht,{"data-slot":`tooltip`,...e})})}function ji({...e}){return(0,H.jsx)(ft,{"data-slot":`tooltip-trigger`,...e})}function Mi({className:e,sideOffset:t=0,arrowClassName:n,children:r,...i}){return(0,H.jsx)(Wt,{children:(0,H.jsxs)(gt,{"data-slot":`tooltip-content`,sideOffset:t,className:p(`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,H.jsx)(Qe,{className:p(`bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]`,n)})]})})}var Ni=D(`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-foreground [a&]:hover:bg-yellow/90`,success:`border-green bg-green/40 text-foreground [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-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground`}},defaultVariants:{variant:`default`}});function Pi(){let e=`v5.2.0-alpha.5`;return(0,H.jsx)(`a`,{href:e.startsWith(`v`)?`https://github.com/HarperFast/studio/releases/tag/${e}`:`https://github.com/HarperFast/studio/releases`,target:`_blank`,rel:`noopener noreferrer`,children:(0,H.jsxs)(`span`,{className:p(Ni({variant:`default`}),`text-xs inline-block ml-2 align-text-top`),children:[e,` BETA`]})})}function Fi(e={}){let{instanceId:t,clusterId:n}=M({strict:!1});return h({id:u,...e})}function Ii(e={}){let{instanceId:t,clusterId:n}=M({strict:!1});return{instanceClient:h({id:u,...e}),entityType:`instance`}}function W(e={}){let{instanceId:t,clusterId:n}=M({strict:!1});return(0,U.useMemo)(()=>Li({instanceId:t,clusterId:n,...e}),[e.instanceId??t,e.clusterId??n,e.operationsUrl,e.port,e.secure,e.disableFabricConnect,e.forceFabricConnect])}function Li({instanceId:e,clusterId:t,...n}){let r=u;if(!r)throw Error(`id could not be automatically calculated in useInstanceClientIdParams`);return{instanceClient:h({id:r,...n}),entityId:r,entityType:`instance`}}function Ri(){localStorage.clear()}function zi(){sessionStorage.clear()}async function Bi(){i.setUserForEntity(u,null),yn.getQueryCache().clear(),Ri(),zi(),await yn.invalidateQueries({refetchType:`none`})}async function Vi(e){await i.signOutFromPotentiallyAuthenticatedInstances(),await d({...e,entityId:u})}function Hi(){let e=Fi();return j({mutationFn:()=>Vi({instanceClient:e}),onSuccess:Bi})}var Ui={className:`text-foreground dark:text-white font-semibold`};function Wi(){let{mutate:e}=Hi(),t=L(),{user:n}=Re(),r=se(),i=(0,U.useCallback)(()=>{e(void 0,{onSuccess:async()=>{B.success(`Success`,{description:`You have been signed out successfully.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),t({to:`/sign-in`}),r.invalidate()}})},[e,r,t]),a=(0,U.useMemo)(()=>[!1,{to:`https://docs.harperdb.io/docs`,target:`_blank`,icon:(0,H.jsx)(Ln,{}),text:`Docs`,textBreakpoint:`md`},{to:`https://github.com/HarperFast/studio/issues`,target:`_blank`,icon:(0,H.jsx)(zn,{}),text:`Report an Issue`,textBreakpoint:`lg`},{to:`https://discord.gg/VzZuaw3Xay`,target:`_blank`,icon:(0,H.jsx)(gi,{}),text:`Discord`,textBreakpoint:`lg`},{onClick:i,icon:(0,H.jsx)(Dr,{}),text:`Sign Out`,textBreakpoint:`md`}].filter(di),[i]);return n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Yi,{menuItems:a}),(0,H.jsx)(qi,{menuItems:a})]}):(0,H.jsx)(Ki,{})}function Gi(e){return e.items!==void 0}function Ki(){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`inline-block`,children:[(0,H.jsx)(I,{to:`/sign-in`,children:(0,H.jsx)(_i,{})}),(0,H.jsx)(Pi,{})]}),(0,H.jsx)(Ti,{children:(0,H.jsxs)(Oi,{className:`text-muted-foreground dark:text-grey-400`,children:[(0,H.jsx)(Ei,{children:(0,H.jsx)(Di,{asChild:!0,children:(0,H.jsxs)(I,{to:`https://docs.harperdb.io/docs`,target:`_blank`,rel:`noreferrer noopener`,className:`flex-row items-center`,children:[(0,H.jsx)(Ln,{}),` `,(0,H.jsx)(`span`,{className:`hidden md:inline-block`,children:`Docs`})]})})}),(0,H.jsx)(Ei,{children:(0,H.jsx)(Ci,{})}),(0,H.jsx)(Ei,{children:(0,H.jsx)(Di,{asChild:!0,children:(0,H.jsxs)(I,{to:`/sign-in`,className:`flex-row items-center`,activeProps:Ui,children:[(0,H.jsx)(Er,{}),` Sign In`]})})})]})})]})}function qi({menuItems:e}){let{user:t}=Re();return Dn(t),(0,H.jsx)(`div`,{className:`hidden md:[@media(hover:hover)]:block xl:block`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`inline-block`,children:[(0,H.jsx)(I,{to:`/`,children:(0,H.jsx)(_i,{})}),(0,H.jsx)(Pi,{})]}),(0,H.jsx)(Ti,{children:(0,H.jsxs)(Oi,{className:`text-muted-foreground dark:text-grey-400`,children:[e.map(e=>Gi(e)?!!e.items.length&&(0,H.jsx)(`div`,{className:`bg-muted dark:bg-black rounded-2xl flex`,children:e.items.map(e=>(0,H.jsx)(Ji,{menuItem:e},e.text))},e.text):(0,H.jsx)(Ji,{menuItem:e},e.text)),(0,H.jsx)(Ei,{children:(0,H.jsx)(Ci,{})})]})})]})})}function Ji({menuItem:e}){return(0,H.jsx)(Ei,{className:`text-muted-foreground dark:text-gray-400 hover:text-foreground dark:hover:text-white`,children:(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(Di,{asChild:!0,children:(0,H.jsxs)(I,{to:e.to,onClick:e.onClick,"aria-label":e.text,className:`flex-row items-center`,target:e.target,activeProps:e.to?Ui:void 0,children:[e.icon,(0,H.jsx)(`span`,{className:`hidden ${e.textBreakpoint}:inline-block`,children:e.text}),(0,H.jsx)(`span`,{className:`${e.textBreakpoint}:hidden`,children:`\xA0`})]})})}),(0,H.jsx)(Mi,{side:`bottom`,className:`${e.textBreakpoint}:hidden`,children:e.text})]})})}function Yi({menuItems:e}){let{user:t}=Re();Dn(t);let[n,r]=(0,U.useState)(!1),i=(0,U.useCallback)(()=>r(e=>!e),[]),a=(0,U.useCallback)(()=>r(!1),[]);return(0,H.jsxs)(`div`,{className:`md:[@media(hover:hover)]:hidden xl:hidden`,id:`mobile-menu`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(I,{to:`/`,children:(0,H.jsx)(_i,{})}),(0,H.jsx)(Pi,{}),(0,H.jsxs)(`button`,{type:`button`,className:`shadow-xs text-muted-foreground dark:text-grey-400 hover:text-foreground dark:hover:text-white hover:bg-muted dark:hover:bg-black-dark`,onClick:i,children:[(0,H.jsx)(`span`,{className:`sr-only`,children:n?`Close menu`:`Open menu`}),n?(0,H.jsx)(_n,{}):(0,H.jsx)(jr,{})]})]}),(0,H.jsx)(`div`,{className:`${n?`fixed`:`hidden`} top-40 bottom-0 left-0 right-0 bg-foreground/20 dark:bg-black-dark dark:opacity-70`,onClick:a}),(0,H.jsxs)(`div`,{className:`${n?`block`:`hidden`} md:hidden z-50 space-y-1 pb-3 bg-card border-b border-border dark:bg-black-dark dark:border-none absolute left-0 top-full w-full rounded-b-md`,children:[(0,H.jsx)(`div`,{className:`flex justify-end px-3 pt-2`,children:(0,H.jsx)(Ci,{})}),e.map(e=>Gi(e)?!!e.items.length&&(0,H.jsx)(`div`,{className:`bg-muted dark:bg-black pl-10 pr-2 py-2`,children:e.items.map(e=>(0,H.jsx)(Xi,{menuItem:e,onClick:a},e.text))},e.text):(0,H.jsx)(Xi,{menuItem:e,onClick:a},e.text))]})]})}function Xi({menuItem:e,onClick:t}){let n=(0,U.useCallback)(()=>{e.onClick?.(),t()},[e,t]);return(0,H.jsxs)(I,{to:e.to,onClick:n,target:e.target,className:`flex flex-row px-3 py-2 text-base font-medium rounded-md text-muted-foreground dark:text-gray-400 hover:text-foreground dark:hover:text-white`,activeProps:e.to?Ui:void 0,children:[e.icon,(0,H.jsx)(`span`,{className:`ml-4`,children:e.text})]})}function Zi(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-gradient-to-r from-violet-100 to-white border-b border-violet-200 dark:from-purple-950 dark:to-zinc-900 dark:border-purple-950 md:px-12`,children:(0,H.jsx)(Wi,{})}),(0,H.jsxs)(`div`,{className:`pt-20 h-screen grid grid-cols-1 md:grid-cols-2`,children:[(0,H.jsx)(`section`,{"aria-label":`Harper Fabric overview`,className:`items-center justify-center hidden text-white md:flex px-6 fabricSignupTextContainer`,children:(0,H.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,H.jsx)(`main`,{className:`overflow-y-auto px-6 bg-white dark:bg-linear-(--black-dark-gradient) border-l border-border dark:border-none`,children:(0,H.jsx)(`div`,{className:`min-h-full flex items-start justify-center py-12`,children:(0,H.jsx)(Ee,{})})})]})]})}var Qi;function $i(){(0,U.useEffect)(()=>{},[])}var ea=[`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 ta(e){if(!e||!e.includes(`@`))return null;let t=e.split(`@`).pop()||``;if(!t)return null;for(let e of ea)if(t===e||t.endsWith(`.`+e))return null;return t}var na=`utm_`;function ra(e){let t=new URLSearchParams(e),n=Array.from(t.keys()).filter(e=>e.toLowerCase().startsWith(na));if(n.length===0)return e;for(let e of n)t.delete(e);let r=t.toString();return r?`?${r}`:``}function ia(){if(typeof location>`u`||typeof history>`u`)return;let{search:e,pathname:t,hash:n,origin:r}=location,i=ra(e);i!==e&&history.replaceState(history.state,``,`${r}${t}${i}${n}`)}var aa=null;function oa(){let e=L(),t=se(),n=le(),{redirect:r}=pe({strict:!1});return(0,U.useEffect)(()=>{aa||=(async function(){let a=await o().catch(()=>null);if(!a)B.error(`We were not able to verify your sign-in. Please try signing in again.`,{duration:1e4}),await e({to:`/sign-in`});else{i.setUserForEntity(u,a),ia();let o=Dn(a),s=ta(a.email);Qi?.identify?.({username:a.email,type:`email`,...s?{company:s}:{}}),await n.invalidateQueries({queryKey:v,refetchType:`none`}),await t.invalidate(),await e({to:r?.startsWith(`/`)?r:o})}aa=null})()},[]),(0,H.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`text-foreground dark:text-white w-lg flex flex-col gap-4`,children:[(0,H.jsxs)(`h1`,{className:`text-3xl font-light`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-2xl animate-flower-dance mr-4`,title:`Loading`,children:`🌼`}),`Checking...`]}),(0,H.jsx)(`div`,{className:`underline flex gap-4`,children:(0,H.jsx)(I,{className:`text-sm opacity-50 text-muted-foreground hover:text-foreground dark:text-inherit dark:hover:text-blue-300`,to:`/sign-in`,children:`Try signing in again`})})]})}var sa=new Map;function ca(e){if(!e)return``;if(sa.has(e))return sa.get(e);let t=e.replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim();if(!t)return sa.set(e,``),``;let n=t.match(/([A-Z]+(?=[A-Z][a-z])|[A-Z]?[a-z]+|[A-Z]+|[0-9]+)/g);if(!n)return sa.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(la).join(` `);return sa.set(e,i),i}function la(e){return/^[A-Z]{2,3}s?$/.test(e)||/^[0-9]+$/.test(e)?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function ua({restartRequired:e}){let t=Ae(),{organization:n,instance:r,cluster:i}=Me({strict:!1});return(0,H.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,U.useMemo)(()=>{let e=t.pathname.split(`/`).filter(e=>e&&e.length>0),a=[(0,H.jsxs)(I,{to:`/`,children:[(0,H.jsx)(vr,{"aria-hidden":`true`,className:`size-5 shrink-0`}),(0,H.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=ca(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,H.jsx)(`svg`,{fill:`currentColor`,viewBox:`0 0 20 20`,"aria-hidden":`true`,className:`size-5 shrink-0 text-grey`,children:(0,H.jsx)(`path`,{d:`M5.555 17.776l8-16 .894.448-8 16-.894-.448z`})},a.length+`-dash`),(0,H.jsx)(I,{to:s,className:`text-xs md:text-sm font-medium hover:text-grey truncate max-w-48`,children:c},s))}return a},[t.pathname,i?.name,r?.name,n?.name]),e&&(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(`div`,{className:`text-xs italic text-muted-foreground`,children:[`* Restart `,(0,H.jsx)(`span`,{className:`hidden lg:inline-block`,children:`Requested`})]})}),(0,H.jsxs)(Mi,{side:`bottom`,children:[`This `,`Instance`,` is requesting a restart, when convenient, to apply your latest changes.`,(0,H.jsx)(`br`,{}),`You can do this from the Apps or Config pages.`]})]})]})}var G=Ct,da=(0,U.createContext)({}),fa=(0,U.createContext)({});function pa(){let e=(0,U.useContext)(da),t=(0,U.useContext)(fa),{getFieldState:n}=Tt(),r=et({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 K({...e}){let{error:t,formItemId:n,formDescriptionId:r,formMessageId:i}=pa();return(0,H.jsx)(Je,{"data-slot":`form-control`,id:n,"aria-describedby":t?`${r} ${i}`:`${r}`,"aria-invalid":!!t,...e})}function q({...e}){return(0,H.jsx)(da,{value:{name:e.name},children:(0,H.jsx)(an,{...e})})}function J({className:e,...t}){return(0,H.jsx)(fa,{value:{id:(0,U.useId)()},children:(0,H.jsx)(`div`,{"data-slot":`form-item`,className:p(`grid gap-2`,e),...t})})}function ma({className:e,...t}){return(0,H.jsx)(Pt,{"data-slot":`label`,className:p(`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 Y({className:e,...t}){let{error:n,formItemId:r}=pa();return(0,H.jsx)(ma,{"data-slot":`form-label`,"data-error":!!n,className:p(`data-[error=true]:text-destructive`,e),htmlFor:r,...t})}function X({className:e,...t}){let{error:n,formMessageId:r}=pa(),i=n?String(n?.message):t.children;return i?(0,H.jsx)(`p`,{"data-slot":`form-message`,id:r,className:p(`text-destructive text-sm`,e),...t,children:i}):null}function Z({className:e,type:t,...n}){return(0,H.jsx)(`input`,{type:t,"data-slot":`input`,className:p(`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
|
|
@@ -9,7 +9,7 @@ import{a as e,r as t,t as n}from"./rolldown-runtime-CNC7AqOf.js";import{_ as r,a
|
|
|
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 ha=[`RUNNING`],ga=[`TERMINATING`,`TERMINATED`,`REMOVED`];function _a(){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 va({username:e,password:t,instanceClient:n,entityId:r}){let o={username:e,password:t};i.checkForBasicAuth(r)&&(n.defaults.auth=o,n.defaults.withCredentials=!1);let{data:{message:s}}=await n.post(`/`,{operation:`login`,username:e,password:t});if(!i.checkForBasicAuth(r))try{let e=await a({instanceClient:n});return i.setLastConnectMode(r,`direct`),{message:s,user:e}}catch(e){console.error(`Failed to get user after login, trying basic auth`,e)}try{n.defaults.auth=o,n.defaults.withCredentials=!1;let e=await a({instanceClient:n,auth:o});return i.flagForBasicAuth(r,o),i.setLastConnectMode(r,`direct`),{message:s,user:e}}catch(e){throw n.defaults.auth=void 0,n.defaults.withCredentials=!0,e}return{message:s,user:await i.establishFabricConnectAuth({id:r,operationsUrl:n.defaults.baseURL}),instanceClient:h({id:r,operationsUrl:n.defaults.baseURL})}}function ya(){return j({mutationFn:va})}function ba({cluster:e,instance:t,instanceParams:n}){let r=L(),a=se(),{redirect:o}=pe({strict:!1}),{mutate:s,isPending:c}=ya();return{isPending:c,submitForm:(0,U.useCallback)(async c=>{s({...c,...n},{onSuccess:async({message:n,user:s})=>{if(B.success(n),e?.instances?.length&&!t)for(let t of e.instances)i.setUserForEntity(t,s);let c=u;if(!c)throw Error(`Sign in failed due to missing cluster or instance.`);i.setUserForEntity(c,s),a.invalidate(),await r({to:o?.startsWith(`/`)?o:`/`})}})},[e,t,n,r,o,a,s])}}async function xa(e){let{data:t}=await c.get(`/Cluster/${e}`);return t}function Sa(e,t){return F({queryKey:[e],queryFn:()=>xa(e),retry:!1,staleTime:1900,enabled:!!e,refetchInterval:t?t===!0?1e4:t:void 0})}var Ca=E({error:`Please enter a valid email address.`}).toLowerCase().trim(),wa=w().nonempty({error:`Please enter your password.`}),Ta=w().nonempty({error:`Please enter a username.`}),Ea=S({username:Ta,password:wa}),Da=S({email:Ca,password:wa});function Oa({entityId:e,instanceClient:t}){return F({queryKey:[`health`,e],queryFn:async()=>{try{return await t.get(`/health`),!0}catch{return!1}},retry:2,refetchInterval:5e3})}var ka=[`localhost`,`127.0.0.1`],Aa=function(e){return e.MixedLoopback=`MixedLoopback`,e.InsecureCookieOutsideChromeAndFirefox=`InsecureCookieOutsideChromeAndFirefox`,e}({});function ja(e,t,n){if(!n||!t||!e)return null;let r=new URL(n).hostname,i=ka.includes(t),a=ka.includes(r);if(i&&a&&r!==t)return`MixedLoopback`;if(!i&&a){let t=e.indexOf(`Chrome`)>=0,n=e.indexOf(`Firefox`)>=0;if(!t&&!n)return`InsecureCookieOutsideChromeAndFirefox`}return null}function Ma(){let{clusterId:e,instanceId:t}=M({strict:!1}),{data:n}=N(Sa(e,!0)),r=(0,U.useMemo)(()=>t&&n&&n?.instances?.find(e=>e.id===t)||void 0,[n,t]),a=(0,U.useMemo)(()=>n?.status&&ha.includes(n.status),[n?.status]),o=`instance`,s=(0,U.useMemo)(()=>n?r?(i.flagForFabricConnect(r.id,!1),m(r)):(i.flagForFabricConnect(n.id,!1),g(n)):null,[n,r]);(0,U.useEffect)(()=>{r?i.setUserForEntity(r,null):n&&i.setUserForEntity(n,null)},[r?.id??n?.id]);let c=W({operationsUrl:s}),l=(0,U.useMemo)(()=>s?.includes(`localhost`)||s?.includes(`127.0.0.1`),[s]),u=(0,U.useMemo)(()=>ja(navigator.userAgent,location.hostname,s),[s]),{data:d}=N(Oa(c)),f=R({resolver:z(Ea),defaultValues:{username:``,password:``}}),{control:p,handleSubmit:h}=f,{submitForm:v,isPending:y}=ba({cluster:n,instance:r,instanceParams:c});return!t&&n&&!n?.fqdn?(0,H.jsx)(he,{to:`../instances`,replace:!0}):a&&n?.resetPassword?(0,H.jsx)(he,{to:`/${n.organizationId}/${n.id}/finish-setup`,replace:!0}):!a&&n?.resetPassword?(0,H.jsx)(he,{to:`/${n.organizationId}/${n.id}/starting-up`,replace:!0}):(0,H.jsxs)(H.Fragment,{children:[!1,(0,H.jsx)(`div`,{className:b(`min-h-screen`,`items-center justify-center flex`),children:(0,H.jsxs)(`div`,{className:`text-foreground w-xs py-8`,children:[(0,H.jsxs)(`h1`,{className:`text-2xl font-light`,children:[`Sign in to Harper `,`Local`]}),(0,H.jsx)(G,{...f,children:(0,H.jsxs)(`form`,{id:`auth-${o}-signin-form`,name:`auth-${o}-signin-form`,onSubmit:h(v),className:`my-4`,children:[(0,H.jsx)(q,{control:p,name:`username`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Username`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{autoComplete:`username`,autoFocus:!0,type:`text`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:p,name:`password`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(_,{disabled:y,type:`submit`,variant:`submit`,className:`w-full my-2`,children:`Sign In`}),d===!1&&(0,H.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,H.jsx)(`span`,{className:`font-medium`,children:`Warning!`}),` This `,o,` is not responding to GET`,` `,(0,H.jsxs)(`a`,{href:`${s}health`,className:`underline`,target:`_blank`,children:[s,`health`]}),` `,`checks.`,(0,H.jsxs)(`ol`,{className:`list-decimal ml-8 mt-2`,children:[(0,H.jsx)(`li`,{children:`Is the server running?`}),(0,H.jsxs)(`li`,{children:[`Have you`,` `,(0,H.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?`]}),l&&(0,H.jsxs)(`li`,{children:[`Have you allowed`,` `,(0,H.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?`]})]})]}),u===Aa.MixedLoopback&&(0,H.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,H.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.`]}),u===Aa.InsecureCookieOutsideChromeAndFirefox&&(0,H.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,H.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,H.jsxs)(`div`,{className:`p-4 mt-4 text-sm rounded-lg bg-purple-950`,role:`alert`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:`Did you know?`}),` `,`You can add this instance to your Harper account to manage it remotely.`,(0,H.jsx)(`div`,{className:`text-center pt-2`,children:(0,H.jsx)(I,{to:_a(),target:`_blank`,children:(0,H.jsx)(_,{type:`button`,variant:`positive`,children:`Connect to Harper Fabric`})})})]})]})})]})})]})}async function Na({email:e}){let{data:t}=await c.post(`/ForgotPassword/`,{email:e});if(t)return t;throw Error(`Something went wrong`)}function Pa(){return j({mutationFn:e=>Na(e)})}var Fa=S({email:Ca});function Ia(){let e=L(),{me:t}=pe({strict:!1}),n=R({resolver:z(Fa),defaultValues:{email:t||``}}),r=n.watch(`email`),{setFocus:i,control:a,handleSubmit:o}=n;(0,U.useEffect)(()=>{i(`email`)},[i]);let{mutate:s,isPending:c}=Pa(),l=async t=>{s(t,{onSuccess:t=>{B.success(`Success`,{description:`${t}`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),e({to:`/sign-in`,search:{me:r}})}})};return(0,H.jsxs)(`div`,{className:`text-foreground dark:text-white w-xs`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light`,children:`Enter your account email`}),(0,H.jsx)(`p`,{className:`text-sm pt-1`,children:`If a matching account exists, we'll send you a password reset link.`}),(0,H.jsx)(G,{...n,children:(0,H.jsxs)(`form`,{id:`auth-forgot-password-form`,name:`auth-forgot-password-form`,onSubmit:o(l),className:`my-4`,children:[(0,H.jsx)(q,{control:a,name:`email`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-2`,children:[(0,H.jsx)(Y,{children:`Email`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{disabled:c,type:`email`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(_,{type:`submit`,variant:`submit`,disabled:c,className:`w-full my-2`,children:`Send Password Reset Email`})]})}),(0,H.jsxs)(`div`,{className:`flex px-4 mt-4 underline place-content-between`,children:[(0,H.jsx)(I,{className:`text-sm hover:text-blue-300`,to:`/sign-in`,search:{me:r},children:`Sign in to your account`}),(0,H.jsx)(I,{className:`text-sm hover:text-blue-300`,to:`/sign-up`,search:{me:r},children:`Sign up for free`})]})]})}var La=async({token:e,password:t})=>{let{data:n}=await c.put(`/ResetPassword/`,{token:e,newPassword:t});return n};function Ra(){return j({mutationFn:e=>La(e)})}var za=S({password:wa.min(8,{error:`Password must be at least 8 characters long.`}).max(50,{error:`Password cannot be longer than 50 characters.`}),confirmPassword:w()}).refine(e=>e.password===e.confirmPassword,{error:`Passwords do not match.`,path:[`confirmPassword`]});function Ba(){let{token:e}=pe({strict:!1}),t=L();(0,U.useEffect)(()=>{e||t({to:`/sign-in`})},[e,t]);let n=R({resolver:z(za),defaultValues:{password:``,confirmPassword:``}}),{setFocus:r,control:i,handleSubmit:a}=n;(0,U.useEffect)(()=>{r(`password`)},[r]);let{mutate:o,isPending:s}=Ra(),c=(0,U.useCallback)(async n=>{o({token:e,password:n.password},{onSuccess:()=>{B.success(`Success`,{description:`Your password has been reset successfully.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),t({to:`/sign-in`})}})},[t,o,e]);return(0,H.jsxs)(`div`,{className:`text-foreground dark:text-white w-xs`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light`,children:`Reset Password`}),(0,H.jsx)(G,{...n,children:(0,H.jsxs)(`form`,{id:`auth-reset-password-form`,name:`auth-reset-password-form`,className:`my-4`,onSubmit:a(c),children:[(0,H.jsx)(q,{control:i,name:`password`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-2`,children:[(0,H.jsx)(Y,{children:`New Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{disabled:s,type:`password`,autoComplete:`new-password`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:i,name:`confirmPassword`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-2`,children:[(0,H.jsx)(Y,{children:`Confirm Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{disabled:s,type:`password`,autoComplete:`new-password`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(_,{variant:`submit`,type:`submit`,disabled:s,className:`w-full my-2`,children:`Submit New Password`})]})})]})}function Va({className:e,variant:t,asChild:n=!1,...r}){return(0,H.jsx)(n?Je:`span`,{"data-slot":`badge`,className:p(Ni({variant:t}),e),...r})}function Ha(){return(0,H.jsx)(Va,{className:`pointer-events-none absolute -top-2 right-3 z-10 rounded-full border-primary bg-primary px-1.5 py-0 text-[10px] font-medium text-white shadow-sm`,children:`Last used`})}function Ua({text:e,disabled:t,onClick:n,lastUsed:r=!1}){let i=(0,H.jsxs)(`a`,{href:`/oauth/github/login?redirect=%2F%23%2Fcheck-oauth`,onClick:n,"aria-disabled":t||void 0,className:b(`github-signin-btn`,t&&`opacity-50 cursor-default`),children:[(0,H.jsx)(`img`,{src:`/github/GitHub_Invertocat_White.svg`,alt:``,className:`github-icon`}),e]});return r?(0,H.jsxs)(`div`,{className:`relative flex flex-col`,children:[i,(0,H.jsx)(Ha,{})]}):i}function Wa({text:e,disabled:t,onClick:n,lastUsed:r=!1}){let i=(0,H.jsxs)(`a`,{href:`/oauth/google/login?redirect=%2F%23%2Fcheck-oauth`,onClick:n,"aria-disabled":t||void 0,className:b(`gsi-material-button`,t&&`opacity-50 cursor-default`),children:[(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`gsi-material-button-state`}),(0,H.jsxs)(`div`,{className:`gsi-material-button-content-wrapper`,children:[(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`gsi-material-button-icon`,children:(0,H.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,H.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,H.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,H.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,H.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,H.jsx)(`path`,{fill:`none`,d:`M0 0h48v48H0z`})]})}),(0,H.jsx)(`span`,{className:`gsi-material-button-contents`,children:e}),(0,H.jsx)(`span`,{className:`hidden`,children:e})]})]});return r?(0,H.jsxs)(`div`,{className:`relative flex flex-col`,children:[i,(0,H.jsx)(Ha,{})]}):i}function Ga(){let e=L(),t=le(),n=se(),{redirect:r}=pe({strict:!1}),{mutate:a,isPending:o}=Ka();return{isPending:o,submitForm:(0,U.useCallback)(o=>{a(o,{onSuccess:async a=>{i.setUserForEntity(u,a),ia();let o=Dn(a),s=ta(a.email);Qi?.identify?.({username:a.email,type:`email`,...s?{company:s}:{}}),await t.invalidateQueries({queryKey:v,refetchType:`none`}),n.invalidate(),await e({to:r?.startsWith(`/`)?r:o})}})},[e,t,r,n,a])}}function Ka(){return j({mutationFn:e=>qa(e)})}async function qa({email:e,password:t}){let{data:n}=await c.post(`/Login/`,{email:e,password:t});if(n)return n;throw Error(`Something went wrong`)}function Ja(){let[e,t]=xn(Cn.RememberSignInMethod,!0),[n,r]=xn(Cn.LastUsedSignInMethod,null),i=(0,U.useCallback)(t=>{e&&(Sn(Cn.LastUsedSignInMethod,t),r(t))},[e,r]),a=(0,U.useCallback)(()=>{r(null),t(!1)},[r,t]),o=(0,U.useCallback)(()=>{t(!0)},[t]);return{lastUsed:e?n:null,remember:e,recordMethod:i,disable:a,enable:o}}var Ya=`mx-auto mt-3 block text-xs text-muted-foreground underline hover:text-foreground dark:text-inherit dark:hover:text-blue-300`;function Xa(){let{me:e}=pe({strict:!1}),t=R({resolver:z(Da),defaultValues:{email:e||``,password:``}}),{handleSubmit:n,control:r}=t,i=t.watch(`email`),{submitForm:a,isPending:o}=Ga(),{lastUsed:s,remember:c,recordMethod:l,disable:u,enable:d}=Ja();return(0,H.jsxs)(`div`,{className:`text-foreground dark:text-white w-xs`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light text-center`,children:`Sign in to Harper Fabric`}),(0,H.jsx)(G,{...t,children:(0,H.jsxs)(`form`,{id:`auth-signin-form`,name:`auth-signin-form`,onSubmit:n(a),className:`my-4`,children:[(0,H.jsx)(q,{control:r,name:`email`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Email`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`email`,autoFocus:!0,autoComplete:`email`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:r,name:`password`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,autoComplete:`current-password`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(_,{type:`submit`,variant:`submit`,className:`w-full my-2`,disabled:o,children:`Sign In`}),(0,H.jsxs)(`div`,{className:`flex px-4 mt-4 underline place-content-between`,children:[(0,H.jsx)(I,{className:`text-sm text-muted-foreground hover:text-foreground dark:text-inherit dark:hover:text-blue-300`,to:`/sign-up`,search:{me:i},children:`Sign up for free`}),(0,H.jsx)(I,{className:`text-sm text-muted-foreground hover:text-foreground dark:text-inherit dark:hover:text-blue-300`,to:`/forgot-password`,search:{me:i},children:`Forgot password?`})]})]})}),(0,H.jsx)(`hr`,{"aria-hidden":`true`,className:`border-border dark:border-gray-600 my-6`}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Wa,{text:`Sign in with Google`,lastUsed:s===`google`,onClick:()=>l(`google`)}),(0,H.jsx)(Ua,{text:`Sign in with GitHub`,lastUsed:s===`github`,onClick:()=>l(`github`)})]}),c?s&&(0,H.jsx)(`button`,{type:`button`,onClick:u,className:Ya,children:`On a shared device? Forget my sign-in method.`}):(0,H.jsx)(`button`,{type:`button`,onClick:d,className:Ya,children:`Remember my last sign-in method on this device.`})]})}var Za=/^[a-zA-ZàáâäãåąčćęèéêëėįìíîïłńòóôöõøùúûüųūÿýżźñçčšžæÀÁÂÄÃÅĄĆČĖĘÈÉÊËÌÍÎÏĮŁŃÒÓÔÖÕØÙÚÛÜŲŪŸÝŻŹÑßÇŒÆČŠŽ∂ð ,'-]+$/u;async function Qa(e){let{data:t}=await c.post(`/User/`,e);if(t)return t;throw Error(`Something went wrong`)}function $a(){return j({mutationFn:e=>Qa(e)})}var eo=S({email:Ca.max(80,{error:`Email cannot be longer than 80 characters.`}),firstname:w().trim().min(2,{error:`Please enter your first name.`}).regex(Za,{error:`First name can only contain letters, spaces, and hyphens.`}).max(40,{error:`First name cannot be longer than 40 characters.`}),lastname:w().trim().min(2,{error:`Please enter your last name.`}).regex(Za,{error:`Last name can only contain letters, spaces, and hyphens.`}).max(80,{error:`Last name cannot be longer than 80 characters.`}),password:wa.min(8,{error:`Password must be at least 8 characters long.`}),confirmPassword:w(),acceptTerms:O().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 to(){let e=L(),{email:t,me:n}=pe({strict:!1}),[r,i]=(0,U.useState)(!1),a=R({resolver:z(eo),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,U.useEffect)(()=>{c(`firstname`)},[c]);let{mutate:d}=$a(),f=(0,U.useCallback)(async t=>{let{confirmPassword:n,acceptTerms:r,...i}=t;d(i,{onSuccess:()=>{let t=ta(i.email);Qi?.identify?.({username:i.email,type:`email`,firstname:i.firstname,lastname:i.lastname,...t?{company:t}:{}}),ia(),e({to:`/verifying?email=`+encodeURIComponent(i.email)})}})},[e,d]),p=(0,U.useCallback)(e=>{if(!s)return i(!0),setTimeout(()=>i(!1),1e3),e.preventDefault(),!1},[s]),m=(0,H.jsx)(q,{control:l,name:`acceptTerms`,render:({field:e})=>(0,H.jsxs)(J,{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,H.jsx)(K,{children:(0,H.jsx)(Z,{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,H.jsxs)(`div`,{className:`space-y-1 leading-none`,children:[(0,H.jsxs)(Y,{className:`text-xs font-normal`,children:[`I accept the`,` `,(0,H.jsx)(`a`,{href:`https://www.harper.fast/resources/privacy-policy`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,"aria-label":`Privacy Policy (opens in new tab)`,children:`Privacy Policy`}),` `,`and`,` `,(0,H.jsx)(`a`,{href:`https://www.harper.fast/resources/paas-terms-of-service`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-blue-300`,"aria-label":`Terms of Service (opens in new tab)`,children:`Terms of Service`})]}),(0,H.jsx)(X,{})]})]})});return(0,H.jsxs)(`div`,{className:`text-foreground dark:text-white w-xs`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light text-center`,children:`Sign up for Harper Fabric`}),(0,H.jsxs)(G,{...a,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 my-6`,children:[m,(0,H.jsx)(Wa,{text:`Sign up with Google`,disabled:!s,onClick:p}),(0,H.jsx)(Ua,{text:`Sign up with GitHub`,disabled:!s,onClick:p})]}),(0,H.jsx)(`hr`,{className:`border-gray-600`}),(0,H.jsxs)(`form`,{id:`auth-signup-form`,name:`auth-signup-form`,onSubmit:u(f),className:`grid gap-4 my-4`,children:[(0,H.jsx)(q,{control:l,name:`firstname`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`First Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,className:`dark:bg-black dark:border-black`,autoCapitalize:`words`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:l,name:`lastname`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Last Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,className:`dark:bg-black dark:border-black`,autoCapitalize:`words`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:l,name:`email`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Email`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`email`,readOnly:!!t,disabled:!!t,className:`dark:bg-black dark:border-black`,autoComplete:`email`,autoCapitalize:`none`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:l,name:`password`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,autoComplete:`new-password`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:l,name:`confirmPassword`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Confirm Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,autoComplete:`new-password`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),m,(0,H.jsx)(_,{type:`submit`,variant:`submit`,className:`w-full my-4`,children:`Sign Up For Free`})]})]}),(0,H.jsx)(`div`,{className:`flex px-4 mt-4 underline place-content-between`,children:(0,H.jsx)(I,{className:`m-auto text-sm hover:text-blue-300`,to:`/sign-in`,search:{me:o},children:`Already have an account? Sign in instead.`})})]})}var no=async({email:e})=>{let{data:t}=await c.post(`/ResendVerificationEmail/`,{email:e});return t};function ro(){return j({mutationFn:e=>no(e)})}var io=async e=>{let{data:t}=await c.put(`/VerifyEmail/`,{token:e.toString()});return t};function ao(){return j({mutationFn:e=>io(e)})}var oo=S({email:Ca});function so(){let e=L(),{mutate:t,isPending:n}=ro(),r=R({resolver:z(oo),defaultValues:{email:``}}),i=r.watch(`email`),{setFocus:a,control:o,handleSubmit:s}=r;(0,U.useEffect)(()=>{a(`email`)},[a]);let c=(0,U.useCallback)(async n=>{t(n,{onSuccess:t=>{B.success(`Success`,{description:`${t}`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),e({to:`/sign-in`,search:{me:i}})}})},[i,e,t]);return(0,H.jsxs)(G,{...r,children:[(0,H.jsx)(`p`,{className:`text-sm py-2`,children:`Please Enter an Email`}),(0,H.jsxs)(`form`,{id:`auth-verify-email-form`,name:`auth-verify-email-form`,onSubmit:s(c),className:`my-4`,children:[(0,H.jsx)(q,{control:o,name:`email`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-2`,children:[(0,H.jsx)(Y,{children:`Email`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{disabled:n,type:`email`,className:`dark:bg-black dark:border-black`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(_,{type:`submit`,variant:`submit`,disabled:n,className:`w-full my-2`,children:`Send Verification Email`})]})]})}function co(){let{token:e}=pe({strict:!1}),t=L(),{mutate:n,isPending:r}=ao(),i=(0,U.useCallback)(e=>{n(e,{onSuccess:()=>{B.success(`Success`,{description:`Email verified successfully`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),t({to:`/sign-in`})}})},[n,t]);return(0,U.useEffect)(()=>{e&&i(e)},[i,e]),(0,H.jsxs)(`div`,{className:`text-foreground dark:text-white w-xs`,children:[(0,H.jsx)(`h1`,{className:`text-3xl font-light`,children:`Verify Email`}),r?(0,H.jsx)(`p`,{className:`text-sm pt-1`,children:`Verifying email...`}):(0,H.jsx)(so,{})]})}function lo(){let{email:e}=pe({strict:!1}),{mutate:t,isPending:n}=ro(),r=(0,U.useCallback)(n=>(n.preventDefault(),e&&t({email:e},{onSuccess:e=>{B.success(`Code Sent`,{description:`${e}`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}}),!1),[e,t]);return(0,H.jsxs)(`div`,{className:`text-foreground dark:text-white w-lg flex flex-col gap-4`,children:[(0,H.jsxs)(`h1`,{className:`text-3xl font-light`,children:[(0,H.jsx)(`span`,{"aria-hidden":`true`,className:`text-2xl animate-flower-dance mr-4`,title:`Loading`,children:`🌼`}),`Check your email!`]}),(0,H.jsxs)(`p`,{children:[`Your account has been created! You should receive an email with a link to `,(0,H.jsx)(`strong`,{children:`[Verify My Email]`}),`!`]}),(0,H.jsxs)(`p`,{children:[`From: `,(0,H.jsx)(`strong`,{children:`harper@notifications.harperfabric.com`})]}),(0,H.jsxs)(`p`,{children:[`To: `,(0,H.jsx)(`strong`,{children:e||`your email`})]}),(0,H.jsx)(`p`,{children:`Can you click it? Then we can carry on to more fun things!`}),(0,H.jsxs)(`div`,{className:`underline flex gap-4`,children:[(0,H.jsx)(I,{className:`text-sm text-muted-foreground hover:text-foreground dark:text-inherit dark:hover:text-blue-300`,to:`/sign-in`,search:{me:e},children:`I did it, let me sign in!`}),(0,H.jsx)(I,{className:`text-sm opacity-50 text-muted-foreground hover:text-foreground dark:text-inherit dark:hover:text-blue-300`,to:void 0,onClick:r,disabled:n,children:`Send me another code, please.`})]})]})}var uo=P({getParentRoute:()=>hi,id:`_authLayout`,component:Zi}),fo=P({getParentRoute:()=>uo,path:`sign-in`,head:()=>({meta:[{title:`Sign In — Harper Fabric`}]}),component:Xa,beforeLoad:({context:e,location:t})=>{let n=e.authentication[u]?.user;if(n){let e=t?.search,r=Dn(n);throw xe({to:e?.redirect?.startsWith(`/`)?e.redirect:r})}}}),po=P({getParentRoute:()=>hi,path:`sign-in`,head:()=>({meta:[{title:`Sign In — Harper Fabric`}]}),component:Ma,beforeLoad:({context:e,location:t})=>{if(e.authentication.OverallAppSignIn?.user){let e=t?.search;throw xe({to:e?.redirect?.startsWith(`/`)?e.redirect:`/`})}}}),mo=P({getParentRoute:()=>uo,path:`sign-up`,head:()=>({meta:[{title:`Sign Up — Harper Fabric`}]}),component:to}),ho=P({getParentRoute:()=>uo,path:`forgot-password`,head:()=>({meta:[{title:`Forgot Password — Harper Fabric`}]}),component:Ia}),go=P({getParentRoute:()=>uo,path:`verify-email`,head:()=>({meta:[{title:`Verify Email — Harper Fabric`}]}),component:co}),_o=P({getParentRoute:()=>uo,path:`verifying`,head:()=>({meta:[{title:`Check Your Email — Harper Fabric`}]}),component:lo}),vo=P({getParentRoute:()=>uo,path:`check-oauth`,head:()=>({meta:[{title:`Signing In — Harper Fabric`}]}),component:oa}),yo=P({getParentRoute:()=>uo,path:`reset-password`,head:()=>({meta:[{title:`Reset Password — Harper Fabric`}]}),component:Ba});uo.addChildren([fo,mo,vo,ho,go,_o,yo]);var bo=[po];function xo({children:e}){return(0,H.jsx)(`nav`,{className:`fixed top-20 w-full h-12 z-39 py-2 px-4 md:px-12 bg-violet-50 border-b border-violet-100 dark:bg-grey-700 dark:border-none`,children:(0,H.jsxs)(`div`,{className:`flex items-center h-full space-x-2`,children:[(0,H.jsx)(ua,{}),e]})})}function So(e){if(Eo(e)||Do(e))return`warning`;if(Co(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 Co(e){switch(e){case`RUNNING`:case`UPDATED`:return!0;default:return!1}}function wo(e){switch(e){case`FAILED`:return!0;default:return!1}}function To(e){switch(e){case`TERMINATED`:return!0;default:return!1}}function Eo(e){switch(e){case`CLONE_PENDING`:case`PENDING_UPGRADE`:return!0;default:return!1}}function Do(e){switch(e){case`PROVISIONING`:case`CLONING`:case`CLONE_READY`:case`UPDATING_HDB_NODES`:case`DRAINING`:case`UPDATING`:return!0;default:return!1}}var Oo=360,ko=280,Ao=16,jo={width:820,height:680};function Mo({width:e,height:t},n,r){return{width:Math.round(Math.max(Oo,Math.min(e,n-Ao*2))),height:Math.round(Math.max(ko,Math.min(t,r-Ao*2)))}}function No({width:e,height:t},n,r){return{x:Math.round((n-e)/2),y:Math.round((r-t)/2)}}function Po({x:e,y:t},{width:n,height:r},i,a){let o=Math.max(Ao,i-n-Ao),s=Math.max(Ao,a-r-Ao);return{x:Math.min(Math.max(e,Ao),o),y:Math.min(Math.max(t,Ao),s)}}function Fo(){let[e,t]=xn(Cn.ResizableModalSize,jo),[n,r]=(0,U.useState)(()=>Mo(e,window.innerWidth,window.innerHeight)),[i,a]=(0,U.useState)(()=>No(n,window.innerWidth,window.innerHeight)),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(!1),f=(0,U.useRef)(n);f.current=n;let p=(0,U.useRef)(i);p.current=i;let m=(0,U.useRef)(u);m.current=u;let h=(0,U.useRef)(null),g=(0,U.useRef)(e);g.current=e;let _=(0,U.useRef)(null),v=(0,U.useRef)(!1),y=(0,U.useRef)(null),b=(0,U.useCallback)(e=>{if(!e||e===y.current)return;y.current=e,d(!1),h.current=null;let t=window.innerWidth,n=window.innerHeight,i=Mo(g.current,t,n);r(i),a(No(i,t,n))},[]);return(0,U.useEffect)(()=>{let e=()=>{let e=window.innerWidth,t=window.innerHeight;if(m.current){let n=Mo({width:e,height:t},e,t);r(n),a(No(n,e,t));return}let n=Mo(g.current,e,t);r(n),a(Po(p.current,n,e,t))};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),(0,U.useEffect)(()=>(v.current=!1,()=>{v.current=!0,_.current?.()}),[]),{size:n,position:i,isDragging:o,isResizing:c,isMaximized:u,contentRef:b,startDrag:(0,U.useCallback)(e=>{e.preventDefault(),_.current?.();let t=y.current,n=e.clientX,r=e.clientY,i={...p.current};s(!0),d(!1);let o=0,c=0,l=0,u=()=>{o=0,t&&(t.style.transform=`translate3d(${c}px, ${l}px, 0)`)},m=e=>{c=e.clientX-n,l=e.clientY-r,o||=requestAnimationFrame(u)},h=()=>{o&&cancelAnimationFrame(o),window.removeEventListener(`mousemove`,m),window.removeEventListener(`mouseup`,g),v.current||s(!1),_.current===h&&(_.current=null)},g=()=>{h();let e=Po({x:i.x+c,y:i.y+l},f.current,window.innerWidth,window.innerHeight);t&&(t.style.left=`${e.x}px`,t.style.top=`${e.y}px`,t.style.transform=``),a(e)};window.addEventListener(`mousemove`,m),window.addEventListener(`mouseup`,g),_.current=h},[]),startResize:(0,U.useCallback)(e=>n=>{n.preventDefault(),n.stopPropagation(),_.current?.();let i=y.current,o=n.clientX,s=n.clientY,c={...f.current},u={...p.current};l(!0),d(!1);let m=0,h=c,g=u,b=()=>{m=0,i&&(i.style.width=`${h.width}px`,i.style.height=`${h.height}px`,i.style.left=`${g.x}px`,i.style.top=`${g.y}px`)},x=t=>{let n=window.innerWidth,r=window.innerHeight,i=t.clientX-o,a=t.clientY-s,l=t.altKey,d=l?2:1,f=c.width,p=c.height;e.includes(`e`)&&(f=c.width+i*d),e.includes(`w`)&&(f=c.width-i*d),e.includes(`s`)&&(p=c.height+a*d),e.includes(`n`)&&(p=c.height-a*d),h=Mo({width:f,height:p},n,r);let{x:_,y:v}=u;l?(_=Math.round(u.x+(c.width-h.width)/2),v=Math.round(u.y+(c.height-h.height)/2)):(e.includes(`w`)&&(_=u.x+c.width-h.width),e.includes(`n`)&&(v=u.y+c.height-h.height)),g={x:_,y:v},m||=requestAnimationFrame(b)},S=()=>{m&&cancelAnimationFrame(m),window.removeEventListener(`mousemove`,x),window.removeEventListener(`mouseup`,C),v.current||l(!1),_.current===S&&(_.current=null)},C=()=>{S();let e=window.innerWidth,n=window.innerHeight,i=Mo(h,e,n);r(i),a(Po(g,i,e,n)),t(i)};window.addEventListener(`mousemove`,x),window.addEventListener(`mouseup`,C),_.current=S},[t]),toggleMaximize:(0,U.useCallback)(()=>{let e=window.innerWidth,t=window.innerHeight;if(m.current){let n=h.current;if(n){let i=Mo(n.size,e,t);r(i),a(Po(n.position,i,e,t))}d(!1)}else{h.current={size:f.current,position:p.current};let n=Mo({width:e,height:t},e,t);r(n),a(No(n,e,t)),d(!0)}},[])}}function Io({...e}){return(0,H.jsx)(Ft,{"data-slot":`dialog`,...e})}function Lo({...e}){return(0,H.jsx)(zt,{"data-slot":`dialog-trigger`,...e})}function Ro({...e}){return(0,H.jsx)(Yt,{"data-slot":`dialog-portal`,...e})}function zo({className:e,...t}){return(0,H.jsx)(Rt,{"data-slot":`dialog-overlay`,className:p(`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-white/80 backdrop-blur-xs dark:bg-black-dark/90 dark:backdrop-blur-none`,e),...t})}function Bo({className:e}){return(0,H.jsxs)(Gt,{className:p(`ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-0 right-0 flex items-start justify-end rounded-bl-md p-4 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`,e),children:[(0,H.jsx)(_n,{className:`text-popover-foreground`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]})}var Vo=[{dir:`n`,className:`-top-2 inset-x-5 h-4 cursor-ns-resize z-30`},{dir:`s`,className:`-bottom-2 inset-x-5 h-4 cursor-ns-resize z-30`},{dir:`e`,className:`-right-2 inset-y-5 w-4 cursor-ew-resize z-30`},{dir:`w`,className:`-left-2 inset-y-5 w-4 cursor-ew-resize z-30`},{dir:`nw`,className:`-top-2 -left-2 size-6 cursor-nwse-resize z-40`},{dir:`ne`,className:`-top-2 -right-2 size-6 cursor-nesw-resize z-40`},{dir:`sw`,className:`-bottom-2 -left-2 size-6 cursor-nesw-resize z-40`},{dir:`se`,className:`-bottom-2 -right-2 size-6 cursor-nwse-resize z-40`}];function Ho({className:e,children:t,...n}){let{size:r,position:i,isDragging:a,isResizing:o,isMaximized:s,contentRef:c,startDrag:l,startResize:u,toggleMaximize:d}=Fo(),f=`ring-offset-background focus:ring-ring text-popover-foreground flex size-8 items-center justify-center rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none`;return(0,H.jsxs)(Ro,{"data-slot":`dialog-portal`,children:[(0,H.jsx)(zo,{className:p(`transition-opacity duration-200`,a&&`opacity-0`)}),(0,H.jsxs)(en,{ref:c,"data-slot":`dialog-content`,style:{left:i.x,top:i.y,width:r.width,height:r.height},className:p(`bg-popover 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 z-50 rounded-md border shadow-2xl transition-none`,a&&`will-change-transform`,e),...n,children:[(0,H.jsxs)(`div`,{className:p(`flex h-full w-full flex-col gap-4 overflow-hidden rounded-md p-6`,(a||o)&&`select-none`),children:[(0,H.jsx)(`div`,{onMouseDown:l,className:`absolute inset-x-0 top-0 z-10 flex h-12 cursor-move items-start justify-center`,"aria-hidden":!0,children:(0,H.jsx)(hr,{className:`mt-1 size-4 text-muted-foreground/40`})}),t,(0,H.jsxs)(`div`,{className:`absolute top-6 right-4 z-20 flex h-[1.125rem] items-center gap-1`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:d,"aria-label":s?`Restore modal size`:`Maximize modal`,className:f,children:s?(0,H.jsx)(Mr,{className:`size-4`}):(0,H.jsx)(Ar,{className:`size-4`})}),(0,H.jsxs)(Gt,{"aria-label":`Close`,className:f,children:[(0,H.jsx)(_n,{className:`size-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}),Vo.map(({dir:e,className:t})=>(0,H.jsx)(`div`,{"data-resize-handle":e,onMouseDown:u(e),className:p(`absolute`,t),"aria-hidden":!0},e))]})]})}function Uo({className:e,children:t,resizable:n,...r}){return n?(0,H.jsx)(Ho,{className:e,...r,children:t}):(0,H.jsxs)(Ro,{"data-slot":`dialog-portal`,children:[(0,H.jsx)(zo,{}),(0,H.jsxs)(en,{"data-slot":`dialog-content`,className:p(`bg-popover 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 border p-6 shadow-2xl duration-200`,e),...r,children:[t,(0,H.jsx)(Bo,{})]})]})}function Wo({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-header`,className:p(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Go({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`dialog-footer`,className:p(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...t})}function Ko({className:e,...t}){return(0,H.jsx)(Kt,{"data-slot":`dialog-title`,className:p(`text-lg leading-none text-popover-foreground font-semibold`,e),...t})}function qo({className:e,...t}){return(0,H.jsx)(It,{"data-slot":`dialog-description`,className:p(`text-muted-foreground text-sm`,e),...t})}function Jo({typeOfThingBeingDeleted:e,nameOfThingBeingDeleted:t,isModalOpen:n,hideDataLossWarning:r,setIsModalOpen:i,deletionConfirmed:a,deletionPending:o,trigger:s,presentParticiple:c=`Deleting`,transitiveVerb:l=`Delete`}){return(0,H.jsxs)(Io,{open:n,onOpenChange:i,children:[s&&(0,H.jsx)(Lo,{asChild:!0,children:s}),(0,H.jsxs)(Uo,{className:`sm:max-w-[750px]`,children:[(0,H.jsxs)(Wo,{children:[(0,H.jsxs)(Ko,{children:[`Are you sure you want to `,l.toLowerCase(),` this `,e,`?`]}),(0,H.jsx)(qo,{children:`This action cannot be undone.`})]}),!r&&(0,H.jsxs)(`div`,{className:`p-3 my-5 text-white rounded-md bg-amber-600`,children:[(0,H.jsxs)(`p`,{className:`flex space-x-1 font-semibold align-baseline`,children:[(0,H.jsx)(ii,{className:`inline-block size-5`}),` `,(0,H.jsx)(`span`,{children:`Warning`})]}),(0,H.jsxs)(`p`,{className:`pt-2 text-base`,children:[`By `,c.toLowerCase(),` `,e,` `,(0,H.jsx)(`span`,{className:`font-semibold`,children:t}),` `,`you will lose the data stored in it permanently.`]})]}),(0,H.jsx)(Go,{children:(0,H.jsxs)(`div`,{className:`flex justify-center space-x-5`,children:[(0,H.jsxs)(_,{type:`button`,onClick:()=>i(!1),children:[(0,H.jsx)(jn,{}),` Cancel`]}),(0,H.jsxs)(_,{variant:`destructive`,onClick:a,disabled:o,children:[(0,H.jsx)(ri,{}),` `,l]})]})})]})]})}function Yo({...e}){return(0,H.jsx)(qt,{"data-slot":`dropdown-menu`,...e})}function Xo({...e}){return(0,H.jsx)(Qt,{"data-slot":`dropdown-menu-trigger`,...e})}function Zo({className:e,sideOffset:t=4,...n}){return(0,H.jsx)($t,{children:(0,H.jsx)(jt,{"data-slot":`dropdown-menu-content`,sideOffset:t,className:p(`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-border p-1 shadow-md`,e),...n})})}function Qo({className:e,inset:t,variant:n=`default`,...r}){return(0,H.jsx)(yt,{"data-slot":`dropdown-menu-item`,"data-inset":t,"data-variant":n,className:p(`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 $o({className:e,children:t,checked:n,...r}){return(0,H.jsxs)(kt,{"data-slot":`dropdown-menu-checkbox-item`,className:p(`focus:bg-accent focus:text-accent-foreground 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,H.jsx)(`span`,{className:`pointer-events-none absolute left-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(We,{children:(0,H.jsx)(pn,{className:`size-4`})})}),t]})}function es({className:e,inset:t,...n}){return(0,H.jsx)(Lt,{"data-slot":`dropdown-menu-label`,"data-inset":t,className:p(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function ts({className:e,...t}){return(0,H.jsx)(Zt,{"data-slot":`dropdown-menu-separator`,className:p(`bg-border -mx-1 my-1 h-px`,e),...t})}function ns({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`dropdown-menu-shortcut`,className:p(`text-muted-foreground ml-auto text-xs tracking-widest`,e),...t})}function rs({...e}){return(0,H.jsx)(Bt,{"data-slot":`dropdown-menu-sub`,...e})}function is({className:e,inset:t,children:n,...r}){return(0,H.jsxs)(Jt,{"data-slot":`dropdown-menu-sub-trigger`,"data-inset":t,className:p(`focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground`,`flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none`,`data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0`,`[&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,H.jsx)(Un,{className:`ml-auto size-4`})]})}function as({className:e,...t}){return(0,H.jsx)(Mt,{"data-slot":`dropdown-menu-sub-content`,className:p(`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 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg`,e),...t})}function os({...e}){return(0,H.jsx)(Xt,{"data-slot":`context-menu`,...e})}function ss({...e}){return(0,H.jsx)(At,{"data-slot":`context-menu-trigger`,...e})}function cs({className:e,...t}){return(0,H.jsx)(ct,{children:(0,H.jsx)(Et,{"data-slot":`context-menu-content`,className:p(`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-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border border-border p-1 shadow-md`,e),...t})})}function ls({className:e,inset:t,variant:n=`default`,...r}){return(0,H.jsx)(Ot,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:p(`focus:bg-accent focus:text-grey dark:focus:bg-white/15 dark:focus:text-white`,`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 us({className:e,inset:t,...n}){return(0,H.jsx)(rt,{"data-slot":`context-menu-label`,"data-inset":t,className:p(`px-2 py-1.5 text-sm font-medium data-[inset]:pl-8`,e),...n})}function ds({className:e,...t}){return(0,H.jsx)(st,{"data-slot":`context-menu-separator`,className:p(`bg-border -mx-1 my-1 h-px`,e),...t})}function fs({className:e,...t}){return(0,H.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:p(`text-muted-foreground ml-auto text-xs tracking-widest`,e),...t})}var ps={dropdown:{Item:Qo,Label:es,Separator:ts},context:{Item:ls,Label:us,Separator:ds}};function ms(e,t){let{Item:n,Label:r,Separator:i}=ps[t];return e.map(e=>{if(e.type===`separator`)return(0,H.jsx)(i,{},e.key);if(e.type===`label`)return(0,H.jsx)(r,{className:e.className,children:e.label},e.key);let t=(0,H.jsxs)(n,{className:e.className,onClick:e.onClick,disabled:e.disabled,variant:e.variant,children:[e.icon,e.label]});return e.to?(0,H.jsx)(I,{to:e.to,disabled:e.disabled,children:t},e.key):(0,H.jsx)(U.Fragment,{children:t},e.key)})}function hs({items:e,children:t}){return e.length?(0,H.jsxs)(os,{children:[(0,H.jsx)(ss,{asChild:!0,children:t}),(0,H.jsx)(cs,{children:ms(e,`context`)})]}):(0,H.jsx)(H.Fragment,{children:t})}function gs(e,t,n,r){return e?e.super_user===!0||e.structure_user===!0||e[t]?.tables?.[n]?.[r]===!0:!1}function _s(e){let{user:t}=He(),{organizationId:n}=M({strict:!1});if(Ue(t))return{update:!0,remove:!0};let r=t?.roles?.[e??n];return!r||`oauthProviders`in r||!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 vs(e){let{user:t}=He(),{organizationId:n}=M({strict:!1});if(Ue(t))return{create:!0,remove:!0,update:!0,view:!0};let r=t?.roles?.[e??n];if(!r||`oauthProviders`in r||!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 ys(e,t){let{user:n}=He(),{organizationId:r,clusterId:i}=M({strict:!1});return bs(n,e??r,t??i)}function bs(e,t,n){if(Ue(e))return{create:!0,remove:!0,update:!0,view:!0};let r=e?.roles?.[t];if(!r||`oauthProviders`in r||!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 xs(e,t){let{user:n}=He(),{organizationId:r,clusterId:i}=M({strict:!1});return Ss(n,e??r,t??i)}function Ss(e,t,n){if(Ue(e))return{create:!0,remove:!0,update:!0,view:!0};let r=e?.roles?.[t];if(!r||`oauthProviders`in r||!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 Cs(e){let{clusterId:t,instanceId:n}=M({strict:!1}),{user:r}=ze(e??n??t),i=r?.role?.permission;return i?i.super_user===!0:!1}function ws(e){let{clusterId:t,instanceId:n}=M({strict:!1}),{user:r}=ze(e??n??t),i=r?.role?.permission;return i?i.super_user===!0||i.structure_user===!0:!1}function Ts(e,t,n,r){let{clusterId:i,instanceId:a}=M({strict:!1}),{user:o}=ze(e??a??i);return gs(o?.role?.permission,t,n,r)}function Es(e){return!!e?.plans?.[0]?.planId?.startsWith(`self-hosted`)}function Ds({cluster:e,hasCardLink:t=!1}){let{view:n,update:r}=ys(e.organizationId,e.id),i=`/${e.organizationId}/${e.id}`;if(n)return Es(e)?(0,H.jsx)(Os,{cluster:e,hasCardLink:t}):e.fqdn?e.resetPassword?r?(0,H.jsx)(I,{to:`${i}/finish-setup`,className:`text-sm text-nowrap`,"aria-label":`Set Password on ${e.name}`,title:`Set Password on ${e.name}`,children:(0,H.jsxs)(_,{variant:`positive`,className:`py-2 hover:border-b-2 animate-glow-pulse`,children:[`Finish Setup `,(0,H.jsx)(Mn,{className:`inline-block`})]})}):(0,H.jsx)(`span`,{className:`py-2 text-nowrap`,children:`Pending Owner Setup`}):(0,H.jsx)(Os,{cluster:e,hasCardLink:t}):t?(0,H.jsxs)(`span`,{className:`text-sm text-nowrap py-2 ml-auto`,children:[`Instances `,(0,H.jsx)(Mn,{className:`inline-block`})]}):(0,H.jsx)(I,{to:`${i}/instances`,className:`text-sm text-nowrap`,"aria-label":`View ${e.name}`,title:`View ${e.name}`,children:(0,H.jsxs)(`span`,{className:`py-2 hover:border-b-2`,children:[`Instances `,(0,H.jsx)(Mn,{className:`inline-block`})]})})}function Os({cluster:e,hasCardLink:t}){return t?(0,H.jsxs)(`span`,{className:`text-sm text-nowrap py-2 ml-auto`,children:[`Open `,(0,H.jsx)(Mn,{className:`inline-block`})]}):(0,H.jsx)(I,{to:`/${e.organizationId}/${e.id}`,className:`text-sm text-nowrap`,"aria-label":`Open ${e.name}`,title:`Open ${e.name}`,children:(0,H.jsxs)(`span`,{className:`py-2 hover:border-b-2`,children:[`Open `,(0,H.jsx)(Mn,{className:`inline-block`})]})})}function ks(e,t){let n=[];if(e)for(let r of e)n.push(r[t]);return n}function As({cluster:e,forceProgressBarVisible:t}){let[n,r]=(0,U.useState)(t||!1),{data:i}=N(Sa(n&&e.id,2e3));(0,U.useEffect)(function(){(Eo(e.status)||Do(e.status))&&r(!0)},[n,e.status,i?.instances]);let a=(0,U.useMemo)(()=>{let e=ks(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||To(t)||(Eo(t)?(n+=1,r[t]=`${n} ${ca(t)}`):Do(t)?(a+=1,o[t]=`${a} ${ca(t)}`):wo(t)?(l+=1,u[t]=`${l} ${ca(t)}`):!i.planId||!e.includes(i.planId)?(a+=1,o.DRAINING_TRAFFIC=`${a} ${ca(`Draining Traffic`)}`):Co(t)&&(s+=1,c[t]=`${s} ${ca(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,H.jsxs)(`div`,{className:`w-full text-center`,children:[(0,H.jsxs)(`div`,{className:`w-full h-2.5 rounded-full overflow-clip flex shadow`,children:[(0,H.jsx)(`div`,{style:{width:a.runningWidth},className:`grow bg-green/80 transition-[width] duration-1000 ease-in-out motion-reduce:transition-none`}),(0,H.jsx)(`div`,{style:{width:a.failedWidth},className:`grow bg-red/80 transition-[width] duration-1000 ease-in-out motion-reduce:transition-none`}),(0,H.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,H.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,H.jsx)(`div`,{className:`text-xs text-muted-foreground font-light mt-2`,children:a.text})]}):null}async function js(e){let{data:t}=await c.delete(`/Cluster/${e}`,{timeout:0});return t}function Ms(){return j({mutationFn:e=>js(e)})}async function Ns(e){if(!navigator.clipboard)return B.error(`Clipboard access is not available in this environment.`),!1;try{return await navigator.clipboard.writeText(e),!0}catch{return B.error(`Failed to copy to clipboard.`),!1}}function Ps(e){Ns(e).then(e=>{e&&B.info(`Copied to clipboard!`,{icon:(0,H.jsx)(Yn,{}),duration:1e3})})}function Fs(...e){return(0,U.useMemo)(()=>e.map(e=>()=>Ps(e)),e)}function Is(){return Ps}function Ls({cluster:e}){let t=se(),n=le(),r=(0,U.useMemo)(()=>g(e),[e]),a=Fi({operationsUrl:r}),o=ze(e.id),[,s]=xn(Cn.SavedClusterState,null),{view:c,update:l,remove:u,create:f}=ys(e.organizationId,e.id),{mutate:p,isPending:m}=Ms(),[h,_]=(0,U.useState)(!1),[v,y]=(0,U.useState)(!1),b=(0,U.useMemo)(()=>!!(e.status&&ha.includes(e.status)),[e.status]),x=Es(e),S=i.checkForFabricConnect(e.id),C=!S&&!!o.user,w=(0,U.useMemo)(()=>!!(e.status&&ga.includes(e.status)),[e.status]),T=(0,U.useMemo)(()=>!!(e.status&&wo(e.status)),[e.status]),E=l&&!x&&!w&&!Do(e.status)&&!Eo(e.status),ee=(0,U.useCallback)(async()=>{_(!0);let t=await xa(e.id).catch(e=>(console.error(`Failed to lookup cluster details, proceeding without checking instances.`,e),null));if(await d({entityId:e.id,instanceClient:a}),t?.instances?.length)for(let e of t.instances)i.setUserForEntity(e,null);i.setUserForEntity(e,null)},[e,a]),D=(0,U.useCallback)(()=>{s(e),t.navigate({to:`/${e.organizationId}/new-cluster`})},[e,t,s]),O=(0,U.useCallback)(()=>y(!0),[]),k=(0,U.useCallback)(()=>{let r=e.organizationId;p(e.id,{onSuccess:async()=>{await n.invalidateQueries({queryKey:[r],refetchType:`active`}),await t.invalidate(),B.success(`Success`,{description:x?`Cluster successfully removed.`:`Cluster successfully terminated.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),y(!1)},onError:()=>{B.error(`Error`,{description:x?`Failed to remove cluster: ${e.name}`:`Failed to terminate cluster: ${e.name}.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),y(!1)}})},[t,e.organizationId,e.id,e.name,p,x,n]),A=!b||!c||w?void 0:x?`/${e.organizationId}/${e.id}`:e.fqdn?e.resetPassword?void 0:`/${e.organizationId}/${e.id}`:`/${e.organizationId}/${e.id}/instances`,te=e.domains?.[0]?.domain||e.fqdn,[ne,re]=Fs(`${te}`,`https://${te}`),ie=[{type:`label`,key:`label`,className:`text-gray-600 text-xs`,label:`Options`},{type:`separator`,key:`label-separator`},b&&l&&!o.isLoading&&(!C||S)&&{key:`sign-in`,to:`${e.id}/sign-in`,disabled:h,icon:(0,H.jsx)(xr,{className:`text-green`}),label:`Direct Sign In`},b&&c&&!!r&&!o.isLoading&&C&&{key:`direct-sign-out`,onClick:ee,disabled:h,label:`Direct Sign Out`},b&&l&&{key:`edit`,to:`${e.id}/edit`,disabled:h,icon:(0,H.jsx)(Hr,{className:`text-purple-600`}),label:x?`Edit`:`Edit Scaling`},E&&{key:`edit-version`,to:`${e.id}/edit/version`,disabled:h,icon:(0,H.jsx)(pr,{className:`text-fuchsia-300`}),label:`Edit Version`},b&&l&&!1,b&&c&&{key:`instances`,to:`${e.id}/instances`,disabled:h,icon:(0,H.jsx)(Wr,{className:`text-orange-300`}),label:`Instances`},b&&c&&{key:`deployments`,to:`${e.id}/config/deployments`,disabled:h,icon:(0,H.jsx)(zr,{className:`text-sky-400`}),label:`Deployments`},b&&c&&!!e.fqdn&&{type:`separator`,key:`copy-separator`},b&&c&&!!e.fqdn&&{key:`copy-host-name`,onClick:ne,disabled:h,icon:(0,H.jsx)(Xn,{}),label:`Copy Host Name`},b&&c&&!!e.fqdn&&{key:`copy-api-url`,onClick:re,disabled:h,icon:(0,H.jsx)(Xn,{}),label:`Copy API URL`},T&&f&&{key:`try-again`,onClick:D,className:`focus:bg-green/70 focus:text-white`,label:`Try Again`},!w&&u&&b&&{type:`separator`,key:`remove-separator`},!w&&u&&{key:`remove`,onClick:O,className:`focus:bg-red/70 focus:text-white`,icon:(0,H.jsx)(ri,{className:`text-red-300`}),label:x?`Remove`:`Terminate`}].filter(di);return(0,H.jsx)(hs,{items:w?[]:ie,children:(0,H.jsxs)(fn,{className:`relative h-full justify-between transition-[transform,box-shadow] duration-200 ${A?`hover:scale-[1.02] hover:shadow-lg hover:ring-2 hover:ring-primary/60 dark:hover:ring-violet-400/70`:`hover:shadow-lg`}`,children:[A&&(0,H.jsx)(I,{to:A,"aria-label":`${x||e.fqdn?`Open`:`View`} ${e.name}`,className:`absolute inset-0 rounded-[inherit] focus-visible:ring-2 focus-visible:ring-purple-200 focus-visible:outline-none`}),(0,H.jsxs)(ln,{children:[(0,H.jsxs)(dn,{className:`flex items-center justify-between`,children:[te?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`span`,{className:`truncate max-w-48`,children:te}),(0,H.jsx)(`button`,{type:`button`,"aria-label":`Copy host name`,onClick:e=>{e.stopPropagation(),ne()},className:`relative z-10 -m-1.5 p-1.5 rounded-md text-muted-foreground cursor-pointer hover:bg-accent/60 hover:text-foreground`,children:(0,H.jsx)(tr,{size:16})}),(0,H.jsx)(`span`,{className:`grow`})]}):(0,H.jsx)(`span`,{children:`Self-Hosted`}),!w&&(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{"aria-label":`Cluster options`,onClick:e=>e.stopPropagation(),className:`relative z-10 -m-2 p-2 rounded-md hover:bg-accent/60`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(Zo,{children:ms(ie,`dropdown`)})]})]}),(0,H.jsx)(cn,{children:(0,H.jsx)(`h2`,{children:e.name})})]}),(0,H.jsxs)(un,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(As,{cluster:e}),b&&c&&(0,H.jsx)(Ds,{cluster:e,hasCardLink:!!A}),T&&e.status&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Va,{variant:So(e.status),children:ca(e.status)}),(0,H.jsx)(`span`,{className:`text-xs`,children:`Click "..." to choose how to proceed.`})]})]}),(0,H.jsx)(Jo,{typeOfThingBeingDeleted:`cluster`,transitiveVerb:x?`Remove`:`Terminate`,presentParticiple:x?`Removing`:`Terminating`,nameOfThingBeingDeleted:e.name,isModalOpen:v,hideDataLossWarning:x,setIsModalOpen:e=>y(e),deletionConfirmed:k,deletionPending:m})]})})}function Rs({overEmail:e}){return(0,H.jsx)(`a`,{href:e?`mailto:support@harperdb.io`:`https://discord.com/channels/1415002037439041710/1415002038286286994`,target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Contact us`})}function zs({className:e,text:t,centered:n,...r}){return(0,H.jsxs)(`div`,{className:`text-foreground h-full w-full ${e||``} ${n?`flex flex-col items-center justify-center`:``}`,...r,children:[(0,H.jsx)(`img`,{src:`/HDBDogOnly.svg`,width:`100px`,height:`100px`,alt:`HDB Dog Logo Loading`,className:`inline-block`}),(0,H.jsx)(`p`,{className:`pt-4`,children:t||`Loading...`})]})}function Bs({children:e,className:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))] relative ${t??``}`,children:e})]})}var Vs=`flex items-center gap-3 p-2 rounded-lg text-sm transition-colors`,Hs=`block p-2 rounded-lg text-sm transition-colors`,Us={className:`text-foreground hover:bg-accent dark:text-white dark:hover:bg-grey-700`},Ws={className:`font-medium text-primary bg-primary/10 dark:text-white dark:bg-white/10`};function Gs({items:e,ariaLabel:t}){let{pathname:n}=Ae(),r=e=>e.exact?n===e.to:n.startsWith(e.to),i=e.find(r)??e[0],a=i.icon;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`nav`,{className:`hidden md:flex flex-col gap-1`,"aria-label":t,children:e.map(e=>{let t=e.icon;return(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(I,{to:e.to,className:Vs,activeOptions:{exact:!!e.exact},activeProps:Ws,inactiveProps:Us,children:[(0,H.jsx)(t,{className:`size-4 shrink-0`}),e.label]}),e.children&&r(e)&&(0,H.jsx)(`div`,{className:`mt-1 ml-4 flex flex-col gap-1 border-l border-border pl-3`,children:e.children.map(e=>(0,H.jsx)(I,{to:e.to,className:Hs,activeOptions:{exact:!!e.exact},activeProps:Ws,inactiveProps:Us,children:e.label},e.to))})]},e.to)})}),(0,H.jsx)(`div`,{className:`md:hidden`,children:(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{asChild:!0,children:(0,H.jsxs)(_,{variant:`outline`,className:`w-full justify-between`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(a,{className:`size-4`}),i.label]}),(0,H.jsx)(mn,{className:`size-4`})]})}),(0,H.jsx)(Zo,{align:`start`,className:`w-(--radix-dropdown-menu-trigger-width)`,children:e.map(e=>{let t=e.icon;return[(0,H.jsx)(Qo,{asChild:!0,children:(0,H.jsxs)(I,{to:e.to,className:`flex items-center gap-2`,children:[(0,H.jsx)(t,{className:`size-4`}),e.label]})},e.to),...e.children&&r(e)?e.children.map(e=>(0,H.jsx)(Qo,{asChild:!0,children:(0,H.jsx)(I,{to:e.to,className:`flex items-center gap-2 pl-8`,children:e.label})},e.to)):[]]})})]})})]})}function Ks({children:e}){let{organizationId:t,clusterId:n}=M({strict:!1}),{view:r,update:i}=ys(t,n),{data:a}=N(Sa(n,!1)),o=a?Es(a):!1,s=`/${t}/${n}`;return(0,H.jsx)(`div`,{className:`relative mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,H.jsxs)(`div`,{className:`md:grid gap-6 md:grid-cols-12`,children:[(0,H.jsx)(`aside`,{className:`md:col-span-3 lg:col-span-2 mb-4 md:mb-0`,children:(0,H.jsx)(Gs,{items:[{to:s,label:`Overview`,icon:Sr,exact:!0},i&&{to:`${s}/edit`,label:o?`Configuration`:`Scaling`,icon:fr,exact:!0},i&&!o&&{to:`${s}/edit/version`,label:`Version`,icon:$r,exact:!0},i&&!o&&{to:`${s}/domains`,label:`Domains`,icon:mr},r&&{to:`${s}/instances`,label:`Instances`,icon:Wr}].filter(Boolean),ariaLabel:`Cluster sections`})}),(0,H.jsx)(`section`,{className:`md:col-span-9 lg:col-span-10 min-w-0`,children:e})]})})}async function qs(e){let{data:t}=await c.get(`/Plan/`,{params:{organizationId:e}});return t}function Js(e){return F({queryKey:[e,`instancePlan`],queryFn:()=>qs(e),retry:!1})}async function Ys(){let{data:e}=await c.get(`/HarperVersions/`);return e}function Xs(){return F({queryKey:[`HarperVersions`],queryFn:Ys,staleTime:6e4,retry:!1})}async function Zs({organizationId:e,availableHosts:t}={}){let{data:n}=await c.get(`/Region/`,{params:{availableHosts:t,organizationId:e}});return n}function Qs({organizationId:e,availableHosts:t}={}){return F({queryKey:[e,`regionLocations`,t],queryFn:()=>Zs({organizationId:e,availableHosts:t}),retry:!1})}function $s(e){return(t,n)=>t[e]===n[e]?0:t[e]>n[e]?1:-1}function ec(e){let t=e.split(`.`).map(Number);return(t[0]<<24|t[1]<<16|t[2]<<8|t[3])>>>0}function tc(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)}function nc(e,t){return e.instanceFqdn===t.instanceFqdn?e.operationsApiPort-t.operationsApiPort:tc(e.instanceFqdn)&&tc(t.instanceFqdn)?ec(e.instanceFqdn)-ec(t.instanceFqdn):e.instanceFqdn>t.instanceFqdn?1:-1}function rc(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 ic(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 ac(e,t,n){let r=rc(e,t),i={};for(let e in r)i[e]=ic(r[e],n);return i}function oc(e,t){let n=cc(e),r=cc(t);return!n||!r?!1:dc(r,n)>=0}function sc(e,t){let n=cc(e),r=cc(t);return!n&&!r?0:n?r?dc(n,r):1:-1}function cc(e){if(typeof e!=`string`)return null;let[t]=e.split(`+`,1).concat(``),n=t.indexOf(`-`),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+1),a=r.split(`.`);if(a.length===0)return null;let o=lc(a[0]),s=lc(a[1]??`0`),c=lc(a[2]??`0`);return o==null||s==null||c==null?null:{major:o,minor:s,patch:c,pre:i?i.split(`.`).map(e=>uc(e)?Number(e):e):[]}}function lc(e){return e==null||e===``||!/^\d+$/.test(e)?null:Number(e)}function uc(e){return/^\d+$/.test(e)}function dc(e,t){if(e.major!==t.major)return e.major<t.major?-1:1;if(e.minor!==t.minor)return e.minor<t.minor?-1:1;if(e.patch!==t.patch)return e.patch<t.patch?-1:1;let n=e.pre.length>0,r=t.pre.length>0;if(!n&&!r)return 0;if(!n&&r)return 1;if(n&&!r)return-1;let i=Math.min(e.pre.length,t.pre.length);for(let n=0;n<i;n++){let r=e.pre[n],i=t.pre[n],a=typeof r==`number`,o=typeof i==`number`;if(a&&o){if(r!==i)return r<i?-1:1;continue}if(a&&!o)return-1;if(!a&&o)return 1;if(r!==i)return String(r)<String(i)?-1:1}return e.pre.length===t.pre.length?0:e.pre.length<t.pre.length?-1:1}function fc({width:e,className:t,animated:n,placeholder:r}){return(0,H.jsxs)(`div`,{className:b(`w-full bg-gray-200 rounded-full relative`,r?`h-6`:`h-2.5`),children:[r&&(0,H.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,H.jsx)(`div`,{className:b(`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 pc({duration:e,message:t,lateMessage:n}){let r=(0,U.useRef)(0),i=(0,U.useRef)(0),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(`5%`),l=(0,U.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,U.useEffect)(()=>(r.current=requestAnimationFrame(l),()=>cancelAnimationFrame(r.current)),[l]),(0,H.jsxs)(H.Fragment,{children:[a?n:t,(0,H.jsx)(fc,{width:s,animated:!1})]})}async function mc(e){let{data:t}=await c.post(`/Cluster/`,e,{timeout:0});return t}function hc(){return j({mutationFn:e=>mc(e)})}async function gc(e){let{id:t,...n}=e,{data:r}=await c.put(`/Cluster/${t}`,n,{timeout:0});return r}function _c(){return j({mutationFn:e=>gc(e)})}function vc(e){return!!e&&e!==`undefined`&&e!==`null`}async function yc(e){if(!vc(e))throw Error(`getOrganization called without a valid organization id (got: ${e})`);let{data:t}=await c.get(`/Organization/${e}`);return t}function bc(e){return F({queryKey:[e],queryFn:()=>yc(e),retry:!1,enabled:vc(e),refetchInterval:1e4})}var xc=`ENTERPRISE`;function Sc(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 Cc(e,t,n=`-`){let r=t.split(n)[0];return e.findIndex(e=>e.startsWith(r))!==-1}function wc(e){return e.replace(/[^a-zA-Z0-9]/g,`-`).replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase().replace(/-+/g,`-`).replace(/^-+|-+$/g,``)}function Tc(e){return e!==void 0&&e>0}function Ec(e,t,n){return t===void 0?Promise.resolve():e.invalidateQueries({predicate:e=>e.queryKey[0]===t||e.queryKey[1]===t,...n})}async function Dc(e){await c.put(`/Payment/`,e)}function Oc(){return j({mutationFn:e=>Dc(e)})}function kc(e){let{mutate:t}=Oc();return(0,U.useCallback)((n,r)=>{t({paymentMethodId:typeof n==`string`?n:n.id,organizationId:e},{onSuccess:()=>{B.success(`Success! Your payment method has been saved.`),r(!0)},onError:()=>{B.error(`Failed to process payment method details. Please try another payment method.`),r(!1)}})},[t,e])}var Ac=(0,U.createContext)(null);function jc(){return(0,U.useContext)(Ac)}var Mc=n(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),Nc=n(((e,t)=>{var n=Mc();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),Pc=n(((e,t)=>{t.exports=Nc()()})),Fc=e(Pc(),1);function Ic(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Lc(e){if(Array.isArray(e))return e}function Rc(e,t,n){return(t=qc(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zc(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Bc(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
11
11
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Hc(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Vc(Object(n),!0).forEach(function(t){Rc(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vc(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Uc(e,t){if(e==null)return{};var n,r,i=Wc(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Wc(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Gc(e,t){return Lc(e)||zc(e,t)||Yc(e,t)||Bc()}function Kc(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function qc(e){var t=Kc(e,`string`);return typeof t==`symbol`?t:t+``}function Jc(e){"@babel/helpers - typeof";return Jc=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Jc(e)}function Yc(e,t){if(e){if(typeof e==`string`)return Ic(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ic(e,t):void 0}}var Xc=function(e,t,n){var r=!!n,i=U.useRef(n);U.useEffect(function(){i.current=n},[n]),U.useEffect(function(){if(!r||!e)return function(){};var n=function(){if(i.current)return i.current.apply(i,arguments)};return e.on(t,n),function(){e.off(t,n)}},[r,t,e,i])},Zc=function(e){var t=U.useRef(e);return U.useEffect(function(){t.current=e},[e]),t.current},Qc=function(e){return e!==null&&Jc(e)===`object`},$c=function(e){return Qc(e)&&typeof e.then==`function`},el=function(e){return Qc(e)&&typeof e.elements==`function`&&typeof e.createToken==`function`&&typeof e.createPaymentMethod==`function`&&typeof e.confirmCardPayment==`function`},tl=`[object Object]`,nl=function e(t,n){if(!Qc(t)||!Qc(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var i=Object.prototype.toString.call(t)===tl;if(i!==(Object.prototype.toString.call(n)===tl))return!1;if(!i&&!r)return t===n;var a=Object.keys(t),o=Object.keys(n);if(a.length!==o.length)return!1;for(var s={},c=0;c<a.length;c+=1)s[a[c]]=!0;for(var l=0;l<o.length;l+=1)s[o[l]]=!0;var u=Object.keys(s);if(u.length!==a.length)return!1;var d=t,f=n;return u.every(function(t){return e(d[t],f[t])})},rl=function(e,t,n){return Qc(e)?Object.keys(e).reduce(function(r,i){var a=!Qc(t)||!nl(e[i],t[i]);return n.includes(i)?(a&&console.warn(`Unsupported prop change: options.${i} is not a mutable property.`),r):a?Hc(Hc({},r||{}),{},Rc({},i,e[i])):r},null):null},il="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",al=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:il;if(e===null||el(e))return e;throw Error(t)},ol=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:il;if($c(e))return{tag:`async`,stripePromise:Promise.resolve(e).then(function(e){return al(e,t)})};var n=al(e,t);return n===null?{tag:`empty`}:{tag:`sync`,stripe:n}},sl=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:`react-stripe-js`,version:`6.7.0`}),e.registerAppInfo({name:`react-stripe-js`,version:`6.7.0`,url:`https://stripe.com/docs/stripe-js/react`}))},cl=U.createContext(null);cl.displayName=`ElementsContext`;var ll=function(e,t){if(!e)throw Error(`Could not find Elements context; You need to wrap the part of your app that ${t} in an <Elements> provider.`);return e},ul=function(e){var t=e.stripe,n=e.options,r=e.children,i=U.useMemo(function(){return ol(t)},[t]),a=Gc(U.useState(function(){return{stripe:i.tag===`sync`?i.stripe:null,elements:i.tag===`sync`?i.stripe.elements(n):null}}),2),o=a[0],s=a[1];U.useEffect(function(){var e=!0,t=function(e){s(function(t){return t.stripe?t:{stripe:e,elements:e.elements(n)}})};return i.tag===`async`&&!o.stripe?i.stripePromise.then(function(n){n&&e&&t(n)}):i.tag===`sync`&&!o.stripe&&t(i.stripe),function(){e=!1}},[i,o,n]);var c=Zc(t);U.useEffect(function(){c!==null&&c!==t&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[c,t]);var l=Zc(n);return U.useEffect(function(){if(o.elements){var e=rl(n,l,[`clientSecret`,`fonts`]);e&&o.elements.update(e)}},[n,l,o.elements]),U.useEffect(function(){sl(o.stripe)},[o.stripe]),U.createElement(cl.Provider,{value:o},r)};ul.propTypes={stripe:Fc.default.any,options:Fc.default.object};var dl=function(e){return ll(U.useContext(cl),e)},fl=function(){return dl(`calls useElements()`).elements},pl=function(e){var t=e.children;return t(dl(`mounts <ElementsConsumer>`))};pl.propTypes={children:Fc.default.func.isRequired};var ml=U.createContext(null);ml.displayName=`CheckoutContext`;var hl=function(e){var t=U.useContext(ml),n=U.useContext(cl);if(t){if(n)throw Error(`You cannot wrap the part of your app that ${e} in both a checkout provider and <Elements> provider.`);return t}else return ll(n,e)},gl=[`mode`],_l=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},vl=function(e,t,n){var r=`${_l(e)}Element`,i=t?function(e){hl(`mounts <${r}>`);var t=e.id,n=e.className;return U.createElement(`div`,{id:t,className:n})}:function(t){var n=t.id,i=t.className,a=t.options,o=a===void 0?{}:a,s=t.onBlur,c=t.onFocus,l=t.onReady,u=t.onChange,d=t.onEscape,f=t.onClick,p=t.onLoadError,m=t.onLoaderStart,h=t.onNetworksChange,g=t.onConfirm,_=t.onCancel,v=t.onShippingAddressChange,y=t.onShippingRateChange,b=t.onSavedPaymentMethodRemove,x=t.onSavedPaymentMethodUpdate,S=t.onAvailablePaymentMethodsChange,C=hl(`mounts <${r}>`),w=`elements`in C?C.elements:null,T=`checkoutState`in C?C.checkoutState:null,E=T?.type===`success`||T?.type===`loading`?T.sdk:null,ee=Gc(U.useState(null),2),D=ee[0],O=ee[1],k=U.useRef(null),A=U.useRef(null);Xc(D,`blur`,s),Xc(D,`focus`,c),Xc(D,`escape`,d),Xc(D,`click`,f),Xc(D,`loaderror`,p),Xc(D,`loaderstart`,m),Xc(D,`networkschange`,h),Xc(D,`confirm`,g),Xc(D,`cancel`,_),Xc(D,`shippingaddresschange`,v),Xc(D,`shippingratechange`,y),Xc(D,`savedpaymentmethodremove`,b),Xc(D,`savedpaymentmethodupdate`,x),Xc(D,`availablepaymentmethodschange`,S),Xc(D,`change`,u);var te;l&&(te=e===`expressCheckout`?l:function(){l(D)}),Xc(D,`ready`,te),U.useLayoutEffect(function(){if(k.current===null&&A.current!==null&&(w||E)){var t=null;if(E){var n=E,i=E;switch(e){case`paymentForm`:t=i.createForm(o);break;case`payment`:t=n.createPaymentElement(o);break;case`address`:if(`mode`in o){var a=o.mode,s=Uc(o,gl);if(a===`shipping`)t=n.createShippingAddressElement(s);else if(a===`billing`)t=n.createBillingAddressElement(s);else throw Error(`Invalid options.mode. mode must be 'billing' or 'shipping'.`)}else throw Error(`You must supply options.mode. mode must be 'billing' or 'shipping'.`);break;case`expressCheckout`:t=n.createExpressCheckoutElement(o);break;case`currencySelector`:t=E.createCurrencySelectorElement();break;case`taxId`:t=n.createTaxIdElement(o);break;case`contactDetails`:t=n.createContactDetailsElement();break;default:throw Error(`<${r}> is not supported inside a checkout provider. Use an <Elements> provider instead.`)}}else w&&(t=w.create(e,o));k.current=t,O(t),t&&t.mount(A.current)}},[w,E,o]);var ne=Zc(o);return U.useEffect(function(){if(k.current){var e=rl(o,ne,[`paymentRequest`]);e&&`update`in k.current&&k.current.update(e)}},[o,ne]),U.useLayoutEffect(function(){return function(){if(k.current&&typeof k.current.destroy==`function`)try{k.current.destroy(),k.current=null}catch{}}},[]),U.createElement(`div`,{id:n,className:i,ref:A})};return i.propTypes={id:Fc.default.string,className:Fc.default.string,onChange:Fc.default.func,onBlur:Fc.default.func,onFocus:Fc.default.func,onReady:Fc.default.func,onEscape:Fc.default.func,onClick:Fc.default.func,onLoadError:Fc.default.func,onLoaderStart:Fc.default.func,onNetworksChange:Fc.default.func,onConfirm:Fc.default.func,onCancel:Fc.default.func,onShippingAddressChange:Fc.default.func,onShippingRateChange:Fc.default.func,onSavedPaymentMethodRemove:Fc.default.func,onSavedPaymentMethodUpdate:Fc.default.func,onAvailablePaymentMethodsChange:Fc.default.func,options:Fc.default.object},i.displayName=r,i.__elementType=e,i},yl=typeof window>`u`,bl=U.createContext(null);bl.displayName=`EmbeddedCheckoutProviderContext`;var xl=function(){return hl(`calls useStripe()`).stripe};vl(`auBankAccount`,yl),vl(`card`,yl),vl(`cardNumber`,yl),vl(`cardExpiry`,yl),vl(`cardCvc`,yl),vl(`currencySelector`,yl),vl(`iban`,yl);var Sl=vl(`payment`,yl);vl(`expressCheckout`,yl),vl(`paymentRequestButton`,yl),vl(`linkAuthentication`,yl),vl(`contactDetails`,yl);var Cl=vl(`address`,yl);vl(`shippingAddress`,yl),vl(`paymentMethodMessaging`,yl),vl(`taxId`,yl),vl(`issuingCardNumberDisplay`,yl),vl(`issuingCardCvcDisplay`,yl),vl(`issuingCardExpiryDisplay`,yl),vl(`issuingCardPinDisplay`,yl),vl(`issuingCardCopyButton`,yl);function wl({hasExistingBilling:e,onPaymentAdded:t,onSaveStateForBillingRedirect:n}){let{organizationId:r}=M({strict:!1}),i=xl(),a=jc(),o=fl(),[s,c]=(0,U.useState)(!1),l=kc(r),u=(0,U.useCallback)(()=>{t(!1)},[t]);return(0,H.jsxs)(`form`,{id:`billing-add-payment-method-form`,name:`billing-add-payment-method-form`,onSubmit:(0,U.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),B.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,H.jsx)(Sl,{}),(0,H.jsx)(Cl,{options:{mode:`billing`}}),(0,H.jsxs)(`div`,{className:`mt-4 flex gap-8 items-center`,children:[(0,H.jsxs)(_,{disabled:!i||!o||s,variant:`submit`,children:[(0,H.jsx)(Vr,{}),` Add Payment Method`]}),e&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{className:`text-xs text-gray-600`,children:`Your existing payment method will be overwritten.`}),(0,H.jsx)(_,{variant:`defaultOutline`,type:`button`,onClick:u,children:`Cancel`})]})]})]})}var Tl=`dahlia`,El=`https://js.stripe.com`,Dl=`${El}/${Tl}/stripe.js`,Ol=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,kl=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,Al=`loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used`,jl=function(e){return Ol.test(e)||kl.test(e)},Ml=function(){for(var e=document.querySelectorAll(`script[src^="${El}"]`),t=0;t<e.length;t++){var n=e[t];if(jl(n.src))return n}return null},Nl=function(e){var t=e&&!e.advancedFraudSignals?`?advancedFraudSignals=false`:``,n=document.createElement(`script`);n.src=`${Dl}${t}`;var r=document.head||document.body;if(!r)throw Error(`Expected document.body not to be null. Stripe.js requires a <body> element.`);return r.appendChild(n),n},Pl=null,Fl=null,Il=null,Ll=function(e){return function(t){e(Error(`Failed to load Stripe.js`,{cause:t}))}},Rl=function(e,t){return function(){window.Stripe?e(window.Stripe):t(Error(`Stripe.js not available`))}},zl=function(e){return Pl===null?(Pl=new Promise(function(t,n){if(typeof window>`u`||typeof document>`u`){t(null);return}if(window.Stripe&&e&&console.warn(Al),window.Stripe){t(window.Stripe);return}try{var r=Ml();if(r&&e)console.warn(Al);else if(!r)r=Nl(e);else if(r&&Il!==null&&Fl!==null){var i;r.removeEventListener(`load`,Il),r.removeEventListener(`error`,Fl),(i=r.parentNode)==null||i.removeChild(r),r=Nl(e)}Il=Rl(t,n),Fl=Ll(n),r.addEventListener(`load`,Il),r.addEventListener(`error`,Fl)}catch(e){n(e);return}}),Pl.catch(function(e){return Pl=null,Promise.reject(e)})):Pl},Bl,Vl=function(){return Bl||(Bl=zl(null).catch(function(e){return Bl=null,Promise.reject(e)}),Bl)};Promise.resolve().then(function(){return Vl()}).catch(function(e){console.warn(e)});async function Hl(e){let{data:t}=await c.post(`/StripeAccount/`,e);return t}function Ul(){return j({mutationFn:e=>Hl(e)})}async function Wl(e){let{data:t}=await c.post(`/Payment/`,{organizationId:e.organizationId});return t}function Gl(){return j({mutationFn:e=>Wl(e)})}function Kl(e){let{enabled:t,existingStripeId:n,organizationId:r}=e,{mutate:i}=Ul(),{mutate:a}=Gl(),[o,s]=(0,U.useState)(void 0);return(0,U.useEffect)(()=>{},[i,t,n,a,(0,U.useCallback)(e=>{s(e.clientSecret)},[]),r]),o}function ql({children:e}){let{organizationId:t}=M({strict:!1}),{data:n}=N(bc(t)),r=Kl({organizationId:t,enabled:!!n,existingStripeId:n?.stripeId}),i=vi();return(0,U.useMemo)(()=>({clientSecret:r||``,appearance:{theme:i===`dark`?`night`:`stripe`}}),[r,i]),console.error(`No VITE_PUBLIC_STRIPE_KEY is configured for this environment.`),(0,H.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 Jl({onPaymentAdded:e,onSaveStateForBillingRedirect:t}){let{organizationId:n}=M({strict:!1}),{data:r}=N(bc(n)),i=r?.billing,a=i?.paymentMethod;return(0,H.jsxs)(ql,{children:[(0,H.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,H.jsx)(wl,{hasExistingBilling:!!i,onSaveStateForBillingRedirect:t,onPaymentAdded:e})]})}var Yl=function(e){return e.PASS=`pass`,e.FAIL=`fail`,e.PENDING=`pending`,e.ERROR=`error`,e}({});function Xl(e){switch(e){case Yl.PASS:return`success`;case Yl.FAIL:case Yl.ERROR:return`destructive`;case Yl.PENDING:default:return`default`}}function Zl(e){switch(e){case Yl.PASS:return`READY`;case Yl.FAIL:case Yl.ERROR:case Yl.PENDING:default:return e.toUpperCase()}}function Ql(e,t){return`${String(e).padStart(2,`0`)}/${String(t%100).padStart(2,`0`)}`}function $l(e){let{onSaveStateForBillingRedirect:t,onReplacingPaymentMethod:n}=e??{},{organizationId:r}=M({strict:!1}),{update:i}=_s(r),{data:a,refetch:o}=N(bc(r)),s=a?.billing?.paymentMethod,[c,l]=(0,U.useState)(!1),u=(0,U.useCallback)(()=>{l(!c),n?.(!c)},[n,c]),d=(0,U.useCallback)(e=>{l(!1),n?.(!1),e&&o()},[n,o]);return a?.type===`ENTERPRISE`?(0,H.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,H.jsx)(Rs,{}),`, we would love to talk!`]}):s&&!c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mt-2`,children:[s.brand?.toUpperCase()??`Card`,` ending in `,s.last4??`••••`,s.expMonth&&s.expYear?(0,H.jsxs)(H.Fragment,{children:[`(exp `,Ql(s.expMonth,s.expYear),`)`]}):null,s.status?(0,H.jsxs)(H.Fragment,{children:[`—`,` `,(0,H.jsx)(Va,{variant:Xl(s.status),children:Zl(s.status)})]}):null]}),i&&(0,H.jsx)(`div`,{className:`mt-2 mb-6`,children:(0,H.jsx)(_,{variant:`defaultOutline`,type:`button`,onClick:u,children:`Replace Payment Method`})})]}):i?(0,H.jsx)(Jl,{onSaveStateForBillingRedirect:t,onPaymentAdded:d}):(0,H.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 eu({clusterId:e,isPending:t,onGoBackToDetails:n,onSaveStateForBillingRedirect:r,onSubmit:i,organizationId:a,selectedPlan:o}){let{data:s}=N(bc(a)),c=s?.billing,u=s?.type===xc,d=u||c?.paymentMethod?.status===Yl.PASS,[f,p]=(0,U.useState)(!1),m=Tc(o?.planLimits?.expirationMonths)&&o.planLimits.expirationMonths<1e3&&o.planLimits.expirationMonths,h=(0,H.jsx)(H.Fragment,{children:(0,H.jsxs)(`div`,{className:`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end mt-3 max-w-xl`,children:[(0,H.jsxs)(_,{type:`button`,variant:`defaultOutline`,disabled:t,onClick:n,children:[(0,H.jsx)(jn,{}),` Back to Details`]}),(0,H.jsxs)(_,{disabled:t||!d||f,type:`submit`,variant:`submit`,onClick:i,children:[e?`Edit Cluster`:`Create New Cluster`,` `,(0,H.jsx)(Mn,{})]})]})});if(u)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`ul`,{className:`list-disc ml-6 max-w-lg`,children:[(0,H.jsx)(`li`,{children:`Reminder: you will be billed at your contracted rate for any additional infrastructure.`}),(0,H.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,H.jsx)(Rs,{overEmail:!0}),`, we are here to help.`]})]}),h]});let g=m&&`, or ${l(m,`month`,`months`)} elapse`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`ul`,{className:`list-disc ml-6 mb-6`,children:[(0,H.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,H.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,H.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,H.jsxs)(`li`,{children:[`When that block is used up`,g,`, you will be automatically renewed.`]}),(0,H.jsx)(`li`,{children:`While refunds are not available, we’d be happy to assist you with troubleshooting.`}),(0,H.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,H.jsx)(Rs,{overEmail:!0}),`, we are here to help.`]})]}),(0,H.jsx)(`p`,{className:`text-muted-foreground text-sm mb-6`,children:`Payment method:`}),(0,H.jsx)($l,{onSaveStateForBillingRedirect:r,onReplacingPaymentMethod:p}),h]})}var tu=/(^$|^(?: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,nu=65535,ru=w().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.`),iu=S({clusterName:w().nonempty(`Please enter a cluster name.`).max(255,`Cluster name cannot be longer than 255 characters long.`),abbreviatedName:ie([k(``),te(),ru]).optional(),fqdn:w().regex(tu,`Please enter a valid host name without the port or any path.`).optional(),version:w().optional(),deploymentDescription:w().nonempty(`Please select a deployment tier.`),performanceDescription:w().nonempty(`Please select a performance tier.`),regionPlans:T(S({regionName:w().nonempty(`Please select a region.`),latencyDescription:w().nonempty(`Please select a latency tier.`)})).max(50,{error:`A maximum of 50 regions can be selected for each cluster. `}),instances:T(S({secure:ne([`true`,`false`]),fqdn:w().nonempty(`Please enter the host name of your instance.`).regex(tu,`Please enter a valid host name without the port or any path.`),port:ee().min(0,`Positive thinking only, please.`).max(nu,`That port number is too high.`).optional()})).max(100,{error:`A maximum of 100 instances can be added to each cluster.`}),skipToBilling:O().optional(),skipGtmWait:O().optional(),sourceClusterId:w().optional()});function au({calculatedNames:e,disabled:t,form:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(q,{control:n.control,name:`abbreviatedName`,render:({field:n})=>(0,H.jsxs)(J,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Host Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{...n,type:`text`,maxLength:ru.maxLength,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:e.suggestedAbbreviatedName,disabled:t})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(J,{className:`col-span-3 `,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Full Host Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(`span`,{children:e.fullHostName})}),(0,H.jsx)(X,{})]})]})}function ou({className:e}={}){return(0,H.jsx)(`div`,{className:(0,U.useMemo)(()=>b(`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 su({...e}){return(0,H.jsx)(Ut,{"data-slot":`select`,...e})}function cu({...e}){return(0,H.jsx)(Vt,{"data-slot":`select-group`,...e})}function lu({...e}){return(0,H.jsx)(Dt,{"data-slot":`select-value`,...e})}function uu({className:e,children:t,...n}){return(0,H.jsxs)(qe,{"data-slot":`select-trigger`,className:p(`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-white text-foreground dark:bg-grey-700 dark:text-white 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,H.jsx)(dt,{asChild:!0,children:(0,H.jsx)(mn,{className:`size-4 text-foreground dark:text-white`})})]})}function du({className:e,children:t,position:n=`popper`,...r}){return(0,H.jsx)(lt,{children:(0,H.jsxs)(Ge,{"data-slot":`select-content`,className:p(`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,H.jsx)(pu,{}),(0,H.jsx)(it,{className:p(`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,H.jsx)(mu,{})]})})}function fu({className:e,...t}){return(0,H.jsx)(at,{"data-slot":`select-label`,className:p(`px-2 py-1.5 text-sm font-medium`,e),...t})}function Q({className:e,children:t,...n}){return(0,H.jsxs)(pt,{"data-slot":`select-item`,className:p(`focus:bg-accent 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,H.jsx)(tt,{children:t}),(0,H.jsx)(`span`,{className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,H.jsx)(_t,{children:(0,H.jsx)(pn,{className:`size-4`})})})]})}function pu({className:e,...t}){return(0,H.jsx)(sn,{"data-slot":`select-scroll-up-button`,className:p(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(gn,{className:`size-4`})})}function mu({className:e,...t}){return(0,H.jsx)(bt,{"data-slot":`select-scroll-down-button`,className:p(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,H.jsx)(mn,{className:`size-4`})})}var hu={Colocated:`Shared infrastructure for optimized value`,Dedicated:`Dedicated infrastructure for consistent performance`,"Self-Hosted":`Your own infrastructure`};function gu({availableDeploymentTypes:e,disabled:t,form:n}){return(0,H.jsx)(q,{control:n.control,name:`deploymentDescription`,render:({field:r})=>(0,H.jsxs)(J,{className:`col-span-3`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Harper Deployment`}),(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(ou,{}),children:(0,H.jsx)(K,{children:(0,H.jsxs)(su,{...r,disabled:t,onValueChange:e=>{r.onChange(e),n.trigger()},children:[(0,H.jsx)(uu,{className:`w-full h-auto`,children:(0,H.jsx)(lu,{placeholder:`Choose Tier`})}),(0,H.jsx)(du,{children:(0,H.jsx)(cu,{children:e.map(e=>(0,H.jsxs)(Q,{value:e,children:[(0,H.jsx)(`dt`,{className:`text-left font-bold text-sm/6`,children:e}),hu[e]&&(0,H.jsx)(`dd`,{className:`font-light`,children:hu[e]})]},e))})})]})})}),(0,H.jsx)(X,{})]})})}function _u({disabled:e,form:t}){return(0,H.jsx)(q,{control:t.control,name:`fqdn`,render:({field:t})=>(0,H.jsxs)(J,{className:`md:col-span-6 col-span-3`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Optional Cluster Load Balancer Host Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{...t,type:`text`,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:`example.your-company.com`,disabled:e})}),(0,H.jsx)(X,{})]})})}function vu({className:e,disabled:t,form:n}){return(0,H.jsx)(q,{control:n.control,name:`clusterName`,render:({field:n})=>(0,H.jsxs)(J,{className:e,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Cluster Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{autoFocus:!0,type:`text`,maxLength:iu.shape.clusterName.maxLength,autoCapitalize:`words`,disabled:t,...n})}),(0,H.jsx)(X,{})]})})}function yu({availablePerformanceDescriptions:e,form:t,selectedDeployment:n}){return(0,H.jsx)(q,{control:t.control,name:`performanceDescription`,render:({field:r})=>(0,H.jsxs)(J,{className:`col-span-3`,children:[(0,H.jsxs)(Y,{className:`pb-1`,children:[n.startsWith(`Self`)?`Support`:`Performance`,` & Usage`]}),(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(ou,{}),children:(0,H.jsx)(K,{children:(0,H.jsxs)(su,{...r,onValueChange:e=>{r.onChange(e),t.trigger()},disabled:!e?.length,children:[(0,H.jsx)(uu,{className:`w-full h-auto`,children:(0,H.jsx)(lu,{placeholder:`Choose Tier`})}),(0,H.jsx)(du,{children:(0,H.jsx)(cu,{children:e.map(e=>(0,H.jsxs)(Q,{value:e.performanceTier,children:[(0,H.jsxs)(`dt`,{className:`text-left font-bold text-sm/6 flex items-center gap-2`,children:[e.name,e.isPremium&&(0,H.jsx)(Va,{children:`Premium`})]}),e.description&&(0,H.jsx)(`dd`,{className:`text-left font-light`,children:e.description})]},e.name))})})]})})}),(0,H.jsx)(X,{})]})})}function bu({className:e,...t}){let{formDescriptionId:n}=pa();return(0,H.jsx)(`p`,{"data-slot":`form-description`,id:n,className:p(`text-muted-foreground text-sm`,e),...t})}function xu({className:e,form:t}){return(0,H.jsx)(q,{control:t.control,name:`skipGtmWait`,render:({field:t})=>(0,H.jsxs)(J,{className:e,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-4 h-4 cursor-pointer`,checked:t.value||!1,onChange:t.onChange,onBlur:t.onBlur,name:t.name,ref:t.ref})}),(0,H.jsx)(Y,{className:`cursor-pointer`,children:`Immediate upgrade and restart`})]}),(0,H.jsx)(bu,{children:`Apply changes immediately without waiting for each instance to be taken out of the load balancer (faster, but potentially less safe).`})]})})}function Su({className:e,disabled:t,form:n,harperVersions:r}){return r?.value?.length?(0,H.jsx)(q,{control:n.control,name:`version`,render:({field:i})=>(0,H.jsxs)(J,{className:e,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Harper Version`}),(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(ou,{}),children:(0,H.jsx)(K,{children:(0,H.jsxs)(su,{...i,disabled:t,onValueChange:e=>{i.onChange(e),n.trigger()},children:[(0,H.jsx)(uu,{className:`w-full h-auto`,children:(0,H.jsx)(lu,{placeholder:`Choose Version`})}),(0,H.jsx)(du,{children:(0,H.jsx)(cu,{children:r?.value.map(e=>(0,H.jsxs)(Q,{value:e.version,children:[e.version,` `,(0,H.jsx)(`span`,{className:`font-light opacity-50`,children:e.name})]},e.version))})})]})})}),(0,H.jsx)(X,{})]})}):null}var Cu=new RegExp(/^\d+/);function wu(e,t){let n=parseInt(e.match(Cu)?.[0]||`0`,10),r=parseInt(t.match(Cu)?.[0]||`0`,10);return n===r?0:n>r?1:-1}var Tu=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],Eu=[`secs`,`mins`,`hrs`],Du={bytes:1e3,secs:60};function Ou(e,t,n){let r,i;switch(t){case`bytes`:r=Tu,i=Du.bytes;break;case`secs`:r=Eu,i=Du.secs;break;default:return e}let a=r.indexOf(n);return a===-1?e:e/i**a}function ku(e,t){let n,r;switch(e){case`bytes`:n=Tu,r=Du.bytes;break;case`secs`:n=Eu,r=Du.secs;break;default:return e}let i=0;for(;t>=r&&i<n.length-1;)t/=r,i++;return n[i]}function Au(e,t=1){let n=e*t,r=ku(`bytes`,n),i=Ou(n,`bytes`,r);return`${new Intl.NumberFormat().format(Math.round(i))} ${r}`}function ju(e){return new Intl.NumberFormat().format(e)}var Mu=[`K`,`M`,`B`,`T`,`Qa`,`Qi`,`Sx`,`Sp`,`Oc`,`No`,`Dc`];function Nu(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<Mu.length-1);return`${ju(Math.round(n))} ${Mu[r]}`}function Pu(e,t){let n=Object.values(t).flatMap(e=>Object.values(e)).map(e=>e.purchasedBlockMultiplier??1),r=Math.max(...n,1),i=Math.min(...n,r),a=t=>{let n=e.map(t).filter(e=>typeof e==`number`&&e>0);return n.length?{min:Math.min(...n),max:Math.max(...n)}:{min:0,max:0}},o=a(e=>e.planLimits?.readsPerMinuteCount),s=a(e=>e.planLimits?.totalReadCount);return{readRate:{min:o.min*i,max:o.max*r},totalReads:{min:s.min*i,max:s.max*r},writeRate:a(e=>e.planLimits?.writesPerMinuteCount),totalWrites:a(e=>e.planLimits?.totalWriteCount)}}function Fu(e,{min:t,max:n}){if(e<=0)return 0;let r=Math.max(Math.min(t,e),1),i=Math.max(n,e);if(i<=r)return 1;let a=(Math.log(e)-Math.log(r))/(Math.log(i)-Math.log(r));return Math.min(Math.max(a,0),1)}function Iu({selectedPlan:e,selectedRegion:t,usageScale:n,isEnterprise:r,cloudProvider:i}){let[a,o]=(0,U.useState)(!1),s=(0,U.useCallback)(()=>{o(!a)},[a,o]),c=e?.planLimits,u=e?.resourcesPerInstance,d=i&&e?.cloudInstanceTypes?.[i],f=Tc(c?.expirationMonths)&&c.expirationMonths<1e3&&c.expirationMonths,m=t?.purchasedBlockMultiplier??1,h=(0,U.useMemo)(()=>c?[Tc(c.totalReadCount)&&{label:`Total Reads`,value:Nu(c.totalReadCount*m)},Tc(c.totalReadsBytes)&&{label:`Total Read Transfer`,value:`${Au(c.totalReadsBytes*m)}`},Tc(c.readsPerMinuteCount)&&{label:`Read Rate`,value:`${Nu(c.readsPerMinuteCount*60*m)}/hr`},Tc(c.readsPerMinuteBytes)&&{label:`Read Bandwidth`,value:`${Au(c.readsPerMinuteBytes*60*m)}/hr`},Tc(c.totalWriteCount)&&{label:`Total Writes`,value:Nu(c.totalWriteCount)},Tc(c.totalWritesBytes)&&{label:`Total Write Transfer`,value:`${Au(c.totalWritesBytes)}`},Tc(c.writesPerMinuteCount)&&{label:`Write Rate`,value:`${Nu(c.writesPerMinuteCount*60)}/hr`},Tc(c.writesPerMinuteBytes)&&{label:`Write Bandwidth`,value:`${Au(c.writesPerMinuteBytes*60)}/hr`},Tc(c.totalRealTimeMessageDeliveries)&&{label:`Total Real-Time Messages`,value:`${Nu(c.totalRealTimeMessageDeliveries*m)} messages`},Tc(c.totalRealTimeMessageDeliveryBytes)&&{label:`Total Real-Time Message Transfer`,value:`${Au(c.totalRealTimeMessageDeliveryBytes*m)}`},Tc(c.realTimeMessageDeliveriesPerMinute)&&{label:`Real-Time Message Rate`,value:`${Nu(c.realTimeMessageDeliveriesPerMinute*60*m)}/hr`},Tc(c.realTimeMessageDeliveryBytesPerMinute)&&{label:`Real-Time Message Bandwidth`,value:`${Au(c.realTimeMessageDeliveryBytesPerMinute*60*m)}/hr`},Tc(c.tlsHandshakes)&&{label:`TLS Handshakes`,value:`${Nu(c.tlsHandshakes*60*m)}`},Tc(c.applicationComputeHours)&&{label:`Application Compute Hours`,value:`${Nu(c.applicationComputeHours*m)}`},!!u&&Tc(u.storageGb)&&{label:`Storage`,value:`${Au(u.storageGb*1e9)}`},!!u&&Tc(u.cpuCores)&&{label:`Maximum CPU Cores`,value:`${Nu(u.cpuCores)}`},!!u&&Tc(u.memoryMb)&&{label:`Memory`,value:`${u.memoryMb/1024} GB`},!!d&&{label:`Cloud Instance Type`,value:d},!!f&&{label:`Expiration`,value:l(f,`month`,`months`)},!!t?.id&&{label:`Region ID`,value:t.id},!!e?.id&&{label:`Plan ID`,value:e.id}].filter(di):[],[f,t,e,m]);if(!c)return``;if(!Tc(c.totalReadCount))return`This plan has no usage limits.`;let g=r?`for the contracted rate`:`for the price listed above`,v=f?` in ${l(f,`month`,`months`)} or`:``,y=Tc(c.readsPerMinuteCount)?c.readsPerMinuteCount*m:0,b=Tc(c.writesPerMinuteCount)?c.writesPerMinuteCount:0,x=c.totalReadCount*m,S=Tc(c.totalWriteCount)?c.totalWriteCount:0,C=[y>0&&{icon:fr,label:`Read Rate`,value:`${Nu(y)}/min`,fill:Fu(y,n.readRate)},x>0&&{icon:Pn,label:`Total Reads`,value:Nu(x),fill:Fu(x,n.totalReads)},b>0&&{icon:fr,label:`Write Rate`,value:`${Nu(b)}/min`,fill:Fu(b,n.writeRate)},S>0&&{icon:kn,label:`Total Writes`,value:Nu(S),fill:Fu(S,n.totalWrites)},!!f&&{icon:Bn,label:`License Term`,value:l(f,`month`,`months`)}].filter(di);return(0,H.jsxs)(J,{className:`basis-full`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-2`,children:[(0,H.jsx)(Y,{onClick:s,className:`cursor-pointer`,children:`Usage block included with this plan`}),(0,H.jsxs)(_,{type:`button`,variant:`link`,className:`text-foreground`,onClick:s,children:[`Learn More `,a?(0,H.jsx)(An,{}):(0,H.jsx)(Mn,{})]})]}),(0,H.jsx)(`div`,{className:`grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5`,children:C.map(e=>(0,H.jsx)(Lu,{icon:e.icon,label:e.label,value:e.value,fill:e.fill},e.label))}),(0,H.jsx)(K,{children:(0,H.jsxs)(`dl`,{className:p(`divide-y divide-border rounded-md overflow-hidden transition-[max-height] duration-200 ease-in`,a?`max-h-fit border border-border`:`max-h-0`),children:[(0,H.jsxs)(`div`,{className:`text-sm px-4 py-5 leading-relaxed text-muted-foreground`,children:[`This plan licenses Harper for the usage limits below, `,g,`. The usage license expires`,v,` `,`when any usage limit is reached. New usage blocks are automatically purchased/billed as blocks are consumed.`]}),h.map((e,t)=>(0,H.jsxs)(`div`,{className:p(`px-4 py-1 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-3`,t%2==0&&`bg-muted dark:bg-grey-700`),children:[(0,H.jsx)(`dt`,{className:`text-sm/6 font-medium text-foreground`,children:e.label}),(0,H.jsx)(`dd`,{className:`mt-1 text-sm/6 text-muted-foreground sm:col-span-2 sm:mt-0`,children:e.value})]},e.label))]})}),(0,H.jsx)(X,{})]})}function Lu({icon:e,label:t,value:n,fill:r}){return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border border-border bg-background/50 p-3`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground`,children:[(0,H.jsx)(e,{className:`size-4 shrink-0`}),(0,H.jsx)(`span`,{className:`text-xs font-medium`,children:t})]}),(0,H.jsx)(`span`,{className:`text-lg font-bold text-foreground tabular-nums`,children:n}),r!==void 0&&(0,H.jsx)(`div`,{className:`h-1.5 w-full overflow-hidden rounded-full bg-sky-500/15`,children:(0,H.jsx)(`div`,{className:`h-full rounded-full bg-sky-500 transition-[width] duration-300`,style:{width:`${Math.max(Math.min(r,1)*100,4)}%`}})})]})}function Ru({control:e,fieldArray:t,form:n,index:r,regionNameToLatencyToRegion:i,premiumOnlyRegions:a,usageScale:o,selectedPlan:s,isEnterprise:c,cloudProvider:l}){let u=(0,U.useMemo)(()=>Object.keys(i).sort(),[i]),d=n.watch(`deploymentDescription`)?.startsWith(`Dedicated`),f=n.watch(`regionPlans.${r}.regionName`),p=n.watch(`regionPlans.${r}.latencyDescription`),m=(0,U.useMemo)(()=>Object.keys(i[f]||{}).sort(wu).reverse(),[i,f]),h=s?.allowedRegionIds,g=(0,U.useCallback)(e=>!h?.length||Object.values(i[e]||{}).some(e=>h.includes(e.id)),[h,i]),v=(0,U.useCallback)(e=>{if(!h?.length)return!0;let t=i[f]?.[e]?.id;return!t||h.includes(t)},[h,i,f]);(0,U.useEffect)(function(){if(f&&m?.length&&!m?.includes(p)){let e=p?.split(` `)[0].toLowerCase(),t=m.find(t=>!e||t.split(` `)[0].toLowerCase()===e)||m[0];n.setValue(`regionPlans.${r}.latencyDescription`,t),n.trigger()}},[m,n,r,p,f]);let y=(0,U.useCallback)(()=>{t?.remove(r),n.trigger()},[t,n,r]);return(0,H.jsxs)(`div`,{className:`md:col-span-6 col-span-3 py-2 pl-4 border-l-4 border-border gap-6 flex flex-wrap items-start`,children:[(0,H.jsx)(q,{control:e,name:`regionPlans.${r}.regionName`,render:({field:e})=>(0,H.jsxs)(J,{className:`flex-1`,children:[(0,H.jsxs)(Y,{className:`flex items-center gap-1.5`,children:[(0,H.jsx)(kr,{className:`size-4 shrink-0`}),`Region `,t.fields.length>1?r+1:``]}),(0,H.jsx)(K,{children:(0,H.jsxs)(su,{onValueChange:t=>{e.onChange(t),n.trigger()},...e,children:[(0,H.jsx)(uu,{className:`w-full`,children:(0,H.jsx)(lu,{placeholder:`Choose Region`})}),(0,H.jsx)(du,{children:(0,H.jsx)(cu,{children:u.map(e=>(0,H.jsx)(Q,{value:e,disabled:!g(e),children:(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e,a.regionNames.has(e)&&(0,H.jsx)(Va,{children:`Premium`})]})},e))})})]})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:e,name:`regionPlans.${r}.latencyDescription`,render:({field:e})=>(0,H.jsxs)(J,{className:`flex-1`,children:[(0,H.jsxs)(Y,{children:[`Estimated `,d?`P95`:`P90`,` Latency, Distribution`]}),(0,H.jsx)(K,{children:(0,H.jsxs)(su,{onValueChange:t=>{e.onChange(t),n.trigger()},...e,disabled:!m?.length,children:[(0,H.jsx)(uu,{className:`w-full`,children:(0,H.jsx)(lu,{placeholder:`Choose Latency Tier`})}),(0,H.jsx)(du,{children:(0,H.jsx)(cu,{children:m.map(e=>(0,H.jsx)(Q,{value:e,disabled:!v(e),children:(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[e,(()=>{let t=i[f]?.[e]?.id;return t&&a.regionIds.has(t)&&(0,H.jsx)(Va,{children:`Premium`})})()]})},e))})})]})}),(0,H.jsx)(X,{})]})}),t?.fields?.length&&t?.fields?.length>1&&(0,H.jsx)(`div`,{className:`flex-none mt-6`,children:(0,H.jsxs)(_,{type:`button`,variant:`destructiveOutline`,size:`sm`,onClick:y,children:[(0,H.jsx)(ri,{}),` `,(0,H.jsx)(`span`,{className:`sr-only`,children:`Remove`})]})}),(0,H.jsx)(Iu,{selectedPlan:s,selectedRegion:i[f]?.[p],usageScale:o,isEnterprise:c,cloudProvider:l})]})}function zu({form:e,regionLocations:t,regionNameToLatencyToRegion:n,premiumOnlyRegions:r,usageScale:i,selectedPlan:a,totalPrice:o,isEnterprise:s,cloudProvider:c}){let l=e.watch(`regionPlans`),u=Xe({control:e.control,name:`regionPlans`}),d=(0,U.useMemo)(()=>{let e=l.map(e=>n?.[e.regionName]?.[e.latencyDescription]?.region);return o?t?.find(t=>!e.includes(t.region)):null},[t,n,l,o]),f=(0,U.useCallback)(()=>{d&&(u.append({regionName:d.region,latencyDescription:d.latencyDescription}),e.trigger())},[e,d,u]);return t?.length?(0,H.jsxs)(H.Fragment,{children:[u.fields.map((t,o)=>(0,H.jsx)(Ru,{control:e.control,fieldArray:u,form:e,index:o,regionNameToLatencyToRegion:n,premiumOnlyRegions:r,usageScale:i,selectedPlan:a,isEnterprise:s,cloudProvider:c},t.id)),d&&(0,H.jsx)(`div`,{className:`md:col-span-6 col-span-3`,children:(0,H.jsxs)(_,{type:`button`,variant:`positiveOutline`,onClick:f,children:[(0,H.jsx)(Rr,{}),`Add Additional Region Usage`]})})]}):(0,H.jsx)(`div`,{className:`md:col-span-6 col-span-3`,children:(0,H.jsx)(ci,{className:`mt-0 m-0`,title:`No Regions Available`,showReturnToHome:!1,error:{message:(0,H.jsxs)(H.Fragment,{children:[`The deployment type you selected currently has no available regions. Please try a different deployment type, try again later, or `,(0,H.jsx)(Rs,{}),`.`]})}})})}function Bu({control:e,fieldArray:t,form:n,index:r}){let i=(0,U.useCallback)(()=>{t?.remove(r)},[t,r]);return(0,H.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,H.jsx)(q,{control:e,name:`instances.${r}.secure`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsxs)(Y,{children:[`Instance `,t.fields.length>1?r+1:``]}),(0,H.jsx)(K,{children:(0,H.jsxs)(su,{...e,onValueChange:t=>{e.onChange(t),n.trigger()},children:[(0,H.jsx)(uu,{className:`w-full`,children:(0,H.jsx)(lu,{placeholder:`https://`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(Q,{value:`true`,children:`https://`}),(0,H.jsx)(Q,{value:`false`,children:`http://`})]})})]})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:e,name:`instances.${r}.fqdn`,render:({field:e})=>(0,H.jsxs)(J,{className:`flex-3`,children:[(0,H.jsx)(Y,{children:`Host Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{...e,type:`text`,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,onChange:t=>{e.onChange(t);let i=t.target.value,a=i===`localhost`||i===`127.0.0.1`,o=n.getFieldState(`instances.${r}.secure`);a&&!o.isDirty&&n.setValue(`instances.${r}.secure`,`false`)}})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:e,name:`instances.${r}.port`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Operations API Port`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{...e,type:`number`,min:0,max:nu,autoCapitalize:`none`,autoComplete:`off`,autoCorrect:`off`,placeholder:String(y),onChange:t=>{e.onChange(t.target.value?parseInt(t.target.value,10):void 0),n.trigger()}})}),(0,H.jsx)(X,{})]})}),t?.fields?.length&&t?.fields?.length>1&&(0,H.jsx)(`div`,{className:`flex-none mt-6`,children:(0,H.jsxs)(_,{type:`button`,variant:`destructiveOutline`,size:`sm`,onClick:i,children:[(0,H.jsx)(ri,{}),` `,(0,H.jsx)(`span`,{className:`sr-only`,children:`Remove`})]})})]})}function Vu({form:e}){let t=Xe({control:e.control,name:`instances`}),n=(0,U.useCallback)(()=>{t.append({secure:`true`,fqdn:``,port:y})},[t]);return(0,H.jsxs)(H.Fragment,{children:[t.fields.map((n,r)=>(0,H.jsx)(Bu,{control:e.control,fieldArray:t,form:e,index:r},n.id)),(0,H.jsx)(`div`,{className:`md:col-span-6 col-span-3`,children:(0,H.jsxs)(_,{type:`button`,variant:`positiveOutline`,onClick:n,children:[(0,H.jsx)(Rr,{}),`Add Instance`]})})]})}function Hu(e,t){return!e.allowedRegionIds?.length||e.allowedRegionIds.includes(t)}function Uu(e,t){let n=new Set,r=new Set;if(!e.length)return{regionNames:n,regionIds:r};let i=Math.min(...e.map(e=>e.planLevel??0)),a=e.filter(e=>(e.planLevel??0)===i),o=e.filter(e=>(e.planLevel??0)>i);if(!o.length)return{regionNames:n,regionIds:r};for(let[e,i]of Object.entries(t)){let t=!1,s=!0;for(let e of Object.values(i)){let n=a.some(t=>Hu(t,e.id)),i=o.some(t=>Hu(t,e.id));!n&&!i||(t=!0,n?s=!1:r.add(e.id))}t&&s&&n.add(e)}return{regionNames:n,regionIds:r}}function Wu({calculatedNames:e,clusterId:t,deploymentToPerformanceToPlan:n,form:r,harperVersions:i,isEnterprise:a,cloudProvider:o,isPending:s,mode:c,partialUpgrade:l,regionLocations:u,regionNameToLatencyToRegion:d,selectedDeployment:f,selectedPerformance:p,selectedPlan:m,totalPrice:h}){let{isDirty:g,isValid:v}=et(),y=(0,U.useMemo)(()=>{let e=n[f]||{},t=Object.values(e).map(e=>e.planLevel??0),r=t.length?Math.min(...t):0;return Object.keys(e).map(t=>{let n=(e[t].planLevel??0)>r,i=t.slice(0,-1).split(`(`);if(i.length>1)return{performanceTier:t,name:i[0],description:i[1],isPremium:n};let a=t.split(` for `);return a.length>1?{performanceTier:t,name:a[0],description:`For `+a[1],isPremium:n}:{performanceTier:t,name:t,description:``,isPremium:n}})},[n,f]),b=(0,U.useMemo)(()=>Object.keys(n).sort(),[n]),x=(0,U.useMemo)(()=>Uu(Object.values(n[f]||{}),d),[n,d,f]),S=(0,U.useMemo)(()=>Pu(Object.values(n).flatMap(e=>Object.values(e)),d),[n,d]);(0,U.useEffect)(function(){y?.length&&!y.find(e=>e.performanceTier===p)&&(r.setValue(`performanceDescription`,y[0].performanceTier),r.trigger())},[f,p,y,r]);let C=f===`Self-Hosted`,w=(0,H.jsx)(Go,{className:`mt-3 mb-12`,children:(0,H.jsxs)(_,{type:`submit`,variant:`submit`,disabled:s||t&&!g&&!(c===`version`&&l)||!v,children:[c!==`version`&&h>0?`Confirm Payment Details`:t?`Edit Cluster`:`Create New Cluster`,(0,H.jsx)(Mn,{})]})});return c===`version`?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-3 items-start gap-6 text-foreground md:grid-cols-6`,children:[(0,H.jsx)(vu,{className:i?.value?.length?`col-span-3`:`md:col-span-6 col-span-3`,disabled:!0,form:r}),(0,H.jsx)(Su,{className:`col-span-3`,form:r,harperVersions:i}),(0,H.jsx)(xu,{className:`col-span-3 md:col-span-6`,form:r}),l&&(0,H.jsxs)(`p`,{className:`col-span-3 md:col-span-6 max-w-prose text-xs font-light text-amber-600 dark:text-amber-400`,children:[l.behindCount,` of `,l.total,` instances`,` `,l.behindCount===1?`is`:`are`,` still on an older version. Re-run the upgrade to bring`,` `,l.behindCount===1?`it`:`them`,` up to `,l.latest,`.`]})]}),w]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-3 items-start gap-6 text-foreground md:grid-cols-6`,children:[(0,H.jsx)(vu,{className:i?.value?.length?`col-span-3`:`md:col-span-6 col-span-3`,disabled:!!t,form:r}),(0,H.jsx)(Su,{className:`col-span-3`,disabled:!!t,form:r,harperVersions:i}),C?(0,H.jsx)(_u,{form:r,disabled:!!t}):(0,H.jsx)(au,{form:r,calculatedNames:e,disabled:!!t}),(0,H.jsx)(gu,{form:r,availableDeploymentTypes:b}),(0,H.jsx)(yu,{availablePerformanceDescriptions:y,form:r,selectedDeployment:f}),C?(0,H.jsx)(Vu,{form:r}):(0,H.jsx)(zu,{form:r,regionLocations:u,regionNameToLatencyToRegion:d,premiumOnlyRegions:x,usageScale:S,selectedPlan:m,totalPrice:h,isEnterprise:a,cloudProvider:o}),t&&!C&&(0,H.jsx)(xu,{className:`col-span-3 md:col-span-6`,form:r})]}),w]})}function Gu(e){let{fqdn:t}=e,{secure:n,port:r}=e;return r||=y,r===443&&n===`false`&&(n=`true`),r===80&&n===`true`&&(n=`false`),`${n===`true`?`https`:`http`}://${t}${r===443||r===80?``:`:`+r}`.toLowerCase()}function Ku(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 qu(e,t,n){if(t&&n){let r=e.getValues();if(!r.deploymentDescription||!r.performanceDescription||!r.regionPlans.length){let i=Ku(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 Ju({price:e}){return(0,H.jsx)(`span`,{className:`text-4xl`,children:new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).formatToParts(e||0).map((e,t)=>(0,H.jsx)(Yu,{type:e.type,value:e.value},t))})}function Yu({type:e,value:t}){switch(e){case`currency`:case`decimal`:case`fraction`:return(0,H.jsx)(`sup`,{className:`font-light text-xl`,children:t});default:return t}}function Xu({alreadyUsingFree:e,clusterId:t,defaultValues:n,deploymentToPerformanceToPlan:r,harperVersions:i,mode:a,organization:o,organizationId:s,partialUpgrade:c,planTypes:u,regionLocationsColocated:d,regionLocationsDedicated:f,setSavedClusterState:p,startOffOnBilling:m}){let h=L(),g=se(),_=o?.type===xc,v=o?.channel===`Akamai`?`linode`:void 0,x=le(),{mutate:S,isPending:C}=hc(),{mutate:w,isPending:T}=_c(),[E,ee]=(0,U.useState)(m),D=(0,U.useMemo)(()=>ac(d?.sort($s(`latencyDescription`))||[],`region`,`latencyDescription`),[d]),O=(0,U.useMemo)(()=>ac(f?.sort($s(`latencyDescription`))||[],`region`,`latencyDescription`),[f]),k=(0,U.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=Gu(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`?O:D;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!`}):Cc(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,D,O,r]),A=R({mode:`onChange`,resolver:z(iu.superRefine(k)),defaultValues:n}),[te,ne]=(0,U.useState)(!0);(0,U.useEffect)(()=>{te&&n&&(p(null),ne(!1))},[n,te,p]);let re=A.watch(`clusterName`),ie=A.watch(`abbreviatedName`),j=A.watch(`deploymentDescription`),ae=A.watch(`performanceDescription`),M=A.watch(`regionPlans`),oe=A.watch(`instances`),ce=j===`Dedicated`?O:D,ue=j===`Dedicated`?f:d;(0,U.useEffect)(function(){let e=A.getValues();j&&(j===`Self-Hosted`?(e.abbreviatedName&&A.setValue(`abbreviatedName`,``),e.regionPlans.length&&A.setValue(`regionPlans`,[]),e.instances.length||A.setValue(`instances`,[{secure:`true`,fqdn:``,port:y}])):(e.fqdn&&A.setValue(`fqdn`,``),e.instances.length&&A.setValue(`instances`,[]),e.regionPlans.length||qu(A,u,ue)))},[A,u,ue,j]);let N=(0,U.useMemo)(()=>{let e=Sc(wc(re),ru.maxLength);return{suggestedAbbreviatedName:e,fullHostName:`${ie||e}.${o.subdomain||`your-org`}.harperfabric.com`}},[re,ie,o]),de=(0,U.useMemo)(()=>r?.[j]?.[ae],[r,j,ae]);(0,U.useEffect)(function(){let e=de?.allowedRegionIds;if(e?.length&&M?.length===1){let t=M[0],n=ce?.[t.regionName]?.[t.latencyDescription];if(!e.includes(n?.id)){let t=ue?.filter(t=>e.includes(t.id)),n=t?.find(e=>e.region===`US`)||t?.[0];n&&(A.setValue(`regionPlans.0.regionName`,n.region),A.setValue(`regionPlans.0.latencyDescription`,n.latencyDescription),A.trigger())}}},[de,M,A,ce,ue]),(0,U.useEffect)(function(){if(j!==`Self-Hosted`&&Object.keys(ce).length&&M.length)for(let e=0;e<M.length;e++){let t=M[e];ce[t.regionName]||A.setValue(`regionPlans.${e}.regionName`,``)}},[A,ce,j,M]);let fe=de?.priceUsd?j===`Self-Hosted`?oe.length*de.priceUsd:M.reduce((e,t)=>{let n=ce?.[t.regionName]?.[t.latencyDescription];return e+(n?de.priceUsd*n.instanceCount/2:0)},0):0,pe=de?.planLimits?.expirationMonths,P=Tc(pe)&&pe<1e3?pe:void 0,me=P?fe/P:fe,he=(0,U.useCallback)(({creating:e,deploymentDescription:t})=>B.message(e?`Creating Cluster`:`Updating Cluster`,{description:(0,H.jsx)(pc,{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:0}),[]),ge=(0,U.useCallback)(async({clusterId:e,sourceClusterId:t,creating:n,toastId:r,isSelfManaged:i,skipGtmWait:a})=>{if(t){let e=(await yc(s)).clusters?.find(e=>e.id===t);wo(e?.status)&&await js(t)}x.invalidateQueries({queryKey:[s],refetchType:`active`}),n||Ec(x,e,{refetchType:`active`}),g.invalidate(),h(i?{to:`/${s}/${e}/instances`}:n?{to:`/${s}/${e}/starting-up`}:{to:`/${s}/${e}/scaling`,search:a?{immediate:!0}:void 0}),A.reset(),B.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})},[x,g,h,s,A]),_e=(0,U.useCallback)(async()=>{let e=A.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=ce[t.regionName][t.latencyDescription];n.push({autoRenew:!0,planId:i.id,regionId:e.id})}p(null);let c=he({creating:!t,deploymentDescription:e.deploymentDescription}),l=()=>B.dismiss(c);t?w(a===`version`?{id:t,version:e.version,skipGtmWait:e.skipGtmWait}:{id:t,regionPlans:n,skipGtmWait:e.skipGtmWait},{onSuccess:t=>ge({clusterId:t.id,sourceClusterId:e.sourceClusterId,isSelfManaged:o,creating:!1,toastId:c,skipGtmWait:e.skipGtmWait}),onError:l}):S({abbreviatedName:o?void 0:e.abbreviatedName||N.suggestedAbbreviatedName,autoRenew:!0,fqdn:o&&e.fqdn||void 0,name:e.clusterName,version:e.version,organizationId:s,regionPlans:n},{onSuccess:t=>ge({clusterId:t.id,sourceClusterId:e.sourceClusterId,isSelfManaged:o,creating:!0,toastId:c}),onError:l})},[N.suggestedAbbreviatedName,t,r,A,ge,he,s,ce,p,w,S]),ve=(0,U.useCallback)(()=>{if(a!==`version`&&fe>0){ee(!0);return}return _e()},[a,_e,fe]),ye=(0,U.useCallback)(e=>{p(e?{clusterId:t,...A.getValues(),skipToBilling:!0}:null)},[t,A,p]),be=(0,U.useCallback)(()=>{ee(!1)},[]),F=!_&&`mr-37.5`;return(0,H.jsxs)(H.Fragment,{children:[!_&&a!==`version`&&(0,H.jsxs)(`div`,{className:`absolute top-3 right-4 md:right-12 flex flex-col items-end text-right`,children:[(0,H.jsx)(`dt`,{className:`font-light`,children:P?`Monthly Price`:`Total Price`}),(0,H.jsx)(`dd`,{className:`font-bold`,children:fe>0?(0,H.jsxs)(`span`,{className:`inline-flex items-baseline`,children:[(0,H.jsx)(Ju,{price:me}),!!P&&(0,H.jsxs)(`span`,{className:`font-light text-base text-muted-foreground`,children:[`/mo`,P>1&&(0,H.jsx)(`sup`,{children:`*`})]})]}):(0,H.jsx)(`span`,{className:`text-4xl text-green`,children:`Free`})})]}),(0,H.jsx)(G,{...A,children:E?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h1`,{className:b(`text-lg leading-none text-foreground font-semibold mb-4`,F),children:`Cluster Billing`}),(0,H.jsx)(`p`,{className:b(`text-muted-foreground text-sm mb-2`,F),children:`Please confirm the following billing details:`}),(0,H.jsx)(eu,{clusterId:t,isPending:C||T,onGoBackToDetails:be,onSaveStateForBillingRedirect:ye,onSubmit:_e,organizationId:s,selectedPlan:de})]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h1`,{className:b(`text-lg leading-none text-foreground font-semibold mb-4`,F),children:`Cluster Configuration`}),(0,H.jsxs)(`div`,{className:b(`mb-6 flex flex-col items-start gap-2`,F),children:[(0,H.jsx)(`p`,{className:`sr-only`,children:`Configure your Harper cluster and define deployment plans.`}),!_&&a!==`version`&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Va,{variant:`warning`,children:`Beta pricing subject to change.`}),!!P&&P>1&&fe>0&&(0,H.jsxs)(`p`,{className:`max-w-prose text-xs font-light text-muted-foreground`,children:[`* Billed as`,` `,new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(fe),` `,`every`,` `,l(P,`month`,`months`),`, or sooner if you reach a usage limit — then a new license is issued.`]})]})]}),(0,H.jsx)(`form`,{id:`cluster-upsert-form`,name:`cluster-upsert-form`,onSubmit:A.handleSubmit(ve),children:(0,H.jsx)(Wu,{calculatedNames:N,clusterId:t,deploymentToPerformanceToPlan:r,form:A,isPending:C||T,harperVersions:i,mode:a,partialUpgrade:c,regionLocations:ue,regionNameToLatencyToRegion:ce,selectedDeployment:j,selectedPerformance:ae,selectedPlan:de,totalPrice:fe,isEnterprise:_,cloudProvider:v})})]})})]})}function Zu(e){return e?.clusterName!==void 0}function Qu(e){let t=e.filter(e=>!!e&&!(e.status!=null&&ga.includes(e.status))).map(e=>e.version).filter(e=>!!e);if(t.length<2)return null;let n=t.reduce((e,t)=>sc(t,e)>0?t:e),r=t.filter(e=>e!==n).length;return r>0?{latest:n,behindCount:r,total:t.length}:null}function $u({isEdit:e,className:t,children:n}){return e?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(Ks,{children:(0,H.jsx)(`div`,{className:t,children:n})})]}):(0,H.jsx)(Bs,{className:t,children:n})}function ed(){let{organizationId:e,clusterId:t,mode:n}=M({strict:!1}),{create:r,update:i}=ys(e),{organization:a,cluster:o}=Me({strict:!1}),[s,c]=xn(Cn.SavedClusterState,null),{data:l}=N(Js(e)),{data:u}=N(Qs({availableHosts:!0,organizationId:e})),{data:d}=N(Qs({organizationId:e})),{data:f}=N(Xs()),p=(0,U.useMemo)(()=>{if(o){let e=o.instances?.map(e=>e.version).filter(di);if(f&&e){let t=e.sort(sc).pop();return{...f,value:[!!t&&{name:`current`,version:t},...(f?.value||[]).filter(e=>t!==e.version&&(!t||oc(t,e.version)))].filter(di)}}}return f},[f,o]),m=(0,U.useMemo)(()=>Qu(o?.instances??[]),[o]),h=(0,U.useMemo)(()=>{for(let e of a?.clusters??[])if(e.id!==o?.id&&l&&!To(e.status)&&!wo(e.status)&&e.plans)for(let t of e.plans){let e=l.find(e=>e.id===t.planId);if(e?.priceUsd===0&&!e.id.startsWith(`self-hosted`))return!0}return!1},[o?.id,a?.clusters,l]),g=(0,U.useMemo)(()=>ac(l?.sort($s(`priceUsd`))||[],`deploymentDescription`,`performanceDescription`),[l]),_=(0,U.useMemo)(()=>{if(!l||!p||!u||!d||t&&!o)return null;let e=o;if(s){if(Zu(s))return{...s,clusterName:s.clusterName||``,abbreviatedName:s.abbreviatedName||``,version:s.version,deploymentDescription:s.deploymentDescription||``,performanceDescription:s.performanceDescription||``,fqdn:s.fqdn||``,regionPlans:s.regionPlans||[],instances:s.instances||[]};e=s}let n=l?.find(e=>e.id===o?.plans?.[0].planId),r=[],i=[],a=n?.deploymentDescription===`Dedicated`?d:u,c=Ku(l,a,h),f=!1;if(e){if(e.plans){for(let t of e.plans)if(t.regionId){let e=a.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&&!ga.includes(e.status)).sort(nc);for(let e of t)f=!0,i.push({fqdn:e.instanceFqdn,port:e.operationsApiPort,secure:e.operationsApiSecure?`true`:`false`})}}else c&&r.push(...c.regionPlans);!f&&!r.length&&r.push({regionName:``,latencyDescription:``});let m=p.value?.find(e=>e.name===`current`)?.version??p.value?.find(e=>e.name===`stable`)?.version;return{sourceClusterId:e?.id,autoRenew:e?.plans?.[0]?.autoRenew??!0,clusterName:e?.name??``,abbreviatedName:e?.abbreviatedName??``,version:m,deploymentDescription:n?.deploymentDescription??c?.deploymentDescription??``,performanceDescription:n?.performanceDescription??c?.performanceDescription??``,fqdn:f?e?.fqdn??``:``,instances:i,regionPlans:r}},[h,o,t,l,p,u,d,s]);return!_||!a||!l||!u||!d?(0,H.jsx)($u,{isEdit:!!t,children:(0,H.jsx)(zs,{centered:!0,text:`Loading...`})}):(o?.id?!i:!r)?(0,H.jsx)($u,{isEdit:!!t,children:(0,H.jsx)(ci,{title:`Not Allowed`,error:{message:(0,H.jsxs)(H.Fragment,{children:[`You do not have permission to `,o?.id?`update`:`create`,` clusters in this org.`]})}})}):l.length===0?(0,H.jsx)($u,{isEdit:!!t,children:(0,H.jsx)(ci,{title:`Cluster ${t?`Modification`:`Creation`} Not Currently Allowed`,error:{message:(0,H.jsxs)(H.Fragment,{children:[`There are no available deployment types right now! Please try again later, or `,(0,H.jsx)(Rs,{}),`.`]})}})}):(0,H.jsx)($u,{isEdit:!!t,className:`max-w-4xl mx-auto`,children:(0,H.jsx)(Xu,{alreadyUsingFree:h,clusterId:t,defaultValues:_,deploymentToPerformanceToPlan:g,harperVersions:p,mode:n,organization:a,organizationId:e,partialUpgrade:m,planTypes:l,regionLocationsColocated:u,regionLocationsDedicated:d,setSavedClusterState:c,startOffOnBilling:Zu(s)&&s.skipToBilling===!0})})}function td({children:e}){let{organizationId:t}=M({strict:!1}),{view:n}=vs(t),{update:r}=_s(t),i=`/${t}`;return(0,H.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,H.jsxs)(`div`,{className:`md:grid gap-6 md:grid-cols-12`,children:[(0,H.jsx)(`aside`,{className:`md:col-span-3 lg:col-span-2 mb-4 md:mb-0`,children:(0,H.jsx)(Gs,{items:[{to:i,label:`Clusters`,icon:Wr,exact:!0},n&&{to:`${i}/users`,label:`Users`,icon:oi},n&&{to:`${i}/roles`,label:`Roles`,icon:Kr},r&&{to:`${i}/billing`,label:`Billing`,icon:nr,children:[{to:`${i}/billing`,label:`Payment Method`,exact:!0},{to:`${i}/billing/invoices`,label:`Invoices`}]},r&&{to:`${i}/settings`,label:`Settings`,icon:Gr}].filter(Boolean),ariaLabel:`Organization sections`})}),(0,H.jsx)(`section`,{className:`md:col-span-9 lg:col-span-10 min-w-0`,children:e})]})})}var nd={FAILED:0,UPDATING:1,PROVISIONING:2,RUNNING:3,TERMINATED:4},rd=nd.RUNNING;function id(e,t){return e.status===t.status?e.name.localeCompare(t.name):(e.status?nd[e.status]??rd:rd)-(t.status?nd[t.status]??rd:rd)}function ad(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 od(){let{organizationId:e}=M({strict:!1}),{create:t}=ys(e),{data:n,isSuccess:r}=ue(bc(e)),[i]=xn(Cn.SavedClusterState,null),[a,o]=(0,U.useState)(``),s=(0,U.useCallback)(()=>o(``),[]),c=(0,U.useCallback)(e=>{o(e.currentTarget.value?.toLowerCase()||``)},[]),l=(0,U.useMemo)(()=>n?.clusters?.slice().filter(e=>!To(e.status)).sort(id)||[],[n?.clusters]),u=(0,U.useMemo)(()=>l.filter(ad([`id`,`name`],a))||[],[a,l]);return n&&l.length===0&&t?(0,H.jsx)(ed,{}):i?(0,H.jsx)(he,{to:`/${e}/new-cluster`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{children:r&&t&&(0,H.jsx)(`div`,{className:`flex w-full justify-end`,children:(0,H.jsx)(I,{to:`new-cluster`,children:(0,H.jsxs)(_,{variant:`positive`,accessKey:`n`,children:[(0,H.jsx)(Rr,{}),` `,(0,H.jsxs)(`span`,{className:`hidden sm:inline-block`,children:[(0,H.jsx)(`u`,{children:`N`}),`ew `,(0,H.jsx)(`span`,{className:`hidden md:inline-block`,children:`Cluster`})]})]})})})}),(0,H.jsxs)(td,{children:[(0,H.jsxs)(`div`,{className:`relative mb-6 w-full`,children:[(0,H.jsx)(Ur,{className:`pointer-events-none absolute left-0 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(Z,{placeholder:`Filter by name`,className:`w-full rounded-none border-0 border-b border-border bg-transparent dark:bg-transparent pl-6 shadow-none focus-visible:border-primary focus-visible:ring-0`,value:a,onChange:c})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-9 mb-4`,children:[u.map(e=>(0,H.jsx)(`div`,{className:`col-span-1 md:col-span-3 xl:col-span-3 2xl:col-span-2`,children:(0,H.jsx)(Ls,{cluster:e})},e.id)),!u.length&&(0,H.jsxs)(`div`,{className:`col-span-1 md:col-span-9 text-center`,children:[(0,H.jsx)(`h2`,{className:`my-4 text-xl`,children:`No matches found.`}),(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:s,children:`Clear Filters`})]})]})]})]})}function sd(){let e=location.hash;return e?e.startsWith(`#/`)?e.slice(1):e:`/`}function cd(){return`/#`+sd()}function ld(){let{organizationId:e}=M({strict:!1}),t=L(),n=new URLSearchParams(window.location.search).get(`setup_intent_client_secret`),{setup_intent_client_secret:r}=pe({strict:!1}),[i]=xn(Cn.SavedClusterState,null),a=n||r,o=xl(),s=kc(e),c=(0,U.useCallback)(()=>{let e=i?i.clusterId?`../../${i.clusterId}/edit`:`../../new-cluster`:`../`;window.history.replaceState(null,``,cd()),t({search:void 0,to:e})},[t,i]);return(0,U.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?(B.error(`Failed to process payment method details. Please try another payment method.`),c()):s(e.payment_method,c);break;case`processing`:B.warning(`Processing payment method. Please check back later.`),c();break;case`requires_payment_method`:B.error(`Failed to process payment method details. Please try another payment method.`),c();break;default:B.error(`Failed to process payment method details. Please try another payment method.`),c();break}}catch(e){console.error(e),B.error(`Failed to process payment method details. Please try another payment method.`),c()}})()},[a,c,e,s,o]),(0,H.jsx)(zs,{centered:!0})}function ud(){return(0,H.jsx)(ql,{children:(0,H.jsx)(ld,{})})}function dd(){let{organizationId:e}=M({strict:!1}),{update:t}=_s(e);return t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(td,{children:(0,H.jsx)(Ee,{})})]}):(0,H.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 fd({className:e,containerClassName:t,containerRef:n,...r}){return(0,H.jsx)(`div`,{ref:n,"data-slot":`table-container`,className:p(`relative w-full overflow-x-auto`,t),children:(0,H.jsx)(`table`,{"data-slot":`table`,className:p(`w-full caption-bottom text-sm`,e),...r})})}function pd({className:e,...t}){return(0,H.jsx)(`thead`,{"data-slot":`table-header`,className:p(`[&_tr]:border-b`,e),...t})}function md({className:e,...t}){return(0,H.jsx)(`tbody`,{"data-slot":`table-body`,className:p(`[&_tr:last-child]:border-0`,e),...t})}function hd({className:e,...t}){return(0,H.jsx)(`tr`,{"data-slot":`table-row`,className:p(`border-b border-grey-700 transition-colors`,e),...t})}function gd({className:e,...t}){return(0,H.jsx)(`th`,{"data-slot":`table-head`,className:p(`h-10 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function _d({header:e,onColumnClick:t,className:n,...r}){let i=(0,U.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]),a=e.column.columnDef.enableSorting,o=e.column.columnDef.enableResizing,s=e.isPlaceholder?null:De(e.column.columnDef.header,e.getContext()),c=(0,U.useCallback)(()=>{e.column.resetSize()},[e]);return(0,H.jsx)(gd,{...r,style:{width:`${e.getSize()}px`},className:p(a?`px-0`:`px-2`,n),children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[a?(0,H.jsxs)(_,{type:`button`,variant:`ghost`,className:p(`rounded-none`,!e.column.getIsSorted()||e.column.getIsSorted()===`asc`?`cursor-n-resize`:`cursor-s-resize`),onClick:i,children:[s,e.column.getIsSorted()===`asc`?(0,H.jsx)(Fn,{}):e.column.getIsSorted()===`desc`?(0,H.jsx)(An,{}):(0,H.jsx)(Nn,{className:`text-gray-600`})]}):s,o&&(0,H.jsx)(_,{type:`button`,variant:`ghost`,className:`cursor-col-resize`,onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),onDoubleClick:c,style:{transform:e.column.getIsResizing()?`translateX(${e.getContext().table.getState().columnSizingInfo.deltaOffset}px)`:``},children:(0,H.jsx)(gr,{})})]})})}function vd({className:e,...t}){return(0,H.jsx)(`td`,{"data-slot":`table-cell`,className:p(`align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]`,e),...t})}function yd({columns:e,data:t,isFetching:n,onRowClick:r,onColumnClick:i,sortingState:a,children:o}){let s=be({data:t,columns:e,getCoreRowModel:Te(),getSortedRowModel:ge(),initialState:{sorting:a}});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-end space-x-2 pb-4`,children:[(0,H.jsx)(`div`,{className:`grow lg:hidden`}),o,(0,H.jsx)(`div`,{className:`grow hidden lg:visible`})]}),(0,H.jsxs)(fd,{containerClassName:`rounded-md bg-card dark:bg-black-dark`,children:[(0,H.jsx)(pd,{children:s.getHeaderGroups().map(e=>(0,H.jsx)(hd,{className:`border-none`,children:e.headers.map(e=>(0,H.jsx)(_d,{header:e,onColumnClick:i},e.id))},e.id))}),(0,H.jsx)(md,{className:`bg-background dark:bg-black border border-border dark:border-grey-700`,children:s.getRowModel().rows?.length?s.getRowModel().rows.map(e=>(0,H.jsx)(hd,{"data-state":e.getIsSelected()&&`selected`,onClick:()=>r?.(e),className:p(`hover:bg-muted/10 data-[state=selected]:bg-muted`,r&&`cursor-pointer`),children:e.getVisibleCells().map(e=>(0,H.jsx)(vd,{className:`py-2 px-2 overflow-x-hidden max-w-32 text-ellipsis whitespace-nowrap`,style:{width:`${e.column.getSize()}px`},children:De(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,H.jsx)(hd,{children:(0,H.jsx)(vd,{colSpan:e.length,className:`h-24 text-center`,children:n?(0,H.jsx)(`div`,{children:(0,H.jsx)(zs,{className:`p-12`})}):(0,H.jsx)(`span`,{children:`No results.`})})})})]})]})}function bd(e){switch(e){case`paid`:return`success`;case`void`:case`uncollectible`:return`destructive`;default:return`default`}}function xd(e){return new Intl.NumberFormat(`en-US`,{style:`currency`,currency:`USD`}).format(e)}function Sd(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 Cd=[{header:`Invoice Id`,accessorKey:`id`,enableSorting:!1},{header:`Status`,accessorKey:`status`,enableSorting:!1,cell:({cell:e})=>(0,H.jsx)(Va,{variant:bd(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?Sd(r,t):[t?Sd(r,t):`-`,n?Sd(i,n):`-`].join(` to `)}},{header:`Amount Due`,accessorKey:`amountDue`,enableSorting:!1,cell:({cell:e})=>xd(e.getValue()?e.getValue()/100:0)},{header:`Amount Paid`,accessorKey:`amountPaid`,enableSorting:!1,cell:({cell:e})=>xd(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} @ ${xd(e.amount/100)}`);return n.join(`
|
|
12
|
-
`)}}];function wd(e){return(0,U.useCallback)(async()=>{B.loading(`Refreshing...`,{id:`refreshing`});let t=Date.now();await e(),Date.now()-t<500&&await f(500),B.success(`Refreshed!`,{id:`refreshing`})},[e])}async function Td(e){let{data:t}=await c.get(`/Invoice/${e}`);return t}function Ed(e,t){return F({queryKey:[e,`invoices`],queryFn:()=>Td(e),retry:!1,enabled:!!e,refetchInterval:t?1e4:void 0})}function Dd(){let{organizationId:e}=M({strict:!1}),{data:t}=N(bc(e)),{data:n,refetch:r,isLoading:i,isFetching:a,isRefetching:o}=N(Ed(t?.type!==`ENTERPRISE`&&t?.id,!1)),s=wd(r);return t?.type===`ENTERPRISE`?(0,H.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,H.jsx)(Rs,{}),`, we would love to talk!`]}):i?(0,H.jsx)(zs,{centered:!0}):!n||!n.length?(0,H.jsxs)(`span`,{children:[`Your invoices will be shown here once one is available! Want to explore your solution with Harper more?`,` `,(0,H.jsx)(Rs,{overEmail:!0}),`, we would love to talk!`]}):(0,H.jsx)(yd,{data:n,columns:Cd,children:(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:s,accessKey:`r`,disabled:a||o,children:[(0,H.jsx)(hn,{}),(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]})})}function Od(e){let t=P({getParentRoute:()=>e,path:`billing`,head:()=>({meta:[{title:`Billing — Harper Fabric`}]}),component:dd}),n=P({getParentRoute:()=>t,path:`/`,head:()=>({meta:[{title:`Payment Methods — Harper Fabric`}]}),component:$l}),r=P({getParentRoute:()=>t,path:`invoices`,head:()=>({meta:[{title:`Invoices — Harper Fabric`}]}),component:Dd}),i=P({getParentRoute:()=>t,path:`confirm`,head:()=>({meta:[{title:`Confirm Payment — Harper Fabric`}]}),component:ud});return t.addChildren([n,r,i])}async function kd(e){let{data:t}=await c.get(`/OrganizationRole/${e}`);return t}function Ad(e){return F({queryKey:[e,`roles`],queryFn:()=>kd(e),retry:!1,refetchInterval:10*1e3})}var jd=me(),Md=[{header:`Role Name`,accessorKey:`roleName`,enableSorting:!1},jd.display({header:`ID`,id:`id`,enableSorting:!1,cell:e=>(0,H.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,title:e.row.original.id,children:e.row.original.id})}),jd.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 Nd(e){let{data:t}=await c.post(`/Role/`,e);return t}function Pd(){return j({mutationFn:Nd})}var Fd=S({name:w().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:O(),delete:O()});S({roles:S({create:O(),delete:O(),update:O(),view:O()}),clusters:S({create:O(),delete:O(),update:O(),view:O(),resources:T(S({id:w(),delete:O(),update:O(),view:O(),instances:S({create:O(),delete:O(),update:O(),view:O()})}))})});function Id(){let[e]=xi(),t=vi();return e===`dark`||e===`system`&&t===`dark`?`vs-dark`:`light`}var Ld=(0,U.lazy)(async()=>(await Pe(()=>import(`./setup-SKA4UhdE.js`),__vite__mapDeps([0,1,2,3,4,5,6])),{default:(await Pe(()=>import(`./dist-DHjL6trB.js`),__vite__mapDeps([5,2,1]))).default}));function Rd(e){return(0,H.jsx)(U.Suspense,{fallback:e.loading??null,children:(0,H.jsx)(Ld,{...e})})}var zd={roles:{create:!0,view:!0,update:!0,delete:!0},clusters:{create:!0,view:!0,update:!0,delete:!0,resources:[]}};function Bd({isModalOpen:e,setIsModalOpen:t}){let n=Id(),r=le(),{organizationId:i}=M({strict:!1}),[a,o]=(0,U.useState)(!0),[s,c]=(0,U.useState)(JSON.stringify(zd,null,2)),{mutate:l,isPending:u}=Pd(),d=R({resolver:z(Fd),defaultValues:{name:``,update:!1,delete:!1}}),f=(0,U.useCallback)(e=>{o(e.length===0)},[o]),p=(0,U.useCallback)(async e=>{let n=bn(s);if(!n)return;let o={...e,...n,organizationId:i};e&&a&&l(o,{onSuccess:()=>{B.success(`Organization role added successfully!`),t(!1),r.invalidateQueries({queryKey:[i,`roles`],refetchType:`active`}),d.reset()},onError:e=>{B.error(`Failed to add organization role: ${e.message}`)}})},[a,s,l,d,r,t,i]);return(0,H.jsx)(Io,{onOpenChange:t,open:e,children:(0,H.jsxs)(Uo,{resizable:!0,children:[(0,H.jsx)(Ko,{children:`Add New Organization Role`}),(0,H.jsx)(qo,{children:`Set the new organization role permissions.`}),(0,H.jsx)(G,{...d,children:(0,H.jsxs)(`form`,{id:`org-add-role-form`,name:`org-add-role-form`,className:`flex flex-1 min-h-0 flex-col gap-4 my-4`,onSubmit:d.handleSubmit(p),children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsx)(q,{control:d.control,name:`name`,render:({field:e})=>(0,H.jsxs)(J,{className:`col-span-2`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Role Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,className:``,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:d.control,name:`update`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Update Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:d.control,name:`delete`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Delete Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})})]}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,H.jsx)(Rd,{className:`w-full h-full`,theme:n,defaultLanguage:`json`,onValidate:f,onChange:e=>{e&&c(e)},options:{automaticLayout:!0},defaultValue:JSON.stringify(zd,null,2)})}),(0,H.jsx)(Go,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,H.jsx)(_,{variant:`destructiveOutline`,type:`button`,onClick:()=>t(!1),disabled:u,children:`Cancel`}),(0,H.jsx)(_,{variant:`submit`,disabled:u||!a||!d.formState.isValid,children:`Save Changes`})]})})]})})]})})}async function Vd({roleId:e}){let{data:t}=await c.delete(`/Role/${e}`,{id:e,deleted:!0});return t}function Hd(){return j({mutationFn:({roleId:e})=>Vd({roleId:e})})}async function Ud({roleId:e,updatedRoleInfo:t}){let{data:n}=await c.put(`/Role/${e}`,t);return n}function Wd(){return j({mutationFn:({roleId:e,updatedRoleInfo:t})=>Ud({roleId:e,updatedRoleInfo:t})})}function Gd({organizationId:e,roleId:t}){return F({queryKey:[e,`roles`,t],queryFn:()=>Kd(t),refetchInterval:10*1e3})}async function Kd(e){let{data:t}=await c.get(`/Role/${e}`);return t}function qd({onRoleDeleteClick:e,setIsConfirmingRoleDeletion:t,isRoleDeletionPending:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ko,{children:`Confirm Role Deletion`}),(0,H.jsx)(qo,{children:`Are you sure you want to delete this role? This action cannot be undone.`}),(0,H.jsxs)(Go,{children:[(0,H.jsx)(_,{type:`button`,variant:`defaultOutline`,onClick:()=>t(!1),children:`Cancel`}),(0,H.jsx)(_,{variant:`destructiveOutline`,onClick:e,disabled:n,children:n?`Deleting...`:`Delete Role`})]})]})}function Jd({data:e,isModalOpen:t,closeModal:n}){return(0,H.jsx)(Io,{onOpenChange:(0,U.useCallback)(()=>n(!1),[n]),open:t,children:(0,H.jsx)(Uo,{resizable:!0,children:(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(Yd,{roleName:e.roleName}),children:(0,H.jsx)(Xd,{data:e,closeModal:n})})})})}function Yd({roleName:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Ko,{children:[`Organization Role "`,e,`"`]}),(0,H.jsx)(zs,{centered:!0,text:`Loading role…`,className:`flex-1 min-h-0`})]})}function Xd({data:e,closeModal:t}){let n=le(),{data:r}=ue(Gd({roleId:e.id,organizationId:e.organizationId})),i=He().user?.roles?.[e.organizationId]?.id===e.id,{update:a,remove:o}=vs(e.organizationId),{mutate:s,isPending:c}=Wd(),{mutate:l,isPending:u}=Hd(),d=Id(),[f,p]=(0,U.useState)(!1),m=R({resolver:z(Fd),defaultValues:{name:e.roleName,update:r.organization.update||!1,delete:r.organization.delete||!1}}),h=(0,U.useCallback)(()=>{l({roleId:e.id},{onSuccess:()=>{B.success(`Role deleted successfully!`),t(!0),m.reset()},onError:e=>{B.error(`Error`,{description:`Failed to delete role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}})},[e.id,l,m,t]),[g,v]=(0,U.useState)(!0),y=(0,U.useMemo)(()=>JSON.stringify({roles:{...r.organization.roles},clusters:{...r.organization.clusters}},null,2),[r]),[b,x]=(0,U.useState)(y),S=b!==y,C=(0,U.useCallback)(e=>{v(e.length===0)},[v]),w=(0,U.useCallback)(async r=>{if(!a)return;let i=bn(b);if(!i)return;let o={...r,...i,organizationId:e.organizationId};b&&g&&s({roleId:e.id,updatedRoleInfo:o},{onSuccess:async()=>{B.success(`Role updated successfully!`),await n.invalidateQueries({queryKey:[e.organizationId,`roles`,e.id]}),t(!1),m.reset()},onError:e=>{B.error(`Error`,{description:`Failed to update role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}})},[t,e.id,e.organizationId,m,g,n,r,a,b,s]);return f?(0,H.jsx)(qd,{onRoleDeleteClick:h,setIsConfirmingRoleDeletion:p,isRoleDeletionPending:u}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Ko,{children:[i||!a?`View`:`Edit`,` Organization Role "`,e.roleName,`"`]}),(0,H.jsx)(G,{...m,children:(0,H.jsxs)(`form`,{id:`org-edit-role-form`,name:`org-edit-role-form`,className:`flex flex-1 min-h-0 flex-col gap-4 my-4`,onSubmit:m.handleSubmit(w),children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsx)(q,{control:m.control,name:`name`,render:({field:e})=>(0,H.jsxs)(J,{className:`col-span-2`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Role Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,className:``,...e,disabled:!0,readOnly:!0})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`update`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Update Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,disabled:i||!a,readOnly:i||!a,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`delete`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Delete Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,disabled:i||!a,readOnly:i||!a,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})})]}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,H.jsx)(Rd,{className:`w-full h-full`,theme:d,defaultLanguage:`json`,onValidate:C,onChange:e=>{e&&x(e)},options:{readOnly:i||!a,automaticLayout:!0},defaultValue:b})}),!i&&(o||a)&&(0,H.jsx)(Go,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[o&&(0,H.jsx)(_,{type:`button`,variant:`destructiveOutline`,onClick:()=>p(!0),disabled:c,children:`Delete Role`}),a&&(0,H.jsx)(_,{variant:`submit`,disabled:!g||c||!m.formState.isValid||!m.formState.isDirty&&!S,children:`Save Changes`})]})})]})})]})}function Zd(){let e=L(),t=le(),{organizationId:n,orgRoleId:r}=M({strict:!1}),{create:i}=vs(n),{data:a,refetch:o,isFetching:s,isRefetching:c}=ue(Ad(n)),l=(0,U.useMemo)(()=>a&&a?.find(e=>e.id===r),[a,r]),u=!!r&&!!l,[d,f]=(0,U.useState)(!1),p=(0,U.useCallback)(async(i,a)=>{let o=[r?`..`:``,i].filter(Boolean);await e({to:o.join(`/`)}),a&&await t.invalidateQueries({queryKey:[n,`roles`],refetchType:`active`})},[r,e,t]),m=(0,U.useCallback)(()=>{f(!0)},[f]),h=(0,U.useCallback)(e=>p(e.original.id,!1),[p]),g=(0,U.useCallback)(e=>p(void 0,e),[p]),v=wd(o);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(td,{children:(0,H.jsxs)(U.Suspense,{fallback:(0,H.jsx)(zs,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,H.jsxs)(yd,{data:a,columns:Md,onRowClick:h,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:v,accessKey:`r`,disabled:s||c,children:[(0,H.jsx)(hn,{}),(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]}),i&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:m,accessKey:`a`,disabled:d,children:[(0,H.jsx)(Rr,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`A`}),`dd`]})]})]}),i&&(0,H.jsx)(Bd,{isModalOpen:d,setIsModalOpen:f}),u&&(0,H.jsx)(Jd,{data:l,isModalOpen:u,closeModal:g},l.id)]})})]})}function Qd({className:e,...t}){return(0,H.jsx)(Ze,{"data-slot":`switch`,className:p(`peer data-[state=checked]:bg-green data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-grey-500 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,H.jsx)(ht,{"data-slot":`switch-thumb`,className:p(`bg-white dark:data-[state=unchecked]:bg-white dark:data-[state=checked]:bg-white pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}function $d(e){return`//oauth/${e}/login`}async function ef(e,t){let{data:n}=await c.patch(`/Organization/${e}/settings/oauth`,t);return n}var tf=S({domain:w().min(1,`Domain is required`),clientId:w().min(1,`Client ID is required`),clientSecret:w().min(1,`Client secret is required`),scope:w().optional()}),nf=S({domain:w().min(1,`Domain is required`),clientId:w().optional(),clientSecret:w().optional(),scope:w().optional()});function rf(){let{organizationId:e}=M({strict:!1}),{user:t}=He(),{update:n}=_s(e),{data:r}=ue(bc(e)),i=le(),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),l=r.settings?.oauthConfigs??[],{mutate:u,isPending:d}=j({mutationFn:t=>ef(e,t),onSuccess:()=>void i.invalidateQueries({queryKey:[e]}),onError:()=>B.error(`Failed to update OAuth settings.`)}),f=R({resolver:z(tf),defaultValues:{domain:``,clientId:``,clientSecret:``,scope:`openid email profile`}}),p=e=>{u({provider:`okta`,...e},{onSuccess:()=>{B.success(`OAuth provider added.`),f.reset(),o(!1)}})},m=R({resolver:z(nf)}),h=e=>{c(e.id??null),m.reset({domain:e.domain,clientId:``,clientSecret:``,scope:e.scope??``})},g=(e,t)=>{let n={id:e.id,provider:e.provider,domain:t.domain,scope:t.scope};t.clientId&&(n.clientId=t.clientId),t.clientSecret&&(n.clientSecret=t.clientSecret),u(n,{onSuccess:()=>{B.success(`OAuth provider updated.`),c(null)}})},v=(e,t)=>{u({id:e.id,provider:e.provider,[t]:!e[t]})},y=e=>`//oauth/${e}/callback`,b=async e=>{await Ns(e)&&B.success(`Sign-in URL copied.`)},x=async e=>{await Ns(e)&&B.success(`Redirect URI copied.`)};return n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(td,{children:(0,H.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,H.jsx)(`h2`,{className:`text-2xl text-foreground font-light mb-6`,children:`Authentication`}),(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h3`,{className:`text-lg text-foreground font-medium`,children:`OAuth Providers`}),!a&&(0,H.jsxs)(_,{variant:`positiveOutline`,size:`sm`,onClick:()=>o(!0),children:[(0,H.jsx)(Rr,{}),`Add Provider`]})]}),l.length===0&&!a&&(0,H.jsx)(`p`,{className:`text-muted-foreground text-sm mb-4`,children:`No OAuth providers configured.`}),l.map(e=>{let n=t?.oauthConfigId===e.id;return s===e.id?(0,H.jsxs)(`div`,{className:`border rounded-lg p-4 mb-3 text-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h4`,{className:`font-medium`,children:`Edit Provider`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(null),className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(_n,{className:`size-4`})})]}),(0,H.jsx)(G,{...m,children:(0,H.jsxs)(`form`,{onSubmit:m.handleSubmit(t=>g(e,t)),className:`space-y-4`,children:[(0,H.jsx)(q,{control:m.control,name:`domain`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Domain`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`company.okta.com`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`clientId`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client ID`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`Leave blank to keep existing`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`clientSecret`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client Secret`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,placeholder:`Leave blank to keep existing`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`scope`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Scope`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`openid email profile`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,H.jsx)(_,{type:`submit`,variant:`positive`,disabled:d,children:d?`Saving...`:`Save`}),(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>c(null),children:`Cancel`})]})]})})]},e.id):(0,H.jsx)(`div`,{className:`border rounded-lg p-4 mb-3 text-foreground`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:e.domain}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase bg-muted px-2 py-0.5 rounded`,children:e.provider}),e.enabled===!1&&(0,H.jsx)(`span`,{className:`text-xs text-destructive bg-destructive/10 px-2 py-0.5 rounded`,children:`Disabled`})]}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:[`Client ID: `,(0,H.jsx)(`span`,{className:`text-foreground font-mono`,children:`****`})]}),e.id&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mt-3 rounded-md bg-muted px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Okta redirect URI`}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-1.5`,children:[`Add to `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`Login redirect URIs`}),` `,`in your Okta app settings.`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-foreground font-mono truncate`,children:y(e.id)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void x(y(e.id)),className:`hover:text-foreground shrink-0 text-muted-foreground`,title:`Copy redirect URI`,children:(0,H.jsx)(tr,{className:`size-3.5`})})]})]}),(0,H.jsxs)(`div`,{className:`mt-2 rounded-md bg-muted px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:`User login link`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`a`,{href:$d(e.id),target:`_blank`,rel:`noreferrer`,className:`text-sm text-foreground truncate hover:underline`,children:$d(e.id)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 text-muted-foreground`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>void b($d(e.id)),className:`hover:text-foreground`,title:`Copy login link`,children:(0,H.jsx)(tr,{className:`size-3.5`})}),(0,H.jsx)(`a`,{href:$d(e.id),target:`_blank`,rel:`noreferrer`,className:`hover:text-foreground`,title:`Open login link`,children:(0,H.jsx)(ar,{className:`size-3.5`})})]})]})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 sm:shrink-0`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground cursor-pointer`,children:[(0,H.jsx)(Qd,{checked:e.enabled!==!1,onCheckedChange:()=>v(e,`enabled`),disabled:d}),`Enabled`]}),(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-sm text-foreground ${n?`cursor-pointer`:`cursor-not-allowed opacity-50`}`,children:[(0,H.jsx)(Qd,{checked:!!e.required,onCheckedChange:()=>v(e,`required`),disabled:d||!n}),`Required`]})}),!n&&(0,H.jsxs)(Mi,{children:[`Sign in via `,e.provider,` first to enable Required`]})]}),(0,H.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>h(e),disabled:d,children:(0,H.jsx)(Lr,{className:`size-4`})})]})]})},e.id)}),a&&(0,H.jsxs)(`div`,{className:`border rounded-lg p-4 text-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h4`,{className:`font-medium`,children:`Add Okta Provider`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{o(!1),f.reset()},className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(_n,{className:`size-4`})})]}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-4`,children:[`After saving, copy the `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`Okta redirect URI`}),` `,`from the provider card and add it to your Okta app's`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`Login redirect URIs`}),`.`]}),(0,H.jsx)(G,{...f,children:(0,H.jsxs)(`form`,{onSubmit:f.handleSubmit(p),className:`space-y-4`,children:[(0,H.jsx)(q,{control:f.control,name:`domain`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Domain`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`company.okta.com`,autoFocus:!0,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f.control,name:`clientId`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client ID`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`Okta Client ID`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f.control,name:`clientSecret`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client Secret`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,placeholder:`Okta Client Secret`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f.control,name:`scope`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Scope`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`openid email profile`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,H.jsx)(_,{type:`submit`,variant:`positive`,disabled:d,children:d?`Adding...`:`Add Provider`}),(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>{o(!1),f.reset()},children:`Cancel`})]})]})})]})]})]})})]}):(0,H.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))] text-foreground`,children:`You don't have permission to manage settings for this organization.`})}var af=[{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},me().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}];function of({name:e,id:t}){return(0,H.jsxs)(`span`,{className:`flex items-baseline gap-2 truncate`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:e}),(0,H.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:t})]})}var sf=A.object({email:Ca.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:A.string().nonempty({error:`Please select a role.`})});async function cf(e){let{data:t}=await c.post(`/OrganizationRole/`,e);return t}function lf(){return j({mutationFn:e=>cf(e)})}A.object({email:Ca.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:A.string().nonempty({error:`Please select a role.`})});async function uf(e){let{data:t}=await c.post(`/UserInvite/`,e);return t}function df(){return j({mutationFn:e=>uf(e)})}function ff({isModalOpen:e,onChangesSaved:t,setIsModalOpen:n}){let{organizationId:r}=M({strict:!1}),{data:i,isLoading:a}=N({...Ad(r),throwOnError:!0}),[o,s]=(0,U.useState)(!1),c=R({resolver:z(sf),defaultValues:{email:``,roleId:``}}),{mutate:l,isPending:u}=lf(),{mutate:d,isPending:f}=df(),p=(0,U.useCallback)(async e=>{e&&(o?d:l)(e,{onSuccess:()=>{let r=e.roleId;c.reset(),c.setValue(`roleId`,r),t(),B.success(`User invited successfully!`),n(!1),s(!1)},onError:e=>{e?.status===404&&s(!0)}})},[l,c,d,t,n,o]);return(0,H.jsx)(Io,{onOpenChange:()=>{n(!1),s(!1),c.reset()},open:e,children:(0,H.jsx)(Uo,{"aria-describedby":void 0,children:(0,H.jsx)(G,{...c,children:(0,H.jsxs)(`form`,{id:`org-add-user-form`,name:`org-add-user-form`,onSubmit:c.handleSubmit(p),className:`grid gap-4 my-4`,children:[(0,H.jsx)(Wo,{children:(0,H.jsx)(Ko,{children:o?`Invite User`:`Add User`})}),(0,H.jsx)(q,{control:c.control,name:`email`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Email`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`email`,enterKeyHint:`next`,autoComplete:`email`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:c.control,name:`roleId`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Roles`}),a?(0,H.jsx)(ou,{}):(0,H.jsx)(K,{children:(0,H.jsxs)(su,{...e,onValueChange:t=>e.onChange(t),children:[(0,H.jsx)(uu,{className:`w-full`,children:(0,H.jsx)(lu,{placeholder:`Choose Role`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(fu,{children:`Role`}),i?.map(e=>(0,H.jsx)(Q,{value:e.id,children:(0,H.jsx)(of,{name:e.roleName,id:e.id})},e.id))]})})]})}),(0,H.jsx)(X,{})]})}),o&&(0,H.jsxs)(qo,{className:`p-3 my-5 text-white rounded-md bg-amber-600 flex`,children:[(0,H.jsx)(Or,{className:`inline-block size-12 pr-2`}),(0,H.jsx)(`span`,{children:`This person doesn’t have a Fabric account. Do you want to invite them?`})]}),(0,H.jsx)(Go,{children:(0,H.jsx)(`div`,{className:`flex justify-between w-full`,children:(0,H.jsxs)(_,{type:`submit`,variant:`submit`,disabled:u||f,children:[(0,H.jsx)(Vr,{}),` `,o?`Invite User`:`Add User`]})})})]})})})})}async function pf({roleId:e,userId:t}){let{data:n}=await c.delete(`/OrganizationRole/role/${e}/user/${t}`);return n}function mf(){return j({mutationFn:({roleId:e,userId:t})=>pf({roleId:e,userId:t})})}function hf(e){let[t,n]=(0,U.useState)(e||!1);return[t,(0,U.useCallback)(e=>{n(typeof e==`boolean`?e:e.target.checked)},[])]}function gf({data:e,readOnly:t,canRemove:n,orgRole:r,selectedRoles:i,setChangesMade:a}){let{mutate:o,isPending:s}=lf(),{mutate:c,isPending:l}=mf(),u=!!i[r.id],[d,f]=(0,U.useState)(u),[p,m]=hf(u);return(0,U.useEffect)(()=>{p!==d&&(p?o({email:e.email,roleId:r.id},{onSuccess:()=>{f(p),a(!0),B.success(`Role added successfully`)}}):c({userId:e.id,roleId:r.id},{onSuccess:()=>{f(p),a(!0),B.success(`Role removed successfully`)}}))},[o,e.email,e.id,p,r.id,c,a,d]),(0,H.jsxs)(ma,{className:`flex`,children:[(0,H.jsx)(Z,{type:`checkbox`,className:`w-6`,disabled:t||s||l||!n&&p,checked:p,onChange:m}),(0,H.jsx)(`span`,{className:`pl-4 pr-8 flex-1 py-2.5`,children:r.roleName})]},r.id)}function _f({closeModal:e,data:t,isModalOpen:n,onUserUpdated:r}){let{organizationId:i}=M({strict:!1}),a=He(),{update:o,remove:s}=vs(i),c=a.user?.email===t.email,[l,u]=(0,U.useState)(!1);return(0,H.jsx)(Io,{onOpenChange:l?r:e,open:n,children:(0,H.jsxs)(Uo,{resizable:!0,children:[(0,H.jsx)(Wo,{children:(0,H.jsxs)(Ko,{children:[o?`Edit `:`View `,` `,t.email,` `,c?`(yourself)`:``]})}),o&&(0,H.jsxs)(qo,{children:[`To remove `,c?`your self`:`this user`,` from the organization, uncheck all of the boxes below.`]}),(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(zs,{centered:!0,text:`Loading roles…`,className:`flex-1 min-h-0`}),children:(0,H.jsx)(vf,{data:t,organizationId:i,update:o,remove:s,setChangesMade:u})})]})})}function vf({data:e,organizationId:t,update:n,remove:r,setChangesMade:i}){let{data:a}=ue(Ad(t)),o=(0,U.useMemo)(()=>e.roles?ic(e.roles,`id`):{},[e]);return(0,H.jsx)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto`,children:a.map(t=>(0,H.jsx)(gf,{readOnly:!n,canRemove:r,data:e,orgRole:t,selectedRoles:o,setChangesMade:i},t.id))})}function yf(e,t){return e.email>t.email?1:-1}function bf(){let e=L(),{organizationId:t,orgUserId:n}=M({strict:!1}),{update:r}=vs(t),{data:i,refetch:a,isFetching:o,isRefetching:s}=ue(Ad(t)),c=(0,U.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(yf)},[i]),l=(0,U.useMemo)(()=>c?.find(e=>e.id===n),[c,n]),u=(0,U.useCallback)(t=>{let r=[n?`..`:``,t].filter(Boolean);e({to:r.join(`/`)})},[n,e]),d=!!n&&!!l,[f,p]=(0,U.useState)(!1),[m]=(0,U.useState)({attribute:`email`,descending:!1}),h=(0,U.useMemo)(()=>[{desc:m.descending,id:m.attribute}],[m]),g=(0,U.useCallback)(()=>{p(!0)},[p]),v=(0,U.useCallback)(()=>{a(),p(!1)},[a,p]),y=(0,U.useCallback)(e=>{u(e.original.id)},[u]),b=(0,U.useCallback)(()=>{u(void 0)},[u]),x=(0,U.useCallback)(()=>{a(),u(void 0)},[u,a]),S=wd(a);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(td,{children:(0,H.jsxs)(U.Suspense,{fallback:(0,H.jsx)(zs,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,H.jsxs)(yd,{data:c,isFetching:o||s,columns:af,onRowClick:y,sortingState:h,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:S,accessKey:`r`,disabled:o||s,children:[(0,H.jsx)(hn,{}),` `,(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]}),r&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:g,accessKey:`a`,disabled:f,children:[(0,H.jsx)(Rr,{}),` `,(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`A`}),`dd`]})]})]}),r&&(0,H.jsx)(ff,{isModalOpen:f,onChangesSaved:v,setIsModalOpen:p}),d&&(0,H.jsx)(_f,{closeModal:b,data:l,isModalOpen:d,onUserUpdated:x})]})})]})}function xf({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`skeleton`,className:p(`bg-primary/10 animate-pulse rounded-md`,e),...t})}function Sf({organizationId:e,organizationName:t,providers:n}){return(0,H.jsxs)(fn,{className:`relative h-full justify-between opacity-90`,children:[(0,H.jsxs)(ln,{children:[(0,H.jsx)(dn,{className:`truncate`,children:e}),(0,H.jsx)(cn,{children:(0,H.jsx)(`h2`,{children:t})})]}),(0,H.jsxs)(un,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center gap-1.5 mb-1`,children:[(0,H.jsx)(br,{className:`size-3 shrink-0`}),`Sign in with an OAuth provider to access this organization.`]}),n.map(e=>(0,H.jsx)(`a`,{href:$d(e.oauthConfigId),children:(0,H.jsxs)(_,{variant:`outline`,className:`w-full`,children:[`Sign in with `,e.name]})},e.oauthConfigId))]})]})}var Cf=S({couponId:w().nonempty({message:`Please enter a coupon ID.`}).trim()});async function wf({organizationId:e,couponId:t}){let{data:n}=await c.post(`/Coupon`,{organizationId:e,couponId:t},{validateStatus:e=>e>=200&&e<400||e===400||e===409});return n}function Tf(){return j({mutationFn:wf})}function Ef({organizationId:e,organizationName:t,isOpen:n,onClose:r}){let{mutate:i,isPending:a}=Tf(),o=R({resolver:z(Cf),defaultValues:{couponId:``}}),{handleSubmit:s,control:c,reset:l}=o;(0,U.useEffect)(()=>{n&&l({couponId:``})},[n,l]);let u=(0,U.useCallback)(n=>{i({organizationId:e,couponId:n.couponId},{onSuccess:i=>{i?B.error(`Error`,{description:i||`Failed to add coupon.`}):(B.success(`Success`,{description:`Coupon "${n.couponId}" added to ${t||e}.`}),r())}})},[i,e,t,r]);return(0,H.jsx)(Io,{open:n,onOpenChange:e=>!e&&r(),children:(0,H.jsxs)(Uo,{children:[(0,H.jsxs)(Wo,{children:[(0,H.jsx)(Ko,{children:`Add Coupon`}),(0,H.jsxs)(qo,{children:[`Add a coupon code to`,` `,t||e,`. This coupon will be applied to the next billing cycle.`,(0,H.jsx)(`br`,{}),`Coupons can be created in our`,` `,(0,H.jsx)(`a`,{href:`https://dashboard.stripe.com/`,target:`_blank`,rel:`noreferrer`,className:`text-purple hover:underline`,children:`Stripe Dashboard`}),`.`]})]}),(0,H.jsx)(G,{...o,children:(0,H.jsxs)(`form`,{onSubmit:s(u),children:[(0,H.jsx)(`div`,{className:`grid gap-4 py-4`,children:(0,H.jsx)(q,{control:c,name:`couponId`,render:({field:e})=>(0,H.jsxs)(J,{className:`grid items-center gap-4`,children:[(0,H.jsx)(Y,{children:`Coupon ID`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{...e,placeholder:`e.g. 100OFF`,disabled:a})}),(0,H.jsx)(X,{})]})})}),(0,H.jsxs)(Go,{children:[(0,H.jsx)(_,{type:`button`,variant:`ghost`,onClick:r,disabled:a,children:`Cancel`}),(0,H.jsx)(_,{type:`submit`,disabled:a,children:a?`Adding...`:`Add Coupon`})]})]})})]})})}function Df({organizationRole:e,onDeleteOrgModal:t}){let{organizationId:n,organizationName:r,roleName:i}=e,{remove:a,update:o}=_s(n),s=o,{view:c}=vs(n),l=Be(),[u,d]=(0,U.useState)(!1),f=(0,U.useCallback)(()=>{t(e)},[t,e]),p=[{type:`label`,key:`label`,className:`text-gray-600 text-xs`,label:`Options`},{type:`separator`,key:`sep-top`},{key:`clusters`,to:`${n}`,icon:(0,H.jsx)(Wr,{className:`size-4 mr-2 text-blue-500`}),label:`Clusters`},c&&{key:`roles`,to:`${n}/roles`,icon:(0,H.jsx)(Kr,{className:`size-4 mr-2 text-purple`}),label:`Roles`},c&&{key:`users`,to:`${n}/users`,icon:(0,H.jsx)(oi,{className:`size-4 mr-2 text-orange-500`}),label:`Users`},s&&{key:`billing`,to:`${n}/billing`,icon:(0,H.jsx)(nr,{className:`size-4 mr-2 text-green-500`}),label:`Billing`},o&&{key:`settings`,to:`${n}/settings`,icon:(0,H.jsx)(br,{className:`size-4 mr-2 text-yellow-500`}),label:`Settings`},l&&{key:`add-coupon`,onClick:()=>d(!0),icon:(0,H.jsx)(ti,{className:`size-4 mr-2 text-pink-500`}),label:`Add Coupon`},{type:`separator`,key:`sep-bottom`},{key:`delete`,onClick:f,className:`focus:bg-red/70 focus:text-white`,icon:(0,H.jsx)(ni,{className:`size-4 mr-2 text-red-500`}),label:`Delete`}].filter(di);return(0,H.jsx)(hs,{items:a?p:[],children:(0,H.jsxs)(fn,{className:`relative h-full justify-between transition-[transform,box-shadow] duration-200 hover:scale-[1.02] hover:shadow-lg hover:ring-2 hover:ring-primary/60 dark:hover:ring-violet-400/70`,children:[(0,H.jsx)(I,{to:n,"aria-label":`View ${r??n}`,className:`absolute inset-0 rounded-[inherit] focus-visible:ring-2 focus-visible:ring-purple-200 focus-visible:outline-none`}),(0,H.jsxs)(ln,{children:[(0,H.jsxs)(dn,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:n}),a&&(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{"aria-label":`Options`,onClick:e=>e.stopPropagation(),className:`relative z-10 -m-2 p-2 rounded-md hover:bg-accent/60 hover:text-foreground`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(Zo,{children:ms(p,`dropdown`)})]})]}),(0,H.jsx)(cn,{children:(0,H.jsx)(`h2`,{children:r})})]}),(0,H.jsxs)(un,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(Va,{className:`min-w-0 shrink`,title:ca(i),children:(0,H.jsx)(`span`,{className:`truncate`,children:ca(i)})}),(0,H.jsxs)(`span`,{className:`text-sm shrink-0 py-2 whitespace-nowrap ml-auto`,children:[`View `,(0,H.jsx)(Mn,{className:`inline-block`})]})]}),(0,H.jsx)(Ef,{organizationId:n,organizationName:r,isOpen:u,onClose:()=>d(!1)})]})})}async function Of(e){let{data:t}=await c.delete(`/Organization/${e}`);return t}function kf(){return j({mutationFn:e=>Of(e)})}async function Af(e){let{data:t}=await c.post(`/Organization/`,{...e});return t}function jf(){return j({mutationFn:e=>Af(e)})}var Mf=w().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.`}),Nf=S({name:w().max(255,{error:`Name cannot be longer than 255 characters.`}),subdomain:ie([k(``),te(),Mf]).optional()});function Pf(){let{user:e}=He(),t=L(),n=R({resolver:z(Nf),defaultValues:{name:``,subdomain:``}}),{setFocus:r,watch:a}=n;(0,U.useEffect)(()=>{r(`name`)},[r]);let o=`${e?.firstname} ${e?.lastname} Org`,s=a(`name`)||o,c=a(`subdomain`),l=(0,U.useMemo)(()=>{let e=Sc(wc(s),Mf.maxLength);return{suggestedSubdomain:e,fullHostName:`future-cluster-names.${c||e}.harperfabric.com`}},[s,c]),{mutate:d,isPending:f}=jf(),p=le(),m=(0,U.useCallback)(async e=>{d({name:e.name||o,subdomain:e.subdomain||l.suggestedSubdomain},{onSuccess:e=>{p.invalidateQueries({queryKey:v,refetchType:`active`}),i.reloadUser(u),t({to:`/${e.id}`})}})},[l.suggestedSubdomain,p,d,o,t]);return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(G,{...n,children:(0,H.jsxs)(`form`,{id:`org-add-form`,name:`org-add-form`,onSubmit:n.handleSubmit(m),className:`grid gap-6 text-foreground max-w-xl`,children:[(0,H.jsx)(q,{control:n.control,name:`name`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,maxLength:Nf.shape.name.maxLength,autoCapitalize:`words`,placeholder:o,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:n.control,name:`subdomain`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Subdomain`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,maxLength:Mf.maxLength,autoCapitalize:`none`,placeholder:l.suggestedSubdomain,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Full Host Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(`span`,{children:l.fullHostName})}),(0,H.jsx)(X,{})]}),(0,H.jsx)(Go,{children:(0,H.jsxs)(_,{type:`submit`,variant:`submit`,disabled:f,children:[`Create New Organization `,(0,H.jsx)(Mn,{})]})})]})})})}function Ff(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,H.jsx)(Pf,{})})]})}var If={org:`organization`,clu:`cluster`,ins:`instance`},Lf=/^(org|clu|ins)-[a-z0-9]+$/;function Rf(e){if(typeof e!=`string`)return null;let t=e.trim(),n=Lf.exec(t);return n?{kind:If[n[1]],id:t}:null}function zf(e,t){let n=e*12;return`/Admin/Organization/?${[...t?[`name=ct=${encodeURIComponent(t)}`]:[],`status=ne=DELETED`,`sort(name)`,`limit(${n},${n+12+1})`].join(`&`)}`}async function Bf(e,t){let{data:n}=await c.get(zf(e,t));return{organizations:n.slice(0,12),hasNextPage:n.length>12}}var Vf={organizations:[],hasNextPage:!1};function Hf(e){return e instanceof x&&(e.response?.status===404||e.status===404)}async function Uf(e){try{let{data:t}=await c.get(`/Admin/Organization/${e}`);return t?{organizations:[t],hasNextPage:!1}:Vf}catch(e){if(Hf(e))return Vf;throw e}}async function Wf(e){try{let{data:t}=await c.get(`/Cluster/${e}`),n=t?.organizationId;return n?await Uf(n):Vf}catch(e){if(Hf(e))return Vf;throw e}}function Gf(e,t){let n=Rf(t);return F({queryKey:[`admin-all-organizations`,t,e],queryFn:()=>n?.kind===`organization`?Uf(n.id):n?.kind===`cluster`?Wf(n.id):Bf(e,t),placeholderData:ae,retry:!1})}function Kf(e,t=300,n){let[r,i]=(0,U.useState)(e);return(0,U.useEffect)(()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},[n?n(e):e,t]),r}function qf(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 Jf(e,t){let[n,r]=(0,U.useState)(t),[i,a]=(0,U.useState)(e);return(0,U.useEffect)(()=>{qf(n,t)||(r(t),a(e))},[n,t,e]),qf(n,t)?[i,a]:[e,a]}var Yf={};function Xf(e,t,n){let r=(0,U.useCallback)((e,n)=>t(e,n),[n]);(0,U.useEffect)(()=>(Yf[e]||(Yf[e]=[]),Yf[e].push(r),function(){let t=Yf[e].indexOf(r);t>=0&&Yf[e].splice(t,1)}),[e,t,r])}function Zf(e,t,n){let r=Yf[e];if(r)for(let e of r)e(t,n)}function Qf(e,t,n){return r=>Zf(e,t,n??r)}function $f(e,t,n){return(0,U.useCallback)(r=>Zf(e,t,n??r),[e,t,n])}function ep(e,t){return bn(sessionStorage.getItem(String(e)))??t}function tp(e,t){t==null?sessionStorage.removeItem(String(e)):sessionStorage.setItem(String(e),JSON.stringify(t))}function np(e,t){let n=Jf(ep(e,t),[e]),[r,i]=n;return(0,U.useEffect)(()=>{tp(e,r),Zf(`Session:${e}`,r)},[e,r]),Xf(`Session:${e}`,function(e){r!==e&&i(e)},[r,e,t]),(0,U.useEffect)(function(){let n=n=>{n.key===e&&i(ep(e,t))};return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}},[e,i,t]),n}function rp(){let e=le(),{data:t}=ue(s()),{mutate:n,isPending:r}=kf(),[i,a]=(0,U.useState)(!1),[o,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(``),d=(0,U.useCallback)(()=>u(``),[]),f=Be(),[p,m]=np(`ShowAllOrganizations`,!1),[h,g]=(0,U.useState)(0),v=f&&p,y=(0,U.useCallback)(e=>{m(e),g(0)},[m]),b=Kf(l,300),x=(0,U.useMemo)(()=>{if(!f)return null;let e=Rf(b);return e?.kind===`organization`||e?.kind===`cluster`?e:null},[f,b]),S=v||!!x,{data:C,isPending:w}=N({...Gf(h,b),enabled:S}),{organizationRoles:T,oauthLockedOrgs:E}=(0,U.useMemo)(()=>{let e=t?.roles||{},n=[],r=[];for(let[t,i]of Object.entries(e))`oauthProviders`in i&&!f?r.push({organizationId:t,organizationName:i.organizationName,providers:i.oauthProviders}):n.push({organizationId:t,organizationName:i.organizationName,roleName:i.role??`fabric admin`});return{organizationRoles:n.filter(ad([`organizationId`,`organizationName`],l)).sort((e,t)=>(e.organizationName||``)>(t.organizationName||``)?1:-1),oauthLockedOrgs:r}},[l,t?.roles,f]),ee=(0,U.useMemo)(()=>{let e=t?.roles||{};return(C?.organizations||[]).map(t=>({organizationId:t.id,organizationName:t.name,roleName:e[t.id]?.role||`fabric admin`}))},[C?.organizations,t?.roles]),D=S?ee:T,O=(0,U.useCallback)(e=>{u(e.currentTarget.value||``),g(0)},[]),k=(0,U.useCallback)(t=>{t?.organizationId&&n(t.organizationId,{onSuccess:()=>{B.success(`Success`,{description:`Organization successfully deleted.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),e.invalidateQueries({queryKey:[]}),a(!1)},onError:()=>a(!1)})},[n,e,a]),A=(0,U.useCallback)(e=>{c(e),a(!0)},[]),{createCluster:te}=pe({strict:!1});return!v&&T.length===1&&!l.length&&te?(0,H.jsx)(he,{to:`/${T[0].organizationId}/new-cluster`,replace:!0}):!v&&!T.length&&!E.length&&!l.length?(0,H.jsx)(Ff,{}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{children:(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-2`,children:[f&&(0,H.jsxs)(`label`,{className:`flex shrink-0 cursor-pointer items-center gap-2 text-xs`,children:[(0,H.jsx)(Qd,{checked:p,onCheckedChange:y,"aria-label":`Show all organizations`}),(0,H.jsx)(`span`,{className:`hidden sm:inline-block`,children:`All Orgs`})]}),(0,H.jsx)(Z,{placeholder:`Filter by name`,className:`inline-block w-full text-xs`,value:l,onChange:O}),(0,H.jsx)(I,{to:`/new-org`,children:(0,H.jsxs)(_,{variant:`positive`,accessKey:`n`,children:[(0,H.jsx)(Rr,{}),(0,H.jsxs)(`span`,{className:`hidden sm:inline-block`,children:[(0,H.jsx)(`u`,{children:`N`}),`ew `,(0,H.jsx)(`span`,{className:`hidden md:inline-block`,children:`Organization`})]})]})})]})}),(0,H.jsxs)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-12`,children:[!S&&E.map(e=>(0,H.jsx)(`div`,{className:`col-span-1 md:col-span-4 lg:col-span-3 2xl:col-span-2`,children:(0,H.jsx)(Sf,{organizationId:e.organizationId,organizationName:e.organizationName,providers:e.providers})},e.organizationId)),S&&w?Array.from({length:12},(e,t)=>(0,H.jsx)(xf,{className:`col-span-1 h-40 md:col-span-4 lg:col-span-3 2xl:col-span-2`},t)):D.map(e=>(0,H.jsx)(`div`,{className:`col-span-1 md:col-span-4 lg:col-span-3 2xl:col-span-2`,children:(0,H.jsx)(Df,{organizationRole:e,onDeleteOrgModal:A})},e.organizationId)),!D.length&&!(S&&w)&&(S||!E.length)&&(0,H.jsxs)(`div`,{className:`col-span-1 md:col-span-12 text-center`,children:[(0,H.jsx)(`h2`,{className:`my-4 text-xl`,children:`No matches found.`}),(0,H.jsx)(_,{variant:`outline`,onClick:d,children:`Clear Filters`})]})]}),S&&(h>0||C?.hasNextPage)&&(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-4 py-6`,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,size:`sm`,className:`select-none`,disabled:h===0,onClick:()=>g(e=>e-1),children:[(0,H.jsx)(jn,{}),`Previous`]}),(0,H.jsxs)(`span`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:[`Page `,h+1]}),(0,H.jsxs)(_,{variant:`defaultOutline`,size:`sm`,className:`select-none`,disabled:!C?.hasNextPage,onClick:()=>g(e=>e+1),children:[`Next`,(0,H.jsx)(Mn,{})]})]})]}),o&&(0,H.jsx)(Jo,{typeOfThingBeingDeleted:`organization`,nameOfThingBeingDeleted:o.organizationName,isModalOpen:i,setIsModalOpen:()=>a(!1),deletionConfirmed:()=>k(o),deletionPending:r})]})}function ip(){let{isLoading:e}=Re(),{createCluster:t}=pe({strict:!1}),[,n]=xn(Cn.SavedClusterState,null);return(0,U.useEffect)(()=>{t&&n(t)},[t,n]),e?(0,H.jsx)(zs,{className:`fixed z-50 translate-1/2`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-gradient-to-r from-violet-100 to-white border-b border-violet-200 dark:from-purple-950 dark:to-zinc-900 dark:border-purple-950 md:px-12`,children:(0,H.jsx)(Wi,{})}),(0,H.jsx)(`main`,{children:(0,H.jsx)(Ee,{})})]})}var ap=[`/`,`/forgot-password`,`/reset-password`,`/sign-in`,`/sign-up`,`/verify-email`];function op(){let e=sd();return!ap.includes(e)&&{redirect:e}}var sp=P({getParentRoute:()=>hi,id:`_dashboardLayout`,component:ip,beforeLoad:({context:e})=>{let t=e.authentication[u];if(t&&!t.isLoading&&!t.user)throw xe({to:`/sign-in`,search:op()})}}),cp=P({getParentRoute:()=>sp,id:`_orgsLayout`});P({getParentRoute:()=>cp,path:`/`,head:()=>({meta:[{title:`Organizations — Harper Fabric`}]}),component:rp}),P({getParentRoute:()=>cp,path:`/new-org`,head:()=>({meta:[{title:`New Organization — Harper Fabric`}]}),component:Ff});var lp=P({getParentRoute:()=>cp,path:`$organizationId`,beforeLoad:async e=>{let{organizationId:t}=e.params;if(!vc(t))throw xe({to:`/`});return{organization:await e.context.queryClient.ensureQueryData(bc(t))}}});P({getParentRoute:()=>lp,path:`/roles`,head:()=>({meta:[{title:`Organization Roles — Harper Fabric`}]}),component:Zd}),P({getParentRoute:()=>lp,path:`/roles/$orgRoleId`,head:()=>({meta:[{title:`Organization Roles — Harper Fabric`}]}),component:Zd}),P({getParentRoute:()=>lp,path:`/users`,head:()=>({meta:[{title:`Organization Users — Harper Fabric`}]}),component:bf}),P({getParentRoute:()=>lp,path:`/users/$orgUserId`,head:()=>({meta:[{title:`Organization Users — Harper Fabric`}]}),component:bf}),P({getParentRoute:()=>lp,path:`/settings`,component:rf}),Od(lp);var up=P({getParentRoute:()=>lp,id:`_clusterLayout`});P({getParentRoute:()=>up,path:`/`,head:()=>({meta:[{title:`Clusters — Harper Fabric`}]}),component:od}),P({getParentRoute:()=>lp,path:`/new-cluster`,head:()=>({meta:[{title:`New Cluster — Harper Fabric`}]}),component:ed}),P({getParentRoute:()=>fp,path:`/edit`,head:()=>({meta:[{title:`Edit Cluster — Harper Fabric`}]}),component:ed}),P({getParentRoute:()=>fp,path:`/edit/$mode`,head:()=>({meta:[{title:`Edit Cluster — Harper Fabric`}]}),component:ed});function dp(){return(0,H.jsx)(Ee,{})}var fp=P({getParentRoute:()=>up,path:`$clusterId`,component:dp,beforeLoad:async({context:e,params:t})=>({cluster:await e.queryClient.ensureQueryData(Sa(t.clusterId))})});function pp(){let{clusterId:e}=M({strict:!1}),t=se(),n=L(),{data:r}=N(Sa(e,!0)),{user:a,isLoading:o}=ze(e),{view:s,update:c}=ys(r?.organizationId,r?.id),[l,u]=(0,U.useState)(!1),f=r?.domains?.[0]?.domain||r?.fqdn||``,[p,m]=Fs(f,f?`https://${f}`:``),v=r?`/${r.organizationId}/${r.id}`:``,y=(0,U.useCallback)(async()=>{if(r){u(!0);try{await i.establishFabricConnectAuth({id:r.id,operationsUrl:g(r)}),await t.invalidate()}catch{B.error(`Could not connect to this cluster through Fabric Connect.`)}finally{u(!1)}}},[r,t]),b=(0,U.useCallback)(()=>{r&&(i.setUserForEntity(r,null),i.flagForFabricConnect(r.id,!1)),n({to:`${v}/sign-in`})},[v,r,n]),x=(0,U.useCallback)(async()=>{if(r){try{await d({instanceClient:h({id:r.id}),entityId:r.id})}catch{}i.setUserForEntity(r,null),i.flagForFabricConnect(r.id,!1),i.flagForBasicAuth(r.id,null),await t.invalidate()}},[r,t]);if(!r)return(0,H.jsx)(hp,{children:(0,H.jsx)(gp,{})});if(!s)return(0,H.jsx)(he,{to:`/${r.organizationId}`,replace:!0});if(Es(r))return(0,H.jsx)(mp,{cluster:r});if(!r.fqdn)return(0,H.jsx)(he,{to:`${v}/instances`,replace:!0});if(r.resetPassword)return c?(0,H.jsx)(he,{to:`${v}/${r.status&&ha.includes(r.status)?`finish-setup`:`starting-up`}`,replace:!0}):(0,H.jsx)(hp,{children:(0,H.jsxs)(`div`,{className:`text-center py-12`,children:[(0,H.jsx)(Wr,{className:`size-12 text-muted-foreground mx-auto mb-4`}),(0,H.jsx)(`h1`,{className:`text-xl font-medium mb-2 text-foreground`,children:`Pending Owner Setup`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-md mx-auto`,children:`This cluster needs an administrator to finish setup before it can be used.`})]})});let S=i.checkForFabricConnect(r.id),C=!!a,w=i.getLastConnectMode(r.id),T=(r.instances??[]).filter(e=>e.status&&!ga.includes(e.status)).length;return(0,H.jsxs)(hp,{children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4 mb-6`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-xl bg-violet-50 text-primary dark:bg-grey-700 dark:text-violet-300 shrink-0`,children:(0,H.jsx)(Wr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light text-foreground`,children:r.name}),(0,H.jsx)(_p,{status:r.status})]}),(0,H.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[T,` `,T===1?`instance`:`instances`]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`a`,{href:`https://${f}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 hover:text-foreground hover:underline`,children:[f,(0,H.jsx)(ar,{className:`size-3`})]}),(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{"aria-label":`Copy cluster URLs`,className:`rounded-md p-1 -m-1 hover:bg-accent/60 hover:text-foreground`,children:(0,H.jsx)(tr,{className:`size-3.5`})}),(0,H.jsxs)(Zo,{align:`start`,children:[(0,H.jsx)(Qo,{onClick:p,children:`Copy host name`}),(0,H.jsx)(Qo,{onClick:m,children:`Copy API URL`})]})]})]})]})]}),o?(0,H.jsx)(gp,{}):C?(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-4 text-sm`,children:[(0,H.jsx)(Kn,{className:`size-4 text-green shrink-0`}),(0,H.jsx)(`span`,{className:`font-medium text-green`,children:S?`Connected via Fabric Connect`:`Signed in directly`}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,S?`through your Harper account`:`session cookie`]})]}),(0,H.jsxs)(I,{to:`${v}/apps`,className:`group flex items-center gap-4 rounded-2xl border-2 border-primary/30 bg-primary/5 p-6 transition-all hover:border-primary hover:bg-primary/10 dark:border-violet-400/30 dark:bg-violet-400/5 dark:hover:border-violet-400 dark:hover:bg-violet-400/10`,children:[(0,H.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-primary/10 text-primary shrink-0 dark:bg-violet-400/15 dark:text-violet-300`,children:(0,H.jsx)(zr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-lg font-medium text-foreground`,children:`Enter cluster`}),(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Open the studio — apps, databases, APIs, logs, and config.`})]}),(0,H.jsx)(Mn,{className:`size-5 text-muted-foreground transition-transform group-hover:translate-x-1`})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-4 text-sm`,children:[S&&(0,H.jsx)(`button`,{type:`button`,onClick:b,className:`text-muted-foreground hover:text-foreground transition-colors`,children:`Switch to direct sign-in`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void x(),className:`text-muted-foreground hover:text-destructive transition-colors`,children:S?`Disconnect`:`Direct sign out`})]})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-foreground mb-3`,children:`Connect to this cluster`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3.5`,children:[c&&!Es(r)&&(0,H.jsx)(vp,{icon:si,title:`Fabric Connect`,description:`Connect through your Harper account. No cluster credentials needed.`,pill:w===`fabric`?`last`:w?void 0:`recommended`,children:(0,H.jsx)(_,{className:`w-full`,disabled:l,onClick:()=>void y(),children:l?(0,H.jsx)(wr,{className:`animate-spin`}):`Fabric Connect`})}),(0,H.jsx)(vp,{icon:br,title:`Direct sign-in`,description:`Sign in with this cluster's Harper username and password.`,pill:w===`direct`?`last`:void 0,children:(0,H.jsx)(_,{className:`w-full`,variant:`outline`,onClick:b,children:`Direct sign-in`})})]})]})]})}function mp({cluster:e}){let t=se(),n=L(),r=`/${e.organizationId}/${e.id}`,a=(0,U.useMemo)(()=>(e.instances??[]).filter(e=>e.status&&!ga.includes(e.status)).sort(nc),[e.instances]),o=a.at(0),{user:s,isLoading:c}=ze(o?.id),l=!!o&&!!s,u=(0,U.useCallback)(()=>{o&&n({to:`${r}/instance/${o.id}/sign-in`})},[r,o,n]),f=(0,U.useCallback)(async()=>{if(o){try{await d({instanceClient:h({id:o.id,operationsUrl:m(o)}),entityId:o.id})}catch{}i.setUserForEntity(o,null),i.flagForBasicAuth(o.id,null),await t.invalidate()}},[o,t]);return(0,H.jsxs)(hp,{children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4 mb-6`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-xl bg-violet-50 text-primary dark:bg-grey-700 dark:text-violet-300 shrink-0`,children:(0,H.jsx)(Wr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light text-foreground`,children:e.name}),(0,H.jsx)(`span`,{className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-0.5 rounded-full text-muted-foreground bg-muted`,children:`Self-Hosted`})]}),(0,H.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:(0,H.jsxs)(I,{to:`${r}/instances`,className:`hover:text-foreground hover:underline`,children:[a.length,` `,a.length===1?`instance`:`instances`]})})]})]}),o?c?(0,H.jsx)(gp,{}):l?(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-4 text-sm`,children:[(0,H.jsx)(Kn,{className:`size-4 text-green shrink-0`}),(0,H.jsx)(`span`,{className:`font-medium text-green`,children:`Signed in directly`}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,o.name||o.instanceFqdn]})]}),(0,H.jsxs)(I,{to:`${r}/instance/${o.id}/`,className:`group flex items-center gap-4 rounded-2xl border-2 border-primary/30 bg-primary/5 p-6 transition-all hover:border-primary hover:bg-primary/10 dark:border-violet-400/30 dark:bg-violet-400/5 dark:hover:border-violet-400 dark:hover:bg-violet-400/10`,children:[(0,H.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-primary/10 text-primary shrink-0 dark:bg-violet-400/15 dark:text-violet-300`,children:(0,H.jsx)(zr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-lg font-medium text-foreground`,children:`Enter cluster`}),(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Open the studio — apps, databases, APIs, logs, and config.`})]}),(0,H.jsx)(Mn,{className:`size-5 text-muted-foreground transition-transform group-hover:translate-x-1`})]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-4 text-sm`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>void f(),className:`text-muted-foreground hover:text-destructive transition-colors`,children:`Direct sign out`})})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-foreground mb-3`,children:`Connect to this cluster`}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3.5`,children:(0,H.jsx)(vp,{icon:br,title:`Direct sign-in`,description:`Sign in with this instance's Harper username and password.`,children:(0,H.jsx)(_,{className:`w-full`,variant:`outline`,onClick:u,children:`Direct sign-in`})})})]}):(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This cluster has no instances yet. Register one from the`,` `,(0,H.jsx)(I,{to:`${r}/instances`,className:`underline hover:text-foreground`,children:`Instances`}),` page.`]})]})}function hp({children:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(Ks,{children:(0,H.jsx)(`div`,{className:`max-w-3xl`,children:e})})]})}function gp(){return(0,H.jsx)(`div`,{className:`flex justify-center py-10 text-muted-foreground`,children:(0,H.jsx)(wr,{className:`size-6 animate-spin`})})}function _p({status:e}){return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-0.5 rounded-full ${e&&ha.includes(e)?`text-green bg-green/10`:`text-muted-foreground bg-muted`}`,children:[(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),e?e.charAt(0)+e.slice(1).toLowerCase():`Unknown`]})}function vp({icon:e,title:t,description:n,pill:r,children:i}){return(0,H.jsxs)(`div`,{className:`relative rounded-xl p-4.5 bg-card border ${r===`last`?`border-2 border-green`:r===`recommended`?`border-2 border-primary dark:border-violet-400`:`border-border`}`,children:[r&&(0,H.jsx)(`span`,{className:`absolute -top-2.5 left-4 rounded-full bg-card`,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-0.5 rounded-full ${r===`last`?`text-green bg-green/15`:`text-primary bg-violet-50 dark:text-violet-300 dark:bg-grey-700`}`,children:[r===`last`&&(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),r===`last`?`Last used`:`Recommended`]})}),(0,H.jsx)(e,{className:`size-6 text-primary dark:text-violet-300 mb-2`}),(0,H.jsx)(`div`,{className:`text-[15px] font-medium text-foreground mb-1`,children:t}),(0,H.jsx)(`p`,{className:`text-[13px] text-muted-foreground leading-normal mb-4`,children:n}),i]})}function yp({children:e,className:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(Ks,{children:(0,H.jsx)(`div`,{className:t,children:e})})]})}var bp=new Set([`com`,`co`,`org`,`net`,`edu`,`gov`,`mil`,`me`,`biz`,`info`,`ac`,`or`,`ne`,`go`,`lg`,`asn`,`id`,`nom`,`sch`,`ltd`,`plc`]);function xp(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&&bp.has(r)?3:2;return t.length<=i?`@`:t.slice(0,-i).join(`.`)}function Sp({cluster:{fqdn:e},domain:{domain:t,id:n}}){let r=xp(t),[i,a,o]=Fs(r,e||``,n);return(0,H.jsxs)(`div`,{className:`grid gap-4 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,H.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,H.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:i,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:a,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:o,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]})}),(0,H.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 Cp({certificate:e,domain:t,cluster:n}){let r=xp(t.domain),[i,a,o]=Fs(r,n.fqdn||``,t.id),s=(0,U.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,H.jsxs)(`div`,{className:`w-full max-w-2xl border border-border/50 rounded-md p-4 bg-gray-900/20`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`div`,{className:`w-full h-1.5 rounded-full overflow-clip flex shadow-sm bg-gray-800`,children:(0,H.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,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground font-light mt-1 italic`,children:s.text})]}),(0,H.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] text-sm`,children:[(0,H.jsx)(`div`,{className:`col-span-1 text-xs text-muted-foreground`,children:`CNAME:`}),(0,H.jsxs)(`div`,{className:`col-span-1 flex gap-2 items-center flex-wrap`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted px-2 py-0.5 rounded text-xs`,children:[(0,H.jsx)(`span`,{className:`truncate max-w-[150px]`,title:r,children:r}),(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:i,title:`Copy Name`,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]}),(0,H.jsx)(wp,{}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted px-2 py-0.5 rounded text-xs`,children:[(0,H.jsx)(`span`,{className:`truncate max-w-[200px]`,title:n.fqdn||``,children:n.fqdn}),(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:a,title:`Copy Target`,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]})]}),(0,H.jsx)(`div`,{className:`col-span-1 text-[10px] text-muted-foreground`,children:`Domain ID:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted px-2 py-0.5 rounded text-[10px] text-muted-foreground italic`,children:[(0,H.jsx)(`span`,{className:`truncate max-w-[200px]`,children:t.id}),(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`h-3 w-3 p-0`,onClick:o,title:`Copy ID`,children:(0,H.jsx)(tr,{className:`w-2.5 h-2.5`})})]})})]})]})}function wp(){return(0,H.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,H.jsx)(`path`,{d:`M5 12h14`}),(0,H.jsx)(`path`,{d:`m12 5 7 7-7 7`})]})}function Tp(e){let{enabled:t,entityId:n,databaseName:r,tableName:i,searchAttribute:a,sort:o,pageIndex:s,pageSize:c,onlyIfCached:l,getAttributes:u}=e;return F({enabled:t,queryKey:[n,r,i,`search_by_value`,a,o.attribute||`default`,o.descending||!1,s||0,c||0,l,u??null],retry:!1,staleTime:6e4,gcTime:5e3,queryFn:()=>Ep(e)})}async function Ep({instanceClient:e,databaseName:t,tableName:n,searchAttribute:r,sort:i,pageIndex:a,pageSize:o,onlyIfCached:s,getAttributes:c,headers:l}){let u=i.attribute.length&&!(i.attribute===r&&!i.descending),d=await e.post(`/`,{operation:`search_by_value`,get_attributes:c??[`*`],database:t,table:n,search_attribute:r,search_value:`*`,sort:u?i:void 0,offset:a*o,limit:o,onlyIfCached:s,noCacheStore:s},{timeout:0,headers:l,validateStatus:e=>e>=200&&e<400||e===404});return d.status===404?{data:[]}:d}function Dp(e){return F({queryKey:[e,`ChallengeCertificate`],queryFn:async()=>{if(!e)return[];let{data:t}=await Ep({searchAttribute:`domain`,entityId:e,databaseName:`data`,tableName:`ChallengeCertificate`,sort:{attribute:`domain`,descending:!0},instanceClient:h({id:e,forceFabricConnect:!0}),onlyIfCached:!1,pageIndex:0,pageSize:100});return t},enabled:!!e,refetchInterval:5e3})}function Op(e){return N(Dp(e))}function kp({domain:{challengeToken:e,challengeTxtRecord:t,domain:n,id:r},cluster:{fqdn:i}}){let a=xp(n),[o,s,c,l,u]=Fs(t,e,a,i||``,r);return(0,H.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,H.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,H.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TXT`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:o,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Content:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:s,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.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,H.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:c,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:l,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:u,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]})}),(0,H.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 Ap({clusterId:e,domainIds:t,generateDomainCerts:n}){let{data:r}=await c.put(`/Cluster/${e}`,{domainIds:t,generateDomainCerts:n},{timeout:0});return r}function jp(){return j({mutationFn:e=>Ap(e)})}A.object({domainId:A.string()});async function Mp(e){let{data:t}=await c.delete(`/Domain/${e.domainId}`);return t}function Np(){return j({mutationFn:e=>Mp(e)})}function Pp(e){return[...new Set(e)]}var Fp=me();function Ip(e,t,n){let{data:r}=Op(e.id),i=(0,U.useMemo)(()=>!!r?.some(e=>!e.issueDate||e.inProgress),[r]),{mutate:a,isPending:o}=jp(),{mutate:s,isPending:c}=Np(),l=o||c,u=(0,U.useCallback)((t,n)=>{if(!Co(e.status)){B.error(`Cluster is currently `+e.status,{description:`To bind a domain, it must be running.`});return}a({clusterId:e.id,domainIds:Pp((e.domainIds?.slice()||[]).concat([t])),generateDomainCerts:n},{onSuccess:()=>{yn.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),B.success(`Domain bound!`+(n?` Certificates are being generated in the background now.`:``))}})},[a,e]),d=(0,U.useCallback)(t=>{s({domainId:t},{onSuccess:()=>{yn.invalidateQueries({queryKey:[e.organizationId,`domains`],refetchType:`active`}),B.success(`Domain removed!`)}})},[s]),f=(0,U.useCallback)(t=>{a({clusterId:e.id,domainIds:(e.domainIds?.slice()||[]).filter(e=>e!==t),generateDomainCerts:!1},{onSuccess:()=>{yn.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),B.success(`Domain unbound!`)}})},[s]);return(0,U.useMemo)(()=>[Fp.display({id:`select`,header:`Bind`,size:50,cell:r=>{let a=r.row.original;return a.status===`ACTIVE`&&!a.clusterId&&!Es(e)?(0,H.jsx)(`label`,{className:`p-10 -m-10`,children:(0,H.jsx)(`input`,{type:`checkbox`,checked:t.includes(a.id),onChange:()=>n(a.id),disabled:l||i})}):null}}),Fp.display({header:`Domains`,id:`domain`,enableSorting:!1,size:150,cell:e=>{let t=e.row.original;return(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{children:t.domain}),(0,H.jsx)(_,{type:`button`,variant:`destructiveGhost`,className:`text-muted-foreground text-xs`,disabled:l||!!t.clusterId,onClick:()=>d(t.id),children:`Remove Domain`})]})}),(0,H.jsx)(Mi,{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!`})]})}}),Fp.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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{children:`Bound to this cluster`}),i&&(!i.issueDate||i.inProgress)&&(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(Cp,{certificate:i,domain:n,cluster:e})}),(0,H.jsx)(_,{type:`button`,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,H.jsx)(kp,{domain:n,cluster:e}):Es(e)?`Cannot be associated with this self-managed cluster.`:n.status===`ACTIVE`&&!n.clusterId?(0,H.jsx)(Sp,{cluster:e,domain:n}):n.status}})],[e,u,l,r,i,t,n])}var Lp=A.object({domain:A.string(),organizationId:A.string()});async function Rp(e){let{data:t}=await c.post(`/Domain/`,e);return t}function zp(){return j({mutationFn:e=>Rp(e)})}async function Bp(e){let{data:t}=await c.post(`/Domain/${e}/validate`);return t}async function Vp(e){let{data:t}=await c.get(`/Domain/?organizationId=${e}`);return t}function Hp(e){return F({queryKey:[e,`domains`],queryFn:()=>Vp(e)})}function Up(){let{organizationId:e,clusterId:t}=M({strict:!1}),{data:n}=ue(Sa(t,!0)),{update:r}=vs(e),{data:i,refetch:a,isFetching:o,isRefetching:s}=N(Hp(e)),c=(0,U.useMemo)(()=>i?.filter(e=>e.status===`PENDING_VALIDATION`)||[],[i]),[u]=(0,U.useState)({attribute:`domain`,descending:!1}),d=(0,U.useMemo)(()=>[{desc:u.descending,id:u.attribute}],[u]),f=wd(a),[p,m]=(0,U.useState)([]),h=(0,U.useCallback)(e=>{m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{mutate:g,isPending:v}=jp(),y=(0,U.useCallback)(()=>{if(!Co(n.status)){B.error(`Cluster is currently `+n.status,{description:`To bind a domain, it must be running.`});return}g({clusterId:n.id,domainIds:Pp((n.domainIds?.slice()||[]).concat(p)),generateDomainCerts:!0},{onSuccess:()=>{yn.invalidateQueries({queryKey:[n.organizationId],refetchType:`active`}),B.success(`Domain(s) bound! Certificates are being generated in the background now.`),m([])}})},[n,p,g]),{mutateAsync:b,isPending:x}=zp(),S=R({resolver:z(Lp),defaultValues:{domain:``,organizationId:e}}),C=(0,U.useCallback)(async e=>{if(e){let t=e.domain.split(/[,\s]+/).map(e=>e.trim()).filter(Boolean);for(let n of t)await b({...e,domain:n});S.reset(),await a(),B.success(`${l(t.length,`Domain`,`Domains`)} added! Please add the txt record above to your domain registrar.`)}},[b,S,a]),w=(0,U.useCallback)(async()=>{let e=`Validating ${l(c.length,`domain`,`domains`)}...`,t=`validatingDomains`,n=0,r=0;for(let i of c)try{B.loading(e,{description:`${n++} of ${c.length} checked`,id:t}),await Bp(i.id)}catch{r+=1}r>0?B.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(),B.success(`Validation succeeded!`,{description:`Please take a look at the next steps for newly verified domains.`,id:t}))},[c]),T=Ip(n,p,h),E=S.watch(`domain`),ee=(0,U.useMemo)(()=>typeof E==`string`&&E.trim().split(`.`).length===2,[E]),D=(0,U.useCallback)(()=>{typeof E==`string`&&S.setValue(`domain`,`${E.trim()}, www.${E.trim()}`)},[E,S]);return(0,H.jsx)(yd,{data:i||[],isFetching:o||s,columns:T,sortingState:d,children:(0,H.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,H.jsx)(G,{...S,children:(0,H.jsxs)(`form`,{id:`cluster-add-domain-form`,name:`cluster-add-domain-form`,onSubmit:S.handleSubmit(C),className:`flex gap-1 flex-col md:flex-row`,children:[(0,H.jsx)(q,{control:S.control,name:`domain`,render:({field:e})=>(0,H.jsxs)(J,{className:`flex-1`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`New Domain Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,enterKeyHint:`done`,autoComplete:`off`,...e})}),ee&&(0,H.jsxs)(`div`,{className:`mt-1 flex gap-4`,children:[`Adding an apex domain?`,(0,H.jsx)(_,{variant:`positiveOutline`,type:`button`,onClick:D,children:`Add www as well`})]}),(0,H.jsx)(X,{children:(0,H.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,H.jsxs)(`div`,{className:`flex-0 self-start flex gap-1 md:pt-6.5`,children:[(0,H.jsxs)(_,{type:`submit`,variant:`submit`,disabled:x,children:[(0,H.jsx)(Rr,{}),` Add`]}),c.length>0&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:w,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,H.jsx)(Cr,{}),` `,(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`V`}),`alidate`]})]}),(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:f,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,H.jsx)(hn,{}),` `,(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]})]})]})}),p.length>0&&(0,H.jsx)(`div`,{className:`flex-0 self-start md:pt-6.5`,children:(0,H.jsxs)(_,{variant:`submit`,onClick:y,disabled:v,children:[(0,H.jsx)(Vr,{}),` Bind `,l(p.length,`Domain`,`Domains`)]})})]})})}function Wp(){return(0,H.jsx)(yp,{className:`flex flex-col justify-start max-w-4xl`,children:(0,H.jsx)(Up,{})})}var Gp=S({username:Ta,role:w().nonempty({error:`Please select a role.`}),password:wa.min(8,{error:`Password must be at least 8 characters long.`}),confirmPassword:w()}).refine(e=>e.password===e.confirmPassword,{error:`Passwords do not match.`,path:[`confirmPassword`]});async function Kp(e){await c.patch(`/ResetPasswordUpdater/${e}`)}async function qp(e){let{instanceClient:t,...n}=e,{data:r}=await t.post(`/`,{operation:`add_user`,...n});return r}function Jp(){return j({mutationFn:qp})}async function Yp({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 Xp(){return j({mutationFn:Yp})}async function Zp({username:e,instanceClient:t}){let{data:n}=await t.post(`/`,{operation:`drop_user`,username:e});return n}function Qp(){return j({mutationFn:Zp})}async function $p({clusterId:e,initialUsername:t,desiredUsername:n,newPassword:i,tempPassword:a,instanceClient:o}){if(!a)throw Error(`You may not have permission to set the password on this cluster.`);let s=o;try{let o=await va({username:t,password:a,instanceClient:s,entityId:e});return o.instanceClient&&(s=o.instanceClient),n===`HDB_ADMIN`?await Yp({username:n,password:i,instanceClient:s}):(await qp({username:n,password:i,role:`super_user`,active:!0,instanceClient:s}),await va({username:n,password:i,instanceClient:s,entityId:e}),await Zp({username:r,instanceClient:s})),await Kp(e),o}catch(t){throw await d({entityId:e,instanceClient:s}),t}}function em(){return j({mutationFn:$p})}function tm(){let{user:e}=He(),{clusterId:t}=M({strict:!1}),{data:n}=N(Sa(t,!0)),a=L(),o=(0,U.useMemo)(()=>g(n),[n]),s=Fi({operationsUrl:o}),{redirect:c}=pe({strict:!1}),l=se(),u=R({resolver:z(Gp),defaultValues:{confirmPassword:``,password:``,role:`super_user`,username:e?.email??``}}),{setFocus:d,control:f,handleSubmit:p}=u;(0,U.useEffect)(()=>{d(`password`)},[d]);let m=n?.instances?.find(e=>e.tempPassword)?.tempPassword,{mutate:h,isPending:v}=em(),y=(0,U.useCallback)(async e=>{if(!o){B.error(`Cluster is not yet fully loaded, please wait a moment before trying to sign in.`);return}h({instanceClient:s,clusterId:t,newPassword:e.password,tempPassword:m,initialUsername:r,desiredUsername:e.username},{onSuccess:async({message:e,user:t})=>{B.success(e),i.setUserForEntity(n,t),l.invalidate(),await a({to:c?.startsWith(`/`)?c:`../`})}})},[n,t,s,a,o,c,l,h,m]);return n&&!n.resetPassword?(0,H.jsx)(he,{to:`../sign-in`,replace:!0}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`fixed top-20 w-full h-12 z-39 px-4 md:px-12 bg-violet-50 border-b border-violet-100 dark:bg-grey-700 dark:border-none flex items-center`,children:(0,H.jsx)(ua,{})}),(0,H.jsx)(`div`,{className:`items-center justify-center flex mt-32 py-4 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,H.jsxs)(`div`,{className:`text-foreground w-xs`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light`,children:`Create Admin User`}),(0,H.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,H.jsx)(G,{...u,children:(0,H.jsxs)(`form`,{id:`cluster-create-admin-form`,name:`cluster-create-admin-form`,onSubmit:p(y),className:`my-4`,children:[(0,H.jsx)(q,{control:f,name:`username`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Username`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{autoComplete:`username`,type:`text`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f,name:`password`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,autoComplete:`new-password`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f,name:`confirmPassword`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Confirm Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,autoComplete:`new-password`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(_,{disabled:v,type:`submit`,variant:`submit`,className:`w-full my-2`,children:`Create Admin User`})]})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground flex gap-2 align-middle`,children:[(0,H.jsx)(On,{size:36,className:`flex-none`}),(0,H.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 nm({columns:e,data:t,renderRowWrapper:n}){let r=be({data:t,columns:e,getCoreRowModel:Te()});return(0,H.jsx)(`div`,{className:`bg-card dark:bg-black-dark rounded-md`,children:(0,H.jsxs)(fd,{children:[(0,H.jsx)(pd,{children:r.getHeaderGroups().map(e=>(0,H.jsx)(hd,{className:`border-none`,children:e.headers.map(e=>(0,H.jsx)(gd,{className:`p-4`,style:{width:`${e.getSize()}%`},children:e.isPlaceholder?null:De(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(md,{className:`bg-background dark:bg-black`,children:r.getRowModel().rows?.length?r.getRowModel().rows.map(e=>{let t=(0,H.jsx)(hd,{"data-state":e.getIsSelected()&&`selected`,className:`hover:bg-muted/10 data-[state=selected]:bg-muted`,children:e.getVisibleCells().map(e=>(0,H.jsx)(vd,{className:`p-4`,style:{width:`${e.column.getSize()}%`},children:De(e.column.columnDef.cell,e.getContext())},e.id))});return(0,H.jsx)(U.Fragment,{children:n?n(e.original,t):t},e.id)}):(0,H.jsx)(hd,{children:(0,H.jsx)(vd,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})})}function rm(){return(0,H.jsx)(`div`,{className:`flex-col items-center justify-center px-16 space-y-3 text-center pt-30`,children:(0,H.jsx)(`p`,{children:`No instances found.`})})}async function im({instance:e,instanceClient:t}){try{await d({instanceClient:t,entityId:e.id})}catch{}i.signOutLocally(e.id),e.clusterId&&i.signOutLocally(e.clusterId)}function am({entityId:e,instanceClient:t},n){return F({queryKey:[`get_status`,e],staleTime:9e3,refetchInterval:1e4,retryDelay:1e4,throwOnError:!1,enabled:n,queryFn:async()=>{let{data:e}=await t.post(`/`,{operation:`get_status`});return e}})}function om(e,t){return e?.systemStatus?.find(e=>e.id===t)?.status}async function sm({instanceClient:e,id:t,status:n}){let{data:r}=await e.post(`/`,{operation:`set_status`,id:t,status:n});return r}function cm(){return j({mutationFn:sm,onSuccess:(e,t)=>yn.invalidateQueries({queryKey:[`get_status`,t.entityId]})})}var lm=[`CLONE_READY`,`RUNNING`,`UPDATED`,`PENDING_UPGRADE`];function um(e,t,n){let{user:r}=ze(e.id),a=(0,U.useMemo)(()=>m(e),[e]),o=Fi({operationsUrl:a}),{update:s}=xs(),c=i.checkForFabricConnect(e.id),l=W({operationsUrl:a,instanceId:e.id,forceFabricConnect:!0}),{data:u}=N(am(l,n&&s)),d=om(u,`availability`)||`Unknown`,f=d===`Available`,p=d===`Unavailable`,{mutate:h,isPending:g}=cm(),_=e.instanceFqdn,v=Gu({secure:e.operationsApiSecure?`true`:`false`,port:e.operationsApiPort,fqdn:e.instanceFqdn}),[y,b]=Fs(_??``,v),x=(0,U.useCallback)(async()=>{await im({instance:e,instanceClient:o})},[e,o]),S=!!e.status&&lm.includes(e.status),C=!!r&&!c,w=S,T=!!_,E=s&&S&&(f||p),ee=[w&&C&&{key:`direct-connect`,to:`../instance/${e.id}/`,icon:(0,H.jsx)(Wr,{className:`text-green`}),label:`Direct Connect`},w&&C&&{key:`direct-sign-out`,onClick:x,variant:`destructive`,icon:(0,H.jsx)(Dr,{}),label:`Direct Sign Out`},w&&!C&&s&&!t&&{key:`fabric-connect`,to:`../instance/${e.id}/`,icon:(0,H.jsx)(Wr,{className:`text-green`}),label:`Fabric Connect`},w&&!C&&{key:`direct-sign-in`,to:`../instance/${e.id}/sign-in`,icon:(0,H.jsx)(Er,{}),label:`Direct Sign In`},w&&T&&{type:`separator`,key:`copy-sep`},T&&{key:`copy-fqdn`,onClick:y,icon:(0,H.jsx)(Xn,{}),label:`Copy Instance FQDN`},T&&{key:`copy-api`,onClick:b,icon:(0,H.jsx)(Xn,{}),label:`Copy API URL`},(w||T)&&E&&{type:`separator`,key:`rotation-sep`},E&&f&&{key:`out-of-rotation`,variant:`destructive`,disabled:g,onClick:()=>h({...l,id:`availability`,status:`Unavailable`}),icon:(0,H.jsx)(qr,{}),label:`Bring out of rotation`},E&&p&&{key:`into-rotation`,disabled:g,onClick:()=>h({...l,id:`availability`,status:`Available`}),icon:(0,H.jsx)(Kr,{}),label:`Bring back into rotation`}].filter(di);return ee.length?[{type:`label`,key:`label`,className:`text-gray-600 text-xs`,label:`Options`},{type:`separator`,key:`label-sep`},...ee]:[]}function dm({instance:e,isSelfManaged:t}){let[n,r]=(0,U.useState)(!1),i=um(e,t,n);return i.length?(0,H.jsxs)(Yo,{open:n,onOpenChange:r,children:[(0,H.jsx)(Xo,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Instance options`,children:(0,H.jsx)(ir,{})})}),(0,H.jsx)(Zo,{align:`end`,className:`min-w-48`,children:ms(i,`dropdown`)})]}):null}function fm({isSelfManaged:e,instance:t}){let{user:n,isLoading:r}=ze(t.id),a=Fi({operationsUrl:(0,U.useMemo)(()=>m(t),[t])}),{update:o}=xs(),s=i.checkForFabricConnect(t.id),c=(0,U.useCallback)(async()=>{await im({instance:t,instanceClient:a})},[t,a]);return r||!t.status||![`CLONE_READY`,`RUNNING`,`UPDATED`,`PENDING_UPGRADE`].includes(t.status)?(0,H.jsx)(wr,{className:`animate-spin`,color:`gray`}):!n||s?(0,H.jsxs)(`span`,{className:`flex gap-4`,children:[o&&!e&&(0,H.jsx)(I,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Connect to ${t.name} instance`,title:`Connect to ${t.name} instance`,children:(0,H.jsx)(_,{variant:`positiveOutline`,children:`Fabric Connect`})}),(0,H.jsx)(I,{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,H.jsx)(_,{variant:o?`defaultOutline`:`positiveOutline`,children:`Direct Sign In`})})]}):(0,H.jsxs)(`span`,{className:`flex gap-4`,children:[(0,H.jsx)(I,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Go to ${t.name} instance`,title:`Go to ${t.name} instance`,children:(0,H.jsx)(_,{variant:`positiveOutline`,children:`Direct Connect`})}),(0,H.jsx)(_,{variant:`destructiveOutline`,className:`text-sm`,"aria-label":`Sign out from ${t.name} instance`,title:`Sign out from ${t.name} instance`,onClick:c,children:`Direct Sign Out`})]})}function pm({instance:e,isSelfManaged:t,children:n}){let[r,i]=(0,U.useState)(!1),a=um(e,t,r);return a.length?(0,H.jsxs)(os,{onOpenChange:i,children:[(0,H.jsx)(ss,{asChild:!0,children:n}),(0,H.jsx)(cs,{className:`min-w-48`,children:ms(a,`context`)})]}):(0,H.jsx)(H.Fragment,{children:n})}function mm({instance:e,index:t}){let{update:n}=xs(),r=W({operationsUrl:(0,U.useMemo)(()=>m(e),[e]),instanceId:e.id,forceFabricConnect:!0}),{mutate:i,isPending:a}=cm(),[o,s]=(0,U.useState)(!1);(0,U.useEffect)(()=>{let e=setTimeout(()=>s(!0),t*500);return()=>clearTimeout(e)},[t]);let{data:c,isLoading:l,isFetching:u}=N(am(r,o&&n)),d=om(c,`availability`)||`Unknown`,f=d===`Available`,p=d===`Unavailable`;return n?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(`div`,{className:`flex items-center`,children:l||!o||u&&!c?(0,H.jsx)(wr,{className:`animate-spin size-5 text-muted-foreground`}):(0,H.jsx)(Va,{variant:f?`success`:p?`destructive`:`default`,className:`size-4 rounded-full p-0`,children:(0,H.jsx)(`span`,{className:`sr-only`,children:f?`Online`:`Offline`})})})}),(0,H.jsxs)(Mi,{children:[u&&c?`Refreshing... `:``,d]})]}),n&&(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[f&&(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`destructiveGhost`,size:`icon`,onClick:()=>i({...r,id:`availability`,status:`Unavailable`}),disabled:a,children:a?(0,H.jsx)(wr,{className:`animate-spin size-4`}):(0,H.jsx)(qr,{className:`size-4`})})}),(0,H.jsx)(Mi,{children:`Bring out of rotation`})]}),p&&(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i({...r,id:`availability`,status:`Available`}),disabled:a,children:a?(0,H.jsx)(wr,{className:`animate-spin size-4`}):(0,H.jsx)(Kr,{className:`size-4`})})}),(0,H.jsx)(Mi,{children:`Bring back into rotation`})]})]})]}):null}function hm(){let{clusterId:e}=M({strict:!1}),{data:t,isLoading:n}=N(Sa(e,!0)),r=Es(t),i=(0,U.useMemo)(()=>[{id:`instanceActions`,size:1,minSize:1,cell:e=>(0,H.jsx)(`div`,{className:`flex justify-end gap-2 items-center`,children:(0,H.jsx)(fm,{isSelfManaged:r,instance:e.row.original})})},r&&{accessorKey:`instanceFqdn`,size:90,header:`URL`,cell:e=>Gu({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,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(mm,{instance:e.row.original,index:e.row.index}),t?(0,H.jsx)(Va,{variant:So(t),children:ca(t)}):null]})}},!r&&{accessorKey:`version`,size:1,minSize:1,header:`Version`},!r&&{accessorKey:`storageGb`,size:1,minSize:1,header:`Storage`,cell:e=>`${e.getValue()} GB`},!r&&{accessorKey:`usedStorageGb`,size:1,minSize:1,header:`Used Storage`,cell:e=>{let t=e.getValue();return t===void 0?`-`:`${t} GB`}},!r&&{accessorKey:`cpuCores`,size:1,minSize:1,header:`Cores/Threads`,cell:e=>(0,H.jsxs)(H.Fragment,{children:[e.row.original.cpuCores,` / `,e.row.original.threads]})},!r&&{accessorKey:`memoryMb`,size:1,minSize:1,header:`Memory`,cell:e=>`${e.getValue()/1024} GB`},{id:`instanceMenu`,size:1,minSize:1,cell:e=>(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsx)(dm,{isSelfManaged:r,instance:e.row.original})})}].filter(di),[r]),a=(0,U.useMemo)(()=>t?.instances?t.instances.filter(e=>e.status&&!ga.includes(e.status)).sort(nc):[],[t]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(Ks,{children:(0,H.jsx)(fn,{className:`p-0 min-h-96`,children:(0,H.jsx)(un,{className:`p-0 min-h-96`,children:n?(0,H.jsx)(ou,{}):a.length?(0,H.jsx)(nm,{data:a,columns:i,renderRowWrapper:(e,t)=>(0,H.jsx)(pm,{instance:e,isSelfManaged:r,children:t})}):(0,H.jsx)(rm,{})})})})]})}function gm(){let{clusterId:e}=M({strict:!1}),{immediate:t}=pe({strict:!1}),n=t===!0||t===`true`,{data:r,isLoading:i}=N(Sa(e,2e3)),a=r?.status,o=(0,U.useMemo)(()=>a&&ha.includes(a),[a]);return i||!r?(0,H.jsx)(yp,{className:`flex justify-center`,children:(0,H.jsx)(ou,{})}):o?(0,H.jsx)(yp,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`All done!`}),(0,H.jsx)(As,{cluster:r,forceProgressBarVisible:!0}),(0,H.jsx)(`p`,{children:`Your cluster finished updating, and is ready for interaction.`}),(0,H.jsx)(`div`,{className:`text-center`,children:(0,H.jsx)(Ds,{cluster:r})})]})}):(0,H.jsx)(yp,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,H.jsx)(As,{cluster:r,forceProgressBarVisible:!0}),(0,H.jsxs)(`p`,{children:[n?`Your cluster is applying the latest changes immediately, without waiting to take instances out of rotation.`:`Your cluster is updating with the latest changes. This includes waiting several minutes to let traffic drain safely.`,` `,(0,H.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,H.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 _m({children:e,className:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(`div`,{className:b(`mt-32 px-4 py-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))] flex justify-center`,t),children:e})]})}function vm(){let e=se(),{clusterId:t}=M({strict:!1}),{data:n,isLoading:r}=N(Sa(t,2e3)),i=n?.status,a=(0,U.useMemo)(()=>i&&ha.includes(i),[i]),o=wo(i),[,s]=xn(Cn.SavedClusterState,null),c=(0,U.useCallback)(()=>{s(n),e.navigate({to:`/${n.organizationId}/new-cluster`})},[n,e,s]);return r||!n?(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsx)(ou,{})}):o?(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4 items-center`,children:[(0,H.jsx)(Zn,{className:`w-24 h-24`}),(0,H.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,H.jsx)(Rs,{}),` if you want more help.`]}),(0,H.jsx)(_,{type:`button`,variant:`positiveOutline`,onClick:c,children:`Try Again`})]})}):a?(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`It's ready!`}),(0,H.jsx)(As,{cluster:n,forceProgressBarVisible:!0}),(0,H.jsxs)(`p`,{children:[`Let's set up your secure, browser-to-cluster connection now.`,` `,(0,H.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,H.jsx)(`em`,{children:`Direct Connect`}),`! Once you create your user, you will have the option to`,` `,(0,H.jsx)(`em`,{children:`Fabric Connect`}),` from your Fabric account without having to sign in again.`]})]}),(0,H.jsx)(`div`,{className:`text-center`,children:(0,H.jsx)(Ds,{cluster:n})})]})}):(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,H.jsx)(As,{cluster:n,forceProgressBarVisible:!0}),(0,H.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,H.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,H.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.`]})]})]})})}P({getParentRoute:()=>fp,path:`instances`,head:()=>({meta:[{title:`Instances — Harper Fabric`}]}),component:hm}),P({getParentRoute:()=>fp,path:`starting-up`,head:()=>({meta:[{title:`Starting Up — Harper Fabric`}]}),component:vm}),P({getParentRoute:()=>fp,path:`scaling`,head:()=>({meta:[{title:`Scaling — Harper Fabric`}]}),component:gm}),P({getParentRoute:()=>fp,path:`domains`,head:()=>({meta:[{title:`Domains — Harper Fabric`}]}),component:Wp});function ym({location:e,params:t}){let n=i.checkForFabricConnect(t.clusterId);if(i.getConnectionById(t.clusterId).user&&!n){let t=e?.search?.redirect;throw xe({to:t?.startsWith(`/`)?t:`../`})}}function bm({location:e,params:t}){let n=i.checkForFabricConnect(t.instanceId);if(i.getConnectionById(t.instanceId).user&&!n){let t=e?.search?.redirect;throw xe({to:t?.startsWith(`/`)?t:`../`})}}P({getParentRoute:()=>fp,path:`sign-in`,head:()=>({meta:[{title:`Sign In — Harper Fabric`}]}),component:Ma,beforeLoad:ym}),P({getParentRoute:()=>fp,path:`instance/$instanceId/sign-in`,head:()=>({meta:[{title:`Sign In — Harper Fabric`}]}),component:Ma,beforeLoad:bm}),P({getParentRoute:()=>fp,path:`finish-setup`,head:()=>({meta:[{title:`Create Admin User — Harper Fabric`}]}),component:tm}),P({getParentRoute:()=>fp,path:`/`,head:()=>({meta:[{title:`Cluster — Harper Fabric`}]}),component:pp});function xm(e){return P({getParentRoute:()=>e,path:`apis`,head:()=>({meta:[{title:`APIs — Harper Fabric`}]})}).lazy(()=>Pe(()=>import(`./index.lazy-Dk5j1AoQ.js`).then(e=>e.route),__vite__mapDeps([7,2,8,9,10,1,11,12,13,14])))}function Sm(e,t){return[P({getParentRoute:()=>e,path:t===`cluster`?`apps`:`/`,head:()=>({meta:[{title:`Applications — Harper Fabric`}]}),component:Ce(()=>Pe(()=>import(`./applications-D8Am9ikM.js`),__vite__mapDeps([15,2,8,9,10,1,11,12,16,17,18,19,20,21,22,23,24,3,4,13,6,25])),`ApplicationsEditor`)})]}async function Cm({instanceClient:e}){let{data:t}=await e.post(`/`,{operation:`list_certificates`});return t}function wm(e){return F({queryKey:[e.entityId,`list_certificates`],queryFn:()=>Cm(e)})}var Tm=[{header:`Certificate Name`,accessorKey:`name`,enableSorting:!0},{header:`Issuer`,accessorKey:`details.issuer`,enableSorting:!0},me().display({header:`Expires At`,enableSorting:!1,id:`details.valid_to`,cell:e=>e.row.original.details.valid_to?new Date(e.row.original.details.valid_to).toLocaleString():`N/A`})];function Em({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`input`,className:p(`border-input file:text-foreground placeholder:text-muted-foreground selection:bg-purple
|
|
12
|
+
`)}}];function wd(e){return(0,U.useCallback)(async()=>{B.loading(`Refreshing...`,{id:`refreshing`});let t=Date.now();await e(),Date.now()-t<500&&await f(500),B.success(`Refreshed!`,{id:`refreshing`})},[e])}async function Td(e){let{data:t}=await c.get(`/Invoice/${e}`);return t}function Ed(e,t){return F({queryKey:[e,`invoices`],queryFn:()=>Td(e),retry:!1,enabled:!!e,refetchInterval:t?1e4:void 0})}function Dd(){let{organizationId:e}=M({strict:!1}),{data:t}=N(bc(e)),{data:n,refetch:r,isLoading:i,isFetching:a,isRefetching:o}=N(Ed(t?.type!==`ENTERPRISE`&&t?.id,!1)),s=wd(r);return t?.type===`ENTERPRISE`?(0,H.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,H.jsx)(Rs,{}),`, we would love to talk!`]}):i?(0,H.jsx)(zs,{centered:!0}):!n||!n.length?(0,H.jsxs)(`span`,{children:[`Your invoices will be shown here once one is available! Want to explore your solution with Harper more?`,` `,(0,H.jsx)(Rs,{overEmail:!0}),`, we would love to talk!`]}):(0,H.jsx)(yd,{data:n,columns:Cd,children:(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:s,accessKey:`r`,disabled:a||o,children:[(0,H.jsx)(hn,{}),(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]})})}function Od(e){let t=P({getParentRoute:()=>e,path:`billing`,head:()=>({meta:[{title:`Billing — Harper Fabric`}]}),component:dd}),n=P({getParentRoute:()=>t,path:`/`,head:()=>({meta:[{title:`Payment Methods — Harper Fabric`}]}),component:$l}),r=P({getParentRoute:()=>t,path:`invoices`,head:()=>({meta:[{title:`Invoices — Harper Fabric`}]}),component:Dd}),i=P({getParentRoute:()=>t,path:`confirm`,head:()=>({meta:[{title:`Confirm Payment — Harper Fabric`}]}),component:ud});return t.addChildren([n,r,i])}async function kd(e){let{data:t}=await c.get(`/OrganizationRole/${e}`);return t}function Ad(e){return F({queryKey:[e,`roles`],queryFn:()=>kd(e),retry:!1,refetchInterval:10*1e3})}var jd=me(),Md=[{header:`Role Name`,accessorKey:`roleName`,enableSorting:!1},jd.display({header:`ID`,id:`id`,enableSorting:!1,cell:e=>(0,H.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,title:e.row.original.id,children:e.row.original.id})}),jd.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 Nd(e){let{data:t}=await c.post(`/Role/`,e);return t}function Pd(){return j({mutationFn:Nd})}var Fd=S({name:w().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:O(),delete:O()});S({roles:S({create:O(),delete:O(),update:O(),view:O()}),clusters:S({create:O(),delete:O(),update:O(),view:O(),resources:T(S({id:w(),delete:O(),update:O(),view:O(),instances:S({create:O(),delete:O(),update:O(),view:O()})}))})});function Id(){let[e]=xi(),t=vi();return e===`dark`||e===`system`&&t===`dark`?`vs-dark`:`light`}var Ld=(0,U.lazy)(async()=>(await Pe(()=>import(`./setup-TGCErIhq.js`),__vite__mapDeps([0,1,2,3,4,5,6])),{default:(await Pe(()=>import(`./dist-DHjL6trB.js`),__vite__mapDeps([5,2,1]))).default}));function Rd(e){return(0,H.jsx)(U.Suspense,{fallback:e.loading??null,children:(0,H.jsx)(Ld,{...e})})}var zd={roles:{create:!0,view:!0,update:!0,delete:!0},clusters:{create:!0,view:!0,update:!0,delete:!0,resources:[]}};function Bd({isModalOpen:e,setIsModalOpen:t}){let n=Id(),r=le(),{organizationId:i}=M({strict:!1}),[a,o]=(0,U.useState)(!0),[s,c]=(0,U.useState)(JSON.stringify(zd,null,2)),{mutate:l,isPending:u}=Pd(),d=R({resolver:z(Fd),defaultValues:{name:``,update:!1,delete:!1}}),f=(0,U.useCallback)(e=>{o(e.length===0)},[o]),p=(0,U.useCallback)(async e=>{let n=bn(s);if(!n)return;let o={...e,...n,organizationId:i};e&&a&&l(o,{onSuccess:()=>{B.success(`Organization role added successfully!`),t(!1),r.invalidateQueries({queryKey:[i,`roles`],refetchType:`active`}),d.reset()},onError:e=>{B.error(`Failed to add organization role: ${e.message}`)}})},[a,s,l,d,r,t,i]);return(0,H.jsx)(Io,{onOpenChange:t,open:e,children:(0,H.jsxs)(Uo,{resizable:!0,children:[(0,H.jsx)(Ko,{children:`Add New Organization Role`}),(0,H.jsx)(qo,{children:`Set the new organization role permissions.`}),(0,H.jsx)(G,{...d,children:(0,H.jsxs)(`form`,{id:`org-add-role-form`,name:`org-add-role-form`,className:`flex flex-1 min-h-0 flex-col gap-4 my-4`,onSubmit:d.handleSubmit(p),children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsx)(q,{control:d.control,name:`name`,render:({field:e})=>(0,H.jsxs)(J,{className:`col-span-2`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Role Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,className:``,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:d.control,name:`update`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Update Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:d.control,name:`delete`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Delete Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})})]}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,H.jsx)(Rd,{className:`w-full h-full`,theme:n,defaultLanguage:`json`,onValidate:f,onChange:e=>{e&&c(e)},options:{automaticLayout:!0},defaultValue:JSON.stringify(zd,null,2)})}),(0,H.jsx)(Go,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[(0,H.jsx)(_,{variant:`destructiveOutline`,type:`button`,onClick:()=>t(!1),disabled:u,children:`Cancel`}),(0,H.jsx)(_,{variant:`submit`,disabled:u||!a||!d.formState.isValid,children:`Save Changes`})]})})]})})]})})}async function Vd({roleId:e}){let{data:t}=await c.delete(`/Role/${e}`,{id:e,deleted:!0});return t}function Hd(){return j({mutationFn:({roleId:e})=>Vd({roleId:e})})}async function Ud({roleId:e,updatedRoleInfo:t}){let{data:n}=await c.put(`/Role/${e}`,t);return n}function Wd(){return j({mutationFn:({roleId:e,updatedRoleInfo:t})=>Ud({roleId:e,updatedRoleInfo:t})})}function Gd({organizationId:e,roleId:t}){return F({queryKey:[e,`roles`,t],queryFn:()=>Kd(t),refetchInterval:10*1e3})}async function Kd(e){let{data:t}=await c.get(`/Role/${e}`);return t}function qd({onRoleDeleteClick:e,setIsConfirmingRoleDeletion:t,isRoleDeletionPending:n}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Ko,{children:`Confirm Role Deletion`}),(0,H.jsx)(qo,{children:`Are you sure you want to delete this role? This action cannot be undone.`}),(0,H.jsxs)(Go,{children:[(0,H.jsx)(_,{type:`button`,variant:`defaultOutline`,onClick:()=>t(!1),children:`Cancel`}),(0,H.jsx)(_,{variant:`destructiveOutline`,onClick:e,disabled:n,children:n?`Deleting...`:`Delete Role`})]})]})}function Jd({data:e,isModalOpen:t,closeModal:n}){return(0,H.jsx)(Io,{onOpenChange:(0,U.useCallback)(()=>n(!1),[n]),open:t,children:(0,H.jsx)(Uo,{resizable:!0,children:(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(Yd,{roleName:e.roleName}),children:(0,H.jsx)(Xd,{data:e,closeModal:n})})})})}function Yd({roleName:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Ko,{children:[`Organization Role "`,e,`"`]}),(0,H.jsx)(zs,{centered:!0,text:`Loading role…`,className:`flex-1 min-h-0`})]})}function Xd({data:e,closeModal:t}){let n=le(),{data:r}=ue(Gd({roleId:e.id,organizationId:e.organizationId})),i=He().user?.roles?.[e.organizationId]?.id===e.id,{update:a,remove:o}=vs(e.organizationId),{mutate:s,isPending:c}=Wd(),{mutate:l,isPending:u}=Hd(),d=Id(),[f,p]=(0,U.useState)(!1),m=R({resolver:z(Fd),defaultValues:{name:e.roleName,update:r.organization.update||!1,delete:r.organization.delete||!1}}),h=(0,U.useCallback)(()=>{l({roleId:e.id},{onSuccess:()=>{B.success(`Role deleted successfully!`),t(!0),m.reset()},onError:e=>{B.error(`Error`,{description:`Failed to delete role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}})},[e.id,l,m,t]),[g,v]=(0,U.useState)(!0),y=(0,U.useMemo)(()=>JSON.stringify({roles:{...r.organization.roles},clusters:{...r.organization.clusters}},null,2),[r]),[b,x]=(0,U.useState)(y),S=b!==y,C=(0,U.useCallback)(e=>{v(e.length===0)},[v]),w=(0,U.useCallback)(async r=>{if(!a)return;let i=bn(b);if(!i)return;let o={...r,...i,organizationId:e.organizationId};b&&g&&s({roleId:e.id,updatedRoleInfo:o},{onSuccess:async()=>{B.success(`Role updated successfully!`),await n.invalidateQueries({queryKey:[e.organizationId,`roles`,e.id]}),t(!1),m.reset()},onError:e=>{B.error(`Error`,{description:`Failed to update role: ${e instanceof Error?e.message:String(e)}.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}})},[t,e.id,e.organizationId,m,g,n,r,a,b,s]);return f?(0,H.jsx)(qd,{onRoleDeleteClick:h,setIsConfirmingRoleDeletion:p,isRoleDeletionPending:u}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(Ko,{children:[i||!a?`View`:`Edit`,` Organization Role "`,e.roleName,`"`]}),(0,H.jsx)(G,{...m,children:(0,H.jsxs)(`form`,{id:`org-edit-role-form`,name:`org-edit-role-form`,className:`flex flex-1 min-h-0 flex-col gap-4 my-4`,onSubmit:m.handleSubmit(w),children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,H.jsx)(q,{control:m.control,name:`name`,render:({field:e})=>(0,H.jsxs)(J,{className:`col-span-2`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Role Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,className:``,...e,disabled:!0,readOnly:!0})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`update`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Update Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,disabled:i||!a,readOnly:i||!a,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`delete`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Can Delete Organization`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`checkbox`,className:`w-6 ml-2`,disabled:i||!a,readOnly:i||!a,checked:e.value,onChange:t=>e.onChange(t.target.checked)})}),(0,H.jsx)(X,{})]})})]}),(0,H.jsx)(`div`,{className:`flex-1 min-h-0`,children:(0,H.jsx)(Rd,{className:`w-full h-full`,theme:d,defaultLanguage:`json`,onValidate:C,onChange:e=>{e&&x(e)},options:{readOnly:i||!a,automaticLayout:!0},defaultValue:b})}),!i&&(o||a)&&(0,H.jsx)(Go,{children:(0,H.jsxs)(`div`,{className:`flex justify-between w-full`,children:[o&&(0,H.jsx)(_,{type:`button`,variant:`destructiveOutline`,onClick:()=>p(!0),disabled:c,children:`Delete Role`}),a&&(0,H.jsx)(_,{variant:`submit`,disabled:!g||c||!m.formState.isValid||!m.formState.isDirty&&!S,children:`Save Changes`})]})})]})})]})}function Zd(){let e=L(),t=le(),{organizationId:n,orgRoleId:r}=M({strict:!1}),{create:i}=vs(n),{data:a,refetch:o,isFetching:s,isRefetching:c}=ue(Ad(n)),l=(0,U.useMemo)(()=>a&&a?.find(e=>e.id===r),[a,r]),u=!!r&&!!l,[d,f]=(0,U.useState)(!1),p=(0,U.useCallback)(async(i,a)=>{let o=[r?`..`:``,i].filter(Boolean);await e({to:o.join(`/`)}),a&&await t.invalidateQueries({queryKey:[n,`roles`],refetchType:`active`})},[r,e,t]),m=(0,U.useCallback)(()=>{f(!0)},[f]),h=(0,U.useCallback)(e=>p(e.original.id,!1),[p]),g=(0,U.useCallback)(e=>p(void 0,e),[p]),v=wd(o);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(td,{children:(0,H.jsxs)(U.Suspense,{fallback:(0,H.jsx)(zs,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,H.jsxs)(yd,{data:a,columns:Md,onRowClick:h,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:v,accessKey:`r`,disabled:s||c,children:[(0,H.jsx)(hn,{}),(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]}),i&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:m,accessKey:`a`,disabled:d,children:[(0,H.jsx)(Rr,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`A`}),`dd`]})]})]}),i&&(0,H.jsx)(Bd,{isModalOpen:d,setIsModalOpen:f}),u&&(0,H.jsx)(Jd,{data:l,isModalOpen:u,closeModal:g},l.id)]})})]})}function Qd({className:e,...t}){return(0,H.jsx)(Ze,{"data-slot":`switch`,className:p(`peer data-[state=checked]:bg-green data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-grey-500 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50`,e),...t,children:(0,H.jsx)(ht,{"data-slot":`switch-thumb`,className:p(`bg-white dark:data-[state=unchecked]:bg-white dark:data-[state=checked]:bg-white pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0`)})})}function $d(e){return`//oauth/${e}/login`}async function ef(e,t){let{data:n}=await c.patch(`/Organization/${e}/settings/oauth`,t);return n}var tf=S({domain:w().min(1,`Domain is required`),clientId:w().min(1,`Client ID is required`),clientSecret:w().min(1,`Client secret is required`),scope:w().optional()}),nf=S({domain:w().min(1,`Domain is required`),clientId:w().optional(),clientSecret:w().optional(),scope:w().optional()});function rf(){let{organizationId:e}=M({strict:!1}),{user:t}=He(),{update:n}=_s(e),{data:r}=ue(bc(e)),i=le(),[a,o]=(0,U.useState)(!1),[s,c]=(0,U.useState)(null),l=r.settings?.oauthConfigs??[],{mutate:u,isPending:d}=j({mutationFn:t=>ef(e,t),onSuccess:()=>void i.invalidateQueries({queryKey:[e]}),onError:()=>B.error(`Failed to update OAuth settings.`)}),f=R({resolver:z(tf),defaultValues:{domain:``,clientId:``,clientSecret:``,scope:`openid email profile`}}),p=e=>{u({provider:`okta`,...e},{onSuccess:()=>{B.success(`OAuth provider added.`),f.reset(),o(!1)}})},m=R({resolver:z(nf)}),h=e=>{c(e.id??null),m.reset({domain:e.domain,clientId:``,clientSecret:``,scope:e.scope??``})},g=(e,t)=>{let n={id:e.id,provider:e.provider,domain:t.domain,scope:t.scope};t.clientId&&(n.clientId=t.clientId),t.clientSecret&&(n.clientSecret=t.clientSecret),u(n,{onSuccess:()=>{B.success(`OAuth provider updated.`),c(null)}})},v=(e,t)=>{u({id:e.id,provider:e.provider,[t]:!e[t]})},y=e=>`//oauth/${e}/callback`,b=async e=>{await Ns(e)&&B.success(`Sign-in URL copied.`)},x=async e=>{await Ns(e)&&B.success(`Redirect URI copied.`)};return n?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(td,{children:(0,H.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,H.jsx)(`h2`,{className:`text-2xl text-foreground font-light mb-6`,children:`Authentication`}),(0,H.jsxs)(`section`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h3`,{className:`text-lg text-foreground font-medium`,children:`OAuth Providers`}),!a&&(0,H.jsxs)(_,{variant:`positiveOutline`,size:`sm`,onClick:()=>o(!0),children:[(0,H.jsx)(Rr,{}),`Add Provider`]})]}),l.length===0&&!a&&(0,H.jsx)(`p`,{className:`text-muted-foreground text-sm mb-4`,children:`No OAuth providers configured.`}),l.map(e=>{let n=t?.oauthConfigId===e.id;return s===e.id?(0,H.jsxs)(`div`,{className:`border rounded-lg p-4 mb-3 text-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h4`,{className:`font-medium`,children:`Edit Provider`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(null),className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(_n,{className:`size-4`})})]}),(0,H.jsx)(G,{...m,children:(0,H.jsxs)(`form`,{onSubmit:m.handleSubmit(t=>g(e,t)),className:`space-y-4`,children:[(0,H.jsx)(q,{control:m.control,name:`domain`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Domain`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`company.okta.com`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`clientId`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client ID`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`Leave blank to keep existing`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`clientSecret`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client Secret`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,placeholder:`Leave blank to keep existing`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:m.control,name:`scope`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Scope`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`openid email profile`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,H.jsx)(_,{type:`submit`,variant:`positive`,disabled:d,children:d?`Saving...`:`Save`}),(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>c(null),children:`Cancel`})]})]})})]},e.id):(0,H.jsx)(`div`,{className:`border rounded-lg p-4 mb-3 text-foreground`,children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-1`,children:[(0,H.jsx)(`span`,{className:`font-medium`,children:e.domain}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground uppercase bg-muted px-2 py-0.5 rounded`,children:e.provider}),e.enabled===!1&&(0,H.jsx)(`span`,{className:`text-xs text-destructive bg-destructive/10 px-2 py-0.5 rounded`,children:`Disabled`})]}),(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground mb-2`,children:[`Client ID: `,(0,H.jsx)(`span`,{className:`text-foreground font-mono`,children:`****`})]}),e.id&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mt-3 rounded-md bg-muted px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1`,children:`Okta redirect URI`}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-1.5`,children:[`Add to `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`Login redirect URIs`}),` `,`in your Okta app settings.`]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-sm text-foreground font-mono truncate`,children:y(e.id)}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void x(y(e.id)),className:`hover:text-foreground shrink-0 text-muted-foreground`,title:`Copy redirect URI`,children:(0,H.jsx)(tr,{className:`size-3.5`})})]})]}),(0,H.jsxs)(`div`,{className:`mt-2 rounded-md bg-muted px-3 py-2`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:`User login link`}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`a`,{href:$d(e.id),target:`_blank`,rel:`noreferrer`,className:`text-sm text-foreground truncate hover:underline`,children:$d(e.id)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0 text-muted-foreground`,children:[(0,H.jsx)(`button`,{type:`button`,onClick:()=>void b($d(e.id)),className:`hover:text-foreground`,title:`Copy login link`,children:(0,H.jsx)(tr,{className:`size-3.5`})}),(0,H.jsx)(`a`,{href:$d(e.id),target:`_blank`,rel:`noreferrer`,className:`hover:text-foreground`,title:`Open login link`,children:(0,H.jsx)(ar,{className:`size-3.5`})})]})]})]})]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-3 sm:shrink-0`,children:[(0,H.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground cursor-pointer`,children:[(0,H.jsx)(Qd,{checked:e.enabled!==!1,onCheckedChange:()=>v(e,`enabled`),disabled:d}),`Enabled`]}),(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-sm text-foreground ${n?`cursor-pointer`:`cursor-not-allowed opacity-50`}`,children:[(0,H.jsx)(Qd,{checked:!!e.required,onCheckedChange:()=>v(e,`required`),disabled:d||!n}),`Required`]})}),!n&&(0,H.jsxs)(Mi,{children:[`Sign in via `,e.provider,` first to enable Required`]})]}),(0,H.jsx)(_,{variant:`outline`,size:`sm`,onClick:()=>h(e),disabled:d,children:(0,H.jsx)(Lr,{className:`size-4`})})]})]})},e.id)}),a&&(0,H.jsxs)(`div`,{className:`border rounded-lg p-4 text-foreground`,children:[(0,H.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,H.jsx)(`h4`,{className:`font-medium`,children:`Add Okta Provider`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>{o(!1),f.reset()},className:`text-muted-foreground hover:text-foreground`,children:(0,H.jsx)(_n,{className:`size-4`})})]}),(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-4`,children:[`After saving, copy the `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`Okta redirect URI`}),` `,`from the provider card and add it to your Okta app's`,` `,(0,H.jsx)(`span`,{className:`font-medium text-foreground`,children:`Login redirect URIs`}),`.`]}),(0,H.jsx)(G,{...f,children:(0,H.jsxs)(`form`,{onSubmit:f.handleSubmit(p),className:`space-y-4`,children:[(0,H.jsx)(q,{control:f.control,name:`domain`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Domain`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`company.okta.com`,autoFocus:!0,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f.control,name:`clientId`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client ID`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`Okta Client ID`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f.control,name:`clientSecret`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Client Secret`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,placeholder:`Okta Client Secret`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f.control,name:`scope`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Scope`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{placeholder:`openid email profile`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,H.jsx)(_,{type:`submit`,variant:`positive`,disabled:d,children:d?`Adding...`:`Add Provider`}),(0,H.jsx)(_,{type:`button`,variant:`outline`,onClick:()=>{o(!1),f.reset()},children:`Cancel`})]})]})})]})]})]})})]}):(0,H.jsx)(`div`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))] text-foreground`,children:`You don't have permission to manage settings for this organization.`})}var af=[{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},me().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}];function of({name:e,id:t}){return(0,H.jsxs)(`span`,{className:`flex items-baseline gap-2 truncate`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:e}),(0,H.jsx)(`span`,{className:`text-muted-foreground font-mono text-xs`,children:t})]})}var sf=A.object({email:Ca.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:A.string().nonempty({error:`Please select a role.`})});async function cf(e){let{data:t}=await c.post(`/OrganizationRole/`,e);return t}function lf(){return j({mutationFn:e=>cf(e)})}A.object({email:Ca.max(80,{error:`Email cannot be longer than 80 characters.`}),roleId:A.string().nonempty({error:`Please select a role.`})});async function uf(e){let{data:t}=await c.post(`/UserInvite/`,e);return t}function df(){return j({mutationFn:e=>uf(e)})}function ff({isModalOpen:e,onChangesSaved:t,setIsModalOpen:n}){let{organizationId:r}=M({strict:!1}),{data:i,isLoading:a}=N({...Ad(r),throwOnError:!0}),[o,s]=(0,U.useState)(!1),c=R({resolver:z(sf),defaultValues:{email:``,roleId:``}}),{mutate:l,isPending:u}=lf(),{mutate:d,isPending:f}=df(),p=(0,U.useCallback)(async e=>{e&&(o?d:l)(e,{onSuccess:()=>{let r=e.roleId;c.reset(),c.setValue(`roleId`,r),t(),B.success(`User invited successfully!`),n(!1),s(!1)},onError:e=>{e?.status===404&&s(!0)}})},[l,c,d,t,n,o]);return(0,H.jsx)(Io,{onOpenChange:()=>{n(!1),s(!1),c.reset()},open:e,children:(0,H.jsx)(Uo,{"aria-describedby":void 0,children:(0,H.jsx)(G,{...c,children:(0,H.jsxs)(`form`,{id:`org-add-user-form`,name:`org-add-user-form`,onSubmit:c.handleSubmit(p),className:`grid gap-4 my-4`,children:[(0,H.jsx)(Wo,{children:(0,H.jsx)(Ko,{children:o?`Invite User`:`Add User`})}),(0,H.jsx)(q,{control:c.control,name:`email`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Email`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`email`,enterKeyHint:`next`,autoComplete:`email`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:c.control,name:`roleId`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Roles`}),a?(0,H.jsx)(ou,{}):(0,H.jsx)(K,{children:(0,H.jsxs)(su,{...e,onValueChange:t=>e.onChange(t),children:[(0,H.jsx)(uu,{className:`w-full`,children:(0,H.jsx)(lu,{placeholder:`Choose Role`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(fu,{children:`Role`}),i?.map(e=>(0,H.jsx)(Q,{value:e.id,children:(0,H.jsx)(of,{name:e.roleName,id:e.id})},e.id))]})})]})}),(0,H.jsx)(X,{})]})}),o&&(0,H.jsxs)(qo,{className:`p-3 my-5 text-white rounded-md bg-amber-600 flex`,children:[(0,H.jsx)(Or,{className:`inline-block size-12 pr-2`}),(0,H.jsx)(`span`,{children:`This person doesn’t have a Fabric account. Do you want to invite them?`})]}),(0,H.jsx)(Go,{children:(0,H.jsx)(`div`,{className:`flex justify-between w-full`,children:(0,H.jsxs)(_,{type:`submit`,variant:`submit`,disabled:u||f,children:[(0,H.jsx)(Vr,{}),` `,o?`Invite User`:`Add User`]})})})]})})})})}async function pf({roleId:e,userId:t}){let{data:n}=await c.delete(`/OrganizationRole/role/${e}/user/${t}`);return n}function mf(){return j({mutationFn:({roleId:e,userId:t})=>pf({roleId:e,userId:t})})}function hf(e){let[t,n]=(0,U.useState)(e||!1);return[t,(0,U.useCallback)(e=>{n(typeof e==`boolean`?e:e.target.checked)},[])]}function gf({data:e,readOnly:t,canRemove:n,orgRole:r,selectedRoles:i,setChangesMade:a}){let{mutate:o,isPending:s}=lf(),{mutate:c,isPending:l}=mf(),u=!!i[r.id],[d,f]=(0,U.useState)(u),[p,m]=hf(u);return(0,U.useEffect)(()=>{p!==d&&(p?o({email:e.email,roleId:r.id},{onSuccess:()=>{f(p),a(!0),B.success(`Role added successfully`)}}):c({userId:e.id,roleId:r.id},{onSuccess:()=>{f(p),a(!0),B.success(`Role removed successfully`)}}))},[o,e.email,e.id,p,r.id,c,a,d]),(0,H.jsxs)(ma,{className:`flex`,children:[(0,H.jsx)(Z,{type:`checkbox`,className:`w-6`,disabled:t||s||l||!n&&p,checked:p,onChange:m}),(0,H.jsx)(`span`,{className:`pl-4 pr-8 flex-1 py-2.5`,children:r.roleName})]},r.id)}function _f({closeModal:e,data:t,isModalOpen:n,onUserUpdated:r}){let{organizationId:i}=M({strict:!1}),a=He(),{update:o,remove:s}=vs(i),c=a.user?.email===t.email,[l,u]=(0,U.useState)(!1);return(0,H.jsx)(Io,{onOpenChange:l?r:e,open:n,children:(0,H.jsxs)(Uo,{resizable:!0,children:[(0,H.jsx)(Wo,{children:(0,H.jsxs)(Ko,{children:[o?`Edit `:`View `,` `,t.email,` `,c?`(yourself)`:``]})}),o&&(0,H.jsxs)(qo,{children:[`To remove `,c?`your self`:`this user`,` from the organization, uncheck all of the boxes below.`]}),(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(zs,{centered:!0,text:`Loading roles…`,className:`flex-1 min-h-0`}),children:(0,H.jsx)(vf,{data:t,organizationId:i,update:o,remove:s,setChangesMade:u})})]})})}function vf({data:e,organizationId:t,update:n,remove:r,setChangesMade:i}){let{data:a}=ue(Ad(t)),o=(0,U.useMemo)(()=>e.roles?ic(e.roles,`id`):{},[e]);return(0,H.jsx)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 overflow-y-auto`,children:a.map(t=>(0,H.jsx)(gf,{readOnly:!n,canRemove:r,data:e,orgRole:t,selectedRoles:o,setChangesMade:i},t.id))})}function yf(e,t){return e.email>t.email?1:-1}function bf(){let e=L(),{organizationId:t,orgUserId:n}=M({strict:!1}),{update:r}=vs(t),{data:i,refetch:a,isFetching:o,isRefetching:s}=ue(Ad(t)),c=(0,U.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(yf)},[i]),l=(0,U.useMemo)(()=>c?.find(e=>e.id===n),[c,n]),u=(0,U.useCallback)(t=>{let r=[n?`..`:``,t].filter(Boolean);e({to:r.join(`/`)})},[n,e]),d=!!n&&!!l,[f,p]=(0,U.useState)(!1),[m]=(0,U.useState)({attribute:`email`,descending:!1}),h=(0,U.useMemo)(()=>[{desc:m.descending,id:m.attribute}],[m]),g=(0,U.useCallback)(()=>{p(!0)},[p]),v=(0,U.useCallback)(()=>{a(),p(!1)},[a,p]),y=(0,U.useCallback)(e=>{u(e.original.id)},[u]),b=(0,U.useCallback)(()=>{u(void 0)},[u]),x=(0,U.useCallback)(()=>{a(),u(void 0)},[u,a]),S=wd(a);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(td,{children:(0,H.jsxs)(U.Suspense,{fallback:(0,H.jsx)(zs,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:[(0,H.jsxs)(yd,{data:c,isFetching:o||s,columns:af,onRowClick:y,sortingState:h,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:S,accessKey:`r`,disabled:o||s,children:[(0,H.jsx)(hn,{}),` `,(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]}),r&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:g,accessKey:`a`,disabled:f,children:[(0,H.jsx)(Rr,{}),` `,(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`A`}),`dd`]})]})]}),r&&(0,H.jsx)(ff,{isModalOpen:f,onChangesSaved:v,setIsModalOpen:p}),d&&(0,H.jsx)(_f,{closeModal:b,data:l,isModalOpen:d,onUserUpdated:x})]})})]})}function xf({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`skeleton`,className:p(`bg-primary/10 animate-pulse rounded-md`,e),...t})}function Sf({organizationId:e,organizationName:t,providers:n}){return(0,H.jsxs)(fn,{className:`relative h-full justify-between opacity-90`,children:[(0,H.jsxs)(ln,{children:[(0,H.jsx)(dn,{className:`truncate`,children:e}),(0,H.jsx)(cn,{children:(0,H.jsx)(`h2`,{children:t})})]}),(0,H.jsxs)(un,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`p`,{className:`text-xs text-muted-foreground flex items-center gap-1.5 mb-1`,children:[(0,H.jsx)(br,{className:`size-3 shrink-0`}),`Sign in with an OAuth provider to access this organization.`]}),n.map(e=>(0,H.jsx)(`a`,{href:$d(e.oauthConfigId),children:(0,H.jsxs)(_,{variant:`outline`,className:`w-full`,children:[`Sign in with `,e.name]})},e.oauthConfigId))]})]})}var Cf=S({couponId:w().nonempty({message:`Please enter a coupon ID.`}).trim()});async function wf({organizationId:e,couponId:t}){let{data:n}=await c.post(`/Coupon`,{organizationId:e,couponId:t},{validateStatus:e=>e>=200&&e<400||e===400||e===409});return n}function Tf(){return j({mutationFn:wf})}function Ef({organizationId:e,organizationName:t,isOpen:n,onClose:r}){let{mutate:i,isPending:a}=Tf(),o=R({resolver:z(Cf),defaultValues:{couponId:``}}),{handleSubmit:s,control:c,reset:l}=o;(0,U.useEffect)(()=>{n&&l({couponId:``})},[n,l]);let u=(0,U.useCallback)(n=>{i({organizationId:e,couponId:n.couponId},{onSuccess:i=>{i?B.error(`Error`,{description:i||`Failed to add coupon.`}):(B.success(`Success`,{description:`Coupon "${n.couponId}" added to ${t||e}.`}),r())}})},[i,e,t,r]);return(0,H.jsx)(Io,{open:n,onOpenChange:e=>!e&&r(),children:(0,H.jsxs)(Uo,{children:[(0,H.jsxs)(Wo,{children:[(0,H.jsx)(Ko,{children:`Add Coupon`}),(0,H.jsxs)(qo,{children:[`Add a coupon code to`,` `,t||e,`. This coupon will be applied to the next billing cycle.`,(0,H.jsx)(`br`,{}),`Coupons can be created in our`,` `,(0,H.jsx)(`a`,{href:`https://dashboard.stripe.com/`,target:`_blank`,rel:`noreferrer`,className:`text-purple hover:underline`,children:`Stripe Dashboard`}),`.`]})]}),(0,H.jsx)(G,{...o,children:(0,H.jsxs)(`form`,{onSubmit:s(u),children:[(0,H.jsx)(`div`,{className:`grid gap-4 py-4`,children:(0,H.jsx)(q,{control:c,name:`couponId`,render:({field:e})=>(0,H.jsxs)(J,{className:`grid items-center gap-4`,children:[(0,H.jsx)(Y,{children:`Coupon ID`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{...e,placeholder:`e.g. 100OFF`,disabled:a})}),(0,H.jsx)(X,{})]})})}),(0,H.jsxs)(Go,{children:[(0,H.jsx)(_,{type:`button`,variant:`ghost`,onClick:r,disabled:a,children:`Cancel`}),(0,H.jsx)(_,{type:`submit`,disabled:a,children:a?`Adding...`:`Add Coupon`})]})]})})]})})}function Df({organizationRole:e,onDeleteOrgModal:t}){let{organizationId:n,organizationName:r,roleName:i}=e,{remove:a,update:o}=_s(n),s=o,{view:c}=vs(n),l=Be(),[u,d]=(0,U.useState)(!1),f=(0,U.useCallback)(()=>{t(e)},[t,e]),p=[{type:`label`,key:`label`,className:`text-gray-600 text-xs`,label:`Options`},{type:`separator`,key:`sep-top`},{key:`clusters`,to:`${n}`,icon:(0,H.jsx)(Wr,{className:`size-4 mr-2 text-blue-500`}),label:`Clusters`},c&&{key:`roles`,to:`${n}/roles`,icon:(0,H.jsx)(Kr,{className:`size-4 mr-2 text-purple`}),label:`Roles`},c&&{key:`users`,to:`${n}/users`,icon:(0,H.jsx)(oi,{className:`size-4 mr-2 text-orange-500`}),label:`Users`},s&&{key:`billing`,to:`${n}/billing`,icon:(0,H.jsx)(nr,{className:`size-4 mr-2 text-green-500`}),label:`Billing`},o&&{key:`settings`,to:`${n}/settings`,icon:(0,H.jsx)(br,{className:`size-4 mr-2 text-yellow-500`}),label:`Settings`},l&&{key:`add-coupon`,onClick:()=>d(!0),icon:(0,H.jsx)(ti,{className:`size-4 mr-2 text-pink-500`}),label:`Add Coupon`},{type:`separator`,key:`sep-bottom`},{key:`delete`,onClick:f,className:`focus:bg-red/70 focus:text-white`,icon:(0,H.jsx)(ni,{className:`size-4 mr-2 text-red-500`}),label:`Delete`}].filter(di);return(0,H.jsx)(hs,{items:a?p:[],children:(0,H.jsxs)(fn,{className:`relative h-full justify-between transition-[transform,box-shadow] duration-200 hover:scale-[1.02] hover:shadow-lg hover:ring-2 hover:ring-primary/60 dark:hover:ring-violet-400/70`,children:[(0,H.jsx)(I,{to:n,"aria-label":`View ${r??n}`,className:`absolute inset-0 rounded-[inherit] focus-visible:ring-2 focus-visible:ring-purple-200 focus-visible:outline-none`}),(0,H.jsxs)(ln,{children:[(0,H.jsxs)(dn,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:n}),a&&(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{"aria-label":`Options`,onClick:e=>e.stopPropagation(),className:`relative z-10 -m-2 p-2 rounded-md hover:bg-accent/60 hover:text-foreground`,children:(0,H.jsx)(ir,{})}),(0,H.jsx)(Zo,{children:ms(p,`dropdown`)})]})]}),(0,H.jsx)(cn,{children:(0,H.jsx)(`h2`,{children:r})})]}),(0,H.jsxs)(un,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(Va,{className:`min-w-0 shrink`,title:ca(i),children:(0,H.jsx)(`span`,{className:`truncate`,children:ca(i)})}),(0,H.jsxs)(`span`,{className:`text-sm shrink-0 py-2 whitespace-nowrap ml-auto`,children:[`View `,(0,H.jsx)(Mn,{className:`inline-block`})]})]}),(0,H.jsx)(Ef,{organizationId:n,organizationName:r,isOpen:u,onClose:()=>d(!1)})]})})}async function Of(e){let{data:t}=await c.delete(`/Organization/${e}`);return t}function kf(){return j({mutationFn:e=>Of(e)})}async function Af(e){let{data:t}=await c.post(`/Organization/`,{...e});return t}function jf(){return j({mutationFn:e=>Af(e)})}var Mf=w().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.`}),Nf=S({name:w().max(255,{error:`Name cannot be longer than 255 characters.`}),subdomain:ie([k(``),te(),Mf]).optional()});function Pf(){let{user:e}=He(),t=L(),n=R({resolver:z(Nf),defaultValues:{name:``,subdomain:``}}),{setFocus:r,watch:a}=n;(0,U.useEffect)(()=>{r(`name`)},[r]);let o=`${e?.firstname} ${e?.lastname} Org`,s=a(`name`)||o,c=a(`subdomain`),l=(0,U.useMemo)(()=>{let e=Sc(wc(s),Mf.maxLength);return{suggestedSubdomain:e,fullHostName:`future-cluster-names.${c||e}.harperfabric.com`}},[s,c]),{mutate:d,isPending:f}=jf(),p=le(),m=(0,U.useCallback)(async e=>{d({name:e.name||o,subdomain:e.subdomain||l.suggestedSubdomain},{onSuccess:e=>{p.invalidateQueries({queryKey:v,refetchType:`active`}),i.reloadUser(u),t({to:`/${e.id}`})}})},[l.suggestedSubdomain,p,d,o,t]);return(0,H.jsx)(H.Fragment,{children:(0,H.jsx)(G,{...n,children:(0,H.jsxs)(`form`,{id:`org-add-form`,name:`org-add-form`,onSubmit:n.handleSubmit(m),className:`grid gap-6 text-foreground max-w-xl`,children:[(0,H.jsx)(q,{control:n.control,name:`name`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,maxLength:Nf.shape.name.maxLength,autoCapitalize:`words`,placeholder:o,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:n.control,name:`subdomain`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Subdomain`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,maxLength:Mf.maxLength,autoCapitalize:`none`,placeholder:l.suggestedSubdomain,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{className:`pb-1`,children:`Full Host Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(`span`,{children:l.fullHostName})}),(0,H.jsx)(X,{})]}),(0,H.jsx)(Go,{children:(0,H.jsxs)(_,{type:`submit`,variant:`submit`,disabled:f,children:[`Create New Organization `,(0,H.jsx)(Mn,{})]})})]})})})}function Ff(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:(0,H.jsx)(Pf,{})})]})}var If={org:`organization`,clu:`cluster`,ins:`instance`},Lf=/^(org|clu|ins)-[a-z0-9]+$/;function Rf(e){if(typeof e!=`string`)return null;let t=e.trim(),n=Lf.exec(t);return n?{kind:If[n[1]],id:t}:null}function zf(e,t){let n=e*12;return`/Admin/Organization/?${[...t?[`name=ct=${encodeURIComponent(t)}`]:[],`status=ne=DELETED`,`sort(name)`,`limit(${n},${n+12+1})`].join(`&`)}`}async function Bf(e,t){let{data:n}=await c.get(zf(e,t));return{organizations:n.slice(0,12),hasNextPage:n.length>12}}var Vf={organizations:[],hasNextPage:!1};function Hf(e){return e instanceof x&&(e.response?.status===404||e.status===404)}async function Uf(e){try{let{data:t}=await c.get(`/Admin/Organization/${e}`);return t?{organizations:[t],hasNextPage:!1}:Vf}catch(e){if(Hf(e))return Vf;throw e}}async function Wf(e){try{let{data:t}=await c.get(`/Cluster/${e}`),n=t?.organizationId;return n?await Uf(n):Vf}catch(e){if(Hf(e))return Vf;throw e}}function Gf(e,t){let n=Rf(t);return F({queryKey:[`admin-all-organizations`,t,e],queryFn:()=>n?.kind===`organization`?Uf(n.id):n?.kind===`cluster`?Wf(n.id):Bf(e,t),placeholderData:ae,retry:!1})}function Kf(e,t=300,n){let[r,i]=(0,U.useState)(e);return(0,U.useEffect)(()=>{let n=setTimeout(()=>i(e),t);return()=>clearTimeout(n)},[n?n(e):e,t]),r}function qf(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 Jf(e,t){let[n,r]=(0,U.useState)(t),[i,a]=(0,U.useState)(e);return(0,U.useEffect)(()=>{qf(n,t)||(r(t),a(e))},[n,t,e]),qf(n,t)?[i,a]:[e,a]}var Yf={};function Xf(e,t,n){let r=(0,U.useCallback)((e,n)=>t(e,n),[n]);(0,U.useEffect)(()=>(Yf[e]||(Yf[e]=[]),Yf[e].push(r),function(){let t=Yf[e].indexOf(r);t>=0&&Yf[e].splice(t,1)}),[e,t,r])}function Zf(e,t,n){let r=Yf[e];if(r)for(let e of r)e(t,n)}function Qf(e,t,n){return r=>Zf(e,t,n??r)}function $f(e,t,n){return(0,U.useCallback)(r=>Zf(e,t,n??r),[e,t,n])}function ep(e,t){return bn(sessionStorage.getItem(String(e)))??t}function tp(e,t){t==null?sessionStorage.removeItem(String(e)):sessionStorage.setItem(String(e),JSON.stringify(t))}function np(e,t){let n=Jf(ep(e,t),[e]),[r,i]=n;return(0,U.useEffect)(()=>{tp(e,r),Zf(`Session:${e}`,r)},[e,r]),Xf(`Session:${e}`,function(e){r!==e&&i(e)},[r,e,t]),(0,U.useEffect)(function(){let n=n=>{n.key===e&&i(ep(e,t))};return window.addEventListener(`storage`,n),()=>{window.removeEventListener(`storage`,n)}},[e,i,t]),n}function rp(){let e=le(),{data:t}=ue(s()),{mutate:n,isPending:r}=kf(),[i,a]=(0,U.useState)(!1),[o,c]=(0,U.useState)(null),[l,u]=(0,U.useState)(``),d=(0,U.useCallback)(()=>u(``),[]),f=Be(),[p,m]=np(`ShowAllOrganizations`,!1),[h,g]=(0,U.useState)(0),v=f&&p,y=(0,U.useCallback)(e=>{m(e),g(0)},[m]),b=Kf(l,300),x=(0,U.useMemo)(()=>{if(!f)return null;let e=Rf(b);return e?.kind===`organization`||e?.kind===`cluster`?e:null},[f,b]),S=v||!!x,{data:C,isPending:w}=N({...Gf(h,b),enabled:S}),{organizationRoles:T,oauthLockedOrgs:E}=(0,U.useMemo)(()=>{let e=t?.roles||{},n=[],r=[];for(let[t,i]of Object.entries(e))`oauthProviders`in i&&!f?r.push({organizationId:t,organizationName:i.organizationName,providers:i.oauthProviders}):n.push({organizationId:t,organizationName:i.organizationName,roleName:i.role??`fabric admin`});return{organizationRoles:n.filter(ad([`organizationId`,`organizationName`],l)).sort((e,t)=>(e.organizationName||``)>(t.organizationName||``)?1:-1),oauthLockedOrgs:r}},[l,t?.roles,f]),ee=(0,U.useMemo)(()=>{let e=t?.roles||{};return(C?.organizations||[]).map(t=>({organizationId:t.id,organizationName:t.name,roleName:e[t.id]?.role||`fabric admin`}))},[C?.organizations,t?.roles]),D=S?ee:T,O=(0,U.useCallback)(e=>{u(e.currentTarget.value||``),g(0)},[]),k=(0,U.useCallback)(t=>{t?.organizationId&&n(t.organizationId,{onSuccess:()=>{B.success(`Success`,{description:`Organization successfully deleted.`,duration:5e3,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),e.invalidateQueries({queryKey:[]}),a(!1)},onError:()=>a(!1)})},[n,e,a]),A=(0,U.useCallback)(e=>{c(e),a(!0)},[]),{createCluster:te}=pe({strict:!1});return!v&&T.length===1&&!l.length&&te?(0,H.jsx)(he,{to:`/${T[0].organizationId}/new-cluster`,replace:!0}):!v&&!T.length&&!E.length&&!l.length?(0,H.jsx)(Ff,{}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{children:(0,H.jsxs)(`div`,{className:`flex w-full items-center justify-end gap-2`,children:[f&&(0,H.jsxs)(`label`,{className:`flex shrink-0 cursor-pointer items-center gap-2 text-xs`,children:[(0,H.jsx)(Qd,{checked:p,onCheckedChange:y,"aria-label":`Show all organizations`}),(0,H.jsx)(`span`,{className:`hidden sm:inline-block`,children:`All Orgs`})]}),(0,H.jsx)(Z,{placeholder:`Filter by name`,className:`inline-block w-full text-xs`,value:l,onChange:O}),(0,H.jsx)(I,{to:`/new-org`,children:(0,H.jsxs)(_,{variant:`positive`,accessKey:`n`,children:[(0,H.jsx)(Rr,{}),(0,H.jsxs)(`span`,{className:`hidden sm:inline-block`,children:[(0,H.jsx)(`u`,{children:`N`}),`ew `,(0,H.jsx)(`span`,{className:`hidden md:inline-block`,children:`Organization`})]})]})})]})}),(0,H.jsxs)(`section`,{className:`mt-32 px-4 pt-4 md:px-12 min-h-[calc(100vh-theme(spacing.32))]`,children:[(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 md:grid-cols-12`,children:[!S&&E.map(e=>(0,H.jsx)(`div`,{className:`col-span-1 md:col-span-4 lg:col-span-3 2xl:col-span-2`,children:(0,H.jsx)(Sf,{organizationId:e.organizationId,organizationName:e.organizationName,providers:e.providers})},e.organizationId)),S&&w?Array.from({length:12},(e,t)=>(0,H.jsx)(xf,{className:`col-span-1 h-40 md:col-span-4 lg:col-span-3 2xl:col-span-2`},t)):D.map(e=>(0,H.jsx)(`div`,{className:`col-span-1 md:col-span-4 lg:col-span-3 2xl:col-span-2`,children:(0,H.jsx)(Df,{organizationRole:e,onDeleteOrgModal:A})},e.organizationId)),!D.length&&!(S&&w)&&(S||!E.length)&&(0,H.jsxs)(`div`,{className:`col-span-1 md:col-span-12 text-center`,children:[(0,H.jsx)(`h2`,{className:`my-4 text-xl`,children:`No matches found.`}),(0,H.jsx)(_,{variant:`outline`,onClick:d,children:`Clear Filters`})]})]}),S&&(h>0||C?.hasNextPage)&&(0,H.jsxs)(`div`,{className:`flex items-center justify-center gap-4 py-6`,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,size:`sm`,className:`select-none`,disabled:h===0,onClick:()=>g(e=>e-1),children:[(0,H.jsx)(jn,{}),`Previous`]}),(0,H.jsxs)(`span`,{className:`text-sm text-gray-500 dark:text-gray-400`,children:[`Page `,h+1]}),(0,H.jsxs)(_,{variant:`defaultOutline`,size:`sm`,className:`select-none`,disabled:!C?.hasNextPage,onClick:()=>g(e=>e+1),children:[`Next`,(0,H.jsx)(Mn,{})]})]})]}),o&&(0,H.jsx)(Jo,{typeOfThingBeingDeleted:`organization`,nameOfThingBeingDeleted:o.organizationName,isModalOpen:i,setIsModalOpen:()=>a(!1),deletionConfirmed:()=>k(o),deletionPending:r})]})}function ip(){let{isLoading:e}=Re(),{createCluster:t}=pe({strict:!1}),[,n]=xn(Cn.SavedClusterState,null);return(0,U.useEffect)(()=>{t&&n(t)},[t,n]),e?(0,H.jsx)(zs,{className:`fixed z-50 translate-1/2`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`header`,{className:`fixed top-0 z-40 w-full h-20 p-4 bg-gradient-to-r from-violet-100 to-white border-b border-violet-200 dark:from-purple-950 dark:to-zinc-900 dark:border-purple-950 md:px-12`,children:(0,H.jsx)(Wi,{})}),(0,H.jsx)(`main`,{children:(0,H.jsx)(Ee,{})})]})}var ap=[`/`,`/forgot-password`,`/reset-password`,`/sign-in`,`/sign-up`,`/verify-email`];function op(){let e=sd();return!ap.includes(e)&&{redirect:e}}var sp=P({getParentRoute:()=>hi,id:`_dashboardLayout`,component:ip,beforeLoad:({context:e})=>{let t=e.authentication[u];if(t&&!t.isLoading&&!t.user)throw xe({to:`/sign-in`,search:op()})}}),cp=P({getParentRoute:()=>sp,id:`_orgsLayout`});P({getParentRoute:()=>cp,path:`/`,head:()=>({meta:[{title:`Organizations — Harper Fabric`}]}),component:rp}),P({getParentRoute:()=>cp,path:`/new-org`,head:()=>({meta:[{title:`New Organization — Harper Fabric`}]}),component:Ff});var lp=P({getParentRoute:()=>cp,path:`$organizationId`,beforeLoad:async e=>{let{organizationId:t}=e.params;if(!vc(t))throw xe({to:`/`});return{organization:await e.context.queryClient.ensureQueryData(bc(t))}}});P({getParentRoute:()=>lp,path:`/roles`,head:()=>({meta:[{title:`Organization Roles — Harper Fabric`}]}),component:Zd}),P({getParentRoute:()=>lp,path:`/roles/$orgRoleId`,head:()=>({meta:[{title:`Organization Roles — Harper Fabric`}]}),component:Zd}),P({getParentRoute:()=>lp,path:`/users`,head:()=>({meta:[{title:`Organization Users — Harper Fabric`}]}),component:bf}),P({getParentRoute:()=>lp,path:`/users/$orgUserId`,head:()=>({meta:[{title:`Organization Users — Harper Fabric`}]}),component:bf}),P({getParentRoute:()=>lp,path:`/settings`,component:rf}),Od(lp);var up=P({getParentRoute:()=>lp,id:`_clusterLayout`});P({getParentRoute:()=>up,path:`/`,head:()=>({meta:[{title:`Clusters — Harper Fabric`}]}),component:od}),P({getParentRoute:()=>lp,path:`/new-cluster`,head:()=>({meta:[{title:`New Cluster — Harper Fabric`}]}),component:ed}),P({getParentRoute:()=>fp,path:`/edit`,head:()=>({meta:[{title:`Edit Cluster — Harper Fabric`}]}),component:ed}),P({getParentRoute:()=>fp,path:`/edit/$mode`,head:()=>({meta:[{title:`Edit Cluster — Harper Fabric`}]}),component:ed});function dp(){return(0,H.jsx)(Ee,{})}var fp=P({getParentRoute:()=>up,path:`$clusterId`,component:dp,beforeLoad:async({context:e,params:t})=>({cluster:await e.queryClient.ensureQueryData(Sa(t.clusterId))})});function pp(){let{clusterId:e}=M({strict:!1}),t=se(),n=L(),{data:r}=N(Sa(e,!0)),{user:a,isLoading:o}=ze(e),{view:s,update:c}=ys(r?.organizationId,r?.id),[l,u]=(0,U.useState)(!1),f=r?.domains?.[0]?.domain||r?.fqdn||``,[p,m]=Fs(f,f?`https://${f}`:``),v=r?`/${r.organizationId}/${r.id}`:``,y=(0,U.useCallback)(async()=>{if(r){u(!0);try{await i.establishFabricConnectAuth({id:r.id,operationsUrl:g(r)}),await t.invalidate()}catch{B.error(`Could not connect to this cluster through Fabric Connect.`)}finally{u(!1)}}},[r,t]),b=(0,U.useCallback)(()=>{r&&(i.setUserForEntity(r,null),i.flagForFabricConnect(r.id,!1)),n({to:`${v}/sign-in`})},[v,r,n]),x=(0,U.useCallback)(async()=>{if(r){try{await d({instanceClient:h({id:r.id}),entityId:r.id})}catch{}i.setUserForEntity(r,null),i.flagForFabricConnect(r.id,!1),i.flagForBasicAuth(r.id,null),await t.invalidate()}},[r,t]);if(!r)return(0,H.jsx)(hp,{children:(0,H.jsx)(gp,{})});if(!s)return(0,H.jsx)(he,{to:`/${r.organizationId}`,replace:!0});if(Es(r))return(0,H.jsx)(mp,{cluster:r});if(!r.fqdn)return(0,H.jsx)(he,{to:`${v}/instances`,replace:!0});if(r.resetPassword)return c?(0,H.jsx)(he,{to:`${v}/${r.status&&ha.includes(r.status)?`finish-setup`:`starting-up`}`,replace:!0}):(0,H.jsx)(hp,{children:(0,H.jsxs)(`div`,{className:`text-center py-12`,children:[(0,H.jsx)(Wr,{className:`size-12 text-muted-foreground mx-auto mb-4`}),(0,H.jsx)(`h1`,{className:`text-xl font-medium mb-2 text-foreground`,children:`Pending Owner Setup`}),(0,H.jsx)(`p`,{className:`text-sm text-muted-foreground max-w-md mx-auto`,children:`This cluster needs an administrator to finish setup before it can be used.`})]})});let S=i.checkForFabricConnect(r.id),C=!!a,w=i.getLastConnectMode(r.id),T=(r.instances??[]).filter(e=>e.status&&!ga.includes(e.status)).length;return(0,H.jsxs)(hp,{children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4 mb-6`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-xl bg-violet-50 text-primary dark:bg-grey-700 dark:text-violet-300 shrink-0`,children:(0,H.jsx)(Wr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light text-foreground`,children:r.name}),(0,H.jsx)(_p,{status:r.status})]}),(0,H.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[T,` `,T===1?`instance`:`instances`]}),(0,H.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,H.jsxs)(`a`,{href:`https://${f}`,target:`_blank`,rel:`noreferrer`,className:`inline-flex items-center gap-1 hover:text-foreground hover:underline`,children:[f,(0,H.jsx)(ar,{className:`size-3`})]}),(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{"aria-label":`Copy cluster URLs`,className:`rounded-md p-1 -m-1 hover:bg-accent/60 hover:text-foreground`,children:(0,H.jsx)(tr,{className:`size-3.5`})}),(0,H.jsxs)(Zo,{align:`start`,children:[(0,H.jsx)(Qo,{onClick:p,children:`Copy host name`}),(0,H.jsx)(Qo,{onClick:m,children:`Copy API URL`})]})]})]})]})]}),o?(0,H.jsx)(gp,{}):C?(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-4 text-sm`,children:[(0,H.jsx)(Kn,{className:`size-4 text-green shrink-0`}),(0,H.jsx)(`span`,{className:`font-medium text-green`,children:S?`Connected via Fabric Connect`:`Signed in directly`}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,S?`through your Harper account`:`session cookie`]})]}),(0,H.jsxs)(I,{to:`${v}/apps`,className:`group flex items-center gap-4 rounded-2xl border-2 border-primary/30 bg-primary/5 p-6 transition-all hover:border-primary hover:bg-primary/10 dark:border-violet-400/30 dark:bg-violet-400/5 dark:hover:border-violet-400 dark:hover:bg-violet-400/10`,children:[(0,H.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-primary/10 text-primary shrink-0 dark:bg-violet-400/15 dark:text-violet-300`,children:(0,H.jsx)(zr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-lg font-medium text-foreground`,children:`Enter cluster`}),(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Open the studio — apps, databases, APIs, logs, and config.`})]}),(0,H.jsx)(Mn,{className:`size-5 text-muted-foreground transition-transform group-hover:translate-x-1`})]}),(0,H.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-4 text-sm`,children:[S&&(0,H.jsx)(`button`,{type:`button`,onClick:b,className:`text-muted-foreground hover:text-foreground transition-colors`,children:`Switch to direct sign-in`}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>void x(),className:`text-muted-foreground hover:text-destructive transition-colors`,children:S?`Disconnect`:`Direct sign out`})]})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-foreground mb-3`,children:`Connect to this cluster`}),(0,H.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3.5`,children:[c&&!Es(r)&&(0,H.jsx)(vp,{icon:si,title:`Fabric Connect`,description:`Connect through your Harper account. No cluster credentials needed.`,pill:w===`fabric`?`last`:w?void 0:`recommended`,children:(0,H.jsx)(_,{className:`w-full`,disabled:l,onClick:()=>void y(),children:l?(0,H.jsx)(wr,{className:`animate-spin`}):`Fabric Connect`})}),(0,H.jsx)(vp,{icon:br,title:`Direct sign-in`,description:`Sign in with this cluster's Harper username and password.`,pill:w===`direct`?`last`:void 0,children:(0,H.jsx)(_,{className:`w-full`,variant:`outline`,onClick:b,children:`Direct sign-in`})})]})]})]})}function mp({cluster:e}){let t=se(),n=L(),r=`/${e.organizationId}/${e.id}`,a=(0,U.useMemo)(()=>(e.instances??[]).filter(e=>e.status&&!ga.includes(e.status)).sort(nc),[e.instances]),o=a.at(0),{user:s,isLoading:c}=ze(o?.id),l=!!o&&!!s,u=(0,U.useCallback)(()=>{o&&n({to:`${r}/instance/${o.id}/sign-in`})},[r,o,n]),f=(0,U.useCallback)(async()=>{if(o){try{await d({instanceClient:h({id:o.id,operationsUrl:m(o)}),entityId:o.id})}catch{}i.setUserForEntity(o,null),i.flagForBasicAuth(o.id,null),await t.invalidate()}},[o,t]);return(0,H.jsxs)(hp,{children:[(0,H.jsxs)(`div`,{className:`flex items-start gap-4 mb-6`,children:[(0,H.jsx)(`div`,{className:`flex items-center justify-center size-12 rounded-xl bg-violet-50 text-primary dark:bg-grey-700 dark:text-violet-300 shrink-0`,children:(0,H.jsx)(Wr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light text-foreground`,children:e.name}),(0,H.jsx)(`span`,{className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-0.5 rounded-full text-muted-foreground bg-muted`,children:`Self-Hosted`})]}),(0,H.jsx)(`div`,{className:`mt-1 text-sm text-muted-foreground`,children:(0,H.jsxs)(I,{to:`${r}/instances`,className:`hover:text-foreground hover:underline`,children:[a.length,` `,a.length===1?`instance`:`instances`]})})]})]}),o?c?(0,H.jsx)(gp,{}):l?(0,H.jsxs)(`div`,{children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 mb-4 text-sm`,children:[(0,H.jsx)(Kn,{className:`size-4 text-green shrink-0`}),(0,H.jsx)(`span`,{className:`font-medium text-green`,children:`Signed in directly`}),(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[`· `,o.name||o.instanceFqdn]})]}),(0,H.jsxs)(I,{to:`${r}/instance/${o.id}/`,className:`group flex items-center gap-4 rounded-2xl border-2 border-primary/30 bg-primary/5 p-6 transition-all hover:border-primary hover:bg-primary/10 dark:border-violet-400/30 dark:bg-violet-400/5 dark:hover:border-violet-400 dark:hover:bg-violet-400/10`,children:[(0,H.jsx)(`div`,{className:`flex size-12 items-center justify-center rounded-xl bg-primary/10 text-primary shrink-0 dark:bg-violet-400/15 dark:text-violet-300`,children:(0,H.jsx)(zr,{className:`size-6`})}),(0,H.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,H.jsx)(`div`,{className:`text-lg font-medium text-foreground`,children:`Enter cluster`}),(0,H.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:`Open the studio — apps, databases, APIs, logs, and config.`})]}),(0,H.jsx)(Mn,{className:`size-5 text-muted-foreground transition-transform group-hover:translate-x-1`})]}),(0,H.jsx)(`div`,{className:`mt-4 flex flex-wrap gap-4 text-sm`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>void f(),className:`text-muted-foreground hover:text-destructive transition-colors`,children:`Direct sign out`})})]}):(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`h2`,{className:`text-sm font-medium text-foreground mb-3`,children:`Connect to this cluster`}),(0,H.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3.5`,children:(0,H.jsx)(vp,{icon:br,title:`Direct sign-in`,description:`Sign in with this instance's Harper username and password.`,children:(0,H.jsx)(_,{className:`w-full`,variant:`outline`,onClick:u,children:`Direct sign-in`})})})]}):(0,H.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`This cluster has no instances yet. Register one from the`,` `,(0,H.jsx)(I,{to:`${r}/instances`,className:`underline hover:text-foreground`,children:`Instances`}),` page.`]})]})}function hp({children:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(Ks,{children:(0,H.jsx)(`div`,{className:`max-w-3xl`,children:e})})]})}function gp(){return(0,H.jsx)(`div`,{className:`flex justify-center py-10 text-muted-foreground`,children:(0,H.jsx)(wr,{className:`size-6 animate-spin`})})}function _p({status:e}){return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-0.5 rounded-full ${e&&ha.includes(e)?`text-green bg-green/10`:`text-muted-foreground bg-muted`}`,children:[(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),e?e.charAt(0)+e.slice(1).toLowerCase():`Unknown`]})}function vp({icon:e,title:t,description:n,pill:r,children:i}){return(0,H.jsxs)(`div`,{className:`relative rounded-xl p-4.5 bg-card border ${r===`last`?`border-2 border-green`:r===`recommended`?`border-2 border-primary dark:border-violet-400`:`border-border`}`,children:[r&&(0,H.jsx)(`span`,{className:`absolute -top-2.5 left-4 rounded-full bg-card`,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs px-2.5 py-0.5 rounded-full ${r===`last`?`text-green bg-green/15`:`text-primary bg-violet-50 dark:text-violet-300 dark:bg-grey-700`}`,children:[r===`last`&&(0,H.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`}),r===`last`?`Last used`:`Recommended`]})}),(0,H.jsx)(e,{className:`size-6 text-primary dark:text-violet-300 mb-2`}),(0,H.jsx)(`div`,{className:`text-[15px] font-medium text-foreground mb-1`,children:t}),(0,H.jsx)(`p`,{className:`text-[13px] text-muted-foreground leading-normal mb-4`,children:n}),i]})}function yp({children:e,className:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(Ks,{children:(0,H.jsx)(`div`,{className:t,children:e})})]})}var bp=new Set([`com`,`co`,`org`,`net`,`edu`,`gov`,`mil`,`me`,`biz`,`info`,`ac`,`or`,`ne`,`go`,`lg`,`asn`,`id`,`nom`,`sch`,`ltd`,`plc`]);function xp(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&&bp.has(r)?3:2;return t.length<=i?`@`:t.slice(0,-i).join(`.`)}function Sp({cluster:{fqdn:e},domain:{domain:t,id:n}}){let r=xp(t),[i,a,o]=Fs(r,e||``,n);return(0,H.jsxs)(`div`,{className:`grid gap-4 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,H.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,H.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:i,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:a,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:o,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]})}),(0,H.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 Cp({certificate:e,domain:t,cluster:n}){let r=xp(t.domain),[i,a,o]=Fs(r,n.fqdn||``,t.id),s=(0,U.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,H.jsxs)(`div`,{className:`w-full max-w-2xl border border-border/50 rounded-md p-4 bg-gray-900/20`,children:[(0,H.jsxs)(`div`,{className:`mb-4`,children:[(0,H.jsx)(`div`,{className:`w-full h-1.5 rounded-full overflow-clip flex shadow-sm bg-gray-800`,children:(0,H.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,H.jsx)(`div`,{className:`text-[10px] text-muted-foreground font-light mt-1 italic`,children:s.text})]}),(0,H.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] text-sm`,children:[(0,H.jsx)(`div`,{className:`col-span-1 text-xs text-muted-foreground`,children:`CNAME:`}),(0,H.jsxs)(`div`,{className:`col-span-1 flex gap-2 items-center flex-wrap`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted px-2 py-0.5 rounded text-xs`,children:[(0,H.jsx)(`span`,{className:`truncate max-w-[150px]`,title:r,children:r}),(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:i,title:`Copy Name`,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]}),(0,H.jsx)(wp,{}),(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted px-2 py-0.5 rounded text-xs`,children:[(0,H.jsx)(`span`,{className:`truncate max-w-[200px]`,title:n.fqdn||``,children:n.fqdn}),(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`h-4 w-4 p-0`,onClick:a,title:`Copy Target`,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]})]}),(0,H.jsx)(`div`,{className:`col-span-1 text-[10px] text-muted-foreground`,children:`Domain ID:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted px-2 py-0.5 rounded text-[10px] text-muted-foreground italic`,children:[(0,H.jsx)(`span`,{className:`truncate max-w-[200px]`,children:t.id}),(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`sm`,className:`h-3 w-3 p-0`,onClick:o,title:`Copy ID`,children:(0,H.jsx)(tr,{className:`w-2.5 h-2.5`})})]})})]})]})}function wp(){return(0,H.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,H.jsx)(`path`,{d:`M5 12h14`}),(0,H.jsx)(`path`,{d:`m12 5 7 7-7 7`})]})}function Tp(e){let{enabled:t,entityId:n,databaseName:r,tableName:i,searchAttribute:a,sort:o,pageIndex:s,pageSize:c,onlyIfCached:l,getAttributes:u}=e;return F({enabled:t,queryKey:[n,r,i,`search_by_value`,a,o.attribute||`default`,o.descending||!1,s||0,c||0,l,u??null],retry:!1,staleTime:6e4,gcTime:5e3,queryFn:()=>Ep(e)})}async function Ep({instanceClient:e,databaseName:t,tableName:n,searchAttribute:r,sort:i,pageIndex:a,pageSize:o,onlyIfCached:s,getAttributes:c,headers:l}){let u=i.attribute.length&&!(i.attribute===r&&!i.descending),d=await e.post(`/`,{operation:`search_by_value`,get_attributes:c??[`*`],database:t,table:n,search_attribute:r,search_value:`*`,sort:u?i:void 0,offset:a*o,limit:o,onlyIfCached:s,noCacheStore:s},{timeout:0,headers:l,validateStatus:e=>e>=200&&e<400||e===404});return d.status===404?{data:[]}:d}function Dp(e){return F({queryKey:[e,`ChallengeCertificate`],queryFn:async()=>{if(!e)return[];let{data:t}=await Ep({searchAttribute:`domain`,entityId:e,databaseName:`data`,tableName:`ChallengeCertificate`,sort:{attribute:`domain`,descending:!0},instanceClient:h({id:e,forceFabricConnect:!0}),onlyIfCached:!1,pageIndex:0,pageSize:100});return t},enabled:!!e,refetchInterval:5e3})}function Op(e){return N(Dp(e))}function kp({domain:{challengeToken:e,challengeTxtRecord:t,domain:n,id:r},cluster:{fqdn:i}}){let a=xp(n),[o,s,c,l,u]=Fs(t,e,a,i||``,r);return(0,H.jsxs)(`div`,{className:`grid gap-2 grid-cols-1 md:grid-cols-[80px_1fr] pb-6`,children:[(0,H.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,H.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TXT`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:o,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Content:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:s,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.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,H.jsx)(`div`,{className:`col-span-1`,children:`Type:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`CNAME`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Name:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:c,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`TTL:`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Auto`}),(0,H.jsx)(`div`,{className:`col-span-1`,children:`Target:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-1 flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-6 w-6 p-0 shrink-0`,onClick:l,children:(0,H.jsx)(tr,{className:`w-3.5 h-3.5`})})]})}),(0,H.jsx)(`div`,{className:`col-span-1 text-xs`,children:`Domain ID:`}),(0,H.jsx)(`div`,{className:`col-span-1 flex gap-2 items-center`,children:(0,H.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted rounded-md px-3 py-0.5 text-xs text-muted-foreground italic flex-1 overflow-hidden`,children:[(0,H.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,H.jsx)(_,{type:`button`,size:`sm`,variant:`ghost`,className:`h-5 w-5 p-0 shrink-0`,onClick:u,children:(0,H.jsx)(tr,{className:`w-3 h-3`})})]})}),(0,H.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 Ap({clusterId:e,domainIds:t,generateDomainCerts:n}){let{data:r}=await c.put(`/Cluster/${e}`,{domainIds:t,generateDomainCerts:n},{timeout:0});return r}function jp(){return j({mutationFn:e=>Ap(e)})}A.object({domainId:A.string()});async function Mp(e){let{data:t}=await c.delete(`/Domain/${e.domainId}`);return t}function Np(){return j({mutationFn:e=>Mp(e)})}function Pp(e){return[...new Set(e)]}var Fp=me();function Ip(e,t,n){let{data:r}=Op(e.id),i=(0,U.useMemo)(()=>!!r?.some(e=>!e.issueDate||e.inProgress),[r]),{mutate:a,isPending:o}=jp(),{mutate:s,isPending:c}=Np(),l=o||c,u=(0,U.useCallback)((t,n)=>{if(!Co(e.status)){B.error(`Cluster is currently `+e.status,{description:`To bind a domain, it must be running.`});return}a({clusterId:e.id,domainIds:Pp((e.domainIds?.slice()||[]).concat([t])),generateDomainCerts:n},{onSuccess:()=>{yn.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),B.success(`Domain bound!`+(n?` Certificates are being generated in the background now.`:``))}})},[a,e]),d=(0,U.useCallback)(t=>{s({domainId:t},{onSuccess:()=>{yn.invalidateQueries({queryKey:[e.organizationId,`domains`],refetchType:`active`}),B.success(`Domain removed!`)}})},[s]),f=(0,U.useCallback)(t=>{a({clusterId:e.id,domainIds:(e.domainIds?.slice()||[]).filter(e=>e!==t),generateDomainCerts:!1},{onSuccess:()=>{yn.invalidateQueries({queryKey:[e.organizationId],refetchType:`active`}),B.success(`Domain unbound!`)}})},[s]);return(0,U.useMemo)(()=>[Fp.display({id:`select`,header:`Bind`,size:50,cell:r=>{let a=r.row.original;return a.status===`ACTIVE`&&!a.clusterId&&!Es(e)?(0,H.jsx)(`label`,{className:`p-10 -m-10`,children:(0,H.jsx)(`input`,{type:`checkbox`,checked:t.includes(a.id),onChange:()=>n(a.id),disabled:l||i})}):null}}),Fp.display({header:`Domains`,id:`domain`,enableSorting:!1,size:150,cell:e=>{let t=e.row.original;return(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{children:t.domain}),(0,H.jsx)(_,{type:`button`,variant:`destructiveGhost`,className:`text-muted-foreground text-xs`,disabled:l||!!t.clusterId,onClick:()=>d(t.id),children:`Remove Domain`})]})}),(0,H.jsx)(Mi,{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!`})]})}}),Fp.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,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`div`,{children:`Bound to this cluster`}),i&&(!i.issueDate||i.inProgress)&&(0,H.jsx)(`div`,{className:`py-2`,children:(0,H.jsx)(Cp,{certificate:i,domain:n,cluster:e})}),(0,H.jsx)(_,{type:`button`,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,H.jsx)(kp,{domain:n,cluster:e}):Es(e)?`Cannot be associated with this self-managed cluster.`:n.status===`ACTIVE`&&!n.clusterId?(0,H.jsx)(Sp,{cluster:e,domain:n}):n.status}})],[e,u,l,r,i,t,n])}var Lp=A.object({domain:A.string(),organizationId:A.string()});async function Rp(e){let{data:t}=await c.post(`/Domain/`,e);return t}function zp(){return j({mutationFn:e=>Rp(e)})}async function Bp(e){let{data:t}=await c.post(`/Domain/${e}/validate`);return t}async function Vp(e){let{data:t}=await c.get(`/Domain/?organizationId=${e}`);return t}function Hp(e){return F({queryKey:[e,`domains`],queryFn:()=>Vp(e)})}function Up(){let{organizationId:e,clusterId:t}=M({strict:!1}),{data:n}=ue(Sa(t,!0)),{update:r}=vs(e),{data:i,refetch:a,isFetching:o,isRefetching:s}=N(Hp(e)),c=(0,U.useMemo)(()=>i?.filter(e=>e.status===`PENDING_VALIDATION`)||[],[i]),[u]=(0,U.useState)({attribute:`domain`,descending:!1}),d=(0,U.useMemo)(()=>[{desc:u.descending,id:u.attribute}],[u]),f=wd(a),[p,m]=(0,U.useState)([]),h=(0,U.useCallback)(e=>{m(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[]),{mutate:g,isPending:v}=jp(),y=(0,U.useCallback)(()=>{if(!Co(n.status)){B.error(`Cluster is currently `+n.status,{description:`To bind a domain, it must be running.`});return}g({clusterId:n.id,domainIds:Pp((n.domainIds?.slice()||[]).concat(p)),generateDomainCerts:!0},{onSuccess:()=>{yn.invalidateQueries({queryKey:[n.organizationId],refetchType:`active`}),B.success(`Domain(s) bound! Certificates are being generated in the background now.`),m([])}})},[n,p,g]),{mutateAsync:b,isPending:x}=zp(),S=R({resolver:z(Lp),defaultValues:{domain:``,organizationId:e}}),C=(0,U.useCallback)(async e=>{if(e){let t=e.domain.split(/[,\s]+/).map(e=>e.trim()).filter(Boolean);for(let n of t)await b({...e,domain:n});S.reset(),await a(),B.success(`${l(t.length,`Domain`,`Domains`)} added! Please add the txt record above to your domain registrar.`)}},[b,S,a]),w=(0,U.useCallback)(async()=>{let e=`Validating ${l(c.length,`domain`,`domains`)}...`,t=`validatingDomains`,n=0,r=0;for(let i of c)try{B.loading(e,{description:`${n++} of ${c.length} checked`,id:t}),await Bp(i.id)}catch{r+=1}r>0?B.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(),B.success(`Validation succeeded!`,{description:`Please take a look at the next steps for newly verified domains.`,id:t}))},[c]),T=Ip(n,p,h),E=S.watch(`domain`),ee=(0,U.useMemo)(()=>typeof E==`string`&&E.trim().split(`.`).length===2,[E]),D=(0,U.useCallback)(()=>{typeof E==`string`&&S.setValue(`domain`,`${E.trim()}, www.${E.trim()}`)},[E,S]);return(0,H.jsx)(yd,{data:i||[],isFetching:o||s,columns:T,sortingState:d,children:(0,H.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,H.jsx)(G,{...S,children:(0,H.jsxs)(`form`,{id:`cluster-add-domain-form`,name:`cluster-add-domain-form`,onSubmit:S.handleSubmit(C),className:`flex gap-1 flex-col md:flex-row`,children:[(0,H.jsx)(q,{control:S.control,name:`domain`,render:({field:e})=>(0,H.jsxs)(J,{className:`flex-1`,children:[(0,H.jsx)(Y,{className:`pb-1`,children:`New Domain Name`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`text`,enterKeyHint:`done`,autoComplete:`off`,...e})}),ee&&(0,H.jsxs)(`div`,{className:`mt-1 flex gap-4`,children:[`Adding an apex domain?`,(0,H.jsx)(_,{variant:`positiveOutline`,type:`button`,onClick:D,children:`Add www as well`})]}),(0,H.jsx)(X,{children:(0,H.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,H.jsxs)(`div`,{className:`flex-0 self-start flex gap-1 md:pt-6.5`,children:[(0,H.jsxs)(_,{type:`submit`,variant:`submit`,disabled:x,children:[(0,H.jsx)(Rr,{}),` Add`]}),c.length>0&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:w,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,H.jsx)(Cr,{}),` `,(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`V`}),`alidate`]})]}),(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:f,accessKey:`r`,type:`button`,disabled:o||s,children:[(0,H.jsx)(hn,{}),` `,(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]})]})]})}),p.length>0&&(0,H.jsx)(`div`,{className:`flex-0 self-start md:pt-6.5`,children:(0,H.jsxs)(_,{variant:`submit`,onClick:y,disabled:v,children:[(0,H.jsx)(Vr,{}),` Bind `,l(p.length,`Domain`,`Domains`)]})})]})})}function Wp(){return(0,H.jsx)(yp,{className:`flex flex-col justify-start max-w-4xl`,children:(0,H.jsx)(Up,{})})}var Gp=S({username:Ta,role:w().nonempty({error:`Please select a role.`}),password:wa.min(8,{error:`Password must be at least 8 characters long.`}),confirmPassword:w()}).refine(e=>e.password===e.confirmPassword,{error:`Passwords do not match.`,path:[`confirmPassword`]});async function Kp(e){await c.patch(`/ResetPasswordUpdater/${e}`)}async function qp(e){let{instanceClient:t,...n}=e,{data:r}=await t.post(`/`,{operation:`add_user`,...n});return r}function Jp(){return j({mutationFn:qp})}async function Yp({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 Xp(){return j({mutationFn:Yp})}async function Zp({username:e,instanceClient:t}){let{data:n}=await t.post(`/`,{operation:`drop_user`,username:e});return n}function Qp(){return j({mutationFn:Zp})}async function $p({clusterId:e,initialUsername:t,desiredUsername:n,newPassword:i,tempPassword:a,instanceClient:o}){if(!a)throw Error(`You may not have permission to set the password on this cluster.`);let s=o;try{let o=await va({username:t,password:a,instanceClient:s,entityId:e});return o.instanceClient&&(s=o.instanceClient),n===`HDB_ADMIN`?await Yp({username:n,password:i,instanceClient:s}):(await qp({username:n,password:i,role:`super_user`,active:!0,instanceClient:s}),await va({username:n,password:i,instanceClient:s,entityId:e}),await Zp({username:r,instanceClient:s})),await Kp(e),o}catch(t){throw await d({entityId:e,instanceClient:s}),t}}function em(){return j({mutationFn:$p})}function tm(){let{user:e}=He(),{clusterId:t}=M({strict:!1}),{data:n}=N(Sa(t,!0)),a=L(),o=(0,U.useMemo)(()=>g(n),[n]),s=Fi({operationsUrl:o}),{redirect:c}=pe({strict:!1}),l=se(),u=R({resolver:z(Gp),defaultValues:{confirmPassword:``,password:``,role:`super_user`,username:e?.email??``}}),{setFocus:d,control:f,handleSubmit:p}=u;(0,U.useEffect)(()=>{d(`password`)},[d]);let m=n?.instances?.find(e=>e.tempPassword)?.tempPassword,{mutate:h,isPending:v}=em(),y=(0,U.useCallback)(async e=>{if(!o){B.error(`Cluster is not yet fully loaded, please wait a moment before trying to sign in.`);return}h({instanceClient:s,clusterId:t,newPassword:e.password,tempPassword:m,initialUsername:r,desiredUsername:e.username},{onSuccess:async({message:e,user:t})=>{B.success(e),i.setUserForEntity(n,t),l.invalidate(),await a({to:c?.startsWith(`/`)?c:`../`})}})},[n,t,s,a,o,c,l,h,m]);return n&&!n.resetPassword?(0,H.jsx)(he,{to:`../sign-in`,replace:!0}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`fixed top-20 w-full h-12 z-39 px-4 md:px-12 bg-violet-50 border-b border-violet-100 dark:bg-grey-700 dark:border-none flex items-center`,children:(0,H.jsx)(ua,{})}),(0,H.jsx)(`div`,{className:`items-center justify-center flex mt-32 py-4 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,H.jsxs)(`div`,{className:`text-foreground w-xs`,children:[(0,H.jsx)(`h1`,{className:`text-2xl font-light`,children:`Create Admin User`}),(0,H.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,H.jsx)(G,{...u,children:(0,H.jsxs)(`form`,{id:`cluster-create-admin-form`,name:`cluster-create-admin-form`,onSubmit:p(y),className:`my-4`,children:[(0,H.jsx)(q,{control:f,name:`username`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Username`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{autoComplete:`username`,type:`text`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f,name:`password`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,autoComplete:`new-password`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:f,name:`confirmPassword`,render:({field:e})=>(0,H.jsxs)(J,{className:`my-4`,children:[(0,H.jsx)(Y,{children:`Confirm Password`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`password`,autoComplete:`new-password`,...e})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(_,{disabled:v,type:`submit`,variant:`submit`,className:`w-full my-2`,children:`Create Admin User`})]})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground flex gap-2 align-middle`,children:[(0,H.jsx)(On,{size:36,className:`flex-none`}),(0,H.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 nm({columns:e,data:t,renderRowWrapper:n}){let r=be({data:t,columns:e,getCoreRowModel:Te()});return(0,H.jsx)(`div`,{className:`bg-card dark:bg-black-dark rounded-md`,children:(0,H.jsxs)(fd,{children:[(0,H.jsx)(pd,{children:r.getHeaderGroups().map(e=>(0,H.jsx)(hd,{className:`border-none`,children:e.headers.map(e=>(0,H.jsx)(gd,{className:`p-4`,style:{width:`${e.getSize()}%`},children:e.isPlaceholder?null:De(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(md,{className:`bg-background dark:bg-black`,children:r.getRowModel().rows?.length?r.getRowModel().rows.map(e=>{let t=(0,H.jsx)(hd,{"data-state":e.getIsSelected()&&`selected`,className:`hover:bg-muted/10 data-[state=selected]:bg-muted`,children:e.getVisibleCells().map(e=>(0,H.jsx)(vd,{className:`p-4`,style:{width:`${e.column.getSize()}%`},children:De(e.column.columnDef.cell,e.getContext())},e.id))});return(0,H.jsx)(U.Fragment,{children:n?n(e.original,t):t},e.id)}):(0,H.jsx)(hd,{children:(0,H.jsx)(vd,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})})}function rm(){return(0,H.jsx)(`div`,{className:`flex-col items-center justify-center px-16 space-y-3 text-center pt-30`,children:(0,H.jsx)(`p`,{children:`No instances found.`})})}async function im({instance:e,instanceClient:t}){try{await d({instanceClient:t,entityId:e.id})}catch{}i.signOutLocally(e.id),e.clusterId&&i.signOutLocally(e.clusterId)}function am({entityId:e,instanceClient:t},n){return F({queryKey:[`get_status`,e],staleTime:9e3,refetchInterval:1e4,retryDelay:1e4,throwOnError:!1,enabled:n,queryFn:async()=>{let{data:e}=await t.post(`/`,{operation:`get_status`});return e}})}function om(e,t){return e?.systemStatus?.find(e=>e.id===t)?.status}async function sm({instanceClient:e,id:t,status:n}){let{data:r}=await e.post(`/`,{operation:`set_status`,id:t,status:n});return r}function cm(){return j({mutationFn:sm,onSuccess:(e,t)=>yn.invalidateQueries({queryKey:[`get_status`,t.entityId]})})}var lm=[`CLONE_READY`,`RUNNING`,`UPDATED`,`PENDING_UPGRADE`];function um(e,t,n){let{user:r}=ze(e.id),a=(0,U.useMemo)(()=>m(e),[e]),o=Fi({operationsUrl:a}),{update:s}=xs(),c=i.checkForFabricConnect(e.id),l=W({operationsUrl:a,instanceId:e.id,forceFabricConnect:!0}),{data:u}=N(am(l,n&&s)),d=om(u,`availability`)||`Unknown`,f=d===`Available`,p=d===`Unavailable`,{mutate:h,isPending:g}=cm(),_=e.instanceFqdn,v=Gu({secure:e.operationsApiSecure?`true`:`false`,port:e.operationsApiPort,fqdn:e.instanceFqdn}),[y,b]=Fs(_??``,v),x=(0,U.useCallback)(async()=>{await im({instance:e,instanceClient:o})},[e,o]),S=!!e.status&&lm.includes(e.status),C=!!r&&!c,w=S,T=!!_,E=s&&S&&(f||p),ee=[w&&C&&{key:`direct-connect`,to:`../instance/${e.id}/`,icon:(0,H.jsx)(Wr,{className:`text-green`}),label:`Direct Connect`},w&&C&&{key:`direct-sign-out`,onClick:x,variant:`destructive`,icon:(0,H.jsx)(Dr,{}),label:`Direct Sign Out`},w&&!C&&s&&!t&&{key:`fabric-connect`,to:`../instance/${e.id}/`,icon:(0,H.jsx)(Wr,{className:`text-green`}),label:`Fabric Connect`},w&&!C&&{key:`direct-sign-in`,to:`../instance/${e.id}/sign-in`,icon:(0,H.jsx)(Er,{}),label:`Direct Sign In`},w&&T&&{type:`separator`,key:`copy-sep`},T&&{key:`copy-fqdn`,onClick:y,icon:(0,H.jsx)(Xn,{}),label:`Copy Instance FQDN`},T&&{key:`copy-api`,onClick:b,icon:(0,H.jsx)(Xn,{}),label:`Copy API URL`},(w||T)&&E&&{type:`separator`,key:`rotation-sep`},E&&f&&{key:`out-of-rotation`,variant:`destructive`,disabled:g,onClick:()=>h({...l,id:`availability`,status:`Unavailable`}),icon:(0,H.jsx)(qr,{}),label:`Bring out of rotation`},E&&p&&{key:`into-rotation`,disabled:g,onClick:()=>h({...l,id:`availability`,status:`Available`}),icon:(0,H.jsx)(Kr,{}),label:`Bring back into rotation`}].filter(di);return ee.length?[{type:`label`,key:`label`,className:`text-gray-600 text-xs`,label:`Options`},{type:`separator`,key:`label-sep`},...ee]:[]}function dm({instance:e,isSelfManaged:t}){let[n,r]=(0,U.useState)(!1),i=um(e,t,n);return i.length?(0,H.jsxs)(Yo,{open:n,onOpenChange:r,children:[(0,H.jsx)(Xo,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":`Instance options`,children:(0,H.jsx)(ir,{})})}),(0,H.jsx)(Zo,{align:`end`,className:`min-w-48`,children:ms(i,`dropdown`)})]}):null}function fm({isSelfManaged:e,instance:t}){let{user:n,isLoading:r}=ze(t.id),a=Fi({operationsUrl:(0,U.useMemo)(()=>m(t),[t])}),{update:o}=xs(),s=i.checkForFabricConnect(t.id),c=(0,U.useCallback)(async()=>{await im({instance:t,instanceClient:a})},[t,a]);return r||!t.status||![`CLONE_READY`,`RUNNING`,`UPDATED`,`PENDING_UPGRADE`].includes(t.status)?(0,H.jsx)(wr,{className:`animate-spin`,color:`gray`}):!n||s?(0,H.jsxs)(`span`,{className:`flex gap-4`,children:[o&&!e&&(0,H.jsx)(I,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Connect to ${t.name} instance`,title:`Connect to ${t.name} instance`,children:(0,H.jsx)(_,{variant:`positiveOutline`,children:`Fabric Connect`})}),(0,H.jsx)(I,{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,H.jsx)(_,{variant:o?`defaultOutline`:`positiveOutline`,children:`Direct Sign In`})})]}):(0,H.jsxs)(`span`,{className:`flex gap-4`,children:[(0,H.jsx)(I,{to:`../instance/${t.id}/`,className:`text-sm`,"aria-label":`Go to ${t.name} instance`,title:`Go to ${t.name} instance`,children:(0,H.jsx)(_,{variant:`positiveOutline`,children:`Direct Connect`})}),(0,H.jsx)(_,{variant:`destructiveOutline`,className:`text-sm`,"aria-label":`Sign out from ${t.name} instance`,title:`Sign out from ${t.name} instance`,onClick:c,children:`Direct Sign Out`})]})}function pm({instance:e,isSelfManaged:t,children:n}){let[r,i]=(0,U.useState)(!1),a=um(e,t,r);return a.length?(0,H.jsxs)(os,{onOpenChange:i,children:[(0,H.jsx)(ss,{asChild:!0,children:n}),(0,H.jsx)(cs,{className:`min-w-48`,children:ms(a,`context`)})]}):(0,H.jsx)(H.Fragment,{children:n})}function mm({instance:e,index:t}){let{update:n}=xs(),r=W({operationsUrl:(0,U.useMemo)(()=>m(e),[e]),instanceId:e.id,forceFabricConnect:!0}),{mutate:i,isPending:a}=cm(),[o,s]=(0,U.useState)(!1);(0,U.useEffect)(()=>{let e=setTimeout(()=>s(!0),t*500);return()=>clearTimeout(e)},[t]);let{data:c,isLoading:l,isFetching:u}=N(am(r,o&&n)),d=om(c,`availability`)||`Unknown`,f=d===`Available`,p=d===`Unavailable`;return n?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(`div`,{className:`flex items-center`,children:l||!o||u&&!c?(0,H.jsx)(wr,{className:`animate-spin size-5 text-muted-foreground`}):(0,H.jsx)(Va,{variant:f?`success`:p?`destructive`:`default`,className:`size-4 rounded-full p-0`,children:(0,H.jsx)(`span`,{className:`sr-only`,children:f?`Online`:`Offline`})})})}),(0,H.jsxs)(Mi,{children:[u&&c?`Refreshing... `:``,d]})]}),n&&(0,H.jsxs)(`div`,{className:`flex gap-1`,children:[f&&(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`destructiveGhost`,size:`icon`,onClick:()=>i({...r,id:`availability`,status:`Unavailable`}),disabled:a,children:a?(0,H.jsx)(wr,{className:`animate-spin size-4`}):(0,H.jsx)(qr,{className:`size-4`})})}),(0,H.jsx)(Mi,{children:`Bring out of rotation`})]}),p&&(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsx)(_,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i({...r,id:`availability`,status:`Available`}),disabled:a,children:a?(0,H.jsx)(wr,{className:`animate-spin size-4`}):(0,H.jsx)(Kr,{className:`size-4`})})}),(0,H.jsx)(Mi,{children:`Bring back into rotation`})]})]})]}):null}function hm(){let{clusterId:e}=M({strict:!1}),{data:t,isLoading:n}=N(Sa(e,!0)),r=Es(t),i=(0,U.useMemo)(()=>[{id:`instanceActions`,size:1,minSize:1,cell:e=>(0,H.jsx)(`div`,{className:`flex justify-end gap-2 items-center`,children:(0,H.jsx)(fm,{isSelfManaged:r,instance:e.row.original})})},r&&{accessorKey:`instanceFqdn`,size:90,header:`URL`,cell:e=>Gu({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,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(mm,{instance:e.row.original,index:e.row.index}),t?(0,H.jsx)(Va,{variant:So(t),children:ca(t)}):null]})}},!r&&{accessorKey:`version`,size:1,minSize:1,header:`Version`},!r&&{accessorKey:`storageGb`,size:1,minSize:1,header:`Storage`,cell:e=>`${e.getValue()} GB`},!r&&{accessorKey:`usedStorageGb`,size:1,minSize:1,header:`Used Storage`,cell:e=>{let t=e.getValue();return t===void 0?`-`:`${t} GB`}},!r&&{accessorKey:`cpuCores`,size:1,minSize:1,header:`Cores/Threads`,cell:e=>(0,H.jsxs)(H.Fragment,{children:[e.row.original.cpuCores,` / `,e.row.original.threads]})},!r&&{accessorKey:`memoryMb`,size:1,minSize:1,header:`Memory`,cell:e=>`${e.getValue()/1024} GB`},{id:`instanceMenu`,size:1,minSize:1,cell:e=>(0,H.jsx)(`div`,{className:`flex justify-end`,children:(0,H.jsx)(dm,{isSelfManaged:r,instance:e.row.original})})}].filter(di),[r]),a=(0,U.useMemo)(()=>t?.instances?t.instances.filter(e=>e.status&&!ga.includes(e.status)).sort(nc):[],[t]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(Ks,{children:(0,H.jsx)(fn,{className:`p-0 min-h-96`,children:(0,H.jsx)(un,{className:`p-0 min-h-96`,children:n?(0,H.jsx)(ou,{}):a.length?(0,H.jsx)(nm,{data:a,columns:i,renderRowWrapper:(e,t)=>(0,H.jsx)(pm,{instance:e,isSelfManaged:r,children:t})}):(0,H.jsx)(rm,{})})})})]})}function gm(){let{clusterId:e}=M({strict:!1}),{immediate:t}=pe({strict:!1}),n=t===!0||t===`true`,{data:r,isLoading:i}=N(Sa(e,2e3)),a=r?.status,o=(0,U.useMemo)(()=>a&&ha.includes(a),[a]);return i||!r?(0,H.jsx)(yp,{className:`flex justify-center`,children:(0,H.jsx)(ou,{})}):o?(0,H.jsx)(yp,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`All done!`}),(0,H.jsx)(As,{cluster:r,forceProgressBarVisible:!0}),(0,H.jsx)(`p`,{children:`Your cluster finished updating, and is ready for interaction.`}),(0,H.jsx)(`div`,{className:`text-center`,children:(0,H.jsx)(Ds,{cluster:r})})]})}):(0,H.jsx)(yp,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,H.jsx)(As,{cluster:r,forceProgressBarVisible:!0}),(0,H.jsxs)(`p`,{children:[n?`Your cluster is applying the latest changes immediately, without waiting to take instances out of rotation.`:`Your cluster is updating with the latest changes. This includes waiting several minutes to let traffic drain safely.`,` `,(0,H.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,H.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 _m({children:e,className:t}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(xo,{}),(0,H.jsx)(`div`,{className:b(`mt-32 px-4 py-4 md:px-12 min-h-[calc(100vh-(--spacing(32)))] flex justify-center`,t),children:e})]})}function vm(){let e=se(),{clusterId:t}=M({strict:!1}),{data:n,isLoading:r}=N(Sa(t,2e3)),i=n?.status,a=(0,U.useMemo)(()=>i&&ha.includes(i),[i]),o=wo(i),[,s]=xn(Cn.SavedClusterState,null),c=(0,U.useCallback)(()=>{s(n),e.navigate({to:`/${n.organizationId}/new-cluster`})},[n,e,s]);return r||!n?(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsx)(ou,{})}):o?(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4 items-center`,children:[(0,H.jsx)(Zn,{className:`w-24 h-24`}),(0,H.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,H.jsx)(Rs,{}),` if you want more help.`]}),(0,H.jsx)(_,{type:`button`,variant:`positiveOutline`,onClick:c,children:`Try Again`})]})}):a?(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`It's ready!`}),(0,H.jsx)(As,{cluster:n,forceProgressBarVisible:!0}),(0,H.jsxs)(`p`,{children:[`Let's set up your secure, browser-to-cluster connection now.`,` `,(0,H.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,H.jsx)(`em`,{children:`Direct Connect`}),`! Once you create your user, you will have the option to`,` `,(0,H.jsx)(`em`,{children:`Fabric Connect`}),` from your Fabric account without having to sign in again.`]})]}),(0,H.jsx)(`div`,{className:`text-center`,children:(0,H.jsx)(Ds,{cluster:n})})]})}):(0,H.jsx)(_m,{className:`flex justify-center`,children:(0,H.jsxs)(`div`,{className:`center max-w-2xl flex flex-col gap-4`,children:[(0,H.jsx)(`h1`,{className:`text-xl text-center`,children:`Here we go!`}),(0,H.jsx)(As,{cluster:n,forceProgressBarVisible:!0}),(0,H.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,H.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,H.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.`]})]})]})})}P({getParentRoute:()=>fp,path:`instances`,head:()=>({meta:[{title:`Instances — Harper Fabric`}]}),component:hm}),P({getParentRoute:()=>fp,path:`starting-up`,head:()=>({meta:[{title:`Starting Up — Harper Fabric`}]}),component:vm}),P({getParentRoute:()=>fp,path:`scaling`,head:()=>({meta:[{title:`Scaling — Harper Fabric`}]}),component:gm}),P({getParentRoute:()=>fp,path:`domains`,head:()=>({meta:[{title:`Domains — Harper Fabric`}]}),component:Wp});function ym({location:e,params:t}){let n=i.checkForFabricConnect(t.clusterId);if(i.getConnectionById(t.clusterId).user&&!n){let t=e?.search?.redirect;throw xe({to:t?.startsWith(`/`)?t:`../`})}}function bm({location:e,params:t}){let n=i.checkForFabricConnect(t.instanceId);if(i.getConnectionById(t.instanceId).user&&!n){let t=e?.search?.redirect;throw xe({to:t?.startsWith(`/`)?t:`../`})}}P({getParentRoute:()=>fp,path:`sign-in`,head:()=>({meta:[{title:`Sign In — Harper Fabric`}]}),component:Ma,beforeLoad:ym}),P({getParentRoute:()=>fp,path:`instance/$instanceId/sign-in`,head:()=>({meta:[{title:`Sign In — Harper Fabric`}]}),component:Ma,beforeLoad:bm}),P({getParentRoute:()=>fp,path:`finish-setup`,head:()=>({meta:[{title:`Create Admin User — Harper Fabric`}]}),component:tm}),P({getParentRoute:()=>fp,path:`/`,head:()=>({meta:[{title:`Cluster — Harper Fabric`}]}),component:pp});function xm(e){return P({getParentRoute:()=>e,path:`apis`,head:()=>({meta:[{title:`APIs — Harper Fabric`}]})}).lazy(()=>Pe(()=>import(`./index.lazy-CAmCIA65.js`).then(e=>e.route),__vite__mapDeps([7,2,8,9,10,1,11,12,13,14])))}function Sm(e,t){return[P({getParentRoute:()=>e,path:t===`cluster`?`apps`:`/`,head:()=>({meta:[{title:`Applications — Harper Fabric`}]}),component:Ce(()=>Pe(()=>import(`./applications-C0jT2vdZ.js`),__vite__mapDeps([15,2,8,9,10,1,11,12,16,17,18,19,20,21,22,23,24,3,4,13,6,25])),`ApplicationsEditor`)})]}async function Cm({instanceClient:e}){let{data:t}=await e.post(`/`,{operation:`list_certificates`});return t}function wm(e){return F({queryKey:[e.entityId,`list_certificates`],queryFn:()=>Cm(e)})}var Tm=[{header:`Certificate Name`,accessorKey:`name`,enableSorting:!0},{header:`Issuer`,accessorKey:`details.issuer`,enableSorting:!0},me().display({header:`Expires At`,enableSorting:!1,id:`details.valid_to`,cell:e=>e.row.original.details.valid_to?new Date(e.row.original.details.valid_to).toLocaleString():`N/A`})];function Em({className:e,...t}){return(0,H.jsx)(`textarea`,{"data-slot":`input`,className:p(`border-input file:text-foreground placeholder:text-muted-foreground selection:bg-purple
|
|
13
13
|
selection:text-primary-foreground
|
|
14
14
|
dark:aria-invalid:outline-destructive dark:aria-invalid:ring-destructive/50 ring-ring/10
|
|
15
15
|
dark:ring-ring/20 dark:outline-ring/40 outline-ring/50 aria-invalid:outline-destructive/60
|
|
@@ -24,7 +24,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24
24
|
`),n=-1,r=0;if(e!==-1&&(t===-1||e<t)?(n=e,r=2):t!==-1&&(n=t,r=4),n===-1)return;let a=i.slice(0,n);i=i.slice(n+r);let o=Zm(a);o&&(yield o)}}}function Zm(e){let t=e.split(/\r?\n/),n=`message`,r,i,a=[];for(let e of t){if(e===``||e.startsWith(`:`))continue;let t=e.indexOf(`:`),o=t===-1?e:e.slice(0,t),s=t===-1?``:e.slice(t+1);switch(s.startsWith(` `)&&(s=s.slice(1)),o){case`event`:n=s;break;case`data`:a.push(s);break;case`id`:r=s;break;case`retry`:{let e=Number(s);Number.isFinite(e)&&(i=e);break}}}return a.length===0&&n===`message`?null:{event:n,data:a.join(`
|
|
25
25
|
`),id:r,retry:i}}function Qm(e){try{return JSON.parse(e.data)}catch{return e.data}}var $m=class extends Error{constructor(e,t){super(e,t),this.name=`SSEUnsupportedError`}},eh=class extends Error{constructor(e,t){super(e,t),this.name=`SSEInconclusiveError`}},th=class extends Error{code;phase;deploymentId;constructor(e,t){super(e),this.name=`SSEOperationError`,this.code=t?.code,this.phase=t?.phase,this.deploymentId=t?.deploymentId}};function nh({id:e=u,operationsUrl:t,port:n,secure:r,forceFabricConnect:a,disableFabricConnect:o}={}){let s=t||i.getOperationsUrl(e);if(s&&(n||r!==void 0)){let e=new URL(s);n&&(e.port=String(n)),r!==void 0&&(e.protocol=r?`https:`:`http:`),s=e.toString()}let l=i.checkForBasicAuth(e),d=a||o||l?void 0:i.getOperationToken(e),f=!d&&!o&&(a||i.checkForFabricConnect(e));if(f&&(e.startsWith(`clu-`)?s=c.defaults.baseURL+`/Cluster/${e}/operation`:e.startsWith(`ins-`)&&(s=c.defaults.baseURL+`/HDBInstance/${e}/operation`)),!s)throw Error(`No operations URL is known for "${e}"; cannot open an SSE stream.`);let p={"Content-Type":`application/json`,Accept:`text/event-stream`};return d?p.Authorization=`Bearer ${d}`:l&&!f&&(p.Authorization=`Basic ${btoa(`${l.username}:${l.password}`)}`),{url:s.replace(/\/+$/,``)+`/`,headers:p,credentials:f||!l&&!d?`include`:`same-origin`,mode:f?`proxy`:`direct`}}async function rh({connection:e,body:t,signal:n,idleTimeoutMs:r=12e4,onMessage:i}){let{url:a,headers:o,credentials:s}=nh(e),c=new AbortController,{signal:l,cleanup:u}=ih([n,c.signal]),d,f=()=>{d&&clearTimeout(d),d=setTimeout(()=>c.abort(),r)};try{let e;try{f(),e=await fetch(a,{method:`POST`,headers:o,credentials:s,body:JSON.stringify(t),signal:l})}catch(e){throw n?.aborted?e:new $m(`Failed to open the SSE stream.`,{cause:e})}let r=e.headers.get(`content-type`)??``;if(!e.ok||!r.includes(`text/event-stream`)||!e.body)throw await e.body?.cancel().catch(()=>{}),new $m(`Server did not return an event stream (status ${e.status}, content-type "${r}").`);let u=!1,d;try{for await(let t of Xm(e.body,l)){if(f(),i?.(t),t.event===`done`){u=!0;let e=Qm(t);d=e?.result??e;break}if(t.event===`error`){u=!0;let e=Qm(t);if(!e||typeof e!=`object`)throw new th(typeof e==`string`&&e?e:`The operation failed.`);let n=e;throw new th(vn(n.message)??`The operation failed.`,{code:n.code,phase:n.phase,deploymentId:n.deployment_id})}}}catch(e){throw c.signal.aborted&&!n?.aborted?new eh(`The stream went idle before completing.`,{cause:e}):e}if(!u)throw new eh(`The stream ended without a terminal event.`);return d}finally{clearTimeout(d),u()}}function ih(e){let t=()=>{},n=e.filter(e=>!!e);if(n.length===1)return{signal:n[0],cleanup:t};if(typeof AbortSignal.any==`function`)return{signal:AbortSignal.any(n),cleanup:t};let r=new AbortController;function i(){for(let e of n)e.removeEventListener(`abort`,a)}function a(e){r.abort(e.target.reason),i()}for(let e of n){if(e.aborted){r.abort(e.reason),i();break}e.addEventListener(`abort`,a)}return{signal:r.signal,cleanup:i}}var ah=[`prepare`,`load`,`replicate`,`restart`,`success`];async function oh({connection:e,package:t,project:n,replicated:r,install_command:i,restart:a,signal:o,onEvent:s}){return await rh({connection:e,body:{operation:`deploy_component`,package:t,project:n,replicated:r,install_command:i||void 0,restart:a},signal:o,onMessage:e=>{if(s)switch(e.event){case`phase`:s({type:`phase`,data:Qm(e)});break;case`install`:s({type:`install`,data:Qm(e)});break;case`peer`:s({type:`peer`,data:Qm(e)});break}}})??{}}var sh={prepare:`Prepare`,load:`Load`,replicate:`Replicate`,restart:`Restart`,success:`Finish`};function ch({status:e,isCurrent:t}){return e===`done`?(0,H.jsx)(pn,{className:`size-4 text-success`}):e===`error`?(0,H.jsx)(_n,{className:`size-4 text-destructive`}):e===`start`||t?(0,H.jsx)(wr,{className:`size-4 animate-spin text-primary`}):(0,H.jsx)(qn,{className:`size-4 text-muted-foreground`})}function lh({state:e}){let t=(0,U.useRef)(null);(0,U.useEffect)(()=>{t.current?.scrollIntoView({block:`end`})},[e.installLog.length]);let n=e.lifecycle===`error`;return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(`ol`,{className:`flex flex-col gap-2`,children:ah.map(t=>{let n=e.phases[t];return(0,H.jsxs)(`li`,{className:`flex items-center gap-2 text-sm`,children:[(0,H.jsx)(ch,{status:n,isCurrent:e.currentPhase===t&&n!==`done`}),(0,H.jsx)(`span`,{className:p(n?`text-foreground`:`text-muted-foreground`),children:sh[t]??t})]},t)})}),e.installLog.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(qm,{className:`mb-2`}),(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Install output`}),(0,H.jsx)(Jm,{className:`h-40 rounded-md border bg-muted/40`,children:(0,H.jsxs)(`pre`,{className:`whitespace-pre-wrap break-words p-2 font-mono text-xs leading-relaxed`,children:[e.installLog.map(e=>(0,H.jsx)(`div`,{className:p(e.stream===`stderr`&&`text-destructive`),children:e.line},e.id)),(0,H.jsx)(`div`,{ref:t})]})})]}),e.peers.length>0&&(0,H.jsxs)(`div`,{children:[(0,H.jsx)(qm,{className:`mb-2`}),(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Replication`}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:e.peers.map((e,t)=>{let n=e.status===`failed`,r=vn(e.error??e.reason);return(0,H.jsxs)(`li`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{className:`flex items-center gap-2`,children:[n?(0,H.jsx)(_n,{className:`size-4 text-destructive`}):(0,H.jsx)(pn,{className:`size-4 text-success`}),(0,H.jsx)(`span`,{className:`truncate`,children:e.node??`node ${t+1}`})]}),n&&r&&(0,H.jsx)(`span`,{className:`truncate text-xs text-destructive`,children:r})]},t)})})]}),n&&e.error&&(0,H.jsxs)(`div`,{className:`flex items-start gap-2 text-sm text-destructive`,children:[(0,H.jsx)(Jn,{className:`mt-0.5 size-4 shrink-0`}),(0,H.jsx)(`span`,{children:e.error})]}),e.lifecycle===`inconclusive`&&(0,H.jsx)(Va,{variant:`warning`,className:`self-start`,children:`Live updates ended early — verifying…`})]})}var uh={lifecycle:`idle`,phases:{},installLog:[],peers:[]},dh=1e3;function fh(e,t){switch(t.kind){case`reset`:return uh;case`start`:return{...uh,lifecycle:`streaming`};case`event`:{let{event:n}=t;if(n.type===`phase`){let{phase:t,status:r}=n.data;return{...e,lifecycle:`streaming`,phases:{...e.phases,[t]:r},currentPhase:r===`start`?t:e.currentPhase}}if(n.type===`install`){let t=(e.installLog[e.installLog.length-1]?.id??0)+1,r=e.installLog.concat({id:t,stream:n.data.stream,line:n.data.line});return{...e,installLog:r.length>dh?r.slice(-1e3):r}}return{...e,peers:e.peers.concat(n.data)}}case`settled`:return{...e,lifecycle:t.lifecycle,error:t.error}}}function ph(){let[e,t]=(0,U.useReducer)(fh,uh),n=(0,U.useCallback)(e=>t({kind:`event`,event:e}),[]),r=(0,U.useCallback)(()=>t({kind:`start`}),[]),i=(0,U.useCallback)(()=>t({kind:`reset`}),[]),a=(0,U.useCallback)((e,n)=>t({kind:`settled`,lifecycle:e,error:n}),[]);return(0,U.useMemo)(()=>({state:e,onEvent:n,markStarted:r,markSettled:a,reset:i}),[e,n,r,a,i])}function mh({entityId:e,instanceClient:t}){return F({queryKey:[`registration_info`,e],staleTime:6e4,gcTime:5e3,queryFn:async()=>{let{data:e}=await t.post(`/`,{operation:`registration_info`});return e}})}function hh(){let{data:e}=N(mh(W()));return!!e?.version&&oc(`5.1.0`,e.version)}function gh(){let e=W();return hh()&&i.isDirectConnection(e.entityId)}async function _h({instanceClient:e,deploymentId:t}){let{data:n}=await e.post(`/`,{operation:`get_deployment`,deployment_id:t});return n}function vh(e){return F({queryKey:[e.entityId,`get_deployment`,e.deploymentId],queryFn:()=>_h(e),retry:!1,refetchInterval:t=>e.pollWhileActive&&!Im(t.state.data?.status)?2e3:!1})}async function yh({connection:e,deploymentId:t,signal:n,onEvent:r}){return await rh({connection:e,body:{operation:`get_deployment`,deployment_id:t},signal:n,onMessage:e=>{if(r)switch(e.event){case`phase`:r({type:`phase`,data:Qm(e)});break;case`install`:r({type:`install`,data:Qm(e)});break;case`peer`:r({type:`peer`,data:Qm(e)});break}}})??{}}function bh({label:e,value:t}){return t==null||t===``?null:(0,H.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e}),(0,H.jsx)(`span`,{className:`break-words text-sm`,children:t})]})}function xh(e){return e?Sd((Date.now()-e)/1e3,e):void 0}function Sh({deploymentId:e}){let t=W(),n=gh(),r=le(),i=ph(),{data:a,isLoading:o,error:s}=N(vh({...t,deploymentId:e,pollWhileActive:!0})),c=!!a&&!Im(a.status);if((0,U.useEffect)(()=>{if(!n||!c)return;let a=new AbortController;return i.reset(),i.markStarted(),yh({connection:{id:t.entityId},deploymentId:e,signal:a.signal,onEvent:i.onEvent}).then(()=>i.markSettled(`success`)).catch(()=>{a.signal.aborted||i.markSettled(`inconclusive`)}).finally(()=>{a.signal.aborted||r.invalidateQueries({queryKey:[t.entityId,`get_deployment`,e]})}),()=>a.abort()},[n,c,e,t.entityId]),o)return(0,H.jsx)(zs,{className:`flex h-full flex-col items-center justify-center`,text:`Loading deployment...`});if(s||!a)return(0,H.jsx)(`div`,{className:`p-4 text-sm text-destructive`,children:`Could not load this deployment.`});let l=c&&(i.state.installLog.length>0||Object.keys(i.state.phases).length>0);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-4 p-1`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(`h2`,{className:`text-lg font-semibold`,children:a.project}),(0,H.jsx)(Um,{status:a.status}),a.phase&&(0,H.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:a.phase})]}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 md:grid-cols-3`,children:[(0,H.jsx)(bh,{label:`Deployment ID`,value:(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:a.deployment_id})}),(0,H.jsx)(bh,{label:`User`,value:a.user}),(0,H.jsx)(bh,{label:`Origin node`,value:a.origin_node}),(0,H.jsx)(bh,{label:`Started`,value:xh(a.started_at)}),(0,H.jsx)(bh,{label:`Completed`,value:xh(a.completed_at)}),(0,H.jsx)(bh,{label:`Restart mode`,value:a.restart_mode??void 0}),(0,H.jsx)(bh,{label:`Package`,value:a.package_identifier??void 0}),(0,H.jsx)(bh,{label:`Payload size`,value:a.payload_size==null?void 0:Au(a.payload_size)}),(0,H.jsx)(bh,{label:`Payload hash`,value:a.payload_hash?(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:a.payload_hash}):void 0}),(0,H.jsx)(bh,{label:`Restorable`,value:a.restorable===void 0?void 0:a.restorable?`Yes`:`No`}),(0,H.jsx)(bh,{label:`Rollback of`,value:a.rollback_of?(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:a.rollback_of}):void 0})]}),l&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(qm,{}),(0,H.jsx)(lh,{state:i.state})]}),a.error&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(qm,{}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-md border border-destructive/40 bg-destructive/5 p-3 text-sm`,children:[(0,H.jsxs)(`span`,{className:`font-medium text-destructive`,children:[`Error`,typeof a.error.phase==`string`&&a.error.phase?` during ${a.error.phase}`:``,typeof a.error.code==`string`||typeof a.error.code==`number`?` (${a.error.code})`:``]}),(0,H.jsx)(`span`,{className:`break-words`,children:vn(a.error)??`Unknown error`})]})]}),!!a.peer_results?.length&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(qm,{}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Replication`}),(0,H.jsx)(`ul`,{className:`flex flex-col gap-1 text-sm`,children:a.peer_results.map((e,t)=>{let n=vn(e.error);return(0,H.jsxs)(`li`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate`,children:e.node}),(0,H.jsxs)(`span`,{className:e.status===`failed`?`text-destructive`:`text-success`,children:[e.status??`ok`,n?`: ${n}`:``]})]},e.node??t)})})]})]}),!!a.event_log?.length&&(0,H.jsx)(Ch,{deployment:a})]})}function Ch({deployment:e}){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(qm,{}),(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`div`,{className:`mb-1 text-xs font-medium text-muted-foreground`,children:`Activity`}),(0,H.jsx)(`ol`,{className:`flex flex-col gap-1 text-xs`,children:e.event_log.map((e,t)=>(0,H.jsxs)(`li`,{className:`flex gap-2`,children:[(0,H.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:new Date(e.t).toLocaleTimeString()}),(0,H.jsx)(`span`,{className:`font-medium`,children:e.event}),(0,H.jsx)(`span`,{className:`break-words text-muted-foreground`,children:typeof e.data==`string`?e.data:JSON.stringify(e.data)})]},t))})]})]})}function wh({deploymentId:e,isModalOpen:t,closeModal:n}){return(0,H.jsx)(Io,{onOpenChange:n,open:t,children:(0,H.jsxs)(Uo,{resizable:!0,"aria-describedby":void 0,children:[(0,H.jsx)(Wo,{children:(0,H.jsx)(Ko,{children:`Deployment`})}),(0,H.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,H.jsx)(Sh,{deploymentId:e})})]})})}function Th(){let e=L(),t=Cs(),{deploymentId:n}=M({strict:!1}),{data:r,isFetching:i,isRefetching:a,refetch:o,error:s}=N(Bm({...W(),limit:100,enabled:t,pollWhileOpen:!0})),c=(0,U.useMemo)(()=>r?.deployments??[],[r]),l=(0,U.useCallback)(t=>{let r=[n?`..`:``,t].filter(Boolean);e({to:r.join(`/`)||`.`})},[n,e]),u=(0,U.useCallback)(e=>l(e.original.deployment_id),[l]),d=(0,U.useCallback)(()=>l(void 0),[l]),f=wd(o);return t?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(yd,{data:c,isFetching:i||a,columns:Km,onRowClick:u,children:(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:f,accessKey:`r`,disabled:i||a,children:[(0,H.jsx)(hn,{}),` `,(0,H.jsxs)(`span`,{className:`hidden lg:inline-block`,children:[(0,H.jsx)(`u`,{children:`R`}),`efresh`]})]})}),s&&(0,H.jsx)(`div`,{className:`mt-2 text-sm text-muted-foreground`,children:`Could not load deployments. This instance may not support deployment history.`}),!s&&!i&&c.length===0&&(0,H.jsx)(`div`,{className:`mt-2 text-sm text-muted-foreground`,children:`No deployments yet.`}),!!n&&(0,H.jsx)(wh,{deploymentId:n,isModalOpen:!0,closeModal:d})]}):(0,H.jsx)(`div`,{className:`p-2 text-sm text-muted-foreground`,children:`Viewing deployments requires super-user permissions on this instance.`})}function Eh(){return(0,H.jsx)(Up,{})}function Dh({clusterId:e,instanceId:t,organizationId:n},r){return`/`+[n,e,t&&`instance`,t,r].filter(di).join(`/`)}var Oh=`flex items-center p-2 rounded-lg group`,kh={className:`text-foreground hover:bg-accent dark:text-white dark:hover:bg-gray-700`},Ah={className:`text-black bg-white pointer-events-none cursor-default`};function jh(){let e=M({strict:!1}),{version:t}=je({strict:!1}),n=oc(`4.6.0`,t),r=oc(`5.1.0`,t),i=oc(`5.2.0-alpha.1`,t),{clusterId:a}=e,o=Cs(),{data:s}=N(Sa(a,!1));s===void 0||Es(s);let c=o&&(0,H.jsxs)(H.Fragment,{children:[n&&(0,H.jsx)(`li`,{children:(0,H.jsxs)(I,{to:Dh(e,`config/certificates`),className:Oh,inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(Kr,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`Certificates`})]})}),r&&(0,H.jsx)(`li`,{children:(0,H.jsxs)(I,{to:Dh(e,`config/deployments`),className:Oh,inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(zr,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`Deployments`})]})}),!1,(0,H.jsx)(`li`,{children:(0,H.jsxs)(I,{to:Dh(e,`config/roles`),className:Oh,inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(_r,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`Roles`})]})}),i&&(0,H.jsx)(`li`,{children:(0,H.jsxs)(I,{to:Dh(e,`config/secrets`),className:Oh,inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(Tr,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`Secrets`})]})}),n&&(0,H.jsx)(`li`,{children:(0,H.jsxs)(I,{to:Dh(e,`config/ssh-keys`),className:Oh,inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(xr,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`SSH Keys`})]})}),(0,H.jsx)(`li`,{children:(0,H.jsxs)(I,{to:Dh(e,`config/users`),className:Oh,inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(oi,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`Users`})]})})]});return(0,H.jsxs)(`div`,{className:`md:grid gap-4 md:grid-cols-12 min-h-[calc(100vh-(--spacing(36)))]`,children:[(0,H.jsxs)(`section`,{className:`col-span-1 text-foreground md:col-span-4 lg:col-span-3 md:border-r border-b md:border-b-0 md:pr-4 border-gray-700`,children:[(0,H.jsx)(Mh,{params:e,children:c}),(0,H.jsx)(Nh,{params:e,children:c})]}),(0,H.jsx)(`section`,{className:`col-span-1 text-foreground md:col-span-8 lg:col-span-9 md:pt-4`,children:(0,H.jsx)(U.Suspense,{fallback:(0,H.jsx)(zs,{className:`flex flex-col items-center justify-center h-full`,text:`Loading...`}),children:(0,H.jsx)(Ee,{})})})]})}function Mh({params:e,children:t}){return(0,H.jsxs)(`div`,{className:`hidden md:block pl-4 pt-4`,children:[(0,H.jsxs)(I,{to:Dh(e,`config`),className:Oh,activeOptions:{exact:!0},inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(Vn,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`Overview`})]}),t&&(0,H.jsx)(`ul`,{className:`border-t border-gray-700 pt-4 mt-4 space-y-2`,children:t})]})}function Nh({params:e,children:t}){return(0,H.jsxs)(`ul`,{className:`flex space-x-2 md:hidden py-2 px-4`,children:[(0,H.jsx)(`li`,{children:(0,H.jsxs)(I,{to:Dh(e,`config`),className:Oh,activeOptions:{exact:!0},inactiveProps:kh,activeProps:Ah,children:[(0,H.jsx)(Vn,{className:`hidden md:inline-block`}),` `,(0,H.jsx)(`span`,{className:`ms-3`,children:`Overview`})]})}),t]})}async function Ph(e,t=3,n=1e3){let r=0;if(t<=0)throw Error(`retries must be greater than 0`);let i;for(;r<t;)try{return await e()}catch(e){if(r++,i=e,r===t)break;await f(n)}throw i}async function Fh({operation:e,replicated:t,instanceClient:n}){let{data:r}=await n.post(`/`,{operation:e,service:e===`restart_service`?`http`:void 0,replicated:t});return await f(1e4),await Ph(()=>a({instanceClient:n,timeout:3e3}),12,15e3),r}function Ih(){return j({mutationFn:Fh})}function Lh({onRestartedSuccessfully:e}={}){let{clusterId:t}=M({strict:!1}),n=le(),[r,o]=(0,U.useState)(!1);return{onRestartClick:(0,U.useCallback)(async()=>{if(!t)throw Error(`clusterId must be set in the route to invoke useRestartClusterClick`);o(!0);let r=!1,s={duration:6e4,action:{label:`Cancel`,onClick:()=>{r=!0}}},c=B.loading(`Restarting`,{...s,description:(0,H.jsx)(fc,{animated:!0,width:`0%`})}),u=await xa(t),d=i.checkForFabricConnect(u.id),p=u?.instances??[],g=p.filter(e=>e.status===`RUNNING`).map(e=>h({id:e.id,forceFabricConnect:d,operationsUrl:m(e)})).reverse(),_=0;if(g.length)for(let e=0;e<g.length;e++){let t=g[e];if(!r){B.loading(`Restarting Instance ${e+1} of ${g.length}`,{...s,id:c,description:(0,H.jsx)(fc,{animated:!0,width:(e===0?0:e/g.length*100)+`%`})});try{await a({instanceClient:t}),await Fh({operation:`restart`,replicated:!1,instanceClient:t}),_+=1}catch{e+1!==g.length&&(B.loading(`Failed Restarting Instance ${e+1} of ${g.length}`,{...s,id:c,description:`We will carry on momentarily.`}),await f(3e3))}}}if(o(!1),Ec(n,t),r)B.error(`Cancelled`,{id:c,description:`The restart was partially cancelled.`,duration:1e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}});else if(p.length===_)e?.(),B.success(`Success`,{id:c,description:`Cluster fully restarted!`,duration:1e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}});else{let e=l(p.length,`instance`,`instances`),t=l(_,`"RUNNING" instance was`,`"RUNNING" instances were`);B.error(`Error`,{id:c,description:`Failed to fully restart cluster.
|
|
26
26
|
`+([p.length===0&&`No instances were found within the cluster to restart.`,_===0&&`No instances were in a "RUNNING" state of ${e}.`,p.length!==_&&`Only ${t} restarted of ${e}.`].filter(di).shift()||``),duration:1e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}},[t,e,n]),isRestartPending:r}}function Rh({operation:e,instanceClient:t,onRestartedSuccessfully:n}){let{clusterId:r,instanceId:i}=M({strict:!1}),a=`Instance`,{mutateAsync:o,isPending:s}=Ih(),c=le();return{onRestartClick:(0,U.useCallback)(async()=>{let s=B.loading(`Restarting`,{description:`Restarting instance. This may take up to 60 seconds.`,duration:18e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}});try{await o({operation:e,replicated:e===`restart_service`&&!1,instanceClient:t}),Ec(c,r),Ec(c,i),B.dismiss(s),B.success(`Success`,{description:`${a} restarted!`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}}),n?.()}catch{B.dismiss(s),B.error(`Error`,{description:`Failed to restart instance.`,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}},[r,t,i,n,e,c,o,a]),isRestartPending:s}}function zh({className:e,disabled:t,hideText:n,instanceClient:r,operation:i,targetNoun:a,tooltip:o,variant:s}){let{onRestartClick:c,isRestartPending:l}=Lh(),{onRestartClick:u,isRestartPending:d}=Rh({operation:i,instanceClient:r});return(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(_,{type:`button`,variant:s||`positiveOutline`,className:b(`mx-0 md:mx-4`,e),onClick:a===`Cluster`&&i===`restart`?c:u,disabled:t||d||l,title:`Restart ${a}`,children:[(0,H.jsx)(Br,{className:`pointer-events-none`}),n!==!0&&(0,H.jsxs)(`span`,{className:`hidden md:inline-block pointer-events-none`,children:[`Restart `,(0,H.jsx)(`span`,{className:`hidden 2xl:inline-block`,children:a})]})]})}),(0,H.jsx)(Mi,{side:`bottom`,children:o||(i===`restart_service`?`Restarts all service threads to apply changes. No downtime expected. Performance may be briefly slower during restart.`:`This fully restarts the Harper service and causes downtime.`)})]})}var Bh=D(`relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90`,warning:`border-amber-500/50 text-amber-600 dark:text-amber-400 bg-amber-50/50 dark:bg-amber-950/20 [&>svg]:text-amber-600 dark:[&>svg]:text-amber-400`}},defaultVariants:{variant:`default`}});function Vh({className:e,variant:t,...n}){return(0,H.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:p(Bh({variant:t}),e),...n})}function Hh({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-title`,className:p(`col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight`,e),...t})}function Uh({className:e,...t}){return(0,H.jsx)(`div`,{"data-slot":`alert-description`,className:p(`text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed`,e),...t})}async function Wh({clusterId:e,instanceId:t}){return null}function Gh(e){return F({queryKey:[e.clusterId,e.instanceId],queryFn:()=>Wh(e),retry:!1})}var Kh=({loadingRegistration:e,registrationInfo:t})=>{let n=!!t?.version&&parseInt(t.version[0],10)>=5&&`https://github.com/HarperFast/harper/releases/tag/v${t.version}`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-bold text-sm/6`,children:`Harper Version`}),(0,H.jsx)(`dd`,{className:`text-sm/6 sm:mt-2`,children:e?(0,H.jsx)(ou,{className:`w-10`}):n?(0,H.jsx)(`a`,{href:n,target:`_blank`,className:`underline hover:text-blue-300`,rel:`noopener noreferrer`,children:t.version}):t?.version||`Unknown`})]})},qh=({loading:e,timestamp:t})=>{let n=t?new Date(t).toLocaleString():`Never`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`dt`,{className:`font-bold text-sm/6`,children:`Last Deployed`}),(0,H.jsx)(`dd`,{className:`text-sm/6 sm:mt-2`,children:e?(0,H.jsx)(ou,{className:`w-24`}):n})]})};async function Jh({instanceClient:e,...t}){let{data:n}=await e.post(`/`,{operation:`set_configuration`,...t});return n}function Yh({onRestartedSuccessfully:e}={}){let t=W(),n=le(),[r,o]=(0,U.useState)(!1);return{onConfigUpdate:(0,U.useCallback)(async r=>{o(!0);let s=!1,c={duration:6e4,action:{label:`Cancel`,onClick:()=>{s=!0}}},u=B.loading(`Restarting`,{...c,description:(0,H.jsx)(fc,{animated:!0,width:`0%`})}),d=t.entityType===`cluster`?await xa(t.entityId):null,p=t.entityType===`cluster`?d?.instances||[]:[{id:t.entityId,status:`RUNNING`}],g=!!d&&i.checkForFabricConnect(d.id),_=t.entityType===`cluster`?p.filter(e=>e.status===`RUNNING`).map(e=>h({id:e.id,forceFabricConnect:g,operationsUrl:m(e)})).reverse():[t.instanceClient],v=0;if(_.length)for(let e=0;e<_.length;e++){let t=_[e];if(!s){B.loading(`Updating Instance ${e+1} of ${_.length}`,{...c,id:u,description:(0,H.jsx)(fc,{animated:!0,width:(e===0?0:e/_.length*100)+`%`})});try{await a({instanceClient:t}),await Jh({...r,instanceClient:t}),await Fh({operation:`restart_service`,replicated:!1,instanceClient:t}),v+=1}catch{e+1!==_.length&&(B.loading(`Failed Restarting Instance ${e+1} of ${_.length}`,{...c,id:u,description:`We will carry on momentarily.`}),await f(3e3))}}}if(o(!1),n.invalidateQueries({queryKey:[`get_configuration`,t.entityId]}),s)B.error(`Cancelled`,{id:u,description:`The config update was partially cancelled.`,duration:1e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}});else if(p.length===v)e?.(),B.success(`Success`,{id:u,description:`Your configuration has been updated successfully!`,duration:1e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}});else{let e=l(p.length,`instance`,`instances`),t=l(v,`"RUNNING" instance was`,`"RUNNING" instances were`);B.error(`Error`,{id:u,description:`Failed to fully update cluster.
|
|
27
|
-
`+([p.length===0&&`No instances were found within the cluster to restart.`,v===0&&`No instances were in a "RUNNING" state of ${e}.`,p.length!==v&&`Only ${t} restarted of ${e}.`].filter(di).shift()||``),duration:1e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}},[t,e,n]),isPending:r}}async function Xh({instanceClient:e}){let{data:t}=await e.post(`/`,{operation:`get_components`});return t}function Zh(e){return F({queryKey:[e.entityId,`get_components`],queryFn:()=>Xh(e),retry:!1,enabled:e.enabled!==!1})}function Qh({entityId:e,instanceClient:t}){return F({queryKey:[`get_configuration`,e],queryFn:async()=>{let{data:e}=await t.post(`/`,{operation:`get_configuration`});return e}})}function $h({entityId:e,instanceClient:t},n){return F({queryKey:[`get_usage_licenses`,e],enabled:n,queryFn:async()=>{try{let{data:e}=await t.post(`/`,{operation:`get_usage_licenses`});return e}catch(e){return console.error(e),null}}})}var eg={http:{port:`blocked`,securePort:`blocked`},threads:`blocked`,authentication:{enableSessions:`blocked`},logging:{auditLog:`blocked`,root:`blocked`,rotation:{path:`blocked`}},mqtt:{network:{port:`blocked`,securePort:`blocked`}},operationsApi:{network:{domainSocket:`blocked`,port:`blocked`,securePort:`blocked`}},rootPath:`blocked`,replication:`blocked_except_databases`,storage:`blocked`,tls:`blocked`,node:`blocked`,license:`blocked`,componentsRoot:`blocked`,analytics:`allowed`,applications:`allowed`,localStudio:`allowed`};function tg(e,t,n){if(JSON.stringify(t)===JSON.stringify(n))return!1;let r=e.split(`.`),i=eg;for(let e=0;e<r.length;e++){let t=r[e];if(i===`blocked`)return!0;if(i===`blocked_except_databases`)return t!==`databases`;if(typeof i==`object`&&i&&t in i)i=i[t];else return!1}return i===`blocked`}function ng(e,t=eg){if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){let i=e[r],a=t?.[r];if(a!==`blocked`)if(a===`blocked_except_databases`){i&&typeof i==`object`&&`databases`in i&&(n.replication={databases:i.databases});continue}else if(typeof a==`object`&&a){let e=ng(i,a);e!==void 0&&(typeof e!=`object`||Object.keys(e).length>0)&&(n[r]=e)}else n[r]=i}return n}function rg(e,t){if(typeof e!=`object`||!e||typeof t!=`object`||!t)return JSON.stringify(e)===JSON.stringify(t)?void 0:t;let n={},r=new Set([...Object.keys(e),...Object.keys(t)]);for(let i of r){let r=e[i],a=t[i];if(typeof r==`object`&&r&&typeof a==`object`&&a&&!Array.isArray(r)&&!Array.isArray(a)){let e=rg(r,a);Object.keys(e).length>0&&(n[i]=e)}else JSON.stringify(r)!==JSON.stringify(a)&&(n[i]=a)}return n}function ig(e,t=``){let n={};for(let r in e){let i=e[r],a=t?`${t}_${r}`:r;typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(n,ig(i,a)):n[a]=i}return n}var ag=t({getWorker:()=>sg,jsonDefaults:()=>og}),og=new class{constructor(e,t,n){this._onDidChange=new Tn,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}(`json`,{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:`warning`,schemaValidation:`warning`,comments:`error`,trailingCommas:`error`},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0}),sg=()=>cg().then(e=>e.getWorker());function cg(){return Pe(()=>import(`./jsonMode-DD1NLQKv.js`),__vite__mapDeps([26,3,2,4,27,28]))}wn.register({id:`json`,extensions:[`.json`,`.bowerrc`,`.jshintrc`,`.jscsrc`,`.eslintrc`,`.babelrc`,`.har`],aliases:[`JSON`,`json`],mimetypes:[`application/json`]}),wn.onLanguage(`json`,()=>{cg().then(e=>e.setupMode(og))});var lg=`5.9.3`,ug=t({JsxEmit:()=>fg,ModuleKind:()=>dg,ModuleResolutionKind:()=>hg,NewLineKind:()=>pg,ScriptTarget:()=>mg,getJavaScriptWorker:()=>Sg,getTypeScriptWorker:()=>xg,javascriptDefaults:()=>bg,typescriptDefaults:()=>yg,typescriptVersion:()=>_g}),dg=(e=>(e[e.None=0]=`None`,e[e.CommonJS=1]=`CommonJS`,e[e.AMD=2]=`AMD`,e[e.UMD=3]=`UMD`,e[e.System=4]=`System`,e[e.ES2015=5]=`ES2015`,e[e.ESNext=99]=`ESNext`,e))(dg||{}),fg=(e=>(e[e.None=0]=`None`,e[e.Preserve=1]=`Preserve`,e[e.React=2]=`React`,e[e.ReactNative=3]=`ReactNative`,e[e.ReactJSX=4]=`ReactJSX`,e[e.ReactJSXDev=5]=`ReactJSXDev`,e))(fg||{}),pg=(e=>(e[e.CarriageReturnLineFeed=0]=`CarriageReturnLineFeed`,e[e.LineFeed=1]=`LineFeed`,e))(pg||{}),mg=(e=>(e[e.ES3=0]=`ES3`,e[e.ES5=1]=`ES5`,e[e.ES2015=2]=`ES2015`,e[e.ES2016=3]=`ES2016`,e[e.ES2017=4]=`ES2017`,e[e.ES2018=5]=`ES2018`,e[e.ES2019=6]=`ES2019`,e[e.ES2020=7]=`ES2020`,e[e.ESNext=99]=`ESNext`,e[e.JSON=100]=`JSON`,e[e.Latest=99]=`Latest`,e))(mg||{}),hg=(e=>(e[e.Classic=1]=`Classic`,e[e.NodeJs=2]=`NodeJs`,e))(hg||{}),gg=class{constructor(e,t,n,r,i){this._onDidChange=new Tn,this._onDidExtraLibsChange=new Tn,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(e),this.setDiagnosticsOptions(t),this.setWorkerOptions(n),this.setInlayHintsOptions(r),this.setModeConfiguration(i),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(e,t){let n;if(n=t===void 0?`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t,this._extraLibs[n]&&this._extraLibs[n].content===e)return{dispose:()=>{}};let r=1;return this._removedExtraLibs[n]&&(r=this._removedExtraLibs[n]+1),this._extraLibs[n]&&(r=this._extraLibs[n].version+1),this._extraLibs[n]={content:e,version:r},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let e=this._extraLibs[n];e&&e.version===r&&(delete this._extraLibs[n],this._removedExtraLibs[n]=r,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(e){for(let e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),e&&e.length>0)for(let t of e){let e=t.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,n=t.content,r=1;this._removedExtraLibs[e]&&(r=this._removedExtraLibs[e]+1),this._extraLibs[e]={content:n,version:r}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(e){this._workerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(e){this._inlayHintsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(e){}setEagerModelSync(e){this._eagerModelSync=e}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(void 0)}},_g=lg,vg={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},yg=new gg({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},vg),bg=new gg({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},vg),xg=()=>Cg().then(e=>e.getTypeScriptWorker()),Sg=()=>Cg().then(e=>e.getJavaScriptWorker());function Cg(){return Pe(()=>import(`./tsMode-
|
|
27
|
+
`+([p.length===0&&`No instances were found within the cluster to restart.`,v===0&&`No instances were in a "RUNNING" state of ${e}.`,p.length!==v&&`Only ${t} restarted of ${e}.`].filter(di).shift()||``),duration:1e4,action:{label:`Dismiss`,onClick:()=>B.dismiss()}})}},[t,e,n]),isPending:r}}async function Xh({instanceClient:e}){let{data:t}=await e.post(`/`,{operation:`get_components`});return t}function Zh(e){return F({queryKey:[e.entityId,`get_components`],queryFn:()=>Xh(e),retry:!1,enabled:e.enabled!==!1})}function Qh({entityId:e,instanceClient:t}){return F({queryKey:[`get_configuration`,e],queryFn:async()=>{let{data:e}=await t.post(`/`,{operation:`get_configuration`});return e}})}function $h({entityId:e,instanceClient:t},n){return F({queryKey:[`get_usage_licenses`,e],enabled:n,queryFn:async()=>{try{let{data:e}=await t.post(`/`,{operation:`get_usage_licenses`});return e}catch(e){return console.error(e),null}}})}var eg={http:{port:`blocked`,securePort:`blocked`},threads:`blocked`,authentication:{enableSessions:`blocked`},logging:{auditLog:`blocked`,root:`blocked`,rotation:{path:`blocked`}},mqtt:{network:{port:`blocked`,securePort:`blocked`}},operationsApi:{network:{domainSocket:`blocked`,port:`blocked`,securePort:`blocked`}},rootPath:`blocked`,replication:`blocked_except_databases`,storage:`blocked`,tls:`blocked`,node:`blocked`,license:`blocked`,componentsRoot:`blocked`,analytics:`allowed`,applications:`allowed`,localStudio:`allowed`};function tg(e,t,n){if(JSON.stringify(t)===JSON.stringify(n))return!1;let r=e.split(`.`),i=eg;for(let e=0;e<r.length;e++){let t=r[e];if(i===`blocked`)return!0;if(i===`blocked_except_databases`)return t!==`databases`;if(typeof i==`object`&&i&&t in i)i=i[t];else return!1}return i===`blocked`}function ng(e,t=eg){if(typeof e!=`object`||!e)return e;let n=Array.isArray(e)?[]:{};for(let r in e){let i=e[r],a=t?.[r];if(a!==`blocked`)if(a===`blocked_except_databases`){i&&typeof i==`object`&&`databases`in i&&(n.replication={databases:i.databases});continue}else if(typeof a==`object`&&a){let e=ng(i,a);e!==void 0&&(typeof e!=`object`||Object.keys(e).length>0)&&(n[r]=e)}else n[r]=i}return n}function rg(e,t){if(typeof e!=`object`||!e||typeof t!=`object`||!t)return JSON.stringify(e)===JSON.stringify(t)?void 0:t;let n={},r=new Set([...Object.keys(e),...Object.keys(t)]);for(let i of r){let r=e[i],a=t[i];if(typeof r==`object`&&r&&typeof a==`object`&&a&&!Array.isArray(r)&&!Array.isArray(a)){let e=rg(r,a);Object.keys(e).length>0&&(n[i]=e)}else JSON.stringify(r)!==JSON.stringify(a)&&(n[i]=a)}return n}function ig(e,t=``){let n={};for(let r in e){let i=e[r],a=t?`${t}_${r}`:r;typeof i==`object`&&i&&!Array.isArray(i)?Object.assign(n,ig(i,a)):n[a]=i}return n}var ag=t({getWorker:()=>sg,jsonDefaults:()=>og}),og=new class{constructor(e,t,n){this._onDidChange=new Tn,this._languageId=e,this.setDiagnosticsOptions(t),this.setModeConfiguration(n)}get onDidChange(){return this._onDidChange.event}get languageId(){return this._languageId}get modeConfiguration(){return this._modeConfiguration}get diagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(this)}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(this)}}(`json`,{validate:!0,allowComments:!0,schemas:[],enableSchemaRequest:!1,schemaRequest:`warning`,schemaValidation:`warning`,comments:`error`,trailingCommas:`error`},{documentFormattingEdits:!0,documentRangeFormattingEdits:!0,completionItems:!0,hovers:!0,documentSymbols:!0,tokens:!0,colors:!0,foldingRanges:!0,diagnostics:!0,selectionRanges:!0}),sg=()=>cg().then(e=>e.getWorker());function cg(){return Pe(()=>import(`./jsonMode-DD1NLQKv.js`),__vite__mapDeps([26,3,2,4,27,28]))}wn.register({id:`json`,extensions:[`.json`,`.bowerrc`,`.jshintrc`,`.jscsrc`,`.eslintrc`,`.babelrc`,`.har`],aliases:[`JSON`,`json`],mimetypes:[`application/json`]}),wn.onLanguage(`json`,()=>{cg().then(e=>e.setupMode(og))});var lg=`5.9.3`,ug=t({JsxEmit:()=>fg,ModuleKind:()=>dg,ModuleResolutionKind:()=>hg,NewLineKind:()=>pg,ScriptTarget:()=>mg,getJavaScriptWorker:()=>Sg,getTypeScriptWorker:()=>xg,javascriptDefaults:()=>bg,typescriptDefaults:()=>yg,typescriptVersion:()=>_g}),dg=(e=>(e[e.None=0]=`None`,e[e.CommonJS=1]=`CommonJS`,e[e.AMD=2]=`AMD`,e[e.UMD=3]=`UMD`,e[e.System=4]=`System`,e[e.ES2015=5]=`ES2015`,e[e.ESNext=99]=`ESNext`,e))(dg||{}),fg=(e=>(e[e.None=0]=`None`,e[e.Preserve=1]=`Preserve`,e[e.React=2]=`React`,e[e.ReactNative=3]=`ReactNative`,e[e.ReactJSX=4]=`ReactJSX`,e[e.ReactJSXDev=5]=`ReactJSXDev`,e))(fg||{}),pg=(e=>(e[e.CarriageReturnLineFeed=0]=`CarriageReturnLineFeed`,e[e.LineFeed=1]=`LineFeed`,e))(pg||{}),mg=(e=>(e[e.ES3=0]=`ES3`,e[e.ES5=1]=`ES5`,e[e.ES2015=2]=`ES2015`,e[e.ES2016=3]=`ES2016`,e[e.ES2017=4]=`ES2017`,e[e.ES2018=5]=`ES2018`,e[e.ES2019=6]=`ES2019`,e[e.ES2020=7]=`ES2020`,e[e.ESNext=99]=`ESNext`,e[e.JSON=100]=`JSON`,e[e.Latest=99]=`Latest`,e))(mg||{}),hg=(e=>(e[e.Classic=1]=`Classic`,e[e.NodeJs=2]=`NodeJs`,e))(hg||{}),gg=class{constructor(e,t,n,r,i){this._onDidChange=new Tn,this._onDidExtraLibsChange=new Tn,this._extraLibs=Object.create(null),this._removedExtraLibs=Object.create(null),this._eagerModelSync=!1,this.setCompilerOptions(e),this.setDiagnosticsOptions(t),this.setWorkerOptions(n),this.setInlayHintsOptions(r),this.setModeConfiguration(i),this._onDidExtraLibsChangeTimeout=-1}get onDidChange(){return this._onDidChange.event}get onDidExtraLibsChange(){return this._onDidExtraLibsChange.event}get modeConfiguration(){return this._modeConfiguration}get workerOptions(){return this._workerOptions}get inlayHintsOptions(){return this._inlayHintsOptions}getExtraLibs(){return this._extraLibs}addExtraLib(e,t){let n;if(n=t===void 0?`ts:extralib-${Math.random().toString(36).substring(2,15)}`:t,this._extraLibs[n]&&this._extraLibs[n].content===e)return{dispose:()=>{}};let r=1;return this._removedExtraLibs[n]&&(r=this._removedExtraLibs[n]+1),this._extraLibs[n]&&(r=this._extraLibs[n].version+1),this._extraLibs[n]={content:e,version:r},this._fireOnDidExtraLibsChangeSoon(),{dispose:()=>{let e=this._extraLibs[n];e&&e.version===r&&(delete this._extraLibs[n],this._removedExtraLibs[n]=r,this._fireOnDidExtraLibsChangeSoon())}}}setExtraLibs(e){for(let e in this._extraLibs)this._removedExtraLibs[e]=this._extraLibs[e].version;if(this._extraLibs=Object.create(null),e&&e.length>0)for(let t of e){let e=t.filePath||`ts:extralib-${Math.random().toString(36).substring(2,15)}`,n=t.content,r=1;this._removedExtraLibs[e]&&(r=this._removedExtraLibs[e]+1),this._extraLibs[e]={content:n,version:r}}this._fireOnDidExtraLibsChangeSoon()}_fireOnDidExtraLibsChangeSoon(){this._onDidExtraLibsChangeTimeout===-1&&(this._onDidExtraLibsChangeTimeout=window.setTimeout(()=>{this._onDidExtraLibsChangeTimeout=-1,this._onDidExtraLibsChange.fire(void 0)},0))}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setWorkerOptions(e){this._workerOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setInlayHintsOptions(e){this._inlayHintsOptions=e||Object.create(null),this._onDidChange.fire(void 0)}setMaximumWorkerIdleTime(e){}setEagerModelSync(e){this._eagerModelSync=e}getEagerModelSync(){return this._eagerModelSync}setModeConfiguration(e){this._modeConfiguration=e||Object.create(null),this._onDidChange.fire(void 0)}},_g=lg,vg={completionItems:!0,hovers:!0,documentSymbols:!0,definitions:!0,references:!0,documentHighlights:!0,rename:!0,diagnostics:!0,documentRangeFormattingEdits:!0,signatureHelp:!0,onTypeFormattingEdits:!0,codeActions:!0,inlayHints:!0},yg=new gg({allowNonTsExtensions:!0,target:99},{noSemanticValidation:!1,noSyntaxValidation:!1,onlyVisible:!1},{},{},vg),bg=new gg({allowNonTsExtensions:!0,allowJs:!0,target:99},{noSemanticValidation:!0,noSyntaxValidation:!1,onlyVisible:!1},{},{},vg),xg=()=>Cg().then(e=>e.getTypeScriptWorker()),Sg=()=>Cg().then(e=>e.getJavaScriptWorker());function Cg(){return Pe(()=>import(`./tsMode-DJ6Sl24Q.js`),__vite__mapDeps([29,3,2,4,27]))}wn.onLanguage(`typescript`,()=>Cg().then(e=>e.setupTypeScript(yg))),wn.onLanguage(`javascript`,()=>Cg().then(e=>e.setupJavaScript(bg)));var wg=ug,Tg=ag,Eg=JSON.parse(`{
|
|
28
28
|
"$schema": "https://json-schema.org/draft-06/schema",
|
|
29
29
|
"$id": "https://harper.fast/schema/config-root.schema.json",
|
|
30
30
|
"title": "HarperDB Root Configuration",
|
|
@@ -813,5 +813,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
813
813
|
disabled:pointer-events-none disabled:opacity-40
|
|
814
814
|
[&_svg]:size-4 [&_svg]:shrink-0`,e&&`bg-muted font-semibold text-foreground`,t),...n})}function KC({pageCount:e,disabled:t,onGo:n}){let[r,i]=(0,U.useState)(``);return(0,H.jsxs)(`form`,{onSubmit:t=>{t.preventDefault();let a=Number(r);Number.isFinite(a)&&a>=1&&n(Math.min(a,e)),i(``)},className:`hidden items-center gap-2 @min-[840px]:flex`,children:[(0,H.jsx)(`label`,{htmlFor:`pagination-go-to`,className:`text-sm whitespace-nowrap text-muted-foreground`,children:`Go to`}),(0,H.jsx)(`input`,{id:`pagination-go-to`,type:`number`,min:1,max:e,inputMode:`numeric`,placeholder:`Page`,disabled:t,value:r,onChange:e=>i(e.target.value),className:`h-9 w-20 rounded-md border border-input bg-white px-3 text-sm text-foreground
|
|
815
815
|
placeholder:text-muted-foreground focus-visible:ring-1 focus-visible:ring-purple focus-visible:outline-none
|
|
816
|
-
disabled:pointer-events-none disabled:opacity-50 dark:bg-grey-700 dark:text-white`})]})}function qC({pageSize:e,onChange:t}){return(0,H.jsxs)(`div`,{className:`hidden items-center gap-2 @min-[960px]:flex`,children:[(0,H.jsx)(`span`,{className:`text-sm whitespace-nowrap text-muted-foreground`,children:`Rows`}),(0,H.jsxs)(su,{value:String(e),onValueChange:e=>t(Number(e)),children:[(0,H.jsx)(uu,{"aria-label":`Rows per page`,className:`h-9 w-20`,children:(0,H.jsx)(lu,{})}),(0,H.jsx)(du,{side:`top`,children:HC.map(e=>(0,H.jsx)(Q,{value:String(e),children:ju(e)},e))})]})]})}function JC(e,t,n=1){if(t<=n*2+5)return YC(1,t);let r=Math.max(e-n,1),i=Math.min(e+n,t),a=r>2,o=i<t-1,s=3+2*n;return!a&&o?[...YC(1,s),`ellipsis`,t]:a&&!o?[1,`ellipsis`,...YC(t-s+1,t)]:[1,`ellipsis`,...YC(r,i),`ellipsis`,t]}function YC(e,t){return Array.from({length:t-e+1},(t,n)=>e+n)}function XC({applyFilters:e,columnFiltersForm:t,columns:n,columnVisibility:r,data:i,isFetching:a,onColumnClick:o,onRowClick:s,pageIndex:c,pageSize:l,primaryKey:u,setPageIndex:d,setPageSize:f,filtersToggled:p,totalPages:m,totalRecords:h,isEstimatedCount:g,estimatedRange:_,isExactCountFetching:v,isExactCountError:y,onRequestExactCount:b}){let x=be({data:i||[],columns:n,manualPagination:!0,enableColumnResizing:!0,columnResizeMode:`onEnd`,pageCount:m,defaultColumn:{minSize:1},state:{columnVisibility:r},rowCount:h,getCoreRowModel:Te(),getPaginationRowModel:Oe()});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(fd,{containerClassName:`rounded-md bg-card dark:bg-black-dark grow overflow-visible`,children:[(0,H.jsx)(pd,{children:x.getHeaderGroups().map(e=>(0,H.jsx)(hd,{className:`border-none`,children:e.headers.map(e=>(0,H.jsx)(_d,{header:e,onColumnClick:o,className:`sticky top-32 z-10 bg-card dark:bg-black-dark border-b border-border`},e.id))},e.id))}),p&&(0,H.jsx)(LC,{applyFilters:e,columnFiltersForm:t,headerGroups:x.getHeaderGroups()}),(0,H.jsx)(md,{className:`bg-background dark:bg-black border border-border dark:border-grey-700`,children:x.getRowModel().rows?.length?x.getRowModel().rows.map(e=>(0,H.jsx)(ZC,{row:e,onRowClick:s,primaryKey:u},e.id)):(0,H.jsx)(hd,{children:(0,H.jsx)(vd,{colSpan:n.length,className:`h-24 text-center`,children:a||i===void 0?(0,H.jsx)(VC,{className:`opacity-50 inline-block`}):(0,H.jsx)(`span`,{children:`No results.`})})})})]}),(0,H.jsx)(UC,{pageIndex:c,pageSize:l,totalPages:m,totalRecords:h,isEstimatedCount:g,estimatedRange:_,isExactCountFetching:v,isExactCountError:y,onRequestExactCount:b,setPageIndex:d,setPageSize:f})]})}function ZC({row:e,primaryKey:t,onRowClick:n}){let r=e.getVisibleCells(),i=(0,U.useMemo)(()=>{let n=e.original;return n&&n.message===`This entry has expired`?r[0]?.column?.id===t?[(0,H.jsx)(QC,{cell:r[0]},r[0].id),(0,H.jsx)($C,{colSpan:r.length-1},`expired`)]:[(0,H.jsx)($C,{colSpan:r.length},`expired`)]:r.map(e=>(0,H.jsx)(QC,{cell:e},e.id))},[e,t,r]);return(0,H.jsx)(hd,{"data-state":e.getIsSelected()&&`selected`,onClick:()=>n?.(e),className:p(`hover:bg-muted/10 data-[state=selected]:bg-muted`,n&&`cursor-pointer`),children:i})}function QC({cell:e}){return(0,H.jsx)(vd,{style:{width:`${e.column.getSize()}px`},className:`px-2 py-2 overflow-x-hidden max-w-32 text-ellipsis whitespace-nowrap`,children:De(e.column.columnDef.cell,e.getContext())})}function $C({colSpan:e}){return(0,H.jsx)(vd,{colSpan:e,className:`px-2 py-2 overflow-x-hidden max-w-32 text-ellipsis whitespace-nowrap`,children:(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`This entry has expired`})})}function ew({instanceDatabaseMap:e,databaseName:t,tableName:n}){let r=M({strict:!1}),i=W(),{clusterId:a,instanceId:o}=r,{toggled:s,toggle:c}=EC(!0),l=Be(),u=Ts(o??a,t,n,`insert`),d=Ts(o??a,t,n,`update`),f=Ts(o??a,t,n,`delete`),p=ws(),{data:m}=N(gb({...i,databaseName:t,tableName:n})),h=e?.[t],g=h?.[n],v=m??g,y=(0,U.useMemo)(()=>ic(v?.attributes??[],`attribute`),[v]),{data:b}=N(SC(i)),x=b?.[t]?.[n],S=(0,U.useMemo)(()=>Hv(v,h,x),[v,h,x]),C=(0,U.useMemo)(()=>qv(v,h),[v,h]),w=(0,U.useMemo)(()=>Wv(v?.attributes,h),[v,h]),[T,E]=Jf(null,r),[ee,D]=(0,U.useState)(!1),O=(0,U.useMemo)(()=>(t?Object.keys(e?.[t]||[]).sort():[]).length===1,[e,t]),{toggled:k,toggleOn:A,toggleOff:te}=EC(!1),ne=R({resolver:z(IC)}),{reset:re}=ne,ie=ne.watch(),[j,ae]=Jf(null,[r.clusterId,r.instanceId,t,n]),oe=(0,U.useCallback)(e=>{let t=[];for(let n in e){let r=e[n];if(r?.length)try{t.push(...ob(n,r,y[n],S[n]))}catch(e){B.error(String(e))}}return t},[y,S]),se=(0,U.useCallback)(()=>{let e=oe(ie);ae(e.length?e:null),re({...ie})},[oe,re,ie]),ce=(0,U.useCallback)(()=>{re({},{keepValues:!1,keepDirtyValues:!1,keepDefaultValues:!1}),re(),ae(null),te()},[te,re]);(0,U.useEffect)(function(){return ce()},[r,ce]);let{filters:ue}=pe({strict:!1}),de=JSON.stringify([t,n,ue??null]),fe=(0,U.useRef)(null);(0,U.useEffect)(function(){if(!v||fe.current===de)return;let e=fe.current===null;if(fe.current=de,ue){re({...ue});let e=oe(ue);ae(e.length?e:null),A()}else e||ce()},[ue,de,v,re,oe,ae,A,ce]);let{dataTableColumns:P,primaryKey:me}=Jy(v,S),[he,ge]=Jf({attribute:me,descending:!1},r),[_e,ve]=Jf(0,[t,n,j]),[ye,be]=(0,U.useState)(20),F=m?.record_count??g?.record_count,xe=m?.estimated_record_range??g?.estimated_record_range,[Se,Ce]=Jf(!1,[t,n]),{data:we,isFetching:Te,isError:Ee,refetch:De}=N(NC({...i,enabled:Se,databaseName:t,tableName:n})),Oe=(0,U.useCallback)(()=>{Se?De():Ce(!0)},[Se,De,Ce]),ke=we??F,Ae=ke?Math.ceil(ke/ye):0,je=we===void 0&&xe!==void 0,L=k&&!!j,{data:Me,isFetching:Ne}=N(Tp({...i,enabled:!L&&!!me,databaseName:t,tableName:n,searchAttribute:me,sort:he,pageSize:ye,pageIndex:_e,onlyIfCached:s,getAttributes:C})),{data:Pe,isFetching:Fe}=N(ib({...i,enabled:L&&!!me,databaseName:t,tableName:n,conditions:j,sort:he,pageSize:ye,pageIndex:_e,onlyIfCached:s,getAttributes:C})),Ie=L?Pe:Me,Le=Ne||Fe,{data:Re}=N(jC({...i,enabled:ee,databaseName:t,tableName:n,ids:T})),{mutate:ze,isPending:Ve}=FC(),{mutate:He,isPending:Ue}=AC(),{mutate:We,isPending:Ge}=OC(),Ke=le(),qe=(0,U.useCallback)(()=>Ke.invalidateQueries({queryKey:[i.entityId,t,n]}),[Ke,i.entityId,t,n]),Je=(0,U.useCallback)(async()=>{confirm(`Are you sure you want to cleanup orphan blobs for database "${t}"?`)&&We({...i,databaseName:t},{onSuccess:e=>{B.success(e.message||`Orphan blobs cleanup started successfully`),qe()},onError:e=>{B.error(e instanceof Error?e.message:`Failed to cleanup orphan blobs`)}})},[We,t,i,qe]),{exportCsv:Ye,isExporting:Xe}=fb(),Ze=(0,U.useCallback)(()=>{Ye({databaseName:t,tableName:n,primaryKey:me,sort:he,conditions:L?j:null})},[Ye,t,n,me,he,L,j]),Qe=(0,U.useCallback)(e=>{ze({...i,databaseName:t,tableName:n,records:e},{onSuccess:()=>{qe(),D(!1),B.success(`Record updated successfully`)}})},[ze,i,t,n,qe]),$e=(0,U.useCallback)(e=>{He({...i,databaseName:t,tableName:n,hashValues:e},{onSuccess:()=>{qe(),D(!1),B.success(`Record deleted successfully`)}})},[He,i,t,n,qe]),et=e=>{E([e.original[me]]),D(!ee)},tt=(e,t)=>{ge({attribute:e,descending:!t})},nt=wd(qe),rt=(0,U.useCallback)(()=>{cy(`ShowAddTableRecords`,{databaseName:t,tableName:n})},[t,n]),it=(0,U.useCallback)(()=>{cy(`ShowImportData`,{databaseName:t,tableName:n})},[t,n]),[at,ot]=np(`ColumnDisplayed/${t}/${n}`,{}),st=(0,U.useMemo)(()=>({...Object.fromEntries(Kv(S).map(e=>[e,!1])),...at}),[S,at]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col md:flex-row items-center justify-between space-y-3 md:space-y-0 md:space-x-3 pt-15 pb-4 pr-4`,children:[(0,H.jsxs)(`div`,{className:`flex space-x-2`,children:[u&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:rt,accessKey:`n`,children:[(0,H.jsx)(Rr,{}),(0,H.jsxs)(`span`,{children:[`Add `,(0,H.jsx)(`u`,{children:`N`}),`ew Record(s)`]})]}),u&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:it,accessKey:`i`,children:[(0,H.jsx)($n,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`I`}),`mport Data`]})]}),(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:Ze,disabled:Xe,accessKey:`e`,children:[(0,H.jsx)(Qn,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`E`}),`xport CSV`]})]})]}),(0,H.jsxs)(`div`,{className:`flex space-x-2`,children:[k&&j&&(0,H.jsxs)(_,{type:`button`,variant:`ghost`,onClick:ce,accessKey:`f`,children:[(0,H.jsx)(ur,{className:`inline-block `}),(0,H.jsxs)(`span`,{children:[`Clear `,(0,H.jsx)(`u`,{children:`F`}),`ilters`]})]}),k&&ne.formState.isDirty&&(0,H.jsxs)(_,{variant:`default`,onClick:se,children:[(0,H.jsx)(lr,{className:`inline-block `}),`Apply Filters`]}),k&&!j&&(0,H.jsxs)(_,{variant:`ghost`,onClick:te,accessKey:`f`,children:[(0,H.jsx)(ur,{className:`inline-block `}),(0,H.jsxs)(`span`,{children:[`Hide `,(0,H.jsx)(`u`,{children:`F`}),`ilters`]})]}),!k&&(0,H.jsxs)(_,{variant:`ghost`,onClick:A,accessKey:`f`,children:[(0,H.jsx)(dr,{className:`inline-block `}),(0,H.jsxs)(`span`,{children:[`Show `,(0,H.jsx)(`u`,{children:`F`}),`ilters`]})]}),(0,H.jsx)(_,{variant:`defaultOutline`,onClick:nt,disabled:Le,children:(0,H.jsx)(hn,{})}),(0,H.jsx)(zC,{columns:P,columnVisibility:st,setColumnVisibility:ot}),(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{asChild:!0,disabled:!e,children:(0,H.jsx)(_,{variant:`ghost`,size:`icon`,disabled:!e,children:(0,H.jsx)(ir,{"aria-label":`Table options`})})}),(0,H.jsxs)(Zo,{side:`bottom`,align:`end`,children:[(0,H.jsxs)(Qo,{className:`focus:bg-primary/70 focus:text-white`,onClick:c,children:[s?(0,H.jsx)(Gn,{className:`text-green`}):(0,H.jsx)(Jn,{}),`Only If Cached`,(0,H.jsx)(I,{to:`https://docs.harperdb.io/docs/developers/applications/caching#cache-control-header`,target:`_blank`,rel:`noopener noreferrer`,onClick:Uy,children:(0,H.jsx)(ar,{})})]}),p&&l&&!!o&&(0,H.jsxs)(Qo,{className:`focus:bg-yellow/70 focus:text-white`,onClick:Je,disabled:Ge,children:[(0,H.jsx)(Rn,{className:`text-yellow `}),`Cleanup Orphan Blobs`]}),p&&!O&&(0,H.jsxs)(Qo,{className:`focus:bg-red/70 focus:text-white`,onClick:()=>cy(`ShowDeleteTable`,{databaseName:t,tableName:n}),children:[(0,H.jsx)(ri,{className:`inline-block `}),`Drop Table`]}),p&&(0,H.jsxs)(Qo,{className:`focus:bg-red/70 focus:text-white`,onClick:()=>cy(`ShowDeleteDatabase`,{databaseName:t}),children:[(0,H.jsx)(ni,{}),`Drop Database`]})]})]})]})]}),(0,H.jsx)(XC,{primaryKey:me,data:Ie?.data,isFetching:Le,filtersToggled:k,columns:P,columnVisibility:st,onRowClick:et,onColumnClick:tt,totalPages:Ae,totalRecords:ke,isEstimatedCount:je,estimatedRange:xe,isExactCountFetching:Te,isExactCountError:Ee,onRequestExactCount:Oe,pageIndex:_e,pageSize:ye,columnFiltersForm:ne,applyFilters:se,setPageIndex:ve,setPageSize:be}),(0,H.jsx)(TC,{canEditRecords:d,canDeleteRecords:f,setIsModalOpen:D,isModalOpen:ee,primaryKey:me,syntheticAttributes:w,data:Re?.data,onSaveChanges:Qe,onDeleteRecord:$e,isUpdateTableRecordsPending:Ve,isDeleteTableRecordsPending:Ue})]})}function tw(e,t){if(!e)return null;if(!(t.databaseName&&e[t.databaseName])){let n=Object.keys(e).sort()[0];return n&&n!==t.databaseName?{databaseName:n,tableName:void 0}:null}return t.tableName&&!e[t.databaseName][t.tableName]?{databaseName:t.databaseName,tableName:void 0}:null}function nw(){let e=M({strict:!1}),{data:t}=N(Jg({...W(),skipRecordCount:!0})),n=tw(t,e);return n?(0,H.jsx)(he,{to:Iv({...e,...n}),replace:!0}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`main`,{className:`grid grid-cols-1 gap-4 md:grid-cols-12 md:items-start`,children:[(0,H.jsx)(`section`,{className:`col-span-1 text-foreground md:col-span-4 lg:col-span-3 flex flex-col min-h-0 md:sticky md:top-32 md:h-[calc(100vh-(--spacing(32)))] md:max-h-[calc(100vh-(--spacing(32)))] overflow-hidden`,children:(0,H.jsx)(bS,{instanceDatabaseMap:t})}),(0,H.jsx)(`section`,{className:`col-span-1 text-foreground md:col-span-8 lg:col-span-9 flex flex-col min-h-0`,children:e.databaseName&&e.tableName?(0,H.jsx)(ew,{instanceDatabaseMap:t,databaseName:e.databaseName,tableName:e.tableName}):e.databaseName?(0,H.jsx)(xb,{instanceDatabaseMap:t,databaseName:e.databaseName}):null})]}),t&&(0,H.jsx)(Hy,{instanceDatabaseMap:t})]})}function rw(e){return P({getParentRoute:()=>e,path:`/databases/{-$databaseName}/{-$tableName}`,head:()=>({meta:[{title:`Databases — Harper Fabric`}]}),component:nw})}var iw={className:`text-primary font-semibold bg-primary/10 rounded-md dark:text-white dark:bg-white/10`};function aw(){let e=Cs(),t=M({strict:!1}),{version:n}=je({strict:!1}),r=oc(`4.6.0`,n)&&e,i=oc(`4.7.0-beta.7`,n),{data:a}=N(am(W(),r)),o=a?.restartRequired??!1,s=(0,U.useMemo)(()=>[e&&{to:t.clusterId&&!t.instanceId?Dh(t,`apps`):Dh(t),activeOptions:{exact:!0},name:`Applications`,shortName:`Apps`,icon:(0,H.jsx)(Ir,{className:`inline-block`})},{to:Dh(t,`databases`),icon:(0,H.jsx)(rr,{className:`inline-block`}),name:`Databases`},e&&i&&{to:Dh(t,`apis`),name:`APIs`,icon:(0,H.jsx)(Wr,{className:`inline-block`})},e&&r&&{to:Dh(t,`status`),icon:(0,H.jsx)(fr,{className:`inline-block`}),name:`Status`},e&&{to:Dh(t,`logs`),icon:(0,H.jsx)(Fr,{className:`inline-block`}),name:`Logs`},e&&{to:Dh(t,`config`),icon:(0,H.jsx)(Gr,{className:`inline-block`}),name:`Config`}].filter(di),[e,t,i,r]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ow,{links:s,restartRequired:o}),(0,H.jsx)(sw,{links:s,restartRequired:o})]})}function ow({links:e,restartRequired:t}){return(0,H.jsxs)(`div`,{className:`hidden md:[@media(hover:hover)]:flex xl:flex items-center justify-between h-full text-sm text-foreground`,children:[(0,H.jsx)(ua,{restartRequired:t}),(0,H.jsx)(`div`,{className:`flex space-x-2`,children:e.map(({shortName:e,...t})=>{let n=(0,H.jsxs)(I,{"aria-label":t.name,className:`p-2 text-center text-muted-foreground hover:text-foreground`,activeProps:iw,...t,children:[t.icon,(0,H.jsx)(`span`,{className:`hidden xl:inline-block ml-1`,children:t.name}),e&&(0,H.jsx)(`span`,{className:`visible xl:hidden ml-1`,children:e})]},t.to);return e?n:(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:n}),(0,H.jsx)(Mi,{side:`bottom`,className:`xl:hidden`,children:t.name})]},t.to)})})]})}function sw({links:e,restartRequired:t}){return(0,H.jsx)(H.Fragment,{children:(0,H.jsxs)(`div`,{className:`flex md:[@media(hover:hover)]:hidden xl:hidden items-center justify-between h-full px-2 text-foreground`,children:[(0,H.jsx)(ua,{restartRequired:t}),(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{asChild:!0,children:(0,H.jsx)(_,{variant:`ghost`,className:`p-0`,children:(0,H.jsx)(jr,{className:`h-8 w-8`})})}),(0,H.jsxs)(Zo,{children:[(0,H.jsx)(es,{children:`Instance Menu`}),(0,H.jsx)(ts,{}),e.map(e=>(0,H.jsx)(Qo,{asChild:!0,children:(0,H.jsxs)(I,{to:e.to,activeProps:iw,className:`flex items-center gap-2`,children:[e.icon,e.name]})},e.to))]})]})]})})}(0,U.lazy)(()=>Pe(()=>import(`./FloatingChat-DGUC3L4r.js`).then(e=>({default:e.FloatingChat})),__vite__mapDeps([30,2,1,11,31,18,24])));function cw(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`nav`,{className:`fixed top-20 w-full z-39 h-12 md:px-12 bg-violet-50 border-b border-violet-100 dark:bg-grey-700 dark:border-none`,children:(0,H.jsx)(aw,{})}),(0,H.jsx)(`div`,{className:`mt-32 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,H.jsx)(Ee,{})}),!1]})}function lw(e){switch(e){case`local`:return P({getParentRoute:()=>sp,id:`_instanceLayout`,component:cw,loader:Pv});case`cluster`:return P({getParentRoute:()=>fp,id:`_instanceLayout`,component:cw,beforeLoad:uw,loader:Pv});case`instance`:return P({getParentRoute:()=>fp,path:`instance/$instanceId`,component:cw,beforeLoad:uw,loader:Pv})}}async function uw({context:e,params:t}){let n=t.instanceId||t.clusterId,r=!1;if(i.checkForFabricConnect(n)&&!i.hasResolvedFabricConnect(n)&&(r=!0,await dw(n,e.cluster,t.instanceId)))return;let a=i.getConnectionById(n);if(a.isLoading||a.user)return;let o=e.authentication[u];if(o?.isLoading)return;let{update:s}=t.instanceId?Ss(o.user,t.organizationId,t.clusterId):bs(o.user,t.organizationId,t.clusterId);if(!(!r&&s&&await dw(n,e.cluster,t.instanceId)))throw xe({to:`/${t.organizationId}/${t.clusterId}/`+(t.instanceId?`instance/${t.instanceId}`:``)+`/sign-in`,search:op()})}async function dw(e,t,n){try{return await i.establishFabricConnectAuth({id:e,operationsUrl:fw(t,n)}),!0}catch(e){return console.debug(`Fabric Connect not established`,e),!1}}function fw(e,t){if(t){let n=e?.instances?.find(e=>e.id===t);return n?m(n):void 0}return g(e)??void 0}function pw(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 mw=[`secondary`,`default`,`warning`,`outline`,`success`,`destructive`],hw=0,gw=new Map,_w=e=>{if(gw.has(e))return gw.get(e);hw++;let t=mw[hw%mw.length];return gw.set(e,t),t};function vw(e){switch(e){case`error`:case`stderr`:return`border-l-destructive`;case`warn`:return`border-l-yellow-500`;case`notify`:return`border-l-green-500`;default:return`border-l-transparent`}}function yw({columns:e,data:t,onRowClick:n,containerRef:r}){let i=be({data:t,columns:e,getCoreRowModel:Te()});return(0,H.jsxs)(fd,{className:`text-xs`,containerRef:r,containerClassName:`rounded-md bg-card dark:bg-black-dark logsTable max-h-[calc(100vh-(--spacing(48)))] overflow-y-auto md:max-h-[calc(100vh-(--spacing(40)))]`,children:[(0,H.jsx)(pd,{children:i.getHeaderGroups().map(e=>(0,H.jsx)(hd,{className:`border-b border-border`,children:e.headers.map(e=>(0,H.jsx)(gd,{className:`p-4 max-w-96 sticky top-0 z-10 border-b border-border bg-card dark:bg-black-dark`,children:e.isPlaceholder?null:De(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(md,{className:`bg-background dark:bg-black`,children:i.getRowModel().rows?.length?i.getRowModel().rows.map(e=>(0,H.jsx)(hd,{"data-state":e.getIsSelected()&&`selected`,className:p(`hover:bg-muted/20 data-[state=selected]:bg-muted max-w-full border-l-2`,vw(e.original.level),n&&`cursor-pointer`),onClick:()=>n?.(e),children:e.getVisibleCells().map(e=>(0,H.jsx)(vd,{className:`p-2`,children:De(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,H.jsx)(hd,{children:(0,H.jsx)(vd,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})}var bw=512*1024;function xw(e){try{JSON.parse(e)}catch{return!1}return!0}function Sw(e){return!e||e.length>524288?`plaintext`:xw(e)?`json`:`plaintext`}function Cw({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`flex items-start gap-3 py-1.5 border-b border-border/50 last:border-0`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground w-20 shrink-0 pt-0.5`,children:e}),(0,H.jsx)(`span`,{className:`text-xs`,children:t})]})}function ww({setIsModalOpen:e,isModalOpen:t,data:n}){let r=n?_w(n.node):`default`,i=Id();return(0,H.jsx)(Io,{onOpenChange:e,open:t,children:(0,H.jsxs)(Uo,{"aria-describedby":void 0,resizable:!0,children:[(0,H.jsx)(Wo,{children:(0,H.jsx)(Ko,{children:`Log Entry`})}),n?(0,H.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 text-popover-foreground`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-border/50 bg-muted/20 px-3 py-1`,children:[(0,H.jsx)(Cw,{label:`Level`,children:(0,H.jsx)(Va,{variant:pw(n.level),children:ca(n.level)})}),(0,H.jsx)(Cw,{label:`Timestamp`,children:(0,H.jsx)(`span`,{className:`tabular-nums`,children:new Date(n.timestamp).toLocaleString()})}),(0,H.jsx)(Cw,{label:`Thread`,children:(0,H.jsx)(`span`,{className:`tabular-nums font-mono`,children:n.thread})}),n.node&&(0,H.jsx)(Cw,{label:`Node`,children:(0,H.jsx)(Va,{variant:r,children:n.node})}),n.tags&&n.tags.length>0&&(0,H.jsx)(Cw,{label:`Tags`,children:(0,H.jsx)(`span`,{className:`font-mono`,children:n.tags})})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:`Message`}),(0,H.jsx)(`div`,{className:`rounded-md overflow-hidden border border-border/50 flex-1 min-h-0`,children:(0,H.jsx)(Rd,{className:`w-full h-full`,language:Sw(n.message),theme:i,value:n.message,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,padding:{top:12,bottom:12},automaticLayout:!0}})})]})]}):(0,H.jsx)(zs,{})]})})}var Tw=S({limit:w().or(te()).or(C()).optional(),level:ne([`notify`,`error`,`warn`,`info`,`debug`,`trace`,`undefined`]).or(te()).or(C()).optional(),from:w().or(te()).or(C()).optional(),until:w().or(te()).or(C()).optional(),log_name:ne([`hdb.log`,`system.log`]).or(te()).or(C()).optional(),filter:w().or(te()).or(C()).optional()}),Ew=`dark:bg-grey-600 dark:border-grey-500`;function Dw({form:e,resetFilters:t,submitFilters:n,showLogName:r,showFilter:i,isOpen:a,onOpenChange:o}){return(0,H.jsxs)(fn,{className:p(a?`block`:`hidden`,`mt-3 md:mt-0 md:block`),children:[(0,H.jsx)(ln,{className:`hidden md:block`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>o(!a),"aria-expanded":a,"aria-controls":`logs-filters-content`,className:`flex w-full items-center justify-between md:pointer-events-none`,children:(0,H.jsxs)(cn,{className:`flex items-center gap-2 text-base`,children:[(0,H.jsx)(Jr,{className:`size-4 text-muted-foreground`}),`Filters`]})})}),(0,H.jsx)(un,{id:`logs-filters-content`,children:(0,H.jsx)(G,{...e,children:(0,H.jsxs)(`form`,{id:`instance-edit-log-filters-form`,name:`instance-edit-log-filters-form`,onSubmit:e.handleSubmit(n),className:`flex-col space-y-4`,children:[i&&(0,H.jsx)(q,{control:e.control,name:`filter`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(K,{children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Ur,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(Z,{type:`search`,placeholder:`Search logs…`,className:p(`pl-9`,Ew),value:e.value??``,onChange:e.onChange})]})}),(0,H.jsx)(X,{})]})}),r&&(0,H.jsx)(q,{control:e.control,name:`log_name`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Log file`}),(0,H.jsxs)(su,{onValueChange:e.onChange,value:e.value??void 0,children:[(0,H.jsx)(uu,{className:p(`w-full bg-white`,Ew),children:(0,H.jsx)(lu,{placeholder:`Select log file`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(Q,{value:`hdb.log`,children:`Application (hdb.log)`}),(0,H.jsx)(Q,{value:`system.log`,children:`System (system.log)`})]})})]}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsx)(q,{control:e.control,name:`limit`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Limit`}),(0,H.jsxs)(su,{onValueChange:e.onChange,value:e.value??void 0,children:[(0,H.jsx)(uu,{className:p(`w-full bg-white`,Ew),children:(0,H.jsx)(lu,{placeholder:`Limit`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(Q,{value:`1000`,children:`1000`}),(0,H.jsx)(Q,{value:`500`,children:`500`}),(0,H.jsx)(Q,{value:`250`,children:`250`}),(0,H.jsx)(Q,{value:`100`,children:`100`}),(0,H.jsx)(Q,{value:`10`,children:`10`})]})})]}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:e.control,name:`level`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Level`}),(0,H.jsxs)(su,{onValueChange:e.onChange,value:e.value??void 0,children:[(0,H.jsx)(uu,{className:p(`w-full bg-white`,Ew),children:(0,H.jsx)(lu,{placeholder:`Level`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(Q,{value:`undefined`,children:`All`}),(0,H.jsx)(Q,{value:`notify`,children:`Notify`}),(0,H.jsx)(Q,{value:`error`,children:`Error`}),(0,H.jsx)(Q,{value:`warn`,children:`Warn`}),(0,H.jsx)(Q,{value:`info`,children:`Info`}),(0,H.jsx)(Q,{value:`debug`,children:`Debug`}),(0,H.jsx)(Q,{value:`trace`,children:`Trace`})]})})]}),(0,H.jsx)(X,{})]})})]}),(0,H.jsx)(q,{control:e.control,name:`from`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Start date`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`datetime-local`,className:Ew,value:e.value??void 0,onChange:e.onChange})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:e.control,name:`until`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`End date`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`datetime-local`,className:Ew,value:e.value??void 0,onChange:e.onChange})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsx)(_,{type:`submit`,variant:`positiveOutline`,className:`grow`,children:`Apply Filters`}),(0,H.jsx)(_,{type:`reset`,variant:`destructiveOutline`,onClick:t,children:`Clear`})]})]})})})]})}var Ow=1e4;function kw(e){if(!e)return;let t=parseInt(e,10);if(!(!Number.isFinite(t)||t<=0))return Math.min(t,Ow)}function Aw(e,t){return{operation:`read_log`,start:0,replicated:t,limit:kw(e.limit),level:e.level===`undefined`?void 0:e.level,from:e.from?new Date(e.from).toISOString():void 0,until:e.until?new Date(e.until).toISOString():void 0,log_name:e.log_name??void 0,filter:e.filter?e.filter:void 0,order:`desc`}}async function jw({instanceClient:e,logFilters:t,replicated:n}){let{data:r}=await e.post(`/`,Aw(t,n));return r}function Mw(e){let t=e.logFilters;return F({queryKey:[`read_log`,e.entityId,t.limit,t.level,t.from,t.until,t.log_name,t.filter,e.replicated],queryFn:()=>jw(e),retry:!1,refetchInterval:e.isAutoRefreshEnabled?5e3:!1})}async function Nw({connection:e,logFilters:t,replicated:n,signal:r,onEntry:i}){let{url:a,headers:o,credentials:s}=nh(e),c;try{c=await fetch(a,{method:`POST`,headers:o,credentials:s,body:JSON.stringify(Aw(t,n)),signal:r})}catch(e){throw r?.aborted?e:new $m(`Failed to open the read_log SSE stream.`,{cause:e})}let l=c.headers.get(`content-type`)??``;if(!c.ok||!l.includes(`text/event-stream`)||!c.body)throw await c.body?.cancel().catch(()=>{}),new $m(`read_log did not return an event stream (status ${c.status}, content-type "${l}").`);for await(let e of Xm(c.body,r)){if(e.event===`error`){let t=Qm(e);if(!t||typeof t!=`object`)throw new th(typeof t==`string`&&t?t:`The log stream failed.`);let n=t;throw new th(n.message??`The log stream failed.`,{code:n.code})}if(e.event===`done`||e.event===`end`)return;for(let t of Pw(Qm(e)))i(t)}}function Pw(e){return Array.isArray(e)?e.filter(Fw):Fw(e)?[e]:[]}function Fw(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.timestamp==`string`&&(typeof t.level==`string`||typeof t.message==`string`)}function Iw(e){return[e.timestamp,e.node??``,e.thread??``,e.level,e.message].join(`|`)}function Lw(e,t,n){let r=new Set,i=[];for(let n of[...t,...e]){let e=Iw(n);r.has(e)||(r.add(e),i.push(n))}return i.sort((e,t)=>e.timestamp<t.timestamp?1:e.timestamp>t.timestamp?-1:0),n>0&&i.length>n?i.slice(0,n):i}var Rw={entries:[],fellBack:!1};function zw(e,t){switch(t.kind){case`reset`:return Rw;case`retry`:return e.fellBack?{...e,fellBack:!1}:e;case`append`:{if(t.entries.length===0)return e;let n=e.entries.concat(t.entries);return n.length<=t.cap?{...e,entries:n}:(n.sort((e,t)=>e.timestamp<t.timestamp?1:e.timestamp>t.timestamp?-1:0),{...e,entries:n.slice(0,t.cap)})}case`fellBack`:return{...e,fellBack:!0}}}function Bw(){let e=W();return i.isDirectConnection(e.entityId)}var Vw=1e3,Hw=2e3,Uw=250;function Ww(e){return kw(e)??Vw}function Gw(e,t){return JSON.stringify([e.limit,e.level,e.from,e.until,e.log_name,e.filter,t])}function Kw({params:e,logFilters:t,replicated:n,live:r}){let i=Bw(),[a,o]=(0,U.useReducer)(zw,Rw),s=r&&i&&!a.fellBack,c=Gw(t,n),l=Ww(t.limit),u=Math.max(Hw,l),d=N(Mw({...e,logFilters:t,replicated:n,isAutoRefreshEnabled:r&&!s}));(0,U.useEffect)(()=>{o({kind:`reset`})},[e.entityId,c]),(0,U.useEffect)(()=>{r&&o({kind:`retry`})},[r]);let f=(0,U.useRef)({logFilters:t,replicated:n});f.current={logFilters:t,replicated:n},(0,U.useEffect)(()=>{if(!s)return;let t=new AbortController,n=[],r=()=>{if(n.length>0&&!t.signal.aborted){let e=n;n=[],o({kind:`append`,entries:e,cap:u})}},i=setInterval(r,Uw);return Nw({connection:{id:e.entityId},logFilters:f.current.logFilters,replicated:f.current.replicated,signal:t.signal,onEntry:e=>n.push(e)}).catch(()=>{}).finally(()=>{clearInterval(i),!t.signal.aborted&&(r(),o({kind:`fellBack`}))}),()=>{clearInterval(i),t.abort()}},[s,e.entityId,c]);let p=(0,U.useMemo)(()=>{let e=d.data??[];return a.entries.length===0?e:Lw(e,a.entries,l)},[d.data,a.entries,l]),m=s?`streaming`:r?`polling`:`idle`;return{logs:p,isLoading:d.isLoading,isFetching:d.isFetching,refetch:()=>d.refetch(),transport:m}}var qw={log_name:`hdb.log`,limit:`100`,level:`undefined`,from:``,until:``,filter:``},Jw={error:(0,H.jsx)(Wn,{className:`size-3`}),stderr:(0,H.jsx)(Wn,{className:`size-3`}),warn:(0,H.jsx)(ii,{className:`size-3`}),notify:(0,H.jsx)(In,{className:`size-3`}),info:(0,H.jsx)(yr,{className:`size-3`}),debug:(0,H.jsx)(zn,{className:`size-3`}),trace:(0,H.jsx)(On,{className:`size-3`}),stdout:(0,H.jsx)(ei,{className:`size-3`})},Yw=[{accessorKey:`level`,header:`Level`,cell:({row:e})=>{let{level:t}=e.original;return(0,H.jsxs)(Va,{variant:pw(t),children:[Jw[t],ca(t)]})}},{accessorKey:`timestamp`,header:`Timestamp`,cell:({row:e})=>{let{timestamp:t}=e.original,n=new Date(t);return(0,H.jsxs)(`span`,{className:`tabular-nums whitespace-nowrap text-muted-foreground`,children:[n.getFullYear()===new Date().getFullYear()?n.toLocaleDateString(void 0,{month:`numeric`,day:`2-digit`}):n.toLocaleDateString(),` `,n.toLocaleTimeString()]})}},{accessorKey:`message`,header:`Message`,cell:({row:e})=>{let{message:t}=e.original;return(0,H.jsx)(`span`,{className:`block max-w-xl truncate font-mono text-xs`,children:t})}},{accessorKey:`thread`,header:`Thread`,cell:({row:e})=>(0,H.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.original.thread})},{accessorKey:`node`,header:`Node`,cell:({row:e})=>{let{node:t}=e.original,n=_w(t);return(0,H.jsx)(H.Fragment,{children:t?(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(Va,{variant:n,children:[t.split(`.`)[0],`...`]})}),(0,H.jsx)(Mi,{className:`bg-popover text-popover-foreground border border-border`,arrowClassName:`bg-popover fill-popover`,children:t})]}):null})}},{accessorKey:`tags`,header:`Tags`,cell:({row:e})=>{let{tags:t}=e.original;return t&&t.length>0?(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null}}],Xw=(e,t)=>!e&&!t||!e||!t||new Date(e)<=new Date(t);function Zw(){return(0,H.jsxs)(`div`,{className:`rounded-md bg-card dark:bg-black-dark overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`flex gap-4 p-4 border-b border-border`,children:[`w-14`,`w-32`,`w-14`,`w-24`,`w-16`,`flex-1`].map((e,t)=>(0,H.jsx)(xf,{className:`h-4 ${e}`},t))}),Array.from({length:12}).map((e,t)=>(0,H.jsxs)(`div`,{className:`flex gap-4 p-3 border-b border-border/40 border-l-2 border-l-transparent`,children:[(0,H.jsx)(xf,{className:`h-5 w-14`}),(0,H.jsx)(xf,{className:`h-5 w-32`}),(0,H.jsx)(xf,{className:`h-5 w-10`}),(0,H.jsx)(xf,{className:`h-5 w-20`}),(0,H.jsx)(xf,{className:`h-5 w-12`}),(0,H.jsx)(xf,{className:`h-5 flex-1 max-w-xs`})]},t))]})}function Qw(){let[e,t]=(0,U.useState)(qw),[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(!1),[c,l]=xn(Cn.LogsOrderReversed,!1),[u,d]=(0,U.useState)(!1),f=W(),{data:p}=N(mh(f)),m=p?.version,h=!!m&&oc(`4.7.16`,m),{logs:g,isLoading:v,isFetching:y,refetch:b,transport:x}=Kw({params:f,logFilters:e,replicated:f.entityType===`cluster`,live:o}),S=(0,U.useMemo)(()=>c?[...g??[]].reverse():g??[],[g,c]),C=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=C.current;v||!e||e.scrollTo({top:c?e.scrollHeight:0})},[c,v]),(0,U.useEffect)(()=>{let e=C.current;!o||v||!e||e.scrollTo({top:c?e.scrollHeight:0})},[S,o,c,v]);let w=R({resolver:z(Tw),defaultValues:qw,mode:`onChange`}),T=e=>{a(e.original),r(!0)},E=async e=>{if(!Xw(e.from,e.until)){w.setError(`from`,{type:`onChange`,message:`Start date must be before end date`}),w.setError(`until`,{type:`onChange`,message:`End date must be after start date`});return}t(e)},ee=async()=>{w.reset(),t(qw)},D=wd(b);return(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 pt-2 text-foreground md:grid-cols-12 md:gap-4`,children:[(0,H.jsxs)(`section`,{className:`col-span-1 md:col-span-4 lg:col-span-3 px-2 pb-0 md:self-start md:sticky md:top-34 md:max-h-[calc(100vh-(--spacing(34)))] md:overflow-y-auto md:pb-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:()=>d(e=>!e),"aria-label":`Toggle filters`,"aria-expanded":u,className:`flex-1`,children:[(0,H.jsx)(Jr,{}),`Filters`]}),(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:D,disabled:y||v||o,"aria-label":`Refresh logs`,className:`flex-1`,children:[(0,H.jsx)(hn,{className:y?`animate-spin`:``}),`Refresh`]}),(0,H.jsxs)(_,{variant:c?`default`:`defaultOutline`,onClick:()=>l(e=>!e),"aria-label":`Reverse log order`,"aria-pressed":c,className:`flex-1`,children:[(0,H.jsx)(Nn,{}),`Reverse`]})]}),(0,H.jsx)(Dw,{form:w,resetFilters:ee,submitFilters:E,showLogName:!1,showFilter:h,isOpen:u,onOpenChange:d}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-3 hidden md:block`,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:D,disabled:y||v||o,className:`w-full`,children:[(0,H.jsx)(hn,{}),`Refresh`]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,H.jsx)(Qd,{id:`logs-live-switch`,"aria-label":`Toggle live logs`,checked:o,onCheckedChange:s}),(0,H.jsxs)(`label`,{htmlFor:`logs-live-switch`,className:`flex items-center gap-2 cursor-pointer`,children:[(0,H.jsx)(hn,{className:`size-4 ${o?`animate-spin [animation-duration:3s]`:``}`}),o?x===`streaming`?`Live (streaming)`:`Live (polling every 5s)`:`Live`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,H.jsx)(Qd,{id:`logs-reverse-order-switch`,"aria-label":`Reverse log order`,checked:c,onCheckedChange:l}),(0,H.jsxs)(`label`,{htmlFor:`logs-reverse-order-switch`,className:`flex items-center gap-2 cursor-pointer`,children:[(0,H.jsx)(Nn,{className:`size-4`}),c?`Oldest first`:`Newest first`]})]})]})]})]}),(0,H.jsx)(`section`,{className:`col-span-1 md:col-span-8 lg:col-span-9`,children:v?(0,H.jsx)(Zw,{}):(0,H.jsx)(yw,{columns:Yw,data:S,onRowClick:T,containerRef:C})}),(0,H.jsx)(ww,{isModalOpen:n,setIsModalOpen:r,data:i})]})}function $w(e){return P({getParentRoute:()=>e,path:`logs`,head:()=>({meta:[{title:`Logs — Harper Fabric`}]}),component:Qw})}var eT=6e4,tT=60*eT,nT=24*tT,rT=[{id:`1h`,label:`Last 1 hour`,durationMs:tT,bucketMs:1*eT},{id:`6h`,label:`Last 6 hours`,durationMs:6*tT,bucketMs:1*eT},{id:`24h`,label:`Last 24 hours`,durationMs:nT,bucketMs:5*eT},{id:`7d`,label:`Last 7 days`,durationMs:7*nT,bucketMs:15*eT},{id:`30d`,label:`Last 30 days`,durationMs:30*nT,bucketMs:tT}];function iT(e){let t=rT.find(t=>t.id===e);if(!t)throw Error(`Unknown preset: ${e}`);return t}var aT=[{label:`Off`,value:0},{label:`30s`,value:3e4},{label:`60s`,value:6e4},{label:`5m`,value:3e5}],oT=6e4,sT=[`health`,`traffic`,`requests`,`database`,`replication`,`storage`,`overview`],cT={tab:`health`,range:`1h`,refresh:oT};function lT(e){let t=e.refresh===``?NaN:Number(e.refresh);return{tab:sT.find(t=>t===e.tab)??cT.tab,range:rT.find(t=>t.id===e.range)?.id??cT.range,refresh:aT.find(e=>e.value===t)?.value??cT.refresh}}function uT(e){return P({getParentRoute:()=>e,path:`status`,validateSearch:lT,search:{middlewares:[oe(cT)]},head:()=>({meta:[{title:`Status — Harper Fabric`}]}),component:Ce(async()=>Pe(()=>import(`./status-DetVLUxR.js`),__vite__mapDeps([32,2,8,9,10,1,11,12,17,18,19,20,23,33,34,35,36,37,38,39,40,41,42,43,44,45,46])),`StatusIndex`)})}function dT(e){let t=lw(e),n=[$w(t),...Sm(t,e),xm(t),uT(t),Fv(t),rw(t)];return t.addChildren(n)}P({getParentRoute:()=>sp,path:`profile`,head:()=>({meta:[{title:`Profile — Harper Fabric`}]}),component:Ce(async()=>Pe(()=>import(`./profile-7bu_CF1f.js`),__vite__mapDeps([47,2,8,9,10,1,11,12,16])),`ProfileIndex`)});var fT=hi.addChildren([...bo,sp.addChildren([dT(`local`)])]);function pT({routeTree:e=fT,authentication:t}){let[n]=(0,U.useState)(()=>ve({routeTree:e,history:de(),defaultNotFoundComponent:li,defaultErrorComponent:ci,defaultPreload:!ui()&&`intent`,trailingSlash:`never`,defaultPreloadStaleTime:0,scrollRestoration:!0,context:{queryClient:yn,authentication:t||{}}}));return n}function mT(){let e=Ve(),t=pT({authentication:e}),n=(0,U.useRef)(e);return(0,U.useEffect)(()=>{n.current!==e&&(n.current=e,t.invalidate())},[t,e]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_e,{router:t,context:{authentication:e}}),(0,H.jsx)(we,{router:t,position:`bottom-right`})]})}var hT=({...e})=>(0,H.jsx)(xt,{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}),gT=!1;function _T(){(0,U.useEffect)(()=>{gT||=!0},[])}function vT(){return $i(),pi(),_T(),(0,H.jsxs)(bi,{children:[(0,H.jsxs)(ce,{client:yn,children:[(0,H.jsx)(mT,{}),(0,H.jsx)(ke,{buttonPosition:`bottom-right`})]}),(0,H.jsx)(hT,{richColors:!0})]})}function yT(){if(typeof Node!=`function`||!Node.prototype)return;let e=`__harperTranslationGuarded__`,t=Node.prototype;if(t[e])return;Object.defineProperty(t,e,{value:!0,configurable:!0,writable:!0,enumerable:!1});let n=Node.prototype.removeChild;Node.prototype.removeChild=function(e){return e instanceof Node&&e.parentNode!==this?e:n.call(this,e)};let r=Node.prototype.insertBefore;Node.prototype.insertBefore=function(e,t){return t instanceof Node&&t.parentNode!==this?r.call(this,e,null):r.call(this,e,t)}}var bT=`Studio:StaleDeployReloadedAt`,xT=6e4,ST=`__harperStaleDeployReloadState__`;function CT(){if(!(typeof window>`u`))return window[ST]}function wT(){let e=CT();if(e){try{let e=Number(sessionStorage.getItem(bT)??0);if(Date.now()-e<xT)return;sessionStorage.setItem(bT,String(Date.now()))}catch{return}e.reload()}}function TT(e=()=>window.location.reload()){if(typeof window>`u`)return;let t=window,n=t[ST];if(n){n.reload=e;return}t[ST]={reload:e},window.addEventListener(`vite:preloadError`,()=>wT())}var ET=Le();yT(),TT(),(0,ET.createRoot)(document.getElementById(`root`),{onUncaughtError:(e,t)=>{Fe(e,t),console.error(`Uncaught error:`,e,t)},onCaughtError:(e,t)=>{Fe(e,t),console.error(`Caught error:`,e,t)},onRecoverableError:(e,t)=>{Fe(e,t),console.warn(`Recoverable error:`,e,t)}}).render((0,H.jsx)(U.StrictMode,{children:(0,H.jsx)(vT,{})}));export{k_ as $,Rr as $n,ws as $t,TS as A,K as An,Zf as At,Uy as B,ci as Bn,su as Bt,BS as C,Sa as Cn,qm as Ct,US as D,ma as Dn,np as Dt,zS as E,Y as En,Ep as Et,Cb as F,Ii as Fn,Id as Ft,Jv as G,ei as Gn,Pc as Gt,cy as H,ii as Hn,Q as Ht,Sb as I,Ai as In,Sd as It,Y_ as J,Kr as Jn,fc as Jt,_v as K,Qr as Kn,Ec as Kt,_b as L,Mi as Ln,cd as Lt,OS as M,Bi as Mn,Xf as Mt,nS as N,Fi as Nn,Qd as Nt,HS as O,J as On,ep as Ot,yx as P,W as Pn,Rd as Pt,O_ as Q,zr as Qn,Fs as Qt,hb as R,ji as Rn,sd as Rt,JS as S,Va as Sn,$m as St,WS as T,X as Tn,Pp as Tt,uy as U,ri as Un,uu as Ut,ly as V,ai as Vn,du as Vt,sy as W,ni as Wn,lu as Wt,z_ as X,Vr as Xn,zs as Xt,R_ as Y,Ur as Yn,oc as Yt,T_ as Z,Br as Zn,Is as Zt,GS as _,Uo as _n,mh as _t,iT as a,fs as an,rr as ar,yg as at,KS as b,Wo as bn,oh as bt,PC as c,Zo as cn,Wn as cr,Zh as ct,_C as d,ns as dn,jn as dr,Uh as dt,Cs as en,Lr as er,I_ as et,yC as f,rs as fn,Hh as ft,fC as g,Io as gn,gh as gt,pC as h,Xo as hn,Dh as ht,rT as i,ds as in,yr as ir,wg as it,kS as j,G as jn,$f as jt,AS as k,q as kn,Qf as kt,kC as l,Qo as ln,Un as lr,Yh as lt,hC as m,is as mn,Fh as mt,lT as n,cs as nn,Tr as nr,F_ as nt,jw as o,ss as on,tr as or,Qh as ot,vC as p,as as pn,Rh as pt,ev as q,Zr as qn,wc as qt,aT as r,ls as rn,wr as rr,qg as rt,bw as s,Yo as sn,Kn as sr,Xh as st,wT as t,os as tn,Ir as tr,A_ as tt,EC as u,ts as un,Mn as ur,Vh as ut,IS as v,qo as vn,ph as vt,RS as w,Z as wn,am as wt,qS as x,Ko as xn,eh as xt,LS as y,Go as yn,lh as yt,ab as z,di as zn,Au as zt};
|
|
817
|
-
//# sourceMappingURL=index-
|
|
816
|
+
disabled:pointer-events-none disabled:opacity-50 dark:bg-grey-700 dark:text-white`})]})}function qC({pageSize:e,onChange:t}){return(0,H.jsxs)(`div`,{className:`hidden items-center gap-2 @min-[960px]:flex`,children:[(0,H.jsx)(`span`,{className:`text-sm whitespace-nowrap text-muted-foreground`,children:`Rows`}),(0,H.jsxs)(su,{value:String(e),onValueChange:e=>t(Number(e)),children:[(0,H.jsx)(uu,{"aria-label":`Rows per page`,className:`h-9 w-20`,children:(0,H.jsx)(lu,{})}),(0,H.jsx)(du,{side:`top`,children:HC.map(e=>(0,H.jsx)(Q,{value:String(e),children:ju(e)},e))})]})]})}function JC(e,t,n=1){if(t<=n*2+5)return YC(1,t);let r=Math.max(e-n,1),i=Math.min(e+n,t),a=r>2,o=i<t-1,s=3+2*n;return!a&&o?[...YC(1,s),`ellipsis`,t]:a&&!o?[1,`ellipsis`,...YC(t-s+1,t)]:[1,`ellipsis`,...YC(r,i),`ellipsis`,t]}function YC(e,t){return Array.from({length:t-e+1},(t,n)=>e+n)}function XC({applyFilters:e,columnFiltersForm:t,columns:n,columnVisibility:r,data:i,isFetching:a,onColumnClick:o,onRowClick:s,pageIndex:c,pageSize:l,primaryKey:u,setPageIndex:d,setPageSize:f,filtersToggled:p,totalPages:m,totalRecords:h,isEstimatedCount:g,estimatedRange:_,isExactCountFetching:v,isExactCountError:y,onRequestExactCount:b}){let x=be({data:i||[],columns:n,manualPagination:!0,enableColumnResizing:!0,columnResizeMode:`onEnd`,pageCount:m,defaultColumn:{minSize:1},state:{columnVisibility:r},rowCount:h,getCoreRowModel:Te(),getPaginationRowModel:Oe()});return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(fd,{containerClassName:`rounded-md bg-card dark:bg-black-dark grow overflow-visible`,children:[(0,H.jsx)(pd,{children:x.getHeaderGroups().map(e=>(0,H.jsx)(hd,{className:`border-none`,children:e.headers.map(e=>(0,H.jsx)(_d,{header:e,onColumnClick:o,className:`sticky top-32 z-10 bg-card dark:bg-black-dark border-b border-border`},e.id))},e.id))}),p&&(0,H.jsx)(LC,{applyFilters:e,columnFiltersForm:t,headerGroups:x.getHeaderGroups()}),(0,H.jsx)(md,{className:`bg-background dark:bg-black border border-border dark:border-grey-700`,children:x.getRowModel().rows?.length?x.getRowModel().rows.map(e=>(0,H.jsx)(ZC,{row:e,onRowClick:s,primaryKey:u},e.id)):(0,H.jsx)(hd,{children:(0,H.jsx)(vd,{colSpan:n.length,className:`h-24 text-center`,children:a||i===void 0?(0,H.jsx)(VC,{className:`opacity-50 inline-block`}):(0,H.jsx)(`span`,{children:`No results.`})})})})]}),(0,H.jsx)(UC,{pageIndex:c,pageSize:l,totalPages:m,totalRecords:h,isEstimatedCount:g,estimatedRange:_,isExactCountFetching:v,isExactCountError:y,onRequestExactCount:b,setPageIndex:d,setPageSize:f})]})}function ZC({row:e,primaryKey:t,onRowClick:n}){let r=e.getVisibleCells(),i=(0,U.useMemo)(()=>{let n=e.original;return n&&n.message===`This entry has expired`?r[0]?.column?.id===t?[(0,H.jsx)(QC,{cell:r[0]},r[0].id),(0,H.jsx)($C,{colSpan:r.length-1},`expired`)]:[(0,H.jsx)($C,{colSpan:r.length},`expired`)]:r.map(e=>(0,H.jsx)(QC,{cell:e},e.id))},[e,t,r]);return(0,H.jsx)(hd,{"data-state":e.getIsSelected()&&`selected`,onClick:()=>n?.(e),className:p(`hover:bg-muted/10 data-[state=selected]:bg-muted`,n&&`cursor-pointer`),children:i})}function QC({cell:e}){return(0,H.jsx)(vd,{style:{width:`${e.column.getSize()}px`},className:`px-2 py-2 overflow-x-hidden max-w-32 text-ellipsis whitespace-nowrap`,children:De(e.column.columnDef.cell,e.getContext())})}function $C({colSpan:e}){return(0,H.jsx)(vd,{colSpan:e,className:`px-2 py-2 overflow-x-hidden max-w-32 text-ellipsis whitespace-nowrap`,children:(0,H.jsx)(`span`,{className:`text-muted-foreground`,children:`This entry has expired`})})}function ew({instanceDatabaseMap:e,databaseName:t,tableName:n}){let r=M({strict:!1}),i=W(),{clusterId:a,instanceId:o}=r,{toggled:s,toggle:c}=EC(!0),l=Be(),u=Ts(o??a,t,n,`insert`),d=Ts(o??a,t,n,`update`),f=Ts(o??a,t,n,`delete`),p=ws(),{data:m}=N(gb({...i,databaseName:t,tableName:n})),h=e?.[t],g=h?.[n],v=m??g,y=(0,U.useMemo)(()=>ic(v?.attributes??[],`attribute`),[v]),{data:b}=N(SC(i)),x=b?.[t]?.[n],S=(0,U.useMemo)(()=>Hv(v,h,x),[v,h,x]),C=(0,U.useMemo)(()=>qv(v,h),[v,h]),w=(0,U.useMemo)(()=>Wv(v?.attributes,h),[v,h]),[T,E]=Jf(null,r),[ee,D]=(0,U.useState)(!1),O=(0,U.useMemo)(()=>(t?Object.keys(e?.[t]||[]).sort():[]).length===1,[e,t]),{toggled:k,toggleOn:A,toggleOff:te}=EC(!1),ne=R({resolver:z(IC)}),{reset:re}=ne,ie=ne.watch(),[j,ae]=Jf(null,[r.clusterId,r.instanceId,t,n]),oe=(0,U.useCallback)(e=>{let t=[];for(let n in e){let r=e[n];if(r?.length)try{t.push(...ob(n,r,y[n],S[n]))}catch(e){B.error(String(e))}}return t},[y,S]),se=(0,U.useCallback)(()=>{let e=oe(ie);ae(e.length?e:null),re({...ie})},[oe,re,ie]),ce=(0,U.useCallback)(()=>{re({},{keepValues:!1,keepDirtyValues:!1,keepDefaultValues:!1}),re(),ae(null),te()},[te,re]);(0,U.useEffect)(function(){return ce()},[r,ce]);let{filters:ue}=pe({strict:!1}),de=JSON.stringify([t,n,ue??null]),fe=(0,U.useRef)(null);(0,U.useEffect)(function(){if(!v||fe.current===de)return;let e=fe.current===null;if(fe.current=de,ue){re({...ue});let e=oe(ue);ae(e.length?e:null),A()}else e||ce()},[ue,de,v,re,oe,ae,A,ce]);let{dataTableColumns:P,primaryKey:me}=Jy(v,S),[he,ge]=Jf({attribute:me,descending:!1},r),[_e,ve]=Jf(0,[t,n,j]),[ye,be]=(0,U.useState)(20),F=m?.record_count??g?.record_count,xe=m?.estimated_record_range??g?.estimated_record_range,[Se,Ce]=Jf(!1,[t,n]),{data:we,isFetching:Te,isError:Ee,refetch:De}=N(NC({...i,enabled:Se,databaseName:t,tableName:n})),Oe=(0,U.useCallback)(()=>{Se?De():Ce(!0)},[Se,De,Ce]),ke=we??F,Ae=ke?Math.ceil(ke/ye):0,je=we===void 0&&xe!==void 0,L=k&&!!j,{data:Me,isFetching:Ne}=N(Tp({...i,enabled:!L&&!!me,databaseName:t,tableName:n,searchAttribute:me,sort:he,pageSize:ye,pageIndex:_e,onlyIfCached:s,getAttributes:C})),{data:Pe,isFetching:Fe}=N(ib({...i,enabled:L&&!!me,databaseName:t,tableName:n,conditions:j,sort:he,pageSize:ye,pageIndex:_e,onlyIfCached:s,getAttributes:C})),Ie=L?Pe:Me,Le=Ne||Fe,{data:Re}=N(jC({...i,enabled:ee,databaseName:t,tableName:n,ids:T})),{mutate:ze,isPending:Ve}=FC(),{mutate:He,isPending:Ue}=AC(),{mutate:We,isPending:Ge}=OC(),Ke=le(),qe=(0,U.useCallback)(()=>Ke.invalidateQueries({queryKey:[i.entityId,t,n]}),[Ke,i.entityId,t,n]),Je=(0,U.useCallback)(async()=>{confirm(`Are you sure you want to cleanup orphan blobs for database "${t}"?`)&&We({...i,databaseName:t},{onSuccess:e=>{B.success(e.message||`Orphan blobs cleanup started successfully`),qe()},onError:e=>{B.error(e instanceof Error?e.message:`Failed to cleanup orphan blobs`)}})},[We,t,i,qe]),{exportCsv:Ye,isExporting:Xe}=fb(),Ze=(0,U.useCallback)(()=>{Ye({databaseName:t,tableName:n,primaryKey:me,sort:he,conditions:L?j:null})},[Ye,t,n,me,he,L,j]),Qe=(0,U.useCallback)(e=>{ze({...i,databaseName:t,tableName:n,records:e},{onSuccess:()=>{qe(),D(!1),B.success(`Record updated successfully`)}})},[ze,i,t,n,qe]),$e=(0,U.useCallback)(e=>{He({...i,databaseName:t,tableName:n,hashValues:e},{onSuccess:()=>{qe(),D(!1),B.success(`Record deleted successfully`)}})},[He,i,t,n,qe]),et=e=>{E([e.original[me]]),D(!ee)},tt=(e,t)=>{ge({attribute:e,descending:!t})},nt=wd(qe),rt=(0,U.useCallback)(()=>{cy(`ShowAddTableRecords`,{databaseName:t,tableName:n})},[t,n]),it=(0,U.useCallback)(()=>{cy(`ShowImportData`,{databaseName:t,tableName:n})},[t,n]),[at,ot]=np(`ColumnDisplayed/${t}/${n}`,{}),st=(0,U.useMemo)(()=>({...Object.fromEntries(Kv(S).map(e=>[e,!1])),...at}),[S,at]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`flex flex-col md:flex-row items-center justify-between space-y-3 md:space-y-0 md:space-x-3 pt-15 pb-4 pr-4`,children:[(0,H.jsxs)(`div`,{className:`flex space-x-2`,children:[u&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:rt,accessKey:`n`,children:[(0,H.jsx)(Rr,{}),(0,H.jsxs)(`span`,{children:[`Add `,(0,H.jsx)(`u`,{children:`N`}),`ew Record(s)`]})]}),u&&(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:it,accessKey:`i`,children:[(0,H.jsx)($n,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`I`}),`mport Data`]})]}),(0,H.jsxs)(_,{variant:`positiveOutline`,onClick:Ze,disabled:Xe,accessKey:`e`,children:[(0,H.jsx)(Qn,{}),(0,H.jsxs)(`span`,{children:[(0,H.jsx)(`u`,{children:`E`}),`xport CSV`]})]})]}),(0,H.jsxs)(`div`,{className:`flex space-x-2`,children:[k&&j&&(0,H.jsxs)(_,{type:`button`,variant:`ghost`,onClick:ce,accessKey:`f`,children:[(0,H.jsx)(ur,{className:`inline-block `}),(0,H.jsxs)(`span`,{children:[`Clear `,(0,H.jsx)(`u`,{children:`F`}),`ilters`]})]}),k&&ne.formState.isDirty&&(0,H.jsxs)(_,{variant:`default`,onClick:se,children:[(0,H.jsx)(lr,{className:`inline-block `}),`Apply Filters`]}),k&&!j&&(0,H.jsxs)(_,{variant:`ghost`,onClick:te,accessKey:`f`,children:[(0,H.jsx)(ur,{className:`inline-block `}),(0,H.jsxs)(`span`,{children:[`Hide `,(0,H.jsx)(`u`,{children:`F`}),`ilters`]})]}),!k&&(0,H.jsxs)(_,{variant:`ghost`,onClick:A,accessKey:`f`,children:[(0,H.jsx)(dr,{className:`inline-block `}),(0,H.jsxs)(`span`,{children:[`Show `,(0,H.jsx)(`u`,{children:`F`}),`ilters`]})]}),(0,H.jsx)(_,{variant:`defaultOutline`,onClick:nt,disabled:Le,children:(0,H.jsx)(hn,{})}),(0,H.jsx)(zC,{columns:P,columnVisibility:st,setColumnVisibility:ot}),(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{asChild:!0,disabled:!e,children:(0,H.jsx)(_,{variant:`ghost`,size:`icon`,disabled:!e,children:(0,H.jsx)(ir,{"aria-label":`Table options`})})}),(0,H.jsxs)(Zo,{side:`bottom`,align:`end`,children:[(0,H.jsxs)(Qo,{className:`focus:bg-primary/70 focus:text-white`,onClick:c,children:[s?(0,H.jsx)(Gn,{className:`text-green`}):(0,H.jsx)(Jn,{}),`Only If Cached`,(0,H.jsx)(I,{to:`https://docs.harperdb.io/docs/developers/applications/caching#cache-control-header`,target:`_blank`,rel:`noopener noreferrer`,onClick:Uy,children:(0,H.jsx)(ar,{})})]}),p&&l&&!!o&&(0,H.jsxs)(Qo,{className:`focus:bg-yellow/70 focus:text-white`,onClick:Je,disabled:Ge,children:[(0,H.jsx)(Rn,{className:`text-yellow `}),`Cleanup Orphan Blobs`]}),p&&!O&&(0,H.jsxs)(Qo,{className:`focus:bg-red/70 focus:text-white`,onClick:()=>cy(`ShowDeleteTable`,{databaseName:t,tableName:n}),children:[(0,H.jsx)(ri,{className:`inline-block `}),`Drop Table`]}),p&&(0,H.jsxs)(Qo,{className:`focus:bg-red/70 focus:text-white`,onClick:()=>cy(`ShowDeleteDatabase`,{databaseName:t}),children:[(0,H.jsx)(ni,{}),`Drop Database`]})]})]})]})]}),(0,H.jsx)(XC,{primaryKey:me,data:Ie?.data,isFetching:Le,filtersToggled:k,columns:P,columnVisibility:st,onRowClick:et,onColumnClick:tt,totalPages:Ae,totalRecords:ke,isEstimatedCount:je,estimatedRange:xe,isExactCountFetching:Te,isExactCountError:Ee,onRequestExactCount:Oe,pageIndex:_e,pageSize:ye,columnFiltersForm:ne,applyFilters:se,setPageIndex:ve,setPageSize:be}),(0,H.jsx)(TC,{canEditRecords:d,canDeleteRecords:f,setIsModalOpen:D,isModalOpen:ee,primaryKey:me,syntheticAttributes:w,data:Re?.data,onSaveChanges:Qe,onDeleteRecord:$e,isUpdateTableRecordsPending:Ve,isDeleteTableRecordsPending:Ue})]})}function tw(e,t){if(!e)return null;if(!(t.databaseName&&e[t.databaseName])){let n=Object.keys(e).sort()[0];return n&&n!==t.databaseName?{databaseName:n,tableName:void 0}:null}return t.tableName&&!e[t.databaseName][t.tableName]?{databaseName:t.databaseName,tableName:void 0}:null}function nw(){let e=M({strict:!1}),{data:t}=N(Jg({...W(),skipRecordCount:!0})),n=tw(t,e);return n?(0,H.jsx)(he,{to:Iv({...e,...n}),replace:!0}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`main`,{className:`grid grid-cols-1 gap-4 md:grid-cols-12 md:items-start`,children:[(0,H.jsx)(`section`,{className:`col-span-1 text-foreground md:col-span-4 lg:col-span-3 flex flex-col min-h-0 md:sticky md:top-32 md:h-[calc(100vh-(--spacing(32)))] md:max-h-[calc(100vh-(--spacing(32)))] overflow-hidden`,children:(0,H.jsx)(bS,{instanceDatabaseMap:t})}),(0,H.jsx)(`section`,{className:`col-span-1 text-foreground md:col-span-8 lg:col-span-9 flex flex-col min-h-0`,children:e.databaseName&&e.tableName?(0,H.jsx)(ew,{instanceDatabaseMap:t,databaseName:e.databaseName,tableName:e.tableName}):e.databaseName?(0,H.jsx)(xb,{instanceDatabaseMap:t,databaseName:e.databaseName}):null})]}),t&&(0,H.jsx)(Hy,{instanceDatabaseMap:t})]})}function rw(e){return P({getParentRoute:()=>e,path:`/databases/{-$databaseName}/{-$tableName}`,head:()=>({meta:[{title:`Databases — Harper Fabric`}]}),component:nw})}var iw={className:`text-primary font-semibold bg-primary/10 rounded-md dark:text-white dark:bg-white/10`};function aw(){let e=Cs(),t=M({strict:!1}),{version:n}=je({strict:!1}),r=oc(`4.6.0`,n)&&e,i=oc(`4.7.0-beta.7`,n),{data:a}=N(am(W(),r)),o=a?.restartRequired??!1,s=(0,U.useMemo)(()=>[e&&{to:t.clusterId&&!t.instanceId?Dh(t,`apps`):Dh(t),activeOptions:{exact:!0},name:`Applications`,shortName:`Apps`,icon:(0,H.jsx)(Ir,{className:`inline-block`})},{to:Dh(t,`databases`),icon:(0,H.jsx)(rr,{className:`inline-block`}),name:`Databases`},e&&i&&{to:Dh(t,`apis`),name:`APIs`,icon:(0,H.jsx)(Wr,{className:`inline-block`})},e&&r&&{to:Dh(t,`status`),icon:(0,H.jsx)(fr,{className:`inline-block`}),name:`Status`},e&&{to:Dh(t,`logs`),icon:(0,H.jsx)(Fr,{className:`inline-block`}),name:`Logs`},e&&{to:Dh(t,`config`),icon:(0,H.jsx)(Gr,{className:`inline-block`}),name:`Config`}].filter(di),[e,t,i,r]);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ow,{links:s,restartRequired:o}),(0,H.jsx)(sw,{links:s,restartRequired:o})]})}function ow({links:e,restartRequired:t}){return(0,H.jsxs)(`div`,{className:`hidden md:[@media(hover:hover)]:flex xl:flex items-center justify-between h-full text-sm text-foreground`,children:[(0,H.jsx)(ua,{restartRequired:t}),(0,H.jsx)(`div`,{className:`flex space-x-2`,children:e.map(({shortName:e,...t})=>{let n=(0,H.jsxs)(I,{"aria-label":t.name,className:`p-2 text-center text-muted-foreground hover:text-foreground`,activeProps:iw,...t,children:[t.icon,(0,H.jsx)(`span`,{className:`hidden xl:inline-block ml-1`,children:t.name}),e&&(0,H.jsx)(`span`,{className:`visible xl:hidden ml-1`,children:e})]},t.to);return e?n:(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:n}),(0,H.jsx)(Mi,{side:`bottom`,className:`xl:hidden`,children:t.name})]},t.to)})})]})}function sw({links:e,restartRequired:t}){return(0,H.jsx)(H.Fragment,{children:(0,H.jsxs)(`div`,{className:`flex md:[@media(hover:hover)]:hidden xl:hidden items-center justify-between h-full px-2 text-foreground`,children:[(0,H.jsx)(ua,{restartRequired:t}),(0,H.jsxs)(Yo,{children:[(0,H.jsx)(Xo,{asChild:!0,children:(0,H.jsx)(_,{variant:`ghost`,className:`p-0`,children:(0,H.jsx)(jr,{className:`h-8 w-8`})})}),(0,H.jsxs)(Zo,{children:[(0,H.jsx)(es,{children:`Instance Menu`}),(0,H.jsx)(ts,{}),e.map(e=>(0,H.jsx)(Qo,{asChild:!0,children:(0,H.jsxs)(I,{to:e.to,activeProps:iw,className:`flex items-center gap-2`,children:[e.icon,e.name]})},e.to))]})]})]})})}(0,U.lazy)(()=>Pe(()=>import(`./FloatingChat-CPyPIcVR.js`).then(e=>({default:e.FloatingChat})),__vite__mapDeps([30,2,1,11,31,18,24])));function cw(){return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`nav`,{className:`fixed top-20 w-full z-39 h-12 md:px-12 bg-violet-50 border-b border-violet-100 dark:bg-grey-700 dark:border-none`,children:(0,H.jsx)(aw,{})}),(0,H.jsx)(`div`,{className:`mt-32 min-h-[calc(100vh-(--spacing(32)))]`,children:(0,H.jsx)(Ee,{})}),!1]})}function lw(e){switch(e){case`local`:return P({getParentRoute:()=>sp,id:`_instanceLayout`,component:cw,loader:Pv});case`cluster`:return P({getParentRoute:()=>fp,id:`_instanceLayout`,component:cw,beforeLoad:uw,loader:Pv});case`instance`:return P({getParentRoute:()=>fp,path:`instance/$instanceId`,component:cw,beforeLoad:uw,loader:Pv})}}async function uw({context:e,params:t}){let n=t.instanceId||t.clusterId,r=!1;if(i.checkForFabricConnect(n)&&!i.hasResolvedFabricConnect(n)&&(r=!0,await dw(n,e.cluster,t.instanceId)))return;let a=i.getConnectionById(n);if(a.isLoading||a.user)return;let o=e.authentication[u];if(o?.isLoading)return;let{update:s}=t.instanceId?Ss(o.user,t.organizationId,t.clusterId):bs(o.user,t.organizationId,t.clusterId);if(!(!r&&s&&await dw(n,e.cluster,t.instanceId)))throw xe({to:`/${t.organizationId}/${t.clusterId}/`+(t.instanceId?`instance/${t.instanceId}`:``)+`/sign-in`,search:op()})}async function dw(e,t,n){try{return await i.establishFabricConnectAuth({id:e,operationsUrl:fw(t,n)}),!0}catch(e){return console.debug(`Fabric Connect not established`,e),!1}}function fw(e,t){if(t){let n=e?.instances?.find(e=>e.id===t);return n?m(n):void 0}return g(e)??void 0}function pw(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 mw=[`secondary`,`default`,`warning`,`outline`,`success`,`destructive`],hw=0,gw=new Map,_w=e=>{if(gw.has(e))return gw.get(e);hw++;let t=mw[hw%mw.length];return gw.set(e,t),t};function vw(e){switch(e){case`error`:case`stderr`:return`border-l-destructive`;case`warn`:return`border-l-yellow-500`;case`notify`:return`border-l-green-500`;default:return`border-l-transparent`}}function yw({columns:e,data:t,onRowClick:n,containerRef:r}){let i=be({data:t,columns:e,getCoreRowModel:Te()});return(0,H.jsxs)(fd,{className:`text-xs`,containerRef:r,containerClassName:`rounded-md bg-card dark:bg-black-dark logsTable max-h-[calc(100vh-(--spacing(48)))] overflow-y-auto md:max-h-[calc(100vh-(--spacing(40)))]`,children:[(0,H.jsx)(pd,{children:i.getHeaderGroups().map(e=>(0,H.jsx)(hd,{className:`border-b border-border`,children:e.headers.map(e=>(0,H.jsx)(gd,{className:`p-4 max-w-96 sticky top-0 z-10 border-b border-border bg-card dark:bg-black-dark`,children:e.isPlaceholder?null:De(e.column.columnDef.header,e.getContext())},e.id))},e.id))}),(0,H.jsx)(md,{className:`bg-background dark:bg-black`,children:i.getRowModel().rows?.length?i.getRowModel().rows.map(e=>(0,H.jsx)(hd,{"data-state":e.getIsSelected()&&`selected`,className:p(`hover:bg-muted/20 data-[state=selected]:bg-muted max-w-full border-l-2`,vw(e.original.level),n&&`cursor-pointer`),onClick:()=>n?.(e),children:e.getVisibleCells().map(e=>(0,H.jsx)(vd,{className:`p-2`,children:De(e.column.columnDef.cell,e.getContext())},e.id))},e.id)):(0,H.jsx)(hd,{children:(0,H.jsx)(vd,{colSpan:e.length,className:`h-24 text-center`,children:`No results.`})})})]})}var bw=512*1024;function xw(e){try{JSON.parse(e)}catch{return!1}return!0}function Sw(e){return!e||e.length>524288?`plaintext`:xw(e)?`json`:`plaintext`}function Cw({label:e,children:t}){return(0,H.jsxs)(`div`,{className:`flex items-start gap-3 py-1.5 border-b border-border/50 last:border-0`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground w-20 shrink-0 pt-0.5`,children:e}),(0,H.jsx)(`span`,{className:`text-xs`,children:t})]})}function ww({setIsModalOpen:e,isModalOpen:t,data:n}){let r=n?_w(n.node):`default`,i=Id();return(0,H.jsx)(Io,{onOpenChange:e,open:t,children:(0,H.jsxs)(Uo,{"aria-describedby":void 0,resizable:!0,children:[(0,H.jsx)(Wo,{children:(0,H.jsx)(Ko,{children:`Log Entry`})}),n?(0,H.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col gap-2 text-popover-foreground`,children:[(0,H.jsxs)(`div`,{className:`rounded-md border border-border/50 bg-muted/20 px-3 py-1`,children:[(0,H.jsx)(Cw,{label:`Level`,children:(0,H.jsx)(Va,{variant:pw(n.level),children:ca(n.level)})}),(0,H.jsx)(Cw,{label:`Timestamp`,children:(0,H.jsx)(`span`,{className:`tabular-nums`,children:new Date(n.timestamp).toLocaleString()})}),(0,H.jsx)(Cw,{label:`Thread`,children:(0,H.jsx)(`span`,{className:`tabular-nums font-mono`,children:n.thread})}),n.node&&(0,H.jsx)(Cw,{label:`Node`,children:(0,H.jsx)(Va,{variant:r,children:n.node})}),n.tags&&n.tags.length>0&&(0,H.jsx)(Cw,{label:`Tags`,children:(0,H.jsx)(`span`,{className:`font-mono`,children:n.tags})})]}),(0,H.jsxs)(`div`,{className:`flex flex-1 min-h-0 flex-col`,children:[(0,H.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground mb-1.5`,children:`Message`}),(0,H.jsx)(`div`,{className:`rounded-md overflow-hidden border border-border/50 flex-1 min-h-0`,children:(0,H.jsx)(Rd,{className:`w-full h-full`,language:Sw(n.message),theme:i,value:n.message,options:{readOnly:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,fontSize:12,padding:{top:12,bottom:12},automaticLayout:!0}})})]})]}):(0,H.jsx)(zs,{})]})})}var Tw=S({limit:w().or(te()).or(C()).optional(),level:ne([`notify`,`error`,`warn`,`info`,`debug`,`trace`,`undefined`]).or(te()).or(C()).optional(),from:w().or(te()).or(C()).optional(),until:w().or(te()).or(C()).optional(),log_name:ne([`hdb.log`,`system.log`]).or(te()).or(C()).optional(),filter:w().or(te()).or(C()).optional()}),Ew=`dark:bg-grey-600 dark:border-grey-500`;function Dw({form:e,resetFilters:t,submitFilters:n,showLogName:r,showFilter:i,isOpen:a,onOpenChange:o}){return(0,H.jsxs)(fn,{className:p(a?`block`:`hidden`,`mt-3 md:mt-0 md:block`),children:[(0,H.jsx)(ln,{className:`hidden md:block`,children:(0,H.jsx)(`button`,{type:`button`,onClick:()=>o(!a),"aria-expanded":a,"aria-controls":`logs-filters-content`,className:`flex w-full items-center justify-between md:pointer-events-none`,children:(0,H.jsxs)(cn,{className:`flex items-center gap-2 text-base`,children:[(0,H.jsx)(Jr,{className:`size-4 text-muted-foreground`}),`Filters`]})})}),(0,H.jsx)(un,{id:`logs-filters-content`,children:(0,H.jsx)(G,{...e,children:(0,H.jsxs)(`form`,{id:`instance-edit-log-filters-form`,name:`instance-edit-log-filters-form`,onSubmit:e.handleSubmit(n),className:`flex-col space-y-4`,children:[i&&(0,H.jsx)(q,{control:e.control,name:`filter`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(K,{children:(0,H.jsxs)(`div`,{className:`relative`,children:[(0,H.jsx)(Ur,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground`}),(0,H.jsx)(Z,{type:`search`,placeholder:`Search logs…`,className:p(`pl-9`,Ew),value:e.value??``,onChange:e.onChange})]})}),(0,H.jsx)(X,{})]})}),r&&(0,H.jsx)(q,{control:e.control,name:`log_name`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Log file`}),(0,H.jsxs)(su,{onValueChange:e.onChange,value:e.value??void 0,children:[(0,H.jsx)(uu,{className:p(`w-full bg-white`,Ew),children:(0,H.jsx)(lu,{placeholder:`Select log file`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(Q,{value:`hdb.log`,children:`Application (hdb.log)`}),(0,H.jsx)(Q,{value:`system.log`,children:`System (system.log)`})]})})]}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,H.jsx)(q,{control:e.control,name:`limit`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Limit`}),(0,H.jsxs)(su,{onValueChange:e.onChange,value:e.value??void 0,children:[(0,H.jsx)(uu,{className:p(`w-full bg-white`,Ew),children:(0,H.jsx)(lu,{placeholder:`Limit`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(Q,{value:`1000`,children:`1000`}),(0,H.jsx)(Q,{value:`500`,children:`500`}),(0,H.jsx)(Q,{value:`250`,children:`250`}),(0,H.jsx)(Q,{value:`100`,children:`100`}),(0,H.jsx)(Q,{value:`10`,children:`10`})]})})]}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:e.control,name:`level`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Level`}),(0,H.jsxs)(su,{onValueChange:e.onChange,value:e.value??void 0,children:[(0,H.jsx)(uu,{className:p(`w-full bg-white`,Ew),children:(0,H.jsx)(lu,{placeholder:`Level`})}),(0,H.jsx)(du,{children:(0,H.jsxs)(cu,{children:[(0,H.jsx)(Q,{value:`undefined`,children:`All`}),(0,H.jsx)(Q,{value:`notify`,children:`Notify`}),(0,H.jsx)(Q,{value:`error`,children:`Error`}),(0,H.jsx)(Q,{value:`warn`,children:`Warn`}),(0,H.jsx)(Q,{value:`info`,children:`Info`}),(0,H.jsx)(Q,{value:`debug`,children:`Debug`}),(0,H.jsx)(Q,{value:`trace`,children:`Trace`})]})})]}),(0,H.jsx)(X,{})]})})]}),(0,H.jsx)(q,{control:e.control,name:`from`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`Start date`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`datetime-local`,className:Ew,value:e.value??void 0,onChange:e.onChange})}),(0,H.jsx)(X,{})]})}),(0,H.jsx)(q,{control:e.control,name:`until`,render:({field:e})=>(0,H.jsxs)(J,{children:[(0,H.jsx)(Y,{children:`End date`}),(0,H.jsx)(K,{children:(0,H.jsx)(Z,{type:`datetime-local`,className:Ew,value:e.value??void 0,onChange:e.onChange})}),(0,H.jsx)(X,{})]})}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsx)(_,{type:`submit`,variant:`positiveOutline`,className:`grow`,children:`Apply Filters`}),(0,H.jsx)(_,{type:`reset`,variant:`destructiveOutline`,onClick:t,children:`Clear`})]})]})})})]})}var Ow=1e4;function kw(e){if(!e)return;let t=parseInt(e,10);if(!(!Number.isFinite(t)||t<=0))return Math.min(t,Ow)}function Aw(e,t){return{operation:`read_log`,start:0,replicated:t,limit:kw(e.limit),level:e.level===`undefined`?void 0:e.level,from:e.from?new Date(e.from).toISOString():void 0,until:e.until?new Date(e.until).toISOString():void 0,log_name:e.log_name??void 0,filter:e.filter?e.filter:void 0,order:`desc`}}async function jw({instanceClient:e,logFilters:t,replicated:n}){let{data:r}=await e.post(`/`,Aw(t,n));return r}function Mw(e){let t=e.logFilters;return F({queryKey:[`read_log`,e.entityId,t.limit,t.level,t.from,t.until,t.log_name,t.filter,e.replicated],queryFn:()=>jw(e),retry:!1,refetchInterval:e.isAutoRefreshEnabled?5e3:!1})}async function Nw({connection:e,logFilters:t,replicated:n,signal:r,onEntry:i}){let{url:a,headers:o,credentials:s}=nh(e),c;try{c=await fetch(a,{method:`POST`,headers:o,credentials:s,body:JSON.stringify(Aw(t,n)),signal:r})}catch(e){throw r?.aborted?e:new $m(`Failed to open the read_log SSE stream.`,{cause:e})}let l=c.headers.get(`content-type`)??``;if(!c.ok||!l.includes(`text/event-stream`)||!c.body)throw await c.body?.cancel().catch(()=>{}),new $m(`read_log did not return an event stream (status ${c.status}, content-type "${l}").`);for await(let e of Xm(c.body,r)){if(e.event===`error`){let t=Qm(e);if(!t||typeof t!=`object`)throw new th(typeof t==`string`&&t?t:`The log stream failed.`);let n=t;throw new th(n.message??`The log stream failed.`,{code:n.code})}if(e.event===`done`||e.event===`end`)return;for(let t of Pw(Qm(e)))i(t)}}function Pw(e){return Array.isArray(e)?e.filter(Fw):Fw(e)?[e]:[]}function Fw(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.timestamp==`string`&&(typeof t.level==`string`||typeof t.message==`string`)}function Iw(e){return[e.timestamp,e.node??``,e.thread??``,e.level,e.message].join(`|`)}function Lw(e,t,n){let r=new Set,i=[];for(let n of[...t,...e]){let e=Iw(n);r.has(e)||(r.add(e),i.push(n))}return i.sort((e,t)=>e.timestamp<t.timestamp?1:e.timestamp>t.timestamp?-1:0),n>0&&i.length>n?i.slice(0,n):i}var Rw={entries:[],fellBack:!1};function zw(e,t){switch(t.kind){case`reset`:return Rw;case`retry`:return e.fellBack?{...e,fellBack:!1}:e;case`append`:{if(t.entries.length===0)return e;let n=e.entries.concat(t.entries);return n.length<=t.cap?{...e,entries:n}:(n.sort((e,t)=>e.timestamp<t.timestamp?1:e.timestamp>t.timestamp?-1:0),{...e,entries:n.slice(0,t.cap)})}case`fellBack`:return{...e,fellBack:!0}}}function Bw(){let e=W();return i.isDirectConnection(e.entityId)}var Vw=1e3,Hw=2e3,Uw=250;function Ww(e){return kw(e)??Vw}function Gw(e,t){return JSON.stringify([e.limit,e.level,e.from,e.until,e.log_name,e.filter,t])}function Kw({params:e,logFilters:t,replicated:n,live:r}){let i=Bw(),[a,o]=(0,U.useReducer)(zw,Rw),s=r&&i&&!a.fellBack,c=Gw(t,n),l=Ww(t.limit),u=Math.max(Hw,l),d=N(Mw({...e,logFilters:t,replicated:n,isAutoRefreshEnabled:r&&!s}));(0,U.useEffect)(()=>{o({kind:`reset`})},[e.entityId,c]),(0,U.useEffect)(()=>{r&&o({kind:`retry`})},[r]);let f=(0,U.useRef)({logFilters:t,replicated:n});f.current={logFilters:t,replicated:n},(0,U.useEffect)(()=>{if(!s)return;let t=new AbortController,n=[],r=()=>{if(n.length>0&&!t.signal.aborted){let e=n;n=[],o({kind:`append`,entries:e,cap:u})}},i=setInterval(r,Uw);return Nw({connection:{id:e.entityId},logFilters:f.current.logFilters,replicated:f.current.replicated,signal:t.signal,onEntry:e=>n.push(e)}).catch(()=>{}).finally(()=>{clearInterval(i),!t.signal.aborted&&(r(),o({kind:`fellBack`}))}),()=>{clearInterval(i),t.abort()}},[s,e.entityId,c]);let p=(0,U.useMemo)(()=>{let e=d.data??[];return a.entries.length===0?e:Lw(e,a.entries,l)},[d.data,a.entries,l]),m=s?`streaming`:r?`polling`:`idle`;return{logs:p,isLoading:d.isLoading,isFetching:d.isFetching,refetch:()=>d.refetch(),transport:m}}var qw={log_name:`hdb.log`,limit:`100`,level:`undefined`,from:``,until:``,filter:``},Jw={error:(0,H.jsx)(Wn,{className:`size-3`}),stderr:(0,H.jsx)(Wn,{className:`size-3`}),warn:(0,H.jsx)(ii,{className:`size-3`}),notify:(0,H.jsx)(In,{className:`size-3`}),info:(0,H.jsx)(yr,{className:`size-3`}),debug:(0,H.jsx)(zn,{className:`size-3`}),trace:(0,H.jsx)(On,{className:`size-3`}),stdout:(0,H.jsx)(ei,{className:`size-3`})},Yw=[{accessorKey:`level`,header:`Level`,cell:({row:e})=>{let{level:t}=e.original;return(0,H.jsxs)(Va,{variant:pw(t),children:[Jw[t],ca(t)]})}},{accessorKey:`timestamp`,header:`Timestamp`,cell:({row:e})=>{let{timestamp:t}=e.original,n=new Date(t);return(0,H.jsxs)(`span`,{className:`tabular-nums whitespace-nowrap text-muted-foreground`,children:[n.getFullYear()===new Date().getFullYear()?n.toLocaleDateString(void 0,{month:`numeric`,day:`2-digit`}):n.toLocaleDateString(),` `,n.toLocaleTimeString()]})}},{accessorKey:`message`,header:`Message`,cell:({row:e})=>{let{message:t}=e.original;return(0,H.jsx)(`span`,{className:`block max-w-xl truncate font-mono text-xs`,children:t})}},{accessorKey:`thread`,header:`Thread`,cell:({row:e})=>(0,H.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:e.original.thread})},{accessorKey:`node`,header:`Node`,cell:({row:e})=>{let{node:t}=e.original,n=_w(t);return(0,H.jsx)(H.Fragment,{children:t?(0,H.jsxs)(Ai,{children:[(0,H.jsx)(ji,{asChild:!0,children:(0,H.jsxs)(Va,{variant:n,children:[t.split(`.`)[0],`...`]})}),(0,H.jsx)(Mi,{className:`bg-popover text-popover-foreground border border-border`,arrowClassName:`bg-popover fill-popover`,children:t})]}):null})}},{accessorKey:`tags`,header:`Tags`,cell:({row:e})=>{let{tags:t}=e.original;return t&&t.length>0?(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null}}],Xw=(e,t)=>!e&&!t||!e||!t||new Date(e)<=new Date(t);function Zw(){return(0,H.jsxs)(`div`,{className:`rounded-md bg-card dark:bg-black-dark overflow-hidden`,children:[(0,H.jsx)(`div`,{className:`flex gap-4 p-4 border-b border-border`,children:[`w-14`,`w-32`,`w-14`,`w-24`,`w-16`,`flex-1`].map((e,t)=>(0,H.jsx)(xf,{className:`h-4 ${e}`},t))}),Array.from({length:12}).map((e,t)=>(0,H.jsxs)(`div`,{className:`flex gap-4 p-3 border-b border-border/40 border-l-2 border-l-transparent`,children:[(0,H.jsx)(xf,{className:`h-5 w-14`}),(0,H.jsx)(xf,{className:`h-5 w-32`}),(0,H.jsx)(xf,{className:`h-5 w-10`}),(0,H.jsx)(xf,{className:`h-5 w-20`}),(0,H.jsx)(xf,{className:`h-5 w-12`}),(0,H.jsx)(xf,{className:`h-5 flex-1 max-w-xs`})]},t))]})}function Qw(){let[e,t]=(0,U.useState)(qw),[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(),[o,s]=(0,U.useState)(!1),[c,l]=xn(Cn.LogsOrderReversed,!1),[u,d]=(0,U.useState)(!1),f=W(),{data:p}=N(mh(f)),m=p?.version,h=!!m&&oc(`4.7.16`,m),{logs:g,isLoading:v,isFetching:y,refetch:b,transport:x}=Kw({params:f,logFilters:e,replicated:f.entityType===`cluster`,live:o}),S=(0,U.useMemo)(()=>c?[...g??[]].reverse():g??[],[g,c]),C=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=C.current;v||!e||e.scrollTo({top:c?e.scrollHeight:0})},[c,v]),(0,U.useEffect)(()=>{let e=C.current;!o||v||!e||e.scrollTo({top:c?e.scrollHeight:0})},[S,o,c,v]);let w=R({resolver:z(Tw),defaultValues:qw,mode:`onChange`}),T=e=>{a(e.original),r(!0)},E=async e=>{if(!Xw(e.from,e.until)){w.setError(`from`,{type:`onChange`,message:`Start date must be before end date`}),w.setError(`until`,{type:`onChange`,message:`End date must be after start date`});return}t(e)},ee=async()=>{w.reset(),t(qw)},D=wd(b);return(0,H.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 pt-2 text-foreground md:grid-cols-12 md:gap-4`,children:[(0,H.jsxs)(`section`,{className:`col-span-1 md:col-span-4 lg:col-span-3 px-2 pb-0 md:self-start md:sticky md:top-34 md:max-h-[calc(100vh-(--spacing(34)))] md:overflow-y-auto md:pb-4`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 md:hidden`,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:()=>d(e=>!e),"aria-label":`Toggle filters`,"aria-expanded":u,className:`flex-1`,children:[(0,H.jsx)(Jr,{}),`Filters`]}),(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:D,disabled:y||v||o,"aria-label":`Refresh logs`,className:`flex-1`,children:[(0,H.jsx)(hn,{className:y?`animate-spin`:``}),`Refresh`]}),(0,H.jsxs)(_,{variant:c?`default`:`defaultOutline`,onClick:()=>l(e=>!e),"aria-label":`Reverse log order`,"aria-pressed":c,className:`flex-1`,children:[(0,H.jsx)(Nn,{}),`Reverse`]})]}),(0,H.jsx)(Dw,{form:w,resetFilters:ee,submitFilters:E,showLogName:!1,showFilter:h,isOpen:u,onOpenChange:d}),(0,H.jsxs)(`div`,{className:`mt-3 space-y-3 hidden md:block`,children:[(0,H.jsxs)(_,{variant:`defaultOutline`,onClick:D,disabled:y||v||o,className:`w-full`,children:[(0,H.jsx)(hn,{}),`Refresh`]}),(0,H.jsxs)(`div`,{className:`flex flex-col gap-2.5`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,H.jsx)(Qd,{id:`logs-live-switch`,"aria-label":`Toggle live logs`,checked:o,onCheckedChange:s}),(0,H.jsxs)(`label`,{htmlFor:`logs-live-switch`,className:`flex items-center gap-2 cursor-pointer`,children:[(0,H.jsx)(hn,{className:`size-4 ${o?`animate-spin [animation-duration:3s]`:``}`}),o?x===`streaming`?`Live (streaming)`:`Live (polling every 5s)`:`Live`]})]}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,H.jsx)(Qd,{id:`logs-reverse-order-switch`,"aria-label":`Reverse log order`,checked:c,onCheckedChange:l}),(0,H.jsxs)(`label`,{htmlFor:`logs-reverse-order-switch`,className:`flex items-center gap-2 cursor-pointer`,children:[(0,H.jsx)(Nn,{className:`size-4`}),c?`Oldest first`:`Newest first`]})]})]})]})]}),(0,H.jsx)(`section`,{className:`col-span-1 md:col-span-8 lg:col-span-9`,children:v?(0,H.jsx)(Zw,{}):(0,H.jsx)(yw,{columns:Yw,data:S,onRowClick:T,containerRef:C})}),(0,H.jsx)(ww,{isModalOpen:n,setIsModalOpen:r,data:i})]})}function $w(e){return P({getParentRoute:()=>e,path:`logs`,head:()=>({meta:[{title:`Logs — Harper Fabric`}]}),component:Qw})}var eT=6e4,tT=60*eT,nT=24*tT,rT=[{id:`1h`,label:`Last 1 hour`,durationMs:tT,bucketMs:1*eT},{id:`6h`,label:`Last 6 hours`,durationMs:6*tT,bucketMs:1*eT},{id:`24h`,label:`Last 24 hours`,durationMs:nT,bucketMs:5*eT},{id:`7d`,label:`Last 7 days`,durationMs:7*nT,bucketMs:15*eT},{id:`30d`,label:`Last 30 days`,durationMs:30*nT,bucketMs:tT}];function iT(e){let t=rT.find(t=>t.id===e);if(!t)throw Error(`Unknown preset: ${e}`);return t}var aT=[{label:`Off`,value:0},{label:`30s`,value:3e4},{label:`60s`,value:6e4},{label:`5m`,value:3e5}],oT=6e4,sT=[`health`,`traffic`,`requests`,`database`,`replication`,`storage`,`overview`],cT={tab:`health`,range:`1h`,refresh:oT};function lT(e){let t=e.refresh===``?NaN:Number(e.refresh);return{tab:sT.find(t=>t===e.tab)??cT.tab,range:rT.find(t=>t.id===e.range)?.id??cT.range,refresh:aT.find(e=>e.value===t)?.value??cT.refresh}}function uT(e){return P({getParentRoute:()=>e,path:`status`,validateSearch:lT,search:{middlewares:[oe(cT)]},head:()=>({meta:[{title:`Status — Harper Fabric`}]}),component:Ce(async()=>Pe(()=>import(`./status-DG0Maoao.js`),__vite__mapDeps([32,2,8,9,10,1,11,12,17,18,19,20,23,33,34,35,36,37,38,39,40,41,42,43,44,45,46])),`StatusIndex`)})}function dT(e){let t=lw(e),n=[$w(t),...Sm(t,e),xm(t),uT(t),Fv(t),rw(t)];return t.addChildren(n)}P({getParentRoute:()=>sp,path:`profile`,head:()=>({meta:[{title:`Profile — Harper Fabric`}]}),component:Ce(async()=>Pe(()=>import(`./profile-CaF-4aZe.js`),__vite__mapDeps([47,2,8,9,10,1,11,12,16])),`ProfileIndex`)});var fT=hi.addChildren([...bo,sp.addChildren([dT(`local`)])]);function pT({routeTree:e=fT,authentication:t}){let[n]=(0,U.useState)(()=>ve({routeTree:e,history:de(),defaultNotFoundComponent:li,defaultErrorComponent:ci,defaultPreload:!ui()&&`intent`,trailingSlash:`never`,defaultPreloadStaleTime:0,scrollRestoration:!0,context:{queryClient:yn,authentication:t||{}}}));return n}function mT(){let e=Ve(),t=pT({authentication:e}),n=(0,U.useRef)(e);return(0,U.useEffect)(()=>{n.current!==e&&(n.current=e,t.invalidate())},[t,e]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(_e,{router:t,context:{authentication:e}}),(0,H.jsx)(we,{router:t,position:`bottom-right`})]})}var hT=({...e})=>(0,H.jsx)(xt,{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}),gT=!1;function _T(){(0,U.useEffect)(()=>{gT||=!0},[])}function vT(){return $i(),pi(),_T(),(0,H.jsxs)(bi,{children:[(0,H.jsxs)(ce,{client:yn,children:[(0,H.jsx)(mT,{}),(0,H.jsx)(ke,{buttonPosition:`bottom-right`})]}),(0,H.jsx)(hT,{richColors:!0})]})}function yT(){if(typeof Node!=`function`||!Node.prototype)return;let e=`__harperTranslationGuarded__`,t=Node.prototype;if(t[e])return;Object.defineProperty(t,e,{value:!0,configurable:!0,writable:!0,enumerable:!1});let n=Node.prototype.removeChild;Node.prototype.removeChild=function(e){return e instanceof Node&&e.parentNode!==this?e:n.call(this,e)};let r=Node.prototype.insertBefore;Node.prototype.insertBefore=function(e,t){return t instanceof Node&&t.parentNode!==this?r.call(this,e,null):r.call(this,e,t)}}var bT=`Studio:StaleDeployReloadedAt`,xT=6e4,ST=`__harperStaleDeployReloadState__`;function CT(){if(!(typeof window>`u`))return window[ST]}function wT(){let e=CT();if(e){try{let e=Number(sessionStorage.getItem(bT)??0);if(Date.now()-e<xT)return;sessionStorage.setItem(bT,String(Date.now()))}catch{return}e.reload()}}function TT(e=()=>window.location.reload()){if(typeof window>`u`)return;let t=window,n=t[ST];if(n){n.reload=e;return}t[ST]={reload:e},window.addEventListener(`vite:preloadError`,()=>wT())}var ET=Le();yT(),TT(),(0,ET.createRoot)(document.getElementById(`root`),{onUncaughtError:(e,t)=>{Fe(e,t),console.error(`Uncaught error:`,e,t)},onCaughtError:(e,t)=>{Fe(e,t),console.error(`Caught error:`,e,t)},onRecoverableError:(e,t)=>{Fe(e,t),console.warn(`Recoverable error:`,e,t)}}).render((0,H.jsx)(U.StrictMode,{children:(0,H.jsx)(vT,{})}));export{k_ as $,Rr as $n,ws as $t,TS as A,K as An,Zf as At,Uy as B,ci as Bn,su as Bt,BS as C,Sa as Cn,qm as Ct,US as D,ma as Dn,np as Dt,zS as E,Y as En,Ep as Et,Cb as F,Ii as Fn,Id as Ft,Jv as G,ei as Gn,Pc as Gt,cy as H,ii as Hn,Q as Ht,Sb as I,Ai as In,Sd as It,Y_ as J,Kr as Jn,fc as Jt,_v as K,Qr as Kn,Ec as Kt,_b as L,Mi as Ln,cd as Lt,OS as M,Bi as Mn,Xf as Mt,nS as N,Fi as Nn,Qd as Nt,HS as O,J as On,ep as Ot,yx as P,W as Pn,Rd as Pt,O_ as Q,zr as Qn,Fs as Qt,hb as R,ji as Rn,sd as Rt,JS as S,Va as Sn,$m as St,WS as T,X as Tn,Pp as Tt,uy as U,ri as Un,uu as Ut,ly as V,ai as Vn,du as Vt,sy as W,ni as Wn,lu as Wt,z_ as X,Vr as Xn,zs as Xt,R_ as Y,Ur as Yn,oc as Yt,T_ as Z,Br as Zn,Is as Zt,GS as _,Uo as _n,mh as _t,iT as a,fs as an,rr as ar,yg as at,KS as b,Wo as bn,oh as bt,PC as c,Zo as cn,Wn as cr,Zh as ct,_C as d,ns as dn,jn as dr,Uh as dt,Cs as en,Lr as er,I_ as et,yC as f,rs as fn,Hh as ft,fC as g,Io as gn,gh as gt,pC as h,Xo as hn,Dh as ht,rT as i,ds as in,yr as ir,wg as it,kS as j,G as jn,$f as jt,AS as k,q as kn,Qf as kt,kC as l,Qo as ln,Un as lr,Yh as lt,hC as m,is as mn,Fh as mt,lT as n,cs as nn,Tr as nr,F_ as nt,jw as o,ss as on,tr as or,Qh as ot,vC as p,as as pn,Rh as pt,ev as q,Zr as qn,wc as qt,aT as r,ls as rn,wr as rr,qg as rt,bw as s,Yo as sn,Kn as sr,Xh as st,wT as t,os as tn,Ir as tr,A_ as tt,EC as u,ts as un,Mn as ur,Vh as ut,IS as v,qo as vn,ph as vt,RS as w,Z as wn,am as wt,qS as x,Ko as xn,eh as xt,LS as y,Go as yn,lh as yt,ab as z,di as zn,Au as zt};
|
|
817
|
+
//# sourceMappingURL=index-D_GKOkhn.js.map
|