Sign In

@tanstack/react-router

Package Overview
Dependencies
Maintainers
3
Versions
1192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tanstack/react-router - npm Package Compare versions

Comparing version
1.170.25
to
1.170.26
+18
dist/cjs/nonRouteComponentContext.cjs
"use client";
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
let react = require("react");
react = require_runtime.__toESM(react, 1);
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/nonRouteComponentContext.tsx
var nonRouteComponentContext = process.env.NODE_ENV !== "production" ? react.createContext(void 0) : void 0;
function wrapInNonRouteComponentContext(element, component) {
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(nonRouteComponentContext.Provider, {
value: component,
children: element
});
}
//#endregion
exports.nonRouteComponentContext = nonRouteComponentContext;
exports.wrapInNonRouteComponentContext = wrapInNonRouteComponentContext;
//# sourceMappingURL=nonRouteComponentContext.cjs.map
{"version":3,"file":"nonRouteComponentContext.cjs","names":[],"sources":["../../src/nonRouteComponentContext.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nexport type NonRouteComponent =\n | 'pendingComponent'\n | 'errorComponent'\n | 'notFoundComponent'\n\nexport const nonRouteComponentContext =\n process.env.NODE_ENV !== 'production'\n ? React.createContext<NonRouteComponent | undefined>(undefined)\n : undefined\n\nexport function wrapInNonRouteComponentContext(\n element: React.ReactElement,\n component: NonRouteComponent,\n): React.ReactElement {\n const Context = nonRouteComponentContext!\n return <Context.Provider value={component}>{element}</Context.Provider>\n}\n"],"mappings":";;;;;;AASA,IAAa,2BAAA,QAAA,IAAA,aACc,eACrB,MAAM,cAA6C,KAAA,CAAS,IAC5D,KAAA;AAEN,SAAgB,+BACd,SACA,WACoB;CAEpB,OAAO,iBAAA,GAAA,kBAAA,KAAC,yBAAQ,UAAT;EAAkB,OAAO;YAAY;CAA0B,CAAA;AACxE"}
import * as React from 'react';
export type NonRouteComponent = 'pendingComponent' | 'errorComponent' | 'notFoundComponent';
export declare const nonRouteComponentContext: React.Context<NonRouteComponent | undefined> | undefined;
export declare function wrapInNonRouteComponentContext(element: React.ReactElement, component: NonRouteComponent): React.ReactElement;
import * as React from 'react';
export type NonRouteComponent = 'pendingComponent' | 'errorComponent' | 'notFoundComponent';
export declare const nonRouteComponentContext: React.Context<NonRouteComponent | undefined> | undefined;
export declare function wrapInNonRouteComponentContext(element: React.ReactElement, component: NonRouteComponent): React.ReactElement;
"use client";
import * as React$1 from "react";
import { jsx } from "react/jsx-runtime";
//#region src/nonRouteComponentContext.tsx
var nonRouteComponentContext = process.env.NODE_ENV !== "production" ? React$1.createContext(void 0) : void 0;
function wrapInNonRouteComponentContext(element, component) {
return /* @__PURE__ */ jsx(nonRouteComponentContext.Provider, {
value: component,
children: element
});
}
//#endregion
export { nonRouteComponentContext, wrapInNonRouteComponentContext };
//# sourceMappingURL=nonRouteComponentContext.js.map
{"version":3,"file":"nonRouteComponentContext.js","names":[],"sources":["../../src/nonRouteComponentContext.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\n\nexport type NonRouteComponent =\n | 'pendingComponent'\n | 'errorComponent'\n | 'notFoundComponent'\n\nexport const nonRouteComponentContext =\n process.env.NODE_ENV !== 'production'\n ? React.createContext<NonRouteComponent | undefined>(undefined)\n : undefined\n\nexport function wrapInNonRouteComponentContext(\n element: React.ReactElement,\n component: NonRouteComponent,\n): React.ReactElement {\n const Context = nonRouteComponentContext!\n return <Context.Provider value={component}>{element}</Context.Provider>\n}\n"],"mappings":";;;;AASA,IAAa,2BAAA,QAAA,IAAA,aACc,eACrB,QAAM,cAA6C,KAAA,CAAS,IAC5D,KAAA;AAEN,SAAgB,+BACd,SACA,WACoB;CAEpB,OAAO,oBAAC,yBAAQ,UAAT;EAAkB,OAAO;YAAY;CAA0B,CAAA;AACxE"}
'use client'
import * as React from 'react'
export type NonRouteComponent =
| 'pendingComponent'
| 'errorComponent'
| 'notFoundComponent'
export const nonRouteComponentContext =
process.env.NODE_ENV !== 'production'
? React.createContext<NonRouteComponent | undefined>(undefined)
: undefined
export function wrapInNonRouteComponentContext(
element: React.ReactElement,
component: NonRouteComponent,
): React.ReactElement {
const Context = nonRouteComponentContext!
return <Context.Provider value={component}>{element}</Context.Provider>
}
+9
-4
"use client";
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
const require_nonRouteComponentContext = require("./nonRouteComponentContext.cjs");
let react = require("react");

@@ -34,6 +35,10 @@ react = require_runtime.__toESM(react, 1);

const error = this.state.error;
return error ? react.createElement(this.props.errorComponent ?? ErrorComponent, {
error,
reset: this.reset
}) : this.props.children;
if (error) {
const element = react.createElement(this.props.errorComponent ?? ErrorComponent, {
error,
reset: this.reset
});
return process.env.NODE_ENV !== "production" ? require_nonRouteComponentContext.wrapInNonRouteComponentContext(element, "errorComponent") : element;
}
return this.props.children;
}

@@ -40,0 +45,0 @@ };

@@ -1,1 +0,1 @@

{"version":3,"file":"CatchBoundary.cjs","names":[],"sources":["../../src/CatchBoundary.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport type { ErrorRouteComponent } from './route'\nimport type { ErrorInfo } from 'react'\n\nexport function CatchBoundary(props: {\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}) {\n return <CatchBoundaryImpl {...props} />\n}\n\nclass CatchBoundaryImpl extends React.Component<{\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}> {\n state = { error: null } as { error: Error | null; resetKey?: unknown }\n\n static getDerivedStateFromProps(\n props: { getResetKey: () => unknown },\n state: { resetKey?: unknown; error: Error | null },\n ) {\n const resetKey = props.getResetKey()\n\n if (state.error && state.resetKey !== resetKey) {\n return { resetKey, error: null }\n }\n\n return { resetKey }\n }\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n reset = () => {\n this.setState({ error: null })\n }\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.props.onCatch?.(error, errorInfo)\n }\n render() {\n const error = this.state.error\n return error\n ? React.createElement(this.props.errorComponent ?? ErrorComponent, {\n error,\n reset: this.reset,\n })\n : this.props.children\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;AAMA,SAAgB,cAAc,OAK3B;CACD,OAAO,iBAAA,GAAA,kBAAA,KAAC,mBAAD,EAAmB,GAAI,MAAQ,CAAA;AACxC;AAEA,IAAM,oBAAN,cAAgC,MAAM,UAKnC;;;eACO,EAAE,OAAO,KAAK;qBAiBR;GACZ,KAAK,SAAS,EAAE,OAAO,KAAK,CAAC;EAC/B;;CAjBA,OAAO,yBACL,OACA,OACA;EACA,MAAM,WAAW,MAAM,YAAY;EAEnC,IAAI,MAAM,SAAS,MAAM,aAAa,UACpC,OAAO;GAAE;GAAU,OAAO;EAAK;EAGjC,OAAO,EAAE,SAAS;CACpB;CACA,OAAO,yBAAyB,OAAc;EAC5C,OAAO,EAAE,MAAM;CACjB;CAIA,kBAAkB,OAAc,WAAsB;EACpD,KAAK,MAAM,UAAU,OAAO,SAAS;CACvC;CACA,SAAS;EACP,MAAM,QAAQ,KAAK,MAAM;EACzB,OAAO,QACH,MAAM,cAAc,KAAK,MAAM,kBAAkB,gBAAgB;GAC/D;GACA,OAAO,KAAK;EACd,CAAC,IACD,KAAK,MAAM;CACjB;AACF;AAEA,SAAgB,eAAe,EAAE,SAAyB;CACxD,MAAM,CAAC,MAAM,WAAW,MAAM,SAAA,QAAA,IAAA,aAAkC,YAAY;CAE5E,OACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,OAAO;GAAE,SAAS;GAAS,UAAU;EAAO;YAAjD;GACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;IAAK,OAAO;KAAE,SAAS;KAAQ,YAAY;KAAU,KAAK;IAAQ;cAAlE,CACE,iBAAA,GAAA,kBAAA,KAAC,UAAD;KAAQ,OAAO,EAAE,UAAU,OAAO;eAAG;IAA6B,CAAA,GAClE,iBAAA,GAAA,kBAAA,KAAC,UAAD;KACE,OAAO;MACL,YAAY;MACZ,UAAU;MACV,QAAQ;MACR,SAAS;MACT,YAAY;MACZ,cAAc;KAChB;KACA,eAAe,SAAS,MAAM,CAAC,CAAC;eAE/B,OAAO,eAAe;IACjB,CAAA,CACL;;GACL,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,OAAO,EAAE,QAAQ,SAAS,EAAI,CAAA;GAClC,OACC,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;IACE,OAAO;KACL,UAAU;KACV,QAAQ;KACR,cAAc;KACd,SAAS;KACT,OAAO;KACP,UAAU;IACZ;cAEC,MAAM,UAAU,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,MAAM,QAAc,CAAA,IAAI;GAC7C,CAAA,EACF,CAAA,IACH;EACD;;AAET"}
{"version":3,"file":"CatchBoundary.cjs","names":[],"sources":["../../src/CatchBoundary.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { wrapInNonRouteComponentContext } from './nonRouteComponentContext'\nimport type { ErrorRouteComponent } from './route'\nimport type { ErrorInfo } from 'react'\n\nexport function CatchBoundary(props: {\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}) {\n return <CatchBoundaryImpl {...props} />\n}\n\nclass CatchBoundaryImpl extends React.Component<{\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}> {\n state = { error: null } as { error: Error | null; resetKey?: unknown }\n\n static getDerivedStateFromProps(\n props: { getResetKey: () => unknown },\n state: { resetKey?: unknown; error: Error | null },\n ) {\n const resetKey = props.getResetKey()\n\n if (state.error && state.resetKey !== resetKey) {\n return { resetKey, error: null }\n }\n\n return { resetKey }\n }\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n reset = () => {\n this.setState({ error: null })\n }\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.props.onCatch?.(error, errorInfo)\n }\n render() {\n const error = this.state.error\n if (error) {\n const element = React.createElement(\n this.props.errorComponent ?? ErrorComponent,\n {\n error,\n reset: this.reset,\n },\n )\n\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(element, 'errorComponent')\n : element\n }\n\n return this.props.children\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;;;AAOA,SAAgB,cAAc,OAK3B;CACD,OAAO,iBAAA,GAAA,kBAAA,KAAC,mBAAD,EAAmB,GAAI,MAAQ,CAAA;AACxC;AAEA,IAAM,oBAAN,cAAgC,MAAM,UAKnC;;;eACO,EAAE,OAAO,KAAK;qBAiBR;GACZ,KAAK,SAAS,EAAE,OAAO,KAAK,CAAC;EAC/B;;CAjBA,OAAO,yBACL,OACA,OACA;EACA,MAAM,WAAW,MAAM,YAAY;EAEnC,IAAI,MAAM,SAAS,MAAM,aAAa,UACpC,OAAO;GAAE;GAAU,OAAO;EAAK;EAGjC,OAAO,EAAE,SAAS;CACpB;CACA,OAAO,yBAAyB,OAAc;EAC5C,OAAO,EAAE,MAAM;CACjB;CAIA,kBAAkB,OAAc,WAAsB;EACpD,KAAK,MAAM,UAAU,OAAO,SAAS;CACvC;CACA,SAAS;EACP,MAAM,QAAQ,KAAK,MAAM;EACzB,IAAI,OAAO;GACT,MAAM,UAAU,MAAM,cACpB,KAAK,MAAM,kBAAkB,gBAC7B;IACE;IACA,OAAO,KAAK;GACd,CACF;GAEA,OAAA,QAAA,IAAA,aAAgC,eAC5B,iCAAA,+BAA+B,SAAS,gBAAgB,IACxD;EACN;EAEA,OAAO,KAAK,MAAM;CACpB;AACF;AAEA,SAAgB,eAAe,EAAE,SAAyB;CACxD,MAAM,CAAC,MAAM,WAAW,MAAM,SAAA,QAAA,IAAA,aAAkC,YAAY;CAE5E,OACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,OAAO;GAAE,SAAS;GAAS,UAAU;EAAO;YAAjD;GACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;IAAK,OAAO;KAAE,SAAS;KAAQ,YAAY;KAAU,KAAK;IAAQ;cAAlE,CACE,iBAAA,GAAA,kBAAA,KAAC,UAAD;KAAQ,OAAO,EAAE,UAAU,OAAO;eAAG;IAA6B,CAAA,GAClE,iBAAA,GAAA,kBAAA,KAAC,UAAD;KACE,OAAO;MACL,YAAY;MACZ,UAAU;MACV,QAAQ;MACR,SAAS;MACT,YAAY;MACZ,cAAc;KAChB;KACA,eAAe,SAAS,MAAM,CAAC,CAAC;eAE/B,OAAO,eAAe;IACjB,CAAA,CACL;;GACL,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAK,OAAO,EAAE,QAAQ,SAAS,EAAI,CAAA;GAClC,OACC,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAA,UACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;IACE,OAAO;KACL,UAAU;KACV,QAAQ;KACR,cAAc;KACd,SAAS;KACT,OAAO;KACP,UAAU;IACZ;cAEC,MAAM,UAAU,iBAAA,GAAA,kBAAA,KAAC,QAAD,EAAA,UAAO,MAAM,QAAc,CAAA,IAAI;GAC7C,CAAA,EACF,CAAA,IACH;EACD;;AAET"}

@@ -12,3 +12,2 @@ "use client";

let _tanstack_react_store = require("@tanstack/react-store");
let react_dom = require("react-dom");
//#region src/link.tsx

@@ -253,5 +252,4 @@ function useValueStable(value) {

};
const [isTransitioning, setIsTransitioning] = react.useState(false);
const hasRenderFetched = react.useRef(false);
const preload = options.reloadDocument || externalLink ? false : userPreload ?? router.options.defaultPreload;
const preload = options.reloadDocument || externalLink || disabled ? false : userPreload ?? router.options.defaultPreload;
const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;

@@ -264,16 +262,34 @@ const doPreload = react.useCallback(() => {

}, [router, _options]);
require_utils.useIntersectionObserver(innerRef, react.useCallback((entry) => {
if (entry?.isIntersecting) doPreload();
}, [doPreload]), intersectionObserverOptions, !!disabled || preload !== "viewport");
const enqueuePreload = react.useCallback((e) => {
if (!e) {
cancelPreload(innerRef);
return;
}
if (!(e.isIntersecting ?? preload === "intent")) {
if (e.isIntersecting === false) cancelPreload(innerRef);
return;
}
if (!preloadDelay) {
doPreload();
return;
}
if (timeoutMap.has(innerRef)) return;
timeoutMap.set(innerRef, setTimeout(() => {
timeoutMap.delete(innerRef);
doPreload();
}, preloadDelay));
}, [
doPreload,
innerRef,
preload,
preloadDelay
]);
require_utils.useIntersectionObserver(innerRef, enqueuePreload, preload !== "viewport");
react.useEffect(() => {
if (hasRenderFetched.current) return;
if (!disabled && preload === "render") {
if (preload === "render") {
doPreload();
hasRenderFetched.current = true;
}
}, [
disabled,
doPreload,
preload
]);
}, [doPreload, preload]);
const handleClick = (e) => {

@@ -284,9 +300,2 @@ const elementTarget = e.currentTarget.getAttribute("target");

e.preventDefault();
(0, react_dom.flushSync)(() => {
setIsTransitioning(true);
});
const unsub = router.subscribe("onResolved", () => {
unsub();
setIsTransitioning(false);
});
router.navigate({

@@ -319,28 +328,8 @@ ..._options,

};
const enqueueIntentPreload = (e) => {
if (disabled || preload !== "intent") return;
if (!preloadDelay) {
doPreload();
return;
}
const eventTarget = e.currentTarget;
if (timeoutMap.has(eventTarget)) return;
const id = setTimeout(() => {
timeoutMap.delete(eventTarget);
doPreload();
}, preloadDelay);
timeoutMap.set(eventTarget, id);
};
const handleTouchStart = (_) => {
if (disabled || preload !== "intent") return;
const handleTouchStart = () => {
if (preload !== "intent") return;
doPreload();
};
const handleLeave = (e) => {
if (disabled || !preload || !preloadDelay) return;
const eventTarget = e.currentTarget;
const id = timeoutMap.get(eventTarget);
if (id) {
clearTimeout(id);
timeoutMap.delete(eventTarget);
}
const handleLeave = () => {
if (preload === "intent") cancelPreload(innerRef);
};

@@ -355,4 +344,4 @@ return {

onBlur: composeHandlers([onBlur, handleLeave]),
onFocus: composeHandlers([onFocus, enqueueIntentPreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),
onFocus: composeHandlers([onFocus, enqueuePreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueuePreload]),
onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),

@@ -365,4 +354,3 @@ onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),

...disabled && STATIC_DISABLED_PROPS,
...isActive && STATIC_ACTIVE_PROPS,
...isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS
...isActive && STATIC_ACTIVE_PROPS
};

@@ -380,5 +368,7 @@ }

};
var STATIC_TRANSITIONING_PROPS = { "data-transitioning": "transitioning" };
var timeoutMap = /* @__PURE__ */ new WeakMap();
var intersectionObserverOptions = { rootMargin: "100px" };
var cancelPreload = (eventTarget) => {
clearTimeout(timeoutMap.get(eventTarget));
timeoutMap.delete(eventTarget);
};
var composeHandlers = (handlers) => (e) => {

@@ -436,3 +426,3 @@ for (const handler of handlers) {

* - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
* - `preloadDelay`: Delay in ms before preloading on hover
* - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry
* - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive

@@ -439,0 +429,0 @@ * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation

@@ -1,1 +0,1 @@

{"version":3,"file":"link.cjs","names":[],"sources":["../../src/link.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { flushSync } from 'react-dom'\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n hasKeys,\n isDangerousProtocol,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nimport { useForwardedRef, useIntersectionObserver } from './utils'\n\nimport { useHydrated } from './ClientOnly'\nimport type {\n ActiveOptions,\n AnyRouter,\n Constrain,\n LinkOptions,\n ParsedLocation,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type { ReactNode } from 'react'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\ntype LinkState = [\n href: string | undefined,\n externalLink: string | undefined,\n isActive: boolean,\n]\n\n// Keep a referentially stable value while the contents are equal. Links\n// routinely pass inline `params` / `search` object literals, which would\n// otherwise change `_options` identity on every parent render, rebuild the\n// store selector, and discard its memoized selection.\n//\n// `ignoreUndefined: false` is required: an explicit `undefined` clears an\n// inherited param or search key, so `{}` and `{ category: undefined }` build\n// different locations and must not be treated as equal here.\nfunction useValueStable<T>(value: T): T {\n const ref = React.useRef(value)\n // `deepEqual` short-circuits on reference equality, so this covers both cases.\n if (!deepEqual(ref.current, value, { ignoreUndefined: false })) {\n ref.current = value\n }\n return ref.current\n}\n\nfunction compareLinkState(a: LinkState, b: LinkState) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]\n}\n\nfunction resolveExternalLink(\n hrefOption: { href: string; external?: boolean } | undefined,\n to: unknown,\n protocolAllowlist: AnyRouter['protocolAllowlist'],\n): string | undefined {\n if (hrefOption?.external) {\n // Block dangerous protocols for external links\n if (isDangerousProtocol(hrefOption.href, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${hrefOption.href}`)\n }\n return undefined\n }\n return hrefOption.href\n }\n if (isSafeInternal(to)) {\n return undefined\n }\n if (typeof to !== 'string' || to.indexOf(':') === -1) {\n return undefined\n }\n try {\n new URL(to)\n // Block dangerous protocols like javascript:, blob:, data:\n if (isDangerousProtocol(to, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n return undefined\n}\n\nfunction resolveIsActive(\n location: ParsedLocation,\n next: ParsedLocation,\n activeOptions: ActiveOptions | undefined,\n basepath: string,\n isHydrated: boolean,\n isExternal: boolean,\n): boolean {\n if (isExternal) {\n return false\n }\n if (activeOptions?.exact) {\n const testExact = exactPathTest(location.pathname, next.pathname, basepath)\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(location.pathname, basepath)\n const nextPathSplit = removeTrailingSlash(next.pathname, basepath)\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(location.search, next.search, {\n partial: !activeOptions?.exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (activeOptions?.includeHash) {\n return isHydrated && location.hash === next.hash\n }\n return true\n}\n\n/**\n * Build anchor-like props for declarative navigation and preloading.\n *\n * Returns stable `href`, event handlers and accessibility props derived from\n * router options and active state. Used internally by `Link` and custom links.\n *\n * Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,\n * `activeProps`, `inactiveProps`, and more.\n *\n * @returns React anchor props suitable for `<a>` or custom components.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook\n */\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n forwardedRef?: React.ForwardedRef<Element>,\n): React.ComponentPropsWithRef<'a'> {\n const router = useRouter()\n const innerRef = useForwardedRef(forwardedRef)\n\n const {\n // custom props\n activeProps,\n inactiveProps,\n activeOptions,\n to,\n preload: userPreload,\n preloadDelay: userPreloadDelay,\n preloadIntentProximity: _preloadIntentProximity,\n hashScrollIntoView,\n replace,\n startTransition,\n resetScroll,\n viewTransition,\n // element props\n children,\n target,\n disabled,\n style,\n className,\n onClick,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n ignoreBlocker,\n // prevent these from being returned\n params: _params,\n search: _search,\n hash: _hash,\n state: _state,\n mask: _mask,\n reloadDocument: _reloadDocument,\n unsafeRelative: _unsafeRelative,\n from: _from,\n _fromLocation,\n ...propsSafeToSpread\n } = options\n\n // ==========================================================================\n // SERVER EARLY RETURN\n // On the server, we return static props without any event handlers,\n // effects, or client-side interactivity.\n //\n // For SSR parity (to avoid hydration errors), we still compute the link's\n // active status on the server, but we avoid creating any router-state\n // subscriptions by reading from the location store directly.\n //\n // Note: `location.hash` is not available on the server.\n // ==========================================================================\n // The expression must stay inlined in the `if` so bundlers fold the\n // browser-build constant `isServer = false` and drop this server block.\n if (isServer ?? router.isServer) {\n const safeInternal = isSafeInternal(to)\n\n // If `to` is obviously an absolute URL, treat as external and avoid\n // computing the internal location via `buildLocation`.\n if (\n typeof to === 'string' &&\n !safeInternal &&\n // Quick checks to avoid `new URL` in common internal-like cases\n to.indexOf(':') > -1\n ) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: undefined,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: to,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n } catch {\n // Not an absolute URL\n }\n }\n\n const next = router.buildLocation({ ...options, from: options.from } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOptionPublicHref = next.maskedLocation\n ? next.maskedLocation.publicHref\n : next.publicHref\n const hrefOptionExternal = next.maskedLocation\n ? next.maskedLocation.external\n : next.external\n const hrefOption = getHrefOption(\n hrefOptionPublicHref,\n hrefOptionExternal,\n router.history,\n disabled,\n )\n\n const externalLink = (() => {\n if (hrefOption?.external) {\n if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n )\n }\n return undefined\n }\n return hrefOption.href\n }\n\n if (safeInternal) return undefined\n\n // Only attempt URL parsing when it looks like an absolute URL.\n if (typeof to === 'string' && to.indexOf(':') > -1) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n }\n\n return undefined\n })()\n\n const isActive = (() => {\n if (externalLink) return false\n\n const currentLocation = router.stores.location.get()\n\n const exact = activeOptions?.exact ?? false\n\n if (exact) {\n const testExact = exactPathTest(\n currentLocation.pathname,\n next.pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n currentLocation.pathname,\n router.basepath,\n )\n const nextPathSplit = removeTrailingSlash(\n next.pathname,\n router.basepath,\n )\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n const includeSearch = activeOptions?.includeSearch ?? true\n if (includeSearch) {\n if (currentLocation.search !== next.search) {\n const currentSearchEmpty =\n !currentLocation.search ||\n (typeof currentLocation.search === 'object' &&\n !hasKeys(currentLocation.search))\n const nextSearchEmpty =\n !next.search ||\n (typeof next.search === 'object' &&\n !hasKeys(next.search as Record<string, unknown>))\n\n if (!(currentSearchEmpty && nextSearchEmpty)) {\n const searchTest = deepEqual(currentLocation.search, next.search, {\n partial: !exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n }\n }\n\n // Hash is not available on the server\n if (activeOptions?.includeHash) {\n return false\n }\n\n return true\n })()\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedStyle = (() => {\n const baseStyle = style\n const activeStyle = resolvedActiveProps.style\n const inactiveStyle = resolvedInactiveProps.style\n\n if (!baseStyle && !activeStyle && !inactiveStyle) {\n return undefined\n }\n\n if (baseStyle && !activeStyle && !inactiveStyle) {\n return baseStyle\n }\n\n if (!baseStyle && activeStyle && !inactiveStyle) {\n return activeStyle\n }\n\n if (!baseStyle && !activeStyle && inactiveStyle) {\n return inactiveStyle\n }\n\n return {\n ...baseStyle,\n ...activeStyle,\n ...inactiveStyle,\n }\n })()\n\n const resolvedClassName = (() => {\n const baseClassName = className\n const activeClassName = resolvedActiveProps.className\n const inactiveClassName = resolvedInactiveProps.className\n\n if (!baseClassName && !activeClassName && !inactiveClassName) {\n return ''\n }\n\n let out = ''\n\n if (baseClassName) {\n out = baseClassName\n }\n\n if (activeClassName) {\n out = out ? `${out} ${activeClassName}` : activeClassName\n }\n\n if (inactiveClassName) {\n out = out ? `${out} ${inactiveClassName}` : inactiveClassName\n }\n\n return out\n })()\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href: hrefOption?.href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n }\n }\n\n // ==========================================================================\n // CLIENT-ONLY CODE\n // Everything below this point only runs on the client. The `isServer` check\n // above is a compile-time constant that bundlers use for dead code elimination,\n // so this entire section is removed from server bundles.\n //\n // We disable the rules-of-hooks lint rule because these hooks appear after\n // an early return. This is safe because:\n // 1. `isServer` is a compile-time constant from conditional exports\n // 2. In server bundles, this code is completely eliminated by the bundler\n // 3. In client bundles, `isServer` is `false`, so the early return never executes\n // ==========================================================================\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isHydrated = useHydrated()\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableSearch = useValueStable(options.search)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableParams = useValueStable(options.params)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableActiveOptions = useValueStable(activeOptions)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const _options = React.useMemo(\n () => options,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n router,\n options.from,\n options._fromLocation,\n options.hash,\n options.to,\n stableSearch,\n stableParams,\n options.state,\n options.mask,\n options.unsafeRelative,\n ],\n )\n\n // Derive inside the selector so `compareLinkState` can bail out. Deriving after\n // the subscription instead re-renders every link on every navigation, because\n // the comparator only sees the location, not whether this link's output moved.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const selectLinkState = React.useCallback(\n (location: ParsedLocation): LinkState => {\n const next = router.buildLocation({\n _fromLocation: location,\n ..._options,\n } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOption = getHrefOption(\n next.maskedLocation ? next.maskedLocation.publicHref : next.publicHref,\n next.maskedLocation ? next.maskedLocation.external : next.external,\n router.history,\n disabled,\n )\n\n const externalLink = resolveExternalLink(\n hrefOption,\n to,\n router.protocolAllowlist,\n )\n\n return [\n hrefOption?.href,\n externalLink,\n resolveIsActive(\n location,\n next,\n stableActiveOptions,\n router.basepath,\n isHydrated,\n externalLink !== undefined,\n ),\n ]\n },\n [stableActiveOptions, disabled, isHydrated, _options, router, to],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [href, externalLink, isActive] = useStore(\n router.stores.location,\n selectLinkState,\n compareLinkState,\n )\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedClassName = [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = (style ||\n resolvedActiveProps.style ||\n resolvedInactiveProps.style) && {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [isTransitioning, setIsTransitioning] = React.useState(false)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const hasRenderFetched = React.useRef(false)\n\n const preload =\n options.reloadDocument || externalLink\n ? false\n : (userPreload ?? router.options.defaultPreload)\n const preloadDelay =\n userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const doPreload = React.useCallback(() => {\n // `preloadRoute` builds the location itself; it is no longer held in render\n // state. It only reads the options, so `_options` can go through as-is.\n router.preloadRoute(_options as any).catch((err) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n }, [router, _options])\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const preloadViewportIoCallback = React.useCallback(\n (entry: IntersectionObserverEntry | undefined) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n },\n [doPreload],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useIntersectionObserver(\n innerRef,\n preloadViewportIoCallback,\n intersectionObserverOptions,\n !!disabled || preload !== 'viewport',\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (hasRenderFetched.current) {\n return\n }\n if (!disabled && preload === 'render') {\n doPreload()\n hasRenderFetched.current = true\n }\n }, [disabled, doPreload, preload])\n\n // The click handler\n const handleClick = (e: React.MouseEvent) => {\n // Check actual element's target attribute as fallback\n const elementTarget = (\n e.currentTarget as HTMLAnchorElement | SVGAElement\n ).getAttribute('target')\n const effectiveTarget = target !== undefined ? target : elementTarget\n\n if (\n !disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!effectiveTarget || effectiveTarget === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n flushSync(() => {\n setIsTransitioning(true)\n })\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n setIsTransitioning(false)\n })\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n router.navigate({\n ..._options,\n replace,\n resetScroll,\n hashScrollIntoView,\n startTransition,\n viewTransition,\n ignoreBlocker,\n })\n }\n }\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n ...(onClick && { onClick }),\n ...(onBlur && { onBlur }),\n ...(onFocus && { onFocus }),\n ...(onMouseEnter && { onMouseEnter }),\n ...(onMouseLeave && { onMouseLeave }),\n ...(onTouchStart && { onTouchStart }),\n }\n }\n\n const enqueueIntentPreload = (e: React.MouseEvent | React.FocusEvent) => {\n if (disabled || preload !== 'intent') return\n\n if (!preloadDelay) {\n doPreload()\n return\n }\n\n const eventTarget = e.currentTarget\n\n if (timeoutMap.has(eventTarget)) {\n return\n }\n\n const id = setTimeout(() => {\n timeoutMap.delete(eventTarget)\n doPreload()\n }, preloadDelay)\n timeoutMap.set(eventTarget, id)\n }\n\n const handleTouchStart = (_: React.TouchEvent) => {\n if (disabled || preload !== 'intent') return\n doPreload()\n }\n\n const handleLeave = (e: React.MouseEvent | React.FocusEvent) => {\n if (disabled || !preload || !preloadDelay) return\n const eventTarget = e.currentTarget\n const id = timeoutMap.get(eventTarget)\n if (id) {\n clearTimeout(id)\n timeoutMap.delete(eventTarget)\n }\n }\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n onClick: composeHandlers([onClick, handleClick]),\n onBlur: composeHandlers([onBlur, handleLeave]),\n onFocus: composeHandlers([onFocus, enqueueIntentPreload]),\n onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n ...(isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS),\n }\n}\n\nconst STATIC_EMPTY_OBJECT = {}\nconst STATIC_ACTIVE_OBJECT = { className: 'active' }\nconst STATIC_DISABLED_PROPS = { role: 'link', 'aria-disabled': true }\nconst STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }\nconst STATIC_TRANSITIONING_PROPS = { 'data-transitioning': 'transitioning' }\n\nconst timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()\n\nconst intersectionObserverOptions: IntersectionObserverInit = {\n rootMargin: '100px',\n}\n\nconst composeHandlers =\n (handlers: Array<undefined | React.EventHandler<any>>) =>\n (e: React.SyntheticEvent) => {\n for (const handler of handlers) {\n if (!handler) continue\n if (e.defaultPrevented) return\n handler(e)\n }\n }\n\nfunction getHrefOption(\n publicHref: string,\n external: boolean,\n history: AnyRouter['history'],\n disabled: boolean | undefined,\n) {\n if (disabled) return undefined\n // Full URL means rewrite changed the origin - treat as external-like\n if (external) {\n return { href: publicHref, external: true }\n }\n return {\n href: history.createHref(publicHref) || '/',\n external: false,\n }\n}\n\nfunction isSafeInternal(to: unknown) {\n if (typeof to !== 'string') return false\n const zero = to.charCodeAt(0)\n if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'\n return zero === 46 // '.', '..', './', '../'\n}\n\ntype UseLinkReactProps<TComp> = TComp extends keyof React.JSX.IntrinsicElements\n ? React.JSX.IntrinsicElements[TComp]\n : TComp extends React.ComponentType<any>\n ? React.ComponentPropsWithoutRef<TComp> &\n React.RefAttributes<React.ComponentRef<TComp>>\n : never\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n UseLinkReactProps<'a'>\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentReactProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => React.ReactNode)\n}\n\ntype LinkComponentReactProps<TComp> = Omit<\n UseLinkReactProps<TComp>,\n keyof CreateLinkProps\n>\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentReactProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => React.ReactElement\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom;\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): React.ReactElement\n}\n\n/**\n * Creates a typed Link-like component that preserves TanStack Router's\n * navigation semantics and type-safety while delegating rendering to the\n * provided host component.\n *\n * Useful for integrating design system anchors/buttons while keeping\n * router-aware props (eg. `to`, `params`, `search`, `preload`).\n *\n * @param Comp The host component to render (eg. a design-system Link/Button)\n * @returns A router-aware component with the same API as `Link`.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link\n */\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => ReactNode>,\n): LinkComponent<TComp> {\n return React.forwardRef(function CreatedLink(props, ref) {\n return <Link {...(props as any)} _asChild={Comp} ref={ref} />\n }) as any\n}\n\n/**\n * A strongly-typed anchor component for declarative navigation.\n * Handles path, search, hash and state updates with optional route preloading\n * and active-state styling.\n *\n * Props:\n * - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)\n * - `preloadDelay`: Delay in ms before preloading on hover\n * - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive\n * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation\n * - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation\n * - `ignoreBlocker`: Bypass registered blockers\n *\n * @returns An anchor-like element that navigates without full page reloads.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent\n */\nexport const Link: LinkComponent<'a'> = React.forwardRef<Element, any>(\n (props, ref) => {\n const { _asChild, ...rest } = props\n const { type: _type, ...linkProps } = useLinkProps(rest as any, ref)\n\n const children =\n typeof rest.children === 'function'\n ? rest.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : rest.children\n\n if (!_asChild) {\n // the ReturnType of useLinkProps returns the correct type for a <a> element, not a general component that has a disabled prop\n // @ts-expect-error\n const { disabled: _, ...rest } = linkProps\n return React.createElement('a', rest, children)\n }\n return React.createElement(_asChild, linkProps, children)\n },\n) as any\n\nfunction isCtrlEvent(e: React.MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\n/**\n * Validate and reuse navigation options for `Link`, `navigate` or `redirect`.\n * Accepts a literal options object and returns it typed for later spreading.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n\n/**\n * Type-check a literal object for use with `Link`, `navigate` or `redirect`.\n * Use to validate and reuse navigation options across your app.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\n"],"mappings":";;;;;;;;;;;;;AAiDA,SAAS,eAAkB,OAAa;CACtC,MAAM,MAAM,MAAM,OAAO,KAAK;CAE9B,IAAI,EAAA,GAAA,sBAAA,WAAW,IAAI,SAAS,OAAO,EAAE,iBAAiB,MAAM,CAAC,GAC3D,IAAI,UAAU;CAEhB,OAAO,IAAI;AACb;AAEA,SAAS,iBAAiB,GAAc,GAAc;CACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM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AG,WAAW,CAAC,MAAM;CAC7C,OAAO,SAAS;AAClB;;;;;;;;;;;;;AAwIA,SAAgB,WACd,MACsB;CACtB,OAAO,MAAM,WAAW,SAAS,YAAY,OAAO,KAAK;EACvD,OAAO,iBAAA,GAAA,kBAAA,KAAC,MAAD;GAAM,GAAK;GAAe,UAAU;GAAW;EAAM,CAAA;CAC9D,CAAC;AACH;;;;;;;;;;;;;;;;;AAkBA,IAAa,OAA2B,MAAM,YAC3C,OAAO,QAAQ;CACd,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,EAAE,MAAM,OAAO,GAAG,cAAc,aAAa,MAAa,GAAG;CAEnE,MAAM,WACJ,OAAO,KAAK,aAAa,aACrB,KAAK,SAAS,EACZ,UAAW,UAAkB,mBAAmB,SAClD,CAAC,IACD,KAAK;CAEX,IAAI,CAAC,UAAU;EAGb,MAAM,EAAE,UAAU,GAAG,GAAG,SAAS;EACjC,OAAO,MAAM,cAAc,KAAK,MAAM,QAAQ;CAChD;CACA,OAAO,MAAM,cAAc,UAAU,WAAW,QAAQ;AAC1D,CACF;AAEA,SAAS,YAAY,GAAqB;CACxC,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE;AACpD;;;;;;;;AAyBA,IAAa,eAAmC,YAAY;CAC1D,OAAO;AACT"}
{"version":3,"file":"link.cjs","names":[],"sources":["../../src/link.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n hasKeys,\n isDangerousProtocol,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nimport { useForwardedRef, useIntersectionObserver } from './utils'\n\nimport { useHydrated } from './ClientOnly'\nimport type {\n ActiveOptions,\n AnyRouter,\n Constrain,\n LinkOptions,\n ParsedLocation,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type { ReactNode } from 'react'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\ntype LinkState = [\n href: string | undefined,\n externalLink: string | undefined,\n isActive: boolean,\n]\n\n// Keep a referentially stable value while the contents are equal. Links\n// routinely pass inline `params` / `search` object literals, which would\n// otherwise change `_options` identity on every parent render, rebuild the\n// store selector, and discard its memoized selection.\n//\n// `ignoreUndefined: false` is required: an explicit `undefined` clears an\n// inherited param or search key, so `{}` and `{ category: undefined }` build\n// different locations and must not be treated as equal here.\nfunction useValueStable<T>(value: T): T {\n const ref = React.useRef(value)\n // `deepEqual` short-circuits on reference equality, so this covers both cases.\n if (!deepEqual(ref.current, value, { ignoreUndefined: false })) {\n ref.current = value\n }\n return ref.current\n}\n\nfunction compareLinkState(a: LinkState, b: LinkState) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]\n}\n\nfunction resolveExternalLink(\n hrefOption: { href: string; external?: boolean } | undefined,\n to: unknown,\n protocolAllowlist: AnyRouter['protocolAllowlist'],\n): string | undefined {\n if (hrefOption?.external) {\n // Block dangerous protocols for external links\n if (isDangerousProtocol(hrefOption.href, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${hrefOption.href}`)\n }\n return undefined\n }\n return hrefOption.href\n }\n if (isSafeInternal(to)) {\n return undefined\n }\n if (typeof to !== 'string' || to.indexOf(':') === -1) {\n return undefined\n }\n try {\n new URL(to)\n // Block dangerous protocols like javascript:, blob:, data:\n if (isDangerousProtocol(to, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n return undefined\n}\n\nfunction resolveIsActive(\n location: ParsedLocation,\n next: ParsedLocation,\n activeOptions: ActiveOptions | undefined,\n basepath: string,\n isHydrated: boolean,\n isExternal: boolean,\n): boolean {\n if (isExternal) {\n return false\n }\n if (activeOptions?.exact) {\n const testExact = exactPathTest(location.pathname, next.pathname, basepath)\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(location.pathname, basepath)\n const nextPathSplit = removeTrailingSlash(next.pathname, basepath)\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(location.search, next.search, {\n partial: !activeOptions?.exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (activeOptions?.includeHash) {\n return isHydrated && location.hash === next.hash\n }\n return true\n}\n\n/**\n * Build anchor-like props for declarative navigation and preloading.\n *\n * Returns stable `href`, event handlers and accessibility props derived from\n * router options and active state. Used internally by `Link` and custom links.\n *\n * Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,\n * `activeProps`, `inactiveProps`, and more.\n *\n * @returns React anchor props suitable for `<a>` or custom components.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook\n */\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n forwardedRef?: React.ForwardedRef<Element>,\n): React.ComponentPropsWithRef<'a'> {\n const router = useRouter()\n const innerRef = useForwardedRef(forwardedRef)\n\n const {\n // custom props\n activeProps,\n inactiveProps,\n activeOptions,\n to,\n preload: userPreload,\n preloadDelay: userPreloadDelay,\n preloadIntentProximity: _preloadIntentProximity,\n hashScrollIntoView,\n replace,\n startTransition,\n resetScroll,\n viewTransition,\n // element props\n children,\n target,\n disabled,\n style,\n className,\n onClick,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n ignoreBlocker,\n // prevent these from being returned\n params: _params,\n search: _search,\n hash: _hash,\n state: _state,\n mask: _mask,\n reloadDocument: _reloadDocument,\n unsafeRelative: _unsafeRelative,\n from: _from,\n _fromLocation,\n ...propsSafeToSpread\n } = options\n\n // ==========================================================================\n // SERVER EARLY RETURN\n // On the server, we return static props without any event handlers,\n // effects, or client-side interactivity.\n //\n // For SSR parity (to avoid hydration errors), we still compute the link's\n // active status on the server, but we avoid creating any router-state\n // subscriptions by reading from the location store directly.\n //\n // Note: `location.hash` is not available on the server.\n // ==========================================================================\n // The expression must stay inlined in the `if` so bundlers fold the\n // browser-build constant `isServer = false` and drop this server block.\n if (isServer ?? router.isServer) {\n const safeInternal = isSafeInternal(to)\n\n // If `to` is obviously an absolute URL, treat as external and avoid\n // computing the internal location via `buildLocation`.\n if (\n typeof to === 'string' &&\n !safeInternal &&\n // Quick checks to avoid `new URL` in common internal-like cases\n to.indexOf(':') > -1\n ) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: undefined,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: to,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n } catch {\n // Not an absolute URL\n }\n }\n\n const next = router.buildLocation({ ...options, from: options.from } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOptionPublicHref = next.maskedLocation\n ? next.maskedLocation.publicHref\n : next.publicHref\n const hrefOptionExternal = next.maskedLocation\n ? next.maskedLocation.external\n : next.external\n const hrefOption = getHrefOption(\n hrefOptionPublicHref,\n hrefOptionExternal,\n router.history,\n disabled,\n )\n\n const externalLink = (() => {\n if (hrefOption?.external) {\n if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n )\n }\n return undefined\n }\n return hrefOption.href\n }\n\n if (safeInternal) return undefined\n\n // Only attempt URL parsing when it looks like an absolute URL.\n if (typeof to === 'string' && to.indexOf(':') > -1) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n }\n\n return undefined\n })()\n\n const isActive = (() => {\n if (externalLink) return false\n\n const currentLocation = router.stores.location.get()\n\n const exact = activeOptions?.exact ?? false\n\n if (exact) {\n const testExact = exactPathTest(\n currentLocation.pathname,\n next.pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n currentLocation.pathname,\n router.basepath,\n )\n const nextPathSplit = removeTrailingSlash(\n next.pathname,\n router.basepath,\n )\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n const includeSearch = activeOptions?.includeSearch ?? true\n if (includeSearch) {\n if (currentLocation.search !== next.search) {\n const currentSearchEmpty =\n !currentLocation.search ||\n (typeof currentLocation.search === 'object' &&\n !hasKeys(currentLocation.search))\n const nextSearchEmpty =\n !next.search ||\n (typeof next.search === 'object' &&\n !hasKeys(next.search as Record<string, unknown>))\n\n if (!(currentSearchEmpty && nextSearchEmpty)) {\n const searchTest = deepEqual(currentLocation.search, next.search, {\n partial: !exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n }\n }\n\n // Hash is not available on the server\n if (activeOptions?.includeHash) {\n return false\n }\n\n return true\n })()\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedStyle = (() => {\n const baseStyle = style\n const activeStyle = resolvedActiveProps.style\n const inactiveStyle = resolvedInactiveProps.style\n\n if (!baseStyle && !activeStyle && !inactiveStyle) {\n return undefined\n }\n\n if (baseStyle && !activeStyle && !inactiveStyle) {\n return baseStyle\n }\n\n if (!baseStyle && activeStyle && !inactiveStyle) {\n return activeStyle\n }\n\n if (!baseStyle && !activeStyle && inactiveStyle) {\n return inactiveStyle\n }\n\n return {\n ...baseStyle,\n ...activeStyle,\n ...inactiveStyle,\n }\n })()\n\n const resolvedClassName = (() => {\n const baseClassName = className\n const activeClassName = resolvedActiveProps.className\n const inactiveClassName = resolvedInactiveProps.className\n\n if (!baseClassName && !activeClassName && !inactiveClassName) {\n return ''\n }\n\n let out = ''\n\n if (baseClassName) {\n out = baseClassName\n }\n\n if (activeClassName) {\n out = out ? `${out} ${activeClassName}` : activeClassName\n }\n\n if (inactiveClassName) {\n out = out ? `${out} ${inactiveClassName}` : inactiveClassName\n }\n\n return out\n })()\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href: hrefOption?.href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n }\n }\n\n // ==========================================================================\n // CLIENT-ONLY CODE\n // Everything below this point only runs on the client. The `isServer` check\n // above is a compile-time constant that bundlers use for dead code elimination,\n // so this entire section is removed from server bundles.\n //\n // We disable the rules-of-hooks lint rule because these hooks appear after\n // an early return. This is safe because:\n // 1. `isServer` is a compile-time constant from conditional exports\n // 2. In server bundles, this code is completely eliminated by the bundler\n // 3. In client bundles, `isServer` is `false`, so the early return never executes\n // ==========================================================================\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isHydrated = useHydrated()\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableSearch = useValueStable(options.search)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableParams = useValueStable(options.params)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableActiveOptions = useValueStable(activeOptions)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const _options = React.useMemo(\n () => options,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n router,\n options.from,\n options._fromLocation,\n options.hash,\n options.to,\n stableSearch,\n stableParams,\n options.state,\n options.mask,\n options.unsafeRelative,\n ],\n )\n\n // Derive inside the selector so `compareLinkState` can bail out. Deriving after\n // the subscription instead re-renders every link on every navigation, because\n // the comparator only sees the location, not whether this link's output moved.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const selectLinkState = React.useCallback(\n (location: ParsedLocation): LinkState => {\n const next = router.buildLocation({\n _fromLocation: location,\n ..._options,\n } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOption = getHrefOption(\n next.maskedLocation ? next.maskedLocation.publicHref : next.publicHref,\n next.maskedLocation ? next.maskedLocation.external : next.external,\n router.history,\n disabled,\n )\n\n const externalLink = resolveExternalLink(\n hrefOption,\n to,\n router.protocolAllowlist,\n )\n\n return [\n hrefOption?.href,\n externalLink,\n resolveIsActive(\n location,\n next,\n stableActiveOptions,\n router.basepath,\n isHydrated,\n externalLink !== undefined,\n ),\n ]\n },\n [stableActiveOptions, disabled, isHydrated, _options, router, to],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [href, externalLink, isActive] = useStore(\n router.stores.location,\n selectLinkState,\n compareLinkState,\n )\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedClassName = [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = (style ||\n resolvedActiveProps.style ||\n resolvedInactiveProps.style) && {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const hasRenderFetched = React.useRef(false)\n\n const preload =\n options.reloadDocument || externalLink || disabled\n ? false\n : (userPreload ?? router.options.defaultPreload)\n const preloadDelay =\n userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const doPreload = React.useCallback(() => {\n // `preloadRoute` builds the location itself; it is no longer held in render\n // state. It only reads the options, so `_options` can go through as-is.\n router.preloadRoute(_options as any).catch((err) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n }, [router, _options])\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const enqueuePreload = React.useCallback(\n (e?: React.MouseEvent | React.FocusEvent | IntersectionObserverEntry) => {\n if (!e) {\n cancelPreload(innerRef)\n return\n }\n\n if (\n !(\n (e as IntersectionObserverEntry).isIntersecting ??\n preload === 'intent'\n )\n ) {\n if ((e as IntersectionObserverEntry).isIntersecting === false) {\n cancelPreload(innerRef)\n }\n return\n }\n\n if (!preloadDelay) {\n doPreload()\n return\n }\n\n if (timeoutMap.has(innerRef)) {\n return\n }\n\n timeoutMap.set(\n innerRef,\n setTimeout(() => {\n timeoutMap.delete(innerRef)\n doPreload()\n }, preloadDelay),\n )\n },\n [doPreload, innerRef, preload, preloadDelay],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useIntersectionObserver(innerRef, enqueuePreload, preload !== 'viewport')\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (hasRenderFetched.current) {\n return\n }\n if (preload === 'render') {\n doPreload()\n hasRenderFetched.current = true\n }\n }, [doPreload, preload])\n\n // The click handler\n const handleClick = (e: React.MouseEvent) => {\n // Check actual element's target attribute as fallback\n const elementTarget = (\n e.currentTarget as HTMLAnchorElement | SVGAElement\n ).getAttribute('target')\n const effectiveTarget = target !== undefined ? target : elementTarget\n\n if (\n !disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!effectiveTarget || effectiveTarget === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n router.navigate({\n ..._options,\n replace,\n resetScroll,\n hashScrollIntoView,\n startTransition,\n viewTransition,\n ignoreBlocker,\n })\n }\n }\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n ...(onClick && { onClick }),\n ...(onBlur && { onBlur }),\n ...(onFocus && { onFocus }),\n ...(onMouseEnter && { onMouseEnter }),\n ...(onMouseLeave && { onMouseLeave }),\n ...(onTouchStart && { onTouchStart }),\n }\n }\n\n const handleTouchStart = () => {\n if (preload !== 'intent') return\n doPreload()\n }\n\n const handleLeave = () => {\n if (preload === 'intent') {\n cancelPreload(innerRef)\n }\n }\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n onClick: composeHandlers([onClick, handleClick]),\n onBlur: composeHandlers([onBlur, handleLeave]),\n onFocus: composeHandlers([onFocus, enqueuePreload]),\n onMouseEnter: composeHandlers([onMouseEnter, enqueuePreload]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n }\n}\n\nconst STATIC_EMPTY_OBJECT = {}\nconst STATIC_ACTIVE_OBJECT = { className: 'active' }\nconst STATIC_DISABLED_PROPS = { role: 'link', 'aria-disabled': true }\nconst STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }\n\nconst timeoutMap = new WeakMap<object, ReturnType<typeof setTimeout>>()\nconst cancelPreload = (eventTarget: object) => {\n clearTimeout(timeoutMap.get(eventTarget))\n timeoutMap.delete(eventTarget)\n}\n\nconst composeHandlers =\n (handlers: Array<undefined | React.EventHandler<any>>) =>\n (e: React.SyntheticEvent) => {\n for (const handler of handlers) {\n if (!handler) continue\n if (e.defaultPrevented) return\n handler(e)\n }\n }\n\nfunction getHrefOption(\n publicHref: string,\n external: boolean,\n history: AnyRouter['history'],\n disabled: boolean | undefined,\n) {\n if (disabled) return undefined\n // Full URL means rewrite changed the origin - treat as external-like\n if (external) {\n return { href: publicHref, external: true }\n }\n return {\n href: history.createHref(publicHref) || '/',\n external: false,\n }\n}\n\nfunction isSafeInternal(to: unknown) {\n if (typeof to !== 'string') return false\n const zero = to.charCodeAt(0)\n if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'\n return zero === 46 // '.', '..', './', '../'\n}\n\ntype UseLinkReactProps<TComp> = TComp extends keyof React.JSX.IntrinsicElements\n ? React.JSX.IntrinsicElements[TComp]\n : TComp extends React.ComponentType<any>\n ? React.ComponentPropsWithoutRef<TComp> &\n React.RefAttributes<React.ComponentRef<TComp>>\n : never\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n UseLinkReactProps<'a'>\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentReactProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n}\n\ntype LinkComponentReactProps<TComp> = Omit<\n UseLinkReactProps<TComp>,\n keyof CreateLinkProps\n>\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentReactProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => React.ReactElement\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom;\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): React.ReactElement\n}\n\n/**\n * Creates a typed Link-like component that preserves TanStack Router's\n * navigation semantics and type-safety while delegating rendering to the\n * provided host component.\n *\n * Useful for integrating design system anchors/buttons while keeping\n * router-aware props (eg. `to`, `params`, `search`, `preload`).\n *\n * @param Comp The host component to render (eg. a design-system Link/Button)\n * @returns A router-aware component with the same API as `Link`.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link\n */\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => ReactNode>,\n): LinkComponent<TComp> {\n return React.forwardRef(function CreatedLink(props, ref) {\n return <Link {...(props as any)} _asChild={Comp} ref={ref} />\n }) as any\n}\n\n/**\n * A strongly-typed anchor component for declarative navigation.\n * Handles path, search, hash and state updates with optional route preloading\n * and active-state styling.\n *\n * Props:\n * - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)\n * - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry\n * - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive\n * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation\n * - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation\n * - `ignoreBlocker`: Bypass registered blockers\n *\n * @returns An anchor-like element that navigates without full page reloads.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent\n */\nexport const Link: LinkComponent<'a'> = React.forwardRef<Element, any>(\n (props, ref) => {\n const { _asChild, ...rest } = props\n const { type: _type, ...linkProps } = useLinkProps(rest as any, ref)\n\n const children =\n typeof rest.children === 'function'\n ? rest.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : rest.children\n\n if (!_asChild) {\n // the ReturnType of useLinkProps returns the correct type for a <a> element, not a general component that has a disabled prop\n // @ts-expect-error\n const { disabled: _, ...rest } = linkProps\n return React.createElement('a', rest, children)\n }\n return React.createElement(_asChild, linkProps, children)\n },\n) as any\n\nfunction isCtrlEvent(e: React.MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\n/**\n * Validate and reuse navigation options for `Link`, `navigate` or `redirect`.\n * Accepts a literal options object and returns it typed for later spreading.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n\n/**\n * Type-check a literal object for use with `Link`, `navigate` or `redirect`.\n * Use to validate and reuse navigation options across your app.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\n"],"mappings":";;;;;;;;;;;;AAgDA,SAAS,eAAkB,OAAa;CACtC,MAAM,MAAM,MAAM,OAAO,KAAK;CAE9B,IAAI,EAAA,GAAA,sBAAA,WAAW,IAAI,SAAS,OAAO,EAAE,iBAAiB,MAAM,CAAC,GAC3D,IAAI,UAAU;CAEhB,OAAO,IAAI;AACb;AAEA,SAAS,iBAAiB,GAAc,GAAc;CACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;AACtD;AAEA,SAAS,oBACP,YACA,IACA,mBACoB;CACpB,IAAI,YAAY,UAAU;EAExB,KAAA,GAAA,sBAAA,qBAAwB,WAAW,MAAM,iBAAiB,GAAG;GAC3D,IAAA,QAAA,IAAA,aAA6B,cAC3B,QAAQ,KAAK,yCAAyC,WAAW,MAAM;GAEzE;EACF;EACA,OAAO,WAAW;CACpB;CACA,IAAI,eAAe,EAAE,GACnB;CAEF,IAAI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O,MAAM,cAAc,UAAU,WAAW,QAAQ;AAC1D,CACF;AAEA,SAAS,YAAY,GAAqB;CACxC,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE;AACpD;;;;;;;;AAyBA,IAAa,eAAmC,YAAY;CAC1D,OAAO;AACT"}

@@ -40,3 +40,2 @@ import { AnyRouter, Constrain, LinkOptions, RegisteredRouter, RoutePaths } from '@tanstack/router-core';

isActive: boolean;
isTransitioning: boolean;
}) => React.ReactNode);

@@ -72,3 +71,3 @@ }

* - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
* - `preloadDelay`: Delay in ms before preloading on hover
* - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry
* - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive

@@ -75,0 +74,0 @@ * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation

"use client";
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
const require_nonRouteComponentContext = require("./nonRouteComponentContext.cjs");
const require_CatchBoundary = require("./CatchBoundary.cjs");

@@ -20,3 +21,5 @@ const require_ClientOnly = require("./ClientOnly.cjs");

const PendingComponent = route?.options.pendingComponent ?? router.options.defaultPendingComponent;
return PendingComponent ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PendingComponent, {}) : null;
if (!PendingComponent) return null;
const pendingElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PendingComponent, {});
return process.env.NODE_ENV !== "production" ? require_nonRouteComponentContext.wrapInNonRouteComponentContext(pendingElement, "pendingComponent") : pendingElement;
}

@@ -64,3 +67,4 @@ var outletMatchSelectionEqual = (a, b) => a[0] === b[0] && a[1] === b[1];

if (error.routeId !== match.routeId) throw error;
return react.createElement(routeNotFoundComponent, error);
const notFoundElement = react.createElement(routeNotFoundComponent, error);
return process.env.NODE_ENV !== "production" ? require_nonRouteComponentContext.wrapInNonRouteComponentContext(notFoundElement, "notFoundComponent") : notFoundElement;
},

@@ -110,7 +114,10 @@ children: resolvedNoSsr ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_ClientOnly.ClientOnly, {

if (match.status === "error") {
if (_tanstack_router_core_isServer.isServer ?? router.isServer) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || require_CatchBoundary.ErrorComponent, {
error: match.error,
reset: void 0,
info: { componentStack: "" }
});
if (_tanstack_router_core_isServer.isServer ?? router.isServer) {
const errorElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)((route.options.errorComponent ?? router.options.defaultErrorComponent) || require_CatchBoundary.ErrorComponent, {
error: match.error,
reset: void 0,
info: { componentStack: "" }
});
return process.env.NODE_ENV !== "production" ? require_nonRouteComponentContext.wrapInNonRouteComponentContext(errorElement, "errorComponent") : errorElement;
}
throw match.error;

@@ -127,2 +134,6 @@ }

var Outlet = react.memo(function OutletImpl() {
if (process.env.NODE_ENV !== "production") {
const nonRouteComponent = react.useContext(require_nonRouteComponentContext.nonRouteComponentContext);
if (nonRouteComponent) console.warn(`Warning: An <Outlet /> was rendered inside a ${nonRouteComponent}. <Outlet /> should only be rendered inside a route component.`);
}
const router = require_useRouter.useRouter();

@@ -129,0 +140,0 @@ const routeId = react.useContext(require_matchContext.matchContext);

@@ -1,1 +0,1 @@

{"version":3,"file":"Match.cjs","names":[],"sources":["../../src/Match.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { isNotFound, rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport { ClientOnly } from './ClientOnly'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n RootRouteOptions,\n} from '@tanstack/router-core'\n\nexport function renderPending(\n router: ReturnType<typeof useRouter>,\n route?: AnyRoute,\n) {\n const PendingComponent =\n route?.options.pendingComponent ?? router.options.defaultPendingComponent\n return PendingComponent ? <PendingComponent /> : null\n}\n\ntype OutletMatchSelection = [\n parentGlobalNotFound: boolean,\n parentNotFoundError: unknown,\n]\n\nconst outletMatchSelectionEqual = (\n a: OutletMatchSelection,\n b: OutletMatchSelection,\n) => a[0] === b[0] && a[1] === b[1]\n\nexport const Match = React.memo(function MatchImpl({\n routeId,\n}: {\n routeId: string\n}) {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n const match = router.stores.byRoute.get(routeId)!.get()!\n return <MatchView router={router} match={match} />\n }\n\n const matchStore = router.stores.getMatchStore(routeId)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const match = useStore(matchStore, (value) => value)\n return <MatchView router={router} match={match!} />\n})\n\nfunction MatchView({\n router,\n match,\n}: {\n router: ReturnType<typeof useRouter>\n match: AnyRouteMatch\n}) {\n const route: AnyRoute = router.routesById[match.routeId]\n\n const pendingElement = renderPending(router, route)\n\n const routeErrorComponent =\n route.options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = route.isRoot\n ? // If it's the root route, use the _notFound option, with fallback to the notFoundRoute's component\n (route.options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route.options.notFoundComponent\n\n const resolvedNoSsr = match.ssr === false || match.ssr === 'data-only'\n const ResolvedSuspenseBoundary =\n (route.options.wrapInSuspense ??\n pendingElement ??\n ((route.options.errorComponent as any)?.preload || resolvedNoSsr))\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const ResolvedNotFoundBoundary = routeNotFoundComponent\n ? CatchNotFound\n : SafeFragment\n\n const ShellComponent = route.isRoot\n ? ((route.options as RootRouteOptions).shellComponent ?? SafeFragment)\n : SafeFragment\n return (\n <ShellComponent>\n <matchContext.Provider value={match.routeId}>\n <ResolvedSuspenseBoundary fallback={pendingElement}>\n <ResolvedCatchBoundary\n getResetKey={() => match}\n errorComponent={routeErrorComponent as any}\n onCatch={(error, errorInfo) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) {\n error.routeId ??= match.routeId\n throw error\n }\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${match.id}`)\n }\n routeOnCatch?.(error, errorInfo)\n }}\n >\n <ResolvedNotFoundBoundary\n fallback={(error) => {\n error.routeId ??= match.routeId\n\n if (error.routeId !== match.routeId) {\n throw error\n }\n\n return React.createElement(\n routeNotFoundComponent!,\n error as any,\n )\n }}\n >\n {resolvedNoSsr ? (\n <ClientOnly fallback={pendingElement}>\n <MatchInner match={match} />\n </ClientOnly>\n ) : (\n <MatchInner match={match} />\n )}\n </ResolvedNotFoundBoundary>\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchContext.Provider>\n {(isServer ?? router.isServer) &&\n route.parentRoute?.id === rootRouteId &&\n router.options.scrollRestoration ? (\n <ScrollRestoration />\n ) : null}\n </ShellComponent>\n )\n}\n\nexport const MatchInner = React.memo(function MatchInnerImpl({\n match,\n}: {\n match: AnyRouteMatch\n}): any {\n const router = useRouter()\n const routeId = match.routeId\n const route = router.routesById[routeId] as AnyRoute\n const key = React.useMemo(() => {\n const remountFn =\n route.options.remountDeps ?? router.options.defaultRemountDeps\n const remountDeps = remountFn?.({\n routeId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n return remountDeps ? JSON.stringify(remountDeps) : undefined\n }, [\n routeId,\n match.loaderDeps,\n match._strictParams,\n match._strictSearch,\n route.options.remountDeps,\n router.options.defaultRemountDeps,\n ])\n const out = React.useMemo(() => {\n const Comp = route.options.component ?? router.options.defaultComponent\n return Comp ? <Comp key={key} /> : <Outlet />\n }, [key, route.options.component, router.options.defaultComponent])\n\n if (match.status === 'pending') {\n if (router._tx) {\n throw router._tx[5]\n }\n return renderPending(router, route)\n }\n\n if (match.status === 'notFound') {\n return renderRouteNotFound(router, route, match.error)\n }\n\n if (match.status === 'error') {\n if (isServer ?? router.isServer) {\n const RouteErrorComponent =\n (route.options.errorComponent ??\n router.options.defaultErrorComponent) ||\n ErrorComponent\n return (\n <RouteErrorComponent\n error={match.error as any}\n reset={undefined as any}\n info={{\n componentStack: '',\n }}\n />\n )\n }\n throw match.error\n }\n\n return out\n})\n\n/**\n * Render the next child match in the route tree. Typically used inside\n * a route component to render nested routes.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent\n */\nexport const Outlet = React.memo(function OutletImpl() {\n const router = useRouter()\n const routeId = React.useContext(matchContext)!\n\n let parentGlobalNotFound: boolean\n let parentNotFoundError: unknown\n let childRouteId: string | undefined\n\n if (isServer ?? router.isServer) {\n const matches = router.stores.matches.get()\n const parentIndex = matches.findIndex((match) => match.routeId === routeId)\n const parentMatch = matches[parentIndex]!\n parentGlobalNotFound = !!parentMatch._notFound\n parentNotFoundError = parentMatch.error\n childRouteId = matches[parentIndex + 1]?.routeId\n } else {\n const parentMatchStore = router.stores.getMatchStore(routeId)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ;[parentGlobalNotFound, parentNotFoundError] = useStore(\n parentMatchStore,\n (match): OutletMatchSelection => [!!match!._notFound, match!.error],\n outletMatchSelectionEqual,\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n childRouteId = useStore(router.stores.ids, (ids) => {\n return ids[ids.indexOf(routeId) + 1]\n })\n }\n\n if (parentGlobalNotFound) {\n return renderRouteNotFound(\n router,\n router.routesById[routeId],\n parentNotFoundError,\n )\n }\n\n if (!childRouteId) {\n return null\n }\n\n const nextMatch = <Match routeId={childRouteId} />\n\n if (routeId === rootRouteId) {\n return (\n <React.Suspense fallback={renderPending(router)}>\n {nextMatch}\n </React.Suspense>\n )\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AAO,UAAU;EAC/B,MAAM,UAAU,OAAO,OAAO,QAAQ,IAAI;EAC1C,MAAM,cAAc,QAAQ,WAAW,UAAU,MAAM,YAAY,OAAO;EAC1E,MAAM,cAAc,QAAQ;EAC5B,uBAAuB,CAAC,CAAC,YAAY;EACrC,sBAAsB,YAAY;EAClC,eAAe,QAAQ,cAAc,IAAI;CAC3C,OAAO;EACL,MAAM,mBAAmB,OAAO,OAAO,cAAc,OAAO;EAG3D,CAAC,sBAAsB,wBAAA,GAAA,sBAAA,UACtB,mBACC,UAAgC,CAAC,CAAC,CAAC,MAAO,WAAW,MAAO,KAAK,GAClE,yBACF;EAGA,gBAAA,GAAA,sBAAA,UAAwB,OAAO,OAAO,MAAM,QAAQ;GAClD,OAAO,IAAI,IAAI,QAAQ,OAAO,IAAI;EACpC,CAAC;CACH;CAEA,IAAI,sBACF,OAAO,4BAAA,oBACL,QACA,OAAO,WAAW,UAClB,mBACF;CAGF,IAAI,CAAC,cACH,OAAO;CAGT,MAAM,YAAY,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAO,SAAS,aAAe,CAAA;CAEjD,IAAI,YAAY,sBAAA,aACd,OACE,iBAAA,GAAA,kBAAA,KAAC,MAAM,UAAP;EAAgB,UAAU,cAAc,MAAM;YAC3C;CACa,CAAA;CAIpB,OAAO;AACT,CAAC"}
{"version":3,"file":"Match.cjs","names":[],"sources":["../../src/Match.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { isNotFound, rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport { ClientOnly } from './ClientOnly'\nimport {\n nonRouteComponentContext,\n wrapInNonRouteComponentContext,\n} from './nonRouteComponentContext'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n RootRouteOptions,\n} from '@tanstack/router-core'\n\nexport function renderPending(\n router: ReturnType<typeof useRouter>,\n route?: AnyRoute,\n) {\n const PendingComponent =\n route?.options.pendingComponent ?? router.options.defaultPendingComponent\n if (!PendingComponent) {\n return null\n }\n\n const pendingElement = <PendingComponent />\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(pendingElement, 'pendingComponent')\n : pendingElement\n}\n\ntype OutletMatchSelection = [\n parentGlobalNotFound: boolean,\n parentNotFoundError: unknown,\n]\n\nconst outletMatchSelectionEqual = (\n a: OutletMatchSelection,\n b: OutletMatchSelection,\n) => a[0] === b[0] && a[1] === b[1]\n\nexport const Match = React.memo(function MatchImpl({\n routeId,\n}: {\n routeId: string\n}) {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n const match = router.stores.byRoute.get(routeId)!.get()!\n return <MatchView router={router} match={match} />\n }\n\n const matchStore = router.stores.getMatchStore(routeId)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const match = useStore(matchStore, (value) => value)\n return <MatchView router={router} match={match!} />\n})\n\nfunction MatchView({\n router,\n match,\n}: {\n router: ReturnType<typeof useRouter>\n match: AnyRouteMatch\n}) {\n const route: AnyRoute = router.routesById[match.routeId]\n\n const pendingElement = renderPending(router, route)\n\n const routeErrorComponent =\n route.options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = route.isRoot\n ? // If it's the root route, use the _notFound option, with fallback to the notFoundRoute's component\n (route.options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route.options.notFoundComponent\n\n const resolvedNoSsr = match.ssr === false || match.ssr === 'data-only'\n const ResolvedSuspenseBoundary =\n (route.options.wrapInSuspense ??\n pendingElement ??\n ((route.options.errorComponent as any)?.preload || resolvedNoSsr))\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const ResolvedNotFoundBoundary = routeNotFoundComponent\n ? CatchNotFound\n : SafeFragment\n\n const ShellComponent = route.isRoot\n ? ((route.options as RootRouteOptions).shellComponent ?? SafeFragment)\n : SafeFragment\n return (\n <ShellComponent>\n <matchContext.Provider value={match.routeId}>\n <ResolvedSuspenseBoundary fallback={pendingElement}>\n <ResolvedCatchBoundary\n getResetKey={() => match}\n errorComponent={routeErrorComponent as any}\n onCatch={(error, errorInfo) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) {\n error.routeId ??= match.routeId\n throw error\n }\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${match.id}`)\n }\n routeOnCatch?.(error, errorInfo)\n }}\n >\n <ResolvedNotFoundBoundary\n fallback={(error) => {\n error.routeId ??= match.routeId\n\n if (error.routeId !== match.routeId) {\n throw error\n }\n\n const notFoundElement = React.createElement(\n routeNotFoundComponent!,\n error as any,\n )\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(\n notFoundElement,\n 'notFoundComponent',\n )\n : notFoundElement\n }}\n >\n {resolvedNoSsr ? (\n <ClientOnly fallback={pendingElement}>\n <MatchInner match={match} />\n </ClientOnly>\n ) : (\n <MatchInner match={match} />\n )}\n </ResolvedNotFoundBoundary>\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchContext.Provider>\n {(isServer ?? router.isServer) &&\n route.parentRoute?.id === rootRouteId &&\n router.options.scrollRestoration ? (\n <ScrollRestoration />\n ) : null}\n </ShellComponent>\n )\n}\n\nexport const MatchInner = React.memo(function MatchInnerImpl({\n match,\n}: {\n match: AnyRouteMatch\n}): any {\n const router = useRouter()\n const routeId = match.routeId\n const route = router.routesById[routeId] as AnyRoute\n const key = React.useMemo(() => {\n const remountFn =\n route.options.remountDeps ?? router.options.defaultRemountDeps\n const remountDeps = remountFn?.({\n routeId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n return remountDeps ? JSON.stringify(remountDeps) : undefined\n }, [\n routeId,\n match.loaderDeps,\n match._strictParams,\n match._strictSearch,\n route.options.remountDeps,\n router.options.defaultRemountDeps,\n ])\n const out = React.useMemo(() => {\n const Comp = route.options.component ?? router.options.defaultComponent\n return Comp ? <Comp key={key} /> : <Outlet />\n }, [key, route.options.component, router.options.defaultComponent])\n\n if (match.status === 'pending') {\n if (router._tx) {\n throw router._tx[5]\n }\n return renderPending(router, route)\n }\n\n if (match.status === 'notFound') {\n return renderRouteNotFound(router, route, match.error)\n }\n\n if (match.status === 'error') {\n if (isServer ?? router.isServer) {\n const RouteErrorComponent =\n (route.options.errorComponent ??\n router.options.defaultErrorComponent) ||\n ErrorComponent\n const errorElement = (\n <RouteErrorComponent\n error={match.error as any}\n reset={undefined as any}\n info={{\n componentStack: '',\n }}\n />\n )\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(errorElement, 'errorComponent')\n : errorElement\n }\n throw match.error\n }\n\n return out\n})\n\n/**\n * Render the next child match in the route tree. Typically used inside\n * a route component to render nested routes.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent\n */\nexport const Outlet = React.memo(function OutletImpl() {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const nonRouteComponent = React.useContext(nonRouteComponentContext!)\n if (nonRouteComponent) {\n console.warn(\n `Warning: An <Outlet /> was rendered inside a ${nonRouteComponent}. <Outlet /> should only be rendered inside a route component.`,\n )\n }\n }\n\n const router = useRouter()\n const routeId = React.useContext(matchContext)!\n\n let parentGlobalNotFound: boolean\n let parentNotFoundError: unknown\n let childRouteId: string | undefined\n\n if (isServer ?? router.isServer) {\n const matches = router.stores.matches.get()\n const parentIndex = matches.findIndex((match) => match.routeId === routeId)\n const parentMatch = matches[parentIndex]!\n parentGlobalNotFound = !!parentMatch._notFound\n parentNotFoundError = parentMatch.error\n childRouteId = matches[parentIndex + 1]?.routeId\n } else {\n const parentMatchStore = router.stores.getMatchStore(routeId)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ;[parentGlobalNotFound, parentNotFoundError] = useStore(\n parentMatchStore,\n (match): OutletMatchSelection => [!!match!._notFound, match!.error],\n outletMatchSelectionEqual,\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n childRouteId = useStore(router.stores.ids, (ids) => {\n return ids[ids.indexOf(routeId) + 1]\n })\n }\n\n if (parentGlobalNotFound) {\n return renderRouteNotFound(\n router,\n router.routesById[routeId],\n parentNotFoundError,\n )\n }\n\n if (!childRouteId) {\n return null\n }\n\n const nextMatch = <Match routeId={childRouteId} />\n\n if (routeId === rootRouteId) {\n return (\n <React.Suspense fallback={renderPending(router)}>\n {nextMatch}\n </React.Suspense>\n )\n }\n\n return nextMatch\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwBA,SAAgB,cACd,QACA,OACA;CACA,MAAM,mBACJ,OAAO,QAAQ,oBAAoB,OAAO,QAAQ;CACpD,IAAI,CAAC,kBACH,OAAO;CAGT,MAAM,iBAAiB,iBAAA,GAAA,kBAAA,KAAC,kBAAD,CAAmB,CAAA;CAC1C,OAAA,QAAA,IAAA,aAAgC,eAC5B,iCAAA,+BAA+B,gBAAgB,kBAAkB,IACjE;AACN;AAOA,IAAM,6BACJ,GACA,MACG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;AAEjC,IAAa,QAAQ,MAAM,KAAK,SAAS,UAAU,EACjD,WAGC;CACD,MAAM,SAAS,kBAAA,UAAU;CAEzB,IAAI,+BAAA,YAAY,OAAO,UAErB,OAAO,iBAAA,GAAA,kBAAA,KAAC,WAAD;EAAmB;EAAe,OAD3B,OAAO,OAAO,QAAQ,IAAI,OAAO,EAAG,IACT;CAAQ,CAAA;CAMnD,OAAO,iBAAA,GAAA,kBAAA,KAAC,WAAD;EAAmB;EAAe,QAAA,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,cAAc,OAAO;EAG3D,CAAC,sBAAsB,wBAAA,GAAA,sBAAA,UACtB,mBACC,UAAgC,CAAC,CAAC,CAAC,MAAO,WAAW,MAAO,KAAK,GAClE,yBACF;EAGA,gBAAA,GAAA,sBAAA,UAAwB,OAAO,OAAO,MAAM,QAAQ;GAClD,OAAO,IAAI,IAAI,QAAQ,OAAO,IAAI;EACpC,CAAC;CACH;CAEA,IAAI,sBACF,OAAO,4BAAA,oBACL,QACA,OAAO,WAAW,UAClB,mBACF;CAGF,IAAI,CAAC,cACH,OAAO;CAGT,MAAM,YAAY,iBAAA,GAAA,kBAAA,KAAC,OAAD,EAAO,SAAS,aAAe,CAAA;CAEjD,IAAI,YAAY,sBAAA,aACd,OACE,iBAAA,GAAA,kBAAA,KAAC,MAAM,UAAP;EAAgB,UAAU,cAAc,MAAM;YAC3C;CACa,CAAA;CAIpB,OAAO;AACT,CAAC"}
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
const require_nonRouteComponentContext = require("./nonRouteComponentContext.cjs");
const require_not_found = require("./not-found.cjs");

@@ -17,3 +18,6 @@ let react = require("react");

if (!route.options.notFoundComponent) {
if (router.options.defaultNotFoundComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(router.options.defaultNotFoundComponent, { ...data });
if (router.options.defaultNotFoundComponent) {
const notFoundElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(router.options.defaultNotFoundComponent, { ...data });
return process.env.NODE_ENV !== "production" ? require_nonRouteComponentContext.wrapInNonRouteComponentContext(notFoundElement, "notFoundComponent") : notFoundElement;
}
if (process.env.NODE_ENV !== "production") {

@@ -24,3 +28,4 @@ if (!route.options.notFoundComponent) console.warn(`Warning: A notFoundError was encountered on the route with ID "${route.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`);

}
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(route.options.notFoundComponent, { ...data });
const notFoundElement = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(route.options.notFoundComponent, { ...data });
return process.env.NODE_ENV !== "production" ? require_nonRouteComponentContext.wrapInNonRouteComponentContext(notFoundElement, "notFoundComponent") : notFoundElement;
}

@@ -27,0 +32,0 @@ //#endregion

@@ -1,1 +0,1 @@

{"version":3,"file":"renderRouteNotFound.cjs","names":[],"sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import * as React from 'react'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\n/**\n * Renders a not found component for a route when no matching route is found.\n *\n * @param router - The router instance containing the route configuration\n * @param route - The route that triggered the not found state\n * @param data - Additional data to pass to the not found component\n * @returns The rendered not found component or a default fallback component\n */\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n return <router.options.defaultNotFoundComponent {...data} />\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!route.options.notFoundComponent) {\n console.warn(\n `Warning: A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`,\n )\n }\n }\n\n return <DefaultGlobalNotFound />\n }\n\n return <route.options.notFoundComponent {...data} />\n}\n"],"mappings":";;;;;;;;;;;;;;AAYA,SAAgB,oBACd,QACA,OACA,MACA;CACA,IAAI,CAAC,MAAM,QAAQ,mBAAmB;EACpC,IAAI,OAAO,QAAQ,0BACjB,OAAO,iBAAA,GAAA,kBAAA,KAAC,OAAO,QAAQ,0BAAhB,EAAyC,GAAI,KAAO,CAAA;EAG7D,IAAA,QAAA,IAAA,aAA6B;OACvB,CAAC,MAAM,QAAQ,mBACjB,QAAQ,KACN,kEAAkE,MAAM,GAAG,mPAC7E;EAAA;EAIJ,OAAO,iBAAA,GAAA,kBAAA,KAAC,kBAAA,uBAAD,CAAwB,CAAA;CACjC;CAEA,OAAO,iBAAA,GAAA,kBAAA,KAAC,MAAM,QAAQ,mBAAf,EAAiC,GAAI,KAAO,CAAA;AACrD"}
{"version":3,"file":"renderRouteNotFound.cjs","names":[],"sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import * as React from 'react'\nimport { DefaultGlobalNotFound } from './not-found'\nimport { wrapInNonRouteComponentContext } from './nonRouteComponentContext'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\n/**\n * Renders a not found component for a route when no matching route is found.\n *\n * @param router - The router instance containing the route configuration\n * @param route - The route that triggered the not found state\n * @param data - Additional data to pass to the not found component\n * @returns The rendered not found component or a default fallback component\n */\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n const notFoundElement = (\n <router.options.defaultNotFoundComponent {...data} />\n )\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(notFoundElement, 'notFoundComponent')\n : notFoundElement\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!route.options.notFoundComponent) {\n console.warn(\n `Warning: A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`,\n )\n }\n }\n\n return <DefaultGlobalNotFound />\n }\n\n const notFoundElement = <route.options.notFoundComponent {...data} />\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(notFoundElement, 'notFoundComponent')\n : notFoundElement\n}\n"],"mappings":";;;;;;;;;;;;;;;AAaA,SAAgB,oBACd,QACA,OACA,MACA;CACA,IAAI,CAAC,MAAM,QAAQ,mBAAmB;EACpC,IAAI,OAAO,QAAQ,0BAA0B;GAC3C,MAAM,kBACJ,iBAAA,GAAA,kBAAA,KAAC,OAAO,QAAQ,0BAAhB,EAAyC,GAAI,KAAO,CAAA;GAEtD,OAAA,QAAA,IAAA,aAAgC,eAC5B,iCAAA,+BAA+B,iBAAiB,mBAAmB,IACnE;EACN;EAEA,IAAA,QAAA,IAAA,aAA6B;OACvB,CAAC,MAAM,QAAQ,mBACjB,QAAQ,KACN,kEAAkE,MAAM,GAAG,mPAC7E;EAAA;EAIJ,OAAO,iBAAA,GAAA,kBAAA,KAAC,kBAAA,uBAAD,CAAwB,CAAA;CACjC;CAEA,MAAM,kBAAkB,iBAAA,GAAA,kBAAA,KAAC,MAAM,QAAQ,mBAAf,EAAiC,GAAI,KAAO,CAAA;CACpE,OAAA,QAAA,IAAA,aAAgC,eAC5B,iCAAA,+BAA+B,iBAAiB,mBAAmB,IACnE;AACN"}

@@ -20,5 +20,4 @@ "use client";

* @param ref - The ref to observe
* @param intersectionObserverOptions - The options to pass to the IntersectionObserver
* @param callback - The callback to call when the intersection changes
* @param disabled - Whether observation is disabled
* @param callback - The callback to call when the intersection changes
* @returns The IntersectionObserver instance

@@ -32,3 +31,2 @@ * @example

* (entry) => { doSomething(entry) },
* { rootMargin: '10px' },
* false

@@ -39,11 +37,12 @@ * )

*/
function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}, disabled) {
function useIntersectionObserver(ref, callback, disabled) {
react.useEffect(() => {
if (!ref.current || disabled || typeof IntersectionObserver !== "function") return;
const observer = new IntersectionObserver(([entry]) => {
callback(entry);
}, intersectionObserverOptions);
if (!ref.current || disabled || typeof IntersectionObserver !== "function") return () => callback();
const observer = new IntersectionObserver((entries) => {
callback(entries.pop());
}, { rootMargin: "100px" });
observer.observe(ref.current);
return () => {
observer.disconnect();
callback();
};

@@ -53,3 +52,2 @@ }, [

disabled,
intersectionObserverOptions,
ref

@@ -56,0 +54,0 @@ ]);

@@ -1,1 +0,1 @@

{"version":3,"file":"utils.cjs","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { isServer } from '@tanstack/router-core/isServer'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\n// eslint-disable-next-line prefer-const -- Must be `let` to prevent bundler constant-folding\nlet REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n | (<T>(usable: Promise<T> | React.Context<T>) => T)\n | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n fn: T,\n): T {\n const fnRef = React.useRef(fn)\n fnRef.current = fn\n\n const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n return ref.current as T\n}\n\nexport const useLayoutEffect =\n (isServer ?? typeof window === 'undefined')\n ? React.useEffect\n : React.useLayoutEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n // initialise the ref with previous and current values\n const ref = React.useRef<{ value: T; prev: T | null }>({\n value: value,\n prev: null,\n })\n\n const current = ref.current.value\n\n // if the value passed into hook doesn't match what we store as \"current\"\n // move the \"current\" to the \"previous\"\n // and store the passed value as \"current\"\n if (value !== current) {\n ref.current = {\n value: value,\n prev: current,\n }\n }\n\n // return the previous value only\n return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param disabled - Whether observation is disabled\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * false\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: React.RefObject<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n disabled?: boolean,\n) {\n React.useEffect(() => {\n if (\n !ref.current ||\n disabled ||\n typeof IntersectionObserver !== 'function'\n ) {\n return\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observer.observe(ref.current)\n\n return () => {\n observer.disconnect()\n }\n }, [callback, disabled, intersectionObserverOptions, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n * const innerRef = useForwardedRef(ref)\n * return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n React.useImperativeHandle(ref, () => innerRef.current!, [])\n return innerRef\n}\n"],"mappings":";;;;;;;;;AAeA,IAAa,WAEI,MAAc;AAY/B,IAAa,kBACV,+BAAA,YAAY,OAAO,WAAW,cAC3B,MAAM,YACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDZ,SAAgB,wBACd,KACA,UACA,8BAAwD,CAAC,GACzD,UACA;CACA,MAAM,gBAAgB;EACpB,IACE,CAAC,IAAI,WACL,YACA,OAAO,yBAAyB,YAEhC;EAGF,MAAM,WAAW,IAAI,sBAAsB,CAAC,WAAW;GACrD,SAAS,KAAK;EAChB,GAAG,2BAA2B;EAE9B,SAAS,QAAQ,IAAI,OAAO;EAE5B,aAAa;GACX,SAAS,WAAW;EACtB;CACF,GAAG;EAAC;EAAU;EAAU;EAA6B;CAAG,CAAC;AAC3D;;;;;;;;;;;;;;AAeA,SAAgB,gBAAmB,KAA6B;CAC9D,MAAM,WAAW,MAAM,OAAU,IAAI;CACrC,MAAM,oBAAoB,WAAW,SAAS,SAAU,CAAC,CAAC;CAC1D,OAAO;AACT"}
{"version":3,"file":"utils.cjs","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { isServer } from '@tanstack/router-core/isServer'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\n// eslint-disable-next-line prefer-const -- Must be `let` to prevent bundler constant-folding\nlet REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n | (<T>(usable: Promise<T> | React.Context<T>) => T)\n | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n fn: T,\n): T {\n const fnRef = React.useRef(fn)\n fnRef.current = fn\n\n const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n return ref.current as T\n}\n\nexport const useLayoutEffect =\n (isServer ?? typeof window === 'undefined')\n ? React.useEffect\n : React.useLayoutEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n // initialise the ref with previous and current values\n const ref = React.useRef<{ value: T; prev: T | null }>({\n value: value,\n prev: null,\n })\n\n const current = ref.current.value\n\n // if the value passed into hook doesn't match what we store as \"current\"\n // move the \"current\" to the \"previous\"\n // and store the passed value as \"current\"\n if (value !== current) {\n ref.current = {\n value: value,\n prev: current,\n }\n }\n\n // return the previous value only\n return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param callback - The callback to call when the intersection changes\n * @param disabled - Whether observation is disabled\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * false\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: React.RefObject<T | null>,\n callback: (entry?: IntersectionObserverEntry) => void,\n disabled?: boolean,\n) {\n React.useEffect(() => {\n if (\n !ref.current ||\n disabled ||\n typeof IntersectionObserver !== 'function'\n ) {\n return () => callback()\n }\n\n const observer = new IntersectionObserver(\n (entries) => {\n callback(entries.pop())\n },\n { rootMargin: '100px' },\n )\n\n observer.observe(ref.current)\n\n return () => {\n observer.disconnect()\n callback()\n }\n }, [callback, disabled, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n * const innerRef = useForwardedRef(ref)\n * return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n React.useImperativeHandle(ref, () => innerRef.current!, [])\n return innerRef\n}\n"],"mappings":";;;;;;;;;AAeA,IAAa,WAEI,MAAc;AAY/B,IAAa,kBACV,+BAAA,YAAY,OAAO,WAAW,cAC3B,MAAM,YACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;AAmDZ,SAAgB,wBACd,KACA,UACA,UACA;CACA,MAAM,gBAAgB;EACpB,IACE,CAAC,IAAI,WACL,YACA,OAAO,yBAAyB,YAEhC,aAAa,SAAS;EAGxB,MAAM,WAAW,IAAI,sBAClB,YAAY;GACX,SAAS,QAAQ,IAAI,CAAC;EACxB,GACA,EAAE,YAAY,QAAQ,CACxB;EAEA,SAAS,QAAQ,IAAI,OAAO;EAE5B,aAAa;GACX,SAAS,WAAW;GACpB,SAAS;EACX;CACF,GAAG;EAAC;EAAU;EAAU;CAAG,CAAC;AAC9B;;;;;;;;;;;;;;AAeA,SAAgB,gBAAmB,KAA6B;CAC9D,MAAM,WAAW,MAAM,OAAU,IAAI;CACrC,MAAM,oBAAoB,WAAW,SAAS,SAAU,CAAC,CAAC;CAC1D,OAAO;AACT"}

@@ -21,5 +21,4 @@ import * as React from 'react';

* @param ref - The ref to observe
* @param intersectionObserverOptions - The options to pass to the IntersectionObserver
* @param callback - The callback to call when the intersection changes
* @param disabled - Whether observation is disabled
* @param callback - The callback to call when the intersection changes
* @returns The IntersectionObserver instance

@@ -33,3 +32,2 @@ * @example

* (entry) => { doSomething(entry) },
* { rootMargin: '10px' },
* false

@@ -40,3 +38,3 @@ * )

*/
export declare function useIntersectionObserver<T extends Element>(ref: React.RefObject<T | null>, callback: (entry: IntersectionObserverEntry | undefined) => void, intersectionObserverOptions?: IntersectionObserverInit, disabled?: boolean): void;
export declare function useIntersectionObserver<T extends Element>(ref: React.RefObject<T | null>, callback: (entry?: IntersectionObserverEntry) => void, disabled?: boolean): void;
/**

@@ -43,0 +41,0 @@ * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.

"use client";
import { wrapInNonRouteComponentContext } from "./nonRouteComponentContext.js";
import * as React$1 from "react";

@@ -32,6 +33,10 @@ import { jsx, jsxs } from "react/jsx-runtime";

const error = this.state.error;
return error ? React$1.createElement(this.props.errorComponent ?? ErrorComponent, {
error,
reset: this.reset
}) : this.props.children;
if (error) {
const element = React$1.createElement(this.props.errorComponent ?? ErrorComponent, {
error,
reset: this.reset
});
return process.env.NODE_ENV !== "production" ? wrapInNonRouteComponentContext(element, "errorComponent") : element;
}
return this.props.children;
}

@@ -38,0 +43,0 @@ };

@@ -1,1 +0,1 @@

{"version":3,"file":"CatchBoundary.js","names":[],"sources":["../../src/CatchBoundary.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport type { ErrorRouteComponent } from './route'\nimport type { ErrorInfo } from 'react'\n\nexport function CatchBoundary(props: {\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}) {\n return <CatchBoundaryImpl {...props} />\n}\n\nclass CatchBoundaryImpl extends React.Component<{\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}> {\n state = { error: null } as { error: Error | null; resetKey?: unknown }\n\n static getDerivedStateFromProps(\n props: { getResetKey: () => unknown },\n state: { resetKey?: unknown; error: Error | null },\n ) {\n const resetKey = props.getResetKey()\n\n if (state.error && state.resetKey !== resetKey) {\n return { resetKey, error: null }\n }\n\n return { resetKey }\n }\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n reset = () => {\n this.setState({ error: null })\n }\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.props.onCatch?.(error, errorInfo)\n }\n render() {\n const error = this.state.error\n return error\n ? React.createElement(this.props.errorComponent ?? ErrorComponent, {\n error,\n reset: this.reset,\n })\n : this.props.children\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code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,EAAK,OAAO,EAAE,QAAQ,SAAS,EAAI,CAAA;GAClC,OACC,oBAAC,OAAD,EAAA,UACE,oBAAC,OAAD;IACE,OAAO;KACL,UAAU;KACV,QAAQ;KACR,cAAc;KACd,SAAS;KACT,OAAO;KACP,UAAU;IACZ;cAEC,MAAM,UAAU,oBAAC,QAAD,EAAA,UAAO,MAAM,QAAc,CAAA,IAAI;GAC7C,CAAA,EACF,CAAA,IACH;EACD;;AAET"}
{"version":3,"file":"CatchBoundary.js","names":[],"sources":["../../src/CatchBoundary.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { wrapInNonRouteComponentContext } from './nonRouteComponentContext'\nimport type { ErrorRouteComponent } from './route'\nimport type { ErrorInfo } from 'react'\n\nexport function CatchBoundary(props: {\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}) {\n return <CatchBoundaryImpl {...props} />\n}\n\nclass CatchBoundaryImpl extends React.Component<{\n getResetKey: () => unknown\n children: React.ReactNode\n errorComponent?: ErrorRouteComponent\n onCatch?: (error: Error, errorInfo: ErrorInfo) => void\n}> {\n state = { error: null } as { error: Error | null; resetKey?: unknown }\n\n static getDerivedStateFromProps(\n props: { getResetKey: () => unknown },\n state: { resetKey?: unknown; error: Error | null },\n ) {\n const resetKey = props.getResetKey()\n\n if (state.error && state.resetKey !== resetKey) {\n return { resetKey, error: null }\n }\n\n return { resetKey }\n }\n static getDerivedStateFromError(error: Error) {\n return { error }\n }\n reset = () => {\n this.setState({ error: null })\n }\n componentDidCatch(error: Error, errorInfo: ErrorInfo) {\n this.props.onCatch?.(error, errorInfo)\n }\n render() {\n const error = this.state.error\n if (error) {\n const element = React.createElement(\n this.props.errorComponent ?? ErrorComponent,\n {\n error,\n reset: this.reset,\n },\n )\n\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(element, 'errorComponent')\n : element\n }\n\n return this.props.children\n }\n}\n\nexport function ErrorComponent({ error }: { error: any }) {\n const [show, setShow] = React.useState(process.env.NODE_ENV !== 'production')\n\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <div style={{ display: 'flex', alignItems: 'center', gap: '.5rem' }}>\n <strong style={{ fontSize: '1rem' }}>Something went wrong!</strong>\n <button\n style={{\n appearance: 'none',\n fontSize: '.6em',\n border: '1px solid currentColor',\n padding: '.1rem .2rem',\n fontWeight: 'bold',\n borderRadius: '.25rem',\n }}\n onClick={() => setShow((d) => !d)}\n >\n {show ? 'Hide Error' : 'Show Error'}\n </button>\n </div>\n <div style={{ height: '.25rem' }} />\n {show ? (\n <div>\n <pre\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.3rem',\n color: 'red',\n overflow: 'auto',\n }}\n >\n {error.message ? <code>{error.message}</code> : null}\n </pre>\n </div>\n ) : null}\n </div>\n )\n}\n"],"mappings":";;;;;AAOA,SAAgB,cAAc,OAK3B;CACD,OAAO,oBAAC,mBAAD,EAAmB,GAAI,MAAQ,CAAA;AACxC;AAEA,IAAM,oBAAN,cAAgC,QAAM,UAKnC;;;eACO,EAAE,OAAO,KAAK;qBAiBR;GACZ,KAAK,SAAS,EAAE,OAAO,KAAK,CAAC;EAC/B;;CAjBA,OAAO,yBACL,OACA,OACA;EACA,MAAM,WAAW,MAAM,YAAY;EAEnC,IAAI,MAAM,SAAS,MAAM,aAAa,UACpC,OAAO;GAAE;GAAU,OAAO;EAAK;EAGjC,OAAO,EAAE,SAAS;CACpB;CACA,OAAO,yBAAyB,OAAc;EAC5C,OAAO,EAAE,MAAM;CACjB;CAIA,kBAAkB,OAAc,WAAsB;EACpD,KAAK,MAAM,UAAU,OAAO,SAAS;CACvC;CACA,SAAS;EACP,MAAM,QAAQ,KAAK,MAAM;EACzB,IAAI,OAAO;GACT,MAAM,UAAU,QAAM,cACpB,KAAK,MAAM,kBAAkB,gBAC7B;IACE;IACA,OAAO,KAAK;GACd,CACF;GAEA,OAAA,QAAA,IAAA,aAAgC,eAC5B,+BAA+B,SAAS,gBAAgB,IACxD;EACN;EAEA,OAAO,KAAK,MAAM;CACpB;AACF;AAEA,SAAgB,eAAe,EAAE,SAAyB;CACxD,MAAM,CAAC,MAAM,WAAW,QAAM,SAAA,QAAA,IAAA,aAAkC,YAAY;CAE5E,OACE,qBAAC,OAAD;EAAK,OAAO;GAAE,SAAS;GAAS,UAAU;EAAO;YAAjD;GACE,qBAAC,OAAD;IAAK,OAAO;KAAE,SAAS;KAAQ,YAAY;KAAU,KAAK;IAAQ;cAAlE,CACE,oBAAC,UAAD;KAAQ,OAAO,EAAE,UAAU,OAAO;eAAG;IAA6B,CAAA,GAClE,oBAAC,UAAD;KACE,OAAO;MACL,YAAY;MACZ,UAAU;MACV,QAAQ;MACR,SAAS;MACT,YAAY;MACZ,cAAc;KAChB;KACA,eAAe,SAAS,MAAM,CAAC,CAAC;eAE/B,OAAO,eAAe;IACjB,CAAA,CACL;;GACL,oBAAC,OAAD,EAAK,OAAO,EAAE,QAAQ,SAAS,EAAI,CAAA;GAClC,OACC,oBAAC,OAAD,EAAA,UACE,oBAAC,OAAD;IACE,OAAO;KACL,UAAU;KACV,QAAQ;KACR,cAAc;KACd,SAAS;KACT,OAAO;KACP,UAAU;IACZ;cAEC,MAAM,UAAU,oBAAC,QAAD,EAAA,UAAO,MAAM,QAAc,CAAA,IAAI;GAC7C,CAAA,EACF,CAAA,IACH;EACD;;AAET"}

@@ -40,3 +40,2 @@ import { AnyRouter, Constrain, LinkOptions, RegisteredRouter, RoutePaths } from '@tanstack/router-core';

isActive: boolean;
isTransitioning: boolean;
}) => React.ReactNode);

@@ -72,3 +71,3 @@ }

* - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
* - `preloadDelay`: Delay in ms before preloading on hover
* - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry
* - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive

@@ -75,0 +74,0 @@ * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation

@@ -10,3 +10,2 @@ "use client";

import { useStore } from "@tanstack/react-store";
import { flushSync } from "react-dom";
//#region src/link.tsx

@@ -251,5 +250,4 @@ function useValueStable(value) {

};
const [isTransitioning, setIsTransitioning] = React$1.useState(false);
const hasRenderFetched = React$1.useRef(false);
const preload = options.reloadDocument || externalLink ? false : userPreload ?? router.options.defaultPreload;
const preload = options.reloadDocument || externalLink || disabled ? false : userPreload ?? router.options.defaultPreload;
const preloadDelay = userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0;

@@ -262,16 +260,34 @@ const doPreload = React$1.useCallback(() => {

}, [router, _options]);
useIntersectionObserver(innerRef, React$1.useCallback((entry) => {
if (entry?.isIntersecting) doPreload();
}, [doPreload]), intersectionObserverOptions, !!disabled || preload !== "viewport");
const enqueuePreload = React$1.useCallback((e) => {
if (!e) {
cancelPreload(innerRef);
return;
}
if (!(e.isIntersecting ?? preload === "intent")) {
if (e.isIntersecting === false) cancelPreload(innerRef);
return;
}
if (!preloadDelay) {
doPreload();
return;
}
if (timeoutMap.has(innerRef)) return;
timeoutMap.set(innerRef, setTimeout(() => {
timeoutMap.delete(innerRef);
doPreload();
}, preloadDelay));
}, [
doPreload,
innerRef,
preload,
preloadDelay
]);
useIntersectionObserver(innerRef, enqueuePreload, preload !== "viewport");
React$1.useEffect(() => {
if (hasRenderFetched.current) return;
if (!disabled && preload === "render") {
if (preload === "render") {
doPreload();
hasRenderFetched.current = true;
}
}, [
disabled,
doPreload,
preload
]);
}, [doPreload, preload]);
const handleClick = (e) => {

@@ -282,9 +298,2 @@ const elementTarget = e.currentTarget.getAttribute("target");

e.preventDefault();
flushSync(() => {
setIsTransitioning(true);
});
const unsub = router.subscribe("onResolved", () => {
unsub();
setIsTransitioning(false);
});
router.navigate({

@@ -317,28 +326,8 @@ ..._options,

};
const enqueueIntentPreload = (e) => {
if (disabled || preload !== "intent") return;
if (!preloadDelay) {
doPreload();
return;
}
const eventTarget = e.currentTarget;
if (timeoutMap.has(eventTarget)) return;
const id = setTimeout(() => {
timeoutMap.delete(eventTarget);
doPreload();
}, preloadDelay);
timeoutMap.set(eventTarget, id);
};
const handleTouchStart = (_) => {
if (disabled || preload !== "intent") return;
const handleTouchStart = () => {
if (preload !== "intent") return;
doPreload();
};
const handleLeave = (e) => {
if (disabled || !preload || !preloadDelay) return;
const eventTarget = e.currentTarget;
const id = timeoutMap.get(eventTarget);
if (id) {
clearTimeout(id);
timeoutMap.delete(eventTarget);
}
const handleLeave = () => {
if (preload === "intent") cancelPreload(innerRef);
};

@@ -353,4 +342,4 @@ return {

onBlur: composeHandlers([onBlur, handleLeave]),
onFocus: composeHandlers([onFocus, enqueueIntentPreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),
onFocus: composeHandlers([onFocus, enqueuePreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueuePreload]),
onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),

@@ -363,4 +352,3 @@ onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),

...disabled && STATIC_DISABLED_PROPS,
...isActive && STATIC_ACTIVE_PROPS,
...isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS
...isActive && STATIC_ACTIVE_PROPS
};

@@ -378,5 +366,7 @@ }

};
var STATIC_TRANSITIONING_PROPS = { "data-transitioning": "transitioning" };
var timeoutMap = /* @__PURE__ */ new WeakMap();
var intersectionObserverOptions = { rootMargin: "100px" };
var cancelPreload = (eventTarget) => {
clearTimeout(timeoutMap.get(eventTarget));
timeoutMap.delete(eventTarget);
};
var composeHandlers = (handlers) => (e) => {

@@ -434,3 +424,3 @@ for (const handler of handlers) {

* - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
* - `preloadDelay`: Delay in ms before preloading on hover
* - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry
* - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive

@@ -437,0 +427,0 @@ * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation

@@ -1,1 +0,1 @@

{"version":3,"file":"link.js","names":[],"sources":["../../src/link.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { flushSync } from 'react-dom'\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n hasKeys,\n isDangerousProtocol,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nimport { useForwardedRef, useIntersectionObserver } from './utils'\n\nimport { useHydrated } from './ClientOnly'\nimport type {\n ActiveOptions,\n AnyRouter,\n Constrain,\n LinkOptions,\n ParsedLocation,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type { ReactNode } from 'react'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\ntype LinkState = [\n href: string | undefined,\n externalLink: string | undefined,\n isActive: boolean,\n]\n\n// Keep a referentially stable value while the contents are equal. Links\n// routinely pass inline `params` / `search` object literals, which would\n// otherwise change `_options` identity on every parent render, rebuild the\n// store selector, and discard its memoized selection.\n//\n// `ignoreUndefined: false` is required: an explicit `undefined` clears an\n// inherited param or search key, so `{}` and `{ category: undefined }` build\n// different locations and must not be treated as equal here.\nfunction useValueStable<T>(value: T): T {\n const ref = React.useRef(value)\n // `deepEqual` short-circuits on reference equality, so this covers both cases.\n if (!deepEqual(ref.current, value, { ignoreUndefined: false })) {\n ref.current = value\n }\n return ref.current\n}\n\nfunction compareLinkState(a: LinkState, b: LinkState) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]\n}\n\nfunction resolveExternalLink(\n hrefOption: { href: string; external?: boolean } | undefined,\n to: unknown,\n protocolAllowlist: AnyRouter['protocolAllowlist'],\n): string | undefined {\n if (hrefOption?.external) {\n // Block dangerous protocols for external links\n if (isDangerousProtocol(hrefOption.href, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${hrefOption.href}`)\n }\n return undefined\n }\n return hrefOption.href\n }\n if (isSafeInternal(to)) {\n return undefined\n }\n if (typeof to !== 'string' || to.indexOf(':') === -1) {\n return undefined\n }\n try {\n new URL(to)\n // Block dangerous protocols like javascript:, blob:, data:\n if (isDangerousProtocol(to, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n return undefined\n}\n\nfunction resolveIsActive(\n location: ParsedLocation,\n next: ParsedLocation,\n activeOptions: ActiveOptions | undefined,\n basepath: string,\n isHydrated: boolean,\n isExternal: boolean,\n): boolean {\n if (isExternal) {\n return false\n }\n if (activeOptions?.exact) {\n const testExact = exactPathTest(location.pathname, next.pathname, basepath)\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(location.pathname, basepath)\n const nextPathSplit = removeTrailingSlash(next.pathname, basepath)\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(location.search, next.search, {\n partial: !activeOptions?.exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (activeOptions?.includeHash) {\n return isHydrated && location.hash === next.hash\n }\n return true\n}\n\n/**\n * Build anchor-like props for declarative navigation and preloading.\n *\n * Returns stable `href`, event handlers and accessibility props derived from\n * router options and active state. Used internally by `Link` and custom links.\n *\n * Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,\n * `activeProps`, `inactiveProps`, and more.\n *\n * @returns React anchor props suitable for `<a>` or custom components.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook\n */\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n forwardedRef?: React.ForwardedRef<Element>,\n): React.ComponentPropsWithRef<'a'> {\n const router = useRouter()\n const innerRef = useForwardedRef(forwardedRef)\n\n const {\n // custom props\n activeProps,\n inactiveProps,\n activeOptions,\n to,\n preload: userPreload,\n preloadDelay: userPreloadDelay,\n preloadIntentProximity: _preloadIntentProximity,\n hashScrollIntoView,\n replace,\n startTransition,\n resetScroll,\n viewTransition,\n // element props\n children,\n target,\n disabled,\n style,\n className,\n onClick,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n ignoreBlocker,\n // prevent these from being returned\n params: _params,\n search: _search,\n hash: _hash,\n state: _state,\n mask: _mask,\n reloadDocument: _reloadDocument,\n unsafeRelative: _unsafeRelative,\n from: _from,\n _fromLocation,\n ...propsSafeToSpread\n } = options\n\n // ==========================================================================\n // SERVER EARLY RETURN\n // On the server, we return static props without any event handlers,\n // effects, or client-side interactivity.\n //\n // For SSR parity (to avoid hydration errors), we still compute the link's\n // active status on the server, but we avoid creating any router-state\n // subscriptions by reading from the location store directly.\n //\n // Note: `location.hash` is not available on the server.\n // ==========================================================================\n // The expression must stay inlined in the `if` so bundlers fold the\n // browser-build constant `isServer = false` and drop this server block.\n if (isServer ?? router.isServer) {\n const safeInternal = isSafeInternal(to)\n\n // If `to` is obviously an absolute URL, treat as external and avoid\n // computing the internal location via `buildLocation`.\n if (\n typeof to === 'string' &&\n !safeInternal &&\n // Quick checks to avoid `new URL` in common internal-like cases\n to.indexOf(':') > -1\n ) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: undefined,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: to,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n } catch {\n // Not an absolute URL\n }\n }\n\n const next = router.buildLocation({ ...options, from: options.from } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOptionPublicHref = next.maskedLocation\n ? next.maskedLocation.publicHref\n : next.publicHref\n const hrefOptionExternal = next.maskedLocation\n ? next.maskedLocation.external\n : next.external\n const hrefOption = getHrefOption(\n hrefOptionPublicHref,\n hrefOptionExternal,\n router.history,\n disabled,\n )\n\n const externalLink = (() => {\n if (hrefOption?.external) {\n if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n )\n }\n return undefined\n }\n return hrefOption.href\n }\n\n if (safeInternal) return undefined\n\n // Only attempt URL parsing when it looks like an absolute URL.\n if (typeof to === 'string' && to.indexOf(':') > -1) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n }\n\n return undefined\n })()\n\n const isActive = (() => {\n if (externalLink) return false\n\n const currentLocation = router.stores.location.get()\n\n const exact = activeOptions?.exact ?? false\n\n if (exact) {\n const testExact = exactPathTest(\n currentLocation.pathname,\n next.pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n currentLocation.pathname,\n router.basepath,\n )\n const nextPathSplit = removeTrailingSlash(\n next.pathname,\n router.basepath,\n )\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n const includeSearch = activeOptions?.includeSearch ?? true\n if (includeSearch) {\n if (currentLocation.search !== next.search) {\n const currentSearchEmpty =\n !currentLocation.search ||\n (typeof currentLocation.search === 'object' &&\n !hasKeys(currentLocation.search))\n const nextSearchEmpty =\n !next.search ||\n (typeof next.search === 'object' &&\n !hasKeys(next.search as Record<string, unknown>))\n\n if (!(currentSearchEmpty && nextSearchEmpty)) {\n const searchTest = deepEqual(currentLocation.search, next.search, {\n partial: !exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n }\n }\n\n // Hash is not available on the server\n if (activeOptions?.includeHash) {\n return false\n }\n\n return true\n })()\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedStyle = (() => {\n const baseStyle = style\n const activeStyle = resolvedActiveProps.style\n const inactiveStyle = resolvedInactiveProps.style\n\n if (!baseStyle && !activeStyle && !inactiveStyle) {\n return undefined\n }\n\n if (baseStyle && !activeStyle && !inactiveStyle) {\n return baseStyle\n }\n\n if (!baseStyle && activeStyle && !inactiveStyle) {\n return activeStyle\n }\n\n if (!baseStyle && !activeStyle && inactiveStyle) {\n return inactiveStyle\n }\n\n return {\n ...baseStyle,\n ...activeStyle,\n ...inactiveStyle,\n }\n })()\n\n const resolvedClassName = (() => {\n const baseClassName = className\n const activeClassName = resolvedActiveProps.className\n const inactiveClassName = resolvedInactiveProps.className\n\n if (!baseClassName && !activeClassName && !inactiveClassName) {\n return ''\n }\n\n let out = ''\n\n if (baseClassName) {\n out = baseClassName\n }\n\n if (activeClassName) {\n out = out ? `${out} ${activeClassName}` : activeClassName\n }\n\n if (inactiveClassName) {\n out = out ? `${out} ${inactiveClassName}` : inactiveClassName\n }\n\n return out\n })()\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href: hrefOption?.href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n }\n }\n\n // ==========================================================================\n // CLIENT-ONLY CODE\n // Everything below this point only runs on the client. The `isServer` check\n // above is a compile-time constant that bundlers use for dead code elimination,\n // so this entire section is removed from server bundles.\n //\n // We disable the rules-of-hooks lint rule because these hooks appear after\n // an early return. This is safe because:\n // 1. `isServer` is a compile-time constant from conditional exports\n // 2. In server bundles, this code is completely eliminated by the bundler\n // 3. In client bundles, `isServer` is `false`, so the early return never executes\n // ==========================================================================\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isHydrated = useHydrated()\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableSearch = useValueStable(options.search)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableParams = useValueStable(options.params)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableActiveOptions = useValueStable(activeOptions)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const _options = React.useMemo(\n () => options,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n router,\n options.from,\n options._fromLocation,\n options.hash,\n options.to,\n stableSearch,\n stableParams,\n options.state,\n options.mask,\n options.unsafeRelative,\n ],\n )\n\n // Derive inside the selector so `compareLinkState` can bail out. Deriving after\n // the subscription instead re-renders every link on every navigation, because\n // the comparator only sees the location, not whether this link's output moved.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const selectLinkState = React.useCallback(\n (location: ParsedLocation): LinkState => {\n const next = router.buildLocation({\n _fromLocation: location,\n ..._options,\n } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOption = getHrefOption(\n next.maskedLocation ? next.maskedLocation.publicHref : next.publicHref,\n next.maskedLocation ? next.maskedLocation.external : next.external,\n router.history,\n disabled,\n )\n\n const externalLink = resolveExternalLink(\n hrefOption,\n to,\n router.protocolAllowlist,\n )\n\n return [\n hrefOption?.href,\n externalLink,\n resolveIsActive(\n location,\n next,\n stableActiveOptions,\n router.basepath,\n isHydrated,\n externalLink !== undefined,\n ),\n ]\n },\n [stableActiveOptions, disabled, isHydrated, _options, router, to],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [href, externalLink, isActive] = useStore(\n router.stores.location,\n selectLinkState,\n compareLinkState,\n )\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedClassName = [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = (style ||\n resolvedActiveProps.style ||\n resolvedInactiveProps.style) && {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [isTransitioning, setIsTransitioning] = React.useState(false)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const hasRenderFetched = React.useRef(false)\n\n const preload =\n options.reloadDocument || externalLink\n ? false\n : (userPreload ?? router.options.defaultPreload)\n const preloadDelay =\n userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const doPreload = React.useCallback(() => {\n // `preloadRoute` builds the location itself; it is no longer held in render\n // state. It only reads the options, so `_options` can go through as-is.\n router.preloadRoute(_options as any).catch((err) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n }, [router, _options])\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const preloadViewportIoCallback = React.useCallback(\n (entry: IntersectionObserverEntry | undefined) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n },\n [doPreload],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useIntersectionObserver(\n innerRef,\n preloadViewportIoCallback,\n intersectionObserverOptions,\n !!disabled || preload !== 'viewport',\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (hasRenderFetched.current) {\n return\n }\n if (!disabled && preload === 'render') {\n doPreload()\n hasRenderFetched.current = true\n }\n }, [disabled, doPreload, preload])\n\n // The click handler\n const handleClick = (e: React.MouseEvent) => {\n // Check actual element's target attribute as fallback\n const elementTarget = (\n e.currentTarget as HTMLAnchorElement | SVGAElement\n ).getAttribute('target')\n const effectiveTarget = target !== undefined ? target : elementTarget\n\n if (\n !disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!effectiveTarget || effectiveTarget === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n flushSync(() => {\n setIsTransitioning(true)\n })\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n setIsTransitioning(false)\n })\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n router.navigate({\n ..._options,\n replace,\n resetScroll,\n hashScrollIntoView,\n startTransition,\n viewTransition,\n ignoreBlocker,\n })\n }\n }\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n ...(onClick && { onClick }),\n ...(onBlur && { onBlur }),\n ...(onFocus && { onFocus }),\n ...(onMouseEnter && { onMouseEnter }),\n ...(onMouseLeave && { onMouseLeave }),\n ...(onTouchStart && { onTouchStart }),\n }\n }\n\n const enqueueIntentPreload = (e: React.MouseEvent | React.FocusEvent) => {\n if (disabled || preload !== 'intent') return\n\n if (!preloadDelay) {\n doPreload()\n return\n }\n\n const eventTarget = e.currentTarget\n\n if (timeoutMap.has(eventTarget)) {\n return\n }\n\n const id = setTimeout(() => {\n timeoutMap.delete(eventTarget)\n doPreload()\n }, preloadDelay)\n timeoutMap.set(eventTarget, id)\n }\n\n const handleTouchStart = (_: React.TouchEvent) => {\n if (disabled || preload !== 'intent') return\n doPreload()\n }\n\n const handleLeave = (e: React.MouseEvent | React.FocusEvent) => {\n if (disabled || !preload || !preloadDelay) return\n const eventTarget = e.currentTarget\n const id = timeoutMap.get(eventTarget)\n if (id) {\n clearTimeout(id)\n timeoutMap.delete(eventTarget)\n }\n }\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n onClick: composeHandlers([onClick, handleClick]),\n onBlur: composeHandlers([onBlur, handleLeave]),\n onFocus: composeHandlers([onFocus, enqueueIntentPreload]),\n onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n ...(isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS),\n }\n}\n\nconst STATIC_EMPTY_OBJECT = {}\nconst STATIC_ACTIVE_OBJECT = { className: 'active' }\nconst STATIC_DISABLED_PROPS = { role: 'link', 'aria-disabled': true }\nconst STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }\nconst STATIC_TRANSITIONING_PROPS = { 'data-transitioning': 'transitioning' }\n\nconst timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()\n\nconst intersectionObserverOptions: IntersectionObserverInit = {\n rootMargin: '100px',\n}\n\nconst composeHandlers =\n (handlers: Array<undefined | React.EventHandler<any>>) =>\n (e: React.SyntheticEvent) => {\n for (const handler of handlers) {\n if (!handler) continue\n if (e.defaultPrevented) return\n handler(e)\n }\n }\n\nfunction getHrefOption(\n publicHref: string,\n external: boolean,\n history: AnyRouter['history'],\n disabled: boolean | undefined,\n) {\n if (disabled) return undefined\n // Full URL means rewrite changed the origin - treat as external-like\n if (external) {\n return { href: publicHref, external: true }\n }\n return {\n href: history.createHref(publicHref) || '/',\n external: false,\n }\n}\n\nfunction isSafeInternal(to: unknown) {\n if (typeof to !== 'string') return false\n const zero = to.charCodeAt(0)\n if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'\n return zero === 46 // '.', '..', './', '../'\n}\n\ntype UseLinkReactProps<TComp> = TComp extends keyof React.JSX.IntrinsicElements\n ? React.JSX.IntrinsicElements[TComp]\n : TComp extends React.ComponentType<any>\n ? React.ComponentPropsWithoutRef<TComp> &\n React.RefAttributes<React.ComponentRef<TComp>>\n : never\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n UseLinkReactProps<'a'>\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentReactProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => React.ReactNode)\n}\n\ntype LinkComponentReactProps<TComp> = Omit<\n UseLinkReactProps<TComp>,\n keyof CreateLinkProps\n>\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentReactProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => React.ReactElement\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom;\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): React.ReactElement\n}\n\n/**\n * Creates a typed Link-like component that preserves TanStack Router's\n * navigation semantics and type-safety while delegating rendering to the\n * provided host component.\n *\n * Useful for integrating design system anchors/buttons while keeping\n * router-aware props (eg. `to`, `params`, `search`, `preload`).\n *\n * @param Comp The host component to render (eg. a design-system Link/Button)\n * @returns A router-aware component with the same API as `Link`.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link\n */\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => ReactNode>,\n): LinkComponent<TComp> {\n return React.forwardRef(function CreatedLink(props, ref) {\n return <Link {...(props as any)} _asChild={Comp} ref={ref} />\n }) as any\n}\n\n/**\n * A strongly-typed anchor component for declarative navigation.\n * Handles path, search, hash and state updates with optional route preloading\n * and active-state styling.\n *\n * Props:\n * - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)\n * - `preloadDelay`: Delay in ms before preloading on hover\n * - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive\n * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation\n * - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation\n * - `ignoreBlocker`: Bypass registered blockers\n *\n * @returns An anchor-like element that navigates without full page reloads.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent\n */\nexport const Link: LinkComponent<'a'> = React.forwardRef<Element, any>(\n (props, ref) => {\n const { _asChild, ...rest } = props\n const { type: _type, ...linkProps } = useLinkProps(rest as any, ref)\n\n const children =\n typeof rest.children === 'function'\n ? rest.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : rest.children\n\n if (!_asChild) {\n // the ReturnType of useLinkProps returns the correct type for a <a> element, not a general component that has a disabled prop\n // @ts-expect-error\n const { disabled: _, ...rest } = linkProps\n return React.createElement('a', rest, children)\n }\n return React.createElement(_asChild, linkProps, children)\n },\n) as any\n\nfunction isCtrlEvent(e: React.MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\n/**\n * Validate and reuse navigation options for `Link`, `navigate` or `redirect`.\n * Accepts a literal options object and returns it typed for later spreading.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n\n/**\n * Type-check a literal object for use with `Link`, `navigate` or `redirect`.\n * Use to validate and reuse navigation options across your app.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\n"],"mappings":";;;;;;;;;;;AAiDA,SAAS,eAAkB,OAAa;CACtC,MAAM,MAAM,QAAM,OAAO,KAAK;CAE9B,IAAI,CAAC,UAAU,IAAI,SAAS,OAAO,EAAE,iBAAiB,MAAM,CAAC,GAC3D,IAAI,UAAU;CAEhB,OAAO,IAAI;AACb;AAEA,SAAS,iBAAiB,GAAc,GAAc;CACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;AACtD;AAEA,SAAS,oBACP,YACA,IACA,mBACoB;CACpB,IAAI,YAAY,UAAU;EAExB,IAAI,oBAAoB,WAAW,MAAM,iBAAiB,GAAG;GAC3D,IAAA,QAAA,IAAA,aAA6B,cAC3B,QAAQ,KAAK,yCAAyC,WAAW,MAAM;GAEzE;EACF;EACA,OAAO,WAAW;CACpB;CACA,IAAI,eAAe,EAAE,GACnB;CAEF,IAAI,OAAO,OAAO,YAAY,GAAG,QAAQ,GAAG,MAAM,IAChD;CAEF,IAAI;EACF,IAAI,IAAI,EAAE;EAEV,IAAI,oBAAoB,IAAI,iBAAiB,GAAG;GAC9C,IAAA,QAAA,IAAA,aAA6B,cAC3B,QAAQ,KAAK,yCAAyC,IAAI;GAE5D;EACF;EACA,OAAO;CACT,QAAQ,CAAC;AAEX;AAEA,SAAS,gBACP,UACA,MACA,eACA,UACA,YACA,YACS;CACT,IAAI,YACF,OAAO;CAET,IAAI,eAAe;MAEb,CADc,cAAc,SAAS,UAAU,KAAK,UAAU,QAC7D,GACH,OAAO;CAAA,OAEJ;EACL,MAAM,mBAAmB,oBAAoB,SAAS,UAAU,Q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O;EACL,MAAM,QAAQ,WAAW,UAAU,KAAK;EACxC,UAAU;CACZ;AACF;AAEA,SAAS,eAAe,IAAa;CACnC,IAAI,OAAO,OAAO,UAAU,OAAO;CACnC,MAAM,OAAO,GAAG,WAAW,CAAC;CAC5B,IAAI,SAAS,IAAI,OAAO,GAAG,WAAW,CAAC,MAAM;CAC7C,OAAO,SAAS;AAClB;;;;;;;;;;;;;AAwIA,SAAgB,WACd,MACsB;CACtB,OAAO,QAAM,WAAW,SAAS,YAAY,OAAO,KAAK;EACvD,OAAO,oBAAC,MAAD;GAAM,GAAK;GAAe,UAAU;GAAW;EAAM,CAAA;CAC9D,CAAC;AACH;;;;;;;;;;;;;;;;;AAkBA,IAAa,OAA2B,QAAM,YAC3C,OAAO,QAAQ;CACd,MAAM,EAAE,UAAU,GAAG,SAAS;CAC9B,MAAM,EAAE,MAAM,OAAO,GAAG,cAAc,aAAa,MAAa,GAAG;CAEnE,MAAM,WACJ,OAAO,KAAK,aAAa,aACrB,KAAK,SAAS,EACZ,UAAW,UAAkB,mBAAmB,SAClD,CAAC,IACD,KAAK;CAEX,IAAI,CAAC,UAAU;EAGb,MAAM,EAAE,UAAU,GAAG,GAAG,SAAS;EACjC,OAAO,QAAM,cAAc,KAAK,MAAM,QAAQ;CAChD;CACA,OAAO,QAAM,cAAc,UAAU,WAAW,QAAQ;AAC1D,CACF;AAEA,SAAS,YAAY,GAAqB;CACxC,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE;AACpD;;;;;;;;AAyBA,IAAa,eAAmC,YAAY;CAC1D,OAAO;AACT"}
{"version":3,"file":"link.js","names":[],"sources":["../../src/link.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n hasKeys,\n isDangerousProtocol,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { useRouter } from './useRouter'\n\nimport { useForwardedRef, useIntersectionObserver } from './utils'\n\nimport { useHydrated } from './ClientOnly'\nimport type {\n ActiveOptions,\n AnyRouter,\n Constrain,\n LinkOptions,\n ParsedLocation,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type { ReactNode } from 'react'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\ntype LinkState = [\n href: string | undefined,\n externalLink: string | undefined,\n isActive: boolean,\n]\n\n// Keep a referentially stable value while the contents are equal. Links\n// routinely pass inline `params` / `search` object literals, which would\n// otherwise change `_options` identity on every parent render, rebuild the\n// store selector, and discard its memoized selection.\n//\n// `ignoreUndefined: false` is required: an explicit `undefined` clears an\n// inherited param or search key, so `{}` and `{ category: undefined }` build\n// different locations and must not be treated as equal here.\nfunction useValueStable<T>(value: T): T {\n const ref = React.useRef(value)\n // `deepEqual` short-circuits on reference equality, so this covers both cases.\n if (!deepEqual(ref.current, value, { ignoreUndefined: false })) {\n ref.current = value\n }\n return ref.current\n}\n\nfunction compareLinkState(a: LinkState, b: LinkState) {\n return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]\n}\n\nfunction resolveExternalLink(\n hrefOption: { href: string; external?: boolean } | undefined,\n to: unknown,\n protocolAllowlist: AnyRouter['protocolAllowlist'],\n): string | undefined {\n if (hrefOption?.external) {\n // Block dangerous protocols for external links\n if (isDangerousProtocol(hrefOption.href, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${hrefOption.href}`)\n }\n return undefined\n }\n return hrefOption.href\n }\n if (isSafeInternal(to)) {\n return undefined\n }\n if (typeof to !== 'string' || to.indexOf(':') === -1) {\n return undefined\n }\n try {\n new URL(to)\n // Block dangerous protocols like javascript:, blob:, data:\n if (isDangerousProtocol(to, protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n return undefined\n}\n\nfunction resolveIsActive(\n location: ParsedLocation,\n next: ParsedLocation,\n activeOptions: ActiveOptions | undefined,\n basepath: string,\n isHydrated: boolean,\n isExternal: boolean,\n): boolean {\n if (isExternal) {\n return false\n }\n if (activeOptions?.exact) {\n const testExact = exactPathTest(location.pathname, next.pathname, basepath)\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(location.pathname, basepath)\n const nextPathSplit = removeTrailingSlash(next.pathname, basepath)\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(location.search, next.search, {\n partial: !activeOptions?.exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (activeOptions?.includeHash) {\n return isHydrated && location.hash === next.hash\n }\n return true\n}\n\n/**\n * Build anchor-like props for declarative navigation and preloading.\n *\n * Returns stable `href`, event handlers and accessibility props derived from\n * router options and active state. Used internally by `Link` and custom links.\n *\n * Options cover `to`, `params`, `search`, `hash`, `state`, `preload`,\n * `activeProps`, `inactiveProps`, and more.\n *\n * @returns React anchor props suitable for `<a>` or custom components.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/useLinkPropsHook\n */\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = string,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n forwardedRef?: React.ForwardedRef<Element>,\n): React.ComponentPropsWithRef<'a'> {\n const router = useRouter()\n const innerRef = useForwardedRef(forwardedRef)\n\n const {\n // custom props\n activeProps,\n inactiveProps,\n activeOptions,\n to,\n preload: userPreload,\n preloadDelay: userPreloadDelay,\n preloadIntentProximity: _preloadIntentProximity,\n hashScrollIntoView,\n replace,\n startTransition,\n resetScroll,\n viewTransition,\n // element props\n children,\n target,\n disabled,\n style,\n className,\n onClick,\n onBlur,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n ignoreBlocker,\n // prevent these from being returned\n params: _params,\n search: _search,\n hash: _hash,\n state: _state,\n mask: _mask,\n reloadDocument: _reloadDocument,\n unsafeRelative: _unsafeRelative,\n from: _from,\n _fromLocation,\n ...propsSafeToSpread\n } = options\n\n // ==========================================================================\n // SERVER EARLY RETURN\n // On the server, we return static props without any event handlers,\n // effects, or client-side interactivity.\n //\n // For SSR parity (to avoid hydration errors), we still compute the link's\n // active status on the server, but we avoid creating any router-state\n // subscriptions by reading from the location store directly.\n //\n // Note: `location.hash` is not available on the server.\n // ==========================================================================\n // The expression must stay inlined in the `if` so bundlers fold the\n // browser-build constant `isServer = false` and drop this server block.\n if (isServer ?? router.isServer) {\n const safeInternal = isSafeInternal(to)\n\n // If `to` is obviously an absolute URL, treat as external and avoid\n // computing the internal location via `buildLocation`.\n if (\n typeof to === 'string' &&\n !safeInternal &&\n // Quick checks to avoid `new URL` in common internal-like cases\n to.indexOf(':') > -1\n ) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: undefined,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: to,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n } catch {\n // Not an absolute URL\n }\n }\n\n const next = router.buildLocation({ ...options, from: options.from } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOptionPublicHref = next.maskedLocation\n ? next.maskedLocation.publicHref\n : next.publicHref\n const hrefOptionExternal = next.maskedLocation\n ? next.maskedLocation.external\n : next.external\n const hrefOption = getHrefOption(\n hrefOptionPublicHref,\n hrefOptionExternal,\n router.history,\n disabled,\n )\n\n const externalLink = (() => {\n if (hrefOption?.external) {\n if (isDangerousProtocol(hrefOption.href, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n `Blocked Link with dangerous protocol: ${hrefOption.href}`,\n )\n }\n return undefined\n }\n return hrefOption.href\n }\n\n if (safeInternal) return undefined\n\n // Only attempt URL parsing when it looks like an absolute URL.\n if (typeof to === 'string' && to.indexOf(':') > -1) {\n try {\n new URL(to)\n if (isDangerousProtocol(to, router.protocolAllowlist)) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Blocked Link with dangerous protocol: ${to}`)\n }\n return undefined\n }\n return to\n } catch {}\n }\n\n return undefined\n })()\n\n const isActive = (() => {\n if (externalLink) return false\n\n const currentLocation = router.stores.location.get()\n\n const exact = activeOptions?.exact ?? false\n\n if (exact) {\n const testExact = exactPathTest(\n currentLocation.pathname,\n next.pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n currentLocation.pathname,\n router.basepath,\n )\n const nextPathSplit = removeTrailingSlash(\n next.pathname,\n router.basepath,\n )\n\n const pathIsFuzzyEqual =\n currentPathSplit.startsWith(nextPathSplit) &&\n (currentPathSplit.length === nextPathSplit.length ||\n currentPathSplit[nextPathSplit.length] === '/')\n\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n const includeSearch = activeOptions?.includeSearch ?? true\n if (includeSearch) {\n if (currentLocation.search !== next.search) {\n const currentSearchEmpty =\n !currentLocation.search ||\n (typeof currentLocation.search === 'object' &&\n !hasKeys(currentLocation.search))\n const nextSearchEmpty =\n !next.search ||\n (typeof next.search === 'object' &&\n !hasKeys(next.search as Record<string, unknown>))\n\n if (!(currentSearchEmpty && nextSearchEmpty)) {\n const searchTest = deepEqual(currentLocation.search, next.search, {\n partial: !exact,\n ignoreUndefined: !activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n }\n }\n\n // Hash is not available on the server\n if (activeOptions?.includeHash) {\n return false\n }\n\n return true\n })()\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n }\n }\n\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedStyle = (() => {\n const baseStyle = style\n const activeStyle = resolvedActiveProps.style\n const inactiveStyle = resolvedInactiveProps.style\n\n if (!baseStyle && !activeStyle && !inactiveStyle) {\n return undefined\n }\n\n if (baseStyle && !activeStyle && !inactiveStyle) {\n return baseStyle\n }\n\n if (!baseStyle && activeStyle && !inactiveStyle) {\n return activeStyle\n }\n\n if (!baseStyle && !activeStyle && inactiveStyle) {\n return inactiveStyle\n }\n\n return {\n ...baseStyle,\n ...activeStyle,\n ...inactiveStyle,\n }\n })()\n\n const resolvedClassName = (() => {\n const baseClassName = className\n const activeClassName = resolvedActiveProps.className\n const inactiveClassName = resolvedInactiveProps.className\n\n if (!baseClassName && !activeClassName && !inactiveClassName) {\n return ''\n }\n\n let out = ''\n\n if (baseClassName) {\n out = baseClassName\n }\n\n if (activeClassName) {\n out = out ? `${out} ${activeClassName}` : activeClassName\n }\n\n if (inactiveClassName) {\n out = out ? `${out} ${inactiveClassName}` : inactiveClassName\n }\n\n return out\n })()\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href: hrefOption?.href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n }\n }\n\n // ==========================================================================\n // CLIENT-ONLY CODE\n // Everything below this point only runs on the client. The `isServer` check\n // above is a compile-time constant that bundlers use for dead code elimination,\n // so this entire section is removed from server bundles.\n //\n // We disable the rules-of-hooks lint rule because these hooks appear after\n // an early return. This is safe because:\n // 1. `isServer` is a compile-time constant from conditional exports\n // 2. In server bundles, this code is completely eliminated by the bundler\n // 3. In client bundles, `isServer` is `false`, so the early return never executes\n // ==========================================================================\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const isHydrated = useHydrated()\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableSearch = useValueStable(options.search)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableParams = useValueStable(options.params)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const stableActiveOptions = useValueStable(activeOptions)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const _options = React.useMemo(\n () => options,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [\n router,\n options.from,\n options._fromLocation,\n options.hash,\n options.to,\n stableSearch,\n stableParams,\n options.state,\n options.mask,\n options.unsafeRelative,\n ],\n )\n\n // Derive inside the selector so `compareLinkState` can bail out. Deriving after\n // the subscription instead re-renders every link on every navigation, because\n // the comparator only sees the location, not whether this link's output moved.\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const selectLinkState = React.useCallback(\n (location: ParsedLocation): LinkState => {\n const next = router.buildLocation({\n _fromLocation: location,\n ..._options,\n } as any)\n\n // Use publicHref - it contains the correct href for display\n // When a rewrite changes the origin, publicHref is the full URL\n // Otherwise it's the origin-stripped path\n // This avoids constructing URL objects in the hot path\n const hrefOption = getHrefOption(\n next.maskedLocation ? next.maskedLocation.publicHref : next.publicHref,\n next.maskedLocation ? next.maskedLocation.external : next.external,\n router.history,\n disabled,\n )\n\n const externalLink = resolveExternalLink(\n hrefOption,\n to,\n router.protocolAllowlist,\n )\n\n return [\n hrefOption?.href,\n externalLink,\n resolveIsActive(\n location,\n next,\n stableActiveOptions,\n router.basepath,\n isHydrated,\n externalLink !== undefined,\n ),\n ]\n },\n [stableActiveOptions, disabled, isHydrated, _options, router, to],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const [href, externalLink, isActive] = useStore(\n router.stores.location,\n selectLinkState,\n compareLinkState,\n )\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> = isActive\n ? (functionalUpdate(activeProps as any, {}) ?? STATIC_ACTIVE_OBJECT)\n : STATIC_EMPTY_OBJECT\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive\n ? STATIC_EMPTY_OBJECT\n : (functionalUpdate(inactiveProps, {}) ?? STATIC_EMPTY_OBJECT)\n\n const resolvedClassName = [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = (style ||\n resolvedActiveProps.style ||\n resolvedInactiveProps.style) && {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const hasRenderFetched = React.useRef(false)\n\n const preload =\n options.reloadDocument || externalLink || disabled\n ? false\n : (userPreload ?? router.options.defaultPreload)\n const preloadDelay =\n userPreloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const doPreload = React.useCallback(() => {\n // `preloadRoute` builds the location itself; it is no longer held in render\n // state. It only reads the options, so `_options` can go through as-is.\n router.preloadRoute(_options as any).catch((err) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n }, [router, _options])\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const enqueuePreload = React.useCallback(\n (e?: React.MouseEvent | React.FocusEvent | IntersectionObserverEntry) => {\n if (!e) {\n cancelPreload(innerRef)\n return\n }\n\n if (\n !(\n (e as IntersectionObserverEntry).isIntersecting ??\n preload === 'intent'\n )\n ) {\n if ((e as IntersectionObserverEntry).isIntersecting === false) {\n cancelPreload(innerRef)\n }\n return\n }\n\n if (!preloadDelay) {\n doPreload()\n return\n }\n\n if (timeoutMap.has(innerRef)) {\n return\n }\n\n timeoutMap.set(\n innerRef,\n setTimeout(() => {\n timeoutMap.delete(innerRef)\n doPreload()\n }, preloadDelay),\n )\n },\n [doPreload, innerRef, preload, preloadDelay],\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useIntersectionObserver(innerRef, enqueuePreload, preload !== 'viewport')\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n if (hasRenderFetched.current) {\n return\n }\n if (preload === 'render') {\n doPreload()\n hasRenderFetched.current = true\n }\n }, [doPreload, preload])\n\n // The click handler\n const handleClick = (e: React.MouseEvent) => {\n // Check actual element's target attribute as fallback\n const elementTarget = (\n e.currentTarget as HTMLAnchorElement | SVGAElement\n ).getAttribute('target')\n const effectiveTarget = target !== undefined ? target : elementTarget\n\n if (\n !disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!effectiveTarget || effectiveTarget === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n router.navigate({\n ..._options,\n replace,\n resetScroll,\n hashScrollIntoView,\n startTransition,\n viewTransition,\n ignoreBlocker,\n })\n }\n }\n\n if (externalLink) {\n return {\n ...propsSafeToSpread,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n href: externalLink,\n ...(children && { children }),\n ...(target && { target }),\n ...(disabled && { disabled }),\n ...(style && { style }),\n ...(className && { className }),\n ...(onClick && { onClick }),\n ...(onBlur && { onBlur }),\n ...(onFocus && { onFocus }),\n ...(onMouseEnter && { onMouseEnter }),\n ...(onMouseLeave && { onMouseLeave }),\n ...(onTouchStart && { onTouchStart }),\n }\n }\n\n const handleTouchStart = () => {\n if (preload !== 'intent') return\n doPreload()\n }\n\n const handleLeave = () => {\n if (preload === 'intent') {\n cancelPreload(innerRef)\n }\n }\n\n return {\n ...propsSafeToSpread,\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n href,\n ref: innerRef as React.ComponentPropsWithRef<'a'>['ref'],\n onClick: composeHandlers([onClick, handleClick]),\n onBlur: composeHandlers([onBlur, handleLeave]),\n onFocus: composeHandlers([onFocus, enqueuePreload]),\n onMouseEnter: composeHandlers([onMouseEnter, enqueuePreload]),\n onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),\n onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),\n disabled: !!disabled,\n target,\n ...(resolvedStyle && { style: resolvedStyle }),\n ...(resolvedClassName && { className: resolvedClassName }),\n ...(disabled && STATIC_DISABLED_PROPS),\n ...(isActive && STATIC_ACTIVE_PROPS),\n }\n}\n\nconst STATIC_EMPTY_OBJECT = {}\nconst STATIC_ACTIVE_OBJECT = { className: 'active' }\nconst STATIC_DISABLED_PROPS = { role: 'link', 'aria-disabled': true }\nconst STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }\n\nconst timeoutMap = new WeakMap<object, ReturnType<typeof setTimeout>>()\nconst cancelPreload = (eventTarget: object) => {\n clearTimeout(timeoutMap.get(eventTarget))\n timeoutMap.delete(eventTarget)\n}\n\nconst composeHandlers =\n (handlers: Array<undefined | React.EventHandler<any>>) =>\n (e: React.SyntheticEvent) => {\n for (const handler of handlers) {\n if (!handler) continue\n if (e.defaultPrevented) return\n handler(e)\n }\n }\n\nfunction getHrefOption(\n publicHref: string,\n external: boolean,\n history: AnyRouter['history'],\n disabled: boolean | undefined,\n) {\n if (disabled) return undefined\n // Full URL means rewrite changed the origin - treat as external-like\n if (external) {\n return { href: publicHref, external: true }\n }\n return {\n href: history.createHref(publicHref) || '/',\n external: false,\n }\n}\n\nfunction isSafeInternal(to: unknown) {\n if (typeof to !== 'string') return false\n const zero = to.charCodeAt(0)\n if (zero === 47) return to.charCodeAt(1) !== 47 // '/' but not '//'\n return zero === 46 // '.', '..', './', '../'\n}\n\ntype UseLinkReactProps<TComp> = TComp extends keyof React.JSX.IntrinsicElements\n ? React.JSX.IntrinsicElements[TComp]\n : TComp extends React.ComponentType<any>\n ? React.ComponentPropsWithoutRef<TComp> &\n React.RefAttributes<React.ComponentRef<TComp>>\n : never\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n UseLinkReactProps<'a'>\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentReactProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n}\n\ntype LinkComponentReactProps<TComp> = Omit<\n UseLinkReactProps<TComp>,\n keyof CreateLinkProps\n>\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentReactProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => React.ReactElement\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom;\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): React.ReactElement\n}\n\n/**\n * Creates a typed Link-like component that preserves TanStack Router's\n * navigation semantics and type-safety while delegating rendering to the\n * provided host component.\n *\n * Useful for integrating design system anchors/buttons while keeping\n * router-aware props (eg. `to`, `params`, `search`, `preload`).\n *\n * @param Comp The host component to render (eg. a design-system Link/Button)\n * @returns A router-aware component with the same API as `Link`.\n * @link https://tanstack.com/router/latest/docs/framework/react/guide/custom-link\n */\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => ReactNode>,\n): LinkComponent<TComp> {\n return React.forwardRef(function CreatedLink(props, ref) {\n return <Link {...(props as any)} _asChild={Comp} ref={ref} />\n }) as any\n}\n\n/**\n * A strongly-typed anchor component for declarative navigation.\n * Handles path, search, hash and state updates with optional route preloading\n * and active-state styling.\n *\n * Props:\n * - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)\n * - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry\n * - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive\n * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation\n * - `viewTransition`/`startTransition`: Use View Transitions/React transitions for navigation\n * - `ignoreBlocker`: Bypass registered blockers\n *\n * @returns An anchor-like element that navigates without full page reloads.\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkComponent\n */\nexport const Link: LinkComponent<'a'> = React.forwardRef<Element, any>(\n (props, ref) => {\n const { _asChild, ...rest } = props\n const { type: _type, ...linkProps } = useLinkProps(rest as any, ref)\n\n const children =\n typeof rest.children === 'function'\n ? rest.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : rest.children\n\n if (!_asChild) {\n // the ReturnType of useLinkProps returns the correct type for a <a> element, not a general component that has a disabled prop\n // @ts-expect-error\n const { disabled: _, ...rest } = linkProps\n return React.createElement('a', rest, children)\n }\n return React.createElement(_asChild, linkProps, children)\n },\n) as any\n\nfunction isCtrlEvent(e: React.MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\n/**\n * Validate and reuse navigation options for `Link`, `navigate` or `redirect`.\n * Accepts a literal options object and returns it typed for later spreading.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n\n/**\n * Type-check a literal object for use with `Link`, `navigate` or `redirect`.\n * Use to validate and reuse navigation options across your app.\n * @example\n * const opts = linkOptions({ to: '/dashboard', search: { tab: 'home' } })\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/linkOptions\n */\n"],"mappings":";;;;;;;;;;AAgDA,SAAS,eAAkB,OAAa;CACtC,MAAM,MAAM,QAAM,OAAO,KAAK;CAE9B,IAAI,CAAC,UAAU,IAAI,SAAS,OAAO,EAAE,iBAAiB,MAAM,CAAC,GAC3D,IAAI,UAAU;CAEhB,OAAO,IAAI;AACb;AAEA,SAAS,iBAAiB,GAAc,GAAc;CACpD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;AACtD;AAEA,SAAS,oBACP,YACA,IACA,mBACoB;CACpB,IAAI,YAAY,UAAU;EAExB,IAAI,oBAAoB,WAAW,MAAM,iBAAiB,GAAG;GAC3D,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C,YAAY;CAC1D,OAAO;AACT"}
"use client";
import { nonRouteComponentContext, wrapInNonRouteComponentContext } from "./nonRouteComponentContext.js";
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";

@@ -18,3 +19,5 @@ import { ClientOnly } from "./ClientOnly.js";

const PendingComponent = route?.options.pendingComponent ?? router.options.defaultPendingComponent;
return PendingComponent ? /* @__PURE__ */ jsx(PendingComponent, {}) : null;
if (!PendingComponent) return null;
const pendingElement = /* @__PURE__ */ jsx(PendingComponent, {});
return process.env.NODE_ENV !== "production" ? wrapInNonRouteComponentContext(pendingElement, "pendingComponent") : pendingElement;
}

@@ -62,3 +65,4 @@ var outletMatchSelectionEqual = (a, b) => a[0] === b[0] && a[1] === b[1];

if (error.routeId !== match.routeId) throw error;
return React$1.createElement(routeNotFoundComponent, error);
const notFoundElement = React$1.createElement(routeNotFoundComponent, error);
return process.env.NODE_ENV !== "production" ? wrapInNonRouteComponentContext(notFoundElement, "notFoundComponent") : notFoundElement;
},

@@ -108,7 +112,10 @@ children: resolvedNoSsr ? /* @__PURE__ */ jsx(ClientOnly, {

if (match.status === "error") {
if (isServer ?? router.isServer) return /* @__PURE__ */ jsx((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
error: match.error,
reset: void 0,
info: { componentStack: "" }
});
if (isServer ?? router.isServer) {
const errorElement = /* @__PURE__ */ jsx((route.options.errorComponent ?? router.options.defaultErrorComponent) || ErrorComponent, {
error: match.error,
reset: void 0,
info: { componentStack: "" }
});
return process.env.NODE_ENV !== "production" ? wrapInNonRouteComponentContext(errorElement, "errorComponent") : errorElement;
}
throw match.error;

@@ -125,2 +132,6 @@ }

var Outlet = React$1.memo(function OutletImpl() {
if (process.env.NODE_ENV !== "production") {
const nonRouteComponent = React$1.useContext(nonRouteComponentContext);
if (nonRouteComponent) console.warn(`Warning: An <Outlet /> was rendered inside a ${nonRouteComponent}. <Outlet /> should only be rendered inside a route component.`);
}
const router = useRouter();

@@ -127,0 +138,0 @@ const routeId = React$1.useContext(matchContext);

@@ -1,1 +0,1 @@

{"version":3,"file":"Match.js","names":[],"sources":["../../src/Match.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { isNotFound, rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport { ClientOnly } from './ClientOnly'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n RootRouteOptions,\n} from '@tanstack/router-core'\n\nexport function renderPending(\n router: ReturnType<typeof useRouter>,\n route?: AnyRoute,\n) {\n const PendingComponent =\n route?.options.pendingComponent ?? router.options.defaultPendingComponent\n return PendingComponent ? <PendingComponent /> : null\n}\n\ntype OutletMatchSelection = [\n parentGlobalNotFound: boolean,\n parentNotFoundError: unknown,\n]\n\nconst outletMatchSelectionEqual = (\n a: OutletMatchSelection,\n b: OutletMatchSelection,\n) => a[0] === b[0] && a[1] === b[1]\n\nexport const Match = React.memo(function MatchImpl({\n routeId,\n}: {\n routeId: string\n}) {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n const match = router.stores.byRoute.get(routeId)!.get()!\n return <MatchView router={router} match={match} />\n }\n\n const matchStore = router.stores.getMatchStore(routeId)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const match = useStore(matchStore, (value) => value)\n return <MatchView router={router} match={match!} />\n})\n\nfunction MatchView({\n router,\n match,\n}: {\n router: ReturnType<typeof useRouter>\n match: AnyRouteMatch\n}) {\n const route: AnyRoute = router.routesById[match.routeId]\n\n const pendingElement = renderPending(router, route)\n\n const routeErrorComponent =\n route.options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = route.isRoot\n ? // If it's the root route, use the _notFound option, with fallback to the notFoundRoute's component\n (route.options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route.options.notFoundComponent\n\n const resolvedNoSsr = match.ssr === false || match.ssr === 'data-only'\n const ResolvedSuspenseBoundary =\n (route.options.wrapInSuspense ??\n pendingElement ??\n ((route.options.errorComponent as any)?.preload || resolvedNoSsr))\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const ResolvedNotFoundBoundary = routeNotFoundComponent\n ? CatchNotFound\n : SafeFragment\n\n const ShellComponent = route.isRoot\n ? ((route.options as RootRouteOptions).shellComponent ?? SafeFragment)\n : SafeFragment\n return (\n <ShellComponent>\n <matchContext.Provider value={match.routeId}>\n <ResolvedSuspenseBoundary fallback={pendingElement}>\n <ResolvedCatchBoundary\n getResetKey={() => match}\n errorComponent={routeErrorComponent as any}\n onCatch={(error, errorInfo) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) {\n error.routeId ??= match.routeId\n throw error\n }\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${match.id}`)\n }\n routeOnCatch?.(error, errorInfo)\n }}\n >\n <ResolvedNotFoundBoundary\n fallback={(error) => {\n error.routeId ??= match.routeId\n\n if (error.routeId !== match.routeId) {\n throw error\n }\n\n return React.createElement(\n routeNotFoundComponent!,\n error as any,\n )\n }}\n >\n {resolvedNoSsr ? (\n <ClientOnly fallback={pendingElement}>\n <MatchInner match={match} />\n </ClientOnly>\n ) : (\n <MatchInner match={match} />\n )}\n </ResolvedNotFoundBoundary>\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchContext.Provider>\n {(isServer ?? router.isServer) &&\n route.parentRoute?.id === rootRouteId &&\n router.options.scrollRestoration ? (\n <ScrollRestoration />\n ) : null}\n </ShellComponent>\n )\n}\n\nexport const MatchInner = React.memo(function MatchInnerImpl({\n match,\n}: {\n match: AnyRouteMatch\n}): any {\n const router = useRouter()\n const routeId = match.routeId\n const route = router.routesById[routeId] as AnyRoute\n const key = React.useMemo(() => {\n const remountFn =\n route.options.remountDeps ?? router.options.defaultRemountDeps\n const remountDeps = remountFn?.({\n routeId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n return remountDeps ? JSON.stringify(remountDeps) : undefined\n }, [\n routeId,\n match.loaderDeps,\n match._strictParams,\n match._strictSearch,\n route.options.remountDeps,\n router.options.defaultRemountDeps,\n ])\n const out = React.useMemo(() => {\n const Comp = route.options.component ?? router.options.defaultComponent\n return Comp ? <Comp key={key} /> : <Outlet />\n }, [key, route.options.component, router.options.defaultComponent])\n\n if (match.status === 'pending') {\n if (router._tx) {\n throw router._tx[5]\n }\n return renderPending(router, route)\n }\n\n if (match.status === 'notFound') {\n return renderRouteNotFound(router, route, match.error)\n }\n\n if (match.status === 'error') {\n if (isServer ?? router.isServer) {\n const RouteErrorComponent =\n (route.options.errorComponent ??\n router.options.defaultErrorComponent) ||\n ErrorComponent\n return (\n <RouteErrorComponent\n error={match.error as any}\n reset={undefined as any}\n info={{\n componentStack: '',\n }}\n />\n )\n }\n throw match.error\n }\n\n return out\n})\n\n/**\n * Render the next child match in the route tree. Typically used inside\n * a route component to render nested routes.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent\n */\nexport const Outlet = React.memo(function OutletImpl() {\n const router = useRouter()\n const routeId = React.useContext(matchContext)!\n\n let parentGlobalNotFound: boolean\n let parentNotFoundError: unknown\n let childRouteId: string | undefined\n\n if (isServer ?? router.isServer) {\n const matches = router.stores.matches.get()\n const parentIndex = matches.findIndex((match) => match.routeId === routeId)\n const parentMatch = matches[parentIndex]!\n parentGlobalNotFound = !!parentMatch._notFound\n parentNotFoundError = parentMatch.error\n childRouteId = matches[parentIndex + 1]?.routeId\n } else {\n const parentMatchStore = router.stores.getMatchStore(routeId)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ;[parentGlobalNotFound, parentNotFoundError] = useStore(\n parentMatchStore,\n (match): OutletMatchSelection => [!!match!._notFound, match!.error],\n outletMatchSelectionEqual,\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n childRouteId = useStore(router.stores.ids, (ids) => {\n return ids[ids.indexOf(routeId) + 1]\n })\n }\n\n if (parentGlobalNotFound) {\n return renderRouteNotFound(\n router,\n router.routesById[routeId],\n parentNotFoundError,\n )\n }\n\n if (!childRouteId) {\n return null\n }\n\n const nextMatch = <Match routeId={childRouteId} />\n\n if (routeId === rootRouteId) {\n return (\n <React.Suspense fallback={renderPending(router)}>\n {nextMatch}\n </React.Suspense>\n )\n }\n\n return nextMatch\n})\n"],"mappings":";;;;;;;;;;;;;;;AAoBA,SAAgB,cACd,QACA,OACA;CACA,MAAM,mBACJ,OAAO,QAAQ,oBAAoB,OAAO,QAAQ;CACpD,OAAO,mBAAmB,oBAAC,kBAAD,CAAmB,CAAA,IAAI;AACnD;AAOA,IAAM,6BACJ,GACA,MACG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;AAEjC,IAAa,QAAQ,QAAM,KAAK,SAAS,UAAU,EACjD,WAGC;CACD,MAAM,SAAS,UAAU;CAEzB,IAAI,YAAY,OAAO,UAErB,OAAO,oBAAC,WAAD;EAAmB;EAAe,OAD3B,OAAO,OAAO,QAAQ,IAAI,OAAO,EAAG,IACT;CAAQ,CAAA;CAMnD,OAAO,oBAAC,WAAD;EAAmB;EAAe,OAD3B,SAFK,OAAO,OAAO,cAAc,OAExB,IAAa,UAAU,KACL;CAAS,CAAA;AACpD,CAAC;AAED,SAAS,UAAU,EACjB,QACA,SAIC;CACD,MAAM,QAAkB,OAAO,WAAW,MAAM;CAEhD,MAAM,iBAAiB,cAAc,QAAQ,KAAK;CAElD,MAAM,sBACJ,MAAM,QAAQ,kBAAkB,OAAO,QAAQ;CAEjD,MAAM,eAAe,MAA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U;EAC/B,MAAM,UAAU,OAAO,OAAO,QAAQ,IAAI;EAC1C,MAAM,cAAc,QAAQ,WAAW,UAAU,MAAM,YAAY,OAAO;EAC1E,MAAM,cAAc,QAAQ;EAC5B,uBAAuB,CAAC,CAAC,YAAY;EACrC,sBAAsB,YAAY;EAClC,eAAe,QAAQ,cAAc,IAAI;CAC3C,OAAO;EACL,MAAM,mBAAmB,OAAO,OAAO,cAAc,OAAO;EAG3D,CAAC,sBAAsB,uBAAuB,SAC7C,mBACC,UAAgC,CAAC,CAAC,CAAC,MAAO,WAAW,MAAO,KAAK,GAClE,yBACF;EAGA,eAAe,SAAS,OAAO,OAAO,MAAM,QAAQ;GAClD,OAAO,IAAI,IAAI,QAAQ,OAAO,IAAI;EACpC,CAAC;CACH;CAEA,IAAI,sBACF,OAAO,oBACL,QACA,OAAO,WAAW,UAClB,mBACF;CAGF,IAAI,CAAC,cACH,OAAO;CAGT,MAAM,YAAY,oBAAC,OAAD,EAAO,SAAS,aAAe,CAAA;CAEjD,IAAI,YAAY,aACd,OACE,oBAAC,QAAM,UAAP;EAAgB,UAAU,cAAc,MAAM;YAC3C;CACa,CAAA;CAIpB,OAAO;AACT,CAAC"}
{"version":3,"file":"Match.js","names":[],"sources":["../../src/Match.tsx"],"sourcesContent":["'use client'\n\nimport * as React from 'react'\nimport { useStore } from '@tanstack/react-store'\nimport { isNotFound, rootRouteId } from '@tanstack/router-core'\nimport { isServer } from '@tanstack/router-core/isServer'\nimport { CatchBoundary, ErrorComponent } from './CatchBoundary'\nimport { useRouter } from './useRouter'\nimport { CatchNotFound } from './not-found'\nimport { matchContext } from './matchContext'\nimport { SafeFragment } from './SafeFragment'\nimport { renderRouteNotFound } from './renderRouteNotFound'\nimport { ScrollRestoration } from './scroll-restoration'\nimport { ClientOnly } from './ClientOnly'\nimport {\n nonRouteComponentContext,\n wrapInNonRouteComponentContext,\n} from './nonRouteComponentContext'\nimport type {\n AnyRoute,\n AnyRouteMatch,\n RootRouteOptions,\n} from '@tanstack/router-core'\n\nexport function renderPending(\n router: ReturnType<typeof useRouter>,\n route?: AnyRoute,\n) {\n const PendingComponent =\n route?.options.pendingComponent ?? router.options.defaultPendingComponent\n if (!PendingComponent) {\n return null\n }\n\n const pendingElement = <PendingComponent />\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(pendingElement, 'pendingComponent')\n : pendingElement\n}\n\ntype OutletMatchSelection = [\n parentGlobalNotFound: boolean,\n parentNotFoundError: unknown,\n]\n\nconst outletMatchSelectionEqual = (\n a: OutletMatchSelection,\n b: OutletMatchSelection,\n) => a[0] === b[0] && a[1] === b[1]\n\nexport const Match = React.memo(function MatchImpl({\n routeId,\n}: {\n routeId: string\n}) {\n const router = useRouter()\n\n if (isServer ?? router.isServer) {\n const match = router.stores.byRoute.get(routeId)!.get()!\n return <MatchView router={router} match={match} />\n }\n\n const matchStore = router.stores.getMatchStore(routeId)\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const match = useStore(matchStore, (value) => value)\n return <MatchView router={router} match={match!} />\n})\n\nfunction MatchView({\n router,\n match,\n}: {\n router: ReturnType<typeof useRouter>\n match: AnyRouteMatch\n}) {\n const route: AnyRoute = router.routesById[match.routeId]\n\n const pendingElement = renderPending(router, route)\n\n const routeErrorComponent =\n route.options.errorComponent ?? router.options.defaultErrorComponent\n\n const routeOnCatch = route.options.onCatch ?? router.options.defaultOnCatch\n\n const routeNotFoundComponent = route.isRoot\n ? // If it's the root route, use the _notFound option, with fallback to the notFoundRoute's component\n (route.options.notFoundComponent ??\n router.options.notFoundRoute?.options.component)\n : route.options.notFoundComponent\n\n const resolvedNoSsr = match.ssr === false || match.ssr === 'data-only'\n const ResolvedSuspenseBoundary =\n (route.options.wrapInSuspense ??\n pendingElement ??\n ((route.options.errorComponent as any)?.preload || resolvedNoSsr))\n ? React.Suspense\n : SafeFragment\n\n const ResolvedCatchBoundary = routeErrorComponent\n ? CatchBoundary\n : SafeFragment\n\n const ResolvedNotFoundBoundary = routeNotFoundComponent\n ? CatchNotFound\n : SafeFragment\n\n const ShellComponent = route.isRoot\n ? ((route.options as RootRouteOptions).shellComponent ?? SafeFragment)\n : SafeFragment\n return (\n <ShellComponent>\n <matchContext.Provider value={match.routeId}>\n <ResolvedSuspenseBoundary fallback={pendingElement}>\n <ResolvedCatchBoundary\n getResetKey={() => match}\n errorComponent={routeErrorComponent as any}\n onCatch={(error, errorInfo) => {\n // Forward not found errors (we don't want to show the error component for these)\n if (isNotFound(error)) {\n error.routeId ??= match.routeId\n throw error\n }\n if (process.env.NODE_ENV !== 'production') {\n console.warn(`Warning: Error in route match: ${match.id}`)\n }\n routeOnCatch?.(error, errorInfo)\n }}\n >\n <ResolvedNotFoundBoundary\n fallback={(error) => {\n error.routeId ??= match.routeId\n\n if (error.routeId !== match.routeId) {\n throw error\n }\n\n const notFoundElement = React.createElement(\n routeNotFoundComponent!,\n error as any,\n )\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(\n notFoundElement,\n 'notFoundComponent',\n )\n : notFoundElement\n }}\n >\n {resolvedNoSsr ? (\n <ClientOnly fallback={pendingElement}>\n <MatchInner match={match} />\n </ClientOnly>\n ) : (\n <MatchInner match={match} />\n )}\n </ResolvedNotFoundBoundary>\n </ResolvedCatchBoundary>\n </ResolvedSuspenseBoundary>\n </matchContext.Provider>\n {(isServer ?? router.isServer) &&\n route.parentRoute?.id === rootRouteId &&\n router.options.scrollRestoration ? (\n <ScrollRestoration />\n ) : null}\n </ShellComponent>\n )\n}\n\nexport const MatchInner = React.memo(function MatchInnerImpl({\n match,\n}: {\n match: AnyRouteMatch\n}): any {\n const router = useRouter()\n const routeId = match.routeId\n const route = router.routesById[routeId] as AnyRoute\n const key = React.useMemo(() => {\n const remountFn =\n route.options.remountDeps ?? router.options.defaultRemountDeps\n const remountDeps = remountFn?.({\n routeId,\n loaderDeps: match.loaderDeps,\n params: match._strictParams,\n search: match._strictSearch,\n })\n return remountDeps ? JSON.stringify(remountDeps) : undefined\n }, [\n routeId,\n match.loaderDeps,\n match._strictParams,\n match._strictSearch,\n route.options.remountDeps,\n router.options.defaultRemountDeps,\n ])\n const out = React.useMemo(() => {\n const Comp = route.options.component ?? router.options.defaultComponent\n return Comp ? <Comp key={key} /> : <Outlet />\n }, [key, route.options.component, router.options.defaultComponent])\n\n if (match.status === 'pending') {\n if (router._tx) {\n throw router._tx[5]\n }\n return renderPending(router, route)\n }\n\n if (match.status === 'notFound') {\n return renderRouteNotFound(router, route, match.error)\n }\n\n if (match.status === 'error') {\n if (isServer ?? router.isServer) {\n const RouteErrorComponent =\n (route.options.errorComponent ??\n router.options.defaultErrorComponent) ||\n ErrorComponent\n const errorElement = (\n <RouteErrorComponent\n error={match.error as any}\n reset={undefined as any}\n info={{\n componentStack: '',\n }}\n />\n )\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(errorElement, 'errorComponent')\n : errorElement\n }\n throw match.error\n }\n\n return out\n})\n\n/**\n * Render the next child match in the route tree. Typically used inside\n * a route component to render nested routes.\n *\n * @link https://tanstack.com/router/latest/docs/framework/react/api/router/outletComponent\n */\nexport const Outlet = React.memo(function OutletImpl() {\n if (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n const nonRouteComponent = React.useContext(nonRouteComponentContext!)\n if (nonRouteComponent) {\n console.warn(\n `Warning: An <Outlet /> was rendered inside a ${nonRouteComponent}. <Outlet /> should only be rendered inside a route component.`,\n )\n }\n }\n\n const router = useRouter()\n const routeId = React.useContext(matchContext)!\n\n let parentGlobalNotFound: boolean\n let parentNotFoundError: unknown\n let childRouteId: string | undefined\n\n if (isServer ?? router.isServer) {\n const matches = router.stores.matches.get()\n const parentIndex = matches.findIndex((match) => match.routeId === routeId)\n const parentMatch = matches[parentIndex]!\n parentGlobalNotFound = !!parentMatch._notFound\n parentNotFoundError = parentMatch.error\n childRouteId = matches[parentIndex + 1]?.routeId\n } else {\n const parentMatchStore = router.stores.getMatchStore(routeId)\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n ;[parentGlobalNotFound, parentNotFoundError] = useStore(\n parentMatchStore,\n (match): OutletMatchSelection => [!!match!._notFound, match!.error],\n outletMatchSelectionEqual,\n )\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n childRouteId = useStore(router.stores.ids, (ids) => {\n return ids[ids.indexOf(routeId) + 1]\n })\n }\n\n if (parentGlobalNotFound) {\n return renderRouteNotFound(\n router,\n router.routesById[routeId],\n parentNotFoundError,\n )\n }\n\n if (!childRouteId) {\n return null\n }\n\n const nextMatch = <Match routeId={childRouteId} />\n\n if (routeId === rootRouteId) {\n return (\n <React.Suspense fallback={renderPending(router)}>\n {nextMatch}\n </React.Suspense>\n )\n }\n\n return nextMatch\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAwBA,SAAgB,cACd,QACA,OACA;CACA,MAAM,mBACJ,OAAO,QAAQ,oBAAoB,OAAO,QAAQ;CACpD,IAAI,CAAC,kBACH,OAAO;CAGT,MAAM,iBAAiB,oBAAC,kBAAD,CAAmB,CAAA;CAC1C,OAAA,QAAA,IAAA,aAAgC,eAC5B,+BAA+B,gBAAgB,kBAAkB,IACjE;AACN;AAOA,IAAM,6BACJ,GACA,MACG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE;AAEjC,IAAa,QAAQ,QAAM,KAAK,SAAS,UAAU,EACjD,WAGC;CACD,MAAM,SAAS,UAAU;CAEzB,IAAI,YAAY,OAAO,UAErB,OAAO,oBAAC,WAAD;EAAmB;EAAe,OAD3B,OAAO,OAAO,QAAQ,IAAI,OAAO,EAAG,IACT;CAAQ,CAAA;CAMnD,OAAO,oBAAC,WAAD;EAAmB;EAAe,OAD3B,SAFK,OAAO,OAAO,cAAc,OAExB,IAAa,UAAU,KACL;CAAS,CAAA;AACpD,CAAC;AAED,SAAS,UAAU,EACjB,QACA,SAIC;CACD,MAAM,QAAkB,OAAO,WAAW,MAAM;CAEhD,MAAM,iBAAiB,cAAc,QA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@@ import "react";

if (!route.options.notFoundComponent) {
if (router.options.defaultNotFoundComponent) return /* @__PURE__ */ jsx(router.options.defaultNotFoundComponent, { ...data });
if (router.options.defaultNotFoundComponent) {
const notFoundElement = /* @__PURE__ */ jsx(router.options.defaultNotFoundComponent, { ...data });
return process.env.NODE_ENV !== "production" ? wrapInNonRouteComponentContext(notFoundElement, "notFoundComponent") : notFoundElement;
}
if (process.env.NODE_ENV !== "production") {

@@ -22,3 +26,4 @@ if (!route.options.notFoundComponent) console.warn(`Warning: A notFoundError was encountered on the route with ID "${route.id}", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`);

}
return /* @__PURE__ */ jsx(route.options.notFoundComponent, { ...data });
const notFoundElement = /* @__PURE__ */ jsx(route.options.notFoundComponent, { ...data });
return process.env.NODE_ENV !== "production" ? wrapInNonRouteComponentContext(notFoundElement, "notFoundComponent") : notFoundElement;
}

@@ -25,0 +30,0 @@ //#endregion

@@ -1,1 +0,1 @@

{"version":3,"file":"renderRouteNotFound.js","names":[],"sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import * as React from 'react'\nimport { DefaultGlobalNotFound } from './not-found'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\n/**\n * Renders a not found component for a route when no matching route is found.\n *\n * @param router - The router instance containing the route configuration\n * @param route - The route that triggered the not found state\n * @param data - Additional data to pass to the not found component\n * @returns The rendered not found component or a default fallback component\n */\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n return <router.options.defaultNotFoundComponent {...data} />\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!route.options.notFoundComponent) {\n console.warn(\n `Warning: A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`,\n )\n }\n }\n\n return <DefaultGlobalNotFound />\n }\n\n return <route.options.notFoundComponent {...data} />\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,oBACd,QACA,OACA,MACA;CACA,IAAI,CAAC,MAAM,QAAQ,mBAAmB;EACpC,IAAI,OAAO,QAAQ,0BACjB,OAAO,oBAAC,OAAO,QAAQ,0BAAhB,EAAyC,GAAI,KAAO,CAAA;EAG7D,IAAA,QAAA,IAAA,aAA6B;OACvB,CAAC,MAAM,QAAQ,mBACjB,QAAQ,KACN,kEAAkE,MAAM,GAAG,mPAC7E;EAAA;EAIJ,OAAO,oBAAC,uBAAD,CAAwB,CAAA;CACjC;CAEA,OAAO,oBAAC,MAAM,QAAQ,mBAAf,EAAiC,GAAI,KAAO,CAAA;AACrD"}
{"version":3,"file":"renderRouteNotFound.js","names":[],"sources":["../../src/renderRouteNotFound.tsx"],"sourcesContent":["import * as React from 'react'\nimport { DefaultGlobalNotFound } from './not-found'\nimport { wrapInNonRouteComponentContext } from './nonRouteComponentContext'\nimport type { AnyRoute, AnyRouter } from '@tanstack/router-core'\n\n/**\n * Renders a not found component for a route when no matching route is found.\n *\n * @param router - The router instance containing the route configuration\n * @param route - The route that triggered the not found state\n * @param data - Additional data to pass to the not found component\n * @returns The rendered not found component or a default fallback component\n */\nexport function renderRouteNotFound(\n router: AnyRouter,\n route: AnyRoute,\n data: any,\n) {\n if (!route.options.notFoundComponent) {\n if (router.options.defaultNotFoundComponent) {\n const notFoundElement = (\n <router.options.defaultNotFoundComponent {...data} />\n )\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(notFoundElement, 'notFoundComponent')\n : notFoundElement\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (!route.options.notFoundComponent) {\n console.warn(\n `Warning: A notFoundError was encountered on the route with ID \"${route.id}\", but a notFoundComponent option was not configured, nor was a router level defaultNotFoundComponent configured. Consider configuring at least one of these to avoid TanStack Router's overly generic defaultNotFoundComponent (<p>Not Found</p>)`,\n )\n }\n }\n\n return <DefaultGlobalNotFound />\n }\n\n const notFoundElement = <route.options.notFoundComponent {...data} />\n return process.env.NODE_ENV !== 'production'\n ? wrapInNonRouteComponentContext(notFoundElement, 'notFoundComponent')\n : notFoundElement\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,oBACd,QACA,OACA,MACA;CACA,IAAI,CAAC,MAAM,QAAQ,mBAAmB;EACpC,IAAI,OAAO,QAAQ,0BAA0B;GAC3C,MAAM,kBACJ,oBAAC,OAAO,QAAQ,0BAAhB,EAAyC,GAAI,KAAO,CAAA;GAEtD,OAAA,QAAA,IAAA,aAAgC,eAC5B,+BAA+B,iBAAiB,mBAAmB,IACnE;EACN;EAEA,IAAA,QAAA,IAAA,aAA6B;OACvB,CAAC,MAAM,QAAQ,mBACjB,QAAQ,KACN,kEAAkE,MAAM,GAAG,mPAC7E;EAAA;EAIJ,OAAO,oBAAC,uBAAD,CAAwB,CAAA;CACjC;CAEA,MAAM,kBAAkB,oBAAC,MAAM,QAAQ,mBAAf,EAAiC,GAAI,KAAO,CAAA;CACpE,OAAA,QAAA,IAAA,aAAgC,eAC5B,+BAA+B,iBAAiB,mBAAmB,IACnE;AACN"}

@@ -21,5 +21,4 @@ import * as React from 'react';

* @param ref - The ref to observe
* @param intersectionObserverOptions - The options to pass to the IntersectionObserver
* @param callback - The callback to call when the intersection changes
* @param disabled - Whether observation is disabled
* @param callback - The callback to call when the intersection changes
* @returns The IntersectionObserver instance

@@ -33,3 +32,2 @@ * @example

* (entry) => { doSomething(entry) },
* { rootMargin: '10px' },
* false

@@ -40,3 +38,3 @@ * )

*/
export declare function useIntersectionObserver<T extends Element>(ref: React.RefObject<T | null>, callback: (entry: IntersectionObserverEntry | undefined) => void, intersectionObserverOptions?: IntersectionObserverInit, disabled?: boolean): void;
export declare function useIntersectionObserver<T extends Element>(ref: React.RefObject<T | null>, callback: (entry?: IntersectionObserverEntry) => void, disabled?: boolean): void;
/**

@@ -43,0 +41,0 @@ * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.

@@ -18,5 +18,4 @@ "use client";

* @param ref - The ref to observe
* @param intersectionObserverOptions - The options to pass to the IntersectionObserver
* @param callback - The callback to call when the intersection changes
* @param disabled - Whether observation is disabled
* @param callback - The callback to call when the intersection changes
* @returns The IntersectionObserver instance

@@ -30,3 +29,2 @@ * @example

* (entry) => { doSomething(entry) },
* { rootMargin: '10px' },
* false

@@ -37,11 +35,12 @@ * )

*/
function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}, disabled) {
function useIntersectionObserver(ref, callback, disabled) {
React$1.useEffect(() => {
if (!ref.current || disabled || typeof IntersectionObserver !== "function") return;
const observer = new IntersectionObserver(([entry]) => {
callback(entry);
}, intersectionObserverOptions);
if (!ref.current || disabled || typeof IntersectionObserver !== "function") return () => callback();
const observer = new IntersectionObserver((entries) => {
callback(entries.pop());
}, { rootMargin: "100px" });
observer.observe(ref.current);
return () => {
observer.disconnect();
callback();
};

@@ -51,3 +50,2 @@ }, [

disabled,
intersectionObserverOptions,
ref

@@ -54,0 +52,0 @@ ]);

@@ -1,1 +0,1 @@

{"version":3,"file":"utils.js","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { isServer } from '@tanstack/router-core/isServer'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\n// eslint-disable-next-line prefer-const -- Must be `let` to prevent bundler constant-folding\nlet REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n | (<T>(usable: Promise<T> | React.Context<T>) => T)\n | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n fn: T,\n): T {\n const fnRef = React.useRef(fn)\n fnRef.current = fn\n\n const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n return ref.current as T\n}\n\nexport const useLayoutEffect =\n (isServer ?? typeof window === 'undefined')\n ? React.useEffect\n : React.useLayoutEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n // initialise the ref with previous and current values\n const ref = React.useRef<{ value: T; prev: T | null }>({\n value: value,\n prev: null,\n })\n\n const current = ref.current.value\n\n // if the value passed into hook doesn't match what we store as \"current\"\n // move the \"current\" to the \"previous\"\n // and store the passed value as \"current\"\n if (value !== current) {\n ref.current = {\n value: value,\n prev: current,\n }\n }\n\n // return the previous value only\n return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param disabled - Whether observation is disabled\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * false\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: React.RefObject<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n disabled?: boolean,\n) {\n React.useEffect(() => {\n if (\n !ref.current ||\n disabled ||\n typeof IntersectionObserver !== 'function'\n ) {\n return\n }\n\n const observer = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observer.observe(ref.current)\n\n return () => {\n observer.disconnect()\n }\n }, [callback, disabled, intersectionObserverOptions, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n * const innerRef = useForwardedRef(ref)\n * return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n React.useImperativeHandle(ref, () => innerRef.current!, [])\n return innerRef\n}\n"],"mappings":";;;;;;;AAeA,IAAa,WAEI,QAAc;AAY/B,IAAa,kBACV,YAAY,OAAO,WAAW,cAC3B,QAAM,YACN,QAAM;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDZ,SAAgB,wBACd,KACA,UACA,8BAAwD,CAAC,GACzD,UACA;CACA,QAAM,gBAAgB;EACpB,IACE,CAAC,IAAI,WACL,YACA,OAAO,yBAAyB,YAEhC;EAGF,MAAM,WAAW,IAAI,sBAAsB,CAAC,WAAW;GACrD,SAAS,KAAK;EAChB,GAAG,2BAA2B;EAE9B,SAAS,QAAQ,IAAI,OAAO;EAE5B,aAAa;GACX,SAAS,WAAW;EACtB;CACF,GAAG;EAAC;EAAU;EAAU;EAA6B;CAAG,CAAC;AAC3D;;;;;;;;;;;;;;AAeA,SAAgB,gBAAmB,KAA6B;CAC9D,MAAM,WAAW,QAAM,OAAU,IAAI;CACrC,QAAM,oBAAoB,WAAW,SAAS,SAAU,CAAC,CAAC;CAC1D,OAAO;AACT"}
{"version":3,"file":"utils.js","names":[],"sources":["../../src/utils.ts"],"sourcesContent":["'use client'\nimport * as React from 'react'\nimport { isServer } from '@tanstack/router-core/isServer'\n\n// Safe version of React.use() that will not cause compilation errors against\n// React 18 with Webpack, which statically analyzes imports and fails when it\n// sees React.use referenced (since 'use' is not exported from React 18).\n// This uses a dynamic string lookup to avoid the static analysis.\n// eslint-disable-next-line prefer-const -- Must be `let` to prevent bundler constant-folding\nlet REACT_USE = 'use'\n\n/**\n * React.use if available (React 19+), undefined otherwise.\n * Use dynamic lookup to avoid Webpack compilation errors with React 18.\n */\nexport const reactUse:\n | (<T>(usable: Promise<T> | React.Context<T>) => T)\n | undefined = (React as any)[REACT_USE]\n\nexport function useStableCallback<T extends (...args: Array<any>) => any>(\n fn: T,\n): T {\n const fnRef = React.useRef(fn)\n fnRef.current = fn\n\n const ref = React.useRef((...args: Array<any>) => fnRef.current(...args))\n return ref.current as T\n}\n\nexport const useLayoutEffect =\n (isServer ?? typeof window === 'undefined')\n ? React.useEffect\n : React.useLayoutEffect\n\n/**\n * Taken from https://www.developerway.com/posts/implementing-advanced-use-previous-hook#part3\n */\nexport function usePrevious<T>(value: T): T | null {\n // initialise the ref with previous and current values\n const ref = React.useRef<{ value: T; prev: T | null }>({\n value: value,\n prev: null,\n })\n\n const current = ref.current.value\n\n // if the value passed into hook doesn't match what we store as \"current\"\n // move the \"current\" to the \"previous\"\n // and store the passed value as \"current\"\n if (value !== current) {\n ref.current = {\n value: value,\n prev: current,\n }\n }\n\n // return the previous value only\n return ref.current.prev\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param callback - The callback to call when the intersection changes\n * @param disabled - Whether observation is disabled\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * false\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: React.RefObject<T | null>,\n callback: (entry?: IntersectionObserverEntry) => void,\n disabled?: boolean,\n) {\n React.useEffect(() => {\n if (\n !ref.current ||\n disabled ||\n typeof IntersectionObserver !== 'function'\n ) {\n return () => callback()\n }\n\n const observer = new IntersectionObserver(\n (entries) => {\n callback(entries.pop())\n },\n { rootMargin: '100px' },\n )\n\n observer.observe(ref.current)\n\n return () => {\n observer.disconnect()\n callback()\n }\n }, [callback, disabled, ref])\n}\n\n/**\n * React hook to take a `React.ForwardedRef` and returns a `ref` that can be used on a DOM element.\n *\n * @param ref - The forwarded ref\n * @returns The inner ref returned by `useRef`\n * @example\n * ```tsx\n * const MyComponent = React.forwardRef((props, ref) => {\n * const innerRef = useForwardedRef(ref)\n * return <div ref={innerRef} />\n * })\n * ```\n */\nexport function useForwardedRef<T>(ref?: React.ForwardedRef<T>) {\n const innerRef = React.useRef<T>(null)\n React.useImperativeHandle(ref, () => innerRef.current!, [])\n return innerRef\n}\n"],"mappings":";;;;;;;AAeA,IAAa,WAEI,QAAc;AAY/B,IAAa,kBACV,YAAY,OAAO,WAAW,cAC3B,QAAM,YACN,QAAM;;;;;;;;;;;;;;;;;;;;;;;;AAmDZ,SAAgB,wBACd,KACA,UACA,UACA;CACA,QAAM,gBAAgB;EACpB,IACE,CAAC,IAAI,WACL,YACA,OAAO,yBAAyB,YAEhC,aAAa,SAAS;EAGxB,MAAM,WAAW,IAAI,sBAClB,YAAY;GACX,SAAS,QAAQ,IAAI,CAAC;EACxB,GACA,EAAE,YAAY,QAAQ,CACxB;EAEA,SAAS,QAAQ,IAAI,OAAO;EAE5B,aAAa;GACX,SAAS,WAAW;GACpB,SAAS;EACX;CACF,GAAG;EAAC;EAAU;EAAU;CAAG,CAAC;AAC9B;;;;;;;;;;;;;;AAeA,SAAgB,gBAAmB,KAA6B;CAC9D,MAAM,WAAW,QAAM,OAAU,IAAI;CACrC,QAAM,oBAAoB,WAAW,SAAS,SAAU,CAAC,CAAC;CAC1D,OAAO;AACT"}
{
"name": "@tanstack/react-router",
"version": "1.170.25",
"version": "1.170.26",
"description": "Modern and scalable routing for React applications",

@@ -81,3 +81,3 @@ "author": "Tanner Linsley",

"@tanstack/history": "1.162.1",
"@tanstack/router-core": "1.171.21"
"@tanstack/router-core": "1.171.22"
},

@@ -84,0 +84,0 @@ "devDependencies": {

'use client'
import * as React from 'react'
import { wrapInNonRouteComponentContext } from './nonRouteComponentContext'
import type { ErrorRouteComponent } from './route'

@@ -47,8 +48,17 @@ import type { ErrorInfo } from 'react'

const error = this.state.error
return error
? React.createElement(this.props.errorComponent ?? ErrorComponent, {
if (error) {
const element = React.createElement(
this.props.errorComponent ?? ErrorComponent,
{
error,
reset: this.reset,
})
: this.props.children
},
)
return process.env.NODE_ENV !== 'production'
? wrapInNonRouteComponentContext(element, 'errorComponent')
: element
}
return this.props.children
}

@@ -55,0 +65,0 @@ }

@@ -5,3 +5,2 @@ 'use client'

import { useStore } from '@tanstack/react-store'
import { flushSync } from 'react-dom'
import {

@@ -597,8 +596,6 @@ deepEqual,

// eslint-disable-next-line react-hooks/rules-of-hooks
const [isTransitioning, setIsTransitioning] = React.useState(false)
// eslint-disable-next-line react-hooks/rules-of-hooks
const hasRenderFetched = React.useRef(false)
const preload =
options.reloadDocument || externalLink
options.reloadDocument || externalLink || disabled
? false

@@ -620,18 +617,43 @@ : (userPreload ?? router.options.defaultPreload)

// eslint-disable-next-line react-hooks/rules-of-hooks
const preloadViewportIoCallback = React.useCallback(
(entry: IntersectionObserverEntry | undefined) => {
if (entry?.isIntersecting) {
const enqueuePreload = React.useCallback(
(e?: React.MouseEvent | React.FocusEvent | IntersectionObserverEntry) => {
if (!e) {
cancelPreload(innerRef)
return
}
if (
!(
(e as IntersectionObserverEntry).isIntersecting ??
preload === 'intent'
)
) {
if ((e as IntersectionObserverEntry).isIntersecting === false) {
cancelPreload(innerRef)
}
return
}
if (!preloadDelay) {
doPreload()
return
}
if (timeoutMap.has(innerRef)) {
return
}
timeoutMap.set(
innerRef,
setTimeout(() => {
timeoutMap.delete(innerRef)
doPreload()
}, preloadDelay),
)
},
[doPreload],
[doPreload, innerRef, preload, preloadDelay],
)
// eslint-disable-next-line react-hooks/rules-of-hooks
useIntersectionObserver(
innerRef,
preloadViewportIoCallback,
intersectionObserverOptions,
!!disabled || preload !== 'viewport',
)
useIntersectionObserver(innerRef, enqueuePreload, preload !== 'viewport')

@@ -643,7 +665,7 @@ // eslint-disable-next-line react-hooks/rules-of-hooks

}
if (!disabled && preload === 'render') {
if (preload === 'render') {
doPreload()
hasRenderFetched.current = true
}
}, [disabled, doPreload, preload])
}, [doPreload, preload])

@@ -667,11 +689,2 @@ // The click handler

flushSync(() => {
setIsTransitioning(true)
})
const unsub = router.subscribe('onResolved', () => {
unsub()
setIsTransitioning(false)
})
// All is well? Navigate!

@@ -710,35 +723,10 @@ // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing

const enqueueIntentPreload = (e: React.MouseEvent | React.FocusEvent) => {
if (disabled || preload !== 'intent') return
if (!preloadDelay) {
doPreload()
return
}
const eventTarget = e.currentTarget
if (timeoutMap.has(eventTarget)) {
return
}
const id = setTimeout(() => {
timeoutMap.delete(eventTarget)
doPreload()
}, preloadDelay)
timeoutMap.set(eventTarget, id)
}
const handleTouchStart = (_: React.TouchEvent) => {
if (disabled || preload !== 'intent') return
const handleTouchStart = () => {
if (preload !== 'intent') return
doPreload()
}
const handleLeave = (e: React.MouseEvent | React.FocusEvent) => {
if (disabled || !preload || !preloadDelay) return
const eventTarget = e.currentTarget
const id = timeoutMap.get(eventTarget)
if (id) {
clearTimeout(id)
timeoutMap.delete(eventTarget)
const handleLeave = () => {
if (preload === 'intent') {
cancelPreload(innerRef)
}

@@ -755,4 +743,4 @@ }

onBlur: composeHandlers([onBlur, handleLeave]),
onFocus: composeHandlers([onFocus, enqueueIntentPreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueueIntentPreload]),
onFocus: composeHandlers([onFocus, enqueuePreload]),
onMouseEnter: composeHandlers([onMouseEnter, enqueuePreload]),
onMouseLeave: composeHandlers([onMouseLeave, handleLeave]),

@@ -766,3 +754,2 @@ onTouchStart: composeHandlers([onTouchStart, handleTouchStart]),

...(isActive && STATIC_ACTIVE_PROPS),
...(isHydrated && isTransitioning && STATIC_TRANSITIONING_PROPS),
}

@@ -775,8 +762,7 @@ }

const STATIC_ACTIVE_PROPS = { 'data-status': 'active', 'aria-current': 'page' }
const STATIC_TRANSITIONING_PROPS = { 'data-transitioning': 'transitioning' }
const timeoutMap = new WeakMap<EventTarget, ReturnType<typeof setTimeout>>()
const intersectionObserverOptions: IntersectionObserverInit = {
rootMargin: '100px',
const timeoutMap = new WeakMap<object, ReturnType<typeof setTimeout>>()
const cancelPreload = (eventTarget: object) => {
clearTimeout(timeoutMap.get(eventTarget))
timeoutMap.delete(eventTarget)
}

@@ -877,6 +863,3 @@

| React.ReactNode
| ((state: {
isActive: boolean
isTransitioning: boolean
}) => React.ReactNode)
| ((state: { isActive: boolean }) => React.ReactNode)
}

@@ -968,3 +951,3 @@

* - `preload`: Controls route preloading (eg. 'intent', 'render', 'viewport', true/false)
* - `preloadDelay`: Delay in ms before preloading on hover
* - `preloadDelay`: Delay in ms before preloading on focus, hover, or viewport entry
* - `activeProps`/`inactiveProps`: Additional props merged when link is active/inactive

@@ -971,0 +954,0 @@ * - `resetScroll`/`hashScrollIntoView`: Control scroll behavior on navigation

@@ -15,2 +15,6 @@ 'use client'

import { ClientOnly } from './ClientOnly'
import {
nonRouteComponentContext,
wrapInNonRouteComponentContext,
} from './nonRouteComponentContext'
import type {

@@ -28,3 +32,10 @@ AnyRoute,

route?.options.pendingComponent ?? router.options.defaultPendingComponent
return PendingComponent ? <PendingComponent /> : null
if (!PendingComponent) {
return null
}
const pendingElement = <PendingComponent />
return process.env.NODE_ENV !== 'production'
? wrapInNonRouteComponentContext(pendingElement, 'pendingComponent')
: pendingElement
}

@@ -128,6 +139,12 @@

return React.createElement(
const notFoundElement = React.createElement(
routeNotFoundComponent!,
error as any,
)
return process.env.NODE_ENV !== 'production'
? wrapInNonRouteComponentContext(
notFoundElement,
'notFoundComponent',
)
: notFoundElement
}}

@@ -203,3 +220,3 @@ >

ErrorComponent
return (
const errorElement = (
<RouteErrorComponent

@@ -213,2 +230,5 @@ error={match.error as any}

)
return process.env.NODE_ENV !== 'production'
? wrapInNonRouteComponentContext(errorElement, 'errorComponent')
: errorElement
}

@@ -228,2 +248,12 @@ throw match.error

export const Outlet = React.memo(function OutletImpl() {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line react-hooks/rules-of-hooks
const nonRouteComponent = React.useContext(nonRouteComponentContext!)
if (nonRouteComponent) {
console.warn(
`Warning: An <Outlet /> was rendered inside a ${nonRouteComponent}. <Outlet /> should only be rendered inside a route component.`,
)
}
}
const router = useRouter()

@@ -230,0 +260,0 @@ const routeId = React.useContext(matchContext)!

import * as React from 'react'
import { DefaultGlobalNotFound } from './not-found'
import { wrapInNonRouteComponentContext } from './nonRouteComponentContext'
import type { AnyRoute, AnyRouter } from '@tanstack/router-core'

@@ -20,3 +21,8 @@

if (router.options.defaultNotFoundComponent) {
return <router.options.defaultNotFoundComponent {...data} />
const notFoundElement = (
<router.options.defaultNotFoundComponent {...data} />
)
return process.env.NODE_ENV !== 'production'
? wrapInNonRouteComponentContext(notFoundElement, 'notFoundComponent')
: notFoundElement
}

@@ -35,3 +41,6 @@

return <route.options.notFoundComponent {...data} />
const notFoundElement = <route.options.notFoundComponent {...data} />
return process.env.NODE_ENV !== 'production'
? wrapInNonRouteComponentContext(notFoundElement, 'notFoundComponent')
: notFoundElement
}

@@ -69,5 +69,4 @@ 'use client'

* @param ref - The ref to observe
* @param intersectionObserverOptions - The options to pass to the IntersectionObserver
* @param callback - The callback to call when the intersection changes
* @param disabled - Whether observation is disabled
* @param callback - The callback to call when the intersection changes
* @returns The IntersectionObserver instance

@@ -81,3 +80,2 @@ * @example

* (entry) => { doSomething(entry) },
* { rootMargin: '10px' },
* false

@@ -90,4 +88,3 @@ * )

ref: React.RefObject<T | null>,
callback: (entry: IntersectionObserverEntry | undefined) => void,
intersectionObserverOptions: IntersectionObserverInit = {},
callback: (entry?: IntersectionObserverEntry) => void,
disabled?: boolean,

@@ -101,8 +98,11 @@ ) {

) {
return
return () => callback()
}
const observer = new IntersectionObserver(([entry]) => {
callback(entry)
}, intersectionObserverOptions)
const observer = new IntersectionObserver(
(entries) => {
callback(entries.pop())
},
{ rootMargin: '100px' },
)

@@ -113,4 +113,5 @@ observer.observe(ref.current)

observer.disconnect()
callback()
}
}, [callback, disabled, intersectionObserverOptions, ref])
}, [callback, disabled, ref])
}

@@ -117,0 +118,0 @@