omnigateway 0.7.2 → 0.8.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 (42) hide show
  1. package/README.md +90 -4
  2. package/bin/omni.js +6874 -4685
  3. package/gateway.js +17400 -14802
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-BOyBT5TP.js → Chip-DG-mqRx0.js} +1 -1
  6. package/public/assets/{CopyValue-DRHHQlN_.js → CopyValue-CItB094V.js} +1 -1
  7. package/public/assets/Lamp-Cxp-OxUq.js +25 -0
  8. package/public/assets/{Rack-D798XvPQ.js → Rack-xBT_6EtM.js} +5 -5
  9. package/public/assets/{RequestTable-CEBhwDs7.js → RequestTable-CM9mPiMF.js} +1 -1
  10. package/public/assets/{SummaryDeck-DBCSHihY.js → SummaryDeck-C3ZwZ3ng.js} +1 -1
  11. package/public/assets/{Toggle-CdCCoDEo.js → Toggle-CmXXn6F3.js} +1 -1
  12. package/public/assets/{TokenBreakdown-DDI9uTPW.js → TokenBreakdown-COJ643vg.js} +1 -1
  13. package/public/assets/{WindowChart-C-Y6U3WF.js → WindowChart-BrLf4KCu.js} +1 -1
  14. package/public/assets/_app.accounts-B-OYO2Yi.js +59 -0
  15. package/public/assets/_app.console-BOZ1wncA.js +44 -0
  16. package/public/assets/{_app.database-D0W0pcxC.js → _app.database-B5oHZPbu.js} +4 -4
  17. package/public/assets/{_app.index-CyxnfhVX.js → _app.index-CB3UFRwF.js} +5 -5
  18. package/public/assets/{_app.keys-D9qmw9Tj.js → _app.keys-B89CMo3x.js} +2 -2
  19. package/public/assets/{_app.logs-DtXUZETW.js → _app.logs-CNAnRW07.js} +1 -1
  20. package/public/assets/{_app.models-CNxwXyFl.js → _app.models-DpRcGhag.js} +4 -4
  21. package/public/assets/_app.plugins._pluginId-LzBq-Zjj.js +2 -0
  22. package/public/assets/{_app.plugins._pluginId-87Ox_hkW.js → _app.plugins._pluginId-sYDTZ9Px.js} +1 -1
  23. package/public/assets/{_app.settings-DjiMSl1Y.js → _app.settings-BV085FpM.js} +4 -4
  24. package/public/assets/{_app.usage-CZz9raYR.js → _app.usage-CGuOdYun.js} +3 -3
  25. package/public/assets/{chevron-right-CPoaXYHw.js → chevron-right-BeVtzzum.js} +1 -1
  26. package/public/assets/{client-CZnyYbay.js → client-Mf5f5R9Z.js} +1 -1
  27. package/public/assets/index-3lpol4cr.js +13 -0
  28. package/public/assets/{login-BtlMmyKj.js → login-BpvnkW6i.js} +2 -2
  29. package/public/assets/{login-dV42ZQIA.js → login-CwYbEKWH.js} +2 -2
  30. package/public/assets/plus-nHMFjQ2I.js +1 -0
  31. package/public/assets/{preload-helper-4wSmu2-E.js → preload-helper-8jyVfd2a.js} +1 -1
  32. package/public/assets/{shared-OJcoRCqT.js → shared-B2Lmnazz.js} +1 -1
  33. package/public/assets/{stream-CEb81tzM.js → stream-VJMOV03S.js} +1 -1
  34. package/public/assets/{trash-2-BjpqTubo.js → trash-2-CbjLfrko.js} +1 -1
  35. package/public/index.html +7 -7
  36. package/public/shared/dashboard-sdk.js +1 -1
  37. package/public/assets/Lamp-ZlMzNs5N.js +0 -25
  38. package/public/assets/_app.accounts-CLLLwN77.js +0 -59
  39. package/public/assets/_app.console-Dr9qxU7J.js +0 -44
  40. package/public/assets/_app.plugins._pluginId-CZWipH1n.js +0 -2
  41. package/public/assets/index-DNSPtYpM.js +0 -13
  42. package/public/assets/plus-_zo43Lvf.js +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omnigateway",
3
- "version": "0.7.2",
3
+ "version": "0.8.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-D798XvPQ.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-xBT_6EtM.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-D798XvPQ.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-CYQvfI3L.js";import{b as n}from"./Rack-xBT_6EtM.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;
@@ -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-CYQvfI3L.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,te=f.useLayoutEffect;function ne(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 re(e){let t=f.useRef(null);return f.useImperativeHandle(e,()=>t.current,[]),t}function T(e){return e[e.length-1]}function E(e){return typeof e==`function`}function ie(e,t){return E(e)?e(t):e}var D=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;function oe(e){for(let t in e)if(D.call(e,t))return!0;return!1}var se=()=>Object.create(null),ce=(e,t)=>le(e,t,se);function le(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=fe(e)&&fe(i);if(!a&&!(O(e)&&O(i)))return i;let o=a?e:ue(e);if(!o)return i;let s=a?i:ue(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:D.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=le(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function ue(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(!ae.call(e,r))return!1;t.push(r)}return t}function O(e){if(!de(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!de(n)||!n.hasOwnProperty(`isPrototypeOf`))}function de(e){return Object.prototype.toString.call(e)===`[object Object]`}function fe(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function k(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(!k(e[r],t[r],n))return!1;return!0}if(O(e)&&O(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!k(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||!k(e[o],t[o],n)))return!1;return i===a}return!1}function pe(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 A=/[\x00-\x1f\x7f"<>`{}]/g;function me(e){return e.replace(A,e=>`%`+e.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`))}function he(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 me(t)}var ge=[`http:`,`https:`,`mailto:`,`tel:`];function j(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function _e(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+=he(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=he(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function ve(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function M(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 N(){throw Error(`Invariant failed`)}function P(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 F=4,I=5;function ye(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 be(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=ye(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 L(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=be(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=z(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=B(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=z(r);e.kind=I,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=z(r);e.kind=F,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)L(e,t,r,c,i,a,o,s)}function R(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 z(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 B(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 V(e,t){let n=z(`/`),r=new Uint16Array(6),i=[];for(let t of e)L(!1,r,t,1,n,0,i);for(let e of i)e.sort(R);t.masksTree=n,t.flatCache=P(1e3)}function xe(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=Ee(e,t.masksTree);return t.flatCache.set(e,r),r}function Se(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=z(`/`),L(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),Ee(r,o,n)}function Ce(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=Ee(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Oe(a.route)),t.matchCache.set(r,a),a}function we(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Te(e,t=!1,n){let r=z(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;L(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&N(),o[e.id]=e,c!==0&&e.path){let t=we(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(R);return{processedTree:{segmentTree:r,singleCache:P(1e3),matchCache:P(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function Ee(e,t,n=!1){let r=e.split(`/`),i=Ae(e,r,t,n);if(!i)return null;let[a]=De(e,r,i);return{route:i.node.route,rawParams:a}}function De(e,t,n){let r=ke(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===F)break;if(u.kind===I){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 Oe(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function ke(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function Ae(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!T(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&&!U(l,n))continue;if(i.parse){if(!Me(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==F&&U(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===F||i.kind===2)&&U(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&&(Me(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&je(f,o))return n;U(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+H(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+H(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+H(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+H(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 H(e,t){return 2**(e-t-1)}function je(e,t){return e===2**(t-1)-1}function Me(e,t,n){let r,i;try{[r,i]=De(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 U(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===F)>(e.node.kind===F)||t.node.kind===F==(e.node.kind===F)&&t.node.depth>e.node.depth)))}function Ne(e){return Pe(e.filter(e=>e!==void 0).join(`/`))}function Pe(e){return e.replace(/\/{2,}/g,`/`)}function Fe(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Ie(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Le(e){return Ie(Fe(e))}function W(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Re(e,t,n){return W(e,n)===W(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&&T(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&&(T(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=Pe(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=be(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 k(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 j(e.href,n)?void 0:e.href;if(!ft(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),j(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=W(e.pathname,r),i=W(t.pathname,r);if(!(n.startsWith(i)&&(n.length===i.length||n[i.length]===`/`)))return!1}return(n?.includeSearch??!0)&&!k(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=re(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:te,onMouseEnter:T,onMouseLeave:E,onTouchStart:D,ignoreBlocker:ae,params:oe,search:se,hash:ce,state:le,mask:ue,reloadDocument:O,unsafeRelative:de,from:fe,_fromLocation:k,...pe}=e,A=Ke(),me=et(e.search),he=et(e.params),ge=et(s),j=f.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,me,he,e.state,e.mask,e.unsafeRelative]),_e=f.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...j}),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,ge,n.basepath,A,i!==void 0)]},[ge,b,A,j,n,c]),[ve,M,N]=Qe(n.stores.location,_e,tt),P=N?ie(a,{})??ot:at,F=N?at:ie(o,{})??at,I=[S,P.className,F.className].filter(Boolean).join(` `),ye=(x||P.style||F.style)&&{...x,...P.style,...F.style},[be,L]=f.useState(!1),R=f.useRef(!1),z=e.reloadDocument||M?!1:l??n.options.defaultPreload,B=u??n.options.defaultPreloadDelay??0,V=f.useCallback(()=>{n.preloadRoute(j).catch(e=>{console.warn(e),console.warn(We)})},[n,j]);ne(i,f.useCallback(e=>{e?.isIntersecting&&V()},[V]),ut,!!b||z!==`viewport`),f.useEffect(()=>{R.current||!b&&z===`render`&&(V(),R.current=!0)},[b,V,z]);let xe=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(()=>{L(!0)});let t=n.subscribe(`onResolved`,()=>{t(),L(!1)});n.navigate({...j,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:ae})}};if(M)return{...pe,ref:i,href:M,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...C&&{onClick:C},...w&&{onBlur:w},...te&&{onFocus:te},...T&&{onMouseEnter:T},...E&&{onMouseLeave:E},...D&&{onTouchStart:D}};let Se=e=>{if(b||z!==`intent`)return;if(!B){V();return}let t=e.currentTarget;if(G.has(t))return;let n=setTimeout(()=>{G.delete(t),V()},B);G.set(t,n)},Ce=e=>{b||z!==`intent`||V()},we=e=>{if(b||!z||!B)return;let t=e.currentTarget,n=G.get(t);n&&(clearTimeout(n),G.delete(t))};return{...pe,...P,...F,href:ve,ref:i,onClick:K([C,xe]),onBlur:K([w,we]),onFocus:K([te,Se]),onMouseEnter:K([T,Se]),onMouseLeave:K([E,we]),onTouchStart:K([D,Ce]),disabled:!!b,target:y,...ye&&{style:ye},...I&&{className:I},...b&&st,...N&&ct,...A&&be&&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})}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:t=>e(`/api/database/snapshots/${encodeURIComponent(t)}`),onSuccess:()=>J(t)})}function Wt(){return l({mutationFn:e=>t(`/api/database/snapshots/${encodeURIComponent(e)}/restore`)})}function Gt(){return l({mutationFn:e=>t(`/api/database/import`,e)})}function Kt(){return u({queryKey:q.lifecycle,queryFn:({signal:e})=>i(`/api/lifecycle`,e),refetchInterval:!1})}function qt(){return l({mutationFn:()=>t(`/api/lifecycle/restart`)})}function Jt(){return l({mutationFn:()=>t(`/api/lifecycle/shutdown`)})}function Yt(){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 Xt(){let e=d();return l({mutationFn:e=>t(`/api/setup`,{password:e}),onSuccess:()=>e.invalidateQueries()})}function Zt(){let e=d();return l({mutationFn:()=>t(`/api/logout`),onSuccess:()=>{e.clear()}})}function Qt(){let e=d();return l({mutationFn:()=>t(`/api/client/logout`),onSuccess:()=>e.clear()})}function $t(){return u({queryKey:q.clientSummary,queryFn:({signal:e})=>i(`/api/client/summary`,e)})}function en(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 tn(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 nn(e=6e4){return u({queryKey:q.clientQuota,queryFn:async({signal:e})=>(await i(`/api/client/quota`,e)).accounts,refetchInterval:e})}function rn(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 an(){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 on(){let t=d();return l({mutationFn:t=>e(`/api/credentials/${t}`),onSuccess:()=>{t.invalidateQueries({queryKey:q.credentials}),t.invalidateQueries({queryKey:q.credentialHealth})}})}function sn(){let e=d();return l({mutationFn:e=>n(`/api/models/${e.id}`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.models})})}function cn(){let t=d();return l({mutationFn:t=>e(`/api/models/${t}`),onSuccess:()=>t.invalidateQueries({queryKey:q.models})})}function ln(){return l({mutationFn:({modelId:e,need:n})=>t(`/api/models/${e}/dry-run`,n)})}function un(){let e=d();return l({mutationFn:e=>t(`/api/keys`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.keys})})}function dn(){let e=d();return l({mutationFn:({id:e,limits:t})=>n(`/api/keys/${e}/limits`,{limits:t}),onSuccess:()=>e.invalidateQueries({queryKey:q.keys})})}function fn(){let e=d();return l({mutationFn:({id:e,modelAllowlist:t})=>n(`/api/keys/${e}/models`,{modelAllowlist:t}),onSuccess:()=>e.invalidateQueries({queryKey:q.keys})})}function pn(){let t=d();return l({mutationFn:t=>e(`/api/keys/${t}`),onSuccess:()=>t.invalidateQueries({queryKey:q.keys})})}function mn(){let e=d();return l({mutationFn:e=>n(`/api/settings`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.settings})})}function hn(){return l({mutationFn:e=>n(`/api/settings/password`,e)})}function gn(){let e=d();return l({mutationFn:e=>n(`/api/settings/viewer-password`,{password:e}),onSuccess:()=>e.invalidateQueries({queryKey:q.status})})}function _n(){return l({mutationFn:e=>t(`/api/connect/start`,e)})}function vn(){let e=d();return l({mutationFn:e=>t(`/api/credentials`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.credentials})})}function yn(){let e=d();return l({mutationFn:e=>t(`/api/connect/finish`,e),onSuccess:()=>e.invalidateQueries({queryKey:q.credentials})})}function bn(){return u({queryKey:q.plugins,queryFn:async({signal:e})=>(await i(`/api/plugins`,e)).plugins,staleTime:3e5})}async function xn(e){let t=await o(`/api/connect/poll`,{method:`POST`,body:{flowId:e},accept:[202]});return t.status===202?{status:`pending`}:t.data}var Sn=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),Cn=new Intl.NumberFormat(`en-US`);function wn(e){return Number.isFinite(e)?e<1e4?Cn.format(Math.round(e)):Sn.format(e).toLowerCase():`—`}function Tn(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${Sn.format(e).toLowerCase()}`:`—`}function En(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 Dn(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var On=[[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=On.find(([e])=>t<e);return n===void 0?`—`:`${Math.floor(t/n[1])}${n[2]}`}function kn(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 An(e){return new Date(e).toLocaleTimeString(`en-GB`,{hour12:!1})}var jn=864e5;function Mn(e,t){let n=new Date(e),r=n.toLocaleTimeString(`en-GB`,{hour:`2-digit`,minute:`2-digit`,hour12:!1});return Nn(t)?`${n.toLocaleDateString(`en-GB`,{day:`2-digit`,month:`short`})} ${r}`:r}function Nn(e){return e>=jn}function Pn(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 Fn=[`B`,`KiB`,`MiB`,`GiB`,`TiB`];function In(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<Fn.length-1;)t/=1024,n+=1;return`${t.toFixed(1)} ${Fn[n]}`}function Ln(e,t=8){return e.length<=t?e:`${e.slice(0,t)}…`}var Rn={fiveHour:18e6,daily:864e5,weekly:6048e5};function X(e,t){return t!==null&&t>0?t:Rn[e]}var zn=6e4;function Z(e,t){return e===null||t===null?e===t:Math.abs(e-t)<=zn}function Bn(e,t){return e.resetsAt!==null&&e.resetsAt<=t}function Vn(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 Hn(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 Un(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 Wn(e){return e.filter(e=>!Q(e))}function $(e){return Q(e)?!1:e.status>=400||e.errorCode!==null}var Gn={ok:`●`,warn:`◐`,down:`○`,idle:`·`,live:`●`};function Kn(e){return Q(e)?`live`:$(e)?`down`:`ok`}function qn(e){return Q(e)?`in flight`:$(e)?`failed with ${e.status}`:`succeeded`}function Jn(e,t){let n=Wn(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:Un(r,.5),ttftP95:Un(r,.95),costUsd:a,inputTokens:o,outputTokens:s,cacheReadTokens:c,cacheWriteTokens:l}}function Yn(e,t){let n=Wn(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=Un(l[e]??[],.5);return c}var Xn={tokenRejected:`reconnect needed — provider rejected the refresh token`,expiredNoRefresh:`reconnect needed — token expired with nothing to refresh from`};function Zn(e,t,n,r=null){if(!n){let e=r===`tokenRejected`||r===`expiredNoRefresh`;return{state:e?`down`:`idle`,note:e?Xn[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 Qn={fiveHour:`5h`,daily:`24h`,weekly:`7d`};function $n(e){return Math.max(e,6e4)*3}function er(e,t,n){return e.observedAt<=0||t-e.observedAt>$n(n)}function tr(e,t){return t?.ratePerHour===void 0||t.ratePerHour===null||e.limit===null||e.limit<=0?null:t.ratePerHour/e.limit}function nr(e,t){return e.find(e=>e.windowType===t)}function rr(e,t,n,r,i){return ir(e,{stale:er(e,t,n),rolledOver:Bn(e,t),estimateStale:i===void 0||i.stale,survives:i?.survives??null,exhaustsAt:i?.exhaustsAt??null},t,r)}function ir(e,t,n,r){let i=Qn[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 ar(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 or(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 sr(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&&or(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 cr(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 lr(e){return e.startsAt===null||e.resetsAt===null?null:{from:{at:e.startsAt,percent:0},to:{at:e.resetsAt,percent:100}}}var ur=36e5;function dr(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)/ur);return l<=100?{from:c,to:{at:r,percent:l}}:{from:c,to:{at:i+(100-o)/s*ur,percent:100}}}var fr={fiveHour:0,daily:1,weekly:2};function pr(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)=>fr[e.window.windowType]-fr[t.window.windowType])}function mr(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 hr=C`
2
+ 0%, 100% { opacity: 1; }
3
+ 50% { opacity: 0.28; }
4
+ `,gr=S`
5
+ color: ${({theme:e})=>e.color.ok};
6
+ animation: ${hr} 1.2s ease-in-out infinite;
7
+
8
+ @media (prefers-reduced-motion: reduce) {
9
+ animation: none;
10
+ }
11
+ `,_r={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:gr},vr=x.span`
20
+ font-family: ${({theme:e})=>e.font.mono};
21
+ font-size: 12px;
22
+ line-height: 1;
23
+ flex: none;
24
+ ${({$state:e})=>_r[e]}
25
+ `;function yr({state:e,label:t,className:n}){return b(vr,{$state:e,className:n,role:`img`,"aria-label":t,title:t,children:Gn[e]})}export{rn as $,ze as $t,wn as A,sn as At,At as B,vt as Bt,X as C,w as Cn,bn as Ct,In as D,qt as Dt,Hn as E,Mt as Et,kn as F,gn as Ft,Rt as G,$e as Gt,_t as H,kt as Ht,Tn as I,Tt as It,Dt as J,Ge as Jt,Ot as K,Qe as Kt,Nn as L,Xt as Lt,Y as M,mn as Mt,En as N,dn as Nt,Mn as O,Wt as Ot,Dn as P,fn as Pt,nn as Q,Ne as Qt,Ln as R,Jt as Rt,cr as S,le as Sn,It as St,Vn as T,xt as Tt,xn as U,Ht as Ut,ht as V,an as Vt,q as W,pt as Wt,Qt as X,Be as Xt,hn as Y,Pe as Yt,tn as Z,He as Zt,sr as _,oe as _n,Kt as _t,lr as a,Ce as an,vn as at,ar as b,T as bn,jt as bt,mr as c,Te as cn,bt as ct,er as d,ge as dn,on as dt,Le as en,$t as et,qn as f,M as fn,cn as ft,ir as g,ie as gn,Ct as gt,rr as h,ve as hn,Gt as ht,Yn as i,xe as in,Pt as it,Pn as j,Vt as jt,An as k,pn as kt,$ as l,P as ln,yt as lt,dr as m,k as mn,ln as mt,Qn as n,Ie as nn,yn as nt,nr as o,Se as on,un as ot,Kn as p,_e as pn,Ut as pt,Et as q,Xe as qt,fr as r,Oe as rn,_n as rt,Zn as s,V as sn,Bt as st,yr as t,Fe as tn,en as tt,Q as u,N as un,Lt as ut,pr as v,j as vn,Yt as vt,Bn as w,te as wn,gt as wt,Jn as x,ce as xn,St as xt,tr as y,pe as yn,Zt as yt,Nt as z,zt};
@@ -1,4 +1,4 @@
1
- import{Et as e,I as t,Lt as n,N as r,P as i,St as a,Ut as o,Wt as s,_t as c,bt as l,i as u,t as d,x as f,yt as p}from"./Lamp-ZlMzNs5N.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{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-Cxp-OxUq.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(`
2
2
  `)}var Be=le`
3
3
  :root {
4
4
  ${({$providers:e})=>ze(e,`light`)}
@@ -202,7 +202,7 @@ import{Et as e,I as t,Lt as n,N as r,P as i,St as a,Ut as o,Wt as s,_t as c,bt 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:n,signOut:a}){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=n||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:n?`request log unreadable`:`error rate ${i(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:i(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: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:a.pending,onClick:a.run,children:k(ke,{})})]})}function ht(){let e=s(),{cadence:t}=fe(),n=p(),r=l(200,t(1e4,`res:logs`));return k(mt,{logs:r.data??[],logsFailed:r.isError,signOut:{pending:n.isPending,run:()=>{n.mutate(void 0,{onSuccess:()=>void e({to:`/login`})})}}})}function gt(e){return`/plugins/${e}`}function _t(e){return e.filter(e=>e.nav!==null&&e.ui!==null).sort((e,t)=>e.id.localeCompare(t.id)).map(e=>({id:e.id,label:e.nav?.label??e.name,disabledReason:vt(e)}))}function vt(e){let t=e.ui;return t===null||t.compatible&&t.entry!==null?null:t.reason??`This plugin's interface does not match this gateway.`}var yt=Object.defineProperty,bt=(e,t)=>yt(e,`name`,{value:t,configurable:!0});function xt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}bt(xt,`setRef`);function St(...e){return t=>{let n=!1,r=e.map(e=>{let r=xt(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():xt(e[t],null)}}}}bt(St,`composeRefs`);function P(...e){return w.useCallback(St(...e),e)}bt(P,`useComposedRefs`);var Ct=Object.defineProperty,F=(e,t)=>Ct(e,`name`,{value:t,configurable:!0});function wt(e){let t=w.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];Mt(r)&&typeof It==`function`&&(r=It(r._payload)),w.Children.forEach(r,e=>{if(At(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;Mt(n)&&typeof It==`function`&&(n=It(n._payload)),a=Dt(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=w.cloneElement(a,void 0,s):!o&&w.Children.count(r)===1&&w.isValidElement(r)&&(a=r);let c=a?kt(a):void 0,l=P(n,c);if(!a){if(r||r===0)throw Error(o?Ft(e):Pt(e));return r}let u=Ot(i,a.props??{});return a.type!==w.Fragment&&(u.ref=n?l:c),w.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}F(wt,`createSlot`);var Tt=Symbol.for(`radix.slottable`);function Et(e){let t=F(e=>`child`in e?e.children(e.child):e.children,`Slottable`);return t.displayName=`${e}.Slottable`,t.__radixId=Tt,t}F(Et,`createSlottable`);var Dt=F((e,t)=>{if(`child`in e.props){let t=e.props.child;return w.isValidElement(t)?w.cloneElement(t,void 0,e.props.children(t.props.children)):null}return w.isValidElement(t)?t:null},`getSlottableElementFromSlottable`);function Ot(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}F(Ot,`mergeProps`);function kt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}F(kt,`getElementRef`);function At(e){return w.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Tt}F(At,`isSlottable`);var jt=Symbol.for(`react.lazy`);function Mt(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===jt&&`_payload`in e&&Nt(e._payload)}F(Mt,`isLazyComponent`);function Nt(e){return typeof e==`object`&&!!e&&`then`in e}F(Nt,`isPromiseLike`);var Pt=F(e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,`createSlotError`),Ft=F(e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,`createSlottableError`),It=w.use,Lt=Object.defineProperty,Rt=(e,t)=>Lt(e,`name`,{value:t,configurable:!0}),I=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=wt(`Primitive.${t}`),r=w.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),k(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function zt(e,t){e&&se.flushSync(()=>e.dispatchEvent(t))}Rt(zt,`dispatchDiscreteCustomEvent`);var Bt=Object.defineProperty,L=(e,t)=>Bt(e,`name`,{value:t,configurable:!0});function Vt(e,t){let n=w.createContext(t);n.displayName=e+`Context`;let r=L(e=>{let{children:t,...r}=e,i=w.useMemo(()=>r,Object.values(r));return k(n.Provider,{value:i,children:t})},`Provider`);r.displayName=e+`Provider`;function i(r,i={}){let{optional:a=!1}=i,o=w.useContext(n);if(o)return o;if(t!==void 0)return t;if(!a)throw Error(`\`${r}\` must be used within \`${e}\``)}return L(i,`useContext`),[r,i]}L(Vt,`createContext`);function Ht(e,t=[]){let n=[];function r(t,r){let i=w.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=L(t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=w.useMemo(()=>o,Object.values(o));return k(s.Provider,{value:c,children:r})},`Provider`);o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=w.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return L(s,`useContext`),[o,s]}L(r,`createContext`);let i=L(()=>{let t=n.map(e=>w.createContext(e));return L(function(n){let r=n?.[e]||t;return w.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])},`useScope`)},`createScope`);return i.scopeName=e,[r,Ut(i,...t)]}L(Ht,`createContextScope`);function Ut(...e){let t=e[0];if(e.length===1)return t;let n=L(()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return L(function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return w.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])},`useComposedScopes`)},`createScope`);return n.scopeName=t.scopeName,n}L(Ut,`composeContextScopes`);var Wt=Object.defineProperty,R=(e,t)=>Wt(e,`name`,{value:t,configurable:!0}),Gt=!!(typeof window<`u`&&window.document&&window.document.createElement);function z(e,t,{checkForDefaultPrevented:n=!0}={}){return R(function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)},`handleEvent`)}R(z,`composeEventHandlers`);function Kt(e){if(!Gt)throw Error(`Cannot access window outside of the DOM`);return e?.ownerDocument?.defaultView??window}R(Kt,`getOwnerWindow`);function qt(e){if(!Gt)throw Error(`Cannot access document outside of the DOM`);return e?.ownerDocument??document}R(qt,`getOwnerDocument`);function Jt(e,t=!1){let{activeElement:n}=qt(e);if(!n?.nodeName)return null;if(Yt(n)&&n.contentDocument)return Jt(n.contentDocument.body,t);if(t){let e=n.getAttribute(`aria-activedescendant`);if(e){let t=qt(n).getElementById(e);if(t)return t}}return n}R(Jt,`getActiveElement`);function Yt(e){return e.tagName===`IFRAME`}R(Yt,`isFrame`);var B=globalThis?.document?w.useLayoutEffect:()=>{},Xt=Object.defineProperty,Zt=(e,t)=>Xt(e,`name`,{value:t,configurable:!0}),Qt=w.useEffectEvent,$t=w.useInsertionEffect;function en(e){if(typeof Qt==`function`)return Qt(e);let t=w.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof $t==`function`?$t(()=>{t.current=e}):B(()=>{t.current=e}),w.useMemo(()=>((...e)=>t.current?.(...e)),[])}Zt(en,`useEffectEvent`);var tn=Object.defineProperty,nn=(e,t)=>tn(e,`name`,{value:t,configurable:!0}),rn=w.useInsertionEffect||B;function an({prop:e,defaultProp:t,onChange:n=nn(()=>{},`onChange`),caller:r}){let[i,a,o]=on({defaultProp:t,onChange:n}),s=e!==void 0;return[s?e:i,w.useCallback(t=>{if(s){let n=sn(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}nn(an,`useControllableState`);function on({defaultProp:e,onChange:t}){let[n,r]=w.useState(e),i=w.useRef(n),a=w.useRef(t);return rn(()=>{a.current=t},[t]),w.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}nn(on,`useUncontrolledState`);function sn(e){return typeof e==`function`}nn(sn,`isFunction`);var cn=Symbol(`RADIX:SYNC_STATE`);function ln(e,t,n,r){let{prop:i,defaultProp:a,onChange:o,caller:s}=t,c=i!==void 0,l=en(o),u=[{...n,state:a}];r&&u.push(r);let[d,f]=w.useReducer((t,n)=>{if(n.type===cn)return{...t,state:n.state};let r=e(t,n);return c&&!Object.is(r.state,t.state)&&l(r.state),r},...u),p=d.state,m=w.useRef(p);w.useEffect(()=>{m.current!==p&&(m.current=p,c||l(p))},[p,m,c]);let h=w.useMemo(()=>i===void 0?d:{...d,state:i},[d,i]);return w.useEffect(()=>{c&&!Object.is(i,d.state)&&f({type:cn,state:i})},[i,d.state,c]),[h,f]}nn(ln,`useControllableStateReducer`);var un=Object.defineProperty,V=(e,t)=>un(e,`name`,{value:t,configurable:!0});function dn(e,t){return w.useReducer((e,n)=>t[e][n]??e,e)}V(dn,`useStateMachine`);var fn=V(e=>{let{present:t,children:n}=e,r=pn(t),i=typeof n==`function`?n({present:r.isPresent}):w.Children.only(n),a=hn(r.ref,gn(i));return typeof n==`function`||r.isPresent?w.cloneElement(i,{ref:a}):null},`Presence`);function pn(e){let[t,n]=w.useState(),r=w.useRef(null),i=w.useRef(e),a=w.useRef(`none`),o=w.useRef(void 0),[s,c]=dn(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return w.useEffect(()=>{s===`mounted`?(a.current=o.current??H(r.current),o.current=void 0):a.current=`none`},[s]),B(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=H(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),B(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=V(a=>{let o=H(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},`handleAnimationEnd`),s=V(e=>{e.target===t&&(a.current=H(r.current))},`handleAnimationStart`);return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:w.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=H(t)}else r.current=null;n(e)},[])}}V(pn,`usePresence`);function mn(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}V(mn,`setRef`);function hn(...e){let t=w.useRef(e);return t.current=e,w.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=mn(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():mn(n[e],null)}}},[])}V(hn,`useStableComposedRefs`);function H(e){return e?.animationName||`none`}V(H,`getAnimationName`);function gn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}V(gn,`getElementRef`);var _n=Object.defineProperty,vn=(e,t)=>_n(e,`name`,{value:t,configurable:!0}),yn=w.useId||(()=>void 0),bn=0;function xn(e){let[t,n]=w.useState(yn());return B(()=>{e||n(e=>e??String(bn++))},[e]),e||(t?`radix-${t}`:``)}vn(xn,`useId`);var Sn=Object.defineProperty,Cn=(e,t)=>Sn(e,`name`,{value:t,configurable:!0});function U(e){let t=w.useRef(e);return w.useEffect(()=>{t.current=e}),w.useMemo(()=>((...e)=>t.current?.(...e)),[])}Cn(U,`useCallbackRef`);var wn=Object.defineProperty,W=(e,t)=>wn(e,`name`,{value:t,configurable:!0}),Tn=`dismissableLayer.update`,En=`dismissableLayer.pointerDownOutside`,Dn=`dismissableLayer.focusOutside`,On,kn=w.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),An=w.forwardRef(W(function(e,t){let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=w.useContext(kn),[d,f]=w.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=w.useState({}),h=P(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=w.useRef(!1),C=Nn(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:w.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),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: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`),`
206
206
  .${dr} {
207
207
  overflow: hidden ${r};
208
208
  padding-right: ${s}px ${r};
@@ -336,7 +336,7 @@ import{Et as e,I as t,Lt as n,N as r,P as i,St as a,Ut as o,Wt as s,_t as c,bt 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:t=750}){let r=c(),i=e(),a=n(),[o,s]=D(null),[l,u]=D(!1),[d,f]=D(!1),[p,h]=D(`idle`),g=r.data;ie(()=>{if(!l)return;let e=!1,n,r=!1,i=0,a=Math.max(1,Math.ceil(la/t)),o=async()=>{let s=await ua();if(!e){if(!r&&!s)r=!0,h(`returning`);else if(r&&s){window.location.reload();return}if(i+=1,i>=a){h(`lost`),u(!1);return}n=setTimeout(()=>void o(),t)}};return n=setTimeout(()=>void o(),t),()=>{e=!0,n!==void 0&&clearTimeout(n)}},[l,t]);let _=()=>{h(`leaving`),i.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||i.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||a.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,i.isError?k(oa,{role:`alert`,children:S(i.error)}):null,a.isError?k(oa,{role:`alert`,children:S(a.error)}):null]}),k(ea,{open:o===`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:i.isPending,onConfirm:()=>{s(null),_()}}),k(ea,{open:o===`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:a.isPending,onConfirm:()=>{s(null),a.mutate(void 0,{onSuccess:()=>f(!0)})}})]})}var fa=[{to:`/`,label:`Rack`,blurb:`Live state of every account and model`,Icon:Se},{to:`/accounts`,label:`Accounts`,blurb:`Provider credentials and their health`,Icon:Te},{to:`/models`,label:`Models`,blurb:`Virtual models, targets, and routing`,Icon:we},{to:`/keys`,label:`Keys`,blurb:`Gateway API keys and their limits`,Icon:Oe},{to:`/usage`,label:`Usage`,blurb:`Requests, tokens, and spend over time`,Icon:De},{to:`/logs`,label:`Logs`,blurb:`Recent requests, one row each`,Icon:Pe},{to:`/console`,label:`Console`,blurb:`The gateway's own output, as it was printed`,Icon:Le},{to:`/settings`,label:`Settings`,blurb:`Routing weights, retries, retention`,Icon:Fe},{to:`/database`,label:`Database`,blurb:`Size, snapshots, and retention`,Icon:Ee}],pa=j.nav`
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`
340
340
  grid-area: rail;
341
341
  display: flex;
342
342
  flex-direction: column;
@@ -372,7 +372,7 @@ import{Et as e,I as t,Lt as n,N as r,P as i,St as a,Ut as o,Wt as s,_t as c,bt a
372
372
  height: 15px;
373
373
  flex: none;
374
374
  }
375
- `,ha=j(o)`
375
+ `,ha=j(s)`
376
376
  ${ma}
377
377
 
378
378
  &:hover {
@@ -412,7 +412,7 @@ import{Et as e,I as t,Lt as n,N as r,P as i,St as a,Ut as o,Wt as s,_t as c,bt a
412
412
  font-weight: 400;
413
413
  line-height: 1.3;
414
414
  color: ${({theme:e})=>e.color.warn};
415
- `;function ya(){let e=a();return A(pa,{"aria-label":`Console sections`,children:[fa.map(({to:e,label:t,blurb:n,Icon:r})=>A(ha,{to:e,title:n,activeOptions:{exact:e===`/`},children:[k(r,{}),t]},e)),_t(e.data??[]).map(({id:e,label:t,disabledReason:n})=>n===null?A(ha,{to:gt(e),title:`Provided by the ${e} plugin`,children:[k(Ce,{}),t]},e):A(ga,{type:`button`,disabled:!0,children:[k(Ce,{}),A(_a,{children:[t,k(va,{children:n})]})]},e)),k(da,{})]})}var ba=j.div`
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`
416
416
  display: grid;
417
417
  grid-template-areas:
418
418
  "chassis chassis"
@@ -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-ZlMzNs5N.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-DDI9uTPW.js";import{n as b,t as x}from"./Chip-BOyBT5TP.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-Cxp-OxUq.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-COJ643vg.js";import{n as b,t as x}from"./Chip-DG-mqRx0.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-OJcoRCqT.js";import{A as r,I as i,N as a,P as o}from"./Lamp-ZlMzNs5N.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-D798XvPQ.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-B2Lmnazz.js";import{A as r,I as i,N as a,P as o}from"./Lamp-Cxp-OxUq.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-xBT_6EtM.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)`
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-D798XvPQ.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-xBT_6EtM.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-ZlMzNs5N.js";import{b as t,y as n}from"./Rack-D798XvPQ.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-Cxp-OxUq.js";import{b as t,y as n}from"./Rack-xBT_6EtM.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-OJcoRCqT.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-ZlMzNs5N.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-B2Lmnazz.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-Cxp-OxUq.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)`
2
2
  gap: ${({theme:e})=>e.space(5)};
3
3
  flex-wrap: wrap;
4
4
  `,P=A.div`
@@ -0,0 +1,59 @@
1
+ import{A as e,F as t,H as n,It as r,N as i,P as a,Tt as o,U as s,Vt as c,at as l,b as u,c as d,ct as f,d as p,dt as ee,h as m,lt as h,n as g,nt as _,o as v,rt as te,s as ne,t as y,v as b,w as x,wt as re,xt as S,y as C}from"./Lamp-Cxp-OxUq.js";import{C as w,D as T,O as E,_ as D,a as O,b as k,i as ie,o as A,r as j,t as M,v as N,x as P}from"./Panel-CYQvfI3L.js";import{_ as F,b as I,i as ae,m as L,r as R,t as z}from"./Rack-xBT_6EtM.js";import{t as B}from"./CopyValue-CItB094V.js";import{n as V,t as oe}from"./chevron-right-BeVtzzum.js";import{t as se}from"./plus-nHMFjQ2I.js";import{t as ce}from"./trash-2-CbjLfrko.js";import{t as le}from"./Toggle-CmXXn6F3.js";import{t as ue}from"./Chip-DG-mqRx0.js";import{i as H,n as U,r as de,t as W}from"./Field-DK5zaBVA.js";import{t as fe}from"./Meter-stpt3vQu.js";import{i as pe,n as G,r as K,t as me}from"./Table-CVDZ69Zx.js";import{n as he,r as ge,t as _e}from"./WindowChart-BrLf4KCu.js";import{Fragment as ve,useCallback as q,useEffect as ye,useState as J}from"react";import{Fragment as Y,jsx as X,jsxs as Z}from"react/jsx-runtime";import Q from"styled-components";var be=I(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]);function $(e){return e?.authTypes??[]}function xe(e){return $(e).includes(`oauth`)?`oauth`:`apiKey`}function Se(e){return e[0]?.id??`anthropic`}var Ce={oauth:`Authorize in the browser`,apiKey:`Paste an API key`};function we(e){let t=e?.callback;return t===void 0?`code#state`:`${t.uri}?code=…`}var Te=Q.ol`
2
+ display: flex;
3
+ flex-direction: column;
4
+ gap: ${({theme:e})=>e.space(3)};
5
+ `,Ee=Q.div`
6
+ font-family: ${({theme:e})=>e.font.mono};
7
+ font-size: 26px;
8
+ letter-spacing: 0.22em;
9
+ text-align: center;
10
+ padding: ${({theme:e})=>e.space(3)};
11
+ background: ${({theme:e})=>e.color.panelSunk};
12
+ border: 1px solid ${({theme:e})=>e.color.ruleStrong};
13
+ border-radius: ${({theme:e})=>e.radius.control};
14
+ `,De=Q.p`
15
+ font-size: 12px;
16
+ color: ${({theme:e})=>e.color.down};
17
+ `,Oe=Q.p`
18
+ font-size: 12px;
19
+ color: ${({theme:e})=>e.color.inkDim};
20
+ `;function ke({open:e,credentials:t,onOpenChange:r,onConnected:i}){let a=re().data??[],[o,c]=J(()=>Se(a)),u=n(a,o),[d,f]=J(()=>xe(n(a,Se(a)))),[p,ee]=J(``),m=u?.label??o,[h,g]=J(null),[v,ne]=J(``),[y,b]=J(``),x=(t??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[S,C]=J(``),[E,O]=J(``),[ie,j]=J(`chat_completions`),[M,N]=J(``),[P,F]=J(null),I=te(),L=_(),R=l(),z=q(()=>{g(null),ne(``),b(``),C(``),O(``),j(`chat_completions`),N(``),F(null),ee(``),I.reset(),L.reset(),R.reset()},[I,L,R]),V=q(e=>{e||z(),r(e)},[r,z]);return ye(()=>{if(h===null||h.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await s(h.flowId);if(e)return;if(t.status===`complete`){z(),r(!1),i();return}}catch(t){if(e)return;F(A(t)),g(null);return}e||(n=setTimeout(()=>void t(),h.pollIntervalMs))},n=setTimeout(()=>void t(),h.pollIntervalMs);return()=>{e=!0,clearTimeout(n)}},[h,i,r,z]),X(ae,{open:e,onOpenChange:V,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:h===null?Z(Y,{children:[X(T,{type:`button`,onClick:()=>V(!1),children:`Cancel`}),X(T,{type:`button`,$variant:`primary`,disabled:I.isPending||R.isPending,onClick:()=>{if(F(null),d===`apiKey`){R.mutate({provider:o,apiKey:M,label:p.trim()||void 0,...o===`custom`?{endpointId:y,endpointLabel:S,origin:E,protocol:ie}:{}},{onSuccess:()=>{z(),r(!1),i()},onError:e=>F(A(e))});return}I.mutate({provider:o,label:p.trim().length===0?m:p.trim()},{onSuccess:e=>g(e),onError:e=>F(A(e))})},children:d===`apiKey`?R.isPending?`Adding…`:`Add API key`:I.isPending?`Starting…`:`Start authorization`})]}):h.kind===`device`?X(T,{type:`button`,onClick:()=>V(!1),children:`Cancel`}):Z(Y,{children:[X(T,{type:`button`,onClick:()=>V(!1),children:`Cancel`}),X(T,{type:`button`,$variant:`primary`,disabled:L.isPending||v.trim().length===0,onClick:()=>{h!==null&&(F(null),L.mutate({flowId:h.flowId,code:v.trim()},{onSuccess:()=>{z(),r(!1),i()},onError:e=>F(A(e))}))},children:L.isPending?`Finishing…`:`Finish connecting`})]}),children:Z(Te,{children:[h===null?Z(w,{$gap:3,children:[X(W,{label:`Provider`,children:e=>X(H,{...e,value:o,onChange:e=>{let t=e.target.value;c(t),f(xe(n(a,t)))},children:a.map(e=>X(`option`,{value:e.id,children:e.label},e.id))})}),$(u).length>1?X(W,{label:`How to connect`,children:e=>X(H,{...e,value:d,onChange:e=>f(e.target.value),children:$(u).map(e=>X(`option`,{value:e,children:Ce[e]},e))})}):null,o===`custom`?Z(Y,{children:[x.length===0?null:X(W,{label:`Existing endpoint`,children:e=>Z(H,{...e,value:y,onChange:e=>{let t=x.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){b(``),C(``),O(``),j(`chat_completions`);return}b(String(t.providerData.endpointId)),C(String(t.providerData.endpointLabel)),O(String(t.providerData.origin)+String(t.providerData.basePath??``)),j(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[X(`option`,{value:``,children:`Create new endpoint`}),x.map(e=>X(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),X(W,{label:`Endpoint ID`,children:e=>X(U,{...e,value:y,onChange:e=>b(e.target.value)})}),X(W,{label:`Endpoint label`,children:e=>X(U,{...e,value:S,onChange:e=>C(e.target.value)})}),X(W,{label:`Server URL`,children:e=>X(U,{...e,value:E,placeholder:`https://server.example/api`,onChange:e=>O(e.target.value)})}),E.trim().toLowerCase().startsWith(`http://`)?X(De,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,X(W,{label:`Protocol`,children:e=>Z(H,{...e,value:ie,onChange:e=>j(e.target.value),children:[X(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),X(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,d===`apiKey`?X(W,{label:`API key`,children:e=>X(U,{...e,type:`password`,value:M,autoComplete:`off`,onChange:e=>N(e.target.value)})}):null,X(W,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>X(U,{...e,value:p,placeholder:m,onChange:e=>ee(e.target.value)})})]}):Z(w,{$gap:3,children:[Z(w,{$gap:1,children:[X(D,{children:`Step 1 — authorize`}),X(k,{$gap:2,children:Z(T,{as:`a`,href:h.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[X(be,{}),`Open `,m]})}),X(B,{value:h.authorizeUrl,label:`Copy authorization link`})]}),h.userCode===null?null:Z(w,{$gap:1,children:[X(D,{children:`Step 2 — enter this code`}),X(Ee,{children:h.userCode})]}),h.kind===`device`?Z(Oe,{children:[u?.pasteHint??``,` Waiting for authorization…`]}):X(W,{label:`Authorization code`,hint:u?.pasteHint??``,...P===null?{}:{problem:P},children:e=>X(U,{...e,value:v,autoFocus:!0,placeholder:we(u),onChange:e=>ne(e.target.value)})})]}),P===null||h?.kind===`pkce`?null:X(De,{children:P})]})})}function Ae({credentialId:e,windows:t,burn:n,pollIntervalMs:r,now:i}){let a=t.map(e=>({window:e,estimate:v(n,e.windowType),since:ge(u(e))})),s=a.map(e=>e.since).filter(e=>e!==null),c=s.length===0?0:Math.min(...s),l=o({credentialId:e,since:c},s.length>0),d=l.data?.samples??[],f=l.data?.gatewayRates??[];return X(w,{$gap:4,children:a.map(e=>X(je,{window:e.window,estimate:e.estimate,since:e.since,samples:d.filter(t=>t.windowType===e.window.windowType&&t.observedAt>=(e.since??0)),gatewayRate:f.find(t=>t.windowType===e.window.windowType),pollIntervalMs:r,now:i},e.window.windowType))})}function je({window:t,estimate:n,since:r,samples:i,gatewayRate:a,pollIntervalMs:o,now:s}){let c=t.limit===null?`${e(t.used)} used`:`${e(t.used)} of ${e(t.limit)} used`,l=x(t,s),d=n===void 0||p(t,s,o)||n.stale&&!l;return X(he,{live:u(t),samples:i.map(u),since:r,now:s,ratePerHourRatio:C(t,n),exhaustsAt:n?.exhaustsAt??null,survives:n?.survives??null,stale:d,rolledOver:l,spent:c,rateText:n?.ratePerHour===void 0||n.ratePerHour===null?`unknown`:`${e(n.ratePerHour)}/h`,extraFact:X(_e,{legend:`This gateway accounts for`,value:a?.gatewayRatePerHour===void 0||a.gatewayRatePerHour===null?`unknown`:`${e(a.gatewayRatePerHour)} tokens/h`})})}var Me=Q(M)`
21
+ border-left: 3px solid ${({$provider:e})=>L(e)};
22
+ `,Ne=Q(U)`
23
+ width: 100%;
24
+ min-width: 140px;
25
+ height: 26px;
26
+ font-family: ${({theme:e})=>e.font.sans};
27
+ font-size: 12.5px;
28
+ background: transparent;
29
+ border-color: transparent;
30
+
31
+ &:hover:not(:disabled),
32
+ &:focus {
33
+ background: ${({theme:e})=>e.color.panelSunk};
34
+ border-color: ${({theme:e})=>e.color.ruleStrong};
35
+ }
36
+ `,Pe=Q(de)`
37
+ width: 62px;
38
+ height: 26px;
39
+ `,Fe=Q.span`
40
+ display: block;
41
+ padding-left: 9px;
42
+ font-size: 11px;
43
+ color: ${({theme:e})=>e.color.inkDim};
44
+ `,Ie=Q.div`
45
+ display: grid;
46
+ /* Bar, figure, legend. The figure has a column of its own so the legends stay
47
+ aligned down the stack whether a window reads 4% or 100%. */
48
+ grid-template-columns: 96px 34px 1fr;
49
+ align-items: center;
50
+ min-width: 208px;
51
+ gap: 6px;
52
+ `,Le=Q(N)`
53
+ font-size: 11px;
54
+ text-align: right;
55
+ `,Re=Q.div`
56
+ display: flex;
57
+ flex-direction: column;
58
+ gap: 4px;
59
+ `;function ze(){let e=c();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function Be(e,t){if(t===void 0)return` The list of models could not be read, so whether any target is pinned to this account is unknown.`;let n=t.filter(t=>t.targets.some(t=>t.credentialId===e.id)).map(e=>e.id);return n.length===0?``:` ${n.length===1?`The model`:`The models`} ${n.join(`, `)} ${n.length===1?`pins a target`:`pin targets`} to this account. Those targets will fail rather than fall back to another account.`}function Ve(){let{cadence:e}=F(),o=h(),s=f(e(1e4,`res:credentials`)),c=r(),l=S(),u=re(),p=ee(),{commit:_}=ze(),[te,x]=J(!1),[C,A]=J(null),[N,I]=J(new Set),ae=e=>I(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),L=Date.now(),B=o.data??[],H=u.data??[],U=e=>n(H,e)?.order??1/0,de=[...new Set(B.map(e=>e.provider))].sort((e,t)=>U(e)-U(t)),W=e=>n(H,e)?.label??e,he=d(s.data?.health??[],e=>e.credentialId),ge=d(s.data?.quota??[],e=>e.credentialId),_e=d(s.data?.burn??[],e=>e.credentialId),q=c.data?.quotaPollIntervalMs??3e5,ye=B.filter(e=>e.enabled).length,Q=o.isLoading?`Reading connected accounts…`:B.length===0?`No provider credentials are connected, so every request fails at the router.`:`${ye} of ${B.length} accounts are enabled and eligible for routing.`;return Z(Y,{children:[X(z,{legend:`Accounts`,title:`Provider accounts`,summary:Q,actions:Z(T,{type:`button`,$variant:`primary`,onClick:()=>x(!0),children:[X(se,{}),`Connect an account`]})}),o.isError?X(M,{legend:`Accounts`,children:X(ie,{error:o.error,onRetry:()=>void o.refetch()})}):o.isLoading?X(M,{legend:`Accounts`,children:X(O,{rows:5})}):B.length===0?X(M,{legend:`Accounts`,children:X(j,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:X(T,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>x(!0),children:`Connect an account`})})}):X(w,{$gap:4,children:de.map(e=>{let n=B.filter(t=>t.provider===e);return X(Me,{$provider:e,legend:W(e),meta:`${n.length} account${n.length===1?``:`s`}`,flush:!0,children:X(P,{children:Z(me,{children:[X(`thead`,{children:Z(`tr`,{children:[X(K,{$width:`24%`,children:`Account`}),X(K,{$width:`20%`,children:`Sign-in`}),X(K,{$align:`right`,$width:`86px`,children:`Tier`}),X(K,{$align:`right`,$width:`94px`,children:`Weight`}),X(K,{$align:`center`,$width:`86px`,children:`Enabled`}),X(K,{$width:`240px`,children:`Quota`}),X(K,{$align:`right`,$width:`88px`,children:`TTFT`}),X(K,{$align:`right`,$width:`130px`,children:`Token expires`}),X(K,{$width:`76px`})]})}),X(`tbody`,{children:n.map(e=>{let n=ne(he.get(e.id)??[],L,e.enabled,e.disabledReason),r=ge.get(e.id)??[],o=_e.get(e.id)??[],s=b(r),c=N.has(e.id);return Z(ve,{children:[Z(pe,{children:[Z(G,{children:[Z(k,{$gap:2,children:[X(y,{state:n.state,label:n.note===``?`healthy`:n.note}),X(Ne,{defaultValue:e.label,"aria-label":`Label for ${e.label}`,onBlur:t=>{let n=t.target.value.trim();if(n.length===0||n===e.label){t.target.value=e.label;return}_(e.id,{label:n})}})]}),n.note===``?null:X(Fe,{children:n.note})]}),X(G,{children:Z(k,{$gap:1,children:[X(ue,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:X(D,{children:e.accountEmail})]})}),X(G,{$align:`right`,children:X(Pe,{min:1,step:1,defaultValue:e.tier,"aria-label":`Tier for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isInteger(n)||n<1||n===e.tier){t.target.value=String(e.tier);return}_(e.id,{tier:n})}})}),X(G,{$align:`right`,children:X(Pe,{min:.1,step:.1,defaultValue:e.weight,"aria-label":`Weight for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isFinite(n)||n<=0||n===e.weight){t.target.value=String(e.weight);return}_(e.id,{weight:n})}})}),X(G,{$align:`center`,children:X(le,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>_(e.id,{enabled:t})})}),X(G,{children:s.length===0?X(D,{children:`unknown`}):X(Re,{children:s.map(({window:e,fraction:n})=>Z(Ie,{children:[X(fe,{fraction:n,label:`${g[e.windowType]} window, ${Math.round(n*100)}% used`}),X(Le,{children:a(n,0)}),X(D,{children:m(e,L,q,t,v(o,e.windowType))})]},e.windowType))})}),X(G,{$align:`right`,$mono:!0,children:i(n.ttftMs)}),X(G,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:t(e.expiresAt,L)}),X(G,{$align:`right`,children:Z(k,{$gap:1,$justify:`flex-end`,children:[r.length===0?null:X(E,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":c,"aria-label":`${c?`Hide`:`Show`} quota history for ${e.label}`,title:`${c?`Hide`:`Show`} quota history for ${e.label}`,onClick:()=>ae(e.id),children:X(c?V:oe,{})}),X(E,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>A(e),children:X(ce,{})})]})})]}),c?X(pe,{children:X(G,{colSpan:9,children:X(Ae,{credentialId:e.id,windows:r,burn:o,pollIntervalMs:q,now:L})})}):null]},e.id)})})]})})},e)})}),X(ke,{open:te,credentials:o.data??[],onOpenChange:x,onConnected:()=>void o.refetch()}),X(R,{open:C!==null,onOpenChange:e=>{e||A(null)},title:`Remove account`,body:C===null?``:`Removing "${C.label}" deletes its stored token. Any model target pointing at ${W(C.provider)} loses this account, and reconnecting means authorizing again.`+Be(C,l.data),confirmLabel:`Remove account`,busy:p.isPending,onConfirm:()=>{C!==null&&p.mutate(C.id,{onSettled:()=>A(null)})}})]})}var He=Ve;export{He as component};
@@ -0,0 +1,44 @@
1
+ import{A as e,St as t,it as n,z as r}from"./Lamp-Cxp-OxUq.js";import{a as i,b as a,i as o,r as s,t as c,y as l}from"./Panel-CYQvfI3L.js";import{_ as ee,t as u}from"./Rack-xBT_6EtM.js";import{a as d,i as te,o as ne,r as f}from"./stream-VJMOV03S.js";import{i as p}from"./Field-DK5zaBVA.js";import{useQueryClient as m}from"@tanstack/react-query";import{useLayoutEffect as h,useMemo as g,useRef as _,useState as v}from"react";import{jsx as y,jsxs as b}from"react/jsx-runtime";import x from"styled-components";var S={debug:10,info:20,warn:30,error:40};function C(e){return typeof e==`string`&&e in S}function w(e,t){return!C(t)||e.level===null||S[e.level]>=S[t]}function T(e){if(typeof e!=`object`||!e)return null;let{raw:t,at:n,level:r,msg:i}=e;return typeof t!=`string`||n!==null&&typeof n!=`number`||r!==null&&!C(r)||i!==null&&typeof i!=`string`?null:{raw:t,at:n,level:r,msg:i}}function E(e){if(typeof e!=`object`||!e)return null;let{lines:t}=e;if(!Array.isArray(t))return null;let n=[];for(let e of t){let t=T(e);if(t===null)return null;n.push(t)}return n}var D=[100,200,500],O=[{value:``,label:`All levels`},{value:`debug`,label:`Debug and above`},{value:`info`,label:`Info and above`},{value:`warn`,label:`Warnings and errors`},{value:`error`,label:`Errors only`}],k=x(a)`
2
+ gap: ${({theme:e})=>e.space(2)};
3
+ flex-wrap: wrap;
4
+ `,A=x(p)`
5
+ width: auto;
6
+ `,j=x.div`
7
+ display: grid;
8
+ grid-template-rows: auto minmax(0, 1fr);
9
+ gap: ${({theme:e})=>e.space(4)};
10
+ min-height: 0;
11
+ flex: 1;
12
+ `,M=x(c)`
13
+ min-height: 0;
14
+
15
+ > div {
16
+ display: flex;
17
+ flex: 1;
18
+ flex-direction: column;
19
+ min-height: 0;
20
+ }
21
+ `,N=x.div`
22
+ flex: 1;
23
+ min-height: 0;
24
+ overflow-x: auto;
25
+ overflow-y: auto;
26
+ `,P=x.pre`
27
+ margin: 0;
28
+ padding: ${({theme:e})=>e.space(3)};
29
+ font-family: ${({theme:e})=>e.font.mono};
30
+ font-size: 12px;
31
+ line-height: 1.65;
32
+ white-space: pre;
33
+ `,F=x.div`
34
+ color: ${({theme:e,$level:t})=>t===`error`?e.color.down:t===`warn`?e.color.warn:t===`debug`?e.color.inkFaint:e.color.ink};
35
+ `,I=x.p`
36
+ margin: 0;
37
+ padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
38
+ border-top: 1px solid ${({theme:e})=>e.color.rule};
39
+ color: ${({theme:e})=>e.color.inkDim};
40
+ font-size: 12px;
41
+ `,L=x.code`
42
+ font-family: ${({theme:e})=>e.font.mono};
43
+ word-break: break-all;
44
+ `;function R({read:e}){return e.source===`file`?b(I,{children:[`Reading `,y(L,{children:e.path}),`, named by `,y(L,{children:`OMNI_LOG_FILE`}),`. That variable says where the gateway's output is being captured; it does not redirect it.`]}):e.source===`journal`?b(I,{children:[`Reading the systemd journal for `,y(L,{children:`omnigateway.service`}),`. To read a file instead, redirect the gateway's output to one and point `,y(L,{children:`OMNI_LOG_FILE`}),` at the same path.`]}):null}var z=[],B={read:void 0,lines:z};function V(){let{cadence:a}=ee(),c=m(),[p,x]=v(200),[S,C]=v(``),[T,I]=v(``),L=t().data?.nodes??[],V=L.length>1,U=T===``&&V?`all`:T,W=U===``||U===`all`?null:`${d}:${U}`,G=n(p,S,a(r,W??`stream:console`),U),K=G.data,[q,J]=v(B),Y=q.read===K?q.lines:z,X=g(()=>[...K?.lines??[],...Y].slice(-p),[K,Y,p]),Z=_(null),Q=_(!0),$=e=>{if(e.kind!==`frame`&&e.kind!==`gap`&&e.kind!==`closed`)return;let t=e.kind===`frame`?E(e.payload):null;if(t===null){J({read:K,lines:z}),e.kind===`frame`&&ne(c,d);return}let n=t.filter(e=>w(e,S));n.length!==0&&J(e=>({read:K,lines:[...e.read===K?e.lines:[],...n].slice(-p)}))};return te(d,e=>{W===null&&$(e)}),f(W,$),h(()=>{let e=Z.current;e!==null&&Q.current&&X.length>0&&(e.scrollTop=e.scrollHeight)},[X]),b(j,{children:[y(u,{legend:`Console`,title:`Gateway output`,summary:G.isLoading?`Reading the gateway's own output…`:`${e(X.length)} lines of what this process is doing. Requests are in Logs; prompt bodies, tokens and keys are never written here.`,actions:b(k,{children:[V?b(A,{value:U,"aria-label":`Which process to show`,onChange:e=>I(e.target.value),children:[y(`option`,{value:`all`,children:`every process`}),L.map(e=>y(`option`,{value:e.id,children:e.self?`${e.id.slice(0,8)} (this one)`:e.id.slice(0,8)},e.id))]}):null,y(A,{value:S,"aria-label":`Which levels to show`,onChange:e=>C(e.target.value),children:O.map(e=>y(`option`,{value:e.value,children:e.label},e.value))}),y(A,{value:p,"aria-label":`How many lines to fetch`,onChange:e=>x(Number(e.target.value)),children:D.map(e=>b(`option`,{value:e,children:[`last `,e]},e))})]})}),b(M,{legend:`Process output`,meta:K===void 0?void 0:y(l,{children:H(K)}),flush:!0,children:[K===void 0?null:y(R,{read:K}),y(N,{ref:Z,"data-testid":`console-terminal`,onScroll:e=>{let t=e.currentTarget;Q.current=t.scrollHeight-t.scrollTop-t.clientHeight<=8},children:G.isError?y(o,{error:G.error,onRetry:()=>void G.refetch()}):G.isLoading?y(`div`,{style:{padding:12},children:y(i,{rows:10})}):K!==void 0&&K.source===`none`?y(s,{legend:`Nothing is capturing this gateway`,message:"Its output is going to a terminal, so there is nothing to read back. To capture it, run the gateway under systemd with `omni service install`, or start it with `omni start`, which redirects output to a file and points OMNI_LOG_FILE at it."}):X.length===0?y(s,{legend:`Nothing to show`,message:S===``?`This log is empty. The gateway writes here when it boots, refreshes a token, or polls a quota.`:`No line in this window is at that level. Widen the filter to see everything.`}):y(P,{children:X.map((e,t)=>y(F,{$level:e.level,children:e.nodeId===void 0?e.raw:`[${e.nodeId.slice(0,8)}] ${e.raw}`},`${e.at??0}-${t}`))})})]})]})}function H(e){return e.source===`file`?`log file`:e.source===`journal`?`systemd journal`:e.source===`fleet`?`every process, merged`:`not captured`}var U=V;export{U as component};