import { GLOBAL_SEROVAL, GLOBAL_TSR } from './ssr/constants.js'; import { TsrSsrGlobal } from './ssr/types.js'; import { ParsedLocation } from './location.js'; import { NavigateOptions } from './link.js'; import { AnyRouteMatch } from './Matches.js'; import { NotFoundError } from './not-found.js'; import { AnyRoute } from './route.js'; import { AnyRedirect } from './redirect.js'; import { AnyRouter, RouterCore, TrailingSlashOption } from './router.js'; import { RoutePaths } from './routeInfo.js'; import { RouterHistory } from '@tanstack/history'; export declare function replaceRouteChunk(route: AnyRoute, lazyFn: AnyRoute['lazyFn']): void; export declare function loadRouteChunk(route: AnyRoute, componentType?: 'errorComponent' | 'notFoundComponent' | false, onPendingReady?: () => void): Promise | undefined; /** Return the structural lane through the first terminal render boundary. */ export declare function _getRenderedMatches(matches: Array): Array; /** Return the lane whose document assets belong to the current presentation. */ export declare function _getAssetMatches(matches: Array): Array; declare const lanePhase: unique symbol; type LanePhase = 'matched' | 'contextualized' | 'reduced' | 'projected'; /** * Lane matches carry their lane's phase so functions can demand evidence of * pipeline position (e.g. `commitMatches` only accepts a projected lane's * matches). The brand is phantom — it never exists at runtime. */ type LaneMatches = Array & { readonly [lanePhase]?: TPhase; }; type Lane = [ location: ParsedLocation, matches: LaneMatches, background?: Array, backgroundSettlement?: Promise ] & { readonly [lanePhase]?: TPhase; }; type ReducedLane = Lane<'reduced'>; type ProjectedLane = Lane<'projected'>; declare const SUCCESS = 0; declare const ERROR = 1; declare const NOT_FOUND = 2; declare const REDIRECTED = 3; declare const CANCELED = 4; type RedirectOutcome = [ kind: typeof REDIRECTED, redirect: AnyRedirect, location?: ParsedLocation ]; type NonRedirectOutcome = [kind: typeof SUCCESS, data: unknown] | [kind: typeof ERROR, error: unknown] | [kind: typeof NOT_FOUND, error: NotFoundError] | [kind: typeof CANCELED]; type RawLoaderOutcome = NonRedirectOutcome | [kind: typeof REDIRECTED, redirect: AnyRedirect]; type LoaderOutcome = NonRedirectOutcome | RedirectOutcome; type IndexedOutcome = [index: number, outcome: LoaderOutcome, boundary?: number]; export type LoaderFlight = [ outcome: Promise, controller: AbortController, leases: number ]; type WorkMatch = AnyRouteMatch & { _flight?: LoaderFlight; }; declare const matchPhase: unique symbol; /** * A match whose loader outcome has been applied by `settleInto`, which is the * sole granter of this brand (phantom, zero-runtime). Consumers that require * it — e.g. `cacheLoaderMatch` — can only be reached after settlement, so the * compiler enforces the loader→settle→cache ordering. Sources that arrive * already settled (dehydrated server data) must cast at a named boundary. */ type SettledMatch = WorkMatch & { readonly [matchPhase]: 'settled'; }; export type LoadTransaction = [ controller: AbortController, redirects: number, location: ParsedLocation, matches: Array, startedAt: number, done: Promise, /** * Dev-only HMR refresh mode. Presence forces successor rematerialization * until this publication is acknowledged. The optional hydration handoff is * retired when the refresh publishes. */ refresh?: [handoff: NonNullable | undefined] ]; export type PendingSession = [ generation: LoadTransaction, boundaryId: string, /** Pending reveal time until acknowledged, then minimum-visible-until time. */ deadline: number, revealTimer?: ReturnType, ack?: Promise | true, component?: unknown ]; type CoordinatorRouter = AnyRouter & { /** Active speculative lanes retained for cancellation, invalidation, and cache clearing. */ _preloads?: Map>; _refreshNextLoad?: boolean; }; type BackgroundLoaderTask = [ index: number, outcome: Promise, chunkFailure: Promise, candidate: WorkMatch ]; export declare function waitFor(value: T | PromiseLike, signal: AbortSignal): Promise; export declare function getRoute(router: AnyRouter, match: WorkMatch): AnyRoute; export declare function cacheLoaderMatch(router: CoordinatorRouter, match: SettledMatch, planned: AnyRouteMatch | undefined): void; export declare function projectLane(router: AnyRouter, lane: ReducedLane, signal: AbortSignal, start?: number, end?: number): Promise; export declare function commitMatches(router: CoordinatorRouter, tx: LoadTransaction, matches: LaneMatches<'projected'>, resolvedPrefix?: number): void; export declare function loadClientRoute(router: CoordinatorRouter, opts?: { sync?: boolean; }): Promise; export declare function refreshClientRoute(router: CoordinatorRouter): Promise; export declare function preloadClientRoute = Record, TFrom extends RoutePaths | string = string, TTo extends string | undefined = undefined, TMaskFrom extends RoutePaths | string = TFrom, TMaskTo extends string = ''>(router: RouterCore, opts: NavigateOptions, TFrom, TTo, TMaskFrom, TMaskTo>): Promise | undefined>; declare global { interface Window { [GLOBAL_TSR]?: TsrSsrGlobal; [GLOBAL_SEROVAL]?: any; } } export declare function hydrate(router: AnyRouter): Promise; export {};