cartethyia 2.3.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboard/assets/{BannedPage-Dc8V-nxc.js → BannedPage-CvnNj-tj.js} +1 -1
- package/dist/dashboard/assets/{CliToolDetailPage-ifAh7wbK.js → CliToolDetailPage-DdYuTZKs.js} +1 -1
- package/dist/dashboard/assets/{CliToolsPage-2A1c_dFb.js → CliToolsPage-Ba55GO-L.js} +1 -1
- package/dist/dashboard/assets/{ConsoleLogPage-FfxY8_yn.js → ConsoleLogPage-D-OQwsYE.js} +1 -1
- package/dist/dashboard/assets/{CustomizationPage-CZ5H40Ha.js → CustomizationPage-BMqN7mc4.js} +1 -1
- package/dist/dashboard/assets/{HealthEventsModal-CZKQak_s.js → HealthEventsModal-C5cygmiy.js} +1 -1
- package/dist/dashboard/assets/{LoginPage-sqFYY4uv.js → LoginPage-lI7CDb07.js} +1 -1
- package/dist/dashboard/assets/{OverviewPage-BOZJaauG.js → OverviewPage-HaMJcZaC.js} +1 -1
- package/dist/dashboard/assets/{ProviderDetailPage-CNUCsNFg.js → ProviderDetailPage-Pb-0zXVA.js} +1 -1
- package/dist/dashboard/assets/{ProvidersPage-CsXoemJ1.js → ProvidersPage-KifbSUkV.js} +1 -1
- package/dist/dashboard/assets/{ProxyPage-DvRt3aZP.js → ProxyPage-DKLnIcne.js} +1 -1
- package/dist/dashboard/assets/{QuotaPage-DNYJWw7s.js → QuotaPage-BzG3XTSg.js} +1 -1
- package/dist/dashboard/assets/{SetupPage-Cz1DWkcr.js → SetupPage-Cu42oonZ.js} +1 -1
- package/dist/dashboard/assets/{StudioPage-CsKD9sy-.js → StudioPage-DIglSNvf.js} +1 -1
- package/dist/dashboard/assets/{UsagePage-_Zu6460J.js → UsagePage-DQh2rUsY.js} +1 -1
- package/dist/dashboard/assets/{entry-COuKgXuV.js → entry-6PSJYbzI.js} +3 -3
- package/dist/dashboard/assets/{index-CF94-Gob.js → index-Bysq3XgY.js} +2 -2
- package/dist/dashboard/index.html +1 -1
- package/package.json +2 -1
- package/scripts/cli/cli-launcher.cjs +12 -1
- package/scripts/cli/cli.ts +923 -657
- package/scripts/cli/menu.ts +107 -53
- package/scripts/cli/runtime-state.ts +48 -32
- package/scripts/cli/setup.ts +448 -443
- package/scripts/cli/wordmark.ts +58 -0
- package/src/boot/app.ts +39 -0
- package/src/console/auth/account-reset.ts +67 -0
- package/src/console/backup/export-endpoint.ts +111 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LoginPage-
|
|
2
|
-
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{t as i}from"./index-CF94-Gob.js";import{c as a,o,r as s,s as c,t as l}from"./app-BDJWMThu.js";import{i as u,n as d,r as f,t as p}from"./terminal-C9mZ4Ugm.js";import{_ as m,c as h,f as g,g as _,h as v,l as y,m as b,n as x,o as ee,p as te,s as ne,t as S,u as re}from"./toast-DKAdP2mo.js";import{t as ie}from"./dialog-iocKA3jr.js";import{C as ae,S as C,_ as w,d as oe,f as se,g as ce,h as le,m as ue,n as de,p as fe,r as pe,s as me,u as he,w as T}from"./assert-Bwh6DJTK.js";import{A as ge,C as _e,D as E,E as ve,N as ye,O as be,S as xe,T as Se,_ as D,a as O,c as k,d as Ce,g as we,h as Te,i as A,n as Ee,r as j,s as De,t as M,u as Oe,v as ke,x as Ae,y as je}from"./query-keys-ROf-g1Wi.js";import{t as Me}from"./mutation-BIizFZav.js";import{t as N}from"./useMutation-DVmwOKU-.js";import{t as Ne}from"./dialog-actions-B1axpEg7.js";var Pe=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Fe=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ie=e(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Le=e(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Re=e(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),ze=e(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Be=e(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Ve=e(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),He=e(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ue=e(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),We=e(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ge=e(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ke=e(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),qe=class extends je{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Me({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=Je(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=Je(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=Je(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=Je(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){D.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=>Se(t,e))}findAll(e={}){return this.getAll().filter(t=>Se(e,t))}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return D.batch(()=>Promise.all(e.map(e=>e.continue().catch(E))))}};function Je(e){return e.options.scope?.id}var Ye=class extends je{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??_e(r,t),a=this.get(i);return a||(a=new Ce({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}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(){D.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=>ve(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ve(e,t)):t}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){D.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){D.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xe=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ye,this.#t=e.mutationCache||new qe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ke.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=we.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),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ge(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}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=Ae(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return D.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;D.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return D.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=D.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(E).catch(E)}invalidateQueries(e,t={}){return D.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=D.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(E)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(E)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(ge(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ge(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(E).catch(E)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(E).catch(E)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return we.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(xe(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{be(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(xe(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{be(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||=_e(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===ye&&(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()}},P=t(n(),1),Ze=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Qe=/^[\\/]{2}/;function $e(e,t){return t+e.replace(/\\/g,`/`)}var et=`popstate`;function tt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function nt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return at(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:L(t)}return ot(t,n,null,e)}function F(e,t){if(e===!1||e==null)throw Error(t)}function I(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function rt(){return Math.random().toString(36).substring(2,10)}function it(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function at(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?R(t):t,state:n,key:t&&t.key||r||rt(),mask:i}}function L({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function R(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ot(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=tt(e)?e:at(h.location,e,t);n&&n(r,e),l=u()+1;let d=it(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=tt(e)?e:at(h.location,e,t);n&&n(r,e),l=u();let i=it(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return st(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(et,d),c=e,()=>{i.removeEventListener(et,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function st(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),F(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:L(t);return i=i.replace(/ $/,`%20`),!n&&Qe.test(i)&&(i=r+i),new URL(i,r)}function ct(e,t,n=`/`){return lt(e,t,n,!1)}function lt(e,t,n,r,i){let a=z((typeof t==`string`?R(t):t).pathname||`/`,n);if(a==null)return null;let o=i??ut(e),s=null,c=Dt(a);for(let e=0;s==null&&e<o.length;++e)s=Ct(o[e],c,r);return s}function ut(e){let t=dt(e);return pt(t),t}function dt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;F(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=B([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(F(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),dt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:xt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Et(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ft(e.path))a(e,t,!0,n)}),t}function ft(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ft(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function pt(e){e.sort((e,t)=>e.score===t.score?St(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var mt=/^:[\w-]+$/,ht=3,gt=2,_t=1,vt=10,yt=-2,bt=e=>e===`*`;function xt(e,t){let n=e.split(`/`),r=n.length;return n.some(bt)&&(r+=yt),t&&(r+=gt),n.filter(e=>!bt(e)).reduce((e,t)=>e+(mt.test(t)?ht:t===``?_t:vt),r)}function St(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Ct(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Tt(u,l,s.matcher,s.compiledParams):wt(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=wt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:B([a,d.pathname]),pathnameBase:Ft(B([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=B([a,d.pathnameBase]))}return o}function wt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Et(e.path,e.caseSensitive,e.end);return Tt(e,t,n,r)}function Tt(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=V(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=V(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Et(e,t=!1,n=!0){I(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Dt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return I(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function z(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ot(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?R(e):e,a;return n?(n=Pt(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?kt(n.substring(1),`/`):kt(n,t)):a=t,{pathname:a,search:It(r),hash:Lt(i)}}function kt(e,t){let n=V(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function At(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function jt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Mt(e){let t=jt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Nt(e,t,n,r=!1){let i;typeof e==`string`?i=R(e):(i={...e},F(!i.pathname||!i.pathname.includes(`?`),At(`?`,`pathname`,`search`,i)),F(!i.pathname||!i.pathname.includes(`#`),At(`#`,`pathname`,`hash`,i)),F(!i.search||!i.search.includes(`#`),At(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Ot(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Pt=e=>e.replace(/[\\/]{2,}/g,`/`),B=e=>Pt(e.join(`/`));function V(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Ft=e=>V(e).replace(/^\/*/,`/`),It=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Lt=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Rt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function zt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Bt(e){return B(e.map(e=>e.route.path).filter(Boolean))||`/`}var Vt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ht(e,t){let n=e;if(typeof n!=`string`||!Ze.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Vt)try{let e=new URL(window.location.href),r=Qe.test(n)?new URL($e(n,e.protocol)):new URL(n),a=z(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{I(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ut=new URL(`http://localhost`);function Wt(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Ut)}catch{return Ut}}function Gt(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Kt(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function qt(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Gt(i,n),s=!Gt(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Kt(e,i)||!Gt(i,a)))throw Error(`External navigation is not allowed`)}var Jt=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Jt);var Yt=[`GET`,...Jt];new Set(Yt);var Xt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Zt(e){try{return Xt.includes(new URL(e).protocol)}catch{return!1}}var H=P.createContext(null);H.displayName=`DataRouter`;var Qt=P.createContext(null);Qt.displayName=`DataRouterState`;var $t=P.createContext(!1);function en(){return P.useContext($t)}var tn=P.createContext({isTransitioning:!1});tn.displayName=`ViewTransition`;var nn=P.createContext(new Map);nn.displayName=`Fetchers`;var rn=P.createContext(null);rn.displayName=`Await`;var U=P.createContext(null);U.displayName=`Navigation`;var an=P.createContext(null);an.displayName=`Location`;var W=P.createContext({outlet:null,matches:[],isDataRoute:!1});W.displayName=`Route`;var on=P.createContext(null);on.displayName=`RouteError`;var sn=`REACT_ROUTER_ERROR`,cn=`REDIRECT`,ln=`ROUTE_ERROR_RESPONSE`;function un(e){if(e.startsWith(`${sn}:${cn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function dn(e){if(e.startsWith(`${sn}:${ln}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Rt(t.status,t.statusText,t.data)}catch{}}function fn(e,{relative:t}={}){F(pn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=P.useContext(U),{hash:i,pathname:a,search:o}=vn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:B([n,a])),r.createHref({pathname:s,search:o,hash:i})}function pn(){return P.useContext(an)!=null}function G(){return F(pn(),`useLocation() may be used only in the context of a <Router> component.`),P.useContext(an).location}var mn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function hn(e){P.useContext(U).static||P.useLayoutEffect(e)}function K(){let{isDataRoute:e}=P.useContext(W);return e?Fn():gn()}function gn(){F(pn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=P.useContext(H),{basename:t,navigator:n}=P.useContext(U),{matches:r}=P.useContext(W),{pathname:i}=G(),a=JSON.stringify(Mt(r)),o=P.useRef(!1);return hn(()=>{o.current=!0}),P.useCallback((r,s={})=>{if(I(o.current,mn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Nt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:B([t,c.pathname])),qt(typeof r==`string`?r:L(r),n.createHref(c),Wt(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}P.createContext(null);function _n(){let{matches:e}=P.useContext(W);return e[e.length-1]?.params??{}}function vn(e,{relative:t}={}){let{matches:n}=P.useContext(W),{pathname:r}=G(),i=JSON.stringify(Mt(n));return P.useMemo(()=>Nt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function yn(e,t){return bn(e,t)}function bn(e,t,n){F(pn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=P.useContext(U),{matches:i}=P.useContext(W),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Ln(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/LoginPage-lI7CDb07.js","assets/jsx-runtime-CXUMngI_.js","assets/toast-DKAdP2mo.js","assets/app-BDJWMThu.js","assets/app-Cjgo4-Lf.css","assets/log-in-BmRjy60c.js","assets/query-keys-ROf-g1Wi.js","assets/input-Bn4_kNav.js","assets/eye-off-Bk5g2luF.js","assets/eye-C_hawfH4.js","assets/SetupPage-Cu42oonZ.js","assets/layout-Bv-NxqZ5.js","assets/backup-file-gdKIlg8U.js","assets/BannedPage-CvnNj-tj.js","assets/OverviewPage-HaMJcZaC.js","assets/model-bans-CVvHZ-qz.js","assets/assert-Bwh6DJTK.js","assets/useMutation-DVmwOKU-.js","assets/mutation-BIizFZav.js","assets/fingerprint-pattern-BWuHtbW4.js","assets/check-D69FzdvC.js","assets/select-CGUuTQmj.js","assets/chevron-right-BXIy5l3h.js","assets/SortableList-Bol1ASmI.js","assets/stack-C1kTcOmP.js","assets/copy-ngmQ9zcZ.js","assets/download-A0SW9OCW.js","assets/gauge-BbIMy7MB.js","assets/state-DHKdg-pm.js","assets/key-round-UkavsGxp.js","assets/clipboard-button-DQmMikNQ.js","assets/use-clipboard-B0Sy03fE.js","assets/dialog-iocKA3jr.js","assets/use-presence-BSZEBx7U.js","assets/pencil-768ysRAr.js","assets/plus-DIdX_g-x.js","assets/refresh-cw-BqJFk4sU.js","assets/route-CNSNj9Zm.js","assets/search-JOKus9rb.js","assets/shield-check-DVS0Foqh.js","assets/settings-BAS6QbmJ.js","assets/sparkles-BRaRUxAU.js","assets/trash-Cppn5c3R.js","assets/card-BTdbRFFg.js","assets/download-dRFo5_Wu.js","assets/tokens-DDxMbSRL.js","assets/badge-BwmwEOgA.js","assets/ModelPicker-CAiPR5Vd.js","assets/ProviderIcon-paOCq8I0.js","assets/switch-DIDeAiz9.js","assets/inline-DCejSLlA.js","assets/api-keys-CjIGQhe7.js","assets/cli-tools-DccaOfhX.js","assets/quota-DZGyp0N5.js","assets/UsagePage-DQh2rUsY.js","assets/terminal-C9mZ4Ugm.js","assets/drawer-CDKOTZdY.js","assets/circle-check-BU3v_mFW.js","assets/cog-CdWhsajs.js","assets/image-BPaouViG.js","assets/scaling-nWE4Cx8f.js","assets/wrench-B6E1oEuY.js","assets/use-reduced-motion-C4B0R6Sz.js","assets/numbers-CFL4_Dqc.js","assets/use-timeout-BwcBBRrT.js","assets/banner-BKBfKTqn.js","assets/live-YlifPYox.js","assets/stream-retry-5QnVuSSo.js","assets/ProviderDetailPage-Pb-0zXVA.js","assets/arrow-left-CpBxkoxI.js","assets/brain-Cwed_72z.js","assets/circle-alert-CntYHV5v.js","assets/layers-2-glBbjl.js","assets/privacy-mode-CQjbZ3xk.js","assets/rotate-ccw-CufcqITi.js","assets/list-row-BLA0sldD.js","assets/routing-jntw9-Ui.js","assets/HealthEventsModal-C5cygmiy.js","assets/AccountCooldown-ChpdzxRH.js","assets/ProvidersPage-KifbSUkV.js","assets/dialog-actions-B1axpEg7.js","assets/CombosPage-B7ETkfVH.js","assets/arrow-right-Dl5yKnp8.js","assets/QuotaPage-BzG3XTSg.js","assets/sliders-horizontal-ClG7dBeJ.js","assets/ProxyPage-DKLnIcne.js","assets/SettingsPage-YxRml8AT.js","assets/CliToolsPage-Ba55GO-L.js","assets/ToolIcon-K1ckcDKg.js","assets/CliToolDetailPage-DdYuTZKs.js","assets/ConsoleLogPage-D-OQwsYE.js","assets/CustomizationPage-BMqN7mc4.js","assets/StudioPage-DIglSNvf.js","assets/message-circle-CCxGwRvv.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{n as e,o as t,r as n,t as r}from"./jsx-runtime-CXUMngI_.js";import{t as i}from"./index-Bysq3XgY.js";import{c as a,o,r as s,s as c,t as l}from"./app-BDJWMThu.js";import{i as u,n as d,r as f,t as p}from"./terminal-C9mZ4Ugm.js";import{_ as m,c as h,f as g,g as _,h as v,l as y,m as b,n as x,o as ee,p as te,s as ne,t as S,u as re}from"./toast-DKAdP2mo.js";import{t as ie}from"./dialog-iocKA3jr.js";import{C as ae,S as C,_ as w,d as oe,f as se,g as ce,h as le,m as ue,n as de,p as fe,r as pe,s as me,u as he,w as T}from"./assert-Bwh6DJTK.js";import{A as ge,C as _e,D as E,E as ve,N as ye,O as be,S as xe,T as Se,_ as D,a as O,c as k,d as Ce,g as we,h as Te,i as A,n as Ee,r as j,s as De,t as M,u as Oe,v as ke,x as Ae,y as je}from"./query-keys-ROf-g1Wi.js";import{t as Me}from"./mutation-BIizFZav.js";import{t as N}from"./useMutation-DVmwOKU-.js";import{t as Ne}from"./dialog-actions-B1axpEg7.js";var Pe=e(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),Fe=e(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Ie=e(`layout-dashboard`,[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]),Le=e(`log-out`,[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]),Re=e(`memory-stick`,[[`path`,{d:`M12 12v-2`,key:`fwoke6`}],[`path`,{d:`M12 18v-2`,key:`qj6yno`}],[`path`,{d:`M16 12v-2`,key:`heuere`}],[`path`,{d:`M16 18v-2`,key:`s1ct0w`}],[`path`,{d:`M2 11h1.5`,key:`15p63e`}],[`path`,{d:`M20 18v-2`,key:`12ehxp`}],[`path`,{d:`M20.5 11H22`,key:`khsy7a`}],[`path`,{d:`M4 18v-2`,key:`1c3oqr`}],[`path`,{d:`M8 12v-2`,key:`1mwtfd`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`rect`,{x:`2`,y:`6`,width:`20`,height:`10`,rx:`2`,key:`1qcswk`}]]),ze=e(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),Be=e(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Ve=e(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),He=e(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),Ue=e(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),We=e(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ge=e(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]),Ke=e(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),qe=class extends je{#e;#t;#n;constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}build(e,t,n){let r=new Me({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=Je(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=Je(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=Je(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=Je(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){D.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=>Se(t,e))}findAll(e={}){return this.getAll().filter(t=>Se(e,t))}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return D.batch(()=>Promise.all(e.map(e=>e.continue().catch(E))))}};function Je(e){return e.options.scope?.id}var Ye=class extends je{#e;constructor(e={}){super(),this.config=e,this.#e=new Map}build(e,t,n){let r=t.queryKey,i=t.queryHash??_e(r,t),a=this.get(i);return a||(a=new Ce({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}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(){D.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=>ve(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>ve(e,t)):t}notify(e){D.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){D.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){D.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Xe=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Ye,this.#t=e.mutationCache||new qe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ke.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=we.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),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(ge(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}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=Ae(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return D.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;D.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return D.batch(()=>{let r=n.findAll(e),i=new Set(r);return r.forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,predicate:e=>i.has(e)},t)})}cancelQueries(e,t={}){let n={revert:!0,...t},r=D.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(E).catch(E)}invalidateQueries(e,t={}){return D.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=D.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(E)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(E)}async query(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t),r=n.isStaleByTime(ge(t.staleTime,n))?await n.fetch(t):n.state.data,i=t.select;return i?i(r):r}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(ge(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(E).catch(E)}infiniteQuery(e){return e._type=`infinite`,this.query(e)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(E).catch(E)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return we.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(xe(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{be(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(xe(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{be(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||=_e(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===ye&&(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()}},P=t(n(),1),Ze=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Qe=/^[\\/]{2}/;function $e(e,t){return t+e.replace(/\\/g,`/`)}var et=`popstate`;function tt(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function nt(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return at(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:L(t)}return ot(t,n,null,e)}function F(e,t){if(e===!1||e==null)throw Error(t)}function I(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function rt(){return Math.random().toString(36).substring(2,10)}function it(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function at(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?R(t):t,state:n,key:t&&t.key||r||rt(),mask:i}}function L({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function R(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function ot(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=tt(e)?e:at(h.location,e,t);n&&n(r,e),l=u()+1;let d=it(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=tt(e)?e:at(h.location,e,t);n&&n(r,e),l=u();let i=it(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return st(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(et,d),c=e,()=>{i.removeEventListener(et,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function st(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),F(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:L(t);return i=i.replace(/ $/,`%20`),!n&&Qe.test(i)&&(i=r+i),new URL(i,r)}function ct(e,t,n=`/`){return lt(e,t,n,!1)}function lt(e,t,n,r,i){let a=z((typeof t==`string`?R(t):t).pathname||`/`,n);if(a==null)return null;let o=i??ut(e),s=null,c=Dt(a);for(let e=0;s==null&&e<o.length;++e)s=Ct(o[e],c,r);return s}function ut(e){let t=dt(e);return pt(t),t}function dt(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;F(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=B([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(F(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),dt(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:xt(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=Et(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of ft(e.path))a(e,t,!0,n)}),t}function ft(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=ft(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function pt(e){e.sort((e,t)=>e.score===t.score?St(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var mt=/^:[\w-]+$/,ht=3,gt=2,_t=1,vt=10,yt=-2,bt=e=>e===`*`;function xt(e,t){let n=e.split(`/`),r=n.length;return n.some(bt)&&(r+=yt),t&&(r+=gt),n.filter(e=>!bt(e)).reduce((e,t)=>e+(mt.test(t)?ht:t===``?_t:vt),r)}function St(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function Ct(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?Tt(u,l,s.matcher,s.compiledParams):wt(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=wt({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:B([a,d.pathname]),pathnameBase:Ft(B([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=B([a,d.pathnameBase]))}return o}function wt(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=Et(e.path,e.caseSensitive,e.end);return Tt(e,t,n,r)}function Tt(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=V(a,1),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=V(a.slice(0,a.length-e.length),1)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function Et(e,t=!1,n=!0){I(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(\/|$)/g,`(/$1)?$2`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function Dt(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return I(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function z(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function Ot(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?R(e):e,a;return n?(n=Pt(n),a=n.startsWith(`/`)||n.startsWith(`\\`)?kt(n.substring(1),`/`):kt(n,t)):a=t,{pathname:a,search:It(r),hash:Lt(i)}}function kt(e,t){let n=V(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function At(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function jt(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Mt(e){let t=jt(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function Nt(e,t,n,r=!1){let i;typeof e==`string`?i=R(e):(i={...e},F(!i.pathname||!i.pathname.includes(`?`),At(`?`,`pathname`,`search`,i)),F(!i.pathname||!i.pathname.includes(`#`),At(`#`,`pathname`,`hash`,i)),F(!i.search||!i.search.includes(`#`),At(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=Ot(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var Pt=e=>e.replace(/[\\/]{2,}/g,`/`),B=e=>Pt(e.join(`/`));function V(e,t=0){let n=e.length;for(;n>t&&e.charCodeAt(n-1)===47;)n--;return n===e.length?e:e.slice(0,n)}var Ft=e=>V(e).replace(/^\/*/,`/`),It=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,Lt=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,Rt=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function zt(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function Bt(e){return B(e.map(e=>e.route.path).filter(Boolean))||`/`}var Vt=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function Ht(e,t){let n=e;if(typeof n!=`string`||!Ze.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(Vt)try{let e=new URL(window.location.href),r=Qe.test(n)?new URL($e(n,e.protocol)):new URL(n),a=z(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{I(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);var Ut=new URL(`http://localhost`);function Wt(e){if(e.createURL)return e.createURL(`/`);try{return new URL(e.createHref(`/`),Ut)}catch{return Ut}}function Gt(e,t){return e.origin===t.origin&&(e.origin!==`null`||e.protocol===t.protocol&&e.host===t.host)}function Kt(e,t){if(e.startsWith(`//`))return!0;let n=t.protocol.toLowerCase();return e.toLowerCase().startsWith(n)?t.host===``||e.slice(n.length).startsWith(`//`):!1}function qt(e,t,n,r){let i=null;try{i=e==null?null:new URL(e,n)}catch{}let a=new URL(t,n),o=i!=null&&!Gt(i,n),s=!Gt(a,n);if(r===`reject`){if(o||s)throw Error(`External navigation is not allowed`)}else if(s&&(i==null||!Kt(e,i)||!Gt(i,a)))throw Error(`External navigation is not allowed`)}var Jt=[`POST`,`PUT`,`PATCH`,`DELETE`];new Set(Jt);var Yt=[`GET`,...Jt];new Set(Yt);var Xt=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function Zt(e){try{return Xt.includes(new URL(e).protocol)}catch{return!1}}var H=P.createContext(null);H.displayName=`DataRouter`;var Qt=P.createContext(null);Qt.displayName=`DataRouterState`;var $t=P.createContext(!1);function en(){return P.useContext($t)}var tn=P.createContext({isTransitioning:!1});tn.displayName=`ViewTransition`;var nn=P.createContext(new Map);nn.displayName=`Fetchers`;var rn=P.createContext(null);rn.displayName=`Await`;var U=P.createContext(null);U.displayName=`Navigation`;var an=P.createContext(null);an.displayName=`Location`;var W=P.createContext({outlet:null,matches:[],isDataRoute:!1});W.displayName=`Route`;var on=P.createContext(null);on.displayName=`RouteError`;var sn=`REACT_ROUTER_ERROR`,cn=`REDIRECT`,ln=`ROUTE_ERROR_RESPONSE`;function un(e){if(e.startsWith(`${sn}:${cn}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function dn(e){if(e.startsWith(`${sn}:${ln}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new Rt(t.status,t.statusText,t.data)}catch{}}function fn(e,{relative:t}={}){F(pn(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=P.useContext(U),{hash:i,pathname:a,search:o}=vn(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:B([n,a])),r.createHref({pathname:s,search:o,hash:i})}function pn(){return P.useContext(an)!=null}function G(){return F(pn(),`useLocation() may be used only in the context of a <Router> component.`),P.useContext(an).location}var mn=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function hn(e){P.useContext(U).static||P.useLayoutEffect(e)}function K(){let{isDataRoute:e}=P.useContext(W);return e?Fn():gn()}function gn(){F(pn(),`useNavigate() may be used only in the context of a <Router> component.`);let e=P.useContext(H),{basename:t,navigator:n}=P.useContext(U),{matches:r}=P.useContext(W),{pathname:i}=G(),a=JSON.stringify(Mt(r)),o=P.useRef(!1);return hn(()=>{o.current=!0}),P.useCallback((r,s={})=>{if(I(o.current,mn),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=Nt(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:B([t,c.pathname])),qt(typeof r==`string`?r:L(r),n.createHref(c),Wt(n),`reject`),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}P.createContext(null);function _n(){let{matches:e}=P.useContext(W);return e[e.length-1]?.params??{}}function vn(e,{relative:t}={}){let{matches:n}=P.useContext(W),{pathname:r}=G(),i=JSON.stringify(Mt(n));return P.useMemo(()=>Nt(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function yn(e,t){return bn(e,t)}function bn(e,t,n){F(pn(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=P.useContext(U),{matches:i}=P.useContext(W),a=i[i.length-1],o=a?a.params:{},s=a?a.pathname:`/`,c=a?a.pathnameBase:`/`,l=a&&a.route;{let e=l&&l.path||``;Ln(s,!l||e.endsWith(`*`)||e.endsWith(`*?`),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${s}" (under <Route path="${e}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
3
3
|
|
|
4
|
-
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=G(),d;if(t){let e=typeof t==`string`?R(t):t;F(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):ct(e,{pathname:p});I(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),I(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Dn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:B([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:B([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?P.createElement(an.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function xn(){let e=Pn(),t=zt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=P.createElement(P.Fragment,null,P.createElement(`p`,null,`💿 Hey developer 👋`),P.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,P.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,P.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),P.createElement(P.Fragment,null,P.createElement(`h2`,null,`Unexpected Application Error!`),P.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?P.createElement(`pre`,{style:i},n):null,o)}var Sn=P.createElement(xn,null),Cn=class extends P.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:P.createElement(W.Provider,{value:this.props.routeContext},P.createElement(on.Provider,{value:e,children:this.props.component}));return this.context?P.createElement(Tn,{error:e},t):t}};Cn.contextType=$t;var wn=new WeakMap;function Tn({children:e,error:t}){let{basename:n,navigator:r}=P.useContext(U);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=un(t.digest);if(e){let i=wn.get(t);if(i)throw i;let a=Ht(e.location,n),o=a.absoluteURL||a.to;if(qt(e.location,o,Wt(r),`allow-explicit`),Zt(o))throw Error(`Invalid redirect location`);if(Vt&&!wn.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw wn.set(t,n),n}}return P.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function En({routeContext:e,match:t,children:n}){let r=P.useContext(H);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),P.createElement(W.Provider,{value:e},n)}function Dn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);F(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Bt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Sn,o&&(s<0&&c===0?(Ln(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?P.createElement(n.route.Component,null):n.route.element?n.route.element:e,P.createElement(En,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?P.createElement(Cn,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function On(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kn(e){let t=P.useContext(H);return F(t,On(e)),t}function An(e){let t=P.useContext(Qt);return F(t,On(e)),t}function jn(e){let t=P.useContext(W);return F(t,On(e)),t}function Mn(e){let t=jn(e),n=t.matches[t.matches.length-1];return F(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Nn(){return Mn(`useRouteId`)}function Pn(){let e=P.useContext(on),t=An(`useRouteError`),n=Mn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Fn(){let{router:e}=kn(`useNavigate`),t=Mn(`useNavigate`),n=P.useRef(!1);return hn(()=>{n.current=!0}),P.useCallback(async(r,i={})=>{I(n.current,mn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var In={};function Ln(e,t,n){!t&&!In[e]&&(In[e]=!0,I(!1,n))}P.memo(Rn);function Rn({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return bn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function zn({to:e,replace:t,state:n,relative:r}){F(pn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=P.useContext(U);I(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=P.useContext(W),{pathname:s}=G(),c=K(),l=Nt(e,Mt(o),s,r===`path`);qt(typeof e==`string`?e:L(e),a.createHref(l),Wt(a),`reject`);let u=JSON.stringify(l);return P.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function q(e){F(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Bn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){F(!pn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=P.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=R(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=P.useMemo(()=>{let e=z(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return I(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:P.createElement(U.Provider,{value:c},P.createElement(an.Provider,{children:t,value:h}))}function Vn({children:e,location:t}){return yn(Hn(e),t)}P.Component;function Hn(e,t=[]){let n=[];return P.Children.forEach(e,(e,r)=>{if(!P.isValidElement(e))return;let i=[...t,r];if(e.type===P.Fragment){n.push.apply(n,Hn(e.props.children,i));return}F(e.type===q,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),F(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Hn(e.props.children,i)),n.push(a)}),n}var Un=`get`,Wn=`application/x-www-form-urlencoded`;function Gn(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Kn(e){return Gn(e)&&e.tagName.toLowerCase()===`button`}function qn(e){return Gn(e)&&e.tagName.toLowerCase()===`form`}function Jn(e){return Gn(e)&&e.tagName.toLowerCase()===`input`}function Yn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Xn(e,t){return e.button===0&&(!t||t===`_self`)&&!Yn(e)}function Zn(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Qn(e,t){let n=Zn(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var $n=null;function er(){if($n===null)try{new FormData(document.createElement(`form`),0),$n=!1}catch{$n=!0}return $n}var tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function nr(e){return e!=null&&!tr.has(e)?(I(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wn}"`),null):e}function rr(e,t){let n,r,i,a,o;if(qn(e)){let o=e.getAttribute(`action`);r=o?z(o,t):null,n=e.getAttribute(`method`)||Un,i=nr(e.getAttribute(`enctype`))||Wn,a=new FormData(e)}else if(Kn(e)||Jn(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?z(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Un,i=nr(e.getAttribute(`formenctype`))||nr(o.getAttribute(`enctype`))||Wn,a=new FormData(o,e),!er()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Gn(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Un,r=null,i=Wn,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ir(e,t){if(e===!1||e==null)throw Error(t)}function ar(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&z(i.pathname,t)===`/`?`${V(t)}/_root.${r}`:`${V(i.pathname)}.${r}`,i}async function or(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function sr(e){return e!=null&&typeof e.page==`string`}function cr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function lr(e,t,n){return mr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await or(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(cr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ur(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function dr(e,t,{includeHydrateFallback:n}={}){return fr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function fr(e){return[...new Set(e)]}function pr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function mr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!sr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(pr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function hr(){let e=P.useContext(H);return ir(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function gr(){let e=P.useContext(Qt);return ir(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var _r=P.createContext(void 0);_r.displayName=`FrameworkContext`;function vr(){let e=P.useContext(_r);return ir(e,`You must render this element inside a <HydratedRouter> element`),e}function yr(e,t){let n=P.useContext(_r),[r,i]=P.useState(!1),[a,o]=P.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=P.useRef(null);P.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),P.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:br(s,p),onBlur:br(c,m),onMouseEnter:br(l,p),onMouseLeave:br(u,m),onTouchStart:br(d,p)}]:[a,f,{}]:[!1,f,{}]}function br(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function xr({page:e,...t}){let n=en(),{nonce:r}=vr(),{router:i}=hr(),a=P.useMemo(()=>ct(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?P.createElement(Cr,{page:e,matches:a,...t}):P.createElement(wr,{page:e,matches:a,...t})):null}function Sr(e){let{manifest:t,routeModules:n}=vr(),[r,i]=P.useState([]);return P.useEffect(()=>{let r=!1;return lr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Cr({page:e,matches:t,...n}){let r=G(),{future:i}=vr(),{basename:a}=hr(),o=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=ar(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return P.createElement(P.Fragment,null,o.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function wr({page:e,matches:t,...n}){let r=G(),{future:i,manifest:a,routeModules:o}=vr(),{basename:s}=hr(),{loaderData:c,matches:l}=gr(),u=P.useMemo(()=>ur(e,t,l,a,r,`data`),[e,t,l,a,r]),d=P.useMemo(()=>ur(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=ar(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=P.useMemo(()=>dr(d,a),[d,a]),m=Sr(d);return P.createElement(P.Fragment,null,f.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>P.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>P.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Tr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}P.Component;var Er=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Er&&(window.__reactRouterVersion=`7.18.3`)}catch{}function Dr({basename:e,children:t,useTransitions:n,window:r}){let i=P.useRef();i.current??=nt({window:r,v5Compat:!0});let a=i.current,[o,s]=P.useState({action:a.action,location:a.location}),c=P.useCallback(e=>{n===!1?s(e):P.startTransition(()=>s(e))},[n]);return P.useLayoutEffect(()=>a.listen(c),[a,c]),P.createElement(Bn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Or=P.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=P.useContext(U),v=typeof l==`string`&&Ze.test(l),y=Ht(l,h);l=y.to;let b=fn(l,{relative:r}),x=G(),ee=null;if(o){let e=Nt(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:B([h,e.pathname])),ee=g.createHref(e)}let[te,ne,S]=yr(n,p),re=Nr(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ie(t){e&&e(t),t.defaultPrevented||re(t)}let ae=!(y.isExternal||i),C=P.createElement(`a`,{...p,...S,href:(ae?ee:void 0)||y.absoluteURL||b,onClick:ae?ie:e,ref:Tr(m,ne),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return te&&!v?P.createElement(P.Fragment,null,C,P.createElement(xr,{page:b})):C});Or.displayName=`Link`;var kr=P.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=vn(a,{relative:c.relative}),d=G(),f=P.useContext(Qt),{navigator:p,basename:m}=P.useContext(U),h=f!=null&&zr(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=z(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),ee={isActive:b,isPending:x,isTransitioning:h},te=b?e:void 0,ne;ne=typeof n==`function`?n(ee):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let S=typeof i==`function`?i(ee):i;return P.createElement(Or,{...c,"aria-current":te,className:ne,ref:l,style:S,to:a,viewTransition:o},typeof s==`function`?s(ee):s)});kr.displayName=`NavLink`;var Ar=P.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Un,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=P.useContext(U),g=Lr(),_=Rr(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Ze.test(s);return P.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?P.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Ar.displayName=`Form`;function jr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mr(e){let t=P.useContext(H);return F(t,jr(e)),t}function Nr(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=K(),d=G(),f=vn(e,{relative:o});return P.useCallback(p=>{if(Xn(p,t)){p.preventDefault();let t=n===void 0?L(d)===L(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?P.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Pr(e){I(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=P.useRef(Zn(e)),n=P.useRef(!1),r=G(),i=P.useMemo(()=>Qn(r.search,n.current?null:t.current),[r.search]),a=K();return[i,P.useCallback((e,t)=>{let r=Zn(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Fr=0,Ir=()=>`__${String(++Fr)}__`;function Lr(){let{router:e}=Mr(`useSubmit`),{basename:t}=P.useContext(U),n=Nn(),r=e.fetch,i=e.navigate;return P.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=rr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Ir();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Rr(e,{relative:t}={}){let{basename:n}=P.useContext(U),r=P.useContext(W);F(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...vn(e||`.`,{relative:t})},o=G();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:B([n,a.pathname])),L(a)}function zr(e,{relative:t}={}){let n=P.useContext(tn);F(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Mr(`useViewTransitionState`),i=vn(e,{relative:t});if(!n.isTransitioning)return!1;let a=z(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=z(n.nextLocation.pathname,r)||n.nextLocation.pathname;return wt(i.pathname,o)!=null||wt(i.pathname,a)!=null}var Br=t(a(),1),Vr=c(),Hr=`cartethyia.customization`,J=`media`,Ur=`background`,Wr=1,Gr=`/console-backgrounds.jpg`;function Kr(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(Hr,Wr);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(J)||e.createObjectStore(J)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the media database.`)),e}function qr(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The media database rejected the request.`)),t}function Jr(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}async function Yr(){let e=await Kr();try{let t=await qr(e.transaction(J,`readonly`).objectStore(J).get(Ur));if(!t||!t.blob)return null;let n=t;return{blob:n.blob,kind:n.kind,url:URL.createObjectURL(n.blob)}}finally{e.close()}}async function Xr(e,t){let n=await Kr();try{let r=n.transaction(J,`readwrite`);r.objectStore(J).put({blob:e,kind:t},Ur),await Jr(r,`Could not store the background.`)}finally{n.close()}}async function Zr(){let e=await Kr();try{let t=e.transaction(J,`readwrite`);t.objectStore(J).delete(Ur),await Jr(t,`Could not remove the background.`)}finally{e.close()}}var Qr=2560,$r=.85;async function ei(e){let t=await createImageBitmap(e).catch(()=>null);if(!t)return e;try{let n=Math.max(t.width,t.height),r=Math.min(1,Qr/n),i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t.width*r)),i.height=Math.max(1,Math.round(t.height*r));let a=i.getContext(`2d`);return a?(a.drawImage(t,0,0,i.width,i.height),await ri(i)??e):e}finally{t.close()}}var ti=4294967296,ni=268435456;function ri(e){let{promise:t,resolve:n}=Promise.withResolvers();return e.toBlob(e=>n(e),`image/webp`,$r),t}function ii(e){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:null}var ai=[`none`,`frosted`,`vibrancy`,`heavy`],Y={backgroundSet:!1,backgroundEnabled:!0,backgroundRevision:0,backgroundOpacity:20,backgroundScale:100,backgroundX:0,backgroundY:0,backgroundBlur:5,blurCards:`frosted`,blurChrome:`frosted`,blurCardsAmount:45,blurCardsDepth:20,blurChromeAmount:25,blurChromeDepth:10,blurCardsEnabled:!0,blurChromeEnabled:!0,emptyOutline:!1},oi=`cartethyia.customization`,si=`cartethyia-customization-change`,ci=[`cards`,`chrome`];function li(e){return typeof e==`string`&&ai.includes(e)}function X(e,t,n,r){let i=typeof e==`number`?e:Number(e);return Number.isFinite(i)?Math.min(n,Math.max(t,i)):r}function ui(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{backgroundSet:t.backgroundSet===!0,backgroundRevision:X(t.backgroundRevision,0,2**53-1,0),backgroundEnabled:typeof t.backgroundEnabled==`boolean`?t.backgroundEnabled:Y.backgroundEnabled,backgroundOpacity:X(t.backgroundOpacity,0,100,Y.backgroundOpacity),backgroundScale:X(t.backgroundScale,100,180,Y.backgroundScale),backgroundX:X(t.backgroundX,-100,100,Y.backgroundX),backgroundY:X(t.backgroundY,-100,100,Y.backgroundY),backgroundBlur:X(t.backgroundBlur,0,100,Y.backgroundBlur),blurCards:li(t.blurCards)?t.blurCards:Y.blurCards,blurChrome:li(t.blurChrome)?t.blurChrome:Y.blurChrome,blurCardsAmount:X(t.blurCardsAmount,0,100,Y.blurCardsAmount),blurChromeAmount:X(t.blurChromeAmount,0,100,Y.blurChromeAmount),blurCardsDepth:X(t.blurCardsDepth,0,100,Y.blurCardsDepth),blurChromeDepth:X(t.blurChromeDepth,0,100,Y.blurChromeDepth),blurCardsEnabled:t.blurCardsEnabled!==!1,blurChromeEnabled:t.blurChromeEnabled!==!1,emptyOutline:t.emptyOutline===!0}}var di=null;function fi(){if(di)return di;if(typeof window>`u`)return Y;try{di=ui(JSON.parse(window.localStorage.getItem(oi)??`null`))}catch{di={...Y}}return di}function pi(e){if(typeof document>`u`)return;let t=document.documentElement;t.dataset.blurCards=e.blurCards,t.dataset.blurChrome=e.blurChrome,t.style.setProperty(`--blur-cards`,`${e.blurCardsAmount}`),t.style.setProperty(`--blur-chrome`,`${e.blurChromeAmount}`),t.style.setProperty(`--blur-cards-depth`,`${e.blurCardsDepth}`),t.style.setProperty(`--blur-chrome-depth`,`${e.blurChromeDepth}`),t.dataset.blurCardsOn=e.blurCardsEnabled?`true`:`false`,t.dataset.blurChromeOn=e.blurChromeEnabled?`true`:`false`,t.dataset.emptyOutline=e.emptyOutline?`true`:`false`,t.dataset.bgActive=e.backgroundEnabled?`true`:`false`,t.style.setProperty(`--bg-opacity`,(e.backgroundOpacity/100).toFixed(2)),t.style.setProperty(`--bg-scale`,(e.backgroundScale/100).toFixed(2)),t.style.setProperty(`--bg-x`,`${e.backgroundX}%`),t.style.setProperty(`--bg-y`,`${e.backgroundY}%`),t.style.setProperty(`--bg-blur`,`${Math.round(e.backgroundBlur*.4)}px`)}function mi(e){try{window.localStorage.setItem(oi,JSON.stringify(e))}catch{}}function hi(e){let t=ui({...fi(),...e});return di=t,typeof window<`u`&&(mi(t),pi(t),window.dispatchEvent(new CustomEvent(si))),t}function gi(){let[e,t]=(0,P.useState)(fi);return(0,P.useEffect)(()=>{let e=()=>t(fi());return window.addEventListener(si,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(si,e),window.removeEventListener(`storage`,e)}},[]),[e,e=>t(hi(e))]}var _i=ci,Z=r(),vi=`(max-width: 767px)`,yi=`(prefers-reduced-motion: reduce)`;function bi(e){let[t,n]=(0,P.useState)(()=>typeof window<`u`&&window.matchMedia(e).matches);return(0,P.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function xi(){let[e,t]=(0,P.useState)(()=>typeof document>`u`||!document.hidden);return(0,P.useEffect)(()=>{let e=()=>t(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}function Si(){let[e]=gi(),[t,n]=(0,P.useState)(null),r=bi(vi),i=bi(yi),a=xi();(0,P.useEffect)(()=>{if(!e.backgroundSet){n(e=>(e&&URL.revokeObjectURL(e.url),{blob:new Blob,kind:`image`,url:Gr}));return}let t=!1,r=null;return Yr().then(e=>{if(t){e&&URL.revokeObjectURL(e.url);return}r=e,n(e)}).catch(()=>{t||n(null)}),()=>{t=!0,r&&URL.revokeObjectURL(r.url)}},[e.backgroundSet,e.backgroundRevision]);let o=(0,P.useRef)(null),s=t?.kind===`video`&&!r&&!i&&a;return(0,P.useEffect)(()=>{let e=o.current;if(e){if(s){e.play().catch(()=>{});return}e.pause()}},[s]),!t||!e.backgroundEnabled?null:(0,Z.jsx)(`div`,{className:`custom-background`,"data-kind":t.kind,"data-playing":s?`true`:`false`,"aria-hidden":`true`,children:t.kind===`video`?(0,Z.jsx)(`video`,{ref:o,className:`custom-background-media`,src:t.url,autoPlay:s,loop:!0,muted:!0,playsInline:!0,preload:r?`metadata`:`auto`}):(0,Z.jsx)(`img`,{className:`custom-background-media`,src:t.url,alt:``})})}function Ci({open:e,onClose:t,onConfirm:n,title:r,message:i,confirmLabel:a=`Confirm`,cancelLabel:o=`Cancel`,danger:s}){let[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{e&&(l(null),d(!1))},[e]),(0,Z.jsx)(ie,{open:e,onClose:t,title:r,description:i,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,Z.jsx)(`p`,{className:`text-body text-text-secondary leading-normal`,children:i}),c?(0,Z.jsx)(`p`,{role:`alert`,className:`text-caption text-red`,children:c}):null,(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(x,{variant:`secondary`,size:`sm`,onClick:t,disabled:u,children:o}),(0,Z.jsx)(x,{variant:s?`danger`:`primary`,size:`sm`,onClick:()=>{u||(l(null),d(!0),Promise.resolve().then(()=>n()).then(()=>t()).catch(e=>{l(k(e,`Action failed. Please try again.`)),d(!1)}))},disabled:u,children:u?`Working…`:a})]})]})})}var Q=new Xe({defaultOptions:{queries:j,mutations:Ee}});function wi(e){let[t,n]=(e.trim().replace(/^v/i,``).split(`+`,1)[0]??``).split(`-`,2);if(t===void 0||!/^\d+\.\d+\.\d+$/.test(t))return null;let r=t.split(`.`).map(Number);if(r.length!==3||r.some(e=>!Number.isSafeInteger(e)||e<0))return null;let i=n===void 0||n.length===0?[]:n.split(`.`).map(e=>/^\d+$/.test(e)?Number(e):e);return i.some(e=>typeof e==`number`&&(!Number.isSafeInteger(e)||e<0))?null:{core:[r[0]??0,r[1]??0,r[2]??0],prerelease:i}}function Ti(e,t){if(e===void 0||t===void 0)return!1;let n=wi(e),r=wi(t);return n===null||r===null?t.trim()!==e.trim():Ei(r,n)>0}function Ei(e,t){for(let n=0;n<e.core.length;n+=1){let r=e.core[n]??0,i=t.core[n]??0;if(r!==i)return r>i?1:-1}if(e.prerelease.length===0&&t.prerelease.length>0)return 1;if(e.prerelease.length>0&&t.prerelease.length===0)return-1;for(let n=0;n<Math.max(e.prerelease.length,t.prerelease.length);n+=1){let r=e.prerelease[n],i=t.prerelease[n];if(r===void 0)return-1;if(i===void 0)return 1;if(r!==i)return typeof r==`number`&&typeof i==`string`?-1:typeof r==`string`&&typeof i==`number`||r>i?1:-1}return 0}var Di=5e3,Oi=new WeakMap;function ki(e,t){if(t!==`/`&&t!==`/providers`&&t!==`/proxy`)return Promise.resolve();let n=Date.now(),r=Oi.get(e);if(r!==void 0){if(r>n)return Promise.resolve();Oi.delete(e)}return e.fetchQuery({queryKey:M.system.health,queryFn:e=>O(`/system/health`,{signal:w(e)}).then(oe),...j}).then(()=>{Oi.delete(e)}).catch(t=>{Te(t)||Oi.set(e,Date.now()+Di)})}function Ai(){return C({queryKey:M.session.current,queryFn:()=>De(),staleTime:6e4,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1})}function ji(){return C({queryKey:M.system.health,queryFn:e=>O(`/system/health`,{signal:w(e)}).then(oe),...j,refetchInterval:A.status})}function Mi(){return C({queryKey:M.releases.githubLatest,queryFn:e=>O(`/updates/release`,{signal:w(e)}).then(pe),...j,staleTime:18e5,refetchInterval:18e5,retry:!1})}function Ni(e){return C({queryKey:M.usageAnalytics.summary(e),queryFn:t=>O(`/system/usage/summary?period=${encodeURIComponent(e)}`,{signal:w(t)}).then(ce),...j,refetchInterval:A.status})}function Pi(e){return C({queryKey:M.usageAnalytics.chart(e),queryFn:t=>O(`/system/usage/chart?period=${encodeURIComponent(e)}`,{signal:w(t)}).then(fe),...j,refetchInterval:A.status})}function Fi(e,t){return C({queryKey:M.usageAnalytics.by(e,t),queryFn:n=>O(`/system/usage/by-${t}?period=${encodeURIComponent(e)}`,{signal:w(n)}).then(se),...j,refetchInterval:A.status})}function Ii(e,t=50,n){let r=n==null?``:`&httpStatus=${encodeURIComponent(String(n))}`;return C({queryKey:M.usageAnalytics.requests(e,t,n),queryFn:n=>O(`/system/usage/requests?period=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${r}`,{signal:w(n)}).then(le),...j,placeholderData:e=>e,refetchInterval:A.live})}function Li(e){return C({queryKey:M.usageAnalytics.requestDetail(e??`_`),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Request is required`};return O(`/system/usage/requests/${encodeURIComponent(e)}`,{signal:w(t)}).then(ue)},enabled:e!==null,...j})}function Ri(e){return C({queryKey:M.audit.list(e??{}),queryFn:t=>{let n=new URLSearchParams;e?.action&&n.set(`action`,e.action),e?.actor&&n.set(`actor`,e.actor),e?.cursor&&n.set(`cursor`,e.cursor),e?.limit&&n.set(`limit`,String(e.limit));let r=n.toString()?`?${n.toString()}`:``;return O(`/audit${r}`,{signal:w(t)}).then(de)},...j})}function zi(){return C({queryKey:M.providers.all,queryFn:e=>O(`/providers`,{signal:w(e)}).then(he),...j,staleTime:6e4,gcTime:6e5,refetchInterval:A.catalog})}function Bi(e){return C({queryKey:M.providers.models(e),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Provider is required`};return O(`/providers/${encodeURIComponent(e)}/models`,{signal:w(t)}).then(me)},...j,staleTime:3e5,gcTime:6e5,enabled:!!e})}function Vi(){let e=T();return N({mutationFn:({providerId:e,modelIds:t,wireFamily:n,metadata:r})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`POST`,body:JSON.stringify({modelIds:t,...n?{wireFamily:n}:{},...r?{metadata:r}:{}})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)}),S.success(`Models registered`,`${n.modelIds.length} model(s) added to ${n.providerId}`)},onError:e=>{S.error(`Failed to register models`,k(e))}})}function Hi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/models/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await ea(e,r.providerId)}})}function Ui(){return N({mutationFn:e=>O(`/providers/connection-test`,{method:`POST`,body:JSON.stringify(e)})})}function Wi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await ea(e,r.providerId)}})}function Gi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)})}})}function Ki(){let e=T();return N({mutationFn:({providerId:e,modelId:t,route:n,metadata:r})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify({modelId:t,route:n,enabled:!0,metadata:r})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)}),S.success(`Model updated`,`${n.modelId} limits and capabilities saved`)},onError:e=>{S.error(`Failed to update model`,k(e))}})}function qi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`DELETE`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)})}})}function Ji(e){return C({queryKey:M.providers.accounts(e),queryFn:t=>O(`/providers/${encodeURIComponent(e??``)}/accounts`,{signal:w(t)}),enabled:!!e,...j,staleTime:3e4,gcTime:6e5})}function Yi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/accounts`,{method:`POST`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.all})])}})}function Xi(){let e=T();return N({mutationFn:({providerId:e,accounts:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/batch`,{method:`POST`,body:JSON.stringify({accounts:t})}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.all})])}})}function Zi(){let e=T();return N({mutationFn:({providerId:e,accountId:t,request:n})=>O(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}`,{method:`PATCH`,body:JSON.stringify(n)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.all})])}})}function Qi(e,t){return C({queryKey:M.providers.healthEvents(e,t),queryFn:n=>O(`/providers/${encodeURIComponent(e??``)}/accounts/${encodeURIComponent(t??``)}/health-events`,{signal:w(n)}),enabled:!!e&&!!t,...j,refetchInterval:A.status})}async function $i(e,t){await e.invalidateQueries({predicate:e=>{let n=e.queryKey;return n[0]===`console`&&n[1]===`providers`&&n[2]===t&&n[3]===`accounts`&&n[5]===`health-events`}})}async function ea(e,t){await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(t)}),$i(e,t),e.invalidateQueries({queryKey:M.providers.all})])}function ta(){let e=T();return N({mutationFn:({providerId:e,accountId:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/recover`,{method:`POST`,body:`{}`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:M.providers.all})]),S.success(`Account recovered`)},onError:e=>{S.error(`Could not recover the account.`,k(e))}})}function na(){return N({mutationFn:({providerId:e,accountIds:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/export`,{method:`POST`,body:JSON.stringify({accountIds:t})})})}function ra(){return N({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>O(`/providers/${encodeURIComponent(e)}/oauth/authorize`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function ia(){let e=T();return N({mutationFn:({providerId:e,code:t,state:n})=>O(`/providers/${encodeURIComponent(e)}/oauth/callback?${new URLSearchParams({code:t,state:n}).toString()}`),onSuccess:async(t,n)=>{await ea(e,n.providerId)}})}function aa(){return N({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>O(`/providers/${encodeURIComponent(e)}/oauth/device/start`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function oa(){let e=T();return N({mutationFn:({providerId:e,credential:t,fields:n,accountLabel:r})=>O(`/providers/${encodeURIComponent(e)}/oauth/import`,{method:`POST`,body:JSON.stringify({credential:t,...n&&Object.keys(n).length>0?{fields:n}:{},...r?{accountLabel:r}:{}})}),onSuccess:async(t,n)=>{await ea(e,n.providerId),await e.invalidateQueries({queryKey:M.quota.all})}})}function sa(){let e=T();return N({mutationFn:({providerId:e,deviceAuthId:t})=>O(`/providers/${encodeURIComponent(e)}/oauth/device/poll`,{method:`POST`,body:JSON.stringify({deviceAuthId:t})}),onSuccess:async(t,n)=>{t.status===`complete`&&await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.healthEvents(n.providerId,t.accountId)}),e.invalidateQueries({queryKey:M.quota.all}),ea(e,n.providerId)])}})}function ca(){let e=T();return N({mutationFn:e=>O(`/providers`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async t=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.all}),e.invalidateQueries({queryKey:M.modelRouting.all})]),S.success(`Provider created`,t.label??t.providerId)},onError:e=>{S.error(`Failed to create provider`,k(e))}})}function la(){let e=T();return N({mutationFn:({providerId:e,enabled:t})=>O(`/providers/platform/global/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({enabled:t})}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.all}),e.invalidateQueries({queryKey:M.providers.detail(n)})])}})}function ua(e={}){let t=T();return N({mutationFn:e=>O(`/providers/${encodeURIComponent(e)}/models/sync`,{method:`POST`,body:`{}`}),onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:M.providers.models(r)}),e.silent||S.success(`Models fetched`,n.synced>0?`${n.synced} new model${n.synced===1?``:`s`} added`:`No new models found`)},onError:t=>{e.silent||S.error(`Failed to fetch models`,k(t))}})}function da(){let e=T();return N({mutationFn:e=>O(`/providers/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.all}),e.invalidateQueries({queryKey:M.quota.all}),e.invalidateQueries({queryKey:M.modelRouting.all})]),S.success(`Provider deleted`,n)},onError:e=>{S.error(`Failed to delete provider`,k(e))}})}var fa={name:`cartethyia`,version:`2.3.4`,description:`A powerful, self-hosted reverse proxy for OpenAI- and Anthropic-compatible AI clients, powered by native Bun and Elysia. It serves both protocols from a single server, routes every model across any configured provider, and translates requests and responses in real time — streaming and prompt caching included. Underneath it runs a full delivery engine: per-account health tracking, quota and cooldown enforcement, automatic failover across pools and providers, usage accounting, and telemetry. Point OpenCode, Cline, Claude Code, Codex, or any compatible client at Cartethyia and it keeps its native protocol while the gateway absorbs every provider-specific difference behind it. Runs on embedded SQLite or external PostgreSQL with optional Redis coordination, ships as a global CLI with a system-tray console, and needs only Bun 1.4+ alongside Node.js/npm.`,license:`GPL-3.0-only`,type:`module`,packageManager:`bun@1.4.0`,repository:{type:`git`,url:`git+https://github.com/risunCode/Cartethyia.git`},homepage:`https://github.com/risunCode/Cartethyia#readme`,bugs:{url:`https://github.com/risunCode/Cartethyia/issues`},keywords:[`ai`,`gateway`,`llm`,`bun`,`self-hosted`],bin:{cartethyia:`scripts/cli/cli-launcher.cjs`,carte:`scripts/cli/carte-launcher.cjs`},files:[`scripts/cli/`,`scripts/operations/probe-egress.ts`,`scripts/operations/restart.ts`,`scripts/shared/env.ts`,`src/`,`migrations/`,`dist/dashboard/`,`tray-assets/`,`.env.example`,`README.md`],workspaces:[`dashboard`],engines:{bun:`>=1.4.0`},scripts:{dev:`bun run dev:stack`,"dev:watch":`bun run scripts/dev/supervisor.ts`,test:`bun run scripts/test/run.ts`,build:`bun run scripts/build/build.ts`,prepack:`bun run dashboard:build`,setup:`bun run scripts/cli/setup.ts`,start:`bun run scripts/operations/start-production.ts`,doctor:`bun run scripts/cli/doctor.ts`,"probe:egress":`bun run scripts/operations/probe-egress.ts`,restart:`bun run scripts/operations/restart.ts`,"build:aot":`bun run scripts/build/aot.ts`,"dev:stack":`concurrently -n BACKEND,DASHBOARD -c cyan,magenta --kill-others-on-fail "bun run dev:backend" "bun run dashboard:dev"`,typecheck:`tsc --noEmit`,"test:watch":`bun run scripts/test/run.ts --watch`,"test-db:up":`docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dev:backend":`bun run --hot src/main.ts`,"dev:console-auth":`bun run scripts/dev/console-session.ts`,"dev:visual-baseline":`bun run scripts/dev/visual-baseline.ts`,"build:binary":`bun run scripts/build/binary.ts`,"test:backend":`bun run scripts/test/run.ts --scope backend`,"test-db:down":`docker compose -f docker-compose.test.yml down`,"dashboard:dev":`bun run --cwd dashboard dev`,"test-db:check":`bun run scripts/test/db-check.ts`,"dashboard:test":`bun run scripts/test/run.ts --scope dashboard`,"test-db:reset":`docker compose -f docker-compose.test.yml down -v && docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dashboard:build":`bun run --cwd dashboard build`,"dashboard:typecheck":`bun run --cwd dashboard typecheck`},dependencies:{"@bufbuild/protobuf":`^2.14.1`,"@electric-sql/pglite":`^0.5.8`,"drizzle-orm":`0.45.2`,elysia:`^2.0.0-beta.16`,"exact-mirror":`^1.2.6`,impit:`^0.14.5`,ioredis:`6.0.0`,pg:`8.23.0`,pino:`^10.3.1`,"pino-pretty":`^13.1.3`,"socks-proxy-agent":`^10.1.0`,systray2:`2.1.4`,typebox:`1.3.27`,undici:`^8.10.2`,ws:`8.22.0`},devDependencies:{"@types/pg":`8.11.10`,"@types/ws":`8.18.1`,"bun-types":`1.4.0`,concurrently:`^10.0.5`,typescript:`5.9.2`}}.version,pa=`v${fa.replace(/\.0$/,``)} (Zhezhi)`,ma=[{label:`Main`,items:[{label:`Overview`,path:`/`,icon:Ie},{label:`Usage`,path:`/usage`,icon:u},{label:`Providers`,path:`/providers`,icon:Ue},{label:`Model Lab`,path:`/model-lab`,icon:_}]},{label:`Control`,items:[{label:`Combos & Routes`,path:`/combos`,icon:Fe},{label:`Quota Management`,path:`/quota`,icon:Ge},{label:`Proxy & Requests`,path:`/proxy`,icon:d},{label:`CLI Tools`,path:`/cli-tools`,icon:p}]},{label:`System`,items:[{label:`Customization`,path:`/customization`,icon:Be},{label:`Console Log`,path:`/console-log`,icon:He},{label:`Settings`,path:`/settings`,icon:We}]}],ha={"/":{title:`Overview`,sub:`Gateway health, capacity, and live metrics`,icon:Ie},"/usage":{title:`Usage & Metrics`,sub:`Token economics, requests, and cost breakdown`,icon:u},"/providers":{title:`Provider Catalog`,sub:`Upstream credentials, models, and latency`,icon:Ue},"/combos":{title:`Combos & Routing`,sub:`Failover policies, model aliases, and weighted routes`,icon:Fe},"/quota":{title:`Quota Management`,sub:`Rate limits, leases, and tenant quotas`,icon:Ge},"/proxy":{title:`Proxy & Requests`,sub:`Network pools, SOCKS5/HTTP egress, and dispatch`,icon:d},"/customization":{title:`Customization`,sub:`Background, transparency, and blur`,icon:Be},"/model-lab":{title:`Model Lab`,sub:`Chat a routed model without leaving the console`,icon:_},"/console-log":{title:`Console Log`,sub:`Live server logs and audit trail`,icon:He},"/cli-tools":{title:`CLI Tools`,sub:`Claude Code CLI, OpenCode, and local developer tool integrations`,icon:p},"/settings":{title:`Settings`,sub:`Account security, runtime preferences, and state recovery`,icon:We}},ga={title:`Console`,sub:`Cartethyia AI Gateway Administration`,icon:Ie};function _a(e,t){let n=/^\/providers\/([^/]+)\/?$/.exec(e);if(n?.[1]){let e=t.find(e=>e.providerId===n[1]);return{title:e?.label||e?.displayName||n[1],sub:`Routing, accounts, models, and health`,icon:Ue}}let r=/^\/cli-tools\/([^/]+)\/?$/.exec(e);return r?.[1]?{title:`CLI Tool`,sub:`${r[1]} — mappings, endpoints, and downloadable config`,icon:p}:ha[e]??ga}function va(){try{return ji()}catch{return{data:void 0,isError:!1,isFetching:!1,isPending:!1}}}function ya(){let[e,t]=(0,P.useState)(()=>h()),n=ne(e);return(0,P.useEffect)(()=>{let e=()=>t(h());return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,P.useEffect)(()=>{ee(e)},[e]),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{let e=n?`light`:`dark`;t(e),y(e)},"aria-label":`Toggle theme`,"aria-pressed":n,className:`topbar-icon-button`,title:n?`Switch to light mode`:`Switch to dark mode`,children:(0,Z.jsx)(`span`,{className:`grid place-items-center`,children:n?(0,Z.jsx)(g,{size:17}):(0,Z.jsx)(te,{size:17})},n?`sun`:`moon`)})}var ba=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),xa=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`,timeZone:`UTC`});function Sa(e){if(!Number.isFinite(e)||e<0)return`Unavailable`;let t=Math.floor(e);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=n%60,i=Math.floor(n/60),a=i%24,o=Math.floor(i/24);return o>0?`${o}d ${a}h ${r}m`:i>0?`${i}h ${r}m`:`${n}m`}function Ca(e){if(!Number.isFinite(e)||e<0)return`Unavailable`;let t=e>=1024**3?{divisor:1024**3,label:`GiB`}:{divisor:1024**2,label:`MiB`};return`${(e/t.divisor).toFixed(1)} ${t.label}`}function wa({icon:e,label:t,value:n,detail:r,title:i}){return(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-control border border-inner-border bg-surface-2 p-3`,title:i,children:[(0,Z.jsxs)(`dt`,{className:`flex items-center gap-2 text-micro font-medium text-text-tertiary`,children:[(0,Z.jsx)(e,{size:13,strokeWidth:1.8,className:`shrink-0`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]}),(0,Z.jsx)(`dd`,{className:`mt-1 truncate font-mono text-caption font-semibold tabular-nums text-text-primary`,children:n}),r?(0,Z.jsx)(`dd`,{className:`mt-1 text-micro text-text-secondary`,children:r}):null]})}function Ta({health:e}){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(()=>new Date),a=(0,P.useRef)(null),s=(0,P.useRef)(null);(0,P.useEffect)(()=>{if(!t)return;i(new Date);let e=window.setInterval(()=>i(new Date),1e3);return()=>window.clearInterval(e)},[t]),(0,P.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.target;s.current&&!s.current.contains(t)&&a.current&&!a.current.contains(t)&&n(!1)},r=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,r)}},[t]);let c=e?e.status===`healthy`?`All systems operational`:e.status===`degraded`?`Gateway degraded`:`Gateway unhealthy`:`System health unavailable`,l=e?e.status===`healthy`?`Postgres & Redis admission connected.`:e.status===`degraded`?`Check connection logs.`:`Gateway is reporting an unhealthy status.`:`Live gateway metrics are not available.`,u=e&&[Number.isFinite(e.memory_percent)?`${e.memory_percent.toFixed(1)}% of system RAM`:void 0,e.database_in_process?`In-process DB included`:void 0].filter(Boolean).join(` · `)||void 0,d=e?Number.isFinite(e.cpu_cores)&&e.cpu_cores>0?`1-min load · ${e.cpu_cores} cores`:`Normalized 1-min load`:void 0;return(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`button`,{ref:a,type:`button`,className:`topbar-icon-button`,"aria-label":`Notifications`,"aria-expanded":t,"aria-haspopup":`dialog`,onClick:()=>n(e=>!e),children:(0,Z.jsx)(Pe,{size:17})}),t?(0,Br.createPortal)((0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`fixed inset-0 z-floating bg-overlay backdrop-blur-dialog`,onClick:()=>n(!1)}),(0,Z.jsxs)(`div`,{ref:s,role:`dialog`,"aria-label":`Notifications`,className:`app-topbar-popover popout-enter glass rounded-sidebar border border-inner-border bg-popover-bg p-5 shadow-popout z-popover`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 font-bold text-body-lg`,children:[(0,Z.jsx)(`span`,{className:`w-13 h-13 rounded-pill bg-accent-soft text-accent grid place-items-center`,children:(0,Z.jsx)(Pe,{size:13})}),(0,Z.jsx)(`span`,{children:`Notifications`})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close notifications`,onClick:()=>n(!1),className:`cursor-pointer border-none bg-transparent p-2 text-caption text-text-tertiary`,children:(0,Z.jsx)(o,{size:14})})]}),(0,Z.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,Z.jsx)(Ue,{size:16,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`font-semibold text-caption`,children:c}),(0,Z.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:l})]})]}),(0,Z.jsxs)(`dl`,{"aria-label":`Runtime metrics`,className:`grid grid-cols-2 gap-2`,children:[(0,Z.jsx)(wa,{icon:m,label:`Local time`,value:ba.format(r)}),(0,Z.jsx)(wa,{icon:v,label:`UTC`,value:xa.format(r)}),(0,Z.jsx)(wa,{icon:Ke,label:`Uptime`,value:e?Sa(e.uptime_seconds):`Unavailable`,detail:e&&Number.isFinite(e.uptime_seconds)&&e.uptime_seconds>=0?`Gateway process running`:void 0}),(0,Z.jsx)(wa,{icon:Re,label:`Process RSS`,value:e?Ca(e.memory_bytes):`Unavailable`,detail:u,title:`Process resident set size; percentage is share of system RAM.`}),(0,Z.jsx)(wa,{icon:Fe,label:`CPU load`,value:e&&Number.isFinite(e.cpu_percent)?`${e.cpu_percent.toFixed(1)}%`:`Unavailable`,detail:d,title:`One-minute load average normalized by the number of CPU cores.`}),(0,Z.jsx)(wa,{icon:ze,label:`Runtime`,value:e?.platform?.trim()||`Unavailable`,detail:e?.platform?.trim()?`Gateway host platform`:void 0,title:e?.platform?.trim()||`Runtime platform unavailable`})]}),(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,Z.jsx)(Ve,{size:16,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`font-semibold text-caption`,children:pa}),(0,Z.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`High-performance AI Gateway & Protocol Orchestrator.`})]})]})]})]})]}),document.body):null]})}function Ea({group:e,pathname:t,onIntent:n}){return(0,Z.jsxs)(`div`,{className:`nav-group-section`,children:[(0,Z.jsx)(`p`,{className:`nav-group-title`,children:e.label}),(0,Z.jsx)(Da,{items:e.items,pathname:t,onIntent:n})]})}function Da({items:e,pathname:t,onIntent:n}){let r=(0,P.useRef)(null),[i,a]=(0,P.useState)({top:0,height:0,opacity:0});return(0,P.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.querySelector(`[data-active="true"]`);if(!t){a(e=>({...e,opacity:0}));return}let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();a({top:i.top-n.top,height:i.height,opacity:1})},[t,e]),(0,Z.jsxs)(`div`,{ref:r,className:`nav-items-container`,children:[(0,Z.jsx)(`div`,{className:`sidebar-active-indicator`,style:{transform:`translateY(${i.top}px)`,height:`${i.height}px`,opacity:i.opacity},"aria-hidden":`true`}),e.map(e=>{let r=e.path===`/`?t===`/`:t===e.path||t.startsWith(`${e.path}/`);return(0,Z.jsxs)(kr,{to:e.path,end:e.path===`/`,"data-active":r?`true`:void 0,className:`nav-link-item ${r?`active`:``}`,onMouseEnter:()=>n(e.path),onFocus:()=>n(e.path),children:[(0,Z.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,Z.jsx)(`span`,{children:e.label}),e.badge?(0,Z.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},e.path)})]})}function Oa({user:e,children:t}){let n=K(),r=G(),[i,a]=(0,P.useState)(!1),[o,c]=(0,P.useState)(!1),[u,d]=(0,P.useState)(!1),p=va(),m=Mi(),h=p.data?.version??fa,g=m.data?.tag_name?.replace(/^v/,``),_=Ti(h,g),v=zi(),y=e=>{ki(Q,e)};(0,P.useEffect)(()=>{a(!1)},[r.pathname]),(0,P.useEffect)(()=>{let e=()=>a(!1);return window.addEventListener(`cartethyia:overlay-open`,e),()=>window.removeEventListener(`cartethyia:overlay-open`,e)},[]),(0,P.useLayoutEffect)(()=>{window.scrollTo(0,0)},[r.pathname]);let b=async()=>{c(!0);try{await O(`/auth/logout`,{method:`POST`})}finally{Q.clear(),n(`/login`,{replace:!0})}};(0,P.useEffect)(()=>(document.documentElement.dataset.glassEnabled=`true`,pi(fi()),()=>{delete document.documentElement.dataset.glassEnabled}),[]);let x=_a(r.pathname,v.data??[]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`app-bg`,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`app-shell-frame`,children:(0,Z.jsxs)(`div`,{className:`app-shell-root`,"data-drawer":i?`open`:void 0,"data-page-scroll":r.pathname===`/console-log`?`contained`:void 0,onClick:e=>{i&&e.target.closest(`.app-main-column`)&&a(!1)},children:[(0,Z.jsxs)(`aside`,{className:`glass app-sidebar ${i?`is-open`:``}`,"aria-label":`Dashboard navigation`,children:[(0,Z.jsxs)(`div`,{className:`brand-header`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`brand-icon overflow-hidden p-0`,children:(0,Z.jsx)(`img`,{src:`/assets/brand/sidebar_ico.jpg`,alt:`Cartethyia`,onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src=`/assets/brand/sidebar_ico.jpg`},className:`w-full h-full object-cover block`})}),(0,Z.jsxs)(`div`,{className:`brand-meta`,children:[(0,Z.jsx)(`div`,{className:`brand-name`,children:(0,Z.jsx)(`span`,{children:`Cartethyia`})}),(0,Z.jsxs)(`div`,{className:`brand-version-badge`,children:[(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:`brand-version-link`,children:pa}),_?(0,Z.jsxs)(`a`,{href:m.data?.html_url??l,target:`_blank`,rel:`noreferrer`,className:`brand-update-badge`,title:g===void 0?`A newer Cartethyia release is available on GitHub`:`Update available on GitHub: v${g}`,children:[(0,Z.jsx)(Ve,{size:9,className:`shrink-0`,"aria-hidden":`true`}),`update`]}):null]})]})]}),(0,Z.jsx)(`nav`,{className:`flex-1 overflow-y-auto py-2 px-0`,children:ma.map(e=>(0,Z.jsx)(Ea,{group:e,pathname:r.pathname,onIntent:y},e.label))}),(0,Z.jsx)(`div`,{className:`sidebar-user-card`,children:(0,Z.jsxs)(`div`,{className:`user-card-content`,children:[(0,Z.jsx)(`div`,{className:`user-avatar`,"aria-hidden":`true`,children:(e.displayName??e.email).slice(0,2).toUpperCase()}),(0,Z.jsxs)(`div`,{className:`user-info`,children:[(0,Z.jsx)(`p`,{className:`user-name`,children:e.displayName||`Admin`}),(0,Z.jsx)(`p`,{className:`user-role`,children:e.email})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>d(!0),disabled:o,"aria-label":`Sign out`,title:`Sign out`,className:`topbar-icon-button w-15 h-15 rounded-inset`,children:(0,Z.jsx)(Le,{size:14})})]})})]}),(0,Z.jsxs)(`div`,{className:`app-main-column`,children:[(0,Z.jsx)(Si,{}),(0,Z.jsxs)(`header`,{className:`glass app-topbar`,children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,className:`topbar-menu-btn`,onClick:()=>a(!0),children:(0,Z.jsx)(f,{size:18})}),(0,Z.jsxs)(`div`,{className:`topbar-meta`,children:[(0,Z.jsxs)(`h1`,{className:`topbar-title`,children:[(0,Z.jsx)(x.icon,{className:`topbar-title-icon`,size:16,"aria-hidden":`true`}),x.title]}),(0,Z.jsx)(`p`,{className:`topbar-subtitle`,children:x.sub})]}),(0,Z.jsxs)(`div`,{className:`topbar-actions`,children:[(0,Z.jsx)(ya,{}),(0,Z.jsx)(Ta,{health:p.data})]})]}),(0,Z.jsx)(`main`,{className:`route-enter w-full min-w-0`,children:t})]})]})}),(0,Z.jsx)(Ci,{open:u,onClose:()=>d(!1),onConfirm:b,title:`Sign out?`,message:`You will need to sign in again to open the console.`,confirmLabel:`Sign out`,danger:!0})]})}var ka=class extends P.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[console] route render failed:`,e,t.componentStack)}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.error!==null&&this.setState({error:null})}render(){return this.state.error===null?this.props.children:(0,Z.jsx)(`main`,{className:`auth-viewport`,children:(0,Z.jsxs)(`div`,{className:`card-solid auth-window border border-red-soft`,children:[(0,Z.jsxs)(`div`,{className:`auth-header`,children:[(0,Z.jsx)(`h1`,{className:`auth-title`,children:`Console view failed`}),(0,Z.jsx)(`p`,{className:`auth-desc`,children:`This view could not be rendered.`})]}),(0,Z.jsxs)(`div`,{className:`rounded-panel border border-inner-border bg-surface-2 p-7 leading-normal text-caption text-text-secondary`,children:[(0,Z.jsx)(`strong`,{className:`block text-text-primary mb-2`,children:`Rendering error`}),(0,Z.jsx)(`span`,{className:`select-text break-words`,children:this.state.error.message})]}),(0,Z.jsx)(`button`,{type:`button`,className:`btn btn-primary inline-flex w-full items-center justify-center rounded-control bg-accent font-semibold text-accent-foreground mt-3 h-20 text-caption`,onClick:()=>window.location.reload(),children:`Reload console`})]})})}},Aa=3e5;function ja(e){return`cartethyia:lazy-retry:${e}`}function Ma(e,t){if(e===null)return!0;let n=Number(e);return!Number.isFinite(n)||t-n>Aa}function Na(){try{return typeof sessionStorage>`u`?void 0:sessionStorage}catch{return}}function $(e,t,n={}){let r=n.storage??Na(),i=n.reload??(()=>{window.location.reload()}),a=n.now??(()=>Date.now()),o=ja(t);return(0,P.lazy)(async()=>{try{let t=await e();try{r?.removeItem(o)}catch{}return t}catch(e){let t=null;try{t=r?.getItem(o)??null}catch{t=null}if(Ma(t,a())){try{r?.setItem(o,String(a()))}catch{}return i(),new Promise(()=>{})}throw e}})}function Pa(){return(0,Z.jsxs)(`div`,{role:`status`,"aria-label":`Loading console`,className:`min-h-dvh flex flex-col items-center justify-center gap-6 text-text-tertiary`,children:[(0,Z.jsx)(b,{size:22,className:`animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(`p`,{className:`text-caption`,children:`Loading console…`})]})}var Fa=$(()=>i(()=>import(`./LoginPage-sqFYY4uv.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),`login`),Ia=$(()=>i(()=>import(`./SetupPage-Cz1DWkcr.js`),__vite__mapDeps([10,1,2,3,4,6,7,8,9,11,12])),`setup`),La=$(()=>i(()=>import(`./BannedPage-Dc8V-nxc.js`),__vite__mapDeps([13,1])),`banned`),Ra=$(()=>i(()=>import(`./OverviewPage-BOZJaauG.js`),__vite__mapDeps([14,1,15,16,6,17,18,19,20,21,3,4,2,22,23,24,25,26,8,9,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,7,47,48,49,50,51,52,11,53])),`overview`),za=$(()=>i(()=>import(`./UsagePage-_Zu6460J.js`),__vite__mapDeps([54,1,55,56,3,4,2,33,15,16,6,17,18,20,21,57,58,25,26,8,9,59,28,5,37,60,61,62,43,44,45,63,24,50,11,64,65,66,67])),`usage`),Ba=$(()=>i(()=>import(`./ProviderDetailPage-CNUCsNFg.js`),__vite__mapDeps([68,1,55,69,70,19,20,21,3,4,2,71,57,58,25,26,8,9,27,59,28,29,72,32,33,34,35,73,36,74,38,42,61,16,6,43,44,45,63,46,7,48,49,24,50,53,75,76,17,18,77,11,78,64,65])),`provider-detail`),Va=$(()=>i(()=>import(`./ProvidersPage-CsXoemJ1.js`),__vite__mapDeps([79,1,21,3,4,20,2,8,9,28,32,33,35,42,6,80,43,46,7,48,49,24,50,75,78])),`providers`),Ha=$(()=>i(()=>import(`./CombosPage-B7ETkfVH.js`),__vite__mapDeps([81,1,3,4,82,21,20,2,23,24,25,28,72,32,33,34,35,37,38,42,6,80,43,31,7,8,9,47,16,45,46,48,50,75,76,17,18,64])),`combos`),Ua=$(()=>i(()=>import(`./QuotaPage-DNYJWw7s.js`),__vite__mapDeps([83,1,55,20,21,3,4,2,22,8,28,32,33,36,74,84,42,6,43,46,48,49,24,50,11,53,77,16,17,18])),`quota`),Wa=$(()=>i(()=>import(`./ProxyPage-DvRt3aZP.js`),__vite__mapDeps([85,1,55,21,3,4,20,2,26,8,9,27,28,32,33,34,35,73,74,39,42,16,6,17,18,43,44,63,46,7,49,24,50,11,66,67])),`proxy`),Ga=$(()=>i(()=>import(`./SettingsPage-YxRml8AT.js`),__vite__mapDeps([86,1,21,3,4,20,2,26,9,28,32,33,40,16,6,17,18,42,43,44,7,8,49,24,65,12])),`settings`),Ka=$(()=>i(()=>import(`./CliToolsPage-2A1c_dFb.js`),__vite__mapDeps([87,1,55,28,2,3,4,43,46,24,50,52,16,6,17,18,88,11])),`cli-tools`),qa=$(()=>i(()=>import(`./CliToolDetailPage-ifAh7wbK.js`),__vite__mapDeps([89,1,69,21,3,4,20,2,57,26,28,37,38,6,43,44,46,7,8,9,47,32,33,16,45,48,49,24,50,51,17,18,52,88])),`cli-tool-detail`),Ja=$(()=>i(()=>import(`./ConsoleLogPage-FfxY8_yn.js`),__vite__mapDeps([90,1,2,3,4,28,36,38,39,42,6,43,63,67,46,7,8,9,11])),`console-log`),Ya=$(()=>i(()=>import(`./CustomizationPage-CZ5H40Ha.js`),__vite__mapDeps([91,1,2,3,4,59,72,74,43,49,24,50])),`customization`),Xa=$(()=>i(()=>import(`./StudioPage-CsKD9sy-.js`),__vite__mapDeps([92,1,3,4,56,2,33,70,20,21,71,25,26,27,93,32,34,74,84,61,43,7,8,9,47,37,38,16,6,45,46,48,51,17,18])),`studio`);function Za(){let e=K(),t=G();return(0,P.useEffect)(()=>(Oe(n=>{if(Q.clear(),n===`banned`){e(`/banned`,{replace:!0});return}e(`/login?returnTo=${encodeURIComponent(t.pathname)}`,{replace:!0})}),()=>Oe(void 0)),[e,t.pathname]),null}function Qa(){let e=G();return(0,Z.jsx)(ka,{resetKey:`${e.pathname}${e.search}`,children:(0,Z.jsx)(P.Suspense,{fallback:(0,Z.jsx)(Pa,{}),children:(0,Z.jsxs)(Vn,{children:[(0,Z.jsx)(q,{path:`/login`,element:(0,Z.jsx)(Fa,{})}),(0,Z.jsx)(q,{path:`/setup`,element:(0,Z.jsx)(Ia,{})}),(0,Z.jsx)(q,{path:`/banned`,element:(0,Z.jsx)(La,{})}),(0,Z.jsx)(q,{path:`/*`,element:(0,Z.jsx)($a,{})})]})})})}function $a(){let[e,t]=(0,P.useState)({kind:`loading`}),n=G(),r=K(),[i]=(0,P.useState)(()=>n.pathname);return(0,P.useEffect)(()=>{let e=new AbortController;return Q.fetchQuery({queryKey:M.session.current,queryFn:()=>De(),staleTime:6e4}).then(n=>{if(!e.signal.aborted){if(n){Q.setQueryData(M.session.current,n),t({kind:`ready`,user:n}),n.isFirstBoot&&i!==`/setup`&&r(`/setup`,{replace:!0});return}Q.removeQueries({queryKey:M.session.current}),O(`/auth/first-boot`,{signal:e.signal}).then(n=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:n.requires_setup})}).catch(()=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:!1})})}}).catch(n=>{e.signal.aborted||(typeof n==`object`&&n&&`status`in n&&n.status===403?t({kind:`blocked`}):t({kind:`unauthenticated`,needsSetup:!1}))}),()=>e.abort()},[i,r]),e.kind===`loading`?null:e.kind===`blocked`?(0,Z.jsx)(zn,{to:`/banned`,replace:!0}):e.kind===`unauthenticated`?(0,Z.jsx)(zn,{to:e.needsSetup?`/setup`:`/login?returnTo=${encodeURIComponent(n.pathname)}`,replace:!0}):(0,Z.jsx)(Oa,{user:e.user,children:(0,Z.jsx)(ka,{resetKey:n.pathname,children:(0,Z.jsxs)(Vn,{children:[(0,Z.jsx)(q,{path:`/`,element:(0,Z.jsx)(Ra,{})}),(0,Z.jsx)(q,{path:`/usage`,element:(0,Z.jsx)(za,{})}),(0,Z.jsx)(q,{path:`/providers`,element:(0,Z.jsx)(Va,{})}),(0,Z.jsx)(q,{path:`/providers/:providerId`,element:(0,Z.jsx)(Ba,{})}),(0,Z.jsx)(q,{path:`/combos`,element:(0,Z.jsx)(Ha,{})}),(0,Z.jsx)(q,{path:`/quota`,element:(0,Z.jsx)(Ua,{})}),(0,Z.jsx)(q,{path:`/proxy`,element:(0,Z.jsx)(Wa,{})}),(0,Z.jsx)(q,{path:`/console-log`,element:(0,Z.jsx)(Ja,{})}),(0,Z.jsx)(q,{path:`/customization`,element:(0,Z.jsx)(Ya,{})}),(0,Z.jsx)(q,{path:`/model-lab`,element:(0,Z.jsx)(Xa,{})}),(0,Z.jsx)(q,{path:`/cli-tools`,element:(0,Z.jsx)(Ka,{})}),(0,Z.jsx)(q,{path:`/cli-tools/:toolId`,element:(0,Z.jsx)(qa,{})}),(0,Z.jsx)(q,{path:`/settings`,element:(0,Z.jsx)(Ga,{})}),(0,Z.jsx)(q,{path:`*`,element:(0,Z.jsx)(zn,{to:`/`,replace:!0})})]})})})}function eo(){return(0,Z.jsx)(ae,{client:Q,children:(0,Z.jsxs)(Dr,{basename:`/console`,children:[(0,Z.jsx)(Za,{}),(0,Z.jsx)(Qa,{}),(0,Z.jsx)(re,{position:`top-right`,offset:{top:`6rem`,right:`1rem`},mobileOffset:{top:`6rem`,left:`1rem`,right:`1rem`},visibleToasts:2,richColors:!0,duration:5e3,toastOptions:{className:`toast-surface select-text`,descriptionClassName:`select-text`,classNames:{title:`select-text`},style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`,userSelect:`text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]})})}function to(e){document.title=`Cartethyia Console`,(0,Vr.createRoot)(e).render((0,Z.jsx)(P.StrictMode,{children:(0,Z.jsx)(eo,{})}))}export{Ge as $,Pi as A,ti as B,Ui as C,Ri as D,Zi as E,Ci as F,Yr as G,Gr as H,_i as I,Or as J,ei as K,Y as L,Ii as M,Ni as N,Ai as O,Q as P,Ke as Q,hi as R,ua as S,Ki as T,Zr as U,ni as V,ii as W,_n as X,K as Y,Pr as Z,ta as _,Yi as a,ra as b,qi as c,sa as d,Ue as et,Wi as f,zi as g,Bi as h,ca as i,Li as j,Fi as k,na as l,Ji as m,to as mountConsole,Qi as n,Ie as nt,Xi as o,Hi as p,Xr as q,ia as r,da as s,fa as t,He as tt,oa as u,Vi as v,la as w,aa as x,Gi as y,gi as z};
|
|
4
|
+
Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}/*`}">.`)}let u=G(),d;if(t){let e=typeof t==`string`?R(t):t;F(c===`/`||e.pathname?.startsWith(c),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${e.pathname}" was given in the \`location\` prop.`),d=e}else d=u;let f=d.pathname||`/`,p=f;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);p=`/`+f.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let m=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):ct(e,{pathname:p});I(l||m!=null,`No routes matched location "${d.pathname}${d.search}${d.hash}" `),I(m==null||m[m.length-1].route.element!==void 0||m[m.length-1].route.Component!==void 0||m[m.length-1].route.lazy!==void 0,`Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let h=Dn(m&&m.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:B([c,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:B([c,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&h?P.createElement(an.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...d},navigationType:`POP`}},h):h}function xn(){let e=Pn(),t=zt(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r=`rgba(200,200,200, 0.5)`,i={padding:`0.5rem`,backgroundColor:r},a={padding:`2px 4px`,backgroundColor:r},o=null;return console.error(`Error handled by React Router default ErrorBoundary:`,e),o=P.createElement(P.Fragment,null,P.createElement(`p`,null,`💿 Hey developer 👋`),P.createElement(`p`,null,`You can provide a way better UX than this when your app throws errors by providing your own `,P.createElement(`code`,{style:a},`ErrorBoundary`),` or`,` `,P.createElement(`code`,{style:a},`errorElement`),` prop on your route.`)),P.createElement(P.Fragment,null,P.createElement(`h2`,null,`Unexpected Application Error!`),P.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?P.createElement(`pre`,{style:i},n):null,o)}var Sn=P.createElement(xn,null),Cn=class extends P.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=dn(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:P.createElement(W.Provider,{value:this.props.routeContext},P.createElement(on.Provider,{value:e,children:this.props.component}));return this.context?P.createElement(Tn,{error:e},t):t}};Cn.contextType=$t;var wn=new WeakMap;function Tn({children:e,error:t}){let{basename:n,navigator:r}=P.useContext(U);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=un(t.digest);if(e){let i=wn.get(t);if(i)throw i;let a=Ht(e.location,n),o=a.absoluteURL||a.to;if(qt(e.location,o,Wt(r),`allow-explicit`),Zt(o))throw Error(`Invalid redirect location`);if(Vt&&!wn.get(t)){if(a.isExternal||e.reloadDocument)window.location.href=o;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(a.to,{replace:e.replace}));throw wn.set(t,n),n}}return P.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${o}`})}}return e}function En({routeContext:e,match:t,children:n}){let r=P.useContext(H);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),P.createElement(W.Provider,{value:e},n)}function Dn(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);F(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:Bt(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||Sn,o&&(s<0&&c===0?(Ln(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?P.createElement(n.route.Component,null):n.route.element?n.route.element:e,P.createElement(En,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?P.createElement(Cn,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function On(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function kn(e){let t=P.useContext(H);return F(t,On(e)),t}function An(e){let t=P.useContext(Qt);return F(t,On(e)),t}function jn(e){let t=P.useContext(W);return F(t,On(e)),t}function Mn(e){let t=jn(e),n=t.matches[t.matches.length-1];return F(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function Nn(){return Mn(`useRouteId`)}function Pn(){let e=P.useContext(on),t=An(`useRouteError`),n=Mn(`useRouteError`);return e===void 0?t.errors?.[n]:e}function Fn(){let{router:e}=kn(`useNavigate`),t=Mn(`useNavigate`),n=P.useRef(!1);return hn(()=>{n.current=!0}),P.useCallback(async(r,i={})=>{I(n.current,mn),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var In={};function Ln(e,t,n){!t&&!In[e]&&(In[e]=!0,I(!1,n))}P.memo(Rn);function Rn({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return bn(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function zn({to:e,replace:t,state:n,relative:r}){F(pn(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i,navigator:a}=P.useContext(U);I(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:o}=P.useContext(W),{pathname:s}=G(),c=K(),l=Nt(e,Mt(o),s,r===`path`);qt(typeof e==`string`?e:L(e),a.createHref(l),Wt(a),`reject`);let u=JSON.stringify(l);return P.useEffect(()=>{c(JSON.parse(u),{replace:t,state:n,relative:r})},[c,u,r,t,n]),null}function q(e){F(!1,`A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.`)}function Bn({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){F(!pn(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=P.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=R(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=P.useMemo(()=>{let e=z(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return I(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:P.createElement(U.Provider,{value:c},P.createElement(an.Provider,{children:t,value:h}))}function Vn({children:e,location:t}){return yn(Hn(e),t)}P.Component;function Hn(e,t=[]){let n=[];return P.Children.forEach(e,(e,r)=>{if(!P.isValidElement(e))return;let i=[...t,r];if(e.type===P.Fragment){n.push.apply(n,Hn(e.props.children,i));return}F(e.type===q,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),F(!e.props.index||!e.props.children,`An index route cannot have child routes.`);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,middleware:e.props.middleware,loader:e.props.loader,action:e.props.action,hydrateFallbackElement:e.props.hydrateFallbackElement,HydrateFallback:e.props.HydrateFallback,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.hasErrorBoundary===!0||e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=Hn(e.props.children,i)),n.push(a)}),n}var Un=`get`,Wn=`application/x-www-form-urlencoded`;function Gn(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Kn(e){return Gn(e)&&e.tagName.toLowerCase()===`button`}function qn(e){return Gn(e)&&e.tagName.toLowerCase()===`form`}function Jn(e){return Gn(e)&&e.tagName.toLowerCase()===`input`}function Yn(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Xn(e,t){return e.button===0&&(!t||t===`_self`)&&!Yn(e)}function Zn(e=``){return new URLSearchParams(typeof e==`string`||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(e=>[n,e]):[[n,r]])},[]))}function Qn(e,t){let n=Zn(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var $n=null;function er(){if($n===null)try{new FormData(document.createElement(`form`),0),$n=!1}catch{$n=!0}return $n}var tr=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function nr(e){return e!=null&&!tr.has(e)?(I(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Wn}"`),null):e}function rr(e,t){let n,r,i,a,o;if(qn(e)){let o=e.getAttribute(`action`);r=o?z(o,t):null,n=e.getAttribute(`method`)||Un,i=nr(e.getAttribute(`enctype`))||Wn,a=new FormData(e)}else if(Kn(e)||Jn(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?z(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||Un,i=nr(e.getAttribute(`formenctype`))||nr(o.getAttribute(`enctype`))||Wn,a=new FormData(o,e),!er()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(Gn(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=Un,r=null,i=Wn,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ir(e,t){if(e===!1||e==null)throw Error(t)}function ar(e,t,n,r){let i=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return i.pathname=n?i.pathname.endsWith(`/`)?`${i.pathname}_.${r}`:`${i.pathname}.${r}`:i.pathname===`/`?`_root.${r}`:t&&z(i.pathname,t)===`/`?`${V(t)}/_root.${r}`:`${V(i.pathname)}.${r}`,i}async function or(e,t){if(e.id in t)return t[e.id];try{let n=await i(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function sr(e){return e!=null&&typeof e.page==`string`}function cr(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function lr(e,t,n){return mr((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await or(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(cr).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function ur(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function dr(e,t,{includeHydrateFallback:n}={}){return fr(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function fr(e){return[...new Set(e)]}function pr(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function mr(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!sr(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(pr(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function hr(){let e=P.useContext(H);return ir(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function gr(){let e=P.useContext(Qt);return ir(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var _r=P.createContext(void 0);_r.displayName=`FrameworkContext`;function vr(){let e=P.useContext(_r);return ir(e,`You must render this element inside a <HydratedRouter> element`),e}function yr(e,t){let n=P.useContext(_r),[r,i]=P.useState(!1),[a,o]=P.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=P.useRef(null);P.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),P.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:br(s,p),onBlur:br(c,m),onMouseEnter:br(l,p),onMouseLeave:br(u,m),onTouchStart:br(d,p)}]:[a,f,{}]:[!1,f,{}]}function br(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function xr({page:e,...t}){let n=en(),{nonce:r}=vr(),{router:i}=hr(),a=P.useMemo(()=>ct(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?P.createElement(Cr,{page:e,matches:a,...t}):P.createElement(wr,{page:e,matches:a,...t})):null}function Sr(e){let{manifest:t,routeModules:n}=vr(),[r,i]=P.useState([]);return P.useEffect(()=>{let r=!1;return lr(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Cr({page:e,matches:t,...n}){let r=G(),{future:i}=vr(),{basename:a}=hr(),o=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=ar(e,a,i.v8_trailingSlashAwareDataRequests,`rsc`),o=!1,s=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?o=!0:s.push(e.route.id);return o&&s.length>0&&n.searchParams.set(`_routes`,s.join(`,`)),[n.pathname+n.search]},[a,i.v8_trailingSlashAwareDataRequests,e,r,t]);return P.createElement(P.Fragment,null,o.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function wr({page:e,matches:t,...n}){let r=G(),{future:i,manifest:a,routeModules:o}=vr(),{basename:s}=hr(),{loaderData:c,matches:l}=gr(),u=P.useMemo(()=>ur(e,t,l,a,r,`data`),[e,t,l,a,r]),d=P.useMemo(()=>ur(e,t,l,a,r,`assets`),[e,t,l,a,r]),f=P.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,l=!1;if(t.forEach(e=>{let t=a.routes[e.route.id];t&&t.hasLoader&&(!u.some(t=>t.route.id===e.route.id)&&e.route.id in c&&o[e.route.id]?.shouldRevalidate||t.hasClientLoader?l=!0:n.add(e.route.id))}),n.size===0)return[];let d=ar(e,s,i.v8_trailingSlashAwareDataRequests,`data`);return l&&n.size>0&&d.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[d.pathname+d.search]},[s,i.v8_trailingSlashAwareDataRequests,c,r,a,u,t,e,o]),p=P.useMemo(()=>dr(d,a),[d,a]),m=Sr(d);return P.createElement(P.Fragment,null,f.map(e=>P.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),p.map(e=>P.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),m.map(({key:e,link:t})=>P.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function Tr(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}P.Component;var Er=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{Er&&(window.__reactRouterVersion=`7.18.3`)}catch{}function Dr({basename:e,children:t,useTransitions:n,window:r}){let i=P.useRef();i.current??=nt({window:r,v5Compat:!0});let a=i.current,[o,s]=P.useState({action:a.action,location:a.location}),c=P.useCallback(e=>{n===!1?s(e):P.startTransition(()=>s(e))},[n]);return P.useLayoutEffect(()=>a.listen(c),[a,c]),P.createElement(Bn,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:a,useTransitions:n})}var Or=P.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=P.useContext(U),v=typeof l==`string`&&Ze.test(l),y=Ht(l,h);l=y.to;let b=fn(l,{relative:r}),x=G(),ee=null;if(o){let e=Nt(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:B([h,e.pathname])),ee=g.createHref(e)}let[te,ne,S]=yr(n,p),re=Nr(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function ie(t){e&&e(t),t.defaultPrevented||re(t)}let ae=!(y.isExternal||i),C=P.createElement(`a`,{...p,...S,href:(ae?ee:void 0)||y.absoluteURL||b,onClick:ae?ie:e,ref:Tr(m,ne),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return te&&!v?P.createElement(P.Fragment,null,C,P.createElement(xr,{page:b})):C});Or.displayName=`Link`;var kr=P.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=vn(a,{relative:c.relative}),d=G(),f=P.useContext(Qt),{navigator:p,basename:m}=P.useContext(U),h=f!=null&&zr(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=z(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(g.length)===`/`),ee={isActive:b,isPending:x,isTransitioning:h},te=b?e:void 0,ne;ne=typeof n==`function`?n(ee):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let S=typeof i==`function`?i(ee):i;return P.createElement(Or,{...c,"aria-current":te,className:ne,ref:l,style:S,to:a,viewTransition:o},typeof s==`function`?s(ee):s)});kr.displayName=`NavLink`;var Ar=P.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=Un,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=P.useContext(U),g=Lr(),_=Rr(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Ze.test(s);return P.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?P.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});Ar.displayName=`Form`;function jr(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Mr(e){let t=P.useContext(H);return F(t,jr(e)),t}function Nr(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=K(),d=G(),f=vn(e,{relative:o});return P.useCallback(p=>{if(Xn(p,t)){p.preventDefault();let t=n===void 0?L(d)===L(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?P.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function Pr(e){I(typeof URLSearchParams<`u`,"You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=P.useRef(Zn(e)),n=P.useRef(!1),r=G(),i=P.useMemo(()=>Qn(r.search,n.current?null:t.current),[r.search]),a=K();return[i,P.useCallback((e,t)=>{let r=Zn(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var Fr=0,Ir=()=>`__${String(++Fr)}__`;function Lr(){let{router:e}=Mr(`useSubmit`),{basename:t}=P.useContext(U),n=Nn(),r=e.fetch,i=e.navigate;return P.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=rr(e,t);if(a.navigate===!1){let e=a.fetcherKey||Ir();await r(e,n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync})}else await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Rr(e,{relative:t}={}){let{basename:n}=P.useContext(U),r=P.useContext(W);F(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...vn(e||`.`,{relative:t})},o=G();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:B([n,a.pathname])),L(a)}function zr(e,{relative:t}={}){let n=P.useContext(tn);F(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=Mr(`useViewTransitionState`),i=vn(e,{relative:t});if(!n.isTransitioning)return!1;let a=z(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=z(n.nextLocation.pathname,r)||n.nextLocation.pathname;return wt(i.pathname,o)!=null||wt(i.pathname,a)!=null}var Br=t(a(),1),Vr=c(),Hr=`cartethyia.customization`,J=`media`,Ur=`background`,Wr=1,Gr=`/console-backgrounds.jpg`;function Kr(){let{promise:e,resolve:t,reject:n}=Promise.withResolvers(),r=indexedDB.open(Hr,Wr);return r.onupgradeneeded=()=>{let e=r.result;e.objectStoreNames.contains(J)||e.createObjectStore(J)},r.onsuccess=()=>t(r.result),r.onerror=()=>n(r.error??Error(`Could not open the media database.`)),e}function qr(e){let{promise:t,resolve:n,reject:r}=Promise.withResolvers();return e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??Error(`The media database rejected the request.`)),t}function Jr(e,t){let{promise:n,resolve:r,reject:i}=Promise.withResolvers();return e.oncomplete=()=>r(),e.onerror=()=>i(e.error??Error(t)),n}async function Yr(){let e=await Kr();try{let t=await qr(e.transaction(J,`readonly`).objectStore(J).get(Ur));if(!t||!t.blob)return null;let n=t;return{blob:n.blob,kind:n.kind,url:URL.createObjectURL(n.blob)}}finally{e.close()}}async function Xr(e,t){let n=await Kr();try{let r=n.transaction(J,`readwrite`);r.objectStore(J).put({blob:e,kind:t},Ur),await Jr(r,`Could not store the background.`)}finally{n.close()}}async function Zr(){let e=await Kr();try{let t=e.transaction(J,`readwrite`);t.objectStore(J).delete(Ur),await Jr(t,`Could not remove the background.`)}finally{e.close()}}var Qr=2560,$r=.85;async function ei(e){let t=await createImageBitmap(e).catch(()=>null);if(!t)return e;try{let n=Math.max(t.width,t.height),r=Math.min(1,Qr/n),i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t.width*r)),i.height=Math.max(1,Math.round(t.height*r));let a=i.getContext(`2d`);return a?(a.drawImage(t,0,0,i.width,i.height),await ri(i)??e):e}finally{t.close()}}var ti=4294967296,ni=268435456;function ri(e){let{promise:t,resolve:n}=Promise.withResolvers();return e.toBlob(e=>n(e),`image/webp`,$r),t}function ii(e){return e.type.startsWith(`image/`)?`image`:e.type.startsWith(`video/`)?`video`:null}var ai=[`none`,`frosted`,`vibrancy`,`heavy`],Y={backgroundSet:!1,backgroundEnabled:!0,backgroundRevision:0,backgroundOpacity:20,backgroundScale:100,backgroundX:0,backgroundY:0,backgroundBlur:5,blurCards:`frosted`,blurChrome:`frosted`,blurCardsAmount:45,blurCardsDepth:20,blurChromeAmount:25,blurChromeDepth:10,blurCardsEnabled:!0,blurChromeEnabled:!0,emptyOutline:!1},oi=`cartethyia.customization`,si=`cartethyia-customization-change`,ci=[`cards`,`chrome`];function li(e){return typeof e==`string`&&ai.includes(e)}function X(e,t,n,r){let i=typeof e==`number`?e:Number(e);return Number.isFinite(i)?Math.min(n,Math.max(t,i)):r}function ui(e){let t=typeof e==`object`&&e&&!Array.isArray(e)?e:{};return{backgroundSet:t.backgroundSet===!0,backgroundRevision:X(t.backgroundRevision,0,2**53-1,0),backgroundEnabled:typeof t.backgroundEnabled==`boolean`?t.backgroundEnabled:Y.backgroundEnabled,backgroundOpacity:X(t.backgroundOpacity,0,100,Y.backgroundOpacity),backgroundScale:X(t.backgroundScale,100,180,Y.backgroundScale),backgroundX:X(t.backgroundX,-100,100,Y.backgroundX),backgroundY:X(t.backgroundY,-100,100,Y.backgroundY),backgroundBlur:X(t.backgroundBlur,0,100,Y.backgroundBlur),blurCards:li(t.blurCards)?t.blurCards:Y.blurCards,blurChrome:li(t.blurChrome)?t.blurChrome:Y.blurChrome,blurCardsAmount:X(t.blurCardsAmount,0,100,Y.blurCardsAmount),blurChromeAmount:X(t.blurChromeAmount,0,100,Y.blurChromeAmount),blurCardsDepth:X(t.blurCardsDepth,0,100,Y.blurCardsDepth),blurChromeDepth:X(t.blurChromeDepth,0,100,Y.blurChromeDepth),blurCardsEnabled:t.blurCardsEnabled!==!1,blurChromeEnabled:t.blurChromeEnabled!==!1,emptyOutline:t.emptyOutline===!0}}var di=null;function fi(){if(di)return di;if(typeof window>`u`)return Y;try{di=ui(JSON.parse(window.localStorage.getItem(oi)??`null`))}catch{di={...Y}}return di}function pi(e){if(typeof document>`u`)return;let t=document.documentElement;t.dataset.blurCards=e.blurCards,t.dataset.blurChrome=e.blurChrome,t.style.setProperty(`--blur-cards`,`${e.blurCardsAmount}`),t.style.setProperty(`--blur-chrome`,`${e.blurChromeAmount}`),t.style.setProperty(`--blur-cards-depth`,`${e.blurCardsDepth}`),t.style.setProperty(`--blur-chrome-depth`,`${e.blurChromeDepth}`),t.dataset.blurCardsOn=e.blurCardsEnabled?`true`:`false`,t.dataset.blurChromeOn=e.blurChromeEnabled?`true`:`false`,t.dataset.emptyOutline=e.emptyOutline?`true`:`false`,t.dataset.bgActive=e.backgroundEnabled?`true`:`false`,t.style.setProperty(`--bg-opacity`,(e.backgroundOpacity/100).toFixed(2)),t.style.setProperty(`--bg-scale`,(e.backgroundScale/100).toFixed(2)),t.style.setProperty(`--bg-x`,`${e.backgroundX}%`),t.style.setProperty(`--bg-y`,`${e.backgroundY}%`),t.style.setProperty(`--bg-blur`,`${Math.round(e.backgroundBlur*.4)}px`)}function mi(e){try{window.localStorage.setItem(oi,JSON.stringify(e))}catch{}}function hi(e){let t=ui({...fi(),...e});return di=t,typeof window<`u`&&(mi(t),pi(t),window.dispatchEvent(new CustomEvent(si))),t}function gi(){let[e,t]=(0,P.useState)(fi);return(0,P.useEffect)(()=>{let e=()=>t(fi());return window.addEventListener(si,e),window.addEventListener(`storage`,e),()=>{window.removeEventListener(si,e),window.removeEventListener(`storage`,e)}},[]),[e,e=>t(hi(e))]}var _i=ci,Z=r(),vi=`(max-width: 767px)`,yi=`(prefers-reduced-motion: reduce)`;function bi(e){let[t,n]=(0,P.useState)(()=>typeof window<`u`&&window.matchMedia(e).matches);return(0,P.useEffect)(()=>{let t=window.matchMedia(e),r=()=>n(t.matches);return r(),t.addEventListener(`change`,r),()=>t.removeEventListener(`change`,r)},[e]),t}function xi(){let[e,t]=(0,P.useState)(()=>typeof document>`u`||!document.hidden);return(0,P.useEffect)(()=>{let e=()=>t(!document.hidden);return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]),e}function Si(){let[e]=gi(),[t,n]=(0,P.useState)(null),r=bi(vi),i=bi(yi),a=xi();(0,P.useEffect)(()=>{if(!e.backgroundSet){n(e=>(e&&URL.revokeObjectURL(e.url),{blob:new Blob,kind:`image`,url:Gr}));return}let t=!1,r=null;return Yr().then(e=>{if(t){e&&URL.revokeObjectURL(e.url);return}r=e,n(e)}).catch(()=>{t||n(null)}),()=>{t=!0,r&&URL.revokeObjectURL(r.url)}},[e.backgroundSet,e.backgroundRevision]);let o=(0,P.useRef)(null),s=t?.kind===`video`&&!r&&!i&&a;return(0,P.useEffect)(()=>{let e=o.current;if(e){if(s){e.play().catch(()=>{});return}e.pause()}},[s]),!t||!e.backgroundEnabled?null:(0,Z.jsx)(`div`,{className:`custom-background`,"data-kind":t.kind,"data-playing":s?`true`:`false`,"aria-hidden":`true`,children:t.kind===`video`?(0,Z.jsx)(`video`,{ref:o,className:`custom-background-media`,src:t.url,autoPlay:s,loop:!0,muted:!0,playsInline:!0,preload:r?`metadata`:`auto`}):(0,Z.jsx)(`img`,{className:`custom-background-media`,src:t.url,alt:``})})}function Ci({open:e,onClose:t,onConfirm:n,title:r,message:i,confirmLabel:a=`Confirm`,cancelLabel:o=`Cancel`,danger:s}){let[c,l]=(0,P.useState)(null),[u,d]=(0,P.useState)(!1);return(0,P.useEffect)(()=>{e&&(l(null),d(!1))},[e]),(0,Z.jsx)(ie,{open:e,onClose:t,title:r,description:i,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-8 py-2 px-0`,children:[(0,Z.jsx)(`p`,{className:`text-body text-text-secondary leading-normal`,children:i}),c?(0,Z.jsx)(`p`,{role:`alert`,className:`text-caption text-red`,children:c}):null,(0,Z.jsxs)(Ne,{children:[(0,Z.jsx)(x,{variant:`secondary`,size:`sm`,onClick:t,disabled:u,children:o}),(0,Z.jsx)(x,{variant:s?`danger`:`primary`,size:`sm`,onClick:()=>{u||(l(null),d(!0),Promise.resolve().then(()=>n()).then(()=>t()).catch(e=>{l(k(e,`Action failed. Please try again.`)),d(!1)}))},disabled:u,children:u?`Working…`:a})]})]})})}var Q=new Xe({defaultOptions:{queries:j,mutations:Ee}});function wi(e){let[t,n]=(e.trim().replace(/^v/i,``).split(`+`,1)[0]??``).split(`-`,2);if(t===void 0||!/^\d+\.\d+\.\d+$/.test(t))return null;let r=t.split(`.`).map(Number);if(r.length!==3||r.some(e=>!Number.isSafeInteger(e)||e<0))return null;let i=n===void 0||n.length===0?[]:n.split(`.`).map(e=>/^\d+$/.test(e)?Number(e):e);return i.some(e=>typeof e==`number`&&(!Number.isSafeInteger(e)||e<0))?null:{core:[r[0]??0,r[1]??0,r[2]??0],prerelease:i}}function Ti(e,t){if(e===void 0||t===void 0)return!1;let n=wi(e),r=wi(t);return n===null||r===null?t.trim()!==e.trim():Ei(r,n)>0}function Ei(e,t){for(let n=0;n<e.core.length;n+=1){let r=e.core[n]??0,i=t.core[n]??0;if(r!==i)return r>i?1:-1}if(e.prerelease.length===0&&t.prerelease.length>0)return 1;if(e.prerelease.length>0&&t.prerelease.length===0)return-1;for(let n=0;n<Math.max(e.prerelease.length,t.prerelease.length);n+=1){let r=e.prerelease[n],i=t.prerelease[n];if(r===void 0)return-1;if(i===void 0)return 1;if(r!==i)return typeof r==`number`&&typeof i==`string`?-1:typeof r==`string`&&typeof i==`number`||r>i?1:-1}return 0}var Di=5e3,Oi=new WeakMap;function ki(e,t){if(t!==`/`&&t!==`/providers`&&t!==`/proxy`)return Promise.resolve();let n=Date.now(),r=Oi.get(e);if(r!==void 0){if(r>n)return Promise.resolve();Oi.delete(e)}return e.fetchQuery({queryKey:M.system.health,queryFn:e=>O(`/system/health`,{signal:w(e)}).then(oe),...j}).then(()=>{Oi.delete(e)}).catch(t=>{Te(t)||Oi.set(e,Date.now()+Di)})}function Ai(){return C({queryKey:M.session.current,queryFn:()=>De(),staleTime:6e4,gcTime:3e5,retry:!1,refetchOnWindowFocus:!1})}function ji(){return C({queryKey:M.system.health,queryFn:e=>O(`/system/health`,{signal:w(e)}).then(oe),...j,refetchInterval:A.status})}function Mi(){return C({queryKey:M.releases.githubLatest,queryFn:e=>O(`/updates/release`,{signal:w(e)}).then(pe),...j,staleTime:18e5,refetchInterval:18e5,retry:!1})}function Ni(e){return C({queryKey:M.usageAnalytics.summary(e),queryFn:t=>O(`/system/usage/summary?period=${encodeURIComponent(e)}`,{signal:w(t)}).then(ce),...j,refetchInterval:A.status})}function Pi(e){return C({queryKey:M.usageAnalytics.chart(e),queryFn:t=>O(`/system/usage/chart?period=${encodeURIComponent(e)}`,{signal:w(t)}).then(fe),...j,refetchInterval:A.status})}function Fi(e,t){return C({queryKey:M.usageAnalytics.by(e,t),queryFn:n=>O(`/system/usage/by-${t}?period=${encodeURIComponent(e)}`,{signal:w(n)}).then(se),...j,refetchInterval:A.status})}function Ii(e,t=50,n){let r=n==null?``:`&httpStatus=${encodeURIComponent(String(n))}`;return C({queryKey:M.usageAnalytics.requests(e,t,n),queryFn:n=>O(`/system/usage/requests?period=${encodeURIComponent(e)}&limit=${encodeURIComponent(String(t))}${r}`,{signal:w(n)}).then(le),...j,placeholderData:e=>e,refetchInterval:A.live})}function Li(e){return C({queryKey:M.usageAnalytics.requestDetail(e??`_`),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Request is required`};return O(`/system/usage/requests/${encodeURIComponent(e)}`,{signal:w(t)}).then(ue)},enabled:e!==null,...j})}function Ri(e){return C({queryKey:M.audit.list(e??{}),queryFn:t=>{let n=new URLSearchParams;e?.action&&n.set(`action`,e.action),e?.actor&&n.set(`actor`,e.actor),e?.cursor&&n.set(`cursor`,e.cursor),e?.limit&&n.set(`limit`,String(e.limit));let r=n.toString()?`?${n.toString()}`:``;return O(`/audit${r}`,{signal:w(t)}).then(de)},...j})}function zi(){return C({queryKey:M.providers.all,queryFn:e=>O(`/providers`,{signal:w(e)}).then(he),...j,staleTime:6e4,gcTime:6e5,refetchInterval:A.catalog})}function Bi(e){return C({queryKey:M.providers.models(e),queryFn:t=>{if(!e)throw{status:400,code:`invalid_request`,message:`Provider is required`};return O(`/providers/${encodeURIComponent(e)}/models`,{signal:w(t)}).then(me)},...j,staleTime:3e5,gcTime:6e5,enabled:!!e})}function Vi(){let e=T();return N({mutationFn:({providerId:e,modelIds:t,wireFamily:n,metadata:r})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`POST`,body:JSON.stringify({modelIds:t,...n?{wireFamily:n}:{},...r?{metadata:r}:{}})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)}),S.success(`Models registered`,`${n.modelIds.length} model(s) added to ${n.providerId}`)},onError:e=>{S.error(`Failed to register models`,k(e))}})}function Hi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/models/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await ea(e,r.providerId)}})}function Ui(){return N({mutationFn:e=>O(`/providers/connection-test`,{method:`POST`,body:JSON.stringify(e)})})}function Wi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/probe`,{method:`POST`,body:JSON.stringify(t)}),onSettled:async(t,n,r)=>{await ea(e,r.providerId)}})}function Gi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)})}})}function Ki(){let e=T();return N({mutationFn:({providerId:e,modelId:t,route:n,metadata:r})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`PATCH`,body:JSON.stringify({modelId:t,route:n,enabled:!0,metadata:r})}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)}),S.success(`Model updated`,`${n.modelId} limits and capabilities saved`)},onError:e=>{S.error(`Failed to update model`,k(e))}})}function qi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/models`,{method:`DELETE`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await e.invalidateQueries({queryKey:M.providers.models(n.providerId)})}})}function Ji(e){return C({queryKey:M.providers.accounts(e),queryFn:t=>O(`/providers/${encodeURIComponent(e??``)}/accounts`,{signal:w(t)}),enabled:!!e,...j,staleTime:3e4,gcTime:6e5})}function Yi(){let e=T();return N({mutationFn:({providerId:e,request:t})=>O(`/providers/${encodeURIComponent(e)}/accounts`,{method:`POST`,body:JSON.stringify(t)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.all})])}})}function Xi(){let e=T();return N({mutationFn:({providerId:e,accounts:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/batch`,{method:`POST`,body:JSON.stringify({accounts:t})}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.all})])}})}function Zi(){let e=T();return N({mutationFn:({providerId:e,accountId:t,request:n})=>O(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}`,{method:`PATCH`,body:JSON.stringify(n)}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.all})])}})}function Qi(e,t){return C({queryKey:M.providers.healthEvents(e,t),queryFn:n=>O(`/providers/${encodeURIComponent(e??``)}/accounts/${encodeURIComponent(t??``)}/health-events`,{signal:w(n)}),enabled:!!e&&!!t,...j,refetchInterval:A.status})}async function $i(e,t){await e.invalidateQueries({predicate:e=>{let n=e.queryKey;return n[0]===`console`&&n[1]===`providers`&&n[2]===t&&n[3]===`accounts`&&n[5]===`health-events`}})}async function ea(e,t){await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(t)}),$i(e,t),e.invalidateQueries({queryKey:M.providers.all})])}function ta(){let e=T();return N({mutationFn:({providerId:e,accountId:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/${encodeURIComponent(t)}/recover`,{method:`POST`,body:`{}`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.healthEvents(n.providerId,n.accountId)}),e.invalidateQueries({queryKey:M.providers.all})]),S.success(`Account recovered`)},onError:e=>{S.error(`Could not recover the account.`,k(e))}})}function na(){return N({mutationFn:({providerId:e,accountIds:t})=>O(`/providers/${encodeURIComponent(e)}/accounts/export`,{method:`POST`,body:JSON.stringify({accountIds:t})})})}function ra(){return N({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>O(`/providers/${encodeURIComponent(e)}/oauth/authorize`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function ia(){let e=T();return N({mutationFn:({providerId:e,code:t,state:n})=>O(`/providers/${encodeURIComponent(e)}/oauth/callback?${new URLSearchParams({code:t,state:n}).toString()}`),onSuccess:async(t,n)=>{await ea(e,n.providerId)}})}function aa(){return N({mutationFn:({providerId:e,accountLabel:t,parameters:n})=>O(`/providers/${encodeURIComponent(e)}/oauth/device/start`,{method:`POST`,body:JSON.stringify({...t?{accountLabel:t}:{},...n&&Object.keys(n).length>0?{parameters:n}:{}})})})}function oa(){let e=T();return N({mutationFn:({providerId:e,credential:t,fields:n,accountLabel:r})=>O(`/providers/${encodeURIComponent(e)}/oauth/import`,{method:`POST`,body:JSON.stringify({credential:t,...n&&Object.keys(n).length>0?{fields:n}:{},...r?{accountLabel:r}:{}})}),onSuccess:async(t,n)=>{await ea(e,n.providerId),await e.invalidateQueries({queryKey:M.quota.all})}})}function sa(){let e=T();return N({mutationFn:({providerId:e,deviceAuthId:t})=>O(`/providers/${encodeURIComponent(e)}/oauth/device/poll`,{method:`POST`,body:JSON.stringify({deviceAuthId:t})}),onSuccess:async(t,n)=>{t.status===`complete`&&await Promise.all([e.invalidateQueries({queryKey:M.providers.accounts(n.providerId)}),e.invalidateQueries({queryKey:M.providers.healthEvents(n.providerId,t.accountId)}),e.invalidateQueries({queryKey:M.quota.all}),ea(e,n.providerId)])}})}function ca(){let e=T();return N({mutationFn:e=>O(`/providers`,{method:`POST`,body:JSON.stringify(e)}),onSuccess:async t=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.all}),e.invalidateQueries({queryKey:M.modelRouting.all})]),S.success(`Provider created`,t.label??t.providerId)},onError:e=>{S.error(`Failed to create provider`,k(e))}})}function la(){let e=T();return N({mutationFn:({providerId:e,enabled:t})=>O(`/providers/platform/global/${encodeURIComponent(e)}`,{method:`PATCH`,body:JSON.stringify({enabled:t})}),onSuccess:async(t,{providerId:n})=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.all}),e.invalidateQueries({queryKey:M.providers.detail(n)})])}})}function ua(e={}){let t=T();return N({mutationFn:e=>O(`/providers/${encodeURIComponent(e)}/models/sync`,{method:`POST`,body:`{}`}),onSuccess:async(n,r)=>{await t.invalidateQueries({queryKey:M.providers.models(r)}),e.silent||S.success(`Models fetched`,n.synced>0?`${n.synced} new model${n.synced===1?``:`s`} added`:`No new models found`)},onError:t=>{e.silent||S.error(`Failed to fetch models`,k(t))}})}function da(){let e=T();return N({mutationFn:e=>O(`/providers/${encodeURIComponent(e)}`,{method:`DELETE`}),onSuccess:async(t,n)=>{await Promise.all([e.invalidateQueries({queryKey:M.providers.all}),e.invalidateQueries({queryKey:M.quota.all}),e.invalidateQueries({queryKey:M.modelRouting.all})]),S.success(`Provider deleted`,n)},onError:e=>{S.error(`Failed to delete provider`,k(e))}})}var fa={name:`cartethyia`,version:`2.4.0`,description:`A powerful, self-hosted reverse proxy for OpenAI- and Anthropic-compatible AI clients, powered by native Bun and Elysia. It serves both protocols from a single server, routes every model across any configured provider, and translates requests and responses in real time — streaming and prompt caching included. Underneath it runs a full delivery engine: per-account health tracking, quota and cooldown enforcement, automatic failover across pools and providers, usage accounting, and telemetry. Point OpenCode, Cline, Claude Code, Codex, or any compatible client at Cartethyia and it keeps its native protocol while the gateway absorbs every provider-specific difference behind it. Runs on embedded SQLite or external PostgreSQL with optional Redis coordination, ships as a global CLI with a system-tray console, and needs only Bun 1.4+ alongside Node.js/npm.`,license:`GPL-3.0-only`,type:`module`,packageManager:`bun@1.4.0`,repository:{type:`git`,url:`git+https://github.com/risunCode/Cartethyia.git`},homepage:`https://github.com/risunCode/Cartethyia#readme`,bugs:{url:`https://github.com/risunCode/Cartethyia/issues`},keywords:[`ai`,`gateway`,`llm`,`bun`,`self-hosted`],bin:{cartethyia:`scripts/cli/cli-launcher.cjs`,carte:`scripts/cli/carte-launcher.cjs`},files:[`scripts/cli/`,`scripts/operations/probe-egress.ts`,`scripts/operations/restart.ts`,`scripts/shared/env.ts`,`src/`,`migrations/`,`dist/dashboard/`,`tray-assets/`,`.env.example`,`README.md`],workspaces:[`dashboard`],engines:{bun:`>=1.4.0`},scripts:{dev:`bun run dev:stack`,"dev:watch":`bun run scripts/dev/supervisor.ts`,test:`bun run scripts/test/run.ts`,build:`bun run scripts/build/build.ts`,prepack:`bun run dashboard:build`,setup:`bun run scripts/cli/setup.ts`,start:`bun run scripts/operations/start-production.ts`,doctor:`bun run scripts/cli/doctor.ts`,"probe:egress":`bun run scripts/operations/probe-egress.ts`,restart:`bun run scripts/operations/restart.ts`,"build:aot":`bun run scripts/build/aot.ts`,"dev:stack":`concurrently -n BACKEND,DASHBOARD -c cyan,magenta --kill-others-on-fail "bun run dev:backend" "bun run dashboard:dev"`,typecheck:`tsc --noEmit`,"test:watch":`bun run scripts/test/run.ts --watch`,"test-db:up":`docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dev:backend":`bun run --hot src/main.ts`,"dev:console-auth":`bun run scripts/dev/console-session.ts`,"dev:visual-baseline":`bun run scripts/dev/visual-baseline.ts`,"build:binary":`bun run scripts/build/binary.ts`,"test:backend":`bun run scripts/test/run.ts --scope backend`,"test-db:down":`docker compose -f docker-compose.test.yml down`,"dashboard:dev":`bun run --cwd dashboard dev`,"test-db:check":`bun run scripts/test/db-check.ts`,"dashboard:test":`bun run scripts/test/run.ts --scope dashboard`,"test-db:reset":`docker compose -f docker-compose.test.yml down -v && docker compose -f docker-compose.test.yml up -d --wait postgres-test`,"dashboard:build":`bun run --cwd dashboard build`,"dashboard:typecheck":`bun run --cwd dashboard typecheck`},dependencies:{"@bufbuild/protobuf":`^2.14.1`,"@electric-sql/pglite":`^0.5.8`,"drizzle-orm":`0.45.2`,elysia:`^2.0.0-beta.16`,enquirer:`^2.4.1`,"exact-mirror":`^1.2.6`,impit:`^0.14.5`,ioredis:`6.0.0`,pg:`8.23.0`,pino:`^10.3.1`,"pino-pretty":`^13.1.3`,"socks-proxy-agent":`^10.1.0`,systray2:`2.1.4`,typebox:`1.3.27`,undici:`^8.10.2`,ws:`8.22.0`},devDependencies:{"@types/pg":`8.11.10`,"@types/ws":`8.18.1`,"bun-types":`1.4.0`,concurrently:`^10.0.5`,typescript:`5.9.2`}}.version,pa=`v${fa.replace(/\.0$/,``)} (Zhezhi)`,ma=[{label:`Main`,items:[{label:`Overview`,path:`/`,icon:Ie},{label:`Usage`,path:`/usage`,icon:u},{label:`Providers`,path:`/providers`,icon:Ue},{label:`Model Lab`,path:`/model-lab`,icon:_}]},{label:`Control`,items:[{label:`Combos & Routes`,path:`/combos`,icon:Fe},{label:`Quota Management`,path:`/quota`,icon:Ge},{label:`Proxy & Requests`,path:`/proxy`,icon:d},{label:`CLI Tools`,path:`/cli-tools`,icon:p}]},{label:`System`,items:[{label:`Customization`,path:`/customization`,icon:Be},{label:`Console Log`,path:`/console-log`,icon:He},{label:`Settings`,path:`/settings`,icon:We}]}],ha={"/":{title:`Overview`,sub:`Gateway health, capacity, and live metrics`,icon:Ie},"/usage":{title:`Usage & Metrics`,sub:`Token economics, requests, and cost breakdown`,icon:u},"/providers":{title:`Provider Catalog`,sub:`Upstream credentials, models, and latency`,icon:Ue},"/combos":{title:`Combos & Routing`,sub:`Failover policies, model aliases, and weighted routes`,icon:Fe},"/quota":{title:`Quota Management`,sub:`Rate limits, leases, and tenant quotas`,icon:Ge},"/proxy":{title:`Proxy & Requests`,sub:`Network pools, SOCKS5/HTTP egress, and dispatch`,icon:d},"/customization":{title:`Customization`,sub:`Background, transparency, and blur`,icon:Be},"/model-lab":{title:`Model Lab`,sub:`Chat a routed model without leaving the console`,icon:_},"/console-log":{title:`Console Log`,sub:`Live server logs and audit trail`,icon:He},"/cli-tools":{title:`CLI Tools`,sub:`Claude Code CLI, OpenCode, and local developer tool integrations`,icon:p},"/settings":{title:`Settings`,sub:`Account security, runtime preferences, and state recovery`,icon:We}},ga={title:`Console`,sub:`Cartethyia AI Gateway Administration`,icon:Ie};function _a(e,t){let n=/^\/providers\/([^/]+)\/?$/.exec(e);if(n?.[1]){let e=t.find(e=>e.providerId===n[1]);return{title:e?.label||e?.displayName||n[1],sub:`Routing, accounts, models, and health`,icon:Ue}}let r=/^\/cli-tools\/([^/]+)\/?$/.exec(e);return r?.[1]?{title:`CLI Tool`,sub:`${r[1]} — mappings, endpoints, and downloadable config`,icon:p}:ha[e]??ga}function va(){try{return ji()}catch{return{data:void 0,isError:!1,isFetching:!1,isPending:!1}}}function ya(){let[e,t]=(0,P.useState)(()=>h()),n=ne(e);return(0,P.useEffect)(()=>{let e=()=>t(h());return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[]),(0,P.useEffect)(()=>{ee(e)},[e]),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>{let e=n?`light`:`dark`;t(e),y(e)},"aria-label":`Toggle theme`,"aria-pressed":n,className:`topbar-icon-button`,title:n?`Switch to light mode`:`Switch to dark mode`,children:(0,Z.jsx)(`span`,{className:`grid place-items-center`,children:n?(0,Z.jsx)(g,{size:17}):(0,Z.jsx)(te,{size:17})},n?`sun`:`moon`)})}var ba=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`}),xa=new Intl.DateTimeFormat(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hourCycle:`h23`,timeZone:`UTC`});function Sa(e){if(!Number.isFinite(e)||e<0)return`Unavailable`;let t=Math.floor(e);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=n%60,i=Math.floor(n/60),a=i%24,o=Math.floor(i/24);return o>0?`${o}d ${a}h ${r}m`:i>0?`${i}h ${r}m`:`${n}m`}function Ca(e){if(!Number.isFinite(e)||e<0)return`Unavailable`;let t=e>=1024**3?{divisor:1024**3,label:`GiB`}:{divisor:1024**2,label:`MiB`};return`${(e/t.divisor).toFixed(1)} ${t.label}`}function wa({icon:e,label:t,value:n,detail:r,title:i}){return(0,Z.jsxs)(`div`,{className:`min-w-0 rounded-control border border-inner-border bg-surface-2 p-3`,title:i,children:[(0,Z.jsxs)(`dt`,{className:`flex items-center gap-2 text-micro font-medium text-text-tertiary`,children:[(0,Z.jsx)(e,{size:13,strokeWidth:1.8,className:`shrink-0`,"aria-hidden":`true`}),(0,Z.jsx)(`span`,{children:t})]}),(0,Z.jsx)(`dd`,{className:`mt-1 truncate font-mono text-caption font-semibold tabular-nums text-text-primary`,children:n}),r?(0,Z.jsx)(`dd`,{className:`mt-1 text-micro text-text-secondary`,children:r}):null]})}function Ta({health:e}){let[t,n]=(0,P.useState)(!1),[r,i]=(0,P.useState)(()=>new Date),a=(0,P.useRef)(null),s=(0,P.useRef)(null);(0,P.useEffect)(()=>{if(!t)return;i(new Date);let e=window.setInterval(()=>i(new Date),1e3);return()=>window.clearInterval(e)},[t]),(0,P.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.target;s.current&&!s.current.contains(t)&&a.current&&!a.current.contains(t)&&n(!1)},r=e=>{e.key===`Escape`&&n(!1)};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,r),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,r)}},[t]);let c=e?e.status===`healthy`?`All systems operational`:e.status===`degraded`?`Gateway degraded`:`Gateway unhealthy`:`System health unavailable`,l=e?e.status===`healthy`?`Postgres & Redis admission connected.`:e.status===`degraded`?`Check connection logs.`:`Gateway is reporting an unhealthy status.`:`Live gateway metrics are not available.`,u=e&&[Number.isFinite(e.memory_percent)?`${e.memory_percent.toFixed(1)}% of system RAM`:void 0,e.database_in_process?`In-process DB included`:void 0].filter(Boolean).join(` · `)||void 0,d=e?Number.isFinite(e.cpu_cores)&&e.cpu_cores>0?`1-min load · ${e.cpu_cores} cores`:`Normalized 1-min load`:void 0;return(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`button`,{ref:a,type:`button`,className:`topbar-icon-button`,"aria-label":`Notifications`,"aria-expanded":t,"aria-haspopup":`dialog`,onClick:()=>n(e=>!e),children:(0,Z.jsx)(Pe,{size:17})}),t?(0,Br.createPortal)((0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`fixed inset-0 z-floating bg-overlay backdrop-blur-dialog`,onClick:()=>n(!1)}),(0,Z.jsxs)(`div`,{ref:s,role:`dialog`,"aria-label":`Notifications`,className:`app-topbar-popover popout-enter glass rounded-sidebar border border-inner-border bg-popover-bg p-5 shadow-popout z-popover`,children:[(0,Z.jsxs)(`div`,{className:`mb-3 flex shrink-0 items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 font-bold text-body-lg`,children:[(0,Z.jsx)(`span`,{className:`w-13 h-13 rounded-pill bg-accent-soft text-accent grid place-items-center`,children:(0,Z.jsx)(Pe,{size:13})}),(0,Z.jsx)(`span`,{children:`Notifications`})]}),(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Close notifications`,onClick:()=>n(!1),className:`cursor-pointer border-none bg-transparent p-2 text-caption text-text-tertiary`,children:(0,Z.jsx)(o,{size:14})})]}),(0,Z.jsxs)(`div`,{className:`scroll-region min-h-0 flex-1 flex flex-col gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,Z.jsx)(Ue,{size:16,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`font-semibold text-caption`,children:c}),(0,Z.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:l})]})]}),(0,Z.jsxs)(`dl`,{"aria-label":`Runtime metrics`,className:`grid grid-cols-2 gap-2`,children:[(0,Z.jsx)(wa,{icon:m,label:`Local time`,value:ba.format(r)}),(0,Z.jsx)(wa,{icon:v,label:`UTC`,value:xa.format(r)}),(0,Z.jsx)(wa,{icon:Ke,label:`Uptime`,value:e?Sa(e.uptime_seconds):`Unavailable`,detail:e&&Number.isFinite(e.uptime_seconds)&&e.uptime_seconds>=0?`Gateway process running`:void 0}),(0,Z.jsx)(wa,{icon:Re,label:`Process RSS`,value:e?Ca(e.memory_bytes):`Unavailable`,detail:u,title:`Process resident set size; percentage is share of system RAM.`}),(0,Z.jsx)(wa,{icon:Fe,label:`CPU load`,value:e&&Number.isFinite(e.cpu_percent)?`${e.cpu_percent.toFixed(1)}%`:`Unavailable`,detail:d,title:`One-minute load average normalized by the number of CPU cores.`}),(0,Z.jsx)(wa,{icon:ze,label:`Runtime`,value:e?.platform?.trim()||`Unavailable`,detail:e?.platform?.trim()?`Gateway host platform`:void 0,title:e?.platform?.trim()||`Runtime platform unavailable`})]}),(0,Z.jsxs)(`div`,{className:`flex items-start gap-3 rounded-card border border-inner-border bg-surface-2 p-4`,children:[(0,Z.jsx)(`span`,{className:`mt-0.5 grid w-12 h-12 shrink-0 place-items-center rounded-control bg-surface-1 text-text-secondary`,children:(0,Z.jsx)(Ve,{size:16,"aria-hidden":`true`})}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`p`,{className:`font-semibold text-caption`,children:pa}),(0,Z.jsx)(`p`,{className:`text-badge text-text-secondary mt-1`,children:`High-performance AI Gateway & Protocol Orchestrator.`})]})]})]})]})]}),document.body):null]})}function Ea({group:e,pathname:t,onIntent:n}){return(0,Z.jsxs)(`div`,{className:`nav-group-section`,children:[(0,Z.jsx)(`p`,{className:`nav-group-title`,children:e.label}),(0,Z.jsx)(Da,{items:e.items,pathname:t,onIntent:n})]})}function Da({items:e,pathname:t,onIntent:n}){let r=(0,P.useRef)(null),[i,a]=(0,P.useState)({top:0,height:0,opacity:0});return(0,P.useLayoutEffect)(()=>{let e=r.current;if(!e)return;let t=e.querySelector(`[data-active="true"]`);if(!t){a(e=>({...e,opacity:0}));return}let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();a({top:i.top-n.top,height:i.height,opacity:1})},[t,e]),(0,Z.jsxs)(`div`,{ref:r,className:`nav-items-container`,children:[(0,Z.jsx)(`div`,{className:`sidebar-active-indicator`,style:{transform:`translateY(${i.top}px)`,height:`${i.height}px`,opacity:i.opacity},"aria-hidden":`true`}),e.map(e=>{let r=e.path===`/`?t===`/`:t===e.path||t.startsWith(`${e.path}/`);return(0,Z.jsxs)(kr,{to:e.path,end:e.path===`/`,"data-active":r?`true`:void 0,className:`nav-link-item ${r?`active`:``}`,onMouseEnter:()=>n(e.path),onFocus:()=>n(e.path),children:[(0,Z.jsx)(e.icon,{size:17,className:`nav-link-icon`}),(0,Z.jsx)(`span`,{children:e.label}),e.badge?(0,Z.jsx)(`span`,{className:`nav-link-badge`,children:e.badge}):null]},e.path)})]})}function Oa({user:e,children:t}){let n=K(),r=G(),[i,a]=(0,P.useState)(!1),[o,c]=(0,P.useState)(!1),[u,d]=(0,P.useState)(!1),p=va(),m=Mi(),h=p.data?.version??fa,g=m.data?.tag_name?.replace(/^v/,``),_=Ti(h,g),v=zi(),y=e=>{ki(Q,e)};(0,P.useEffect)(()=>{a(!1)},[r.pathname]),(0,P.useEffect)(()=>{let e=()=>a(!1);return window.addEventListener(`cartethyia:overlay-open`,e),()=>window.removeEventListener(`cartethyia:overlay-open`,e)},[]),(0,P.useLayoutEffect)(()=>{window.scrollTo(0,0)},[r.pathname]);let b=async()=>{c(!0);try{await O(`/auth/logout`,{method:`POST`})}finally{Q.clear(),n(`/login`,{replace:!0})}};(0,P.useEffect)(()=>(document.documentElement.dataset.glassEnabled=`true`,pi(fi()),()=>{delete document.documentElement.dataset.glassEnabled}),[]);let x=_a(r.pathname,v.data??[]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`app-bg`,"aria-hidden":`true`}),(0,Z.jsx)(`div`,{className:`app-shell-frame`,children:(0,Z.jsxs)(`div`,{className:`app-shell-root`,"data-drawer":i?`open`:void 0,"data-page-scroll":r.pathname===`/console-log`?`contained`:void 0,onClick:e=>{i&&e.target.closest(`.app-main-column`)&&a(!1)},children:[(0,Z.jsxs)(`aside`,{className:`glass app-sidebar ${i?`is-open`:``}`,"aria-label":`Dashboard navigation`,children:[(0,Z.jsxs)(`div`,{className:`brand-header`,children:[(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`brand-icon overflow-hidden p-0`,children:(0,Z.jsx)(`img`,{src:`/assets/brand/sidebar_ico.jpg`,alt:`Cartethyia`,onError:e=>{e.currentTarget.onerror=null,e.currentTarget.src=`/assets/brand/sidebar_ico.jpg`},className:`w-full h-full object-cover block`})}),(0,Z.jsxs)(`div`,{className:`brand-meta`,children:[(0,Z.jsx)(`div`,{className:`brand-name`,children:(0,Z.jsx)(`span`,{children:`Cartethyia`})}),(0,Z.jsxs)(`div`,{className:`brand-version-badge`,children:[(0,Z.jsx)(`a`,{href:s,target:`_blank`,rel:`noreferrer`,className:`brand-version-link`,children:pa}),_?(0,Z.jsxs)(`a`,{href:m.data?.html_url??l,target:`_blank`,rel:`noreferrer`,className:`brand-update-badge`,title:g===void 0?`A newer Cartethyia release is available on GitHub`:`Update available on GitHub: v${g}`,children:[(0,Z.jsx)(Ve,{size:9,className:`shrink-0`,"aria-hidden":`true`}),`update`]}):null]})]})]}),(0,Z.jsx)(`nav`,{className:`flex-1 overflow-y-auto py-2 px-0`,children:ma.map(e=>(0,Z.jsx)(Ea,{group:e,pathname:r.pathname,onIntent:y},e.label))}),(0,Z.jsx)(`div`,{className:`sidebar-user-card`,children:(0,Z.jsxs)(`div`,{className:`user-card-content`,children:[(0,Z.jsx)(`div`,{className:`user-avatar`,"aria-hidden":`true`,children:(e.displayName??e.email).slice(0,2).toUpperCase()}),(0,Z.jsxs)(`div`,{className:`user-info`,children:[(0,Z.jsx)(`p`,{className:`user-name`,children:e.displayName||`Admin`}),(0,Z.jsx)(`p`,{className:`user-role`,children:e.email})]}),(0,Z.jsx)(`button`,{type:`button`,onClick:()=>d(!0),disabled:o,"aria-label":`Sign out`,title:`Sign out`,className:`topbar-icon-button w-15 h-15 rounded-inset`,children:(0,Z.jsx)(Le,{size:14})})]})})]}),(0,Z.jsxs)(`div`,{className:`app-main-column`,children:[(0,Z.jsx)(Si,{}),(0,Z.jsxs)(`header`,{className:`glass app-topbar`,children:[(0,Z.jsx)(`button`,{type:`button`,"aria-label":`Open navigation`,className:`topbar-menu-btn`,onClick:()=>a(!0),children:(0,Z.jsx)(f,{size:18})}),(0,Z.jsxs)(`div`,{className:`topbar-meta`,children:[(0,Z.jsxs)(`h1`,{className:`topbar-title`,children:[(0,Z.jsx)(x.icon,{className:`topbar-title-icon`,size:16,"aria-hidden":`true`}),x.title]}),(0,Z.jsx)(`p`,{className:`topbar-subtitle`,children:x.sub})]}),(0,Z.jsxs)(`div`,{className:`topbar-actions`,children:[(0,Z.jsx)(ya,{}),(0,Z.jsx)(Ta,{health:p.data})]})]}),(0,Z.jsx)(`main`,{className:`route-enter w-full min-w-0`,children:t})]})]})}),(0,Z.jsx)(Ci,{open:u,onClose:()=>d(!1),onConfirm:b,title:`Sign out?`,message:`You will need to sign in again to open the console.`,confirmLabel:`Sign out`,danger:!0})]})}var ka=class extends P.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[console] route render failed:`,e,t.componentStack)}componentDidUpdate(e){e.resetKey!==this.props.resetKey&&this.state.error!==null&&this.setState({error:null})}render(){return this.state.error===null?this.props.children:(0,Z.jsx)(`main`,{className:`auth-viewport`,children:(0,Z.jsxs)(`div`,{className:`card-solid auth-window border border-red-soft`,children:[(0,Z.jsxs)(`div`,{className:`auth-header`,children:[(0,Z.jsx)(`h1`,{className:`auth-title`,children:`Console view failed`}),(0,Z.jsx)(`p`,{className:`auth-desc`,children:`This view could not be rendered.`})]}),(0,Z.jsxs)(`div`,{className:`rounded-panel border border-inner-border bg-surface-2 p-7 leading-normal text-caption text-text-secondary`,children:[(0,Z.jsx)(`strong`,{className:`block text-text-primary mb-2`,children:`Rendering error`}),(0,Z.jsx)(`span`,{className:`select-text break-words`,children:this.state.error.message})]}),(0,Z.jsx)(`button`,{type:`button`,className:`btn btn-primary inline-flex w-full items-center justify-center rounded-control bg-accent font-semibold text-accent-foreground mt-3 h-20 text-caption`,onClick:()=>window.location.reload(),children:`Reload console`})]})})}},Aa=3e5;function ja(e){return`cartethyia:lazy-retry:${e}`}function Ma(e,t){if(e===null)return!0;let n=Number(e);return!Number.isFinite(n)||t-n>Aa}function Na(){try{return typeof sessionStorage>`u`?void 0:sessionStorage}catch{return}}function $(e,t,n={}){let r=n.storage??Na(),i=n.reload??(()=>{window.location.reload()}),a=n.now??(()=>Date.now()),o=ja(t);return(0,P.lazy)(async()=>{try{let t=await e();try{r?.removeItem(o)}catch{}return t}catch(e){let t=null;try{t=r?.getItem(o)??null}catch{t=null}if(Ma(t,a())){try{r?.setItem(o,String(a()))}catch{}return i(),new Promise(()=>{})}throw e}})}function Pa(){return(0,Z.jsxs)(`div`,{role:`status`,"aria-label":`Loading console`,className:`min-h-dvh flex flex-col items-center justify-center gap-6 text-text-tertiary`,children:[(0,Z.jsx)(b,{size:22,className:`animate-spin`,"aria-hidden":`true`}),(0,Z.jsx)(`p`,{className:`text-caption`,children:`Loading console…`})]})}var Fa=$(()=>i(()=>import(`./LoginPage-lI7CDb07.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9])),`login`),Ia=$(()=>i(()=>import(`./SetupPage-Cu42oonZ.js`),__vite__mapDeps([10,1,2,3,4,6,7,8,9,11,12])),`setup`),La=$(()=>i(()=>import(`./BannedPage-CvnNj-tj.js`),__vite__mapDeps([13,1])),`banned`),Ra=$(()=>i(()=>import(`./OverviewPage-HaMJcZaC.js`),__vite__mapDeps([14,1,15,16,6,17,18,19,20,21,3,4,2,22,23,24,25,26,8,9,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,7,47,48,49,50,51,52,11,53])),`overview`),za=$(()=>i(()=>import(`./UsagePage-DQh2rUsY.js`),__vite__mapDeps([54,1,55,56,3,4,2,33,15,16,6,17,18,20,21,57,58,25,26,8,9,59,28,5,37,60,61,62,43,44,45,63,24,50,11,64,65,66,67])),`usage`),Ba=$(()=>i(()=>import(`./ProviderDetailPage-Pb-0zXVA.js`),__vite__mapDeps([68,1,55,69,70,19,20,21,3,4,2,71,57,58,25,26,8,9,27,59,28,29,72,32,33,34,35,73,36,74,38,42,61,16,6,43,44,45,63,46,7,48,49,24,50,53,75,76,17,18,77,11,78,64,65])),`provider-detail`),Va=$(()=>i(()=>import(`./ProvidersPage-KifbSUkV.js`),__vite__mapDeps([79,1,21,3,4,20,2,8,9,28,32,33,35,42,6,80,43,46,7,48,49,24,50,75,78])),`providers`),Ha=$(()=>i(()=>import(`./CombosPage-B7ETkfVH.js`),__vite__mapDeps([81,1,3,4,82,21,20,2,23,24,25,28,72,32,33,34,35,37,38,42,6,80,43,31,7,8,9,47,16,45,46,48,50,75,76,17,18,64])),`combos`),Ua=$(()=>i(()=>import(`./QuotaPage-BzG3XTSg.js`),__vite__mapDeps([83,1,55,20,21,3,4,2,22,8,28,32,33,36,74,84,42,6,43,46,48,49,24,50,11,53,77,16,17,18])),`quota`),Wa=$(()=>i(()=>import(`./ProxyPage-DKLnIcne.js`),__vite__mapDeps([85,1,55,21,3,4,20,2,26,8,9,27,28,32,33,34,35,73,74,39,42,16,6,17,18,43,44,63,46,7,49,24,50,11,66,67])),`proxy`),Ga=$(()=>i(()=>import(`./SettingsPage-YxRml8AT.js`),__vite__mapDeps([86,1,21,3,4,20,2,26,9,28,32,33,40,16,6,17,18,42,43,44,7,8,49,24,65,12])),`settings`),Ka=$(()=>i(()=>import(`./CliToolsPage-Ba55GO-L.js`),__vite__mapDeps([87,1,55,28,2,3,4,43,46,24,50,52,16,6,17,18,88,11])),`cli-tools`),qa=$(()=>i(()=>import(`./CliToolDetailPage-DdYuTZKs.js`),__vite__mapDeps([89,1,69,21,3,4,20,2,57,26,28,37,38,6,43,44,46,7,8,9,47,32,33,16,45,48,49,24,50,51,17,18,52,88])),`cli-tool-detail`),Ja=$(()=>i(()=>import(`./ConsoleLogPage-D-OQwsYE.js`),__vite__mapDeps([90,1,2,3,4,28,36,38,39,42,6,43,63,67,46,7,8,9,11])),`console-log`),Ya=$(()=>i(()=>import(`./CustomizationPage-BMqN7mc4.js`),__vite__mapDeps([91,1,2,3,4,59,72,74,43,49,24,50])),`customization`),Xa=$(()=>i(()=>import(`./StudioPage-DIglSNvf.js`),__vite__mapDeps([92,1,3,4,56,2,33,70,20,21,71,25,26,27,93,32,34,74,84,61,43,7,8,9,47,37,38,16,6,45,46,48,51,17,18])),`studio`);function Za(){let e=K(),t=G();return(0,P.useEffect)(()=>(Oe(n=>{if(Q.clear(),n===`banned`){e(`/banned`,{replace:!0});return}e(`/login?returnTo=${encodeURIComponent(t.pathname)}`,{replace:!0})}),()=>Oe(void 0)),[e,t.pathname]),null}function Qa(){let e=G();return(0,Z.jsx)(ka,{resetKey:`${e.pathname}${e.search}`,children:(0,Z.jsx)(P.Suspense,{fallback:(0,Z.jsx)(Pa,{}),children:(0,Z.jsxs)(Vn,{children:[(0,Z.jsx)(q,{path:`/login`,element:(0,Z.jsx)(Fa,{})}),(0,Z.jsx)(q,{path:`/setup`,element:(0,Z.jsx)(Ia,{})}),(0,Z.jsx)(q,{path:`/banned`,element:(0,Z.jsx)(La,{})}),(0,Z.jsx)(q,{path:`/*`,element:(0,Z.jsx)($a,{})})]})})})}function $a(){let[e,t]=(0,P.useState)({kind:`loading`}),n=G(),r=K(),[i]=(0,P.useState)(()=>n.pathname);return(0,P.useEffect)(()=>{let e=new AbortController;return Q.fetchQuery({queryKey:M.session.current,queryFn:()=>De(),staleTime:6e4}).then(n=>{if(!e.signal.aborted){if(n){Q.setQueryData(M.session.current,n),t({kind:`ready`,user:n}),n.isFirstBoot&&i!==`/setup`&&r(`/setup`,{replace:!0});return}Q.removeQueries({queryKey:M.session.current}),O(`/auth/first-boot`,{signal:e.signal}).then(n=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:n.requires_setup})}).catch(()=>{e.signal.aborted||t({kind:`unauthenticated`,needsSetup:!1})})}}).catch(n=>{e.signal.aborted||(typeof n==`object`&&n&&`status`in n&&n.status===403?t({kind:`blocked`}):t({kind:`unauthenticated`,needsSetup:!1}))}),()=>e.abort()},[i,r]),e.kind===`loading`?null:e.kind===`blocked`?(0,Z.jsx)(zn,{to:`/banned`,replace:!0}):e.kind===`unauthenticated`?(0,Z.jsx)(zn,{to:e.needsSetup?`/setup`:`/login?returnTo=${encodeURIComponent(n.pathname)}`,replace:!0}):(0,Z.jsx)(Oa,{user:e.user,children:(0,Z.jsx)(ka,{resetKey:n.pathname,children:(0,Z.jsxs)(Vn,{children:[(0,Z.jsx)(q,{path:`/`,element:(0,Z.jsx)(Ra,{})}),(0,Z.jsx)(q,{path:`/usage`,element:(0,Z.jsx)(za,{})}),(0,Z.jsx)(q,{path:`/providers`,element:(0,Z.jsx)(Va,{})}),(0,Z.jsx)(q,{path:`/providers/:providerId`,element:(0,Z.jsx)(Ba,{})}),(0,Z.jsx)(q,{path:`/combos`,element:(0,Z.jsx)(Ha,{})}),(0,Z.jsx)(q,{path:`/quota`,element:(0,Z.jsx)(Ua,{})}),(0,Z.jsx)(q,{path:`/proxy`,element:(0,Z.jsx)(Wa,{})}),(0,Z.jsx)(q,{path:`/console-log`,element:(0,Z.jsx)(Ja,{})}),(0,Z.jsx)(q,{path:`/customization`,element:(0,Z.jsx)(Ya,{})}),(0,Z.jsx)(q,{path:`/model-lab`,element:(0,Z.jsx)(Xa,{})}),(0,Z.jsx)(q,{path:`/cli-tools`,element:(0,Z.jsx)(Ka,{})}),(0,Z.jsx)(q,{path:`/cli-tools/:toolId`,element:(0,Z.jsx)(qa,{})}),(0,Z.jsx)(q,{path:`/settings`,element:(0,Z.jsx)(Ga,{})}),(0,Z.jsx)(q,{path:`*`,element:(0,Z.jsx)(zn,{to:`/`,replace:!0})})]})})})}function eo(){return(0,Z.jsx)(ae,{client:Q,children:(0,Z.jsxs)(Dr,{basename:`/console`,children:[(0,Z.jsx)(Za,{}),(0,Z.jsx)(Qa,{}),(0,Z.jsx)(re,{position:`top-right`,offset:{top:`6rem`,right:`1rem`},mobileOffset:{top:`6rem`,left:`1rem`,right:`1rem`},visibleToasts:2,richColors:!0,duration:5e3,toastOptions:{className:`toast-surface select-text`,descriptionClassName:`select-text`,classNames:{title:`select-text`},style:{background:`var(--glass-bg-2)`,border:`1px solid var(--glass-border-2)`,color:`var(--text-primary)`,fontSize:`12.5px`,userSelect:`text`},actionButtonStyle:{background:`var(--accent)`,color:`var(--accent-foreground)`},cancelButtonStyle:{background:`var(--surface-muted)`,color:`var(--text-primary)`}}})]})})}function to(e){document.title=`Cartethyia Console`,(0,Vr.createRoot)(e).render((0,Z.jsx)(P.StrictMode,{children:(0,Z.jsx)(eo,{})}))}export{Ge as $,Pi as A,ti as B,Ui as C,Ri as D,Zi as E,Ci as F,Yr as G,Gr as H,_i as I,Or as J,ei as K,Y as L,Ii as M,Ni as N,Ai as O,Q as P,Ke as Q,hi as R,ua as S,Ki as T,Zr as U,ni as V,ii as W,_n as X,K as Y,Pr as Z,ta as _,Yi as a,ra as b,qi as c,sa as d,Ue as et,Wi as f,zi as g,Bi as h,ca as i,Li as j,Fi as k,na as l,Ji as m,to as mountConsole,Qi as n,Ie as nt,Xi as o,Hi as p,Xr as q,ia as r,da as s,fa as t,He as tt,oa as u,Vi as v,la as w,aa as x,Gi as y,gi as z};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entry-
|
|
2
|
-
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){return e===`/share`||e.startsWith(`/share/`)?`share`:e===`/console`||e.startsWith(`/console/`)?`console`:`landing`}var t=`modulepreload`,n=function(e){return`/`+e},r={},i=function(e,i,a){let o=Promise.resolve();if(i&&i.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}o=l(i.map(i=>{if(i=n(i,a),i=u(i),i in r)return;r[i]=!0;let o=i.endsWith(`.css`);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.href===i&&(!o||n.rel===`stylesheet`))return}let s=document.createElement(`link`);if(s.rel=o?`stylesheet`:t,o||(s.as=`script`),s.crossOrigin=``,s.href=i,c&&s.setAttribute(`nonce`,c),document.head.appendChild(s),o)return new Promise((e,t)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},a=document.getElementById(`root`);if(a===null)throw Error(`Dashboard root element is missing`);var o=e(window.location.pathname);o===`console`?i(async()=>{let{mountConsole:e}=await import(`./entry-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entry-6PSJYbzI.js","assets/jsx-runtime-CXUMngI_.js","assets/app-BDJWMThu.js","assets/app-Cjgo4-Lf.css","assets/terminal-C9mZ4Ugm.js","assets/toast-DKAdP2mo.js","assets/dialog-iocKA3jr.js","assets/use-presence-BSZEBx7U.js","assets/assert-Bwh6DJTK.js","assets/query-keys-ROf-g1Wi.js","assets/mutation-BIizFZav.js","assets/useMutation-DVmwOKU-.js","assets/dialog-actions-B1axpEg7.js","assets/entry-Dm3PpDCO.js","assets/brain-Cwed_72z.js","assets/chevron-right-BXIy5l3h.js","assets/circle-check-BU3v_mFW.js","assets/eye-C_hawfH4.js","assets/github-badge-BuAJr8oU.js","assets/state-DHKdg-pm.js","assets/key-round-UkavsGxp.js","assets/clipboard-button-DQmMikNQ.js","assets/check-D69FzdvC.js","assets/copy-ngmQ9zcZ.js","assets/use-clipboard-B0Sy03fE.js","assets/scaling-nWE4Cx8f.js","assets/wrench-B6E1oEuY.js","assets/card-BTdbRFFg.js","assets/download-dRFo5_Wu.js","assets/tokens-DDxMbSRL.js","assets/numbers-CFL4_Dqc.js","assets/stream-retry-5QnVuSSo.js","assets/entry-keNDZ_Wz.js","assets/arrow-right-Dl5yKnp8.js","assets/message-circle-CCxGwRvv.js","assets/shield-check-DVS0Foqh.js","assets/sparkles-BRaRUxAU.js","assets/use-reduced-motion-C4B0R6Sz.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function e(e){return e===`/share`||e.startsWith(`/share/`)?`share`:e===`/console`||e.startsWith(`/console/`)?`console`:`landing`}var t=`modulepreload`,n=function(e){return`/`+e},r={},i=function(e,i,a){let o=Promise.resolve();if(i&&i.length>0){let e=document.getElementsByTagName(`link`),s=document.querySelector(`meta[property=csp-nonce]`),c=s?.nonce||s?.getAttribute(`nonce`);function l(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function u(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}o=l(i.map(i=>{if(i=n(i,a),i=u(i),i in r)return;r[i]=!0;let o=i.endsWith(`.css`);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.href===i&&(!o||n.rel===`stylesheet`))return}let s=document.createElement(`link`);if(s.rel=o?`stylesheet`:t,o||(s.as=`script`),s.crossOrigin=``,s.href=i,c&&s.setAttribute(`nonce`,c),document.head.appendChild(s),o)return new Promise((e,t)=>{s.addEventListener(`load`,e),s.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${i}`)))})}))}function s(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return o.then(t=>{for(let e of t||[])e.status===`rejected`&&s(e.reason);return e().catch(s)})},a=document.getElementById(`root`);if(a===null)throw Error(`Dashboard root element is missing`);var o=e(window.location.pathname);o===`console`?i(async()=>{let{mountConsole:e}=await import(`./entry-6PSJYbzI.js`);return{mountConsole:e}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12])).then(({mountConsole:e})=>e(a)):o===`share`?i(()=>import(`./entry-Dm3PpDCO.js`).then(()=>void 0),__vite__mapDeps([13,1,2,3,14,15,16,5,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31])):i(async()=>{let{mountLanding:e}=await import(`./entry-keNDZ_Wz.js`);return{mountLanding:e}},__vite__mapDeps([32,1,2,3,4,33,18,34,35,36,37])).then(({mountLanding:e})=>e(a));export{i as t};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cartethyia",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "A powerful, self-hosted reverse proxy for OpenAI- and Anthropic-compatible AI clients, powered by native Bun and Elysia. It serves both protocols from a single server, routes every model across any configured provider, and translates requests and responses in real time — streaming and prompt caching included. Underneath it runs a full delivery engine: per-account health tracking, quota and cooldown enforcement, automatic failover across pools and providers, usage accounting, and telemetry. Point OpenCode, Cline, Claude Code, Codex, or any compatible client at Cartethyia and it keeps its native protocol while the gateway absorbs every provider-specific difference behind it. Runs on embedded SQLite or external PostgreSQL with optional Redis coordination, ships as a global CLI with a system-tray console, and needs only Bun 1.4+ alongside Node.js/npm.",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"@electric-sql/pglite": "^0.5.8",
|
|
77
77
|
"drizzle-orm": "0.45.2",
|
|
78
78
|
"elysia": "^2.0.0-beta.16",
|
|
79
|
+
"enquirer": "^2.4.1",
|
|
79
80
|
"exact-mirror": "^1.2.6",
|
|
80
81
|
"impit": "^0.14.5",
|
|
81
82
|
"ioredis": "6.0.0",
|
|
@@ -72,7 +72,18 @@ if (trayMode) {
|
|
|
72
72
|
fs.unlinkSync(startupSignalPath);
|
|
73
73
|
} catch {}
|
|
74
74
|
if (error) {
|
|
75
|
-
|
|
75
|
+
// `error.message` can be an empty string when the failure came from a
|
|
76
|
+
// signal rather than a thrown message, which printed as a bare
|
|
77
|
+
// "Cartethyia failed to start:" with no cause. Fall back to the code and
|
|
78
|
+
// name what usually causes it.
|
|
79
|
+
const detail =
|
|
80
|
+
error.message && error.message.trim() !== ""
|
|
81
|
+
? error.message
|
|
82
|
+
: `the process exited without a message (code ${child.exitCode ?? "unknown"})`;
|
|
83
|
+
console.error(`Cartethyia failed to start: ${detail}`);
|
|
84
|
+
console.error(
|
|
85
|
+
"If another Cartethyia is already running on this port, stop it with `cartethyia stop` first.",
|
|
86
|
+
);
|
|
76
87
|
process.exitCode = 1;
|
|
77
88
|
if (child.exitCode === null) child.kill();
|
|
78
89
|
return;
|