Socket
Socket
Sign inDemoInstall

@tanstack/router

Package Overview
Dependencies
Maintainers
1
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/router - npm Package Compare versions

Comparing version 0.0.1-beta.74 to 0.0.1-beta.75

16

build/cjs/routeMatch.js

@@ -30,3 +30,3 @@ /**

params: opts.params,
store: new store.Store({
__store: new store.Store({
updatedAt: 0,

@@ -42,3 +42,3 @@ routeSearch: {},

});
this.state = this.store.state;
this.state = this.__store.state;
componentTypes.map(async type => {

@@ -51,3 +51,3 @@ const component = this.route.options[type];

if (this.state.status === 'idle' && !this.#hasLoaders()) {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -72,3 +72,3 @@ status: 'success'

this.routeContext = routeContext;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -144,3 +144,3 @@ routeSearch: utils.replaceEqualDeep(s.routeSearch, routeSearch),

this.route.options.onError?.(err);
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -179,3 +179,3 @@ status: 'error',

if (this.state.status === 'idle') {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -213,3 +213,3 @@ status: 'pending'

if (latestPromise = checkLatest()) return await latestPromise;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -227,3 +227,3 @@ error: undefined,

this.route.options.onError?.(err);
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -230,0 +230,0 @@ error: err,

@@ -62,3 +62,3 @@ /**

};
this.store = new store.Store(getInitialRouterState(), {
this.__store = new store.Store(getInitialRouterState(), {
onUpdate: state => {

@@ -68,3 +68,3 @@ this.state = state;

});
this.state = this.store.state;
this.state = this.__store.state;
this.basepath = '';

@@ -89,3 +89,3 @@ this.update(options);

reset = () => {
this.store.setState(s => Object.assign(s, getInitialRouterState()));
this.__store.setState(s => Object.assign(s, getInitialRouterState()));
};

@@ -110,3 +110,3 @@ mount = () => {

const parsedLocation = this.#parseLocation();
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -160,6 +160,6 @@ latestLocation: parsedLocation,

let matches;
this.store.batch(() => {
this.__store.batch(() => {
if (opts?.next) {
// Ingest the new location
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -174,3 +174,3 @@ latestLocation: opts.next

});
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -214,3 +214,3 @@ status: 'pending',

if (d.state.status === 'error') {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -235,3 +235,3 @@ status: 'idle',

const prevLocation = this.state.currentLocation;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -557,3 +557,3 @@ status: 'idle',

hydrate = dehydratedRouter => {
this.store.setState(s => {
this.__store.setState(s => {
// Match the routes

@@ -566,3 +566,3 @@ const currentMatches = this.matchRoutes(dehydratedRouter.state.latestLocation.pathname, {

invariant__default["default"](dehydratedMatch && dehydratedMatch.id === match.id, 'Oh no! There was a hydration mismatch when attempting to hydrate the state of the router! 😬');
match.store.setState(s => ({
match.__store.setState(s => ({
...s,

@@ -569,0 +569,0 @@ ...dehydratedMatch.state

@@ -662,3 +662,3 @@ /**

};
this.store = new Store(getInitialRouterState(), {
this.__store = new Store(getInitialRouterState(), {
onUpdate: state => {

@@ -668,3 +668,3 @@ this.state = state;

});
this.state = this.store.state;
this.state = this.__store.state;
this.basepath = '';

@@ -689,3 +689,3 @@ this.update(options);

reset = () => {
this.store.setState(s => Object.assign(s, getInitialRouterState()));
this.__store.setState(s => Object.assign(s, getInitialRouterState()));
};

@@ -710,3 +710,3 @@ mount = () => {

const parsedLocation = this.#parseLocation();
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -760,6 +760,6 @@ latestLocation: parsedLocation,

let matches;
this.store.batch(() => {
this.__store.batch(() => {
if (opts?.next) {
// Ingest the new location
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -774,3 +774,3 @@ latestLocation: opts.next

});
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -814,3 +814,3 @@ status: 'pending',

if (d.state.status === 'error') {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -835,3 +835,3 @@ status: 'idle',

const prevLocation = this.state.currentLocation;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1157,3 +1157,3 @@ status: 'idle',

hydrate = dehydratedRouter => {
this.store.setState(s => {
this.__store.setState(s => {
// Match the routes

@@ -1166,3 +1166,3 @@ const currentMatches = this.matchRoutes(dehydratedRouter.state.latestLocation.pathname, {

invariant(dehydratedMatch && dehydratedMatch.id === match.id, 'Oh no! There was a hydration mismatch when attempting to hydrate the state of the router! 😬');
match.store.setState(s => ({
match.__store.setState(s => ({
...s,

@@ -1361,3 +1361,3 @@ ...dehydratedMatch.state

params: opts.params,
store: new Store({
__store: new Store({
updatedAt: 0,

@@ -1373,3 +1373,3 @@ routeSearch: {},

});
this.state = this.store.state;
this.state = this.__store.state;
componentTypes.map(async type => {

@@ -1382,3 +1382,3 @@ const component = this.route.options[type];

if (this.state.status === 'idle' && !this.#hasLoaders()) {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1403,3 +1403,3 @@ status: 'success'

this.routeContext = routeContext;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1475,3 +1475,3 @@ routeSearch: replaceEqualDeep(s.routeSearch, routeSearch),

this.route.options.onError?.(err);
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1510,3 +1510,3 @@ status: 'error',

if (this.state.status === 'idle') {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1544,3 +1544,3 @@ status: 'pending'

if (latestPromise = checkLatest()) return await latestPromise;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1558,3 +1558,3 @@ error: undefined,

this.route.options.onError?.(err);
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1561,0 +1561,0 @@ error: err,

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

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "ef61-32"
"uid": "37ac-32"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "ef61-34"
"uid": "37ac-34"
}

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

{
"uid": "ef61-36",
"uid": "37ac-36",
"name": "history.ts"
},
{
"uid": "ef61-38",
"uid": "37ac-38",
"name": "utils.ts"
},
{
"uid": "ef61-40",
"uid": "37ac-40",
"name": "path.ts"
},
{
"uid": "ef61-42",
"uid": "37ac-42",
"name": "qss.ts"
},
{
"uid": "ef61-44",
"uid": "37ac-44",
"name": "route.ts"
},
{
"uid": "ef61-48",
"uid": "37ac-48",
"name": "searchParams.ts"
},
{
"uid": "ef61-50",
"uid": "37ac-50",
"name": "router.ts"
},
{
"uid": "ef61-52",
"uid": "37ac-52",
"name": "routeMatch.ts"
},
{
"uid": "ef61-54",
"uid": "37ac-54",
"name": "index.ts"

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

"name": "store/build/esm/index.js",
"uid": "ef61-46"
"uid": "37ac-46"
}

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

"nodeParts": {
"ef61-32": {
"37ac-32": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "ef61-31"
"mainUid": "37ac-31"
},
"ef61-34": {
"37ac-34": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "ef61-33"
"mainUid": "37ac-33"
},
"ef61-36": {
"37ac-36": {
"renderedLength": 4365,
"gzipLength": 1105,
"brotliLength": 0,
"mainUid": "ef61-35"
"mainUid": "37ac-35"
},
"ef61-38": {
"37ac-38": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "ef61-37"
"mainUid": "37ac-37"
},
"ef61-40": {
"37ac-40": {
"renderedLength": 5705,
"gzipLength": 1352,
"brotliLength": 0,
"mainUid": "ef61-39"
"mainUid": "37ac-39"
},
"ef61-42": {
"37ac-42": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "ef61-41"
"mainUid": "37ac-41"
},
"ef61-44": {
"37ac-44": {
"renderedLength": 2963,
"gzipLength": 847,
"brotliLength": 0,
"mainUid": "ef61-43"
"mainUid": "37ac-43"
},
"ef61-46": {
"37ac-46": {
"renderedLength": 1384,
"gzipLength": 502,
"brotliLength": 0,
"mainUid": "ef61-45"
"mainUid": "37ac-45"
},
"ef61-48": {
"37ac-48": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "ef61-47"
"mainUid": "37ac-47"
},
"ef61-50": {
"renderedLength": 24098,
"gzipLength": 5496,
"37ac-50": {
"renderedLength": 24120,
"gzipLength": 5498,
"brotliLength": 0,
"mainUid": "ef61-49"
"mainUid": "37ac-49"
},
"ef61-52": {
"renderedLength": 6868,
"gzipLength": 1717,
"37ac-52": {
"renderedLength": 6884,
"gzipLength": 1720,
"brotliLength": 0,
"mainUid": "ef61-51"
"mainUid": "37ac-51"
},
"ef61-54": {
"37ac-54": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "ef61-53"
"mainUid": "37ac-53"
}
},
"nodeMetas": {
"ef61-31": {
"37ac-31": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "ef61-32"
"index.production.js": "37ac-32"
},

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

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-43"
"uid": "37ac-43"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
}
]
},
"ef61-33": {
"37ac-33": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "ef61-34"
"index.production.js": "37ac-34"
},

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

{
"uid": "ef61-53"
"uid": "37ac-53"
}
]
},
"ef61-35": {
"37ac-35": {
"id": "/packages/router/src/history.ts",
"moduleParts": {
"index.production.js": "ef61-36"
"index.production.js": "37ac-36"
},

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

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
}
]
},
"ef61-37": {
"37ac-37": {
"id": "/packages/router/src/utils.ts",
"moduleParts": {
"index.production.js": "ef61-38"
"index.production.js": "37ac-38"
},

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

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-39"
"uid": "37ac-39"
},
{
"uid": "ef61-51"
"uid": "37ac-51"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
}
]
},
"ef61-39": {
"37ac-39": {
"id": "/packages/router/src/path.ts",
"moduleParts": {
"index.production.js": "ef61-40"
"index.production.js": "37ac-40"
},
"imported": [
{
"uid": "ef61-37"
"uid": "37ac-37"
}

@@ -238,16 +238,16 @@ ],

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-43"
"uid": "37ac-43"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
}
]
},
"ef61-41": {
"37ac-41": {
"id": "/packages/router/src/qss.ts",
"moduleParts": {
"index.production.js": "ef61-42"
"index.production.js": "37ac-42"
},

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

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-47"
"uid": "37ac-47"
}
]
},
"ef61-43": {
"37ac-43": {
"id": "/packages/router/src/route.ts",
"moduleParts": {
"index.production.js": "ef61-44"
"index.production.js": "37ac-44"
},
"imported": [
{
"uid": "ef61-31"
"uid": "37ac-31"
},
{
"uid": "ef61-39"
"uid": "37ac-39"
}

@@ -280,10 +280,10 @@ ],

{
"uid": "ef61-53"
"uid": "37ac-53"
}
]
},
"ef61-45": {
"37ac-45": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "ef61-46"
"index.production.js": "37ac-46"
},

@@ -293,17 +293,17 @@ "imported": [],

{
"uid": "ef61-51"
"uid": "37ac-51"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
}
]
},
"ef61-47": {
"37ac-47": {
"id": "/packages/router/src/searchParams.ts",
"moduleParts": {
"index.production.js": "ef61-48"
"index.production.js": "37ac-48"
},
"imported": [
{
"uid": "ef61-41"
"uid": "37ac-41"
}

@@ -313,35 +313,35 @@ ],

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
}
]
},
"ef61-49": {
"37ac-49": {
"id": "/packages/router/src/router.ts",
"moduleParts": {
"index.production.js": "ef61-50"
"index.production.js": "37ac-50"
},
"imported": [
{
"uid": "ef61-45"
"uid": "37ac-45"
},
{
"uid": "ef61-31"
"uid": "37ac-31"
},
{
"uid": "ef61-39"
"uid": "37ac-39"
},
{
"uid": "ef61-51"
"uid": "37ac-51"
},
{
"uid": "ef61-47"
"uid": "37ac-47"
},
{
"uid": "ef61-37"
"uid": "37ac-37"
},
{
"uid": "ef61-35"
"uid": "37ac-35"
}

@@ -351,23 +351,23 @@ ],

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-51"
"uid": "37ac-51"
}
]
},
"ef61-51": {
"37ac-51": {
"id": "/packages/router/src/routeMatch.ts",
"moduleParts": {
"index.production.js": "ef61-52"
"index.production.js": "37ac-52"
},
"imported": [
{
"uid": "ef61-45"
"uid": "37ac-45"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
},
{
"uid": "ef61-37"
"uid": "37ac-37"
}

@@ -377,53 +377,53 @@ ],

{
"uid": "ef61-53"
"uid": "37ac-53"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
}
]
},
"ef61-53": {
"37ac-53": {
"id": "/packages/router/src/index.ts",
"moduleParts": {
"index.production.js": "ef61-54"
"index.production.js": "37ac-54"
},
"imported": [
{
"uid": "ef61-31"
"uid": "37ac-31"
},
{
"uid": "ef61-33"
"uid": "37ac-33"
},
{
"uid": "ef61-35"
"uid": "37ac-35"
},
{
"uid": "ef61-55"
"uid": "37ac-55"
},
{
"uid": "ef61-56"
"uid": "37ac-56"
},
{
"uid": "ef61-39"
"uid": "37ac-39"
},
{
"uid": "ef61-41"
"uid": "37ac-41"
},
{
"uid": "ef61-43"
"uid": "37ac-43"
},
{
"uid": "ef61-57"
"uid": "37ac-57"
},
{
"uid": "ef61-51"
"uid": "37ac-51"
},
{
"uid": "ef61-49"
"uid": "37ac-49"
},
{
"uid": "ef61-47"
"uid": "37ac-47"
},
{
"uid": "ef61-37"
"uid": "37ac-37"
}

@@ -434,3 +434,3 @@ ],

},
"ef61-55": {
"37ac-55": {
"id": "/packages/router/src/frameworks.ts",

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

{
"uid": "ef61-53"
"uid": "37ac-53"
}
]
},
"ef61-56": {
"37ac-56": {
"id": "/packages/router/src/link.ts",

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

{
"uid": "ef61-53"
"uid": "37ac-53"
}
]
},
"ef61-57": {
"37ac-57": {
"id": "/packages/router/src/routeInfo.ts",

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

{
"uid": "ef61-53"
"uid": "37ac-53"
}

@@ -466,0 +466,0 @@ ]

@@ -226,3 +226,3 @@ /**

navigationPromise: undefined | Promise<void>;
store: Store<RouterStore<TRoutesInfo>>;
__store: Store<RouterStore<TRoutesInfo>>;
state: RouterStore<TRoutesInfo>;

@@ -285,3 +285,3 @@ startedLoadingAt: number;

router: Router<TRoutesInfo['routeTree'], TRoutesInfo>;
store: Store<RouteMatchStore<TRoutesInfo, TRoute>>;
__store: Store<RouteMatchStore<TRoutesInfo, TRoute>>;
state: RouteMatchStore<TRoutesInfo, TRoute>;

@@ -327,2 +327,4 @@ id: string;

}
interface RouteContext {
}
type RouteOptionsBase<TCustomId, TPath> = {

@@ -341,3 +343,3 @@ path: TPath;

};
type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, any> = Record<ParsePathParams<TPath>, string>, TAllParams = TParams, TParentContext extends AnyContext = AnyContext, TAllParentContext extends AnyContext = AnyContext, TRouteContext extends AnyContext = AnyContext, TContext extends AnyContext = TRouteContext> = RouteOptionsBase<TCustomId, TPath> & FrameworkRouteOptions & {
type RouteOptions<TParentRoute extends AnyRoute = AnyRoute, TCustomId extends string = string, TPath extends string = string, TParentSearchSchema extends {} = {}, TSearchSchema extends AnySearchSchema = {}, TFullSearchSchema extends AnySearchSchema = TSearchSchema, TParentParams extends AnyPathParams = {}, TParams extends Record<ParsePathParams<TPath>, any> = Record<ParsePathParams<TPath>, string>, TAllParams = TParams, TParentContext extends AnyContext = AnyContext, TAllParentContext extends AnyContext = AnyContext, TRouteContext extends RouteContext = AnyContext, TContext extends AnyContext = TRouteContext> = RouteOptionsBase<TCustomId, TPath> & FrameworkRouteOptions & {
getParentRoute: () => TParentRoute;

@@ -658,2 +660,2 @@ caseSensitive?: boolean;

export { ActiveOptions, AnyContext, AnyLoaderData, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouter, AnyRoutesInfo, AnySearchSchema, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultRoutesInfo, DefinedPathParamWarning, DehydratedRouter, DehydratedRouterState, Expand, FilterRoutesFn, FrameworkGenerics, FrameworkRouteOptions, FromLocation, GetFrameworkGeneric, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderState, LocationState, MatchCache, MatchCacheEntry, MatchLocation, MatchRouteOptions, MetaOptions, NavigateOptions, NoInfer, OnLoadFn, ParentParams, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamMask, PathParamOptions, PendingRouteMatchInfo, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, Redirect, Register, RegisteredRouter, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFullSearchSchema, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteMatch, RouteMatchStore, RouteMeta, RouteOptions, RouteOptionsBase, RouteOptionsBaseIntersection, Router, RouterConstructorOptions, RouterContext, RouterHistory, RouterLocation, RouterOptions, RouterStore, RoutesById, RoutesInfo, RoutesInfoInner, SearchFilter, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, Timeout, ToIdOption, ToOptions, ToPathOption, UnionToIntersection, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, cleanPath, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultFetchServerDataFn, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, isRedirect, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight };
export { ActiveOptions, AnyContext, AnyLoaderData, AnyPathParams, AnyRedirect, AnyRootRoute, AnyRoute, AnyRouteMatch, AnyRouter, AnyRoutesInfo, AnySearchSchema, BuildNextOptions, CheckId, CheckIdError, CheckPath, CheckPathError, CheckRelativePath, DeepAwaited, DefaultRoutesInfo, DefinedPathParamWarning, DehydratedRouter, DehydratedRouterState, Expand, FilterRoutesFn, FrameworkGenerics, FrameworkRouteOptions, FromLocation, GetFrameworkGeneric, InferFullSearchSchema, IsAny, IsAnyBoolean, IsKnown, LinkInfo, LinkOptions, ListenerFn, LoaderContext, LoaderState, LocationState, MatchCache, MatchCacheEntry, MatchLocation, MatchRouteOptions, MetaOptions, NavigateOptions, NoInfer, OnLoadFn, ParentParams, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamMask, PathParamOptions, PendingRouteMatchInfo, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, Redirect, Register, RegisteredRouter, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFullSearchSchema, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteContext, RouteMatch, RouteMatchStore, RouteMeta, RouteOptions, RouteOptionsBase, RouteOptionsBaseIntersection, Router, RouterConstructorOptions, RouterContext, RouterHistory, RouterLocation, RouterOptions, RouterStore, RoutesById, RoutesInfo, RoutesInfoInner, SearchFilter, SearchParamOptions, SearchParser, SearchSchemaValidator, SearchSchemaValidatorFn, SearchSchemaValidatorObj, SearchSerializer, Segment, Split, Timeout, ToIdOption, ToOptions, ToPathOption, UnionToIntersection, UnloaderFn, Updater, ValidFromPath, ValueKeys, Values, cleanPath, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultFetchServerDataFn, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, isRedirect, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, redirect, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight };

@@ -740,3 +740,3 @@ /**

};
this.store = new Store(getInitialRouterState(), {
this.__store = new Store(getInitialRouterState(), {
onUpdate: state => {

@@ -746,3 +746,3 @@ this.state = state;

});
this.state = this.store.state;
this.state = this.__store.state;
this.basepath = '';

@@ -767,3 +767,3 @@ this.update(options);

reset = () => {
this.store.setState(s => Object.assign(s, getInitialRouterState()));
this.__store.setState(s => Object.assign(s, getInitialRouterState()));
};

@@ -788,3 +788,3 @@ mount = () => {

const parsedLocation = this.#parseLocation();
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -838,6 +838,6 @@ latestLocation: parsedLocation,

let matches;
this.store.batch(() => {
this.__store.batch(() => {
if (opts?.next) {
// Ingest the new location
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -852,3 +852,3 @@ latestLocation: opts.next

});
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -892,3 +892,3 @@ status: 'pending',

if (d.state.status === 'error') {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -913,3 +913,3 @@ status: 'idle',

const prevLocation = this.state.currentLocation;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1235,3 +1235,3 @@ status: 'idle',

hydrate = dehydratedRouter => {
this.store.setState(s => {
this.__store.setState(s => {
// Match the routes

@@ -1244,3 +1244,3 @@ const currentMatches = this.matchRoutes(dehydratedRouter.state.latestLocation.pathname, {

invariant(dehydratedMatch && dehydratedMatch.id === match.id, 'Oh no! There was a hydration mismatch when attempting to hydrate the state of the router! 😬');
match.store.setState(s => ({
match.__store.setState(s => ({
...s,

@@ -1439,3 +1439,3 @@ ...dehydratedMatch.state

params: opts.params,
store: new Store({
__store: new Store({
updatedAt: 0,

@@ -1451,3 +1451,3 @@ routeSearch: {},

});
this.state = this.store.state;
this.state = this.__store.state;
componentTypes.map(async type => {

@@ -1460,3 +1460,3 @@ const component = this.route.options[type];

if (this.state.status === 'idle' && !this.#hasLoaders()) {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1481,3 +1481,3 @@ status: 'success'

this.routeContext = routeContext;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1553,3 +1553,3 @@ routeSearch: replaceEqualDeep(s.routeSearch, routeSearch),

this.route.options.onError?.(err);
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1588,3 +1588,3 @@ status: 'error',

if (this.state.status === 'idle') {
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1622,3 +1622,3 @@ status: 'pending'

if (latestPromise = checkLatest()) return await latestPromise;
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1636,3 +1636,3 @@ error: undefined,

this.route.options.onError?.(err);
this.store.setState(s => ({
this.__store.setState(s => ({
...s,

@@ -1639,0 +1639,0 @@ error: err,

@@ -11,3 +11,3 @@ /**

*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RouterCore={})}(this,(function(t){"use strict";function e(t,e){if(!t)throw new Error("Invariant failed")}const a="popstate";function s(t){let e=t.getLocation(),a=()=>{},s=new Set;const r=()=>{e=t.getLocation(),s.forEach((t=>t()))};return{get location(){return e},listen:e=>(0===s.size&&(a=t.listener(r)),s.add(e),()=>{s.delete(e),0===s.size&&a()}),push:(e,a)=>{t.pushState(e,a),r()},replace:(e,a)=>{t.replaceState(e,a),r()},go:e=>{t.go(e),r()},back:()=>{t.back(),r()},forward:()=>{t.forward(),r()},createHref:e=>t.createHref(e)}}function r(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.hash}${window.location.search}`),r=t?.createHref??(t=>t);return s({getLocation:()=>n(e(),history.state),listener:t=>(window.addEventListener(a,t),()=>{window.removeEventListener(a,t)}),pushState:(t,e)=>{window.history.pushState({...e,key:i()},"",r(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:i()},"",r(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>r(t)})}function o(t={initialEntries:["/"]}){const e=t.initialEntries;let a=t.initialIndex??e.length-1,r={};return s({getLocation:()=>n(e[a],r),listener:()=>()=>{},pushState:(t,s)=>{r={...s,key:i()},e.push(t),a++},replaceState:(t,s)=>{r={...s,key:i()},e[a]=t},back:()=>{a--},forward:()=>{a=Math.min(a+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function n(t,e){let a=t.indexOf("#"),s=t.indexOf("?");return{href:t,pathname:t.substring(0,a>0?s>0?Math.min(a,s):a:s>0?s:t.length),hash:a>-1?t.substring(a,s):"",search:s>-1?t.substring(s):"",state:e}}function i(){return(Math.random()+1).toString(36).substring(7)}function h(t){return t[t.length-1]}function c(t,e){return"function"==typeof t?t(e):t}function u(t,e){return e.reduce(((e,a)=>(e[a]=t[a],e)),{})}function l(t,e){if(t===e)return t;const a=e,s=Array.isArray(t)&&Array.isArray(a);if(s||p(t)&&p(a)){const e=s?t.length:Object.keys(t).length,r=s?a:Object.keys(a),o=r.length,n=s?[]:{};let i=0;for(let e=0;e<o;e++){const o=s?e:r[e];n[o]=l(t[o],a[o]),n[o]===t[o]&&i++}return e===o&&i===e?t:n}return a}function p(t){if(!d(t))return!1;const e=t.constructor;if(void 0===e)return!0;const a=e.prototype;return!!d(a)&&!!a.hasOwnProperty("isPrototypeOf")}function d(t){return"[object Object]"===Object.prototype.toString.call(t)}function f(t,e){return t===e||typeof t==typeof e&&(p(t)&&p(e)?!Object.keys(e).some((a=>!f(t[a],e[a]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,a)=>f(t,e[a])))))}function m(t){return y(t.filter(Boolean).join("/"))}function y(t){return t.replace(/\/{2,}/g,"/")}function g(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function v(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function w(t){return v(g(t))}function S(t,e,a){e=e.replace(new RegExp(`^${t}`),"/"),a=a.replace(new RegExp(`^${t}`),"/");let s=b(e);const r=b(a);r.forEach(((t,e)=>{if("/"===t.value)e?e===r.length-1&&s.push(t):s=[t];else if(".."===t.value)s.length>1&&"/"===h(s)?.value&&s.pop(),s.pop();else{if("."===t.value)return;s.push(t)}}));return y(m([t,...s.map((t=>t.value))]))}function b(t){if(!t)return[];const e=[];if("/"===(t=y(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const a=t.split("/").filter(Boolean);return e.push(...a.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function L(t,e,a){return m(b(t).map((t=>["$","*"].includes(t.value)&&!a?"":"param"===t.type?e[t.value.substring(1)]??"":t.value)))}function P(t,e,a){const s=x(t,e,a);if(!a.to||s)return s??{}}function x(t,e,a){if(!e.startsWith(t))return;const s=b(e="/"!=t?e.substring(t.length):e),r=b(`${a.to??"$"}`);"/"===h(s)?.value&&s.pop();const o={};return(()=>{for(let t=0;t<Math.max(s.length,r.length);t++){const e=s[t],n=r[t],i=t===r.length-1,h=t===s.length-1;if(n){if("wildcard"===n.type)return!!e?.value&&(o["*"]=m(s.slice(t).map((t=>t.value))),!0);if("pathname"===n.type){if("/"===n.value&&!e?.value)return!0;if(e)if(a.caseSensitive){if(n.value!==e.value)return!1}else if(n.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===n.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(o[n.value.substring(1)]=e.value)}}if(i&&!h)return!!a.fuzzy}return!0})()?o:void 0}function _(t,e){var a,s,r,o="";for(a in t)if(void 0!==(r=t[a]))if(Array.isArray(r))for(s=0;s<r.length;s++)o&&(o+="&"),o+=encodeURIComponent(a)+"="+encodeURIComponent(r[s]);else o&&(o+="&"),o+=encodeURIComponent(a)+"="+encodeURIComponent(r);return(e||"")+o}function R(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||("0"===e.charAt(0)?e:0*+e==0?+e:e))}function E(t){for(var e,a,s={},r=t.split("&");e=r.shift();)void 0!==s[a=(e=e.split("=")).shift()]?s[a]=[].concat(s[a],R(e.shift())):s[a]=R(e.shift());return s}const M="__root__";class C{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const a=this.options,s=!a?.path&&!a?.id,r=this.options?.getParentRoute?.();s?this.path=M:e(r);let o=s?M:a.path;o&&"/"!==o&&(o=w(o));const n=a?.id||o;let i=s?M:m([r.id===M?"":r.id,n]);o===M&&(o="/"),i!==M&&(i=m(["/",i]));const h=i===M?"/":v(m([r.fullPath,o]));this.path=o,this.id=i,this.fullPath=h};addChildren=t=>(this.children=t,this);generate=t=>{e(!1)}}class $ extends C{constructor(t){super(t)}static withRouterContext=()=>t=>new $(t)}
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).RouterCore={})}(this,(function(t){"use strict";function e(t,e){if(!t)throw new Error("Invariant failed")}const a="popstate";function s(t){let e=t.getLocation(),a=()=>{},s=new Set;const r=()=>{e=t.getLocation(),s.forEach((t=>t()))};return{get location(){return e},listen:e=>(0===s.size&&(a=t.listener(r)),s.add(e),()=>{s.delete(e),0===s.size&&a()}),push:(e,a)=>{t.pushState(e,a),r()},replace:(e,a)=>{t.replaceState(e,a),r()},go:e=>{t.go(e),r()},back:()=>{t.back(),r()},forward:()=>{t.forward(),r()},createHref:e=>t.createHref(e)}}function r(t){const e=t?.getHref??(()=>`${window.location.pathname}${window.location.hash}${window.location.search}`),r=t?.createHref??(t=>t);return s({getLocation:()=>n(e(),history.state),listener:t=>(window.addEventListener(a,t),()=>{window.removeEventListener(a,t)}),pushState:(t,e)=>{window.history.pushState({...e,key:i()},"",r(t))},replaceState:(t,e)=>{window.history.replaceState({...e,key:i()},"",r(t))},back:()=>window.history.back(),forward:()=>window.history.forward(),go:t=>window.history.go(t),createHref:t=>r(t)})}function o(t={initialEntries:["/"]}){const e=t.initialEntries;let a=t.initialIndex??e.length-1,r={};return s({getLocation:()=>n(e[a],r),listener:()=>()=>{},pushState:(t,s)=>{r={...s,key:i()},e.push(t),a++},replaceState:(t,s)=>{r={...s,key:i()},e[a]=t},back:()=>{a--},forward:()=>{a=Math.min(a+1,e.length-1)},go:t=>window.history.go(t),createHref:t=>t})}function n(t,e){let a=t.indexOf("#"),s=t.indexOf("?");return{href:t,pathname:t.substring(0,a>0?s>0?Math.min(a,s):a:s>0?s:t.length),hash:a>-1?t.substring(a,s):"",search:s>-1?t.substring(s):"",state:e}}function i(){return(Math.random()+1).toString(36).substring(7)}function h(t){return t[t.length-1]}function c(t,e){return"function"==typeof t?t(e):t}function u(t,e){return e.reduce(((e,a)=>(e[a]=t[a],e)),{})}function l(t,e){if(t===e)return t;const a=e,s=Array.isArray(t)&&Array.isArray(a);if(s||p(t)&&p(a)){const e=s?t.length:Object.keys(t).length,r=s?a:Object.keys(a),o=r.length,n=s?[]:{};let i=0;for(let e=0;e<o;e++){const o=s?e:r[e];n[o]=l(t[o],a[o]),n[o]===t[o]&&i++}return e===o&&i===e?t:n}return a}function p(t){if(!d(t))return!1;const e=t.constructor;if(void 0===e)return!0;const a=e.prototype;return!!d(a)&&!!a.hasOwnProperty("isPrototypeOf")}function d(t){return"[object Object]"===Object.prototype.toString.call(t)}function f(t,e){return t===e||typeof t==typeof e&&(p(t)&&p(e)?!Object.keys(e).some((a=>!f(t[a],e[a]))):!(!Array.isArray(t)||!Array.isArray(e))&&(t.length===e.length&&t.every(((t,a)=>f(t,e[a])))))}function m(t){return y(t.filter(Boolean).join("/"))}function y(t){return t.replace(/\/{2,}/g,"/")}function g(t){return"/"===t?t:t.replace(/^\/{1,}/,"")}function v(t){return"/"===t?t:t.replace(/\/{1,}$/,"")}function w(t){return v(g(t))}function _(t,e,a){e=e.replace(new RegExp(`^${t}`),"/"),a=a.replace(new RegExp(`^${t}`),"/");let s=S(e);const r=S(a);r.forEach(((t,e)=>{if("/"===t.value)e?e===r.length-1&&s.push(t):s=[t];else if(".."===t.value)s.length>1&&"/"===h(s)?.value&&s.pop(),s.pop();else{if("."===t.value)return;s.push(t)}}));return y(m([t,...s.map((t=>t.value))]))}function S(t){if(!t)return[];const e=[];if("/"===(t=y(t)).slice(0,1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),!t)return e;const a=t.split("/").filter(Boolean);return e.push(...a.map((t=>"$"===t||"*"===t?{type:"wildcard",value:t}:"$"===t.charAt(0)?{type:"param",value:t}:{type:"pathname",value:t}))),"/"===t.slice(-1)&&(t=t.substring(1),e.push({type:"pathname",value:"/"})),e}function b(t,e,a){return m(S(t).map((t=>["$","*"].includes(t.value)&&!a?"":"param"===t.type?e[t.value.substring(1)]??"":t.value)))}function L(t,e,a){const s=P(t,e,a);if(!a.to||s)return s??{}}function P(t,e,a){if(!e.startsWith(t))return;const s=S(e="/"!=t?e.substring(t.length):e),r=S(`${a.to??"$"}`);"/"===h(s)?.value&&s.pop();const o={};return(()=>{for(let t=0;t<Math.max(s.length,r.length);t++){const e=s[t],n=r[t],i=t===r.length-1,h=t===s.length-1;if(n){if("wildcard"===n.type)return!!e?.value&&(o["*"]=m(s.slice(t).map((t=>t.value))),!0);if("pathname"===n.type){if("/"===n.value&&!e?.value)return!0;if(e)if(a.caseSensitive){if(n.value!==e.value)return!1}else if(n.value.toLowerCase()!==e.value.toLowerCase())return!1}if(!e)return!1;if("param"===n.type){if("/"===e?.value)return!1;"$"!==e.value.charAt(0)&&(o[n.value.substring(1)]=e.value)}}if(i&&!h)return!!a.fuzzy}return!0})()?o:void 0}function x(t,e){var a,s,r,o="";for(a in t)if(void 0!==(r=t[a]))if(Array.isArray(r))for(s=0;s<r.length;s++)o&&(o+="&"),o+=encodeURIComponent(a)+"="+encodeURIComponent(r[s]);else o&&(o+="&"),o+=encodeURIComponent(a)+"="+encodeURIComponent(r);return(e||"")+o}function R(t){if(!t)return"";var e=decodeURIComponent(t);return"false"!==e&&("true"===e||("0"===e.charAt(0)?e:0*+e==0?+e:e))}function E(t){for(var e,a,s={},r=t.split("&");e=r.shift();)void 0!==s[a=(e=e.split("=")).shift()]?s[a]=[].concat(s[a],R(e.shift())):s[a]=R(e.shift());return s}const M="__root__";class C{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const a=this.options,s=!a?.path&&!a?.id,r=this.options?.getParentRoute?.();s?this.path=M:e(r);let o=s?M:a.path;o&&"/"!==o&&(o=w(o));const n=a?.id||o;let i=s?M:m([r.id===M?"":r.id,n]);o===M&&(o="/"),i!==M&&(i=m(["/",i]));const h=i===M?"/":v(m([r.fullPath,o]));this.path=o,this.id=i,this.fullPath=h};addChildren=t=>(this.children=t,this);generate=t=>{e(!1)}}class $ extends C{constructor(t){super(t)}static withRouterContext=()=>t=>new $(t)}
/**

@@ -22,3 +22,3 @@ * store

* @license MIT
*/class I{listeners=new Set;batching=!1;queue=[];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=>{const e=this.state;this.state=this.options?.updateFn?this.options.updateFn(e)(t):t(e),this.state!==e&&(this.options?.onUpdate?.(this.state,e),this.queue.push((()=>{this.listeners.forEach((t=>t(this.state,e)))})),this.#t())};#t=()=>{this.batching||(this.queue.forEach((t=>t())),this.queue=[])};batch=t=>{this.batching=!0,t(),this.batching=!1,this.#t()}}const A=T(JSON.parse),k=D(JSON.stringify);function T(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let a=E(e);for(let e in a){const s=a[e];if("string"==typeof s)try{a[e]=t(s)}catch(t){}}return a}}function D(t){return e=>{(e={...e})&&Object.keys(e).forEach((a=>{const s=e[a];if(void 0===s||void 0===s)delete e[a];else if(s&&"object"==typeof s&&null!==s)try{e[a]=t(s)}catch(t){}}));const a=_(e).toString();return a?`?${a}`:""}}const H=async({router:t,routeMatch:e})=>{const a=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),s=await fetch(a.href,{method:"GET",signal:e.abortController.signal});if(s.ok)return s.json();throw new Error("Failed to fetch match data")};const j="undefined"==typeof window||!window.document.createElement;function O(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],lastUpdated:Date.now()}}function N(t){return!!t?.isRedirect}const U=["component","errorComponent","pendingComponent"];class B{abortController=new AbortController;onLoaderDataListeners=new Set;constructor(t,e,a){Object.assign(this,{route:e,router:t,id:a.id,pathname:a.pathname,params:a.params,store:new I({updatedAt:0,routeSearch:{},search:{},status:"idle"},{onUpdate:t=>{this.state=t}})}),this.state=this.store.state,U.map((async t=>{const e=this.route.options[t];"function"!=typeof this[t]&&(this[t]=e)})),"idle"!==this.state.status||this.#e()||this.store.setState((t=>({...t,status:"success"})))}#e=()=>!(!this.route.options.onLoad&&!U.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:a,routeContext:s}=this.#a({location:this.router.state.currentLocation});this.context=a,this.routeContext=s,this.store.setState((a=>({...a,routeSearch:l(a.routeSearch,t),search:l(a.search,e)})))};cancel=()=>{this.abortController?.abort()};#s=t=>{const e=this.parentMatch?this.parentMatch.#s(t):{search:t.location.search,routeSearch:t.location.search};try{const t=("object"==typeof this.route.options.validateSearch?this.route.options.validateSearch.parse:this.route.options.validateSearch)?.(e.search)??{};return{routeSearch:t,search:{...e.search,...t}}}catch(t){if(N(t))throw t;this.route.options.onValidateSearchError?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#a=t=>{const{search:e,routeSearch:a}=this.#s(t),s=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:a,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...s},routeContext:s}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#a(t)}catch(t){return N(t)?void this.router.navigate(t):(this.route.options.onError?.(t),void this.store.setState((e=>({...e,status:"error",error:t}))))}const{routeSearch:a,search:s,context:r,routeContext:o}=e;if("pending"!==this.state.status)return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#r=e;const n=()=>e!==this.#r?this.__loadPromise:void 0;let i;"idle"===this.state.status&&this.store.setState((t=>({...t,status:"pending"})));const h=(async()=>{await Promise.all(U.map((async t=>{const e=this.route.options[t];this[t]?.preload&&(this[t]=await this.router.options.loadComponent(e))})))})(),c=Promise.resolve().then((()=>{if(this.route.options.onLoad)return this.route.options.onLoad({params:this.params,routeSearch:a,search:s,signal:this.abortController.signal,preload:!!t?.preload,routeContext:o,context:r})}));try{if(await Promise.all([h,c]),i=n())return await i;this.store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now()})))}catch(t){if(N(t))return void this.router.navigate(t);this.route.options.onLoadError?.(t),this.route.options.onError?.(t),this.store.setState((e=>({...e,error:t,status:"error",updatedAt:Date.now()})))}finally{delete this.__loadPromise}})),this.__loadPromise};#r=""}t.RootRoute=$,t.Route=C,t.RouteMatch=B,t.Router=class{#o;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??k,parseSearch:t?.parseSearch??A,fetchServerDataFn:t?.fetchServerDataFn??H},this.store=new I(O(),{onUpdate:t=>{this.state=t}}),this.state=this.store.state,this.basepath="",this.update(t),this.options.Router?.(this);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.latestLocation.href!==e.href&&this.#n({...e,replace:!0})}reset=()=>{this.store.setState((t=>Object.assign(t,O())))};mount=()=>(j||this.state.currentMatches.length||this.safeLoad(),()=>{});update=t=>{if(Object.assign(this.options,t),!this.history||this.options.history&&this.options.history!==this.history){this.#o&&this.#o(),this.history=this.options.history??(j?o():r());const t=this.#i();this.store.setState((e=>({...e,latestLocation:t,currentLocation:t}))),this.#o=this.history.listen((()=>{this.safeLoad({next:this.#i(this.state.latestLocation)})}))}const{basepath:e,routeTree:a}=this.options;return this.basepath=`/${w(e??"")??""}`,a&&(this.routesById={},this.routeTree=this.#h(a)),this};buildNext=t=>{const e=this.#c(t),a=this.matchRoutes(e.pathname);return this.#c({...t,__matches:a})};cancelMatches=()=>{[...this.state.currentMatches,...this.state.pendingMatches||[]].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),e(!1)}))};load=async t=>{let e=Date.now();const a=e;let s;if(this.startedLoadingAt=a,this.cancelMatches(),this.store.batch((()=>{t?.next&&this.store.setState((e=>({...e,latestLocation:t.next}))),s=this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}),this.store.setState((t=>({...t,status:"pending",pendingMatches:s,pendingLocation:this.state.latestLocation})))})),await this.loadMatches(s,this.state.pendingLocation),this.startedLoadingAt!==a)return this.navigationPromise;const r=this.state.currentMatches,o=[],n=[];r.forEach((t=>{s.find((e=>e.id===t.id))?n.push(t):o.push(t)}));const i=s.filter((t=>!r.find((e=>e.id===t.id))));e=Date.now(),o.forEach((t=>{t.__onExit?.({params:t.params,search:t.state.routeSearch}),"error"===t.state.status&&this.store.setState((t=>({...t,status:"idle",error:void 0})))})),n.forEach((t=>{t.route.options.onTransition?.({params:t.params,search:t.state.routeSearch})})),i.forEach((t=>{t.__onExit=t.route.options.onLoaded?.({params:t.params,search:t.state.search})}));const h=this.state.currentLocation;this.store.setState((t=>({...t,status:"idle",currentLocation:this.state.latestLocation,currentMatches:s,pendingLocation:void 0,pendingMatches:void 0}))),s.forEach((t=>{t.__commit()})),h.href!==this.state.currentLocation.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const a=this.routesById[t];return e(a),a};loadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),a=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(a,e),a};preloadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),a=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(a,e,{preload:!0}),a};matchRoutes=(t,e)=>{const a=[];if(!this.routeTree)return a;const s=[...this.state.currentMatches,...this.state.pendingMatches??[]],r=async o=>{let n=h(a)?.params??{};const i=this.options.filterRoutes?.(o)??o;let c=[];const u=(a,s)=>(s.some((s=>{const r=s.children;if(!s.path&&r?.length)return u([...c,s],r);const o=!("/"===s.path&&!r?.length),i=P(this.basepath,t,{to:s.fullPath,fuzzy:o,caseSensitive:s.options.caseSensitive??this.options.caseSensitive});if(i){let t;try{t=s.options.parseParams?.(i)??i}catch(t){if(e?.strictParseParams)throw t}n={...n,...t}}return i&&(c=[...a,s]),!!c.length})),!!c.length);if(u([],i),!c.length)return;c.forEach((t=>{const e=L(t.path,n),r=L(t.id,n,!0),o=s.find((t=>t.id===r))||new B(this,t,{id:r,params:n,pathname:m([this.basepath,e])});a.push(o)}));const l=h(c).children;l?.length&&r(l)};return r([this.routeTree]),a};loadMatches=async(t,e,a)=>{await Promise.all(t.map((async t=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(e){throw a?.preload||t.route.options.onBeforeLoadError?.(e),t.route.options.onError?.(e),e}})));const s=t.map((async(s,r)=>{const o=t[r-1];s.__load({preload:a?.preload,location:e,parentMatch:o}),await s.__loadPromise,o&&await o.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>S(this.basepath,t,y(e));navigate=async({from:t,to:a="",search:s,hash:r,replace:o,params:n})=>{const i=String(a),h=void 0===t?t:String(t);let c;try{new URL(`${i}`),c=!0}catch(t){}return e(!c),this.#n({from:h,to:i,search:s,hash:r,replace:o,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const a=this.buildNext(t),s=e?.pending?this.state.pendingLocation:this.state.currentLocation;if(!s)return!1;const r=P(this.basepath,s.pathname,{...e,to:a.pathname});return!!r&&(e?.includeSearch??1?!!f(s.search,a.search)&&r:r)};buildLink=({from:t,to:e=".",search:a,params:s,hash:r,target:o,replace:n,activeOptions:i,preload:h,preloadDelay:c,disabled:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const l={from:t,to:e,search:a,params:s,hash:r,replace:n},p=this.buildNext(l);h=h??this.options.defaultPreload;const d=c??this.options.defaultPreloadDelay??0,m=this.state.currentLocation.pathname.split("/"),y=p.pathname.split("/").every(((t,e)=>t===m[e])),g=i?.exact?this.state.currentLocation.pathname===p.pathname:y,v=!i?.includeHash||this.state.currentLocation.hash===p.hash,w=!(i?.includeSearch??1)||f(this.state.currentLocation.search,p.search);return{type:"internal",next:p,handleFocus:t=>{h&&this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{u||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||o&&"_self"!==o||0!==t.button||(t.preventDefault(),this.#n(l))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),d)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&v&&w,disabled:u}};dehydrate=()=>({state:{...u(this.state,["latestLocation","currentLocation","status","lastUpdated"]),currentMatches:this.state.currentMatches.map((t=>({id:t.id,state:{status:t.state.status}})))}});hydrate=t=>{this.store.setState((a=>{const s=this.matchRoutes(t.state.latestLocation.pathname,{strictParseParams:!0});return s.forEach(((a,s)=>{const r=t.state.currentMatches[s];e(r&&r.id===a.id),a.store.setState((t=>({...t,...r.state})))})),{...a,...t.state,currentMatches:s}}))};#h=t=>{const e=t=>{t.forEach(((t,a)=>{t.init({originalIndex:a,router:this});if(this.routesById[t.id])throw new Error;this.routesById[t.id]=t;const s=t.children;s?.length&&(e(s),t.children=s.map(((t,e)=>{const a=b(g(y(t.path??"/")));for(;a.length>1&&"/"===a[0]?.value;)a.shift();let s=0;return a.forEach(((t,e)=>{let a=1;for(;e--;)a*=.001;"pathname"===t.type&&"/"!==t.value?s+=1*a:"param"===t.type?s+=2*a:"wildcard"===t.type&&(s+=3*a)})),{child:t,parsed:a,index:e,score:s}})).sort(((t,e)=>t.score!==e.score?t.score-e.score:t.index-e.index)).map((t=>t.child)))}))};return e([t]),t};#i=t=>{let{pathname:e,search:a,hash:s,state:r}=this.history.location;const o=this.options.parseSearch(a);return{pathname:e,searchStr:a,search:l(t?.search,o),hash:s.split("#").reverse()[0]??"",href:`${e}${a}${s}`,state:r,key:r?.key||"__init__"}};#c=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.latestLocation.pathname:t.from??this.state.latestLocation.pathname;let a=S(this.basepath??"/",e,`${t.to??""}`);const s={...h(this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}))?.params};let r=!0===(t.params??!0)?s:c(t.params,s);r&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{r={...r,...t(r)}})),a=L(a,r??{});const o=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=o?.length?o?.reduce(((t,e)=>e(t)),this.state.latestLocation.search):this.state.latestLocation.search,u=!0===t.search?i:t.search?c(t.search,i)??{}:o?.length?i:{},p=n?.length?n.reduce(((t,e)=>e(t)),u):u,d=l(this.state.latestLocation.search,p),f=this.options.stringifySearch(d);let m=!0===t.hash?this.state.latestLocation.hash:c(t.hash,this.state.latestLocation.hash);m=m?`#${m}`:"";return{pathname:a,search:d,searchStr:f,state:!0===t.state?this.state.latestLocation.state:c(t.state,this.state.latestLocation.state),hash:m,href:this.history.createHref(`${a}${f}${m}`),key:t.key}};#n=async t=>{const e=this.buildNext(t),a=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let s="replace";t.replace||(s="push");this.state.latestLocation.href===e.href&&!e.key&&(s="replace");const r=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===s?"push":"replace"](r,{id:a,...e.state}),this.navigationPromise=new Promise((t=>{const e=this.resolveNavigation;this.resolveNavigation=()=>{e(),t()}}))}},t.cleanPath=y,t.createBrowserHistory=r,t.createHashHistory=function(){return r({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=o,t.decode=E,t.defaultFetchServerDataFn=H,t.defaultParseSearch=A,t.defaultStringifySearch=k,t.encode=_,t.functionalUpdate=c,t.interpolatePath=L,t.invariant=e,t.isPlainObject=p,t.isRedirect=N,t.joinPaths=m,t.last=h,t.matchByPath=x,t.matchPathname=P,t.parsePathname=b,t.parseSearchWith=T,t.partialDeepEqual=f,t.pick=u,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=l,t.resolvePath=S,t.rootRouteId=M,t.stringifySearchWith=D,t.trimPath=w,t.trimPathLeft=g,t.trimPathRight=v,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
*/class I{listeners=new Set;batching=!1;queue=[];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=>{const e=this.state;this.state=this.options?.updateFn?this.options.updateFn(e)(t):t(e),this.state!==e&&(this.options?.onUpdate?.(this.state,e),this.queue.push((()=>{this.listeners.forEach((t=>t(this.state,e)))})),this.#t())};#t=()=>{this.batching||(this.queue.forEach((t=>t())),this.queue=[])};batch=t=>{this.batching=!0,t(),this.batching=!1,this.#t()}}const A=T(JSON.parse),k=D(JSON.stringify);function T(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let a=E(e);for(let e in a){const s=a[e];if("string"==typeof s)try{a[e]=t(s)}catch(t){}}return a}}function D(t){return e=>{(e={...e})&&Object.keys(e).forEach((a=>{const s=e[a];if(void 0===s||void 0===s)delete e[a];else if(s&&"object"==typeof s&&null!==s)try{e[a]=t(s)}catch(t){}}));const a=x(e).toString();return a?`?${a}`:""}}const H=async({router:t,routeMatch:e})=>{const a=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),s=await fetch(a.href,{method:"GET",signal:e.abortController.signal});if(s.ok)return s.json();throw new Error("Failed to fetch match data")};const j="undefined"==typeof window||!window.document.createElement;function O(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],lastUpdated:Date.now()}}function N(t){return!!t?.isRedirect}const U=["component","errorComponent","pendingComponent"];class B{abortController=new AbortController;onLoaderDataListeners=new Set;constructor(t,e,a){Object.assign(this,{route:e,router:t,id:a.id,pathname:a.pathname,params:a.params,__store:new I({updatedAt:0,routeSearch:{},search:{},status:"idle"},{onUpdate:t=>{this.state=t}})}),this.state=this.__store.state,U.map((async t=>{const e=this.route.options[t];"function"!=typeof this[t]&&(this[t]=e)})),"idle"!==this.state.status||this.#e()||this.__store.setState((t=>({...t,status:"success"})))}#e=()=>!(!this.route.options.onLoad&&!U.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:a,routeContext:s}=this.#a({location:this.router.state.currentLocation});this.context=a,this.routeContext=s,this.__store.setState((a=>({...a,routeSearch:l(a.routeSearch,t),search:l(a.search,e)})))};cancel=()=>{this.abortController?.abort()};#s=t=>{const e=this.parentMatch?this.parentMatch.#s(t):{search:t.location.search,routeSearch:t.location.search};try{const t=("object"==typeof this.route.options.validateSearch?this.route.options.validateSearch.parse:this.route.options.validateSearch)?.(e.search)??{};return{routeSearch:t,search:{...e.search,...t}}}catch(t){if(N(t))throw t;this.route.options.onValidateSearchError?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#a=t=>{const{search:e,routeSearch:a}=this.#s(t),s=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:a,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...s},routeContext:s}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#a(t)}catch(t){return N(t)?void this.router.navigate(t):(this.route.options.onError?.(t),void this.__store.setState((e=>({...e,status:"error",error:t}))))}const{routeSearch:a,search:s,context:r,routeContext:o}=e;if("pending"!==this.state.status)return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#r=e;const n=()=>e!==this.#r?this.__loadPromise:void 0;let i;"idle"===this.state.status&&this.__store.setState((t=>({...t,status:"pending"})));const h=(async()=>{await Promise.all(U.map((async t=>{const e=this.route.options[t];this[t]?.preload&&(this[t]=await this.router.options.loadComponent(e))})))})(),c=Promise.resolve().then((()=>{if(this.route.options.onLoad)return this.route.options.onLoad({params:this.params,routeSearch:a,search:s,signal:this.abortController.signal,preload:!!t?.preload,routeContext:o,context:r})}));try{if(await Promise.all([h,c]),i=n())return await i;this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now()})))}catch(t){if(N(t))return void this.router.navigate(t);this.route.options.onLoadError?.(t),this.route.options.onError?.(t),this.__store.setState((e=>({...e,error:t,status:"error",updatedAt:Date.now()})))}finally{delete this.__loadPromise}})),this.__loadPromise};#r=""}t.RootRoute=$,t.Route=C,t.RouteMatch=B,t.Router=class{#o;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??k,parseSearch:t?.parseSearch??A,fetchServerDataFn:t?.fetchServerDataFn??H},this.__store=new I(O(),{onUpdate:t=>{this.state=t}}),this.state=this.__store.state,this.basepath="",this.update(t),this.options.Router?.(this);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.latestLocation.href!==e.href&&this.#n({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,O())))};mount=()=>(j||this.state.currentMatches.length||this.safeLoad(),()=>{});update=t=>{if(Object.assign(this.options,t),!this.history||this.options.history&&this.options.history!==this.history){this.#o&&this.#o(),this.history=this.options.history??(j?o():r());const t=this.#i();this.__store.setState((e=>({...e,latestLocation:t,currentLocation:t}))),this.#o=this.history.listen((()=>{this.safeLoad({next:this.#i(this.state.latestLocation)})}))}const{basepath:e,routeTree:a}=this.options;return this.basepath=`/${w(e??"")??""}`,a&&(this.routesById={},this.routeTree=this.#h(a)),this};buildNext=t=>{const e=this.#c(t),a=this.matchRoutes(e.pathname);return this.#c({...t,__matches:a})};cancelMatches=()=>{[...this.state.currentMatches,...this.state.pendingMatches||[]].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),e(!1)}))};load=async t=>{let e=Date.now();const a=e;let s;if(this.startedLoadingAt=a,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,latestLocation:t.next}))),s=this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatches:s,pendingLocation:this.state.latestLocation})))})),await this.loadMatches(s,this.state.pendingLocation),this.startedLoadingAt!==a)return this.navigationPromise;const r=this.state.currentMatches,o=[],n=[];r.forEach((t=>{s.find((e=>e.id===t.id))?n.push(t):o.push(t)}));const i=s.filter((t=>!r.find((e=>e.id===t.id))));e=Date.now(),o.forEach((t=>{t.__onExit?.({params:t.params,search:t.state.routeSearch}),"error"===t.state.status&&this.__store.setState((t=>({...t,status:"idle",error:void 0})))})),n.forEach((t=>{t.route.options.onTransition?.({params:t.params,search:t.state.routeSearch})})),i.forEach((t=>{t.__onExit=t.route.options.onLoaded?.({params:t.params,search:t.state.search})}));const h=this.state.currentLocation;this.__store.setState((t=>({...t,status:"idle",currentLocation:this.state.latestLocation,currentMatches:s,pendingLocation:void 0,pendingMatches:void 0}))),s.forEach((t=>{t.__commit()})),h.href!==this.state.currentLocation.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const a=this.routesById[t];return e(a),a};loadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),a=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(a,e),a};preloadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),a=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(a,e,{preload:!0}),a};matchRoutes=(t,e)=>{const a=[];if(!this.routeTree)return a;const s=[...this.state.currentMatches,...this.state.pendingMatches??[]],r=async o=>{let n=h(a)?.params??{};const i=this.options.filterRoutes?.(o)??o;let c=[];const u=(a,s)=>(s.some((s=>{const r=s.children;if(!s.path&&r?.length)return u([...c,s],r);const o=!("/"===s.path&&!r?.length),i=L(this.basepath,t,{to:s.fullPath,fuzzy:o,caseSensitive:s.options.caseSensitive??this.options.caseSensitive});if(i){let t;try{t=s.options.parseParams?.(i)??i}catch(t){if(e?.strictParseParams)throw t}n={...n,...t}}return i&&(c=[...a,s]),!!c.length})),!!c.length);if(u([],i),!c.length)return;c.forEach((t=>{const e=b(t.path,n),r=b(t.id,n,!0),o=s.find((t=>t.id===r))||new B(this,t,{id:r,params:n,pathname:m([this.basepath,e])});a.push(o)}));const l=h(c).children;l?.length&&r(l)};return r([this.routeTree]),a};loadMatches=async(t,e,a)=>{await Promise.all(t.map((async t=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(e){throw a?.preload||t.route.options.onBeforeLoadError?.(e),t.route.options.onError?.(e),e}})));const s=t.map((async(s,r)=>{const o=t[r-1];s.__load({preload:a?.preload,location:e,parentMatch:o}),await s.__loadPromise,o&&await o.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>_(this.basepath,t,y(e));navigate=async({from:t,to:a="",search:s,hash:r,replace:o,params:n})=>{const i=String(a),h=void 0===t?t:String(t);let c;try{new URL(`${i}`),c=!0}catch(t){}return e(!c),this.#n({from:h,to:i,search:s,hash:r,replace:o,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const a=this.buildNext(t),s=e?.pending?this.state.pendingLocation:this.state.currentLocation;if(!s)return!1;const r=L(this.basepath,s.pathname,{...e,to:a.pathname});return!!r&&(e?.includeSearch??1?!!f(s.search,a.search)&&r:r)};buildLink=({from:t,to:e=".",search:a,params:s,hash:r,target:o,replace:n,activeOptions:i,preload:h,preloadDelay:c,disabled:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const l={from:t,to:e,search:a,params:s,hash:r,replace:n},p=this.buildNext(l);h=h??this.options.defaultPreload;const d=c??this.options.defaultPreloadDelay??0,m=this.state.currentLocation.pathname.split("/"),y=p.pathname.split("/").every(((t,e)=>t===m[e])),g=i?.exact?this.state.currentLocation.pathname===p.pathname:y,v=!i?.includeHash||this.state.currentLocation.hash===p.hash,w=!(i?.includeSearch??1)||f(this.state.currentLocation.search,p.search);return{type:"internal",next:p,handleFocus:t=>{h&&this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},handleClick:t=>{u||function(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}(t)||t.defaultPrevented||o&&"_self"!==o||0!==t.button||(t.preventDefault(),this.#n(l))},handleEnter:t=>{const e=t.target||{};if(h){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))}),d)}},handleLeave:t=>{const e=t.target||{};e.preloadTimeout&&(clearTimeout(e.preloadTimeout),e.preloadTimeout=null)},handleTouchStart:t=>{this.preloadRoute(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&v&&w,disabled:u}};dehydrate=()=>({state:{...u(this.state,["latestLocation","currentLocation","status","lastUpdated"]),currentMatches:this.state.currentMatches.map((t=>({id:t.id,state:{status:t.state.status}})))}});hydrate=t=>{this.__store.setState((a=>{const s=this.matchRoutes(t.state.latestLocation.pathname,{strictParseParams:!0});return s.forEach(((a,s)=>{const r=t.state.currentMatches[s];e(r&&r.id===a.id),a.__store.setState((t=>({...t,...r.state})))})),{...a,...t.state,currentMatches:s}}))};#h=t=>{const e=t=>{t.forEach(((t,a)=>{t.init({originalIndex:a,router:this});if(this.routesById[t.id])throw new Error;this.routesById[t.id]=t;const s=t.children;s?.length&&(e(s),t.children=s.map(((t,e)=>{const a=S(g(y(t.path??"/")));for(;a.length>1&&"/"===a[0]?.value;)a.shift();let s=0;return a.forEach(((t,e)=>{let a=1;for(;e--;)a*=.001;"pathname"===t.type&&"/"!==t.value?s+=1*a:"param"===t.type?s+=2*a:"wildcard"===t.type&&(s+=3*a)})),{child:t,parsed:a,index:e,score:s}})).sort(((t,e)=>t.score!==e.score?t.score-e.score:t.index-e.index)).map((t=>t.child)))}))};return e([t]),t};#i=t=>{let{pathname:e,search:a,hash:s,state:r}=this.history.location;const o=this.options.parseSearch(a);return{pathname:e,searchStr:a,search:l(t?.search,o),hash:s.split("#").reverse()[0]??"",href:`${e}${a}${s}`,state:r,key:r?.key||"__init__"}};#c=(t={})=>{t.fromCurrent=t.fromCurrent??""===t.to;const e=t.fromCurrent?this.state.latestLocation.pathname:t.from??this.state.latestLocation.pathname;let a=_(this.basepath??"/",e,`${t.to??""}`);const s={...h(this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}))?.params};let r=!0===(t.params??!0)?s:c(t.params,s);r&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{r={...r,...t(r)}})),a=b(a,r??{});const o=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=o?.length?o?.reduce(((t,e)=>e(t)),this.state.latestLocation.search):this.state.latestLocation.search,u=!0===t.search?i:t.search?c(t.search,i)??{}:o?.length?i:{},p=n?.length?n.reduce(((t,e)=>e(t)),u):u,d=l(this.state.latestLocation.search,p),f=this.options.stringifySearch(d);let m=!0===t.hash?this.state.latestLocation.hash:c(t.hash,this.state.latestLocation.hash);m=m?`#${m}`:"";return{pathname:a,search:d,searchStr:f,state:!0===t.state?this.state.latestLocation.state:c(t.state,this.state.latestLocation.state),hash:m,href:this.history.createHref(`${a}${f}${m}`),key:t.key}};#n=async t=>{const e=this.buildNext(t),a=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let s="replace";t.replace||(s="push");this.state.latestLocation.href===e.href&&!e.key&&(s="replace");const r=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===s?"push":"replace"](r,{id:a,...e.state}),this.navigationPromise=new Promise((t=>{const e=this.resolveNavigation;this.resolveNavigation=()=>{e(),t()}}))}},t.cleanPath=y,t.createBrowserHistory=r,t.createHashHistory=function(){return r({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=o,t.decode=E,t.defaultFetchServerDataFn=H,t.defaultParseSearch=A,t.defaultStringifySearch=k,t.encode=x,t.functionalUpdate=c,t.interpolatePath=b,t.invariant=e,t.isPlainObject=p,t.isRedirect=N,t.joinPaths=m,t.last=h,t.matchByPath=P,t.matchPathname=L,t.parsePathname=S,t.parseSearchWith=T,t.partialDeepEqual=f,t.pick=u,t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=l,t.resolvePath=_,t.rootRouteId=M,t.stringifySearchWith=D,t.trimPath=w,t.trimPathLeft=g,t.trimPathRight=v,t.warning=function(t,e){},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/router",
"author": "Tanner Linsley",
"version": "0.0.1-beta.74",
"version": "0.0.1-beta.75",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": "tanstack/router",

@@ -25,2 +25,3 @@ import { GetFrameworkGeneric } from './frameworks'

export interface RouteMeta {}
export interface RouteContext {}

@@ -63,3 +64,3 @@ export type RouteOptionsBase<TCustomId, TPath> =

TAllParentContext extends AnyContext = AnyContext,
TRouteContext extends AnyContext = AnyContext,
TRouteContext extends RouteContext = AnyContext,
TContext extends AnyContext = TRouteContext,

@@ -66,0 +67,0 @@ > = RouteOptionsBase<TCustomId, TPath> &

@@ -41,3 +41,3 @@ import { Store } from '@tanstack/store'

router!: Router<TRoutesInfo['routeTree'], TRoutesInfo>
store!: Store<RouteMatchStore<TRoutesInfo, TRoute>>
__store!: Store<RouteMatchStore<TRoutesInfo, TRoute>>
state!: RouteMatchStore<TRoutesInfo, TRoute>

@@ -81,3 +81,3 @@ id!: string

params: opts.params,
store: new Store<RouteMatchStore<TRoutesInfo, TRoute>>(
__store: new Store<RouteMatchStore<TRoutesInfo, TRoute>>(
{

@@ -97,3 +97,3 @@ updatedAt: 0,

this.state = this.store.state
this.state = this.__store.state

@@ -109,3 +109,3 @@ componentTypes.map(async (type) => {

if (this.state.status === 'idle' && !this.#hasLoaders()) {
this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -130,3 +130,3 @@ status: 'success',

this.routeContext = routeContext
this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -226,3 +226,3 @@ routeSearch: replaceEqualDeep(s.routeSearch, routeSearch),

this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -259,3 +259,3 @@ status: 'error',

if (this.state.status === 'idle') {
this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -299,3 +299,3 @@ status: 'pending',

if ((latestPromise = checkLatest())) return await latestPromise
this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -313,3 +313,3 @@ error: undefined,

this.route.options.onError?.(err)
this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -316,0 +316,0 @@ error: err,

@@ -283,3 +283,3 @@ import { Store } from '@tanstack/store'

store: Store<RouterStore<TRoutesInfo>>
__store: Store<RouterStore<TRoutesInfo>>
state: RouterStore<TRoutesInfo>

@@ -299,8 +299,11 @@ startedLoadingAt = Date.now()

this.store = new Store<RouterStore<TRoutesInfo>>(getInitialRouterState(), {
onUpdate: (state) => {
this.state = state
this.__store = new Store<RouterStore<TRoutesInfo>>(
getInitialRouterState(),
{
onUpdate: (state) => {
this.state = state
},
},
})
this.state = this.store.state
)
this.state = this.__store.state
this.basepath = ''

@@ -326,3 +329,3 @@

reset = () => {
this.store.setState((s) => Object.assign(s, getInitialRouterState()))
this.__store.setState((s) => Object.assign(s, getInitialRouterState()))
}

@@ -359,3 +362,3 @@

this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -422,6 +425,6 @@ latestLocation: parsedLocation,

this.store.batch(() => {
this.__store.batch(() => {
if (opts?.next) {
// Ingest the new location
this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -437,3 +440,3 @@ latestLocation: opts.next!,

this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -485,3 +488,3 @@ status: 'pending',

if (d.state.status === 'error') {
this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -510,3 +513,3 @@ status: 'idle',

this.store.setState((s) => ({
this.__store.setState((s) => ({
...s,

@@ -964,3 +967,3 @@ status: 'idle',

hydrate = (dehydratedRouter: DehydratedRouter) => {
this.store.setState((s) => {
this.__store.setState((s) => {
// Match the routes

@@ -980,3 +983,3 @@ const currentMatches = this.matchRoutes(

)
match.store.setState((s) => ({
match.__store.setState((s) => ({
...s,

@@ -983,0 +986,0 @@ ...dehydratedMatch.state,

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 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 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