@tanstack/router-core
Version:
Modern and scalable routing for React applications
1 lines • 114 kB
Source Map (JSON)
{"version":3,"file":"load-client.cjs","names":[],"sources":["../../src/load-client.ts"],"sourcesContent":["// Keep this filename free of a secondary extension so declaration generation\n// can rewrite relative imports for both ESM and CJS.\nimport { isNotFound } from './not-found'\nimport { isRedirect } from './redirect'\nimport { getLocationChangeInfo, runRouteLifecycle } from './router'\nimport { hydrateSsrMatchId } from './ssr/ssr-match-id'\nimport type { GLOBAL_SEROVAL, GLOBAL_TSR } from './ssr/constants'\nimport type { AnySerializationAdapter } from './ssr/serializer/transformer'\nimport type { TsrSsrGlobal } from './ssr/types'\nimport type { ParsedLocation } from './location'\nimport type { AnyRouteMatch } from './Matches'\nimport type { NotFoundError } from './not-found'\nimport type {\n AnyRoute,\n BeforeLoadContextOptions,\n LoaderFnContext,\n RouteContextOptions,\n RouteLoaderFn,\n} from './route'\nimport type { AnyRedirect } from './redirect'\nimport type { AnyRouter } from './router'\n\ntype RouteComponentType =\n | 'component'\n | 'pendingComponent'\n | 'errorComponent'\n | 'notFoundComponent'\n\nexport function replaceRouteChunk(\n route: AnyRoute,\n lazyFn: AnyRoute['lazyFn'],\n): void {\n route.lazyFn = lazyFn ?? route.lazyFn\n route._lazy = undefined\n}\n\nfunction preloadComponent(\n route: AnyRoute,\n type: RouteComponentType,\n): Promise<void> | undefined {\n return (route.options[type] as any)?.preload?.()\n}\n\nfunction loadComponents(\n route: AnyRoute,\n onPendingReady?: () => void,\n): Promise<void> | undefined {\n const component = preloadComponent(route, 'component')\n const pending = preloadComponent(route, 'pendingComponent')\n const pendingReady =\n onPendingReady && pending ? pending.then(onPendingReady) : pending\n if (onPendingReady && !pending) {\n onPendingReady()\n }\n if (component && pendingReady) {\n return Promise.all([component, pendingReady]).then(() => {})\n }\n return component ?? pendingReady\n}\n\nexport function loadRouteChunk(\n route: AnyRoute,\n // `false` waits only for lazy route options, before a boundary is selected.\n componentType?: 'errorComponent' | 'notFoundComponent' | false,\n onPendingReady?: () => void,\n): Promise<void> | undefined {\n const afterLazy = () =>\n componentType === false\n ? undefined\n : componentType\n ? preloadComponent(route, componentType)\n : loadComponents(route, onPendingReady)\n const current = route._lazy\n if (current) {\n return current === true ? afterLazy() : current.then(afterLazy)\n }\n if (!route.lazyFn) {\n return afterLazy()\n }\n\n const promise = route.lazyFn().then(\n (lazyRoute) => {\n // HMR clears the owner before an obsolete import can settle.\n if (process.env.NODE_ENV === 'production' || route._lazy === promise) {\n const { id: _id, ...options } = lazyRoute.options\n Object.assign(route.options, options)\n route._lazy = true\n }\n },\n (error) => {\n if (process.env.NODE_ENV === 'production' || route._lazy === promise) {\n route._lazy = undefined\n }\n throw error\n },\n )\n route._lazy = promise\n return promise.then(afterLazy)\n}\n\n/** Return the structural lane through the first terminal render boundary. */\nexport function _getRenderedMatches(\n matches: Array<AnyRouteMatch>,\n): Array<AnyRouteMatch> {\n const end =\n matches.findIndex(\n (match) => match.status !== 'success' || match._notFound,\n ) + 1\n return end && end < matches.length ? matches.slice(0, end) : matches\n}\n\n/** Return the lane whose document assets belong to the current presentation. */\nexport function _getAssetMatches(\n matches: Array<AnyRouteMatch>,\n): Array<AnyRouteMatch> {\n let end = matches.length\n for (let index = 0; index < end; index++) {\n const match = matches[index]!\n // `_assetEnd` is only ever set on hydration presentation clones that are\n // `status: 'pending'`, `ssr: 'data-only'`, error-free, and not not-found\n // (see hydrate.ts), and commits clear it — so its presence alone is the guard.\n if (match._assetEnd !== undefined) {\n end = Math.min(end, Math.max(index + 1, match._assetEnd))\n continue\n }\n if (match.status !== 'success' || match._notFound) {\n end = index + 1\n break\n }\n }\n // `end` only ever shrinks to `index + 1 >= 1`, so no zero guard is needed.\n return end < matches.length ? matches.slice(0, end) : matches\n}\n\ndeclare const lanePhase: unique symbol\n\ntype LanePhase = 'matched' | 'contextualized' | 'reduced' | 'projected'\n\n/**\n * Lane matches carry their lane's phase so functions can demand evidence of\n * pipeline position (e.g. `commitMatches` only accepts a projected lane's\n * matches). The brand is phantom — it never exists at runtime.\n */\ntype LaneMatches<TPhase extends LanePhase> = Array<WorkMatch> & {\n readonly [lanePhase]?: TPhase\n}\n\ntype Lane<TPhase extends LanePhase> = [\n location: ParsedLocation,\n matches: LaneMatches<TPhase>,\n background?: Array<BackgroundLoaderTask>,\n backgroundSettlement?: Promise<IndexedOutcome | undefined>,\n] & { readonly [lanePhase]?: TPhase }\n\ntype MatchedLane = Lane<'matched'>\ntype ContextualizedLane = Lane<'contextualized'>\ntype ReducedLane = Lane<'reduced'>\ntype ProjectedLane = Lane<'projected'>\n\nconst SUCCESS = 0\nconst ERROR = 1\nconst NOT_FOUND = 2\n// Control outcomes stay contiguous so the hot path can test them together.\nconst REDIRECTED = 3\nconst CANCELED = 4\n\ntype LoaderOutcome =\n | [kind: typeof SUCCESS, data: unknown]\n | [kind: typeof ERROR, error: unknown]\n | [kind: typeof NOT_FOUND, error: NotFoundError]\n | [kind: typeof REDIRECTED, redirect: AnyRedirect]\n | [kind: typeof CANCELED]\n\ntype IndexedOutcome = [index: number, outcome: LoaderOutcome, boundary?: number]\n\nexport type LoaderFlight = [\n outcome: Promise<LoaderOutcome>,\n controller: AbortController,\n leases: number,\n]\n\ntype WorkMatch = AnyRouteMatch & {\n _flight?: LoaderFlight\n}\n\ndeclare const matchPhase: unique symbol\n\n/**\n * A match whose loader outcome has been applied by `settleInto`, which is the\n * sole granter of this brand (phantom, zero-runtime). Consumers that require\n * it — e.g. `cacheLoaderMatch` — can only be reached after settlement, so the\n * compiler enforces the loader→settle→cache ordering. Sources that arrive\n * already settled (dehydrated server data) must cast at a named boundary.\n */\ntype SettledMatch = WorkMatch & { readonly [matchPhase]: 'settled' }\n\nexport type LoadTransaction = [\n controller: AbortController,\n redirects: number,\n location: ParsedLocation,\n matches: Array<AnyRouteMatch>,\n startedAt: number,\n done: Promise<void>,\n /**\n * Dev-only HMR refresh mode. Presence is the mode flag; a refresh always\n * carries the presentation it started from and its optional hydration\n * handoff. While a publication awaits acknowledgement, its rollback lives\n * with the transaction that owns the publication.\n */\n refresh?: [\n presentation: Array<AnyRouteMatch>,\n handoff: NonNullable<AnyRouter['_handoff']> | undefined,\n rollback?: () => boolean,\n ],\n]\n\nexport type PendingSession = [\n owner: LoadTransaction,\n boundary: number,\n /** Pending reveal time until acknowledged, then minimum-visible-until time. */\n deadline: number,\n timer?: ReturnType<typeof setTimeout>,\n ack?: Promise<boolean>,\n component?: unknown,\n]\n\ntype CoordinatorRouter = AnyRouter & {\n /** Active speculative lanes retained for cancellation, invalidation, and cache clearing. */\n _preloads?: Map<AbortController, Array<AnyRouteMatch>>\n _refreshNextLoad?: boolean\n _cancelTransition?: () => void\n}\n\ntype PublicationCheckpoint = {\n previousMatches: Array<AnyRouteMatch>\n previousPresentation: Array<AnyRouteMatch>\n previousCache: Map<string, AnyRouteMatch>\n commitPromise: CoordinatorRouter['_commitPromise']\n published: boolean\n}\n\ntype LoaderTask = [\n index: number,\n outcome: Promise<LoaderOutcome>,\n chunkFailure: Promise<IndexedOutcome | undefined>,\n candidate?: WorkMatch,\n]\n\ntype BackgroundLoaderTask = [\n index: number,\n outcome: Promise<LoaderOutcome>,\n chunkFailure: Promise<IndexedOutcome | undefined>,\n candidate: WorkMatch,\n]\n\ntype ExecuteLaneOptions = [\n controller: AbortController,\n redirects: number,\n isCurrent: () => boolean,\n base: Array<AnyRouteMatch>,\n preload?: boolean,\n sync?: boolean,\n forceStaleReload?: boolean,\n resolvedPrefix?: number,\n onReady?: () => void,\n]\n\ntype ControlOutcome =\n | [kind: typeof REDIRECTED, redirect: AnyRedirect]\n | [kind: typeof CANCELED]\n\ntype LaneResult = ProjectedLane | ControlOutcome\n\nfunction isControl(\n result: Lane<any> | ControlOutcome,\n): result is ControlOutcome {\n return typeof result[0 /* location or kind */] === 'number'\n}\n\nexport function waitFor<T>(\n value: T | PromiseLike<T>,\n signal: AbortSignal,\n): Promise<T> {\n if (signal.aborted) {\n return Promise.race([Promise.reject(signal), value])\n }\n return new Promise<T>((resolve, reject) => {\n const abort = () => reject(signal)\n signal.addEventListener('abort', abort, { once: true })\n Promise.resolve(value)\n .then(resolve, reject)\n .finally(() => signal.removeEventListener('abort', abort))\n })\n}\n\nexport function getRoute(router: AnyRouter, match: WorkMatch): AnyRoute {\n return (router.routesById as Record<string, AnyRoute>)[match.routeId]!\n}\n\nfunction normalize(\n value: unknown,\n rejected: boolean,\n routeId?: string,\n): LoaderOutcome {\n if (isRedirect(value)) {\n return [REDIRECTED, value]\n }\n if (isNotFound(value)) {\n value.routeId ||= routeId\n return [NOT_FOUND, value]\n }\n if (rejected && typeof (value as any)?.then === 'function') {\n value = new Error('A Promise was thrown', { cause: value })\n }\n return rejected ? [ERROR, value] : [SUCCESS, value]\n}\n\nfunction normalizeError(route: AnyRoute, cause: unknown): LoaderOutcome {\n let outcome = normalize(cause, true, route.id)\n if (outcome[0 /* kind */] !== ERROR) {\n return outcome\n }\n try {\n route.options.onError?.(outcome[1 /* error */])\n } catch (onErrorCause) {\n outcome = normalize(onErrorCause, true, route.id)\n }\n return outcome\n}\n\nfunction normalizeLaneError(\n route: AnyRoute,\n cause: unknown,\n options: ExecuteLaneOptions,\n): LoaderOutcome {\n if (\n options[0 /* controller */].signal.aborted ||\n !options[2 /* isCurrent */]()\n ) {\n options[0 /* controller */].abort()\n return [CANCELED]\n }\n return normalizeError(route, cause)\n}\n\nexport function navigateFrom(router: AnyRouter, location: ParsedLocation) {\n return (opts: any) =>\n router.navigate({\n ...opts,\n _fromLocation: location,\n })\n}\n\nasync function contextualize(\n router: AnyRouter,\n lane: MatchedLane,\n options: ExecuteLaneOptions,\n end: number,\n planSuccessfulLane: () => void,\n retainedEnd: number,\n): Promise<IndexedOutcome | undefined> {\n const [location, matches] = lane\n const signal = options[0 /* controller */].signal\n const preload = !!options[4 /* preload */]\n for (let index = options[7 /* resolvedPrefix */] ?? 0; index < end; index++) {\n const match = matches[index]!\n const route = getRoute(router, match)\n\n match.abortController = options[0 /* controller */]\n // Contextualization is serial, so the previous match already contains the\n // complete parent context for this route.\n const parentContext =\n matches[index - 1]?.context ?? router.options.context ?? {}\n const common = {\n params: match.params,\n location,\n navigate: navigateFrom(router, location),\n buildLocation: router.buildLocation,\n cause: preload ? ('preload' as const) : match.cause,\n abortController: options[0 /* controller */],\n preload,\n matches,\n routeId: route.id,\n }\n let context = parentContext\n try {\n let routeContext = match._ctx\n if (!routeContext && route.options.context) {\n routeContext = match._ctx =\n route.options.context({\n ...common,\n deps: match.loaderDeps,\n context: parentContext,\n } satisfies RouteContextOptions<any, any, any, any, any>) || {}\n }\n context = {\n ...parentContext,\n ...routeContext,\n }\n match.context = context\n } catch (cause) {\n releaseFlight(router, match)\n return [index, normalizeLaneError(route, cause, options)]\n }\n if (signal.aborted || !options[2 /* isCurrent */]()) {\n options[0 /* controller */].abort()\n return [index, [CANCELED]]\n }\n const validationError = match.paramsError ?? match.searchError\n if (validationError !== undefined) {\n releaseFlight(router, match)\n return [index, normalizeLaneError(route, validationError, options)]\n }\n const beforeLoad = route.options.beforeLoad\n if (!beforeLoad) {\n continue\n }\n\n const beforeLoadContext: BeforeLoadContextOptions<\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any,\n any\n > = {\n ...common,\n search: match.search,\n context,\n ...router.options.additionalContext,\n }\n\n const previousStatus = match.status\n // Retain only a success that is mounted through the same valid prefix.\n if (previousStatus === 'success' && index >= retainedEnd) {\n match.status = 'pending'\n }\n options[8 /* onReady */]?.()\n try {\n setFetching(router, match, 'beforeLoad', options[0 /* controller */])\n const result = await waitFor(beforeLoad(beforeLoadContext), signal)\n if (!options[2 /* isCurrent */]()) {\n options[0 /* controller */].abort()\n return [index, [CANCELED]]\n }\n const outcome = normalize(result, false, route.id)\n if (outcome[0 /* kind */] !== SUCCESS) {\n releaseFlight(router, match)\n return [index, outcome]\n }\n match.context = {\n ...context,\n ...result,\n }\n } catch (cause) {\n releaseFlight(router, match)\n return [index, normalizeLaneError(route, cause, options)]\n } finally {\n if (previousStatus === 'success' && match.status === 'pending') {\n match.status = 'success'\n }\n setFetching(router, match, false, options[0 /* controller */])\n }\n }\n\n // Let a synchronous lane claim predecessor flights before this frame yields.\n planSuccessfulLane()\n return\n}\n\nfunction releaseOwnedFlight(\n router: AnyRouter,\n match: WorkMatch,\n flight?: LoaderFlight,\n): AbortController | undefined {\n if (!flight || --flight[2 /* leases */]) {\n return\n }\n if (router._flights?.get(match.id) === flight) {\n const current = router._tx\n if (\n current &&\n !current[0 /* controller */].signal.aborted &&\n !(process.env.NODE_ENV !== 'production' && current[6 /* refresh */]) &&\n !current[3 /* matches */].includes(match) &&\n current[3 /* matches */].some((candidate) => candidate.id === match.id) &&\n current[3 /* matches */].some(\n (candidate) => candidate.isFetching === 'beforeLoad',\n )\n ) {\n // Keep work discoverable only while the current lane is still running\n // beforeLoad. Loader planning performs the matching zero-owner sweep.\n return\n }\n router._flights.delete(match.id)\n }\n return flight[1 /* controller */]\n}\n\nfunction releaseFlight(router: AnyRouter, match: WorkMatch): void {\n const flight = match._flight\n match._flight = undefined\n releaseOwnedFlight(router, match, flight)?.abort()\n}\n/**\n * Not passing in a `next` ownership recipient\n * is equivalent to discarding the match resources\n */\nfunction transferMatchResources(\n router: AnyRouter,\n previous: Array<AnyRouteMatch>,\n next?: Array<AnyRouteMatch>,\n deferSameIdFlight?: true,\n): void {\n const abort: Array<AbortController> = []\n for (const match of previous as Array<WorkMatch>) {\n if (!next?.includes(match)) {\n const flight = match._flight\n match._flight = undefined\n if (\n deferSameIdFlight &&\n flight?.[2 /* leases */] === 1 &&\n router._flights?.get(match.id) === flight &&\n !(\n process.env.NODE_ENV !== 'production' && router._tx?.[6 /* refresh */]\n ) &&\n next?.some((candidate) => candidate.id === match.id)\n ) {\n // The successor has not made its same-ID reload decision yet.\n flight[2 /* leases */] = 0\n } else {\n const controller = releaseOwnedFlight(router, match, flight)\n if (controller) {\n abort.push(controller)\n }\n }\n }\n }\n for (const controller of abort) {\n controller.abort()\n }\n}\n\nfunction acquireMatchResources(matches: Array<AnyRouteMatch>): void {\n for (const match of matches as Array<WorkMatch>) {\n const flight = match._flight\n if (flight) {\n flight[2 /* leases */]++\n }\n }\n}\n\nfunction setFetching(\n router: AnyRouter,\n match: WorkMatch,\n value: AnyRouteMatch['isFetching'],\n owner?: AbortController,\n): void {\n match.isFetching = value\n if (owner && router._tx?.[0 /* controller */] !== owner) {\n return\n }\n const store = router.stores.byRoute.get(match.routeId)\n const presented = store?.get()\n if (presented?.id === match.id) {\n store!.set({ ...presented, isFetching: value })\n }\n}\n\nfunction getLoaderContext(\n router: AnyRouter,\n lane: ContextualizedLane,\n match: WorkMatch,\n route: AnyRoute,\n controller: AbortController,\n parentMatchPromise: Promise<WorkMatch> | undefined,\n preload: boolean,\n): LoaderFnContext {\n const location = lane[0 /* location */]\n return {\n params: match.params,\n location,\n navigate: navigateFrom(router, location),\n cause: preload ? ('preload' as const) : match.cause,\n abortController: controller,\n preload,\n deps: match.loaderDeps,\n parentMatchPromise: parentMatchPromise as any,\n context: match.context,\n route,\n ...router.options.additionalContext,\n }\n}\n\nasync function loadResource(\n router: AnyRouter,\n lane: ContextualizedLane,\n match: WorkMatch,\n route: AnyRoute,\n loader: RouteLoaderFn<any> | undefined,\n parentMatchPromise: Promise<WorkMatch> | undefined,\n preload: boolean,\n owner: AbortController,\n): Promise<LoaderOutcome> {\n const signal = owner.signal\n if (signal.aborted) {\n return [CANCELED]\n }\n if (!loader) {\n return [SUCCESS, undefined]\n }\n\n let flight = match._flight\n setFetching(router, match, 'loader', owner)\n try {\n if (!flight) {\n const controller = new AbortController()\n flight = [\n Promise.resolve()\n .then(() =>\n loader(\n getLoaderContext(\n router,\n lane,\n match,\n route,\n controller,\n parentMatchPromise,\n preload,\n ),\n ),\n )\n .then(\n (value) => normalize(value, false, route.id),\n (cause) => normalize(cause, true, route.id),\n )\n .then((result): LoaderOutcome => {\n // The registry controls discovery; leases keep current consumers\n // sharing the same terminal outcome.\n if (\n result[0 /* kind */] !== SUCCESS &&\n router._flights?.get(match.id) === flight\n ) {\n router._flights!.delete(match.id)\n if (!flight![2 /* leases */]) {\n controller.abort()\n }\n }\n return result[0 /* kind */] === ERROR && flight![2 /* leases */]\n ? normalizeError(route, result[1 /* error */])\n : result\n }),\n controller,\n 1,\n ]\n ;(router._flights ??= new Map()).set(match.id, flight)\n }\n match._flight = flight\n match.abortController = flight[1 /* controller */]\n return await waitFor(flight[0 /* outcome */], signal)\n } catch (cause) {\n if (cause !== signal) {\n throw cause\n }\n releaseFlight(router, match)\n return [CANCELED]\n } finally {\n setFetching(router, match, false, owner)\n }\n}\n\nfunction settleInto(\n match: WorkMatch,\n result: LoaderOutcome,\n preload: boolean,\n): asserts match is SettledMatch {\n if (result[0 /* kind */] === SUCCESS) {\n match.loaderData = result[1 /* data */]\n match.error = undefined\n match.status = 'success'\n match.invalid = false\n match.updatedAt = Date.now()\n match.preload = preload\n } else if (result[0 /* kind */] !== REDIRECTED) {\n // Reduction installs only the selected terminal failure. Every other\n // settled attempt remains a renderable, stale match in that lane.\n match.status = 'success'\n match.error = undefined\n match.invalid = true\n }\n}\n\nexport function cacheLoaderMatch(\n router: CoordinatorRouter,\n match: SettledMatch,\n planned: AnyRouteMatch | undefined,\n): void {\n const current = router._cache.get(match.id) as WorkMatch | undefined\n if (\n current !== planned ||\n router._committed.some(\n (candidate) =>\n candidate.id === match.id &&\n (candidate as WorkMatch)._flight === match._flight,\n )\n ) {\n return\n }\n const cached = {\n ...match,\n _notFound: undefined,\n context: {},\n } as WorkMatch\n if (cached._flight) {\n cached._flight[2 /* leases */]++\n }\n router._cache.set(match.id, cached)\n if (current) {\n releaseFlight(router, current)\n }\n}\n\nfunction getParentSnapshot(\n match: WorkMatch,\n outcome: LoaderOutcome,\n): WorkMatch {\n if (outcome[0 /* kind */] === ERROR || outcome[0 /* kind */] === NOT_FOUND) {\n return {\n ...match,\n status: outcome[0 /* kind */] === ERROR ? 'error' : 'notFound',\n error: outcome[1 /* error */],\n _flight: undefined,\n }\n }\n return match\n}\n\nfunction createLoaderTask(\n router: AnyRouter,\n lane: ContextualizedLane,\n index: number,\n tasks: Array<LoaderTask>,\n semanticParent: Promise<WorkMatch> | undefined,\n options: ExecuteLaneOptions,\n retainedEnd: number,\n): Promise<WorkMatch> {\n const match = lane[1 /* matches */][index]!\n const route = getRoute(router, match)\n const preload = !!options[4 /* preload */]\n const plannedCacheMatch = preload ? router._cache.get(match.id) : undefined\n let configured\n let reload = false\n let reloadFailure: LoaderOutcome | undefined\n try {\n if (match.status === 'success') {\n configured = route.options.shouldReload\n if (typeof configured === 'function') {\n configured = configured(\n getLoaderContext(\n router,\n lane,\n match,\n route,\n options[0 /* controller */],\n semanticParent,\n preload,\n ),\n )\n }\n if (!options[2 /* isCurrent */]()) {\n options[0 /* controller */].abort()\n reloadFailure = [CANCELED]\n }\n }\n if (!reloadFailure) {\n if (match.status !== 'success') {\n reload = true\n } else {\n const staleAge =\n options[4 /* preload */] || match.preload\n ? (route.options.preloadStaleTime ??\n router.options.defaultPreloadStaleTime ??\n 30_000)\n : (route.options.staleTime ?? router.options.defaultStaleTime ?? 0)\n reload = !!(\n match.invalid ||\n configured ||\n (configured === undefined &&\n Date.now() - match.updatedAt >= staleAge &&\n (options[6 /* forceStaleReload */] ||\n match.cause === 'enter' ||\n options[3 /* base */].some(\n (candidate) =>\n candidate.routeId === match.routeId &&\n candidate.id !== match.id,\n )))\n )\n }\n }\n } catch (cause) {\n match.invalid = true\n releaseFlight(router, match)\n reloadFailure = normalizeLaneError(route, cause, options)\n }\n const routeLoader = route.options.loader\n const loader =\n typeof routeLoader === 'function' ? routeLoader : routeLoader?.handler\n let donor =\n (!preload || route.options.preload !== false) &&\n routeLoader &&\n !(process.env.NODE_ENV !== 'production' && router._tx?.[6 /* refresh */])\n ? router._flights?.get(match.id)\n : undefined\n if (donor === match._flight || reloadFailure) {\n donor = undefined\n } else if (donor && !reload && !preload && configured === undefined) {\n // Normal cache policy accepts an already-running generation even when this\n // lane itself would not have started another loader.\n reload = true\n } else if (!reload) {\n donor = undefined\n }\n const background = !!(\n routeLoader &&\n reload &&\n match.status === 'success' &&\n !preload &&\n !options[5 /* sync */] &&\n ((typeof routeLoader === 'function'\n ? undefined\n : routeLoader?.staleReloadMode) ??\n router.options.defaultStaleReloadMode) !== 'blocking'\n )\n const loaded = reload && (!preload || route.options.preload !== false)\n const blocking =\n loaded && !background && (match.status !== 'success' || !!routeLoader)\n const onLazyReady =\n route.lazyFn && route._lazy !== true ? options[8 /* onReady */] : undefined\n if (loaded && !routeLoader) {\n match.invalid = false\n match.updatedAt = Date.now()\n }\n if (donor) {\n donor[2 /* leases */]++\n }\n if (blocking) {\n const acceptedFlight = match._flight\n match._flight = donor\n releaseOwnedFlight(router, match, acceptedFlight)?.abort()\n // A successful route without a loader has no blocking work to present. A\n // mounted success likewise remains renderable while its loader revalidates.\n if (match.status === 'success' && index >= retainedEnd) {\n match.status = 'pending'\n }\n options[8 /* onReady */]?.()\n }\n if (!loaded) {\n match.isFetching = false\n }\n const rawOutcome = reloadFailure\n ? Promise.resolve(reloadFailure)\n : !blocking\n ? Promise.resolve<LoaderOutcome>([SUCCESS, match.loaderData])\n : loadResource(\n router,\n lane,\n match,\n route,\n loader,\n semanticParent,\n preload,\n options[0 /* controller */],\n )\n const outcome = rawOutcome.then((result) => {\n if (blocking) {\n settleInto(match, result, preload)\n if (result[0 /* kind */] === SUCCESS) {\n if (\n preload &&\n routeLoader &&\n !options[0 /* controller */].signal.aborted\n ) {\n cacheLoaderMatch(router, match, plannedCacheMatch)\n }\n // A route is renderable only after both its data and normal component\n // chunk are ready. Its loader data is already available to descendants.\n match.status = 'pending'\n }\n }\n return result\n })\n\n const rawChunkFailure = waitFor(\n Promise.resolve().then(() => loadRouteChunk(route, undefined, onLazyReady)),\n options[0 /* controller */].signal,\n ).then(\n () => undefined,\n (cause): IndexedOutcome => [\n index,\n normalizeLaneError(route, cause, options),\n ],\n )\n const chunkFailure = rawChunkFailure.then((failure) =>\n outcome.then((result) => {\n if (\n blocking &&\n !failure &&\n result[0 /* kind */] === SUCCESS &&\n match.status === 'pending' &&\n options[2 /* isCurrent */]()\n ) {\n match.status = 'success'\n options[8 /* onReady */]?.()\n }\n return failure\n }),\n )\n tasks.push([index, outcome, chunkFailure])\n if (!background) {\n return outcome.then((result) => getParentSnapshot(match, result))\n }\n const candidate: WorkMatch = {\n ...match,\n status: 'pending',\n preload: false,\n _flight: donor,\n }\n match.invalid = false\n match.isFetching = 'loader'\n const backgroundOutcome = loadResource(\n router,\n lane,\n candidate,\n route,\n loader,\n semanticParent,\n false,\n options[0 /* controller */],\n ).then((result) => {\n match.isFetching = false\n settleInto(candidate, result, false)\n return result\n })\n ;(lane[2 /* background */] ??= []).push([\n index,\n backgroundOutcome,\n chunkFailure,\n candidate,\n ])\n return backgroundOutcome.then((result) =>\n getParentSnapshot(candidate, result),\n )\n}\n\nasync function getNotFoundBoundary(\n router: AnyRouter,\n matches: Array<WorkMatch>,\n indexed: IndexedOutcome | undefined,\n signal: AbortSignal,\n fallback = 0,\n): Promise<number> {\n const cause = indexed?.[1 /* outcome */][1 /* error or redirect */] as\n | NotFoundError\n | undefined\n let index = cause?.routeId\n ? matches.findIndex((match) => match.routeId === cause.routeId)\n : (indexed?.[0 /* index */] ?? matches.length - 1)\n if (index < 0) {\n index = 0\n }\n for (let i = index; i >= 0; i--) {\n const route = getRoute(router, matches[i]!)\n const loading = loadRouteChunk(route, false)\n if (loading) {\n try {\n await waitFor(loading, signal)\n } catch (cause) {\n if (cause === signal) {\n throw cause\n }\n }\n }\n if (route.options.notFoundComponent) {\n return i\n }\n }\n return cause?.routeId ? index : fallback\n}\n\nfunction discardBackground(router: AnyRouter, lane: Lane<any>): void {\n if (lane[2 /* background */]) {\n transferMatchResources(\n router,\n lane[2 /* background */].map((task) => task[3 /* candidate */]),\n )\n lane[2 /* background */] = undefined\n }\n}\n\nasync function settleTasks(\n tasks: Array<LoaderTask>,\n serialFailure?: IndexedOutcome,\n redirectTasks?: Array<BackgroundLoaderTask>,\n gate?: number | Promise<number>,\n): Promise<IndexedOutcome | undefined> {\n let loaderFailure: IndexedOutcome | undefined\n\n try {\n await Promise.all(\n tasks.map((task) =>\n task[1 /* outcome */].then(async (outcome) => {\n const taskIndex = task[0 /* index */]\n if (gate && taskIndex >= (await gate)) {\n return\n }\n if (outcome[0 /* kind */] >= REDIRECTED) {\n throw [taskIndex, outcome] as IndexedOutcome\n }\n if (!loaderFailure && outcome[0 /* kind */] !== SUCCESS) {\n loaderFailure = [taskIndex, outcome]\n // Every started descendant must settle before an ordinary failure\n // wins because a redirect from any of them remains control flow.\n await Promise.all(\n (redirectTasks ?? []).map((nextTask) => {\n if (nextTask[0 /* index */] <= taskIndex) {\n return\n }\n return nextTask[1 /* outcome */].then((nextOutcome) => {\n if (nextOutcome[0 /* kind */] === REDIRECTED) {\n throw [\n nextTask[0 /* index */],\n nextOutcome,\n ] as IndexedOutcome\n }\n })\n }),\n )\n }\n }),\n ),\n )\n } catch (cause) {\n return cause as IndexedOutcome\n }\n return serialFailure ?? loaderFailure\n}\n\nasync function reduceLane(\n router: AnyRouter,\n lane: ContextualizedLane,\n tasks: Array<LoaderTask>,\n controller: AbortController,\n redirects: number,\n settlement: Promise<IndexedOutcome | undefined>,\n onReady?: () => void,\n): Promise<ReducedLane | ControlOutcome> {\n const matches = lane[1 /* matches */]\n let failure = await settlement\n let redirectLimitExceeded = false\n const plannedBoundary = matches.findIndex((match) => match._notFound)\n const boundaryOf = (found: IndexedOutcome) =>\n found[1 /* outcome */][0 /* kind */] === NOT_FOUND\n ? getNotFoundBoundary(router, matches, found, controller.signal)\n : found[0 /* index */]\n let readinessEnd = plannedBoundary < 0 ? matches.length : plannedBoundary\n\n if ((failure?.[1 /* outcome */][0 /* kind */] ?? 0) >= REDIRECTED) {\n readinessEnd = 0\n } else if (failure) {\n readinessEnd = failure[2 /* boundary */] ??= await boundaryOf(failure)\n for (const task of tasks) {\n if (task[0 /* index */] >= readinessEnd) {\n break\n }\n const outcome = await task[1 /* outcome */]\n // Presence means a loader previously succeeded, even with `undefined`.\n if (\n outcome[0 /* kind */] !== SUCCESS &&\n outcome[0 /* kind */] < REDIRECTED &&\n !('loaderData' in matches[task[0 /* index */]]!)\n ) {\n failure = [task[0 /* index */], outcome]\n readinessEnd = failure[2 /* boundary */] = await boundaryOf(failure)\n break\n }\n }\n }\n\n for (const task of tasks) {\n if (task[0 /* index */] >= readinessEnd) {\n break\n }\n const chunkFailure = await task[2 /* chunkFailure */]\n if (!chunkFailure) {\n continue\n }\n failure = chunkFailure\n break\n }\n\n if ((failure?.[1 /* outcome */][0 /* kind */] ?? 0) >= REDIRECTED) {\n const outcome = failure![1 /* outcome */]\n if (\n outcome[0 /* kind */] !== REDIRECTED ||\n outcome[1 /* redirect */].options.reloadDocument ||\n redirects < 20\n ) {\n discardBackground(router, lane)\n return outcome as ControlOutcome\n }\n redirectLimitExceeded = true\n failure = [0, [ERROR, new Error('Too many redirects')]]\n }\n\n const boundary = failure\n ? (failure[2 /* boundary */] ?? (await boundaryOf(failure)))\n : plannedBoundary\n if (boundary >= 0) {\n const outcome = failure?.[1 /* outcome */]\n const kind = outcome?.[0 /* kind */]\n const match = matches[boundary]!\n const cause = outcome?.[1 /* error or redirect */]\n const install = () => {\n if (outcome) {\n match._notFound = undefined\n if (kind === ERROR) {\n match.status = 'error'\n } else {\n ;(cause as NotFoundError).routeId = match.routeId\n if (match.routeId === router.routeTree.id) {\n match.status = 'success'\n match._notFound = true\n } else {\n match.status = 'notFound'\n }\n }\n match.error = cause\n match.isFetching = false\n }\n }\n install()\n const route = getRoute(router, match)\n try {\n await waitFor<unknown>(\n outcome\n ? Promise.resolve().then(() =>\n loadRouteChunk(\n route,\n kind === ERROR ? 'errorComponent' : 'notFoundComponent',\n ),\n )\n : Promise.all([\n loadRouteChunk(route),\n loadRouteChunk(route, 'notFoundComponent'),\n ]),\n controller.signal,\n )\n } catch (cause) {\n if (cause === controller.signal) {\n discardBackground(router, lane)\n return [CANCELED]\n }\n }\n if (!outcome) {\n match.status = 'success'\n onReady?.()\n } else if (redirectLimitExceeded) {\n controller.abort()\n await Promise.all([\n ...tasks.map((task) => task[1 /* outcome */]),\n ...tasks.map((task) => task[2 /* chunkFailure */]),\n ...(lane[2 /* background */] ?? []).map(\n (task) => task[1 /* outcome */],\n ),\n ])\n discardBackground(router, lane)\n transferMatchResources(router, matches)\n install()\n }\n }\n\n return lane as ReducedLane\n}\n\nexport async function projectLane(\n router: AnyRouter,\n lane: ReducedLane,\n signal: AbortSignal,\n start = 0,\n end = lane[1 /* matches */].length,\n): Promise<ProjectedLane> {\n const matches = lane[1 /* matches */]\n for (let index = start; index < end; index++) {\n const match = matches[index]!\n const routeOptions = getRoute(router, match).options\n if (routeOptions.head || routeOptions.scripts) {\n try {\n const context = {\n ssr: router.options.ssr,\n matches,\n match,\n params: match.params,\n loaderData: match.loaderData,\n }\n const [head, scripts] = await waitFor(\n Promise.all([\n routeOptions.head?.(context),\n routeOptions.scripts?.(context),\n ]),\n signal,\n )\n match.meta = head?.meta\n match.links = head?.links\n match.headScripts = head?.scripts\n match.styles = head?.styles\n match.scripts = scripts\n } catch (cause) {\n if (cause === signal) {\n break\n }\n console.error(cause)\n }\n }\n if (match.status !== 'success' || match._notFound) {\n break\n }\n }\n return lane as ProjectedLane\n}\n\nasync function executeClientLane(\n router: AnyRouter,\n location: ParsedLocation,\n matches: Array<AnyRouteMatch>,\n options: ExecuteLaneOptions,\n): Promise<LaneResult> {\n const matched = [location, matches as Array<WorkMatch>] as MatchedLane\n const presented = router.stores.matches.get()\n let plannedBoundary = matches.findIndex((match) => match._notFound)\n if (router.options.notFoundMode !== 'root' && plannedBoundary >= 0) {\n const boundary = await getNotFoundBoundary(\n router,\n matched[1 /* matches */],\n undefined,\n options[0 /* controller */].signal,\n plannedBoundary,\n )\n if (boundary !== plannedBoundary) {\n matches[plannedBoundary]!._notFound = undefined\n matches[boundary]!._notFound = true\n }\n plannedBoundary = boundary\n }\n let end = plannedBoundary < 0 ? matches.length : plannedBoundary + 1\n let retainedEnd = 0\n while (retainedEnd < end && retainedEnd !== plannedBoundary) {\n const match = matches[retainedEnd]!\n const committed = options[3 /* base */][retainedEnd]\n const visible = presented[retainedEnd]\n if (\n committed?.id !== match.id ||\n committed.status !== 'success' ||\n committed._notFound ||\n match.preload ||\n visible?.id !== match.id ||\n visible.status !== 'success' ||\n visible._notFound\n ) {\n break\n }\n retainedEnd++\n }\n const tasks: Array<LoaderTask> = []\n const start = options[7 /* resolvedPrefix */] ?? 0\n let semanticParent = start\n ? Promise.resolve(matched[1 /* matches */][start - 1]!)\n : undefined\n const planSuccessfulLane = () => {\n for (let index = start; index < end; index++) {\n if (options[0 /* controller */].signal.aborted) {\n break\n }\n semanticParent = createLoaderTask(\n router,\n matched as ContextualizedLane,\n index,\n tasks,\n semanticParent,\n options,\n retainedEnd,\n )\n }\n }\n // From here on `matched` is contextualized: `contextualize` communicates\n // through mutation plus a failure return, so the phase brand is asserted at\n // the two use sites below rather than granted by a (byte-costing) return.\n const failure = await contextualize(\n router,\n matched,\n options,\n end,\n planSuccessfulLane,\n retainedEnd,\n )\n if (failure) {\n options[5 /* sync */] = true\n end = failure[0 /* index */]\n if (failure[1 /* outcome */][0 /* kind */] === NOT_FOUND) {\n failure[2 /* boundary */] = await getNotFoundBoundary(\n router,\n matched[1 /* matches */],\n failure,\n options[0 /* controller */].signal,\n )\n end = Math.min(end, failure[2 /* boundary */] + 1)\n } else if (failure[1 /* outcome */][0 /* kind */] >= REDIRECTED) {\n end = 0\n }\n planSuccessfulLane()\n }\n if (options[2 /* isCurrent */]() && !options[4 /* preload */]) {\n const abort: Array<AbortController> = []\n for (const [id, flight] of router._flights ?? []) {\n if (!flight[2 /* leases */]) {\n router._flights!.delete(id)\n abort.push(flight[1 /* controller */])\n }\n }\n for (const controller of abort) {\n controller.abort()\n }\n }\n let reduced: ReducedLane | ControlOutcome\n try {\n const reduction = reduceLane(\n router,\n matched as ContextualizedLane,\n tasks,\n options[0 /* controller */],\n options[1 /* redirects */],\n settleTasks(tasks, failure, matched[2 /* background */]),\n options[8 /* onReady */],\n )\n if (matched[2 /* background */]?.length) {\n matched[3 /* backgroundSettlement */] = settleTasks(\n matched[2 /* background */],\n undefined,\n undefined,\n reduction.then(\n (foreground) =>\n isControl(foreground)\n ? 0\n : _getRenderedMatches(foreground[1 /* matches */]).length,\n () => 0,\n ),\n )\n }\n reduced = await reduction\n } catch (cause) {\n discardBackground(router, matched)\n throw cause\n }\n if (isControl(reduced)) {\n return reduced\n }\n return projectLane(\n router,\n reduced,\n options[0 /* controller */].signal,\n options[7 /* resolvedPrefix */] === reduced[1 /* matches */].length\n ? options[7 /* resolvedPrefix */]\n : 0,\n )\n}\n\n/**\n * Waits for `pendingMs`, then presents the complete lane. Rendering applies the\n * selected boundary cutoff while retaining every match's structural state.\n * A replacement load for the same match keeps the timer; choosing a different\n * match resets it. `pendingMinMs` starts after the fallback renders.\n */\nfunction offerPending(router: CoordinatorRouter, tx: LoadTransaction): void {\n if (router._tx !== tx) {\n return\n }\n let session = router._pending\n let tookOver = false\n const sessionMatchId =\n session?.[0 /* owner */][3 /* matches */][session[1 /* boundary */]]?.id\n if (session?.[0 /* owner */] !== tx) {\n if (\n session &&\n tx[3 /* matches */][session[1 /* boundary */]]?.id === sessionMatchId\n ) {\n session[0 /* owner */] = tx\n tookOver = true\n } else {\n clearTimeout(session?.[3 /* timer */])\n router._pending = session = undefined\n }\n }\n const matches = tx[3 /* matches */]\n const presented = router.stores.matches.get()\n let boundary = -1\n let delay: number | undefined\n let min!: number\n let component: unknown\n let presentedPending = false\n for (let index = 0; index < matches.length; index++) {\n const match = matches[index]!\n const success = match.status === 'success'\n presentedPending =\n presented[index]?.id === match.id &&\n presented[index]?.status === 'pending'\n if (success && !presentedPending) {\n continue\n }\n const route = getRoute(router, match as WorkMatch)\n delay =\n (success && presentedPending) || match.invalid\n ? 0\n : (route.options.pendingMs ?? router.options.defaultPendingMs)\n component =\n route.options.pendingComponent ??\n (router.options as any).defaultPendingComponent\n if (!component || typeof delay !== 'number' || delay === Infinity) {\n return\n }\n boundary = index\n min = route.options.pendingMinMs ?? router.options.defaultPendingMinMs ?? 0\n break\n }\n if (boundary < 0) {\n return\n }\n const matchId = matches[boundary]!.id\n if (\n !session ||\n session[1 /* boundary */] !== boundary ||\n sessionMatchId !== matchId\n ) {\n // Hydration and redirects can preserve pending presentation without a session.\n // Do not delay it again; conservatively start pendingMinMs from now.\n clearTimeout(session?.[3 /* timer */])\n router._pending = session = [\n tx,\n boundary,\n presentedPending ? Date.now() + min : tx[4 /* startedAt */] + delay!,\n undefined,\n presentedPending ? Promise.resolve(true) : undefined,\n component,\n ]\n }\n if (\n session[4 /* ack */] &&\n !tookOver &&\n session[5 /* component */] === component\n ) {\n return\n }\n session[5 /* component */] = component\n if (!session[4 /* ack */]) {\n clearTimeout(session[3 /* timer */])\n const remaining = session[2 /* deadline */] - Date.now()\n if (remaining > 0) {\n session[3 /* timer */] = setTimeout(\n () => offerPending(router, tx),\n remaining,\n )\n return\n }\n session[2 /* deadline */] = 0\n }\n const offered = matches.map((match) => ({\n ...match,\n _flight: undefined,\n }))\n offered[boundary]!.status = 'pending'\n const ack = router\n .startTransition(() => router.stores.setMatches(offered), offered)\n .then((rendered) => {\n if (\n rendered &&\n router._pending === session &&\n session[4 /* ack */] === ack &&\n !session[2 /* deadline */]\n ) {\n session[2 /* deadline */] = Date.now() + min\n }\n return rendered\n })\n session[4 /* ack */] = ack\n}\n\n/**\n * Cancels pending UI timing when its load ends. The ownership check prevents\n * an older, superseded load from clearing pending UI that a newer load took over.\n */\nfunction finishPending(router: CoordinatorRouter, tx: LoadTransaction): void {\n const session = router._pending\n if (session?.[0 /* owner */] === tx) {\n clearTimeout(session[3 /* timer */])\n router._pending = undefined\n }\n}\n\nfunction publishMatches(\n router: CoordinatorRouter,\n matches: Array<AnyRouteMatch>,\n): void {\n router._committed = matches\n router.stores.setMatches(matches)\n}\n\nfunction discardLane(router: AnyRouter, lane: ProjectedLane): void {\n transferMatchResources(router, lane[1 /* matches */])\n discardBackground(router, lane)\n}\n\nfunction commitMatches(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n matches: LaneMatches<'projected'>,\n resolvedPrefix?: number,\n): void {\n const previous = router._committed\n const previousCached = router._cache\n for (const match of matches) {\n match.preload = false\n if (resolvedPrefix) {\n match._assetEnd = undefined\n }\n }\n const cut = _getRenderedMatches(matches).length\n const cached = new Map<string, AnyRouteMatch>()\n const now = Date.now()\n for (const match of [...previous, ...previousCached.values()]) {\n // Rendered-prefix ids and settled successes anywhere in the lane are\n // authoritative: retaining an older same-id generation would shadow them\n // at the next planning pass. Unsettled beyond-boundary matches are not —\n // they must not evict a newer same-id preload.\n if (\n match.status !== 'success' ||\n matches.some(\n (candidate, index) =>\n candidate.id === match.id &&\n (index < cut || candidate.status === 'success'),\n )\n ) {\n continue\n }\n const work = match as WorkMatch\n const route = getRoute(router, work)\n if (\n !route.options.loader ||\n now - match.updatedAt >=\n (match.preload\n ? (route.options.preloadGcTime ??\n router.options.defaultPreloadGcTime ??\n 300_000)\n : (route.options.gcTime ?? router.options.defaultGcTime ?? 300_000))\n ) {\n continue\n }\n cached.set(\n match.id,\n previousCached.get(match.id) === match\n ? match\n : ({\n ...match,\n _flight: undefined,\n isFetching: false,\n context: {},\n } as WorkMatch),\n )\n }\n // The lane becomes committed before publication can synchronously reenter.\n tx[3 /* matches */] = []\n router._cache = cached\n publishMatches(router, matches)\n transferMatchResources(\n router,\n [...previousCached.values(), ...previous],\n [...matches, ...cached.values()],\n )\n runRouteLifecycle(router, previous, matches, () => router._tx === tx)\n}\n\nfunction commitRefreshMatches(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n matches: LaneMatches<'projected'>,\n checkpoint: PublicationCheckpoint,\n): void {\n const previous = router._committed\n const previousCached = router._cache\n for (const match of matches) {\n match.preload = false\n }\n const cached = new Map<string, AnyRouteMatch>()\n // Delay releasing the previous owners until the HMR render is acknowledged.\n // Old generations must not become reusable cache entries after refresh.\n tx[3 /* matches */] = []\n router._cache = cached\n checkpoint.previousMatches = previous\n checkpoint.previousCache = previousCached\n checkpoint.published = true\n publishMatches(router, matches)\n if (!checkpoint.published || router._tx !== tx) {\n return\n }\n runRouteLifecycle(router, previous, matches, () => router._tx === tx)\n}\n\nfunction settlePublication(\n router: CoordinatorRouter,\n checkpoint: PublicationCheckpoint,\n): void {\n if (!checkpoint.published) {\n return\n }\n checkpoint.published = false\n transferMatchResources(\n router,\n [...checkpoint.previousCache.values(), ...checkpoint.previousMatches],\n [...router._cache.values(), ...router._committed],\n )\n}\n\nfunction rollbackPublication(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n lane: ProjectedLane,\n checkpoint: PublicationCheckpoint,\n): boolean {\n if (\n !checkpoint.published ||\n router._tx !== tx ||\n router._committed !== lane[1 /* matches */]\n ) {\n settlePublication(router, checkpoint)\n return false\n }\n\n const discarded = [...router._cache.values(), ...router._committed]\n const restored = [\n ...checkpoint.previousCache.values(),\n ...checkpoint.previousMatches,\n ]\n router._cache = checkpoint.previousCache\n router._committed = checkpoint.previousMatches\n checkpoint.published = false\n\n for (const match of discarded as Array<WorkMatch>) {\n if (\n !restored.includes(match) &&\n match._flight &&\n router._flights?.get(match.id) === match._flight\n ) {\n router._flights.delete(match.id)\n }\n }\n\n finishPending(router, tx)\n router.batch(() => {\n router.stores.status.set('idle')\n router.stores.setMatches(checkpoint.previousPresentation)\n })\n tx[0 /* controller */].abort()\n transferMatchResources(router, discarded, restored)\n discardBackground(router, lane)\n if (router._tx === tx && router._commitPromise === checkpoint.commitPromise) {\n router._commitPromise?.resolve()\n router._commitPromise = undefined\n }\n return true\n}\n\nasync function transitionRefresh(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n lane: ProjectedLane,\n changeInfo: ReturnType<typeof getLocationChangeInfo>,\n): Promise<boolean | undefined> {\n const refresh = tx[6 /* refresh */]!\n const checkpoint: PublicationCheckpoint = {\n previousMatches: router._committed,\n previousPresentation: refresh[0 /* presentation */],\n previousCache: router._cache,\n commitPromise: router._commitPromise,\n published: false,\n }\n const commit = () => {\n finishPending(router, tx)\n refresh[2 /* rollback */] = rollback\n commitRefreshMatches(router, tx, lane[1 /* matches */], checkpoint)\n if (!checkpoint.published || router._tx !== tx) {\n return\n }\n router.emit({ type: 'onLoad', ...changeInfo })\n if (router._tx === tx) {\n router.emit({ type: 'onBeforeRouteMount', ...changeInfo })\n }\n }\n const rollback = () => {\n if (refresh[2 /* rollback */] === rollback) {\n refresh[2 /* rollback */] = undefined\n }\n const restored = rollbackPublication(router, tx, lane, checkpoint)\n router._cancelTransition?.()\n return restored\n }\n try {\n const rendered = await router.startTransition(commit, lane[1 /* matches */])\n if (refresh[2 /* rollback */] === rollback) {\n refresh[2 /* rollback */] = undefined\n }\n if (checkpoint.published) {\n const handoff = refresh[1 /* handoff */]\n if (handoff && router._handoff === handoff) {\n handoff[1 /* finish */]()\n }\n if (router._tx === tx) {\n tx[6 /* refresh */] = undefined\n }\n }\n settlePublication(router, checkpoint)\n return rendered\n } catch (cause) {\n if (rollback()) {\n return\n }\n throw cause\n }\n}\n\nasync function awaitCurrent(\n router: CoordinatorRouter,\n owner?: LoadTransaction,\n): Promise<void> {\n let current = router._tx\n while (current && current !== owner) {\n await current[5 /* done */]\n if (router._tx === current) {\n return\n }\n current = router._tx\n }\n}\n\nasync function followRedirect(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n redirect: AnyRedirect,\n): Promise<void> {\n await router.navigate({\n ...redirect.options,\n replace: true,\n ignoreBlocker: true,\n _redirects: tx[1 /* redirects */] + 1,\n } as any)\n}\n\nfunction restoreCommitted(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n): void {\n finishPending(router, tx)\n tx[0 /* controller */].abort()\n transferMatchResources(router, tx[3 /* matches */])\n tx[3 /* matches */] = []\n if (router._tx !== tx) {\n return\n }\n router.batch(() => {\n router.stores.status.set('idle')\n router.stores.setMatches(router._committed)\n })\n if (router._tx === tx) {\n router._commitPromise?.resolve()\n router._commitPromise = undefined\n }\n}\n\nasync function runBackground(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n base: Array<AnyRouteMatch>,\n tasks: Array<BackgroundLoaderTask>,\n settlement: Promise<IndexedOutcome | undefined>,\n): Promise<void> {\n const next = base.map((match) => ({ ...match }))\n acquireMatchResources(next)\n for (const task of tasks) {\n releaseFlight(router, next[task[0 /* index */]]!)\n next[task[0 /* index */]] = task[3 /* candidate */]\n }\n // Phase jump: the clones inherit beforeLoad context from the committed\n // foreground lane, which already ran `contextualize` for these matches.\n const lane = [tx[2 /* location */], next] as ContextualizedLane\n let reduced: ReducedLane | ControlOutcome\n try {\n reduced = await reduceLane(\n router,\n lane,\n tasks,\n tx[0 /* controller */],\n tx[1 /* redirects */],\n settlement,\n )\n } catch (cause) {\n transferMatchResources(router, next)\n throw cause\n }\n if (isControl(reduced)) {\n transferMatchResources(router, next)\n if (\n reduced[0 /* kind */] === REDIRECTED &&\n router._tx === tx &&\n router._committed === base\n ) {\n await followRedirect(router, tx, reduced[1 /* redirect */])\n }\n return\n }\n const projected = await projectLane(\n router,\n reduced,\n tx[0 /* controller */].signal,\n )\n if (router._tx !== tx || router._committed !== base) {\n transferMatchResources(router, projected[1 /* matches */])\n return\n }\n for (const match of projected[1 /* matches */] as Array<WorkMatch>) {\n const cached = router._cache.get(match.id) as WorkMatch | undefined\n if (cached?._flight && cached._flight === match._flight) {\n router._cache.delete(match.id)\n releaseFlight(router, cached)\n }\n }\n publishMatches(router, projected[1 /* matches */])\n transferMatchResources(router, base, projected[1 /* matches */])\n}\n\nasync function runClientTransaction(\n router: CoordinatorRouter,\n tx: LoadTransaction,\n forceStaleReload: boolean,\n onReady?: () => void,\n sync?: boolean,\n resolvedPrefix?: number,\n): Promise<void> {\n const options: ExecuteLaneOptions = [\n tx[0 /* controller */],\n tx[1 /* redirects */],\n () => router._tx === tx && !!tx[3 /* matches */].length,\n router._committed,\n undefined,\n sync,\n forceStaleReload,\n resolvedPrefix,\n onReady,\n ]\n const result = await executeClientLane(\n router,\n tx[2 /* location */],\n tx[3 /* matches */],\n options,\n )\n\n if (isControl(result)) {\n if (result[0 /* kind */] === REDIRECTED && router._tx === tx) {\n finishPending(router, tx)\n transferMatchResources(router, tx[3 /* matches */])\n tx[3 /* matches */] = []\n if (router._tx === tx) {\n if (process.env.NODE_ENV !== 'production' && tx[6 /* refresh */]) {\n router._refreshNextLoad = true\n }\n await followRedirect(router, tx, result[1 /* redirect */])\n }\n } else {\n restoreCommitted(router, tx)\n }\n return\n }\n const pending = router._pending\n if (pending?.[0 /* owner */] === tx) {\n /**\n * Loading finished, so cancel any pending reveal. If the fallback rendered,\n * wait out the rest of `pendingMinMs` before replacing it. If it never\n * rendered, there is no minimum wait; if another load took it over, that\n * load owns the deadline.\n */\n clearTimeout(pending[3 /* timer */])\n if (pending[4 /* ack */]) {\n const signal = tx[0 /* controller */].signal\n let rendered = false\n try {\n rendered = await waitFor(pending[4 /* ack */], signal)\n } catch (cause) {\n if (cause !== signal) {\n throw cause\n }\n }\n if (\n rendered &&\n router._pending === pending &&\n pending[0 /* owner */] === tx\n ) {\n const remaining = pending[2 /* deadline */] - Date.now()\n if (remaining > 0) {\n try {\n await waitFor(\n new Promise<void>((resolve) => {\n pending[3 /* timer */] = setTimeout(resolve, remaining)\n }),\n signal,\n )\n } catch {}\n clearTimeout(pending[3 /* timer */])\n }\n }\n }\n }\n if (router._tx !== tx) {\n finishPending(router, tx)\n discardLane(router, result)\n return\n }\n const toLocation = tx[2 /* location */]\n const changeInfo = getLocationChangeInfo(\n toLocation,\n router.stores.resolvedLocation.get(),\n )\n const background = result[2 /* background */]\n await router.startViewTransition(async () => {\n if (router._tx !== tx) {\n discardLane(router, result)\n return\n }\n const commit = () => {\n finishPending(router, tx)\n commitMatches(router, tx, result[1 /* matches */], resolvedPrefix)\n if (router._tx !== tx) {\n return\n }\n router.emit({ type: 'onLoad', ...changeInfo })\n if (router._tx === tx) {\n router.emit({ type: 'onBeforeRouteMount', ...changeInfo })\n }\n }\n const rendered =\n process.env.NODE_ENV !== 'production' && tx[6 /* refresh */]\n ? await transitionRefresh(router, tx, result, changeInfo)\n : await router.startTransition(commit, result[1 /* matches */])\n if (\n process.env.NODE_ENV !== 'production' &&\n tx[6 /* refresh */] &&\n rendered === undefined\n ) {\n return\n }\n if (router._tx !== tx) {\n discardBackground(router, result)\n return\n }\n if (background?.length) {\n // Publish refreshes only after the foreground render acknowledgement.\n // Otherwise a fast refresh can replace the acknowledged generation\n // before the framework commits it and strand the navigation.\n runBackground(\n router,\n tx,\n result[1 /* matches */],\n background,\n result[3 /* backgroundSettlement */]!,\n ).catch(console.error)\n }\n router.batch(() => {\n router.stores.resolvedLocation.set(toLocation)\n router.stores.status.set('idle')\n if (router._tx === tx) {\n router.emit({ type: 'onResolved', ...changeInfo })\n }\n if (rendered && router._tx === tx) {\n router.emit({ type: 'onRendered', ...changeInfo })\n }\n })\n if (router._tx !== tx) {\n return\n }\n router._commitPromise?.resolve()\n router._commitPromise = undefined\n })\n}\n\nexport async function loadClientRoute(\n router: CoordinatorRouter,\n opts?: { sync?: boolean },\n): Promise<void> {\n let rematerialize = false\n if (process.env.NODE_ENV !== 'production') {\n router._tx?.[6 /* refresh */]?.[2 /* rollback */]?.()\n rematerialize = !!router._refreshNextLoad || !!router._tx?.[6 /* refresh */]\n }\n const refreshPresentation = rematerialize\n ? router.stores.matches.get()\n : undefined\n const previousOwner = router._tx\n const resolvedLocation = router.stores.resolvedLocation.get()\n const previousLocation = resolvedLocation ?? router.stores.location.get()\n const location = router.latestLocation\n const pendingLocation = router._pendingLocation as\n | (ParsedLocation & { _redirects?: number })\n | undefined\n const redirects =\n pendingLocation?.href === location.href\n ? (pendingLocation._redirects ?? 0)\n : 0\n const handoff = router._handoff\n const hydrationController = rematerialize\n ? undefined\n : handoff?.[0 /* claim */]()\n const preflight = new AbortController()\n const previousPreflight = router._preflight\n router._preflight = preflight\n if (!rematerialize && !hydrationController) {\n handoff?.[1 /* finish */]()\n }\n previousPreflight?.abort()\n // The preflight controller is not exposed to route hooks. Every replacement\n // aborts its predecessor, so a live signal is the sole authority here.\n if (preflight.signal.aborted) {\n await awaitCurrent(router, previousOwner)\n return\n }\n\n const changeInfo = getLocationChangeInfo(location, resolvedLocation)\n router.emit({ type: 'onBeforeNavigate', ...changeInfo })\n if (!preflight.signal.aborted) {\n router.emit({ type: 'onBeforeLoad', ...changeInfo })\n }\n if (preflight.signal.aborted) {\n await awaitCurrent(router, previousOwner)\n return\n }\n const sameHref = previousLocation.href === location.href\n let matches: Array<AnyRouteMatch>\n let controller = preflight\n try {\n matches =\n process.env.NODE_ENV !== 'production' && rematerialize\n ? router.matchRoutes(location, {\n _controller: preflight,\n _rematerialize: true,\n })\n : router.matchRoutes(location, { _controller: preflight })\n acquireMatchResources(matches)\n } catch (cause) {\n preflight.abort()\n if (!isRedirect(cause)) {\n if (process.env.NODE_ENV !== 'production' && rematerialize) {\n router._refreshNextLoad = undefined\n }\n await awaitCurrent(router)\n router._commitPromise?.resolve()\n router._commitPromise = undefined\n return\n }\n await router.navigate({\n ...cause.options,\n replace: true,\n ignoreBlocker: true,\n })\n await awaitCurrent(router, previousOwner)\n return\n }\n const resolvedPrefix = hydrationController\n ? handoff\n : undefined\n if (resolvedPrefix) {\n controller = hydrationController!\n } else {\n hydrationController?.abort()\n }\n if (preflight.signal.aborted) {\n transferMatchResources(router, matches)\n await awaitCurrent(router, previousOwner)\n return\n }\n router._preflight = undefined\n\n const tx: LoadTransaction = [\n controller,\n redirects,\n location,\n matches,\n Date.now(),\n Promise.resolve()\n .then(() =>\n runClientTransaction(\n router,\n tx,\n sameHref,\n () => offerPending(router, tx),\n opts?.sync,\n resolvedPrefix,\n ),\n )\n .catch(() => {\n if (router._tx === tx) {\n restoreCommitted(router, tx)\n }\n }),\n ]\n if (process.env.NODE_ENV !== 'production' && rematerialize) {\n // `refreshPresentation` is always captured when `rematerialize` is set.\n tx[6 /* refresh */] = [refreshPresentation!, handoff]\n router._refreshNextLoad = undefined\n }\n router._tx = tx\n if (previousOwner) {\n for (const match of router.stores.matches.get() as Array<WorkMatch>) {\n if (router._tx !== tx) {\n break\n }\n if (match.isFetching) {\n setFetching(router, match, false)\n }\n }\n previousOwner[0 /* controller */].abort()\n transferMatchResources(\n router,\n previousOwner[3 /* matches */],\n tx[3 /* matches */],\n true,\n )\n }\n if (router._tx !== tx) {\n transferMatchResources(router, tx[3 /* matches */])\n tx[3 /* matches */] = []\n await awaitCurrent(router, tx)\n return\n }\n router.batch(() => {\n router.stores.status.set('pending')\n router.stores.location.set(location)\n })\n // Cold loads have no committed UI to retain, but provisional not-found\n // matches must wait for lazy routes to place the final boundary.\n if (!resolvedLocation && !matches.some((match) => match._notFound)) {\n offerPending(router, tx)\n }\n try {\n await tx[5 /* done */]\n } finally {\n await awaitCurrent(router, tx)\n }\n}\n\nexport async function refreshClientRoute(\n router: CoordinatorRouter,\n): Promise<void> {\n router._tx?.[6 /* refresh */]?.[2 /* rollback */]?.()\n const pending = router._tx\n if (\n pending &&\n !pending[6 /* refresh */] &&\n router.stores.status.get() === 'pending'\n ) {\n await pending[5 /* done */]\n if (router._tx !== pending) {\n await awaitCurrent(router, pending)\n }\n }\n // Existing owners remain alive for rollback but cannot donate stale work.\n router._flights?.clear()\n router.clearCache()\n router._refreshNextLoad = true\n await loadClientRoute(router, { sync: true })\n}\n\nexport async function preloadClientRoute(\n router: CoordinatorRouter,\n opts: any,\n redirects = 0,\n): Promise<Array<AnyRouteMatch> | undefined> {\n if (redirects > 20) {\n return\n }\n if (\n process.env.NODE_ENV !== 'production' &&\n (router._refreshNextLoad || router._tx?.[6 /* refresh */])\n ) {\n return\n }\n const location = opts._builtLocation ?? router.buildLocation(opts)\n const base = router._committed\n const controller = new AbortController()\n let matches: Array<AnyRouteMatch>\n try {\n matches = router.matchRoutes(location, {\n _controller: controller,\n })\n acquireMatchResources(matches)\n } catch (cause) {\n controller.abort()\n if (!isNotFound(cause)) {\n console.error(cause)\n }\n return\n }\n ;(router._preloads ??= new Map()).set(controller, matches)\n let active: boolean\n try {\n let result: LaneResult\n try {\n result = await executeClientLane(router, location, matches, [\n controller,\n redirects,\n // Preload lanes run to completion even when unrelated navigations commit:\n // finished work seeds the cache.\n () => true,\n base,\n true,\n ])\n } finally {\n active = router._preloads.delete(controller)\n transferMatchResources(router, matches)\n controller.abort()\n }\n if (!isControl(result)) {\n return result[1 /* matches */]\n }\n if (\n active &&\n result[0 /* kind */] === REDIRECTED &&\n !result[1 /* redirect */].options.reloadDocument\n ) {\n return preloadClientRoute(\n router,\n {\n ...result[1 /* redirect */].options,\n _fromLocation: location,\n },\n redirects + 1,\n )\n }\n } catch (cause) {\n if (!isNotFound(cause)) {\n console.error(cause)\n }\n }\n return\n}\n\n// --- SSR hydration (client entry via @tanstack/router-core/ssr/client) ---\n\ndeclare global {\n interface Window {\n [GLOBAL_TSR]?: TsrSsrGlobal\n [GLOBAL_SEROVAL]?: any\n }\n}\n\nexport async function hydrate(router: AnyRouter): Promise<void> {\n if (process.env.NODE_ENV !== 'production' && !window.$_TSR) {\n throw new Error(\n 'Invariant failed: Expected to find bootstrap data on window.$_TSR, but we did not. Please file an issue!',\n )\n }\n const tsr = window.$_TSR!\n\n const adapters = router.options.serializationAdapters as\n | Array<AnySerializationAdapter>\n | undefined\n if (adapters?.length) {\n tsr.t = new Map(\n adapters.map((adapter) => [adapter.key, adapter.fromSerializable]),\n )\n tsr.buffer.forEach((script) => script())\n }\n tsr.initialized = true\n\n const dehydratedRouter = tsr.router\n if (process.env.NODE_ENV !== 'production' && !dehydratedRouter) {\n throw new Error(\n 'Invariant failed: Expected to find a dehydrated data on window.$_TSR.router, but we did not. Please file an issue!',\n )\n }\n router.ssr = { manifest: dehydratedRouter!.manifest }\n router.options.ssr = {\n nonce: (\n document.querySelector('meta[property=\"csp-nonce\"]') as\n | HTMLMetaElement\n | undefined\n )?.content,\n }\n\n const dehydratedMatches = dehydratedRouter!.matches\n\n const controller = new AbortController()\n const previousPreflight = router._preflight\n router._preflight = controller\n previousPreflight?.abort()\n // Route context can abort this controller itself. Only a new slot owner\n // supersedes hydration.\n const isCurrent = () => router._preflight === controller\n\n let location!: AnyRouter['latestLocation']\n let candidates!: Array<AnyRouteMatch>\n let handoffHistoryHref!: string\n let handoffHistoryState: unknown\n try {\n await waitFor(\n router.options.hydrate?.(dehydratedRouter!.dehydratedData),\n controller.signal,\n )\n if (!isCurrent()) {\n return\n }\n // Hydration trusts transported context and beforeLoad. The raw history\n // entry owns the handoff; route structure is verified after rematching.\n const historyLocation = router.history.location\n handoffHistoryHref = historyLocation.href\n handoffHistoryState = historyLocation.state\n router.updateLatestLocation()\n location = router.latestLocation\n router.stores.location.set(location)\n candidates = router.matchRoutes(location, {\n _controller: controller,\n })\n } catch (cause) {\n if (isCurrent()) {\n router._preflight = undefined\n }\n controller.abort(cause)\n if (cause !== controller.signal) {\n throw cause\n }\n }\n if (!isCurrent()) {\n return\n }\n const committed: Array<AnyRouteMatch> = []\n let pendingBoundary: number | undefined\n let verifiedAssetEnd = 0\n const retryFrom = (index: number) => {\n // The failing route's identity is still verified, but no descendant is.\n verifiedAssetEnd = Math.min(verifiedAssetEnd, index + 1)\n const removed = committed.splice(index)\n for (const match of removed) {\n if (\n getRoute(router, match).options.loader &&\n (match.status === 'success' ||\n (!match.invalid && 'loaderData' in match))\n ) {\n cacheLoaderMatch(\n router,\n // Phase jump: dehydrated server data is already past the loader\n // phase — the guard above verified a settled success (or transported\n // loaderData), so this clone is settled without a client settleInto.\n {\n ...match,\n status: 'success',\n error: undefined,\n preload: true,\n } as SettledMatch,\n router._cache.get(match.id),\n )\n }\n }\n transferMatchResources(router, removed)\n }\n\n // A longer server lane is valid only when the local match already caps the\n // branch at a global not-found boundary. Otherwise no transported work is\n // safe to attach to the shorter client lane.\n const shared =\n dehydratedMatches.length > candidates.length\n ? candidates.findIndex((match) => match._notFound) + 1\n : dehydratedMatches.length\n let isTerminal = false\n for (let index = 0; index < shared; index++) {\n const candidate = candidates[index]!\n const dehydrated = dehydratedMatches[index]!\n if (\n typeof dehydrated.i !== 'string' ||\n hydrateSsrMatchId(dehydrated.i) !== candidate.id\n ) {\n pendingBoundary ??= index\n break\n }\n verifiedAssetEnd = index + 1\n const route = getRoute(router, candidate)\n if (\n 'l' in dehydrated ||\n (dehydrated.s === 'success' &&\n dehydrated.e === undefined &&\n route.options.loader)\n ) {\n candidate.loaderData = dehydrated.l\n }\n candidate.status = dehydrated.s\n candidate.ssr = dehydrated.ssr\n route.options.ssr = candidate.ssr\n candidate.updatedAt = dehydrated.u\n candidate.error = dehydrated.e\n candidate._notFound ||= dehydrated.g\n const terminal =\n candidate.status === 'error' ||\n candidate.status === 'notFound' ||\n candidate._notFound\n if (terminal) {\n isTerminal = true\n committed.push(candidate)\n if (candidate.ssr === false || candidate.ssr === 'data-only') {\n pendingBoundary ??= index\n }\n break\n }\n if (candidate.status === 'pending') {\n pendingBoundary ??= index\n break\n }\n\n committed.push(candidate)\n if (candidate.ssr === 'data-only') {\n pendingBoundary ??= index\n }\n }\n if (\n !isTerminal &&\n committed.length === shared &&\n shared < candidates.length\n ) {\n pendingBoundary = shared\n }\n\n // Hooks observe structural membership. Execution remains limited to\n // `committed`, the accepted server prefix.\n const chunks = committed.map(async (match) => {\n try {\n const route = getRoute(router, match)\n if (match._notFound) {\n await Promise.all([\n loadRouteChunk(route),\n loadRouteChunk(route, 'notFoundComponent'),\n ])\n } else {\n await loadRouteChunk(\n route,\n match.status === 'error'\n ? 'errorComponent'\n : match.status === 'notFound'\n ? 'notFoundComponent'\n : undefined,\n )\n }\n return true\n } catch {\n return false\n }\n })\n let chunkFailure = 0\n try {\n while (\n chunkFailure < chunks.length &&\n (await waitFor(chunks[chunkFailure]!, controller.signal))\n ) {\n chunkFailure++\n }\n } catch {\n return\n }\n if (!isCurrent()) {\n return\n }\n if (chunkFailure < committed.length) {\n retryFrom(chunkFailure)\n }\n\n // The first pending match is already visible, so prepare its route context\n // without granting its beforeLoad or loader any hydration authority.\n const contextEnd = Math.max(\n pendingBoundary === committed.length\n ? committed.length + 1\n : committed.length,\n // `chunks.length` keeps the pre-retry committed length, so a smaller\n // `chunkFailure` is the exclusive bound of the verified context prefix.\n chunkFailure < chunks.length ? chunkFailure : verifiedAssetEnd,\n )\n for (let index = 0; index < contextEnd; index++) {\n const match = candidates[index]!\n const route = getRoute(router, match)\n const parentContext =\n candidates[index - 1]?.context ?? router.options.context ?? {}\n let routeContext\n if (route.options.context) {\n try {\n routeContext = match._ctx =\n route.options.context({\n deps: match.loaderDeps,\n params: match.params,\n context: parentContext,\n location,\n navigate: navigateFrom(router, location),\n buildLocation: router.buildLocation,\n cause: match.cause,\n abortController: controller,\n preload: false,\n matches: candidates,\n routeId: route.id,\n }) || {}\n } catch {\n if (!isCurrent()) {\n return\n }\n if (\n match.status !== 'error' &&\n match.status !== 'notFound' &&\n !match._notFound\n ) {\n retryFrom(index)\n break\n }\n }\n if (!isCurrent()) {\n return\n }\n }\n match.context = {\n ...parentContext,\n ...routeContext,\n ...(committed[index] && dehydratedMatches[index]!.b),\n }\n }\n\n await projectLane(\n router,\n [location, candidates] as any,\n controller.signal,\n 0,\n verifiedAssetEnd,\n )\n if (!isCurrent()) {\n return\n }\n const needsClientLoad =\n pendingBoundary !== undefined || committed.length < shared\n const committedMatches =\n isTerminal && committed.length === shared ? candidates : committed\n let presented = needsClientLoad ? candidates : committedMatches\n let dataOnlyAssetEnd: number | undefined\n if (needsClientLoad && pendingBoundary !== undefined) {\n const boundary = presented[pendingBoundary]!\n // A verified descendant proves this data-only boundary was nonterminal.\n dataOnlyAssetEnd =\n boundary.ssr === 'data-only' && verifiedAssetEnd > pendingBoundary + 1\n ? verifiedAssetEnd\n : undefined\n presented = presented.slice()\n presented[pendingBoundary] = {\n ...boundary,\n status: 'pending',\n ssr: boundary.ssr === 'data-only' ? 'data-only' : false,\n _assetEnd: dataOnlyAssetEnd,\n }\n }\n\n const claim = () => {\n const historyLocation = router.history.location\n return needsClientLoad &&\n !router._tx &&\n historyLocation.href === handoffHistoryHref &&\n historyLocation.state === handoffHistoryState &&\n router._committed === committedMatches &&\n committedMatches.length &&\n !controller.signal.aborted\n ? controller\n : undefined\n }\n const handoff: NonNullable<AnyRouter['_handoff']> = [\n claim,\n (matches) => {\n if (router._handoff !== handoff) {\n return\n }\n // `finish` is single-use. Consume the slot before validating or moving\n // resources so reentrant work cannot claim the same handoff.\n router._handoff = undefined\n const prefix = committedMatches.length\n if (\n !matches ||\n !claim() ||\n committedMatches.some((match, index) => match.id !== matches[index]?.id)\n ) {\n controller.abort()\n return\n }\n let handoffAssetEnd = dataOnlyAssetEnd\n if (handoffAssetEnd !== undefined) {\n for (let index = prefix; index < handoffAssetEnd; index++) {\n if (candidates[index]?.id !== matches[index]?.id) {\n handoffAssetEnd = index > pendingBoundary! + 1 ? index : undefined\n break\n }\n }\n }\n const clones = committedMatches.map((match) => ({ ...match }))\n if (handoffAssetEnd !== undefined) {\n clones[pendingBoundary!]!._assetEnd = handoffAssetEnd\n }\n transferMatchResources(router, matches.splice(0, prefix, ...clones))\n for (let index = prefix; index < matches.length; index++) {\n const match = matches[index]!\n const hydrated = candidates[index]\n if (hydrated?.id === match.id && hydrated._ctx) {\n match._ctx = hydrated._ctx\n }\n match.abortController = controller\n }\n return prefix\n },\n ]\n router._committed = committedMatches\n router._handoff = handoff\n router._preflight = undefined\n router.batch(() => {\n router.stores.setMatches(presented)\n router.stores.status.set('idle')\n if (!needsClientLoad) {\n router.stores.resolvedLocation.set(router.stores.location.get())\n }\n })\n}\n"],"mappings":";;;;;AA4BA,SAAgB,kBACd,OACA,QACM;CACN,MAAM,SAAS,UAAU,MAAM;CAC/B,MAAM,QAAQ,KAAA;AAChB;AAEA,SAAS,iBACP,OACA,MAC2B;CAC3B,OAAQ,MAAM,QAAQ,OAAe,UAAU;AACjD;AAEA,SAAS,eACP,OACA,gBAC2B;CAC3B,MAAM,YAAY,iBAAiB,OAAO,WAAW;CACrD,MAAM,UAAU,iBAAiB,OA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