omnigateway 0.12.11 → 0.12.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +1 -0
  2. package/bin/omni.js +488 -119
  3. package/gateway.js +488 -111
  4. package/package.json +1 -1
  5. package/public/assets/{Chip-D4qvhu1D.js → Chip-D0XSbQUr.js} +1 -1
  6. package/public/assets/{CopyValue-SnsT2LML.js → CopyValue-DAlmkISB.js} +3 -3
  7. package/public/assets/{Field-BYBri2NV.js → Field-DG1317zr.js} +1 -1
  8. package/public/assets/Lamp-Dk9XrTCg.js +26 -0
  9. package/public/assets/{Panel-CWmOTDAP.js → Panel-CsovmtxF.js} +23 -4
  10. package/public/assets/Rack-CDUOJkS2.js +483 -0
  11. package/public/assets/{Readout-BTh732hP.js → Readout-DlT5oxGO.js} +1 -1
  12. package/public/assets/RequestTable-i3TtCB9m.js +93 -0
  13. package/public/assets/{SummaryDeck-7ivuca39.js → SummaryDeck-DrzTQQo5.js} +2 -2
  14. package/public/assets/{Toggle-t82IhqEt.js → Toggle-CdMD58sy.js} +1 -1
  15. package/public/assets/{TokenBreakdown-D1Wtza1y.js → TokenBreakdown-BC6nqo1v.js} +1 -1
  16. package/public/assets/{WindowChart-BeGPsccS.js → WindowChart-Bqbl-KFO.js} +2 -2
  17. package/public/assets/_app-CSru2YTE.js +1 -0
  18. package/public/assets/_app.accounts-B2lQkMb0.js +70 -0
  19. package/public/assets/_app.console-a2TJDoBC.js +24 -0
  20. package/public/assets/_app.database-CqSoTi2l.js +24 -0
  21. package/public/assets/_app.index-BV1kJJjA.js +67 -0
  22. package/public/assets/_app.keys-Dq5O0AG9.js +92 -0
  23. package/public/assets/_app.logs-PjRK5wqy.js +46 -0
  24. package/public/assets/_app.models-BfmeeB5e.js +148 -0
  25. package/public/assets/_app.plugins._pluginId-Owb05aFv.js +20 -0
  26. package/public/assets/{_app.settings-C3GzeJ4q.js → _app.settings-5i-vvT-H.js} +7 -7
  27. package/public/assets/_app.usage--5qFtU1W.js +76 -0
  28. package/public/assets/chevron-down-Bb5ZGvwk.js +1 -0
  29. package/public/assets/chevron-right-hwF5mD6-.js +1 -0
  30. package/public/assets/{client-k1tkFSNH.js → client-BcXc3lek.js} +4 -4
  31. package/public/assets/{dist-D03q-60i.js → dist-BBGxva0Y.js} +1 -1
  32. package/public/assets/index-D1RDaq3l.js +14 -0
  33. package/public/assets/{login-DW2Ipp21.js → login-GB0ZGUvA.js} +4 -4
  34. package/public/assets/plus-BgcHxxIr.js +1 -0
  35. package/public/assets/{preload-helper-BPaHpbO_.js → preload-helper-B7KDmXJ9.js} +1 -1
  36. package/public/assets/rotate-ccw-Do43Argv.js +1 -0
  37. package/public/assets/{shared-Dtkw6SE0.js → shared-DDpLUhCp.js} +2 -2
  38. package/public/assets/{trash-D4QWzEK_.js → trash-00950_yY.js} +1 -1
  39. package/public/index.html +5 -5
  40. package/public/assets/Lamp-DkvXKB-B.js +0 -26
  41. package/public/assets/Rack-CEuCdVXc.js +0 -483
  42. package/public/assets/RequestTable-D8L6iVJV.js +0 -93
  43. package/public/assets/_app-Drf03PWk.js +0 -1
  44. package/public/assets/_app.accounts-W1USUo2Q.js +0 -70
  45. package/public/assets/_app.console-Co9d2ZiD.js +0 -44
  46. package/public/assets/_app.database-CtFJLcfE.js +0 -24
  47. package/public/assets/_app.index-DigYfob3.js +0 -67
  48. package/public/assets/_app.keys-B1fRMyU-.js +0 -92
  49. package/public/assets/_app.logs-CFixPsUw.js +0 -60
  50. package/public/assets/_app.models-Dpl1O2RE.js +0 -148
  51. package/public/assets/_app.plugins._pluginId-BK0ADugW.js +0 -20
  52. package/public/assets/_app.usage-D2qlcEp4.js +0 -76
  53. package/public/assets/chevron-down-Bs0tSOyA.js +0 -1
  54. package/public/assets/chevron-right-DSaI1kFo.js +0 -1
  55. package/public/assets/index-Bk9sabex.js +0 -14
  56. package/public/assets/plus-BCfjC6nk.js +0 -1
@@ -1,60 +0,0 @@
1
- import{Ct as e,Ft as t,K as n,Tt as r,V as i,W as a,Y as o,Zt as s,j as c,l,mt as u,u as d}from"./Lamp-DkvXKB-B.js";import{C as f,D as p,_ as m,a as h,b as g,i as _,r as v,t as y,x as b,y as x}from"./Panel-CWmOTDAP.js";import{D as S,i as C,t as w}from"./Rack-CEuCdVXc.js";import{a as ee,i as T,n as E,r as D,t as O}from"./RequestTable-D8L6iVJV.js";import{t as k}from"./Chip-D4qvhu1D.js";import{i as A}from"./Field-BYBri2NV.js";import{useMemo as j,useRef as M,useState as N}from"react";import{Fragment as P,jsx as F,jsxs as I}from"react/jsx-runtime";import L from"styled-components";var R={none:{legend:`Not captured`,message:`Body capture was not running for this request. It needs OMNI_BODY_LOGGING_ALLOWED in the environment and the body logging setting turned on, and the calling key must not have opted out.`},missing:{legend:`Captured, then lost`,message:`This request was captured, but its artifact is no longer on disk. Retention or the row cap has since pruned it, or something removed the file underneath the gateway.`},corrupt:{legend:`Captured, but unreadable`,message:`This request was captured and the artifact is still on disk, but it failed its checksum or would not decrypt. Changing OMNI_ENCRYPTION_KEY invalidates every artifact written under the old one.`}},z=new Intl.NumberFormat(`en-US`),B=L.p`
2
- font-size: 12px;
3
- color: ${({theme:e})=>e.color.inkDim};
4
- max-width: 62ch;
5
- `,V=L(B)`
6
- border-left: 2px solid ${({theme:e})=>e.color.ruleStrong};
7
- padding-left: ${({theme:e})=>e.space(2)};
8
- `,H=L.h4`
9
- font-size: 11px;
10
- font-weight: 600;
11
- letter-spacing: 0.12em;
12
- text-transform: uppercase;
13
- color: ${({theme:e})=>e.color.inkDim};
14
- margin: 0;
15
- `,U=L.figcaption`
16
- display: flex;
17
- align-items: center;
18
- gap: ${({theme:e})=>e.space(2)};
19
- flex-wrap: wrap;
20
- margin-bottom: 4px;
21
- `,W=L.figure`
22
- margin: 0;
23
- min-width: 0;
24
- `,G=L.pre`
25
- margin: 0;
26
- padding: ${({theme:e})=>e.space(2)};
27
- max-height: 260px;
28
- overflow: auto;
29
- border: 1px solid ${({theme:e})=>e.color.rule};
30
- border-radius: ${({theme:e})=>e.radius.control};
31
- background: ${({theme:e})=>e.color.panelSunk};
32
- font-family: ${({theme:e})=>e.font.mono};
33
- font-size: 11.5px;
34
- line-height: 1.5;
35
- white-space: pre-wrap;
36
- word-break: break-word;
37
- `;function K(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;if(t.omitted!==!0||typeof t.reason!=`string`)return null;let n=t.serializedBytes;return{omitted:!0,reason:t.reason,serializedBytes:typeof n==`number`?n:0}}function q({title:e,stage:t,value:n}){let r=K(n);return I(W,{children:[I(U,{children:[F(H,{children:e}),t===void 0?null:F(k,{children:t})]}),r===null?n==null?F(B,{children:`Nothing was recorded for this half — it never happened, or never completed.`}):F(G,{children:JSON.stringify(n,null,2)}):I(B,{children:[`Too large to keep: `,r.reason,`. The payload was`,` `,z.format(r.serializedBytes),` bytes after structural bounding, so it was replaced by this marker rather than written oversized or dropped without a trace.`]})]})}function J({attempt:e}){return I(f,{$gap:2,children:[I(g,{$gap:2,$wrap:!0,children:[I(m,{as:`h3`,children:[`Attempt `,e.attempt,` · `,e.provider]}),e.truncated?F(k,{$tone:`warn`,children:`truncated`}):null]}),F(q,{title:`Request sent to the provider`,stage:`post-RTK`,value:e.request}),F(q,{title:`Response from the provider`,value:e.response}),e.streamChunks===null?null:F(q,{title:`Raw stream frames (${c(e.streamChunks.length)})`,value:e.streamChunks})]})}function Y({body:e}){let t=e.artifact;if(t===null){let t=R[e.detailState===`ready`?`corrupt`:e.detailState];return I(f,{$gap:1,children:[F(m,{children:t.legend}),F(B,{children:t.message})]})}return I(f,{$gap:3,children:[t.attempts.length===0?null:F(V,{children:`The client request below is what arrived at the gateway. Each attempt request is what went upstream after RTK filters ran, so the two are not the same payload — compare them to see what compression actually removed.`}),I(f,{$gap:2,children:[I(g,{$gap:2,$wrap:!0,children:[F(m,{as:`h3`,children:`Client`}),t.client.truncated?F(k,{$tone:`warn`,children:`truncated`}):null]}),F(q,{title:`Request from the client`,stage:`pre-RTK`,value:t.client.request}),F(q,{title:`Response returned to the client`,value:t.client.response})]}),t.attempts.map(e=>F(J,{attempt:e},`${e.attempt}-${e.provider}`)),t.error===null||t.error===void 0?null:F(q,{title:`Error`,value:t.error})]})}function X({requestId:e}){let n=t(e),r=n.data===void 0||n.data.detailState!==`ready`?void 0:`${z.format(n.data.sizeBytes)} bytes on disk`;return F(y,{legend:`Captured bodies`,...r===void 0?{}:{meta:r},...n.data?.truncated===!0?{actions:F(k,{$tone:`warn`,children:`truncated`})}:{},children:n.isError?F(_,{error:n.error,onRetry:()=>void n.refetch()}):n.isPending?F(h,{rows:3}):F(Y,{body:n.data})})}var Z=[50,100,250,500],Q=160,te=L(g)`
38
- gap: ${({theme:e})=>e.space(2)};
39
- flex-wrap: wrap;
40
- `,ne=L(A)`
41
- width: auto;
42
- `,re=L(g)`
43
- justify-content: center;
44
- gap: ${({theme:e})=>e.space(2)};
45
- padding: ${({theme:e})=>e.space(3)};
46
- `,ie=L(y)`
47
- flex: 1;
48
- min-height: 0;
49
-
50
- > div {
51
- display: flex;
52
- flex: 1;
53
- flex-direction: column;
54
- min-height: 0;
55
- }
56
- `,ae=L(b)`
57
- flex: 1;
58
- min-height: 0;
59
- overflow-y: auto;
60
- `;function $(){let{cadence:t,live:f}=S(),[m,g]=N(100),[y,b]=N(ee),[k,A]=N(null),L=M(!1),R=r(y,m,t(i,`res:logs`)),z=j(()=>(R.data?.pages??[]).flatMap(e=>e.logs),[R.data?.pages]),B=!a(R.data),V=s(n.logPages(y,m)),H=M(null),U=()=>{H.current?.scrollTo({top:0}),V()},W=u(),G=e(),K=o(),q=D(f&&z.some(d)),J=j(()=>({accounts:new Map((W.data??[]).map(e=>[e.id,e.label])),keys:new Map((G.data??[]).map(e=>[e.id,e.label]))}),[W.data,G.data]),Y=z.filter(l).length,$=z.filter(d).length;return I(P,{children:[F(w,{legend:`Logs`,title:`Recent requests`,summary:R.isLoading?`Reading the request log…`:`${c(z.length)} requests loaded, ${c(Y)} of them failed${$===0?``:`, ${c($)} still running`}. ${K.data===!0?`Body capture is on: open a request to read what it sent and received.`:`Prompt and response bodies are not being recorded.`}`,actions:I(te,{children:[F(T,{filters:y,onChange:b,operator:!0}),F(ne,{value:m,"aria-label":`How many requests per page`,onChange:e=>g(Number(e.target.value)),children:Z.map(e=>I(`option`,{value:e,children:[e,` per page`]},e))}),B?F(p,{type:`button`,onClick:U,children:`Back to live`}):null]})}),F(ie,{legend:`Request log`,meta:`${z.length} shown`,flush:!0,children:R.isError?F(_,{error:R.error,onRetry:()=>void R.refetch()}):R.isLoading?F(`div`,{style:{padding:12},children:F(h,{rows:8})}):z.length===0?F(v,{legend:`Nothing to show`,message:Object.keys(y).length===0?`No requests have reached the gateway yet.`:`No request matches these filters. Clear them to see everything.`}):I(ae,{ref:H,"data-testid":`request-log-scroller`,onScroll:e=>{let t=e.currentTarget;t.scrollHeight-t.scrollTop-t.clientHeight>Q||R.hasNextPage&&(L.current||(L.current=!0,R.fetchNextPage().finally(()=>{L.current=!1})))},children:[F(E,{rows:z,now:q,names:J,onOpen:A}),R.isFetchingNextPage||B?I(re,{children:[R.isFetchingNextPage?F(x,{children:`Loading older requests…`}):null,B?F(x,{children:`Live updates are paused while older pages are loaded.`}):null]}):null]})}),F(C,{open:k!==null,onOpenChange:e=>{e||A(null)},title:`Request detail`,width:`760px`,footer:F(p,{type:`button`,onClick:()=>A(null),children:`Close`}),children:k===null?null:F(O,{log:k,names:J,children:F(X,{requestId:k.id})})})]})}var oe=$;export{oe as component};
@@ -1,148 +0,0 @@
1
- import{D as e,Kt as t,Mt as n,U as r,bt as i,kt as a,mt as o,vt as s,zt as c}from"./Lamp-DkvXKB-B.js";import{C as l,D as u,O as d,S as f,_ as p,a as m,b as h,i as g,o as _,r as v,t as y,v as b,w as x}from"./Panel-CWmOTDAP.js";import{A as S,r as C,t as w,w as T}from"./Rack-CEuCdVXc.js";import{t as E}from"./plus-BCfjC6nk.js";import{t as D}from"./trash-D4QWzEK_.js";import{t as O}from"./Toggle-t82IhqEt.js";import{n as ee,t as k}from"./Chip-D4qvhu1D.js";import{i as A,n as j,r as M,t as te}from"./Field-BYBri2NV.js";import{t as N}from"./Meter-stpt3vQu.js";import{useEffect as ne,useId as re,useState as P}from"react";import{Fragment as F,jsx as I,jsxs as L}from"react/jsx-runtime";import R from"styled-components";var ie={name:`play`,size:24,node:[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]};ie.node;var ae=S(ie),oe={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};oe.node;var se=S(oe),z=[`tier`,`health`,`quota`,`cost`,`latency`,`load`],ce={tier:`How preferred this tier is`,health:`Consecutive failures and breaker state`,quota:`Headroom in the tightest window, against how much of it is left`,cost:`Price of this request against the other candidates`,latency:`Observed time to first token`,load:`Requests in flight on this pair right now`},le=R.li`
2
- padding: ${({theme:e})=>e.space(2)} 0;
3
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
4
-
5
- &:last-child {
6
- border-bottom: 0;
7
- }
8
- `,ue=R(b)`
9
- width: 22px;
10
- color: ${({theme:e})=>e.color.inkFaint};
11
- flex: none;
12
- `,de=R(k)`
13
- border-color: ${({theme:e})=>e.color.ok};
14
- color: ${({theme:e})=>e.color.ok};
15
- background: ${({theme:e})=>e.color.okWash};
16
- `,fe=R.div`
17
- display: grid;
18
- grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
19
- gap: ${({theme:e})=>e.space(2)};
20
- margin-top: ${({theme:e})=>e.space(2)};
21
- padding-left: 30px;
22
- `,pe=R.div`
23
- display: flex;
24
- flex-direction: column;
25
- gap: 3px;
26
- min-width: 0;
27
- `,me=R.div`
28
- display: flex;
29
- align-items: baseline;
30
- justify-content: space-between;
31
- gap: 6px;
32
- `,he=R.li`
33
- display: flex;
34
- align-items: center;
35
- gap: ${({theme:e})=>e.space(2)};
36
- padding: 5px 0;
37
- `,ge=R(h)`
38
- gap: ${({theme:e})=>e.space(3)};
39
- flex-wrap: wrap;
40
- `,B=R.label`
41
- display: flex;
42
- align-items: center;
43
- gap: 6px;
44
- cursor: pointer;
45
- font-size: 12.5px;
46
- `,_e=R.p`
47
- font-size: 12px;
48
- color: ${({theme:e})=>e.color.down};
49
- `;function V(e,t,n){return(e[t]??0)*n[t]}function ve({modelId:e}){let[n,r]=P({tools:!1,images:!1,reasoning:!1}),[a,o]=P(null),[s,c]=P(null),d=t(),m=i(),g=d.data?.weights,S=()=>{e!==null&&(c(null),m.mutate({modelId:e,need:n},{onSuccess:e=>o(e),onError:e=>{o(null),c(_(e))}}))},C=new Map(z.map(e=>[e,Math.max(1e-4,...(a?.candidates??[]).map(t=>g===void 0?0:Math.abs(V(t.reasons,e,g))))]));return I(y,{legend:`Explain`,meta:e??`no model selected`,actions:L(u,{type:`button`,$size:`sm`,$variant:`primary`,disabled:e===null||m.isPending,onClick:S,children:[I(ae,{}),m.isPending?`Ranking…`:`Rank candidates`]}),children:L(l,{$gap:3,children:[L(l,{$gap:1,children:[I(p,{children:`Pretend the request needs`}),L(ge,{children:[L(B,{children:[I(O,{checked:n.tools,label:`Probe request uses tools`,onCheckedChange:e=>r({...n,tools:e})}),`Tools`]}),L(B,{children:[I(O,{checked:n.images,label:`Probe request includes an image`,onCheckedChange:e=>r({...n,images:e})}),`Images`]}),L(B,{children:[I(O,{checked:n.reasoning,label:`Probe request asks for reasoning`,onCheckedChange:e=>r({...n,reasoning:e})}),`Reasoning`]})]})]}),s===null?null:I(_e,{children:s}),a===null?I(v,{legend:`Not ranked yet`,message:e===null?`Select a model to see which account the router would pick for it.`:`Run the ranking to see which account wins, by how much, and what was filtered out.`}):L(l,{$gap:3,children:[L(h,{$gap:2,$wrap:!0,children:[I(k,{$tone:`accent`,children:a.strategy}),a.deterministic?null:I(k,{$tone:`warn`,children:`order varies per request`}),I(f,{}),L(p,{children:[a.candidates.length,` eligible · `,a.excluded.length,` filtered out`]})]}),a.candidates.length===0?I(v,{legend:`Nothing eligible`,message:`Every target was filtered out. The reasons below say which rule removed each one.`}):I(`ul`,{children:a.candidates.map((e,t)=>L(le,{children:[L(h,{$gap:2,children:[I(ue,{children:t+1}),I(ee,{provider:e.provider}),I(x,{style:{maxWidth:`22ch`},children:e.credentialLabel}),I(b,{$dim:!0,children:e.model}),L(k,{children:[`tier `,e.tier]}),I(f,{}),t===0?I(de,{children:`would be used`}):null,I(b,{children:e.score.toFixed(2)})]}),g===void 0?null:I(fe,{children:z.map(t=>{let n=V(e.reasons,t,g),r=C.get(t)??1;return L(pe,{title:ce[t],children:[L(me,{children:[I(p,{children:t}),I(b,{$dim:!0,$size:`10.5px`,children:n.toFixed(2)})]}),I(N,{fraction:Math.abs(n)/r,height:4,tone:`var(--accent)`,label:`${t} contributes ${n.toFixed(2)} of ${e.score.toFixed(2)}`})]},t)})})]},`${e.credentialId}:${e.model}`))}),a.excluded.length===0?null:L(l,{$gap:1,children:[I(p,{children:`Filtered out`}),I(`ul`,{children:a.excluded.map(e=>L(he,{children:[I(b,{$dim:!0,children:e.model}),I(b,{$dim:!0,children:e.credentialId}),I(f,{}),I(k,{$tone:e.reason.startsWith(`capability`)?`warn`:`down`,children:e.reason})]},`${e.credentialId}:${e.model}:${e.reason}`))})]})]})]})})}function H(e,t,n){return r(e,t)?.models.find(e=>e.id===n)}function U(e,t,n){let i=r(e,t);return i===void 0?null:i.models.find(e=>e.id===n)?.auth??i.authTypes}var W=[{id:`score`,label:`Best score`,blurb:`Rank every eligible target by the routing weights and take the best one.`},{id:`priority`,label:`Lowest tier`,blurb:`Always prefer the lowest tier. Score only breaks ties inside a tier.`},{id:`roundRobin`,label:`Round robin`,blurb:`Take whichever eligible target has been idle longest, to spread load evenly.`},{id:`weighted`,label:`Weighted draw`,blurb:`Pick at random, biased by weight. The order differs from request to request.`}],G=0;function K(){return G+=1,`target-${G}`}function q(e,t,n){let r=H(e,t,n)?.pricing;return r===void 0?null:{costInput:String(r.input),costOutput:String(r.output),costCacheRead:String(r.cacheRead),costCacheWrite5m:String(r.cacheWrite5m),costCacheWrite1h:String(r.cacheWrite1h)}}function ye(e,t,n){let r=H(e,t,n)?.limits;return r===void 0?null:{contextWindow:String(r.contextWindow),maxOutputTokens:String(r.maxOutputTokens)}}var be={oauth:`OAuth`,apiKey:`an API key`};function J(e){return e.map(e=>be[e]).join(` or `)}function xe(e){let t=Object.create(null);for(let n of e){let e=t[n.provider]??[];e.includes(n.authType)||e.push(n.authType),t[n.provider]=e}return t}function Y(e,t,n,r){let i=r[t];if(i===void 0||i.length===0)return!0;let a=U(e,t,n);return a===null||a.some(e=>i.includes(e))}function Se(e,t,n){let i=r(e,t);return i===void 0?[]:i.models.filter(r=>Y(e,t,r.id,n))}function Ce(e,t,n,r){if(n.trim().length===0||Y(e,t,n,r))return null;let i=r[t]??[];return`${t} serves this model to ${J(U(e,t,n)??[])} only, and every ${t} account here is ${J(i)}. Requests routed here will fail.`}function we(t,n){let r={provider:t.provider,endpointId:t.endpointId};return n.filter(t=>e(r,t)).map(e=>({id:e.id,label:e.accountEmail??e.label}))}function Te(e,t,n){return e.length===0||n.length===0||we(t,n).some(t=>t.id===e)?null:`No connected account has this id. Requests routed here will fail rather than falling back to another account.`}function Ee(e,t){return{...e,endpointId:t,...t===e.endpointId?{}:{credentialId:``}}}function De(e,t,n){return{...t,...n,...q(e,n.provider,n.model)??{},...n.provider===t.provider?{}:{credentialId:``},contextWindow:``,maxOutputTokens:``}}function Oe(e,t){let n=t??e[0]?.id??`anthropic`,i=r(e,n)?.defaultModel??``,a=q(e,n,i);return{key:K(),provider:n,endpointId:``,model:i,tier:`1`,weight:`1`,costInput:a?.costInput??`0`,costOutput:a?.costOutput??`0`,costCacheRead:a?.costCacheRead??``,costCacheWrite5m:a?.costCacheWrite5m??``,costCacheWrite1h:a?.costCacheWrite1h??``,contextWindow:``,maxOutputTokens:``,credentialId:``,tools:!0,images:!0,reasoning:!0}}function X(e){return{id:``,strategy:`score`,isAlias:!1,targets:[Oe(e)]}}function ke(e){return{id:e.id,strategy:e.strategy,isAlias:e.isAlias,targets:e.targets.map(e=>({key:K(),provider:e.provider,endpointId:e.provider===`custom`?e.endpointId??``:``,model:e.model,tier:String(e.tier),weight:String(e.weight),costInput:String(e.costPerMTok.input),costOutput:String(e.costPerMTok.output),costCacheRead:e.costPerMTok.cacheRead===void 0?``:String(e.costPerMTok.cacheRead),costCacheWrite5m:e.costPerMTok.cacheWrite5m===void 0?``:String(e.costPerMTok.cacheWrite5m),costCacheWrite1h:e.costPerMTok.cacheWrite1h===void 0?``:String(e.costPerMTok.cacheWrite1h),contextWindow:e.contextWindow===void 0?``:String(e.contextWindow),maxOutputTokens:e.maxOutputTokens===void 0?``:String(e.maxOutputTokens),credentialId:e.credentialId??``,tools:e.capabilities.tools,images:e.capabilities.images,reasoning:e.capabilities.reasoning}))}}function Ae(e){let t=e.id.trim();if(t.length===0)return{ok:!1,problem:`Give the model a name clients will ask for.`};if(e.targets.length===0)return{ok:!1,problem:`A model needs at least one target to route to.`};let n=[];for(let[t,r]of e.targets.entries()){let e=`Target ${t+1}`,i=r.endpointId.trim(),a=r.credentialId.trim();if(r.provider===`custom`&&i.length===0)return{ok:!1,problem:`${e} needs a custom endpoint.`};let o=r.model.trim();if(o.length===0)return{ok:!1,problem:`${e} needs a provider model name.`};let s=Number(r.tier);if(!Number.isInteger(s)||s<1)return{ok:!1,problem:`${e}: tier must be a whole number of 1 or more.`};let c=Number(r.weight);if(!Number.isFinite(c)||c<=0)return{ok:!1,problem:`${e}: weight must be greater than zero.`};let l=Number(r.costInput),u=Number(r.costOutput);if(!Number.isFinite(l)||l<0||!Number.isFinite(u)||u<0)return{ok:!1,problem:`${e}: prices cannot be negative.`};let d=r.costCacheRead.trim().length>0,f=Number(r.costCacheRead);if(d&&(!Number.isFinite(f)||f<0))return{ok:!1,problem:`${e}: the cache-read price cannot be negative.`};let p=r.costCacheWrite5m.trim().length>0,m=Number(r.costCacheWrite5m);if(p&&(!Number.isFinite(m)||m<0))return{ok:!1,problem:`${e}: the 5m cache-write price must be a number of 0 or more.`};let h=r.costCacheWrite1h.trim().length>0,g=Number(r.costCacheWrite1h);if(h&&(!Number.isFinite(g)||g<0))return{ok:!1,problem:`${e}: the 1h cache-write price must be a number of 0 or more.`};let _=r.contextWindow.trim().length>0,v=Number(r.contextWindow);if(_&&(!Number.isInteger(v)||v<1))return{ok:!1,problem:`${e}: the context window must be a whole number of tokens.`};let y=r.maxOutputTokens.trim().length>0,b=Number(r.maxOutputTokens);if(y&&(!Number.isInteger(b)||b<1))return{ok:!1,problem:`${e}: the output limit must be a whole number of tokens.`};n.push({provider:r.provider,...r.provider===`custom`?{endpointId:i}:{},model:o,tier:s,weight:c,costPerMTok:{input:l,output:u,...d?{cacheRead:f}:{},...p?{cacheWrite5m:m}:{},...h?{cacheWrite1h:g}:{}},..._?{contextWindow:v}:{},...y?{maxOutputTokens:b}:{},...a.length>0?{credentialId:a}:{},capabilities:{tools:r.tools,images:r.images,reasoning:r.reasoning}})}return{ok:!0,model:{id:t,strategy:e.strategy,isAlias:e.isAlias,targets:n}}}var je=R.fieldset`
50
- border: 1px solid ${({theme:e})=>e.color.rule};
51
- border-left: 3px solid ${({$provider:e})=>T(e)};
52
- border-radius: ${({theme:e})=>e.radius.control};
53
- padding: ${({theme:e})=>e.space(3)};
54
- margin: 0;
55
- background: ${({theme:e})=>e.color.panelSunk};
56
- display: flex;
57
- flex-direction: column;
58
- gap: ${({theme:e})=>e.space(3)};
59
- min-width: 0;
60
- `,Me=R.div`
61
- display: grid;
62
- grid-template-columns: minmax(140px, 1.4fr) minmax(160px, 2fr) 72px 72px;
63
- gap: ${({theme:e})=>e.space(2)};
64
- align-items: end;
65
-
66
- @media (max-width: 720px) {
67
- grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
68
- }
69
- `,Ne=R.div`
70
- display: grid;
71
- grid-template-columns: repeat(3, minmax(0, 1fr));
72
- gap: ${({theme:e})=>e.space(2)};
73
- align-items: end;
74
- `,Z=R.div`
75
- display: flex;
76
- flex-direction: column;
77
- gap: 4px;
78
- min-width: 0;
79
- `,Pe=R(h)`
80
- gap: ${({theme:e})=>e.space(3)};
81
- flex-wrap: wrap;
82
- `,Fe=R.p`
83
- font-size: 11.5px;
84
- color: ${({theme:e})=>e.color.down};
85
- margin: 0;
86
- `,Q=R.label`
87
- display: flex;
88
- align-items: center;
89
- gap: 6px;
90
- cursor: pointer;
91
- `;function Ie({target:e,index:t,onChange:n,onRemove:i,removable:a,catalog:o,endpoints:s,held:c,credentials:m}){let g=re(),_=r(o,e.provider),v=Se(o,e.provider,c),y=Ce(o,e.provider,e.model,c),b=we(e,m),x=Te(e.credentialId,e,m),S=(t,r)=>{n({...e,[t]:r})},C=q(o,e.provider,e.model),w=ye(o,e.provider,e.model),T=t=>{n(De(o,e,t))};return L(je,{$provider:e.provider,children:[L(h,{$gap:2,children:[L(p,{as:`legend`,children:[`Target `,t+1]}),I(f,{}),I(d,{type:`button`,$variant:`ghost`,$size:`sm`,disabled:!a,"aria-label":`Remove target ${t+1}`,title:a?`Remove target ${t+1}`:`A model needs at least one target`,onClick:i,children:I(D,{})})]}),L(Me,{children:[L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-provider`,children:`Provider`}),L(A,{id:`${g}-provider`,value:e.provider,onChange:t=>{let n=t.target.value,i=r(o,n),a=i?.models.some(t=>t.id===e.model)??!1;T({provider:n,model:a?e.model:i?.defaultModel??``})},children:[o.map(e=>I(`option`,{value:e.id,children:e.label},e.id)),_===void 0?L(`option`,{value:e.provider,children:[e.provider,` (not in the catalog)`]}):null]})]}),e.provider===`custom`?L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-endpoint`,children:`Endpoint`}),L(A,{id:`${g}-endpoint`,value:e.endpointId,onChange:t=>n(Ee(e,t.target.value)),children:[I(`option`,{value:``,children:`Choose endpoint`}),s.map(e=>I(`option`,{value:e.id,children:e.label},e.id))]})]}):null,L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-model`,children:`Provider model`}),I(j,{id:`${g}-model`,list:`${g}-catalog`,value:e.model,placeholder:_?.defaultModel??``,onChange:t=>T({provider:e.provider,model:t.target.value})}),I(`datalist`,{id:`${g}-catalog`,children:v.map(e=>I(`option`,{value:e.id,children:e.label},e.id))}),y===null?null:I(Fe,{role:`note`,children:y})]}),L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-tier`,children:`Tier`}),I(M,{id:`${g}-tier`,min:1,step:1,value:e.tier,onChange:e=>S(`tier`,e.target.value)})]}),L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-weight`,children:`Weight`}),I(M,{id:`${g}-weight`,min:0,step:.1,value:e.weight,onChange:e=>S(`weight`,e.target.value)})]})]}),I(l,{$gap:1,children:L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-account`,children:`Account`}),L(A,{id:`${g}-account`,value:e.credentialId,onChange:e=>S(`credentialId`,e.target.value),children:[I(`option`,{value:``,children:`Any account`}),b.map(e=>I(`option`,{value:e.id,children:e.label},e.id)),x===null?null:L(`option`,{value:e.credentialId,children:[e.credentialId,` (removed)`]})]}),x===null?null:I(Fe,{role:`note`,children:x})]})}),L(l,{$gap:1,children:[L(h,{$gap:2,children:[I(p,{children:`Price per million tokens`}),I(f,{}),C===null?I(p,{as:`span`,children:`not in the catalog — price it yourself`}):L(u,{type:`button`,$size:`sm`,$variant:`ghost`,disabled:e.costInput===C.costInput&&e.costOutput===C.costOutput&&e.costCacheRead===C.costCacheRead&&e.costCacheWrite5m===C.costCacheWrite5m&&e.costCacheWrite1h===C.costCacheWrite1h,onClick:()=>n({...e,...C}),children:[I(se,{}),`Use list price`]})]}),L(Ne,{children:[L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-in`,children:`Input`}),I(M,{id:`${g}-in`,min:0,step:.01,value:e.costInput,onChange:e=>S(`costInput`,e.target.value)})]}),L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-out`,children:`Output`}),I(M,{id:`${g}-out`,min:0,step:.01,value:e.costOutput,onChange:e=>S(`costOutput`,e.target.value)})]}),L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-cache`,children:`Cache read`}),I(M,{id:`${g}-cache`,min:0,step:.01,placeholder:`same as input`,value:e.costCacheRead,onChange:e=>S(`costCacheRead`,e.target.value)})]}),L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-write5m`,children:`Cache write 5m`}),I(M,{id:`${g}-write5m`,min:0,step:.01,placeholder:`1.25x input`,value:e.costCacheWrite5m,onChange:e=>S(`costCacheWrite5m`,e.target.value)})]}),L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-write1h`,children:`Cache write 1h`}),I(M,{id:`${g}-write1h`,min:0,step:.01,placeholder:`2x input`,value:e.costCacheWrite1h,onChange:e=>S(`costCacheWrite1h`,e.target.value)})]})]})]}),L(l,{$gap:1,children:[L(h,{$gap:2,children:[I(p,{children:`Token limits`}),I(f,{}),w===null?I(p,{as:`span`,children:`not in the catalog — state them yourself`}):I(p,{as:`span`,children:`left empty, the published figures are used — and for an OpenAI target, the narrower ones its OAuth backend allows`})]}),L(Ne,{children:[L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-context`,children:`Context window`}),I(M,{id:`${g}-context`,min:1,step:1024,placeholder:w?.contextWindow??`published`,value:e.contextWindow,onChange:e=>S(`contextWindow`,e.target.value)})]}),L(Z,{children:[I(p,{as:`label`,htmlFor:`${g}-maxout`,children:`Max output`}),I(M,{id:`${g}-maxout`,min:1,step:1024,placeholder:w?.maxOutputTokens??`published`,value:e.maxOutputTokens,onChange:e=>S(`maxOutputTokens`,e.target.value)})]})]})]}),L(l,{$gap:1,children:[I(p,{children:`Capabilities`}),L(Pe,{children:[L(Q,{children:[I(O,{checked:e.tools,label:`Target ${t+1} supports tools`,onCheckedChange:e=>S(`tools`,e)}),`Tools`]}),L(Q,{children:[I(O,{checked:e.images,label:`Target ${t+1} supports images`,onCheckedChange:e=>S(`images`,e)}),`Images`]}),L(Q,{children:[I(O,{checked:e.reasoning,label:`Target ${t+1} supports reasoning`,onCheckedChange:e=>S(`reasoning`,e)}),`Reasoning`]})]})]})]})}var Le=R.p`
92
- font-size: 11.5px;
93
- color: ${({theme:e})=>e.color.inkDim};
94
- `,Re=R.p`
95
- font-size: 12px;
96
- color: ${({theme:e})=>e.color.down};
97
- `,ze=R.p`
98
- font-size: 12px;
99
- color: ${({theme:e})=>e.color.ok};
100
- `,Be=R(h)`
101
- gap: 8px;
102
- `;function Ve({model:e,onSaved:t,onDeleted:r}){let i=n().data??[],[a,d]=P(()=>e===null?X(i):ke(e)),[m,g]=P(null),[v,b]=P(!1),[x,S]=P(!1),w=c(),T=s(),D=o(),ee=xe(D.data??[]),k=(D.data??[]).filter(e=>e.provider===`custom`).map(e=>({id:String(e.providerData.endpointId??``),label:String(e.providerData.endpointLabel??e.providerData.endpointId??``)})).filter((e,t,n)=>e.id.length>0&&n.findIndex(t=>t.id===e.id)===t),M=e?.id??null;ne(()=>{d(e===null?X(i):ke(e)),g(null),b(!1)},[M]);let N=W.find(e=>e.id===a.strategy);return L(F,{children:[I(y,{legend:e===null?`New model`:`Edit model`,meta:e===null?void 0:e.id,actions:L(F,{children:[e===null?null:I(u,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>S(!0),children:`Delete`}),I(u,{type:`button`,$variant:`primary`,$size:`sm`,disabled:w.isPending,onClick:()=>{b(!1);let e=Ae(a);if(!e.ok){g(e.problem);return}g(null),w.mutate(e.model,{onSuccess:()=>{b(!0),t(e.model.id)},onError:e=>g(_(e))})},children:w.isPending?`Saving…`:e===null?`Create model`:`Save changes`})]}),children:L(l,{$gap:3,children:[I(te,{label:`Model name`,hint:e===null?`What clients send as the model. Anything not listed here is rejected.`:`Fixed once created. To rename, create a model under the new name and delete this one.`,children:t=>I(j,{...t,value:a.id,disabled:e!==null,placeholder:`fast`,onChange:e=>d({...a,id:e.target.value})})}),I(te,{label:`Routing strategy`,children:e=>I(A,{...e,value:a.strategy,onChange:e=>d({...a,strategy:e.target.value}),children:W.map(e=>I(`option`,{value:e.id,children:e.label},e.id))})}),N===void 0?null:I(Le,{children:N.blurb}),L(Be,{children:[I(O,{checked:a.isAlias,label:`This model is an alias for a provider model name`,onCheckedChange:e=>d({...a,isAlias:e})}),L(l,{$gap:0,children:[I(p,{as:`span`,children:`Alias`}),I(Le,{children:`Mark this when the name mirrors a provider's own model name.`})]})]}),L(l,{$gap:2,children:[L(h,{children:[I(p,{children:`Targets`}),I(f,{}),L(u,{type:`button`,$size:`sm`,onClick:()=>d({...a,targets:[...a.targets,Oe(i,a.targets.at(-1)?.provider)]}),children:[I(E,{}),`Add target`]})]}),a.targets.map((e,t)=>I(Ie,{target:e,index:t,removable:a.targets.length>1,catalog:i,endpoints:k,held:ee,credentials:D.data??[],onChange:t=>d({...a,targets:a.targets.map(n=>n.key===e.key?t:n)}),onRemove:()=>d({...a,targets:a.targets.filter(t=>t.key!==e.key)})},e.key))]}),m===null?null:I(Re,{role:`alert`,children:m}),v&&m===null?I(ze,{role:`status`,children:`Saved.`}):null]})}),I(C,{open:x,onOpenChange:S,title:`Delete model`,body:e===null?``:`Deleting "${e.id}" makes it unroutable. Clients asking for it will get a model-unavailable error, and any key allowlisting it keeps a name that no longer resolves.`,confirmLabel:`Delete model`,busy:T.isPending,onConfirm:()=>{e!==null&&T.mutate(e.id,{onSuccess:()=>{S(!1),r()},onError:e=>{S(!1),g(_(e))}})}})]})}var He=R.div`
103
- display: grid;
104
- grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
105
- gap: ${({theme:e})=>e.space(4)};
106
- align-items: start;
107
-
108
- @media (max-width: 980px) {
109
- grid-template-columns: minmax(0, 1fr);
110
- }
111
- `,Ue=R(l)`
112
- gap: ${({theme:e})=>e.space(4)};
113
- min-width: 0;
114
- `,We=R.button`
115
- display: flex;
116
- flex-direction: column;
117
- gap: 4px;
118
- width: 100%;
119
- padding: ${({theme:e})=>`${e.space(2)} ${e.space(3)}`};
120
- text-align: left;
121
- background: ${({theme:e,$selected:t})=>t?e.color.accentWash:`transparent`};
122
- border: 0;
123
- border-left: 2px solid
124
- ${({theme:e,$selected:t})=>t?e.color.accent:`transparent`};
125
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
126
- cursor: pointer;
127
-
128
- &:hover {
129
- background: ${({theme:e,$selected:t})=>t?e.color.accentWash:e.color.panelSunk};
130
- }
131
-
132
- &:last-child {
133
- border-bottom: 0;
134
- }
135
- `,Ge=R(x)`
136
- font-family: ${({theme:e})=>e.font.mono};
137
- font-size: 12.5px;
138
- display: block;
139
- max-width: 100%;
140
- `,Ke=R.div`
141
- display: flex;
142
- gap: 2px;
143
- `,qe=R.span`
144
- width: 12px;
145
- height: 3px;
146
- border-radius: 1px;
147
- background: ${({$provider:e})=>T(e)};
148
- `,$=`\0new`;function Je(){let e=a(),[t,n]=P(null),r=e.data??[],i=t===$?null:r.find(e=>e.id===t)??null,o=t===$||t===null&&!e.isLoading&&r.length===0;ne(()=>{t===null&&r.length!==0&&n(r[0]?.id??null)},[r,t]);let s=e.isLoading?`Reading configured models…`:r.length===0?`No virtual models exist yet, so no client request can resolve to an upstream.`:`${r.length} model${r.length===1?``:`s`} routing to ${r.reduce((e,t)=>e+t.targets.length,0)} targets.`;return L(F,{children:[I(w,{legend:`Models`,title:`Virtual models`,summary:s,actions:L(u,{type:`button`,$variant:`primary`,onClick:()=>n($),children:[I(E,{}),`New model`]})}),L(He,{children:[I(y,{legend:`Configured`,meta:`${r.length}`,flush:!0,children:e.isError?I(g,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?I(`div`,{style:{padding:12},children:I(m,{rows:4})}):r.length===0?I(v,{legend:`No models`,message:`Create a model to give clients something to ask for.`,action:I(u,{type:`button`,$size:`sm`,$variant:`primary`,onClick:()=>n($),children:`New model`})}):I(`div`,{children:r.map(e=>{let r=[...new Set(e.targets.map(e=>e.provider))];return L(We,{type:`button`,$selected:e.id===t,"aria-pressed":e.id===t,onClick:()=>n(e.id),children:[L(h,{$gap:2,style:{width:`100%`},children:[I(Ge,{title:e.id,children:e.id}),I(f,{}),e.isAlias?I(k,{children:`alias`}):null]}),L(h,{$gap:2,style:{width:`100%`},children:[I(Ke,{children:r.map(e=>I(qe,{$provider:e,title:e},e))}),I(p,{children:e.strategy}),I(f,{}),L(b,{$dim:!0,$size:`11px`,children:[e.targets.length,` target`,e.targets.length===1?``:`s`]})]})]},e.id)})})}),L(Ue,{children:[i===null&&!o?I(y,{legend:`Editor`,children:e.isLoading?I(m,{rows:5}):I(v,{legend:`Nothing selected`,message:`Pick a model on the left to change its targets, or create a new one.`})}):I(Ve,{model:i,onSaved:t=>{n(t),e.refetch()},onDeleted:()=>{n(null),e.refetch()}}),I(ve,{modelId:i?.id??null})]})]})]})}var Ye=Je;export{Ye as component};
@@ -1,20 +0,0 @@
1
- import{jt as e}from"./Lamp-DkvXKB-B.js";import{t}from"./preload-helper-BPaHpbO_.js";import{C as n,a as r,c as i,d as a,f as o,i as s,l as c,r as l,t as u}from"./Panel-CWmOTDAP.js";import{t as d}from"./Rack-CEuCdVXc.js";import{t as f}from"./index-Bk9sabex.js";import{Component as p,Suspense as m,createContext as h,lazy as g,useContext as _,useMemo as v}from"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";import S from"styled-components";import{pluginApiPath as C}from"@omnigateway/dashboard-sdk";var w=new Map;function T(e){let t=w.get(e);if(t!==void 0)return t;let n={get:(t,n)=>c(C(e,t),n),post:(t,n)=>a(C(e,t),n),put:(t,n)=>o(C(e,t),n),del:t=>i(C(e,t))};return w.set(e,n),n}var E=h(e=>t(()=>import(e),[]));E.Provider;function D(){return _(E)}function O(e,t){let n=e?.default;if(n==null)throw Error(`plugin ${t} has no default export from definePluginUI`);if(typeof n.mount!=`function`)throw Error(`plugin ${t} exported a default without a mount function`);return n}function k(e,t,n){return g(async()=>{let r=O(await n(t),e);return{default:()=>r.mount({pluginId:e,api:T(e)})}})}var A=S.p`
2
- font-size: 13px;
3
- color: ${({theme:e})=>e.color.down};
4
- `,j=S.p`
5
- font-family: ${({theme:e})=>e.font.mono};
6
- font-size: 12px;
7
- color: ${({theme:e})=>e.color.inkDim};
8
- overflow-wrap: anywhere;
9
- `,M=S.p`
10
- font-size: 12px;
11
- color: ${({theme:e})=>e.color.inkDim};
12
- max-width: 68ch;
13
- `;function N(e){return e instanceof Error?e.message:typeof e==`string`?e:`The plugin threw a value that is not an error.`}var P=class extends p{state={message:null};static getDerivedStateFromError(e){return{message:N(e)}}componentDidUpdate(e){e.pluginId!==this.props.pluginId&&this.state.message!==null&&this.setState({message:null})}componentDidCatch(e,t){}render(){let{message:e}=this.state;return e===null?this.props.children:b(u,{legend:`Plugin failed`,meta:this.props.pluginId,children:x(n,{$gap:2,children:[x(A,{children:[this.props.pluginName,` stopped rendering.`]}),b(j,{children:e}),b(M,{children:`The rest of the console is unaffected. Reload the page to try this screen again, and report the message above to whoever maintains the plugin.`})]})})}},F=S.p`
14
- font-size: 13px;
15
- color: ${({theme:e})=>e.color.warn};
16
- `,I=S.p`
17
- font-size: 12px;
18
- color: ${({theme:e})=>e.color.inkDim};
19
- max-width: 68ch;
20
- `;function L({pluginId:t}){let i=e(),a=D(),o=i.data?.find(e=>e.id===t),c=o?.ui??null,f=c?.compatible===!0?c.entry:null,p=v(()=>f===null?null:k(t,f,a),[t,f,a]);if(i.isError)return x(y,{children:[b(d,{legend:`Plugin`,title:`Plugins`,summary:`The installed plugins are unknown.`}),b(s,{legend:`Plugins unavailable`,error:i.error})]});if(o===void 0)return x(y,{children:[b(d,{legend:`Plugin`,title:i.isPending?`Loading…`:t,summary:i.isPending?`Reading the installed plugins.`:`This gateway does not run a plugin with that id.`}),i.isPending?b(r,{}):b(l,{legend:`Not installed`,message:`No plugin with the id ${t} is installed. Install it and restart the gateway.`})]});let h=b(d,{legend:`Plugin`,title:o.nav?.label??o.name,summary:`${o.name} ${o.version}, installed as ${o.id}.`});return c===null?x(y,{children:[h,b(l,{legend:`No interface`,message:`${o.name} runs entirely in the gateway and has no console screen.`})]}):p===null?x(y,{children:[h,b(u,{legend:`Interface unavailable`,meta:o.id,children:x(n,{$gap:2,children:[b(F,{children:c.reason??`This plugin's interface does not match this gateway.`}),b(I,{children:`The plugin's server half is unaffected and keeps running. Update the plugin, or the gateway, so the two agree on a dashboard SDK version.`})]})})]}):x(y,{children:[h,b(P,{pluginId:o.id,pluginName:o.name,children:b(m,{fallback:b(r,{}),children:b(p,{})})})]})}function R(){let{pluginId:e}=f.useParams();return b(L,{pluginId:e})}export{R as component};
@@ -1,76 +0,0 @@
1
- import{$ as e,A as t,At as n,B as r,C as i,Ct as a,D as o,Dt as s,E as c,Et as l,F as u,G as d,H as f,I as p,J as m,K as h,L as g,M as _,Mt as v,N as y,O as b,Ot as x,P as S,Q as C,R as w,S as T,St as E,T as D,Tt as O,U as k,V as ee,W as A,X as te,Y as ne,Z as re,_ as ie,_t as ae,a as j,at as oe,b as M,bt as N,c as se,ct as ce,d as P,dt as le,et as ue,f as de,ft as fe,g as pe,gt as me,h as he,ht as ge,i as _e,it as ve,j as ye,jt as be,k as xe,kt as Se,l as Ce,lt as we,m as Te,mt as Ee,n as De,nt as Oe,o as ke,ot as Ae,p as je,pt as Me,q as Ne,r as Pe,rt as Fe,s as Ie,st as Le,t as Re,tt as ze,u as F,ut as Be,v as Ve,vt as He,w as Ue,wt as We,x as I,xt as Ge,y as Ke,yt as qe,z as Je}from"./shared-Dtkw6SE0.js";import{$t as L,Ct as Ye,F as Xe,L as R,Mt as Ze,P as Qe,U as $e,gt as et,j as z,kt as tt,mt as nt}from"./Lamp-DkvXKB-B.js";import{C as B,_ as rt,b as V,g as it,t as at,v as H,w as ot,x as st}from"./Panel-CWmOTDAP.js";import{D as ct,S as lt,t as ut,w as dt}from"./Rack-CEuCdVXc.js";import{i as ft,n as U,r as W,t as pt}from"./Table-CVDZ69Zx.js";import{i as G,n as mt,r as ht,t as gt}from"./SummaryDeck-7ivuca39.js";import*as K from"react";import{PureComponent as _t,forwardRef as vt,useMemo as q,useRef as yt,useState as bt}from"react";import{jsx as J,jsxs as Y}from"react/jsx-runtime";import X from"styled-components";function xt(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.xAxisId??0}function St(e,t){return e.graphicalItems.cartesianItems.find(e=>e.id===t)?.yAxisId??0}var Ct=(e,t,n)=>C(e,`xAxis`,xt(e,t),n),wt=(e,t,n)=>ue(e,`xAxis`,xt(e,t),n),Tt=(e,t,n)=>C(e,`yAxis`,St(e,t),n),Et=(e,t,n)=>ue(e,`yAxis`,St(e,t),n),Dt=N([ce,Ct,Tt,wt,Et],(e,t,n,r,i)=>He(e,`xAxis`)?Me(t,r,!1):Me(n,i,!1)),Ot=N([ze,(e,t)=>t],(e,t)=>e.filter(e=>e.type===`area`).find(e=>e.id===t)),kt=e=>{var t=ce(e);return He(t,`xAxis`)?`yAxis`:`xAxis`},At=(e,t)=>kt(e)===`yAxis`?St(e,t):xt(e,t),jt=(t,n,r)=>e(t,kt(t),At(t,n),r),Mt=N([Ot,jt],(e,t)=>{if(e!=null&&t!=null){var n=e.stackId,r=Oe(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]])}}}),Nt=N([Ot,jt],(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(O)}}),Pt=N([ce,Ct,Tt,wt,Et,Mt,oe,Dt,Ot,ve,Nt],(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 pn({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:i,dataStartIndex:f,areaSettings:c,stackedData:a,displayedData:h,chartBaseValue:l,bandSize:s,stackDataKeys:u})}}),Ft=[`animationElapsedTime`,`isAnimating`,`isEntrance`,`layout`,`isRange`,`stroke`,`connectNulls`],It=[`id`,`baseLine`];function Lt(){return Lt=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},Lt.apply(null,arguments)}function Rt(e,t){if(e==null)return{};var n,r,i=zt(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 zt(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 Bt(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(!qe(a)||!qe(o))return null;var c=t*Math.abs(a-o),l=Math.max(...r.map(e=>e.y||0));return s(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.y||0),l)),s(l)?K.createElement(`rect`,{x:a<o?a:a-c,y:0,width:c,height:Math.floor(l+(i?parseInt(`${i}`,10):1))}):null}function Vt(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(!qe(a)||!qe(o))return null;var c=t*Math.abs(a-o),l=Math.max(...r.map(e=>e.x||0));return s(n)?l=Math.max(n,l):n&&Array.isArray(n)&&n.length&&(l=Math.max(...n.map(e=>e.x||0),l)),s(l)?K.createElement(`rect`,{x:0,y:a<o?a:a-c,width:l+(i?parseInt(`${i}`,10):1),height:Math.floor(c)}):null}function Ht(e){var t=e.alpha,n=e.layout,r=e.points,i=e.baseLine,a=e.strokeWidth;return n===`vertical`?K.createElement(Vt,{alpha:t,points:r,baseLine:i,strokeWidth:a}):K.createElement(Bt,{alpha:t,points:r,baseLine:i,strokeWidth:a})}function Ut(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=Rt(e,Ft),f=s===`vertical`?`vertical`:`horizontal`,m=u??!1,h=p(),g=d.id,_=d.baseLine,v=Rt(d,It),y=be(v),b=K.createElement(Ae,Lt({},d,{id:g,baseLine:_,connectNulls:m,stroke:`none`,className:`recharts-area-area`,layout:f})),x=l!==`none`&&K.createElement(Ae,Lt({},y,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:m,fill:`none`,stroke:l,points:d.points})),S=l!==`none`&&c&&Array.isArray(_)&&K.createElement(Ae,Lt({},y,{className:`recharts-area-curve`,layout:f,type:d.type,connectNulls:m,fill:`none`,stroke:l,points:_}));return o&&(i||n<1)?K.createElement(Se,null,K.createElement(`defs`,null,K.createElement(`clipPath`,{id:h},K.createElement(Ht,{alpha:n,points:d.points??[],baseLine:_,layout:f,strokeWidth:d.strokeWidth}))),K.createElement(Se,{clipPath:`url(#${h})`},b,x,S)):K.createElement(K.Fragment,null,b,x,S)}var Wt=[`id`],Gt=[`activeDot`,`animationBegin`,`animationDuration`,`animationEasing`,`connectNulls`,`dot`,`fill`,`fillOpacity`,`hide`,`isAnimationActive`,`legendType`,`stroke`,`xAxisId`,`yAxisId`];function Kt(){return Kt=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},Kt.apply(null,arguments)}function qt(e,t){if(e==null)return{};var n,r,i=Jt(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 Jt(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 Yt(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 Z(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?Yt(Object(n),!0).forEach(function(t){Xt(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xt(e,t,n){return(t=Zt(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zt(e){var t=Qt(e,`string`);return typeof t==`symbol`?t:t+``}function Qt(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 $t={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:`ease`,animationMatchBy:ee,animationInterpolateFn:(e,t)=>e==null?[]:t===1?e.flatMap(e=>e.status===`removed`?[]:[e.next]):e.flatMap(e=>e.status===`matched`?[Z(Z({},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:Ut,xAxisId:0,yAxisId:0,zIndex:Fe.area};function en(e,t){return e&&e!==`none`?e:t}var tn=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:en(r,i),value:me(n,t),payload:e}]},nn=K.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:x,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:me(o,t),hide:s,type:u,color:en(r,a),unit:c,formatter:l,graphicalItemId:d}};return K.createElement(k,{tooltipEntrySettings:f})});function rn(e){var t=e.clipPathId,n=e.points,r=e.props,i=r.needClip,a=r.dot,o=r.dataKey,s=be(r);return K.createElement(y,{points:n,dot:a,className:`recharts-area-dots`,dotClassName:`recharts-area-dot`,dataKey:o,baseProps:s,needClip:i,clipPathId:t})}function an(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 Z(Z({},t),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:t,fill:void 0})});return K.createElement(h,{value:t?r:void 0},n)}function on(e){var t=e.points,r=e.baseLine,i=e.needClip,a=e.clipPathId,o=e.props,s=e.animationElapsedTime,c=e.isAnimating,l=e.isEntrance,u=o.layout,d=o.type,f=o.stroke,p=o.connectNulls,m=o.isRange,h=o.shape,g=o.id,_=qt(o,Wt),v=Z(Z({},n(_)),{},{id:g,points:t,connectNulls:p,type:d,baseLine:r,layout:u,stroke:f,isRange:m,animationElapsedTime:s,isAnimating:c,isEntrance:l});return K.createElement(K.Fragment,null,t?.length>1&&K.createElement(Se,{clipPath:i?`url(#clipPath-${a})`:void 0},K.createElement(A,{option:h,DefaultShape:$t.shape,shapeProps:v})),K.createElement(rn,{points:t,props:_,clipPathId:a}))}function sn(e,t,n){if(s(e)){var r=s(t)?t:void 0;return a(r,e,n)}if(l(e)||We(e)){var i=s(t)?t:void 0;return a(i,0,n)}return e}function cn(e){var t=e.needClip,n=e.clipPathId,i=e.props,a=e.previousPointsRef,o=e.previousBaselineRef,s=i.points,c=i.baseLine,l=i.isAnimationActive,u=i.animationBegin,d=i.animationDuration,f=i.animationEasing,p=i.animationMatchBy,m=i.animationInterpolateFn,h=q(()=>({points:s,baseLine:c}),[s,c]),_=Je(h,o),v=we(),y=w(i.onAnimationStart,i.onAnimationEnd),b=y.isAnimating,x=y.handleAnimationStart,S=y.handleAnimationEnd,C=_.startValue;if(v==null)return null;var T=Array.isArray(c)&&Array.isArray(C)?r(C,c,p):Array.isArray(c)?r(null,c,p):null;return K.createElement(g,{animationInput:h,animationIdPrefix:`recharts-area-`,items:s,previousItemsRef:a,isAnimationActive:l,animationBegin:u,animationDuration:d,animationEasing:f,onAnimationStart:x,onAnimationEnd:S,animationInterpolateFn:m,animationMatchBy:p,layout:v},(e,r,a)=>{var o=r===1?c:Array.isArray(c)?m(T,r,v):a?c:sn(c,C,r);return _.syncStepValue(o,r),K.createElement(an,{showLabels:!b,points:s},i.children,K.createElement(on,{points:e,baseLine:o,needClip:t,clipPathId:n,props:i,animationElapsedTime:r,isAnimating:b||r<1,isEntrance:a}),K.createElement(Ne,{label:i.label}))})}function ln(e){var t=e.needClip,n=e.clipPathId,r=e.props,i=yt(null),a=yt();return K.createElement(cn,{needClip:t,clipPathId:n,props:r,previousPointsRef:i,previousBaselineRef:a})}var un=class extends _t{render(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.top,s=e.left,c=e.needClip,l=e.xAxisId,u=e.yAxisId,f=e.width,p=e.height,m=e.id,h=e.baseLine,g=e.zIndex;if(t)return null;var _=v(`recharts-area`,i),y=m,x=o(n),S=x.r,C=x.strokeWidth,w=d(n),T=S*2+C,E=c?`url(#clipPath-${w?``:`dots-`}${y})`:void 0;return K.createElement(te,{zIndex:g},K.createElement(Se,{className:_},c&&K.createElement(`defs`,null,K.createElement(b,{clipPathId:y,xAxisId:l,yAxisId:u}),!w&&K.createElement(`clipPath`,{id:`clipPath-dots-${y}`},K.createElement(`rect`,{x:s-T/2,y:a-T/2,width:f+T,height:p+T}))),K.createElement(ln,{needClip:c,clipPathId:y,props:this.props})),K.createElement(ye,{points:r,mainColor:en(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:E}),this.props.isRange&&Array.isArray(h)&&K.createElement(ye,{points:h,mainColor:en(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:E}))}};function dn(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=qt(e,Gt),g=Be(),v=re(),y=xe(p,m).needClip,b=fe(),x=Ge(t=>Pt(t,e.id,b))??{},S=x.points,C=x.isRange,w=x.baseLine,T=_();if(g!==`horizontal`&&g!==`vertical`||T==null||v!==`AreaChart`&&v!==`ComposedChart`)return null;var E=T.height,D=T.width,O=T.x,k=T.y;return!S||!S.length?null:K.createElement(un,Kt({},h,{activeDot:t,animationBegin:n,animationDuration:r,animationEasing:i,baseLine:w,connectNulls:a,dot:o,fill:s,fillOpacity:c,height:E,hide:l,layout:g,isAnimationActive:u,isRange:C,legendType:d,needClip:y,points:S,stroke:f,width:D,left:O,top:k,xAxisId:p,yAxisId:m}))}var fn=(e,t,n,r,i)=>{var a=n??t;if(s(a))return a;var o=e===`horizontal`?i:r,c=o.scale.domain();if(o.type===`number`){var l=Math.max(c[0],c[1]),u=Math.min(c[0],c[1]);return a===`dataMin`?u:a===`dataMax`||l<0?l:Math.max(Math.min(c[0],c[1]),0)}return a===`dataMin`?c[0]:a===`dataMax`?c[1]:c[0]};function pn(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,_=fn(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=ae(e,i);Array.isArray(o)?(r=o,y=!0):r=[_,o]}var s=r?.[1]??null,u=ae(e,i),b=g&&u==null&&h!=null&&h.length>0&&h.every(t=>ae(e,t)==null),x=s==null||g&&!n&&u==null||b;return v?{x:Ee({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:Ee({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 mn(e){var t=E(e,$t),n=fe();return K.createElement(u,{id:t.id,type:`area`},e=>K.createElement(K.Fragment,null,K.createElement(f,{legendPayload:tn(t)}),K.createElement(nn,{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}),K.createElement(S,{type:`area`,id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:ge(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),K.createElement(dn,Kt({},t,{id:e}))))}var hn=K.memo(mn,Le);hn.displayName=`Area`;var gn=[`axis`],_n=vt((e,t)=>K.createElement(i,{chartName:`AreaChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:gn,tooltipPayloadSearcher:ne,categoricalChartProps:e,ref:t})),vn=[`axis`],yn=vt((e,t)=>K.createElement(i,{chartName:`ComposedChart`,defaultTooltipEventType:`axis`,validateTooltipEventTypes:vn,tooltipPayloadSearcher:ne,categoricalChartProps:e,ref:t})),bn=53,Q=9,$=2,xn=X.div`
2
- display: flex;
3
- gap: ${$}px;
4
- `,Sn=X.div`
5
- display: grid;
6
- grid-template-rows: repeat(7, ${Q}px);
7
- gap: ${$}px;
8
- padding-top: ${11}px;
9
- font-size: 9px;
10
- color: ${({theme:e})=>e.color.inkFaint};
11
- `,Cn=X.div`
12
- line-height: ${Q}px;
13
- padding-right: 2px;
14
- text-align: right;
15
- `,wn=X.div`
16
- display: grid;
17
- grid-template-columns: repeat(${bn}, ${Q}px);
18
- gap: ${$}px;
19
- height: ${Q}px;
20
- font-size: 9px;
21
- color: ${({theme:e})=>e.color.inkFaint};
22
- `,Tn=X.div`
23
- white-space: nowrap;
24
- line-height: ${Q}px;
25
- `,En=X.div`
26
- display: grid;
27
- grid-template-columns: repeat(${bn}, ${Q}px);
28
- gap: ${$}px;
29
- `,Dn=X.div`
30
- display: grid;
31
- grid-template-rows: repeat(7, ${Q}px);
32
- gap: ${$}px;
33
- `,On=X.div`
34
- width: ${Q}px;
35
- height: ${Q}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
- `,kn=X(V)`
47
- gap: ${$}px;
48
- `,An=X(H)`
49
- color: ${({theme:e})=>e.color.inkDim};
50
- font-size: 11px;
51
- `;function jn(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 Mn(e,[t,n,r]){return e<=0?0:e<=t?1:e<=n?2:e<=r?3:4}function Nn({days:e,now:t,dayOffsetMinutes:n=null}){let[r,i]=bt(`tokens`),[a,o]=bt(null),s=pe(r),c=q(()=>{let r=new Map;for(let t of e){let e=Number(t.key);Number.isFinite(e)&&r.set(Ke(e,n),{requests:t.requests,errors:t.errors,costUsd:t.costUsd,inputTokens:t.inputTokens,outputTokens:t.outputTokens,cacheReadTokens:t.cacheReadTokens,cacheWriteTokens:t.cacheWriteTokens,rtkSavedTokens:t.rtkSavedTokens,rtkAppliedRequests:t.rtkAppliedRequests,durationMsSum:t.durationMsSum})}let i=Ke(t,n),a=se(i,6-Te(i,n)-370,n);return Array.from({length:bn},()=>Array.from({length:7},()=>{let e=a;return a=se(a,1,n),{at:e,totals:r.get(e)??Ie,future:e>i}}))},[e,t,n]),l=c.flat(),u=jn(l.map(e=>s.of({key:``,...e.totals}))),d=l.reduce((e,t)=>Ce(e,P(t.totals)),Ie),f=l.reduce((e,t)=>e+ +(t.totals.requests>0),0),p=(e,t)=>`${e}: ${z(t.requests)} requests, ${z(F(t))} tokens, ${R(t.costUsd)}`;return J(at,{legend:`Activity`,meta:a===null?`${z(f)} active days`:void 0,actions:J(mt,{children:Pe.map(e=>J(ht,{type:`button`,$size:`sm`,$on:e.id===r,"aria-pressed":e.id===r,onClick:()=>i(e.id),children:e.label},e.id))}),children:Y(B,{$gap:2,children:[J(st,{children:J(B,{$gap:1,style:{width:611},children:Y(xn,{children:[J(Sn,{"aria-hidden":`true`,children:[``,`Mon`,``,`Wed`,``,`Fri`,``].map((e,t)=>J(Cn,{children:e},t))}),Y(B,{$gap:1,children:[J(wn,{"aria-hidden":`true`,children:c.map((e,t)=>{let n=e[0],r=c[t-1]?.[0],i=n!==void 0&&(r===void 0||new Date(r.at).getMonth()!==new Date(n.at).getMonth());return J(Tn,{children:i&&n!==void 0?new Date(n.at).toLocaleDateString(`en-GB`,{month:`short`}):``},n?.at??t)})}),J(En,{role:`grid`,"aria-label":`${s.label} per day over the last year`,children:c.map(e=>J(Dn,{role:`row`,children:e.map(e=>J(On,{role:`gridcell`,tabIndex:-1,"aria-label":p(je(e.at),e.totals),title:p(je(e.at),e.totals),$future:e.future,$level:e.future?0:Mn(s.of({key:``,...e.totals}),u),onMouseEnter:()=>o(e),onMouseLeave:()=>o(null)},e.at))},e[0]?.at))})]})]})})}),Y(V,{$justify:`space-between`,$wrap:!0,children:[J(An,{children:a===null?p(`Last 12 months`,d):p(je(a.at),a.totals)}),Y(V,{$gap:1,children:[J(rt,{children:`Less`}),J(kn,{"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>J(On,{$level:e,$future:!1},e))}),J(rt,{children:`More`})]})]})]})})}function Pn({buckets:e,by:t,since:n,until:r,metric:i,names:a,dayOffsetMinutes:o}){let s=I(n,r,t,o),c=new Map,l=new Map;for(let n of e){let e=n.split??`unknown`;c.set(e,Ce(c.get(e)??Ie,n));let r=l.get(e)??new Map,a=he(n.key,t);r.set(a,(r.get(a)??0)+i.of(n)),l.set(e,r)}let u=[...c.entries()].sort((e,t)=>i.of(P(t[1]))-i.of(P(e[1])));return J(st,{children:Y(pt,{children:[J(`thead`,{children:Y(`tr`,{children:[J(W,{children:`Key`}),J(W,{children:`Trend`}),J(W,{$align:`right`,children:`Requests`}),J(W,{$align:`right`,children:`Failed`}),J(W,{$align:`right`,children:`Tokens`}),J(W,{$align:`right`,children:`Mean`}),J(W,{$align:`right`,children:`Cost`})]})}),J(`tbody`,{children:u.map(([e,t])=>{let n=l.get(e)??new Map,r=e===`unknown`?`Unattributed`:a.get(e)??e;return Y(ft,{children:[J(U,{children:J(ot,{style:{display:`block`,maxWidth:`28ch`},children:r})}),J(U,{style:{width:120},children:J(lt,{values:s.map(e=>n.get(e)??0),height:20,label:`${r}: ${i.format(i.of(P(t)))} over the window`})}),J(U,{$align:`right`,$mono:!0,children:z(t.requests)}),J(U,{$align:`right`,$mono:!0,style:t.errors>0?{color:`var(--down)`}:void 0,children:Xe(t.requests===0?0:t.errors/t.requests,0)}),J(U,{$align:`right`,$mono:!0,children:z(F(t))}),J(U,{$align:`right`,$mono:!0,children:Qe(t.requests===0?null:t.durationMsSum/t.requests)}),J(U,{$align:`right`,$mono:!0,children:R(t.costUsd)})]},e)})})]})})}var Fn=6,In=`__other__`,Ln=`unknown`;function Rn(e,t,n){let r=n.get(t);return r===void 0?e.find(e=>e.models.some(e=>e.id===t))?.id??null:r}function zn(e,t){return e===null?`var(--ink-faint)`:`color-mix(in oklch, ${dt(e)} ${Math.max(30,100-t*22)}%, var(--panel))`}function Bn({buckets:e,by:n,since:r,until:i,dayOffsetMinutes:a,metric:o,providers:s}){let c=Ze().data??[],l=[...de(e,o).entries()],u=l.slice(0,Fn),d=l.slice(Fn),f=[...new Set(u.map(([e])=>Rn(c,e,s)))].filter(e=>e!==null&&$e(c,e)===void 0).sort(),p=[];for(let e of[...c.map(e=>e.id),...f,null])u.filter(([t])=>Rn(c,t,s)===e).forEach(([t,n],r)=>{p.push({name:t,label:t===Ln?`Unresolved`:t,color:zn(e,r),totals:n})});d.length>0&&p.push({name:In,label:`${d.length} more`,color:`var(--ink-faint)`,totals:d.reduce((e,[,t])=>Ce(e,P(t)),Ie)});let h=new Set(u.map(([e])=>e)),g=new Map;for(let t of e){let e=t.split??Ln,r=`${he(t.key,n)} ${h.has(e)?e:In}`;g.set(r,(g.get(r)??0)+o.of(t))}let _=I(r,i,n,a).map(e=>{let t={at:e};for(let n of p)t[n.name]=g.get(`${e} ${n.name}`)??0;return t}),v=new Map(p.map(e=>[e.name,e.label]));return Y(B,{$gap:2,children:[J(Re,{$height:220,children:J(le,{width:`100%`,height:`100%`,children:Y(_n,{data:_,margin:{top:4,right:4,bottom:4,left:4},children:[J(t,{stroke:`var(--rule)`,vertical:!1}),J(D,{dataKey:`at`,tickFormatter:e=>M(e,n),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(Ue,{tickFormatter:e=>o.format(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),J(m,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t,label:r})=>{if(e!==!0||t===void 0||t.length===0)return null;let i=t.filter(e=>Number(e.value??0)>0);return Y(ke,{children:[J(`div`,{children:M(Number(r),n)}),i.length===0?J(`div`,{children:`No ${o.label.toLowerCase()}`}):i.map(e=>Y(`div`,{children:[v.get(String(e.dataKey))??String(e.dataKey),` `,o.format(Number(e.value??0))]},String(e.dataKey)))]})}}),p.map(e=>J(hn,{type:`monotone`,dataKey:e.name,stackId:`models`,stroke:e.color,strokeWidth:2,fill:e.color,fillOpacity:.22,isAnimationActive:!1},e.name))]})})}),J(De,{children:p.map(e=>Y(`span`,{children:[J(j,{$color:e.color}),` `,J(ot,{title:`${e.label}: ${o.format(o.of(P(e.totals)))} ${o.label.toLowerCase()}`,style:{display:`inline-block`,maxWidth:`24ch`,verticalAlign:`bottom`},children:e.label})]},e.name))})]})}var Vn=`unknown`;function Hn(e,t){return $e(e,t)===void 0?`var(--ink-faint)`:dt(t)}function Un(e,t){return t===Vn?`Unresolved`:$e(e,t)?.label??t}function Wn({buckets:e,by:n,since:r,until:i,metric:a,dayOffsetMinutes:o}){let s=Ze().data??[],c=de(e,a),l=[...c.keys()].filter(e=>e!==Vn&&$e(s,e)===void 0).sort(),u=[...s.map(e=>e.id),...l,Vn].map(e=>({name:e,totals:c.get(e)})).filter(e=>e.totals!==void 0),d=u.map(e=>e.name),f=I(r,i,n,o),p=Ve(e,f,n,a),h=[...c.values()].reduce((e,t)=>e+t.requests,0);return Y(B,{$gap:3,children:[J(Re,{$height:200,children:J(le,{width:`100%`,height:`100%`,children:Y(_n,{data:p,margin:{top:4,right:4,bottom:4,left:4},children:[J(t,{stroke:`var(--rule)`,vertical:!1}),J(D,{dataKey:`at`,tickFormatter:e=>M(e,n),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(Ue,{tickFormatter:e=>a.format(e),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:48}),J(m,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t,label:r})=>e!==!0||t===void 0||t.length===0?null:Y(ke,{children:[J(`div`,{children:M(Number(r),n)}),t.map(e=>Y(`div`,{children:[Un(s,String(e.dataKey)),` `,a.format(Number(e.value??0))]},String(e.dataKey)))]})}),d.map(e=>J(hn,{type:`monotone`,dataKey:e,stackId:`providers`,stroke:Hn(s,e),strokeWidth:2,fill:Hn(s,e),fillOpacity:.22,isAnimationActive:!1},e))]})})}),J(De,{children:d.map(e=>Y(`span`,{children:[J(j,{$color:Hn(s,e)}),` `,Un(s,e)]},e))}),Y(pt,{children:[J(`thead`,{children:Y(`tr`,{children:[J(W,{children:`Provider`}),J(W,{$align:`right`,children:`Share`}),J(W,{$align:`right`,children:`Requests`}),J(W,{$align:`right`,children:`Failed`}),J(W,{$align:`right`,children:`Tokens`}),J(W,{$align:`right`,children:`Cost`})]})}),J(`tbody`,{children:u.map(({name:e,totals:t})=>Y(ft,{children:[Y(U,{children:[J(j,{$color:Hn(s,e)}),` `,Un(s,e)]}),J(U,{$align:`right`,$mono:!0,children:Xe(h===0?0:t.requests/h,0)}),J(U,{$align:`right`,$mono:!0,children:z(t.requests)}),J(U,{$align:`right`,$mono:!0,style:t.errors>0?{color:`var(--down)`}:void 0,children:z(t.errors)}),J(U,{$align:`right`,$mono:!0,children:z(F(t))}),J(U,{$align:`right`,$mono:!0,children:R(t.costUsd)})]},e))})]})]})}var Gn=X.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
- `,Kn=X.ol`
57
- display: flex;
58
- flex-direction: column;
59
- gap: ${({theme:e})=>e.space(2)};
60
- `,qn=X.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
- `,Jn=X.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
- `,Yn=X(ot)`
73
- display: block;
74
- font-family: ${({theme:e})=>e.font.mono};
75
- font-size: 12px;
76
- `,Xn=12;function Zn({buckets:e,metric:t,names:n,unknownLabel:r}){let i=new Map;for(let t of e)i.set(t.key,Ce(i.get(t.key)??Ie,t));let a=e=>e===`unknown`?r??`Unattributed`:n?.get(e)??e,o=[...i.entries()].map(([e,n])=>({name:a(e),entry:n,value:t.of(P(n))})).sort((e,t)=>t.value-e.value),s=o.slice(0,Xn),c=o.slice(Xn),l=s[0]?.value??0;return Y(B,{$gap:3,children:[J(Kn,{children:s.map(({name:e,entry:n,value:r})=>Y(Gn,{children:[J(Yn,{title:e,children:e}),J(qn,{children:J(Jn,{$share:l===0?0:r/l,$fault:n.requests>0&&n.errors===n.requests})}),Y(V,{$gap:2,children:[J(H,{$size:`12px`,children:t.format(r)}),J(H,{$size:`11px`,$dim:!0,children:R(n.costUsd)})]})]},e))}),c.length===0?null:J(H,{$size:`11px`,$dim:!0,children:`+ ${c.length} more, ${z(c.reduce((e,t)=>e+t.entry.requests,0))} requests`})]})}var Qn=[{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 $n({buckets:e,by:n,since:r,until:i,dayOffsetMinutes:a}){let o=new Map;for(let t of e)o.set(he(t.key,n),t);let s=I(r,i,n,a).map(e=>{let t=o.get(e);return{at:e,inputTokens:t?.inputTokens??0,outputTokens:t?.outputTokens??0,cacheReadTokens:t?.cacheReadTokens??0,cacheWriteTokens:t?.cacheWriteTokens??0}}),c=Qn.map(e=>({...e,value:s.reduce((t,n)=>t+n[e.id],0)})),l=c.reduce((e,t)=>e+t.value,0);return Y(B,{$gap:3,children:[J(Re,{$height:200,children:J(le,{width:`100%`,height:`100%`,children:Y(_n,{data:s,margin:{top:4,right:4,bottom:4,left:4},children:[J(t,{stroke:`var(--rule)`,vertical:!1}),J(D,{dataKey:`at`,tickFormatter:e=>M(e,n),tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(Ue,{tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:44,tickFormatter:e=>z(e)}),J(m,{cursor:{stroke:`var(--rule-strong)`},content:({active:e,payload:t,label:r})=>e!==!0||t===void 0||t.length===0?null:Y(ke,{children:[J(`div`,{children:M(Number(r),n)}),Qn.map(e=>Y(`div`,{children:[e.label,` `,z(Number(t.find(t=>t.dataKey===e.id)?.value??0))]},e.id))]})}),Qn.map(e=>J(hn,{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))]})})}),J(De,{children:c.map(e=>Y(V,{$gap:1,children:[J(j,{$color:`var(--accent)`,style:{opacity:e.opacity}}),J(`span`,{children:e.label}),J(H,{$size:`11px`,children:z(e.value)}),J(H,{$size:`11px`,$dim:!0,children:Xe(l===0?0:e.value/l,0)})]},e.id))})]})}function er({buckets:e,by:n,since:r,until:i,dayOffsetMinutes:a}){let o=new Map;for(let t of e)o.set(he(t.key,n),t);let s=I(r,i,n,a).map(e=>{let t=o.get(e);return{at:e,label:M(e,n),requests:t?.requests??0,errors:t?.errors??0,costUsd:t?.costUsd??0,tokens:t===void 0?0:F(t)}});return Y(B,{$gap:2,children:[J(Re,{$height:220,children:J(le,{width:`100%`,height:`100%`,children:Y(yn,{data:s,margin:{top:4,right:4,bottom:4,left:4},children:[J(t,{stroke:`var(--rule)`,vertical:!1}),J(D,{dataKey:`label`,tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,interval:`preserveStartEnd`,minTickGap:28}),J(Ue,{tick:{fill:`var(--ink-faint)`,fontSize:10},stroke:`var(--rule-strong)`,width:40}),J(m,{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:Y(ke,{children:[J(`div`,{children:n.label}),Y(`div`,{children:[z(n.requests),` requests`]}),Y(`div`,{children:[z(n.errors),` failed`]}),Y(`div`,{children:[z(n.tokens),` tokens`]}),J(`div`,{children:R(n.costUsd)})]})}}),J(hn,{type:`monotone`,dataKey:`requests`,stroke:`none`,fill:`var(--accent)`,fillOpacity:.12,isAnimationActive:!1}),J(c,{type:`monotone`,dataKey:`requests`,stroke:`var(--accent)`,strokeWidth:2,dot:!1,activeDot:{r:4,stroke:`var(--panel)`,strokeWidth:2},isAnimationActive:!1}),J(c,{type:`monotone`,dataKey:`errors`,stroke:`var(--down)`,strokeWidth:2,dot:!1,activeDot:{r:4,stroke:`var(--panel)`,strokeWidth:2},isAnimationActive:!1})]})})}),Y(De,{children:[Y(`span`,{children:[J(j,{$color:`var(--accent)`}),` Requests`]}),Y(`span`,{children:[J(j,{$color:`var(--down)`}),` Failed`]})]})]})}var tr=864e5,nr=[{id:`requestedModel`,label:`As requested`,column:`Virtual model`},{id:`model`,label:`As served`,column:`Upstream model`}];function rr(){let{cadence:e}=ct(),[t,n]=bt(`24h`),[r,i]=bt(`tokens`),[a,o]=bt(`model`),s=ie(t),c=pe(r),l=et().data??null,u=q(()=>s.grain===`daily`?Ke(Date.now()-s.ms,l):Math.floor((Date.now()-s.ms)/6e4)*6e4,[s,l]),d=q(()=>u+s.ms,[u,s]),f=q(()=>Ke(Date.now()-371*tr,l),[l]),p={since:u,grain:s.grain},m=L({...p,groupBy:s.by},e(6e4,`res:usage`)),h=L({...p,groupBy:s.by,splitBy:`provider`},e(6e4,`res:usage`)),g=L({...p,groupBy:s.by,splitBy:`model`},e(6e4,`res:usage`)),_=L({...p,groupBy:s.by,splitBy:`apiKey`},e(6e4,`res:usage`)),v=L({...p,groupBy:a},e(6e4,`res:usage`)),y=L({...p,groupBy:`credential`},e(6e4,`res:usage`)),b=L({since:f,grain:`daily`,groupBy:`day`},e(3e5,`res:usage`)),x=Ye(),S=nt(),C=tt(),w=q(()=>{let e=new Map;for(let t of C.data??[])for(let n of t.targets)e.set(n.model,n.provider);return e},[C.data]),E=q(()=>{let e=new Map;for(let t of x.data??[])e.set(t.id,t.label);return e},[x.data]),D=q(()=>{let e=new Map;for(let t of S.data??[])e.set(t.id,t.label);return e},[S.data]),O=m.data??[],k=T(O),ee=F(k),A={legend:`Nothing recorded`,message:`No requests landed in this window. Widen the range, or send traffic through the gateway.`};return Y(B,{$gap:4,children:[J(ut,{legend:`Usage`,title:`Requests, tokens, and spend`,summary:m.isLoading?`Reading usage…`:`${z(k.requests)} requests and ${R(k.costUsd)} over the last ${s.label}.`,actions:J(mt,{children:_e.map(e=>J(ht,{type:`button`,$size:`sm`,$on:e.id===t,"aria-pressed":e.id===t,onClick:()=>n(e.id),children:e.id},e.id))})}),J(gt,{buckets:O,since:u,until:d,by:s.by,rangeLabel:s.label,dayOffsetMinutes:l}),J(G,{legend:`Traffic`,meta:s.by===`hour`?`By hour`:`By day`,query:m,isEmpty:O.length===0,empty:A,children:J(er,{buckets:O,by:s.by,since:u,until:d,dayOffsetMinutes:l})}),J(mt,{children:Pe.map(e=>J(ht,{type:`button`,$size:`sm`,$on:e.id===r,"aria-pressed":e.id===r,onClick:()=>i(e.id),children:`Rank by ${e.label.toLowerCase()}`},e.id))}),J(G,{legend:`Traffic by upstream model`,meta:`${c.label}, ${s.by===`hour`?`by hour`:`by day`}`,query:g,isEmpty:(g.data??[]).length===0,empty:A,children:J(Bn,{buckets:g.data??[],by:s.by,since:u,until:d,dayOffsetMinutes:l,metric:c,providers:w})}),Y(it,{$min:`480px`,$gap:4,children:[Y(B,{$gap:4,children:[J(G,{legend:`Providers`,meta:c.label,query:h,isEmpty:(h.data??[]).length===0,empty:A,children:J(Wn,{buckets:h.data??[],by:s.by,since:u,until:d,dayOffsetMinutes:l,metric:c})}),J(Nn,{days:b.data??[],now:Date.now(),dayOffsetMinutes:l})]}),Y(B,{$gap:4,children:[J(G,{legend:`Token mix`,meta:z(ee),query:m,isEmpty:O.length===0,empty:A,children:J($n,{buckets:O,by:s.by,since:u,until:d,dayOffsetMinutes:l})}),J(G,{legend:`Models`,meta:nr.find(e=>e.id===a)?.column,query:v,isEmpty:(v.data??[]).length===0,empty:A,actions:J(mt,{children:nr.map(e=>J(ht,{type:`button`,$size:`sm`,$on:e.id===a,"aria-pressed":e.id===a,onClick:()=>o(e.id),children:e.label},e.id))}),children:J(Zn,{buckets:v.data??[],metric:c})}),J(G,{legend:`Accounts`,meta:c.label,query:y,isEmpty:(y.data??[]).length===0,empty:A,children:J(Zn,{buckets:y.data??[],metric:c,names:D,unknownLabel:`No account`})})]})]}),J(G,{legend:`API keys`,meta:c.label,query:_,isEmpty:(_.data??[]).length===0,empty:A,children:J(Pn,{buckets:_.data??[],by:s.by,since:u,until:d,dayOffsetMinutes:l,metric:c,names:E})})]})}var ir=rr;export{ir as component};
@@ -1 +0,0 @@
1
- import{A as e}from"./Rack-CEuCdVXc.js";var t={name:`chevron-down`,size:24,node:[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]};t.node;var n=e(t);export{n as t};
@@ -1 +0,0 @@
1
- import{A as e}from"./Rack-CEuCdVXc.js";var t={name:`chevron-right`,size:24,node:[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]};t.node;var n=e(t);export{n as t};
@@ -1,14 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app-Drf03PWk.js","assets/Panel-CWmOTDAP.js","assets/client-k1tkFSNH.js","assets/shared-Dtkw6SE0.js","assets/Lamp-DkvXKB-B.js","assets/Rack-CEuCdVXc.js","assets/RequestTable-D8L6iVJV.js","assets/TokenBreakdown-D1Wtza1y.js","assets/chevron-right-DSaI1kFo.js","assets/dist-D03q-60i.js","assets/Chip-D4qvhu1D.js","assets/Field-BYBri2NV.js","assets/Table-CVDZ69Zx.js","assets/chevron-down-Bs0tSOyA.js","assets/Meter-stpt3vQu.js","assets/WindowChart-BeGPsccS.js","assets/SummaryDeck-7ivuca39.js","assets/Readout-BTh732hP.js","assets/login-DW2Ipp21.js","assets/reasons-Du1OBWAM.js","assets/_app.index-DigYfob3.js","assets/_app.accounts-W1USUo2Q.js","assets/CopyValue-SnsT2LML.js","assets/plus-BCfjC6nk.js","assets/trash-D4QWzEK_.js","assets/Toggle-t82IhqEt.js","assets/_app.console-Co9d2ZiD.js","assets/_app.database-CtFJLcfE.js","assets/_app.keys-B1fRMyU-.js","assets/_app.logs-CFixPsUw.js","assets/_app.models-Dpl1O2RE.js","assets/_app.settings-C3GzeJ4q.js","assets/_app.usage-D2qlcEp4.js","assets/_app.plugins._pluginId-BK0ADugW.js","assets/preload-helper-BPaHpbO_.js"])))=>i.map(i=>d[i]);
2
- import{Cn as e,Dn as t,En as n,H as r,In as i,K as a,Mn as o,Mt as s,Nn as c,On as l,Pn as u,Sn as d,Tn as f,W as p,_n as m,an as h,cn as g,fn as _,gn as v,hn as y,jn as b,kn as x,ln as S,mn as C,on as w,pn as T,rn as E,sn as ee,un as te,vn as ne,wn as re,xn as ie,yn as ae}from"./Lamp-DkvXKB-B.js";import{a as oe,c as se,i as ce,n as D,o as le,r as O,s as ue,t as k}from"./preload-helper-BPaHpbO_.js";import{A as de,C as fe,D as pe,_ as me,a as he,k as A,l as ge,s as _e,t as ve}from"./Panel-CWmOTDAP.js";import{C as ye,E as be,T as xe,n as Se}from"./Rack-CEuCdVXc.js";import{MutationCache as Ce,QueryCache as we,QueryClient as Te,QueryClientProvider as Ee,useQueryClient as De}from"@tanstack/react-query";import*as j from"react";import{StrictMode as Oe,createContext as ke,use as Ae,useEffect as M,useRef as je,useState as Me,useSyncExternalStore as Ne}from"react";import{Fragment as Pe,jsx as N,jsxs as P}from"react/jsx-runtime";import{createRoot as Fe}from"react-dom/client";import Ie from"styled-components";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function F(e){return e?.isNotFound===!0}function Le(){try{return sessionStorage}catch{return}}var Re=`tsr-scroll-restoration-v1_3`,ze=Le();function Be(){try{return JSON.parse(ze?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Ve(){try{ze?.setItem(Re,JSON.stringify(I))}catch{}}var I=Be(),He=`data-scroll-restoration-id`,Ue=e=>e.state.__TSR_key||e.href;function We(e){let t=e.getAttribute(He);if(t)return`[${He}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var Ge=!1,Ke=`window`;function qe(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Je(e){let t=new Set;for(let n of e){if(n===Ke)continue;let e=qe(n);e&&t.add(e)}return t}function Ye(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||Ue,a=new Set,o=e=>{let t=I[e]||={};for(let e of a)e===document?t[Ke]={scrollX,scrollY}:e.isConnected&&(t[We(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Ge=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Ge||a.add(e.target)},!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(i(e.fromLocation)),a.clear()}),addEventListener(`pagehide`,()=>{o(i(e.stores.resolvedLocation.get()??e.stores.location.get())),Ve()})),!r.reset&&(r.reset=!0,e.subscribe(`onRendered`,t=>{let n=e.options.scrollRestorationBehavior,o=e.options.scrollToTopSelectors,s=r.next,c=r.hash,l;if(a.clear(),r.next=!0,r.hash=!1,typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let u=i(t.toLocation),d=t.fromLocation&&i(t.fromLocation);if(r.restoring&&d&&d!==u){let e=I[d];if(e){let t=I[u];for(let n in e){if(n===Ke){if(s)continue}else{let e=qe(n);if(!e||s&&o&&(l??=Je(o),l.has(e)))continue}t||=I[u]={},t[n]??=e[n]}}}Ge=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=Je(o));let t=e&&i&&c,s=r.restoring?I[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===Ke){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=qe(e);t&&(t.scrollLeft=r,t.scrollTop=i,l?.delete(t))}}if(!e){let e={top:0,left:0,behavior:n};if(a||scrollTo(e),l)for(let t of l)t.scrollTo(e)}}!a&&e&&i&&document.getElementById(e)?.scrollIntoView(i)}finally{Ge=!1}}))}function Xe(e,t=String){let n;for(let r in e){let i=e[r];i!==void 0&&(n||=new URLSearchParams).set(r,t(i))}return n?n.toString():``}function Ze(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Qe(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=Ze(r):Array.isArray(t)?t.push(Ze(r)):n[e]=[t,Ze(r)]}return n}var $e=/^(?:\s|["[{\d-]|fa|nu|tr)/,et=nt(JSON.parse),tt=rt(JSON.stringify,JSON.parse);function nt(e){let t=e===JSON.parse;return n=>{n[0]===`?`&&(n=n.substring(1));let r=Qe(n);for(let n in r){let i=r[n];if(typeof i==`string`){if(t&&!$e.test(i))continue;try{r[n]=e(i)}catch{}}}return r}}function rt(e,t){let n=t===JSON.parse;function r(r){if(r&&typeof r==`object`)try{return e(r)}catch{}else if(t&&typeof r==`string`){if(n&&!$e.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=Xe(e,r);return t?`?${t}`:``}}function it(e){return{input:({url:t})=>{for(let n of e)t=ot(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=st(e[n],t);return t}}}function at(e){let t=te(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=g([`/`,t,e.pathname]),e)}}function ot(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function st(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function ct(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i}=t,a=new Map,o=n(`idle`),s=n(e),c=n(void 0),l=n([]),u=r(()=>l.get().map(e=>a.get(e).get())),f=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function p(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let m={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:f,getMatchStore:p,setMatches:h};function h(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{d(t,n)||l.set(n);for(let e of t)n.includes(e)||a.get(e).set(()=>void 0);for(let t of e){let e=p(t.routeId);e.get()!==t&&e.set(t)}})}return m}var L=`__TSR_index`,lt=`popstate`,ut=`beforeunload`,dt=/^[\x00-\x20]*(?:[\\/][\t\n\r]*){2,}/;function ft(e){let t=dt.exec(e);return t?`/`+e.slice(t[0].length):e}function pt(e){return/[\x00-\x1f\x7f]/.test(e)&&(e=e.replace(/[\x00-\x1f\x7f]/g,e=>`
3
- \r`.includes(e)?``:encodeURIComponent(e))),ft(e)}function mt(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=_t(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[L];i=ht(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[L];i=ht(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t,n?.ignoreBlocker??!1),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[L]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r,_getBlockers:()=>e.getBlockers?.()??[]}}function ht(e,t){t||={};let n=vt();return{...t,key:n,__TSR_key:n,[L]:e}}function gt(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=t=>pt(e?.createHref?e.createHref(t):t),c=e?.parseLocation??(()=>_t(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=vt();t.history.replaceState({[L]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_=()=>{g&&(S._ignoreSubscribers=!0,(g[2]?t.history.pushState:t.history.replaceState)(g[1],``,g[0]),S._ignoreSubscribers=!1,g=void 0,u=void 0)},v=(t,n,r)=>{let i=e?.createHref?s(n):void 0,a=!!g;a||(u=l),l=_t(n,r),g=[i??l.href,r,g?.[2]||t],a||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(m=!1,f){f=!1;return}let e=c(),n=e.state[L]-l.state[L],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let r=a();if(typeof document<`u`&&r.length){for(let i of r)if(await i.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(-n),S.notify(u);return}}}l=c(),S.notify(u)},x=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},S=mt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>v(!0,e,t),replaceState:(e,t)=>v(!1,e,t),back:e=>(e&&(p=!0,m=!0),t.history.back()),forward:e=>{e&&(p=!0,m=!0),t.history.forward()},go:(e,n)=>{d=!0,n&&(p=!0,m=!0),t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ut,x,{capture:!0}),t.removeEventListener(lt,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return S._ignoreNextBeforeUnload=e=>{m=!1;try{e=new URL(e,t.document.baseURI).href,m=/^https?:/.test(e)&&(!e.includes(`#`)||e.split(`#`)[0]!==t.location.href.split(`#`)[0])}catch{}},t.addEventListener(ut,x,{capture:!0}),t.addEventListener(lt,b),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||y(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||y(`REPLACE`),n},S}function _t(e,t){let n=pt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=vt();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[L]:0,key:a,__TSR_key:a}}}function vt(){return(Math.random()+1).toString(36).substring(7)}function yt(e,t){return e.protocol!==`http:`&&e.protocol!==`https:`||e.origin!==t||!!e.username||!!e.password}function bt(e){return e.pathname+e.search+e.hash}function xt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function St(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function Ct({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function wt(e){return e.findIndex(e=>e.status===`error`||e.status===`notFound`||e._notFound)+1}function Tt(e,t,n,r,i,a){r&&(t=t.slice(0,r)),i&&(n=n.slice(0,i));for(let r of t){if(a&&e._tx!==a)return;n.some(e=>e.routeId===r.routeId)||e.routesById[r.routeId].options.onLeave?.(r)}for(let r of n){if(a&&e._tx!==a)return;e.routesById[r.routeId].options[t.some(e=>e.routeId===r.routeId)?`onStay`:`onEnter`]?.(r)}}var Et=class{constructor(r,i){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=w(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:gt()),this.origin=this.options.origin,this.origin||=window?.origin&&window.origin!==`null`?window.origin:`http://localhost`,this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=ae(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=ct(this.latestLocation,e),Ye(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=te(a);t&&t!==`/`&&e.push(at({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:it(e),this.history&&this.updateLatestLocation(),this.stores&&this.stores.location.set(this.latestLocation)}},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=ne(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&m(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{for(let t of this.subscribers)if(t.eventType===e.type)try{t.fn(e)}catch(e){console.error(e)}},this.parseLocation=(t,n)=>{let r=({pathname:t,search:r,hash:i,href:a,state:s})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(t)){let a=this.options.parseSearch(r),c=this.options.stringifySearch(a);return{href:t+c+i,publicHref:t+c+i,pathname:e(t),external:!1,searchStr:c,search:o(n?.search,a),hash:e(i.slice(1)),state:u(n?.state,s)}}let c=new URL(a,this.origin),l=ot(this.rewrite,c),d=this.options.parseSearch(l.search),f=this.options.stringifySearch(d);return l.search=f,{href:l.href.replace(l.origin,``),publicHref:a,pathname:e(ft(l.pathname)),external:!!this.rewrite&&yt(l,this.origin),searchStr:f,search:o(n?.search,d),hash:e(l.hash.slice(1)),state:u(n?.state,s)}},i=r(t),{__tempLocation:a,__tempKey:s}=i.state;if(a&&(!s||s===this.tempLocationKey)){let e=r(a);return e.state.key=i.state.key,e.state.__TSR_key=i.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:i}}return i},this.resolvePathWithBase=(e,t)=>S({base:e,to:t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>{let t=Object.create(null),n=y(_(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=t=>{let r=(r={})=>{if(r.href){let e=_t(r.href,{});r={...r,to:ot(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let i=r._fromLocation||this._pendingLocation||this.latestLocation,a=this.matchRoutesLightweight(i),s=r.unsafeRelative===`path`?i.pathname:r.from??a[1],c=a[2],d=a[3],p=this.resolvePathWithBase(s,r.to?`${r.to}`:`.`),m=Nt(r.params,d),h=this.routesByPath[_(p)],g;if(h)g=this.getRouteBranch(h);else if(p.includes(`$`))g=[];else{let[e,t,n]=this.getMatchedRoutes(p);g=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(g=[...g,this.options.notFoundRoute])}if(g.length&&l(m))for(let e of g){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){m===d&&(m=Object.assign(Object.create(null),m));try{Object.assign(m,t(m))}catch{}}}let v=t.leaveParams?p:e(ft(ee({path:p,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath)),y=c;if(t._includeValidateSearch&&this.options.search?.strict){let e={};g.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,At(t.options.validateSearch,{...e,...y}))}catch{}}),y=e}y=jt(y,r,g,t._includeValidateSearch),y=o(c,y);let b=this.options.stringifySearch(y),x=r.hash===!0?i.hash:r.hash?n(r.hash,i.hash):void 0,S=x?`#${x}`:``,C=r.state===!0?i.state:r.state?n(r.state,i.state):{};r.state&&(C=u(i.state,C));let w=`${v}${b}${S}`,T,E,te=!1;if(this.rewrite){let e=new URL(w,this.origin),t=e.origin,n=st(this.rewrite,e);T=bt(e),yt(n,t)?(E=n.href,te=!0):E=ft(bt(n))}else T=f(w),E=T;return{publicHref:E,href:T,pathname:v,search:y,searchStr:b,state:C,hash:x??``,external:te,unmaskOnReload:r.unmaskOnReload}},i=r(t);if(t.mask)i.maskedLocation=r({from:t.from,...t.mask});else if(this.options.routeMasks){let e=C(i.pathname,this.processedTree);if(e){let n=Object.assign(Object.create(null),e.rawParams),{from:a,params:o,...s}=e.route,c=Nt(o,n);i.maskedLocation=r({from:t.from,...s,params:c})}}return i},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r=n.maskedLocation??n;if(r.external)return Dt(this,r.publicHref,{replace:n.replace,ignoreBlocker:t});let i,a=_(this.latestLocation.href)===_(n.href)&&re(Ct(n.state),Ct(this.latestLocation.state)),o=this._commitPromise,s,c=new Promise(e=>{s=e});if(c.resolve=()=>{s(),o?.resolve()},this._commitPromise=c,a)this.load();else{let{maskedLocation:r,hashScrollIntoView:a,...o}=n;r&&(o={...r,state:{...r.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,i=n.replace?`REPLACE`:`PUSH`,this.history[i===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:i}})}return this._scroll.next=n.resetScroll??!0,this._commitPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,...a}={})=>{let o=this.buildLocation({...a,_includeValidateSearch:!0});this._pendingLocation=o;let s=this.commitLocation({...o,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===o&&(this._pendingLocation=void 0)}),s},this.navigate=async({to:e,reloadDocument:n,href:r,publicHref:i,...a})=>{let o=r?t(r):void 0;if(o||n){if(e!==void 0||!r){let t=this.buildLocation({to:e,...a}),n=t.maskedLocation??t;r??=n.publicHref,i??=n.publicHref}let t=!o&&i?i:r;return Dt(this,t,a)}return this.buildAndCommitLocation({...a,href:r,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await pn(this,e)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&window.CSS?.supports?.(`selector(:active-view-transition-type(a))`)){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(St(r,i)):t.types;if(a===!1)return e();n={update:e,types:a}}else n=e;return document.startViewTransition(n).updateCallbackDone}return e()},this.invalidate=e=>{let t=this._committed,n=e?.filter,r=this._preloads,i=new Set([...t,...this._cache.values(),...[...r?.values()??[]].flat(),...this._tx?.[3]??[]].filter(e=>!n||n(e)).map(e=>e.id)),a=[];for(let[e,t]of r??[])t.some(e=>i.has(e.id))&&(r.delete(e),a.push(e));let o=t=>{if(i.has(t.id)){let n=this.routesById[t.routeId],r={...t,invalid:!0,...(e?.forcePending||t.status===`error`||t.status===`notFound`)&&xt(n)?{status:`pending`,error:void 0}:void 0};return t._flight=void 0,r}return t};this._committed=t.map(o);for(let[t,n]of this._cache)i.has(t)&&(n.invalid=!0,e?.forcePending&&(n.status=`pending`));for(let e of i)this._flights?.delete(e);for(let e of a)e.abort();return this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.resolveRedirect=e=>{let n=e.options,r=e.headers.get(`Location`)||n.href;if(!r){let e=this.buildLocation(n);r=(e.maskedLocation??e).publicHref||`/`}let i;if(c.test(r)||(i=t(r))&&!this.protocolAllowlist.has(i))throw Error(`Redirect blocked: unsafe protocol`);if(i===`http:`||i===`https:`){let e=new URL(r);e.pathname.startsWith(`//`)?r=e.href:yt(e,this.origin)||(r=bt(e),i=void 0)}return i&&(n.reloadDocument=!0),n.href=r,e.headers.set(`Location`,r),e},this.clearCache=e=>{let t=this._cache,n=this._preloads,r=e?.filter,i=[],a=[];for(let[e,n]of t)(!r||r(n))&&(a.push(e),i.push(n));let o=[];for(let[e,t]of n??[])(!r||t.some(r))&&(o.push(e),i.push(...t));for(let e of a)t.delete(e);for(let e of o)n.delete(e);for(let e of i){let t=e._flight;e._flight=void 0,t&&!--t[2]&&(this._flights?.get(e.id)===t&&this._flights.delete(e.id),o.push(t[1]))}for(let e of o)e.abort()},this.loadRouteChunk=R,this.preloadRoute=e=>mn(this,e),this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n),i=this.stores.status.get()===`pending`;if(t?.pending&&!i)return!1;let a=t?.pending??!i?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),o=v(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!re(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?re(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=i,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...r,caseSensitive:r.caseSensitive??!1,notFoundMode:r.notFoundMode??`fuzzy`,stringifySearch:r.stringifySearch??tt,parseSearch:r.parseSearch??et,protocolAllowlist:r.protocolAllowlist??ie}),self.__TSR_ROUTER__=this}isShell(){return!!this.options.isShell}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=T(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let[n,r,i]=this.getMatchedRoutes(e.pathname),a=n,s=!1;(i?i.path!==`/`&&r[`**`]:_(e.pathname))&&(this.options.notFoundRoute?a=[...a,this.options.notFoundRoute]:s=!0);let c=s?Mt(this.options.notFoundMode,a):void 0,l=Array(a.length),d=this._committed,f=(e,t)=>{let n=d[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?d.find(t=>t.routeId===e.id):void 0},p;for(let n=0;n<a.length;n++){let i=a[n],s=l[n-1],d,m,h;{let n=s?.search??e.search,r=s?._strictSearch??void 0;try{let e=At(i.options.validateSearch,{...n})??void 0;d={...n,...e},m={...r,...e}}catch(e){let r=e;if(e instanceof Ot||(r=new Ot(e.message,{cause:e})),t?.throwOnError)throw r;d=n,m={},h=r}}let g=``,_=``;try{g=i.options.loaderDeps?.({search:d})??``,_=g&&JSON.stringify(g)||``}catch(e){if(t?.throwOnError)throw e;h??=e}let{interpolatedPath:v,usedParams:y}=ee({path:i.fullPath,params:r,decoder:this.pathParamsDecoder,server:this.isServer}),b=i.id+v+_,x=f(i,n),S=this._cache.get(b)??(x?.id===b?x:void 0);p=S?._strictParams??Object.assign(y,p);let C;if(!S)try{Pt(i,p)}catch(e){if(C=F(e)||le(e)?e:new kt(e.message,{cause:e}),t?.throwOnError)throw C}let w=x?`stay`:`enter`,T;if(S)T={...S,cause:w,search:o(x?x.search:S.search,d),_strictSearch:m,searchError:h};else{let e=xt(i)?`pending`:`success`;T={id:b,ssr:i.options.ssr,index:n,routeId:i.id,params:x?.params??p,_strictParams:p,pathname:v,updatedAt:Date.now(),search:x?o(x.search,d):d,_strictSearch:m,searchError:h,status:e,isFetching:!1,error:void 0,paramsError:C,context:{},abortController:t?._controller??new AbortController,cause:w,loaderDeps:x?u(x.loaderDeps,g):g,invalid:!1,preload:!1,staticData:i.options.staticData||{},fullPath:i.fullPath}}let E=c===i.id;T._notFound&&!E&&(T.error=void 0),T._notFound=E,l[n]=T}for(let e=0;e<l.length;e++){let n=l[e];n.params=n.cause===`stay`?o(n.params,p):p,t?._controller&&(n.context={})}return l}matchRoutesLightweight(e){let t=b(this.stores.ids.get()),n=t?this.stores.byRoute.get(t).get():void 0,r=n?.id,i=this.lightweightCache.get(e);if(i&&i[0]===r)return i[1];let[a,o]=this.getMatchedRoutes(e.pathname),s=b(a),c={...e.search};for(let e of a)try{Object.assign(c,At(e.options.validateSearch,c))}catch{}let l=n&&n.routeId===s.id&&n.pathname===e.pathname,u;if(l)u=n.params;else{let e=Object.assign(Object.create(null),o);for(let t of a)try{Pt(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}};async function Dt(e,t,{replace:n,ignoreBlocker:r}){if(!x(t,e.protocolAllowlist)){if(!r){let t=e.history._getBlockers();for(let r of t)if(r?.blockerFn&&await r.blockerFn({currentLocation:e.history.location,nextLocation:e.history.location,action:n?`REPLACE`:`PUSH`}))return}e.history._ignoreNextBeforeUnload?.(t),n?window.location.replace(t):window.location.href=t}}var Ot=class extends Error{},kt=class extends Error{};function At(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Ot(`Async validation not supported`);if(n.issues)throw new Ot(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function jt(e,t,r,i){let a=[];for(let e of r){let t=e.options;`search`in t?t.search?.middlewares&&a.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&a.push(({search:e,next:n})=>{let r=n(t.preSearchFilters?t.preSearchFilters.reduce((e,t)=>t(e),e):e);return t.postSearchFilters?t.postSearchFilters.reduce((e,t)=>t(e),r):r});let n=t.validateSearch;i&&n&&a.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=At(n,i);if(r&&e)for(let t in e)t in i||(r.defaulted||=new Map).set(t,e[t]);return{...i,...e}}catch{}return i})}let o=(e,r,i)=>{if(e>=a.length){if(!t.search)return{};if(t.search===!0)return r;let e=n(t.search,r);return i&&(i.explicit=e),e}return a[e]({search:r,next:(t,n)=>{if(n){let n=i||{};return{search:o(e+1,t,n),meta:n}}return o(e+1,t,i)},meta:i})};return o(0,e)}function Mt(e,t){if(e!==`root`){let e;for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.options.notFoundComponent)return r.id;e||=r.children&&r.id}if(e)return e}return se}function Nt(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let r=Object.assign(Object.create(null),t);return Object.assign(r,n(e,r))}function Pt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Ft(e,t){return e.options[t]?.preload?.()}function It(e,t){let n=Ft(e,`component`),r=Ft(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function R(e,t,n){let r=()=>t===!1?void 0:t?Ft(e,t):It(e,n),i=e._lazy;if(i)return i===!0?r():i.then(r);if(!e.lazyFn)return r();let a=e.lazyFn().then(t=>{{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazy=!0}},t=>{throw e._lazy=void 0,t});return e._lazy=a,a.then(r)}function Lt(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var z=0,B=1,Rt=2,V=3,H=[4];function zt(e){return typeof e[0]==`number`}function U(e,t){return t.aborted?Promise.race([Promise.reject(t),e]):new Promise((n,r)=>{let i=()=>r(t);t.addEventListener(`abort`,i,{once:!0}),Promise.resolve(e).then(n,r).then(()=>t.removeEventListener(`abort`,i))})}function W(e,t){return e.routesById[t.routeId]}function G(e,t,n){return le(e)?[V,e]:F(e)?(e.routeId||=n,[Rt,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[B,e]):[z,e]}function Bt(e,t){let n=G(t,!0,e.id);if(n[0]!==B)return n;try{e.options.onError?.(n[1])}catch(t){n=G(t,!0,e.id)}return n}function K(e,t,n,r,i){return i[0].signal.aborted?H:$t(e,t,n,Bt(n,r),i)}async function Vt(e,t,n,r,i,a){let[o,s]=t,c=n[0].signal,l=!!n[3];for(let i=n[6]??0;i<r;i++){let r=s[i],u=W(e,r);r.abortController=n[0];let d=s[i-1]?.context??e.options.context??{},f={params:r.params,location:o,navigate:t=>e.navigate({...t,_fromLocation:o}),buildLocation:e.buildLocation,cause:l?`preload`:r.cause,abortController:n[0],preload:l,matches:s,routeId:u.id};try{let e=r._ctx||=u.options.context?u.options.context({...f,deps:r.loaderDeps,context:d})||{}:void 0;r.context={...d,...e}}catch(a){return q(e,r),[i,K(e,t,u,a,n)]}if(c.aborted)return[i,H];let p=r.paramsError??r.searchError;if(p!==void 0)return q(e,r),[i,K(e,t,u,p,n)];let m=u.options.beforeLoad;if(!m)continue;let h=r.status;i>=a&&(r.status=`pending`,n[7]?.());try{Wt(e,r,`beforeLoad`,n[0]);let a=m({...f,search:r.search,context:r.context,...e.options.additionalContext}),o=await(typeof a?.then==`function`?U(a,c):a);if(c.aborted)return[i,H];let s=$t(e,t,u,G(o,!1,u.id),n);if(s[0]!==z)return q(e,r),[i,s];r.context={...r.context,...o}}catch(a){return q(e,r),[i,K(e,t,u,a,n)]}finally{r.status=h,Wt(e,r,!1,n[0])}}i()}function Ht(e,t,n){if(!(!n||--n[2])){if(e._flights?.get(t.id)===n){let n=e._tx;if(n&&!n[0].signal.aborted&&!n[3].includes(t)&&n[3].some(e=>e.id===t.id)&&n[3].some(e=>e.isFetching===`beforeLoad`))return;e._flights.delete(t.id)}return n[1]}}function q(e,t){let n=t._flight;t._flight=void 0,Ht(e,t,n)?.abort()}function J(e,t,n,r){let i=[];for(let a of t)if(!n?.includes(a)){let t=a._flight;if(a._flight=void 0,r&&t?.[2]===1&&e._flights?.get(a.id)===t&&n?.some(e=>e.id===a.id))t[2]=0;else{let n=Ht(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Ut(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Wt(e,t,n,r){if(t.isFetching=n,r&&e._tx?.[0]!==r)return;let i=e.stores.byRoute.get(t.routeId),a=i?.get();a?.id===t.id&&i.set({...a,isFetching:n})}function Gt(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:t=>e.navigate({...t,_fromLocation:s}),cause:o?`preload`:n.cause,abortController:i,preload:o,deps:n.loaderDeps,parentMatchPromise:a,context:n.context,route:r,...e.options.additionalContext}}async function Kt(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return H;if(!i)return[z,void 0];let l=n._flight;Wt(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(Gt(e,t,n,r,s,a,!!o[3]))).then(e=>G(e,!1,r.id),e=>G(e,!0,r.id)).then(t=>(t[0]!==z&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===B&&l[2]?Bt(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],$t(e,t,r,await U(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return q(e,n),H}finally{Wt(e,n,!1,s)}}function qt(e,t,n){t[0]!==V&&(e.status=`success`,e.error=void 0,t[0]===z?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function Jt(e,t,n){let r=e._cache.get(t.id);if(r!==n||e._committed.some(e=>e.id===t.id&&e._flight===t._flight))return;let i={...t,_notFound:void 0,context:{}};i._flight&&i._flight[2]++,e._cache.set(t.id,i),r&&q(e,r)}function Yt(e,t){return t[0]===B||t[0]===Rt?{...e,status:t[0]===B?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Xt(e,t,n,r,i,a,o){let s=t[1][n],c=W(e,s),l=!!a[3],u=e._cache.get(s.id),d,f=!1,p;try{if(s.status===`success`&&(d=c.options.shouldReload,typeof d==`function`&&(d=d(Gt(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=H)),!p){if(s.status!==`success`)f=!0;else{let t=l||s.preload?c.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:c.options.staleTime??e.options.defaultStaleTime??0;f=!!(s.invalid||d||d===void 0&&Date.now()-s.updatedAt>=t&&(a[5]||s.cause===`enter`||a[2].some(e=>e.routeId===s.routeId&&e.id!==s.id)))}}}catch(n){s.invalid=!0,q(e,s),p=K(e,t,c,n,a)}let m=c.options.loader,h=typeof m==`function`,g=h?m:m?.handler,_=!l||c.options.preload!==!1,v=_&&m?e._flights?.get(s.id):void 0;v===s._flight||p?v=void 0:v&&!f&&!l&&d===void 0?f=!0:f||(v=void 0);let y=!(!m||!f||s.status!==`success`||l||a[4]||((h?void 0:m.staleReloadMode)??e.options.defaultStaleReloadMode)===`blocking`),b=f&&_,x=b&&!y&&(s.status!==`success`||!!m),S=n>=o?a[7]:void 0,C=c.lazyFn&&c._lazy!==!0?S:void 0;if(b&&!m&&(s.invalid=!1,s.updatedAt=Date.now()),v&&v[2]++,x){let t=s._flight;s._flight=v,Ht(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=!p&&x?Kt(e,t,s,c,g,i,a).then(t=>(qt(s,t,l),t[0]===z&&(m&&!a[0].signal.aborted&&Jt(e,s,u),n>=o&&(s.status=`pending`)),t)):Promise.resolve(p??[z,s.loaderData]),T=(async()=>{try{let e=R(c,void 0,C);e&&await U(e,a[0].signal)}catch(r){if(!t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound)))return[n,K(e,t,c,r,a)]}let r=await w;x&&r[0]===z&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.())})();if(r.push([n,w,T]),!y)return w.then(e=>Yt(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let ee=Kt(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,qt(E,e,!1),e));return(t[2]??=[]).push([n,ee,T,E]),ee.then(e=>Yt(E,e))}async function Zt(e,t,n,r,i=0){let a=n?.[1][1],o=a?.routeId?t.findIndex(e=>e.routeId===a.routeId):n?.[0]??t.length-1;o<0&&(o=0);for(let n=o;n>=0;n--){let i=W(e,t[n]);try{let e=R(i,!1);e&&await U(e,r)}catch(e){if(e===r&&r.aborted)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function Y(e,t){t[2]&&=(J(e,t[2].map(e=>e[3])),void 0)}async function Qt(e,t,n,r){let i;try{await Promise.all(e.map(e=>e[1].then(async t=>{let a=e[0];if(!(r&&a>=await r)){if(t[0]>=V)throw[a,t];!i&&t[0]!==z&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===V)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function $t(e,t,n,r,i,a){for(;r[0]===V;){let o=r[1],s=o.options;try{if((s.href||o.headers.has(`Location`))&&(e.resolveRedirect(o),s.reloadDocument)||(s.reloadDocument?i[3]:i[1]>=20))return r;let n=e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0}),a=n.maskedLocation??n;if(a.external){let t=o.clone();return t.options={...s},t.headers.set(`Location`,a.publicHref),e.resolveRedirect(t),i[3]?[V,t]:[V,t,a]}return[V,o,n]}catch(e){r=a?[B,e]:Bt(n,e),a=!0}}return r}async function en(e,t,n,r,i,a){let o=t[1],s=await i,c=!1,l=o.findIndex(e=>e._notFound),u=t=>t[1][0]===Rt?Zt(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=V)d=0;else if(s){d=s[2]??=await u(s);for(let e of n){if(e[0]>=d)break;let t=await e[1];if(t[0]!==z&&t[0]<V&&!(`loaderData`in o[e[0]])){s=[e[0],t],d=s[2]=await u(s);break}}}for(let e of n){if(e[0]>=d)break;let t=await e[2];if(t){s=t;break}}if((s?.[1][0]??0)>=V){let n=s[1];if(n[0]!==V||n[1].options.reloadDocument||n[2])return Y(e,t),n;c=!0,s=[0,[B,Error(`Too many redirects`)]]}let f=s?s[2]??await u(s):l;if(f>=0){let i=s?.[1],l=i?.[0],u=o[f],d=i?.[1],p=()=>{i&&(u._notFound=void 0,l===B?u.status=`error`:(d.routeId=u.routeId,u.routeId===e.routeTree.id?(u.status=`success`,u._notFound=!0):u.status=`notFound`),u.error=d,u.isFetching=!1)};p(),i||a?.();let m=W(e,u);try{await U(i?Promise.resolve().then(()=>R(m,l===B?`errorComponent`:`notFoundComponent`)):Promise.all([R(m),R(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Y(e,t),H}i?c&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),Y(e,t),J(e,o),p()):u.status=`success`}return t}async function tn(e,t,n,r=0,i=t[1].length){let a=t[1];for(let t=r;t<i;t++){let r=a[t],i=W(e,r).options;if(i.head||i.scripts)try{let t={ssr:e.options.ssr,matches:a,match:r,params:r.params,loaderData:r.loaderData},[o,s]=await U(Promise.all([i.head?.(t),i.scripts?.(t)]),n);r.meta=o?.meta,r.links=o?.links,r.headScripts=o?.scripts,r.styles=o?.styles,r.scripts=s}catch(e){if(e===n&&n.aborted)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function nn(e,t,n,r){let i=[t,n],a=r[0].signal,o;try{let t=e.stores.matches.get(),s=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&s>=0){let t=await Zt(e,n,void 0,a,s);n[s]._notFound=void 0,n[t]._notFound=!0,s=t}let c=s<0?n.length:s+1,l=0;for(;l<c&&l!==s;){let e=n[l],i=r[2][l],a=t[l];if(i?.id!==e.id||i.status!==`success`||e.preload||a?.id!==e.id||a.status!==`success`||(l++,i._notFound||a._notFound))break}let u=[],d=r[6]??0,f=d?Promise.resolve(n[d-1]):void 0,p=()=>{for(let t=d;t<c&&!a.aborted;t++)f=Xt(e,i,t,u,f,r,l)},m=await Vt(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===Rt){let t=await Zt(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=V&&(c=0);p()}if(!a.aborted&&!r[3]){let t=[];for(let[n,r]of e._flights??[])r[2]||(e._flights.delete(n),t.push(r[1]));for(let e of t)e.abort()}let h=en(e,i,u,r[0],Qt(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Qt(i[2],void 0,void 0,h.then(e=>zt(e)?0:Lt(n).length,()=>0))),o=await h}catch(t){if(Y(e,i),t===a&&a.aborted)return H;throw t}return zt(o)?o:tn(e,o,a,r[6]===n.length?r[6]:0)}function rn(e,t){if(e._tx!==t)return;let n=t[3],r=e.stores.matches.get(),i=e._pending;for(let a=0;a<n.length;a++){let o=n[a],s=o.status===`success`&&!o._notFound,c=r[a]?.id===o.id&&r[a]?.status===`pending`;if(s&&!c)continue;let l=W(e,o),u=s||o.invalid?0:l.options.pendingMs??e.options.defaultPendingMs,d=l.options.pendingComponent??e.options.defaultPendingComponent;if(!d||typeof u!=`number`||u===1/0){i&&(i[0]=t,i[2]=0,i[4]=!0);return}let f=l.options.pendingMinMs??e.options.defaultPendingMinMs??0,p=!1;if(i?.[1]===o.id?(p=i[0]!==t,i[0]=t):(clearTimeout(i?.[3]),e._pending=i=void 0),i||(e._pending=i=[t,o.id,c?Date.now()+f:t[4]+u,void 0,c||void 0,d]),i[4]&&!p&&i[5]===d)return;if(i[5]=d,!i[4]){clearTimeout(i[3]);let n=i[2]-Date.now();if(n>0){i[3]=setTimeout(()=>rn(e,t),n);return}i[2]=0}let m=n.map(e=>({...e,_flight:void 0}));m[a].status=`pending`;let h=i[4]=e.startTransition(()=>e.stores.setMatches(m),m).then(t=>(t&&e._pending===i&&i[4]===h&&!i[2]&&(i[2]=Date.now()+f),t));return}}function an(e,t){let n=e._pending;(e._tx===t||!e._tx?.[3].some(e=>e.id===n?.[1]))&&(clearTimeout(n?.[3]),e._pending=void 0)}async function on(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Lt(t[3]).some(e=>e.id===n[1]))return;let i;try{await U(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function sn(e,t){e._committed=t,e.stores.setMatches(t)}function cn(e,t,n,r){let i=e._committed,a=e._lifecycleEnd,o=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let s=Lt(n).length,c=new Map;{let t=Date.now(),r=new Set;for(let e=0;e<n.length;e++){let t=n[e];(e<s||t.status===`success`)&&r.add(t.id)}for(let n of[...i,...o.values()]){if(n.status!==`success`||r.has(n.id))continue;let i=W(e,n);!i.options.loader||t-n.updatedAt>=(n.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||c.set(n.id,o.get(n.id)===n?n:{...n,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=c;let l=e._lifecycleEnd=wt(n);sn(e,n),J(e,[...o.values(),...i].filter(e=>e._flight&&c.get(e.id)!==e),n),Tt(e,i,n,a,l,t)}async function ln(e,t){let n=e._tx;for(;n&&n!==t;)t=n,await n[5],n=e._tx}function un(e,t,n){let r=n[1].options,i=n[2];if(!i)return e.navigate({...r,replace:!0,ignoreBlocker:!0});if(r.reloadDocument)return e.navigate({href:(i.maskedLocation??i).publicHref,reloadDocument:!0,replace:!0,ignoreBlocker:!0});i._redirects=t[1]+1,e._pendingLocation=i;let a=e.commitLocation({...i,viewTransition:r.viewTransition,replace:!0,resetScroll:r.resetScroll,hashScrollIntoView:r.hashScrollIntoView,ignoreBlocker:!0});return queueMicrotask(()=>{e._pendingLocation===i&&(e._pendingLocation=void 0)}),a}async function dn(e,t,n,r,i){let a=n.map(e=>({...e}));Ut(a);for(let t of r)q(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await en(e,o,r,t[0],i)}catch(t){throw J(e,a),t}if(zt(s)){J(e,a),s[0]===V&&e._tx===t&&e._committed===n&&await un(e,t,s);return}if(await tn(e,s,t[0].signal),e._tx!==t||e._committed!==n){J(e,a);return}for(let t of a){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),q(e,n))}sn(e,a),J(e,n,a)}async function fn(e,t,n,r,i,a){let o=await nn(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(zt(o)){let n=o[0]===V&&e._tx===t;if((!n||o[1].options.reloadDocument)&&an(e,t),J(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){an(e,t);return}await un(e,t,o);return}let s=o[1];if(e._tx===t&&await on(e,t),e._tx!==t){an(e,t),J(e,s),Y(e,o);return}let c=t[2],l=St(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await on(e,t),e._tx!==t){an(e,t),J(e,s),Y(e,o);return}let n=await e.startTransition(()=>{an(e,t),cn(e,t,s,a),e._tx===t&&(e.emit({type:`onLoad`,...l}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...l}))},s);if(e._tx!==t){Y(e,o);return}u?.length&&dn(e,t,s,u,o[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(c),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...l}),n&&e._tx===t&&e.emit({type:`onRendered`,...l})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function pn(e,t){let n=e._tx,r=e.stores.resolvedLocation.get(),i=r??e.stores.location.get(),a=e.latestLocation,o=e._pendingLocation,s=o?.href===a.href?o._redirects??0:0,c=e._handoff,l=c?.[0](),u=new AbortController,d=e._preflight;if(e._preflight=u,l||c?.[1](),d?.abort(),!u.signal.aborted){let t=St(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await ln(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Ut(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){J(e,m),await ln(e,n);return}e._preflight=void 0;let g,_=()=>fn(e,y,f,()=>rn(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_),y=[p,s,a,m,Date.now(),v.then(()=>ln(e,y))];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Wt(e,t,!1)}n[0].abort(),J(e,n[3],y[3],!0)}if(e._tx!==y){J(e,y[3]),y[3]=[],g?.(),await ln(e,y);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),(h||!e._committed.length&&m[0]?.status!==`success`&&!m.some(e=>e._notFound))&&rn(e,y),g?.(_()),await y[5]}async function mn(e,t){let n=e.buildLocation(t);for(let t=0;;t++){let r=e._committed,i=new AbortController,a,o,s;try{try{a=e.matchRoutes(n,{_controller:i}),Ut(a),o=(e._preloads??=new Map).set(i,a),s=await nn(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),J(e,a)),i.abort()}if(!zt(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){F(e)||console.error(e);return}}}var hn=class extends j.Component{constructor(...e){super(...e),this.state={error:0},this.reset=()=>{this.setState({error:0})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:0}:{resetKey:n}}static getDerivedStateFromError(e){return{error:[e]}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?j.createElement(this.props.errorComponent??gn,{error:e[0],reset:this.reset}):this.props.children}};function gn({error:e}){let[t,n]=j.useState(!1);return P(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[P(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[N(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),N(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),N(`div`,{style:{height:`.25rem`}}),t?N(`div`,{children:N(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e?.message?N(`code`,{children:e.message}):null})}):null]})}var X=(e=>(e[e.None=0]=`None`,e[e.Mutable=1]=`Mutable`,e[e.Watching=2]=`Watching`,e[e.RecursedCheck=4]=`RecursedCheck`,e[e.Recursed=8]=`Recursed`,e[e.Dirty=16]=`Dirty`,e[e.Pending=32]=`Pending`,e))(X||{});function _n({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function vn(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var yn=[],bn=0,{link:xn,unlink:Sn,propagate:Cn,checkDirty:wn,shallowPropagate:Tn}=_n({update(e){return e._update()},notify(e){yn[Dn++]=e,e.flags&=~X.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=X.Mutable|X.Dirty,An(e))}}),En=0,Dn=0,Z,On=0;function kn(e){try{++On,e()}finally{--On||jn()}}function An(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Sn(n,e)}function jn(){if(!(On>0)){for(;En<Dn;){let e=yn[En];yn[En++]=void 0,e.notify()}En=0,Dn=0}}function Mn(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:n?X.None:X.Mutable,get(){return Z!==void 0&&xn(i,Z,bn),i._snapshot},subscribe(e){let t=vn(e),n={current:!1},r=Nn(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Z,o=t?.compare??Object.is;if(n)Z=i,++bn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=X.Mutable|X.RecursedCheck);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{Z=a,n&&(i.flags&=~X.RecursedCheck),An(i)}}};return n?(i.flags=X.Mutable|X.Dirty,i.get=function(){let e=i.flags;if(e&X.Dirty||e&X.Pending&&wn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Tn(e)}}else e&X.Pending&&(i.flags=e&~X.Pending);return Z!==void 0&&xn(i,Z,bn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Cn(e),Tn(e),jn())}},i}function Nn(e){let t=()=>{let t=Z;Z=n,++bn,n.depsTail=void 0,n.flags=X.Watching|X.RecursedCheck;try{return e()}finally{Z=t,n.flags&=~X.RecursedCheck,An(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:X.Watching|X.RecursedCheck,notify(){let e=this.flags;e&X.Dirty||e&X.Pending&&wn(this.deps,this)?t():this.flags=X.Watching},stop(){this.flags=X.None,this.depsTail=void 0,An(this)}};return t(),n}function Pn(e){let t=A(),n=`not-found-${E(t.stores.location,e=>e.pathname)}-${E(t.stores.status,e=>e)}`;return N(hn,{getResetKey:()=>n,onCatch:(t,n)=>{if(F(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(F(t))return e.fallback?.(t);throw t},children:e.children})}function Fn(){return N(`p`,{children:`Not Found`})}function Q(e){return N(Pe,{children:e.children})}function In(e,t,n){return t.options.notFoundComponent?N(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?N(e.options.defaultNotFoundComponent,{...n}):N(Fn,{})}function Ln(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?N(n,{}):null}var Rn=(e,t)=>e[0]===t[0]&&e[1]===t[1],zn=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,Bn=j.memo(function({routeId:e}){let t=A();return N(Vn,{router:t,match:E(t.stores.getMatchStore(e),e=>e)})});function Vn({router:e,match:t}){let n=e.routesById[t.routeId],r=Ln(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=zn(e,n,t.ssr)&&(n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s))?j.Suspense:Q,l=i?hn:Q,u=o?Pn:Q;return P(n.isRoot?n.options.shellComponent??Q:Q,{children:[N(oe.Provider,{value:t.routeId,children:N(c,{fallback:r,children:N(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(F(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:N(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return j.createElement(o,e)},children:s?N(h,{fallback:r,children:N(Hn,{match:t})}):N(Hn,{match:t})})})})}),null]})}var Hn=j.memo(function({match:e}){let t=A(),n=e.routeId,r=t.routesById[n],i=j.useMemo(()=>{let i=(r.options.remountDeps??t.options.defaultRemountDeps)?.({routeId:n,loaderDeps:e.loaderDeps,params:e._strictParams,search:e._strictSearch});return i?JSON.stringify(i):void 0},[n,e.loaderDeps,e._strictParams,e._strictSearch,r.options.remountDeps,t.options.defaultRemountDeps]),a=j.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?N(e,{},i):N(Un,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!zn(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return Ln(t,r)}if(e.status===`notFound`)return In(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Un=j.memo(function(){let e=A(),t=j.useContext(oe),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=E(a,e=>[!!e._notFound,e.error],Rn),i=E(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return In(e,e.routesById[t],r);if(!i)return null;let a=N(Bn,{routeId:i});return t===`__root__`?N(j.Suspense,{fallback:Ln(e),children:a}):a});function Wn(e,t){let n=e[1];e.length=0,n?.(t)}function Gn({t:e}){let t=A(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Wn(n,!1),n.push(i,a),e(t),j.startTransition(r)}),i(()=>{let e=t.history.subscribe(t.load);t.updateLatestLocation();let r=t.latestLocation,i=t.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(_(r.publicHref)!==_(i.publicHref))return t.commitLocation({...i,replace:!0,ignoreBlocker:!0}),e;let a=t.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?n.push(t.stores.matches.get(),e=>{e&&t.emit({type:`onRendered`,...St(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Kn(){let e=A(),t=e.routesById[se],n=Ln(e,t),r=e.ssr?Q:j.Suspense,i=P(Pe,{children:[N(Gn,{t:j.useState()[1]}),N(r,{fallback:n,children:N(qn,{})})]});return e.options.InnerWrap?N(e.options.InnerWrap,{children:i}):i}function qn(){let e=A(),t=e._rendered,n=E(e.stores.matches,e=>t[0]??e),r=n[0],a=r?.routeId;i(()=>{t[0]===n&&Wn(t,!0)},[t,n]);let o=a?N(Bn,{routeId:a}):null;return N(oe.Provider,{value:a,children:e.options.disableGlobalCatchBoundary?o:N(hn,{getResetKey:()=>r,onCatch:void 0,children:o})})}var Jn=e=>({createMutableStore:Mn,createReadonlyStore:Mn,batch:kn}),Yn=e=>new Xn(e),Xn=class extends Et{constructor(e){super(e,Jn)}};function Zn({router:e,children:t,...n}){l(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=N(de.Provider,{value:e,children:t});return e.options.Wrap?N(e.options.Wrap,{children:r}):r}function Qn({router:e,...t}){return N(Zn,{router:e,...t,children:N(Kn,{})})}var $n=Ie.div`
4
- display: flex;
5
- align-items: center;
6
- justify-content: center;
7
- min-height: 100vh;
8
- padding: ${({theme:e})=>e.space(4)};
9
- text-align: center;
10
- `,er=Ie.p`
11
- font-size: 13px;
12
- color: ${({theme:e})=>e.color.inkDim};
13
- max-width: 48ch;
14
- `,tr=ce()({component:Un,notFoundComponent:()=>N($n,{children:P(fe,{$gap:3,style:{alignItems:`center`},children:[N(me,{children:`Not found`}),N(er,{children:`This console has no screen at that address.`}),N(pe,{as:`a`,href:`/`,$variant:`primary`,$size:`sm`,children:`Back to the rack`})]})})}),nr=`stream:console`,rr={"res:usage":{predicate:e=>e.queryKey[0]===`usage`||e.queryKey[0]===`client`&&(e.queryKey[1]===`usage`||e.queryKey[1]===`summary`)},"res:logs":{predicate:e=>e.queryKey[0]===`logs`&&e.queryKey[1]!==`body`||e.queryKey[0]===`client`&&e.queryKey[1]===`logs`||(e.queryKey[0]===`logPages`||e.queryKey[0]===`client`&&e.queryKey[1]===`logPages`)&&p(e.state.data)},"res:credentials":{queryKey:a.credentials},"res:keys":{queryKey:a.keys},"res:settings":{queryKey:a.settings},"res:models":{queryKey:a.models},"res:quota":{predicate:e=>e.queryKey[0]===`quota-history`||e.queryKey[0]===`credentials`&&e.queryKey[1]===`health`},[nr]:{queryKey:[`console`]}},ir=Object.keys(rr),ar=ir.filter(e=>e.startsWith(`res:`)),or=ir.filter(e=>e.startsWith(`stream:`));function sr(e,t){if(t===`res:*`){lr(e);return}let n=rr[t];n!==void 0&&e.invalidateQueries(n)}function cr(e){for(let t of ir)sr(e,t)}function lr(e){e.invalidateQueries()}var ur=4401,dr=500,fr=3e4,pr=new Set([...ar,...or]),mr=3,hr=6e4,gr=(e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)};function _r(){let{protocol:e,host:t}=window.location;return`${e===`https:`?`wss:`:`ws:`}//${t}/api/stream`}function vr(e){if(typeof e!=`string`)return null;let t;try{t=JSON.parse(e)}catch{return null}if(typeof t!=`object`||!t||Array.isArray(t))return null;let n=t,{type:r,topic:i,seq:a}=n;return typeof r!=`string`||i!==void 0&&typeof i!=`string`||a!==void 0&&typeof a!=`number`?null:{type:r,...typeof i==`string`?{topic:i}:{},...typeof a==`number`?{seq:a}:{},...`payload`in n?{payload:n.payload}:{}}}function yr(e){let t=new Set,n=new Set,r=new Map,i=new Map,a=new Map,o=e=>a.has(e)||pr.has(e),s=[],c=null,l=!1,u=!1,d=!1,f=!1,p=!1,m=0,h=null,g={status:`poll`,pushed:()=>!1};function _(){let e=p?`offline`:u&&!f?`push`:`poll`,r=e===`push`;g={status:e,pushed:e=>r&&n.has(e)};for(let e of t)e()}function v(e){c?.send(JSON.stringify(e))}function y(e,t){let n=i.get(e);if(n===void 0||n.size===0)return!1;for(let e of[...n])e(t);return!0}function b(){for(let e of ar)v({type:`subscribe`,topic:e});for(let e of or){let t=r.get(e);v(t===void 0?{type:`subscribe`,topic:e}:{type:`subscribe`,topic:e,sinceSeq:t})}for(let e of a.keys())v({type:`subscribe`,topic:e})}function x(){u=!0,m=0,n.clear(),d&&cr(e.client),d=!0,b(),_()}function S(t){let i=vr(t.data);if(i===null)return;let{topic:a}=i;if(i.type===`ack`){a!==void 0&&o(a)&&(n.add(a),y(a,{kind:`open`}),_());return}if(i.type===`error`){a!==void 0&&(n.delete(a)&&_(),y(a,{kind:`refused`}));return}if(a!==void 0){if(i.type===`gap`){i.seq!==void 0&&r.set(a,i.seq),y(a,{kind:`gap`}),sr(e.client,a);return}if(i.type===`event`){if(a===`res:*`){lr(e.client);return}if(i.seq!==void 0){let t=r.get(a);if(r.set(a,i.seq),t!==void 0&&i.seq>t+1){y(a,{kind:`gap`}),sr(e.client,a);return}}i.payload!==void 0&&y(a,{kind:`frame`,payload:i.payload})||sr(e.client,a)}}}function C(t){let r=u;u=!1,c=null,n.clear();for(let e of[...i.keys()])y(e,{kind:`closed`});if(l){if(t.code===ur){p=!0,l=!1,_(),lr(e.client);return}if(!r)f=!0;else{let t=e.now();s=[...s.filter(e=>e>t-hr),t],s.length>=mr&&(f=!0)}_(),w()}}function w(){let t=Math.min(fr,dr*2**m);m+=1,h=e.timer(()=>{h=null,l&&T()},t)}function T(){let t=new WebSocket(e.url());c=t,t.addEventListener(`open`,x),t.addEventListener(`message`,S),t.addEventListener(`close`,C)}function E(e,t){let n=i.get(e)??new Set;return i.set(e,n),n.add(t),()=>{n.delete(t),n.size===0&&i.delete(e)}}return{subscribe(e){return t.add(e),()=>{t.delete(e)}},snapshot:()=>g,hold(e,t){let r=E(e,t),i=(a.get(e)??0)+1;a.set(e,i),i===1&&u&&v({type:`subscribe`,topic:e}),n.has(e)&&t({kind:`open`});let o=!1;return()=>{if(o)return;o=!0,r();let t=(a.get(e)??1)-1;if(t>0){a.set(e,t);return}a.delete(e),n.delete(e)&&_(),u&&v({type:`unsubscribe`,topic:e})}},publish(e,t){return!u||!n.has(e)?!1:(v({type:`send`,topic:e,payload:t}),!0)},onStream:E,start(){return l=!0,T(),()=>{l=!1,h?.(),h=null;let e=c;c=null,u=!1,e?.close()}}}}var br=ke(null),xr=ke(null),Sr=ke(null),Cr={status:`poll`,pushed:()=>!1};function wr({children:e,enabled:t=!0,timer:n=gr,now:r=Date.now,url:i=_r}){let a=De(),[o]=Me(()=>yr({client:a,timer:n,now:r,url:i})),[s]=Me(()=>({subscribe:(e,t)=>o.hold(e,e=>{if(e.kind===`gap`){t({kind:`closed`});return}t(e)}),send:o.publish}));M(()=>{if(t)return o.start()},[o,t]);let c=Ne(o.subscribe,o.snapshot,o.snapshot);return N(br,{value:c,children:N(xr,{value:o.onStream,children:N(Sr,{value:s,children:e})})})}function Tr(){return Ae(br)??Cr}function Er(e,t){let n=Ae(xr),r=je(t);M(()=>{r.current=t}),M(()=>{if(n!==null)return n(e,e=>r.current(e))},[n,e])}function Dr(e,t){let n=Ae(Sr),r=je(t);M(()=>{r.current=t}),M(()=>{if(n!==null&&e!==null)return n.subscribe(e,e=>r.current(e))},[n,e])}function Or({children:e}){let t=Tr(),n=Ae(Sr);return N(be,{connection:t,...n===null?{}:{channels:n},children:e})}async function kr(e){return e.queryClient.ensureQueryData({queryKey:a.status,queryFn:()=>ge(`/api/status`),revalidateIfStale:!0})}function Ar(e){let t=e.principal;return e.authenticated!==!0||t==null?`/login`:t.kind===`client`?`/client`:t.kind===`admin`||t.kind===`viewer`?`/`:`/login`}function jr(e,t){let n=Ar(e);if(n===`/login`)throw ue({to:`/login`,search:{next:t}});if(n!==`/`)throw ue({to:n})}function Mr(e,t){let n=Ar(e);if(n===`/login`)throw ue({to:`/login`,search:{next:t}});if(n!==`/client`)throw ue({to:n})}var Nr=O(`/_app`)({beforeLoad:async({context:e,location:t})=>{jr(await kr(e),t.href),await e.queryClient.ensureQueryData(r)},pendingComponent:Pr,pendingMs:200,errorComponent:D(()=>k(()=>import(`./_app-Drf03PWk.js`),__vite__mapDeps([0,1])),`errorComponent`),component:Fr});function Pr(){return N(ve,{legend:`Console`,children:N(he,{rows:6})})}function Fr(){let e=s().data??[];return N(wr,{children:P(Or,{children:[N(xe,{$providers:e}),N(Se,{children:N(Un,{})})]})})}var Ir=O(`/client`)({beforeLoad:async({context:e,location:t})=>{Mr(await kr(e),t.href)},component:D(()=>k(()=>import(`./client-k1tkFSNH.js`),__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17])),`component`)}),Lr=O(`/login`)({validateSearch:e=>({...typeof e.next==`string`?{next:e.next}:{},...typeof e.reason==`string`?{reason:e.reason}:{}}),component:D(()=>k(()=>import(`./login-DW2Ipp21.js`),__vite__mapDeps([18,4,1,11,19])),`component`)}),Rr=O(`/_app/`)({component:D(()=>k(()=>import(`./_app.index-DigYfob3.js`),__vite__mapDeps([20,4,1,5,7,10,14,12,17])),`component`)}),zr=O(`/_app/accounts`)({component:D(()=>k(()=>import(`./_app.accounts-W1USUo2Q.js`),__vite__mapDeps([21,4,1,5,22,13,8,23,24,25,9,10,11,14,12,15,3])),`component`)}),Br=O(`/_app/console`)({component:D(()=>k(()=>import(`./_app.console-Co9d2ZiD.js`),__vite__mapDeps([26,4,1,5,11])),`component`)}),Vr=O(`/_app/database`)({component:D(()=>k(()=>import(`./_app.database-CtFJLcfE.js`),__vite__mapDeps([27,4,1,5,24,11,14,12,17,19])),`component`)}),Hr=O(`/_app/keys`)({component:D(()=>k(()=>import(`./_app.keys-B1fRMyU-.js`),__vite__mapDeps([28,4,1,5,22,13,8,23,25,9,10,11,14,12])),`component`)}),Ur=O(`/_app/logs`)({component:D(()=>k(()=>import(`./_app.logs-CFixPsUw.js`),__vite__mapDeps([29,4,1,5,6,7,8,9,10,11,12])),`component`)}),Wr=O(`/_app/models`)({component:D(()=>k(()=>import(`./_app.models-Dpl1O2RE.js`),__vite__mapDeps([30,4,1,5,23,24,25,9,10,11,14])),`component`)}),Gr=O(`/_app/settings`)({component:D(()=>k(()=>import(`./_app.settings-C3GzeJ4q.js`),__vite__mapDeps([31,4,1,5,25,9,11,14,19])),`component`)}),Kr=O(`/_app/usage`)({component:D(()=>k(()=>import(`./_app.usage-D2qlcEp4.js`),__vite__mapDeps([32,3,4,1,5,12,16,17])),`component`)}),qr=O(`/_app/plugins/$pluginId`)({component:D(()=>k(()=>import(`./_app.plugins._pluginId-BK0ADugW.js`),__vite__mapDeps([33,4,1,34,5])),`component`)}),$=Nr.update({id:`/_app`,getParentRoute:()=>tr}),Jr=Ir.update({id:`/client`,path:`/client`,getParentRoute:()=>tr}),Yr=Lr.update({id:`/login`,path:`/login`,getParentRoute:()=>tr}),Xr=Rr.update({id:`/`,path:`/`,getParentRoute:()=>$}),Zr={AppAccountsRoute:zr.update({id:`/accounts`,path:`/accounts`,getParentRoute:()=>$}),AppConsoleRoute:Br.update({id:`/console`,path:`/console`,getParentRoute:()=>$}),AppDatabaseRoute:Vr.update({id:`/database`,path:`/database`,getParentRoute:()=>$}),AppKeysRoute:Hr.update({id:`/keys`,path:`/keys`,getParentRoute:()=>$}),AppLogsRoute:Ur.update({id:`/logs`,path:`/logs`,getParentRoute:()=>$}),AppModelsRoute:Wr.update({id:`/models`,path:`/models`,getParentRoute:()=>$}),AppSettingsRoute:Gr.update({id:`/settings`,path:`/settings`,getParentRoute:()=>$}),AppUsageRoute:Kr.update({id:`/usage`,path:`/usage`,getParentRoute:()=>$}),AppIndexRoute:Xr,AppPluginsPluginIdRoute:qr.update({id:`/plugins/$pluginId`,path:`/plugins/$pluginId`,getParentRoute:()=>$})},Qr={AppRoute:$._addFileChildren(Zr),ClientRoute:Jr,LoginRoute:Yr},$r=tr._addFileChildren(Qr)._addFileTypes();function ei(e){return{isLoginRoute:()=>e().state.location.pathname===`/login`,onUnauthenticated:()=>void e().navigate({to:`/login`,search:{next:e().state.location.href}})}}function ti(e){let t=t=>{t instanceof _e&&t.isUnauthenticated&&(e.isLoginRoute()||e.onUnauthenticated())};return new Te({queryCache:new we({onError:t}),mutationCache:new Ce({onError:t}),defaultOptions:{queries:{retry:(e,t)=>t instanceof _e&&t.isUnauthenticated?!1:e<2,staleTime:5e3,refetchOnWindowFocus:!0},mutations:{retry:!1}}})}var ni,ri=ti(ei(()=>ni));ni=Yn({routeTree:$r,context:{queryClient:ri}});var ii=document.getElementById(`root`);if(ii===null)throw Error(`#root is missing from index.html`);Fe(ii).render(N(Oe,{children:N(ye,{children:N(Ee,{client:ri,children:N(Qn,{router:ni})})})}));export{Dr as a,sr as c,Or as i,Lr as n,Er as o,wr as r,nr as s,qr as t};
@@ -1 +0,0 @@
1
- import{A as e}from"./Rack-CEuCdVXc.js";var t={name:`plus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]};t.node;var n=e(t);export{n as t};