Socket
Socket
Sign inDemoInstall

@tanstack/router

Package Overview
Dependencies
Maintainers
2
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.93 to 0.0.1-beta.94

3

build/cjs/react.js

@@ -360,3 +360,4 @@ /**

useContext: props.match.route.useContext,
useSearch: props.match.route.useSearch
useSearch: props.match.route.useSearch,
useParams: props.match.route.useParams
});

@@ -363,0 +364,0 @@ }

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

}
const fullPath = id === rootRouteId ? '/' : path.trimPathRight(path.joinPaths([this.parentRoute.fullPath, path$1]));
const fullPath = id === rootRouteId ? '/' : path.joinPaths([this.parentRoute.fullPath, path$1]);
this.path = path$1;

@@ -97,2 +97,8 @@ this.id = id;

};
useParams = opts => {
return react.useParams({
...opts,
from: this.id
});
};
}

@@ -99,0 +105,0 @@ class RootRoute extends Route {

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

"name": "tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "8b81-49"
"uid": "612c-49"
},
{
"name": "tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"uid": "8b81-51"
"uid": "612c-51"
}

@@ -30,39 +30,39 @@ ]

{
"uid": "8b81-53",
"uid": "612c-53",
"name": "history.ts"
},
{
"uid": "8b81-55",
"uid": "612c-55",
"name": "utils.ts"
},
{
"uid": "8b81-57",
"uid": "612c-57",
"name": "path.ts"
},
{
"uid": "8b81-59",
"uid": "612c-59",
"name": "qss.ts"
},
{
"uid": "8b81-67",
"uid": "612c-67",
"name": "react.tsx"
},
{
"uid": "8b81-69",
"uid": "612c-69",
"name": "route.ts"
},
{
"uid": "8b81-71",
"uid": "612c-71",
"name": "searchParams.ts"
},
{
"uid": "8b81-73",
"uid": "612c-73",
"name": "router.ts"
},
{
"uid": "8b81-75",
"uid": "612c-75",
"name": "routeMatch.ts"
},
{
"uid": "8b81-77",
"uid": "612c-77",
"name": "index.ts"

@@ -74,7 +74,7 @@ }

"name": "store/build/esm/index.js",
"uid": "8b81-63"
"uid": "612c-63"
},
{
"name": "react-store/build/esm/index.js",
"uid": "8b81-65"
"uid": "612c-65"
}

@@ -84,3 +84,3 @@ ]

{
"uid": "8b81-61",
"uid": "612c-61",
"name": "\u0000rollupPluginBabelHelpers.js"

@@ -94,98 +94,98 @@ }

"nodeParts": {
"8b81-49": {
"612c-49": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "8b81-48"
"mainUid": "612c-48"
},
"8b81-51": {
"612c-51": {
"renderedLength": 48,
"gzipLength": 65,
"brotliLength": 0,
"mainUid": "8b81-50"
"mainUid": "612c-50"
},
"8b81-53": {
"612c-53": {
"renderedLength": 5664,
"gzipLength": 1407,
"brotliLength": 0,
"mainUid": "8b81-52"
"mainUid": "612c-52"
},
"8b81-55": {
"612c-55": {
"renderedLength": 2821,
"gzipLength": 990,
"brotliLength": 0,
"mainUid": "8b81-54"
"mainUid": "612c-54"
},
"8b81-57": {
"612c-57": {
"renderedLength": 5930,
"gzipLength": 1410,
"brotliLength": 0,
"mainUid": "8b81-56"
"mainUid": "612c-56"
},
"8b81-59": {
"612c-59": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "8b81-58"
"mainUid": "612c-58"
},
"8b81-61": {
"612c-61": {
"renderedLength": 457,
"gzipLength": 241,
"brotliLength": 0,
"mainUid": "8b81-60"
"mainUid": "612c-60"
},
"8b81-63": {
"612c-63": {
"renderedLength": 1436,
"gzipLength": 529,
"brotliLength": 0,
"mainUid": "8b81-62"
"mainUid": "612c-62"
},
"8b81-65": {
"612c-65": {
"renderedLength": 1042,
"gzipLength": 465,
"brotliLength": 0,
"mainUid": "8b81-64"
"mainUid": "612c-64"
},
"8b81-67": {
"renderedLength": 13949,
"gzipLength": 3352,
"612c-67": {
"renderedLength": 13999,
"gzipLength": 3361,
"brotliLength": 0,
"mainUid": "8b81-66"
"mainUid": "612c-66"
},
"8b81-69": {
"renderedLength": 3424,
"gzipLength": 897,
"612c-69": {
"renderedLength": 3528,
"gzipLength": 899,
"brotliLength": 0,
"mainUid": "8b81-68"
"mainUid": "612c-68"
},
"8b81-71": {
"612c-71": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "8b81-70"
"mainUid": "612c-70"
},
"8b81-73": {
"612c-73": {
"renderedLength": 30649,
"gzipLength": 7398,
"brotliLength": 0,
"mainUid": "8b81-72"
"mainUid": "612c-72"
},
"8b81-75": {
"612c-75": {
"renderedLength": 7564,
"gzipLength": 1752,
"brotliLength": 0,
"mainUid": "8b81-74"
"mainUid": "612c-74"
},
"8b81-77": {
"612c-77": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "8b81-76"
"mainUid": "612c-76"
}
},
"nodeMetas": {
"8b81-48": {
"612c-48": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "8b81-49"
"index.production.js": "612c-49"
},

@@ -195,19 +195,19 @@ "imported": [],

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-68"
"uid": "612c-68"
},
{
"uid": "8b81-72"
"uid": "612c-72"
},
{
"uid": "8b81-66"
"uid": "612c-66"
}
]
},
"8b81-50": {
"612c-50": {
"id": "/node_modules/.pnpm/tiny-warning@1.0.3/node_modules/tiny-warning/dist/tiny-warning.esm.js",
"moduleParts": {
"index.production.js": "8b81-51"
"index.production.js": "612c-51"
},

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

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-66"
"uid": "612c-66"
}
]
},
"8b81-52": {
"612c-52": {
"id": "/packages/router/src/history.ts",
"moduleParts": {
"index.production.js": "8b81-53"
"index.production.js": "612c-53"
},

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

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-72"
"uid": "612c-72"
}
]
},
"8b81-54": {
"612c-54": {
"id": "/packages/router/src/utils.ts",
"moduleParts": {
"index.production.js": "8b81-55"
"index.production.js": "612c-55"
},

@@ -249,26 +249,26 @@ "imported": [],

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-56"
"uid": "612c-56"
},
{
"uid": "8b81-74"
"uid": "612c-74"
},
{
"uid": "8b81-72"
"uid": "612c-72"
},
{
"uid": "8b81-66"
"uid": "612c-66"
}
]
},
"8b81-56": {
"612c-56": {
"id": "/packages/router/src/path.ts",
"moduleParts": {
"index.production.js": "8b81-57"
"index.production.js": "612c-57"
},
"imported": [
{
"uid": "8b81-54"
"uid": "612c-54"
}

@@ -278,16 +278,16 @@ ],

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-68"
"uid": "612c-68"
},
{
"uid": "8b81-72"
"uid": "612c-72"
}
]
},
"8b81-58": {
"612c-58": {
"id": "/packages/router/src/qss.ts",
"moduleParts": {
"index.production.js": "8b81-59"
"index.production.js": "612c-59"
},

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

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-70"
"uid": "612c-70"
}
]
},
"8b81-60": {
"612c-60": {
"id": "\u0000rollupPluginBabelHelpers.js",
"moduleParts": {
"index.production.js": "8b81-61"
"index.production.js": "612c-61"
},

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

{
"uid": "8b81-66"
"uid": "612c-66"
}
]
},
"8b81-62": {
"612c-62": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "8b81-63"
"index.production.js": "612c-63"
},

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

{
"uid": "8b81-64"
"uid": "612c-64"
}
]
},
"8b81-64": {
"612c-64": {
"id": "/packages/react-store/build/esm/index.js",
"moduleParts": {
"index.production.js": "8b81-65"
"index.production.js": "612c-65"
},
"imported": [
{
"uid": "8b81-81"
"uid": "612c-81"
},
{
"uid": "8b81-62"
"uid": "612c-62"
}

@@ -346,35 +346,35 @@ ],

{
"uid": "8b81-74"
"uid": "612c-74"
},
{
"uid": "8b81-72"
"uid": "612c-72"
},
{
"uid": "8b81-66"
"uid": "612c-66"
}
]
},
"8b81-66": {
"612c-66": {
"id": "/packages/router/src/react.tsx",
"moduleParts": {
"index.production.js": "8b81-67"
"index.production.js": "612c-67"
},
"imported": [
{
"uid": "8b81-60"
"uid": "612c-60"
},
{
"uid": "8b81-80"
"uid": "612c-80"
},
{
"uid": "8b81-64"
"uid": "612c-64"
},
{
"uid": "8b81-48"
"uid": "612c-48"
},
{
"uid": "8b81-50"
"uid": "612c-50"
},
{
"uid": "8b81-54"
"uid": "612c-54"
}

@@ -384,23 +384,23 @@ ],

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-68"
"uid": "612c-68"
}
]
},
"8b81-68": {
"612c-68": {
"id": "/packages/router/src/route.ts",
"moduleParts": {
"index.production.js": "8b81-69"
"index.production.js": "612c-69"
},
"imported": [
{
"uid": "8b81-48"
"uid": "612c-48"
},
{
"uid": "8b81-56"
"uid": "612c-56"
},
{
"uid": "8b81-66"
"uid": "612c-66"
}

@@ -410,14 +410,14 @@ ],

{
"uid": "8b81-76"
"uid": "612c-76"
}
]
},
"8b81-70": {
"612c-70": {
"id": "/packages/router/src/searchParams.ts",
"moduleParts": {
"index.production.js": "8b81-71"
"index.production.js": "612c-71"
},
"imported": [
{
"uid": "8b81-58"
"uid": "612c-58"
}

@@ -427,35 +427,35 @@ ],

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-72"
"uid": "612c-72"
}
]
},
"8b81-72": {
"612c-72": {
"id": "/packages/router/src/router.ts",
"moduleParts": {
"index.production.js": "8b81-73"
"index.production.js": "612c-73"
},
"imported": [
{
"uid": "8b81-64"
"uid": "612c-64"
},
{
"uid": "8b81-48"
"uid": "612c-48"
},
{
"uid": "8b81-56"
"uid": "612c-56"
},
{
"uid": "8b81-74"
"uid": "612c-74"
},
{
"uid": "8b81-70"
"uid": "612c-70"
},
{
"uid": "8b81-54"
"uid": "612c-54"
},
{
"uid": "8b81-52"
"uid": "612c-52"
}

@@ -465,23 +465,23 @@ ],

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-74"
"uid": "612c-74"
}
]
},
"8b81-74": {
"612c-74": {
"id": "/packages/router/src/routeMatch.ts",
"moduleParts": {
"index.production.js": "8b81-75"
"index.production.js": "612c-75"
},
"imported": [
{
"uid": "8b81-64"
"uid": "612c-64"
},
{
"uid": "8b81-72"
"uid": "612c-72"
},
{
"uid": "8b81-54"
"uid": "612c-54"
}

@@ -491,53 +491,53 @@ ],

{
"uid": "8b81-76"
"uid": "612c-76"
},
{
"uid": "8b81-72"
"uid": "612c-72"
}
]
},
"8b81-76": {
"612c-76": {
"id": "/packages/router/src/index.ts",
"moduleParts": {
"index.production.js": "8b81-77"
"index.production.js": "612c-77"
},
"imported": [
{
"uid": "8b81-48"
"uid": "612c-48"
},
{
"uid": "8b81-50"
"uid": "612c-50"
},
{
"uid": "8b81-52"
"uid": "612c-52"
},
{
"uid": "8b81-78"
"uid": "612c-78"
},
{
"uid": "8b81-56"
"uid": "612c-56"
},
{
"uid": "8b81-58"
"uid": "612c-58"
},
{
"uid": "8b81-68"
"uid": "612c-68"
},
{
"uid": "8b81-79"
"uid": "612c-79"
},
{
"uid": "8b81-74"
"uid": "612c-74"
},
{
"uid": "8b81-72"
"uid": "612c-72"
},
{
"uid": "8b81-70"
"uid": "612c-70"
},
{
"uid": "8b81-54"
"uid": "612c-54"
},
{
"uid": "8b81-66"
"uid": "612c-66"
}

@@ -548,3 +548,3 @@ ],

},
"8b81-78": {
"612c-78": {
"id": "/packages/router/src/link.ts",

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

{
"uid": "8b81-76"
"uid": "612c-76"
}
]
},
"8b81-79": {
"612c-79": {
"id": "/packages/router/src/routeInfo.ts",

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

{
"uid": "8b81-76"
"uid": "612c-76"
}
]
},
"8b81-80": {
"612c-80": {
"id": "react",

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

{
"uid": "8b81-66"
"uid": "612c-66"
}

@@ -583,3 +583,3 @@ ],

},
"8b81-81": {
"612c-81": {
"id": "use-sync-external-store/shim/with-selector",

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

{
"uid": "8b81-64"
"uid": "612c-64"
}

@@ -593,0 +593,0 @@ ],

@@ -87,3 +87,2 @@ import { AnyRoutesInfo, DefaultRoutesInfo, RouteByPath } from './routeInfo';

export type ResolveRelativePath<TFrom, TTo = '.'> = TFrom extends string ? TTo extends string ? TTo extends '.' ? TFrom : TTo extends `./` ? Join<[TFrom, '/']> : TTo extends `./${infer TRest}` ? ResolveRelativePath<TFrom, TRest> : TTo extends `/${infer TRest}` ? TTo : Split<TTo> extends ['..', ...infer ToRest] ? Split<TFrom> extends [...infer FromRest, infer FromTail] ? ToRest extends ['/'] ? Join<[...FromRest, '/']> : ResolveRelativePath<Join<FromRest>, Join<ToRest>> : never : Split<TTo> extends ['.', ...infer ToRest] ? ToRest extends ['/'] ? Join<[TFrom, '/']> : ResolveRelativePath<TFrom, Join<ToRest>> : CleanPath<Join<['/', ...Split<TFrom>, ...Split<TTo>]>> : never : never;
export type ValidFromPath<TRoutesInfo extends AnyRoutesInfo = DefaultRoutesInfo> = undefined | (string extends TRoutesInfo['routePaths'] ? string : TRoutesInfo['routePaths']);
export {};
import * as React from 'react';
import { NoInfer, useStore } from '@tanstack/react-store';
import { LinkOptions, ToOptions, ResolveRelativePath, ValidFromPath, NavigateOptions } from './link';
import { LinkOptions, ToOptions, ResolveRelativePath, NavigateOptions } from './link';
import { AnyRoute } from './route';

@@ -23,3 +23,3 @@ import { RouteByPath, AnyRoutesInfo, DefaultRoutesInfo } from './routeInfo';

};
export type MakeLinkPropsOptions<TFrom extends ValidFromPath<RegisteredRoutesInfo> = '/', TTo extends string = ''> = LinkPropsOptions<TFrom, TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
export type MakeLinkPropsOptions<TFrom extends string = '/', TTo extends string = ''> = LinkPropsOptions<TFrom, TTo> & React.AnchorHTMLAttributes<HTMLAnchorElement>;
export type MakeLinkOptions<TFrom extends RegisteredRoutesInfo['routePaths'] = '/', TTo extends string = ''> = LinkPropsOptions<TFrom, TTo> & Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {

@@ -35,3 +35,3 @@ children?: React.ReactNode | ((state: {

};
export declare function useLinkProps<TFrom extends ValidFromPath<RegisteredRoutesInfo> = '/', TTo extends string = ''>(options: MakeLinkPropsOptions<TFrom, TTo>): React.AnchorHTMLAttributes<HTMLAnchorElement>;
export declare function useLinkProps<TFrom extends string = '/', TTo extends string = ''>(options: MakeLinkPropsOptions<TFrom, TTo>): React.AnchorHTMLAttributes<HTMLAnchorElement>;
export interface LinkFn<TDefaultFrom extends RegisteredRoutesInfo['routePaths'] = '/', TDefaultTo extends string = ''> {

@@ -81,4 +81,4 @@ <TFrom extends RegisteredRoutesInfo['routePaths'] = TDefaultFrom, TTo extends string = TDefaultTo>(props: MakeLinkOptions<TFrom, TTo> & React.RefAttributes<HTMLAnchorElement>): ReactNode;

}): <TFrom extends string = TDefaultFrom, TTo extends string = "">(opts?: MakeLinkOptions<TFrom, TTo> | undefined) => Promise<void>;
export declare function useMatchRoute(): <TFrom extends ValidFromPath<AnyRoutesInfo> = "/", TTo extends string = "">(opts: MakeUseMatchRouteOptions<TFrom, TTo>) => any;
export declare function MatchRoute<TFrom extends ValidFromPath<RegisteredRoutesInfo> = '/', TTo extends string = ''>(props: MakeMatchRouteOptions<TFrom, TTo>): any;
export declare function useMatchRoute(): <TFrom extends string = "/", TTo extends string = "">(opts: MakeUseMatchRouteOptions<TFrom, TTo>) => any;
export declare function MatchRoute<TFrom extends string = '/', TTo extends string = ''>(props: MakeMatchRouteOptions<TFrom, TTo>): any;
export declare function Outlet(): JSX.Element | null;

@@ -85,0 +85,0 @@ export declare function ErrorComponent({ error }: {

@@ -190,2 +190,6 @@ import { ParsePathParams } from './link';

} | undefined) => TStrict extends true ? TSelected : TSelected | undefined;
useParams: <TStrict extends boolean = true, TSelected = TAllParams>(opts?: {
strict?: TStrict | undefined;
track?: ((search: TAllParams) => TSelected) | undefined;
} | undefined) => TStrict extends true ? TSelected : TSelected | undefined;
}

@@ -197,7 +201,7 @@ export type AnyRootRoute = RootRoute<any, any, any, any>;

}
type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed extends RoutePrefix<TParentRoute['fullPath'], TPath> = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : TrimPathRight<`${TPrefixed}`>;
type ResolveFullPath<TParentRoute extends AnyRoute, TPath extends string, TPrefixed extends RoutePrefix<TParentRoute['fullPath'], TPath> = RoutePrefix<TParentRoute['fullPath'], TPath>> = TPrefixed extends RootRouteId ? '/' : `${TPrefixed}`;
type RoutePrefix<TPrefix extends string, TId extends string> = string extends TId ? RootRouteId : TId extends string ? TPrefix extends RootRouteId ? TId extends '/' ? '/' : `/${TrimPath<TId>}` : `${TPrefix}/${TId}` extends '/' ? '/' : `/${TrimPathLeft<`${TrimPathRight<TPrefix>}/${TrimPath<TId>}`>}` : never;
type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
export type TrimPath<T extends string> = '' extends T ? '' : TrimPathRight<TrimPathLeft<T>>;
export type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}` ? TrimPathLeft<U> : T extends `/${infer U}` ? TrimPathLeft<U> : T;
export type TrimPathRight<T extends string> = T extends '/' ? '/' : T extends `${infer U}/` ? TrimPathRight<U> : T;
export {};

@@ -35,3 +35,3 @@ import { AnyRoute, Route } from './route';

} & {
[TRoute in TRouteUnion as TRoute['fullPath'] extends RootRouteId ? never : string extends TRoute['fullPath'] ? never : TRoute['fullPath']]: TRoute;
[TRoute in TRouteUnion as TRoute['fullPath'] extends RootRouteId ? never : string extends TRoute['fullPath'] ? never : `${TRoute['fullPath']}/` extends keyof TRoutesById ? never : TRoute['fullPath'] extends `${infer Trimmed}/` ? Trimmed : TRoute['fullPath']]: TRoute;
}> {

@@ -38,0 +38,0 @@ routeTree: TRouteTree;

@@ -37,2 +37,3 @@ import { Store } from '@tanstack/react-store';

useSearch: TRoute['useSearch'];
useParams: TRoute['useParams'];
}>;

@@ -39,0 +40,0 @@ errorComponent?: RouteComponent<{

/// <reference types="react" />
import { Store } from '@tanstack/react-store';
import { LinkInfo, LinkOptions, NavigateOptions, ToOptions, ValidFromPath, ResolveRelativePath } from './link';
import { LinkInfo, LinkOptions, NavigateOptions, ToOptions, ResolveRelativePath } from './link';
import { AnySearchSchema, AnyRoute, RootRoute, AnyContext } from './route';

@@ -173,5 +173,5 @@ import { RoutesInfo, AnyRoutesInfo, RoutesById } from './routeInfo';

resolvePath: (from: string, path: string) => string;
navigate: <TFrom extends ValidFromPath<TRoutesInfo> = "/", TTo extends string = "">({ from, to, search, hash, replace, params, }: NavigateOptions<TRoutesInfo, TFrom, TTo>) => Promise<void>;
matchRoute: <TFrom extends ValidFromPath<TRoutesInfo> = "/", TTo extends string = "", TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRoutesInfo, TFrom, TTo, ResolveRelativePath<TFrom, NoInfer<TTo>>>, opts?: MatchRouteOptions) => false | TRoutesInfo["routesById"][TResolved]["__types"]["allParams"];
buildLink: <TFrom extends ValidFromPath<TRoutesInfo> = "/", TTo extends string = "">({ from, to, search, params, hash, target, replace, activeOptions, preload, preloadDelay: userPreloadDelay, disabled, }: LinkOptions<TRoutesInfo, TFrom, TTo>) => LinkInfo;
navigate: <TFrom extends string = "/", TTo extends string = "">({ from, to, search, hash, replace, params, }: NavigateOptions<TRoutesInfo, TFrom, TTo>) => Promise<void>;
matchRoute: <TFrom extends string = "/", TTo extends string = "", TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>>(location: ToOptions<TRoutesInfo, TFrom, TTo, ResolveRelativePath<TFrom, NoInfer<TTo>>>, opts?: MatchRouteOptions) => false | TRoutesInfo["routesById"][TResolved]["__types"]["allParams"];
buildLink: <TFrom extends string = "/", TTo extends string = "">({ from, to, search, params, hash, target, replace, activeOptions, preload, preloadDelay: userPreloadDelay, disabled, }: LinkOptions<TRoutesInfo, TFrom, TTo>) => LinkInfo;
}

@@ -178,0 +178,0 @@ export type AnyRedirect = Redirect<any, any, any>;

@@ -31,3 +31,3 @@ /**

* @license MIT
*/function T(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,N)}function N(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function H(t){const e=z(),{type:r,children:o,target:s,activeProps:n=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:u,search:l,params:d,to:p=".",preload:f,preloadDelay:m,replace:g,style:v,className:_,onClick:w,onFocus:b,onMouseEnter:S,onMouseLeave:L,onTouchStart:E,...x}=t,P=e.buildLink(t);if("external"===P.type){const{href:t}=P;return{href:t}}const{handleClick:C,handleFocus:R,handleEnter:M,handleLeave:k,handleTouchStart:O,isActive:j,next:A}=P,I=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},$=j?y(n,{})??{}:{},D=j?{}:y(i,{})??{};return{...$,...D,...x,href:h?void 0:A.href,onClick:I([w,t=>{a.startTransition?a.startTransition((()=>{C(t)})):C(t)}]),onFocus:I([b,R]),onMouseEnter:I([S,M]),onMouseLeave:I([L,k]),onTouchStart:I([E,O]),target:s,style:{...v,...$.style,...D.style},className:[_,$.className,D.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":j?"active":void 0}}const B=a.forwardRef(((t,e)=>{const r=H(t);return a.createElement("a",$({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const F=a.createContext(null),U=a.createContext(null);function z(){const t=a.useContext(U);return T(t.router.__store),t.router}function W(t){const e=z();return T(e.__store,t),e}function q(){return a.useContext(F)}function K(t){const e=z(),r=q()[0],o=t?.from?e.state.currentMatches.find((e=>e.route.id===t?.from)):r;return s(o,t?.from&&t.from),(t?.strict??1)&&s(r.route.id==o?.route.id,(o?.route.id,r.route.id,o?.route.id,o?.route.id)),T(o.__store,(e=>t?.track?.(o)??o)),o}function V(t){const{track:e,...r}=t,o=K(r);return T(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function J(t){const{track:e,...r}=t??{},o=K(r);return T(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function G(){const t=z();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function Y(){const t=q().slice(1),e=t[0];return e?a.createElement(Q,{matches:t,match:e}):null}function Q({matches:t,match:e}){const r=z();T(e.__store,(t=>[t.status,t.error]));const o=a.useCallback((()=>null),[]),s=e.pendingComponent??r.options.defaultPendingComponent??o,n=e.errorComponent??r.options.defaultErrorComponent,i=e.route.options.wrapInSuspense??1?a.Suspense:Z,c=n?tt:Z;return a.createElement(F.Provider,{value:t},a.createElement(i,{fallback:a.createElement(s,null)},a.createElement(c,{key:e.route.id,errorComponent:n,onCatch:()=>{e.id}},a.createElement(X,{match:e}))))}function X(t){const e=z();if("error"===t.match.state.status)throw t.match.state.error;if("pending"===t.match.state.status)throw t.match.__loadPromise;if("success"===t.match.state.status)return a.createElement(t.match.component??e.options.defaultComponent??Y,{useLoader:t.match.route.useLoader,useMatch:t.match.route.useMatch,useContext:t.match.route.useContext,useSearch:t.match.route.useSearch});s(!1)}function Z(t){return a.createElement(a.Fragment,null,t.children)}class tt extends a.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),console.error(t),this.setState({error:t,info:e})}render(){return a.createElement(et,$({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function et(t){const[e,r]=a.useState(t.errorState),o=z(),s=t.errorComponent??rt,n=a.useRef("");return a.useEffect((()=>{e&&o.state.currentLocation.key!==n.current&&r({}),n.current=o.state.currentLocation.key}),[e,o.state.currentLocation.key]),a.useEffect((()=>{t.errorState.error&&r(t.errorState)}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function rt({error:t}){return a.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},a.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),a.createElement("div",{style:{height:".5rem"}}),a.createElement("div",null,a.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red",overflow:"auto"}},t.message?a.createElement("code",null,t.message):null)))}function ot(t,e=!0){const r=W();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)?(o(),e()):r()}));return o}))}const at="__root__";class st{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=at:s(this.parentRoute);let o=r?at:e.path;o&&"/"!==o&&(o=P(o));const a=e?.id||o;let n=r?at:S([this.parentRoute.id===at?"":this.parentRoute.id,a]);o===at&&(o="/"),n!==at&&(n=S(["/",n]));const i=n===at?"/":x(S([this.parentRoute.fullPath,o]));this.path=o,this.id=n,this.fullPath=i};addChildren=t=>(this.children=t,this);useMatch=t=>K({...t,from:this.id});useLoader=t=>V({...t,from:this.id});useContext=t=>K({...t,from:this.id}).context;useSearch=t=>J({...t,from:this.id})}class nt extends st{constructor(t){super(t)}static withRouterContext=()=>t=>new nt(t)}const it=ht(JSON.parse),ct=ut(JSON.stringify);function ht(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=I(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function ut(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=j(e).toString();return r?`?${r}`:""}}const lt=async({router:t,routeMatch:e})=>{const r=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),o=await fetch(r.href,{method:"GET",signal:e.abortController.signal});if(o.ok)return o.json();throw new Error("Failed to fetch match data")};const dt="undefined"==typeof window||!window.document.createElement;function pt(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],lastUpdated:Date.now()}}function ft(t){return!!t?.isRedirect}const mt=["component","errorComponent","pendingComponent"];class gt{abortController=new AbortController;constructor(t,e,r){Object.assign(this,{route:e,router:t,id:r.id,pathname:r.pathname,params:r.params,__store:new D({updatedAt:0,routeSearch:{},search:{},status:"idle",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,mt.map((async t=>{const e=this.route.options[t];this[t]=e})),"idle"!==this.state.status||this.#t()||this.__store.setState((t=>({...t,status:"success"})))}#t=()=>!(!this.route.options.loader&&!mt.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:r,routeContext:o}=this.#e({location:this.router.state.currentLocation});this.context=r,this.routeContext=o,this.__store.setState((r=>({...r,routeSearch:v(r.routeSearch,t),search:v(r.search,e)})))};cancel=()=>{this.abortController?.abort()};#r=t=>{const e=this.parentMatch?this.parentMatch.#r(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(ft(t))throw t;(this.route.options.onValidateSearchError??this.route.options.onError)?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#e=t=>{const{search:e,routeSearch:r}=this.#r(t);try{const t=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:r,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...t},routeContext:t}}catch(t){throw this.route.options.onError?.(t),t}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#e(t)}catch(e){return ft(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,status:"error",error:e})))}const{routeSearch:r,search:o,context:a,routeContext:s}=e;if("pending"!==this.state.status)return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#o=e;const n=()=>e!==this.#o?this.__loadPromise:void 0;let i;"idle"===this.state.status&&this.__store.setState((t=>({...t,status:"pending"})));const c=(async()=>{await Promise.all(mt.map((async t=>{const e=this.route.options[t];e?.preload&&await e.preload()})))})(),h=Promise.resolve().then((()=>{if(this.route.options.loader)return this.route.options.loader({params:this.params,routeSearch:r,search:o,signal:this.abortController.signal,preload:!!t?.preload,routeContext:s,context:a})}));try{const[t,e]=await Promise.all([c,h]);if(i=n())return await i;this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:e})))}catch(e){if(ft(e))return void(t?.preload||this.router.navigate(e));const r=this.route.options.onLoadError??this.route.options.onError;try{r?.(e)}catch(e){return ft(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}finally{delete this.__loadPromise}})),this.__loadPromise};#o=""}t.Block=function({message:t,condition:e,children:r}){return ot(t,e),r??null},t.ErrorComponent=rt,t.Link=B,t.MatchRoute=function(t){const e=G()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=z();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=Y,t.RootRoute=nt,t.Route=st,t.RouteMatch=gt,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??ct,parseSearch:t?.parseSearch??it,fetchServerDataFn:t?.fetchServerDataFn??lt},this.__store=new D(pt(),{onUpdate:()=>{this.state=this.__store.state}}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.latestLocation.href!==e.href&&this.#s({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,pt())))};mount=()=>(dt||this.state.currentMatches.length||this.safeLoad(),()=>{});hydrate=async t=>{let e=t;return"undefined"!=typeof document&&(e=window.__DEHYDRATED__,s(e)),this.options.hydrate?.(e),await this.load()};update=t=>{if(Object.assign(this.options,t),this.context=this.options.context,!this.history||this.options.history&&this.options.history!==this.history){this.#a&&this.#a(),this.history=this.options.history??(dt?p():d());const t=this.#n();this.__store.setState((e=>({...e,latestLocation:t,currentLocation:t}))),this.#a=this.history.listen((()=>{this.safeLoad({next:this.#n(this.state.latestLocation)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${P(e??"")??""}`,r&&(this.routesById={},this.routeTree=this.#i(r)),this};buildNext=t=>{const e=this.#c(t),r=this.matchRoutes(e.pathname);return this.#c({...t,__matches:r})};cancelMatches=()=>{[...this.state.currentMatches,...this.state.pendingMatches||[]].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),s(!1)}))};load=async t=>{let e=Date.now();const r=e;let o;if(this.startedLoadingAt=r,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,latestLocation:t.next}))),o=this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatches:o,pendingLocation:this.state.latestLocation})))})),await this.loadMatches(o,this.state.pendingLocation),this.startedLoadingAt!==r)return this.navigationPromise;const a=this.state.currentMatches,s=[],n=[];a.forEach((t=>{o.find((e=>e.id===t.id))?n.push(t):s.push(t)}));const i=o.filter((t=>!a.find((e=>e.id===t.id))));e=Date.now(),s.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 c=this.state.currentLocation;this.__store.setState((t=>({...t,status:"idle",currentLocation:this.state.latestLocation,currentMatches:o,pendingLocation:void 0,pendingMatches:void 0}))),o.forEach((t=>{t.__commit()})),c.href!==this.state.currentLocation.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};loadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e),r};preloadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e,{preload:!0}),r};matchRoutes=(t,e)=>{if(!this.routeTree)return[];const r=[...this.state.currentMatches,...this.state.pendingMatches??[]];let o=[];const a=r=>{let s;if(r.some((r=>{const n=r.children;if(!r.path){if(n?.length){o.push({route:r});const t=a(n);return t?(s=t,!0):(o.pop(),!1)}return!1}const i="/"!==r.path||!!n?.length,c=k(this.basepath,t,{to:r.fullPath,fuzzy:i,caseSensitive:r.options.caseSensitive??this.options.caseSensitive});if(c){let t;try{t=r.options.parseParams?.(c)??c}catch(t){if(e?.strictParseParams)throw t}return o.push({route:r,params:t}),s=r,!0}return!1})),!s)return;const n=s.children;return n?.length?a(n):s};a([this.routeTree]);let s={};return o.map((({route:t,params:e})=>{Object.assign(s,e);const o=M(t.path,e),a=M(t.id,e,!0);return r.find((t=>t.id===a))||new gt(this,t,{id:a,params:s,pathname:S([this.basepath,o])})}))};loadMatches=async(t,e,r)=>{let o;try{await Promise.all(t.map((async(t,e)=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(r){if(ft(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(ft(e))throw e;return void t.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}t.__store.setState((t=>({...t,error:r,status:"error",updatedAt:Date.now()})))}})))}catch(t){if(ft(t))return void(r?.preload||this.navigate(t));throw t}const a=t.slice(0,o),s=a.map((async(t,o)=>{const s=a[o-1];t.__load({preload:r?.preload,location:e,parentMatch:s}),await t.__loadPromise,s&&await s.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>C(this.basepath,t,L(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:a,params:n})=>{const i=String(e),c=void 0===t?t:String(t);let h;try{new URL(`${i}`),h=!0}catch(t){}return s(!h),this.#s({from:c,to:i,search:r,hash:o,replace:a,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t),o=e?.pending?this.state.pendingLocation:this.state.currentLocation;if(!o)return!1;const a=k(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!b(o.search,r.search)&&a:a)};buildLink=({from:t,to:e=".",search:r,params:o,hash:a,target:s,replace:n,activeOptions:i,preload:c,preloadDelay:h,disabled:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const l={from:t,to:e,search:r,params:o,hash:a,replace:n},d=this.buildNext(l);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.currentLocation.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),g=i?.exact?this.state.currentLocation.pathname===d.pathname:m,y=!i?.includeHash||this.state.currentLocation.hash===d.hash,v=!(i?.includeSearch??1)||b(this.state.currentLocation.search,d.search);return{type:"internal",next:d,handleFocus:t=>{c&&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||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#s(l))},handleEnter:t=>{const e=t.target||{};if(c){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(l).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(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&y&&v,disabled:u}};#i=t=>{const e=(t,r)=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t;const o=t.children;o?.length&&(e(o),o.length,t.children=o.map(((t,e)=>{const r=E(L(t.path??"/")),o=R(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const a=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,cleaned:r,parsed:o,index:e,score:a}})).sort(((t,e)=>{const r=Math.min(t.score.length,e.score.length);for(let o=0;o<r;o++)if(t.score[o]!==e.score[o])return e.score[o]-t.score[o];for(let o=0;o<r;o++)if(t.parsed[o].value!==e.parsed[o].value)return t.parsed[o].value>e.parsed[o].value?1:-1;return t.score.length!==e.score.length?e.score.length-t.score.length:t.cleaned!==e.cleaned?t.cleaned>e.cleaned?1:-1:t.index-e.index})).map((t=>t.child)))}))};e([t]);const r=(t,e)=>{t.forEach((t=>{t.isRoot?s(!e):s(!e||t.parentRoute===e,(t.path,t.parentRoute?.id,e?.id)),t.children&&r(t.children,t)}))};return r([t],void 0),t};#n=t=>{let{pathname:e,search:r,hash:o,state:a}=this.history.location;const s=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:v(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:a,key:a?.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 r=C(this.basepath??"/",e,`${t.to??""}`);const o={...g(this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}))?.params};let a=!0===(t.params??!0)?o:y(t.params,o);a&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),r=M(r,a??{});const s=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.latestLocation.search):this.state.latestLocation.search,c=!0===t.search?i:t.search?y(t.search,i)??{}:s?.length?i:{},h=n?.length?n.reduce(((t,e)=>e(t)),c):c,u=v(this.state.latestLocation.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.latestLocation.hash:y(t.hash,this.state.latestLocation.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.latestLocation.state:y(t.state,this.state.latestLocation.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#s=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.latestLocation.href===e.href&&!e.key&&(o="replace");const a=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](a,{id:r,...e.state}),this.navigationPromise=new Promise((t=>{const e=this.resolveNavigation;this.resolveNavigation=()=>{e(),t()}}))}},t.RouterProvider=function({router:t,...e}){t.update(e);const r=T(t.__store,(t=>t.currentMatches));return a.useEffect(t.mount,[t]),a.createElement(U.Provider,{value:{router:t}},a.createElement(F.Provider,{value:[void 0,...r]},a.createElement(tt,{errorComponent:rt,onCatch:()=>{}},a.createElement(Y,null))))},t.cleanPath=L,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=I,t.defaultFetchServerDataFn=lt,t.defaultParseSearch=it,t.defaultStringifySearch=ct,t.encode=j,t.functionalUpdate=y,t.interpolatePath=M,t.invariant=s,t.isPlainObject=_,t.isRedirect=ft,t.joinPaths=S,t.last=g,t.lazy=function(t,e="default"){const r=a.lazy((async()=>({default:(await t())[e]})));return r.preload=async()=>{await t()},r},t.matchByPath=O,t.matchPathname=k,t.matchesContext=F,t.parsePathname=R,t.parseSearchWith=ht,t.partialDeepEqual=b,t.pick=function(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})},t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=v,t.resolvePath=C,t.rootRouteId=at,t.routerContext=U,t.stringifySearchWith=ut,t.trimPath=P,t.trimPathLeft=E,t.trimPathRight=x,t.useBlocker=ot,t.useLinkProps=H,t.useLoader=V,t.useMatch=K,t.useMatchRoute=G,t.useMatches=q,t.useNavigate=function(t){const e=z();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=function(t){const e=z();return T(e.__store,(e=>{const r=g(e.currentMatches)?.params;return t?.track?.(r)??r})),g(e.state.currentMatches)?.params},t.useRouter=W,t.useRouterContext=z,t.useSearch=J,t.useStore=T,t.warning=n,Object.defineProperty(t,"__esModule",{value:!0})}));
*/function T(t,e=(t=>t)){return r.useSyncExternalStoreWithSelector(t.subscribe,(()=>t.state),(()=>t.state),e,N)}function N(t,e){if(Object.is(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;const r=Object.keys(t);if(r.length!==Object.keys(e).length)return!1;for(let o=0;o<r.length;o++)if(!Object.prototype.hasOwnProperty.call(e,r[o])||!Object.is(t[r[o]],e[r[o]]))return!1;return!0}function H(t){const e=z(),{type:r,children:o,target:s,activeProps:n=(()=>({className:"active"})),inactiveProps:i=(()=>({})),activeOptions:c,disabled:h,hash:u,search:l,params:d,to:p=".",preload:f,preloadDelay:m,replace:g,style:v,className:_,onClick:w,onFocus:b,onMouseEnter:S,onMouseLeave:L,onTouchStart:E,...x}=t,P=e.buildLink(t);if("external"===P.type){const{href:t}=P;return{href:t}}const{handleClick:C,handleFocus:R,handleEnter:M,handleLeave:k,handleTouchStart:O,isActive:j,next:A}=P,I=t=>e=>{e.persist&&e.persist(),t.filter(Boolean).forEach((t=>{e.defaultPrevented||t(e)}))},$=j?y(n,{})??{}:{},D=j?{}:y(i,{})??{};return{...$,...D,...x,href:h?void 0:A.href,onClick:I([w,t=>{a.startTransition?a.startTransition((()=>{C(t)})):C(t)}]),onFocus:I([b,R]),onMouseEnter:I([S,M]),onMouseLeave:I([L,k]),onTouchStart:I([E,O]),target:s,style:{...v,...$.style,...D.style},className:[_,$.className,D.className].filter(Boolean).join(" ")||void 0,...h?{role:"link","aria-disabled":!0}:void 0,"data-status":j?"active":void 0}}const B=a.forwardRef(((t,e)=>{const r=H(t);return a.createElement("a",$({ref:e},r,{children:"function"==typeof t.children?t.children({isActive:"active"===r["data-status"]}):t.children}))}));const F=a.createContext(null),U=a.createContext(null);function z(){const t=a.useContext(U);return T(t.router.__store),t.router}function W(t){const e=z();return T(e.__store,t),e}function q(){return a.useContext(F)}function K(t){const e=z(),r=q()[0],o=t?.from?e.state.currentMatches.find((e=>e.route.id===t?.from)):r;return s(o,t?.from&&t.from),(t?.strict??1)&&s(r.route.id==o?.route.id,(o?.route.id,r.route.id,o?.route.id,o?.route.id)),T(o.__store,(e=>t?.track?.(o)??o)),o}function V(t){const{track:e,...r}=t,o=K(r);return T(o.__store,(e=>t?.track?.(e.loader)??e.loader)),o.state.loader}function J(t){const{track:e,...r}=t??{},o=K(r);return T(o.__store,(e=>t?.track?.(e.search)??e.search)),o.state.search}function G(t){const e=z();return T(e.__store,(e=>{const r=g(e.currentMatches)?.params;return t?.track?.(r)??r})),g(e.state.currentMatches)?.params}function Y(){const t=z();return a.useCallback((e=>{const{pending:r,caseSensitive:o,...a}=e;return t.matchRoute(a,{pending:r,caseSensitive:o})}),[])}function Q(){const t=q().slice(1),e=t[0];return e?a.createElement(X,{matches:t,match:e}):null}function X({matches:t,match:e}){const r=z();T(e.__store,(t=>[t.status,t.error]));const o=a.useCallback((()=>null),[]),s=e.pendingComponent??r.options.defaultPendingComponent??o,n=e.errorComponent??r.options.defaultErrorComponent,i=e.route.options.wrapInSuspense??1?a.Suspense:tt,c=n?et:tt;return a.createElement(F.Provider,{value:t},a.createElement(i,{fallback:a.createElement(s,null)},a.createElement(c,{key:e.route.id,errorComponent:n,onCatch:()=>{e.id}},a.createElement(Z,{match:e}))))}function Z(t){const e=z();if("error"===t.match.state.status)throw t.match.state.error;if("pending"===t.match.state.status)throw t.match.__loadPromise;if("success"===t.match.state.status)return a.createElement(t.match.component??e.options.defaultComponent??Q,{useLoader:t.match.route.useLoader,useMatch:t.match.route.useMatch,useContext:t.match.route.useContext,useSearch:t.match.route.useSearch,useParams:t.match.route.useParams});s(!1)}function tt(t){return a.createElement(a.Fragment,null,t.children)}class et extends a.Component{state={error:!1,info:void 0};componentDidCatch(t,e){this.props.onCatch(t,e),console.error(t),this.setState({error:t,info:e})}render(){return a.createElement(rt,$({},this.props,{errorState:this.state,reset:()=>this.setState({})}))}}function rt(t){const[e,r]=a.useState(t.errorState),o=z(),s=t.errorComponent??ot,n=a.useRef("");return a.useEffect((()=>{e&&o.state.currentLocation.key!==n.current&&r({}),n.current=o.state.currentLocation.key}),[e,o.state.currentLocation.key]),a.useEffect((()=>{t.errorState.error&&r(t.errorState)}),[t.errorState.error]),t.errorState.error&&e.error?a.createElement(s,e):t.children}function ot({error:t}){return a.createElement("div",{style:{padding:".5rem",maxWidth:"100%"}},a.createElement("strong",{style:{fontSize:"1.2rem"}},"Something went wrong!"),a.createElement("div",{style:{height:".5rem"}}),a.createElement("div",null,a.createElement("pre",{style:{fontSize:".7em",border:"1px solid red",borderRadius:".25rem",padding:".5rem",color:"red",overflow:"auto"}},t.message?a.createElement("code",null,t.message):null)))}function at(t,e=!0){const r=W();a.useEffect((()=>{if(!e)return;let o=r.history.block(((e,r)=>{window.confirm(t)?(o(),e()):r()}));return o}))}const st="__root__";class nt{constructor(t){this.options=t||{},this.isRoot=!t?.getParentRoute}init=t=>{this.originalIndex=t.originalIndex,this.router=t.router;const e=this.options,r=!e?.path&&!e?.id;this.parentRoute=this.options?.getParentRoute?.(),r?this.path=st:s(this.parentRoute);let o=r?st:e.path;o&&"/"!==o&&(o=P(o));const a=e?.id||o;let n=r?st:S([this.parentRoute.id===st?"":this.parentRoute.id,a]);o===st&&(o="/"),n!==st&&(n=S(["/",n]));const i=n===st?"/":S([this.parentRoute.fullPath,o]);this.path=o,this.id=n,this.fullPath=i};addChildren=t=>(this.children=t,this);useMatch=t=>K({...t,from:this.id});useLoader=t=>V({...t,from:this.id});useContext=t=>K({...t,from:this.id}).context;useSearch=t=>J({...t,from:this.id});useParams=t=>G({...t,from:this.id})}class it extends nt{constructor(t){super(t)}static withRouterContext=()=>t=>new it(t)}const ct=ut(JSON.parse),ht=lt(JSON.stringify);function ut(t){return e=>{"?"===e.substring(0,1)&&(e=e.substring(1));let r=I(e);for(let e in r){const o=r[e];if("string"==typeof o)try{r[e]=t(o)}catch(t){}}return r}}function lt(t){return e=>{(e={...e})&&Object.keys(e).forEach((r=>{const o=e[r];if(void 0===o||void 0===o)delete e[r];else if(o&&"object"==typeof o&&null!==o)try{e[r]=t(o)}catch(t){}}));const r=j(e).toString();return r?`?${r}`:""}}const dt=async({router:t,routeMatch:e})=>{const r=t.buildNext({to:".",search:t=>({...t??{},__data:{matchId:e.id}})}),o=await fetch(r.href,{method:"GET",signal:e.abortController.signal});if(o.ok)return o.json();throw new Error("Failed to fetch match data")};const pt="undefined"==typeof window||!window.document.createElement;function ft(){return{status:"idle",latestLocation:null,currentLocation:null,currentMatches:[],lastUpdated:Date.now()}}function mt(t){return!!t?.isRedirect}const gt=["component","errorComponent","pendingComponent"];class yt{abortController=new AbortController;constructor(t,e,r){Object.assign(this,{route:e,router:t,id:r.id,pathname:r.pathname,params:r.params,__store:new D({updatedAt:0,routeSearch:{},search:{},status:"idle",loader:void 0},{onUpdate:()=>{this.state=this.__store.state}})}),this.state=this.__store.state,gt.map((async t=>{const e=this.route.options[t];this[t]=e})),"idle"!==this.state.status||this.#t()||this.__store.setState((t=>({...t,status:"success"})))}#t=()=>!(!this.route.options.loader&&!gt.some((t=>this.route.options[t]?.preload)));__commit=()=>{const{routeSearch:t,search:e,context:r,routeContext:o}=this.#e({location:this.router.state.currentLocation});this.context=r,this.routeContext=o,this.__store.setState((r=>({...r,routeSearch:v(r.routeSearch,t),search:v(r.search,e)})))};cancel=()=>{this.abortController?.abort()};#r=t=>{const e=this.parentMatch?this.parentMatch.#r(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(mt(t))throw t;(this.route.options.onValidateSearchError??this.route.options.onError)?.(t);const e=new Error("Invalid search params found",{cause:t});throw e.code="INVALID_SEARCH_PARAMS",e}};#e=t=>{const{search:e,routeSearch:r}=this.#r(t);try{const t=this.route.options.getContext?.({parentContext:this.parentMatch?.routeContext??{},context:this.parentMatch?.context??this.router?.options.context??{},params:this.params,search:e})||{};return{routeSearch:r,search:e,context:{...this.parentMatch?.context??this.router?.options.context,...t},routeContext:t}}catch(t){throw this.route.options.onError?.(t),t}};__load=async t=>{let e;this.parentMatch=t.parentMatch;try{e=this.#e(t)}catch(e){return mt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,status:"error",error:e})))}const{routeSearch:r,search:o,context:a,routeContext:s}=e;if("pending"!==this.state.status)return this.__loadPromise=Promise.resolve().then((async()=>{const e=""+Date.now()+Math.random();this.#o=e;const n=()=>e!==this.#o?this.__loadPromise:void 0;let i;"idle"===this.state.status&&this.__store.setState((t=>({...t,status:"pending"})));const c=(async()=>{await Promise.all(gt.map((async t=>{const e=this.route.options[t];e?.preload&&await e.preload()})))})(),h=Promise.resolve().then((()=>{if(this.route.options.loader)return this.route.options.loader({params:this.params,routeSearch:r,search:o,signal:this.abortController.signal,preload:!!t?.preload,routeContext:s,context:a})}));try{const[t,e]=await Promise.all([c,h]);if(i=n())return await i;this.__store.setState((t=>({...t,error:void 0,status:"success",updatedAt:Date.now(),loader:e})))}catch(e){if(mt(e))return void(t?.preload||this.router.navigate(e));const r=this.route.options.onLoadError??this.route.options.onError;try{r?.(e)}catch(e){return mt(e)?void(t?.preload||this.router.navigate(e)):void this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}this.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}finally{delete this.__loadPromise}})),this.__loadPromise};#o=""}t.Block=function({message:t,condition:e,children:r}){return at(t,e),r??null},t.ErrorComponent=ot,t.Link=B,t.MatchRoute=function(t){const e=Y()(t);return e?"function"==typeof t.children?t.children(e):e?t.children:null:null},t.Navigate=function(t){const e=z();return a.useLayoutEffect((()=>{e.navigate(t)}),[]),null},t.Outlet=Q,t.RootRoute=it,t.Route=nt,t.RouteMatch=yt,t.Router=class{#a;startedLoadingAt=Date.now();resolveNavigation=()=>{};constructor(t){this.options={defaultPreloadDelay:50,context:void 0,...t,stringifySearch:t?.stringifySearch??ht,parseSearch:t?.parseSearch??ct,fetchServerDataFn:t?.fetchServerDataFn??dt},this.__store=new D(ft(),{onUpdate:()=>{this.state=this.__store.state}}),this.state=this.__store.state,this.update(t);const e=this.buildNext({hash:!0,fromCurrent:!0,search:!0,state:!0});this.state.latestLocation.href!==e.href&&this.#s({...e,replace:!0})}reset=()=>{this.__store.setState((t=>Object.assign(t,ft())))};mount=()=>(pt||this.state.currentMatches.length||this.safeLoad(),()=>{});hydrate=async t=>{let e=t;return"undefined"!=typeof document&&(e=window.__DEHYDRATED__,s(e)),this.options.hydrate?.(e),await this.load()};update=t=>{if(Object.assign(this.options,t),this.context=this.options.context,!this.history||this.options.history&&this.options.history!==this.history){this.#a&&this.#a(),this.history=this.options.history??(pt?p():d());const t=this.#n();this.__store.setState((e=>({...e,latestLocation:t,currentLocation:t}))),this.#a=this.history.listen((()=>{this.safeLoad({next:this.#n(this.state.latestLocation)})}))}const{basepath:e,routeTree:r}=this.options;return this.basepath=`/${P(e??"")??""}`,r&&(this.routesById={},this.routeTree=this.#i(r)),this};buildNext=t=>{const e=this.#c(t),r=this.matchRoutes(e.pathname);return this.#c({...t,__matches:r})};cancelMatches=()=>{[...this.state.currentMatches,...this.state.pendingMatches||[]].forEach((t=>{t.cancel()}))};safeLoad=t=>{this.load(t).catch((t=>{console.warn(t),s(!1)}))};load=async t=>{let e=Date.now();const r=e;let o;if(this.startedLoadingAt=r,this.cancelMatches(),this.__store.batch((()=>{t?.next&&this.__store.setState((e=>({...e,latestLocation:t.next}))),o=this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}),this.__store.setState((t=>({...t,status:"pending",pendingMatches:o,pendingLocation:this.state.latestLocation})))})),await this.loadMatches(o,this.state.pendingLocation),this.startedLoadingAt!==r)return this.navigationPromise;const a=this.state.currentMatches,s=[],n=[];a.forEach((t=>{o.find((e=>e.id===t.id))?n.push(t):s.push(t)}));const i=o.filter((t=>!a.find((e=>e.id===t.id))));e=Date.now(),s.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 c=this.state.currentLocation;this.__store.setState((t=>({...t,status:"idle",currentLocation:this.state.latestLocation,currentMatches:o,pendingLocation:void 0,pendingMatches:void 0}))),o.forEach((t=>{t.__commit()})),c.href!==this.state.currentLocation.href&&this.options.onRouteChange?.(),this.resolveNavigation()};getRoute=t=>{const e=this.routesById[t];return s(e),e};loadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e),r};preloadRoute=async(t=this.state.latestLocation)=>{const e=this.buildNext(t),r=this.matchRoutes(e.pathname,{strictParseParams:!0});return await this.loadMatches(r,e,{preload:!0}),r};matchRoutes=(t,e)=>{if(!this.routeTree)return[];const r=[...this.state.currentMatches,...this.state.pendingMatches??[]];let o=[];const a=r=>{let s;if(r.some((r=>{const n=r.children;if(!r.path){if(n?.length){o.push({route:r});const t=a(n);return t?(s=t,!0):(o.pop(),!1)}return!1}const i="/"!==r.path||!!n?.length,c=k(this.basepath,t,{to:r.fullPath,fuzzy:i,caseSensitive:r.options.caseSensitive??this.options.caseSensitive});if(c){let t;try{t=r.options.parseParams?.(c)??c}catch(t){if(e?.strictParseParams)throw t}return o.push({route:r,params:t}),s=r,!0}return!1})),!s)return;const n=s.children;return n?.length?a(n):s};a([this.routeTree]);let s={};return o.map((({route:t,params:e})=>{Object.assign(s,e);const o=M(t.path,e),a=M(t.id,e,!0);return r.find((t=>t.id===a))||new yt(this,t,{id:a,params:s,pathname:S([this.basepath,o])})}))};loadMatches=async(t,e,r)=>{let o;try{await Promise.all(t.map((async(t,e)=>{try{await(t.route.options.beforeLoad?.({router:this,match:t}))}catch(r){if(mt(r))throw r;o=o??e;const a=t.route.options.onBeforeLoadError??t.route.options.onError;try{a?.(r)}catch(e){if(mt(e))throw e;return void t.__store.setState((t=>({...t,error:e,status:"error",updatedAt:Date.now()})))}t.__store.setState((t=>({...t,error:r,status:"error",updatedAt:Date.now()})))}})))}catch(t){if(mt(t))return void(r?.preload||this.navigate(t));throw t}const a=t.slice(0,o),s=a.map((async(t,o)=>{const s=a[o-1];t.__load({preload:r?.preload,location:e,parentMatch:s}),await t.__loadPromise,s&&await s.__loadPromise}));await Promise.all(s)};reload=()=>{this.navigate({fromCurrent:!0,replace:!0,search:!0})};resolvePath=(t,e)=>C(this.basepath,t,L(e));navigate=async({from:t,to:e="",search:r,hash:o,replace:a,params:n})=>{const i=String(e),c=void 0===t?t:String(t);let h;try{new URL(`${i}`),h=!0}catch(t){}return s(!h),this.#s({from:c,to:i,search:r,hash:o,replace:a,params:n})};matchRoute=(t,e)=>{t={...t,to:t.to?this.resolvePath(t.from??"",t.to):void 0};const r=this.buildNext(t),o=e?.pending?this.state.pendingLocation:this.state.currentLocation;if(!o)return!1;const a=k(this.basepath,o.pathname,{...e,to:r.pathname});return!!a&&(e?.includeSearch??1?!!b(o.search,r.search)&&a:a)};buildLink=({from:t,to:e=".",search:r,params:o,hash:a,target:s,replace:n,activeOptions:i,preload:c,preloadDelay:h,disabled:u})=>{try{return new URL(`${e}`),{type:"external",href:e}}catch(t){}const l={from:t,to:e,search:r,params:o,hash:a,replace:n},d=this.buildNext(l);c=c??this.options.defaultPreload;const p=h??this.options.defaultPreloadDelay??0,f=this.state.currentLocation.pathname.split("/"),m=d.pathname.split("/").every(((t,e)=>t===f[e])),g=i?.exact?this.state.currentLocation.pathname===d.pathname:m,y=!i?.includeHash||this.state.currentLocation.hash===d.hash,v=!(i?.includeSearch??1)||b(this.state.currentLocation.search,d.search);return{type:"internal",next:d,handleFocus:t=>{c&&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||s&&"_self"!==s||0!==t.button||(t.preventDefault(),this.#s(l))},handleEnter:t=>{const e=t.target||{};if(c){if(e.preloadTimeout)return;e.preloadTimeout=setTimeout((()=>{e.preloadTimeout=null,this.preloadRoute(l).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(l).catch((t=>{console.warn(t),console.warn("Error preloading route! ☝️")}))},isActive:g&&y&&v,disabled:u}};#i=t=>{const e=(t,r)=>{t.forEach(((t,r)=>{t.init({originalIndex:r,router:this});s(!this.routesById[t.id],String(t.id)),this.routesById[t.id]=t;const o=t.children;o?.length&&(e(o),o.length,t.children=o.map(((t,e)=>{const r=E(L(t.path??"/")),o=R(r);for(;o.length>1&&"/"===o[0]?.value;)o.shift();const a=o.map((t=>"param"===t.type?.5:"wildcard"===t.type?.25:1));return{child:t,cleaned:r,parsed:o,index:e,score:a}})).sort(((t,e)=>{const r=Math.min(t.score.length,e.score.length);for(let o=0;o<r;o++)if(t.score[o]!==e.score[o])return e.score[o]-t.score[o];for(let o=0;o<r;o++)if(t.parsed[o].value!==e.parsed[o].value)return t.parsed[o].value>e.parsed[o].value?1:-1;return t.score.length!==e.score.length?e.score.length-t.score.length:t.cleaned!==e.cleaned?t.cleaned>e.cleaned?1:-1:t.index-e.index})).map((t=>t.child)))}))};e([t]);const r=(t,e)=>{t.forEach((t=>{t.isRoot?s(!e):s(!e||t.parentRoute===e,(t.path,t.parentRoute?.id,e?.id)),t.children&&r(t.children,t)}))};return r([t],void 0),t};#n=t=>{let{pathname:e,search:r,hash:o,state:a}=this.history.location;const s=this.options.parseSearch(r);return{pathname:e,searchStr:r,search:v(t?.search,s),hash:o.split("#").reverse()[0]??"",href:`${e}${r}${o}`,state:a,key:a?.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 r=C(this.basepath??"/",e,`${t.to??""}`);const o={...g(this.matchRoutes(this.state.latestLocation.pathname,{strictParseParams:!0}))?.params};let a=!0===(t.params??!0)?o:y(t.params,o);a&&t.__matches?.map((t=>t.route.options.stringifyParams)).filter(Boolean).forEach((t=>{a={...a,...t(a)}})),r=M(r,a??{});const s=t.__matches?.map((t=>t.route.options.preSearchFilters??[])).flat().filter(Boolean)??[],n=t.__matches?.map((t=>t.route.options.postSearchFilters??[])).flat().filter(Boolean)??[],i=s?.length?s?.reduce(((t,e)=>e(t)),this.state.latestLocation.search):this.state.latestLocation.search,c=!0===t.search?i:t.search?y(t.search,i)??{}:s?.length?i:{},h=n?.length?n.reduce(((t,e)=>e(t)),c):c,u=v(this.state.latestLocation.search,h),l=this.options.stringifySearch(u),d=!0===t.hash?this.state.latestLocation.hash:y(t.hash,this.state.latestLocation.hash),p=d?`#${d}`:"";return{pathname:r,search:u,searchStr:l,state:!0===t.state?this.state.latestLocation.state:y(t.state,this.state.latestLocation.state),hash:d,href:this.history.createHref(`${r}${l}${p}`),key:t.key}};#s=async t=>{const e=this.buildNext(t),r=""+Date.now()+Math.random();this.navigateTimeout&&clearTimeout(this.navigateTimeout);let o="replace";t.replace||(o="push");this.state.latestLocation.href===e.href&&!e.key&&(o="replace");const a=`${e.pathname}${e.searchStr}${e.hash?`#${e.hash}`:""}`;return this.history["push"===o?"push":"replace"](a,{id:r,...e.state}),this.navigationPromise=new Promise((t=>{const e=this.resolveNavigation;this.resolveNavigation=()=>{e(),t()}}))}},t.RouterProvider=function({router:t,...e}){t.update(e);const r=T(t.__store,(t=>t.currentMatches));return a.useEffect(t.mount,[t]),a.createElement(U.Provider,{value:{router:t}},a.createElement(F.Provider,{value:[void 0,...r]},a.createElement(et,{errorComponent:ot,onCatch:()=>{}},a.createElement(Q,null))))},t.cleanPath=L,t.createBrowserHistory=d,t.createHashHistory=function(){return d({getHref:()=>window.location.hash.substring(1),createHref:t=>`#${t}`})},t.createMemoryHistory=p,t.decode=I,t.defaultFetchServerDataFn=dt,t.defaultParseSearch=ct,t.defaultStringifySearch=ht,t.encode=j,t.functionalUpdate=y,t.interpolatePath=M,t.invariant=s,t.isPlainObject=_,t.isRedirect=mt,t.joinPaths=S,t.last=g,t.lazy=function(t,e="default"){const r=a.lazy((async()=>({default:(await t())[e]})));return r.preload=async()=>{await t()},r},t.matchByPath=O,t.matchPathname=k,t.matchesContext=F,t.parsePathname=R,t.parseSearchWith=ut,t.partialDeepEqual=b,t.pick=function(t,e){return e.reduce(((e,r)=>(e[r]=t[r],e)),{})},t.redirect=function(t){return t.isRedirect=!0,t},t.replaceEqualDeep=v,t.resolvePath=C,t.rootRouteId=st,t.routerContext=U,t.stringifySearchWith=lt,t.trimPath=P,t.trimPathLeft=E,t.trimPathRight=x,t.useBlocker=at,t.useLinkProps=H,t.useLoader=V,t.useMatch=K,t.useMatchRoute=Y,t.useMatches=q,t.useNavigate=function(t){const e=z();return a.useCallback((r=>e.navigate({...t,...r})),[])},t.useParams=G,t.useRouter=W,t.useRouterContext=z,t.useSearch=J,t.useStore=T,t.warning=n,Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.production.js.map
{
"name": "@tanstack/router",
"author": "Tanner Linsley",
"version": "0.0.1-beta.93",
"version": "0.0.1-beta.94",
"license": "MIT",

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

@@ -332,9 +332,1 @@ import { AnyRoutesInfo, DefaultRoutesInfo, RouteByPath } from './routeInfo'

: never
export type ValidFromPath<
TRoutesInfo extends AnyRoutesInfo = DefaultRoutesInfo,
> =
| undefined
| (string extends TRoutesInfo['routePaths']
? string
: TRoutesInfo['routePaths'])

@@ -19,2 +19,3 @@ import { ParsePathParams } from './link'

useMatch,
useParams,
useSearch,

@@ -608,5 +609,3 @@ } from './react'

const fullPath =
id === rootRouteId
? '/'
: trimPathRight(joinPaths([this.parentRoute.fullPath, path]))
id === rootRouteId ? '/' : joinPaths([this.parentRoute.fullPath, path])

@@ -674,2 +673,9 @@ this.path = path as TPath

}
useParams = <TStrict extends boolean = true, TSelected = TAllParams>(opts?: {
strict?: TStrict
track?: (search: TAllParams) => TSelected
}): TStrict extends true ? TSelected : TSelected | undefined => {
return useParams({ ...opts, from: this.id })
}
}

@@ -767,3 +773,3 @@

>,
> = TPrefixed extends RootRouteId ? '/' : TrimPathRight<`${TPrefixed}`>
> = TPrefixed extends RootRouteId ? '/' : `${TPrefixed}`

@@ -785,12 +791,13 @@ type RoutePrefix<

type TrimPath<T extends string> = '' extends T
export type TrimPath<T extends string> = '' extends T
? ''
: TrimPathRight<TrimPathLeft<T>>
type TrimPathLeft<T extends string> = T extends `${RootRouteId}/${infer U}`
? TrimPathLeft<U>
: T extends `/${infer U}`
? TrimPathLeft<U>
: T
type TrimPathRight<T extends string> = T extends '/'
export type TrimPathLeft<T extends string> =
T extends `${RootRouteId}/${infer U}`
? TrimPathLeft<U>
: T extends `/${infer U}`
? TrimPathLeft<U>
: T
export type TrimPathRight<T extends string> = T extends '/'
? '/'

@@ -797,0 +804,0 @@ : T extends `${infer U}/`

@@ -38,2 +38,6 @@ import { AnyRoute, Route } from './route'

},
// RoutePaths should always use index routes if possible, but not
// force trailing slashes. To do this, we check if each route
// has an index route registered and if it does, we omit the layout
// route. Then for any index routes, we remove the trailing slash
TRoutesByFullPath = { '/': TRouteUnion } & {

@@ -44,2 +48,6 @@ [TRoute in TRouteUnion as TRoute['fullPath'] extends RootRouteId

? never
: `${TRoute['fullPath']}/` extends keyof TRoutesById
? never
: TRoute['fullPath'] extends `${infer Trimmed}/`
? Trimmed
: TRoute['fullPath']]: TRoute

@@ -46,0 +54,0 @@ },

@@ -56,2 +56,3 @@ import { Store } from '@tanstack/react-store'

useSearch: TRoute['useSearch']
useParams: TRoute['useParams']
}>

@@ -58,0 +59,0 @@ errorComponent?: RouteComponent<{

@@ -11,3 +11,2 @@ import { Store } from '@tanstack/react-store'

ToOptions,
ValidFromPath,
ResolveRelativePath,

@@ -806,6 +805,3 @@ } from './link'

navigate = async <
TFrom extends ValidFromPath<TRoutesInfo> = '/',
TTo extends string = '',
>({
navigate = async <TFrom extends string = '/', TTo extends string = ''>({
from,

@@ -848,3 +844,3 @@ to = '' as any,

matchRoute = <
TFrom extends ValidFromPath<TRoutesInfo> = '/',
TFrom extends string = '/',
TTo extends string = '',

@@ -888,6 +884,3 @@ TResolved extends string = ResolveRelativePath<TFrom, NoInfer<TTo>>,

buildLink = <
TFrom extends ValidFromPath<TRoutesInfo> = '/',
TTo extends string = '',
>({
buildLink = <TFrom extends string = '/', TTo extends string = ''>({
from,

@@ -894,0 +887,0 @@ to = '.' as any,

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 too big to display

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

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