omnigateway 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/README.md +8 -8
  2. package/bin/omni.js +255 -118
  3. package/gateway.js +212 -45
  4. package/package.json +2 -2
  5. package/public/assets/{CopyValue-BwjFnqW2.js → CopyValue-bzKz2tiJ.js} +1 -1
  6. package/public/assets/{Lamp-CSv_5d5k.js → Lamp-WOotyOTd.js} +4 -4
  7. package/public/assets/{Modal-1tHwlj0o.js → Modal-Crr8uyWt.js} +1 -1
  8. package/public/assets/{Rack-DANVhi_U.js → Rack-uDxrjvaz.js} +1 -1
  9. package/public/assets/{Toggle-pWcL2A-N.js → Toggle-D0e4C94X.js} +1 -1
  10. package/public/assets/{_app-C5mYmzgk.js → _app-OSvB-Dv9.js} +1 -1
  11. package/public/assets/_app.accounts-BOE49WyS.js +51 -0
  12. package/public/assets/_app.index-CTRlqxOq.js +61 -0
  13. package/public/assets/{_app.keys-DTREQf0P.js → _app.keys-BNEOjtbu.js} +1 -1
  14. package/public/assets/{_app.logs-Co3QPpc1.js → _app.logs-BxxqeEhM.js} +1 -1
  15. package/public/assets/{_app.models-DPSKIyeq.js → _app.models-BJi-RGUO.js} +6 -6
  16. package/public/assets/{_app.settings-15ZMiM5O.js → _app.settings-C1gB4w7c.js} +1 -1
  17. package/public/assets/_app.usage-B0iHKzmI.js +163 -0
  18. package/public/assets/catalog-DVRPlBJJ.js +1 -0
  19. package/public/assets/{index-DnNTc35a.js → index--dA3FFSN.js} +2 -2
  20. package/public/assets/{login-DNvWG7Nv.js → login-D-FsWNX8.js} +1 -1
  21. package/public/assets/trash-2-Cep_aVLx.js +1 -0
  22. package/public/favicon.svg +25 -0
  23. package/public/index.html +3 -1
  24. package/public/assets/_app.accounts-e7Mbaxdc.js +0 -47
  25. package/public/assets/_app.index-CxunMQ_m.js +0 -57
  26. package/public/assets/_app.usage-BBffCDCD.js +0 -163
  27. package/public/assets/catalog-DmrbfYQe.js +0 -1
@@ -0,0 +1 @@
1
+ var e={anthropic:{defaultModel:`claude-opus-5`,models:[{id:`claude-fable-5`,label:`Claude Fable 5`,pricing:{input:10,output:50,cacheRead:1}},{id:`claude-opus-5`,label:`Claude Opus 5`,pricing:{input:5,output:25,cacheRead:.5}},{id:`claude-sonnet-5`,label:`Claude Sonnet 5`,pricing:{input:3,output:15,cacheRead:.3}},{id:`claude-haiku-4-5`,label:`Claude Haiku 4.5`,pricing:{input:1,output:5,cacheRead:.1}}]},openai:{defaultModel:`gpt-5.6`,models:[{id:`gpt-5.6`,label:`GPT-5.6 — routes to Sol`,pricing:{input:5,output:30,cacheRead:.5}},{id:`gpt-5.6-sol`,label:`GPT-5.6 Sol — deepest reasoning`,pricing:{input:5,output:30,cacheRead:.5}},{id:`gpt-5.6-terra`,label:`GPT-5.6 Terra — balanced`,pricing:{input:2,output:12,cacheRead:.2}},{id:`gpt-5.6-luna`,label:`GPT-5.6 Luna — fastest`,pricing:{input:.2,output:1.2,cacheRead:.02}}]},kimi:{defaultModel:`k3-256k`,models:[{id:`k3-256k`,label:`Kimi K3 — 256K`,pricing:{input:3,output:15,cacheRead:.3}},{id:`k3`,label:`Kimi K3 — up to 1M`,pricing:{input:3,output:15,cacheRead:.3}},{id:`kimi-for-coding`,label:`Kimi K2.7 Code`,pricing:{input:.95,output:4,cacheRead:.19}},{id:`kimi-for-coding-highspeed`,label:`Kimi K2.7 Code — High Speed`,pricing:{input:.95,output:8,cacheRead:.19}}]}};function t(t,n){return e[t].models.find(e=>e.id===n)?.pricing??null}export{t as n,e as t};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app-C5mYmzgk.js","assets/queries-vY5lJqBe.js","assets/Rack-DANVhi_U.js","assets/Lamp-CSv_5d5k.js","assets/login-DNvWG7Nv.js","assets/Field-DdscQ9OO.js","assets/States-DPTTYUHL.js","assets/_app.index-CxunMQ_m.js","assets/Chip-D0YiqYkz.js","assets/Meter-Bm1oQE2U.js","assets/Table-LkPaHBsj.js","assets/Readout-CYg6UOop.js","assets/_app.accounts-e7Mbaxdc.js","assets/CopyValue-BwjFnqW2.js","assets/Toggle-pWcL2A-N.js","assets/Modal-1tHwlj0o.js","assets/catalog-DmrbfYQe.js","assets/_app.keys-DTREQf0P.js","assets/_app.logs-Co3QPpc1.js","assets/_app.models-DPSKIyeq.js","assets/_app.settings-15ZMiM5O.js","assets/_app.usage-BBffCDCD.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_app-OSvB-Dv9.js","assets/queries-vY5lJqBe.js","assets/Rack-uDxrjvaz.js","assets/Lamp-WOotyOTd.js","assets/login-D-FsWNX8.js","assets/Field-DdscQ9OO.js","assets/States-DPTTYUHL.js","assets/_app.index-CTRlqxOq.js","assets/Chip-D0YiqYkz.js","assets/Meter-Bm1oQE2U.js","assets/Table-LkPaHBsj.js","assets/Readout-CYg6UOop.js","assets/_app.accounts-BOE49WyS.js","assets/CopyValue-bzKz2tiJ.js","assets/Toggle-D0e4C94X.js","assets/Modal-Crr8uyWt.js","assets/trash-2-Cep_aVLx.js","assets/catalog-DVRPlBJJ.js","assets/_app.keys-BNEOjtbu.js","assets/_app.logs-BxxqeEhM.js","assets/_app.models-BJi-RGUO.js","assets/_app.settings-C1gB4w7c.js","assets/_app.usage-B0iHKzmI.js"])))=>i.map(i=>d[i]);
2
2
  import{$ as e,At as t,B as n,Bt as r,Ct as i,D as a,Dt as o,Et as s,F as c,Ft as l,G as u,H as d,Ht as f,It as p,J as m,Kt as h,Lt as g,M as _,Mt as v,Nt as y,Ot as b,Pt as x,Q as ee,R as S,Rt as te,St as ne,T as re,Tt as ie,U as ae,Ut as oe,V as se,Vt as ce,W as le,Wt as ue,X as de,Y as C,Z as w,_t as fe,at as pe,bt as me,ct as he,dt as T,et as E,ft as ge,gt as _e,ht as ve,it as ye,jt as be,kt as xe,lt as Se,mt as Ce,n as we,nt as Te,ot as Ee,pt as De,q as Oe,rt as ke,st as Ae,tt as je,ut as Me,vt as Ne,w as Pe,wt as Fe,xt as Ie,yt as Le,zt as Re}from"./queries-vY5lJqBe.js";(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)}})();var ze=class extends oe{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new xe({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=Be(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}return!0}runNext(e){let t=Be(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){v.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>p(t,e))}findAll(e={}){return this.getAll().filter(t=>p(e,t))}notify(e){v.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return v.batch(()=>Promise.all(e.map(e=>e.continue().catch(te))))}};function Be(e){return e.options.scope?.id}var Ve=class extends oe{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,n,r){let i=n.queryKey,a=n.queryHash??l(i,n),o=this.get(a);return o||(o=new t({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){v.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>g(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>g(e,t)):t}notify(e){v.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){v.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){v.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},He=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ve,this.#t=e.mutationCache||new ze,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=f.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=be.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),i=n.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(r(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=y(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return v.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;v.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return v.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=v.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(te).catch(te)}invalidateQueries(e,t={}){return v.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=v.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(te)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(te)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(r(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(te).catch(te)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(te).catch(te)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return be.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(x(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Re(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(x(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Re(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=l(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===ce&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}};function Ue(e){return e?.isNotFound===!0}function We(){try{return sessionStorage}catch{return}}var Ge=`tsr-scroll-restoration-v1_3`,Ke=We();function qe(){try{return JSON.parse(Ke?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function Je(){try{Ke?.setItem(Ge,JSON.stringify(Ye))}catch{}}var Ye=qe(),Xe=`data-scroll-restoration-id`,Ze=e=>e.state.__TSR_key||e.href;function Qe(e){let t=e.getAttribute(Xe);if(t)return`[${Xe}="${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 $e=!1,et=`window`;function tt(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function nt(e){let t=new Set;for(let n of e){if(n===et)continue;let e=tt(n);e&&t.add(e)}return t}function rt(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=Ye[e]||={};for(let e of a)e===document?t[et]={scrollX,scrollY}:e.isConnected&&(t[Qe(e)]={scrollX:e.scrollLeft,scrollY:e.scrollTop})};n&&!r.restoration&&(r.restoration=!0,$e=!1,history.scrollRestoration=`manual`,document.addEventListener(`scroll`,e=>{$e||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())),Je()})),!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=Ye[d];if(e){let t=Ye[u];for(let n in e){if(n===et){if(s)continue}else{let e=tt(n);if(!e||s&&o&&(l??=nt(o),l.has(e)))continue}t||=Ye[u]={},t[n]??=e[n]}}}$e=!0;try{let e=t.toLocation.hash,i=t.toLocation.state.__hashScrollIntoViewOptions??!0,a=!1;if(s){!e&&o&&(l??=nt(o));let t=e&&i&&c,s=r.restoring?Ye[u]:void 0;if(s)for(let e in s){let{scrollX:r,scrollY:i}=s[e];if(e===et){if(t)continue;scrollTo({top:i,left:r,behavior:n}),a=!0}else{let t=tt(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{$e=!1}}))}function it(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 at(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function ot(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]=at(r):Array.isArray(t)?t.push(at(r)):n[e]=[t,at(r)]}return n}var st=lt(JSON.parse),ct=ut(JSON.stringify,JSON.parse);function lt(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=ot(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function ut(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=it(e,r);return t?`?${t}`:``}}var dt=`__root__`;function ft(e){if(e.statusCode=e.statusCode||e.code||307,!e._builtLocation&&!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 pt(e){return e instanceof Response&&!!e.options}function mt(e){return{input:({url:t})=>{for(let n of e)t=gt(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=D(e[n],t);return t}}}function ht(t){let n=je(t.basepath),r=`/${n}`,i=t.caseSensitive?r:r.toLowerCase(),a=`${i}/`;return{input:({url:e})=>{let n=t.caseSensitive?e.pathname:e.pathname.toLowerCase();return n===i?e.pathname=`/`:n.startsWith(a)&&(e.pathname=e.pathname.slice(r.length)),e},output:({url:t})=>(t.pathname=e([`/`,n,t.pathname]),t)}}function gt(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 D(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 _t(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(()=>{De(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 vt=`__TSR_index`,yt=`popstate`,bt=`beforeunload`;function xt(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=Tt(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[vt];i=St(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[vt];i=St(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[vt]!==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 St(e,t){t||={};let n=Et();return{...t,key:n,__TSR_key:n,[vt]:e}}function Ct(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??(()=>Tt(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=Et();t.history.replaceState({[vt]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(S._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),S._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=Tt(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),S.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[vt]-l.state[vt],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)},ee=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=xt({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,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:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(bt,ee,{capture:!0}),t.removeEventListener(yt,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(bt,ee,{capture:!0}),t.addEventListener(yt,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return S._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return S._ignoreSubscribers||b(`REPLACE`),n},S}function wt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function Tt(e,t){let n=wt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=Et();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||{[vt]:0,key:a,__TSR_key:a}}}function Et(){return(Math.random()+1).toString(36).substring(7)}function Dt(e){return e.options.loader||e.options.beforeLoad||e.lazyFn||e.options.component?.preload||e.options.pendingComponent?.preload}function Ot(e,t){return{fromLocation:t,toLocation:e,pathChanged:t?.pathname!==e.pathname,hrefChanged:t?.href!==e.href,hashChanged:t?.hash!==e.hash}}function O({key:e,__TSR_key:t,__TSR_index:n,__hashScrollIntoViewOptions:r,...i}){return i}function kt(e,t,n,r){for(let i of t){if(r?.()===!1)return;n.some(e=>e.routeId===i.routeId)||e.routesById[i.routeId].options.onLeave?.(i)}for(let i of n){if(r?.()===!1)return;e.routesById[i.routeId].options[t.some(e=>e.routeId===i.routeId)?`onStay`:`onEnter`]?.(i)}}var At=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this._scroll={next:!0},this.subscribers=new Set,this._cache=new Map,this._committed=[],this.routeBranchCache=new WeakMap,this.lightweightCache=new WeakMap,this.startTransition=async e=>(e(),!1),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??!1??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=w(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.history=this.options.history?this.options.history:Ct()),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=Me(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=_t(this.latestLocation,e),rt(this)}let a=this.options.basepath??`/`,o=this.options.rewrite;if(r||n!==a||i!==o){this.basepath=a;let e=[],t=je(a);t&&t!==`/`&&e.push(ht({basepath:a})),o&&e.push(o),this.rewrite=e.length===0?void 0:e.length===1?e[0]:mt(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=Se(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&he(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,t)=>{let n=({pathname:e,search:n,hash:r,href:a,state:o})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let a=this.options.parseSearch(n),s=this.options.stringifySearch(a);return{href:e+s+r,publicHref:e+s+r,pathname:Ce(e).path,external:!1,searchStr:s,search:ne(t?.search,a),hash:Ce(r.slice(1)).path,state:i(t?.state,o)}}let s=new URL(a,this.origin),c=gt(this.rewrite,s),l=this.options.parseSearch(c.search),u=this.options.stringifySearch(l);return c.search=u,{href:c.href.replace(c.origin,``),publicHref:a,pathname:Ce(c.pathname).path,external:!!this.rewrite&&c.origin!==this.origin,searchStr:u,search:ne(t?.search,l),hash:Ce(c.hash.slice(1)).path,state:i(t?.state,o)}},r=n(e),{__tempLocation:a,__tempKey:o}=r.state;if(a&&(!o||o===this.tempLocationKey)){let e=n(a);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>E({base:e,to:t.includes(`//`)?de(t):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=Ee(ke(e),this.processedTree,!0);return n&&Object.assign(t,n.rawParams),{matchedRoutes:n?.branch||[this.routesById.__root__],routeParams:t,foundRoute:n?.route}},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this._pendingLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let a=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,o=t.to?`${t.to}`:void 0,s=r.search,c=Object.assign(Object.create(null),r.params),l=o?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(a,`.`),u=o?this.resolvePathWithBase(l,o):l,d=It(t.params,c),f=this.routesByPath[ke(u)],p;if(f)p=this.getRouteBranch(f);else if(u.includes(`$`))p=[];else{let e=this.getMatchedRoutes(u);p=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(p=[...p,this.options.notFoundRoute])}if(p.length&&Ne(d))for(let e of p){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(d,t(d))}catch{}}let m=e.leaveParams?u:Ce(ee({path:u,params:d,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,h=s;if(e._includeValidateSearch&&this.options.search?.strict){let e={};p.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,Nt(t.options.validateSearch,{...e,...h}))}catch{}}),h=e}h=Pt(h,t,p,e._includeValidateSearch),h=ne(s,h);let g=this.options.stringifySearch(h),_=t.hash===!0?n.hash:t.hash?fe(t.hash,n.hash):void 0,v=_?`#${_}`:``,y=t.state===!0?n.state:t.state?fe(t.state,n.state):{};y=i(n.state,y);let b=`${m}${g}${v}`,x,S,te=!1;if(this.rewrite){let e=new URL(b,this.origin),t=D(this.rewrite,e);x=e.href.replace(e.origin,``),t.origin===this.origin?S=t.pathname+t.search+t.hash:(S=t.href,te=!0)}else x=_e(b),S=x;return{publicHref:S,href:x,pathname:m,search:h,searchStr:g,state:y,hash:_??``,external:te,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=pe(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=It(s,n);r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=ke(this.latestLocation.href)===ke(n.href)&&ve(O(n.state),O(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,_redirects:a,href:o,...s}={})=>{if(o){let t=this.history.location.state.__TSR_index,n=Tt(o,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);s.to=gt(this.rewrite,r).pathname,s.search=this.options.parseSearch(n.search),s.hash=n.hash.slice(1)}let c=this.buildLocation({...s,_includeValidateSearch:!0});a&&(c._redirects=a),this._pendingLocation=c;let l=this.commitLocation({...c,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return queueMicrotask(()=>{this._pendingLocation===c&&(this._pendingLocation=void 0)}),l},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(Le(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 Mn(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(Ot(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`)&&Dt(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||e.options._builtLocation){let t=(e.options._builtLocation??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&&!e.options._builtLocation&&Le(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=Bt,this.preloadRoute=e=>Nn(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=Ae(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,a.pathname,this.processedTree);return!o||e.params&&!ve(o.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?ve(a.search,r.search,{partial:!0})?o.rawParams:!1:o.rawParams},this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??ct,parseSearch:e.parseSearch??st,protocolAllowlist:e.protocolAllowlist??ge}),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=ye(e),this.routeBranchCache.set(e,t)),t}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:a}=n,{matchedRoutes:o}=n,s=!1;(r?r.path!==`/`&&a[`**`]:ke(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:s=!0);let c=s?Ft(this.options.notFoundMode,o):void 0,l=Array(o.length),u=this._committed,d=(e,t)=>{let n=u[t];return n?.routeId===e.id?n:e===this.options.notFoundRoute?u.find(t=>t.routeId===e.id):void 0};for(let n=0;n<o.length;n++){let r=o[n],s=l[n-1],u,f,p;{let n=s?.search??e.search,i=s?._strictSearch??void 0;try{let e=Nt(r.options.validateSearch,{...n})??void 0;u={...n,...e},f={...i,...e}}catch(e){let r=e;if(e instanceof jt||(r=new jt(e.message,{cause:e})),t?.throwOnError)throw r;u=n,f={},p=r}}let m=``,h=``;try{m=r.options.loaderDeps?.({search:u})??``,h=m&&JSON.stringify(m)||``}catch(e){if(t?.throwOnError)throw e;p??=e}let{interpolatedPath:g,usedParams:_}=ee({path:r.fullPath,params:a,decoder:this.pathParamsDecoder,server:this.isServer}),v=r.id+g+h,y=d(r,n),b=this._cache.get(v)??(y?.id===v?y:void 0),x=b?._strictParams??_,S;if(!b)try{Lt(r,x)}catch(e){if(S=Ue(e)||pt(e)?e:new Mt(e.message,{cause:e}),t?.throwOnError)throw S}Object.assign(a,x);let te=y?`stay`:`enter`,re;if(b)re={...b,cause:te,params:y?.params??a,_strictParams:x,search:ne(y?y.search:b.search,u),_strictSearch:f,searchError:p};else{let e=Dt(r)?`pending`:`success`;re={id:v,ssr:r.options.ssr,index:n,routeId:r.id,params:y?.params??a,_strictParams:x,pathname:g,updatedAt:Date.now(),search:y?ne(y.search,u):u,_strictSearch:f,searchError:p,status:e,isFetching:!1,error:void 0,paramsError:S,context:{},abortController:t?._controller??new AbortController,cause:te,loaderDeps:y?i(y.loaderDeps,m):m,invalid:!1,preload:!1,staticData:r.options.staticData||{},fullPath:r.fullPath}}let ie=c===r.id;re._notFound&&!ie&&(re.error=void 0),re._notFound=ie,l[n]=re}for(let e=0;e<l.length;e++){let n=l[e];n.params=n.cause===`stay`?ne(n.params,a):a,t?._controller&&(n.context={})}return l}matchRoutesLightweight(e){let t=Ie(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{matchedRoutes:a,routeParams:o}=this.getMatchedRoutes(e.pathname),s=Ie(a),c={...e.search};for(let e of a)try{Object.assign(c,Nt(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{Lt(t,e)}catch{}u=e}let d={matchedRoutes:a,fullPath:s.fullPath,search:c,params:u};return this.lightweightCache.set(e,[r,d]),d}},jt=class extends Error{},Mt=class extends Error{};function Nt(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new jt(`Async validation not supported`);if(n.issues)throw new jt(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 Pt(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;n&&i.push(({search:e,next:t,meta:i})=>{let a=t(e);if(r)try{let e=Nt(n,a);if(i&&e)for(let t in e)t in a||(i.defaulted||=new Map).set(t,e[t]);return{...a,...e}}catch{}return a})}let a=(e,n,r)=>{if(e>=i.length){if(!t.search)return{};if(t.search===!0)return n;let e=fe(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 Ft(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 dt}function It(e,t){return e===!1||e===null?Object.create(null):(e??!0)===!0?t:Object.assign(t,fe(e,t))}function Lt(e,t){let n=e.options.params?.parse??e.options.parseParams;n&&Object.assign(t,n(t))}function Rt(e,t){return e.options[t]?.preload?.()}function zt(e,t){let n=Rt(e,`component`),r=Rt(e,`pendingComponent`),i=t&&r?r.then(t):r;return t&&!r&&t(),n&&i?Promise.all([n,i]).then(()=>{}):n??i}function Bt(e,t,n){let r=()=>t===!1?void 0:t?Rt(e,t):zt(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 Vt(e){let t=e.findIndex(e=>e.status!==`success`||e._notFound)+1;return t&&t<e.length?e.slice(0,t):e}var Ht=0,Ut=1,Wt=2,Gt=3,Kt=4;function qt(e){return typeof e[0]==`number`}function Jt(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 Yt(e,t){return e.routesById[t.routeId]}function Xt(e,t,n){return pt(e)?[Gt,e]:Ue(e)?(e.routeId||=n,[Wt,e]):(t&&typeof e?.then==`function`&&(e=Error(`A Promise was thrown`,{cause:e})),t?[Ut,e]:[Ht,e])}function Zt(e,t){let n=Xt(t,!0,e.id);if(n[0]!==Ut)return n;try{e.options.onError?.(n[1])}catch(t){n=Xt(t,!0,e.id)}return n}function Qt(e,t,n){return n[0].signal.aborted||!n[2]()?(n[0].abort(),[Kt]):Zt(e,t)}function $t(e,t){return n=>e.navigate({...n,_fromLocation:t})}async function en(e,t,n,r,i){let[a,o]=t,s=n[0].signal,c=!!n[4];for(let t=n[7]??0;t<r;t++){let r=o[t],i=Yt(e,r);r.abortController=n[0];let l=o[t-1]?.context??e.options.context??{},u={params:r.params,location:a,navigate:$t(e,a),buildLocation:e.buildLocation,cause:c?`preload`:r.cause,abortController:n[0],preload:c,matches:o,routeId:i.id},d=l;try{let e=r._ctx;!e&&i.options.context&&(e=r._ctx=i.options.context({...u,deps:r.loaderDeps,context:l})||{}),d={...l,...e},r.context=d}catch(a){return nn(e,r),[t,Qt(i,a,n)]}if(s.aborted||!n[2]())return n[0].abort(),[t,[Kt]];let f=r.paramsError??r.searchError;if(f!==void 0)return nn(e,r),[t,Qt(i,f,n)];let p=i.options.beforeLoad;if(!p)continue;let m={...u,search:r.search,context:d,...e.options.additionalContext},h=r.status;h===`success`&&(r.status=`pending`),n[8]?.();try{cn(e,r,`beforeLoad`,n[0]);let a=await Jt(p(m),s);if(!n[2]())return n[0].abort(),[t,[Kt]];let o=Xt(a,!1,i.id);if(o[0]!==Ht)return nn(e,r),[t,o];r.context={...d,...a}}catch(a){return nn(e,r),[t,Qt(i,a,n)]}finally{h===`success`&&r.status===`pending`&&(r.status=`success`),cn(e,r,!1,n[0])}}i()}function tn(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 nn(e,t){let n=t._flight;t._flight=void 0,tn(e,t,n)?.abort()}function rn(e,t,n){let r=[];for(let i of t)if(!n?.includes(i)){let t=i._flight;i._flight=void 0;let n=tn(e,i,t);n&&r.push(n)}for(let e of r)e.abort()}function an(e,t,n){let r=[];for(let i of t)if(!n.includes(i)){let t=i._flight;if(i._flight=void 0,t?.[2]===1&&e._flights?.get(i.id)===t&&n.some(e=>e.id===i.id))t[2]=0;else{let n=tn(e,i,t);n&&r.push(n)}}for(let e of r)e.abort()}function on(e){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()}function sn(e){for(let t of e){let e=t._flight;e&&e[2]++}}function cn(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 ln(e,t,n,r,i,a,o){let s=t[0];return{params:n.params,location:s,navigate:$t(e,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 un(e,t,n,r,i,a,o,s){let c=s.signal;if(c.aborted)return[Kt];if(!i)return[Ht,void 0];let l=n._flight;cn(e,n,`loader`,s);try{if(!l){let s=new AbortController;l=[Promise.resolve().then(()=>i(ln(e,t,n,r,s,a,o))).then(e=>Xt(e,!1,r.id),e=>Xt(e,!0,r.id)).then(t=>(t[0]!==Ht&&e._flights?.get(n.id)===l&&(e._flights.delete(n.id),l[2]||s.abort()),t[0]===Ut&&l[2]?Zt(r,t[1]):t)),s,1],(e._flights??=new Map).set(n.id,l)}return n._flight=l,n.abortController=l[1],await Jt(l[0],c)}catch(t){if(t!==c)throw t;return nn(e,n),[Kt]}finally{cn(e,n,!1,s)}}function dn(e,t,n){t[0]===Ht?(e.loaderData=t[1],e.error=void 0,e.status=`success`,e.invalid=!1,e.updatedAt=Date.now(),e.preload=n):t[0]!==Gt&&(e.status=`success`,e.error=void 0,e.invalid=!0)}function fn(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&&nn(e,r)}function pn(e,t){return t[0]===Ut||t[0]===Wt?{...e,status:t[0]===Ut?`error`:`notFound`,error:t[1],_flight:void 0}:e}function mn(e,t,n,r,i,a){let o=t[1][n],s=Yt(e,o),c=!!a[4],l=c?e._cache.get(o.id):void 0,u,d=!1,f;try{if(o.status===`success`&&(u=s.options.shouldReload,typeof u==`function`&&(u=u(ln(e,t,o,s,a[0],i,c))),a[2]()||(a[0].abort(),f=[Kt])),!f)if(o.status!==`success`)d=!0;else{let t=a[4]||o.preload?s.options.preloadStaleTime??e.options.defaultPreloadStaleTime??3e4:s.options.staleTime??e.options.defaultStaleTime??0;d=!!(o.invalid||u||u===void 0&&Date.now()-o.updatedAt>=t&&(a[6]||o.cause===`enter`||a[3].some(e=>e.routeId===o.routeId&&e.id!==o.id)))}}catch(t){o.invalid=!0,nn(e,o),f=Qt(s,t,a)}let p=s.options.loader,m=typeof p==`function`?p:p?.handler,h=(!c||s.options.preload!==!1)&&p?e._flights?.get(o.id):void 0;h===o._flight||f?h=void 0:h&&!d&&!c&&u===void 0?d=!0:d||(h=void 0);let g=!!(p&&d&&o.status===`success`&&!c&&!a[5]&&((typeof p==`function`?void 0:p?.staleReloadMode)??e.options.defaultStaleReloadMode)!==`blocking`),_=d&&(!c||s.options.preload!==!1),v=_&&!g&&(o.status!==`success`||!!p),y=s.lazyFn&&s._lazy!==!0?a[8]:void 0;if(_&&!p&&(o.invalid=!1,o.updatedAt=Date.now()),h&&h[2]++,v){let t=o._flight;o._flight=h,tn(e,o,t)?.abort(),o.status===`success`&&(o.status=`pending`),a[8]?.()}_||(o.isFetching=!1);let b=(f?Promise.resolve(f):v?un(e,t,o,s,m,i,c,a[0]):Promise.resolve([Ht,o.loaderData])).then(t=>(v&&(dn(o,t,c),t[0]===Ht&&(c&&p&&!a[0].signal.aborted&&fn(e,o,l),o.status=`pending`)),t)),x=Jt(Promise.resolve().then(()=>Bt(s,void 0,y)),a[0].signal).then(()=>void 0,e=>[n,Qt(s,e,a)]).then(e=>b.then(t=>(v&&!e&&t[0]===Ht&&o.status===`pending`&&a[2]()&&(o.status=`success`,a[8]?.()),e)));if(r.push([n,b,x]),!g)return b.then(e=>pn(o,e));let ee={...o,status:`pending`,preload:!1,_flight:h};o.invalid=!1,o.isFetching=`loader`;let S=un(e,t,ee,s,m,i,!1,a[0]).then(e=>(o.isFetching=!1,dn(ee,e,!1),e));return(t[2]??=[]).push([n,S,x,ee]),S.then(e=>pn(ee,e))}async function hn(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=Yt(e,t[n]),a=Bt(i,!1);if(a)try{await Jt(a,r)}catch(e){if(e===r)throw e}if(i.options.notFoundComponent)return n}return a?.routeId?o:i}function gn(e,t){t[2]&&=(rn(e,t[2].map(e=>e[3])),void 0)}async function _n(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]>=Gt)throw[a,t];!i&&t[0]!==Ht&&(i=[a,t],await Promise.all((n??[]).map(e=>{if(!(e[0]<=a))return e[1].then(t=>{if(t[0]===Gt)throw[e[0],t]})})))}})))}catch(e){return e}return t??i}async function vn(e,t,n,r,i,a,o){let s=t[1],c=await a,l=!1,u=s.findIndex(e=>e._notFound),d=t=>t[1][0]===Wt?hn(e,s,t,r.signal):t[0],f=u<0?s.length:u;if((c?.[1][0]??0)>=Gt)f=0;else if(c){f=c[2]??=await d(c);for(let e of n){if(e[0]>=f)break;let t=await e[1];if(t[0]!==Ht&&t[0]<Gt&&!(`loaderData`in s[e[0]])){c=[e[0],t],f=c[2]=await d(c);break}}}for(let e of n){if(e[0]>=f)break;let t=await e[2];if(t){c=t;break}}if((c?.[1][0]??0)>=Gt){let n=c[1];if(n[0]!==Gt||n[1].options.reloadDocument||i<20)return gn(e,t),n;l=!0,c=[0,[Ut,Error(`Too many redirects`)]]}let p=c?c[2]??await d(c):u;if(p>=0){let i=c?.[1],a=i?.[0],u=s[p],d=i?.[1],f=()=>{i&&(u._notFound=void 0,a===Ut?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)};f();try{await Jt(i?Promise.resolve().then(()=>Bt(Yt(e,u),a===Ut?`errorComponent`:`notFoundComponent`)):Promise.all([Bt(Yt(e,u)),Bt(Yt(e,u),`notFoundComponent`)]),r.signal)}catch(n){if(n===r.signal)return gn(e,t),[Kt]}i?l&&(r.abort(),await Promise.all([...n.map(e=>e[1]),...n.map(e=>e[2]),...(t[2]??[]).map(e=>e[1])]),gn(e,t),rn(e,s),f()):(u.status=`success`,o?.())}return t}async function yn(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=Yt(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 Jt(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)break;console.error(e)}if(r.status!==`success`||r._notFound)break}return t}async function bn(e,t,n,r){let i=[t,n],a=n.findIndex(e=>e._notFound);if(e.options.notFoundMode!==`root`&&a>=0){let t=await hn(e,i[1],void 0,r[0].signal,a);t!==a&&(n[a]._notFound=void 0,n[t]._notFound=!0),a=t}let o=a<0?n.length:a+1,s=[],c=r[7]??0,l=c?Promise.resolve(i[1][c-1]):void 0,u=()=>{for(let t=c;t<o&&!r[0].signal.aborted;t++)l=mn(e,i,t,s,l,r)},d=await en(e,i,r,o,u);d&&(r[5]=!0,o=d[0],d[1][0]===Wt?(d[2]=await hn(e,i[1],d,r[0].signal),o=Math.min(o,d[2]+1)):d[1][0]>=Gt&&(o=0),u()),r[2]()&&!r[4]&&on(e);let f;try{let t=vn(e,i,s,r[0],r[1],_n(s,d,i[2]),r[8]);i[2]?.length&&(i[3]=_n(i[2],void 0,void 0,t.then(e=>qt(e)?0:Vt(e[1]).length,()=>0))),f=await t}catch(t){throw gn(e,i),t}return qt(f)?f:yn(e,f,r[0].signal,r[7]===f[1].length?r[7]:0)}function xn(e,t){let n=e.stores.matches.get();for(let r=0;r<t.length;r++){let i=t[r],a=i.status===`success`,o=a&&n[r]?.id===i.id&&n[r]?.status===`pending`;if(a&&!o)continue;let s=Yt(e,i),c=o||i.invalid?0:s.options.pendingMs??e.options.defaultPendingMs,l=s.options.pendingComponent??e.options.defaultPendingComponent;return l&&typeof c==`number`&&c!==1/0?[c,r,s.options.pendingMinMs??e.options.defaultPendingMinMs??0,l]:void 0}}function Sn(e,t){if(e._tx!==t)return;let n=e._pending,r=!1,i=n?.[0][3][n[1]]?.id;n?.[0]!==t&&(n&&t[3][n[1]]?.id===i?(n[0]=t,r=!0):(clearTimeout(n?.[3]),e._pending=n=void 0));let a=xn(e,t[3]);if(!a)return;let[o,s,c,l]=a,u=t[3][s].id;if(!n||n[1]!==s||i!==u){clearTimeout(n?.[3]);let r=e.stores.matches.get()[s],i=r?.id===u&&r.status===`pending`;e._pending=n=[t,s,i?Date.now()+c:t[4]+o,void 0,i?Promise.resolve(!0):void 0,l]}if(n[4]&&!r&&n[5]===l)return;if(n[5]=l,!n[4]){clearTimeout(n[3]);let r=n[2]-Date.now();if(r>0){n[3]=setTimeout(()=>{Sn(e,t)},r);return}n[2]=0}let d=t[3].map(e=>({...e,_flight:void 0}));d[s].status=`pending`;let f=e.startTransition(()=>e.stores.setMatches(d),d).then(t=>(t&&e._pending===n&&n[4]===f&&!n[2]&&(n[2]=Date.now()+c),t));n[4]=f}function Cn(e,t){let n=e._pending;n?.[0]===t&&(clearTimeout(n[3]),e._pending=void 0)}function wn(e,t){e._committed=t,e.stores.setMatches(t)}function Tn(e,t){rn(e,t[1]),gn(e,t)}function En(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=Vt(n).length,s=new Map,c=Date.now();for(let t of[...i,...a.values()]){if(t.status!==`success`||n.some((e,n)=>e.id===t.id&&(n<o||e.status===`success`)))continue;let r=Yt(e,t);!r.options.loader||c-t.updatedAt>=(t.preload?r.options.preloadGcTime??e.options.defaultPreloadGcTime??3e5:r.options.gcTime??e.options.defaultGcTime??3e5)||s.set(t.id,a.get(t.id)===t?t:{...t,_flight:void 0,isFetching:!1,context:{}})}t[3]=[],e._cache=s,wn(e,n),rn(e,[...a.values(),...i],[...n,...s.values()]),kt(e,i,n,()=>e._tx===t)}async function Dn(e,t){let n=e._tx;for(;n&&n!==t;){if(await n[5],e._tx===n)return;n=e._tx}}async function On(e,t,n){await e.navigate({...n.options,replace:!0,ignoreBlocker:!0,_redirects:t[1]+1})}function kn(e,t){Cn(e,t),t[0].abort(),rn(e,t[3]),t[3]=[],e._tx===t&&(e.batch(()=>{e.stores.status.set(`idle`),e.stores.setMatches(e._committed)}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0))}async function An(e,t,n,r,i){let a=n.map(e=>({...e}));sn(a);for(let t of r)nn(e,a[t[0]]),a[t[0]]=t[3];let o=[t[2],a],s;try{s=await vn(e,o,r,t[0],t[1],i)}catch(t){throw rn(e,a),t}if(qt(s)){rn(e,a),s[0]===Gt&&e._tx===t&&e._committed===n&&await On(e,t,s[1]);return}let c=await yn(e,s,t[0].signal);if(e._tx!==t||e._committed!==n){rn(e,c[1]);return}for(let t of c[1]){let n=e._cache.get(t.id);n?._flight&&n._flight===t._flight&&(e._cache.delete(t.id),nn(e,n))}wn(e,c[1]),rn(e,n,c[1])}async function jn(e,t,n,r,i,a){let o=[t[0],t[1],()=>e._tx===t&&!!t[3].length,e._committed,void 0,i,n,a,r],s=await bn(e,t[2],t[3],o);if(qt(s)){s[0]===Gt&&e._tx===t?(Cn(e,t),rn(e,t[3]),t[3]=[],e._tx===t&&await On(e,t,s[1])):kn(e,t);return}let c=e._pending;if(c?.[0]===t&&(clearTimeout(c[3]),c[4])){let n=t[0].signal,r=!1;try{r=await Jt(c[4],n)}catch(e){if(e!==n)throw e}if(r&&e._pending===c&&c[0]===t){let e=c[2]-Date.now();if(e>0){try{await Jt(new Promise(t=>{c[3]=setTimeout(t,e)}),n)}catch{}clearTimeout(c[3])}}}if(e._tx!==t){Cn(e,t),Tn(e,s);return}let l=t[2],u=Ot(l,e.stores.resolvedLocation.get()),d=s[2];await e.startViewTransition(async()=>{if(e._tx!==t){Tn(e,s);return}let n=await e.startTransition(()=>{Cn(e,t),En(e,t,s[1],a),e._tx===t&&(e.emit({type:`onLoad`,...u}),e._tx===t&&e.emit({type:`onBeforeRouteMount`,...u}))},s[1]);if(e._tx!==t){gn(e,s);return}d?.length&&An(e,t,s[1],d,s[3]).catch(console.error),e.batch(()=>{e.stores.resolvedLocation.set(l),e.stores.status.set(`idle`),e._tx===t&&e.emit({type:`onResolved`,...u}),n&&e._tx===t&&e.emit({type:`onRendered`,...u})}),e._tx===t&&(e._commitPromise?.resolve(),e._commitPromise=void 0)})}async function Mn(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){await Dn(e,n);return}let f=Ot(a,r);if(e.emit({type:`onBeforeNavigate`,...f}),u.signal.aborted||e.emit({type:`onBeforeLoad`,...f}),u.signal.aborted){await Dn(e,n);return}let p=i.href===a.href,m,h=u;try{m=e.matchRoutes(a,{_controller:u}),sn(m)}catch(t){if(u.abort(),!pt(t)){await Dn(e),e._commitPromise?.resolve(),e._commitPromise=void 0;return}await e.navigate({...t.options,replace:!0,ignoreBlocker:!0}),await Dn(e,n);return}let g=l?c[1](m):void 0;if(g?h=l:l?.abort(),u.signal.aborted){rn(e,m),await Dn(e,n);return}e._preflight=void 0;let _=[h,s,a,m,Date.now(),Promise.resolve().then(()=>jn(e,_,p,()=>Sn(e,_),t?.sync,g)).catch(()=>{e._tx===_&&kn(e,_)})];if(e._tx=_,n){for(let t of e.stores.matches.get()){if(e._tx!==_)break;t.isFetching&&cn(e,t,!1)}n[0].abort(),an(e,n[3],_[3])}if(e._tx!==_){rn(e,_[3]),_[3]=[],await Dn(e,_);return}e.batch(()=>{e.stores.status.set(`pending`),e.stores.location.set(a)}),Sn(e,_);try{await _[5]}finally{await Dn(e,_)}}async function Nn(e,t,n=0){if(n>20)return;let r=t._builtLocation??e.buildLocation(t),i=e._committed,a=new AbortController,o;try{o=e.matchRoutes(r,{_controller:a}),sn(o)}catch(e){a.abort(),Ue(e)||console.error(e);return}(e._preloads??=new Map).set(a,o);let s;try{let t;try{t=await bn(e,r,o,[a,n,()=>!0,i,!0])}finally{s=e._preloads.delete(a),rn(e,o),a.abort()}if(!qt(t))return t[1];if(s&&t[0]===Gt&&!t[1].options.reloadDocument)return Nn(e,{...t[1].options,_fromLocation:r},n+1)}catch(e){Ue(e)||console.error(e)}}var Pn=class{get to(){return this._to}get id(){return this._id}get path(){return this._path}get fullPath(){return this._fullPath}constructor(t){if(this.init=t=>{this.originalIndex=t.originalIndex;let n=this.options,r=!n?.path&&!n?.id;this.parentRoute=this.options.getParentRoute?.(),r?this._path=dt:this.parentRoute||T();let i=r?dt:n?.path;i&&i!==`/`&&(i=Te(i));let a=n?.id||i,o=r?dt:e([this.parentRoute.id===`__root__`?``:this.parentRoute.id,a]);i===`__root__`&&(i=`/`),o!==`__root__`&&(o=e([`/`,o]));let s=o===`__root__`?`/`:e([this.parentRoute.fullPath,i]);this._path=i,this._id=o,this._fullPath=s,this._to=ke(s)},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=>ft({from:this.fullPath,...e}),this.options=t||{},this.isRoot=!t?.getParentRoute,t?.id&&t?.path)throw Error(`Route cannot have both an 'id' and a 'path' option.`)}},Fn=class extends Pn{constructor(e){super(e)}},k=h(b(),1),A=o();function In(e){return(0,A.jsx)(Ln,{...e})}var Ln=class extends k.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?k.createElement(this.props.errorComponent??Rn,{error:e,reset:this.reset}):this.props.children}};function Rn({error:e}){let[t,n]=k.useState(!1);return(0,A.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,A.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,A.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,A.jsx)(`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`})]}),(0,A.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,A.jsx)(`div`,{children:(0,A.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,A.jsx)(`code`,{children:e.message}):null})}):null]})}var zn=k.createContext(void 0),Bn=k.createContext(void 0),j=(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))(j||{});function Vn({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(!0)}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(!0)}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 Hn(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=[],Wn=0,{link:Gn,unlink:Kn,propagate:qn,checkDirty:Jn,shallowPropagate:Yn}=Vn({update(e){return e._update()},notify(e){Un[Zn++]=e,e.flags&=~j.Watching},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=j.Mutable|j.Dirty,tr(e))}}),Xn=0,Zn=0,Qn,$n=0;function er(e){try{++$n,e()}finally{--$n||nr()}}function tr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Kn(n,e)}function nr(){if(!($n>0)){for(;Xn<Zn;){let e=Un[Xn];Un[Xn++]=void 0,e.notify()}Xn=0,Zn=0}}function rr(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?j.None:j.Mutable,get(){return Qn!==void 0&&Gn(i,Qn,Wn),i._snapshot},subscribe(e){let t=Hn(e),n={current:!1},r=ir(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=Qn,o=t?.compare??Object.is;if(n)Qn=i,++Wn,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=j.Mutable|j.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{Qn=a,n&&(i.flags&=~j.RecursedCheck),tr(i)}}};return n?(i.flags=j.Mutable|j.Dirty,i.get=function(){let e=i.flags;if(e&j.Dirty||e&j.Pending&&Jn(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Yn(e)}}else e&j.Pending&&(i.flags=e&~j.Pending);return Qn!==void 0&&Gn(i,Qn,Wn),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(qn(e),Yn(e),nr())}},i}function ir(e){let t=()=>{let t=Qn;Qn=n,++Wn,n.depsTail=void 0,n.flags=j.Watching|j.RecursedCheck;try{return e()}finally{Qn=t,n.flags&=~j.RecursedCheck,tr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:j.Watching|j.RecursedCheck,notify(){let e=this.flags;e&j.Dirty||e&j.Pending&&Jn(this.deps,this)?t():this.flags=j.Watching},stop(){this.flags=j.None,this.depsTail=void 0,tr(this)}};return t(),n}var ar={};function or(e,t){let n=k.useRef();return r=>{let a=e?.select?e.select(r):r;return e?.structuralSharing??t.options.defaultStructuralSharing?n.current=i(n.current,a):a}}function sr(e){let t=Oe(),n=k.useContext(e.from?Bn:zn),r=e.from??n,i=t.stores.getMatchStore(r),a=or(e,t),o=u(i,e=>e?a(e):ar);if(o!==ar)return o;(e.shouldThrow??!0)&&T()}function cr(e){return sr({from:e.from,strict:e.strict,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.loaderData):t.loaderData})}function lr(e){let{select:t,...n}=e;return sr({...n,select:e=>t?t(e.loaderDeps):e.loaderDeps})}function ur(e){return sr({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 dr(e){return sr({from:e.from,strict:e.strict,shouldThrow:e.shouldThrow,structuralSharing:e.structuralSharing,select:t=>e.select?e.select(t.search):t.search})}function fr(e){return sr({...e,select:t=>e.select?e.select(t.context):t.context})}var pr=class extends Pn{constructor(e){super(e),this.useMatch=e=>sr({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>fr({...e,from:this.id}),this.useSearch=e=>dr({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ur({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>lr({...e,from:this.id}),this.useLoaderData=e=>cr({...e,from:this.id}),this.useNavigate=()=>le({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,A.jsx)(d,{ref:t,from:this.fullPath,...e}))}};function mr(e){return new pr(e)}function hr(){return e=>_r(e)}var gr=class extends Fn{constructor(e){super(e),this.useMatch=e=>sr({select:e?.select,from:this.id,structuralSharing:e?.structuralSharing}),this.useRouteContext=e=>fr({...e,from:this.id}),this.useSearch=e=>dr({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useParams=e=>ur({select:e?.select,structuralSharing:e?.structuralSharing,from:this.id}),this.useLoaderDeps=e=>lr({...e,from:this.id}),this.useLoaderData=e=>cr({...e,from:this.id}),this.useNavigate=()=>le({from:this.fullPath}),this.Link=k.forwardRef((e,t)=>(0,A.jsx)(d,{ref:t,from:this.fullPath,...e}))}};function _r(e){return new gr(e)}function vr(e){return new yr(e,{silent:!0}).createRoute}var yr=class{constructor(e,t){this.path=e,this.createRoute=e=>{let t=mr(e);return t.isRoot=!1,t},this.silent=t?.silent}};function br(e,t){let n,r,i,a=()=>(n||=(i=void 0,e().then(e=>{n=void 0,r=e[t??`default`]}).catch(e=>{n=void 0,i=e})),n),o=function(e){if(i){if(me(i)&&typeof sessionStorage<`u`){let e=`tanstack_router_reload:${i.message}`;if(!sessionStorage.getItem(e))throw sessionStorage.setItem(e,`1`),window.location.reload(),new Promise(()=>{})}throw i}if(!r)if(Fe)Fe(a());else throw a();return k.createElement(r,e)};return o.preload=a,o}function xr(e){let t=Oe(),n=`not-found-${u(t.stores.location,e=>e.pathname)}-${u(t.stores.status,e=>e)}`;return(0,A.jsx)(In,{getResetKey:()=>n,onCatch:(t,n)=>{if(Ue(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(Ue(t))return e.fallback?.(t);throw t},children:e.children})}function Sr(){return(0,A.jsx)(`p`,{children:`Not Found`})}function Cr(e){return(0,A.jsx)(A.Fragment,{children:e.children})}function wr(e,t,n){return t.options.notFoundComponent?(0,A.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,A.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,A.jsx)(Sr,{})}function Tr(e,t){let n=t?.options.pendingComponent??e.options.defaultPendingComponent;return n?(0,A.jsx)(n,{}):null}var Er=(e,t)=>e[0]===t[0]&&e[1]===t[1],Dr=k.memo(function({routeId:e}){let t=Oe();return(0,A.jsx)(Or,{router:t,match:u(t.stores.getMatchStore(e),e=>e)})});function Or({router:e,match:t}){let n=e.routesById[t.routeId],r=Tr(e,n),i=n.options.errorComponent??e.options.defaultErrorComponent,a=n.options.onCatch??e.options.defaultOnCatch,o=n.isRoot?n.options.notFoundComponent??e.options.notFoundRoute?.options.component:n.options.notFoundComponent,s=t.ssr===!1||t.ssr===`data-only`,c=n.options.wrapInSuspense??r??(n.options.errorComponent?.preload||s)?k.Suspense:Cr,l=i?In:Cr,u=o?xr:Cr;return(0,A.jsxs)(n.isRoot?n.options.shellComponent??Cr:Cr,{children:[(0,A.jsx)(zn.Provider,{value:t.routeId,children:(0,A.jsx)(c,{fallback:r,children:(0,A.jsx)(l,{getResetKey:()=>t,errorComponent:i,onCatch:(e,n)=>{if(Ue(e))throw e.routeId??=t.routeId,e;a?.(e,n)},children:(0,A.jsx)(u,{fallback:e=>{if(e.routeId??=t.routeId,e.routeId!==t.routeId)throw e;return k.createElement(o,e)},children:s?(0,A.jsx)(C,{fallback:r,children:(0,A.jsx)(kr,{match:t})}):(0,A.jsx)(kr,{match:t})})})})}),null]})}var kr=k.memo(function({match:e}){let t=Oe(),n=e.routeId,r=t.routesById[n],i=k.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=k.useMemo(()=>{let e=r.options.component??t.options.defaultComponent;return e?(0,A.jsx)(e,{},i):(0,A.jsx)(Ar,{})},[i,r.options.component,t.options.defaultComponent]);if(e.status===`pending`){if(t._tx)throw t._tx[5];return Tr(t,r)}if(e.status===`notFound`)return wr(t,r,e.error);if(e.status===`error`)throw e.error;return a}),Ar=k.memo(function(){let e=Oe(),t=k.useContext(zn),n,r,i;{let a=e.stores.getMatchStore(t);[n,r]=u(a,e=>[!!e._notFound,e.error],Er),i=u(e.stores.ids,e=>e[e.indexOf(t)+1])}if(n)return wr(e,e.routesById[t],r);if(!i)return null;let a=(0,A.jsx)(Dr,{routeId:i});return t===`__root__`?(0,A.jsx)(k.Suspense,{fallback:Tr(e),children:a}):a});function jr(e,t){let n=e[1];e.length=0,n?.(t)}function Mr(){let e=Oe(),t=e._rendered??=[];return e.startTransition=(e,n)=>new Promise((r,i)=>{jr(t,!1),t.push(n,r),k.startTransition(()=>{try{e()}catch(e){t[1]===r&&(t.length=0),i(e)}})}),ie(()=>{let n=e.history.subscribe(e.load);e.updateLatestLocation();let r=e.latestLocation,i=e.buildLocation({to:r.pathname,search:!0,params:!0,hash:!0,state:!0,_includeValidateSearch:!0});if(ke(r.publicHref)!==ke(i.publicHref))return e.commitLocation({...i,replace:!0,ignoreBlocker:!0}),n;let a=e.stores.resolvedLocation.get();return a?.href===r.href&&a.state.__TSR_key===r.state.__TSR_key?t.push(e.stores.matches.get(),t=>{t&&e.emit({type:`onRendered`,...Ot(a,a)})}):e._tx||e.load().catch(console.error),n},[e,e.history]),null}function Nr(){let e=Oe(),t=e.routesById[dt],n=Tr(e,t),r=e.ssr?Cr:k.Suspense,i=(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Mr,{}),(0,A.jsx)(r,{fallback:n,children:(0,A.jsx)(Pr,{})})]});return e.options.InnerWrap?(0,A.jsx)(e.options.InnerWrap,{children:i}):i}function Pr(){let e=Oe(),t=e._rendered,n=u(e.stores.matches,e=>t[0]??e),r=n[0],i=r?.routeId;ie(()=>{t[0]===n&&jr(t,!0)},[t,n]);let a=i?(0,A.jsx)(Dr,{routeId:i}):null;return(0,A.jsx)(zn.Provider,{value:i,children:e.options.disableGlobalCatchBoundary?a:(0,A.jsx)(In,{getResetKey:()=>r,onCatch:void 0,children:a})})}var Fr=e=>({createMutableStore:rr,createReadonlyStore:rr,batch:er}),Ir=e=>new Lr(e),Lr=class extends At{constructor(e){super(e,Fr)}};function Rr({router:e,children:t,...n}){Ne(n)&&e.update({...e.options,...n,context:{...e.options.context,...n.context}});let r=(0,A.jsx)(m.Provider,{value:e,children:t});return e.options.Wrap?(0,A.jsx)(e.options.Wrap,{children:r}):r}function zr({router:e,...t}){return(0,A.jsx)(Rr,{router:e,...t,children:(0,A.jsx)(Nr,{})})}var Br=ue((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,ee||(ee=!0,ae());else{var t=n(l);t!==null&&ce(x,t.startTime-e)}}var ee=!1,S=-1,te=5,ne=-1;function re(){return g?!0:!(e.unstable_now()-ne<te)}function ie(){if(g=!1,ee){var t=e.unstable_now();ne=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(S),S=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&re());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&ce(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}}}finally{i?ae():ee=!1}}}var ae;if(typeof y==`function`)ae=function(){y(ie)};else if(typeof MessageChannel<`u`){var oe=new MessageChannel,se=oe.port2;oe.port1.onmessage=ie,ae=function(){se.postMessage(null)}}else ae=function(){_(ie,0)};function ce(t,n){S=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):te=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(S),S=-1):h=!0,ce(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,ee||(ee=!0,ae()))),r},e.unstable_shouldYield=re,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),Vr=ue(((e,t)=>{t.exports=Br()})),Hr=ue((e=>{var t=Vr(),n=b(),r=ae();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}var f=Object.assign,p=Symbol.for(`react.element`),m=Symbol.for(`react.transitional.element`),h=Symbol.for(`react.portal`),g=Symbol.for(`react.fragment`),_=Symbol.for(`react.strict_mode`),v=Symbol.for(`react.profiler`),y=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),S=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.iterator;function ce(e){return typeof e!=`object`||!e?null:(e=se&&e[se]||e[`@@iterator`],typeof e==`function`?e:null)}var le=Symbol.for(`react.client.reference`);function ue(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===le?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case g:return`Fragment`;case v:return`Profiler`;case _:return`StrictMode`;case S:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case h:return`Portal`;case x:return e.displayName||`Context`;case y:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?ue(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return ue(e(t))}catch{}}return null}var de=Array.isArray,C=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,w=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},pe=[],me=-1;function he(e){return{current:e}}function T(e){0>me||(e.current=pe[me],pe[me]=null,me--)}function E(e,t){me++,pe[me]=e.current,e.current=t}var ge=he(null),_e=he(null),ve=he(null),ye=he(null);function be(e,t){switch(E(ve,t),E(_e,e),E(ge,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Vd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Vd(t),e=Hd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}T(ge),E(ge,e)}function xe(){T(ge),T(_e),T(ve)}function Se(e){e.memoizedState!==null&&E(ye,e);var t=ge.current,n=Hd(t,e.type);t!==n&&(E(_e,e),E(ge,n))}function Ce(e){_e.current===e&&(T(ge),T(_e)),ye.current===e&&(T(ye),Qf._currentValue=fe)}var we,Te;function Ee(e){if(we===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);we=t&&t[1]||``,Te=-1<e.stack.indexOf(`
3
3
  at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
4
4
  `+we+e+Te}var De=!1;function Oe(e,t){if(!e||De)return``;De=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
@@ -18,7 +18,7 @@ Error generating stack: `+e.message+`
18
18
  font-size: 13px;
19
19
  color: ${({theme:e})=>e.color.inkDim};
20
20
  max-width: 48ch;
21
- `,Kr=hr()({component:Ar,notFoundComponent:()=>(0,A.jsx)(Wr,{children:(0,A.jsxs)(_,{$gap:3,style:{alignItems:`center`},children:[(0,A.jsx)(a,{children:`Not found`}),(0,A.jsx)(Gr,{children:`This console has no screen at that address.`}),(0,A.jsx)(c,{as:`a`,href:`/`,$variant:`primary`,$size:`sm`,children:`Back to the rack`})]})})}),qr=`modulepreload`,Jr=function(e){return`/`+e},Yr={},Xr=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=Jr(t,n),t=s(t),t in Yr)return;Yr[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`:qr,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)})},Zr=vr(`/_app`)({beforeLoad:async({context:e,location:t})=>{if(!(await e.queryClient.ensureQueryData({queryKey:we.status,queryFn:()=>re(`/api/status`),revalidateIfStale:!0})).authenticated)throw ft({to:`/login`,search:{next:t.href}})},component:br(()=>Xr(()=>import(`./_app-C5mYmzgk.js`),__vite__mapDeps([0,1,2,3])),`component`)}),Qr=vr(`/login`)({validateSearch:e=>typeof e.next==`string`?{next:e.next}:{},component:br(()=>Xr(()=>import(`./login-DNvWG7Nv.js`),__vite__mapDeps([4,1,3,5,6])),`component`)}),$r=vr(`/_app/`)({component:br(()=>Xr(()=>import(`./_app.index-CxunMQ_m.js`),__vite__mapDeps([7,1,2,3,8,9,6,10,11])),`component`)}),ei=vr(`/_app/accounts`)({component:br(()=>Xr(()=>import(`./_app.accounts-e7Mbaxdc.js`),__vite__mapDeps([12,1,2,3,13,14,15,16,8,5,9,6,10])),`component`)}),ti=vr(`/_app/keys`)({component:br(()=>Xr(()=>import(`./_app.keys-DTREQf0P.js`),__vite__mapDeps([17,1,2,3,13,14,15,8,5,6,10])),`component`)}),ni=vr(`/_app/logs`)({component:br(()=>Xr(()=>import(`./_app.logs-Co3QPpc1.js`),__vite__mapDeps([18,1,2,3,15,8,5,6,10])),`component`)}),ri=vr(`/_app/models`)({component:br(()=>Xr(()=>import(`./_app.models-DPSKIyeq.js`),__vite__mapDeps([19,1,2,3,14,15,16,8,5,9,6])),`component`)}),ii=vr(`/_app/settings`)({component:br(()=>Xr(()=>import(`./_app.settings-15ZMiM5O.js`),__vite__mapDeps([20,1,2,3,5,9,6])),`component`)}),ai=vr(`/_app/usage`)({component:br(()=>Xr(()=>import(`./_app.usage-BBffCDCD.js`),__vite__mapDeps([21,1,2,3,6,10,11])),`component`)}),oi=Zr.update({id:`/_app`,getParentRoute:()=>Kr}),si=Qr.update({id:`/login`,path:`/login`,getParentRoute:()=>Kr}),ci=$r.update({id:`/`,path:`/`,getParentRoute:()=>oi}),li={AppAccountsRoute:ei.update({id:`/accounts`,path:`/accounts`,getParentRoute:()=>oi}),AppKeysRoute:ti.update({id:`/keys`,path:`/keys`,getParentRoute:()=>oi}),AppLogsRoute:ni.update({id:`/logs`,path:`/logs`,getParentRoute:()=>oi}),AppModelsRoute:ri.update({id:`/models`,path:`/models`,getParentRoute:()=>oi}),AppSettingsRoute:ii.update({id:`/settings`,path:`/settings`,getParentRoute:()=>oi}),AppUsageRoute:ai.update({id:`/usage`,path:`/usage`,getParentRoute:()=>oi}),AppIndexRoute:ci},ui={AppRoute:oi._addFileChildren(li),LoginRoute:si},di=Kr._addFileChildren(ui)._addFileTypes();function fi(e){let t=t=>{!(t instanceof Pe)||!t.isUnauthenticated||e.isLoginRoute()||e.onUnauthenticated()};return new He({queryCache:new Ve({onError:t}),mutationCache:new ze({onError:t}),defaultOptions:{queries:{retry:(e,t)=>t instanceof Pe&&t.isUnauthenticated?!1:e<2,staleTime:5e3,refetchOnWindowFocus:!0},mutations:{retry:!1}}})}var pi=S`
21
+ `,Kr=hr()({component:Ar,notFoundComponent:()=>(0,A.jsx)(Wr,{children:(0,A.jsxs)(_,{$gap:3,style:{alignItems:`center`},children:[(0,A.jsx)(a,{children:`Not found`}),(0,A.jsx)(Gr,{children:`This console has no screen at that address.`}),(0,A.jsx)(c,{as:`a`,href:`/`,$variant:`primary`,$size:`sm`,children:`Back to the rack`})]})})}),qr=`modulepreload`,Jr=function(e){return`/`+e},Yr={},Xr=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=Jr(t,n),t=s(t),t in Yr)return;Yr[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`:qr,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)})},Zr=vr(`/_app`)({beforeLoad:async({context:e,location:t})=>{if(!(await e.queryClient.ensureQueryData({queryKey:we.status,queryFn:()=>re(`/api/status`),revalidateIfStale:!0})).authenticated)throw ft({to:`/login`,search:{next:t.href}})},component:br(()=>Xr(()=>import(`./_app-OSvB-Dv9.js`),__vite__mapDeps([0,1,2,3])),`component`)}),Qr=vr(`/login`)({validateSearch:e=>typeof e.next==`string`?{next:e.next}:{},component:br(()=>Xr(()=>import(`./login-D-FsWNX8.js`),__vite__mapDeps([4,1,3,5,6])),`component`)}),$r=vr(`/_app/`)({component:br(()=>Xr(()=>import(`./_app.index-CTRlqxOq.js`),__vite__mapDeps([7,1,2,3,8,9,6,10,11])),`component`)}),ei=vr(`/_app/accounts`)({component:br(()=>Xr(()=>import(`./_app.accounts-BOE49WyS.js`),__vite__mapDeps([12,1,2,3,13,14,15,16,8,5,9,6,10,17])),`component`)}),ti=vr(`/_app/keys`)({component:br(()=>Xr(()=>import(`./_app.keys-BNEOjtbu.js`),__vite__mapDeps([18,1,2,3,13,14,15,8,5,6,10])),`component`)}),ni=vr(`/_app/logs`)({component:br(()=>Xr(()=>import(`./_app.logs-BxxqeEhM.js`),__vite__mapDeps([19,1,2,3,15,8,5,6,10])),`component`)}),ri=vr(`/_app/models`)({component:br(()=>Xr(()=>import(`./_app.models-BJi-RGUO.js`),__vite__mapDeps([20,1,2,3,14,15,16,8,5,9,6,17])),`component`)}),ii=vr(`/_app/settings`)({component:br(()=>Xr(()=>import(`./_app.settings-C1gB4w7c.js`),__vite__mapDeps([21,1,2,3,5,9,6])),`component`)}),ai=vr(`/_app/usage`)({component:br(()=>Xr(()=>import(`./_app.usage-B0iHKzmI.js`),__vite__mapDeps([22,1,2,3,6,10,17,11])),`component`)}),oi=Zr.update({id:`/_app`,getParentRoute:()=>Kr}),si=Qr.update({id:`/login`,path:`/login`,getParentRoute:()=>Kr}),ci=$r.update({id:`/`,path:`/`,getParentRoute:()=>oi}),li={AppAccountsRoute:ei.update({id:`/accounts`,path:`/accounts`,getParentRoute:()=>oi}),AppKeysRoute:ti.update({id:`/keys`,path:`/keys`,getParentRoute:()=>oi}),AppLogsRoute:ni.update({id:`/logs`,path:`/logs`,getParentRoute:()=>oi}),AppModelsRoute:ri.update({id:`/models`,path:`/models`,getParentRoute:()=>oi}),AppSettingsRoute:ii.update({id:`/settings`,path:`/settings`,getParentRoute:()=>oi}),AppUsageRoute:ai.update({id:`/usage`,path:`/usage`,getParentRoute:()=>oi}),AppIndexRoute:ci},ui={AppRoute:oi._addFileChildren(li),LoginRoute:si},di=Kr._addFileChildren(ui)._addFileTypes();function fi(e){let t=t=>{!(t instanceof Pe)||!t.isUnauthenticated||e.isLoginRoute()||e.onUnauthenticated()};return new He({queryCache:new Ve({onError:t}),mutationCache:new ze({onError:t}),defaultOptions:{queries:{retry:(e,t)=>t instanceof Pe&&t.isUnauthenticated?!1:e<2,staleTime:5e3,refetchOnWindowFocus:!0},mutations:{retry:!1}}})}var pi=S`
22
22
  :root {
23
23
  color-scheme: light;
24
24
 
@@ -1,4 +1,4 @@
1
- import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,Ot as o,P as s,W as c,b as l,f as u,k as d,x as f}from"./queries-vY5lJqBe.js";import{a as p}from"./index-DnNTc35a.js";import{t as m}from"./Lamp-CSv_5d5k.js";import{n as h,t as g}from"./Field-DdscQ9OO.js";import{i as _,o as v}from"./States-DPTTYUHL.js";var y=i(o()),b=n(),x=e.div`
1
+ import{B as e,D as t,Dt as n,F as r,Kt as i,M as a,Ot as o,P as s,W as c,b as l,f as u,k as d,x as f}from"./queries-vY5lJqBe.js";import{a as p}from"./index--dA3FFSN.js";import{t as m}from"./Lamp-WOotyOTd.js";import{n as h,t as g}from"./Field-DdscQ9OO.js";import{i as _,o as v}from"./States-DPTTYUHL.js";var y=i(o()),b=n(),x=e.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -0,0 +1 @@
1
+ import{m as e}from"./Rack-uDxrjvaz.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};
@@ -0,0 +1,25 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" role="img" aria-label="OmniGateway">
2
+ <title>OmniGateway</title>
3
+ <!--
4
+ Three inbound lines converging into one outbound line: many provider
5
+ accounts behind a single endpoint, which is the whole product in one mark.
6
+
7
+ Drawn on a solid accent badge rather than as bare strokes so it survives a
8
+ 16px tab on either a light or a dark browser chrome without needing two
9
+ variants. Stroke weight is 3 for the same reason — thinner reads as fuzz
10
+ once the icon is scaled down.
11
+ -->
12
+ <rect width="32" height="32" rx="7" fill="#2f5fd0" />
13
+ <g
14
+ fill="none"
15
+ stroke="#ffffff"
16
+ stroke-width="3"
17
+ stroke-linecap="round"
18
+ stroke-linejoin="round"
19
+ >
20
+ <path d="M7 8h5.5l3.5 8" />
21
+ <path d="M7 16h9" />
22
+ <path d="M7 24h5.5l3.5 -8" />
23
+ <path d="M16 16h9" />
24
+ </g>
25
+ </svg>
package/public/index.html CHANGED
@@ -3,8 +3,10 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
+ <!-- Self-hosted, like the fonts: the console contacts no third-party origin. -->
7
+ <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
6
8
  <title>OmniGateway</title>
7
- <script type="module" crossorigin src="/assets/index-DnNTc35a.js"></script>
9
+ <script type="module" crossorigin src="/assets/index--dA3FFSN.js"></script>
8
10
  <link rel="modulepreload" crossorigin href="/assets/queries-vY5lJqBe.js">
9
11
  <link rel="stylesheet" crossorigin href="/assets/index-Co2s5xMk.css">
10
12
  </head>
@@ -1,47 +0,0 @@
1
- import{A as e,B as t,D as n,Dt as r,F as i,I as a,Kt as o,M as s,Ot as c,S as l,c as u,i as d,k as f,o as p,r as m,s as h,t as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,l as b,m as x,t as S}from"./Rack-DANVhi_U.js";import{t as C}from"./CopyValue-BwjFnqW2.js";import{n as w,r as T,t as ee}from"./Toggle-pWcL2A-N.js";import{r as te,t as E}from"./catalog-DmrbfYQe.js";import{t as D}from"./Modal-1tHwlj0o.js";import{a as O,i as ne,l as re,n as k,s as A,t as j}from"./Lamp-CSv_5d5k.js";import{t as M}from"./Chip-D0YiqYkz.js";import{i as N,n as P,r as F,t as I}from"./Field-DdscQ9OO.js";import{t as ie}from"./Meter-Bm1oQE2U.js";import{a as L,i as R,n as z,r as B,t as V}from"./States-DPTTYUHL.js";import{i as H,n as U,r as W,t as G}from"./Table-LkPaHBsj.js";var K=x(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),q=o(c(),1),J=r(),ae=Object.keys(E),Y={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},X={anthropic:`Authorize in the browser, then paste the code Anthropic shows you.`,openai:`Authorize in the browser. When it redirects to localhost, paste the whole URL.`,kimi:`Enter the code on Kimi's device page. This dialog finishes on its own.`},oe=t.ol`
2
- display: flex;
3
- flex-direction: column;
4
- gap: ${({theme:e})=>e.space(3)};
5
- `,se=t.div`
6
- font-family: ${({theme:e})=>e.font.mono};
7
- font-size: 26px;
8
- letter-spacing: 0.22em;
9
- text-align: center;
10
- padding: ${({theme:e})=>e.space(3)};
11
- background: ${({theme:e})=>e.color.panelSunk};
12
- border: 1px solid ${({theme:e})=>e.color.ruleStrong};
13
- border-radius: ${({theme:e})=>e.radius.control};
14
- `,ce=t.p`
15
- font-size: 12px;
16
- color: ${({theme:e})=>e.color.down};
17
- `,le=t.p`
18
- font-size: 12px;
19
- color: ${({theme:e})=>e.color.inkDim};
20
- `;function ue({open:e,onOpenChange:t,onConnected:r}){let[a,o]=(0,q.useState)(`anthropic`),[c,l]=(0,q.useState)(``),[u,p]=(0,q.useState)(null),[h,_]=(0,q.useState)(``),[v,y]=(0,q.useState)(null),b=d(),x=m(),S=(0,q.useCallback)(()=>{p(null),_(``),y(null),l(``),b.reset(),x.reset()},[b,x]),w=(0,q.useCallback)(e=>{e||S(),t(e)},[t,S]);return(0,q.useEffect)(()=>{if(u===null||u.kind!==`device`)return;let e=!1,n=async()=>{try{let n=await g(u.flowId);if(e)return;if(n.status===`complete`){S(),t(!1),r();return}}catch(t){if(e)return;y(R(t)),p(null);return}e||(i=setTimeout(()=>void n(),u.pollIntervalMs))},i=setTimeout(()=>void n(),u.pollIntervalMs);return()=>{e=!0,clearTimeout(i)}},[u,r,t,S]),(0,J.jsx)(D,{open:e,onOpenChange:w,title:`Connect an account`,description:`The gateway stores the resulting token encrypted. It is never shown again after this dialog.`,footer:u===null?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(i,{type:`button`,$variant:`primary`,disabled:b.isPending,onClick:()=>{y(null),b.mutate({provider:a,label:c.trim().length===0?Y[a]:c.trim()},{onSuccess:e=>p(e),onError:e=>y(R(e))})},children:b.isPending?`Starting…`:`Start authorization`})]}):u.kind===`device`?(0,J.jsx)(i,{type:`button`,onClick:()=>w(!1),children:`Cancel`}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(i,{type:`button`,onClick:()=>w(!1),children:`Cancel`}),(0,J.jsx)(i,{type:`button`,$variant:`primary`,disabled:x.isPending||h.trim().length===0,onClick:()=>{u!==null&&(y(null),x.mutate({flowId:u.flowId,code:h.trim()},{onSuccess:()=>{S(),t(!1),r()},onError:e=>y(R(e))}))},children:x.isPending?`Finishing…`:`Finish connecting`})]}),children:(0,J.jsxs)(oe,{children:[u===null?(0,J.jsxs)(s,{$gap:3,children:[(0,J.jsx)(I,{label:`Provider`,children:e=>(0,J.jsx)(N,{...e,value:a,onChange:e=>o(e.target.value),children:ae.map(e=>(0,J.jsx)(`option`,{value:e,children:Y[e]},e))})}),(0,J.jsx)(I,{label:`Label`,hint:`How this account is named in the rack. Defaults to the provider.`,children:e=>(0,J.jsx)(P,{...e,value:c,placeholder:Y[a],onChange:e=>l(e.target.value)})})]}):(0,J.jsxs)(s,{$gap:3,children:[(0,J.jsxs)(s,{$gap:1,children:[(0,J.jsx)(n,{children:`Step 1 — authorize`}),(0,J.jsx)(f,{$gap:2,children:(0,J.jsxs)(i,{as:`a`,href:u.authorizeUrl,target:`_blank`,rel:`noreferrer noopener`,$variant:`primary`,$size:`sm`,children:[(0,J.jsx)(K,{}),`Open `,Y[a]]})}),(0,J.jsx)(C,{value:u.authorizeUrl,label:`Copy authorization link`})]}),u.userCode===null?null:(0,J.jsxs)(s,{$gap:1,children:[(0,J.jsx)(n,{children:`Step 2 — enter this code`}),(0,J.jsx)(se,{children:u.userCode})]}),u.kind===`device`?(0,J.jsxs)(le,{children:[X[a],` Waiting for authorization…`]}):(0,J.jsx)(I,{label:`Authorization code`,hint:X[a],...v===null?{}:{problem:v},children:e=>(0,J.jsx)(P,{...e,value:h,autoFocus:!0,placeholder:a===`openai`?`http://localhost:1455/auth/callback?code=…`:`code#state`,onChange:e=>_(e.target.value)})})]}),v===null||u?.kind===`pkce`?null:(0,J.jsx)(ce,{children:v})]})})}var de=[`anthropic`,`openai`,`kimi`],Z={anthropic:`Anthropic`,openai:`OpenAI`,kimi:`Kimi`},fe=t(L)`
21
- border-left: 3px solid ${({theme:e,$provider:t})=>e.provider[t]};
22
- `,Q=t(P)`
23
- width: 100%;
24
- min-width: 140px;
25
- height: 26px;
26
- font-family: ${({theme:e})=>e.font.sans};
27
- font-size: 12.5px;
28
- background: transparent;
29
- border-color: transparent;
30
-
31
- &:hover:not(:disabled),
32
- &:focus {
33
- background: ${({theme:e})=>e.color.panelSunk};
34
- border-color: ${({theme:e})=>e.color.ruleStrong};
35
- }
36
- `,$=t(F)`
37
- width: 62px;
38
- height: 26px;
39
- `,pe=t.span`
40
- display: block;
41
- padding-left: 9px;
42
- font-size: 11px;
43
- color: ${({theme:e})=>e.color.inkDim};
44
- `,me=t(f)`
45
- min-width: 130px;
46
- gap: 6px;
47
- `;function he(){let e=l();return{pending:e.isPending,commit:(t,n)=>{e.mutate({id:t,patch:n})}}}function ge(){let{cadence:t}=v(),r=h(),o=p(t(1e4)),c=_(),l=u(),{commit:d}=he(),[m,g]=(0,q.useState)(!1),[x,C]=(0,q.useState)(null),E=Date.now(),D=r.data??[],N=O(o.data?.health??[],e=>e.credentialId),P=O(o.data?.quota??[],e=>e.credentialId),F=c.data?.quotaPollIntervalMs??3e5,I=D.filter(e=>e.enabled).length,R=r.isLoading?`Reading connected accounts…`:D.length===0?`No provider credentials are connected, so every request fails at the router.`:`${I} of ${D.length} accounts are enabled and eligible for routing.`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(S,{legend:`Accounts`,title:`Provider accounts`,summary:R,actions:(0,J.jsxs)(i,{type:`button`,$variant:`primary`,onClick:()=>g(!0),children:[(0,J.jsx)(T,{}),`Connect an account`]})}),r.isError?(0,J.jsx)(L,{legend:`Accounts`,children:(0,J.jsx)(z,{error:r.error,onRetry:()=>void r.refetch()})}):r.isLoading?(0,J.jsx)(L,{legend:`Accounts`,children:(0,J.jsx)(B,{rows:5})}):D.length===0?(0,J.jsx)(L,{legend:`Accounts`,children:(0,J.jsx)(V,{legend:`Nothing connected`,message:`Connect a provider account to give the router something to dispatch to. Tokens are encrypted at rest and never shown again.`,action:(0,J.jsx)(i,{type:`button`,$variant:`primary`,$size:`sm`,onClick:()=>g(!0),children:`Connect an account`})})}):(0,J.jsx)(s,{$gap:4,children:de.filter(e=>D.some(t=>t.provider===e)).map(t=>{let r=D.filter(e=>e.provider===t);return(0,J.jsx)(fe,{$provider:t,legend:Z[t],meta:`${r.length} account${r.length===1?``:`s`}`,flush:!0,children:(0,J.jsx)(e,{children:(0,J.jsxs)(G,{children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(W,{$width:`24%`,children:`Account`}),(0,J.jsx)(W,{$width:`20%`,children:`Sign-in`}),(0,J.jsx)(W,{$align:`right`,$width:`86px`,children:`Tier`}),(0,J.jsx)(W,{$align:`right`,$width:`94px`,children:`Weight`}),(0,J.jsx)(W,{$align:`center`,$width:`86px`,children:`Enabled`}),(0,J.jsx)(W,{$width:`160px`,children:`Quota`}),(0,J.jsx)(W,{$align:`right`,$width:`88px`,children:`TTFT`}),(0,J.jsx)(W,{$align:`right`,$width:`130px`,children:`Token expires`}),(0,J.jsx)(W,{$width:`48px`})]})}),(0,J.jsx)(`tbody`,{children:r.map(e=>{let t=ne(N.get(e.id)??[],E,e.enabled,e.disabledReason),r=re(P.get(e.id)??[]);return(0,J.jsxs)(H,{children:[(0,J.jsxs)(U,{children:[(0,J.jsxs)(f,{$gap:2,children:[(0,J.jsx)(j,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,J.jsx)(Q,{defaultValue:e.label,"aria-label":`Label for ${e.label}`,onBlur:t=>{let n=t.target.value.trim();if(n.length===0||n===e.label){t.target.value=e.label;return}d(e.id,{label:n})}})]}),t.note===``?null:(0,J.jsx)(pe,{children:t.note})]}),(0,J.jsx)(U,{children:(0,J.jsxs)(f,{$gap:1,children:[(0,J.jsx)(M,{children:e.authType===`oauth`?`oauth`:`api key`}),e.accountEmail===null?null:(0,J.jsx)(n,{children:e.accountEmail})]})}),(0,J.jsx)(U,{$align:`right`,children:(0,J.jsx)($,{min:1,step:1,defaultValue:e.tier,"aria-label":`Tier for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isInteger(n)||n<1||n===e.tier){t.target.value=String(e.tier);return}d(e.id,{tier:n})}})}),(0,J.jsx)(U,{$align:`right`,children:(0,J.jsx)($,{min:.1,step:.1,defaultValue:e.weight,"aria-label":`Weight for ${e.label}`,onBlur:t=>{let n=Number(t.target.value);if(!Number.isFinite(n)||n<=0||n===e.weight){t.target.value=String(e.weight);return}d(e.id,{weight:n})}})}),(0,J.jsx)(U,{$align:`center`,children:(0,J.jsx)(ee,{checked:e.enabled,label:`Route to ${e.label}`,onCheckedChange:t=>d(e.id,{enabled:t})})}),(0,J.jsx)(U,{children:r===null?(0,J.jsx)(n,{children:`unknown`}):(0,J.jsxs)(me,{children:[(0,J.jsx)(ie,{fraction:r.fraction,label:`${k[r.window.windowType]} window, ${Math.round(r.fraction*100)}% used`}),(0,J.jsx)(n,{children:A(r.window,E,F,y)})]})}),(0,J.jsx)(U,{$align:`right`,$mono:!0,children:b(t.ttftMs)}),(0,J.jsx)(U,{$align:`right`,$mono:!0,children:e.expiresAt===null?`never`:y(e.expiresAt,E)}),(0,J.jsx)(U,{$align:`right`,children:(0,J.jsx)(a,{type:`button`,$variant:`ghost`,$size:`sm`,"aria-label":`Remove ${e.label}`,title:`Remove ${e.label}`,onClick:()=>C(e),children:(0,J.jsx)(te,{})})})]},e.id)})})]})})},t)})}),(0,J.jsx)(ue,{open:m,onOpenChange:g,onConnected:()=>void r.refetch()}),(0,J.jsx)(w,{open:x!==null,onOpenChange:e=>{e||C(null)},title:`Remove account`,body:x===null?``:`Removing "${x.label}" deletes its stored token. Any model target pointing at ${Z[x.provider]} loses this account, and reconnecting means authorizing again.`,confirmLabel:`Remove account`,busy:l.isPending,onConfirm:()=>{x!==null&&l.mutate(x.id,{onSettled:()=>C(null)})}})]})}var _e=ge;export{_e as component};
@@ -1,57 +0,0 @@
1
- import{A as e,B as t,C as n,D as r,Dt as i,E as a,F as o,H as s,M as c,N as l,O as u,h as d,j as f,k as p,m,o as h,s as g,y as _}from"./queries-vY5lJqBe.js";import{a as v,d as y,f as b,l as x,o as S,r as C,s as w,t as T,u as E}from"./Rack-DANVhi_U.js";import{a as D,c as O,i as k,l as ee,n as A,o as j,r as M,s as N,t as P}from"./Lamp-CSv_5d5k.js";import{n as F,t as I}from"./Chip-D0YiqYkz.js";import{t as L}from"./Meter-Bm1oQE2U.js";import{a as R,n as z,t as B}from"./States-DPTTYUHL.js";import{i as V,n as H,r as U,t as W}from"./Table-LkPaHBsj.js";import{t as G}from"./Readout-CYg6UOop.js";var K=i(),q=t(l)`
2
- font-weight: 500;
3
- display: block;
4
- max-width: 24ch;
5
- `,J=t.span`
6
- font-size: 11px;
7
- color: ${({theme:e})=>e.color.inkDim};
8
- `,Y=t.div`
9
- display: flex;
10
- align-items: center;
11
- gap: 6px;
12
- width: 118px;
13
- `;function te({credentials:t,health:n,quota:i,usage:a,quotaPollIntervalMs:c,now:l}){let u=D(n,e=>e.credentialId),d=D(i,e=>e.credentialId),f=new Map(a.map(e=>[e.key,e])),m={down:0,warn:1,ok:2,idle:3},h=t.map(e=>({credential:e,status:k(u.get(e.id)??[],l,e.enabled,e.disabledReason),quota:ee(d.get(e.id)??[]),usage:f.get(e.id)})).sort((e,t)=>m[e.status.state]-m[t.status.state]||e.credential.tier-t.credential.tier);return(0,K.jsx)(R,{legend:`Accounts`,meta:`${t.length} connected`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/accounts`,$size:`sm`,children:`Manage accounts`}),children:t.length===0?(0,K.jsx)(B,{legend:`No accounts`,message:`The gateway has no provider credentials, so every request will fail. Connect one to start routing.`,action:(0,K.jsx)(o,{as:s,to:`/accounts`,$variant:`primary`,$size:`sm`,children:`Connect an account`})}):(0,K.jsx)(e,{children:(0,K.jsxs)(W,{children:[(0,K.jsx)(`thead`,{children:(0,K.jsxs)(`tr`,{children:[(0,K.jsx)(U,{children:`Account`}),(0,K.jsx)(U,{children:`Provider`}),(0,K.jsx)(U,{$align:`right`,children:`Tier`}),(0,K.jsx)(U,{children:`Quota`}),(0,K.jsx)(U,{$align:`right`,children:`TTFT`}),(0,K.jsx)(U,{$align:`right`,children:`Requests`}),(0,K.jsx)(U,{$align:`right`,children:`Last used`})]})}),(0,K.jsx)(`tbody`,{children:h.map(({credential:e,status:t,quota:n,usage:i})=>(0,K.jsxs)(V,{children:[(0,K.jsx)(H,{children:(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(P,{state:t.state,label:t.note===``?`healthy`:t.note}),(0,K.jsxs)(`div`,{children:[(0,K.jsx)(q,{children:e.label}),t.note===``?null:(0,K.jsx)(J,{children:t.note})]})]})}),(0,K.jsx)(H,{children:(0,K.jsx)(F,{provider:e.provider})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:e.tier}),(0,K.jsx)(H,{children:n===null?(0,K.jsx)(J,{children:`unknown`}):(0,K.jsxs)(Y,{children:[(0,K.jsx)(L,{fraction:n.fraction,label:`${A[n.window.windowType]} window, ${Math.round(n.fraction*100)}% used`}),(0,K.jsx)(r,{children:N(n.window,l,c,y)})]})}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:x(t.ttftMs)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:i===void 0?`—`:w(i.requests)}),(0,K.jsx)(H,{$align:`right`,$mono:!0,children:y(t.lastUsedAt,l)})]},e.id))})]})})})}var X=t.ul`
14
- display: flex;
15
- flex-direction: column;
16
- `,Z=t.li`
17
- display: flex;
18
- align-items: center;
19
- gap: ${({theme:e})=>e.space(2)};
20
- padding: 6px ${({theme:e})=>e.space(3)};
21
- border-bottom: 1px solid ${({theme:e})=>e.color.rule};
22
-
23
- &:last-child {
24
- border-bottom: 0;
25
- }
26
- `,Q=t(l)`
27
- font-family: ${({theme:e})=>e.font.mono};
28
- font-size: 12px;
29
- max-width: 30ch;
30
- `,ne=t(u)`
31
- color: ${({theme:e})=>e.color.down};
32
- font-size: 11px;
33
- `;function re({logs:e}){let t=e.slice(0,12);return(0,K.jsx)(R,{legend:`Activity`,meta:`most recent first`,flush:!0,actions:(0,K.jsx)(o,{as:s,to:`/logs`,$size:`sm`,children:`Open logs`}),children:t.length===0?(0,K.jsx)(B,{legend:`No traffic yet`,message:`Point a client at this gateway with an API key and the requests will appear here.`}):(0,K.jsx)(X,{children:t.map(e=>(0,K.jsxs)(Z,{children:[(0,K.jsx)(P,{state:j(e)?`down`:`ok`,label:j(e)?`failed with ${e.status}`:`succeeded`}),(0,K.jsx)(u,{$dim:!0,children:S(e.at)}),(0,K.jsx)(Q,{title:e.requestedModel,children:e.requestedModel||`—`}),e.resolvedProvider===null?null:(0,K.jsx)(u,{$dim:!0,style:{color:`var(--p-${e.resolvedProvider})`},children:e.resolvedProvider}),(0,K.jsx)(f,{}),e.errorCode===null?null:(0,K.jsx)(ne,{children:e.errorCode}),e.attempts>1?(0,K.jsxs)(u,{$dim:!0,children:[e.attempts,`×`]}):null,(0,K.jsx)(u,{$dim:!0,children:x(e.durationMs)}),(0,K.jsx)(u,{$dim:!0,children:b(e.costUsd)})]},e.id))})})}var ie=t.ul`
34
- display: flex;
35
- flex-direction: column;
36
- gap: ${({theme:e})=>e.space(3)};
37
- `,ae=t(l)`
38
- font-family: ${({theme:e})=>e.font.mono};
39
- font-size: 12.5px;
40
- `,oe=t.div`
41
- display: flex;
42
- height: 5px;
43
- border-radius: 2px;
44
- overflow: hidden;
45
- background: ${({theme:e})=>e.color.panelSunk};
46
- border: 1px solid ${({theme:e})=>e.color.rule};
47
- `,se=t.div`
48
- flex: ${({$grow:e})=>e} 0 0;
49
- background: ${({$color:e})=>e};
50
- opacity: 0.8;
51
- `,ce=t.div`
52
- flex: ${({$grow:e})=>e} 0 0;
53
- `;function le({models:e,logs:t}){let n=new Map;for(let e of t){let t=n.get(e.requestedModel)??{requests:0,costUsd:0};t.requests+=1,t.costUsd+=e.costUsd,n.set(e.requestedModel,t)}let i=Math.max(1,...[...n.values()].map(e=>e.requests)),a=[...e].map(e=>({model:e,used:n.get(e.id)})).sort((e,t)=>(t.used?.requests??0)-(e.used?.requests??0)).slice(0,8);return(0,K.jsx)(R,{legend:`Models`,meta:`${e.length} configured`,actions:(0,K.jsx)(o,{as:s,to:`/models`,$size:`sm`,children:`Edit routing`}),children:e.length===0?(0,K.jsx)(B,{legend:`No models`,message:`Nothing is routable yet. Create a virtual model and point it at one or more provider targets.`,action:(0,K.jsx)(o,{as:s,to:`/models`,$variant:`primary`,$size:`sm`,children:`Create a model`})}):(0,K.jsx)(ie,{children:a.map(({model:e,used:t})=>{let n=(t?.requests??0)/i,a=[...new Set(e.targets.map(e=>e.provider))];return(0,K.jsxs)(`li`,{children:[(0,K.jsxs)(p,{$gap:2,children:[(0,K.jsx)(ae,{title:e.id,children:e.id}),e.isAlias?(0,K.jsx)(I,{children:`alias`}):null,(0,K.jsx)(I,{$tone:`accent`,children:e.strategy}),(0,K.jsx)(f,{}),(0,K.jsx)(u,{$dim:!0,children:w(t?.requests??0)}),(0,K.jsx)(r,{children:`req`}),(0,K.jsx)(u,{$dim:!0,children:b(t?.costUsd??0)})]}),(0,K.jsxs)(oe,{style:{marginTop:6},title:`${Math.round(n*100)}% of the busiest model`,children:[a.map(e=>(0,K.jsx)(se,{$color:`var(--p-${e})`,$grow:n/a.length},e)),(0,K.jsx)(ce,{$grow:Math.max(0,1-n)})]})]},e.id)})})})}var ue=t.div`
54
- display: grid;
55
- grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
56
- gap: ${({theme:e})=>e.space(3)};
57
- `;function de({logs:e,windowMs:t,now:n}){let r=e.filter(e=>n-e.at<=t),i=O(r,t),a=M(r,{now:n,spanMs:t,count:32}),o=i.errorRate>=.25?`down`:i.errorRate>=.05?`warn`:`ok`;return(0,K.jsxs)(ue,{children:[(0,K.jsx)(G,{legend:`Requests`,value:w(i.requests),unit:`${i.ratePerMin.toFixed(1)}/min`,trace:(0,K.jsx)(C,{values:a.map(e=>e.total),overlay:a.map(e=>e.errors),label:`${i.requests} requests, ${i.errors} of them failed`})}),(0,K.jsx)(G,{legend:`Error rate`,value:E(i.errorRate),unit:`${w(i.errors)} failed`,tone:i.requests===0?`ink`:o,trace:(0,K.jsx)(C,{values:a.map(e=>e.errors),scaleTo:Math.max(...a.map(e=>e.total)),color:`var(--down)`,label:`${i.errors} failed requests against ${i.requests} total`})}),(0,K.jsx)(G,{legend:`Time to first token`,value:x(i.ttftP50),unit:`p95 ${x(i.ttftP95)}`,trace:(0,K.jsx)(C,{values:a.map(e=>e.ttftMs??0),color:`var(--ok)`,label:`median first-token latency, currently ${x(i.ttftP50)}`})}),(0,K.jsx)(G,{legend:`Spend`,value:b(i.costUsd),unit:`${w(i.inputTokens+i.outputTokens)} tokens`,trace:(0,K.jsx)(C,{values:a.map(e=>e.costUsd),color:`var(--warn)`,label:`spend over the window, ${b(i.costUsd)} total`})})]})}var $=36e5;function fe(){let{cadence:e}=v(),t=g(),r=h(e(1e4)),i=d(),o=m(500,e(1e4)),s=_(),l=Date.now(),u=Math.floor((l-$)/6e4)*6e4,f=n({groupBy:`credential`,since:u},e(6e4)),p=t.data??[],y=D(r.data?.health??[],e=>e.credentialId),b=p.filter(e=>k(y.get(e.id)??[],l,e.enabled,e.disabledReason).state===`down`),x=t.isLoading||o.isLoading?`Reading the gateway…`:p.length===0?`No accounts are connected, so every request fails at the router.`:b.length>0?`${b.length} account${b.length===1?` is`:`s are`} out of rotation.`:`All ${p.length} accounts are answering. Nothing needs attention.`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(T,{legend:`Rack`,title:`Gateway`,summary:x}),o.isError?(0,K.jsx)(R,{legend:`Traffic`,children:(0,K.jsx)(z,{legend:`The gateway did not answer`,error:o.error,onRetry:()=>void o.refetch()})}):(0,K.jsxs)(c,{$gap:4,children:[(0,K.jsx)(de,{logs:o.data??[],windowMs:$,now:l}),(0,K.jsx)(te,{credentials:p,health:r.data?.health??[],quota:r.data?.quota??[],usage:f.data??[],quotaPollIntervalMs:s.data?.quotaPollIntervalMs??3e5,now:l}),(0,K.jsxs)(a,{$min:`340px`,$gap:4,children:[(0,K.jsx)(le,{models:i.data??[],logs:o.data??[]}),(0,K.jsx)(re,{logs:o.data??[]})]})]})]})}var pe=fe;export{pe as component};