omnigateway 0.11.2 → 0.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/bin/omni.js +1533 -751
  2. package/gateway.js +2040 -1258
  3. package/package.json +2 -4
  4. package/public/assets/{Chip-77Q04h7S.js → Chip-roGX6zyg.js} +5 -1
  5. package/public/assets/CopyValue-FO5yNkRC.js +27 -0
  6. package/public/assets/{Field-56pmSGrh.js → Field-BYBri2NV.js} +1 -1
  7. package/public/assets/Lamp-DsUSnxN4.js +26 -0
  8. package/public/assets/{Panel-BV18WuL1.js → Panel-CWmOTDAP.js} +5 -0
  9. package/public/assets/Rack-CSpeYQ1D.js +483 -0
  10. package/public/assets/{Readout-Dxwka1JI.js → Readout-BTh732hP.js} +1 -1
  11. package/public/assets/{RequestTable-I395emqH.js → RequestTable-xpG3dPST.js} +1 -1
  12. package/public/assets/{SummaryDeck-pAZ93jBW.js → SummaryDeck-DwRGp7mB.js} +1 -1
  13. package/public/assets/{Toggle-y17mtXCV.js → Toggle-BTJVC9Se.js} +1 -1
  14. package/public/assets/TokenBreakdown-DT7or6C9.js +32 -0
  15. package/public/assets/{WindowChart-DWZtz4Ps.js → WindowChart-C-oJo3fW.js} +1 -1
  16. package/public/assets/{_app-0fHLZIC7.js → _app-Drf03PWk.js} +1 -1
  17. package/public/assets/{_app.accounts-DBlImnPw.js → _app.accounts-D8eynNaM.js} +12 -12
  18. package/public/assets/{_app.console-in_iVnep.js → _app.console-DbM7Zbgu.js} +1 -1
  19. package/public/assets/{_app.database-CPj-Juag.js → _app.database-Bj4UJUBZ.js} +7 -7
  20. package/public/assets/{_app.index-DGz9njXx.js → _app.index-2hdPR1Le.js} +1 -1
  21. package/public/assets/_app.keys-BYk7HsiW.js +92 -0
  22. package/public/assets/{_app.logs-C7BhBRjg.js → _app.logs-sG1w9y1i.js} +1 -1
  23. package/public/assets/_app.models-BqdGSdg4.js +148 -0
  24. package/public/assets/{_app.plugins._pluginId-Bx1LgcDj.js → _app.plugins._pluginId-Bf9D8Qiz.js} +1 -1
  25. package/public/assets/{_app.settings-s6K98CA2.js → _app.settings-TzCc7Sd3.js} +1 -1
  26. package/public/assets/{_app.usage-Bp45JtBe.js → _app.usage-XQHmzx-j.js} +1 -1
  27. package/public/assets/chevron-right-DgdKbG-g.js +1 -0
  28. package/public/assets/{client-Bl_FA5jI.js → client-B_g7bcxd.js} +1 -1
  29. package/public/assets/index-C_8ChaGY.js +14 -0
  30. package/public/assets/{login-Qc9iIepG.js → login-Dgd5jBoq.js} +1 -1
  31. package/public/assets/plus-UgaZwucC.js +1 -0
  32. package/public/assets/preload-helper-CvG2RSKd.js +1 -0
  33. package/public/assets/{shared-ChaZCaBz.js → shared-wEQ9LHZa.js} +1 -1
  34. package/public/assets/trash-IE0YvGCJ.js +1 -0
  35. package/public/index.html +5 -5
  36. package/public/shared/chunks/react-DK6rpPfu.js +1 -0
  37. package/public/shared/chunks/react-dom-Wr82bmbV.js +1 -0
  38. package/public/shared/dashboard-sdk.js +1 -1
  39. package/public/shared/react-dom-client.js +5 -5
  40. package/public/shared/react-dom.js +1 -1
  41. package/public/shared/react-query.js +1 -1
  42. package/public/shared/react.js +1 -1
  43. package/public/shared/styled-components.js +1 -1
  44. package/public/assets/CopyValue-DDJId-Zo.js +0 -27
  45. package/public/assets/Lamp-Drd1fFwQ.js +0 -25
  46. package/public/assets/Rack-D3iFlR6e.js +0 -482
  47. package/public/assets/TokenBreakdown-BIwuEVs8.js +0 -32
  48. package/public/assets/_app.keys-C-Fk39-U.js +0 -92
  49. package/public/assets/_app.models-BuiRrOrz.js +0 -148
  50. package/public/assets/chevron-right-BE-3EQR5.js +0 -1
  51. package/public/assets/index-nvJxJ9Gp.js +0 -13
  52. package/public/assets/plus-DhyoE7aH.js +0 -1
  53. package/public/assets/preload-helper-DYShfVEU.js +0 -1
  54. package/public/assets/trash-2-zGGJ7VE_.js +0 -1
  55. package/public/shared/chunks/react-GitiQ0dt.js +0 -1
  56. package/public/shared/chunks/react-dom-BFxyned6.js +0 -1
@@ -1,92 +0,0 @@
1
- import{Lt as e,M as t,Nt as n,Rt as r,Tt as i,bt as a,lt as o,w as s,zt as c}from"./Lamp-Drd1fFwQ.js";import{C as l,D as u,O as d,_ as f,a as p,b as m,i as h,o as g,r as _,t as v,v as y,w as b,x}from"./Panel-BV18WuL1.js";import{b as S,i as C,r as w,t as T,v as E}from"./Rack-D3iFlR6e.js";import{t as D}from"./CopyValue-DDJId-Zo.js";import{n as O,t as k}from"./chevron-right-BE-3EQR5.js";import{t as A}from"./plus-DhyoE7aH.js";import{t as j}from"./Toggle-y17mtXCV.js";import{t as M}from"./Chip-77Q04h7S.js";import{n as N,r as P,t as F}from"./Field-56pmSGrh.js";import{t as I}from"./Meter-stpt3vQu.js";import{i as L,n as R,r as z,t as ee}from"./Table-CVDZ69Zx.js";import{Fragment as B,useState as V}from"react";import{Fragment as H,jsx as U,jsxs as W}from"react/jsx-runtime";import G from"styled-components";var te=S(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v3`,key:`otl347`}],[`path`,{d:`M21 7.338V5a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2h2.338`,key:`7hb8p4`}],[`path`,{d:`M3 9h5.859`,key:`numkqi`}],[`path`,{d:`M8 2v3`,key:`1ioesn`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),ne=S(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]);function K(e,t){return e.revokedAt===null?s(e,t)?`active`:`expired`:`revoked`}function re(e){if(e===null)return``;let t=new Date(e-new Date(e).getTimezoneOffset()*6e4);return Number.isNaN(t.getTime())?``:t.toISOString().slice(0,16)}function q(e){let t=e.trim();if(t.length===0)return{at:null};let n=new Date(t).getTime();return Number.isFinite(n)?{at:n}:{problem:`"${e}" is not a date`}}var ie=G.p`
2
- font-size: 12px;
3
- color: ${({theme:e})=>e.color.down};
4
- `,ae=G.p`
5
- font-size: 12px;
6
- color: ${({theme:e})=>e.color.warn};
7
- `;function oe({apiKey:t,onOpenChange:n}){let r=e(),[i,a]=V(()=>re(t?.expiresAt??null)),[o,s]=V(null),c=()=>{if(t===null)return;let e=q(i);if(`problem`in e){s(e.problem);return}s(null),r.mutate({id:t.id,expiresAt:e.at},{onSuccess:()=>n(!1),onError:e=>s(g(e))})},d=t!==null&&K(t,Date.now())===`expired`;return U(C,{open:t!==null,onOpenChange:n,title:`Edit expiry`,description:t===null?void 0:`When "${t.label}" stops being accepted. Leave it blank for never.`,width:`480px`,footer:W(H,{children:[U(u,{type:`button`,onClick:()=>n(!1),children:`Cancel`}),U(u,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:c,children:r.isPending?`Saving…`:`Save expiry`})]}),children:W(l,{$gap:3,children:[d?U(ae,{role:`status`,children:`This key has expired and the gateway is refusing it. Moving the date forward, or clearing it, brings it back.`}):null,U(F,{label:`Expires`,hint:`Your local time. Blank means the key never expires; a date already past expires it now.`,children:e=>U(N,{...e,type:`datetime-local`,value:i,disabled:r.isPending,onChange:e=>a(e.target.value)})}),o===null?null:U(ie,{role:`alert`,children:o})]})})}var J=[{dimension:`requests`,window:`1m`},{dimension:`requests`,window:`5h`},{dimension:`requests`,window:`1w`},{dimension:`tokens`,window:`1m`},{dimension:`tokens`,window:`5h`},{dimension:`tokens`,window:`1w`},{dimension:`spend`,window:`5h`},{dimension:`spend`,window:`1w`},{dimension:`concurrency`,window:null}];function Y(e){return e.window===null?e.dimension:`${e.dimension}:${e.window}`}var se={requests:`Requests`,tokens:`Tokens`,spend:`Spend`,concurrency:`Concurrent`},ce={"1m":`per minute`,"5h":`per 5 hours`,"1w":`per week`};function X(e){let t=se[e.dimension];return e.window===null?t:`${t} ${ce[e.window]}`}function Z(e,t){return e===`spend`?`$${t<1?t.toFixed(4):t.toFixed(2)}`:t.toLocaleString(`en-US`)}function Q(e){return e.used===null||e.limit<=0?null:Math.max(0,e.used/e.limit)}function le(e){let t=null,n=-1;for(let r of e){let e=Q(r);e!==null&&e>n&&(t=r,n=e)}return t}function $(e){let t={};for(let e of J)t[Y(e)]=``;if(e===null)return t;for(let n of J){let r=n.window===null?e.concurrency:n.dimension===`requests`?e.requests?.[n.window]:n.dimension===`tokens`?e.tokens?.[n.window]:n.window===`1m`?void 0:e.spend?.[n.window];r!=null&&(t[Y(n)]=String(r))}return t}function ue(e){let t={},n={},r={},i;for(let a of J){let o=(e[Y(a)]??``).trim();if(o.length===0)continue;let s=Number(o),c=a.dimension===`spend`;if(!Number.isFinite(s)||s<=0||!c&&!Number.isInteger(s))return{problem:c?`${X(a)} must be an amount above zero, or blank for no limit.`:`${X(a)} must be a whole number above zero, or blank for no limit.`};a.window===null?i=s:a.dimension===`requests`?t[a.window]=s:a.dimension===`tokens`?n[a.window]=s:a.window!==`1m`&&(r[a.window]=s)}return{limits:{...Object.keys(t).length>0?{requests:t}:{},...Object.keys(n).length>0?{tokens:n}:{},...Object.keys(r).length>0?{spend:r}:{},...i===void 0?{}:{concurrency:i}}}}var de=G.div`
8
- display: grid;
9
- grid-template-columns: repeat(3, minmax(0, 1fr));
10
- gap: ${({theme:e})=>e.space(2)};
11
- `,fe=G.p`
12
- font-size: 11px;
13
- color: ${({theme:e})=>e.color.inkDim};
14
- `;function pe({draft:e,onChange:t,disabled:n=!1}){return W(l,{$gap:2,children:[U(de,{children:J.map(r=>{let i=Y(r);return U(F,{label:X(r),children:a=>U(P,{...a,min:r.dimension===`spend`?void 0:1,step:r.dimension===`spend`?`any`:1,disabled:n,value:e[i]??``,placeholder:`none`,onChange:n=>t({...e,[i]:n.target.value})})},i)})}),U(fe,{children:`Blank means no limit. Token and spend ceilings are debited after a response completes, so a key at its ceiling is refused on its next request rather than its current one. Concurrency counts requests in flight right now and resets when the gateway restarts.`})]})}var me=G.p`
15
- font-size: 12px;
16
- color: ${({theme:e})=>e.color.down};
17
- `,he=G.p`
18
- font-size: 12px;
19
- color: ${({theme:e})=>e.color.warn};
20
- `;function ge({apiKey:e,onOpenChange:t}){let n=r(),[i,a]=V(()=>$(e?.limits??{})),[o,s]=V(null);return U(C,{open:e!==null,onOpenChange:t,title:`Edit limits`,description:e===null?void 0:`What "${e.label}" may do per minute, per five hours, and per week. Every field is a ceiling; blank is no limit.`,width:`640px`,footer:W(H,{children:[U(u,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),U(u,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:()=>{if(e===null)return;let r=ue(i);if(`problem`in r){s(r.problem);return}s(null),n.mutate({id:e.id,limits:r.limits},{onSuccess:()=>t(!1),onError:e=>s(g(e))})},children:n.isPending?`Saving…`:`Save limits`})]}),children:W(l,{$gap:3,children:[e?.limits===null?U(he,{role:`status`,children:`The stored limits for this key cannot be read, so the gateway refuses it. Saving here replaces them.`}):null,U(pe,{draft:i,onChange:a,disabled:n.isPending}),o===null?null:U(me,{role:`alert`,children:o})]})})}var _e=G.div`
21
- display: flex;
22
- flex-direction: column;
23
- gap: 2px;
24
- max-height: 190px;
25
- overflow-y: auto;
26
- padding: ${({theme:e})=>e.space(1)};
27
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
28
- border-radius: ${({theme:e})=>e.radius.control};
29
- background: ${({theme:e})=>e.color.panelSunk};
30
- `,ve=G.label`
31
- display: flex;
32
- align-items: center;
33
- gap: ${({theme:e})=>e.space(2)};
34
- padding: 4px 6px;
35
- border-radius: 2px;
36
- cursor: pointer;
37
- font-family: ${({theme:e})=>e.font.mono};
38
- font-size: 12px;
39
-
40
- &:hover {
41
- background: ${({theme:e})=>e.color.panelRaised};
42
- }
43
- `,ye=G.p`
44
- font-size: 11px;
45
- color: ${({theme:e})=>e.color.inkDim};
46
- `;function be({configured:e,checked:t,onChange:n,disabled:r}){let i=[...new Set([...e,...t])].sort(),a=(e,r)=>{n(r?[...t,e]:t.filter(t=>t!==e))},o=t.filter(t=>!e.includes(t));return W(`div`,{children:[U(_e,{children:i.map(e=>W(ve,{children:[U(`input`,{type:`checkbox`,disabled:r,"aria-label":e,checked:t.includes(e),onChange:t=>a(e,t.target.checked)}),e]},e))}),o.length>0?U(ye,{children:`Some listed models are no longer configured. They stay until you clear them.`}):null,t.length===0?U(f,{children:`With nothing selected this key is allowed no model.`}):null]})}var xe=G.p`
47
- font-size: 12px;
48
- color: ${({theme:e})=>e.color.down};
49
- `;function Se({apiKey:e,onOpenChange:t}){let n=c(),r=i(),[a,o]=V(e?.modelAllowlist===null),[s,d]=V(()=>e?.modelAllowlist===null?[]:e?.modelAllowlist??[]),[p,h]=V(null),_=(r.data??[]).map(e=>e.id);return U(C,{open:e!==null,onOpenChange:t,title:`Edit models`,description:e===null?void 0:`Which models "${e.label}" may ask the gateway for. Sent whole on save.`,width:`640px`,footer:W(H,{children:[U(u,{type:`button`,onClick:()=>t(!1),children:`Cancel`}),U(u,{type:`button`,$variant:`primary`,disabled:n.isPending,onClick:()=>{e!==null&&(h(null),n.mutate({id:e.id,modelAllowlist:a?null:s},{onSuccess:()=>t(!1),onError:e=>h(g(e))}))},children:n.isPending?`Saving…`:`Save models`})]}),children:W(l,{$gap:3,children:[W(l,{$gap:2,children:[W(m,{$gap:2,children:[U(j,{checked:a,label:`Allow every model`,onCheckedChange:e=>{o(e),e&&d([])}}),U(f,{as:`span`,children:`Allow every model`})]}),a?null:U(be,{configured:_,checked:s,onChange:d,disabled:n.isPending})]}),p===null?null:U(xe,{role:`alert`,children:p})]})})}var Ce=G.div`
50
- display: grid;
51
- grid-template-columns: minmax(0, 11rem) minmax(0, 12rem) minmax(0, 1fr) minmax(0, 3.5rem);
52
- align-items: center;
53
- gap: ${({theme:e})=>e.space(2)} ${({theme:e})=>e.space(4)};
54
- `,we=G.span`
55
- font-size: 11.5px;
56
- color: ${({theme:e})=>e.color.inkDim};
57
- `,Te=G.p`
58
- font-size: 11px;
59
- color: ${({theme:e})=>e.color.inkDim};
60
- `;function Ee({label:e,readings:t}){return W(l,{$gap:3,children:[U(Ce,{children:t.map(t=>{let n=X({dimension:t.dimension,window:t.window}),r=Q(t),i=Z(t.dimension,t.limit);return W(B,{children:[U(f,{as:`span`,children:n}),U(y,{children:t.used===null?i:`${Z(t.dimension,t.used)} of ${i}`}),r===null?U(we,{children:`in flight now, counted in the gateway process`}):U(I,{fraction:Math.min(1,r),label:`${e}, ${n}, ${Math.round(r*100)}% used`}),U(y,{children:r===null?`—`:`${Math.round(r*100)}%`})]},n)})}),U(Te,{children:`Usage counts completed requests still inside each window. Requests in flight are added by the gateway itself and are not shown here.`})]})}var De=G.p`
61
- font-size: 12px;
62
- color: ${({theme:e})=>e.color.warn};
63
- `,Oe=G.p`
64
- font-size: 11px;
65
- color: ${({theme:e})=>e.color.inkDim};
66
- `,ke=G.p`
67
- font-size: 12px;
68
- color: ${({theme:e})=>e.color.down};
69
- `,Ae=G.p`
70
- font-size: 12px;
71
- color: ${({theme:e})=>e.color.inkDim};
72
- `,je=G(u)`
73
- gap: 4px;
74
- `;function Me({open:e,onOpenChange:t}){let n=i(),r=o(),[a,s]=V(``),[c,d]=V(!0),[p,h]=V([]),[_,v]=V(()=>$({})),[b,x]=V(!1),[S,w]=V(``),[T,E]=V(!1),[A,M]=V(null),[P,I]=V(null),L=()=>{s(``),d(!0),h([]),v($({})),x(!1),w(``),E(!1),M(null),I(null),r.reset()},R=e=>{e||L(),t(e)},z=Object.values(_).filter(e=>e.trim().length>0).length;return U(C,{open:e,onOpenChange:R,title:A===null?`Create an API key`:`Key created`,description:A===null?`Clients send this key as a bearer token or as x-api-key on every /v1 request.`:void 0,footer:A===null?W(H,{children:[U(u,{type:`button`,onClick:()=>R(!1),children:`Cancel`}),U(u,{type:`button`,$variant:`primary`,disabled:r.isPending,onClick:()=>{let e=ue(_);if(`problem`in e){x(!0),I(e.problem);return}let t=q(S);if(`problem`in t){I(t.problem);return}I(null),r.mutate({label:a.trim().length===0?`api key`:a.trim(),modelAllowlist:c?null:p,limits:e.limits,bodyLoggingOptOut:T,expiresAt:t.at},{onSuccess:e=>M(e),onError:e=>I(g(e))})},children:r.isPending?`Creating…`:`Create key`})]}):U(u,{type:`button`,$variant:`primary`,onClick:()=>R(!1),children:`I have copied the key`}),children:A===null?W(l,{$gap:3,children:[U(F,{label:`Label`,hint:`Names the client this key belongs to, e.g. laptop or CI.`,children:e=>U(N,{...e,value:a,placeholder:`api key`,onChange:e=>s(e.target.value)})}),W(l,{$gap:2,children:[W(m,{$gap:2,children:[U(j,{checked:c,label:`Allow every model`,onCheckedChange:d}),U(f,{as:`span`,children:`Allow every model`})]}),c?null:W(H,{children:[U(be,{configured:(n.data??[]).map(e=>e.id),checked:p,onChange:h}),p.length===0?U(De,{children:`With no model selected this key is allowed nothing and every request it makes will be refused.`}):null]})]}),W(l,{$gap:2,children:[W(m,{$gap:2,children:[W(je,{type:`button`,$size:`sm`,"aria-expanded":b,onClick:()=>x(e=>!e),children:[U(b?O:k,{}),`Limits`]}),U(f,{as:`span`,children:z===0?`no limits; this key is unbounded`:`${z} limit${z===1?``:`s`} set`})]}),b?U(pe,{draft:_,onChange:v}):null]}),U(F,{label:`Expires`,hint:`Optional. Your local time; blank means the key never expires.`,children:e=>U(N,{...e,type:`datetime-local`,value:S,onChange:e=>w(e.target.value)})}),W(l,{$gap:2,children:[W(m,{$gap:2,children:[U(j,{checked:T,label:`Never record this key's bodies`,onCheckedChange:E}),U(f,{as:`span`,children:`Never record this key's bodies`})]}),U(Oe,{children:`Suppresses body capture for this key whatever the gateway setting says. Choose it for a client whose payloads must not be retained. It cannot be changed after the key is created — issue a new key instead.`})]}),P===null?null:U(ke,{role:`alert`,children:P})]}):W(l,{$gap:3,children:[U(Ae,{children:`This is the only time the key is shown. The gateway keeps a hash, so a lost key has to be replaced rather than recovered.`}),U(D,{value:A.key,label:`Copy API key`}),W(m,{$gap:2,children:[U(f,{children:`Label`}),U(y,{children:A.label}),U(f,{children:`Prefix`}),U(y,{children:A.prefix})]})]})})}var Ne=G(m)`
75
- gap: 4px;
76
- flex-wrap: wrap;
77
- max-width: 34ch;
78
- `,Pe=G.span`
79
- color: ${({theme:e})=>e.color.inkFaint};
80
- `,Fe=G.span`
81
- display: block;
82
- font-size: 11px;
83
- color: ${({theme:e})=>e.color.inkDim};
84
- `,Ie=G.span`
85
- font-size: 11px;
86
- color: ${({theme:e})=>e.color.inkDim};
87
- `,Le=G.div`
88
- display: flex;
89
- flex-direction: column;
90
- align-items: flex-end;
91
- gap: 2px;
92
- `;function Re(e){if(e===null)return`usage not counted here`;let t=Q(e);return`${X({dimension:e.dimension,window:e.window})} ${Z(e.dimension,e.limit)}, ${t===null?`—`:Math.round(t*100)}% used`}function ze(){let e=a(),r=n(),[i,o]=V(!1),[s,c]=V(null),[l,g]=V(null),[y,S]=V(null),[C,D]=V(null),[j,N]=V(null),P=Date.now(),F=e.data??[],I=F.filter(e=>K(e,P)===`active`),G=e.isLoading?`Reading issued keys…`:F.length===0?`No keys exist, so nothing can call this gateway yet.`:`${I.length} active key${I.length===1?``:`s`} of ${F.length} ever issued.`;return W(H,{children:[U(T,{legend:`Keys`,title:`Gateway API keys`,summary:G,actions:W(u,{type:`button`,$variant:`primary`,onClick:()=>o(!0),children:[U(A,{}),`Create a key`]})}),U(v,{legend:`Issued keys`,meta:`${F.length}`,flush:!0,children:e.isError?U(h,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?U(`div`,{style:{padding:12},children:U(p,{rows:4})}):F.length===0?U(_,{legend:`No keys`,message:`Create a key and give it to a client. The key is shown once, at creation.`,action:U(u,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>o(!0),children:`Create a key`})}):U(x,{children:W(ee,{children:[U(`thead`,{children:W(`tr`,{children:[U(z,{children:`Label`}),U(z,{children:`Prefix`}),U(z,{children:`Allowed models`}),U(z,{$align:`right`,children:`Limits`}),U(z,{$align:`right`,children:`Created`}),U(z,{children:`Body capture`}),U(z,{children:`Status`}),U(z,{})]})}),U(`tbody`,{children:F.map(e=>{let n=C===e.id,r=le(e.limitUsage),i=K(e,P);return W(B,{children:[W(L,{children:[U(R,{children:U(b,{style:{maxWidth:`24ch`,display:`block`},children:e.label})}),W(R,{$mono:!0,children:[e.prefix,`…`]}),U(R,{children:e.modelAllowlist===null?U(f,{children:`every model`}):e.modelAllowlist.length===0?U(M,{$tone:`down`,children:`no models`}):U(Ne,{children:e.modelAllowlist.map(e=>U(M,{children:e},e))})}),U(R,{$align:`right`,children:e.limits===null?U(M,{$tone:`down`,children:`unreadable`}):e.limitUsage.length===0?U(f,{children:`no limits`}):W(Le,{children:[W(`span`,{children:[e.limitUsage.length,` limit`,e.limitUsage.length===1?``:`s`]}),U(Ie,{children:Re(r)})]})}),U(R,{$align:`right`,$mono:!0,children:t(e.createdAt)}),U(R,{children:e.bodyLoggingOptOut?U(M,{children:`no bodies`}):U(f,{children:`—`})}),W(R,{children:[i===`revoked`?U(Pe,{title:t(e.revokedAt??0),children:U(M,{children:`revoked`})}):i===`expired`?U(M,{$tone:`down`,children:`expired`}):U(M,{$tone:`ok`,children:`active`}),e.expiresAt===null?null:W(Fe,{children:[i===`expired`?`expired`:`expires`,` `,t(e.expiresAt)]})]}),U(R,{$align:`right`,children:W(m,{$gap:1,$justify:`flex-end`,children:[e.limitUsage.length===0?null:U(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-expanded":n,"aria-label":`${n?`Hide`:`Show`} limits for ${e.label}`,title:`${n?`Hide`:`Show`} limits for ${e.label}`,onClick:()=>D(n?null:e.id),children:U(n?O:k,{})}),e.revokedAt===null?W(H,{children:[U(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit models for ${e.label}`,title:`Edit models for ${e.label}`,onClick:()=>g(e),children:U(ne,{})}),U(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit limits for ${e.label}`,title:`Edit limits for ${e.label}`,onClick:()=>c(e),children:U(E,{})}),U(d,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Edit expiry for ${e.label}`,title:`Edit expiry for ${e.label}`,onClick:()=>S(e),children:U(te,{})}),U(u,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>N(e),children:`Revoke`})]}):null]})})]}),n?U(L,{children:U(R,{colSpan:8,children:U(Ee,{label:e.label,readings:e.limitUsage})})}):null]},e.id)})})]})})}),U(Me,{open:i,onOpenChange:o}),U(ge,{apiKey:s,onOpenChange:e=>{e||c(null)}},s?.id??`none`),U(Se,{apiKey:l,onOpenChange:e=>{e||g(null)}},l?.id??`none`),U(oe,{apiKey:y,onOpenChange:e=>{e||S(null)}},y?.id??`none`),U(w,{open:j!==null,onOpenChange:e=>{e||N(null)},title:`Revoke key`,body:j===null?``:`Revoking "${j.label}" refuses its next request. The key stays listed so past usage keeps its attribution, and it cannot be un-revoked.`,confirmLabel:`Revoke key`,busy:r.isPending,onConfirm:()=>{j!==null&&r.mutate(j.id,{onSettled:()=>N(null)})}})]})}var Be=ze;export{Be as component};
@@ -1,148 +0,0 @@
1
- import{D as e,Ot as t,Pt as n,Tt as r,U as i,Vt as a,ft as o,gt as s,vt as c}from"./Lamp-Drd1fFwQ.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-BV18WuL1.js";import{b as S,m as C,r as w,t as T}from"./Rack-D3iFlR6e.js";import{t as E}from"./plus-DhyoE7aH.js";import{t as D}from"./trash-2-zGGJ7VE_.js";import{t as O}from"./Toggle-y17mtXCV.js";import{n as ee,t as k}from"./Chip-77Q04h7S.js";import{i as A,n as j,r as M,t as N}from"./Field-56pmSGrh.js";import{t as P}from"./Meter-stpt3vQu.js";import{useEffect as te,useId as ne,useState as F}from"react";import{Fragment as I,jsx as L,jsxs as R}from"react/jsx-runtime";import z from"styled-components";var re=S(`play`,[[`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=S(`rotate-ccw`,[[`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`}]]),B=[`tier`,`health`,`quota`,`cost`,`latency`,`load`],ae={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`},oe=z.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
- `,se=z(b)`
9
- width: 22px;
10
- color: ${({theme:e})=>e.color.inkFaint};
11
- flex: none;
12
- `,ce=z(k)`
13
- border-color: ${({theme:e})=>e.color.ok};
14
- color: ${({theme:e})=>e.color.ok};
15
- background: ${({theme:e})=>e.color.okWash};
16
- `,le=z.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
- `,ue=z.div`
23
- display: flex;
24
- flex-direction: column;
25
- gap: 3px;
26
- min-width: 0;
27
- `,de=z.div`
28
- display: flex;
29
- align-items: baseline;
30
- justify-content: space-between;
31
- gap: 6px;
32
- `,fe=z.li`
33
- display: flex;
34
- align-items: center;
35
- gap: ${({theme:e})=>e.space(2)};
36
- padding: 5px 0;
37
- `,pe=z(h)`
38
- gap: ${({theme:e})=>e.space(3)};
39
- flex-wrap: wrap;
40
- `,V=z.label`
41
- display: flex;
42
- align-items: center;
43
- gap: 6px;
44
- cursor: pointer;
45
- font-size: 12.5px;
46
- `,me=z.p`
47
- font-size: 12px;
48
- color: ${({theme:e})=>e.color.down};
49
- `;function H(e,t,n){return(e[t]??0)*n[t]}function he({modelId:e}){let[t,n]=F({tools:!1,images:!1,reasoning:!1}),[r,i]=F(null),[o,s]=F(null),d=a(),m=c(),g=d.data?.weights,S=()=>{e!==null&&(s(null),m.mutate({modelId:e,need:t},{onSuccess:e=>i(e),onError:e=>{i(null),s(_(e))}}))},C=new Map(B.map(e=>[e,Math.max(1e-4,...(r?.candidates??[]).map(t=>g===void 0?0:Math.abs(H(t.reasons,e,g))))]));return L(y,{legend:`Explain`,meta:e??`no model selected`,actions:R(u,{type:`button`,$size:`sm`,$variant:`primary`,disabled:e===null||m.isPending,onClick:S,children:[L(re,{}),m.isPending?`Ranking…`:`Rank candidates`]}),children:R(l,{$gap:3,children:[R(l,{$gap:1,children:[L(p,{children:`Pretend the request needs`}),R(pe,{children:[R(V,{children:[L(O,{checked:t.tools,label:`Probe request uses tools`,onCheckedChange:e=>n({...t,tools:e})}),`Tools`]}),R(V,{children:[L(O,{checked:t.images,label:`Probe request includes an image`,onCheckedChange:e=>n({...t,images:e})}),`Images`]}),R(V,{children:[L(O,{checked:t.reasoning,label:`Probe request asks for reasoning`,onCheckedChange:e=>n({...t,reasoning:e})}),`Reasoning`]})]})]}),o===null?null:L(me,{children:o}),r===null?L(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.`}):R(l,{$gap:3,children:[R(h,{$gap:2,$wrap:!0,children:[L(k,{$tone:`accent`,children:r.strategy}),r.deterministic?null:L(k,{$tone:`warn`,children:`order varies per request`}),L(f,{}),R(p,{children:[r.candidates.length,` eligible · `,r.excluded.length,` filtered out`]})]}),r.candidates.length===0?L(v,{legend:`Nothing eligible`,message:`Every target was filtered out. The reasons below say which rule removed each one.`}):L(`ul`,{children:r.candidates.map((e,t)=>R(oe,{children:[R(h,{$gap:2,children:[L(se,{children:t+1}),L(ee,{provider:e.provider}),L(x,{style:{maxWidth:`22ch`},children:e.credentialLabel}),L(b,{$dim:!0,children:e.model}),R(k,{children:[`tier `,e.tier]}),L(f,{}),t===0?L(ce,{children:`would be used`}):null,L(b,{children:e.score.toFixed(2)})]}),g===void 0?null:L(le,{children:B.map(t=>{let n=H(e.reasons,t,g),r=C.get(t)??1;return R(ue,{title:ae[t],children:[R(de,{children:[L(p,{children:t}),L(b,{$dim:!0,$size:`10.5px`,children:n.toFixed(2)})]}),L(P,{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}`))}),r.excluded.length===0?null:R(l,{$gap:1,children:[L(p,{children:`Filtered out`}),L(`ul`,{children:r.excluded.map(e=>R(fe,{children:[L(b,{$dim:!0,children:e.model}),L(b,{$dim:!0,children:e.credentialId}),L(f,{}),L(k,{$tone:e.reason.startsWith(`capability`)?`warn`:`down`,children:e.reason})]},`${e.credentialId}:${e.model}:${e.reason}`))})]})]})]})})}function U(e,t,n){return i(e,t)?.models.find(e=>e.id===n)}function W(e,t,n){let r=i(e,t);return r===void 0?null:r.models.find(e=>e.id===n)?.auth??r.authTypes}var G=[{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.`}],K=0;function q(){return K+=1,`target-${K}`}function J(e,t,n){let r=U(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 ge(e,t,n){let r=U(e,t,n)?.limits;return r===void 0?null:{contextWindow:String(r.contextWindow),maxOutputTokens:String(r.maxOutputTokens)}}var _e={oauth:`OAuth`,apiKey:`an API key`};function Y(e){return e.map(e=>_e[e]).join(` or `)}function ve(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 X(e,t,n,r){let i=r[t];if(i===void 0||i.length===0)return!0;let a=W(e,t,n);return a===null||a.some(e=>i.includes(e))}function ye(e,t,n){let r=i(e,t);return r===void 0?[]:r.models.filter(r=>X(e,t,r.id,n))}function be(e,t,n,r){if(n.trim().length===0||X(e,t,n,r))return null;let i=r[t]??[];return`${t} serves this model to ${Y(W(e,t,n)??[])} only, and every ${t} account here is ${Y(i)}. Requests routed here will fail.`}function xe(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 Se(e,t,n){return e.length===0||n.length===0||xe(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 Ce(e,t){return{...e,endpointId:t,...t===e.endpointId?{}:{credentialId:``}}}function we(e,t,n){return{...t,...n,...J(e,n.provider,n.model)??{},...n.provider===t.provider?{}:{credentialId:``},contextWindow:``,maxOutputTokens:``}}function Te(e,t){let n=t??e[0]?.id??`anthropic`,r=i(e,n)?.defaultModel??``,a=J(e,n,r);return{key:q(),provider:n,endpointId:``,model:r,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 Ee(e){return{id:``,strategy:`score`,isAlias:!1,targets:[Te(e)]}}function De(e){return{id:e.id,strategy:e.strategy,isAlias:e.isAlias,targets:e.targets.map(e=>({key:q(),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 Oe(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 ke=z.fieldset`
50
- border: 1px solid ${({theme:e})=>e.color.rule};
51
- border-left: 3px solid ${({$provider:e})=>C(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
- `,Ae=z.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
- `,je=z.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=z.div`
75
- display: flex;
76
- flex-direction: column;
77
- gap: 4px;
78
- min-width: 0;
79
- `,Me=z(h)`
80
- gap: ${({theme:e})=>e.space(3)};
81
- flex-wrap: wrap;
82
- `,Ne=z.p`
83
- font-size: 11.5px;
84
- color: ${({theme:e})=>e.color.down};
85
- margin: 0;
86
- `,Q=z.label`
87
- display: flex;
88
- align-items: center;
89
- gap: 6px;
90
- cursor: pointer;
91
- `;function Pe({target:e,index:t,onChange:n,onRemove:r,removable:a,catalog:o,endpoints:s,held:c,credentials:m}){let g=ne(),_=i(o,e.provider),v=ye(o,e.provider,c),y=be(o,e.provider,e.model,c),b=xe(e,m),x=Se(e.credentialId,e,m),S=(t,r)=>{n({...e,[t]:r})},C=J(o,e.provider,e.model),w=ge(o,e.provider,e.model),T=t=>{n(we(o,e,t))};return R(ke,{$provider:e.provider,children:[R(h,{$gap:2,children:[R(p,{as:`legend`,children:[`Target `,t+1]}),L(f,{}),L(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:r,children:L(D,{})})]}),R(Ae,{children:[R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-provider`,children:`Provider`}),R(A,{id:`${g}-provider`,value:e.provider,onChange:t=>{let n=t.target.value,r=i(o,n),a=r?.models.some(t=>t.id===e.model)??!1;T({provider:n,model:a?e.model:r?.defaultModel??``})},children:[o.map(e=>L(`option`,{value:e.id,children:e.label},e.id)),_===void 0?R(`option`,{value:e.provider,children:[e.provider,` (not in the catalog)`]}):null]})]}),e.provider===`custom`?R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-endpoint`,children:`Endpoint`}),R(A,{id:`${g}-endpoint`,value:e.endpointId,onChange:t=>n(Ce(e,t.target.value)),children:[L(`option`,{value:``,children:`Choose endpoint`}),s.map(e=>L(`option`,{value:e.id,children:e.label},e.id))]})]}):null,R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-model`,children:`Provider model`}),L(j,{id:`${g}-model`,list:`${g}-catalog`,value:e.model,placeholder:_?.defaultModel??``,onChange:t=>T({provider:e.provider,model:t.target.value})}),L(`datalist`,{id:`${g}-catalog`,children:v.map(e=>L(`option`,{value:e.id,children:e.label},e.id))}),y===null?null:L(Ne,{role:`note`,children:y})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-tier`,children:`Tier`}),L(M,{id:`${g}-tier`,min:1,step:1,value:e.tier,onChange:e=>S(`tier`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-weight`,children:`Weight`}),L(M,{id:`${g}-weight`,min:0,step:.1,value:e.weight,onChange:e=>S(`weight`,e.target.value)})]})]}),L(l,{$gap:1,children:R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-account`,children:`Account`}),R(A,{id:`${g}-account`,value:e.credentialId,onChange:e=>S(`credentialId`,e.target.value),children:[L(`option`,{value:``,children:`Any account`}),b.map(e=>L(`option`,{value:e.id,children:e.label},e.id)),x===null?null:R(`option`,{value:e.credentialId,children:[e.credentialId,` (removed)`]})]}),x===null?null:L(Ne,{role:`note`,children:x})]})}),R(l,{$gap:1,children:[R(h,{$gap:2,children:[L(p,{children:`Price per million tokens`}),L(f,{}),C===null?L(p,{as:`span`,children:`not in the catalog — price it yourself`}):R(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:[L(ie,{}),`Use list price`]})]}),R(je,{children:[R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-in`,children:`Input`}),L(M,{id:`${g}-in`,min:0,step:.01,value:e.costInput,onChange:e=>S(`costInput`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-out`,children:`Output`}),L(M,{id:`${g}-out`,min:0,step:.01,value:e.costOutput,onChange:e=>S(`costOutput`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-cache`,children:`Cache read`}),L(M,{id:`${g}-cache`,min:0,step:.01,placeholder:`same as input`,value:e.costCacheRead,onChange:e=>S(`costCacheRead`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-write5m`,children:`Cache write 5m`}),L(M,{id:`${g}-write5m`,min:0,step:.01,placeholder:`1.25x input`,value:e.costCacheWrite5m,onChange:e=>S(`costCacheWrite5m`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-write1h`,children:`Cache write 1h`}),L(M,{id:`${g}-write1h`,min:0,step:.01,placeholder:`2x input`,value:e.costCacheWrite1h,onChange:e=>S(`costCacheWrite1h`,e.target.value)})]})]})]}),R(l,{$gap:1,children:[R(h,{$gap:2,children:[L(p,{children:`Token limits`}),L(f,{}),w===null?L(p,{as:`span`,children:`not in the catalog — state them yourself`}):L(p,{as:`span`,children:`left empty, the published figures are used — and for an OpenAI target, the narrower ones its OAuth backend allows`})]}),R(je,{children:[R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-context`,children:`Context window`}),L(M,{id:`${g}-context`,min:1,step:1024,placeholder:w?.contextWindow??`published`,value:e.contextWindow,onChange:e=>S(`contextWindow`,e.target.value)})]}),R(Z,{children:[L(p,{as:`label`,htmlFor:`${g}-maxout`,children:`Max output`}),L(M,{id:`${g}-maxout`,min:1,step:1024,placeholder:w?.maxOutputTokens??`published`,value:e.maxOutputTokens,onChange:e=>S(`maxOutputTokens`,e.target.value)})]})]})]}),R(l,{$gap:1,children:[L(p,{children:`Capabilities`}),R(Me,{children:[R(Q,{children:[L(O,{checked:e.tools,label:`Target ${t+1} supports tools`,onCheckedChange:e=>S(`tools`,e)}),`Tools`]}),R(Q,{children:[L(O,{checked:e.images,label:`Target ${t+1} supports images`,onCheckedChange:e=>S(`images`,e)}),`Images`]}),R(Q,{children:[L(O,{checked:e.reasoning,label:`Target ${t+1} supports reasoning`,onCheckedChange:e=>S(`reasoning`,e)}),`Reasoning`]})]})]})]})}var Fe=z.p`
92
- font-size: 11.5px;
93
- color: ${({theme:e})=>e.color.inkDim};
94
- `,Ie=z.p`
95
- font-size: 12px;
96
- color: ${({theme:e})=>e.color.down};
97
- `,Le=z.p`
98
- font-size: 12px;
99
- color: ${({theme:e})=>e.color.ok};
100
- `,Re=z(h)`
101
- gap: 8px;
102
- `;function ze({model:e,onSaved:r,onDeleted:i}){let a=t().data??[],[c,d]=F(()=>e===null?Ee(a):De(e)),[m,g]=F(null),[v,b]=F(!1),[x,S]=F(!1),C=n(),T=s(),D=o(),ee=ve(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;te(()=>{d(e===null?Ee(a):De(e)),g(null),b(!1)},[M]);let P=G.find(e=>e.id===c.strategy);return R(I,{children:[L(y,{legend:e===null?`New model`:`Edit model`,meta:e===null?void 0:e.id,actions:R(I,{children:[e===null?null:L(u,{type:`button`,$variant:`danger`,$size:`sm`,onClick:()=>S(!0),children:`Delete`}),L(u,{type:`button`,$variant:`primary`,$size:`sm`,disabled:C.isPending,onClick:()=>{b(!1);let e=Oe(c);if(!e.ok){g(e.problem);return}g(null),C.mutate(e.model,{onSuccess:()=>{b(!0),r(e.model.id)},onError:e=>g(_(e))})},children:C.isPending?`Saving…`:e===null?`Create model`:`Save changes`})]}),children:R(l,{$gap:3,children:[L(N,{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=>L(j,{...t,value:c.id,disabled:e!==null,placeholder:`fast`,onChange:e=>d({...c,id:e.target.value})})}),L(N,{label:`Routing strategy`,children:e=>L(A,{...e,value:c.strategy,onChange:e=>d({...c,strategy:e.target.value}),children:G.map(e=>L(`option`,{value:e.id,children:e.label},e.id))})}),P===void 0?null:L(Fe,{children:P.blurb}),R(Re,{children:[L(O,{checked:c.isAlias,label:`This model is an alias for a provider model name`,onCheckedChange:e=>d({...c,isAlias:e})}),R(l,{$gap:0,children:[L(p,{as:`span`,children:`Alias`}),L(Fe,{children:`Mark this when the name mirrors a provider's own model name.`})]})]}),R(l,{$gap:2,children:[R(h,{children:[L(p,{children:`Targets`}),L(f,{}),R(u,{type:`button`,$size:`sm`,onClick:()=>d({...c,targets:[...c.targets,Te(a,c.targets.at(-1)?.provider)]}),children:[L(E,{}),`Add target`]})]}),c.targets.map((e,t)=>L(Pe,{target:e,index:t,removable:c.targets.length>1,catalog:a,endpoints:k,held:ee,credentials:D.data??[],onChange:t=>d({...c,targets:c.targets.map(n=>n.key===e.key?t:n)}),onRemove:()=>d({...c,targets:c.targets.filter(t=>t.key!==e.key)})},e.key))]}),m===null?null:L(Ie,{role:`alert`,children:m}),v&&m===null?L(Le,{role:`status`,children:`Saved.`}):null]})}),L(w,{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),i()},onError:e=>{S(!1),g(_(e))}})}})]})}var Be=z.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
- `,Ve=z(l)`
112
- gap: ${({theme:e})=>e.space(4)};
113
- min-width: 0;
114
- `,He=z.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
- `,Ue=z(x)`
136
- font-family: ${({theme:e})=>e.font.mono};
137
- font-size: 12.5px;
138
- display: block;
139
- max-width: 100%;
140
- `,We=z.div`
141
- display: flex;
142
- gap: 2px;
143
- `,Ge=z.span`
144
- width: 12px;
145
- height: 3px;
146
- border-radius: 1px;
147
- background: ${({$provider:e})=>C(e)};
148
- `,$=`\0new`;function Ke(){let e=r(),[t,n]=F(null),i=e.data??[],a=t===$?null:i.find(e=>e.id===t)??null,o=t===$||t===null&&!e.isLoading&&i.length===0;te(()=>{t===null&&i.length!==0&&n(i[0]?.id??null)},[i,t]);let s=e.isLoading?`Reading configured models…`:i.length===0?`No virtual models exist yet, so no client request can resolve to an upstream.`:`${i.length} model${i.length===1?``:`s`} routing to ${i.reduce((e,t)=>e+t.targets.length,0)} targets.`;return R(I,{children:[L(T,{legend:`Models`,title:`Virtual models`,summary:s,actions:R(u,{type:`button`,$variant:`primary`,onClick:()=>n($),children:[L(E,{}),`New model`]})}),R(Be,{children:[L(y,{legend:`Configured`,meta:`${i.length}`,flush:!0,children:e.isError?L(g,{error:e.error,onRetry:()=>void e.refetch()}):e.isLoading?L(`div`,{style:{padding:12},children:L(m,{rows:4})}):i.length===0?L(v,{legend:`No models`,message:`Create a model to give clients something to ask for.`,action:L(u,{type:`button`,$size:`sm`,$variant:`primary`,onClick:()=>n($),children:`New model`})}):L(`div`,{children:i.map(e=>{let r=[...new Set(e.targets.map(e=>e.provider))];return R(He,{type:`button`,$selected:e.id===t,"aria-pressed":e.id===t,onClick:()=>n(e.id),children:[R(h,{$gap:2,style:{width:`100%`},children:[L(Ue,{title:e.id,children:e.id}),L(f,{}),e.isAlias?L(k,{children:`alias`}):null]}),R(h,{$gap:2,style:{width:`100%`},children:[L(We,{children:r.map(e=>L(Ge,{$provider:e,title:e},e))}),L(p,{children:e.strategy}),L(f,{}),R(b,{$dim:!0,$size:`11px`,children:[e.targets.length,` target`,e.targets.length===1?``:`s`]})]})]},e.id)})})}),R(Ve,{children:[a===null&&!o?L(y,{legend:`Editor`,children:e.isLoading?L(m,{rows:5}):L(v,{legend:`Nothing selected`,message:`Pick a model on the left to change its targets, or create a new one.`})}):L(ze,{model:a,onSaved:t=>{n(t),e.refetch()},onDeleted:()=>{n(null),e.refetch()}}),L(he,{modelId:a?.id??null})]})]})]})}var qe=Ke;export{qe as component};
@@ -1 +0,0 @@
1
- import{b as e}from"./Rack-D3iFlR6e.js";var t=e(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),n=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t as n,n as t};
@@ -1,13 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app-0fHLZIC7.js","assets/Panel-BV18WuL1.js","assets/client-Bl_FA5jI.js","assets/shared-ChaZCaBz.js","assets/Lamp-Drd1fFwQ.js","assets/Rack-D3iFlR6e.js","assets/chevron-right-BE-3EQR5.js","assets/Field-56pmSGrh.js","assets/Meter-stpt3vQu.js","assets/Table-CVDZ69Zx.js","assets/WindowChart-DWZtz4Ps.js","assets/RequestTable-I395emqH.js","assets/TokenBreakdown-BIwuEVs8.js","assets/Chip-77Q04h7S.js","assets/SummaryDeck-pAZ93jBW.js","assets/Readout-Dxwka1JI.js","assets/login-Qc9iIepG.js","assets/reasons-Du1OBWAM.js","assets/_app.index-DGz9njXx.js","assets/_app.accounts-DBlImnPw.js","assets/CopyValue-DDJId-Zo.js","assets/plus-DhyoE7aH.js","assets/trash-2-zGGJ7VE_.js","assets/Toggle-y17mtXCV.js","assets/_app.console-in_iVnep.js","assets/_app.database-CPj-Juag.js","assets/_app.keys-C-Fk39-U.js","assets/_app.logs-C7BhBRjg.js","assets/_app.models-BuiRrOrz.js","assets/_app.settings-s6K98CA2.js","assets/_app.usage-Bp45JtBe.js","assets/_app.plugins._pluginId-Bx1LgcDj.js","assets/preload-helper-DYShfVEU.js"])))=>i.map(i=>d[i]);
2
- import{$t as e,En as t,G as n,H as r,On as i,Ot as a,Sn as o,Tn as s,Zt as c,_n as l,bn as u,cn as d,dn as f,en as p,fn as m,gn as h,hn as g,in as _,ln as v,nn as y,on as b,pn as x,rn as S,sn as C,tn as w,un as T,vn as E,wn as D,xn as ee,yn as te}from"./Lamp-Drd1fFwQ.js";import{a as ne,c as re,i as ie,n as O,o as ae,r as k,s as oe,t as A}from"./preload-helper-DYShfVEU.js";import{A as se,C as ce,D as le,_ as ue,a as de,k as j,l as fe,s as pe,t as me}from"./Panel-BV18WuL1.js";import{g as he,h as ge,n as _e,p as ve}from"./Rack-D3iFlR6e.js";import{MutationCache as ye,QueryCache as be,QueryClient as xe,QueryClientProvider as Se,useQueryClient as Ce}from"@tanstack/react-query";import*as M from"react";import{StrictMode as we,createContext as Te,use as Ee,useEffect as N,useRef as De,useState as Oe,useSyncExternalStore as ke}from"react";import{Fragment as Ae,jsx as P,jsxs as F}from"react/jsx-runtime";import{createRoot as je}from"react-dom/client";import Me 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 I(e){return e?.isNotFound===!0}function Ne(){try{return sessionStorage}catch{return}}var Pe=`tsr-scroll-restoration-v1_3`,Fe=Ne();function Ie(){try{return JSON.parse(Fe?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Le(){try{Fe?.setItem(Pe,JSON.stringify(L))}catch{}}var L=Ie(),Re=`data-scroll-restoration-id`,ze=e=>e.state.__TSR_key||e.href;function Be(e){let t=e.getAttribute(Re);if(t)return`[${Re}="${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 Ve=!1,He=`window`;function Ue(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function We(e){let t=new Set;for(let n of e){if(n===He)continue;let e=Ue(n);e&&t.add(e)}return t}function Ge(e,t){let n=t??e.options.scrollRestoration,r=e._scroll;n&&(r.restoring=!0);let i=e.options.getScrollRestorationKey||ze,a=new Set,o=e=>{let t=L[e]||={};for(let e of a)e===document?t[He]={scrollX,scrollY}:e.isConnected&&(t[Be(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,Ve=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{Ve||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())),Le()})),!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=L[d];if(e){let t=L[u];for(let n in e){if(n===He){if(s)continue}else{let e=Ue(n);if(!e||s&&o&&(l??=We(o),l.has(e)))continue}t||=L[u]={},t[n]??=e[n]}}}Ve=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=We(o));let t=e&&i&&c,s=r.restoring?L[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===He){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=Ue(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{Ve=!1}}))}function Ke(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function qe(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Je(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]=qe(r):Array.isArray(t)?t.push(qe(r)):n[e]=[t,qe(r)]}return n}var Ye=/^(?:\s|["[{\d-]|fa|nu|tr)/,Xe=Qe(JSON.parse),Ze=$e(JSON.stringify,JSON.parse);function Qe(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Je(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function $e(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&&!Ye.test(r))return r;try{return t(r),e(r)}catch{}}return r}return e=>{let t=Ke(e,r);return t?`?${t}`:``}}function et(e){return{input:({url:t})=>{for(let n of e)t=nt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=rt(e[n],t);return t}}}function tt(e){let t=_(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=y([`/`,t,e.pathname]),e)}}function nt(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 rt(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 it(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())),d=r(()=>({status:o.get(),isLoading:o.get()===`pending`,matches:u.get(),location:s.get(),resolvedLocation:c.get()}));function f(e){let t=a.get(e);return t||(t=n(void 0),a.set(e,t)),t}let p={status:o,location:s,resolvedLocation:c,ids:l,matches:u,byRoute:a,__store:d,getMatchStore:f,setMatches:m};function m(e){let t=l.get(),n=e.map(e=>e.routeId);i(()=>{h(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=f(t.routeId);e.get()!==t&&e.set(t)}})}return p}var R=`__TSR_index`,at=`popstate`,ot=`beforeunload`;function st(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=dt(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[R];i=ct(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[R];i=ct(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),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[R]!==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}}function ct(e,t){t||={};let n=ft();return{...t,key:n,__TSR_key:n,[R]:e}}function lt(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=e?.createHref??(e=>e),c=e?.parseLocation??(()=>dt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=ft();t.history.replaceState({[R]: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=(e,t,n)=>{let r=s(t),i=!!g;i||(u=l),l=dt(t,n),g=[r,n,g?.[2]||e],i||queueMicrotask(()=>_())},y=e=>{l=c(),S.notify({type:e})},b=async()=>{if(f){f=!1;return}let e=c(),n=e.state[R]-l.state[R],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 n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),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=st({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=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:_,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(ot,x,{capture:!0}),t.removeEventListener(at,b)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(ot,x,{capture:!0}),t.addEventListener(at,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 ut(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function dt(e,t){let n=ut(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=ft();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||{[R]:0,key:a,__TSR_key:a}}}function ft(){return(Math.random()+1).toString(36).substring(7)}function pt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function mt(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function ht({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function gt(e,t,n,r){for(let i of t){if(r&&e._tx!==r)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r&&e._tx!==r)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var _t=class{constructor(e,n){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=p(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:lt()),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=x(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=it(this.latestLocation,e),Ge(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=_(a);t&&t!==`/`&&e.push(tt({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:et(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=m(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&f(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=(e,n)=>{let r=({pathname:e,search:r,hash:i,href:a,state:o})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let a=this.options.parseSearch(r),c=this.options.stringifySearch(a);return{href:e+c+i,publicHref:e+c+i,pathname:l(e).path,external:!1,searchStr:c,search:s(n?.search,a),hash:l(i.slice(1)).path,state:t(n?.state,o)}}let c=new URL(a,this.origin),u=nt(this.rewrite,c),d=this.options.parseSearch(u.search),f=this.options.stringifySearch(d);return u.search=f,{href:u.href.replace(u.origin,``),publicHref:a,pathname:l(u.pathname).path,external:!!this.rewrite&&u.origin!==this.origin,searchStr:f,search:s(n?.search,d),hash:l(u.hash.slice(1)).path,state:t(n?.state,o)}},i=r(e),{__tempLocation:a,__tempKey:o}=i.state;if(a&&(!o||o===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=v(b(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),[n?.branch||[this.routesById.__root__],t,n?.route]},this.buildLocation=e=>{let n=(n={})=>{if(n.href){let e=dt(n.href,{});n={...n,to:nt(this.rewrite,new URL(e.pathname,this.origin)).pathname,search:this.options.parseSearch(e.search),hash:e.hash.slice(1)}}let r=n._fromLocation||this._pendingLocation||this.latestLocation,i=this.matchRoutesLightweight(r);n.from;let a=n.unsafeRelative===`path`?r.pathname:n.from??i[1],o=i[2],c=i[3],d=this.resolvePathWithBase(a,n.to?`${n.to}`:`.`),f=Ct(n.params,c),p=this.routesByPath[b(d)],m;if(p)m=this.getRouteBranch(p);else if(d.includes(`$`))m=[];else{let[e,t,n]=this.getMatchedRoutes(d);m=e,this.options.notFoundRoute&&(!n||n.path!==`/`&&t[`**`])&&(m=[...m,this.options.notFoundRoute])}if(m.length&&ee(f))for(let e of m){let t=e.options.params?.stringify??e.options.stringifyParams;if(t){f===c&&(f=Object.assign(Object.create(null),f));try{Object.assign(f,t(f))}catch{}}}let h=e.leaveParams?d:l(w({path:d,params:f,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,g=o;if(e._includeValidateSearch&&this.options.search?.strict){let e={};m.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,bt(t.options.validateSearch,{...e,...g}))}catch{}}),g=e}g=xt(g,n,m,e._includeValidateSearch),g=s(o,g);let _=this.options.stringifySearch(g),v=n.hash===!0?r.hash:n.hash?u(n.hash,r.hash):void 0,y=v?`#${v}`:``,x=n.state===!0?r.state:n.state?u(n.state,r.state):{};n.state&&(x=t(r.state,x));let S=`${h}${_}${y}`,C,T,E=!1;if(this.rewrite){let e=new URL(S,this.origin),t=rt(this.rewrite,e);C=e.href.replace(e.origin,``),t.origin===this.origin?T=t.pathname+t.search+t.hash:(T=t.href,E=!0)}else C=te(S),T=C;return{publicHref:T,href:C,pathname:h,search:g,searchStr:_,state:x,hash:v??``,external:E,unmaskOnReload:n.unmaskOnReload}},r=n(e);if(e.mask)r.maskedLocation=n({from:e.from,...e.mask});else if(this.options.routeMasks){let t=d(r.pathname,this.processedTree);if(t){let i=Object.assign(Object.create(null),t.rawParams),{from:a,params:o,...s}=t.route,c=Ct(o,i);r.maskedLocation=n({from:e.from,...s,params:c})}}return r},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=b(this.latestLocation.href)===b(n.href)&&E(ht(n.state),ht(this.latestLocation.state)),a=this._commitPromise,o,s=new Promise(e=>{o=e});if(s.resolve=()=>{o(),a?.resolve()},this._commitPromise=s,i)this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.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,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t}),this.history.subscribers.size||this.load({action:{type:r}})}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:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(o(t,this.protocolAllowlist))return;if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return}i.replace?window.location.replace(t):window.location.href=t;return}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.load=async e=>{this.updateLatestLocation(),e?.action&&(this._scroll.hash=e.action.type===`PUSH`||e.action.type===`REPLACE`),await rn(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(mt(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`)&&pt(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 t=e.headers.get(`Location`);if(!e.options.href){let t=this.buildLocation(e.options).publicHref||`/`;e.options.href=t,e.headers.set(`Location`,t)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&o(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),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=z,this.preloadRoute=e=>an(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=T(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!E(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?E(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=n,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??Ze,parseSearch:e.parseSearch??Xe,protocolAllowlist:e.protocolAllowlist??g}),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=C(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,n){let[r,i,a]=this.getMatchedRoutes(e.pathname),o=r,c=!1;(a?a.path!==`/`&&i[`**`]:b(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:c=!0);let l=c?St(this.options.notFoundMode,o):void 0,u=Array(o.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 r=0;r<o.length;r++){let a=o[r],c=u[r-1],d,m,h;{let t=c?.search??e.search,r=c?._strictSearch??void 0;try{let e=bt(a.options.validateSearch,{...t})??void 0;d={...t,...e},m={...r,...e}}catch(e){let r=e;if(e instanceof vt||(r=new vt(e.message,{cause:e})),n?.throwOnError)throw r;d=t,m={},h=r}}let g=``,_=``;try{g=a.options.loaderDeps?.({search:d})??``,_=g&&JSON.stringify(g)||``}catch(e){if(n?.throwOnError)throw e;h??=e}let{interpolatedPath:v,usedParams:y}=w({path:a.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),b=a.id+v+_,x=f(a,r),S=this._cache.get(b)??(x?.id===b?x:void 0);p=S?._strictParams??Object.assign(y,p);let C;if(!S)try{wt(a,p)}catch(e){if(C=I(e)||ae(e)?e:new yt(e.message,{cause:e}),n?.throwOnError)throw C}let T=x?`stay`:`enter`,E;if(S)E={...S,cause:T,search:s(x?x.search:S.search,d),_strictSearch:m,searchError:h};else{let e=pt(a)?`pending`:`success`;E={id:b,ssr:a.options.ssr,index:r,routeId:a.id,params:x?.params??p,_strictParams:p,pathname:v,updatedAt:Date.now(),search:x?s(x.search,d):d,_strictSearch:m,searchError:h,status:e,isFetching:!1,error:void 0,paramsError:C,context:{},abortController:n?._controller??new AbortController,cause:T,loaderDeps:x?t(x.loaderDeps,g):g,invalid:!1,preload:!1,staticData:a.options.staticData||{},fullPath:a.fullPath}}let D=l===a.id;E._notFound&&!D&&(E.error=void 0),E._notFound=D,u[r]=E}for(let e=0;e<u.length;e++){let t=u[e];t.params=t.cause===`stay`?s(t.params,p):p,n?._controller&&(t.context={})}return u}matchRoutesLightweight(e){let t=D(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=D(a),c={...e.search};for(let e of a)try{Object.assign(c,bt(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{wt(t,e)}catch{}u=e}let d=[a,s.fullPath,c,u];return this.lightweightCache.set(e,[r,d]),d}},vt=class extends Error{},yt=class extends Error{};function bt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new vt(`Async validation not supported`);if(n.issues)throw new vt(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 xt(e,t,n,r){let i=[];for(let e of n){let t=e.options;`search`in t?t.search?.middlewares&&i.push(...t.search.middlewares):(t.preSearchFilters||t.postSearchFilters)&&i.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;r&&n&&i.push(({search:e,next:t,meta:r})=>{let i=t(e);try{let e=bt(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 a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=u(t.search,n);return r&&(r.explicit=e),e}return i[e]({search:n,next:(t,n)=>{if(n){let n=r||{};return{search:a(e+1,t,n),meta:n}}return a(e+1,t,r)},meta:r})};return a(0,e)}function St(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 re}function Ct(e,t){if(e===!1||e===null)return Object.create(null);if((e??!0)===!0)return t;let n=Object.assign(Object.create(null),t);return Object.assign(n,u(e,n))}function wt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Tt(e,t){return e.options[t]?.preload?.()}function Et(e,t){let n=Tt(e,`component`),r=Tt(e,`pendingComponent`);return t&&(r?r=r.then(t):t()),n&&r?Promise.all([n,r]).then(()=>{}):n??r}function z(e,t,n){let r=()=>t===!1?void 0:t?Tt(e,t):Et(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 Dt(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var B=0,V=1,Ot=2,H=3,U=[4];function W(e){return typeof e[0]==`number`}function G(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).finally(()=>t.removeEventListener(`abort`,i))})}function K(e,t){return e.routesById[t.routeId]}function kt(e,t,n){return ae(e)?[H,e]:I(e)?(e.routeId||=n,[Ot,e]):t?(typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),[V,e]):[B,e]}function At(e,t){let n=kt(t,!0,e.id);if(n[0]!==V)return n;try{e.options.onError?.(n[1])}catch(t){n=kt(t,!0,e.id)}return n}function jt(e,t,n,r,i){return i[0].signal.aborted?U:Wt(e,t,n,At(n,r),i)}async function Mt(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=K(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,jt(e,t,u,a,n)]}if(c.aborted)return[i,U];let p=r.paramsError??r.searchError;if(p!==void 0)return q(e,r),[i,jt(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{Ft(e,r,`beforeLoad`,n[0]);let a=await G(m({...f,search:r.search,context:r.context,...e.options.additionalContext}),c);if(c.aborted)return[i,U];let o=Wt(e,t,u,kt(a,!1,u.id),n);if(o[0]!==B)return q(e,r),[i,o];r.context={...r.context,...a}}catch(a){return q(e,r),[i,jt(e,t,u,a,n)]}finally{r.status=h,Ft(e,r,!1,n[0])}}i()}function Nt(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,Nt(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=Nt(e,a,t);n&&i.push(n)}}for(let e of i)e.abort()}function Pt(e){for(let t of e){let e=t._flight;e&&e[2]++}}function Ft(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 It(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 Lt(e,t,n,r,i,a,o){let s=o[0],c=s.signal;if(c.aborted)return U;if(!i)return[B,void 0];let l=n._flight;Ft(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(It(e,t,n,r,s,a,!!o[3]))).then(e=>kt(e,!1,r.id),e=>kt(e,!0,r.id)).then(t=>(t[0]!==B&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===V&&l[2]?At(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],Wt(e,t,r,await G(l[0],c),o)}catch(t){if(t!==c||!c.aborted)throw t;return q(e,n),U}finally{Ft(e,n,!1,s)}}function Rt(e,t,n){t[0]!==H&&(e.status=`success`,e.error=void 0,t[0]===B?(e.loaderData=t[1],e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):e.invalid=!0)}function zt(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 Bt(e,t){return t[0]===V||t[0]===Ot?{...e,status:t[0]===V?`error`:`notFound`,error:t[1],_flight:void 0}:e}function Vt(e,t,n,r,i,a,o){let s=t[1][n],c=K(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(It(e,t,s,c,a[0],i,l))),a[0].signal.aborted&&(p=U)),!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=jt(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,Nt(e,s,t)?.abort(),n>=o&&(s.status=`pending`),S?.()}b||(s.isFetching=!1);let w=(p?Promise.resolve(p):x?Lt(e,t,s,c,g,i,a):Promise.resolve([B,s.loaderData])).then(t=>(x&&(Rt(s,t,l),t[0]===B&&(m&&!a[0].signal.aborted&&zt(e,s,u),n>=o&&(s.status=`pending`))),t)),T=G(Promise.resolve().then(()=>z(c,void 0,C)),a[0].signal).then(()=>void 0,r=>t[1].some((e,t)=>t<=n&&(e.status===`error`||e.status===`notFound`||e._notFound))?void 0:[n,jt(e,t,c,r,a)]).then(e=>w.then(t=>(x&&!e&&t[0]===B&&s.status===`pending`&&!a[0].signal.aborted&&(s.status=`success`,S?.()),e)));if(r.push([n,w,T]),!y)return w.then(e=>Bt(s,e));let E={...s,status:`pending`,preload:!1,_flight:v};s.invalid=!1,s.isFetching=`loader`;let D=Lt(e,t,E,c,g,i,a).then(e=>(s.isFetching=!1,Rt(E,e,!1),e));return(t[2]??=[]).push([n,D,T,E]),D.then(e=>Bt(E,e))}async function Ht(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=K(e,t[n]);try{let e=z(i,!1);e&&await G(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 Ut(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]>=H)throw[a,t];!i&&t[0]!==B&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===H)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}function Wt(e,t,n,r,i,a){for(;r[0]===H;){let o=r[1],s=o.options;if(s.reloadDocument?i[3]:i[1]>=20)return r;try{return s.href&&s.reloadDocument?(e.resolveRedirect(o),r):[H,o,e.buildLocation({...s,_fromLocation:t[0],_includeValidateSearch:!0})]}catch(e){r=a?[V,e]:At(n,e),a=!0}}return r}async function Gt(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]===Ot?Ht(e,o,t,r.signal):t[0],d=l<0?o.length:l;if((s?.[1][0]??0)>=H)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]!==B&&t[0]<H&&!(`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)>=H){let n=s[1];if(n[0]!==H||n[1].options.reloadDocument||n[2])return Y(e,t),n;c=!0,s=[0,[V,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===V?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=K(e,u);try{await G(i?Promise.resolve().then(()=>z(m,l===V?`errorComponent`:`notFoundComponent`)):Promise.all([z(m),z(m,`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal&&r.signal.aborted)return Y(e,t),U}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 Kt(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=K(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 G(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 qt(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 Ht(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`||i._notFound||e.preload||a?.id!==e.id||a.status!==`success`||a._notFound)break;l++}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=Vt(e,i,t,u,f,r,l)},m=await Mt(e,i,r,c,p,l);if(m){if(r[4]=!0,c=m[0],m[1][0]===Ot){let t=await Ht(e,n,m,a);m[2]=t,c=Math.min(c,t+1)}else m[1][0]>=H&&(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=Gt(e,i,u,r[0],Ut(u,m,i[2]),r[7]);i[2]?.length&&(i[3]=Ut(i[2],void 0,void 0,h.then(e=>W(e)?0:Dt(n).length,()=>0))),o=await h}catch(t){if(Y(e,i),t===a&&a.aborted)return U;throw t}return W(o)?o:Kt(e,o,a,r[6]===n.length?r[6]:0)}function Jt(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=K(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(()=>Jt(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 Yt(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 Xt(e,t){let n=e._pending;if(!n)return;clearTimeout(n[3]);let r=n[2]-Date.now();if(!n[4]||r<=0||!Dt(t[3]).some(e=>e.id===n[1]))return;let i;try{await G(new Promise(e=>{i=setTimeout(e,r)}),t[0].signal)}catch{}clearTimeout(i)}function Zt(e,t){e._committed=t,e.stores.setMatches(t)}function Qt(e,t,n,r){let i=e._committed,a=e._cache;for(let e of n)e.preload=!1,r&&(e._assetEnd=void 0);let o=Dt(n).length,s=new Map;{let t=Date.now();for(let r of[...i,...a.values()]){if(r.status!==`success`||n.some((e,t)=>e.id===r.id&&(t<o||e.status===`success`)))continue;let i=K(e,r);!i.options.loader||t-r.updatedAt>=(r.preload?i.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:i.options.gcTime??e.options.defaultGcTime??3e5)||s.set(r.id,a.get(r.id)===r?r:{...r,_flight:void 0,isFetching:!1,context:{}})}}t[3]=[],e._cache=s,Zt(e,n),J(e,[...a.values(),...i],[...n,...s.values()]),gt(e,i,n,t)}async function $t(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}function en(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.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 tn(e,t,n,r,i){let a=n.map(e=>({...e}));Pt(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 Gt(e,o,r,t[0],i)}catch(t){throw J(e,a),t}if(W(s)){J(e,a),s[0]===H&&e._tx===t&&e._committed===n&&await en(e,t,s);return}if(await Kt(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))}Zt(e,a),J(e,n,a)}async function nn(e,t,n,r,i,a){let o=await qt(e,t[2],t[3],[t[0],t[1],e._committed,void 0,i,n,a,r]);if(W(o)){let n=o[0]===H&&e._tx===t;if((!n||o[1].options.reloadDocument)&&Yt(e,t),J(e,t[3]),t[3]=[],!n)return;if(e._tx!==t){Yt(e,t);return}await en(e,t,o);return}let s=o[1];if(e._tx===t&&await Xt(e,t),e._tx!==t){Yt(e,t),J(e,s),Y(e,o);return}let c=t[2],l=mt(c,e.stores.resolvedLocation.get()),u=o[2];await e.startViewTransition(async()=>{if(e._tx===t&&await Xt(e,t),e._tx!==t){Yt(e,t),J(e,s),Y(e,o);return}let n=await e.startTransition(()=>{Yt(e,t),Qt(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&&tn(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 rn(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=mt(a,r);e.emit({type:`onBeforeNavigate`,...t}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...t})}if(u.signal.aborted){await $t(e,n);return}let f=i.href===a.href,p=u,m=e.matchRoutes(a,{_controller:u});Pt(m);let h=l?c[1](m):void 0;if(h?p=l:l?.abort(),u.signal.aborted){J(e,m),await $t(e,n);return}e._preflight=void 0;let g,_=()=>nn(e,y,f,()=>Jt(e,y),t?.sync,h),v=t?.sync?new Promise(e=>g=e):Promise.resolve().then(_).then(),y=[p,s,a,m,Date.now(),v];if(e._tx=y,n){for(let t of e.stores.matches.get()){if(e._tx!==y)break;t.isFetching&&Ft(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 $t(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))&&Jt(e,y),g?.(_()),await v,await $t(e,y)}async function an(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}),Pt(a),o=(e._preloads??=new Map).set(i,a),s=await qt(e,n,a,[i,t,r,!0])}finally{o&&(o=o.delete(i),J(e,a)),i.abort()}if(!W(s))return s[1];if(!o||s.length<3)return;n=s[2]}catch(e){I(e)||console.error(e);return}}}var on=class extends M.Component{constructor(...e){super(...e),this.state={error:null},this.reset=()=>{this.setState({error:null})}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onCatch?.(e,t)}render(){let e=this.state.error;return e?M.createElement(this.props.errorComponent??sn,{error:e,reset:this.reset}):this.props.children}};function sn({error:e}){let[t,n]=M.useState(!1);return F(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[F(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[P(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),P(`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`})]}),P(`div`,{style:{height:`.25rem`}}),t?P(`div`,{children:P(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?P(`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 cn({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 ln(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 un=[],dn=0,{link:fn,unlink:pn,propagate:mn,checkDirty:hn,shallowPropagate:gn}=cn({update(e){return e._update()},notify(e){un[vn++]=e,e.flags&=~X.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=X.Mutable|X.Dirty,xn(e))}}),_n=0,vn=0,Z,yn=0;function bn(e){try{++yn,e()}finally{--yn||Sn()}}function xn(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=pn(n,e)}function Sn(){if(!(yn>0)){for(;_n<vn;){let e=un[_n];un[_n++]=void 0,e.notify()}_n=0,vn=0}}function Cn(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&&fn(i,Z,dn),i._snapshot},subscribe(e){let t=ln(e),n={current:!1},r=wn(()=>{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,++dn,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),xn(i)}}};return n?(i.flags=X.Mutable|X.Dirty,i.get=function(){let e=i.flags;if(e&X.Dirty||e&X.Pending&&hn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&gn(e)}}else e&X.Pending&&(i.flags=e&~X.Pending);return Z!==void 0&&fn(i,Z,dn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(mn(e),gn(e),Sn())}},i}function wn(e){let t=()=>{let t=Z;Z=n,++dn,n.depsTail=void 0,n.flags=X.Watching|X.RecursedCheck;try{return e()}finally{Z=t,n.flags&=~X.RecursedCheck,xn(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&&hn(this.deps,this)?t():this.flags=X.Watching},stop(){this.flags=X.None,this.depsTail=void 0,xn(this)}};return t(),n}function Tn(e){let t=j(),n=`not-found-${c(t.stores.location,e=>e.pathname)}-${c(t.stores.status,e=>e)}`;return P(on,{getResetKey:()=>n,onCatch:(t,n)=>{if(I(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(I(t))return e.fallback?.(t);throw t},children:e.children})}function En(){return P(`p`,{children:`Not Found`})}function Q(e){return P(Ae,{children:e.children})}function Dn(e,t,n){return t.options.notFoundComponent?P(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?P(e.options.defaultNotFoundComponent,{...n}):P(En,{})}function On(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?P(n,{}):null}var kn=(e,t)=>e[0]===t[0]&&e[1]===t[1],An=(e,t,n)=>!t.isRoot||t.options.shellComponent||t.options.wrapInSuspense||n===!1||n===`data-only`||!e.ssr,jn=M.memo(function({routeId:e}){let t=j();return P(Mn,{router:t,match:c(t.stores.getMatchStore(e),e=>e)})});function Mn({router:t,match:n}){let r=t.routesById[n.routeId],i=On(t,r),a=r.options.errorComponent??t.options.defaultErrorComponent,o=r.options.onCatch??t.options.defaultOnCatch,s=r.isRoot?r.options.notFoundComponent??t.options.notFoundRoute?.options.component:r.options.notFoundComponent,c=n.ssr===!1||n.ssr===`data-only`,l=An(t,r,n.ssr)&&(r.options.wrapInSuspense??i??(r.options.errorComponent?.preload||c))?M.Suspense:Q,u=a?on:Q,d=s?Tn:Q;return F(r.isRoot?r.options.shellComponent??Q:Q,{children:[P(ne.Provider,{value:n.routeId,children:P(l,{fallback:i,children:P(u,{getResetKey:()=>n,errorComponent:a,onCatch:(e,t)=>{if(I(e))throw e.routeId??=n.routeId,e;o?.(e,t)},children:P(d,{fallback:e=>{if(e.routeId??=n.routeId,e.routeId!==n.routeId)throw e;return M.createElement(s,e)},children:c?P(e,{fallback:i,children:P(Nn,{match:n})}):P(Nn,{match:n})})})})}),null]})}var Nn=M.memo(function({match:e}){let t=j(),n=e.routeId,r=t.routesById[n],i=M.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=M.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?P(e,{},i):P(Pn,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t.ssr&&!An(t,r,e.ssr))return a;if(t._tx)throw t._tx[5];return On(t,r)}if(e.status===`notFound`)return Dn(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Pn=M.memo(function(){let e=j(),t=M.useContext(ne),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=c(a,e=>[!!e._notFound,e.error],kn),i=c(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return Dn(e,e.routesById[t],r);if(!i)return null;let a=P(jn,{routeId:i});return t===`__root__`?P(M.Suspense,{fallback:On(e),children:a}):a});function Fn(e,t){let n=e[1];e.length=0,n?.(t)}function In({t:e}){let t=j(),n=t._rendered??=[];return t.startTransition=(r,i)=>new Promise(a=>{Fn(n,!1),n.push(i,a),e(t),M.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(b(r.publicHref)!==b(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`,...mt(a,a)})}):t._tx||t.load({sync:!0}).catch(console.error),e},[t,t.history]),null}function Ln(){let e=j(),t=e.routesById[re],n=On(e,t),r=e.ssr?Q:M.Suspense,i=F(Ae,{children:[P(In,{t:M.useState()[1]}),P(r,{fallback:n,children:P(Rn,{})})]});return e.options.InnerWrap?P(e.options.InnerWrap,{children:i}):i}function Rn(){let e=j(),t=e._rendered,n=c(e.stores.matches,e=>t[0]??e),r=n[0],a=r?.routeId;i(()=>{t[0]===n&&Fn(t,!0)},[t,n]);let o=a?P(jn,{routeId:a}):null;return P(ne.Provider,{value:a,children:e.options.disableGlobalCatchBoundary?o:P(on,{getResetKey:()=>r,onCatch:void 0,children:o})})}var zn=e=>({createMutableStore:Cn,createReadonlyStore:Cn,batch:bn}),Bn=e=>new Vn(e),Vn=class extends _t{constructor(e){super(e,zn)}};function Hn({router:e,children:t,...n}){ee(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=P(se.Provider,{value:e,children:t});return e.options.Wrap?P(e.options.Wrap,{children:r}):r}function Un({router:e,...t}){return P(Hn,{router:e,...t,children:P(Ln,{})})}var Wn=Me.div`
3
- display: flex;
4
- align-items: center;
5
- justify-content: center;
6
- min-height: 100vh;
7
- padding: ${({theme:e})=>e.space(4)};
8
- text-align: center;
9
- `,Gn=Me.p`
10
- font-size: 13px;
11
- color: ${({theme:e})=>e.color.inkDim};
12
- max-width: 48ch;
13
- `,Kn=ie()({component:Pn,notFoundComponent:()=>P(Wn,{children:F(ce,{$gap:3,style:{alignItems:`center`},children:[P(ue,{children:`Not found`}),P(Gn,{children:`This console has no screen at that address.`}),P(le,{as:`a`,href:`/`,$variant:`primary`,$size:`sm`,children:`Back to the rack`})]})})}),qn=`stream:console`,Jn={"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`},"res:credentials":{queryKey:n.credentials},"res:keys":{queryKey:n.keys},"res:settings":{queryKey:n.settings},"res:models":{queryKey:n.models},"res:quota":{queryKey:[`quota-history`]},[qn]:{queryKey:[`console`]}},Yn=Object.keys(Jn),Xn=Yn.filter(e=>e.startsWith(`res:`)),Zn=Yn.filter(e=>e.startsWith(`stream:`));function Qn(e,t){if(t===`res:*`){er(e);return}let n=Jn[t];n!==void 0&&e.invalidateQueries(n)}function $n(e){for(let t of Yn)Qn(e,t)}function er(e){e.invalidateQueries()}var tr=4401,nr=500,rr=3e4,ir=new Set([...Xn,...Zn]),ar=3,or=6e4,sr=(e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)};function cr(){let{protocol:e,host:t}=window.location;return`${e===`https:`?`wss:`:`ws:`}//${t}/api/stream`}function lr(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 ur(e){let t=new Set,n=new Set,r=new Map,i=new Map,a=new Map,o=e=>a.has(e)||ir.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 Xn)v({type:`subscribe`,topic:e});for(let e of Zn){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&&$n(e.client),d=!0,b(),_()}function S(t){let i=lr(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`}),Qn(e.client,a);return}if(i.type===`event`){if(a===`res:*`){er(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`}),Qn(e.client,a);return}}i.payload!==void 0&&y(a,{kind:`frame`,payload:i.payload})||Qn(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===tr){p=!0,l=!1,_(),er(e.client);return}if(!r)f=!0;else{let t=e.now();s=[...s.filter(e=>e>t-or),t],s.length>=ar&&(f=!0)}_(),w()}}function w(){let t=Math.min(rr,nr*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 dr=Te(null),fr=Te(null),pr=Te(null),mr={status:`poll`,pushed:()=>!1};function hr({children:e,enabled:t=!0,timer:n=sr,now:r=Date.now,url:i=cr}){let a=Ce(),[o]=Oe(()=>ur({client:a,timer:n,now:r,url:i})),[s]=Oe(()=>({subscribe:(e,t)=>o.hold(e,e=>{if(e.kind===`gap`){t({kind:`closed`});return}t(e)}),send:o.publish}));N(()=>{if(t)return o.start()},[o,t]);let c=ke(o.subscribe,o.snapshot,o.snapshot);return P(dr,{value:c,children:P(fr,{value:o.onStream,children:P(pr,{value:s,children:e})})})}function gr(){return Ee(dr)??mr}function _r(e,t){let n=Ee(fr),r=De(t);N(()=>{r.current=t}),N(()=>{if(n!==null)return n(e,e=>r.current(e))},[n,e])}function vr(e,t){let n=Ee(pr),r=De(t);N(()=>{r.current=t}),N(()=>{if(n!==null&&e!==null)return n.subscribe(e,e=>r.current(e))},[n,e])}function yr({children:e}){let t=gr(),n=Ee(pr);return P(he,{connection:t,...n===null?{}:{channels:n},children:e})}async function br(e){return e.queryClient.ensureQueryData({queryKey:n.status,queryFn:()=>fe(`/api/status`),revalidateIfStale:!0})}function xr(e){let t=e.principal;return e.authenticated!==!0||t==null?`/login`:t.kind===`client`?`/client`:t.kind===`admin`||t.kind===`viewer`?`/`:`/login`}function Sr(e,t){let n=xr(e);if(n===`/login`)throw oe({to:`/login`,search:{next:t}});if(n!==`/`)throw oe({to:n})}function Cr(e,t){let n=xr(e);if(n===`/login`)throw oe({to:`/login`,search:{next:t}});if(n!==`/client`)throw oe({to:n})}var wr=k(`/_app`)({beforeLoad:async({context:e,location:t})=>{Sr(await br(e),t.href),await e.queryClient.ensureQueryData(r)},pendingComponent:Tr,pendingMs:200,errorComponent:O(()=>A(()=>import(`./_app-0fHLZIC7.js`),__vite__mapDeps([0,1])),`errorComponent`),component:Er});function Tr(){return P(me,{legend:`Console`,children:P(de,{rows:6})})}function Er(){let e=a().data??[];return P(hr,{children:F(yr,{children:[P(ge,{$providers:e}),P(_e,{children:P(Pn,{})})]})})}var Dr=k(`/client`)({beforeLoad:async({context:e,location:t})=>{Cr(await br(e),t.href)},component:O(()=>A(()=>import(`./client-Bl_FA5jI.js`),__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15])),`component`)}),Or=k(`/login`)({validateSearch:e=>({...typeof e.next==`string`?{next:e.next}:{},...typeof e.reason==`string`?{reason:e.reason}:{}}),component:O(()=>A(()=>import(`./login-Qc9iIepG.js`),__vite__mapDeps([16,4,1,7,17])),`component`)}),kr=k(`/_app/`)({component:O(()=>A(()=>import(`./_app.index-DGz9njXx.js`),__vite__mapDeps([18,4,1,5,12,13,8,9,15])),`component`)}),Ar=k(`/_app/accounts`)({component:O(()=>A(()=>import(`./_app.accounts-DBlImnPw.js`),__vite__mapDeps([19,4,1,5,20,6,21,22,23,13,7,8,9,10,3])),`component`)}),jr=k(`/_app/console`)({component:O(()=>A(()=>import(`./_app.console-in_iVnep.js`),__vite__mapDeps([24,4,1,5,7])),`component`)}),Mr=k(`/_app/database`)({component:O(()=>A(()=>import(`./_app.database-CPj-Juag.js`),__vite__mapDeps([25,4,1,5,22,7,8,9,15,17])),`component`)}),Nr=k(`/_app/keys`)({component:O(()=>A(()=>import(`./_app.keys-C-Fk39-U.js`),__vite__mapDeps([26,4,1,5,20,6,21,23,13,7,8,9])),`component`)}),Pr=k(`/_app/logs`)({component:O(()=>A(()=>import(`./_app.logs-C7BhBRjg.js`),__vite__mapDeps([27,4,1,5,13,7,11,12,9])),`component`)}),Fr=k(`/_app/models`)({component:O(()=>A(()=>import(`./_app.models-BuiRrOrz.js`),__vite__mapDeps([28,4,1,5,21,22,23,13,7,8])),`component`)}),Ir=k(`/_app/settings`)({component:O(()=>A(()=>import(`./_app.settings-s6K98CA2.js`),__vite__mapDeps([29,4,1,5,23,7,8,17])),`component`)}),Lr=k(`/_app/usage`)({component:O(()=>A(()=>import(`./_app.usage-Bp45JtBe.js`),__vite__mapDeps([30,3,4,1,5,9,14,15])),`component`)}),Rr=k(`/_app/plugins/$pluginId`)({component:O(()=>A(()=>import(`./_app.plugins._pluginId-Bx1LgcDj.js`),__vite__mapDeps([31,4,1,32,5])),`component`)}),$=wr.update({id:`/_app`,getParentRoute:()=>Kn}),zr=Dr.update({id:`/client`,path:`/client`,getParentRoute:()=>Kn}),Br=Or.update({id:`/login`,path:`/login`,getParentRoute:()=>Kn}),Vr=kr.update({id:`/`,path:`/`,getParentRoute:()=>$}),Hr={AppAccountsRoute:Ar.update({id:`/accounts`,path:`/accounts`,getParentRoute:()=>$}),AppConsoleRoute:jr.update({id:`/console`,path:`/console`,getParentRoute:()=>$}),AppDatabaseRoute:Mr.update({id:`/database`,path:`/database`,getParentRoute:()=>$}),AppKeysRoute:Nr.update({id:`/keys`,path:`/keys`,getParentRoute:()=>$}),AppLogsRoute:Pr.update({id:`/logs`,path:`/logs`,getParentRoute:()=>$}),AppModelsRoute:Fr.update({id:`/models`,path:`/models`,getParentRoute:()=>$}),AppSettingsRoute:Ir.update({id:`/settings`,path:`/settings`,getParentRoute:()=>$}),AppUsageRoute:Lr.update({id:`/usage`,path:`/usage`,getParentRoute:()=>$}),AppIndexRoute:Vr,AppPluginsPluginIdRoute:Rr.update({id:`/plugins/$pluginId`,path:`/plugins/$pluginId`,getParentRoute:()=>$})},Ur={AppRoute:$._addFileChildren(Hr),ClientRoute:zr,LoginRoute:Br},Wr=Kn._addFileChildren(Ur)._addFileTypes();function Gr(e){return{isLoginRoute:()=>e().state.location.pathname===`/login`,onUnauthenticated:()=>void e().navigate({to:`/login`,search:{next:e().state.location.href}})}}function Kr(e){let t=t=>{t instanceof pe&&t.isUnauthenticated&&(e.isLoginRoute()||e.onUnauthenticated())};return new xe({queryCache:new be({onError:t}),mutationCache:new ye({onError:t}),defaultOptions:{queries:{retry:(e,t)=>t instanceof pe&&t.isUnauthenticated?!1:e<2,staleTime:5e3,refetchOnWindowFocus:!0},mutations:{retry:!1}}})}var qr,Jr=Kr(Gr(()=>qr));qr=Bn({routeTree:Wr,context:{queryClient:Jr}});var Yr=document.getElementById(`root`);if(Yr===null)throw Error(`#root is missing from index.html`);je(Yr).render(P(we,{children:P(ve,{children:P(Se,{client:Jr,children:P(Un,{router:qr})})})}));export{vr as a,Qn as c,yr as i,Or as n,_r as o,hr as r,qn as s,Rr as t};
@@ -1 +0,0 @@
1
- import{b as e}from"./Rack-D3iFlR6e.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]);export{t};
@@ -1 +0,0 @@
1
- import{Cn as e,Dn as t,En as n,Xt as r,Yt as i,Zt as a,an as o,mn as s,nn as c,on as l}from"./Lamp-Drd1fFwQ.js";import{k as u}from"./Panel-BV18WuL1.js";import*as d from"react";import f from"react";import{jsx as p}from"react/jsx-runtime";var m=`__root__`;function h(e){if(e.statusCode=e.statusCode||e.code||307,!e.reloadDocument&&typeof e.href==`string`)try{new URL(e.href),e.reloadDocument=!0}catch{}let t=new Headers(e.headers);e.href&&t.get(`Location`)===null&&t.set(`Location`,e.href);let n=new Response(null,{status:e.statusCode,headers:t});if(n.options=e,e.throw)throw n;return n}function g(e){return e instanceof Response&&!!e.options}var _=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(e){if(this.init=e=>{this.originalIndex=e.originalIndex;let t=this.options,n=!t?.path&&!t?.id;this.parentRoute=this.options.getParentRoute?.(),n?this._path=m:this.parentRoute||s();let r=n?m:t?.path;r&&r!==`/`&&(r=o(r));let i=t?.id||r,a=n?m:c([this.parentRoute.id===`__root__`?``:this.parentRoute.id,i]);r===`__root__`&&(r=`/`),a!==`__root__`&&(a=c([`/`,a]));let u=a===`__root__`?`/`:c([this.parentRoute.fullPath,r]);this._path=r,this._id=a,this._fullPath=u,this._to=l(u)},this.addChildren=e=>this._addFileChildren(e),this._addFileChildren=e=>(Array.isArray(e)&&(this.children=e),typeof e==`object`&&e&&(this.children=Object.values(e)),this),this._addFileTypes=()=>this,this.updateLoader=e=>(Object.assign(this.options,e),this),this.update=e=>(Object.assign(this.options,e),this),this.lazy=e=>(this.lazyFn=e,this),this.redirect=e=>h({from:this.fullPath,...e}),this.options=e||{},this.isRoot=!e?.getParentRoute,e?.id&&e?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},v=class extends _{constructor(e){super(e)}},y=d.createContext(void 0),b=d.createContext(void 0),x={};function S(e,t){let r=d.useRef();return i=>{let a=e?.select?e.select(i):i;return e?.structuralSharing??t.options.defaultStructuralSharing?r.current=n(r.current,a):a}}function C(e){let t=u(),n=d.useContext(e.from?b:y),r=e.from??n,i=t.stores.getMatchStore(r),o=S(e,t),c=a(i,e=>e?o(e):x);if(c!==x)return c;(e.shouldThrow??!0)&&s()}function w(e){return C({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function T(e){let{select:t,...n}=e;return C({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function E(e){return C({from:e.from,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,strict:e.strict,select:t=>{let n=e.strict===!1?t.params:t._strictParams;return e.select?e.select(n):n}})}function D(e){return C({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function O(e){return C({...e,select:t=>e.select?e.select(t.context):t.context})}var k=class extends _{constructor(e){super(e),this.useMatch=e=>C({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>O({...e,from:this.id}),this.useSearch=e=>D({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>E({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>T({...e,from:this.id}),this.useLoaderData=e=>w({...e,from:this.id}),this.useNavigate=()=>r({from:this.fullPath}),this.Link=f.forwardRef((e,t)=>p(i,{ref:t,from:this.fullPath,...e}))}};function A(e){return new k(e)}function j(){return e=>N(e)}var M=class extends v{constructor(e){super(e),this.useMatch=e=>C({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>O({...e,from:this.id}),this.useSearch=e=>D({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>E({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>T({...e,from:this.id}),this.useLoaderData=e=>w({...e,from:this.id}),this.useNavigate=()=>r({from:this.fullPath}),this.Link=f.forwardRef((e,t)=>p(i,{ref:t,from:this.fullPath,...e}))}};function N(e){return new M(e)}function P(e){return e=>{let t=A(e);return t.isRoot=!1,t}}function F(n,r){let i,a,o,s=()=>(i||=(o=void 0,n().then(e=>{i=void 0,c.preload=void 0,a=e[r??`default`]}).catch(e=>{i=void 0,o=e})),i),c=function(n){if(o){if(e(o)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${o.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw o}if(!a){if(t)t(s());else throw s()}return d.createElement(a,n)};return c.preload=s,c}var I=`modulepreload`,L=function(e){return`/`+e},R={},z=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=L(t,n),t=s(t),t in R)return;R[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:I,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};export{y as a,m as c,j as i,F as n,g as o,P as r,h as s,z as t};
@@ -1 +0,0 @@
1
- import{b as e}from"./Rack-D3iFlR6e.js";var t=e(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]);export{t};
@@ -1 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-CbXtAM7H.js";var t=e((e=>{var t=Symbol.for(`react.transitional.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.consumer`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.for(`react.activity`),p=Symbol.iterator;function m(e){return typeof e!=`object`||!e?null:(e=p&&e[p]||e[`@@iterator`],typeof e==`function`?e:null)}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},g=Object.assign,_={};function v(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}v.prototype.isReactComponent={},v.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function y(){}y.prototype=v.prototype;function b(e,t,n){this.props=e,this.context=t,this.refs=_,this.updater=n||h}var x=b.prototype=new y;x.constructor=b,g(x,v.prototype),x.isPureReactComponent=!0;var S=Array.isArray;function C(){}var w={H:null,A:null,T:null,S:null},T=Object.prototype.hasOwnProperty;function E(e,n,r){var i=r.ref;return{$$typeof:t,type:e,key:n,ref:i===void 0?null:i,props:r}}function D(e,t){return E(e.type,t,e.props)}function O(e){return typeof e==`object`&&!!e&&e.$$typeof===t}function k(e){var t={"=":`=0`,":":`=2`};return`$`+e.replace(/[=:]/g,function(e){return t[e]})}var A=/\/+/g;function j(e,t){return typeof e==`object`&&e&&e.key!=null?k(``+e.key):t.toString(36)}function M(e){switch(e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason;default:switch(typeof e.status==`string`?e.then(C,C):(e.status=`pending`,e.then(function(t){e.status===`pending`&&(e.status=`fulfilled`,e.value=t)},function(t){e.status===`pending`&&(e.status=`rejected`,e.reason=t)})),e.status){case`fulfilled`:return e.value;case`rejected`:throw e.reason}}throw e}function N(e,r,i,a,o){var s=typeof e;(s===`undefined`||s===`boolean`)&&(e=null);var c=!1;if(e===null)c=!0;else switch(s){case`bigint`:case`string`:case`number`:c=!0;break;case`object`:switch(e.$$typeof){case t:case n:c=!0;break;case d:return c=e._init,N(c(e._payload),r,i,a,o)}}if(c)return o=o(e),c=a===``?`.`+j(e,0):a,S(o)?(i=``,c!=null&&(i=c.replace(A,`$&/`)+`/`),N(o,r,i,``,function(e){return e})):o!=null&&(O(o)&&(o=D(o,i+(o.key==null||e&&e.key===o.key?``:(``+o.key).replace(A,`$&/`)+`/`)+c)),r.push(o)),1;c=0;var l=a===``?`.`:a+`:`;if(S(e))for(var u=0;u<e.length;u++)a=e[u],s=l+j(a,u),c+=N(a,r,i,s,o);else if(u=m(e),typeof u==`function`)for(e=u.call(e),u=0;!(a=e.next()).done;)a=a.value,s=l+j(a,u++),c+=N(a,r,i,s,o);else if(s===`object`){if(typeof e.then==`function`)return N(M(e),r,i,a,o);throw r=String(e),Error(`Objects are not valid as a React child (found: `+(r===`[object Object]`?`object with keys {`+Object.keys(e).join(`, `)+`}`:r)+`). If you meant to render a collection of children, use an array instead.`)}return c}function P(e,t,n){if(e==null)return e;var r=[],i=0;return N(e,r,``,``,function(e){return t.call(n,e,i++)}),r}function F(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(t){(e._status===0||e._status===-1)&&(e._status=1,e._result=t)},function(t){(e._status===0||e._status===-1)&&(e._status=2,e._result=t)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var I=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},L={map:P,forEach:function(e,t,n){P(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return P(e,function(){t++}),t},toArray:function(e){return P(e,function(e){return e})||[]},only:function(e){if(!O(e))throw Error(`React.Children.only expected to receive a single React element child.`);return e}};e.Activity=f,e.Children=L,e.Component=v,e.Fragment=r,e.Profiler=a,e.PureComponent=b,e.StrictMode=i,e.Suspense=l,e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=w,e.__COMPILER_RUNTIME={__proto__:null,c:function(e){return w.H.useMemoCache(e)}},e.cache=function(e){return function(){return e.apply(null,arguments)}},e.cacheSignal=function(){return null},e.cloneElement=function(e,t,n){if(e==null)throw Error(`The argument must be a React element, but you passed `+e+`.`);var r=g({},e.props),i=e.key;if(t!=null)for(a in t.key!==void 0&&(i=``+t.key),t)!T.call(t,a)||a===`key`||a===`__self`||a===`__source`||a===`ref`&&t.ref===void 0||(r[a]=t[a]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var o=Array(a),s=0;s<a;s++)o[s]=arguments[s+2];r.children=o}return E(e.type,i,r)},e.createContext=function(e){return e={$$typeof:s,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:o,_context:e},e},e.createElement=function(e,t,n){var r,i={},a=null;if(t!=null)for(r in t.key!==void 0&&(a=``+t.key),t)T.call(t,r)&&r!==`key`&&r!==`__self`&&r!==`__source`&&(i[r]=t[r]);var o=arguments.length-2;if(o===1)i.children=n;else if(1<o){for(var s=Array(o),c=0;c<o;c++)s[c]=arguments[c+2];i.children=s}if(e&&e.defaultProps)for(r in o=e.defaultProps,o)i[r]===void 0&&(i[r]=o[r]);return E(e,a,i)},e.createRef=function(){return{current:null}},e.forwardRef=function(e){return{$$typeof:c,render:e}},e.isValidElement=O,e.lazy=function(e){return{$$typeof:d,_payload:{_status:-1,_result:e},_init:F}},e.memo=function(e,t){return{$$typeof:u,type:e,compare:t===void 0?null:t}},e.startTransition=function(e){var t=w.T,n={};w.T=n;try{var r=e(),i=w.S;i!==null&&i(n,r),typeof r==`object`&&r&&typeof r.then==`function`&&r.then(C,I)}catch(e){I(e)}finally{t!==null&&n.types!==null&&(t.types=n.types),w.T=t}},e.unstable_useCacheRefresh=function(){return w.H.useCacheRefresh()},e.use=function(e){return w.H.use(e)},e.useActionState=function(e,t,n){return w.H.useActionState(e,t,n)},e.useCallback=function(e,t){return w.H.useCallback(e,t)},e.useContext=function(e){return w.H.useContext(e)},e.useDebugValue=function(){},e.useDeferredValue=function(e,t){return w.H.useDeferredValue(e,t)},e.useEffect=function(e,t){return w.H.useEffect(e,t)},e.useEffectEvent=function(e){return w.H.useEffectEvent(e)},e.useId=function(){return w.H.useId()},e.useImperativeHandle=function(e,t,n){return w.H.useImperativeHandle(e,t,n)},e.useInsertionEffect=function(e,t){return w.H.useInsertionEffect(e,t)},e.useLayoutEffect=function(e,t){return w.H.useLayoutEffect(e,t)},e.useMemo=function(e,t){return w.H.useMemo(e,t)},e.useOptimistic=function(e,t){return w.H.useOptimistic(e,t)},e.useReducer=function(e,t,n){return w.H.useReducer(e,t,n)},e.useRef=function(e){return w.H.useRef(e)},e.useState=function(e){return w.H.useState(e)},e.useSyncExternalStore=function(e,t,n){return w.H.useSyncExternalStore(e,t,n)},e.useTransition=function(){return w.H.useTransition()},e.version=`19.2.8`})),n=e(((e,n)=>{n.exports=t()}));export{n as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-CbXtAM7H.js";import{t}from"./react-GitiQ0dt.js";var n=e((e=>{var n=t();function r(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function i(){}var a={d:{f:i,r:function(){throw Error(r(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for(`react.portal`);function s(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=a,e.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(r(299));return s(e,t,null,n)},e.flushSync=function(e){var t=c.T,n=a.p;try{if(c.T=null,a.p=2,e)return e()}finally{c.T=t,a.p=n,a.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,a.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&a.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),i=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?a.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:i,fetchPriority:o}):n===`script`&&a.d.X(e,{crossOrigin:r,integrity:i,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`){if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);a.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??a.d.M(e)}},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);a.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`){if(t){var n=l(t.as,t.crossOrigin);a.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else a.d.m(e)}},e.requestFormReset=function(e){a.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.8`})),r=e(((e,t)=>{function r(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(e){console.error(e)}}r(),t.exports=n()}));export{r as t};