omnigateway 0.8.1 → 0.9.0

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 (47) hide show
  1. package/README.md +7 -0
  2. package/bin/omni.js +23 -2
  3. package/gateway.js +10 -0
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-BZWa7onX.js → Chip-shturdCv.js} +1 -1
  6. package/public/assets/{CopyValue-Cs2JUZQD.js → CopyValue-BGt9RRTL.js} +1 -1
  7. package/public/assets/{Field-DK5zaBVA.js → Field-DcNu4yw-.js} +1 -1
  8. package/public/assets/Lamp-CVGUT2YK.js +25 -0
  9. package/public/assets/{Panel-CYQvfI3L.js → Panel-BlNr9j6-.js} +3 -1
  10. package/public/assets/{Rack-CRuJZY00.js → Rack-BbZyyu2u.js} +5 -5
  11. package/public/assets/{Readout-D6-aurU8.js → Readout-D8Ofl3Gz.js} +1 -1
  12. package/public/assets/{RequestTable-D9hFf4o5.js → RequestTable-huSAoNZg.js} +1 -1
  13. package/public/assets/{SummaryDeck-D29h0rFx.js → SummaryDeck-BPo2bMSC.js} +1 -1
  14. package/public/assets/{Toggle-BIHUR4pS.js → Toggle-C84xs_YB.js} +1 -1
  15. package/public/assets/{TokenBreakdown-D5mQFSfo.js → TokenBreakdown-CmzXuENj.js} +1 -1
  16. package/public/assets/{WindowChart-DVl7kwqb.js → WindowChart-BZzVrxYk.js} +1 -1
  17. package/public/assets/{_app-BWNEo1e-.js → _app-CWXzHdhc.js} +1 -1
  18. package/public/assets/_app.accounts-DMmtkwnl.js +59 -0
  19. package/public/assets/{_app.console-Bvo2fugd.js → _app.console-BBz3kCPV.js} +1 -1
  20. package/public/assets/_app.database-ZvtMVgsh.js +24 -0
  21. package/public/assets/{_app.index-CgI1OrZR.js → _app.index-DKouD-rz.js} +5 -5
  22. package/public/assets/{_app.keys-CcfPhvCD.js → _app.keys-BG9-zfh6.js} +5 -5
  23. package/public/assets/{_app.logs-C8ZiArCn.js → _app.logs-DjinYGYS.js} +2 -2
  24. package/public/assets/{_app.models-nfMWzVb4.js → _app.models-BCfQVuoT.js} +5 -5
  25. package/public/assets/_app.plugins._pluginId-B9k5eqAt.js +2 -0
  26. package/public/assets/{_app.plugins._pluginId-CE8Jknhs.js → _app.plugins._pluginId-Dm48f3wz.js} +1 -1
  27. package/public/assets/{_app.settings-C45FJLeX.js → _app.settings-C42ylcNP.js} +4 -4
  28. package/public/assets/{_app.usage-C5s-DfBV.js → _app.usage-DfPM6eQ-.js} +3 -3
  29. package/public/assets/{chevron-right-B7JOx5ra.js → chevron-right-HI_fK6Gw.js} +1 -1
  30. package/public/assets/client-TUf0nuim.js +39 -0
  31. package/public/assets/index-C66Zn0tX.js +13 -0
  32. package/public/assets/login-DWgivEPK.js +2 -0
  33. package/public/assets/{login-DvRXHEGv.js → login-w-hVstKf.js} +2 -2
  34. package/public/assets/plus-BCf2TPqz.js +1 -0
  35. package/public/assets/{preload-helper-D2sCuvIY.js → preload-helper-Unv7FI91.js} +1 -1
  36. package/public/assets/{shared-BKWNmsjH.js → shared-XRnr7At9.js} +1 -1
  37. package/public/assets/{stream-BUWwtwme.js → stream-3PafhwhZ.js} +1 -1
  38. package/public/assets/{trash-2-rvGFhAn8.js → trash-2-Bq4GaXzx.js} +1 -1
  39. package/public/index.html +8 -8
  40. package/public/assets/Lamp-BHYJpauE.js +0 -25
  41. package/public/assets/_app.accounts-C3Yv991L.js +0 -59
  42. package/public/assets/_app.database-CfWNOIl-.js +0 -24
  43. package/public/assets/_app.plugins._pluginId-ByykviWs.js +0 -2
  44. package/public/assets/client-DvN2dbYV.js +0 -39
  45. package/public/assets/index-BW1O9p6N.js +0 -13
  46. package/public/assets/login-9Ovj_4DV.js +0 -2
  47. package/public/assets/plus-64jUPIDJ.js +0 -1
package/README.md CHANGED
@@ -388,6 +388,7 @@ Use `--db <path>` to point one command somewhere else.
388
388
  | `omni db backup` / `snapshots` | take a snapshot, and list the ones retention has kept |
389
389
  | `omni db restore <id>` | put a snapshot back; shows a live-vs-snapshot count table, then asks. `--dry-run` shows the table and stops |
390
390
  | `omni db vacuum` | rewrite the database, reclaiming the pages deletion left free |
391
+ | `omni db clear-bodies` | delete every captured request and response body; the requests stay logged |
391
392
 
392
393
  Two worth knowing:
393
394
 
@@ -716,6 +717,12 @@ for the rewrite, so a busy gateway stalls on its writes until it finishes — bu
716
717
  nothing is lost by running it live, and it reports what it actually gave back to
717
718
  the filesystem.
718
719
 
720
+ **Clearing bodies.** `omni db clear-bodies`, or the Database screen's *Clear
721
+ bodies*, deletes every captured prompt and completion on either engine — the
722
+ files beside a SQLite database, the `request_bodies` rows on Postgres. The
723
+ requests stay in the log with their bodies marked pruned. There is no undo:
724
+ bodies are never in a snapshot.
725
+
719
726
  ## Docker
720
727
 
721
728
  ```bash
package/bin/omni.js CHANGED
@@ -25439,6 +25439,11 @@ async function restoreSnapshot(deps, id) {
25439
25439
  return withExclusive("a restore", () => swapIn(deps, { path, consume: false }));
25440
25440
  }
25441
25441
  var MAX_IMPORT_BYTES = 2 * 1024 * 1024 * 1024;
25442
+ async function clearBodies(deps) {
25443
+ const removed = await deps.store.bodies.prune(deps.now());
25444
+ const orphans = await deps.store.bodies.sweepOrphans();
25445
+ return { removed, orphans };
25446
+ }
25442
25447
  async function vacuum(deps) {
25443
25448
  return withExclusive("a vacuum", async () => {
25444
25449
  const before = deps.fs.stat(deps.store.databasePath)?.size ?? 0;
@@ -28592,6 +28597,21 @@ var dbVacuum = {
28592
28597
  ]));
28593
28598
  }
28594
28599
  };
28600
+ var dbClearBodies = {
28601
+ usage: "db clear-bodies",
28602
+ summary: "Delete every captured request and response body; the requests stay logged",
28603
+ async run(_args, env2) {
28604
+ const { ctx, writer, prompt } = env2;
28605
+ if (!await prompt.confirm("delete every captured body? there is no snapshot of them")) {
28606
+ throw new CliError("cancelled");
28607
+ }
28608
+ const result = await clearBodies(await database(env2));
28609
+ emit(ctx, writer, result, () => fields([
28610
+ ["removed", String(result.removed)],
28611
+ ["orphaned files removed", String(result.orphans)]
28612
+ ]));
28613
+ }
28614
+ };
28595
28615
  function previewTable(preview) {
28596
28616
  const live = preview.live;
28597
28617
  const names = [...new Set([...Object.keys(preview.snapshot), ...Object.keys(live ?? {})])].sort();
@@ -29369,7 +29389,7 @@ function createServiceDeps(input) {
29369
29389
  }
29370
29390
 
29371
29391
  // apps/cli/src/version.ts
29372
- var VERSION = "0.8.1";
29392
+ var VERSION = "0.9.0";
29373
29393
 
29374
29394
  // apps/cli/src/commands/service.ts
29375
29395
  function gatewayArgv(root) {
@@ -30029,7 +30049,8 @@ var COMMANDS = {
30029
30049
  "db snapshots": dbSnapshots,
30030
30050
  "db backup": dbBackup,
30031
30051
  "db restore": dbRestore,
30032
- "db vacuum": dbVacuum
30052
+ "db vacuum": dbVacuum,
30053
+ "db clear-bodies": dbClearBodies
30033
30054
  };
30034
30055
  var VALUED_GLOBALS = new Set(["--root", "--db"]);
30035
30056
  function resolveCommand(argv) {
package/gateway.js CHANGED
@@ -31051,6 +31051,11 @@ async function importSnapshot(deps, input) {
31051
31051
  }
31052
31052
  });
31053
31053
  }
31054
+ async function clearBodies(deps) {
31055
+ const removed = await deps.store.bodies.prune(deps.now());
31056
+ const orphans = await deps.store.bodies.sweepOrphans();
31057
+ return { removed, orphans };
31058
+ }
31054
31059
  async function vacuum(deps) {
31055
31060
  return withExclusive("a vacuum", async () => {
31056
31061
  const before = deps.fs.stat(deps.store.databasePath)?.size ?? 0;
@@ -48773,6 +48778,11 @@ function databaseRoutes(deps) {
48773
48778
  durationMs: result.durationMs
48774
48779
  });
48775
48780
  return { ok: true, ...result };
48781
+ }).delete("/api/database/bodies", async ({ request: request2 }) => {
48782
+ await requireAdmin(request2, deps.admin);
48783
+ const result = await clearBodies(database);
48784
+ logger2.info("captured bodies cleared", { count: result.removed });
48785
+ return { ok: true, ...result };
48776
48786
  }).get("/api/database/snapshots", async ({ request: request2 }) => {
48777
48787
  await requireAdmin(request2, deps.admin);
48778
48788
  return { snapshots: listSnapshots(database) };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnigateway",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Self-hosted AI gateway with Anthropic- and OpenAI-compatible APIs, an admin console, and a CLI",
5
5
  "license": "MIT",
6
6
  "author": "Harismawan <mail@harismawan.com>",
@@ -1,4 +1,4 @@
1
- import{m as e}from"./Rack-CRuJZY00.js";import{jsx as t}from"react/jsx-runtime";import n from"styled-components";var r={neutral:{fg:`var(--ink-dim)`,bg:`transparent`},ok:{fg:`var(--ok)`,bg:`var(--ok-wash)`},warn:{fg:`var(--warn)`,bg:`var(--warn-wash)`},down:{fg:`var(--down)`,bg:`var(--down-wash)`},accent:{fg:`var(--accent)`,bg:`var(--accent-wash)`}},i=n.span`
1
+ import{m as e}from"./Rack-BbZyyu2u.js";import{jsx as t}from"react/jsx-runtime";import n from"styled-components";var r={neutral:{fg:`var(--ink-dim)`,bg:`transparent`},ok:{fg:`var(--ok)`,bg:`var(--ok-wash)`},warn:{fg:`var(--warn)`,bg:`var(--warn-wash)`},down:{fg:`var(--down)`,bg:`var(--down-wash)`},accent:{fg:`var(--accent)`,bg:`var(--accent-wash)`}},i=n.span`
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  gap: 4px;
@@ -1,4 +1,4 @@
1
- import{C as e,O as t}from"./Panel-CYQvfI3L.js";import{b as n}from"./Rack-CRuJZY00.js";import{useCallback as r,useEffect as i,useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import l from"styled-components";var u=n(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),d=n(`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`}]]);function f(e){if(e===null||typeof getSelection!=`function`)return!1;let t=getSelection();if(t===null)return!1;try{let n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),!0}catch{return!1}}async function p(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=f(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var m=l.div`
1
+ import{C as e,O as t}from"./Panel-BlNr9j6-.js";import{b as n}from"./Rack-BbZyyu2u.js";import{useCallback as r,useEffect as i,useRef as a,useState as o}from"react";import{jsx as s,jsxs as c}from"react/jsx-runtime";import l from"styled-components";var u=n(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),d=n(`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`}]]);function f(e){if(e===null||typeof getSelection!=`function`)return!1;let t=getSelection();if(t===null)return!1;try{let n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),!0}catch{return!1}}async function p(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=f(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var m=l.div`
2
2
  display: flex;
3
3
  align-items: stretch;
4
4
  gap: 0;
@@ -1,4 +1,4 @@
1
- import{_ as e}from"./Panel-CYQvfI3L.js";import{useId as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";import i from"styled-components";var a=`
1
+ import{_ as e}from"./Panel-BlNr9j6-.js";import{useId as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";import i from"styled-components";var a=`
2
2
  width: 100%;
3
3
  border-radius: 3px;
4
4
  transition: border-color 120ms ease;
@@ -0,0 +1,25 @@
1
+ import{c as e,d as t,f as n,k as r,l as i,m as a,p as o,u as s}from"./Panel-BlNr9j6-.js";import{queryOptions as c,useMutation as l,useQuery as u,useQueryClient as d}from"@tanstack/react-query";import*as f from"react";import p,{useCallback as m,useDebugValue as h,useEffect as g,useMemo as _,useRef as v,useSyncExternalStore as y}from"react";import{jsx as b}from"react/jsx-runtime";import{flushSync as ee}from"react-dom";import x,{css as S,keyframes as C}from"styled-components";var w=f.use,T=f.useLayoutEffect;function te(e,t,n={},r){f.useEffect(()=>{if(!e.current||r||typeof IntersectionObserver!=`function`)return;let i=new IntersectionObserver(([e])=>{t(e)},n);return i.observe(e.current),()=>{i.disconnect()}},[t,r,n,e])}function ne(e){let t=f.useRef(null);return f.useImperativeHandle(e,()=>t.current,[]),t}function E(e){return e[e.length-1]}function D(e){return typeof e==`function`}function re(e,t){return D(e)?e(t):e}var O=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;function ae(e){for(let t in e)if(O.call(e,t))return!0;return!1}var oe=()=>Object.create(null),se=(e,t)=>ce(e,t,oe);function ce(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=de(e)&&de(i);if(!a&&!(k(e)&&k(i)))return i;let o=a?e:le(e);if(!o)return i;let s=a?i:le(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:O.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=ce(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function le(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!ie.call(e,r))return!1;t.push(r)}return t}function k(e){if(!ue(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ue(n)||!n.hasOwnProperty(`isPrototypeOf`))}function ue(e){return Object.prototype.toString.call(e)===`[object Object]`}function de(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function A(e,t,n){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!A(e[r],t[r],n))return!1;return!0}if(k(e)&&k(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!A(e[i],t[i],n))return!1;return!0}let i=0;if(!r)i=Object.keys(e).length;else for(let t in e)e[t]!==void 0&&i++;let a=0;for(let o in t)if((!r||t[o]!==void 0)&&(a++,a>i||!A(e[o],t[o],n)))return!1;return i===a}return!1}function fe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var j=/[\x00-\x1f\x7f"<>`{}]/g;function pe(e){return e.replace(j,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function me(e){let t;try{t=decodeURI(e)}catch{t=e.replaceAll(/%[0-9A-F]{2}/gi,e=>{try{return decodeURI(e)}catch{return e}})}return pe(t)}var he=[`http:`,`https:`,`mailto:`,`tel:`];function M(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function ge(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=me(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=me(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function _e(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function N(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function P(){throw Error(`Invariant failed`)}function F(e){let t=new Map,n,r,i=e=>{e.next&&(e.prev?(e.prev.next=e.next,e.next.prev=e.prev,e.next=void 0,r&&(r.next=e,e.prev=r)):(e.next.prev=void 0,n=e.next,e.next=void 0,r&&(e.prev=r,r.next=e)),r=e)};return{get(e){let n=t.get(e);if(n)return i(n),n.value},set(a,o){if(t.size>=e&&n){let e=n;t.delete(e.key),e.next&&(n=e.next,e.next.prev=void 0),e===r&&(r=void 0)}let s=t.get(a);if(s)s.value=o,i(s);else{let e={key:a,value:o,prev:r};r&&(r.next=e),r=e,n||=e,t.set(a,e)}},clear(){t.clear(),n=void 0,r=void 0}}}var I=4,L=5;function ve(e){let t=e.indexOf(`{`);if(t===-1)return null;let n=e.indexOf(`}`,t);return n===-1||t+1>=e.length?null:[t,n]}function ye(e,t,n=new Uint16Array(6)){let r=e.indexOf(`/`,t),i=r===-1?e.length:r,a=e.substring(t,i);if(!a||!a.includes(`$`))return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n;if(a===`$`){let r=e.length;return n[0]=2,n[1]=t,n[2]=t,n[3]=r,n[4]=r,n[5]=r,n}if(a.charCodeAt(0)===36)return n[0]=1,n[1]=t,n[2]=t+1,n[3]=i,n[4]=i,n[5]=i,n;let o=ve(a);if(o){let[r,s]=o,c=a.charCodeAt(r+1);if(c===45){if(r+2<a.length&&a.charCodeAt(r+2)===36){let e=r+3,a=s;if(e<a)return n[0]=3,n[1]=t+r,n[2]=t+e,n[3]=t+a,n[4]=t+s+1,n[5]=i,n}}else if(c===36){let a=r+1,o=r+2;return o===s?(n[0]=2,n[1]=t+r,n[2]=t+a,n[3]=t+o,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+r,n[2]=t+o,n[3]=t+s,n[4]=t+s+1,n[5]=i,n)}}return n[0]=0,n[1]=t,n[2]=t,n[3]=i,n[4]=i,n[5]=i,n}function R(e,t,n,r,i,a,o,s){s?.(n);let c=r;{let r=n.fullPath??n.from,s=n.options,l=r.length,u=s?.caseSensitive??e,d=s?.params?.parse??s?.parseParams;for(;c<l;){let e=ye(r,c,t),n,s=c,l=e[5];c=l+1,a++;let f=e[0];switch(f){case 0:{let t=r.substring(e[2],e[3]),o=t,s;u?s=i.static??=new Map:(o=t.toLowerCase(),s=i.staticInsensitive??=new Map);let c=s.get(o);if(c)n=c;else{let e=B(r);e.parent=i,e.depth=a,n=e,s.set(o,e)}break}case 1:case 3:case 2:{let t=r.substring(s,e[1]),c=r.substring(e[4],l),p=u&&!!(t||c),m=t?p?t:t.toLowerCase():void 0,h=c?p?c:c.toLowerCase():void 0,g=f===1?i.dynamic:f===3?i.optional:i.wildcard,_=f!==2&&!d&&g?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===m&&e.suffix===h);if(_)n=_;else{let e=V(f,r,p,m,h);n=e,e.parent=i,e.depth=a;let t;t=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],t.push(e),t.length===2&&o?.push(t)}break}}i=n}if(d&&n.children&&!n.isRoot&&n.id&&n.id.charCodeAt(n.id.lastIndexOf(`/`)+1)===95){let e=B(r);e.kind=L,e.parent=i,a++,e.depth=a,i.pathless??=[],i.pathless.push(e),i=e}let f=(n.path||!n.children)&&!n.isRoot;if(f&&r.endsWith(`/`)){let e=B(r);e.kind=I,e.parent=i,a++,e.depth=a,i.index=e,i=e}i.parse=d??null,i.priority=s?.params?.priority??0,f&&!i.route&&(i.route=n,i.fullPath=r)}if(n.children)for(let r of n.children)R(e,t,r,c,i,a,o,s)}function z(e,t){if(e.parse&&!t.parse)return-1;if(!e.parse&&t.parse)return 1;if(e.parse&&t.parse&&(e.priority||t.priority))return t.priority-e.priority;if(e.prefix&&t.prefix&&e.prefix!==t.prefix){if(e.prefix.startsWith(t.prefix))return-1;if(t.prefix.startsWith(e.prefix))return 1}if(e.suffix&&t.suffix&&e.suffix!==t.suffix){if(e.suffix.endsWith(t.suffix))return-1;if(t.suffix.endsWith(e.suffix))return 1}return e.prefix&&!t.prefix?-1:!e.prefix&&t.prefix?1:e.suffix&&!t.suffix?-1:!e.suffix&&t.suffix?1:e.caseSensitive&&!t.caseSensitive?-1:!e.caseSensitive&&t.caseSensitive?1:0}function B(e){return{kind:0,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:e,parent:null,parse:null,priority:0}}function V(e,t,n,r,i){return{kind:e,depth:0,pathless:null,index:null,static:null,staticInsensitive:null,dynamic:null,optional:null,wildcard:null,route:null,fullPath:t,parent:null,parse:null,priority:0,caseSensitive:n,prefix:r,suffix:i}}function H(e,t){let n=B(`/`),r=new Uint16Array(6),i=[];for(let t of e)R(!1,r,t,1,n,0,i);for(let e of i)e.sort(z);t.masksTree=n,t.flatCache=F(1e3)}function be(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Te(e,t.masksTree);return t.flatCache.set(e,r),r}function xe(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=B(`/`),R(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Te(r,o,n)}function Se(e,t,n=!1){let r=n?e:`nofuzz\0${e}`,i=t.matchCache.get(r);if(i!==void 0)return i;e||=`/`;let a;try{a=Te(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=De(a.route)),t.matchCache.set(r,a),a}function Ce(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function we(e,t=!1,n){let r=B(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;R(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&P(),o[e.id]=e,c!==0&&e.path){let t=Ce(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(z);return{processedTree:{segmentTree:r,singleCache:F(1e3),matchCache:F(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function Te(e,t,n=!1){let r=e.split(`/`),i=ke(e,r,t,n);if(!i)return null;let[a]=Ee(e,r,i);return{route:i.node.route,rawParams:a}}function Ee(e,t,n){let r=Oe(n.node),i=null,a=Object.create(null),o=n.extract?.part??0,s=n.extract?.node??0,c=n.extract?.path??0,l=n.extract?.segment??0;for(;s<r.length;o++,s++,c++,l++){let u=r[s];if(u.kind===I)break;if(u.kind===L){l--,o--,c--;continue}let d=t[o],f=c;if(d&&(c+=d.length),u.kind===1){i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0;if(e.charCodeAt(t)===123){let n=u.suffix?.length??0,r=e.substring(t+2,e.length-n-1),i=d.substring(t,d.length-n);a[r]=decodeURIComponent(i)}else{let t=e.substring(1);a[t]=decodeURIComponent(d)}}else if(u.kind===3){if(n.skipped&1<<s){o--,c=f-1;continue}i??=n.node.fullPath.split(`/`);let e=i[l],t=u.prefix?.length??0,r=u.suffix?.length??0,p=e.substring(t+3,e.length-r-1),m=u.suffix||u.prefix?d.substring(t,d.length-r):d;m&&(a[p]=decodeURIComponent(m))}else if(u.kind===2){let t=u,n=e.substring(f+(t.prefix?.length??0),e.length-(t.suffix?.length??0)),r=decodeURIComponent(n);a[`*`]=r,a._splat=r;break}}return n.rawParams&&Object.assign(a,n.rawParams),[a,{part:o,node:s,path:c,segment:l}]}function De(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Oe(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function ke(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!E(t),a=i&&e!==`/`,o=t.length-+!!i,s=[{node:n,index:1,skipped:0,statics:0,dynamics:0,optionals:0}],c=null,l=null;for(;s.length;){let n=s.pop(),{node:i,index:u,skipped:d,statics:f,dynamics:p,optionals:m}=n,{extract:h,rawParams:g}=n;if(i.kind===2&&i.route&&!W(l,n))continue;if(i.parse){if(!je(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==I&&W(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===I||i.kind===2)&&W(l,n)&&(l=n),!i.optional&&!i.wildcard&&!i.index&&!i.pathless))continue;let v=_?void 0:t[u],y;if(_&&i.index){let n={node:i.index,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g},r=!0;if(i.index.parse&&(je(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Ae(f,o))return n;W(l,n)&&(l=n)}}if(i.wildcard)for(let e=i.wildcard.length-1;e>=0;e--){let n=i.wildcard[e],{prefix:r,suffix:a}=n;if(!(r&&(_||!(n.caseSensitive?v:y??=v.toLowerCase()).startsWith(r)))){if(a){if(_)continue;let e=t.slice(u).join(`/`).slice(-a.length);if((n.caseSensitive?e:e.toLowerCase())!==a)continue}s.push({node:n,index:o,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(i.optional){let e=d|1<<i.depth+1;for(let t=i.optional.length-1;t>=0;t--){let n=i.optional[t];s.push({node:n,index:u,skipped:e,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_)for(let e=i.optional.length-1;e>=0;e--){let t=i.optional[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+U(o,u),extract:h,rawParams:g})}}if(!_&&i.dynamic&&v)for(let e=i.dynamic.length-1;e>=0;e--){let t=i.dynamic[e],{prefix:n,suffix:r}=t;if(n||r){let e=t.caseSensitive?v:y??=v.toLowerCase();if(n&&!e.startsWith(n)||r&&!e.endsWith(r))continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+U(o,u),optionals:m,extract:h,rawParams:g})}if(!_&&i.staticInsensitive){let e=i.staticInsensitive.get(y??=v.toLowerCase());e&&s.push({node:e,index:u+1,skipped:d,statics:f+U(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(!_&&i.static){let e=i.static.get(v);e&&s.push({node:e,index:u+1,skipped:d,statics:f+U(o,u),dynamics:p,optionals:m,extract:h,rawParams:g})}if(i.pathless)for(let e=i.pathless.length-1;e>=0;e--){let t=i.pathless[e];s.push({node:t,index:u,skipped:d,statics:f,dynamics:p,optionals:m,extract:h,rawParams:g})}}if(l)return l;if(r&&c){let n=c.index;for(let e=0;e<c.index;e++)n+=t[e].length;let r=n===e.length?`/`:e.slice(n);return c.rawParams??=Object.create(null),c.rawParams[`**`]=decodeURIComponent(r),c}return null}function U(e,t){return 2**(e-t-1)}function Ae(e,t){return e===2**(t-1)-1}function je(e,t,n){let r,i;try{[r,i]=Ee(e,t,n)}catch{return null}if(n.rawParams=r,n.extract=i,!n.node.parse)return!0;try{if(n.node.parse(r)===!1)return null}catch{}return!0}function W(e,t){return!e||t.statics>e.statics||t.statics===e.statics&&(t.dynamics>e.dynamics||t.dynamics===e.dynamics&&(t.optionals>e.optionals||t.optionals===e.optionals&&((t.node.kind===I)>(e.node.kind===I)||t.node.kind===I==(e.node.kind===I)&&t.node.depth>e.node.depth)))}function Me(e){return Ne(e.filter(e=>e!==void 0).join(`/`))}function Ne(e){return e.replace(/\/{2,}/g,`/`)}function Pe(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Fe(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Ie(e){return Fe(Pe(e))}function Le(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Re(e,t,n){return Le(e,n)===Le(t,n)}function ze({base:e,to:t,trailingSlash:n=`never`,cache:r}){let i=t===`.`,a=t.startsWith(`/`),o;if(r){o=a?t:i?e:e+`\0`+t;let n=r.get(o);if(n)return n}let s;if(i)s=e.split(`/`);else if(a)s=t.split(`/`);else{for(s=e.split(`/`);s.length>1&&E(s)===``;)s.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&s.push(r):s=[r]:r===`..`?s.length>1?s.pop():s=[``]:r===`.`||s.push(r)}}s.length>1&&(E(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=Ne(s.join(`/`))||`/`;return o&&r&&r.set(o,c),c}function Be(e){let t=new Map(e.map(e=>[encodeURIComponent(e),e])),n=Array.from(t.keys()).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`),r=new RegExp(n,`g`);return e=>e.replace(r,e=>t.get(e)??e)}function Ve(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Ue(e,n)).join(`/`):Ue(r,n):r}function He({path:e,params:t,decoder:n,...r}){let i=!1,a=Object.create(null);if(!e||e===`/`)return{interpolatedPath:`/`,usedParams:a,isMissingParams:i};if(!e.includes(`$`))return{interpolatedPath:e,usedParams:a,isMissingParams:i};let o=e.length,s=0,c,l=``;for(;s<o;){let r=s;c=ye(e,r,c);let o=c[5];if(s=o+1,r===o)continue;let u=c[0];if(u===0){l+=`/`+e.substring(r,o);continue}if(u===2){let s=t._splat;a._splat=s,a[`*`]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o);if(!s){i=!0,(u||d)&&(l+=`/`+u+d);continue}let f=Ve(`_splat`,t,n);l+=`/`+u+f+d;continue}if(u===1){let s=e.substring(c[2],c[3]);!i&&!(s in t)&&(i=!0),a[s]=t[s];let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ve(s,t,n)??`undefined`;l+=`/`+u+f+d;continue}if(u===3){let i=e.substring(c[2],c[3]),s=t[i];if(s==null)continue;a[i]=s;let u=e.substring(r,c[1]),d=e.substring(c[4],o),f=Ve(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Ue(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var We=`Error preloading route! ☝️`;function Ge({children:e,fallback:t=null}){return b(p.Fragment,{children:Ke()?e:t})}function Ke(){return p.useSyncExternalStore(qe,()=>!0,()=>!1)}function qe(){return()=>{}}function Je(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ye=typeof Object.is==`function`?Object.is:Je;function Xe(e,t,n,r,i){let a=v(null),o;a.current===null?(o={hasValue:!1,value:null},a.current=o):o=a.current;let[s,c]=_(()=>{let e=!1,a,s,c=t=>{if(!e){e=!0,a=t;let n=r(t);if(i!==void 0&&o.hasValue){let e=o.value;if(i(e,n))return s=e,e}return s=n,n}let n=s;if(Ye(a,t))return n;let c=r(t);return i?.(n,c)?(a=t,n):(a=t,s=c,c)},l=n===void 0?null:n;return[()=>c(t()),l===null?void 0:()=>c(l())]},[t,n,r,i,o]),l=y(e,s,c);return g(()=>{o.hasValue=!0,o.value=l},[l,o]),h(l),l}function Ze(e,t){return e===t}function Qe(e,t,n=Ze){let r=m(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=m(()=>e?.get(),[e]);return Xe(r,i,i,t,n)}function $e(e){let t=r();return f.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function et(e){let t=f.useRef(e);return A(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function tt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function nt(e,t,n){if(e?.external)return M(e.href,n)?void 0:e.href;if(!ft(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),M(t,n)?void 0:t}catch{}}function rt(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Re(e.pathname,t.pathname,r))return!1}else{let n=Le(e.pathname,r),i=Le(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!A(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function it(e,t){let n=r(),i=ne(t),{activeProps:a,inactiveProps:o,activeOptions:s,to:c,preload:l,preloadDelay:u,preloadIntentProximity:d,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:S,onClick:C,onBlur:w,onFocus:T,onMouseEnter:E,onMouseLeave:D,onTouchStart:O,ignoreBlocker:ie,params:ae,search:oe,hash:se,state:ce,mask:le,reloadDocument:k,unsafeRelative:ue,from:de,_fromLocation:A,...fe}=e,j=Ke(),pe=et(e.search),me=et(e.params),he=et(s),M=f.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,pe,me,e.state,e.mask,e.unsafeRelative]),ge=f.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...M}),r=dt(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,b),i=nt(r,c,n.protocolAllowlist);return[r?.href,i,rt(e,t,he,n.basepath,j,i!==void 0)]},[he,b,j,M,n,c]),[_e,N,P]=Qe(n.stores.location,ge,tt),F=P?re(a,{})??ot:at,I=P?at:re(o,{})??at,L=[S,F.className,I.className].filter(Boolean).join(` `),ve=(x||F.style||I.style)&&{...x,...F.style,...I.style},[ye,R]=f.useState(!1),z=f.useRef(!1),B=e.reloadDocument||N?!1:l??n.options.defaultPreload,V=u??n.options.defaultPreloadDelay??0,H=f.useCallback(()=>{n.preloadRoute(M).catch(e=>{console.warn(e),console.warn(We)})},[n,M]);te(i,f.useCallback(e=>{e?.isIntersecting&&H()},[H]),ut,!!b||B!==`viewport`),f.useEffect(()=>{z.current||!b&&B===`render`&&(H(),z.current=!0)},[b,H,B]);let be=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;if(!b&&!mt(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),ee(()=>{R(!0)});let t=n.subscribe(`onResolved`,()=>{t(),R(!1)});n.navigate({...M,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:ie})}};if(N)return{...fe,ref:i,href:N,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onBlur:w},...T&&{onFocus:T},...E&&{onMouseEnter:E},...D&&{onMouseLeave:D},...O&&{onTouchStart:O}};let xe=e=>{if(b||B!==`intent`)return;if(!V){H();return}let t=e.currentTarget;if(G.has(t))return;let n=setTimeout(()=>{G.delete(t),H()},V);G.set(t,n)},Se=e=>{b||B!==`intent`||H()},Ce=e=>{if(b||!B||!V)return;let t=e.currentTarget,n=G.get(t);n&&(clearTimeout(n),G.delete(t))};return{...fe,...F,...I,href:_e,ref:i,onClick:K([C,be]),onBlur:K([w,Ce]),onFocus:K([T,xe]),onMouseEnter:K([E,xe]),onMouseLeave:K([D,Ce]),onTouchStart:K([O,Se]),disabled:!!b,target:y,...ve&&{style:ve},...L&&{className:L},...b&&st,...P&&ct,...j&&ye&&lt}}var at={},ot={className:`active`},st={role:`link`,"aria-disabled":!0},ct={"data-status":`active`,"aria-current":`page`},lt={"data-transitioning":`transitioning`},G=new WeakMap,ut={rootMargin:`100px`},K=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function dt(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function ft(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var pt=f.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=it(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;return f.createElement(`a`,t,o)}return f.createElement(n,a,o)});function mt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var q={status:[`status`],credentials:[`credentials`],credentialHealth:[`credentials`,`health`],models:[`models`],keys:[`keys`],settings:[`settings`],agentSetup:(e,t)=>[`agent-setup`,e,t??null],usage:e=>[`usage`,e.grain??`raw`,e.groupBy,e.splitBy??null,e.since,e.until??null],quotaHistory:e=>[`quota-history`,e.credentialId,e.since,e.until??null],logs:e=>[`logs`,e],requestBody:e=>[`logs`,`body`,e],clientSummary:[`client`,`summary`],clientUsage:e=>[`client`,`usage`,e.grain??`raw`,e.groupBy,e.splitBy??null,e.since,e.until??null],clientLogs:e=>[`client`,`logs`,e],clientQuota:[`client`,`quota`],clientQuotaHistory:e=>[`client`,`quota-history`,e.since,e.until??null],console:(e,t,n)=>[`console`,e,t,n],nodes:[`nodes`],database:[`database`],snapshots:[`database`,`snapshots`],lifecycle:[`lifecycle`],plugins:[`plugins`],catalog:[`catalog`]},ht=c({queryKey:q.catalog,queryFn:async({signal:e})=>{let{providers:t}=await i(`/api/catalog`,e);return[...t].sort((e,t)=>e.order-t.order)},staleTime:3e5});function gt(){return u(ht)}function _t(e,t){return e.find(e=>e.id===t)}function vt(){return u({queryKey:q.status,queryFn:({signal:e})=>i(`/api/status`,e),staleTime:3e4})}function yt(){return u({queryKey:q.credentials,queryFn:async({signal:e})=>(await i(`/api/credentials`,e)).credentials})}function bt(e=1e4){return u({queryKey:q.credentialHealth,queryFn:({signal:e})=>i(`/api/credentials/health`,e),refetchInterval:e})}function xt(e,t=!0){return u({queryKey:q.quotaHistory(e),enabled:t,queryFn:({signal:t})=>i(a(`/api/credentials/quota/history`,{credentialId:e.credentialId,since:e.since,...e.until===void 0?{}:{until:e.until}}),t),refetchInterval:!1})}function St(){return u({queryKey:q.models,queryFn:async({signal:e})=>(await i(`/api/models`,e)).models})}function Ct(){return u({queryKey:q.keys,queryFn:async({signal:e})=>(await i(`/api/keys`,e)).keys})}var wt={queryKey:q.settings,queryFn:({signal:e})=>i(`/api/settings`,e)};function Tt(){return u({...wt,select:e=>e.settings})}function Et(){return u({...wt,select:e=>e.bodyLoggingAllowed&&e.settings.bodyLoggingEnabled})}function Dt(){return u({...wt,select:e=>e.bodyLoggingAllowed})}function Ot(e,t){return u({queryKey:q.agentSetup(e,t),enabled:t!==void 0,queryFn:async({signal:n})=>(await i(a(`/api/agent-setup`,{client:e,...t??{}}),n)).files})}function kt(e,t=6e4){return u({queryKey:q.usage(e),queryFn:async({signal:t})=>(await i(a(`/api/usage`,{groupBy:e.groupBy,since:e.since,...e.grain===void 0?{}:{grain:e.grain},...e.splitBy===void 0?{}:{splitBy:e.splitBy},...e.until===void 0?{}:{until:e.until}}),t)).rows,refetchInterval:t})}var At=2e3;function jt(e=100,t=At){return u({queryKey:q.logs(e),queryFn:async({signal:t})=>(await i(a(`/api/logs`,{limit:e}),t)).logs,refetchInterval:t})}function Mt(e){return u({queryKey:q.requestBody(e??``),enabled:e!==null,queryFn:({signal:t})=>i(`/api/requests/${encodeURIComponent(e??``)}/body`,t),refetchInterval:!1})}var Nt=5e3;function Pt(e=200,t=``,n=Nt,r=``){return u({queryKey:q.console(e,t,r),queryFn:async({signal:n})=>i(a(`/api/console`,{lines:e,...t===``?{}:{level:t},...r===``?{}:{node:r}}),n),refetchInterval:n})}var Ft=3e4;function It(){return u({queryKey:q.nodes,queryFn:async({signal:e})=>i(`/api/nodes`,e),refetchInterval:Ft})}function Lt(){return u({queryKey:q.database,queryFn:({signal:e})=>i(`/api/database`,e),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:1/0})}function Rt(e){return`/api/database/snapshots/${encodeURIComponent(e)}/download`}function zt(){return u({queryKey:q.snapshots,queryFn:async({signal:e})=>(await i(`/api/database/snapshots`,e)).snapshots,refetchInterval:!1})}function J(e){e.invalidateQueries({queryKey:q.database})}function Bt(){let e=d();return l({mutationFn:()=>t(`/api/database/snapshots`),onSuccess:()=>J(e)})}function Vt(){let e=d();return l({mutationFn:e=>n(`/api/database/retention`,e),onSuccess:()=>{J(e),e.invalidateQueries({queryKey:q.settings})}})}function Ht(){let e=d();return l({mutationFn:()=>t(`/api/database/vacuum`),onSuccess:()=>J(e)})}function Ut(){let t=d();return l({mutationFn:()=>e(`/api/database/bodies`),onSuccess:()=>{J(t),t.invalidateQueries({queryKey:[`logs`]})}})}function Wt(){let t=d();return l({mutationFn:t=>e(`/api/database/snapshots/${encodeURIComponent(t)}`),onSuccess:()=>J(t)})}function Gt(){return l({mutationFn:e=>t(`/api/database/snapshots/${encodeURIComponent(e)}/restore`)})}function Kt(){return l({mutationFn:e=>t(`/api/database/import`,e)})}function qt(){return u({queryKey:q.lifecycle,queryFn:({signal:e})=>i(`/api/lifecycle`,e),refetchInterval:!1})}function Jt(){return l({mutationFn:()=>t(`/api/lifecycle/restart`)})}function Yt(){return l({mutationFn:()=>t(`/api/lifecycle/shutdown`)})}function Xt(){let e=d();return l({mutationFn:({mode:e,secret:n})=>e===`client`?t(`/api/client/login`,{key:n}):t(`/api/login`,{password:n,...e===`viewer`?{mode:`viewer`}:{}}),onSuccess:()=>e.invalidateQueries()})}function Zt(){let e=d();return l({mutationFn:e=>t(`/api/setup`,{password:e}),onSuccess:()=>e.invalidateQueries()})}function Qt(){let e=d();return l({mutationFn:()=>t(`/api/logout`),onSuccess:()=>{e.clear()}})}function $t(){let e=d();return l({mutationFn:()=>t(`/api/client/logout`),onSuccess:()=>e.clear()})}function en(){return u({queryKey:q.clientSummary,queryFn:({signal:e})=>i(`/api/client/summary`,e)})}function tn(e,t=6e4){return u({queryKey:q.clientUsage(e),queryFn:({signal:t})=>i(a(`/api/client/usage`,{groupBy:e.groupBy,since:e.since,...e.grain===void 0?{}:{grain:e.grain},...e.splitBy===void 0?{}:{splitBy:e.splitBy},...e.until===void 0?{}:{until:e.until}}),t),refetchInterval:t})}function nn(e=100,t=At){return u({queryKey:q.clientLogs(e),queryFn:async({signal:t})=>(await i(a(`/api/client/logs`,{limit:e}),t)).logs,refetchInterval:t})}function rn(e=6e4){return u({queryKey:q.clientQuota,queryFn:async({signal:e})=>(await i(`/api/client/quota`,e)).accounts,refetchInterval:e})}function an(e,t=!0){return u({queryKey:q.clientQuotaHistory(e),enabled:t,queryFn:({signal:t})=>i(a(`/api/client/quota/history`,{since:e.since,...e.until===void 0?{}:{until:e.until}}),t),refetchInterval:3e5})}function on(){let e=d();return l({mutationFn:({id:e,patch:t})=>s(`/api/credentials/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:q.credentials}),e.invalidateQueries({queryKey:q.credentialHealth})}})}function sn(){let t=d();return l({mutationFn:t=>e(`/api/credentials/${t}`),onSuccess:()=>{t.invalidateQueries({queryKey:q.credentials}),t.invalidateQueries({queryKey:q.credentialHealth})}})}function cn(){let e=d();return l({mutationFn:e=>n(`/api/models/${e.id}`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.models})})}function ln(){let t=d();return l({mutationFn:t=>e(`/api/models/${t}`),onSuccess:()=>t.invalidateQueries({queryKey:q.models})})}function un(){return l({mutationFn:({modelId:e,need:n})=>t(`/api/models/${e}/dry-run`,n)})}function dn(){let e=d();return l({mutationFn:e=>t(`/api/keys`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.keys})})}function fn(){let e=d();return l({mutationFn:({id:e,limits:t})=>n(`/api/keys/${e}/limits`,{limits:t}),onSuccess:()=>e.invalidateQueries({queryKey:q.keys})})}function pn(){let e=d();return l({mutationFn:({id:e,modelAllowlist:t})=>n(`/api/keys/${e}/models`,{modelAllowlist:t}),onSuccess:()=>e.invalidateQueries({queryKey:q.keys})})}function mn(){let t=d();return l({mutationFn:t=>e(`/api/keys/${t}`),onSuccess:()=>t.invalidateQueries({queryKey:q.keys})})}function hn(){let e=d();return l({mutationFn:e=>n(`/api/settings`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.settings})})}function gn(){return l({mutationFn:e=>n(`/api/settings/password`,e)})}function _n(){let e=d();return l({mutationFn:e=>n(`/api/settings/viewer-password`,{password:e}),onSuccess:()=>e.invalidateQueries({queryKey:q.status})})}function vn(){return l({mutationFn:e=>t(`/api/connect/start`,e)})}function yn(){let e=d();return l({mutationFn:e=>t(`/api/credentials`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.credentials})})}function bn(){let e=d();return l({mutationFn:e=>t(`/api/connect/finish`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.credentials})})}function xn(){return u({queryKey:q.plugins,queryFn:async({signal:e})=>(await i(`/api/plugins`,e)).plugins,staleTime:3e5})}async function Sn(e){let t=await o(`/api/connect/poll`,{method:`POST`,body:{flowId:e},accept:[202]});return t.status===202?{status:`pending`}:t.data}var Cn=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),wn=new Intl.NumberFormat(`en-US`);function Tn(e){return Number.isFinite(e)?e<1e4?wn.format(Math.round(e)):Cn.format(e).toLowerCase():`—`}function En(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${Cn.format(e).toLowerCase()}`:`—`}function Dn(e){return e==null||!Number.isFinite(e)?`—`:e<1e3?`${Math.round(e)}ms`:e<6e4?`${(e/1e3).toFixed(1)}s`:`${Math.round(e/6e4)}m`}function On(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var kn=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function Y(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=kn.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function An(e,t=Date.now()){if(e==null||!Number.isFinite(e))return`—`;let n=e-t;return Math.abs(n)<5e3?`just now`:n<0?`${Y(n)} ago`:`in ${Y(n)}`}function jn(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}var Mn=864e5;function Nn(e,t){let n=new Date(e),r=n.toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`,hour12:!1});return Pn(t)?`${n.toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`})} ${r}`:r}function Pn(e){return e>=Mn}function Fn(e){return e==null||!Number.isFinite(e)?`—`:new Date(e).toLocaleString(`en-GB`,{year:`numeric`,month:`short`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,hour12:!1})}var In=[`B`,`KiB`,`MiB`,`GiB`,`TiB`];function Ln(e){if(e==null||!Number.isFinite(e))return`—`;if(Math.abs(e)<1024)return`${Math.round(e)} B`;let t=e,n=0;for(;Math.abs(t)>=1024&&n<In.length-1;)t/=1024,n+=1;return`${t.toFixed(1)} ${In[n]}`}function Rn(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var zn={fiveHour:18e6,daily:864e5,weekly:6048e5};function X(e,t){return t!==null&&t>0?t:zn[e]}var Bn=6e4;function Z(e,t){return e===null||t===null?e===t:Math.abs(e-t)<=Bn}function Vn(e,t){return e.resetsAt!==null&&e.resetsAt<=t}function Hn(e,t){return t===void 0?`unknown`:e.observedAt>0&&t.stale?`stale`:t.ratePerHour===null||e.limit===null||e.limit<=0?`unknown`:t.survives===!1&&t.exhaustsAt!==null?`empty`:t.survives===!0?`ok`:`unknown`}function Un(e,t){if(t.provider!==e.provider)return!1;let n=Symbol(`unusable-endpoint`);return(e=>e===void 0||e===``?void 0:e)(e.endpointId)===(e=>{if(e!==void 0)return typeof e==`string`&&e!==``?e:n})(t.providerData.endpointId)?e.credentialId===void 0||t.id===e.credentialId:!1}function Wn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]??null}function Q(e){return e.state===`pending`}function Gn(e){return e.filter(e=>!Q(e))}function $(e){return Q(e)?!1:e.status>=400||e.errorCode!==null}var Kn={ok:`●`,warn:`◐`,down:`○`,idle:`·`,live:`●`};function qn(e){return Q(e)?`live`:$(e)?`down`:`ok`}function Jn(e){return Q(e)?`in flight`:$(e)?`failed with ${e.status}`:`succeeded`}function Yn(e,t){let n=Gn(e),r=[],i=0,a=0,o=0,s=0,c=0,l=0;for(let e of n)$(e)&&(i+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&r.push(e.ttftMs),a+=e.costUsd,o+=e.inputTokens,s+=e.outputTokens,c+=e.cacheReadTokens,l+=e.cacheWriteTokens;let u=t/6e4;return{requests:n.length,errors:i,errorRate:n.length===0?0:i/n.length,ratePerMin:u<=0?0:n.length/u,ttftP50:Wn(r,.5),ttftP95:Wn(r,.95),costUsd:a,inputTokens:o,outputTokens:s,cacheReadTokens:c,cacheWriteTokens:l}}function Xn(e,t){let n=Gn(e),{now:r,spanMs:i,count:a}=t,o=i/a,s=r-i,c=Array.from({length:a},(e,t)=>({at:s+t*o,total:0,errors:0,costUsd:0,tokens:0,ttftMs:null})),l=Array.from({length:a},()=>[]);for(let e of n){if(e.at<s||e.at>r)continue;let t=Math.min(a-1,Math.floor((e.at-s)/o)),n=c[t];n!==void 0&&(n.total+=1,n.costUsd+=e.costUsd,n.tokens+=e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheWriteTokens,$(e)&&(n.errors+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&l[t]?.push(e.ttftMs))}for(let[e,t]of c.entries())t.ttftMs=Wn(l[e]??[],.5);return c}var Zn={tokenRejected:`reconnect needed — provider rejected the refresh token`,expiredNoRefresh:`reconnect needed — token expired with nothing to refresh from`};function Qn(e,t,n,r=null){if(!n){let e=r===`tokenRejected`||r===`expiredNoRefresh`;return{state:e?`down`:`idle`,note:e?Zn[r]:`disabled`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0}}if(e.length===0)return{state:`idle`,note:`unused`,ttftMs:null,lastUsedAt:null,consecutiveFailures:0};let i=`ok`,a=``,o=null,s=null,c=0;for(let n of e){if(n.ewmaTtftMs!==null&&(o=o===null?n.ewmaTtftMs:Math.max(o,n.ewmaTtftMs)),n.lastUsedAt!==null&&(s=s===null?n.lastUsedAt:Math.max(s,n.lastUsedAt)),c=Math.max(c,n.consecutiveFailures),n.breakerState===`open`){i=`down`,a=`breaker open`;continue}if(n.rateLimitedUntil!==null&&n.rateLimitedUntil>t&&i!==`down`){i=`warn`,a=`rate limited`;continue}n.breakerState===`halfOpen`&&i===`ok`&&(i=`warn`,a=`probing`)}return{state:i,note:a,ttftMs:o,lastUsedAt:s,consecutiveFailures:c}}var $n={fiveHour:`5h`,daily:`24h`,weekly:`7d`};function er(e){return Math.max(e,6e4)*3}function tr(e,t,n){return e.observedAt<=0||t-e.observedAt>er(n)}function nr(e,t){return t?.ratePerHour===void 0||t.ratePerHour===null||e.limit===null||e.limit<=0?null:t.ratePerHour/e.limit}function rr(e,t){return e.find(e=>e.windowType===t)}function ir(e,t,n,r,i){return ar(e,{stale:tr(e,t,n),rolledOver:Vn(e,t),estimateStale:i===void 0||i.stale,survives:i?.survives??null,exhaustsAt:i?.exhaustsAt??null},t,r)}function ar(e,t,n,r){let i=$n[e.windowType];if(e.observedAt<=0)return`${i} · never observed`;if(t.stale)return`${i} · stale, read ${r(e.observedAt,n)}`;if(t.rolledOver)return`${i} · rolled over, waiting for the next reading`;if(e.resetsAt===null)return i;let a=`resets ${r(e.resetsAt,n)}`;return t.estimateStale||t.survives!==!1||t.exhaustsAt===null?`${i} · ${a}`:`${i} · ${t.exhaustsAt<=n?`empty now`:`empty ~${Y(t.exhaustsAt-n)}`} · ${a}`}function or(e){return{observedAt:e.observedAt,windowType:e.windowType,windowMs:e.windowMs,resetsAt:e.resetsAt,usedRatio:e.limit===null||e.limit<=0?null:Math.min(1,Math.max(0,e.used/e.limit))}}function sr(e,t){if(e.usedRatio!==0||t.usedRatio!==0)return!1;let n=X(e.windowType,e.windowMs),r=X(t.windowType,t.windowMs);return n===r&&Z(e.resetsAt,e.observedAt+n)&&Z(t.resetsAt,t.observedAt+r)&&!Z(t.resetsAt,e.resetsAt)}function cr(e){let t=e.filter(e=>e.usedRatio!==null).sort((e,t)=>e.observedAt-t.observedAt),n=[],r;for(let e of t){let t={at:e.observedAt,percent:Math.min(100,e.usedRatio*100)},i={resetsAt:e.resetsAt,startsAt:e.resetsAt===null?null:e.resetsAt-X(e.windowType,e.windowMs)},a=n[n.length-1],o=r!==void 0&&sr(r,e);a===void 0||r===void 0||!o&&!Z(e.resetsAt,r.resetsAt)?n.push({key:`window-${n.length}`,points:[t],...i}):(a.points.push(t),a.resetsAt=o?null:i.resetsAt,a.startsAt=o?null:i.startsAt),r=e}return n}function lr(e,t){let{usedRatio:n,observedAt:r}=t;if(n===null)return[...e];let i=e.findLastIndex(e=>Z(e.resetsAt,t.resetsAt)),a=e[i];if(a===void 0)return[...e];let o=a.points[a.points.length-1];if(o===void 0||o.at>=r)return[...e];let s={at:r,percent:Math.min(100,n*100)};return e.map((e,t)=>t===i?{...e,points:[...e.points,s]}:e)}function ur(e){return e.startsAt===null||e.resetsAt===null?null:{from:{at:e.startsAt,percent:0},to:{at:e.resetsAt,percent:100}}}var dr=36e5;function fr(e,t){let{usedRatio:n,resetsAt:r,observedAt:i}=e,a=t;if(n===null||r===null||a===null||a<=0)return null;let o=Math.min(100,n*100),s=a*100,c={at:i,percent:o},l=o+s*((r-i)/dr);return l<=100?{from:c,to:{at:r,percent:l}}:{from:c,to:{at:i+(100-o)/s*dr,percent:100}}}var pr={fiveHour:0,daily:1,weekly:2};function mr(e){return e.filter(e=>e.limit!==null&&e.limit>0).map(e=>({window:e,fraction:Math.min(1,e.used/e.limit)})).sort((e,t)=>pr[e.window.windowType]-pr[t.window.windowType])}function hr(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i===void 0?n.set(e,[r]):i.push(r)}return n}var gr=C`
2
+ 0%, 100% { opacity: 1; }
3
+ 50% { opacity: 0.28; }
4
+ `,_r=S`
5
+ color: ${({theme:e})=>e.color.ok};
6
+ animation: ${gr} 1.2s ease-in-out infinite;
7
+
8
+ @media (prefers-reduced-motion: reduce) {
9
+ animation: none;
10
+ }
11
+ `,vr={ok:S`
12
+ color: ${({theme:e})=>e.color.ok};
13
+ `,warn:S`
14
+ color: ${({theme:e})=>e.color.warn};
15
+ `,down:S`
16
+ color: ${({theme:e})=>e.color.down};
17
+ `,idle:S`
18
+ color: ${({theme:e})=>e.color.inkFaint};
19
+ `,live:_r},yr=x.span`
20
+ font-family: ${({theme:e})=>e.font.mono};
21
+ font-size: 12px;
22
+ line-height: 1;
23
+ flex: none;
24
+ ${({$state:e})=>vr[e]}
25
+ `;function br({state:e,label:t,className:n}){return b(yr,{$state:e,className:n,role:`img`,"aria-label":t,title:t,children:Kn[e]})}export{rn as $,Me as $t,Tn as A,mn as At,At as B,zt as Bt,X as C,ce as Cn,It as Ct,Ln as D,Mt as Dt,Un as E,xt as Et,An as F,pn as Ft,Rt as G,pt as Gt,_t as H,on as Ht,En as I,_n as It,Dt as J,Xe as Jt,Ot as K,$e as Kt,Pn as L,Tt as Lt,Y as M,Vt as Mt,Dn as N,hn as Nt,Nn as O,Jt as Ot,On as P,fn as Pt,nn as Q,He as Qt,Rn as R,Zt as Rt,lr as S,se as Sn,St,Hn as T,T as Tn,gt as Tt,Sn as U,kt as Ut,ht as V,vt as Vt,q as W,Ht as Wt,Ut as X,Ne as Xt,gn as Y,Ge as Yt,$t as Z,Be as Zt,cr as _,re as _n,Ct as _t,ur as a,be as an,Pt as at,or as b,fe as bn,Qt as bt,hr as c,H as cn,Bt as ct,tr as d,P as dn,Lt as dt,ze as en,an as et,Jn as f,he as fn,sn as ft,ar as g,_e as gn,Kt as gt,ir as h,A as hn,un as ht,Xn as i,De as in,vn as it,Fn as j,cn as jt,jn as k,Gt as kt,$ as l,we as ln,bt as lt,fr as m,ge as mn,Wt as mt,$n as n,Pe as nn,tn as nt,rr as o,Se as on,yn as ot,qn as p,N as pn,ln as pt,Et as q,Qe as qt,pr as r,Fe as rn,bn as rt,Qn as s,xe as sn,dn as st,br as t,Ie as tn,en as tt,Q as u,F as un,yt as ut,mr as v,ae as vn,qt as vt,Vn as w,w as wn,xn as wt,Yn as x,E as xn,jt as xt,nr as y,M as yn,Xt as yt,Nt as z,Yt as zt};
@@ -151,7 +151,9 @@ import*as e from"react";import{jsx as t,jsxs as n}from"react/jsx-runtime";import
151
151
  padding: ${({theme:e})=>e.space(8)} ${({theme:e})=>e.space(4)};
152
152
  text-align: center;
153
153
  `,F=r.p`
154
- max-width: 44ch;
154
+ /* Wide enough for the console's uncaptured-fleet advice to read as a paragraph
155
+ rather than a column; the horizontal padding keeps it off the card edge. */
156
+ max-width: min(96ch, 100%);
155
157
  font-size: 13px;
156
158
  color: ${({theme:e})=>e.color.inkDim};
157
159
  `;function I({legend:e,message:r,action:i}){return n(P,{children:[t(f,{children:e}),t(F,{children:r}),i]})}var L=r(F)`
@@ -1,4 +1,4 @@
1
- import{Ct as e,Dt as t,Gt as n,I as r,N as i,P as a,Rt 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-BHYJpauE.js";import{C as m,D as h,E as g,O as _,S as v,T as y,_ as b,b as x,o as S,v as C}from"./Panel-CYQvfI3L.js";import*as w from"react";import{createContext as ee,createElement as T,forwardRef as E,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=ee({}),be=()=>re(ye),xe=E(({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 T(`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])=>T(e,t)),...Array.isArray(a)?a:[a]])}),M=(e,t)=>{let n=E(({className:n,...r},i)=>T(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(`
1
+ import{Gt as e,I as t,Kt as n,N as r,Ot as i,P as a,bt as o,i as s,t as c,vt as l,wt as u,x as d,xt as f,zt as p}from"./Lamp-CVGUT2YK.js";import{C as m,D as h,E as g,O as _,S as v,T as y,_ as b,b as x,o as S,v as C}from"./Panel-BlNr9j6-.js";import*as w from"react";import{createContext as ee,createElement as T,forwardRef as E,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=ee({}),be=()=>re(ye),xe=E(({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 T(`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])=>T(e,t)),...Array.isArray(a)?a:[a]])}),M=(e,t)=>{let n=E(({className:n,...r},i)=>T(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
2
  `)}var Be=le`
3
3
  :root {
4
4
  ${({$providers:e})=>ze(e,`light`)}
@@ -202,7 +202,7 @@ import{Ct as e,Dt as t,Gt as n,I as r,N as i,P as a,Rt as o,Wt as s,_t as c,bt a
202
202
  letter-spacing: 0.08em;
203
203
  `,lt=j.span`
204
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:t,signOut:n}){let{live:o,toggle:s,connection:c}=fe(),{mode:l,setMode:p}=Qe(),m=Date.now(),h=oe(()=>e.filter(e=>m-e.at<=pt),[e,m]),g=f(h,pt),y=u(h,{now:m,spanMs:pt,count:24}),x=dt[(dt.indexOf(l)+1)%dt.length]??`system`,S=l===`light`?Ie:l===`dark`?je:Ae,w=ut[o?c.status===`offline`?`offline`:c.status===`push`?`push`:`poll`:`paused`],ee=t||g.errorRate>=.25?`down`:g.errorRate>=.05?`warn`:h.length===0?`idle`:`ok`;return A(rt,{children:[A(it,{children:[k(d,{state:ee,label:t?`request log unreadable`:`error rate ${a(g.errorRate)}`}),`Omnigateway`]}),A(at,{children:[A(ot,{children:[k(b,{children:`req`}),k(st,{children:k(nt,{values:y.map(e=>e.total),overlay:y.map(e=>e.errors),height:22,label:`${g.requests} requests in the last 10 minutes`})})]}),A(N,{children:[k(b,{children:`rate`}),k(C,{children:g.ratePerMin.toFixed(1)}),k(b,{children:`/min`})]}),A(N,{children:[k(b,{children:`err`}),k(C,{style:{color:g.errorRate>=.05?`var(--down)`:void 0},children:a(g.errorRate)})]}),A(N,{children:[k(b,{children:`ttft p50`}),k(C,{children:i(g.ttftP50)})]}),A(N,{children:[k(b,{children:`spend`}),k(C,{children:r(g.costUsd)})]})]}),k(v,{}),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(_,{type:`button`,$variant:`ghost`,$size:`sm`,onClick:()=>p(x),"aria-label":ft[l],title:`${ft[l]} — switch to ${ft[x].toLowerCase()}`,children:k(S,{})}),k(_,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Sign out`,title:`Sign out`,disabled:n.pending,onClick:n.run,children:k(ke,{})})]})}function ht(){let e=n(),{cadence:t}=fe(),r=p(),i=l(200,t(1e4,`res:logs`));return k(mt,{logs:i.data??[],logsFailed:i.isError,signOut:{pending:r.isPending,run:()=>{r.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])}),ee=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),T=d?y===g.length-1:!1,E=U(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return w.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),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,ee.onFocusCapture),onBlurCapture:z(e.onBlurCapture,ee.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`),`
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:i}){let{live:o,toggle:l,connection:u}=fe(),{mode:f,setMode:p}=Qe(),m=Date.now(),h=oe(()=>e.filter(e=>m-e.at<=pt),[e,m]),g=d(h,pt),y=s(h,{now:m,spanMs:pt,count:24}),x=dt[(dt.indexOf(f)+1)%dt.length]??`system`,S=f===`light`?Ie:f===`dark`?je:Ae,w=ut[o?u.status===`offline`?`offline`:u.status===`push`?`push`:`poll`:`paused`],ee=n||g.errorRate>=.25?`down`:g.errorRate>=.05?`warn`:h.length===0?`idle`:`ok`;return A(rt,{children:[A(it,{children:[k(c,{state:ee,label:n?`request log unreadable`:`error rate ${a(g.errorRate)}`}),`Omnigateway`]}),A(at,{children:[A(ot,{children:[k(b,{children:`req`}),k(st,{children:k(nt,{values:y.map(e=>e.total),overlay:y.map(e=>e.errors),height:22,label:`${g.requests} requests in the last 10 minutes`})})]}),A(N,{children:[k(b,{children:`rate`}),k(C,{children:g.ratePerMin.toFixed(1)}),k(b,{children:`/min`})]}),A(N,{children:[k(b,{children:`err`}),k(C,{style:{color:g.errorRate>=.05?`var(--down)`:void 0},children:a(g.errorRate)})]}),A(N,{children:[k(b,{children:`ttft p50`}),k(C,{children:r(g.ttftP50)})]}),A(N,{children:[k(b,{children:`spend`}),k(C,{children:t(g.costUsd)})]})]}),k(v,{}),A(ct,{type:`button`,$size:`sm`,onClick:l,"aria-pressed":o,"aria-label":w.name,title:w.title,children:[k(c,{state:w.lamp,label:w.name}),w.head,w.tail===null?null:A(O,{children:[k(lt,{"aria-hidden":`true`,children:`·`}),w.tail]})]}),k(_,{type:`button`,$variant:`ghost`,$size:`sm`,onClick:()=>p(x),"aria-label":ft[f],title:`${ft[f]} — switch to ${ft[x].toLowerCase()}`,children:k(S,{})}),k(_,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Sign out`,title:`Sign out`,disabled:i.pending,onClick:i.run,children:k(ke,{})})]})}function ht(){let e=n(),{cadence:t}=fe(),r=o(),i=f(200,t(1e4,`res:logs`));return k(mt,{logs:i.data??[],logsFailed:i.isError,signOut:{pending:r.isPending,run:()=>{r.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])}),ee=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),T=d?y===g.length-1:!1,E=U(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return w.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),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,ee.onFocusCapture),onBlurCapture:z(e.onBlurCapture,ee.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
206
  .${dr} {
207
207
  overflow: hidden ${r};
208
208
  padding-right: ${s}px ${r};
@@ -336,7 +336,7 @@ import{Ct as e,Dt as t,Gt as n,I as r,N as i,P as a,Rt as o,Wt as s,_t as c,bt a
336
336
  font-size: 10.5px;
337
337
  line-height: 1.3;
338
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:e=750}){let n=c(),r=t(),i=o(),[a,s]=D(null),[l,u]=D(!1),[d,f]=D(!1),[p,h]=D(`idle`),g=n.data;ie(()=>{if(!l)return;let t=!1,n,r=!1,i=0,a=Math.max(1,Math.ceil(la/e)),o=async()=>{let s=await ua();if(!t){if(!r&&!s)r=!0,h(`returning`);else if(r&&s){window.location.reload();return}if(i+=1,i>=a){h(`lost`),u(!1);return}n=setTimeout(()=>void o(),e)}};return n=setTimeout(()=>void o(),e),()=>{t=!0,n!==void 0&&clearTimeout(n)}},[l,e]);let _=()=>{h(`leaving`),r.mutate(void 0,{onSuccess:()=>u(!0),onError:()=>h(`idle`)})};return d?A(O,{children:[k(v,{}),k(na,{}),k(ra,{children:A(m,{$gap:1,children:[k(b,{children:`Gateway stopped`}),A(ca,{children:[`Nothing on this screen will update again, and nothing here can start it: that needs`,` `,g?.supervisor===`container`?`the host that runs this container`:`a shell on the machine it runs on`,`.`]})]})})]}):A(O,{children:[k(v,{}),k(na,{}),A(ra,{title:g===void 0?void 0:ta[g.supervisor],children:[A(ia,{type:`button`,$size:`sm`,"aria-label":`Restart gateway`,disabled:g===void 0||!g.canRestart||r.isPending||l,onClick:()=>s(`restart`),children:[k(Ne,{}),`Restart`]}),A(ia,{type:`button`,$size:`sm`,$variant:`danger`,"aria-label":`Shut down gateway`,disabled:g===void 0||!g.canShutdown||i.isPending||l,onClick:()=>s(`shutdown`),children:[k(Me,{}),`Shut down`]}),g?.note===void 0?null:k(aa,{children:g.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,r.isError?k(oa,{role:`alert`,children:S(r.error)}):null,i.isError?k(oa,{role:`alert`,children:S(i.error)}):null]}),k(ea,{open:a===`restart`,onOpenChange:e=>{e||s(null)},title:`Restart gateway`,body:`${g===void 0?``:`${ta[g.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:r.isPending,onConfirm:()=>{s(null),_()}}),k(ea,{open:a===`shutdown`,onOpenChange:e=>{e||s(null)},title:`Shut down gateway`,body:g?.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:i.isPending,onConfirm:()=>{s(null),i.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`
339
+ `,la=9e4;async function ua(){try{return(await fetch(`/health`,{cache:`no-store`})).ok}catch{return!1}}function da({pollMs:e=750}){let t=l(),n=i(),r=p(),[a,o]=D(null),[s,c]=D(!1),[u,d]=D(!1),[f,h]=D(`idle`),g=t.data;ie(()=>{if(!s)return;let t=!1,n,r=!1,i=0,a=Math.max(1,Math.ceil(la/e)),o=async()=>{let s=await ua();if(!t){if(!r&&!s)r=!0,h(`returning`);else if(r&&s){window.location.reload();return}if(i+=1,i>=a){h(`lost`),c(!1);return}n=setTimeout(()=>void o(),e)}};return n=setTimeout(()=>void o(),e),()=>{t=!0,n!==void 0&&clearTimeout(n)}},[s,e]);let _=()=>{h(`leaving`),n.mutate(void 0,{onSuccess:()=>c(!0),onError:()=>h(`idle`)})};return u?A(O,{children:[k(v,{}),k(na,{}),k(ra,{children:A(m,{$gap:1,children:[k(b,{children:`Gateway stopped`}),A(ca,{children:[`Nothing on this screen will update again, and nothing here can start it: that needs`,` `,g?.supervisor===`container`?`the host that runs this container`:`a shell on the machine it runs on`,`.`]})]})})]}):A(O,{children:[k(v,{}),k(na,{}),A(ra,{title:g===void 0?void 0:ta[g.supervisor],children:[A(ia,{type:`button`,$size:`sm`,"aria-label":`Restart gateway`,disabled:g===void 0||!g.canRestart||n.isPending||s,onClick:()=>o(`restart`),children:[k(Ne,{}),`Restart`]}),A(ia,{type:`button`,$size:`sm`,$variant:`danger`,"aria-label":`Shut down gateway`,disabled:g===void 0||!g.canShutdown||r.isPending||s,onClick:()=>o(`shutdown`),children:[k(Me,{}),`Shut down`]}),g?.note===void 0?null:k(aa,{children:g.note}),f===`leaving`?k(sa,{role:`status`,children:`Restarting. Waiting for the gateway to stop answering.`}):f===`returning`?k(sa,{role:`status`,children:`The gateway has stopped answering. Waiting for it to come back, then this page reloads.`}):f===`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,n.isError?k(oa,{role:`alert`,children:S(n.error)}):null,r.isError?k(oa,{role:`alert`,children:S(r.error)}):null]}),k(ea,{open:a===`restart`,onOpenChange:e=>{e||o(null)},title:`Restart gateway`,body:`${g===void 0?``:`${ta[g.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:n.isPending,onConfirm:()=>{o(null),_()}}),k(ea,{open:a===`shutdown`,onOpenChange:e=>{e||o(null)},title:`Shut down gateway`,body:g?.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:r.isPending,onConfirm:()=>{o(null),r.mutate(void 0,{onSuccess:()=>d(!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
340
  grid-area: rail;
341
341
  display: flex;
342
342
  flex-direction: column;
@@ -372,7 +372,7 @@ import{Ct as e,Dt as t,Gt as n,I as r,N as i,P as a,Rt as o,Wt as s,_t as c,bt a
372
372
  height: 15px;
373
373
  flex: none;
374
374
  }
375
- `,ha=j(s)`
375
+ `,ha=j(e)`
376
376
  ${ma}
377
377
 
378
378
  &:hover {
@@ -412,7 +412,7 @@ import{Ct as e,Dt as t,Gt as n,I as r,N as i,P as a,Rt as o,Wt as s,_t as c,bt a
412
412
  font-weight: 400;
413
413
  line-height: 1.3;
414
414
  color: ${({theme:e})=>e.color.warn};
415
- `;function ya(){let t=e();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(t.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`
415
+ `;function ya(){let e=u();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
416
  display: grid;
417
417
  grid-template-areas:
418
418
  "chassis chassis"
@@ -1,4 +1,4 @@
1
- import{_ as e}from"./Panel-CYQvfI3L.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import r from"styled-components";var i=r.div`
1
+ import{_ as e}from"./Panel-BlNr9j6-.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import r from"styled-components";var i=r.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 6px;
@@ -1,4 +1,4 @@
1
- import{A as e,I as t,M as n,N as r,R as i,f as a,j as o,k as s,l as c,p as l,t as u,u as d}from"./Lamp-BHYJpauE.js";import{C as f,_ as p,b as m,v as h,w as g}from"./Panel-CYQvfI3L.js";import{n as _,r as v,t as y}from"./TokenBreakdown-D5mQFSfo.js";import{n as b,t as x}from"./Chip-BZWa7onX.js";import{i as S,n as C,r as w,t as T}from"./Table-CVDZ69Zx.js";import{useEffect as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";import j from"styled-components";function M(e){let[t,n]=D(Date.now);return E(()=>{if(!e)return;n(Date.now());let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function N(e,t,n){if(t.length===0||e.requestedModel.toLowerCase().includes(t)||(e.resolvedModel??``).toLowerCase().includes(t)||(e.errorCode??``).toLowerCase().includes(t))return!0;if(n===void 0)return!1;let r=e.credentialId==null?``:n.accounts.get(e.credentialId)??``,i=e.apiKeyId==null?``:n.keys.get(e.apiKeyId)??e.apiKeyId;return r.toLowerCase().includes(t)||i.toLowerCase().includes(t)}function P(e,t,n,r){let i=n.trim().toLowerCase();return e.filter(e=>(t!==`failed`||c(e))&&N(e,i,r))}function F({log:e}){return k(C,{$align:`right`,$mono:!0,...d(e)?{"aria-label":`processing`}:{title:v(e)},children:d(e)?k(y,{}):k(_,{tokens:e})})}function I({rows:e,now:c,names:f,onOpen:_}){return A(T,{children:[k(`thead`,{children:A(`tr`,{children:[k(w,{}),k(w,{$align:`right`,children:`Time`}),k(w,{children:`Requested`}),k(w,{children:`Routed to`}),f===void 0?null:A(O,{children:[k(w,{children:`Account`}),k(w,{children:`Key`})]}),k(w,{$align:`right`,children:`Try`}),k(w,{$align:`right`,children:`TTFT`}),k(w,{$align:`right`,children:`Total`}),k(w,{$align:`right`,children:`Tokens`}),k(w,{$align:`right`,children:`Cost`}),k(w,{children:`Outcome`})]})}),k(`tbody`,{children:e.map(e=>A(S,{$selectable:!0,onClick:()=>_(e),children:[k(C,{children:k(u,{state:l(e),label:a(e)})}),k(C,{$align:`right`,$mono:!0,title:o(e.at),children:s(e.at)}),k(C,{$mono:!0,children:k(g,{style:{display:`block`,maxWidth:`20ch`},children:e.requestedModel||`—`})}),k(C,{children:e.resolvedProvider===null?k(p,{children:d(e)?`routing…`:`not routed`}):A(m,{$gap:1,children:[k(b,{provider:e.resolvedProvider}),k(h,{$dim:!0,children:e.resolvedModel??`—`})]})}),f===void 0?null:A(O,{children:[k(C,{children:k(g,{style:{display:`block`,maxWidth:`18ch`},children:e.credentialId==null?`—`:f.accounts.get(e.credentialId)??i(e.credentialId)})}),k(C,{children:k(g,{style:{display:`block`,maxWidth:`16ch`},title:e.apiKeyId??void 0,children:e.apiKeyId==null?`—`:f.keys.get(e.apiKeyId)??i(e.apiKeyId)})})]}),k(C,{$align:`right`,$mono:!0,children:d(e)?`—`:e.attempts}),k(C,{$align:`right`,$mono:!0,children:d(e)?`—`:r(e.ttftMs)}),k(C,{$align:`right`,$mono:!0,children:d(e)?n(Math.max(0,c-e.at)):r(e.durationMs)}),k(F,{log:e}),k(C,{$align:`right`,$mono:!0,children:d(e)?`—`:t(e.costUsd)}),k(C,{children:d(e)?k(x,{$tone:`accent`,children:`live`}):e.errorCode===null?k(x,{$tone:`ok`,children:e.status}):k(x,{$tone:`down`,children:e.errorCode})})]},e.id))})]})}var L=j.dl`
1
+ import{A as e,I as t,M as n,N as r,R as i,f as a,j as o,k as s,l as c,p as l,t as u,u as d}from"./Lamp-CVGUT2YK.js";import{C as f,_ as p,b as m,v as h,w as g}from"./Panel-BlNr9j6-.js";import{n as _,r as v,t as y}from"./TokenBreakdown-CmzXuENj.js";import{n as b,t as x}from"./Chip-shturdCv.js";import{i as S,n as C,r as w,t as T}from"./Table-CVDZ69Zx.js";import{useEffect as E,useState as D}from"react";import{Fragment as O,jsx as k,jsxs as A}from"react/jsx-runtime";import j from"styled-components";function M(e){let[t,n]=D(Date.now);return E(()=>{if(!e)return;n(Date.now());let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e]),t}function N(e,t,n){if(t.length===0||e.requestedModel.toLowerCase().includes(t)||(e.resolvedModel??``).toLowerCase().includes(t)||(e.errorCode??``).toLowerCase().includes(t))return!0;if(n===void 0)return!1;let r=e.credentialId==null?``:n.accounts.get(e.credentialId)??``,i=e.apiKeyId==null?``:n.keys.get(e.apiKeyId)??e.apiKeyId;return r.toLowerCase().includes(t)||i.toLowerCase().includes(t)}function P(e,t,n,r){let i=n.trim().toLowerCase();return e.filter(e=>(t!==`failed`||c(e))&&N(e,i,r))}function F({log:e}){return k(C,{$align:`right`,$mono:!0,...d(e)?{"aria-label":`processing`}:{title:v(e)},children:d(e)?k(y,{}):k(_,{tokens:e})})}function I({rows:e,now:c,names:f,onOpen:_}){return A(T,{children:[k(`thead`,{children:A(`tr`,{children:[k(w,{}),k(w,{$align:`right`,children:`Time`}),k(w,{children:`Requested`}),k(w,{children:`Routed to`}),f===void 0?null:A(O,{children:[k(w,{children:`Account`}),k(w,{children:`Key`})]}),k(w,{$align:`right`,children:`Try`}),k(w,{$align:`right`,children:`TTFT`}),k(w,{$align:`right`,children:`Total`}),k(w,{$align:`right`,children:`Tokens`}),k(w,{$align:`right`,children:`Cost`}),k(w,{children:`Outcome`})]})}),k(`tbody`,{children:e.map(e=>A(S,{$selectable:!0,onClick:()=>_(e),children:[k(C,{children:k(u,{state:l(e),label:a(e)})}),k(C,{$align:`right`,$mono:!0,title:o(e.at),children:s(e.at)}),k(C,{$mono:!0,children:k(g,{style:{display:`block`,maxWidth:`20ch`},children:e.requestedModel||`—`})}),k(C,{children:e.resolvedProvider===null?k(p,{children:d(e)?`routing…`:`not routed`}):A(m,{$gap:1,children:[k(b,{provider:e.resolvedProvider}),k(h,{$dim:!0,children:e.resolvedModel??`—`})]})}),f===void 0?null:A(O,{children:[k(C,{children:k(g,{style:{display:`block`,maxWidth:`18ch`},children:e.credentialId==null?`—`:f.accounts.get(e.credentialId)??i(e.credentialId)})}),k(C,{children:k(g,{style:{display:`block`,maxWidth:`16ch`},title:e.apiKeyId??void 0,children:e.apiKeyId==null?`—`:f.keys.get(e.apiKeyId)??i(e.apiKeyId)})})]}),k(C,{$align:`right`,$mono:!0,children:d(e)?`—`:e.attempts}),k(C,{$align:`right`,$mono:!0,children:d(e)?`—`:r(e.ttftMs)}),k(C,{$align:`right`,$mono:!0,children:d(e)?n(Math.max(0,c-e.at)):r(e.durationMs)}),k(F,{log:e}),k(C,{$align:`right`,$mono:!0,children:d(e)?`—`:t(e.costUsd)}),k(C,{children:d(e)?k(x,{$tone:`accent`,children:`live`}):e.errorCode===null?k(x,{$tone:`ok`,children:e.status}):k(x,{$tone:`down`,children:e.errorCode})})]},e.id))})]})}var L=j.dl`
2
2
  display: grid;
3
3
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
4
4
  gap: 6px ${({theme:e})=>e.space(3)};
@@ -1,4 +1,4 @@
1
- import{b as e,p as t,y as n}from"./shared-BKWNmsjH.js";import{A as r,I as i,N as a,P as o}from"./Lamp-BHYJpauE.js";import{D as s,a as c,b as l,i as u,r as d,t as f}from"./Panel-CYQvfI3L.js";import{f as p}from"./Rack-CRuJZY00.js";import{t as m}from"./Readout-D6-aurU8.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";import _ from"styled-components";function v({legend:e,meta:t,actions:n,footer:r,query:i,failure:a,empty:o,isEmpty:s,children:l}){return h(f,{legend:e,...t===void 0?{}:{meta:t},...n===void 0?{}:{actions:n},...r===void 0?{}:{footer:r},children:i.isError?h(u,{...a===void 0?{}:{legend:a},error:i.error,onRetry:i.refetch}):i.isLoading?h(c,{rows:4}):s?h(d,{legend:o.legend,message:o.message}):l})}var y=_(s)`
1
+ import{b as e,p as t,y as n}from"./shared-XRnr7At9.js";import{A as r,I as i,N as a,P as o}from"./Lamp-CVGUT2YK.js";import{D as s,a as c,b as l,i as u,r as d,t as f}from"./Panel-BlNr9j6-.js";import{f as p}from"./Rack-BbZyyu2u.js";import{t as m}from"./Readout-D8Ofl3Gz.js";import{jsx as h,jsxs as g}from"react/jsx-runtime";import _ from"styled-components";function v({legend:e,meta:t,actions:n,footer:r,query:i,failure:a,empty:o,isEmpty:s,children:l}){return h(f,{legend:e,...t===void 0?{}:{meta:t},...n===void 0?{}:{actions:n},...r===void 0?{}:{footer:r},children:i.isError?h(u,{...a===void 0?{}:{legend:a},error:i.error,onRetry:i.refetch}):i.isLoading?h(c,{rows:4}):s?h(d,{legend:o.legend,message:o.message}):l})}var y=_(s)`
2
2
  border-color: ${({theme:e,$on:t})=>t?e.color.accent:e.color.ruleStrong};
3
3
  color: ${({theme:e,$on:t})=>t?e.color.accent:e.color.inkDim};
4
4
  background: ${({theme:e,$on:t})=>t?e.color.accentWash:e.color.panelRaised};
@@ -1,4 +1,4 @@
1
- import{a as e,c as t,l as n,o as r,s as i,u as a}from"./Rack-CRuJZY00.js";import*as o from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import u from"styled-components";var d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0});function p(e){let[t,n]=o.useState(void 0);return r(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}f(p,`useSize`);var m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Switch`,[_,v]=t(g),[y,b]=_(g);function x(t){let{__scopeSwitch:n,checked:r,children:i,defaultChecked:a,disabled:s,form:l,name:u,onCheckedChange:d,required:f,value:p=`on`,internal_do_not_use_render:m}=t,[h,_]=e({prop:r,defaultProp:a??!1,onChange:d,caller:g}),[v,b]=o.useState(null),[x,S]=o.useState(null),C=o.useRef(!1),[w,T]=o.useReducer(e=>e+1,0),E={checked:h,setChecked:_,disabled:s,control:v,setControl:b,name:u,form:l,value:p,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:f,defaultChecked:a,isFormControl:!v||!!l||!!v.closest(`form`),bubbleInput:x,setBubbleInput:S};return c(y,{scope:n,...E,children:k(m)?m(E):i})}h(x,`SwitchProvider`);var S=`SwitchTrigger`,C=o.forwardRef(h(function({__scopeSwitch:e,onClick:t,...r},s){let{control:l,form:u,value:d,disabled:f,checked:p,required:m,setControl:g,setChecked:_,hasConsumerStoppedPropagationRef:v,onUserInteraction:y,isFormControl:x,bubbleInput:C}=b(S,e),w=a(s,g),T=o.useRef(p);return o.useEffect(()=>{let e=u?l?.ownerDocument.getElementById(u):l?.form;if(e instanceof HTMLFormElement){let t=h(()=>_(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[l,u,_]),c(n.button,{type:`button`,role:`switch`,"aria-checked":p,"aria-required":m,"data-state":A(p),"data-disabled":f?``:void 0,disabled:f,value:d,...r,ref:w,onClick:i(t,e=>{y(),_(e=>!e),C&&x&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})},`SwitchTrigger`)),w=o.forwardRef(h(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:u,value:d,onCheckedChange:f,form:p,...m}=e;return c(x,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:u,required:o,onCheckedChange:f,name:r,form:p,value:d,internal_do_not_use_render:({isFormControl:e})=>l(s,{children:[c(C,{...m,ref:t,__scopeSwitch:n}),e&&c(O,{__scopeSwitch:n})]})})},`Switch`)),T=`SwitchThumb`,E=o.forwardRef(h(function(e,t){let{__scopeSwitch:r,...i}=e,a=b(T,r);return c(n.span,{"data-state":A(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})},`SwitchThumb`)),D=`SwitchBubbleInput`,O=o.forwardRef(h(function({__scopeSwitch:e,onClick:t,...r},s){let{control:l,hasConsumerStoppedPropagationRef:u,userInteractionCount:d,checked:f,defaultChecked:m,required:h,disabled:g,name:_,value:v,form:y,bubbleInput:x,setBubbleInput:S}=b(D,e),C=a(s,S),w=p(l),T=o.useRef(!1),E=o.useRef(f),O=o.useRef(d);o.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=d!==O.current;O.current=d;let i=E.current!==f;E.current=f;let a=!(r&&u.current);if(i&&n){T.current=!r;let t=new Event(`click`,{bubbles:a});n.call(e,f),e.dispatchEvent(t),T.current=!1}},[x,f,u,d]);let k=o.useRef(f);return c(n.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??k.current,required:h,disabled:g,name:_,value:v,form:y,...r,tabIndex:-1,ref:C,onClick:i(t,e=>{T.current&&e.stopPropagation()}),style:{...r.style,...w,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function k(e){return typeof e==`function`}h(k,`isFunction`);function A(e){return e?`checked`:`unchecked`}h(A,`getState`);var j=u(w)`
1
+ import{a as e,c as t,l as n,o as r,s as i,u as a}from"./Rack-BbZyyu2u.js";import*as o from"react";import{Fragment as s,jsx as c,jsxs as l}from"react/jsx-runtime";import u from"styled-components";var d=Object.defineProperty,f=(e,t)=>d(e,`name`,{value:t,configurable:!0});function p(e){let[t,n]=o.useState(void 0);return r(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}n(void 0)},[e]),t}f(p,`useSize`);var m=Object.defineProperty,h=(e,t)=>m(e,`name`,{value:t,configurable:!0}),g=`Switch`,[_,v]=t(g),[y,b]=_(g);function x(t){let{__scopeSwitch:n,checked:r,children:i,defaultChecked:a,disabled:s,form:l,name:u,onCheckedChange:d,required:f,value:p=`on`,internal_do_not_use_render:m}=t,[h,_]=e({prop:r,defaultProp:a??!1,onChange:d,caller:g}),[v,b]=o.useState(null),[x,S]=o.useState(null),C=o.useRef(!1),[w,T]=o.useReducer(e=>e+1,0),E={checked:h,setChecked:_,disabled:s,control:v,setControl:b,name:u,form:l,value:p,hasConsumerStoppedPropagationRef:C,userInteractionCount:w,onUserInteraction:T,required:f,defaultChecked:a,isFormControl:!v||!!l||!!v.closest(`form`),bubbleInput:x,setBubbleInput:S};return c(y,{scope:n,...E,children:k(m)?m(E):i})}h(x,`SwitchProvider`);var S=`SwitchTrigger`,C=o.forwardRef(h(function({__scopeSwitch:e,onClick:t,...r},s){let{control:l,form:u,value:d,disabled:f,checked:p,required:m,setControl:g,setChecked:_,hasConsumerStoppedPropagationRef:v,onUserInteraction:y,isFormControl:x,bubbleInput:C}=b(S,e),w=a(s,g),T=o.useRef(p);return o.useEffect(()=>{let e=u?l?.ownerDocument.getElementById(u):l?.form;if(e instanceof HTMLFormElement){let t=h(()=>_(T.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[l,u,_]),c(n.button,{type:`button`,role:`switch`,"aria-checked":p,"aria-required":m,"data-state":A(p),"data-disabled":f?``:void 0,disabled:f,value:d,...r,ref:w,onClick:i(t,e=>{y(),_(e=>!e),C&&x&&(v.current=e.isPropagationStopped(),v.current||e.stopPropagation())})})},`SwitchTrigger`)),w=o.forwardRef(h(function(e,t){let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:u,value:d,onCheckedChange:f,form:p,...m}=e;return c(x,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:u,required:o,onCheckedChange:f,name:r,form:p,value:d,internal_do_not_use_render:({isFormControl:e})=>l(s,{children:[c(C,{...m,ref:t,__scopeSwitch:n}),e&&c(O,{__scopeSwitch:n})]})})},`Switch`)),T=`SwitchThumb`,E=o.forwardRef(h(function(e,t){let{__scopeSwitch:r,...i}=e,a=b(T,r);return c(n.span,{"data-state":A(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t})},`SwitchThumb`)),D=`SwitchBubbleInput`,O=o.forwardRef(h(function({__scopeSwitch:e,onClick:t,...r},s){let{control:l,hasConsumerStoppedPropagationRef:u,userInteractionCount:d,checked:f,defaultChecked:m,required:h,disabled:g,name:_,value:v,form:y,bubbleInput:x,setBubbleInput:S}=b(D,e),C=a(s,S),w=p(l),T=o.useRef(!1),E=o.useRef(f),O=o.useRef(d);o.useEffect(()=>{let e=x;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=d!==O.current;O.current=d;let i=E.current!==f;E.current=f;let a=!(r&&u.current);if(i&&n){T.current=!r;let t=new Event(`click`,{bubbles:a});n.call(e,f),e.dispatchEvent(t),T.current=!1}},[x,f,u,d]);let k=o.useRef(f);return c(n.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:m??k.current,required:h,disabled:g,name:_,value:v,form:y,...r,tabIndex:-1,ref:C,onClick:i(t,e=>{T.current&&e.stopPropagation()}),style:{...r.style,...w,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`SwitchBubbleInput`));function k(e){return typeof e==`function`}h(k,`isFunction`);function A(e){return e?`checked`:`unchecked`}h(A,`getState`);var j=u(w)`
2
2
  all: unset;
3
3
  width: 30px;
4
4
  height: 16px;
@@ -1,4 +1,4 @@
1
- import{A as e}from"./Lamp-BHYJpauE.js";import{b as t,y as n}from"./Rack-CRuJZY00.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a,{keyframes as o}from"styled-components";var s=t(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),c=t(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),l=new Intl.NumberFormat(`en-US`);function u(e){return`${l.format(e.inputTokens)} input, ${l.format(e.outputTokens)} output, ${l.format(e.cacheReadTokens)} cache read, ${l.format(e.cacheWriteTokens)} cache write tokens`}var d=a.span`
1
+ import{A as e}from"./Lamp-CVGUT2YK.js";import{b as t,y as n}from"./Rack-BbZyyu2u.js";import{jsx as r,jsxs as i}from"react/jsx-runtime";import a,{keyframes as o}from"styled-components";var s=t(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),c=t(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),l=new Intl.NumberFormat(`en-US`);function u(e){return`${l.format(e.inputTokens)} input, ${l.format(e.outputTokens)} output, ${l.format(e.cacheReadTokens)} cache read, ${l.format(e.cacheWriteTokens)} cache write tokens`}var d=a.span`
2
2
  display: inline-flex;
3
3
  align-items: center;
4
4
  flex-wrap: wrap;
@@ -1,4 +1,4 @@
1
- import{C as e,K as t,O as n,S as r,lt as i,o as a,q as o,t as s,w as c,x as l}from"./shared-BKWNmsjH.js";import{C as u,L as d,M as f,O as p,S as m,T as h,_ as g,a as _,j as v,m as y,n as b}from"./Lamp-BHYJpauE.js";import{C as x,_ as S,b as C,v as w}from"./Panel-CYQvfI3L.js";import*as T from"react";import{forwardRef as E}from"react";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";import A from"styled-components";var j=[`axis`],M=E((e,t)=>T.createElement(l,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:j,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),N=A(C)`
1
+ import{C as e,K as t,O as n,S as r,lt as i,o as a,q as o,t as s,w as c,x as l}from"./shared-XRnr7At9.js";import{C as u,L as d,M as f,O as p,S as m,T as h,_ as g,a as _,j as v,m as y,n as b}from"./Lamp-CVGUT2YK.js";import{C as x,_ as S,b as C,v as w}from"./Panel-BlNr9j6-.js";import*as T from"react";import{forwardRef as E}from"react";import{Fragment as D,jsx as O,jsxs as k}from"react/jsx-runtime";import A from"styled-components";var j=[`axis`],M=E((e,t)=>T.createElement(l,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:j,tooltipPayloadSearcher:o,categoricalChartProps:e,ref:t})),N=A(C)`
2
2
  gap: ${({theme:e})=>e.space(5)};
3
3
  flex-wrap: wrap;
4
4
  `,P=A.div`
@@ -1 +1 @@
1
- import{i as e,k as t,t as n}from"./Panel-CYQvfI3L.js";import{jsx as r}from"react/jsx-runtime";function i({error:i}){let a=t();return r(n,{legend:`Console unavailable`,children:r(e,{legend:`The gateway did not answer`,error:i,onRetry:()=>void a.invalidate()})})}export{i as errorComponent};
1
+ import{i as e,k as t,t as n}from"./Panel-BlNr9j6-.js";import{jsx as r}from"react/jsx-runtime";function i({error:i}){let a=t();return r(n,{legend:`Console unavailable`,children:r(e,{legend:`The gateway did not answer`,error:i,onRetry:()=>void a.invalidate()})})}export{i as errorComponent};