/**
 * Segment Resolution
 *
 * Extracted from createRouter closure. Contains all segment resolution functions
 * for both fresh (full match) and revalidation (partial match) paths.
 *
 * Functions receive a `deps` parameter for closure-bound helpers from createRouter.
 */
import type { ReactNode } from "react";
import type { EntryData } from "../server/context";
import type { HandlerContext, ResolvedSegment, ShouldRevalidateFn } from "../types";
import type { SegmentResolutionDeps, SegmentRevalidationResult, ActionContext } from "./types.js";
/**
 * Handle Response returns from handlers.
 * When a handler returns a Response (e.g., redirect), throw it to trigger
 * the short-circuit mechanism. Otherwise return the ReactNode.
 */
export declare function handleHandlerResult(result: ReactNode | Response | Promise<ReactNode> | Promise<Response>): ReactNode;
/**
 * Resolve loaders for an entry and emit segments.
 * Loaders are run lazily via ctx.use() and memoized for parallel execution.
 */
export declare function resolveLoaders<TEnv>(entry: EntryData, ctx: HandlerContext<any, TEnv>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, shortCodeOverride?: string): Promise<ResolvedSegment[]>;
/**
 * Options for segment resolution.
 */
export interface ResolveSegmentOptions {
    /** When true, skip resolveLoaders() calls (used for pre-rendering) */
    skipLoaders?: boolean;
}
/**
 * Resolve segments from EntryData.
 * Executes middlewares, loaders, parallels, and handlers in correct order.
 * Returns array: [main segment, ...orphan layout segments]
 */
export declare function resolveSegment<TEnv>(entry: EntryData, routeKey: string, params: Record<string, string>, context: HandlerContext<any, TEnv>, loaderPromises: Map<string, Promise<any>>, deps: SegmentResolutionDeps<TEnv>, isRouteEntry?: boolean, options?: ResolveSegmentOptions): Promise<ResolvedSegment[]>;
/**
 * Resolve orphan layout with its middlewares, loaders, and parallels.
 */
export declare function resolveOrphanLayout<TEnv>(orphan: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, loaderPromises: Map<string, Promise<any>>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>): Promise<ResolvedSegment[]>;
/**
 * Resolve parallel EntryData with its loaders and slot handlers.
 */
export declare function resolveParallelEntry<TEnv>(parallelEntry: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, parentShortCode: string, deps: SegmentResolutionDeps<TEnv>): Promise<ResolvedSegment[]>;
/**
 * Wrapper that adds error boundary handling to segment resolution.
 */
export declare function resolveWithErrorHandling<TEnv>(entry: EntryData, routeKey: string, params: Record<string, string>, context: HandlerContext<any, TEnv>, loaderPromises: Map<string, Promise<any>>, resolveFn: () => Promise<ResolvedSegment[]>, deps: SegmentResolutionDeps<TEnv>, errorContext?: {
    env?: TEnv;
    isPartial?: boolean;
    requestStartTime?: number;
}): Promise<ResolvedSegment[]>;
/**
 * Resolve all segments for a route (used for single-cache-per-request pattern).
 */
export declare function resolveAllSegments<TEnv>(entries: EntryData[], routeKey: string, params: Record<string, string>, context: HandlerContext<any, TEnv>, loaderPromises: Map<string, Promise<any>>, deps: SegmentResolutionDeps<TEnv>, options?: ResolveSegmentOptions): Promise<ResolvedSegment[]>;
/**
 * Resolve only loader segments for all entries (used when serving cached non-loader segments).
 */
export declare function resolveLoadersOnly<TEnv>(entries: EntryData[], context: HandlerContext<any, TEnv>, deps: SegmentResolutionDeps<TEnv>): Promise<ResolvedSegment[]>;
/**
 * Resolve loaders with revalidation awareness (for partial rendering).
 * Returns both segments to render AND all matched segment IDs.
 */
export declare function resolveLoadersWithRevalidation<TEnv>(entry: EntryData, ctx: HandlerContext<any, TEnv>, belongsToRoute: boolean, clientSegmentIds: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, routeKey: string, deps: SegmentResolutionDeps<TEnv>, actionContext?: ActionContext, shortCodeOverride?: string, stale?: boolean): Promise<{
    segments: ResolvedSegment[];
    matchedIds: string[];
}>;
/**
 * Resolve only loader segments for all entries with revalidation logic.
 */
export declare function resolveLoadersOnlyWithRevalidation<TEnv>(entries: EntryData[], context: HandlerContext<any, TEnv>, clientSegmentIds: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, routeKey: string, deps: SegmentResolutionDeps<TEnv>, actionContext?: ActionContext): Promise<{
    segments: ResolvedSegment[];
    matchedIds: string[];
}>;
/**
 * Build a map of segment shortCode -> entry with revalidate functions.
 */
export declare function buildEntryRevalidateMap(entries: EntryData[]): Map<string, {
    entry: EntryData;
    revalidate: ShouldRevalidateFn<any, any>[];
}>;
/**
 * Resolve parallel segments with revalidation.
 */
export declare function resolveParallelSegmentsWithRevalidation<TEnv>(entry: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, clientSegmentIds: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, routeKey: string, deps: SegmentResolutionDeps<TEnv>, actionContext?: ActionContext, stale?: boolean): Promise<SegmentRevalidationResult>;
/**
 * Resolve entry handler (layout, cache, or route) with revalidation.
 */
export declare function resolveEntryHandlerWithRevalidation<TEnv>(entry: Exclude<EntryData, {
    type: "parallel";
}>, params: Record<string, string>, context: HandlerContext<any, TEnv>, belongsToRoute: boolean, clientSegmentIds: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, routeKey: string, deps: SegmentResolutionDeps<TEnv>, actionContext?: ActionContext, stale?: boolean): Promise<{
    segment: ResolvedSegment;
    matchedId: string;
}>;
/**
 * Resolve segments with revalidation awareness (for partial rendering).
 */
export declare function resolveSegmentWithRevalidation<TEnv>(entry: Exclude<EntryData, {
    type: "parallel";
}>, routeKey: string, params: Record<string, string>, context: HandlerContext<any, TEnv>, clientSegmentIds: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, loaderPromises: Map<string, Promise<any>>, deps: SegmentResolutionDeps<TEnv>, actionContext?: ActionContext, stale?: boolean): Promise<SegmentRevalidationResult>;
/**
 * Resolve orphan layout with revalidation.
 */
export declare function resolveOrphanLayoutWithRevalidation<TEnv>(orphan: EntryData, params: Record<string, string>, context: HandlerContext<any, TEnv>, clientSegmentIds: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, routeKey: string, loaderPromises: Map<string, Promise<any>>, belongsToRoute: boolean, deps: SegmentResolutionDeps<TEnv>, actionContext?: ActionContext, stale?: boolean): Promise<SegmentRevalidationResult>;
/**
 * Wrapper for segment resolution with revalidation that adds error boundary handling.
 */
export declare function resolveWithRevalidationErrorHandling<TEnv>(entry: EntryData, params: Record<string, string>, resolveFn: () => Promise<SegmentRevalidationResult>, deps: SegmentResolutionDeps<TEnv>, pathname?: string, errorContext?: {
    request: Request;
    url: URL;
    routeKey?: string;
    env?: TEnv;
    isPartial?: boolean;
    requestStartTime?: number;
}): Promise<SegmentRevalidationResult>;
/**
 * Resolve all segments for a route with revalidation logic (for matchPartial).
 */
export declare function resolveAllSegmentsWithRevalidation<TEnv>(entries: EntryData[], routeKey: string, params: Record<string, string>, context: HandlerContext<any, TEnv>, clientSegmentSet: Set<string>, prevParams: Record<string, string>, request: Request, prevUrl: URL, nextUrl: URL, loaderPromises: Map<string, Promise<any>>, actionContext: ActionContext | undefined, interceptResult: {
    intercept: any;
    entry: EntryData;
} | null, localRouteName: string, pathname: string, deps: SegmentResolutionDeps<TEnv>): Promise<{
    segments: ResolvedSegment[];
    matchedIds: string[];
}>;
//# sourceMappingURL=segment-resolution.d.ts.map