omnigateway 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -17
- package/bin/omni.js +41 -3
- package/gateway.js +41 -3
- package/package.json +1 -1
- package/public/assets/{Confirm-gd8Y6snu.js → Confirm-BO1xS6uH.js} +1 -1
- package/public/assets/{CopyValue-Dds-Ow9a.js → CopyValue-BiiqC_Z2.js} +1 -1
- package/public/assets/{Field-D-14HF0x.js → Field-b0ohzqzR.js} +1 -1
- package/public/assets/{Match-CgNxphvS.js → Match-B2ZxNor3.js} +1 -1
- package/public/assets/{Modal-Dj3LvMS9.js → Modal-OALemCh6.js} +1 -1
- package/public/assets/{Rack-B4c0dbIb.js → Rack-DhVnjAjC.js} +1 -1
- package/public/assets/{Readout-Du15WYx0.js → Readout-VYnpaTMg.js} +1 -1
- package/public/assets/{States-CxLDlCaw.js → States-6G9NsYha.js} +1 -1
- package/public/assets/{TokenBreakdown-BySwFK6Q.js → TokenBreakdown-B9RanXin.js} +1 -1
- package/public/assets/_app-ChlUa_Ov.js +1 -0
- package/public/assets/_app.accounts-CJ6lFXIx.js +64 -0
- package/public/assets/{_app.console-CoaRdkB1.js → _app.console-eFiUh-OA.js} +1 -1
- package/public/assets/{_app.database-CES5ec5g.js → _app.database-BHaMpXld.js} +1 -1
- package/public/assets/{_app.index-DwOZe1A-.js → _app.index-C1vtrxnM.js} +1 -1
- package/public/assets/{_app.keys-B5HrAu2U.js → _app.keys-Bz6-VVJi.js} +1 -1
- package/public/assets/{_app.logs-NbfIexz0.js → _app.logs-DV7O6ZUp.js} +1 -1
- package/public/assets/{_app.models-B1MdFRtQ.js → _app.models-KIctkivt.js} +1 -1
- package/public/assets/{_app.plugins._pluginId-ByMziW8p.js → _app.plugins._pluginId-BbqXEJUB.js} +1 -1
- package/public/assets/{_app.settings-BkDkGkKF.js → _app.settings-B8zjCira.js} +1 -1
- package/public/assets/_app.usage-C4GR06sI.js +83 -0
- package/public/assets/{index-gMv8Qs7m.js → index-B2twwe7y.js} +3 -3
- package/public/assets/{login-cCXnl34r.js → login-CJz2YA-O.js} +1 -1
- package/public/assets/plus-C7a0RuII.js +1 -0
- package/public/assets/queries-BOAAI06M.js +142 -0
- package/public/assets/shared-Rzhx6i7s.js +84 -0
- package/public/assets/{trash-2-ZPh3619D.js → trash-2-C7-QrCg5.js} +1 -1
- package/public/index.html +3 -3
- package/public/assets/_app-Dx_xnlud.js +0 -1
- package/public/assets/_app.accounts-DvBYnbfS.js +0 -64
- package/public/assets/_app.usage-DNpM8Nub.js +0 -83
- package/public/assets/plus-fXfUTt6_.js +0 -1
- package/public/assets/queries-CIOPbRcE.js +0 -142
- package/public/assets/shared-B4o-2quR.js +0 -84
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as e}from"./Rack-
|
|
1
|
+
import{c as e}from"./Rack-DhVnjAjC.js";var t=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t};
|
package/public/index.html
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
|
10
10
|
<title>OmniGateway — One endpoint in front of the AI accounts you already pay for.</title>
|
|
11
11
|
<script type="importmap">{"imports":{"react":"/shared/react.js","react/jsx-runtime":"/shared/jsx-runtime.js","react-dom":"/shared/react-dom.js","react-dom/client":"/shared/react-dom-client.js","styled-components":"/shared/styled-components.js","@tanstack/react-query":"/shared/react-query.js"}}</script>
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
-
<link rel="modulepreload" crossorigin href="/assets/queries-
|
|
12
|
+
<script type="module" crossorigin src="/assets/index-B2twwe7y.js"></script>
|
|
13
|
+
<link rel="modulepreload" crossorigin href="/assets/queries-BOAAI06M.js">
|
|
14
14
|
<link rel="modulepreload" crossorigin href="/assets/matchContext-BOenO3J2.js">
|
|
15
|
-
<link rel="modulepreload" crossorigin href="/assets/Match-
|
|
15
|
+
<link rel="modulepreload" crossorigin href="/assets/Match-B2ZxNor3.js">
|
|
16
16
|
<link rel="stylesheet" crossorigin href="/assets/index-Co2s5xMk.css">
|
|
17
17
|
</head>
|
|
18
18
|
<body>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./Match-CgNxphvS.js";import{i as t,n}from"./Rack-B4c0dbIb.js";import{jsx as r}from"react/jsx-runtime";var i=()=>r(t,{children:r(n,{children:r(e,{})})});export{i as component};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import{$ as e,A as t,W as n,at as r,et as i,f as a,g as o,h as s,l as c,lt as l,nt as u,r as d,rt as f,u as p,ut as m,v as h,z as g}from"./queries-CIOPbRcE.js";import{a as _,c as v,t as y}from"./Rack-B4c0dbIb.js";import{n as b,r as ee,t as x}from"./CopyValue-Dds-Ow9a.js";import{t as S}from"./plus-fXfUTt6_.js";import{t as C}from"./trash-2-ZPh3619D.js";import{t as w}from"./Modal-Dj3LvMS9.js";import{t as T}from"./Toggle-DMk46RX2.js";import{t as te}from"./Confirm-gd8Y6snu.js";import{D as E,S as D,T as O,a as ne,g as k,h as A,i as j,m as M,n as N,o as P,p as F,s as I,t as L,u as R,v as re,w as ie,x as ae,y as oe}from"./Lamp-BDf7-dMa.js";import{t as se}from"./Chip-BltJSw8A.js";import{i as z,n as B,r as ce,t as V}from"./Field-D-14HF0x.js";import{t as le}from"./Meter-stpt3vQu.js";import{a as H,i as U,n as ue,r as de,t as fe}from"./States-CxLDlCaw.js";import{i as pe,n as W,r as G,t as me}from"./Table-CVDZ69Zx.js";import{t as he}from"./catalog-BBKm8Ih8.js";import{A as ge,C as _e,E as ve,J as ye,T as be,Y as xe,c as Se,dt as Ce,t as we,w as Te}from"./shared-B4o-2quR.js";import*as Ee from"react";import{Fragment as De,forwardRef as Oe,useCallback as ke,useEffect as Ae,useState as K}from"react";import{Fragment as q,jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";var je=v(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Me=Object.keys(he);function Ne(e){return he[e].authTypes}function Pe(e){return Ne(e).includes(`oauth`)?`oauth`:`apiKey`}var Fe={oauth:`Authorize in the browser`,apiKey:`Paste an API key`},Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},Ie={anthropic:`Authorize in the browser, then paste the code Anthropic shows you.`,openai:`Authorize in the browser. When it redirects to localhost, paste the whole URL.`,kimi:`Enter the code on Kimi's device page. This dialog finishes on its own.`,kilo:`Approve the code on Kilo's device page. This dialog finishes on its own.`,grok:`Authorize in the browser. When it redirects to 127.0.0.1, paste the whole URL.`,custom:`Enter endpoint metadata and API key.`},Le={openai:`http://localhost:1455/auth/callback?code=…`,grok:`http://127.0.0.1:56121/callback?code=…`},Re=X.ol`
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
5
|
-
`,ze=X.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
|
-
`,Be=X.p`
|
|
15
|
-
font-size: 12px;
|
|
16
|
-
color: ${({theme:e})=>e.color.down};
|
|
17
|
-
`,Ve=X.p`
|
|
18
|
-
font-size: 12px;
|
|
19
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
20
|
-
`;function He({open:t,credentials:n,onOpenChange:i,onConnected:o}){let[s,f]=K(`anthropic`),[m,h]=K(Pe(`anthropic`)),[g,_]=K(``),[v,y]=K(null),[b,ee]=K(``),[S,C]=K(``),T=(n??[]).filter((e,t,n)=>e.provider===`custom`&&n.findIndex(t=>t.provider===`custom`&&t.providerData.endpointId===e.providerData.endpointId)===t),[te,E]=K(``),[D,O]=K(``),[ne,k]=K(`chat_completions`),[A,j]=K(``),[M,N]=K(null),P=p(),F=c(),I=a(),L=ke(()=>{y(null),ee(``),C(``),E(``),O(``),k(`chat_completions`),j(``),N(null),_(``),P.reset(),F.reset(),I.reset()},[P,F,I]),R=ke(e=>{e||L(),i(e)},[i,L]);return Ae(()=>{if(v===null||v.kind!==`device`)return;let e=!1,t=async()=>{try{let t=await d(v.flowId);if(e)return;if(t.status===`complete`){L(),i(!1),o();return}}catch(t){if(e)return;N(U(t)),y(null);return}e||(n=setTimeout(()=>void t(),v.pollIntervalMs))},n=setTimeout(()=>void t(),v.pollIntervalMs);return()=>{e=!0,clearTimeout(n)}},[v,o,i,L]),J(w,{open:t,onOpenChange:R,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:v===null?Y(q,{children:[J(l,{type:`button`,onClick:()=>R(!1),children:`Cancel`}),J(l,{type:`button`,$variant:`primary`,disabled:P.isPending||I.isPending,onClick:()=>{if(N(null),m===`apiKey`){I.mutate({provider:s,apiKey:A,label:g.trim()||void 0,...s===`custom`?{endpointId:S,endpointLabel:te,origin:D,protocol:ne}:{}},{onSuccess:()=>{L(),i(!1),o()},onError:e=>N(U(e))});return}P.mutate({provider:s,label:g.trim().length===0?Z[s]:g.trim()},{onSuccess:e=>y(e),onError:e=>N(U(e))})},children:m===`apiKey`?I.isPending?`Adding…`:`Add API key`:P.isPending?`Starting…`:`Start authorization`})]}):v.kind===`device`?J(l,{type:`button`,onClick:()=>R(!1),children:`Cancel`}):Y(q,{children:[J(l,{type:`button`,onClick:()=>R(!1),children:`Cancel`}),J(l,{type:`button`,$variant:`primary`,disabled:F.isPending||b.trim().length===0,onClick:()=>{v!==null&&(N(null),F.mutate({flowId:v.flowId,code:b.trim()},{onSuccess:()=>{L(),i(!1),o()},onError:e=>N(U(e))}))},children:F.isPending?`Finishing…`:`Finish connecting`})]}),children:Y(Re,{children:[v===null?Y(r,{$gap:3,children:[J(V,{label:`Provider`,children:e=>J(z,{...e,value:s,onChange:e=>{let t=e.target.value;f(t),h(Pe(t))},children:Me.map(e=>J(`option`,{value:e,children:Z[e]},e))})}),Ne(s).length>1?J(V,{label:`How to connect`,children:e=>J(z,{...e,value:m,onChange:e=>h(e.target.value),children:Ne(s).map(e=>J(`option`,{value:e,children:Fe[e]},e))})}):null,s===`custom`?Y(q,{children:[T.length===0?null:J(V,{label:`Existing endpoint`,children:e=>Y(z,{...e,value:S,onChange:e=>{let t=T.find(t=>t.providerData.endpointId===e.target.value);if(t===void 0){C(``),E(``),O(``),k(`chat_completions`);return}C(String(t.providerData.endpointId)),E(String(t.providerData.endpointLabel)),O(String(t.providerData.origin)),k(t.providerData.protocol===`responses`?`responses`:`chat_completions`)},children:[J(`option`,{value:``,children:`Create new endpoint`}),T.map(e=>J(`option`,{value:String(e.providerData.endpointId),children:String(e.providerData.endpointLabel)},String(e.providerData.endpointId)))]})}),J(V,{label:`Endpoint ID`,children:e=>J(B,{...e,value:S,onChange:e=>C(e.target.value)})}),J(V,{label:`Endpoint label`,children:e=>J(B,{...e,value:te,onChange:e=>E(e.target.value)})}),J(V,{label:`Server origin`,children:e=>J(B,{...e,value:D,placeholder:`https://server.example`,onChange:e=>O(e.target.value)})}),D.trim().toLowerCase().startsWith(`http://`)?J(Be,{children:`Plaintext transport sends prompts and API keys without TLS.`}):null,J(V,{label:`Protocol`,children:e=>Y(z,{...e,value:ne,onChange:e=>k(e.target.value),children:[J(`option`,{value:`chat_completions`,children:`Chat Completions (/v1/chat/completions)`}),J(`option`,{value:`responses`,children:`Responses (/v1/responses)`})]})})]}):null,m===`apiKey`?J(V,{label:`API key`,children:e=>J(B,{...e,type:`password`,value:A,autoComplete:`off`,onChange:e=>j(e.target.value)})}):null,J(V,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>J(B,{...e,value:g,placeholder:Z[s],onChange:e=>_(e.target.value)})})]}):Y(r,{$gap:3,children:[Y(r,{$gap:1,children:[J(e,{children:`Step 1 — authorize`}),J(u,{$gap:2,children:Y(l,{as:`a`,href:v.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[J(je,{}),`Open `,Z[s]]})}),J(x,{value:v.authorizeUrl,label:`Copy authorization link`})]}),v.userCode===null?null:Y(r,{$gap:1,children:[J(e,{children:`Step 2 — enter this code`}),J(ze,{children:v.userCode})]}),v.kind===`device`?Y(Ve,{children:[Ie[s],` Waiting for authorization…`]}):J(V,{label:`Authorization code`,hint:Ie[s],...M===null?{}:{problem:M},children:e=>J(B,{...e,value:b,autoFocus:!0,placeholder:Le[s]??`code#state`,onChange:e=>ee(e.target.value)})})]}),M===null||v?.kind===`pkce`?null:J(Be,{children:M})]})})}var Ue=[`axis`],We=Oe((e,t)=>Ee.createElement(_e,{chartName:`LineChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:Ue,tooltipPayloadSearcher:xe,categoricalChartProps:e,ref:t})),Ge=X(u)`
|
|
21
|
-
gap: ${({theme:e})=>e.space(5)};
|
|
22
|
-
flex-wrap: wrap;
|
|
23
|
-
`,Q=X.div`
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
gap: 2px;
|
|
27
|
-
`,$=X.span`
|
|
28
|
-
font-size: 11.5px;
|
|
29
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
30
|
-
`,Ke={budget:`1 4`,projection:`6 4`},qe=`projected`;function Je(e){let t=new Map;for(let{key:n,points:r}of e)for(let e of r){let r=t.get(e.at)??{at:e.at};r[n]=e.percent,t.set(e.at,r)}return[...t.values()].sort((e,t)=>e.at-t.at)}function Ye(e,t,n){return[Math.min(e,...n.map(e=>e.pace.from.at)),Math.max(t,...n.map(e=>e.pace.to.at))]}function Xe(e,t){let n=t?.windowStartsAt??null;return n===null||e.resetsAt===null?null:n-(e.resetsAt-n)}function Ze({credentialId:e,windows:n,burn:i,pollIntervalMs:a,now:o}){let s=n.map(e=>{let t=ne(i,e.windowType);return{window:e,estimate:t,since:Xe(e,t)}}),c=s.map(e=>e.since).filter(e=>e!==null),l=c.length===0?0:Math.min(...c),u=t({credentialId:e,since:l},c.length>0),d=u.data?.samples??[],f=u.data?.gatewayRates??[];return J(r,{$gap:4,children:s.map(e=>J($e,{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:a,now:o},e.window.windowType))})}function Qe(e,t,n){let r=oe(e,t);return r===`ok`?`lasts the window`:r!==`empty`||t.exhaustsAt===null?`unknown`:t.exhaustsAt<=n?`empty now`:`empty ~${ie(t.exhaustsAt-n)} before it resets`}function $e({window:t,estimate:n,since:a,samples:o,gatewayRate:s,pollIntervalMs:c,now:l}){let d=N[t.windowType],f=t.limit===null?`${D(t.used)} used`:`${D(t.used)} of ${D(t.limit)} used`;if(n===void 0||n.stale||R(t,l,c))return Y(r,{$gap:2,children:[Y(u,{$gap:2,$wrap:!0,children:[Y(e,{children:[d,` window`]}),J($,{children:f})]}),J($,{children:`reading is stale`})]});let p=re(A(o),t),m=p.flatMap(e=>{let t=j(e);return t===null?[]:[{key:`${e.key}-budget`,pace:t}]}),h=F(t,n),g=Je([...p,...m.map(e=>({key:e.key,points:[e.pace.from,e.pace.to]})),...h===null?[]:[{key:qe,points:[h.from,h.to]}]]),_=new Set(p.map(e=>e.key)),v=Math.max(100,...h===null?[]:[h.from.percent,h.to.percent].map(e=>Math.ceil(e)));return Y(r,{$gap:2,children:[Y(u,{$gap:2,$wrap:!0,children:[Y(e,{children:[d,` window`]}),J($,{children:f})]}),Y(Ge,{children:[Y(Q,{children:[J(e,{children:`Window average`}),J(i,{children:n.ratePerHour===null?`unknown`:`${D(n.ratePerHour)}/h`})]}),Y(Q,{children:[J(e,{children:`Estimate`}),J(i,{children:Qe(t,n,l)})]}),Y(Q,{children:[J(e,{children:`Projected`}),J(i,{children:h===null?`unknown`:`${Math.round(h.to.percent)}% of limit by reset`})]}),Y(Q,{children:[J(e,{children:`This gateway accounts for`}),J(i,{children:s?.gatewayRatePerHour===void 0||s.gatewayRatePerHour===null?`unknown`:`${D(s.gatewayRatePerHour)} tokens/h`})]})]}),t.limit===null?J($,{children:`no ceiling reported`}):t.resetsAt===null||a===null?J($,{children:`no reset reported`}):p.length===0?J($,{children:`not yet observed`}):Y(q,{children:[J(e,{children:[`Used, this window and the one before`,...m.length===0?[]:[`budget dotted`],...h===null?[]:[`projection dashed`]].join(` · `)}),J(we,{$height:160,children:J(Ce,{width:`100%`,height:`100%`,children:Y(We,{data:g,margin:{top:4,right:8,bottom:4,left:4},children:[J(ge,{stroke:`var(--rule)`,vertical:!1}),J(be,{dataKey:`at`,type:`number`,scale:`time`,domain:Ye(a,t.resetsAt,m),tickFormatter:e=>ae(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,minTickGap:40}),J(Te,{domain:[0,v],allowDataOverflow:!0,tickFormatter:e=>`${Math.round(e)}%`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),J(ye,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t})=>{if(e!==!0||t===void 0||t.length===0)return null;let n=t.find(e=>_.has(String(e.dataKey)));if(n===void 0||typeof n.value!=`number`)return null;let r=n.payload.at;return Y(Se,{children:[J(`div`,{children:ae(r)}),Y(`div`,{children:[n.value.toFixed(1),`% used`]})]})}}),p.map(e=>J(ve,{type:`monotone`,dataKey:e.key,stroke:`var(--accent)`,strokeWidth:2,dot:e.points.length===1&&{r:2.5,fill:`var(--accent)`,stroke:`var(--accent)`},connectNulls:!0,isAnimationActive:!1},e.key)),m.map(e=>J(ve,{type:`linear`,dataKey:e.key,stroke:`var(--ink-faint)`,strokeWidth:1.5,strokeDasharray:Ke.budget,dot:!1,connectNulls:!0,isAnimationActive:!1},e.key)),h===null?null:J(ve,{type:`linear`,dataKey:qe,stroke:`var(--ink-dim)`,strokeWidth:1.5,strokeDasharray:Ke.projection,dot:!1,connectNulls:!0,isAnimationActive:!1})]})})})]})]})}var et=[`anthropic`,`openai`,`kimi`,`kilo`,`grok`,`custom`],tt={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`,kilo:`Kilo`,grok:`Grok`,custom:`OpenAI Compatible`},nt=X(H)`
|
|
31
|
-
border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
|
|
32
|
-
`,rt=X(B)`
|
|
33
|
-
width: 100%;
|
|
34
|
-
min-width: 140px;
|
|
35
|
-
height: 26px;
|
|
36
|
-
font-family: ${({theme:e})=>e.font.sans};
|
|
37
|
-
font-size: 12.5px;
|
|
38
|
-
background: transparent;
|
|
39
|
-
border-color: transparent;
|
|
40
|
-
|
|
41
|
-
&:hover:not(:disabled),
|
|
42
|
-
&:focus {
|
|
43
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
44
|
-
border-color: ${({theme:e})=>e.color.ruleStrong};
|
|
45
|
-
}
|
|
46
|
-
`,it=X(ce)`
|
|
47
|
-
width: 62px;
|
|
48
|
-
height: 26px;
|
|
49
|
-
`,at=X.span`
|
|
50
|
-
display: block;
|
|
51
|
-
padding-left: 9px;
|
|
52
|
-
font-size: 11px;
|
|
53
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
54
|
-
`,ot=X.div`
|
|
55
|
-
display: grid;
|
|
56
|
-
grid-template-columns: 96px 1fr;
|
|
57
|
-
align-items: center;
|
|
58
|
-
min-width: 208px;
|
|
59
|
-
gap: 6px;
|
|
60
|
-
`,st=X.div`
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
gap: 4px;
|
|
64
|
-
`;function ct(){let e=n();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function lt(){let{cadence:t}=_(),n=o(),i=s(t(1e4)),a=g(),c=h(),{commit:d}=ct(),[p,v]=K(!1),[x,w]=K(null),[D,A]=K(new Set),j=e=>A(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n}),F=Date.now(),R=n.data??[],re=I(i.data?.health??[],e=>e.credentialId),ie=I(i.data?.quota??[],e=>e.credentialId),ae=I(i.data?.burn??[],e=>e.credentialId),oe=a.data?.quotaPollIntervalMs??3e5,z=R.filter(e=>e.enabled).length,B=n.isLoading?`Reading connected accounts…`:R.length===0?`No provider credentials are connected, so every request fails at the router.`:`${z} of ${R.length} accounts are enabled and eligible for routing.`;return Y(q,{children:[J(y,{legend:`Accounts`,title:`Provider accounts`,summary:B,actions:Y(l,{type:`button`,$variant:`primary`,onClick:()=>v(!0),children:[J(S,{}),`Connect an account`]})}),n.isError?J(H,{legend:`Accounts`,children:J(ue,{error:n.error,onRetry:()=>void n.refetch()})}):n.isLoading?J(H,{legend:`Accounts`,children:J(de,{rows:5})}):R.length===0?J(H,{legend:`Accounts`,children:J(fe,{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:J(l,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>v(!0),children:`Connect an account`})})}):J(r,{$gap:4,children:et.filter(e=>R.some(t=>t.provider===e)).map(t=>{let n=R.filter(e=>e.provider===t);return J(nt,{$provider:t,legend:tt[t],meta:`${n.length} account${n.length===1?``:`s`}`,flush:!0,children:J(f,{children:Y(me,{children:[J(`thead`,{children:Y(`tr`,{children:[J(G,{$width:`24%`,children:`Account`}),J(G,{$width:`20%`,children:`Sign-in`}),J(G,{$align:`right`,$width:`86px`,children:`Tier`}),J(G,{$align:`right`,$width:`94px`,children:`Weight`}),J(G,{$align:`center`,$width:`86px`,children:`Enabled`}),J(G,{$width:`240px`,children:`Quota`}),J(G,{$align:`right`,$width:`88px`,children:`TTFT`}),J(G,{$align:`right`,$width:`130px`,children:`Token expires`}),J(G,{$width:`76px`})]})}),J(`tbody`,{children:n.map(t=>{let n=P(re.get(t.id)??[],F,t.enabled,t.disabledReason),r=ie.get(t.id)??[],i=ae.get(t.id)??[],a=k(r),o=D.has(t.id);return Y(De,{children:[Y(pe,{children:[Y(W,{children:[Y(u,{$gap:2,children:[J(L,{state:n.state,label:n.note===``?`healthy`:n.note}),J(rt,{defaultValue:t.label,"aria-label":`Label for ${t.label}`,onBlur:e=>{let n=e.target.value.trim();if(n.length===0||n===t.label){e.target.value=t.label;return}d(t.id,{label:n})}})]}),n.note===``?null:J(at,{children:n.note})]}),J(W,{children:Y(u,{$gap:1,children:[J(se,{children:t.authType===`oauth`?`oauth`:`api key`}),t.accountEmail===null?null:J(e,{children:t.accountEmail})]})}),J(W,{$align:`right`,children:J(it,{min:1,step:1,defaultValue:t.tier,"aria-label":`Tier for ${t.label}`,onBlur:e=>{let n=Number(e.target.value);if(!Number.isInteger(n)||n<1||n===t.tier){e.target.value=String(t.tier);return}d(t.id,{tier:n})}})}),J(W,{$align:`right`,children:J(it,{min:.1,step:.1,defaultValue:t.weight,"aria-label":`Weight for ${t.label}`,onBlur:e=>{let n=Number(e.target.value);if(!Number.isFinite(n)||n<=0||n===t.weight){e.target.value=String(t.weight);return}d(t.id,{weight:n})}})}),J(W,{$align:`center`,children:J(T,{checked:t.enabled,label:`Route to ${t.label}`,onCheckedChange:e=>d(t.id,{enabled:e})})}),J(W,{children:a.length===0?J(e,{children:`unknown`}):J(st,{children:a.map(({window:t,fraction:n})=>Y(ot,{children:[J(le,{fraction:n,label:`${N[t.windowType]} window, ${Math.round(n*100)}% used`}),J(e,{children:M(t,F,oe,E,ne(i,t.windowType))})]},t.windowType))})}),J(W,{$align:`right`,$mono:!0,children:O(n.ttftMs)}),J(W,{$align:`right`,$mono:!0,children:t.expiresAt===null?`never`:E(t.expiresAt,F)}),J(W,{$align:`right`,children:Y(u,{$gap:1,$justify:`flex-end`,children:[r.length===0?null:J(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":o,"aria-label":`${o?`Hide`:`Show`} quota history for ${t.label}`,title:`${o?`Hide`:`Show`} quota history for ${t.label}`,onClick:()=>j(t.id),children:J(o?ee:b,{})}),J(m,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${t.label}`,title:`Remove ${t.label}`,onClick:()=>w(t),children:J(C,{})})]})})]}),o?J(pe,{children:J(W,{colSpan:9,children:J(Ze,{credentialId:t.id,windows:r,burn:i,pollIntervalMs:oe,now:F})})}):null]},t.id)})})]})})},t)})}),J(He,{open:p,credentials:n.data??[],onOpenChange:v,onConnected:()=>void n.refetch()}),J(te,{open:x!==null,onOpenChange:e=>{e||w(null)},title:`Remove account`,body:x===null?``:`Removing "${x.label}" deletes its stored token. Any model target pointing at ${tt[x.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:c.isPending,onConfirm:()=>{x!==null&&c.mutate(x.id,{onSettled:()=>w(null)})}})]})}var ut=lt;export{ut as component};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import{$ as e,C as t,G as n,O as r,Q as i,at as a,et as o,g as s,nt as c,ot as l,rt as u}from"./queries-CIOPbRcE.js";import{i as d,n as f,r as p}from"./index-gMv8Qs7m.js";import{a as m,r as h,t as g}from"./Rack-B4c0dbIb.js";import{E as _,O as v,S as y,T as b}from"./Lamp-BDf7-dMa.js";import{a as x,n as S,r as C,t as w}from"./States-CxLDlCaw.js";import{i as T,n as E,r as D,t as O}from"./Table-CVDZ69Zx.js";import{t as ee}from"./catalog-BBKm8Ih8.js";import{$ as te,A as k,At as ne,B as re,C as ie,Ct as A,D as ae,Dt as j,E as oe,Et as M,F as N,G as P,H as se,I as ce,J as le,K as ue,L as de,M as fe,Mt as F,N as I,O as pe,Ot as me,P as L,Q as he,R as ge,S as _e,St as ve,T as ye,Tt as be,U as xe,V as Se,W as Ce,X as we,Y as Te,Z as Ee,_ as De,_t as Oe,a as ke,at as Ae,b as R,bt as je,c as Me,ct as Ne,d as z,dt as Pe,et as Fe,f as B,ft as Ie,g as Le,gt as Re,h as V,ht as ze,i as Be,it as Ve,j as He,jt as Ue,k as We,kt as Ge,l as Ke,lt as qe,m as Je,mt as Ye,n as Xe,nt as Ze,o as Qe,ot as $e,p as et,pt as tt,q as nt,r as rt,rt as it,s as H,st as at,t as ot,tt as st,u as ct,ut as lt,v as ut,vt as dt,w as ft,wt as pt,x as U,xt as mt,y as ht,yt as gt,z as _t}from"./shared-B4o-2quR.js";import{t as W}from"./Readout-Du15WYx0.js";import*as G from"react";import{PureComponent as vt,forwardRef as yt,useMemo as K,useRef as bt,useState as xt}from"react";import{jsx as q,jsxs as J}from"react/jsx-runtime";import Y from"styled-components";function St(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function Ct(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var wt=(e,t,n)=>he(e,`xAxis`,St(e,t),n),Tt=(e,t,n)=>Fe(e,`xAxis`,St(e,t),n),Et=(e,t,n)=>he(e,`yAxis`,Ct(e,t),n),Dt=(e,t,n)=>Fe(e,`yAxis`,Ct(e,t),n),Ot=je([Ne,wt,Et,Tt,Dt],(e,t,n,r,i)=>dt(e,`xAxis`)?tt(t,r,!1):tt(n,i,!1)),kt=je([st,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),At=e=>{var t=Ne(e);return dt(t,`xAxis`)?`yAxis`:`xAxis`},jt=(e,t)=>At(e)===`yAxis`?Ct(e,t):St(e,t),Mt=(e,t,n)=>te(e,At(e),jt(e,t),n),Nt=je([kt,Mt],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=Ze(e);if(n!=null&&r!=null){var i=(t[n]?.stackedData)?.find(e=>e.key===r);if(i!=null)return i.map(e=>[e[0],e[1]])}}}),Pt=je([kt,Mt],(e,t)=>{if(e!=null&&e.stackId!=null&&t!=null){var n=t[e.stackId];if(n!=null)return n.graphicalItems.map(e=>e.dataKey).filter(be)}}),Ft=je([Ne,wt,Et,Tt,Dt,Nt,Ae,Ot,kt,Ve,Pt],(e,t,n,r,i,a,o,s,c,l,u)=>{var d=o.chartData,f=o.dataStartIndex,p=o.dataEndIndex;if(!(c==null||e!==`horizontal`&&e!==`vertical`||t==null||n==null||r==null||i==null||r.length===0||i.length===0||s==null)){var m=c.data,h=m&&m.length>0?m:d?.slice(f,p+1);if(h!=null)return mn({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),It=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],Lt=[`id`,`baseLine`];function Rt(){return Rt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Rt.apply(null,arguments)}function zt(e,t){if(e==null)return{};var n,r,i=Bt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Bt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Vt(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.x,o=r[r.length-1]?.x;if(!gt(a)||!gt(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.y||0));return j(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.y||0),c)),j(c)?G.createElement(`rect`,{x:a<o?a:a-s,y:0,width:s,height:Math.floor(c+(i?parseInt(`${i}`,10):1))}):null}function Ht(e){var t=e.alpha,n=e.baseLine,r=e.points,i=e.strokeWidth,a=r[0]?.y,o=r[r.length-1]?.y;if(!gt(a)||!gt(o))return null;var s=t*Math.abs(a-o),c=Math.max(...r.map(e=>e.x||0));return j(n)?c=Math.max(n,c):n&&Array.isArray(n)&&n.length&&(c=Math.max(...n.map(e=>e.x||0),c)),j(c)?G.createElement(`rect`,{x:0,y:a<o?a:a-s,width:c+(i?parseInt(`${i}`,10):1),height:Math.floor(s)}):null}function Ut(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?G.createElement(Ht,{alpha:t,points:r,baseLine:i,strokeWidth:a}):G.createElement(Vt,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Wt(e){var t=e.animationElapsedTime,n=t===void 0?1:t,r=e.isAnimating,i=r!==void 0&&r,a=e.isEntrance,o=a!==void 0&&a,s=e.layout,c=e.isRange,l=e.stroke,u=e.connectNulls,d=zt(e,It),f=s===`vertical`?`vertical`:`horizontal`,p=u??!1,m=ce(),h=d.id,g=d.baseLine,_=zt(d,Lt),v=Ue(_),y=G.createElement($e,Rt({},d,{id:h,baseLine:g,connectNulls:p,stroke:`none`,className:`recharts-area-area`,layout:f})),b=l!==`none`&&G.createElement($e,Rt({},v,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:d.points})),x=l!==`none`&&c&&Array.isArray(g)&&G.createElement($e,Rt({},v,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:p,fill:`none`,stroke:l,points:g}));return o&&(i||n<1)?G.createElement(Ge,null,G.createElement(`defs`,null,G.createElement(`clipPath`,{id:m},G.createElement(Ut,{alpha:n,points:d.points??[],baseLine:g,layout:f,strokeWidth:d.strokeWidth}))),G.createElement(Ge,{clipPath:`url(#${m})`},y,b,x)):G.createElement(G.Fragment,null,y,b,x)}var Gt=[`id`],Kt=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function qt(){return qt=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},qt.apply(null,arguments)}function Jt(e,t){if(e==null)return{};var n,r,i=Yt(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Yt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Xt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function X(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Xt(Object(n),!0).forEach(function(t){Zt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zt(e,t,n){return(t=Qt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Qt(e){var t=$t(e,`string`);return typeof t==`symbol`?t:t+``}function $t(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}var en={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:Se,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[X(X({},e.next),{},{x:A(e.prev.x,e.next.x,t),y:A(e.prev.y,e.next.y,t)})]:e.status===`added`?[e.next]:[]),connectNulls:!1,dot:!1,fill:`#3182bd`,fillOpacity:.6,hide:!1,isAnimationActive:`auto`,legendType:`line`,stroke:`#3182bd`,strokeWidth:1,type:`linear`,label:!1,shape:Wt,xAxisId:0,yAxisId:0,zIndex:it.area};function tn(e,t){return e&&e!==`none`?e:t}var nn=e=>{var t=e.dataKey,n=e.name,r=e.stroke,i=e.fill,a=e.legendType;return[{inactive:e.hide,dataKey:t,type:a,color:tn(r,i),value:Re(n,t),payload:e}]},rn=G.memo(e=>{var t=e.dataKey,n=e.data,r=e.stroke,i=e.strokeWidth,a=e.fill,o=e.name,s=e.hide,c=e.unit,l=e.formatter,u=e.tooltipType,d=e.id,f={dataDefinedOnItem:n,getPosition:me,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:Re(o,t),hide:s,type:u,color:tn(r,a),unit:c,formatter:l,graphicalItemId:d}};return G.createElement(xe,{tooltipEntrySettings:f})});function an(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=Ue(r);return G.createElement(I,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function on(e){var t=e.showLabels,n=e.children,r=e.points.map(e=>{var t={x:e.x??0,y:e.y??0,width:0,lowerWidth:0,upperWidth:0,height:0};return X(X({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return G.createElement(ue,{value:t?r:void 0},n)}function sn(e){var t=e.points,n=e.baseLine,r=e.needClip,i=e.clipPathId,a=e.props,o=e.animationElapsedTime,s=e.isAnimating,c=e.isEntrance,l=a.layout,u=a.type,d=a.stroke,f=a.connectNulls,p=a.isRange,m=a.shape,h=a.id,g=Jt(a,Gt),_=X(X({},ne(g)),{},{id:h,points:t,connectNulls:f,type:u,baseLine:n,layout:l,stroke:d,isRange:p,animationElapsedTime:o,isAnimating:s,isEntrance:c});return G.createElement(G.Fragment,null,t?.length>1&&G.createElement(Ge,{clipPath:r?`url(#clipPath-${i})`:void 0},G.createElement(Ce,{option:m,DefaultShape:en.shape,shapeProps:_})),G.createElement(an,{points:t,props:g,clipPathId:i}))}function cn(e,t,n){if(j(e)){var r=j(t)?t:void 0;return A(r,e,n)}if(M(e)||pt(e)){var i=j(t)?t:void 0;return A(i,0,n)}return e}function ln(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=e.previousPointsRef,a=e.previousBaselineRef,o=r.points,s=r.baseLine,c=r.isAnimationActive,l=r.animationBegin,u=r.animationDuration,d=r.animationEasing,f=r.animationMatchBy,p=r.animationInterpolateFn,m=K(()=>({points:o,baseLine:s}),[o,s]),h=_t(m,a),g=qe(),_=ge(r.onAnimationStart,r.onAnimationEnd),v=_.isAnimating,y=_.handleAnimationStart,b=_.handleAnimationEnd,x=h.startValue;if(g==null)return null;var S=Array.isArray(s)&&Array.isArray(x)?re(x,s,f):Array.isArray(s)?re(null,s,f):null;return G.createElement(de,{animationInput:m,animationIdPrefix:`recharts-area-`,items:o,previousItemsRef:i,isAnimationActive:c,animationBegin:l,animationDuration:u,animationEasing:d,onAnimationStart:y,onAnimationEnd:b,animationInterpolateFn:p,animationMatchBy:f,layout:g},(e,i,a)=>{var c=i===1?s:Array.isArray(s)?p(S,i,g):a?s:cn(s,x,i);return h.syncStepValue(c,i),G.createElement(on,{showLabels:!v,points:o},r.children,G.createElement(sn,{points:e,baseLine:c,needClip:t,clipPathId:n,props:r,animationElapsedTime:i,isAnimating:v||i<1,isEntrance:a}),G.createElement(nt,{label:r.label}))})}function un(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=bt(null),a=bt();return G.createElement(ln,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var dn=class extends vt{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,o=e.left,s=e.needClip,c=e.xAxisId,l=e.yAxisId,u=e.width,d=e.height,f=e.id,p=e.baseLine,m=e.zIndex;if(t)return null;var h=F(`recharts-area`,i),g=f,_=ae(n),v=_.r,y=_.strokeWidth,b=P(n),x=v*2+y,S=s?`url(#clipPath-${b?``:`dots-`}${g})`:void 0;return G.createElement(we,{zIndex:m},G.createElement(Ge,{className:h},s&&G.createElement(`defs`,null,G.createElement(pe,{clipPathId:g,xAxisId:c,yAxisId:l}),!b&&G.createElement(`clipPath`,{id:`clipPath-dots-${g}`},G.createElement(`rect`,{x:o-x/2,y:a-x/2,width:u+x,height:d+x}))),G.createElement(un,{needClip:s,clipPathId:g,props:this.props})),G.createElement(He,{points:r,mainColor:tn(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}),this.props.isRange&&Array.isArray(p)&&G.createElement(He,{points:p,mainColor:tn(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:S}))}};function fn(e){var t=e.activeDot,n=e.animationBegin,r=e.animationDuration,i=e.animationEasing,a=e.connectNulls,o=e.dot,s=e.fill,c=e.fillOpacity,l=e.hide,u=e.isAnimationActive,d=e.legendType,f=e.stroke,p=e.xAxisId,m=e.yAxisId,h=Jt(e,Kt),g=lt(),_=Ee(),v=We(p,m).needClip,y=Ie(),b=mt(t=>Ft(t,e.id,y))??{},x=b.points,S=b.isRange,C=b.baseLine,w=fe();if(g!==`horizontal`&&g!==`vertical`||w==null||_!==`AreaChart`&&_!==`ComposedChart`)return null;var T=w.height,E=w.width,D=w.x,O=w.y;return!x||!x.length?null:G.createElement(dn,qt({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:C,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:T,hide:l,layout:g,isAnimationActive:u,isRange:S,legendType:d,needClip:v,points:x,stroke:f,width:E,left:D,top:O,xAxisId:p,yAxisId:m}))}var pn=(e,t,n,r,i)=>{var a=n??t;if(j(a))return a;var o=e===`horizontal`?i:r,s=o.scale.domain();if(o.type===`number`){var c=Math.max(s[0],s[1]),l=Math.min(s[0],s[1]);return a===`dataMin`?l:a===`dataMax`||c<0?c:Math.max(Math.min(s[0],s[1]),0)}return a===`dataMin`?s[0]:a===`dataMax`?s[1]:s[0]};function mn(e){var t=e.areaSettings,n=t.connectNulls,r=t.baseValue,i=t.dataKey,a=e.stackedData,o=e.layout,s=e.chartBaseValue,c=e.xAxis,l=e.yAxis,u=e.displayedData,d=e.dataStartIndex,f=e.xAxisTicks,p=e.yAxisTicks,m=e.bandSize,h=e.stackDataKeys,g=a&&a.length,_=pn(o,s,r,c,l),v=o===`horizontal`,y=!1,b=u.map((e,t)=>{var r;if(g)r=a[d+t];else{var o=Oe(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=Oe(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>Oe(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:Ye({axis:c,ticks:f,bandSize:m,entry:e,index:t}),y:x?null:l.scale.map(s)??null,value:r,payload:e}:{x:x?null:c.scale.map(s)??null,y:Ye({axis:l,ticks:p,bandSize:m,entry:e,index:t}),value:r,payload:e}});return{points:b,baseLine:(g||y?b.map(e=>{var t=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:t!=null&&e.y!=null?l.scale.map(t)??null:null,payload:e.payload}:{x:t==null?null:c.scale.map(t)??null,y:e.y,payload:e.payload}}):v?l.scale.map(_):c.scale.map(_))??0,isRange:y}}function hn(e){var t=ve(e,en),n=Ie();return G.createElement(N,{id:t.id,type:`area`},e=>G.createElement(G.Fragment,null,G.createElement(se,{legendPayload:nn(t)}),G.createElement(rn,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,formatter:t.formatter,tooltipType:t.tooltipType,id:e}),G.createElement(L,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:ze(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),G.createElement(fn,qt({},t,{id:e}))))}var gn=G.memo(hn,at);gn.displayName=`Area`;var _n=[`axis`],vn=yt((e,t)=>G.createElement(ie,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:_n,tooltipPayloadSearcher:Te,categoricalChartProps:e,ref:t})),yn=[`axis`],bn=yt((e,t)=>G.createElement(ie,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:yn,tooltipPayloadSearcher:Te,categoricalChartProps:e,ref:t})),xn=53,Z=9,Q=2,Sn=Y.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
gap: ${Q}px;
|
|
4
|
-
`,Cn=Y.div`
|
|
5
|
-
display: grid;
|
|
6
|
-
grid-template-rows: repeat(7, ${Z}px);
|
|
7
|
-
gap: ${Q}px;
|
|
8
|
-
padding-top: ${11}px;
|
|
9
|
-
font-size: 9px;
|
|
10
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
11
|
-
`,wn=Y.div`
|
|
12
|
-
line-height: ${Z}px;
|
|
13
|
-
padding-right: 2px;
|
|
14
|
-
text-align: right;
|
|
15
|
-
`,Tn=Y.div`
|
|
16
|
-
display: grid;
|
|
17
|
-
grid-template-columns: repeat(${xn}, ${Z}px);
|
|
18
|
-
gap: ${Q}px;
|
|
19
|
-
height: ${Z}px;
|
|
20
|
-
font-size: 9px;
|
|
21
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
22
|
-
`,En=Y.div`
|
|
23
|
-
white-space: nowrap;
|
|
24
|
-
line-height: ${Z}px;
|
|
25
|
-
`,Dn=Y.div`
|
|
26
|
-
display: grid;
|
|
27
|
-
grid-template-columns: repeat(${xn}, ${Z}px);
|
|
28
|
-
gap: ${Q}px;
|
|
29
|
-
`,On=Y.div`
|
|
30
|
-
display: grid;
|
|
31
|
-
grid-template-rows: repeat(7, ${Z}px);
|
|
32
|
-
gap: ${Q}px;
|
|
33
|
-
`,kn=Y.div`
|
|
34
|
-
width: ${Z}px;
|
|
35
|
-
height: ${Z}px;
|
|
36
|
-
border-radius: 2px;
|
|
37
|
-
background: ${({$level:e})=>e===0?`var(--panel-sunk)`:`color-mix(in oklch, var(--accent) ${[0,24,46,70,100][e]??100}%, var(--panel-sunk))`};
|
|
38
|
-
border: 1px solid var(--rule);
|
|
39
|
-
visibility: ${({$future:e})=>e?`hidden`:`visible`};
|
|
40
|
-
|
|
41
|
-
&:hover,
|
|
42
|
-
&:focus-visible {
|
|
43
|
-
outline: 1px solid var(--ink-dim);
|
|
44
|
-
outline-offset: 1px;
|
|
45
|
-
}
|
|
46
|
-
`,An=Y(c)`
|
|
47
|
-
gap: ${Q}px;
|
|
48
|
-
`,jn=Y(o)`
|
|
49
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
50
|
-
font-size: 11px;
|
|
51
|
-
`;function Mn(e){let t=e.filter(e=>e>0).sort((e,t)=>e-t);if(t.length===0)return[0,0,0];let n=e=>t[Math.min(t.length-1,Math.floor(t.length*e))]??0;return[n(.25),n(.5),n(.75)]}function Nn(e,[t,n,r]){return e<=0?0:e<=t?1:e<=n?2:e<=r?3:4}function Pn({days:t,now:n}){let[r,i]=xt(`tokens`),[o,s]=xt(null),l=Le(r),d=K(()=>{let e=new Map;for(let n of t){let t=Number(n.key);Number.isFinite(t)&&e.set(ht(t),{requests:n.requests,errors:n.errors,costUsd:n.costUsd,inputTokens:n.inputTokens,outputTokens:n.outputTokens,cacheReadTokens:n.cacheReadTokens,cacheWriteTokens:n.cacheWriteTokens,rtkSavedTokens:n.rtkSavedTokens,rtkAppliedRequests:n.rtkAppliedRequests,durationMsSum:n.durationMsSum})}let r=new Date(ht(n));r.setDate(r.getDate()+(6-r.getDay())-370);let i=ht(n);return Array.from({length:xn},()=>Array.from({length:7},()=>{let t=r.getTime();return r.setDate(r.getDate()+1),{at:t,totals:e.get(t)??Ke,future:t>i}}))},[t,n]),f=d.flat(),p=Mn(f.map(e=>l.of({key:``,...e.totals}))),m=f.reduce((e,t)=>ct(e,B(t.totals)),Ke),h=f.reduce((e,t)=>e+ +(t.totals.requests>0),0),g=(e,t)=>`${e}: ${y(t.requests)} requests, ${y(z(t))} tokens, ${v(t.costUsd)}`;return q(x,{legend:`Activity`,meta:o===null?`${y(h)} active days`:void 0,actions:q(Xe,{children:Be.map(e=>q(Qe,{type:`button`,$size:`sm`,$on:e.id===r,"aria-pressed":e.id===r,onClick:()=>i(e.id),children:e.label},e.id))}),children:J(a,{$gap:2,children:[q(u,{children:q(a,{$gap:1,style:{width:611},children:J(Sn,{children:[q(Cn,{"aria-hidden":`true`,children:[``,`Mon`,``,`Wed`,``,`Fri`,``].map((e,t)=>q(wn,{children:e},t))}),J(a,{$gap:1,children:[q(Tn,{"aria-hidden":`true`,children:d.map((e,t)=>{let n=e[0],r=d[t-1]?.[0],i=n!==void 0&&(r===void 0||new Date(r.at).getMonth()!==new Date(n.at).getMonth());return q(En,{children:i&&n!==void 0?new Date(n.at).toLocaleDateString(`en-GB`,{month:`short`}):``},n?.at??t)})}),q(Dn,{role:`grid`,"aria-label":`${l.label} per day over the last year`,children:d.map(e=>q(On,{role:`row`,children:e.map(e=>q(kn,{role:`gridcell`,tabIndex:-1,"aria-label":g(Je(e.at),e.totals),title:g(Je(e.at),e.totals),$future:e.future,$level:e.future?0:Nn(l.of({key:``,...e.totals}),p),onMouseEnter:()=>s(e),onMouseLeave:()=>s(null)},e.at))},e[0]?.at))})]})]})})}),J(c,{$justify:`space-between`,$wrap:!0,children:[q(jn,{children:o===null?g(`Last 12 months`,m):g(Je(o.at),o.totals)}),J(c,{$gap:1,children:[q(e,{children:`Less`}),q(An,{"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>q(kn,{$level:e,$future:!1},e))}),q(e,{children:`More`})]})]})]})})}function Fn({buckets:e,by:t,since:n,until:r,metric:i,names:a}){let o=U(n,r,t),s=new Map,c=new Map;for(let n of e){let e=n.split??`unknown`;s.set(e,ct(s.get(e)??Ke,n));let r=c.get(e)??new Map,a=V(n.key,t);r.set(a,(r.get(a)??0)+i.of(n)),c.set(e,r)}let d=[...s.entries()].sort((e,t)=>i.of(B(t[1]))-i.of(B(e[1])));return q(u,{children:J(O,{children:[q(`thead`,{children:J(`tr`,{children:[q(D,{children:`Key`}),q(D,{children:`Trend`}),q(D,{$align:`right`,children:`Requests`}),q(D,{$align:`right`,children:`Failed`}),q(D,{$align:`right`,children:`Tokens`}),q(D,{$align:`right`,children:`Mean`}),q(D,{$align:`right`,children:`Cost`})]})}),q(`tbody`,{children:d.map(([e,t])=>{let n=c.get(e)??new Map,r=e===`unknown`?`Unattributed`:a.get(e)??e;return J(T,{children:[q(E,{children:q(l,{style:{display:`block`,maxWidth:`28ch`},children:r})}),q(E,{style:{width:120},children:q(h,{values:o.map(e=>n.get(e)??0),height:20,label:`${r}: ${i.format(i.of(B(t)))} over the window`})}),q(E,{$align:`right`,$mono:!0,children:y(t.requests)}),q(E,{$align:`right`,$mono:!0,style:t.errors>0?{color:`var(--down)`}:void 0,children:_(t.requests===0?0:t.errors/t.requests,0)}),q(E,{$align:`right`,$mono:!0,children:y(z(t))}),q(E,{$align:`right`,$mono:!0,children:b(t.requests===0?null:t.durationMsSum/t.requests)}),q(E,{$align:`right`,$mono:!0,children:v(t.costUsd)})]},e)})})]})})}var In=6,Ln=`__other__`,Rn=`unknown`;function zn(e,t){let n=t.get(e);return n===void 0?f.find(t=>ee[t].models.some(t=>t.id===e))??null:n}function Bn(e,t){return e===null?`var(--ink-faint)`:`color-mix(in oklch, ${d(e)} ${Math.max(30,100-t*22)}%, var(--panel))`}function Vn({buckets:e,by:t,since:n,until:r,metric:i,providers:o}){let s=[...et(e,i).entries()],c=s.slice(0,In),u=s.slice(In),d=[];for(let e of[...f,null])c.filter(([t])=>zn(t,o)===e).forEach(([t,n],r)=>{d.push({name:t,label:t===Rn?`Unresolved`:t,color:Bn(e,r),totals:n})});u.length>0&&d.push({name:Ln,label:`${u.length} more`,color:`var(--ink-faint)`,totals:u.reduce((e,[,t])=>ct(e,B(t)),Ke)});let p=new Set(c.map(([e])=>e)),m=new Map;for(let n of e){let e=n.split??Rn,r=`${V(n.key,t)} ${p.has(e)?e:Ln}`;m.set(r,(m.get(r)??0)+i.of(n))}let h=U(n,r,t).map(e=>{let t={at:e};for(let n of d)t[n.name]=m.get(`${e} ${n.name}`)??0;return t}),g=new Map(d.map(e=>[e.name,e.label]));return J(a,{$gap:2,children:[q(ot,{$height:220,children:q(Pe,{width:`100%`,height:`100%`,children:J(vn,{data:h,margin:{top:4,right:4,bottom:4,left:4},children:[q(k,{stroke:`var(--rule)`,vertical:!1}),q(ye,{dataKey:`at`,tickFormatter:e=>R(e,t),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),q(ft,{tickFormatter:e=>i.format(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),q(le,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:n,label:r})=>{if(e!==!0||n===void 0||n.length===0)return null;let a=n.filter(e=>Number(e.value??0)>0);return J(Me,{children:[q(`div`,{children:R(Number(r),t)}),a.length===0?q(`div`,{children:`No ${i.label.toLowerCase()}`}):a.map(e=>J(`div`,{children:[g.get(String(e.dataKey))??String(e.dataKey),` `,i.format(Number(e.value??0))]},String(e.dataKey)))]})}}),d.map(e=>q(gn,{type:`monotone`,dataKey:e.name,stackId:`models`,stroke:e.color,strokeWidth:2,fill:e.color,fillOpacity:.22,isAnimationActive:!1},e.name))]})})}),q(rt,{children:d.map(e=>J(`span`,{children:[q(H,{$color:e.color}),` `,q(l,{title:`${e.label}: ${i.format(i.of(B(e.totals)))} ${i.label.toLowerCase()}`,style:{display:`inline-block`,maxWidth:`24ch`,verticalAlign:`bottom`},children:e.label})]},e.name))})]})}var Hn=`unknown`;function Un(e){let t=f.find(t=>t===e);return t===void 0?`var(--ink-faint)`:d(t)}function Wn(e){let t=f.find(t=>t===e);return t===void 0?`Unresolved`:p[t]}function Gn({buckets:e,by:t,since:n,until:r,metric:i}){let o=et(e,i),s=[...f,Hn].map(e=>({name:e,totals:o.get(e)})).filter(e=>e.totals!==void 0),c=s.map(e=>e.name),l=U(n,r,t),u=ut(e,l,t,i),d=[...o.values()].reduce((e,t)=>e+t.requests,0);return J(a,{$gap:3,children:[q(ot,{$height:200,children:q(Pe,{width:`100%`,height:`100%`,children:J(vn,{data:u,margin:{top:4,right:4,bottom:4,left:4},children:[q(k,{stroke:`var(--rule)`,vertical:!1}),q(ye,{dataKey:`at`,tickFormatter:e=>R(e,t),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),q(ft,{tickFormatter:e=>i.format(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:48}),q(le,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:n,label:r})=>e!==!0||n===void 0||n.length===0?null:J(Me,{children:[q(`div`,{children:R(Number(r),t)}),n.map(e=>J(`div`,{children:[Wn(String(e.dataKey)),` `,i.format(Number(e.value??0))]},String(e.dataKey)))]})}),c.map(e=>q(gn,{type:`monotone`,dataKey:e,stackId:`providers`,stroke:Un(e),strokeWidth:2,fill:Un(e),fillOpacity:.22,isAnimationActive:!1},e))]})})}),q(rt,{children:c.map(e=>J(`span`,{children:[q(H,{$color:Un(e)}),` `,Wn(e)]},e))}),J(O,{children:[q(`thead`,{children:J(`tr`,{children:[q(D,{children:`Provider`}),q(D,{$align:`right`,children:`Share`}),q(D,{$align:`right`,children:`Requests`}),q(D,{$align:`right`,children:`Failed`}),q(D,{$align:`right`,children:`Tokens`}),q(D,{$align:`right`,children:`Cost`})]})}),q(`tbody`,{children:s.map(({name:e,totals:t})=>J(T,{children:[J(E,{children:[q(H,{$color:Un(e)}),` `,Wn(e)]}),q(E,{$align:`right`,$mono:!0,children:_(d===0?0:t.requests/d,0)}),q(E,{$align:`right`,$mono:!0,children:y(t.requests)}),q(E,{$align:`right`,$mono:!0,style:t.errors>0?{color:`var(--down)`}:void 0,children:y(t.errors)}),q(E,{$align:`right`,$mono:!0,children:y(z(t))}),q(E,{$align:`right`,$mono:!0,children:v(t.costUsd)})]},e))})]})]})}var Kn=Y.li`
|
|
52
|
-
display: grid;
|
|
53
|
-
grid-template-columns: minmax(0, 20ch) 1fr auto;
|
|
54
|
-
align-items: center;
|
|
55
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
56
|
-
`,qn=Y.ol`
|
|
57
|
-
display: flex;
|
|
58
|
-
flex-direction: column;
|
|
59
|
-
gap: ${({theme:e})=>e.space(2)};
|
|
60
|
-
`,Jn=Y.div`
|
|
61
|
-
height: 8px;
|
|
62
|
-
border-radius: 2px;
|
|
63
|
-
background: ${({theme:e})=>e.color.panelSunk};
|
|
64
|
-
border: 1px solid ${({theme:e})=>e.color.rule};
|
|
65
|
-
overflow: hidden;
|
|
66
|
-
`,Yn=Y.div`
|
|
67
|
-
width: ${({$share:e})=>`${Math.max(1.5,e*100)}%`};
|
|
68
|
-
height: 100%;
|
|
69
|
-
border-radius: 0 2px 2px 0;
|
|
70
|
-
background: ${({theme:e,$fault:t})=>t?e.color.down:e.color.accent};
|
|
71
|
-
opacity: 0.85;
|
|
72
|
-
`,Xn=Y(l)`
|
|
73
|
-
display: block;
|
|
74
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
75
|
-
font-size: 12px;
|
|
76
|
-
`,Zn=12;function Qn({buckets:e,metric:t,names:n,unknownLabel:r}){let i=new Map;for(let t of e)i.set(t.key,ct(i.get(t.key)??Ke,t));let s=e=>e===`unknown`?r??`Unattributed`:n?.get(e)??e,l=[...i.entries()].map(([e,n])=>({name:s(e),entry:n,value:t.of(B(n))})).sort((e,t)=>t.value-e.value),u=l.slice(0,Zn),d=l.slice(Zn),f=u[0]?.value??0;return J(a,{$gap:3,children:[q(qn,{children:u.map(({name:e,entry:n,value:r})=>J(Kn,{children:[q(Xn,{title:e,children:e}),q(Jn,{children:q(Yn,{$share:f===0?0:r/f,$fault:n.requests>0&&n.errors===n.requests})}),J(c,{$gap:2,children:[q(o,{$size:`12px`,children:t.format(r)}),q(o,{$size:`11px`,$dim:!0,children:v(n.costUsd)})]})]},e))}),d.length===0?null:q(o,{$size:`11px`,$dim:!0,children:`+ ${d.length} more, ${y(d.reduce((e,t)=>e+t.entry.requests,0))} requests`})]})}function $({legend:e,meta:t,actions:n,query:r,empty:i,isEmpty:a,children:o}){return q(x,{legend:e,meta:t,actions:n,children:r.isError?q(S,{error:r.error,onRetry:r.refetch}):r.isLoading?q(C,{rows:4}):a?q(w,{legend:i.legend,message:i.message}):o})}var $n=[{id:`inputTokens`,label:`Uncached input`,opacity:.95},{id:`outputTokens`,label:`Output`,opacity:.7},{id:`cacheReadTokens`,label:`Cache read`,opacity:.45},{id:`cacheWriteTokens`,label:`Cache write`,opacity:.22}];function er({buckets:e,by:t,since:n,until:r}){let i=new Map;for(let n of e)i.set(V(n.key,t),n);let s=U(n,r,t).map(e=>{let t=i.get(e);return{at:e,inputTokens:t?.inputTokens??0,outputTokens:t?.outputTokens??0,cacheReadTokens:t?.cacheReadTokens??0,cacheWriteTokens:t?.cacheWriteTokens??0}}),l=$n.map(e=>({...e,value:s.reduce((t,n)=>t+n[e.id],0)})),u=l.reduce((e,t)=>e+t.value,0);return J(a,{$gap:3,children:[q(ot,{$height:200,children:q(Pe,{width:`100%`,height:`100%`,children:J(vn,{data:s,margin:{top:4,right:4,bottom:4,left:4},children:[q(k,{stroke:`var(--rule)`,vertical:!1}),q(ye,{dataKey:`at`,tickFormatter:e=>R(e,t),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),q(ft,{tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:44,tickFormatter:e=>y(e)}),q(le,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:n,label:r})=>e!==!0||n===void 0||n.length===0?null:J(Me,{children:[q(`div`,{children:R(Number(r),t)}),$n.map(e=>J(`div`,{children:[e.label,` `,y(Number(n.find(t=>t.dataKey===e.id)?.value??0))]},e.id))]})}),$n.map(e=>q(gn,{type:`monotone`,dataKey:e.id,stackId:`tokens`,stroke:`var(--accent)`,strokeOpacity:e.opacity,strokeWidth:1.5,fill:`var(--accent)`,fillOpacity:e.opacity*.5,isAnimationActive:!1},e.id))]})})}),q(rt,{children:l.map(e=>J(c,{$gap:1,children:[q(H,{$color:`var(--accent)`,style:{opacity:e.opacity}}),q(`span`,{children:e.label}),q(o,{$size:`11px`,children:y(e.value)}),q(o,{$size:`11px`,$dim:!0,children:_(u===0?0:e.value/u,0)})]},e.id))})]})}function tr({buckets:e,by:t,since:n,until:r}){let i=new Map;for(let n of e)i.set(V(n.key,t),n);let o=U(n,r,t).map(e=>{let n=i.get(e);return{at:e,label:R(e,t),requests:n?.requests??0,errors:n?.errors??0,costUsd:n?.costUsd??0,tokens:n===void 0?0:z(n)}});return J(a,{$gap:2,children:[q(ot,{$height:220,children:q(Pe,{width:`100%`,height:`100%`,children:J(bn,{data:o,margin:{top:4,right:4,bottom:4,left:4},children:[q(k,{stroke:`var(--rule)`,vertical:!1}),q(ye,{dataKey:`label`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),q(ft,{tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),q(le,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t})=>{if(e!==!0||t===void 0||t.length===0)return null;let n=t[0]?.payload;return n===void 0?null:J(Me,{children:[q(`div`,{children:n.label}),J(`div`,{children:[y(n.requests),` requests`]}),J(`div`,{children:[y(n.errors),` failed`]}),J(`div`,{children:[y(n.tokens),` tokens`]}),q(`div`,{children:v(n.costUsd)})]})}}),q(gn,{type:`monotone`,dataKey:`requests`,stroke:`none`,fill:`var(--accent)`,fillOpacity:.12,isAnimationActive:!1}),q(oe,{type:`monotone`,dataKey:`requests`,stroke:`var(--accent)`,strokeWidth:2,dot:!1,activeDot:{r:4,stroke:`var(--panel)`,strokeWidth:2},isAnimationActive:!1}),q(oe,{type:`monotone`,dataKey:`errors`,stroke:`var(--down)`,strokeWidth:2,dot:!1,activeDot:{r:4,stroke:`var(--panel)`,strokeWidth:2},isAnimationActive:!1})]})})}),J(rt,{children:[J(`span`,{children:[q(H,{$color:`var(--accent)`}),` Requests`]}),J(`span`,{children:[q(H,{$color:`var(--down)`}),` Failed`]})]})]})}var nr=Y.div`
|
|
77
|
-
display: grid;
|
|
78
|
-
grid-template-columns: repeat(
|
|
79
|
-
auto-fit,
|
|
80
|
-
minmax(max(180px, calc((100% - 4 * ${({theme:e})=>e.space(3)}) / 5)), 1fr)
|
|
81
|
-
);
|
|
82
|
-
gap: ${({theme:e})=>e.space(3)};
|
|
83
|
-
`,rr=864e5,ir=[{id:`requestedModel`,label:`As requested`,column:`Virtual model`},{id:`model`,label:`As served`,column:`Upstream model`}];function ar(){let{cadence:e}=m(),[o,c]=xt(`24h`),[l,u]=xt(`tokens`),[d,f]=xt(`model`),p=De(o),x=Le(l),S=K(()=>p.grain===`daily`?ht(Date.now()-p.ms):Math.floor((Date.now()-p.ms)/6e4)*6e4,[p]),C=K(()=>S+p.ms,[S,p]),w=K(()=>ht(Date.now()-371*rr),[]),T={since:S,grain:p.grain},E=n({...T,groupBy:p.by},e(6e4)),D=n({...T,groupBy:p.by,splitBy:`provider`},e(6e4)),O=n({...T,groupBy:p.by,splitBy:`model`},e(6e4)),ee=n({...T,groupBy:p.by,splitBy:`apiKey`},e(6e4)),te=n({...T,groupBy:d},e(6e4)),k=n({...T,groupBy:`credential`},e(6e4)),ne=n({since:w,grain:`daily`,groupBy:`day`},e(3e5)),re=t(),ie=s(),A=r(),ae=K(()=>{let e=new Map;for(let t of A.data??[])for(let n of t.targets)e.set(n.model,n.provider);return e},[A.data]),j=K(()=>{let e=new Map;for(let t of re.data??[])e.set(t.id,t.label);return e},[re.data]),oe=K(()=>{let e=new Map;for(let t of ie.data??[])e.set(t.id,t.label);return e},[ie.data]),M=E.data??[],N=_e(M),P=N.inputTokens+N.cacheReadTokens+N.cacheWriteTokens,se=z(N),ce=N.requests===0?0:N.outputTokens/N.requests,le=P===0?0:N.cacheReadTokens/P,ue=P===0?0:N.cacheWriteTokens/P,de=N.requests===0?0:N.costUsd/N.requests,fe=U(S,C,p.by),F=new Map(M.map(e=>[V(e.key,p.by),e])),I=e=>fe.map(e),pe=e=>e>=.25?`down`:e>=.05?`warn`:`ok`,me=N.requests===0?0:N.errors/N.requests,L={legend:`Nothing recorded`,message:`No requests landed in this window. Widen the range, or send traffic through the gateway.`};return J(a,{$gap:4,children:[q(g,{legend:`Usage`,title:`Requests, tokens, and spend`,summary:E.isLoading?`Reading usage…`:`${y(N.requests)} requests and ${v(N.costUsd)} over the last ${p.label}.`,actions:q(Xe,{children:ke.map(e=>q(Qe,{type:`button`,$size:`sm`,$on:e.id===o,"aria-pressed":e.id===o,onClick:()=>c(e.id),children:e.id},e.id))})}),J(nr,{"data-testid":`usage-summary-deck`,children:[q(W,{legend:`Requests`,value:y(N.requests),unit:p.label,trace:q(h,{values:I(e=>F.get(e)?.requests??0),overlay:I(e=>F.get(e)?.errors??0),label:`${N.requests} requests, ${N.errors} of them failed`})}),q(W,{legend:`Error rate`,value:_(me),unit:`${y(N.errors)} failed`,tone:N.requests===0?`ink`:pe(me),trace:q(h,{values:I(e=>{let t=F.get(e);return t===void 0||t.requests===0?0:t.errors/t.requests}),color:`var(--down)`,label:`${N.errors} failed requests against ${N.requests} total`})}),q(W,{legend:`Prompt input`,value:y(P),unit:`${y(N.inputTokens)} uncached`,trace:q(h,{values:I(e=>{let t=F.get(e);return(t?.inputTokens??0)+(t?.cacheReadTokens??0)+(t?.cacheWriteTokens??0)}),label:`${P} prompt input tokens over the window`})}),q(W,{legend:`Output`,value:y(N.outputTokens),unit:`mean ${y(ce)}/request`,trace:q(h,{values:I(e=>F.get(e)?.outputTokens??0),label:`${N.outputTokens} output tokens over the window`})}),q(W,{legend:`Cache reads`,value:y(N.cacheReadTokens),unit:`${_(le,0)} of prompt`,trace:q(h,{values:I(e=>F.get(e)?.cacheReadTokens??0),label:`${N.cacheReadTokens} cache-read tokens over the window`})}),q(W,{legend:`Cache writes`,value:y(N.cacheWriteTokens),unit:`${_(ue,0)} of prompt`,trace:q(h,{values:I(e=>F.get(e)?.cacheWriteTokens??0),label:`${N.cacheWriteTokens} cache-write tokens over the window`})}),q(W,{legend:`RTK saved`,value:y(N.rtkSavedTokens),unit:`${y(N.rtkAppliedRequests)} requests`,trace:q(h,{values:I(e=>F.get(e)?.rtkSavedTokens??0),label:`${N.rtkSavedTokens} estimated tokens saved by RTK over the window`})}),q(W,{legend:`Mean duration`,value:b(N.requests===0?null:N.durationMsSum/N.requests),unit:`per request`,trace:q(h,{values:I(e=>{let t=F.get(e);return t===void 0||t.requests===0?0:t.durationMsSum/t.requests}),color:`var(--ok)`,label:`mean request duration over the window`})}),q(W,{legend:`Spend`,value:v(N.costUsd),unit:p.label,trace:q(h,{values:I(e=>F.get(e)?.costUsd??0),color:`var(--warn)`,label:`spend over the window, ${v(N.costUsd)} total`})}),q(W,{legend:`Cost / request`,value:v(de),unit:`mean`,trace:q(h,{values:I(e=>{let t=F.get(e);return t===void 0||t.requests===0?0:t.costUsd/t.requests}),color:`var(--warn)`,label:`${v(de)} mean cost per request over the window`})})]}),q($,{legend:`Traffic`,meta:p.by===`hour`?`By hour`:`By day`,query:E,isEmpty:M.length===0,empty:L,children:q(tr,{buckets:M,by:p.by,since:S,until:C})}),q(Xe,{children:Be.map(e=>q(Qe,{type:`button`,$size:`sm`,$on:e.id===l,"aria-pressed":e.id===l,onClick:()=>u(e.id),children:`Rank by ${e.label.toLowerCase()}`},e.id))}),q($,{legend:`Traffic by upstream model`,meta:`${x.label}, ${p.by===`hour`?`by hour`:`by day`}`,query:O,isEmpty:(O.data??[]).length===0,empty:L,children:q(Vn,{buckets:O.data??[],by:p.by,since:S,until:C,metric:x,providers:ae})}),J(i,{$min:`480px`,$gap:4,children:[J(a,{$gap:4,children:[q($,{legend:`Providers`,meta:x.label,query:D,isEmpty:(D.data??[]).length===0,empty:L,children:q(Gn,{buckets:D.data??[],by:p.by,since:S,until:C,metric:x})}),q(Pn,{days:ne.data??[],now:Date.now()})]}),J(a,{$gap:4,children:[q($,{legend:`Token mix`,meta:y(se),query:E,isEmpty:M.length===0,empty:L,children:q(er,{buckets:M,by:p.by,since:S,until:C})}),q($,{legend:`Models`,meta:ir.find(e=>e.id===d)?.column,query:te,isEmpty:(te.data??[]).length===0,empty:L,actions:q(Xe,{children:ir.map(e=>q(Qe,{type:`button`,$size:`sm`,$on:e.id===d,"aria-pressed":e.id===d,onClick:()=>f(e.id),children:e.label},e.id))}),children:q(Qn,{buckets:te.data??[],metric:x})}),q($,{legend:`Accounts`,meta:x.label,query:k,isEmpty:(k.data??[]).length===0,empty:L,children:q(Qn,{buckets:k.data??[],metric:x,names:oe,unknownLabel:`No account`})})]})]}),q($,{legend:`API keys`,meta:x.label,query:ee,isEmpty:(ee.data??[]).length===0,empty:L,children:q(Fn,{buckets:ee.data??[],by:p.by,since:S,until:C,metric:x,names:j})})]})}var or=ar;export{or as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e}from"./Rack-B4c0dbIb.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import{useMutation as e,useQuery as t,useQueryClient as n}from"@tanstack/react-query";import*as r from"react";import i,{useCallback as a}from"react";import{jsx as o}from"react/jsx-runtime";import{flushSync as s}from"react-dom";import c,{css as l,keyframes as u}from"styled-components";var d=Object.create,f=Object.defineProperty,p=Object.getOwnPropertyDescriptor,m=Object.getOwnPropertyNames,h=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty,_=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),v=(e,t)=>{let n={};for(var r in e)f(n,r,{get:e[r],enumerable:!0});return t||f(n,Symbol.toStringTag,{value:`Module`}),n},y=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=m(t),a=0,o=i.length,s;a<o;a++)s=i[a],!g.call(e,s)&&s!==n&&f(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=p(t,s))||r.enumerable});return e},b=(e,t,n)=>(n=e==null?{}:d(h(e)),y(t||!e||!e.__esModule||!g.call(e,`default`)?f(n,`default`,{value:e,enumerable:!0}):n,e)),x=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.")}),ee=r.use,S=r.useLayoutEffect;function te(e,t,n={},i){r.useEffect(()=>{if(!e.current||i||typeof IntersectionObserver!=`function`)return;let r=new IntersectionObserver(([e])=>{t(e)},n);return r.observe(e.current),()=>{r.disconnect()}},[t,i,n,e])}function ne(e){let t=r.useRef(null);return r.useImperativeHandle(e,()=>t.current,[]),t}function C(e){return e[e.length-1]}function re(e){return typeof e==`function`}function ie(e,t){return re(e)?e(t):e}var w=Object.prototype.hasOwnProperty,ae=Object.prototype.propertyIsEnumerable;function T(e){for(let t in e)if(w.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&&!(E(e)&&E(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:w.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(!ae.call(e,r))return!1;t.push(r)}return t}function E(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 D(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(!D(e[r],t[r],n))return!1;return!0}if(E(e)&&E(t)){let r=n?.ignoreUndefined??!0;if(n?.partial){for(let i in t)if((!r||t[i]!==void 0)&&!D(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||!D(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 O(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 he=[`http:`,`https:`,`mailto:`,`tel:`];function k(e,t){if(!e)return!1;try{let n=new URL(e);return!t.has(n.protocol)}catch{return!1}}function ge(e){if(!e||!/[%\\\x00-\x1f\x7f]/.test(e)&&!e.startsWith(`//`))return{path:e,handledProtocolRelativeURL:!1};let t=/%25|%5C/gi,n=0,r=``,i;for(;(i=t.exec(e))!==null;)r+=O(e.slice(n,i.index))+i[0],n=t.lastIndex;r+=O(n?e.slice(n):e);let a=!1;return r.startsWith(`//`)&&(a=!0,r=`/`+r.replace(/^\/+/,``)),{path:r,handledProtocolRelativeURL:a}}function A(e){return/\s|[^\u0000-\u007F]/.test(e)?e.replace(/\s|[^\u0000-\u007F]/gu,encodeURIComponent):e}function _e(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 ve(){throw Error(`Invariant failed`)}function j(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 M=4,N=5;function P(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 F(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=P(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 I(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=F(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=L(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=be(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=L(r);e.kind=N,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=L(r);e.kind=M,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)I(e,t,r,c,i,a,o,s)}function ye(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 L(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 be(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 R(e,t){let n=L(`/`),r=new Uint16Array(6),i=[];for(let t of e)I(!1,r,t,1,n,0,i);for(let e of i)e.sort(ye);t.masksTree=n,t.flatCache=j(1e3)}function z(e,t){e||=`/`;let n=t.flatCache.get(e);if(n)return n;let r=V(e,t.masksTree);return t.flatCache.set(e,r),r}function B(e,t,n,r,i){e||=`/`,r||=`/`;let a=t?`case\0${e}`:e,o=i.singleCache.get(a);return o||(o=L(`/`),I(t,new Uint16Array(6),{from:e},1,o,0),i.singleCache.set(a,o)),V(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=V(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=L(e.fullPath),i=new Uint16Array(6),a=[],o={},s={},c=0;I(t,i,e,1,r,0,a,e=>{if(n?.(e,c),e.id in o&&ve(),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(ye);return{processedTree:{segmentTree:r,singleCache:j(1e3),matchCache:j(1e3),flatCache:null,masksTree:null},routesById:o,routesByPath:s}}function V(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===M)break;if(u.kind===N){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 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=!C(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(!ke(e,t,n))continue;g=n.rawParams,h=n.extract}r&&i.route&&i.kind!==M&&U(c,n)&&(c=n);let _=u===o;if(_&&(i.route&&(!a||i.kind===M||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&&(ke(e,t,n)||(r=!1)),r){if(!p&&!m&&!d&&Oe(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 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 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===M)>(e.node.kind===M)||t.node.kind===M==(e.node.kind===M)&&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 W(e,t){return e?.endsWith(`/`)&&e!==`/`&&e!==`${t}/`?e.slice(0,-1):e}function Fe(e,t,n){return W(e,n)===W(t,n)}function Ie({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&&C(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&&(C(s)===``?n===`never`&&s.pop():n===`always`&&s.push(``));let c=je(s.join(`/`))||`/`;return o&&r&&r.set(o,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=F(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 o(i.Fragment,{children:Ue()?e:t})}function Ue(){return i.useSyncExternalStore(We,()=>!0,()=>!1)}function We(){return()=>{}}var Ge=r.createContext(null);function Ke(e){return r.useContext(Ge)}var qe=_((e=>{var t=x(`react`);function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),Je=_(((e,t)=>{t.exports=qe()})),Ye=_((e=>{var t=x(`react`),n=Je();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),Xe=_(((e,t)=>{t.exports=Ye()})),Ze=Xe();function Qe(e,t){return e===t}function $e(e,t,n=Qe){let r=a(t=>{if(!e)return()=>{};let{unsubscribe:n}=e.subscribe(t);return n},[e]),i=a(()=>e?.get(),[e]);return(0,Ze.useSyncExternalStoreWithSelector)(r,i,i,t,n)}function et(e){let t=Ke();return r.useCallback(n=>t.navigate({...n,from:n.from??e?.from}),[e?.from,t])}function tt(e){let t=r.useRef(e);return D(t.current,e,{ignoreUndefined:!1})||(t.current=e),t.current}function nt(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function rt(e,t,n){if(e?.external)return k(e.href,n)?void 0:e.href;if(!pt(t)&&typeof t==`string`&&t.indexOf(`:`)!==-1)try{return new URL(t),k(t,n)?void 0:t}catch{}}function it(e,t,n,r,i,a){if(a)return!1;if(n?.exact){if(!Fe(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)&&!D(e.search,t.search,{partial:!n?.exact,ignoreUndefined:!n?.explicitUndefined})?!1:!n?.includeHash||i&&e.hash===t.hash}function at(e,t){let n=Ke(),i=ne(t),{activeProps:a,inactiveProps:o,activeOptions:c,to:l,preload:u,preloadDelay:d,preloadIntentProximity:f,hashScrollIntoView:p,replace:m,startTransition:h,resetScroll:g,viewTransition:_,children:v,target:y,disabled:b,style:x,className:ee,onClick:S,onBlur:C,onFocus:re,onMouseEnter:w,onMouseLeave:ae,onTouchStart:T,ignoreBlocker:oe,params:se,search:ce,hash:le,state:E,mask:ue,reloadDocument:de,unsafeRelative:D,from:fe,_fromLocation:pe,...me}=e,O=Ue(),he=tt(e.search),k=tt(e.params),ge=tt(c),A=r.useMemo(()=>e,[n,e.from,e._fromLocation,e.hash,e.to,he,k,e.state,e.mask,e.unsafeRelative]),_e=r.useCallback(e=>{let t=n.buildLocation({_fromLocation:e,...A}),r=ft(t.maskedLocation?t.maskedLocation.publicHref:t.publicHref,t.maskedLocation?t.maskedLocation.external:t.external,n.history,b),i=rt(r,l,n.protocolAllowlist);return[r?.href,i,it(e,t,ge,n.basepath,O,i!==void 0)]},[ge,b,O,A,n,l]),[ve,j,M]=$e(n.stores.location,_e,nt),N=M?ie(a,{})??st:ot,P=M?ot:ie(o,{})??ot,F=[ee,N.className,P.className].filter(Boolean).join(` `),I=(x||N.style||P.style)&&{...x,...N.style,...P.style},[ye,L]=r.useState(!1),be=r.useRef(!1),R=e.reloadDocument||j?!1:u??n.options.defaultPreload,z=d??n.options.defaultPreloadDelay??0,B=r.useCallback(()=>{n.preloadRoute(A).catch(e=>{console.warn(e),console.warn(Ve)})},[n,A]);te(i,r.useCallback(e=>{e?.isIntersecting&&B()},[B]),dt,!!b||R!==`viewport`),r.useEffect(()=>{be.current||!b&&R===`render`&&(B(),be.current=!0)},[b,B,R]);let xe=e=>{let t=e.currentTarget.getAttribute(`target`),r=y===void 0?t:y;if(!b&&!ht(e)&&!e.defaultPrevented&&(!r||r===`_self`)&&e.button===0){e.preventDefault(),s(()=>{L(!0)});let t=n.subscribe(`onResolved`,()=>{t(),L(!1)});n.navigate({...A,replace:m,resetScroll:g,hashScrollIntoView:p,startTransition:h,viewTransition:_,ignoreBlocker:oe})}};if(j)return{...me,ref:i,href:j,...v&&{children:v},...y&&{target:y},...b&&{disabled:b},...x&&{style:x},...ee&&{className:ee},...S&&{onClick:S},...C&&{onBlur:C},...re&&{onFocus:re},...w&&{onMouseEnter:w},...ae&&{onMouseLeave:ae},...T&&{onTouchStart:T}};let Se=e=>{if(b||R!==`intent`)return;if(!z){B();return}let t=e.currentTarget;if(G.has(t))return;let n=setTimeout(()=>{G.delete(t),B()},z);G.set(t,n)},Ce=e=>{b||R!==`intent`||B()},V=e=>{if(b||!R||!z)return;let t=e.currentTarget,n=G.get(t);n&&(clearTimeout(n),G.delete(t))};return{...me,...N,...P,href:ve,ref:i,onClick:K([S,xe]),onBlur:K([C,V]),onFocus:K([re,Se]),onMouseEnter:K([w,Se]),onMouseLeave:K([ae,V]),onTouchStart:K([T,Ce]),disabled:!!b,target:y,...I&&{style:I},...F&&{className:F},...b&&ct,...M&<,...O&&ye&&ut}}var ot={},st={className:`active`},ct={role:`link`,"aria-disabled":!0},lt={"data-status":`active`,"aria-current":`page`},ut={"data-transitioning":`transitioning`},G=new WeakMap,dt={rootMargin:`100px`},K=e=>t=>{for(let n of e)if(n){if(t.defaultPrevented)return;n(t)}};function ft(e,t,n,r){if(!r)return t?{href:e,external:!0}:{href:n.createHref(e)||`/`,external:!1}}function pt(e){if(typeof e!=`string`)return!1;let t=e.charCodeAt(0);return t===47?e.charCodeAt(1)!==47:t===46}var mt=r.forwardRef((e,t)=>{let{_asChild:n,...i}=e,{type:a,...o}=at(i,t),s=typeof i.children==`function`?i.children({isActive:o[`data-status`]===`active`}):i.children;if(!n){let{disabled:e,...t}=o;return r.createElement(`a`,t,s)}return r.createElement(n,o,s)});function ht(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}var gt={primary:l`
|
|
2
|
-
background: ${({theme:e})=>e.color.accent};
|
|
3
|
-
color: ${({theme:e})=>e.color.accentInk};
|
|
4
|
-
border-color: ${({theme:e})=>e.color.accent};
|
|
5
|
-
|
|
6
|
-
&:hover:not(:disabled) {
|
|
7
|
-
filter: brightness(1.08);
|
|
8
|
-
}
|
|
9
|
-
`,default:l`
|
|
10
|
-
background: ${({theme:e})=>e.color.panelRaised};
|
|
11
|
-
color: ${({theme:e})=>e.color.ink};
|
|
12
|
-
border-color: ${({theme:e})=>e.color.ruleStrong};
|
|
13
|
-
|
|
14
|
-
&:hover:not(:disabled) {
|
|
15
|
-
border-color: ${({theme:e})=>e.color.accent};
|
|
16
|
-
color: ${({theme:e})=>e.color.accent};
|
|
17
|
-
}
|
|
18
|
-
`,ghost:l`
|
|
19
|
-
background: transparent;
|
|
20
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
21
|
-
border-color: transparent;
|
|
22
|
-
|
|
23
|
-
&:hover:not(:disabled) {
|
|
24
|
-
background: ${({theme:e})=>e.color.panelRaised};
|
|
25
|
-
color: ${({theme:e})=>e.color.ink};
|
|
26
|
-
}
|
|
27
|
-
`,danger:l`
|
|
28
|
-
background: transparent;
|
|
29
|
-
color: ${({theme:e})=>e.color.down};
|
|
30
|
-
border-color: ${({theme:e})=>e.color.down};
|
|
31
|
-
|
|
32
|
-
&:hover:not(:disabled) {
|
|
33
|
-
background: ${({theme:e})=>e.color.downWash};
|
|
34
|
-
}
|
|
35
|
-
`},_t={sm:l`
|
|
36
|
-
height: 24px;
|
|
37
|
-
padding: 0 ${({theme:e})=>e.space(2)};
|
|
38
|
-
font-size: 11px;
|
|
39
|
-
`,md:l`
|
|
40
|
-
height: 30px;
|
|
41
|
-
padding: 0 ${({theme:e})=>e.space(3)};
|
|
42
|
-
font-size: 13px;
|
|
43
|
-
`},vt=c.button`
|
|
44
|
-
display: inline-flex;
|
|
45
|
-
align-items: center;
|
|
46
|
-
justify-content: center;
|
|
47
|
-
gap: ${({theme:e})=>e.space(1.5)};
|
|
48
|
-
border: 1px solid transparent;
|
|
49
|
-
border-radius: ${({theme:e})=>e.radius.control};
|
|
50
|
-
font-weight: 500;
|
|
51
|
-
white-space: nowrap;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
transition:
|
|
54
|
-
background 120ms ease,
|
|
55
|
-
color 120ms ease,
|
|
56
|
-
border-color 120ms ease;
|
|
57
|
-
|
|
58
|
-
${({$size:e})=>_t[e??`md`]}
|
|
59
|
-
${({$variant:e})=>gt[e??`default`]}
|
|
60
|
-
|
|
61
|
-
&:disabled {
|
|
62
|
-
opacity: 0.45;
|
|
63
|
-
cursor: not-allowed;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
svg {
|
|
67
|
-
width: 14px;
|
|
68
|
-
height: 14px;
|
|
69
|
-
}
|
|
70
|
-
`,yt=c(vt)`
|
|
71
|
-
padding: 0;
|
|
72
|
-
width: ${({$size:e})=>e===`sm`?`24px`:`30px`};
|
|
73
|
-
`,bt=c.span`
|
|
74
|
-
font-size: 10px;
|
|
75
|
-
font-weight: 600;
|
|
76
|
-
font-stretch: 74%;
|
|
77
|
-
letter-spacing: 0.16em;
|
|
78
|
-
text-transform: uppercase;
|
|
79
|
-
color: ${({theme:e})=>e.color.inkFaint};
|
|
80
|
-
white-space: nowrap;
|
|
81
|
-
`,xt=c.span`
|
|
82
|
-
font-family: ${({theme:e})=>e.font.mono};
|
|
83
|
-
font-variant-numeric: tabular-nums;
|
|
84
|
-
font-size: ${({$size:e})=>e??`12px`};
|
|
85
|
-
color: ${({theme:e,$dim:t})=>t===!0?e.color.inkDim:`inherit`};
|
|
86
|
-
`,St=c.span`
|
|
87
|
-
color: ${({theme:e})=>e.color.inkDim};
|
|
88
|
-
`,Ct=c.div`
|
|
89
|
-
display: flex;
|
|
90
|
-
align-items: ${({$align:e})=>e??`center`};
|
|
91
|
-
justify-content: ${({$justify:e})=>e??`flex-start`};
|
|
92
|
-
gap: ${({theme:e,$gap:t})=>e.space(t??2)};
|
|
93
|
-
${({$wrap:e})=>e===!0?`flex-wrap: wrap;`:``}
|
|
94
|
-
min-width: 0;
|
|
95
|
-
`,wt=c.div`
|
|
96
|
-
display: flex;
|
|
97
|
-
flex-direction: column;
|
|
98
|
-
gap: ${({theme:e,$gap:t})=>e.space(t??2)};
|
|
99
|
-
min-width: 0;
|
|
100
|
-
`,Tt=c.div`
|
|
101
|
-
display: grid;
|
|
102
|
-
grid-template-columns: repeat(auto-fit, minmax(${({$min:e})=>e??`220px`}, 1fr));
|
|
103
|
-
gap: ${({theme:e,$gap:t})=>e.space(t??3)};
|
|
104
|
-
/* Panels size to their content; a short one does not stretch to match a tall one. */
|
|
105
|
-
align-items: start;
|
|
106
|
-
`;c.hr`
|
|
107
|
-
height: 1px;
|
|
108
|
-
border: 0;
|
|
109
|
-
margin: 0;
|
|
110
|
-
background: ${({theme:e})=>e.color.rule};
|
|
111
|
-
`;var Et=c.div`
|
|
112
|
-
flex: 1 1 auto;
|
|
113
|
-
min-width: 0;
|
|
114
|
-
`,Dt=c.div`
|
|
115
|
-
overflow-x: auto;
|
|
116
|
-
overscroll-behavior-x: contain;
|
|
117
|
-
`,Ot=c.span`
|
|
118
|
-
overflow: hidden;
|
|
119
|
-
text-overflow: ellipsis;
|
|
120
|
-
white-space: nowrap;
|
|
121
|
-
min-width: 0;
|
|
122
|
-
`;c.span`
|
|
123
|
-
position: absolute;
|
|
124
|
-
width: 1px;
|
|
125
|
-
height: 1px;
|
|
126
|
-
padding: 0;
|
|
127
|
-
margin: -1px;
|
|
128
|
-
overflow: hidden;
|
|
129
|
-
clip-path: inset(50%);
|
|
130
|
-
white-space: nowrap;
|
|
131
|
-
`;var kt=u`
|
|
132
|
-
0%, 100% { opacity: 1; }
|
|
133
|
-
50% { opacity: 0.35; }
|
|
134
|
-
`,At=l`
|
|
135
|
-
animation: ${kt} 2.4s ease-in-out infinite;
|
|
136
|
-
`,jt=l`
|
|
137
|
-
background-image: repeating-linear-gradient(
|
|
138
|
-
to bottom,
|
|
139
|
-
var(--grid-line) 0 1px,
|
|
140
|
-
transparent 1px 4px
|
|
141
|
-
);
|
|
142
|
-
`,Mt=class extends Error{status;code;constructor(e,t,n){super(n),this.name=`ApiError`,this.status=e,this.code=t}get isUnauthenticated(){return this.status===401||this.code===`AUTH`}};function Nt(e){if(typeof e!=`object`||!e)return!1;let t=e.error;return typeof t!=`object`||!t?!1:typeof t.message==`string`}async function q(e,t={}){let n=t.method??`GET`,r=t.body instanceof Blob?t.body:null,i={method:n,credentials:`same-origin`,headers:t.body===void 0?{}:{"content-type":r===null?`application/json`:`application/octet-stream`},...t.body===void 0?{}:{body:r===null?JSON.stringify(t.body):r},...t.signal===void 0?{}:{signal:t.signal}},a=await fetch(e,i),o=t.accept??[],s=null;if(a.status!==204){let e=await a.text();if(e.length>0)try{s=JSON.parse(e)}catch{s=null}}if(!a.ok&&!o.includes(a.status)){let e=Nt(s)?s.error.code??`INTERNAL`:`INTERNAL`,t=Nt(s)?s.error.message:`request failed with status ${a.status}`;throw new Mt(a.status,String(e),t)}return{status:a.status,data:s}}async function J(e,t){return(await q(e,t===void 0?{}:{signal:t})).data}async function Y(e,t){return(await q(e,{method:`POST`,...t===void 0?{}:{body:t}})).data}async function X(e,t){return(await q(e,{method:`PUT`,body:t})).data}async function Pt(e,t){return(await q(e,{method:`PATCH`,body:t})).data}async function Z(e){return(await q(e,{method:`DELETE`})).data}function Q(e,t){let n=new URLSearchParams;for(let[e,r]of Object.entries(t))r!==void 0&&n.set(e,String(r));let r=n.toString();return r.length===0?e:`${e}?${r}`}var $={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],console:(e,t)=>[`console`,e,t],database:[`database`],snapshots:[`database`,`snapshots`],lifecycle:[`lifecycle`],plugins:[`plugins`]};function Ft(){return t({queryKey:$.status,queryFn:({signal:e})=>J(`/api/status`,e),staleTime:3e4})}function It(){return t({queryKey:$.credentials,queryFn:async({signal:e})=>(await J(`/api/credentials`,e)).credentials})}function Lt(e=1e4){return t({queryKey:$.credentialHealth,queryFn:({signal:e})=>J(`/api/credentials/health`,e),refetchInterval:e})}function Rt(e,n=!0){return t({queryKey:$.quotaHistory(e),enabled:n,queryFn:({signal:t})=>J(Q(`/api/credentials/quota/history`,{credentialId:e.credentialId,since:e.since,...e.until===void 0?{}:{until:e.until}}),t),refetchInterval:!1})}function zt(){return t({queryKey:$.models,queryFn:async({signal:e})=>(await J(`/api/models`,e)).models})}function Bt(){return t({queryKey:$.keys,queryFn:async({signal:e})=>(await J(`/api/keys`,e)).keys})}var Vt={queryKey:$.settings,queryFn:({signal:e})=>J(`/api/settings`,e)};function Ht(){return t({...Vt,select:e=>e.settings})}function Ut(){return t({...Vt,select:e=>e.bodyLoggingAllowed&&e.settings.bodyLoggingEnabled})}function Wt(){return t({...Vt,select:e=>e.bodyLoggingAllowed})}function Gt(e,n){return t({queryKey:$.agentSetup(e,n),enabled:n!==void 0,queryFn:async({signal:t})=>(await J(Q(`/api/agent-setup`,{client:e,...n??{}}),t)).files})}function Kt(e,n=6e4){return t({queryKey:$.usage(e),queryFn:async({signal:t})=>(await J(Q(`/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:n})}var qt=2e3;function Jt(e=100,n=qt){return t({queryKey:$.logs(e),queryFn:async({signal:t})=>(await J(Q(`/api/logs`,{limit:e}),t)).logs,refetchInterval:n})}function Yt(e){return t({queryKey:$.requestBody(e??``),enabled:e!==null,queryFn:({signal:t})=>J(`/api/requests/${encodeURIComponent(e??``)}/body`,t),refetchInterval:!1})}var Xt=5e3;function Zt(e=200,n=``,r=Xt){return t({queryKey:$.console(e,n),queryFn:async({signal:t})=>J(Q(`/api/console`,{lines:e,...n===``?{}:{level:n}}),t),refetchInterval:r})}function Qt(){return t({queryKey:$.database,queryFn:({signal:e})=>J(`/api/database`,e),refetchInterval:!1})}function $t(e){return`/api/database/snapshots/${encodeURIComponent(e)}/download`}function en(){return t({queryKey:$.snapshots,queryFn:async({signal:e})=>(await J(`/api/database/snapshots`,e)).snapshots,refetchInterval:!1})}function tn(e){e.invalidateQueries({queryKey:$.database})}function nn(){let t=n();return e({mutationFn:()=>Y(`/api/database/snapshots`),onSuccess:()=>tn(t)})}function rn(){let t=n();return e({mutationFn:e=>X(`/api/database/retention`,e),onSuccess:()=>{tn(t),t.invalidateQueries({queryKey:$.settings})}})}function an(){let t=n();return e({mutationFn:()=>Y(`/api/database/vacuum`),onSuccess:()=>tn(t)})}function on(){let t=n();return e({mutationFn:e=>Z(`/api/database/snapshots/${encodeURIComponent(e)}`),onSuccess:()=>tn(t)})}function sn(){return e({mutationFn:e=>Y(`/api/database/snapshots/${encodeURIComponent(e)}/restore`)})}function cn(){return e({mutationFn:e=>Y(`/api/database/import`,e)})}function ln(){return t({queryKey:$.lifecycle,queryFn:({signal:e})=>J(`/api/lifecycle`,e),refetchInterval:!1})}function un(){return e({mutationFn:()=>Y(`/api/lifecycle/restart`)})}function dn(){return e({mutationFn:()=>Y(`/api/lifecycle/shutdown`)})}function fn(){let t=n();return e({mutationFn:e=>Y(`/api/login`,{password:e}),onSuccess:()=>t.invalidateQueries()})}function pn(){let t=n();return e({mutationFn:e=>Y(`/api/setup`,{password:e}),onSuccess:()=>t.invalidateQueries()})}function mn(){let t=n();return e({mutationFn:()=>Y(`/api/logout`),onSuccess:()=>{t.clear()}})}function hn(){let t=n();return e({mutationFn:({id:e,patch:t})=>Pt(`/api/credentials/${e}`,t),onSuccess:()=>{t.invalidateQueries({queryKey:$.credentials}),t.invalidateQueries({queryKey:$.credentialHealth})}})}function gn(){let t=n();return e({mutationFn:e=>Z(`/api/credentials/${e}`),onSuccess:()=>{t.invalidateQueries({queryKey:$.credentials}),t.invalidateQueries({queryKey:$.credentialHealth})}})}function _n(){let t=n();return e({mutationFn:e=>X(`/api/models/${e.id}`,e),onSuccess:()=>t.invalidateQueries({queryKey:$.models})})}function vn(){let t=n();return e({mutationFn:e=>Z(`/api/models/${e}`),onSuccess:()=>t.invalidateQueries({queryKey:$.models})})}function yn(){return e({mutationFn:({modelId:e,need:t})=>Y(`/api/models/${e}/dry-run`,t)})}function bn(){let t=n();return e({mutationFn:e=>Y(`/api/keys`,e),onSuccess:()=>t.invalidateQueries({queryKey:$.keys})})}function xn(){let t=n();return e({mutationFn:({id:e,limits:t})=>X(`/api/keys/${e}/limits`,{limits:t}),onSuccess:()=>t.invalidateQueries({queryKey:$.keys})})}function Sn(){let t=n();return e({mutationFn:e=>Z(`/api/keys/${e}`),onSuccess:()=>t.invalidateQueries({queryKey:$.keys})})}function Cn(){let t=n();return e({mutationFn:e=>X(`/api/settings`,e),onSuccess:()=>t.invalidateQueries({queryKey:$.settings})})}function wn(){return e({mutationFn:e=>Y(`/api/connect/start`,e)})}function Tn(){let t=n();return e({mutationFn:e=>Y(`/api/credentials`,e),onSuccess:()=>t.invalidateQueries({queryKey:$.credentials})})}function En(){let t=n();return e({mutationFn:e=>Y(`/api/connect/finish`,e),onSuccess:()=>t.invalidateQueries({queryKey:$.credentials})})}function Dn(){return t({queryKey:$.plugins,queryFn:async({signal:e})=>(await J(`/api/plugins`,e)).plugins,staleTime:3e5})}async function On(e){let t=await q(`/api/connect/poll`,{method:`POST`,body:{flowId:e},accept:[202]});return t.status===202?{status:`pending`}:t.data}export{bt as $,Rt as A,R as At,pn as B,T as Bt,Bt as C,Pe as Ct,Jt as D,z as Dt,mn as E,Te as Et,_n as F,_e as Ft,Kt as G,ce as Gt,en as H,fe as Ht,rn as I,ge as It,Z as J,_ as Jt,an as K,ee as Kt,Cn as L,D as Lt,un as M,j as Mt,sn as N,ve as Nt,zt as O,xe as Ot,Sn as P,he as Pt,Tt as Q,xn as R,A as Rt,cn as S,Ie as St,fn as T,Ne as Tt,Ft as U,C as Ut,dn as V,k as Vt,hn as W,se as Wt,Y as X,x as Xt,J as Y,v as Yt,X as Z,b as Zt,Qt as _,He as _t,$t as a,wt as at,on as b,ze as bt,Wt as c,jt as ct,Zt as d,mt as dt,xt as et,Tn as f,et as ft,It as g,Ge as gt,Lt as h,Ke as ht,$ as i,Et as it,Yt as j,Ce as jt,Dn as k,B as kt,En as l,vt as lt,nn as m,Xe as mt,qt as n,Ct as nt,Gt as o,Ot as ot,bn as p,$e as pt,Mt as q,S as qt,On as r,Dt as rt,Ut as s,At as st,Xt as t,St as tt,wn as u,yt as ut,gn as v,je as vt,ln as w,Me as wt,yn as x,Ae as xt,vn as y,Le as yt,Ht as z,ie as zt};
|