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.62 to 0.0.1-beta.63

1

build/cjs/index.js

@@ -63,2 +63,3 @@ /**

exports.last = utils.last;
exports.partialDeepEqual = utils.partialDeepEqual;
exports.pick = utils.pick;

@@ -65,0 +66,0 @@ exports.replaceEqualDeep = utils.replaceEqualDeep;

11

build/cjs/route.js

@@ -71,11 +71,6 @@ /**

};
// generate: () => {
// invariant(
// false,
// `routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
// )
// },
generate = options => {
invariant__default["default"](false, `route.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `);
};
}
class RootRoute extends Route {

@@ -82,0 +77,0 @@ constructor(options) {

@@ -386,3 +386,3 @@ /**

from,
to = '.',
to = '',
search,

@@ -421,15 +421,18 @@ hash,

const next = this.buildNext(location);
if (opts?.pending) {
if (!this.state.pendingLocation) {
return false;
}
return path.matchPathname(this.basepath, this.state.pendingLocation.pathname, {
...opts,
to: next.pathname
});
const baseLocation = opts?.pending ? this.state.pendingLocation : this.state.currentLocation;
if (!baseLocation) {
return false;
}
return path.matchPathname(this.basepath, this.state.currentLocation.pathname, {
const match = path.matchPathname(this.basepath, baseLocation.pathname, {
...opts,
to: next.pathname
});
if (!match) {
return false;
}
if (opts?.includeSearch ?? true) {
console.log(baseLocation.search, next.search, utils.partialDeepEqual(baseLocation.search, next.search));
return utils.partialDeepEqual(baseLocation.search, next.search) ? match : false;
}
return match;
};

@@ -477,13 +480,12 @@ buildLink = ({

// Compare path/hash for matches
const pathIsEqual = this.state.currentLocation.pathname === next.pathname;
const currentPathSplit = this.state.currentLocation.pathname.split('/');
const nextPathSplit = next.pathname.split('/');
const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
const hashIsEqual = this.state.currentLocation.hash === next.hash;
// Combine the matches based on user options
const pathTest = activeOptions?.exact ? pathIsEqual : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? hashIsEqual : true;
const pathTest = activeOptions?.exact ? this.state.currentLocation.pathname === next.pathname : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? this.state.currentLocation.hash === next.hash : true;
const searchTest = activeOptions?.includeSearch ?? true ? utils.partialDeepEqual(this.state.currentLocation.search, next.search) : true;
// The final "active" test
const isActive = pathTest && hashTest;
const isActive = pathTest && hashTest && searchTest;

@@ -621,4 +623,5 @@ // The click handler

#buildLocation = (dest = {}) => {
dest.fromCurrent = dest.fromCurrent ?? dest.to === '';
const fromPathname = dest.fromCurrent ? this.state.latestLocation.pathname : dest.from ?? this.state.latestLocation.pathname;
let pathname = path.resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? '.'}`);
let pathname = path.resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
const fromMatches = this.matchRoutes(this.state.latestLocation.pathname, {

@@ -625,0 +628,0 @@ strictParseParams: true

@@ -102,2 +102,17 @@ /**

}
function partialDeepEqual(a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return false;
}
if (isPlainObject(a) && isPlainObject(b)) {
return !Object.keys(b).some(key => !partialDeepEqual(a[key], b[key]));
}
if (Array.isArray(a) && Array.isArray(b)) {
return a.length === b.length && a.every((item, index) => partialDeepEqual(item, b[index]));
}
return false;
}

@@ -107,2 +122,3 @@ exports.functionalUpdate = functionalUpdate;

exports.last = last;
exports.partialDeepEqual = partialDeepEqual;
exports.pick = pick;

@@ -109,0 +125,0 @@ exports.replaceEqualDeep = replaceEqualDeep;

@@ -241,2 +241,17 @@ /**

}
function partialDeepEqual(a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return false;
}
if (isPlainObject(a) && isPlainObject(b)) {
return !Object.keys(b).some(key => !partialDeepEqual(a[key], b[key]));
}
if (Array.isArray(a) && Array.isArray(b)) {
return a.length === b.length && a.every((item, index) => partialDeepEqual(item, b[index]));
}
return false;
}

@@ -511,11 +526,6 @@ function joinPaths(paths) {

};
// generate: () => {
// invariant(
// false,
// `routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
// )
// },
generate = options => {
invariant(false, `route.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `);
};
}
class RootRoute extends Route {

@@ -1144,3 +1154,3 @@ constructor(options) {

from,
to = '.',
to = '',
search,

@@ -1179,15 +1189,18 @@ hash,

const next = this.buildNext(location);
if (opts?.pending) {
if (!this.state.pendingLocation) {
return false;
}
return matchPathname(this.basepath, this.state.pendingLocation.pathname, {
...opts,
to: next.pathname
});
const baseLocation = opts?.pending ? this.state.pendingLocation : this.state.currentLocation;
if (!baseLocation) {
return false;
}
return matchPathname(this.basepath, this.state.currentLocation.pathname, {
const match = matchPathname(this.basepath, baseLocation.pathname, {
...opts,
to: next.pathname
});
if (!match) {
return false;
}
if (opts?.includeSearch ?? true) {
console.log(baseLocation.search, next.search, partialDeepEqual(baseLocation.search, next.search));
return partialDeepEqual(baseLocation.search, next.search) ? match : false;
}
return match;
};

@@ -1235,13 +1248,12 @@ buildLink = ({

// Compare path/hash for matches
const pathIsEqual = this.state.currentLocation.pathname === next.pathname;
const currentPathSplit = this.state.currentLocation.pathname.split('/');
const nextPathSplit = next.pathname.split('/');
const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
const hashIsEqual = this.state.currentLocation.hash === next.hash;
// Combine the matches based on user options
const pathTest = activeOptions?.exact ? pathIsEqual : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? hashIsEqual : true;
const pathTest = activeOptions?.exact ? this.state.currentLocation.pathname === next.pathname : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? this.state.currentLocation.hash === next.hash : true;
const searchTest = activeOptions?.includeSearch ?? true ? partialDeepEqual(this.state.currentLocation.search, next.search) : true;
// The final "active" test
const isActive = pathTest && hashTest;
const isActive = pathTest && hashTest && searchTest;

@@ -1379,4 +1391,5 @@ // The click handler

#buildLocation = (dest = {}) => {
dest.fromCurrent = dest.fromCurrent ?? dest.to === '';
const fromPathname = dest.fromCurrent ? this.state.latestLocation.pathname : dest.from ?? this.state.latestLocation.pathname;
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? '.'}`);
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
const fromMatches = this.matchRoutes(this.state.latestLocation.pathname, {

@@ -1475,3 +1488,3 @@ strictParseParams: true

export { RootRoute, Route, RouteMatch, Router, cleanPath, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultFetchServerDataFn, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };
export { RootRoute, Route, RouteMatch, Router, cleanPath, createBrowserHistory, createHashHistory, createMemoryHistory, decode, defaultFetchServerDataFn, defaultParseSearch, defaultStringifySearch, encode, functionalUpdate, interpolatePath, isPlainObject, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };
//# sourceMappingURL=index.js.map

@@ -11,3 +11,3 @@ {

"name": "node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"uid": "dcf0-30"
"uid": "cf24-30"
},

@@ -21,35 +21,35 @@ {

{
"uid": "dcf0-32",
"uid": "cf24-32",
"name": "history.ts"
},
{
"uid": "dcf0-34",
"uid": "cf24-34",
"name": "utils.ts"
},
{
"uid": "dcf0-36",
"uid": "cf24-36",
"name": "path.ts"
},
{
"uid": "dcf0-38",
"uid": "cf24-38",
"name": "qss.ts"
},
{
"uid": "dcf0-40",
"uid": "cf24-40",
"name": "route.ts"
},
{
"uid": "dcf0-44",
"uid": "cf24-44",
"name": "routeMatch.ts"
},
{
"uid": "dcf0-46",
"uid": "cf24-46",
"name": "searchParams.ts"
},
{
"uid": "dcf0-48",
"uid": "cf24-48",
"name": "router.ts"
},
{
"uid": "dcf0-50",
"uid": "cf24-50",
"name": "index.ts"

@@ -61,3 +61,3 @@ }

"name": "store/build/esm/index.js",
"uid": "dcf0-42"
"uid": "cf24-42"
}

@@ -72,74 +72,74 @@ ]

"nodeParts": {
"dcf0-30": {
"cf24-30": {
"renderedLength": 199,
"gzipLength": 134,
"brotliLength": 0,
"mainUid": "dcf0-29"
"mainUid": "cf24-29"
},
"dcf0-32": {
"cf24-32": {
"renderedLength": 4236,
"gzipLength": 1085,
"brotliLength": 0,
"mainUid": "dcf0-31"
"mainUid": "cf24-31"
},
"dcf0-34": {
"renderedLength": 2572,
"gzipLength": 950,
"cf24-34": {
"renderedLength": 3046,
"gzipLength": 1062,
"brotliLength": 0,
"mainUid": "dcf0-33"
"mainUid": "cf24-33"
},
"dcf0-36": {
"cf24-36": {
"renderedLength": 5601,
"gzipLength": 1328,
"brotliLength": 0,
"mainUid": "dcf0-35"
"mainUid": "cf24-35"
},
"dcf0-38": {
"cf24-38": {
"renderedLength": 1395,
"gzipLength": 558,
"brotliLength": 0,
"mainUid": "dcf0-37"
"mainUid": "cf24-37"
},
"dcf0-40": {
"renderedLength": 3148,
"gzipLength": 944,
"cf24-40": {
"renderedLength": 2963,
"gzipLength": 847,
"brotliLength": 0,
"mainUid": "dcf0-39"
"mainUid": "cf24-39"
},
"dcf0-42": {
"cf24-42": {
"renderedLength": 1384,
"gzipLength": 502,
"brotliLength": 0,
"mainUid": "dcf0-41"
"mainUid": "cf24-41"
},
"dcf0-44": {
"cf24-44": {
"renderedLength": 5448,
"gzipLength": 1470,
"brotliLength": 0,
"mainUid": "dcf0-43"
"mainUid": "cf24-43"
},
"dcf0-46": {
"cf24-46": {
"renderedLength": 1387,
"gzipLength": 483,
"brotliLength": 0,
"mainUid": "dcf0-45"
"mainUid": "cf24-45"
},
"dcf0-48": {
"renderedLength": 23107,
"gzipLength": 5390,
"cf24-48": {
"renderedLength": 23450,
"gzipLength": 5468,
"brotliLength": 0,
"mainUid": "dcf0-47"
"mainUid": "cf24-47"
},
"dcf0-50": {
"cf24-50": {
"renderedLength": 0,
"gzipLength": 0,
"brotliLength": 0,
"mainUid": "dcf0-49"
"mainUid": "cf24-49"
}
},
"nodeMetas": {
"dcf0-29": {
"cf24-29": {
"id": "/node_modules/.pnpm/tiny-invariant@1.3.1/node_modules/tiny-invariant/dist/esm/tiny-invariant.js",
"moduleParts": {
"index.production.js": "dcf0-30"
"index.production.js": "cf24-30"
},

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

{
"uid": "dcf0-49"
"uid": "cf24-49"
},
{
"uid": "dcf0-39"
"uid": "cf24-39"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
}
]
},
"dcf0-31": {
"cf24-31": {
"id": "/packages/router/src/history.ts",
"moduleParts": {
"index.production.js": "dcf0-32"
"index.production.js": "cf24-32"
},

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

{
"uid": "dcf0-49"
"uid": "cf24-49"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
}
]
},
"dcf0-33": {
"cf24-33": {
"id": "/packages/router/src/utils.ts",
"moduleParts": {
"index.production.js": "dcf0-34"
"index.production.js": "cf24-34"
},

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

{
"uid": "dcf0-49"
"uid": "cf24-49"
},
{
"uid": "dcf0-35"
"uid": "cf24-35"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
}
]
},
"dcf0-35": {
"cf24-35": {
"id": "/packages/router/src/path.ts",
"moduleParts": {
"index.production.js": "dcf0-36"
"index.production.js": "cf24-36"
},
"imported": [
{
"uid": "dcf0-33"
"uid": "cf24-33"
}

@@ -207,16 +207,16 @@ ],

{
"uid": "dcf0-49"
"uid": "cf24-49"
},
{
"uid": "dcf0-39"
"uid": "cf24-39"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
}
]
},
"dcf0-37": {
"cf24-37": {
"id": "/packages/router/src/qss.ts",
"moduleParts": {
"index.production.js": "dcf0-38"
"index.production.js": "cf24-38"
},

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

{
"uid": "dcf0-49"
"uid": "cf24-49"
},
{
"uid": "dcf0-45"
"uid": "cf24-45"
}
]
},
"dcf0-39": {
"cf24-39": {
"id": "/packages/router/src/route.ts",
"moduleParts": {
"index.production.js": "dcf0-40"
"index.production.js": "cf24-40"
},
"imported": [
{
"uid": "dcf0-29"
"uid": "cf24-29"
},
{
"uid": "dcf0-35"
"uid": "cf24-35"
}

@@ -249,10 +249,10 @@ ],

{
"uid": "dcf0-49"
"uid": "cf24-49"
}
]
},
"dcf0-41": {
"cf24-41": {
"id": "/packages/store/build/esm/index.js",
"moduleParts": {
"index.production.js": "dcf0-42"
"index.production.js": "cf24-42"
},

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

{
"uid": "dcf0-43"
"uid": "cf24-43"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
}
]
},
"dcf0-43": {
"cf24-43": {
"id": "/packages/router/src/routeMatch.ts",
"moduleParts": {
"index.production.js": "dcf0-44"
"index.production.js": "cf24-44"
},
"imported": [
{
"uid": "dcf0-41"
"uid": "cf24-41"
}

@@ -282,17 +282,17 @@ ],

{
"uid": "dcf0-49"
"uid": "cf24-49"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
}
]
},
"dcf0-45": {
"cf24-45": {
"id": "/packages/router/src/searchParams.ts",
"moduleParts": {
"index.production.js": "dcf0-46"
"index.production.js": "cf24-46"
},
"imported": [
{
"uid": "dcf0-37"
"uid": "cf24-37"
}

@@ -302,35 +302,35 @@ ],

{
"uid": "dcf0-49"
"uid": "cf24-49"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
}
]
},
"dcf0-47": {
"cf24-47": {
"id": "/packages/router/src/router.ts",
"moduleParts": {
"index.production.js": "dcf0-48"
"index.production.js": "cf24-48"
},
"imported": [
{
"uid": "dcf0-41"
"uid": "cf24-41"
},
{
"uid": "dcf0-29"
"uid": "cf24-29"
},
{
"uid": "dcf0-35"
"uid": "cf24-35"
},
{
"uid": "dcf0-43"
"uid": "cf24-43"
},
{
"uid": "dcf0-45"
"uid": "cf24-45"
},
{
"uid": "dcf0-33"
"uid": "cf24-33"
},
{
"uid": "dcf0-31"
"uid": "cf24-31"
}

@@ -340,47 +340,47 @@ ],

{
"uid": "dcf0-49"
"uid": "cf24-49"
}
]
},
"dcf0-49": {
"cf24-49": {
"id": "/packages/router/src/index.ts",
"moduleParts": {
"index.production.js": "dcf0-50"
"index.production.js": "cf24-50"
},
"imported": [
{
"uid": "dcf0-29"
"uid": "cf24-29"
},
{
"uid": "dcf0-31"
"uid": "cf24-31"
},
{
"uid": "dcf0-51"
"uid": "cf24-51"
},
{
"uid": "dcf0-52"
"uid": "cf24-52"
},
{
"uid": "dcf0-35"
"uid": "cf24-35"
},
{
"uid": "dcf0-37"
"uid": "cf24-37"
},
{
"uid": "dcf0-39"
"uid": "cf24-39"
},
{
"uid": "dcf0-53"
"uid": "cf24-53"
},
{
"uid": "dcf0-43"
"uid": "cf24-43"
},
{
"uid": "dcf0-47"
"uid": "cf24-47"
},
{
"uid": "dcf0-45"
"uid": "cf24-45"
},
{
"uid": "dcf0-33"
"uid": "cf24-33"
}

@@ -391,3 +391,3 @@ ],

},
"dcf0-51": {
"cf24-51": {
"id": "/packages/router/src/frameworks.ts",

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

{
"uid": "dcf0-49"
"uid": "cf24-49"
}
]
},
"dcf0-52": {
"cf24-52": {
"id": "/packages/router/src/link.ts",

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

{
"uid": "dcf0-49"
"uid": "cf24-49"
}
]
},
"dcf0-53": {
"cf24-53": {
"id": "/packages/router/src/routeInfo.ts",

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

{
"uid": "dcf0-49"
"uid": "cf24-49"
}

@@ -423,0 +423,0 @@ ]

@@ -89,2 +89,3 @@ /**

declare function isPlainObject(o: any): boolean;
declare function partialDeepEqual(a: any, b: any): boolean;

@@ -194,2 +195,3 @@ interface Register {

caseSensitive?: boolean;
includeSearch?: boolean;
fuzzy?: boolean;

@@ -437,2 +439,3 @@ }

addChildren: <TNewChildren extends AnyRoute[]>(children: TNewChildren) => Route<TParentRoute, TPath, TFullPath, TCustomId, TId, TSearchSchema, TFullSearchSchema, TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext, TRouterContext, TNewChildren, TRoutesInfo>;
generate: (options: Omit<RouteOptions<TParentRoute, TCustomId, TPath, InferFullSearchSchema<TParentRoute>, TSearchSchema, TFullSearchSchema, TParentRoute['__types']['allParams'], TParams, TAllParams, TParentContext, TAllParentContext, TRouteContext, TContext>, 'path'>) => never;
}

@@ -582,2 +585,3 @@ type AnyRootRoute = RootRoute<any, any, any>;

includeHash?: boolean;
includeSearch?: boolean;
}

@@ -633,2 +637,2 @@ type LinkOptions<TRoutesInfo extends AnyRoutesInfo = DefaultRoutesInfo, TFrom extends TRoutesInfo['routePaths'] = '/', TTo extends string = '.'> = NavigateOptions<TRoutesInfo, TFrom, TTo> & {

export { ActiveOptions, AnyContext, AnyLoaderData, AnyPathParams, 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, NavigateOptions, NoInfer, OnLoadFn, ParentParams, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, Register, RegisteredRouter, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFullSearchSchema, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteMatch, RouteMatchStore, RouteMeta, RouteOptions, RouteOptionsBase, RouteOptionsBaseIntersection, Router, 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, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };
export { ActiveOptions, AnyContext, AnyLoaderData, AnyPathParams, 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, NavigateOptions, NoInfer, OnLoadFn, ParentParams, ParsePathParams, ParseRoute, ParseRouteChild, ParseRouteChildren, ParsedLocation, ParsedPath, PathParamMask, PathParamOptions, PickAsPartial, PickAsRequired, PickExclude, PickExtra, PickExtract, PickRequired, PickUnsafe, Register, RegisteredRouter, RegisteredRoutesInfo, RelativeToPathAutoComplete, ResolveFullSearchSchema, ResolveRelativePath, RootRoute, RootRouteId, Route, RouteById, RouteByPath, RouteMatch, RouteMatchStore, RouteMeta, RouteOptions, RouteOptionsBase, RouteOptionsBaseIntersection, Router, 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, joinPaths, last, matchByPath, matchPathname, parsePathname, parseSearchWith, partialDeepEqual, pick, replaceEqualDeep, resolvePath, rootRouteId, stringifySearchWith, trimPath, trimPathLeft, trimPathRight, warning };

@@ -253,2 +253,17 @@ /**

}
function partialDeepEqual(a, b) {
if (a === b) {
return true;
}
if (typeof a !== typeof b) {
return false;
}
if (isPlainObject(a) && isPlainObject(b)) {
return !Object.keys(b).some(key => !partialDeepEqual(a[key], b[key]));
}
if (Array.isArray(a) && Array.isArray(b)) {
return a.length === b.length && a.every((item, index) => partialDeepEqual(item, b[index]));
}
return false;
}

@@ -523,11 +538,6 @@ function joinPaths(paths) {

};
// generate: () => {
// invariant(
// false,
// `routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
// )
// },
generate = options => {
invariant(false, `route.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `);
};
}
class RootRoute extends Route {

@@ -1205,3 +1215,3 @@ constructor(options) {

from,
to = '.',
to = '',
search,

@@ -1240,15 +1250,18 @@ hash,

const next = this.buildNext(location);
if (opts?.pending) {
if (!this.state.pendingLocation) {
return false;
}
return matchPathname(this.basepath, this.state.pendingLocation.pathname, {
...opts,
to: next.pathname
});
const baseLocation = opts?.pending ? this.state.pendingLocation : this.state.currentLocation;
if (!baseLocation) {
return false;
}
return matchPathname(this.basepath, this.state.currentLocation.pathname, {
const match = matchPathname(this.basepath, baseLocation.pathname, {
...opts,
to: next.pathname
});
if (!match) {
return false;
}
if (opts?.includeSearch ?? true) {
console.log(baseLocation.search, next.search, partialDeepEqual(baseLocation.search, next.search));
return partialDeepEqual(baseLocation.search, next.search) ? match : false;
}
return match;
};

@@ -1296,13 +1309,12 @@ buildLink = ({

// Compare path/hash for matches
const pathIsEqual = this.state.currentLocation.pathname === next.pathname;
const currentPathSplit = this.state.currentLocation.pathname.split('/');
const nextPathSplit = next.pathname.split('/');
const pathIsFuzzyEqual = nextPathSplit.every((d, i) => d === currentPathSplit[i]);
const hashIsEqual = this.state.currentLocation.hash === next.hash;
// Combine the matches based on user options
const pathTest = activeOptions?.exact ? pathIsEqual : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? hashIsEqual : true;
const pathTest = activeOptions?.exact ? this.state.currentLocation.pathname === next.pathname : pathIsFuzzyEqual;
const hashTest = activeOptions?.includeHash ? this.state.currentLocation.hash === next.hash : true;
const searchTest = activeOptions?.includeSearch ?? true ? partialDeepEqual(this.state.currentLocation.search, next.search) : true;
// The final "active" test
const isActive = pathTest && hashTest;
const isActive = pathTest && hashTest && searchTest;

@@ -1440,4 +1452,5 @@ // The click handler

#buildLocation = (dest = {}) => {
dest.fromCurrent = dest.fromCurrent ?? dest.to === '';
const fromPathname = dest.fromCurrent ? this.state.latestLocation.pathname : dest.from ?? this.state.latestLocation.pathname;
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? '.'}`);
let pathname = resolvePath(this.basepath ?? '/', fromPathname, `${dest.to ?? ''}`);
const fromMatches = this.matchRoutes(this.state.latestLocation.pathname, {

@@ -1559,2 +1572,3 @@ strictParseParams: true

exports.parseSearchWith = parseSearchWith;
exports.partialDeepEqual = partialDeepEqual;
exports.pick = pick;

@@ -1561,0 +1575,0 @@ exports.replaceEqualDeep = replaceEqualDeep;

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

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

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

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

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

includeHash?: boolean
includeSearch?: boolean
}

@@ -243,0 +244,0 @@

@@ -447,8 +447,27 @@ import { GetFrameworkGeneric } from './frameworks'

// generate: () => {
// invariant(
// false,
// `routeConfig.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
// )
// },
generate = (
options: Omit<
RouteOptions<
TParentRoute,
TCustomId,
TPath,
InferFullSearchSchema<TParentRoute>,
TSearchSchema,
TFullSearchSchema,
TParentRoute['__types']['allParams'],
TParams,
TAllParams,
TParentContext,
TAllParentContext,
TRouteContext,
TContext
>,
'path'
>,
) => {
invariant(
false,
`route.generate() is used by TanStack Router's file-based routing code generation and should not actually be called during runtime. `,
)
}
}

@@ -455,0 +474,0 @@

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

replaceEqualDeep,
partialDeepEqual,
} from './utils'

@@ -192,2 +193,3 @@ import {

caseSensitive?: boolean
includeSearch?: boolean
fuzzy?: boolean

@@ -734,3 +736,3 @@ }

from,
to = '.' as any,
to = '' as any,
search,

@@ -786,22 +788,29 @@ hash,

const next = this.buildNext(location)
const baseLocation = opts?.pending
? this.state.pendingLocation
: this.state.currentLocation
if (opts?.pending) {
if (!this.state.pendingLocation) {
return false
}
return matchPathname(
this.basepath,
this.state.pendingLocation!.pathname,
{
...opts,
to: next.pathname,
},
) as any
if (!baseLocation) {
return false
}
return matchPathname(this.basepath, this.state.currentLocation.pathname, {
const match = matchPathname(this.basepath, baseLocation.pathname, {
...opts,
to: next.pathname,
}) as any
if (!match) {
return false
}
if (opts?.includeSearch ?? true) {
console.log(
baseLocation.search,
next.search,
partialDeepEqual(baseLocation.search, next.search),
)
return partialDeepEqual(baseLocation.search, next.search) ? match : false
}
return match
}

@@ -857,3 +866,2 @@

// Compare path/hash for matches
const pathIsEqual = this.state.currentLocation.pathname === next.pathname
const currentPathSplit = this.state.currentLocation.pathname.split('/')

@@ -864,9 +872,16 @@ const nextPathSplit = next.pathname.split('/')

)
const hashIsEqual = this.state.currentLocation.hash === next.hash
// Combine the matches based on user options
const pathTest = activeOptions?.exact ? pathIsEqual : pathIsFuzzyEqual
const hashTest = activeOptions?.includeHash ? hashIsEqual : true
const pathTest = activeOptions?.exact
? this.state.currentLocation.pathname === next.pathname
: pathIsFuzzyEqual
const hashTest = activeOptions?.includeHash
? this.state.currentLocation.hash === next.hash
: true
const searchTest =
activeOptions?.includeSearch ?? true
? partialDeepEqual(this.state.currentLocation.search, next.search)
: true
// The final "active" test
const isActive = pathTest && hashTest
const isActive = pathTest && hashTest && searchTest

@@ -1041,2 +1056,4 @@ // The click handler

#buildLocation = (dest: BuildNextOptions = {}): ParsedLocation => {
dest.fromCurrent = dest.fromCurrent ?? dest.to === ''
const fromPathname = dest.fromCurrent

@@ -1049,3 +1066,3 @@ ? this.state.latestLocation.pathname

fromPathname,
`${dest.to ?? '.'}`,
`${dest.to ?? ''}`,
)

@@ -1052,0 +1069,0 @@

@@ -169,1 +169,24 @@ export type NoInfer<T> = [T][T extends any ? 0 : never]

}
export function partialDeepEqual(a: any, b: any): boolean {
if (a === b) {
return true
}
if (typeof a !== typeof b) {
return false
}
if (isPlainObject(a) && isPlainObject(b)) {
return !Object.keys(b).some((key) => !partialDeepEqual(a[key], b[key]))
}
if (Array.isArray(a) && Array.isArray(b)) {
return (
a.length === b.length &&
a.every((item, index) => partialDeepEqual(item, b[index]))
)
}
return false
}

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

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