omnigateway 0.7.0 → 0.7.2

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.
Files changed (48) hide show
  1. package/README.md +21 -6
  2. package/bin/omni.js +6035 -5841
  3. package/gateway.js +6326 -5555
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-BWxO0uV7.js → Chip-BOyBT5TP.js} +1 -1
  6. package/public/assets/{CopyValue-DIR5A6PG.js → CopyValue-DRHHQlN_.js} +3 -3
  7. package/public/assets/{Field-DI5YTYOX.js → Field-DK5zaBVA.js} +1 -1
  8. package/public/assets/Lamp-ZlMzNs5N.js +25 -0
  9. package/public/assets/{Panel-BCpZVY4U.js → Panel-CYQvfI3L.js} +19 -19
  10. package/public/assets/Rack-D798XvPQ.js +466 -0
  11. package/public/assets/{Readout-B0TZE8aA.js → Readout-D6-aurU8.js} +1 -1
  12. package/public/assets/{RequestTable-D4z82uxG.js → RequestTable-CEBhwDs7.js} +2 -2
  13. package/public/assets/{SummaryDeck-CzozuXOu.js → SummaryDeck-DBCSHihY.js} +2 -2
  14. package/public/assets/{Toggle-ByxBCMfb.js → Toggle-CdCCoDEo.js} +1 -1
  15. package/public/assets/{TokenBreakdown-BMEiZhRX.js → TokenBreakdown-DDI9uTPW.js} +1 -1
  16. package/public/assets/{WindowChart-nxC4SCRC.js → WindowChart-C-Y6U3WF.js} +2 -2
  17. package/public/assets/_app-BWNEo1e-.js +1 -0
  18. package/public/assets/_app.accounts-CLLLwN77.js +59 -0
  19. package/public/assets/{_app.console-D6lrTxJt.js → _app.console-Dr9qxU7J.js} +3 -3
  20. package/public/assets/{_app.database-Y3lFDxoP.js → _app.database-D0W0pcxC.js} +4 -4
  21. package/public/assets/{_app.index-DUFa7RRT.js → _app.index-CyxnfhVX.js} +8 -8
  22. package/public/assets/{_app.keys-DRfXCzMJ.js → _app.keys-D9qmw9Tj.js} +11 -11
  23. package/public/assets/{_app.logs-BQT3kFZr.js → _app.logs-DtXUZETW.js} +4 -4
  24. package/public/assets/{_app.models-CDpbIYHW.js → _app.models-CNxwXyFl.js} +11 -11
  25. package/public/assets/{_app.plugins._pluginId-jaswB8Z5.js → _app.plugins._pluginId-87Ox_hkW.js} +1 -1
  26. package/public/assets/_app.plugins._pluginId-CZWipH1n.js +2 -0
  27. package/public/assets/_app.settings-DjiMSl1Y.js +88 -0
  28. package/public/assets/{_app.usage-BaT54Vee.js → _app.usage-CZz9raYR.js} +6 -6
  29. package/public/assets/{chevron-right-0adI8395.js → chevron-right-CPoaXYHw.js} +1 -1
  30. package/public/assets/client-CZnyYbay.js +39 -0
  31. package/public/assets/{index-BRrBGt1i.js → index-DNSPtYpM.js} +3 -3
  32. package/public/assets/{login-BSWCo_Fz.js → login-BtlMmyKj.js} +3 -3
  33. package/public/assets/login-dV42ZQIA.js +2 -0
  34. package/public/assets/plus-_zo43Lvf.js +1 -0
  35. package/public/assets/{preload-helper-CD37DT-E.js → preload-helper-4wSmu2-E.js} +1 -1
  36. package/public/assets/{shared-dShKzjig.js → shared-OJcoRCqT.js} +1 -1
  37. package/public/assets/{stream-BD4FhzLn.js → stream-CEb81tzM.js} +1 -1
  38. package/public/assets/{trash-2-DrDlpCqO.js → trash-2-BjpqTubo.js} +1 -1
  39. package/public/index.html +8 -8
  40. package/public/assets/Lamp-DN2EKL4m.js +0 -25
  41. package/public/assets/Rack-B03tpeW-.js +0 -466
  42. package/public/assets/_app-D9B6OIjd.js +0 -1
  43. package/public/assets/_app.accounts-BiRGhH3s.js +0 -59
  44. package/public/assets/_app.plugins._pluginId-CtEAGvad.js +0 -2
  45. package/public/assets/_app.settings-CG63splg.js +0 -58
  46. package/public/assets/client-_6YMm6vh.js +0 -39
  47. package/public/assets/login-C7v-Fr28.js +0 -2
  48. package/public/assets/plus-B_f8M9yB.js +0 -1
@@ -1,466 +0,0 @@
1
- import{Et as e,I as t,Lt as n,N as r,P as i,St as a,Ut as o,Wt as s,_t as c,bt as l,i as u,t as d,x as f,yt as p}from"./Lamp-DN2EKL4m.js";import{D as m,E as h,S as g,T as _,_ as v,g as y,o as b,w as x,x as S,y as C}from"./Panel-BCpZVY4U.js";import*as w from"react";import{createContext as T,createElement as E,forwardRef as ee,use as te,useCallback as ne,useContext as re,useEffect as ie,useId as ae,useMemo as oe,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";import*as se from"react-dom";import j,{ThemeProvider as ce,createGlobalStyle as le,css as ue}from"styled-components";import{LiveProvider as de,useLive as fe}from"@omnigateway/dashboard-sdk";var pe=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),me=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),he=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),ge=e=>{let t=he(e);return t.charAt(0).toUpperCase()+t.slice(1)},_e={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ve=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},ye=T({}),be=()=>re(ye),xe=ee(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=be()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return E(`svg`,{ref:c,..._e,width:t??l??_e.width,height:t??l??_e.height,stroke:e??f,strokeWidth:m,className:pe(`lucide`,p,i),...!a&&!ve(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>E(e,t)),...Array.isArray(a)?a:[a]])}),M=(e,t)=>{let n=ee(({className:n,...r},i)=>E(xe,{ref:i,iconNode:t,className:pe(`lucide-${me(ge(e))}`,`lucide-${e}`,n),...r}));return n.displayName=ge(e),n},Se=M(`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`}]]),Ce=M(`blocks`,[[`path`,{d:`M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2`,key:`1ah6g2`}],[`rect`,{x:`14`,y:`2`,width:`8`,height:`8`,rx:`1`,key:`88lufb`}]]),we=M(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),Te=M(`cable`,[[`path`,{d:`M17 19a1 1 0 0 1-1-1v-2a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2a1 1 0 0 1-1 1z`,key:`trhst0`}],[`path`,{d:`M17 21v-2`,key:`ds4u3f`}],[`path`,{d:`M19 14V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V10`,key:`1mo9zo`}],[`path`,{d:`M21 21v-2`,key:`eo0ou`}],[`path`,{d:`M3 5V3`,key:`1k5hjh`}],[`path`,{d:`M4 10a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2z`,key:`1dd30t`}],[`path`,{d:`M7 5V3`,key:`1t1388`}]]),Ee=M(`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`}]]),De=M(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Oe=M(`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`}]]),ke=M(`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`}]]),Ae=M(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),je=M(`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`}]]),Me=M(`power`,[[`path`,{d:`M12 2v10`,key:`mnfbl`}],[`path`,{d:`M18.4 6.6a9 9 0 1 1-12.77.04`,key:`obofu9`}]]),Ne=M(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),Pe=M(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Fe=M(`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`}]]),Ie=M(`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`}]]),Le=M(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),Re=M(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function ze(e,t){return e.flatMap(({id:e,colour:n})=>{let r=n?.[t];return typeof r==`string`?[`--p-${e}: ${r};`]:[]}).join(`
2
- `)}var Be=le`
3
- :root {
4
- ${({$providers:e})=>ze(e,`light`)}
5
- }
6
-
7
- .dark {
8
- ${({$providers:e})=>ze(e,`dark`)}
9
- }
10
- `,Ve=le`
11
- :root {
12
- color-scheme: light;
13
-
14
- --rack: oklch(0.962 0.004 258);
15
- --panel: oklch(1 0 0);
16
- --panel-sunk: oklch(0.972 0.004 258);
17
- --panel-raised: oklch(0.988 0.003 258);
18
- --rule: oklch(0.9 0.006 258);
19
- --rule-strong: oklch(0.82 0.008 258);
20
-
21
- --ink: oklch(0.22 0.017 258);
22
- --ink-dim: oklch(0.45 0.015 258);
23
- --ink-faint: oklch(0.62 0.012 258);
24
-
25
- --accent: oklch(0.52 0.17 262);
26
- --accent-ink: oklch(0.99 0 0);
27
- --accent-wash: oklch(0.52 0.17 262 / 0.11);
28
-
29
- --ok: oklch(0.52 0.13 162);
30
- --warn: oklch(0.58 0.13 72);
31
- --down: oklch(0.53 0.2 27);
32
- --ok-wash: oklch(0.52 0.13 162 / 0.12);
33
- --warn-wash: oklch(0.58 0.13 72 / 0.14);
34
- --down-wash: oklch(0.53 0.2 27 / 0.11);
35
-
36
- --grid-line: oklch(0.22 0.017 258 / 0.055);
37
- --shadow: 0 1px 2px oklch(0.22 0.017 258 / 0.06);
38
- }
39
-
40
- .dark {
41
- color-scheme: dark;
42
-
43
- --rack: oklch(0.163 0.013 258);
44
- --panel: oklch(0.204 0.013 258);
45
- --panel-sunk: oklch(0.183 0.013 258);
46
- --panel-raised: oklch(0.246 0.013 258);
47
- --rule: oklch(0.3 0.012 258);
48
- --rule-strong: oklch(0.4 0.014 258);
49
-
50
- --ink: oklch(0.94 0.006 250);
51
- --ink-dim: oklch(0.72 0.011 253);
52
- --ink-faint: oklch(0.55 0.012 255);
53
-
54
- --accent: oklch(0.74 0.13 262);
55
- --accent-ink: oklch(0.17 0.02 262);
56
- --accent-wash: oklch(0.74 0.13 262 / 0.18);
57
-
58
- --ok: oklch(0.75 0.14 162);
59
- --warn: oklch(0.82 0.14 80);
60
- --down: oklch(0.68 0.19 25);
61
- --ok-wash: oklch(0.75 0.14 162 / 0.16);
62
- --warn-wash: oklch(0.82 0.14 80 / 0.16);
63
- --down-wash: oklch(0.68 0.19 25 / 0.16);
64
-
65
- --grid-line: oklch(0.94 0.006 250 / 0.045);
66
- --shadow: 0 1px 2px oklch(0 0 0 / 0.3);
67
- }
68
-
69
- *,
70
- *::before,
71
- *::after {
72
- box-sizing: border-box;
73
- }
74
-
75
- html,
76
- body,
77
- #root {
78
- height: 100%;
79
- }
80
-
81
- html {
82
- background: ${({theme:e})=>e.color.rack};
83
- }
84
-
85
- body {
86
- margin: 0;
87
- background: ${({theme:e})=>e.color.rack};
88
- color: ${({theme:e})=>e.color.ink};
89
- font-family: ${({theme:e})=>e.font.sans};
90
- font-size: 14px;
91
- line-height: 1.45;
92
- -webkit-font-smoothing: antialiased;
93
- }
94
-
95
- h1, h2, h3, h4, p, figure, dl, dd {
96
- margin: 0;
97
- }
98
-
99
- ul, ol {
100
- margin: 0;
101
- padding: 0;
102
- list-style: none;
103
- }
104
-
105
- button, input, select, textarea {
106
- font: inherit;
107
- color: inherit;
108
- }
109
-
110
- a {
111
- color: inherit;
112
- text-decoration: none;
113
- }
114
-
115
- :focus-visible {
116
- outline: 2px solid ${({theme:e})=>e.color.accent};
117
- outline-offset: 1px;
118
- border-radius: 2px;
119
- }
120
-
121
- ::selection {
122
- background: ${({theme:e})=>e.color.accentWash};
123
- }
124
-
125
- ::-webkit-scrollbar {
126
- width: 10px;
127
- height: 10px;
128
- }
129
-
130
- ::-webkit-scrollbar-track {
131
- background: transparent;
132
- }
133
-
134
- ::-webkit-scrollbar-thumb {
135
- background: ${({theme:e})=>e.color.ruleStrong};
136
- border: 3px solid transparent;
137
- background-clip: padding-box;
138
- border-radius: 6px;
139
- }
140
-
141
- @media (prefers-reduced-motion: reduce) {
142
- *,
143
- *::before,
144
- *::after {
145
- animation-duration: 0.01ms !important;
146
- animation-iteration-count: 1 !important;
147
- transition-duration: 0.01ms !important;
148
- scroll-behavior: auto !important;
149
- }
150
- }
151
- `,He={color:{rack:`var(--rack)`,panel:`var(--panel)`,panelSunk:`var(--panel-sunk)`,panelRaised:`var(--panel-raised)`,rule:`var(--rule)`,ruleStrong:`var(--rule-strong)`,ink:`var(--ink)`,inkDim:`var(--ink-dim)`,inkFaint:`var(--ink-faint)`,accent:`var(--accent)`,accentInk:`var(--accent-ink)`,accentWash:`var(--accent-wash)`,ok:`var(--ok)`,warn:`var(--warn)`,down:`var(--down)`,okWash:`var(--ok-wash)`,warnWash:`var(--warn-wash)`,downWash:`var(--down-wash)`,shadow:`var(--shadow)`},font:{sans:`"Archivo Variable", ui-sans-serif, system-ui, sans-serif`,mono:`"Spline Sans Mono Variable", ui-monospace, "SF Mono", Menlo, monospace`},radius:{panel:`4px`,control:`3px`,chip:`2px`},space:e=>`${e*4}px`,z:{rail:20,chassis:30,overlay:40,dialog:50,toast:60}},Ue=/^[a-z][a-z0-9-]{0,31}$/;function We(e){return Ue.test(e)?`var(--p-${e}, var(--ink-faint))`:`var(--ink-faint)`}var Ge=`omni-theme`;function Ke(e){return e===`light`||e===`dark`||e===`system`}function qe(){try{let e=localStorage.getItem(Ge);return Ke(e)?e:`system`}catch{return`system`}}function Je(){return typeof matchMedia==`function`&&matchMedia(`(prefers-color-scheme: dark)`).matches}function Ye(e){return e===`system`?Je()?`dark`:`light`:e}function Xe(e){let t=document.documentElement;t.classList.toggle(`dark`,e===`dark`),t.dataset.theme=e}var Ze=T(null);function Qe(){let e=te(Ze);if(e===null)throw Error(`useTheme must be used inside <ThemeProvider>`);return e}function $e({children:e}){let[t,n]=D(qe),[r,i]=D(()=>Ye(qe())),a=ne(e=>{n(e);try{localStorage.setItem(Ge,e)}catch{}},[]);return ie(()=>{let e=Ye(t);i(e),Xe(e)},[t]),ie(()=>{if(t!==`system`||typeof matchMedia!=`function`)return;let e=matchMedia(`(prefers-color-scheme: dark)`),n=()=>{let e=Je()?`dark`:`light`;i(e),Xe(e)};return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[t]),k(Ze,{value:{mode:t,resolved:r,setMode:a},children:A(ce,{theme:He,children:[k(Ve,{}),e]})})}var et=j.svg`
152
- display: block;
153
- width: 100%;
154
- height: 100%;
155
- overflow: visible;
156
- `;function tt(e,t,n,r){if(e.length===0)return``;let i=e.length===1?0:t/(e.length-1);return e.map((e,t)=>{let a=t*i,o=n-(r===0?0:e/r*n);return`${t===0?`M`:`L`}${a.toFixed(2)},${o.toFixed(2)}`}).join(` `)}function nt({values:e,overlay:t,height:n=28,color:r,overlayColor:i,scaleTo:a,label:o,className:s}){let c=ae(),l=a===void 0?Math.max(1,...e,...t??[]):Math.max(1,a),u=tt(e,100,n,l),d=u.length===0?``:`${u} L100,${n} L0,${n} Z`;return A(et,{className:s,viewBox:`0 0 100 ${n}`,preserveAspectRatio:`none`,role:`img`,"aria-label":o,style:{height:n},children:[k(`defs`,{children:A(`linearGradient`,{id:c,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[k(`stop`,{offset:`0%`,stopColor:r??`var(--accent)`,stopOpacity:`0.28`}),k(`stop`,{offset:`100%`,stopColor:r??`var(--accent)`,stopOpacity:`0`})]})}),d.length===0?null:k(`path`,{d,fill:`url(#${c})`}),t===void 0?null:k(`path`,{d:tt(t,100,n,l),fill:`none`,stroke:i??`var(--down)`,strokeWidth:`1.25`,vectorEffect:`non-scaling-stroke`}),k(`path`,{d:u,fill:`none`,stroke:r??`var(--accent)`,strokeWidth:`1.5`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`})]})}var rt=j.header`
157
- grid-area: chassis;
158
- display: flex;
159
- align-items: center;
160
- gap: ${({theme:e})=>e.space(3)};
161
- height: 48px;
162
- padding: 0 ${({theme:e})=>e.space(3)};
163
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
164
- background: ${({theme:e})=>e.color.panel};
165
- ${_}
166
- position: sticky;
167
- top: 0;
168
- z-index: ${({theme:e})=>e.z.chassis};
169
- `,it=j.div`
170
- display: flex;
171
- align-items: baseline;
172
- gap: 7px;
173
- font-stretch: 74%;
174
- font-weight: 700;
175
- letter-spacing: 0.2em;
176
- font-size: 12px;
177
- text-transform: uppercase;
178
- flex: none;
179
- `,at=j(C)`
180
- gap: ${({theme:e})=>e.space(3)};
181
- overflow: hidden;
182
-
183
- @media (max-width: 860px) {
184
- display: none;
185
- }
186
- `,N=j.div`
187
- display: flex;
188
- align-items: baseline;
189
- gap: 6px;
190
- padding-left: ${({theme:e})=>e.space(3)};
191
- border-left: 1px solid ${({theme:e})=>e.color.rule};
192
- white-space: nowrap;
193
- `,ot=j(N)`
194
- width: 96px;
195
- align-items: center;
196
- `,st=j.div`
197
- flex: 1;
198
- min-width: 0;
199
- `,ct=j(h)`
200
- gap: 6px;
201
- font-family: ${({theme:e})=>e.font.mono};
202
- letter-spacing: 0.08em;
203
- `,lt=j.span`
204
- color: ${({theme:e})=>e.color.inkFaint};
205
- `,ut={push:{name:`live, pushing`,lamp:`live`,head:`LIVE`,tail:`PUSH`,title:`Refreshing on gateway push — pause refreshing`},poll:{name:`live, polling`,lamp:`ok`,head:`LIVE`,tail:`POLL`,title:`Refreshing on a timer — pause refreshing`},paused:{name:`paused`,lamp:`idle`,head:`PAUSED`,tail:null,title:`Resume refreshing`},offline:{name:`offline`,lamp:`down`,head:`OFFLINE`,tail:null,title:`Not refreshing — this session ended, sign in again`}},dt=[`system`,`light`,`dark`],ft={system:`Match system theme`,light:`Light theme`,dark:`Dark theme`},pt=6e5;function mt({logs:e,logsFailed:n,signOut:a}){let{live:o,toggle:s,connection:c}=fe(),{mode:l,setMode:p}=Qe(),h=Date.now(),g=oe(()=>e.filter(e=>h-e.at<=pt),[e,h]),_=f(g,pt),b=u(g,{now:h,spanMs:pt,count:24}),x=dt[(dt.indexOf(l)+1)%dt.length]??`system`,C=l===`light`?Ie:l===`dark`?je:Ae,w=ut[o?c.status===`offline`?`offline`:c.status===`push`?`push`:`poll`:`paused`],T=n||_.errorRate>=.25?`down`:_.errorRate>=.05?`warn`:g.length===0?`idle`:`ok`;return A(rt,{children:[A(it,{children:[k(d,{state:T,label:n?`request log unreadable`:`error rate ${i(_.errorRate)}`}),`Omnigateway`]}),A(at,{children:[A(ot,{children:[k(y,{children:`req`}),k(st,{children:k(nt,{values:b.map(e=>e.total),overlay:b.map(e=>e.errors),height:22,label:`${_.requests} requests in the last 10 minutes`})})]}),A(N,{children:[k(y,{children:`rate`}),k(v,{children:_.ratePerMin.toFixed(1)}),k(y,{children:`/min`})]}),A(N,{children:[k(y,{children:`err`}),k(v,{style:{color:_.errorRate>=.05?`var(--down)`:void 0},children:i(_.errorRate)})]}),A(N,{children:[k(y,{children:`ttft p50`}),k(v,{children:r(_.ttftP50)})]}),A(N,{children:[k(y,{children:`spend`}),k(v,{children:t(_.costUsd)})]})]}),k(S,{}),A(ct,{type:`button`,$size:`sm`,onClick:s,"aria-pressed":o,"aria-label":w.name,title:w.title,children:[k(d,{state:w.lamp,label:w.name}),w.head,w.tail===null?null:A(O,{children:[k(lt,{"aria-hidden":`true`,children:`·`}),w.tail]})]}),k(m,{type:`button`,$variant:`ghost`,$size:`sm`,onClick:()=>p(x),"aria-label":ft[l],title:`${ft[l]} — switch to ${ft[x].toLowerCase()}`,children:k(C,{})}),k(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Sign out`,title:`Sign out`,disabled:a.pending,onClick:a.run,children:k(ke,{})})]})}function ht(){let e=s(),{cadence:t}=fe(),n=p(),r=l(200,t(1e4,`res:logs`));return k(mt,{logs:r.data??[],logsFailed:r.isError,signOut:{pending:n.isPending,run:()=>{n.mutate(void 0,{onSuccess:()=>void e({to:`/login`})})}}})}function gt(e){return`/plugins/${e}`}function _t(e){return e.filter(e=>e.nav!==null&&e.ui!==null).sort((e,t)=>e.id.localeCompare(t.id)).map(e=>({id:e.id,label:e.nav?.label??e.name,disabledReason:vt(e)}))}function vt(e){let t=e.ui;return t===null||t.compatible&&t.entry!==null?null:t.reason??`This plugin's interface does not match this gateway.`}var yt=Object.defineProperty,bt=(e,t)=>yt(e,`name`,{value:t,configurable:!0});function xt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}bt(xt,`setRef`);function St(...e){return t=>{let n=!1,r=e.map(e=>{let r=xt(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():xt(e[t],null)}}}}bt(St,`composeRefs`);function P(...e){return w.useCallback(St(...e),e)}bt(P,`useComposedRefs`);var Ct=Object.defineProperty,F=(e,t)=>Ct(e,`name`,{value:t,configurable:!0});function wt(e){let t=w.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Mt(r)&&typeof It==`function`&&(r=It(r._payload)),w.Children.forEach(r,e=>{if(At(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Mt(n)&&typeof It==`function`&&(n=It(n._payload)),a=Dt(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=w.cloneElement(a,void 0,s):!o&&w.Children.count(r)===1&&w.isValidElement(r)&&(a=r);let c=a?kt(a):void 0,l=P(n,c);if(!a){if(r||r===0)throw Error(o?Ft(e):Pt(e));return r}let u=Ot(i,a.props??{});return a.type!==w.Fragment&&(u.ref=n?l:c),w.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}F(wt,`createSlot`);var Tt=Symbol.for(`radix.slottable`);function Et(e){let t=F(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Tt,t}F(Et,`createSlottable`);var Dt=F((e,t)=>{if(`child`in e.props){let t=e.props.child;return w.isValidElement(t)?w.cloneElement(t,void 0,e.props.children(t.props.children)):null}return w.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Ot(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}F(Ot,`mergeProps`);function kt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}F(kt,`getElementRef`);function At(e){return w.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Tt}F(At,`isSlottable`);var jt=Symbol.for(`react.lazy`);function Mt(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===jt&&`_payload`in e&&Nt(e._payload)}F(Mt,`isLazyComponent`);function Nt(e){return typeof e==`object`&&!!e&&`then`in e}F(Nt,`isPromiseLike`);var Pt=F(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Ft=F(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),It=w.use,Lt=Object.defineProperty,Rt=(e,t)=>Lt(e,`name`,{value:t,configurable:!0}),I=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=wt(`Primitive.${t}`),r=w.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),k(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function zt(e,t){e&&se.flushSync(()=>e.dispatchEvent(t))}Rt(zt,`dispatchDiscreteCustomEvent`);var Bt=Object.defineProperty,L=(e,t)=>Bt(e,`name`,{value:t,configurable:!0});function Vt(e,t){let n=w.createContext(t);n.displayName=e+`Context`;let r=L(e=>{let{children:t,...r}=e,i=w.useMemo(()=>r,Object.values(r));return k(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=w.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return L(i,`useContext`),[r,i]}L(Vt,`createContext`);function Ht(e,t=[]){let n=[];function r(t,r){let i=w.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=L(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=w.useMemo(()=>o,Object.values(o));return k(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=w.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return L(s,`useContext`),[o,s]}L(r,`createContext`);let i=L(()=>{let t=n.map(e=>w.createContext(e));return L(function(n){let r=n?.[e]||t;return w.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Ut(i,...t)]}L(Ht,`createContextScope`);function Ut(...e){let t=e[0];if(e.length===1)return t;let n=L(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return L(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}L(Ut,`composeContextScopes`);var Wt=Object.defineProperty,R=(e,t)=>Wt(e,`name`,{value:t,configurable:!0}),Gt=!!(typeof window<`u`&&window.document&&window.document.createElement);function z(e,t,{checkForDefaultPrevented:n=!0}={}){return R(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}R(z,`composeEventHandlers`);function Kt(e){if(!Gt)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}R(Kt,`getOwnerWindow`);function qt(e){if(!Gt)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}R(qt,`getOwnerDocument`);function Jt(e,t=!1){let{activeElement:n}=qt(e);if(!n?.nodeName)return null;if(Yt(n)&&n.contentDocument)return Jt(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=qt(n).getElementById(e);if(t)return t}}return n}R(Jt,`getActiveElement`);function Yt(e){return e.tagName===`IFRAME`}R(Yt,`isFrame`);var B=globalThis?.document?w.useLayoutEffect:()=>{},Xt=Object.defineProperty,Zt=(e,t)=>Xt(e,`name`,{value:t,configurable:!0}),Qt=w.useEffectEvent,$t=w.useInsertionEffect;function en(e){if(typeof Qt==`function`)return Qt(e);let t=w.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof $t==`function`?$t(()=>{t.current=e}):B(()=>{t.current=e}),w.useMemo(()=>((...e)=>t.current?.(...e)),[])}Zt(en,`useEffectEvent`);var tn=Object.defineProperty,nn=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),rn=w.useInsertionEffect||B;function an({prop:e,defaultProp:t,onChange:n=nn(()=>{},`onChange`),caller:r}){let[i,a,o]=on({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,w.useCallback(t=>{if(s){let n=sn(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}nn(an,`useControllableState`);function on({defaultProp:e,onChange:t}){let[n,r]=w.useState(e),i=w.useRef(n),a=w.useRef(t);return rn(()=>{a.current=t},[t]),w.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}nn(on,`useUncontrolledState`);function sn(e){return typeof e==`function`}nn(sn,`isFunction`);var cn=Symbol(`RADIX:SYNC_STATE`);function ln(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=en(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=w.useReducer((t,n)=>{if(n.type===cn)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=w.useRef(p);w.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=w.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return w.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:cn,state:i})},[i,d.state,c]),[h,f]}nn(ln,`useControllableStateReducer`);var un=Object.defineProperty,V=(e,t)=>un(e,`name`,{value:t,configurable:!0});function dn(e,t){return w.useReducer((e,n)=>t[e][n]??e,e)}V(dn,`useStateMachine`);var fn=V(e=>{let{present:t,children:n}=e,r=pn(t),i=typeof n==`function`?n({present:r.isPresent}):w.Children.only(n),a=hn(r.ref,gn(i));return typeof n==`function`||r.isPresent?w.cloneElement(i,{ref:a}):null},`Presence`);function pn(e){let[t,n]=w.useState(),r=w.useRef(null),i=w.useRef(e),a=w.useRef(`none`),o=w.useRef(void 0),[s,c]=dn(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return w.useEffect(()=>{s===`mounted`?(a.current=o.current??H(r.current),o.current=void 0):a.current=`none`},[s]),B(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=H(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),B(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=V(a=>{let o=H(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=V(e=>{e.target===t&&(a.current=H(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:w.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=H(t)}else r.current=null;n(e)},[])}}V(pn,`usePresence`);function mn(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}V(mn,`setRef`);function hn(...e){let t=w.useRef(e);return t.current=e,w.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=mn(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():mn(n[e],null)}}},[])}V(hn,`useStableComposedRefs`);function H(e){return e?.animationName||`none`}V(H,`getAnimationName`);function gn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}V(gn,`getElementRef`);var _n=Object.defineProperty,vn=(e,t)=>_n(e,`name`,{value:t,configurable:!0}),yn=w.useId||(()=>void 0),bn=0;function xn(e){let[t,n]=w.useState(yn());return B(()=>{e||n(e=>e??String(bn++))},[e]),e||(t?`radix-${t}`:``)}vn(xn,`useId`);var Sn=Object.defineProperty,Cn=(e,t)=>Sn(e,`name`,{value:t,configurable:!0});function U(e){let t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>((...e)=>t.current?.(...e)),[])}Cn(U,`useCallbackRef`);var wn=Object.defineProperty,W=(e,t)=>wn(e,`name`,{value:t,configurable:!0}),Tn=`dismissableLayer.update`,En=`dismissableLayer.pointerDownOutside`,Dn=`dismissableLayer.focusOutside`,On,kn=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),An=w.forwardRef(W(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=w.useContext(kn),[d,f]=w.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=w.useState({}),h=P(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=w.useRef(!1),C=Nn(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),T=Pn(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),E=d?y===g.length-1:!1,ee=U(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return w.useEffect(()=>{if(E)return p.addEventListener(`keydown`,ee,{capture:!0}),()=>p.removeEventListener(`keydown`,ee,{capture:!0})},[p,E,ee]),w.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(On=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),Fn(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=On))}},[d,p,n,u]),w.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),Fn())},[d,u]),w.useEffect(()=>{let e=W(()=>m({}),`handleUpdate`);return document.addEventListener(Tn,e),()=>document.removeEventListener(Tn,e)},[]),k(I.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:z(e.onFocusCapture,T.onFocusCapture),onBlurCapture:z(e.onBlurCapture,T.onBlurCapture),onPointerDownCapture:z(e.onPointerDownCapture,C.onPointerDownCapture)})},`DismissableLayer`));function jn(){let e=w.useContext(kn),[t,n]=w.useState(null);return w.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}W(jn,`useDismissableLayerSurface`);var Mn=W(()=>!0,`IS_TRUE`);function Nn(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=Mn}=t,s=U(e),c=w.useRef(!1),l=w.useRef(!1),u=w.useRef(new Map),d=w.useRef(()=>{});return w.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}W(e,`resetOutsideInteraction`);function t(){return Array.from(u.current.values()).some(Boolean)}W(t,`isOutsideInteractionIntercepted`);function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}W(f,`handleInteractionCapture`);function p(e){l.current&&u.current.set(e.type,!1)}W(p,`handleInteractionBubble`);let m=W(a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||In(En,s,p,{discrete:!0})};if(W(f,`handleAndDispatchPointerDownOutsideEvent`),!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},`handlePointerDown`),h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:W(()=>c.current=!0,`onPointerDownCapture`)}}W(Nn,`usePointerDownOutside`);function Pn(e,t=globalThis?.document){let n=U(e),r=w.useRef(!1);return w.useEffect(()=>{let e=W(e=>{e.target&&!r.current&&In(Dn,n,{originalEvent:e},{discrete:!1})},`handleFocus`);return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:W(()=>r.current=!0,`onFocusCapture`),onBlurCapture:W(()=>r.current=!1,`onBlurCapture`)}}W(Pn,`useFocusOutside`);function Fn(){let e=new CustomEvent(Tn);document.dispatchEvent(e)}W(Fn,`dispatchUpdate`);function In(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?zt(i,a):i.dispatchEvent(a)}W(In,`handleAndDispatchCustomEvent`);var Ln=Object.defineProperty,G=(e,t)=>Ln(e,`name`,{value:t,configurable:!0}),Rn=`focusScope.autoFocusOnMount`,zn=`focusScope.autoFocusOnUnmount`,Bn={bubbles:!1,cancelable:!0},Vn=w.forwardRef(G(function(e,t){let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=w.useState(null),l=U(i),u=U(a),d=w.useRef(null),f=P(t,c),p=w.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;w.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:K(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||K(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&K(s)};G(e,`handleFocusIn`),G(t,`handleFocusOut`),G(n,`handleMutations`),document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),w.useEffect(()=>{if(s){Jn.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Rn,Bn);s.addEventListener(Rn,l),s.dispatchEvent(t),t.defaultPrevented||(Hn(Zn(Wn(s)),{select:!0}),document.activeElement===e&&K(s))}return()=>{s.removeEventListener(Rn,l),setTimeout(()=>{let t=new CustomEvent(zn,Bn);s.addEventListener(zn,u),s.dispatchEvent(t),t.defaultPrevented||K(e??document.body,{select:!0}),s.removeEventListener(zn,u),Jn.remove(p)},0)}}},[s,l,u,p]);let m=w.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Un(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&K(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&K(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return k(I.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})},`FocusScope`));function Hn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(K(r,{select:t}),document.activeElement!==n)return}G(Hn,`focusFirst`);function Un(e){let t=Wn(e);return[Gn(t,e),Gn(t.reverse(),e)]}G(Un,`getTabbableEdges`);function Wn(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:G(e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},`acceptNode`)});for(;n.nextNode();)t.push(n.currentNode);return t}G(Wn,`getTabbableCandidates`);function Gn(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):Kn(r,{upTo:t})))return r}G(Gn,`findVisible`);function Kn(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}G(Kn,`isHidden`);function qn(e){return e instanceof HTMLInputElement&&`select`in e}G(qn,`isSelectableInput`);function K(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&qn(e)&&t&&e.select()}}G(K,`focus`);var Jn=Yn();function Yn(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=Xn(e,t),e.unshift(t)},remove(t){e=Xn(e,t),e[0]?.resume()}}}G(Yn,`createFocusScopesStack`);function Xn(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}G(Xn,`arrayRemove`);function Zn(e){return e.filter(e=>e.tagName!==`A`)}G(Zn,`removeLinks`);var Qn=Object.defineProperty,$n=w.forwardRef(((e,t)=>Qn(e,`name`,{value:t,configurable:!0}))(function(e,t){let{container:n,...r}=e,[i,a]=w.useState(!1);B(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?se.createPortal(k(I.div,{...r,ref:t}),o):null},`Portal`)),er=Object.defineProperty,tr=(e,t)=>er(e,`name`,{value:t,configurable:!0}),nr=0,rr=null;function ir(e){return ar(),e.children}tr(ir,`FocusGuards`);function ar(){w.useEffect(()=>{rr||={start:or(),end:or()};let{start:e,end:t}=rr;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),nr++,()=>{nr===1&&(rr?.start.remove(),rr?.end.remove(),rr=null),nr=Math.max(0,nr-1)}},[])}tr(ar,`useFocusGuards`);function or(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}tr(or,`createFocusGuard`);var q=function(){return q=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},q.apply(this,arguments)};function sr(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function cr(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var lr=`right-scroll-bar-position`,ur=`width-before-scroll-bar`,dr=`with-scroll-bars-hidden`,fr=`--removed-body-scroll-bar-size`;function pr(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function mr(e,t){var n=D(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var hr=typeof window<`u`?w.useLayoutEffect:w.useEffect,gr=new WeakMap;function _r(e,t){var n=mr(t||null,function(t){return e.forEach(function(e){return pr(e,t)})});return hr(function(){var t=gr.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||pr(e,null)}),i.forEach(function(e){r.has(e)||pr(e,a)})}gr.set(n,e)},[e]),n}function vr(e){return e}function yr(e,t){t===void 0&&(t=vr);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function br(e){e===void 0&&(e={});var t=yr(null);return t.options=q({async:!0,ssr:!1},e),t}var xr=function(e){var t=e.sideCar,n=sr(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return w.createElement(r,q({},n))};xr.isSideCarExport=!0;function Sr(e,t){return e.useMedium(t),xr}var Cr=br(),wr=function(){},Tr=w.forwardRef(function(e,t){var n=w.useRef(null),r=w.useState({onScrollCapture:wr,onWheelCapture:wr,onTouchMoveCapture:wr}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=sr(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=_r([n,t]),C=q(q({},b),i);return w.createElement(w.Fragment,null,u&&w.createElement(x,{sideCar:Cr,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?w.cloneElement(w.Children.only(s),q(q({},C),{ref:S})):w.createElement(v,q({},C,{className:c,ref:S}),s))});Tr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Tr.classNames={fullWidth:ur,zeroRight:lr};var Er,Dr=function(){if(Er)return Er;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Or(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Dr();return t&&e.setAttribute(`nonce`,t),e}function kr(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Ar(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var jr=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Or())&&(kr(t,n),Ar(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Mr=function(){var e=jr();return function(t,n){w.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Nr=function(){var e=Mr();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Pr={left:0,top:0,right:0,gap:0},Fr=function(e){return parseInt(e||``,10)||0},Ir=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Fr(n),Fr(r),Fr(i)]},Lr=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Pr;var t=Ir(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Rr=Nr(),zr=`data-scroll-locked`,Br=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
206
- .${dr} {
207
- overflow: hidden ${r};
208
- padding-right: ${s}px ${r};
209
- }
210
- body[${zr}] {
211
- overflow: hidden ${r};
212
- overscroll-behavior: contain;
213
- ${[t&&`position: relative ${r};`,n===`margin`&&`
214
- padding-left: ${i}px;
215
- padding-top: ${a}px;
216
- padding-right: ${o}px;
217
- margin-left:0;
218
- margin-top:0;
219
- margin-right: ${s}px ${r};
220
- `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
221
- }
222
-
223
- .${lr} {
224
- right: ${s}px ${r};
225
- }
226
-
227
- .${ur} {
228
- margin-right: ${s}px ${r};
229
- }
230
-
231
- .${lr} .${lr} {
232
- right: 0 ${r};
233
- }
234
-
235
- .${ur} .${ur} {
236
- margin-right: 0 ${r};
237
- }
238
-
239
- body[${zr}] {
240
- ${fr}: ${s}px;
241
- }
242
- `},Vr=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Hr=function(){w.useEffect(function(){return document.body.setAttribute(zr,(Vr()+1).toString()),function(){var e=Vr()-1;e<=0?document.body.removeAttribute(zr):document.body.setAttribute(zr,e.toString())}},[])},Ur=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Hr();var a=w.useMemo(function(){return Lr(i)},[i]);return w.createElement(Rr,{styles:Br(a,!t,i,n?``:`!important`)})},Wr=!1;if(typeof window<`u`)try{var Gr=Object.defineProperty({},"passive",{get:function(){return Wr=!0,!0}});window.addEventListener(`test`,Gr,Gr),window.removeEventListener(`test`,Gr,Gr)}catch{Wr=!1}var J=Wr?{passive:!1}:!1,Kr=function(e){return e.tagName===`TEXTAREA`},qr=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Kr(e)&&n[t]===`visible`)},Jr=function(e){return qr(e,`overflowY`)},Yr=function(e){return qr(e,`overflowX`)},Xr=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),$r(e,r)){var i=ei(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Zr=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},Qr=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},$r=function(e,t){return e===`v`?Jr(t):Yr(t)},ei=function(e,t){return e===`v`?Zr(t):Qr(t)},ti=function(e,t){return e===`h`&&t===`rtl`?-1:1},ni=function(e,t,n,r,i){var a=ti(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=ei(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&$r(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},ri=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},ii=function(e){return[e.deltaX,e.deltaY]},ai=function(e){return e&&`current`in e?e.current:e},oi=function(e,t){return e[0]===t[0]&&e[1]===t[1]},si=function(e){return`
243
- .block-interactivity-${e} {pointer-events: none;}
244
- .allow-interactivity-${e} {pointer-events: all;}
245
- `},ci=0,Y=[];function li(e){var t=w.useRef([]),n=w.useRef([0,0]),r=w.useRef(),i=w.useState(ci++)[0],a=w.useState(Nr)[0],o=w.useRef(e);w.useEffect(function(){o.current=e},[e]),w.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=cr([e.lockRef.current],(e.shards||[]).map(ai),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=w.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=ri(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=Xr(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=Xr(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ni(h,t,e,h===`h`?s:c,!0)},[]),c=w.useCallback(function(e){var n=e;if(!(!Y.length||Y[Y.length-1]!==a)){var r=`deltaY`in n?ii(n):ri(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&oi(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ai).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=w.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:ui(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=w.useCallback(function(e){n.current=ri(e),r.current=void 0},[]),d=w.useCallback(function(t){l(t.type,ii(t),t.target,s(t,e.lockRef.current))},[]),f=w.useCallback(function(t){l(t.type,ri(t),t.target,s(t,e.lockRef.current))},[]);w.useEffect(function(){return Y.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,J),document.addEventListener(`touchmove`,c,J),document.addEventListener(`touchstart`,u,J),function(){Y=Y.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,J),document.removeEventListener(`touchmove`,c,J),document.removeEventListener(`touchstart`,u,J)}},[]);var p=e.removeScrollBar,m=e.inert;return w.createElement(w.Fragment,null,m?w.createElement(a,{styles:si(i)}):null,p?w.createElement(Ur,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function ui(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var di=Sr(Cr,li),fi=w.forwardRef(function(e,t){return w.createElement(Tr,q({},e,{ref:t,sideCar:di}))});fi.classNames=Tr.classNames;var pi=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},X=new WeakMap,mi=new WeakMap,hi={},gi=0,_i=function(e){return e&&(e.host||_i(e.parentNode))},vi=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=_i(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},yi=function(e,t,n,r){var i=vi(t,Array.isArray(e)?e:[e]);hi[n]||(hi[n]=new WeakMap);var a=hi[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(X.get(e)||0)+1,l=(a.get(e)||0)+1;X.set(e,c),a.set(e,l),o.push(e),c===1&&i&&mi.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),gi++,function(){o.forEach(function(e){var t=X.get(e)-1,i=a.get(e)-1;X.set(e,t),a.set(e,i),t||(mi.has(e)||e.removeAttribute(r),mi.delete(e)),i||e.removeAttribute(n)}),gi--,gi||(X=new WeakMap,X=new WeakMap,mi=new WeakMap,hi={})}},bi=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||pi(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),yi(r,i,n,`aria-hidden`)):function(){return null}},xi=Object.defineProperty,Z=(e,t)=>xi(e,`name`,{value:t,configurable:!0}),Si=`Dialog`,[Ci,wi]=Ht(Si),[Ti,Q]=Ci(Si),Ei=Z(e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=w.useRef(null),c=w.useRef(null),[l,u]=an({prop:r,defaultProp:i??!1,onChange:a,caller:Si}),[d,f]=w.useState(0),[p,m]=w.useState(0);return k(Ti,{scope:t,triggerRef:s,contentRef:c,contentId:xn(),titleId:xn(),descriptionId:xn(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,open:l,onOpenChange:u,onOpenToggle:w.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})},`Dialog`),Di=`DialogPortal`,[Oi,ki]=Ci(Di,{forceMount:void 0}),Ai=Z(e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Q(Di,t);return k(Oi,{scope:t,forceMount:n,children:w.Children.map(r,e=>k(fn,{present:n||a.open,children:k($n,{asChild:!0,container:i,children:e})}))})},`DialogPortal`),ji=`DialogOverlay`,Mi=w.forwardRef(Z(function(e,t){let n=ki(ji,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Q(ji,e.__scopeDialog);return a.modal?k(fn,{present:r||a.open,children:k(Pi,{...i,ref:t})}):null},`DialogOverlay`)),Ni=wt(`DialogOverlay.RemoveScroll`),Pi=w.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,i=Q(ji,n),a=P(t,jn());return k(fi,{as:Ni,allowPinchZoom:!0,shards:[i.contentRef],children:k(I.div,{"data-state":Gi(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})},`DialogOverlayImpl`)),$=`DialogContent`,Fi=w.forwardRef(Z(function(e,t){let n=ki($,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Q($,e.__scopeDialog);return k(fn,{present:r||a.open,children:a.modal?k(Ii,{...i,ref:t}):k(Li,{...i,ref:t})})},`DialogContent`)),Ii=w.forwardRef(Z(function(e,t){let n=Q($,e.__scopeDialog),r=w.useRef(null),i=P(t,n.contentRef,r);return w.useEffect(()=>{let e=r.current;if(e)return bi(e)},[]),k(Ri,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:z(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:z(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:z(e.onFocusOutside,e=>e.preventDefault())})},`DialogContentModal`)),Li=w.forwardRef(Z(function(e,t){let n=Q($,e.__scopeDialog),r=w.useRef(!1),i=w.useRef(!1);return k(Ri,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`DialogContentNonModal`)),Ri=w.forwardRef(Z(function(e,t){let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Q($,n);return ar(),k(O,{children:k(Vn,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:k(An,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionPresent?s.descriptionId:void 0,"aria-labelledby":s.titlePresent?s.titleId:void 0,"data-state":Gi(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})},`DialogContentImpl`)),zi=`DialogTitle`,Bi=w.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,i=Q(zi,n),{setTitleCount:a}=i;return B(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),k(I.h2,{id:i.titleId,...r,ref:t})},`DialogTitle`)),Vi=`DialogDescription`,Hi=w.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,i=Q(Vi,n),{setDescriptionCount:a}=i;return B(()=>(a(e=>e+1),()=>a(e=>e-1)),[a]),k(I.p,{id:i.descriptionId,...r,ref:t})},`DialogDescription`)),Ui=`DialogClose`,Wi=w.forwardRef(Z(function(e,t){let{__scopeDialog:n,...r}=e,i=Q(Ui,n);return k(I.button,{type:`button`,...r,ref:t,onClick:z(e.onClick,()=>i.onOpenChange(!1))})},`DialogClose`));function Gi(e){return e?`open`:`closed`}Z(Gi,`getState`);var Ki=j(Mi)`
246
- position: fixed;
247
- inset: 0;
248
- z-index: ${({theme:e})=>e.z.overlay};
249
- background: oklch(0 0 0 / 0.5);
250
- backdrop-filter: blur(2px);
251
- `,qi=j(Fi)`
252
- position: fixed;
253
- z-index: ${({theme:e})=>e.z.dialog};
254
- top: 50%;
255
- left: 50%;
256
- transform: translate(-50%, -50%);
257
- width: min(${({$width:e})=>e}, calc(100vw - 32px));
258
- max-height: calc(100vh - 64px);
259
- display: flex;
260
- flex-direction: column;
261
- background: ${({theme:e})=>e.color.panel};
262
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
263
- border-radius: ${({theme:e})=>e.radius.panel};
264
- box-shadow: 0 12px 40px oklch(0 0 0 / 0.35);
265
- `,Ji=j.div`
266
- display: flex;
267
- align-items: center;
268
- gap: ${({theme:e})=>e.space(2)};
269
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(2)} ${e.space(2)} ${e.space(3)}`};
270
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
271
- background: ${({theme:e})=>e.color.panelSunk};
272
- `,Yi=j.div`
273
- padding: ${({theme:e})=>e.space(3)};
274
- overflow-y: auto;
275
- `,Xi=j.div`
276
- display: flex;
277
- justify-content: flex-end;
278
- gap: ${({theme:e})=>e.space(2)};
279
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
280
- border-top: 1px solid ${({theme:e})=>e.color.rule};
281
- background: ${({theme:e})=>e.color.panelSunk};
282
- `,Zi=j(Hi)`
283
- margin: 0 0 ${({theme:e})=>e.space(3)};
284
- font-size: 12px;
285
- color: ${({theme:e})=>e.color.inkDim};
286
- `;function Qi({open:e,onOpenChange:t,title:n,description:r,footer:i,width:a=`560px`,children:o}){return k(Ei,{open:e,onOpenChange:t,children:A(Ai,{children:[k(Ki,{}),A(qi,{$width:a,children:[A(Ji,{children:[k(Bi,{asChild:!0,children:k(y,{as:`h2`,children:n})}),k(S,{}),k(Wi,{asChild:!0,children:k(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Close`,children:k(Re,{})})})]}),A(Yi,{children:[r===void 0?null:k(Zi,{children:r}),o]}),i===void 0?null:k(Xi,{children:i})]})]})})}var $i=j.p`
287
- font-size: 13px;
288
- color: ${({theme:e})=>e.color.inkDim};
289
- `;function ea({open:e,onOpenChange:t,title:n,body:r,confirmLabel:i,busy:a,onConfirm:o}){return k(Qi,{open:e,onOpenChange:t,title:n,width:`420px`,footer:A(O,{children:[k(h,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),k(h,{type:`button`,$variant:`danger`,disabled:a===!0,onClick:o,children:i})]}),children:k($i,{children:r})})}var ta={systemd:`systemd is capturing this process, so a restart asks the manager to bring the unit back rather than signalling the gateway itself.`,container:`This gateway is running in a container, so a restart is an exit and the container's restart policy decides what happens next.`,none:`Nothing is supervising this process. It was started directly, and whatever stops it leaves it stopped.`},na=j.hr`
290
- flex: none;
291
- border: 0;
292
- margin: 0;
293
- height: 1px;
294
- align-self: stretch;
295
- background: ${({theme:e})=>e.color.rule};
296
-
297
- /* The rail turns on its side below 720px, and so does the rule that closes it. */
298
- @media (max-width: 720px) {
299
- height: auto;
300
- width: 1px;
301
- margin-left: ${({theme:e})=>e.space(2)};
302
- }
303
- `,ra=j.div`
304
- display: flex;
305
- flex-direction: column;
306
- gap: 6px;
307
- padding-top: ${({theme:e})=>e.space(2)};
308
-
309
- @media (max-width: 720px) {
310
- padding-top: 0;
311
- padding-left: ${({theme:e})=>e.space(2)};
312
- flex-direction: row;
313
- align-items: center;
314
- }
315
- `,ia=j(h)`
316
- justify-content: flex-start;
317
- width: 100%;
318
-
319
- @media (max-width: 720px) {
320
- width: auto;
321
- }
322
- `,aa=j.p`
323
- font-size: 10.5px;
324
- line-height: 1.3;
325
- color: ${({theme:e})=>e.color.warn};
326
- `,oa=j.p`
327
- font-size: 10.5px;
328
- line-height: 1.3;
329
- color: ${({theme:e})=>e.color.down};
330
- `,sa=j.p`
331
- font-size: 10.5px;
332
- line-height: 1.3;
333
- color: ${({theme:e})=>e.color.inkDim};
334
- ${x}
335
- `,ca=j.p`
336
- font-size: 10.5px;
337
- line-height: 1.3;
338
- color: ${({theme:e})=>e.color.inkDim};
339
- `,la=9e4;async function ua(){try{return(await fetch(`/health`,{cache:`no-store`})).ok}catch{return!1}}function da({pollMs:t=750}){let r=c(),i=e(),a=n(),[o,s]=D(null),[l,u]=D(!1),[d,f]=D(!1),[p,m]=D(`idle`),h=r.data;ie(()=>{if(!l)return;let e=!1,n,r=!1,i=0,a=Math.max(1,Math.ceil(la/t)),o=async()=>{let s=await ua();if(!e){if(!r&&!s)r=!0,m(`returning`);else if(r&&s){window.location.reload();return}if(i+=1,i>=a){m(`lost`),u(!1);return}n=setTimeout(()=>void o(),t)}};return n=setTimeout(()=>void o(),t),()=>{e=!0,n!==void 0&&clearTimeout(n)}},[l,t]);let _=()=>{m(`leaving`),i.mutate(void 0,{onSuccess:()=>u(!0),onError:()=>m(`idle`)})};return d?A(O,{children:[k(S,{}),k(na,{}),k(ra,{children:A(g,{$gap:1,children:[k(y,{children:`Gateway stopped`}),A(ca,{children:[`Nothing on this screen will update again, and nothing here can start it: that needs`,` `,h?.supervisor===`container`?`the host that runs this container`:`a shell on the machine it runs on`,`.`]})]})})]}):A(O,{children:[k(S,{}),k(na,{}),A(ra,{title:h===void 0?void 0:ta[h.supervisor],children:[A(ia,{type:`button`,$size:`sm`,"aria-label":`Restart gateway`,disabled:h===void 0||!h.canRestart||i.isPending||l,onClick:()=>s(`restart`),children:[k(Ne,{}),`Restart`]}),A(ia,{type:`button`,$size:`sm`,$variant:`danger`,"aria-label":`Shut down gateway`,disabled:h===void 0||!h.canShutdown||a.isPending||l,onClick:()=>s(`shutdown`),children:[k(Me,{}),`Shut down`]}),h?.note===void 0?null:k(aa,{children:h.note}),p===`leaving`?k(sa,{role:`status`,children:`Restarting. Waiting for the gateway to stop answering.`}):p===`returning`?k(sa,{role:`status`,children:`The gateway has stopped answering. Waiting for it to come back, then this page reloads.`}):p===`lost`?k(oa,{role:`alert`,children:`The gateway has not come back. Reload this page once it is running again, or check the machine it runs on.`}):null,i.isError?k(oa,{role:`alert`,children:b(i.error)}):null,a.isError?k(oa,{role:`alert`,children:b(a.error)}):null]}),k(ea,{open:o===`restart`,onOpenChange:e=>{e||s(null)},title:`Restart gateway`,body:`${h===void 0?``:`${ta[h.supervisor]} `}Requests in flight are dropped when the process goes. This console waits for the gateway to stop answering and to answer again, then reloads itself.`,confirmLabel:`Restart now`,busy:i.isPending,onConfirm:()=>{s(null),_()}}),k(ea,{open:o===`shutdown`,onOpenChange:e=>{e||s(null)},title:`Shut down gateway`,body:h?.supervisor===`container`?`Stopping the only process in this container takes this dashboard with it, and the dashboard is what would have restarted the gateway. Unless the container's restart policy brings it back, getting it running again needs access to the host.`:`The gateway stops serving and stays stopped. This console goes with it, so starting the gateway again needs a shell on the machine it runs on.`,confirmLabel:`Shut down now`,busy:a.isPending,onConfirm:()=>{s(null),a.mutate(void 0,{onSuccess:()=>f(!0)})}})]})}var fa=[{to:`/`,label:`Rack`,blurb:`Live state of every account and model`,Icon:Se},{to:`/accounts`,label:`Accounts`,blurb:`Provider credentials and their health`,Icon:Te},{to:`/models`,label:`Models`,blurb:`Virtual models, targets, and routing`,Icon:we},{to:`/keys`,label:`Keys`,blurb:`Gateway API keys and their limits`,Icon:Oe},{to:`/usage`,label:`Usage`,blurb:`Requests, tokens, and spend over time`,Icon:De},{to:`/logs`,label:`Logs`,blurb:`Recent requests, one row each`,Icon:Pe},{to:`/console`,label:`Console`,blurb:`The gateway's own output, as it was printed`,Icon:Le},{to:`/settings`,label:`Settings`,blurb:`Routing weights, retries, retention`,Icon:Fe},{to:`/database`,label:`Database`,blurb:`Size, snapshots, and retention`,Icon:Ee}],pa=j.nav`
340
- grid-area: rail;
341
- display: flex;
342
- flex-direction: column;
343
- gap: 2px;
344
- padding: ${({theme:e})=>e.space(2)};
345
- border-right: 1px solid ${({theme:e})=>e.color.rule};
346
- background: ${({theme:e})=>e.color.panel};
347
- overflow-y: auto;
348
-
349
- @media (max-width: 720px) {
350
- flex-direction: row;
351
- overflow-x: auto;
352
- border-right: 0;
353
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
354
- }
355
- `,ma=ue`
356
- display: flex;
357
- align-items: center;
358
- gap: ${({theme:e})=>e.space(2)};
359
- padding: 7px ${({theme:e})=>e.space(2)};
360
- border-radius: ${({theme:e})=>e.radius.control};
361
- border-left: 2px solid transparent;
362
- color: ${({theme:e})=>e.color.inkDim};
363
- font-size: 12.5px;
364
- font-weight: 500;
365
- white-space: nowrap;
366
- transition:
367
- background 120ms ease,
368
- color 120ms ease;
369
-
370
- svg {
371
- width: 15px;
372
- height: 15px;
373
- flex: none;
374
- }
375
- `,ha=j(o)`
376
- ${ma}
377
-
378
- &:hover {
379
- background: ${({theme:e})=>e.color.panelSunk};
380
- color: ${({theme:e})=>e.color.ink};
381
- }
382
-
383
- &[data-status="active"] {
384
- background: ${({theme:e})=>e.color.accentWash};
385
- border-left-color: ${({theme:e})=>e.color.accent};
386
- color: ${({theme:e})=>e.color.accent};
387
- }
388
- `,ga=j.button`
389
- ${ma}
390
- align-items: flex-start;
391
- width: 100%;
392
- text-align: left;
393
- white-space: normal;
394
- background: none;
395
- border-top: 0;
396
- border-right: 0;
397
- border-bottom: 0;
398
- color: ${({theme:e})=>e.color.inkFaint};
399
- cursor: not-allowed;
400
- font-family: inherit;
401
-
402
- svg {
403
- margin-top: 2px;
404
- }
405
- `,_a=j.span`
406
- display: flex;
407
- flex-direction: column;
408
- gap: 2px;
409
- min-width: 0;
410
- `,va=j.span`
411
- font-size: 10.5px;
412
- font-weight: 400;
413
- line-height: 1.3;
414
- color: ${({theme:e})=>e.color.warn};
415
- `;function ya(){let e=a();return A(pa,{"aria-label":`Console sections`,children:[fa.map(({to:e,label:t,blurb:n,Icon:r})=>A(ha,{to:e,title:n,activeOptions:{exact:e===`/`},children:[k(r,{}),t]},e)),_t(e.data??[]).map(({id:e,label:t,disabledReason:n})=>n===null?A(ha,{to:gt(e),title:`Provided by the ${e} plugin`,children:[k(Ce,{}),t]},e):A(ga,{type:`button`,disabled:!0,children:[k(Ce,{}),A(_a,{children:[t,k(va,{children:n})]})]},e)),k(da,{})]})}var ba=j.div`
416
- display: grid;
417
- grid-template-areas:
418
- "chassis chassis"
419
- "rail main";
420
- grid-template-columns: 168px minmax(0, 1fr);
421
- grid-template-rows: auto minmax(0, 1fr);
422
- height: 100vh;
423
- min-height: 0;
424
- overflow: hidden;
425
-
426
- @media (max-width: 720px) {
427
- grid-template-areas:
428
- "chassis"
429
- "rail"
430
- "main";
431
- grid-template-columns: minmax(0, 1fr);
432
- grid-template-rows: auto auto minmax(0, 1fr);
433
- }
434
- `,xa=j.main`
435
- grid-area: main;
436
- padding: ${({theme:e})=>e.space(4)};
437
- display: flex;
438
- flex-direction: column;
439
- gap: ${({theme:e})=>e.space(4)};
440
- min-width: 0;
441
- min-height: 0;
442
- overflow-y: auto;
443
-
444
- @media (max-width: 720px) {
445
- padding: ${({theme:e})=>e.space(3)};
446
- }
447
- `;function Sa({children:e}){return A(ba,{"data-testid":`rack-shell`,children:[k(ht,{}),k(ya,{}),k(xa,{children:e})]})}var Ca=j.div`
448
- display: flex;
449
- align-items: flex-end;
450
- gap: ${({theme:e})=>e.space(3)};
451
- flex-wrap: wrap;
452
- `,wa=j.h1`
453
- font-size: 20px;
454
- font-weight: 600;
455
- font-stretch: 88%;
456
- letter-spacing: -0.01em;
457
- `,Ta=j.p`
458
- font-size: 13px;
459
- color: ${({theme:e})=>e.color.inkDim};
460
- max-width: 68ch;
461
- `,Ea=j.div`
462
- display: flex;
463
- flex-direction: column;
464
- gap: 6px;
465
- min-width: 0;
466
- `;function Da({legend:e,title:t,summary:n,actions:r}){return A(Ca,{children:[A(Ea,{children:[k(y,{children:e}),k(wa,{children:t}),k(Ta,{children:n})]}),k(S,{}),r]})}export{fe as _,an as a,M as b,Ht as c,mt as d,nt as f,de as g,Be as h,Qi as i,I as l,We as m,Sa as n,B as o,$e as p,ea as r,z as s,Da as t,P as u,Fe as v,Ee as y};
@@ -1 +0,0 @@
1
- import{O as e,i as t,t as n}from"./Panel-BCpZVY4U.js";import{jsx as r}from"react/jsx-runtime";function i({error:i}){let a=e();return r(n,{legend:`Console unavailable`,children:r(t,{legend:`The gateway did not answer`,error:i,onRetry:()=>void a.invalidate()})})}export{i as errorComponent};
@@ -1,59 +0,0 @@
1
- import{A as e,Bt as t,Ct as n,F as r,Ft as i,H as a,N as o,P as s,U as c,at as l,b as u,c as d,ct as f,d as p,dt as m,h as ee,lt as h,n as g,nt as _,o as v,rt as y,s as b,t as x,v as S,w as C,wt as w,xt as te,y as T}from"./Lamp-DN2EKL4m.js";import{D as E,E as D,S as O,_ as k,a as A,b as j,g as M,i as ne,o as N,r as re,t as P,y as F}from"./Panel-BCpZVY4U.js";import{_ as I,b as L,i as ie,m as R,r as z,t as B}from"./Rack-B03tpeW-.js";import{t as V}from"./CopyValue-DIR5A6PG.js";import{n as H,t as ae}from"./chevron-right-0adI8395.js";import{t as oe}from"./plus-B_f8M9yB.js";import{t as se}from"./trash-2-DrDlpCqO.js";import{t as ce}from"./Toggle-ByxBCMfb.js";import{t as le}from"./Chip-BWxO0uV7.js";import{i as U,n as W,r as ue,t as G}from"./Field-DI5YTYOX.js";import{t as de}from"./Meter-stpt3vQu.js";import{i as fe,n as K,r as q,t as pe}from"./Table-CVDZ69Zx.js";import{n as me,r as he,t as ge}from"./WindowChart-nxC4SCRC.js";import{Fragment as _e,useCallback as J,useEffect as ve,useState as Y}from"react";import{Fragment as X,jsx as Z,jsxs as Q}from"react/jsx-runtime";import $ from"styled-components";var ye=L(`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`}]]);function be(e){return e?.authTypes??[]}function xe(e){return be(e).includes(`oauth`)?`oauth`:`apiKey`}function Se(e){return e[0]?.id??`anthropic`}var Ce={oauth:`Authorize in the browser`,apiKey:`Paste an API key`};function we(e){let t=e?.callback;return t===void 0?`code#state`:`${t.uri}?code=…`}var Te=$.ol`
2
- display: flex;
3
- flex-direction: column;
4
- gap: ${({theme:e})=>e.space(3)};
5
- `,Ee=$.div`
6
- font-family: ${({theme:e})=>e.font.mono};
7
- font-size: 26px;
8
- letter-spacing: 0.22em;
9
- text-align: center;
10
- padding: ${({theme:e})=>e.space(3)};
11
- background: ${({theme:e})=>e.color.panelSunk};
12
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
13
- border-radius: ${({theme:e})=>e.radius.control};
14
- `,De=$.p`
15
- font-size: 12px;
16
- color: ${({theme:e})=>e.color.down};
17
- `,Oe=$.p`
18
- font-size: 12px;
19
- color: ${({theme:e})=>e.color.inkDim};
20
- `;function ke({open:e,credentials:t,onOpenChange:r,onConnected:i}){let o=n().data??[],[s,u]=Y(()=>Se(o)),d=a(o,s),[f,p]=Y(()=>xe(a(o,Se(o)))),[m,ee]=Y(``),h=d?.label??s,[g,v]=Y(null),[b,x]=Y(``),[S,C]=Y(``),w=(t??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[te,T]=Y(``),[E,k]=Y(``),[A,j]=Y(`chat_completions`),[ne,re]=Y(``),[P,I]=Y(null),L=y(),R=_(),z=l(),B=J(()=>{v(null),x(``),C(``),T(``),k(``),j(`chat_completions`),re(``),I(null),ee(``),L.reset(),R.reset(),z.reset()},[L,R,z]),H=J(e=>{e||B(),r(e)},[r,B]);return ve(()=>{if(g===null||g.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await c(g.flowId);if(e)return;if(t.status===`complete`){B(),r(!1),i();return}}catch(t){if(e)return;I(N(t)),v(null);return}e||(n=setTimeout(()=>void t(),g.pollIntervalMs))},n=setTimeout(()=>void t(),g.pollIntervalMs);return()=>{e=!0,clearTimeout(n)}},[g,i,r,B]),Z(ie,{open:e,onOpenChange:H,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:g===null?Q(X,{children:[Z(D,{type:`button`,onClick:()=>H(!1),children:`Cancel`}),Z(D,{type:`button`,$variant:`primary`,disabled:L.isPending||z.isPending,onClick:()=>{if(I(null),f===`apiKey`){z.mutate({provider:s,apiKey:ne,label:m.trim()||void 0,...s===`custom`?{endpointId:S,endpointLabel:te,origin:E,protocol:A}:{}},{onSuccess:()=>{B(),r(!1),i()},onError:e=>I(N(e))});return}L.mutate({provider:s,label:m.trim().length===0?h:m.trim()},{onSuccess:e=>v(e),onError:e=>I(N(e))})},children:f===`apiKey`?z.isPending?`Adding…`:`Add API key`:L.isPending?`Starting…`:`Start authorization`})]}):g.kind===`device`?Z(D,{type:`button`,onClick:()=>H(!1),children:`Cancel`}):Q(X,{children:[Z(D,{type:`button`,onClick:()=>H(!1),children:`Cancel`}),Z(D,{type:`button`,$variant:`primary`,disabled:R.isPending||b.trim().length===0,onClick:()=>{g!==null&&(I(null),R.mutate({flowId:g.flowId,code:b.trim()},{onSuccess:()=>{B(),r(!1),i()},onError:e=>I(N(e))}))},children:R.isPending?`Finishing…`:`Finish connecting`})]}),children:Q(Te,{children:[g===null?Q(O,{$gap:3,children:[Z(G,{label:`Provider`,children:e=>Z(U,{...e,value:s,onChange:e=>{let t=e.target.value;u(t),p(xe(a(o,t)))},children:o.map(e=>Z(`option`,{value:e.id,children:e.label},e.id))})}),be(d).length>1?Z(G,{label:`How to connect`,children:e=>Z(U,{...e,value:f,onChange:e=>p(e.target.value),children:be(d).map(e=>Z(`option`,{value:e,children:Ce[e]},e))})}):null,s===`custom`?Q(X,{children:[w.length===0?null:Z(G,{label:`Existing endpoint`,children:e=>Q(U,{...e,value:S,onChange:e=>{let t=w.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){C(``),T(``),k(``),j(`chat_completions`);return}C(String(t.providerData.endpointId)),T(String(t.providerData.endpointLabel)),k(String(t.providerData.origin)+String(t.providerData.basePath??``)),j(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[Z(`option`,{value:``,children:`Create new endpoint`}),w.map(e=>Z(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),Z(G,{label:`Endpoint ID`,children:e=>Z(W,{...e,value:S,onChange:e=>C(e.target.value)})}),Z(G,{label:`Endpoint label`,children:e=>Z(W,{...e,value:te,onChange:e=>T(e.target.value)})}),Z(G,{label:`Server URL`,children:e=>Z(W,{...e,value:E,placeholder:`https://server.example/api`,onChange:e=>k(e.target.value)})}),E.trim().toLowerCase().startsWith(`http://`)?Z(De,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,Z(G,{label:`Protocol`,children:e=>Q(U,{...e,value:A,onChange:e=>j(e.target.value),children:[Z(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),Z(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,f===`apiKey`?Z(G,{label:`API key`,children:e=>Z(W,{...e,type:`password`,value:ne,autoComplete:`off`,onChange:e=>re(e.target.value)})}):null,Z(G,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>Z(W,{...e,value:m,placeholder:h,onChange:e=>ee(e.target.value)})})]}):Q(O,{$gap:3,children:[Q(O,{$gap:1,children:[Z(M,{children:`Step 1 — authorize`}),Z(F,{$gap:2,children:Q(D,{as:`a`,href:g.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[Z(ye,{}),`Open `,h]})}),Z(V,{value:g.authorizeUrl,label:`Copy authorization link`})]}),g.userCode===null?null:Q(O,{$gap:1,children:[Z(M,{children:`Step 2 — enter this code`}),Z(Ee,{children:g.userCode})]}),g.kind===`device`?Q(Oe,{children:[d?.pasteHint??``,` Waiting for authorization…`]}):Z(G,{label:`Authorization code`,hint:d?.pasteHint??``,...P===null?{}:{problem:P},children:e=>Z(W,{...e,value:b,autoFocus:!0,placeholder:we(d),onChange:e=>x(e.target.value)})})]}),P===null||g?.kind===`pkce`?null:Z(De,{children:P})]})})}function Ae({credentialId:e,windows:t,burn:n,pollIntervalMs:r,now:i}){let a=t.map(e=>({window:e,estimate:v(n,e.windowType),since:he(u(e))})),o=a.map(e=>e.since).filter(e=>e!==null),s=o.length===0?0:Math.min(...o),c=w({credentialId:e,since:s},o.length>0),l=c.data?.samples??[],d=c.data?.gatewayRates??[];return Z(O,{$gap:4,children:a.map(e=>Z(je,{window:e.window,estimate:e.estimate,since:e.since,samples:l.filter(t=>t.windowType===e.window.windowType&&t.observedAt>=(e.since??0)),gatewayRate:d.find(t=>t.windowType===e.window.windowType),pollIntervalMs:r,now:i},e.window.windowType))})}function je({window:t,estimate:n,since:r,samples:i,gatewayRate:a,pollIntervalMs:o,now:s}){let c=t.limit===null?`${e(t.used)} used`:`${e(t.used)} of ${e(t.limit)} used`,l=C(t,s),d=n===void 0||p(t,s,o)||n.stale&&!l;return Z(me,{live:u(t),samples:i.map(u),since:r,now:s,ratePerHourRatio:T(t,n),exhaustsAt:n?.exhaustsAt??null,survives:n?.survives??null,stale:d,rolledOver:l,spent:c,rateText:n?.ratePerHour===void 0||n.ratePerHour===null?`unknown`:`${e(n.ratePerHour)}/h`,extraFact:Z(ge,{legend:`This gateway accounts for`,value:a?.gatewayRatePerHour===void 0||a.gatewayRatePerHour===null?`unknown`:`${e(a.gatewayRatePerHour)} tokens/h`})})}var Me=$(P)`
21
- border-left: 3px solid ${({$provider:e})=>R(e)};
22
- `,Ne=$(W)`
23
- width: 100%;
24
- min-width: 140px;
25
- height: 26px;
26
- font-family: ${({theme:e})=>e.font.sans};
27
- font-size: 12.5px;
28
- background: transparent;
29
- border-color: transparent;
30
-
31
- &:hover:not(:disabled),
32
- &:focus {
33
- background: ${({theme:e})=>e.color.panelSunk};
34
- border-color: ${({theme:e})=>e.color.ruleStrong};
35
- }
36
- `,Pe=$(ue)`
37
- width: 62px;
38
- height: 26px;
39
- `,Fe=$.span`
40
- display: block;
41
- padding-left: 9px;
42
- font-size: 11px;
43
- color: ${({theme:e})=>e.color.inkDim};
44
- `,Ie=$.div`
45
- display: grid;
46
- /* Bar, figure, legend. The figure has a column of its own so the legends stay
47
- aligned down the stack whether a window reads 4% or 100%. */
48
- grid-template-columns: 96px 34px 1fr;
49
- align-items: center;
50
- min-width: 208px;
51
- gap: 6px;
52
- `,Le=$(k)`
53
- font-size: 11px;
54
- text-align: right;
55
- `,Re=$.div`
56
- display: flex;
57
- flex-direction: column;
58
- gap: 4px;
59
- `;function ze(){let e=t();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function Be(e,t){if(t===void 0)return` The list of models could not be read, so whether any target is pinned to this account is unknown.`;let n=t.filter(t=>t.targets.some(t=>t.credentialId===e.id)).map(e=>e.id);return n.length===0?``:` ${n.length===1?`The model`:`The models`} ${n.join(`, `)} ${n.length===1?`pins a target`:`pin targets`} to this account. Those targets will fail rather than fall back to another account.`}function Ve(){let{cadence:e}=I(),t=h(),c=f(e(1e4,`res:credentials`)),l=i(),u=te(),p=n(),_=m(),{commit:y}=ze(),[C,w]=Y(!1),[T,k]=Y(null),[N,L]=Y(new Set),ie=e=>L(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),R=Date.now(),V=t.data??[],U=p.data??[],W=e=>a(U,e)?.order??1/0,ue=[...new Set(V.map(e=>e.provider))].sort((e,t)=>W(e)-W(t)),G=e=>a(U,e)?.label??e,me=d(c.data?.health??[],e=>e.credentialId),he=d(c.data?.quota??[],e=>e.credentialId),ge=d(c.data?.burn??[],e=>e.credentialId),J=l.data?.quotaPollIntervalMs??3e5,ve=V.filter(e=>e.enabled).length,$=t.isLoading?`Reading connected accounts…`:V.length===0?`No provider credentials are connected, so every request fails at the router.`:`${ve} of ${V.length} accounts are enabled and eligible for routing.`;return Q(X,{children:[Z(B,{legend:`Accounts`,title:`Provider accounts`,summary:$,actions:Q(D,{type:`button`,$variant:`primary`,onClick:()=>w(!0),children:[Z(oe,{}),`Connect an account`]})}),t.isError?Z(P,{legend:`Accounts`,children:Z(ne,{error:t.error,onRetry:()=>void t.refetch()})}):t.isLoading?Z(P,{legend:`Accounts`,children:Z(A,{rows:5})}):V.length===0?Z(P,{legend:`Accounts`,children:Z(re,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:Z(D,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>w(!0),children:`Connect an account`})})}):Z(O,{$gap:4,children:ue.map(e=>{let t=V.filter(t=>t.provider===e);return Z(Me,{$provider:e,legend:G(e),meta:`${t.length} account${t.length===1?``:`s`}`,flush:!0,children:Z(j,{children:Q(pe,{children:[Z(`thead`,{children:Q(`tr`,{children:[Z(q,{$width:`24%`,children:`Account`}),Z(q,{$width:`20%`,children:`Sign-in`}),Z(q,{$align:`right`,$width:`86px`,children:`Tier`}),Z(q,{$align:`right`,$width:`94px`,children:`Weight`}),Z(q,{$align:`center`,$width:`86px`,children:`Enabled`}),Z(q,{$width:`240px`,children:`Quota`}),Z(q,{$align:`right`,$width:`88px`,children:`TTFT`}),Z(q,{$align:`right`,$width:`130px`,children:`Token expires`}),Z(q,{$width:`76px`})]})}),Z(`tbody`,{children:t.map(e=>{let t=b(me.get(e.id)??[],R,e.enabled,e.disabledReason),n=he.get(e.id)??[],i=ge.get(e.id)??[],a=S(n),c=N.has(e.id);return Q(_e,{children:[Q(fe,{children:[Q(K,{children:[Q(F,{$gap:2,children:[Z(x,{state:t.state,label:t.note===``?`healthy`:t.note}),Z(Ne,{defaultValue:e.label,"aria-label":`Label for ${e.label}`,onBlur:t=>{let n=t.target.value.trim();if(n.length===0||n===e.label){t.target.value=e.label;return}y(e.id,{label:n})}})]}),t.note===``?null:Z(Fe,{children:t.note})]}),Z(K,{children:Q(F,{$gap:1,children:[Z(le,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:Z(M,{children:e.accountEmail})]})}),Z(K,{$align:`right`,children:Z(Pe,{min:1,step:1,defaultValue:e.tier,"aria-label":`Tier for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isInteger(n)||n<1||n===e.tier){t.target.value=String(e.tier);return}y(e.id,{tier:n})}})}),Z(K,{$align:`right`,children:Z(Pe,{min:.1,step:.1,defaultValue:e.weight,"aria-label":`Weight for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isFinite(n)||n<=0||n===e.weight){t.target.value=String(e.weight);return}y(e.id,{weight:n})}})}),Z(K,{$align:`center`,children:Z(ce,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>y(e.id,{enabled:t})})}),Z(K,{children:a.length===0?Z(M,{children:`unknown`}):Z(Re,{children:a.map(({window:e,fraction:t})=>Q(Ie,{children:[Z(de,{fraction:t,label:`${g[e.windowType]} window, ${Math.round(t*100)}% used`}),Z(Le,{children:s(t,0)}),Z(M,{children:ee(e,R,J,r,v(i,e.windowType))})]},e.windowType))})}),Z(K,{$align:`right`,$mono:!0,children:o(t.ttftMs)}),Z(K,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:r(e.expiresAt,R)}),Z(K,{$align:`right`,children:Q(F,{$gap:1,$justify:`flex-end`,children:[n.length===0?null:Z(E,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":c,"aria-label":`${c?`Hide`:`Show`} quota history for ${e.label}`,title:`${c?`Hide`:`Show`} quota history for ${e.label}`,onClick:()=>ie(e.id),children:Z(c?H:ae,{})}),Z(E,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>k(e),children:Z(se,{})})]})})]}),c?Z(fe,{children:Z(K,{colSpan:9,children:Z(Ae,{credentialId:e.id,windows:n,burn:i,pollIntervalMs:J,now:R})})}):null]},e.id)})})]})})},e)})}),Z(ke,{open:C,credentials:t.data??[],onOpenChange:w,onConnected:()=>void t.refetch()}),Z(z,{open:T!==null,onOpenChange:e=>{e||k(null)},title:`Remove account`,body:T===null?``:`Removing "${T.label}" deletes its stored token. Any model target pointing at ${G(T.provider)} loses this account, and reconnecting means authorizing again.`+Be(T,u.data),confirmLabel:`Remove account`,busy:_.isPending,onConfirm:()=>{T!==null&&_.mutate(T.id,{onSettled:()=>k(null)})}})]})}var He=Ve;export{He as component};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app.plugins._pluginId-jaswB8Z5.js","assets/Lamp-DN2EKL4m.js","assets/Panel-BCpZVY4U.js","assets/preload-helper-CD37DT-E.js","assets/Rack-B03tpeW-.js"])))=>i.map(i=>d[i]);
2
- import{n as e,r as t,t as n}from"./preload-helper-CD37DT-E.js";var r=t(`/_app/plugins/$pluginId`)({component:e(()=>n(()=>import(`./_app.plugins._pluginId-jaswB8Z5.js`),__vite__mapDeps([0,1,2,3,4])),`component`)});export{r as t};