omnigateway 0.11.2 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/omni.js +1533 -751
- package/gateway.js +2040 -1258
- package/package.json +2 -4
- package/public/assets/{Chip-77Q04h7S.js → Chip-roGX6zyg.js} +5 -1
- package/public/assets/CopyValue-FO5yNkRC.js +27 -0
- package/public/assets/{Field-56pmSGrh.js → Field-BYBri2NV.js} +1 -1
- package/public/assets/Lamp-DsUSnxN4.js +26 -0
- package/public/assets/{Panel-BV18WuL1.js → Panel-CWmOTDAP.js} +5 -0
- package/public/assets/Rack-CSpeYQ1D.js +483 -0
- package/public/assets/{Readout-Dxwka1JI.js → Readout-BTh732hP.js} +1 -1
- package/public/assets/{RequestTable-I395emqH.js → RequestTable-xpG3dPST.js} +1 -1
- package/public/assets/{SummaryDeck-pAZ93jBW.js → SummaryDeck-DwRGp7mB.js} +1 -1
- package/public/assets/{Toggle-y17mtXCV.js → Toggle-BTJVC9Se.js} +1 -1
- package/public/assets/TokenBreakdown-DT7or6C9.js +32 -0
- package/public/assets/{WindowChart-DWZtz4Ps.js → WindowChart-C-oJo3fW.js} +1 -1
- package/public/assets/{_app-0fHLZIC7.js → _app-Drf03PWk.js} +1 -1
- package/public/assets/{_app.accounts-DBlImnPw.js → _app.accounts-D8eynNaM.js} +12 -12
- package/public/assets/{_app.console-in_iVnep.js → _app.console-DbM7Zbgu.js} +1 -1
- package/public/assets/{_app.database-CPj-Juag.js → _app.database-Bj4UJUBZ.js} +7 -7
- package/public/assets/{_app.index-DGz9njXx.js → _app.index-2hdPR1Le.js} +1 -1
- package/public/assets/_app.keys-BYk7HsiW.js +92 -0
- package/public/assets/{_app.logs-C7BhBRjg.js → _app.logs-sG1w9y1i.js} +1 -1
- package/public/assets/_app.models-BqdGSdg4.js +148 -0
- package/public/assets/{_app.plugins._pluginId-Bx1LgcDj.js → _app.plugins._pluginId-Bf9D8Qiz.js} +1 -1
- package/public/assets/{_app.settings-s6K98CA2.js → _app.settings-TzCc7Sd3.js} +1 -1
- package/public/assets/{_app.usage-Bp45JtBe.js → _app.usage-XQHmzx-j.js} +1 -1
- package/public/assets/chevron-right-DgdKbG-g.js +1 -0
- package/public/assets/{client-Bl_FA5jI.js → client-B_g7bcxd.js} +1 -1
- package/public/assets/index-C_8ChaGY.js +14 -0
- package/public/assets/{login-Qc9iIepG.js → login-Dgd5jBoq.js} +1 -1
- package/public/assets/plus-UgaZwucC.js +1 -0
- package/public/assets/preload-helper-CvG2RSKd.js +1 -0
- package/public/assets/{shared-ChaZCaBz.js → shared-wEQ9LHZa.js} +1 -1
- package/public/assets/trash-IE0YvGCJ.js +1 -0
- package/public/index.html +5 -5
- package/public/shared/chunks/react-DK6rpPfu.js +1 -0
- package/public/shared/chunks/react-dom-Wr82bmbV.js +1 -0
- package/public/shared/dashboard-sdk.js +1 -1
- package/public/shared/react-dom-client.js +5 -5
- package/public/shared/react-dom.js +1 -1
- package/public/shared/react-query.js +1 -1
- package/public/shared/react.js +1 -1
- package/public/shared/styled-components.js +1 -1
- package/public/assets/CopyValue-DDJId-Zo.js +0 -27
- package/public/assets/Lamp-Drd1fFwQ.js +0 -25
- package/public/assets/Rack-D3iFlR6e.js +0 -482
- package/public/assets/TokenBreakdown-BIwuEVs8.js +0 -32
- package/public/assets/_app.keys-C-Fk39-U.js +0 -92
- package/public/assets/_app.models-BuiRrOrz.js +0 -148
- package/public/assets/chevron-right-BE-3EQR5.js +0 -1
- package/public/assets/index-nvJxJ9Gp.js +0 -13
- package/public/assets/plus-DhyoE7aH.js +0 -1
- package/public/assets/preload-helper-DYShfVEU.js +0 -1
- package/public/assets/trash-2-zGGJ7VE_.js +0 -1
- package/public/shared/chunks/react-GitiQ0dt.js +0 -1
- package/public/shared/chunks/react-dom-BFxyned6.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnigateway",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
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>",
|
|
@@ -15,9 +15,7 @@
|
|
|
15
15
|
"README.md",
|
|
16
16
|
"LICENSE"
|
|
17
17
|
],
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@node-rs/argon2": "2.2.0"
|
|
20
|
-
},
|
|
18
|
+
"dependencies": {},
|
|
21
19
|
"engines": {
|
|
22
20
|
"bun": ">=1.3.0"
|
|
23
21
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as e}from"./Rack-
|
|
1
|
+
import{m as e}from"./Rack-CSpeYQ1D.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
|
line-height: 1;
|
|
@@ -13,6 +13,10 @@ import{m as e}from"./Rack-D3iFlR6e.js";import{jsx as t}from"react/jsx-runtime";i
|
|
|
13
13
|
font-size: 10.5px;
|
|
14
14
|
letter-spacing: 0.02em;
|
|
15
15
|
white-space: nowrap;
|
|
16
|
+
|
|
17
|
+
svg {
|
|
18
|
+
transform: translateY(-0.5px);
|
|
19
|
+
}
|
|
16
20
|
`,a=n.span`
|
|
17
21
|
display: inline-flex;
|
|
18
22
|
align-items: center;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import{C as e,O as t}from"./Panel-CWmOTDAP.js";import{b as n}from"./Rack-CSpeYQ1D.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={name:`check`,size:24,node:[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]};u.node;var d=n(u),f={name:`copy`,size:24,node:[[`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`}]]};f.node;var p=n(f);function m(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 h(e,t){if(typeof navigator<`u`&&navigator.clipboard!==void 0)try{return await navigator.clipboard.writeText(e),`copied`}catch{}let n=m(t??null);if(n&&typeof document.execCommand==`function`)try{if(document.execCommand(`copy`))return`copied`}catch{}return n?`selected`:`failed`}var g=l.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: stretch;
|
|
4
|
+
gap: 0;
|
|
5
|
+
border: 1px solid ${({theme:e})=>e.color.ruleStrong};
|
|
6
|
+
border-radius: ${({theme:e})=>e.radius.control};
|
|
7
|
+
background: ${({theme:e})=>e.color.panelSunk};
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
`,_=l.code`
|
|
10
|
+
flex: 1;
|
|
11
|
+
min-width: 0;
|
|
12
|
+
padding: 7px 8px;
|
|
13
|
+
font-family: ${({theme:e})=>e.font.mono};
|
|
14
|
+
font-size: 12px;
|
|
15
|
+
word-break: break-all;
|
|
16
|
+
user-select: all;
|
|
17
|
+
`,v=l(t)`
|
|
18
|
+
border: 0;
|
|
19
|
+
border-left: 1px solid ${({theme:e})=>e.color.ruleStrong};
|
|
20
|
+
border-radius: 0;
|
|
21
|
+
height: auto;
|
|
22
|
+
width: 32px;
|
|
23
|
+
flex: none;
|
|
24
|
+
`,y=l.p`
|
|
25
|
+
font-size: 11px;
|
|
26
|
+
color: ${({theme:e})=>e.color.warn};
|
|
27
|
+
`,b={selected:`Your browser would not copy it. The value is selected — copy it with your keyboard.`,failed:`Your browser would not copy it. Select the value and copy it by hand.`};function x({value:t,label:n}){let[l,u]=o(null),f=a(null);i(()=>{if(l!==`copied`)return;let e=setTimeout(()=>u(null),1600);return()=>clearTimeout(e)},[l]);let m=r(()=>{h(t,f.current).then(u)},[t]),x=l===`copied`,S=l===null?void 0:b[l];return c(e,{$gap:1,children:[c(g,{children:[s(_,{ref:f,children:t}),s(v,{type:`button`,$variant:`ghost`,onClick:m,"aria-label":x?`Copied`:n,title:x?`Copied`:n,children:s(x?d:p,{})})]}),S===void 0?null:s(y,{role:`status`,children:S})]})}export{x as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as e}from"./Panel-
|
|
1
|
+
import{_ as e}from"./Panel-CWmOTDAP.js";import{useId as t}from"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";import i from"styled-components";var a=`
|
|
2
2
|
width: 100%;
|
|
3
3
|
border-radius: 3px;
|
|
4
4
|
transition: border-color 120ms ease;
|
|
@@ -0,0 +1,26 @@
|
|
|
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-CWmOTDAP.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 x,{css as S,keyframes as ee}from"styled-components";var C=f.use,te=f.useLayoutEffect;function ne(e,t,n){f.useEffect(()=>{if(!e.current||n||typeof IntersectionObserver!=`function`)return()=>t();let r=new IntersectionObserver(e=>{t(e.pop())},{rootMargin:`100px`});return r.observe(e.current),()=>{r.disconnect(),t()}},[t,n,e])}function re(e){let t=f.useRef(null);return f.useImperativeHandle(e,()=>t.current,[]),t}function w(e){return e[e.length-1]}function ie(e,t){return typeof e==`function`?e(t):e}var T=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;function ae(e){for(let t in e)if(T.call(e,t))return!0;return!1}var oe=()=>Object.create(null),se=(e,t)=>ce(e,t,oe);function ce(e,t,n=()=>({}),r=0){if(e===t)return e;if(r>500)return t;let i=t,a=de(e)&&de(i);if(!a&&!(D(e)&&D(i)))return i;let o=a?e:le(e);if(!o)return i;let s=a?i:le(i);if(!s)return i;let c=o.length,l=s.length,u=a?Array(l):n(),d=0;for(let t=0;t<l;t++){let o=a?t:s[t],l=e[o],f=i[o];if(l===f){u[o]=l,(a?t<c:T.call(e,o))&&d++;continue}if(l===null||f===null||typeof l!=`object`||typeof f!=`object`){u[o]=f;continue}let p=ce(l,f,n,r+1);u[o]=p,p===l&&d++}return c===l&&d===c?e:u}function le(e){let t=Object.keys(e);if(t.length!==Object.getOwnPropertyNames(e).length)return!1;let n=Object.getOwnPropertySymbols(e);if(n.length===0)return t;for(let r of n){if(!E.call(e,r))return!1;t.push(r)}return t}function D(e){if(!ue(e))return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(!ue(n)||!n.hasOwnProperty(`isPrototypeOf`))}function ue(e){return Object.prototype.toString.call(e)===`[object Object]`}function de(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function O(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(!O(e[r],t[r],n))return!1;return!0}if(D(e)&&D(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!O(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||!O(e[o],t[o],n)))return!1;return i===a}return!1}function fe(e){return typeof e?.message==`string`?e.message.startsWith(`Failed to fetch dynamically imported module`)||e.message.startsWith(`error loading dynamically imported module`)||e.message.startsWith(`Importing a module script failed`):!1}var pe=/[\x00-\x1f\x7f"<>`{}]/g;function me(e){return e.replace(pe,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 _e(e){if(e[0]!==`/`&&e.includes(`:`))return/^[\x00-\x20]*([a-z][a-z\d+.\t\n\r-]*:)/i.exec(e)?.[1]?.replace(/[\t\n\r]/g,``).toLowerCase()}var ve=/^[\x00-\x20]*[\\/][\t\n\r]*[\\/]/;function k(e,t){if(!e)return!1;if(ve.test(e))return!0;let n=_e(e);return n?!t.has(n):!1}function A(e){if(!e)return e;let t=e;if(/[%\\\x00-\x1f\x7f]/.test(e)){let n=/%25|%5C/gi,r=0,i;for(t=``;(i=n.exec(e))!==null;)t+=he(e.slice(r,i.index))+i[0],r=n.lastIndex;t+=he(r?e.slice(r):e)}return t}function ye(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function j(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 M(){throw Error(`Invariant failed`)}function N(e){let t=new Map,n,r;return{get(e){let n=t.get(e);if(n)return n.visited=!0,n.value},set(i,a){let o=t.get(i);if(o){o.value=a;return}if(t.size>=e){let e=n?.next().value;for(;!e||e.visited;)e?e.visited=!1:n=t.values(),e=n.next().value;e===r&&(n=void 0),t.delete(e.key)}let s={key:i,value:a,visited:!1};r=s,t.set(i,s)},clear(){t.clear(),n=void 0,r=void 0}}}var P=4,F=5;function I(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=a.indexOf(`{`),s;if(o!==-1&&o+1<a.length&&(s=a.indexOf(`}`,o))!==-1){let r=a.charCodeAt(o+1);if(r===45){if(o+2<a.length&&a.charCodeAt(o+2)===36){let e=o+3,r=s;if(e<r)return n[0]=3,n[1]=t+o,n[2]=t+e,n[3]=t+r,n[4]=t+s+1,n[5]=i,n}}else if(r===36){let r=o+1,a=o+2;return a===s?(n[0]=2,n[1]=t+o,n[2]=t+r,n[3]=t+a,n[4]=t+s+1,n[5]=e.length,n):(n[0]=1,n[1]=t+o,n[2]=t+a,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=I(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);u||(t=t.toLowerCase(),c=c.toLowerCase());let m=f===1?i.dynamic:f===3?i.optional:i.wildcard,h=f!==2&&!d&&m?.find(e=>!e.parse&&e.caseSensitive===p&&e.prefix===t&&e.suffix===c);if(h)n=h;else{let e=B(f,r,p,t,c);n=e,e.parent=i,e.depth=a;let s;s=f===1?i.dynamic??=[]:f===3?i.optional??=[]:i.wildcard??=[],s.push(e),s.length===2&&o?.push(s)}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=F,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=P,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=N(1e3)}function be(e,t){e||=`/`;let n=t.flatCache.get(e);if(n!==void 0)return n;let r=U(e,t.masksTree);return t.flatCache.set(e,r),r}function H(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)),U(r,o,n)}function xe(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=U(e,t.segmentTree,n)}catch(e){if(e instanceof URIError)a=null;else throw e}return a&&(a.branch=Te(a.route)),t.matchCache.set(r,a),a}function Se(e){return e===`/`?e:e.replace(/\/{1,}$/,``)}function Ce(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&&M(),o[e.id]=e,c!==0&&e.path){let t=Se(e.fullPath);(!s[t]||e.fullPath.endsWith(`/`))&&(s[t]=e)}c++});for(let e of a)e.sort(R);return{processedTree:{segmentTree:r,singleCache:N(1e3),matchCache:N(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function U(e,t,n=!1){let r=e.split(`/`),i=De(e,r,t,n);if(!i)return null;let[a]=we(e,r,i);return{route:i.node.route,rawParams:a}}function we(e,t,n){let r=Ee(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===P)break;if(u.kind===F){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;if(e.charCodeAt(t)===123){let n=u.suffix.length,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,r=u.suffix.length,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,e.length-t.suffix.length),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 Te(e){let t=[e];for(;e.parentRoute;)e=e.parentRoute,t.push(e);return t.reverse(),t}function Ee(e){let t=Array(e.depth+1);do t[e.depth]=e,e=e.parent;while(e);return t}function De(e,t,n,r){if(e===`/`&&n.index)return{node:n.index,skipped:0};let i=!w(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&&!G(l,n))continue;if(i.parse){if(!ke(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==P&&G(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===P||i.kind===2)&&G(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&&(ke(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Oe(f,o))return n;G(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(`/`),i=e.slice(-a.length);if((n.caseSensitive?i:i.toLowerCase())!==a||e.length-a.length<r.length)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.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p,optionals:m+W(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.indexOf(r,e.length-r.length)<n.length)continue}s.push({node:t,index:u+1,skipped:d,statics:f,dynamics:p+W(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+W(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+W(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 W(e,t){return 2**(e-t-1)}function Oe(e,t){return e===2**(t-1)-1}function ke(e,t,n){let r,i;try{[r,i]=we(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 G(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===P)>(e.node.kind===P)||t.node.kind===P==(e.node.kind===P)&&t.node.depth>e.node.depth)))}function Ae(e){return je(e.filter(e=>e!==void 0).join(`/`))}function je(e){return e.replace(/\/{2,}/g,`/`)}function Me(e){return e===`/`?e:e.replace(/^\/{1,}/,``)}function Ne(e){let t=e.length;return t>1&&e[t-1]===`/`?e.replace(/\/{1,}$/,``):e}function Pe(e){return Ne(Me(e))}function Fe(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Ie({base:e,to:t,trailingSlash:n=`never`,cache:r}){if(t.includes(`//`)&&(t=je(t)),t.startsWith(`/`))return t.length===1||n===`preserve`?t:n===`always`?t.endsWith(`/`)?t:`${t}/`:t.endsWith(`/`)?t.slice(0,-1):t;let i=t===`.`,a;if(r){a=i?e:e+`\0`+t;let n=r.get(a);if(n)return n}let o;if(i)o=e.split(`/`);else{for(e.includes(`//`)&&(e=je(e)),o=e.split(`/`);o.length>1&&w(o)===``;)o.pop();let n=t.split(`/`);for(let e=0,t=n.length;e<t;e++){let r=n[e];r===``?e?e===t-1&&o.push(r):o=[r]:r===`..`?o.length>1?o.pop():o=[``]:r===`.`||o.push(r)}}o.length>1&&(w(o)===``?n===`never`&&o.pop():n===`always`&&o.push(``));let s=o.join(`/`),c=(i?je(s):s)||`/`;return a&&r&&r.set(a,c),c}function Le(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 Re(e,t,n){let r=t[e];return typeof r==`string`?e===`_splat`?/^[a-zA-Z0-9\-._~!/]*$/.test(r)?r:r.split(`/`).map(e=>Be(e,n)).join(`/`):Be(r,n):r}function ze({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=I(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=Re(`_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=Re(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=Re(i,t,n)??``;l+=`/`+u+f+d;continue}}return e.endsWith(`/`)&&(l+=`/`),{usedParams:a,interpolatedPath:l||`/`,isMissingParams:i}}function Be(e,t){let n=encodeURIComponent(e);return t?.(n)??n}var Ve=`Error preloading route! ☝️`;function He({children:e,fallback:t=null}){return b(p.Fragment,{children:Ue()?e:t})}function Ue(){return p.useSyncExternalStore(We,()=>!0,()=>!1)}function We(){return()=>{}}function Ge(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Ke=typeof Object.is==`function`?Object.is:Ge;function qe(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(Ke(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 Je(e,t){return e===t}function Ye(e,t,n=Je){let r=m(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=m(()=>e?.get(),[e]);return qe(r,i,i,t,n)}function Xe(e){let t=r();return f.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function Ze(e){let t=f.useRef(e);return O(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function Qe(e,t){return e[0]===t[0]&&e[1]===t[1]}function $e(e,t){let n=typeof e==`string`&&_e(e);if(n)return t.has(n)?e:null}function et(e,t,n,r,i){let a=Fe(e.pathname,r),o=Fe(t.pathname,r);return(n?.exact?a!==o:!a.startsWith(o)||a.length!==o.length&&a[o.length]!==`/`)||(n?.includeSearch??!0)&&!O(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function tt(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:ee,onBlur:C,onFocus:te,onMouseEnter:w,onMouseLeave:T,onTouchStart:E,ignoreBlocker:ae,params:oe,search:se,hash:ce,state:le,mask:D,reloadDocument:ue,unsafeRelative:de,from:O,_fromLocation:fe,...pe}=e,me=c,he=Ue(),ge=Ze(e.search),ve=Ze(e.params),k=Ze(s),A=f.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,ge,ve,e.state,e.mask,e.unsafeRelative]),ye=f.useCallback(e=>{let t=$e(me,n.protocolAllowlist);if(t!==void 0)return[t??void 0];let r=n.buildLocation({_fromLocation:e,...A}),i=st(r,n,b);return[i,!b&&(!i||_e(i))?void 0:et(e,r,k,n.basepath,he)]},[k,b,he,A,n,me]),[j,M]=Ye(n.stores.location,ye,Qe),N=M===void 0?j:void 0,P=b||j===void 0,F=f.useRef(!1),I=e.reloadDocument||N||P?!1:l??n.options.defaultPreload,L=u??n.options.defaultPreloadDelay??0,R=f.useCallback(()=>{n.preloadRoute(A).catch(e=>{console.warn(e),console.warn(Ve)})},[n,A]),z=f.useCallback(e=>{if(!e){ot(i);return}if(!(e.isIntersecting??I===`intent`)){e.isIntersecting===!1&&ot(i);return}if(!L){R();return}K.has(i)||K.set(i,setTimeout(()=>{K.delete(i),R()},L))},[R,i,I,L]);if(ne(i,z,I!==`viewport`),f.useEffect(()=>{F.current||I===`render`&&(R(),F.current=!0)},[R,I]),N)return{...pe,ref:i,href:N,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...S&&{className:S},...ee&&{onClick:ee},...C&&{onBlur:C},...te&&{onFocus:te},...w&&{onMouseEnter:w},...T&&{onMouseLeave:T},...E&&{onTouchStart:E}};let B=ie(M?a:o,{})??(M?rt:nt),V=B.className,be=S?V?`${S} ${V}`:S:V,H=B.style,xe=x&&H?{...x,...H}:x||H,Se=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;!P&&!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0&&(e.preventDefault(),n.navigate({...A,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:ae}))},Ce=()=>{I===`intent`&&R()},U=()=>{I===`intent`&&ot(i)};return{...pe,...B,href:j,ref:i,onClick:q(ee,Se),onBlur:q(C,U),onFocus:q(te,z),onMouseEnter:q(w,z),onMouseLeave:q(T,U),onTouchStart:q(E,Ce),disabled:!!P,target:y,...xe&&{style:xe},...be&&{className:be},...P&&it,...M&&at}}var nt={},rt={className:`active`},it={role:`link`,"aria-disabled":!0},at={"data-status":`active`,"aria-current":`page`},K=new WeakMap,ot=e=>{clearTimeout(K.get(e)),K.delete(e)},q=(e,t)=>e?n=>n.defaultPrevented||(e(n),n.defaultPrevented||t(n)):t;function st(e,t,n){if(n)return;let r=e.maskedLocation??e,i=r.external?r.publicHref:t.history.createHref(r.publicHref)||`/`;if(!r.external&&i===r.publicHref||!k(i,t.protocolAllowlist))return i}var ct=f.forwardRef((e,t)=>{let{_asChild:n,...r}=e,{type:i,...a}=tt(r,t),o=typeof r.children==`function`?r.children({isActive:a[`data-status`]===`active`}):r.children;if(!n){let{disabled:e,...t}=a;a=t}return f.createElement(n||`a`,a,o)}),J={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`]},lt=c({queryKey:J.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 ut(){return u(lt)}function dt(e,t){return e.find(e=>e.id===t)}function ft(){return u({queryKey:J.status,queryFn:({signal:e})=>i(`/api/status`,e),staleTime:3e4})}function pt(){return u({queryKey:J.credentials,queryFn:async({signal:e})=>(await i(`/api/credentials`,e)).credentials})}function mt(e=1e4){return u({queryKey:J.credentialHealth,queryFn:({signal:e})=>i(`/api/credentials/health`,e),refetchInterval:e})}function ht(e,t=!0){return u({queryKey:J.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 gt(){return u({queryKey:J.models,queryFn:async({signal:e})=>(await i(`/api/models`,e)).models})}function _t(){return u({queryKey:J.keys,queryFn:async({signal:e})=>(await i(`/api/keys`,e)).keys})}var vt={queryKey:J.settings,queryFn:({signal:e})=>i(`/api/settings`,e)};function yt(){return u({...vt,select:e=>e.settings})}function bt(){return u({...vt,select:e=>e.bodyLoggingAllowed&&e.settings.bodyLoggingEnabled})}function xt(){return u({...vt,select:e=>e.bodyLoggingAllowed})}function St(){return u({...vt,select:e=>e.dayOffsetMinutes??null})}function Ct(e,t){return u({queryKey:J.agentSetup(e,t),enabled:t!==void 0,queryFn:async({signal:n})=>(await i(a(`/api/agent-setup`,{client:e,...t??{}}),n)).files})}function wt(e,t=6e4){return u({queryKey:J.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 Tt=2e3;function Et(e=100,t=Tt){return u({queryKey:J.logs(e),queryFn:async({signal:t})=>(await i(a(`/api/logs`,{limit:e}),t)).logs,refetchInterval:t})}function Dt(e){return u({queryKey:J.requestBody(e??``),enabled:e!==null,queryFn:({signal:t})=>i(`/api/requests/${encodeURIComponent(e??``)}/body`,t),refetchInterval:!1})}var Ot=5e3;function kt(e=200,t=``,n=Ot,r=``){return u({queryKey:J.console(e,t,r),queryFn:async({signal:n})=>i(a(`/api/console`,{lines:e,...t===``?{}:{level:t},...r===``?{}:{node:r}}),n),refetchInterval:n})}var At=3e4;function jt(){return u({queryKey:J.nodes,queryFn:async({signal:e})=>i(`/api/nodes`,e),refetchInterval:At})}function Mt(){return u({queryKey:J.database,queryFn:({signal:e})=>i(`/api/database`,e),refetchInterval:!1,refetchOnWindowFocus:!1,staleTime:1/0})}function Nt(e){return`/api/database/snapshots/${encodeURIComponent(e)}/download`}function Pt(){return u({queryKey:J.snapshots,queryFn:async({signal:e})=>(await i(`/api/database/snapshots`,e)).snapshots,refetchInterval:!1})}function Y(e){e.invalidateQueries({queryKey:J.database})}function Ft(){let e=d();return l({mutationFn:()=>t(`/api/database/snapshots`),onSuccess:()=>Y(e)})}function It(){let e=d();return l({mutationFn:e=>n(`/api/database/retention`,e),onSuccess:()=>{Y(e),e.invalidateQueries({queryKey:J.settings})}})}function Lt(){let e=d();return l({mutationFn:()=>t(`/api/database/vacuum`),onSuccess:()=>Y(e)})}function Rt(){let t=d();return l({mutationFn:()=>e(`/api/database/bodies`),onSuccess:()=>{Y(t),t.invalidateQueries({queryKey:[`logs`]})}})}function zt(){let t=d();return l({mutationFn:t=>e(`/api/database/snapshots/${encodeURIComponent(t)}`),onSuccess:()=>Y(t)})}function Bt(){return l({mutationFn:e=>t(`/api/database/snapshots/${encodeURIComponent(e)}/restore`)})}function Vt(){return l({mutationFn:e=>t(`/api/database/import`,e)})}function Ht(){return u({queryKey:J.lifecycle,queryFn:({signal:e})=>i(`/api/lifecycle`,e),refetchInterval:!1})}function Ut(){return l({mutationFn:()=>t(`/api/lifecycle/restart`)})}function Wt(){return l({mutationFn:()=>t(`/api/lifecycle/shutdown`)})}function Gt(){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 Kt(){let e=d();return l({mutationFn:e=>t(`/api/setup`,{password:e}),onSuccess:()=>e.invalidateQueries()})}function qt(){let e=d();return l({mutationFn:()=>t(`/api/logout`),onSuccess:()=>{e.clear()}})}function Jt(){let e=d();return l({mutationFn:()=>t(`/api/client/logout`),onSuccess:()=>e.clear()})}var Yt={queryKey:J.clientSummary,queryFn:({signal:e})=>i(`/api/client/summary`,e)};function Xt(){return u(Yt)}function Zt(){return u({...Yt,select:e=>e.dayOffsetMinutes??null})}function Qt(e,t=6e4){return u({queryKey:J.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 $t(e=100,t=Tt){return u({queryKey:J.clientLogs(e),queryFn:async({signal:t})=>(await i(a(`/api/client/logs`,{limit:e}),t)).logs,refetchInterval:t})}function en(e=6e4){return u({queryKey:J.clientQuota,queryFn:async({signal:e})=>(await i(`/api/client/quota`,e)).accounts,refetchInterval:e})}function tn(e,t=!0){return u({queryKey:J.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 nn(){let e=d();return l({mutationFn:({id:e,patch:t})=>s(`/api/credentials/${e}`,t),onSuccess:()=>{e.invalidateQueries({queryKey:J.credentials}),e.invalidateQueries({queryKey:J.credentialHealth})}})}function rn(){let t=d();return l({mutationFn:t=>e(`/api/credentials/${t}`),onSuccess:()=>{t.invalidateQueries({queryKey:J.credentials}),t.invalidateQueries({queryKey:J.credentialHealth})}})}function an(){let e=d();return l({mutationFn:e=>n(`/api/models/${encodeURIComponent(e.id)}`,e),onSuccess:()=>e.invalidateQueries({queryKey:J.models})})}function on(){let t=d();return l({mutationFn:t=>e(`/api/models/${encodeURIComponent(t)}`),onSuccess:()=>t.invalidateQueries({queryKey:J.models})})}function sn(){return l({mutationFn:({modelId:e,need:n})=>t(`/api/models/${encodeURIComponent(e)}/dry-run`,n)})}function cn(){let e=d();return l({mutationFn:e=>t(`/api/keys`,e),onSuccess:()=>e.invalidateQueries({queryKey:J.keys})})}function ln(){let e=d();return l({mutationFn:({id:e,limits:t})=>n(`/api/keys/${e}/limits`,{limits:t}),onSuccess:()=>e.invalidateQueries({queryKey:J.keys})})}function un(){let e=d();return l({mutationFn:({id:e,modelAllowlist:t})=>n(`/api/keys/${e}/models`,{modelAllowlist:t}),onSuccess:()=>e.invalidateQueries({queryKey:J.keys})})}function dn(){let e=d();return l({mutationFn:({id:e,expiresAt:t})=>n(`/api/keys/${e}/expiry`,{expiresAt:t}),onSuccess:()=>e.invalidateQueries({queryKey:J.keys})})}function fn(){let t=d();return l({mutationFn:t=>e(`/api/keys/${t}`),onSuccess:()=>t.invalidateQueries({queryKey:J.keys})})}function pn(){let e=d();return l({mutationFn:e=>n(`/api/settings`,e),onSuccess:()=>e.invalidateQueries({queryKey:J.settings})})}function mn(){return l({mutationFn:e=>n(`/api/settings/password`,e)})}function hn(){let e=d();return l({mutationFn:e=>n(`/api/settings/viewer-password`,{password:e}),onSuccess:()=>e.invalidateQueries({queryKey:J.status})})}function gn(){return l({mutationFn:e=>t(`/api/connect/start`,e)})}function _n(){let e=d();return l({mutationFn:e=>t(`/api/credentials`,e),onSuccess:()=>e.invalidateQueries({queryKey:J.credentials})})}function vn(){let e=d();return l({mutationFn:e=>t(`/api/connect/finish`,e),onSuccess:()=>e.invalidateQueries({queryKey:J.credentials})})}function yn(){return u({queryKey:J.plugins,queryFn:async({signal:e})=>(await i(`/api/plugins`,e)).plugins,staleTime:3e5})}async function bn(e){let t=await o(`/api/connect/poll`,{method:`POST`,body:{flowId:e},accept:[202]});return t.status===202?{status:`pending`}:t.data}var xn=new Intl.NumberFormat(`en-US`,{notation:`compact`,maximumFractionDigits:1}),Sn=new Intl.NumberFormat(`en-US`);function Cn(e){return Number.isFinite(e)?e<1e4?Sn.format(Math.round(e)):xn.format(e).toLowerCase():`—`}function wn(e){return Number.isFinite(e)?e===0?`$0`:e<.01?`$${e.toFixed(4)}`:e<100?`$${e.toFixed(2)}`:`$${xn.format(e).toLowerCase()}`:`—`}function Tn(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 En(e,t=1){return Number.isFinite(e)?`${(e*100).toFixed(t)}%`:`—`}var Dn=[[6e4,1e3,`s`],[36e5,6e4,`m`],[864e5,36e5,`h`],[1/0,864e5,`d`]];function On(e){let t=Math.abs(e);if(t<1e3)return`0s`;let n=Dn.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?`${On(n)} ago`:`in ${On(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}var Un=(e,t)=>e.revokedAt===null&&(e.expiresAt===null||e.expiresAt>t);function Wn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>e-t);return n[Math.min(n.length-1,Math.max(0,Math.ceil(t*n.length)-1))]??null}function Q(e){return e.state===`pending`}function Gn(e){return e.filter(e=>!Q(e))}function $(e){return Q(e)?!1:e.status>=400||e.errorCode!==null}var Kn={ok:`●`,warn:`◐`,down:`○`,idle:`·`,live:`●`};function qn(e){return Q(e)?`live`:$(e)?`down`:`ok`}function Jn(e){return Q(e)?`in flight`:$(e)?`failed with ${e.status}`:`succeeded`}function Yn(e,t){let n=Gn(e),r=[],i=0,a=0,o=0,s=0,c=0,l=0;for(let e of n)$(e)&&(i+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&r.push(e.ttftMs),a+=e.costUsd,o+=e.inputTokens,s+=e.outputTokens,c+=e.cacheReadTokens,l+=e.cacheWriteTokens;let u=t/6e4;return{requests:n.length,errors:i,errorRate:n.length===0?0:i/n.length,ratePerMin:u<=0?0:n.length/u,ttftP50:Wn(r,.5),ttftP95:Wn(r,.95),costUsd:a,inputTokens:o,outputTokens:s,cacheReadTokens:c,cacheWriteTokens:l}}function Xn(e,t){let n=Gn(e),{now:r,spanMs:i,count:a}=t,o=i/a,s=r-i,c=Array.from({length:a},(e,t)=>({at:s+t*o,total:0,errors:0,costUsd:0,tokens:0,ttftMs:null})),l=Array.from({length:a},()=>[]);for(let e of n){if(e.at<s||e.at>r)continue;let t=Math.min(a-1,Math.floor((e.at-s)/o)),n=c[t];n!==void 0&&(n.total+=1,n.costUsd+=e.costUsd,n.tokens+=e.inputTokens+e.outputTokens+e.cacheReadTokens+e.cacheWriteTokens,$(e)&&(n.errors+=1),e.ttftMs!==null&&Number.isFinite(e.ttftMs)&&l[t]?.push(e.ttftMs))}for(let[e,t]of c.entries())t.ttftMs=Wn(l[e]??[],.5);return c}var Zn={tokenRejected:`reconnect needed — provider rejected the refresh token`,expiredNoRefresh:`reconnect needed — token expired with nothing to refresh from`};function Qn(e,t,n,r=null){if(!n){let e=r===`tokenRejected`||r===`expiredNoRefresh`;return{state:e?`down`:`idle`,note:e?Zn[r]:`disabled`,consecutiveFailures:0}}let i=`ok`,a=``,o=0;for(let n of e){if(o=Math.max(o,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,consecutiveFailures:o}}var $n={fiveHour:`5h`,daily:`24h`,weekly:`7d`};function er(e){return Math.max(e,6e4)*3}function tr(e,t,n){return e.observedAt<=0||t-e.observedAt>er(n)}function nr(e,t){return t?.ratePerHour===void 0||t.ratePerHour===null||e.limit===null||e.limit<=0?null:t.ratePerHour/e.limit}function rr(e,t){return e.find(e=>e.windowType===t)}function ir(e,t,n,r,i){return ar(e,{stale:tr(e,t,n),rolledOver:Bn(e,t),estimateStale:i===void 0||i.stale,survives:i?.survives??null,exhaustsAt:i?.exhaustsAt??null},t,r)}function ar(e,t,n,r){let i=$n[e.windowType];if(e.observedAt<=0)return`${i} · never observed`;if(t.stale)return`${i} · stale, read ${r(e.observedAt,n)}`;if(t.rolledOver)return`${i} · rolled over, waiting for the next reading`;if(e.resetsAt===null)return i;let a=`resets ${r(e.resetsAt,n)}`;return t.estimateStale||t.survives!==!1||t.exhaustsAt===null?`${i} · ${a}`:`${i} · ${t.exhaustsAt<=n?`empty now`:`empty ~${On(t.exhaustsAt-n)}`} · ${a}`}function or(e){return{observedAt:e.observedAt,windowType:e.windowType,windowMs:e.windowMs,resetsAt:e.resetsAt,usedRatio:e.limit===null||e.limit<=0?null:Math.min(1,Math.max(0,e.used/e.limit))}}function sr(e,t){if(e.usedRatio!==0||t.usedRatio!==0)return!1;let n=X(e.windowType,e.windowMs),r=X(t.windowType,t.windowMs);return n===r&&Z(e.resetsAt,e.observedAt+n)&&Z(t.resetsAt,t.observedAt+r)&&!Z(t.resetsAt,e.resetsAt)}function cr(e){let t=e.filter(e=>e.usedRatio!==null).sort((e,t)=>e.observedAt-t.observedAt),n=[],r;for(let e of t){let t={at:e.observedAt,percent:Math.min(100,e.usedRatio*100)},i={resetsAt:e.resetsAt,startsAt:e.resetsAt===null?null:e.resetsAt-X(e.windowType,e.windowMs)},a=n[n.length-1],o=r!==void 0&&sr(r,e);a===void 0||r===void 0||!o&&!Z(e.resetsAt,r.resetsAt)?n.push({key:`window-${n.length}`,points:[t],...i}):(a.points.push(t),a.resetsAt=o?null:i.resetsAt,a.startsAt=o?null:i.startsAt),r=e}return n}function lr(e,t){let{usedRatio:n,observedAt:r}=t;if(n===null)return[...e];let i=e.findLastIndex(e=>Z(e.resetsAt,t.resetsAt)),a=e[i];if(a===void 0)return[...e];let o=a.points[a.points.length-1];if(o===void 0||o.at>=r)return[...e];let s={at:r,percent:Math.min(100,n*100)};return e.map((e,t)=>t===i?{...e,points:[...e.points,s]}:e)}function ur(e){return e.startsAt===null||e.resetsAt===null?null:{from:{at:e.startsAt,percent:0},to:{at:e.resetsAt,percent:100}}}var dr=36e5;function fr(e,t){let{usedRatio:n,resetsAt:r,observedAt:i}=e,a=t;if(n===null||r===null||a===null||a<=0)return null;let o=Math.min(100,n*100),s=a*100,c={at:i,percent:o},l=o+s*((r-i)/dr);return l<=100?{from:c,to:{at:r,percent:l}}:{from:c,to:{at:i+(100-o)/s*dr,percent:100}}}var pr={fiveHour:0,daily:1,weekly:2};function mr(e){return e.filter(e=>e.limit!==null&&e.limit>0).map(e=>({window:e,fraction:Math.min(1,e.used/e.limit)})).sort((e,t)=>pr[e.window.windowType]-pr[t.window.windowType])}function hr(e,t){let n=new Map;for(let r of e){let e=t(r),i=n.get(e);i===void 0?n.set(e,[r]):i.push(r)}return n}var gr=ee`
|
|
2
|
+
0%, 100% { opacity: 1; }
|
|
3
|
+
50% { opacity: 0.28; }
|
|
4
|
+
`,_r=S`
|
|
5
|
+
color: ${({theme:e})=>e.color.ok};
|
|
6
|
+
animation: ${gr} 1.2s ease-in-out infinite;
|
|
7
|
+
|
|
8
|
+
@media (prefers-reduced-motion: reduce) {
|
|
9
|
+
animation: none;
|
|
10
|
+
}
|
|
11
|
+
`,vr={ok:S`
|
|
12
|
+
color: ${({theme:e})=>e.color.ok};
|
|
13
|
+
`,warn:S`
|
|
14
|
+
color: ${({theme:e})=>e.color.warn};
|
|
15
|
+
`,down:S`
|
|
16
|
+
color: ${({theme:e})=>e.color.down};
|
|
17
|
+
`,idle:S`
|
|
18
|
+
color: ${({theme:e})=>e.color.inkFaint};
|
|
19
|
+
`,live:_r},yr=x.span`
|
|
20
|
+
font-family: ${({theme:e})=>e.font.mono};
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
line-height: 1;
|
|
23
|
+
flex: none;
|
|
24
|
+
transform: translateY(-1.5px);
|
|
25
|
+
${({$state:e})=>vr[e]}
|
|
26
|
+
`;function br({state:e,label:t,className:n}){return b(yr,{$state:e,className:n,role:`img`,"aria-label":t,title:t,children:Kn[e]})}export{Jt as $,He as $t,An as A,te as An,Dt as At,Ot as B,hn as Bt,X as C,k as Cn,qt as Ct,Hn as D,ve as Dn,yn as Dt,Vn as E,se as En,jt as Et,En as F,It as Ft,J as G,ft as Gt,lt as H,Kt as Ht,kn as I,pn as It,bt as J,Lt as Jt,Nt as K,nn as Kt,wn as L,dn as Lt,Pn as M,Bt as Mt,On as N,fn as Nt,In as O,ce as On,ut as Ot,Tn as P,an as Pt,Zt as Q,qe as Qt,Nn as R,ln as Rt,lr as S,ae as Sn,Gt as St,Bn as T,w as Tn,gt as Tt,dt as U,Wt as Ut,Tt as V,yt as Vt,bn as W,Pt as Wt,mn as X,Xe as Xt,xt as Y,ct as Yt,Rt as Z,Ye as Zt,cr as _,A as _n,zt as _t,ur as a,Me as an,vn as at,or as b,ie as bn,_t as bt,hr as c,be as cn,_n as ct,tr as d,V as dn,mt as dt,Le as en,$t as et,Jn as f,Ce as fn,pt as ft,ar as g,j as gn,on as gt,ir as h,ge as hn,rn as ht,Xn as i,Pe as in,Qt as it,Cn as j,Ut as jt,Mn as k,C as kn,ht as kt,$ as l,xe as ln,cn as lt,fr as m,M as mn,St as mt,$n as n,Ae as nn,tn as nt,rr as o,Ne as on,gn as ot,qn as p,N as pn,Mt as pt,Ct as q,wt as qt,pr as r,Ie as rn,Xt as rt,Qn as s,Te as sn,kt as st,br as t,ze as tn,en as tt,Q as u,H as un,Ft as ut,mr as v,O as vn,sn as vt,Un as w,fe as wn,Et as wt,Yn as x,_e as xn,Ht as xt,nr as y,ye as yn,Vt as yt,Ln as z,un as zt};
|
|
@@ -67,10 +67,15 @@ import*as e from"react";import{jsx as t,jsxs as n}from"react/jsx-runtime";import
|
|
|
67
67
|
svg {
|
|
68
68
|
width: 14px;
|
|
69
69
|
height: 14px;
|
|
70
|
+
transform: translateY(-0.5px);
|
|
70
71
|
}
|
|
71
72
|
`,d=r(u)`
|
|
72
73
|
padding: 0;
|
|
73
74
|
width: ${({$size:e})=>e===`sm`?`24px`:`30px`};
|
|
75
|
+
|
|
76
|
+
svg {
|
|
77
|
+
transform: none;
|
|
78
|
+
}
|
|
74
79
|
`,f=r.span`
|
|
75
80
|
font-size: 10px;
|
|
76
81
|
font-weight: 600;
|