Socket
Socket
Sign inDemoInstall

@tanstack/router-core

Package Overview
Dependencies
Maintainers
2
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/router-core - npm Package Compare versions

Comparing version 0.0.1-beta.149 to 0.0.1-beta.150

6

build/cjs/router.js

@@ -401,2 +401,5 @@ /**

})();
Object.assign(match, {
...searchInfo
});
const contextInfo = (() => {

@@ -424,3 +427,2 @@ try {

Object.assign(match, {
...searchInfo,
...contextInfo

@@ -435,3 +437,3 @@ });

resolvedMatches.forEach(match => {
// Update each match with its latest url data
// Update each match with its latest route data
this.setRouteMatch(match.id, s => ({

@@ -438,0 +440,0 @@ ...s,

@@ -1060,2 +1060,5 @@ /**

})();
Object.assign(match, {
...searchInfo
});
const contextInfo = (() => {

@@ -1083,3 +1086,2 @@ try {

Object.assign(match, {
...searchInfo,
...contextInfo

@@ -1094,3 +1096,3 @@ });

resolvedMatches.forEach(match => {
// Update each match with its latest url data
// Update each match with its latest route data
this.setRouteMatch(match.id, s => ({

@@ -1097,0 +1099,0 @@ ...s,

@@ -14,7 +14,7 @@ {

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "0085-43"
"uid": "24a6-43"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "0085-45"
"uid": "24a6-45"
}

@@ -30,35 +30,35 @@ ]

{
"uid": "0085-47",
"uid": "24a6-47",
"name": "history.ts"
},
{
"uid": "0085-49",
"uid": "24a6-49",
"name": "utils.ts"
},
{
"uid": "0085-51",
"uid": "24a6-51",
"name": "path.ts"
},
{
"uid": "0085-53",
"uid": "24a6-53",
"name": "qss.ts"
},
{
"uid": "0085-55",
"uid": "24a6-55",
"name": "route.ts"
},
{
"uid": "0085-57",
"uid": "24a6-57",
"name": "fileRoute.ts"
},
{
"uid": "0085-61",
"uid": "24a6-61",
"name": "searchParams.ts"
},
{
"uid": "0085-63",
"uid": "24a6-63",
"name": "router.ts"
},
{
"uid": "0085-65",
"uid": "24a6-65",
"name": "index.ts"

@@ -70,3 +70,3 @@ }

"name": "store/build/esm/index.js",
"uid": "0085-59"
"uid": "24a6-59"
}

@@ -81,80 +81,80 @@ ]

"nodeParts": {
"0085-43": {
"24a6-43": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "0085-42"
"mainUid": "24a6-42"
},
"0085-45": {
"24a6-45": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "0085-44"
"mainUid": "24a6-44"
},
"0085-47": {
"24a6-47": {
"renderedLength": 6426,
"gzipLength": 1539,
"brotliLength": 0,
"mainUid": "0085-46"
"mainUid": "24a6-46"
},
"0085-49": {
"24a6-49": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "0085-48"
"mainUid": "24a6-48"
},
"0085-51": {
"24a6-51": {
"renderedLength": 6028,
"gzipLength": 1423,
"brotliLength": 0,
"mainUid": "0085-50"
"mainUid": "24a6-50"
},
"0085-53": {
"24a6-53": {
"renderedLength": 1371,
"gzipLength": 552,
"brotliLength": 0,
"mainUid": "0085-52"
"mainUid": "24a6-52"
},
"0085-55": {
"24a6-55": {
"renderedLength": 2292,
"gzipLength": 807,
"brotliLength": 0,
"mainUid": "0085-54"
"mainUid": "24a6-54"
},
"0085-57": {
"24a6-57": {
"renderedLength": 223,
"gzipLength": 143,
"brotliLength": 0,
"mainUid": "0085-56"
"mainUid": "24a6-56"
},
"0085-59": {
"24a6-59": {
"renderedLength": 1969,
"gzipLength": 653,
"brotliLength": 0,
"mainUid": "0085-58"
"mainUid": "24a6-58"
},
"0085-61": {
"24a6-61": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "0085-60"
"mainUid": "24a6-60"
},
"0085-63": {
"renderedLength": 38514,
"gzipLength": 8593,
"24a6-63": {
"renderedLength": 38562,
"gzipLength": 8597,
"brotliLength": 0,
"mainUid": "0085-62"
"mainUid": "24a6-62"
},
"0085-65": {
"24a6-65": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "0085-64"
"mainUid": "24a6-64"
}
},
"nodeMetas": {
"0085-42": {
"24a6-42": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "0085-43"
"index.production.js": "24a6-43"
},

@@ -164,16 +164,16 @@ "imported": [],

{
"uid": "0085-64"
"uid": "24a6-64"
},
{
"uid": "0085-54"
"uid": "24a6-54"
},
{
"uid": "0085-62"
"uid": "24a6-62"
}
]
},
"0085-44": {
"24a6-44": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "0085-45"
"index.production.js": "24a6-45"
},

@@ -183,10 +183,10 @@ "imported": [],

{
"uid": "0085-64"
"uid": "24a6-64"
}
]
},
"0085-46": {
"24a6-46": {
"id": "/packages/router-core/src/history.ts",
"moduleParts": {
"index.production.js": "0085-47"
"index.production.js": "24a6-47"
},

@@ -196,13 +196,13 @@ "imported": [],

{
"uid": "0085-64"
"uid": "24a6-64"
},
{
"uid": "0085-62"
"uid": "24a6-62"
}
]
},
"0085-48": {
"24a6-48": {
"id": "/packages/router-core/src/utils.ts",
"moduleParts": {
"index.production.js": "0085-49"
"index.production.js": "24a6-49"
},

@@ -212,20 +212,20 @@ "imported": [],

{
"uid": "0085-64"
"uid": "24a6-64"
},
{
"uid": "0085-50"
"uid": "24a6-50"
},
{
"uid": "0085-62"
"uid": "24a6-62"
}
]
},
"0085-50": {
"24a6-50": {
"id": "/packages/router-core/src/path.ts",
"moduleParts": {
"index.production.js": "0085-51"
"index.production.js": "24a6-51"
},
"imported": [
{
"uid": "0085-48"
"uid": "24a6-48"
}

@@ -235,16 +235,16 @@ ],

{
"uid": "0085-64"
"uid": "24a6-64"
},
{
"uid": "0085-54"
"uid": "24a6-54"
},
{
"uid": "0085-62"
"uid": "24a6-62"
}
]
},
"0085-52": {
"24a6-52": {
"id": "/packages/router-core/src/qss.ts",
"moduleParts": {
"index.production.js": "0085-53"
"index.production.js": "24a6-53"
},

@@ -254,20 +254,20 @@ "imported": [],

{
"uid": "0085-64"
"uid": "24a6-64"
},
{
"uid": "0085-60"
"uid": "24a6-60"
}
]
},
"0085-54": {
"24a6-54": {
"id": "/packages/router-core/src/route.ts",
"moduleParts": {
"index.production.js": "0085-55"
"index.production.js": "24a6-55"
},
"imported": [
{
"uid": "0085-42"
"uid": "24a6-42"
},
{
"uid": "0085-50"
"uid": "24a6-50"
}

@@ -277,17 +277,17 @@ ],

{
"uid": "0085-64"
"uid": "24a6-64"
},
{
"uid": "0085-56"
"uid": "24a6-56"
}
]
},
"0085-56": {
"24a6-56": {
"id": "/packages/router-core/src/fileRoute.ts",
"moduleParts": {
"index.production.js": "0085-57"
"index.production.js": "24a6-57"
},
"imported": [
{
"uid": "0085-54"
"uid": "24a6-54"
}

@@ -297,10 +297,10 @@ ],

{
"uid": "0085-64"
"uid": "24a6-64"
}
]
},
"0085-58": {
"24a6-58": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "0085-59"
"index.production.js": "24a6-59"
},

@@ -310,14 +310,14 @@ "imported": [],

{
"uid": "0085-68"
"uid": "24a6-68"
}
]
},
"0085-60": {
"24a6-60": {
"id": "/packages/router-core/src/searchParams.ts",
"moduleParts": {
"index.production.js": "0085-61"
"index.production.js": "24a6-61"
},
"imported": [
{
"uid": "0085-52"
"uid": "24a6-52"
}

@@ -327,32 +327,32 @@ ],

{
"uid": "0085-64"
"uid": "24a6-64"
},
{
"uid": "0085-62"
"uid": "24a6-62"
}
]
},
"0085-62": {
"24a6-62": {
"id": "/packages/router-core/src/router.ts",
"moduleParts": {
"index.production.js": "0085-63"
"index.production.js": "24a6-63"
},
"imported": [
{
"uid": "0085-68"
"uid": "24a6-68"
},
{
"uid": "0085-42"
"uid": "24a6-42"
},
{
"uid": "0085-50"
"uid": "24a6-50"
},
{
"uid": "0085-60"
"uid": "24a6-60"
},
{
"uid": "0085-48"
"uid": "24a6-48"
},
{
"uid": "0085-46"
"uid": "24a6-46"
}

@@ -362,47 +362,47 @@ ],

{
"uid": "0085-64"
"uid": "24a6-64"
}
]
},
"0085-64": {
"24a6-64": {
"id": "/packages/router-core/src/index.ts",
"moduleParts": {
"index.production.js": "0085-65"
"index.production.js": "24a6-65"
},
"imported": [
{
"uid": "0085-42"
"uid": "24a6-42"
},
{
"uid": "0085-44"
"uid": "24a6-44"
},
{
"uid": "0085-46"
"uid": "24a6-46"
},
{
"uid": "0085-66"
"uid": "24a6-66"
},
{
"uid": "0085-50"
"uid": "24a6-50"
},
{
"uid": "0085-52"
"uid": "24a6-52"
},
{
"uid": "0085-54"
"uid": "24a6-54"
},
{
"uid": "0085-56"
"uid": "24a6-56"
},
{
"uid": "0085-67"
"uid": "24a6-67"
},
{
"uid": "0085-62"
"uid": "24a6-62"
},
{
"uid": "0085-60"
"uid": "24a6-60"
},
{
"uid": "0085-48"
"uid": "24a6-48"
}

@@ -413,3 +413,3 @@ ],

},
"0085-66": {
"24a6-66": {
"id": "/packages/router-core/src/link.ts",

@@ -420,7 +420,7 @@ "moduleParts": {},

{
"uid": "0085-64"
"uid": "24a6-64"
}
]
},
"0085-67": {
"24a6-67": {
"id": "/packages/router-core/src/routeInfo.ts",

@@ -431,7 +431,7 @@ "moduleParts": {},

{
"uid": "0085-64"
"uid": "24a6-64"
}
]
},
"0085-68": {
"24a6-68": {
"id": "/packages/react-store/build/esm/index.js",

@@ -441,6 +441,6 @@ "moduleParts": {},

{
"uid": "0085-69"
"uid": "24a6-69"
},
{
"uid": "0085-58"
"uid": "24a6-58"
}

@@ -450,7 +450,7 @@ ],

{
"uid": "0085-62"
"uid": "24a6-62"
}
]
},
"0085-69": {
"24a6-69": {
"id": "use-sync-external-store/shim/with-selector",

@@ -461,3 +461,3 @@ "moduleParts": {},

{
"uid": "0085-68"
"uid": "24a6-68"
}

@@ -464,0 +464,0 @@ ],

@@ -22,3 +22,3 @@ /**

*/
class C{listeners=new Set;_batching=!1;_flushing=0;_nextPriority=null;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=(t,e)=>{const s=this.state;this.state=this.options?.updateFn?this.options.updateFn(s)(t):t(s);const a=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=a:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}}const T=H(JSON.parse),k=j(JSON.stringify);function H(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let s=D(e);for(let e in s){const a=s[e];if("string"==typeof a)try{s[e]=t(a)}catch(t){}}return s}}function j(t){return e=>{(e={...e})&&Object.keys(e).forEach((s=>{const a=e[s];if(void 0===a||void 0===a)delete e[s];else if(a&&"object"==typeof a&&null!==a)try{e[s]=t(a)}catch(t){}}));const s=L(e).toString();return s?`?${s}`:""}}const F=["component","errorComponent","pendingComponent"];const N="undefined"==typeof window||!window.document.createElement;function U(){return{status:"idle",isFetching:!1,resolvedLocation:null,location:null,matchesById:{},matchIds:[],pendingMatchIds:[],matches:[],pendingMatches:[],lastUpdated:Date.now()}}function J(t){return!!t?.isRedirect}class W extends Error{}class z extends Error{}t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new B(t);return e.isRoot=!1,e}},t.PathParamError=z,t.RootRoute=O,t.Route=B,t.Router=class{#t;constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??k,parseSearch:t?.parseSearch??T},this.__store=new C(U(),{onUpdate:()=>{const t=this.state;this.state=this.__store.state;const e=t.matchesById!==this.state.matchesById;let s,a;e||(s=t.matchIds.length!==this.state.matchIds.length||t.matchIds.some(((t,e)=>t!==this.state.matchIds[e])),a=t.pendingMatchIds.length!==this.state.pendingMatchIds.length||t.pendingMatchIds.some(((t,e)=>t!==this.state.pendingMatchIds[e]))),(e||s)&&(this.state.matches=this.state.matchIds.map((t=>this.state.matchesById[t]))),(e||a)&&(this.state.pendingMatches=this.state.pendingMatchIds.map((t=>this.state.matchesById[t]))),this.state.isFetching=[...this.state.matches,...this.state.pendingMatches].some((t=>t.isFetching))},defaultPriority:"low"}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.location.href!==e.href&&this.#e({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,U())))};mount=()=>{this.safeLoad()};update=t=>{if(this.options={...this.options,...t,context:{...this.options.context,...t?.context}},!this.history||this.options.history&&this.options.history!==this.history){this.#t&&this.#t(),this.history=this.options.history??(N?c():h());const t=this.#s();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#t=this.history.listen((()=>{this.safeLoad({next:this.#s(this.state.location)})}))}const{basepath:e,routeTree:s}=this.options;return this.basepath=`/${I(e??"")??""}`,s&&s!==this.routeTree&&this.#a(s),this};buildNext=t=>{const e=this.#r(t),s=this.matchRoutes(e.pathname,e.search);return this.#r({...t,__matches:s})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=t=>this.load(t).catch((t=>{}));latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(s,a)=>{let r;const o=()=>this.latestLoadPromise!==e?this.latestLoadPromise:void 0;let i;this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),i=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:t?.throwOnError,debug:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatchIds:i.map((t=>t.id)),matchesById:this.#o(t.matchesById,i)})))}));try{if(await this.loadMatches(i),r=o())return await r;const t=this.state.resolvedLocation;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matchIds:t.pendingMatchIds,pendingMatchIds:[]}))),t.href!==this.state.location.href&&this.options.onRouteChange?.(),s()}catch(t){if(r=o())return await r;a(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#o=(t,e)=>{const s={...t};let a=!1;return e.forEach((t=>{s[t.id]||(a=!0,s[t.id]=t)})),a?s:t};getRoute=t=>{const s=this.routesById[t];return e(s),s};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),s=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return this.__store.setState((t=>({...t,matchesById:this.#o(t.matchesById,s)}))),await this.loadMatches(s,{preload:!0,maxAge:t.maxAge}),s};cleanMatches=()=>{const t=Date.now(),e=Object.values(this.state.matchesById).filter((e=>{const s=this.getRoute(e.routeId);return!this.state.matchIds.includes(e.id)&&!this.state.pendingMatchIds.includes(e.id)&&e.preloadInvalidAt<t&&(!s.options.gcMaxAge||e.updatedAt+s.options.gcMaxAge<t)})).map((t=>t.id));e.length&&this.__store.setState((t=>{const s={...t.matchesById};return e.forEach((t=>{delete s[t]})),{...t,matchesById:s}}))};matchRoutes=(t,e,s)=>{let a={},r=this.flatRoutes.find((e=>{const s=P(this.basepath,b(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!s&&(a=s,!0)}))||this.routesById.__root__,o=[r];for(;r?.parentRoute;)r=r.parentRoute,r&&o.unshift(r);let i={};const n=o.map((t=>{let r,o;try{r=t.options.parseParams?.(a)??a}catch(t){if(o=new z(t.message,{cause:t}),s?.throwOnError)throw o}Object.assign(i,r);const n=E(t.path,i),h=t.options.key?t.options.key({params:i,search:e})??"":"",c=h?JSON.stringify(h):"",l=E(t.id,i,!0)+c,u=this.getRouteMatch(l);if(u)return{...u};const d=!(!t.options.loader&&!F.some((e=>t.options[e]?.preload)));return{id:l,key:c,routeId:t.id,params:i,pathname:w([this.basepath,n]),updatedAt:Date.now(),invalidAt:1/0,preloadInvalidAt:1/0,routeSearch:{},search:{},status:d?"idle":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:o,searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return n.forEach(((t,a)=>{const r=n[a-1],o=this.getRoute(t.routeId),i=(()=>{const a={search:r?.search??e,routeSearch:r?.routeSearch??e};try{const e=("object"==typeof o.options.validateSearch?o.options.validateSearch.parse:o.options.validateSearch)?.(a.search)??{},s={...a.search,...e};return{routeSearch:m(t.routeSearch,e),search:m(t.search,s)}}catch(e){if(t.searchError=new W(e.message,{cause:e}),s?.throwOnError)throw t.searchError;return a}})(),h=(()=>{try{const e=o.options.getContext?.({parentContext:r?.routeContext??{},context:r?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...r?.context??this?.options.context,...e},routeContext:e}}catch(t){throw o.options.onError?.(t),t}})();Object.assign(t,{...i,...h})})),n};loadMatches=async(t,e)=>{let s;this.cleanMatches(),e?.preload||t.forEach((t=>{this.setRouteMatch(t.id,(e=>({...e,routeSearch:t.routeSearch,search:t.search,routeContext:t.routeContext,context:t.context,error:t.error,paramsError:t.paramsError,searchError:t.searchError,params:t.params})))}));try{for(const[a,r]of t.entries()){const t=this.getRoute(r.routeId),o=(e,o)=>{if(s=s??a,o=o||t.options.onError,J(e))throw e;try{o?.(e)}catch(t){if(e=t,J(t))throw t}this.setRouteMatch(r.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};r.paramsError&&o(r.paramsError,t.options.onParseParamsError),r.searchError&&o(r.searchError,t.options.onValidateSearchError);let i=!1;try{await(t.options.beforeLoad?.({...r,preload:!!e?.preload}))}catch(e){o(e,t.options.onBeforeLoadError),i=!0}if(i)break}}catch(t){throw e?.preload||this.navigate(t),t}const a=t.slice(0,s),r=[];a.forEach(((t,s)=>{r.push((async()=>{const a=r[s-1],o=this.getRoute(t.routeId);if(t.isFetching||"success"===t.status&&!this.getIsInvalid({matchId:t.id,preload:e?.preload}))return this.getRouteMatch(t.id)?.loadPromise;const i=Date.now(),n=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==i?e.loadPromise:void 0},h=(async()=>{let s;const r=Promise.all(F.map((async t=>{const e=o.options[t];e?.preload&&await e.preload()}))),i=o.options.loader?.({...t,preload:!!e?.preload,parentMatchPromise:a}),h=t=>!!J(t)&&(e?.preload||this.navigate(t),!0);try{const[a,o]=await Promise.all([r,i]);if(s=n())return await s;this.setRouteMatchData(t.id,(()=>o),e)}catch(e){if(s=n())return await s;if(h(e))return;const a=o.options.onLoadError??o.options.onError;let r=e;try{a?.(e)}catch(t){if(r=t,h(t))return}this.setRouteMatch(t.id,(t=>({...t,error:r,status:"error",isFetching:!1,updatedAt:Date.now()})))}})();this.setRouteMatch(t.id,(t=>({...t,status:"success"!==t.status?"pending":t.status,isFetching:!0,loadPromise:h,fetchedAt:i,invalid:!1}))),await h})())})),await Promise.all(r)};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>S(this.basepath,t,_(e));navigate=async({from:t,to:s="",search:a,hash:r,replace:o,params:i})=>{const n=String(s),h=void 0===t?t:String(t);let c;try{new URL(`${n}`),c=!0}catch(t){}return e(!c),this.#e({from:h,to:n,search:a,hash:r,replace:o,params:i})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const s=this.buildNext(t);if(e?.pending&&"pending"!==this.state.status)return!1;const a=e?.pending?this.state.location:this.state.resolvedLocation;if(!a)return!1;const r=P(this.basepath,a.pathname,{...e,to:s.pathname});return!!r&&(e?.includeSearch??1?!!v(a.search,s.search)&&r:r)};buildLink=({from:t,to:e=".",search:s,params:a,hash:r,target:o,replace:i,activeOptions:n,preload:h,preloadDelay:c,disabled:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u={from:t,to:e,search:s,params:a,hash:r,replace:i},d=this.buildNext(u);h=h??this.options.defaultPreload;const p=c??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=n?.exact?this.state.location.pathname===d.pathname:m,g=!n?.includeHash||this.state.location.hash===d.hash,w=!(n?.includeSearch??1)||v(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{h&&this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{l||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||o&&"_self"!==o||0!==t.button||(t.preventDefault(),this.#e(u))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),p)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:y&&g&&w,disabled:l}};dehydrate=()=>({state:f(this.state,["location","status","lastUpdated"])});hydrate=async t=>{let s=t;"undefined"!=typeof document&&(s=window.__TSR_DEHYDRATED__),e(s);const a=s;this.dehydratedData=a.payload,this.options.hydrate?.(a.payload),this.__store.setState((t=>({...t,...a.router.state,resolvedLocation:a.router.state.location}))),await this.load()};injectedHtml=[];injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const s="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${s}`,a="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${r=s,r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(a)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var r})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#a=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const s=t=>{t.forEach(((t,a)=>{t.init({originalIndex:a,router:this});if(e(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=b(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const r=t.children;r?.length&&s(r)}))};s([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const s=I(t.fullPath),a=x(s);for(;a.length>1&&"/"===a[0]?.value;)a.shift();const r=a.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:s,parsed:a,index:e,score:r}})).sort(((t,e)=>{let s="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==s)return s;const a=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let s=0;s<a;s++)if(t.score[s]!==e.score[s])return e.score[s]-t.score[s];for(let s=0;s<a;s++)if(t.parsed[s].value!==e.parsed[s].value)return t.parsed[s].value>e.parsed[s].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};#s=t=>{let{pathname:e,search:s,hash:a,state:r}=this.history.location;const o=this.options.parseSearch(s);return{pathname:e,searchStr:s,search:m(t?.search,o),hash:a.split("#").reverse()[0]??"",href:`${e}${s}${a}`,state:r,key:r?.key||"__init__"}};#r=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let s=S(this.basepath??"/",e,`${t.to??""}`);const a={...d(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let r=!0===(t.params??!0)?a:p(t.params,a);r&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{r={...r,...t(r)}})),s=E(s,r??{});const o=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],i=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],n=o?.length?o?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,h=!0===t.search?n:t.search?p(t.search,n)??{}:o?.length?n:{},c=i?.length?i.reduce(((t,e)=>e(t)),h):h,l=m(this.state.location.search,c),u=this.options.stringifySearch(l),f=!0===t.hash?this.state.location.hash:p(t.hash,this.state.location.hash),y=f?`#${f}`:"";return{pathname:s,search:l,searchStr:u,state:!0===t.state?this.state.location.state:p(t.state,this.state.location.state),hash:f,href:this.history.createHref(`${s}${u}${y}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),s=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let a="replace";t.replace||(a="push");this.state.location.href===e.href&&!e.key&&(a="replace");const r=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===a?"push":"replace"](r,{id:s,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((s=>({...s,matchesById:{...s.matchesById,[t]:e(s.matchesById[t])}})))};setRouteMatchData=(t,e,s)=>{const a=this.getRouteMatch(t);if(!a)return;const r=this.getRoute(a.routeId),o=s?.updatedAt??Date.now(),i=o+(s?.maxAge??r.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),n=o+(s?.maxAge??r.options.maxAge??this.options.defaultMaxAge??1/0);this.setRouteMatch(t,(t=>({...t,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:p(e,t.loaderData),preloadInvalidAt:i,invalidAt:n}))),this.state.matches.find((e=>e.id===t))};invalidate=async t=>{if(t?.matchId){this.setRouteMatch(t.matchId,(t=>({...t,invalid:!0})));const e=this.state.matches.findIndex((e=>e.id===t.matchId)),s=this.state.matches[e+1];if(s)return this.invalidate({matchId:s.id,reload:!1})}else this.__store.batch((()=>{Object.values(this.state.matchesById).forEach((t=>{this.setRouteMatch(t.id,(t=>({...t,invalid:!0})))}))}));if(t?.reload??1)return this.reload()};getIsInvalid=t=>{if(!t?.matchId)return!!this.state.matches.find((e=>this.getIsInvalid({matchId:e.id,preload:t?.preload})));const e=this.getRouteMatch(t?.matchId);if(!e)return!1;const s=Date.now();return e.invalid||(t?.preload?e.preloadInvalidAt:e.invalidAt)<s}},t.RouterContext=class{constructor(){}createRootRoute=t=>new O(t)},t.SearchParamError=W,t.cleanPath=_,t.componentTypes=F,t.createBrowserHistory=h,t.createHashHistory=function(){return h({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=c,t.decode=D,t.defaultParseSearch=T,t.defaultStringifySearch=k,t.encode=L,t.functionalUpdate=p,t.interpolatePath=E,t.invariant=e,t.isPlainObject=y,t.isRedirect=J,t.joinPaths=w,t.last=d,t.lazyFn=function(t,e){return async(...s)=>(await t())[e||"default"](...s)},t.matchByPath=M,t.matchPathname=P,t.parsePathname=x,t.parseSearchWith=H,t.partialDeepEqual=v,t.pick=f,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=m,t.resolvePath=S,t.rootRouteId=$,t.stringifySearchWith=j,t.trimPath=I,t.trimPathLeft=R,t.trimPathRight=b,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
class C{listeners=new Set;_batching=!1;_flushing=0;_nextPriority=null;constructor(t,e){this.state=t,this.options=e}subscribe=t=>{this.listeners.add(t);const e=this.options?.onSubscribe?.(t,this);return()=>{this.listeners.delete(t),e?.()}};setState=(t,e)=>{const s=this.state;this.state=this.options?.updateFn?this.options.updateFn(s)(t):t(s);const a=e?.priority??this.options?.defaultPriority??"high";null===this._nextPriority||"high"===this._nextPriority?this._nextPriority=a:this._nextPriority=this.options?.defaultPriority??"high",this.options?.onUpdate?.({priority:this._nextPriority}),this._flush()};_flush=()=>{if(this._batching)return;const t=++this._flushing;this.listeners.forEach((e=>{this._flushing===t&&e({priority:this._nextPriority??"high"})}))};batch=t=>{if(this._batching)return t();this._batching=!0,t(),this._batching=!1,this._flush()}}const T=H(JSON.parse),k=j(JSON.stringify);function H(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let s=D(e);for(let e in s){const a=s[e];if("string"==typeof a)try{s[e]=t(a)}catch(t){}}return s}}function j(t){return e=>{(e={...e})&&Object.keys(e).forEach((s=>{const a=e[s];if(void 0===a||void 0===a)delete e[s];else if(a&&"object"==typeof a&&null!==a)try{e[s]=t(a)}catch(t){}}));const s=L(e).toString();return s?`?${s}`:""}}const F=["component","errorComponent","pendingComponent"];const N="undefined"==typeof window||!window.document.createElement;function U(){return{status:"idle",isFetching:!1,resolvedLocation:null,location:null,matchesById:{},matchIds:[],pendingMatchIds:[],matches:[],pendingMatches:[],lastUpdated:Date.now()}}function J(t){return!!t?.isRedirect}class W extends Error{}class z extends Error{}t.FileRoute=class{constructor(t){this.path=t}createRoute=t=>{const e=new B(t);return e.isRoot=!1,e}},t.PathParamError=z,t.RootRoute=O,t.Route=B,t.Router=class{#t;constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??k,parseSearch:t?.parseSearch??T},this.__store=new C(U(),{onUpdate:()=>{const t=this.state;this.state=this.__store.state;const e=t.matchesById!==this.state.matchesById;let s,a;e||(s=t.matchIds.length!==this.state.matchIds.length||t.matchIds.some(((t,e)=>t!==this.state.matchIds[e])),a=t.pendingMatchIds.length!==this.state.pendingMatchIds.length||t.pendingMatchIds.some(((t,e)=>t!==this.state.pendingMatchIds[e]))),(e||s)&&(this.state.matches=this.state.matchIds.map((t=>this.state.matchesById[t]))),(e||a)&&(this.state.pendingMatches=this.state.pendingMatchIds.map((t=>this.state.matchesById[t]))),this.state.isFetching=[...this.state.matches,...this.state.pendingMatches].some((t=>t.isFetching))},defaultPriority:"low"}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.location.href!==e.href&&this.#e({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,U())))};mount=()=>{this.safeLoad()};update=t=>{if(this.options={...this.options,...t,context:{...this.options.context,...t?.context}},!this.history||this.options.history&&this.options.history!==this.history){this.#t&&this.#t(),this.history=this.options.history??(N?c():h());const t=this.#s();this.__store.setState((e=>({...e,resolvedLocation:t,location:t}))),this.#t=this.history.listen((()=>{this.safeLoad({next:this.#s(this.state.location)})}))}const{basepath:e,routeTree:s}=this.options;return this.basepath=`/${I(e??"")??""}`,s&&s!==this.routeTree&&this.#a(s),this};buildNext=t=>{const e=this.#r(t),s=this.matchRoutes(e.pathname,e.search);return this.#r({...t,__matches:s})};cancelMatches=()=>{this.state.matches.forEach((t=>{this.cancelMatch(t.id)}))};cancelMatch=t=>{this.getRouteMatch(t)?.abortController?.abort()};safeLoad=t=>this.load(t).catch((t=>{}));latestLoadPromise=Promise.resolve();load=async t=>{const e=new Promise((async(s,a)=>{let r;const o=()=>this.latestLoadPromise!==e?this.latestLoadPromise:void 0;let i;this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,location:t.next}))),i=this.matchRoutes(this.state.location.pathname,this.state.location.search,{throwOnError:t?.throwOnError,debug:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatchIds:i.map((t=>t.id)),matchesById:this.#o(t.matchesById,i)})))}));try{if(await this.loadMatches(i),r=o())return await r;const t=this.state.resolvedLocation;this.__store.setState((t=>({...t,status:"idle",resolvedLocation:t.location,matchIds:t.pendingMatchIds,pendingMatchIds:[]}))),t.href!==this.state.location.href&&this.options.onRouteChange?.(),s()}catch(t){if(r=o())return await r;a(t)}}));return this.latestLoadPromise=e,this.latestLoadPromise};#o=(t,e)=>{const s={...t};let a=!1;return e.forEach((t=>{s[t.id]||(a=!0,s[t.id]=t)})),a?s:t};getRoute=t=>{const s=this.routesById[t];return e(s),s};preloadRoute=async(t=this.state.location)=>{const e=this.buildNext(t),s=this.matchRoutes(e.pathname,e.search,{throwOnError:!0});return this.__store.setState((t=>({...t,matchesById:this.#o(t.matchesById,s)}))),await this.loadMatches(s,{preload:!0,maxAge:t.maxAge}),s};cleanMatches=()=>{const t=Date.now(),e=Object.values(this.state.matchesById).filter((e=>{const s=this.getRoute(e.routeId);return!this.state.matchIds.includes(e.id)&&!this.state.pendingMatchIds.includes(e.id)&&e.preloadInvalidAt<t&&(!s.options.gcMaxAge||e.updatedAt+s.options.gcMaxAge<t)})).map((t=>t.id));e.length&&this.__store.setState((t=>{const s={...t.matchesById};return e.forEach((t=>{delete s[t]})),{...t,matchesById:s}}))};matchRoutes=(t,e,s)=>{let a={},r=this.flatRoutes.find((e=>{const s=P(this.basepath,b(t),{to:e.fullPath,caseSensitive:e.options.caseSensitive??this.options.caseSensitive});return!!s&&(a=s,!0)}))||this.routesById.__root__,o=[r];for(;r?.parentRoute;)r=r.parentRoute,r&&o.unshift(r);let i={};const n=o.map((t=>{let r,o;try{r=t.options.parseParams?.(a)??a}catch(t){if(o=new z(t.message,{cause:t}),s?.throwOnError)throw o}Object.assign(i,r);const n=E(t.path,i),h=t.options.key?t.options.key({params:i,search:e})??"":"",c=h?JSON.stringify(h):"",l=E(t.id,i,!0)+c,u=this.getRouteMatch(l);if(u)return{...u};const d=!(!t.options.loader&&!F.some((e=>t.options[e]?.preload)));return{id:l,key:c,routeId:t.id,params:i,pathname:w([this.basepath,n]),updatedAt:Date.now(),invalidAt:1/0,preloadInvalidAt:1/0,routeSearch:{},search:{},status:d?"idle":"success",isFetching:!1,invalid:!1,error:void 0,paramsError:o,searchError:void 0,loaderData:void 0,loadPromise:Promise.resolve(),routeContext:void 0,context:void 0,abortController:new AbortController,fetchedAt:0}}));return n.forEach(((t,a)=>{const r=n[a-1],o=this.getRoute(t.routeId),i=(()=>{const a={search:r?.search??e,routeSearch:r?.routeSearch??e};try{const e=("object"==typeof o.options.validateSearch?o.options.validateSearch.parse:o.options.validateSearch)?.(a.search)??{},s={...a.search,...e};return{routeSearch:m(t.routeSearch,e),search:m(t.search,s)}}catch(e){if(t.searchError=new W(e.message,{cause:e}),s?.throwOnError)throw t.searchError;return a}})();Object.assign(t,{...i});const h=(()=>{try{const e=o.options.getContext?.({parentContext:r?.routeContext??{},context:r?.context??this?.options.context??{},params:t.params,search:t.search})||{};return{context:{...r?.context??this?.options.context,...e},routeContext:e}}catch(t){throw o.options.onError?.(t),t}})();Object.assign(t,{...h})})),n};loadMatches=async(t,e)=>{let s;this.cleanMatches(),e?.preload||t.forEach((t=>{this.setRouteMatch(t.id,(e=>({...e,routeSearch:t.routeSearch,search:t.search,routeContext:t.routeContext,context:t.context,error:t.error,paramsError:t.paramsError,searchError:t.searchError,params:t.params})))}));try{for(const[a,r]of t.entries()){const t=this.getRoute(r.routeId),o=(e,o)=>{if(s=s??a,o=o||t.options.onError,J(e))throw e;try{o?.(e)}catch(t){if(e=t,J(t))throw t}this.setRouteMatch(r.id,(t=>({...t,error:e,status:"error",updatedAt:Date.now()})))};r.paramsError&&o(r.paramsError,t.options.onParseParamsError),r.searchError&&o(r.searchError,t.options.onValidateSearchError);let i=!1;try{await(t.options.beforeLoad?.({...r,preload:!!e?.preload}))}catch(e){o(e,t.options.onBeforeLoadError),i=!0}if(i)break}}catch(t){throw e?.preload||this.navigate(t),t}const a=t.slice(0,s),r=[];a.forEach(((t,s)=>{r.push((async()=>{const a=r[s-1],o=this.getRoute(t.routeId);if(t.isFetching||"success"===t.status&&!this.getIsInvalid({matchId:t.id,preload:e?.preload}))return this.getRouteMatch(t.id)?.loadPromise;const i=Date.now(),n=()=>{const e=this.getRouteMatch(t.id);return e&&e.fetchedAt!==i?e.loadPromise:void 0},h=(async()=>{let s;const r=Promise.all(F.map((async t=>{const e=o.options[t];e?.preload&&await e.preload()}))),i=o.options.loader?.({...t,preload:!!e?.preload,parentMatchPromise:a}),h=t=>!!J(t)&&(e?.preload||this.navigate(t),!0);try{const[a,o]=await Promise.all([r,i]);if(s=n())return await s;this.setRouteMatchData(t.id,(()=>o),e)}catch(e){if(s=n())return await s;if(h(e))return;const a=o.options.onLoadError??o.options.onError;let r=e;try{a?.(e)}catch(t){if(r=t,h(t))return}this.setRouteMatch(t.id,(t=>({...t,error:r,status:"error",isFetching:!1,updatedAt:Date.now()})))}})();this.setRouteMatch(t.id,(t=>({...t,status:"success"!==t.status?"pending":t.status,isFetching:!0,loadPromise:h,fetchedAt:i,invalid:!1}))),await h})())})),await Promise.all(r)};reload=()=>this.navigate({fromCurrent:!0,replace:!0,search:!0});resolvePath=(t,e)=>S(this.basepath,t,_(e));navigate=async({from:t,to:s="",search:a,hash:r,replace:o,params:i})=>{const n=String(s),h=void 0===t?t:String(t);let c;try{new URL(`${n}`),c=!0}catch(t){}return e(!c),this.#e({from:h,to:n,search:a,hash:r,replace:o,params:i})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const s=this.buildNext(t);if(e?.pending&&"pending"!==this.state.status)return!1;const a=e?.pending?this.state.location:this.state.resolvedLocation;if(!a)return!1;const r=P(this.basepath,a.pathname,{...e,to:s.pathname});return!!r&&(e?.includeSearch??1?!!v(a.search,s.search)&&r:r)};buildLink=({from:t,to:e=".",search:s,params:a,hash:r,target:o,replace:i,activeOptions:n,preload:h,preloadDelay:c,disabled:l})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const u={from:t,to:e,search:s,params:a,hash:r,replace:i},d=this.buildNext(u);h=h??this.options.defaultPreload;const p=c??this.options.defaultPreloadDelay??0,f=this.state.location.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),y=n?.exact?this.state.location.pathname===d.pathname:m,g=!n?.includeHash||this.state.location.hash===d.hash,w=!(n?.includeSearch??1)||v(this.state.location.search,d.search);return{type:"internal",next:d,handleFocus:t=>{h&&this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{l||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||o&&"_self"!==o||0!==t.button||(t.preventDefault(),this.#e(u))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),p)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(u).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:y&&g&&w,disabled:l}};dehydrate=()=>({state:f(this.state,["location","status","lastUpdated"])});hydrate=async t=>{let s=t;"undefined"!=typeof document&&(s=window.__TSR_DEHYDRATED__),e(s);const a=s;this.dehydratedData=a.payload,this.options.hydrate?.(a.payload),this.__store.setState((t=>({...t,...a.router.state,resolvedLocation:a.router.state.location}))),await this.load()};injectedHtml=[];injectHtml=async t=>{this.injectedHtml.push(t)};dehydrateData=(t,e)=>{if("undefined"==typeof document){const s="string"==typeof t?t:JSON.stringify(t);return this.injectHtml((async()=>{const t=`__TSR_DEHYDRATED__${s}`,a="function"==typeof e?await e():e;return`<script id='${t}' suppressHydrationWarning>window["__TSR_DEHYDRATED__${r=s,r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"')}"] = ${JSON.stringify(a)}\n ;(() => {\n var el = document.getElementById('${t}')\n el.parentElement.removeChild(el)\n })()\n <\/script>`;var r})),()=>this.hydrateData(t)}return()=>{}};hydrateData=t=>{if("undefined"!=typeof document){const e="string"==typeof t?t:JSON.stringify(t);return window[`__TSR_DEHYDRATED__${e}`]}};#a=t=>{this.routeTree=t,this.routesById={},this.routesByPath={},this.flatRoutes=[];const s=t=>{t.forEach(((t,a)=>{t.init({originalIndex:a,router:this});if(e(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t,!t.isRoot&&t.path){const e=b(t.fullPath);this.routesByPath[e]&&!t.fullPath.endsWith("/")||(this.routesByPath[e]=t)}const r=t.children;r?.length&&s(r)}))};s([t]),this.flatRoutes=Object.values(this.routesByPath).map(((t,e)=>{const s=I(t.fullPath),a=x(s);for(;a.length>1&&"/"===a[0]?.value;)a.shift();const r=a.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,trimmed:s,parsed:a,index:e,score:r}})).sort(((t,e)=>{let s="/"===t.trimmed?1:"/"===e.trimmed?-1:0;if(0!==s)return s;const a=Math.min(t.score.length,e.score.length);if(t.score.length!==e.score.length)return e.score.length-t.score.length;for(let s=0;s<a;s++)if(t.score[s]!==e.score[s])return e.score[s]-t.score[s];for(let s=0;s<a;s++)if(t.parsed[s].value!==e.parsed[s].value)return t.parsed[s].value>e.parsed[s].value?1:-1;return t.trimmed!==e.trimmed?t.trimmed>e.trimmed?1:-1:t.index-e.index})).map(((t,e)=>(t.child.rank=e,t.child)))};#s=t=>{let{pathname:e,search:s,hash:a,state:r}=this.history.location;const o=this.options.parseSearch(s);return{pathname:e,searchStr:s,search:m(t?.search,o),hash:a.split("#").reverse()[0]??"",href:`${e}${s}${a}`,state:r,key:r?.key||"__init__"}};#r=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.location.pathname:t.from??this.state.location.pathname;let s=S(this.basepath??"/",e,`${t.to??""}`);const a={...d(this.matchRoutes(this.state.location.pathname,this.state.location.search))?.params};let r=!0===(t.params??!0)?a:p(t.params,a);r&&t.__matches?.map((t=>this.getRoute(t.routeId).options.stringifyParams)).filter(Boolean).forEach((t=>{r={...r,...t(r)}})),s=E(s,r??{});const o=t.__matches?.map((t=>this.getRoute(t.routeId).options.preSearchFilters??[])).flat().filter(Boolean)??[],i=t.__matches?.map((t=>this.getRoute(t.routeId).options.postSearchFilters??[])).flat().filter(Boolean)??[],n=o?.length?o?.reduce(((t,e)=>e(t)),this.state.location.search):this.state.location.search,h=!0===t.search?n:t.search?p(t.search,n)??{}:o?.length?n:{},c=i?.length?i.reduce(((t,e)=>e(t)),h):h,l=m(this.state.location.search,c),u=this.options.stringifySearch(l),f=!0===t.hash?this.state.location.hash:p(t.hash,this.state.location.hash),y=f?`#${f}`:"";return{pathname:s,search:l,searchStr:u,state:!0===t.state?this.state.location.state:p(t.state,this.state.location.state),hash:f,href:this.history.createHref(`${s}${u}${y}`),key:t.key}};#e=async t=>{const e=this.buildNext(t),s=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let a="replace";t.replace||(a="push");this.state.location.href===e.href&&!e.key&&(a="replace");const r=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===a?"push":"replace"](r,{id:s,...e.state}),this.latestLoadPromise};getRouteMatch=t=>this.state.matchesById[t];setRouteMatch=(t,e)=>{this.__store.setState((s=>({...s,matchesById:{...s.matchesById,[t]:e(s.matchesById[t])}})))};setRouteMatchData=(t,e,s)=>{const a=this.getRouteMatch(t);if(!a)return;const r=this.getRoute(a.routeId),o=s?.updatedAt??Date.now(),i=o+(s?.maxAge??r.options.preloadMaxAge??this.options.defaultPreloadMaxAge??5e3),n=o+(s?.maxAge??r.options.maxAge??this.options.defaultMaxAge??1/0);this.setRouteMatch(t,(t=>({...t,error:void 0,status:"success",isFetching:!1,updatedAt:Date.now(),loaderData:p(e,t.loaderData),preloadInvalidAt:i,invalidAt:n}))),this.state.matches.find((e=>e.id===t))};invalidate=async t=>{if(t?.matchId){this.setRouteMatch(t.matchId,(t=>({...t,invalid:!0})));const e=this.state.matches.findIndex((e=>e.id===t.matchId)),s=this.state.matches[e+1];if(s)return this.invalidate({matchId:s.id,reload:!1})}else this.__store.batch((()=>{Object.values(this.state.matchesById).forEach((t=>{this.setRouteMatch(t.id,(t=>({...t,invalid:!0})))}))}));if(t?.reload??1)return this.reload()};getIsInvalid=t=>{if(!t?.matchId)return!!this.state.matches.find((e=>this.getIsInvalid({matchId:e.id,preload:t?.preload})));const e=this.getRouteMatch(t?.matchId);if(!e)return!1;const s=Date.now();return e.invalid||(t?.preload?e.preloadInvalidAt:e.invalidAt)<s}},t.RouterContext=class{constructor(){}createRootRoute=t=>new O(t)},t.SearchParamError=W,t.cleanPath=_,t.componentTypes=F,t.createBrowserHistory=h,t.createHashHistory=function(){return h({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=c,t.decode=D,t.defaultParseSearch=T,t.defaultStringifySearch=k,t.encode=L,t.functionalUpdate=p,t.interpolatePath=E,t.invariant=e,t.isPlainObject=y,t.isRedirect=J,t.joinPaths=w,t.last=d,t.lazyFn=function(t,e){return async(...s)=>(await t())[e||"default"](...s)},t.matchByPath=M,t.matchPathname=P,t.parsePathname=x,t.parseSearchWith=H,t.partialDeepEqual=v,t.pick=f,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=m,t.resolvePath=S,t.rootRouteId=$,t.stringifySearchWith=j,t.trimPath=I,t.trimPathLeft=R,t.trimPathRight=b,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/router-core",
"author": "Tanner Linsley",
"version": "0.0.1-beta.149",
"version": "0.0.1-beta.150",
"license": "MIT",

@@ -46,3 +46,3 @@ "repository": "tanstack/router",

"@gisatcz/cross-package-react-context": "^0.2.0",
"@tanstack/react-store": "0.0.1-beta.149"
"@tanstack/react-store": "0.0.1-beta.150"
},

@@ -49,0 +49,0 @@ "scripts": {

@@ -794,2 +794,6 @@ import { Store } from '@tanstack/react-store'

Object.assign(match, {
...searchInfo,
})
const contextInfo = (() => {

@@ -821,3 +825,2 @@ try {

Object.assign(match, {
...searchInfo,
...contextInfo,

@@ -841,3 +844,3 @@ })

resolvedMatches.forEach((match) => {
// Update each match with its latest url data
// Update each match with its latest route data
this.setRouteMatch(match.id, (s) => ({

@@ -844,0 +847,0 @@ ...s,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc