import type { ActionResult, DynamicParamTypesShort, FlightRouterState, FlightSegmentPath, RenderOpts, Segment } from './types';
import type { StaticGenerationStore } from '../../client/components/static-generation-async-storage.external';
import type { RequestStore } from '../../client/components/request-async-storage.external';
import type { NextParsedUrlQuery } from '../request-meta';
import type { AppPageModule } from '../route-modules/app-page/module';
import type { ClientReferenceManifest } from '../../build/webpack/plugins/flight-manifest-plugin';
import type { Revalidate } from '../lib/revalidate';
import type { DeepReadonly } from '../../shared/lib/deep-readonly';
import type { BaseNextRequest, BaseNextResponse } from '../base-http';
import RenderResult, { type AppPageRenderResultMetadata } from '../render-result';
import { type ErrorHandler } from './create-error-handler';
import type { ServerComponentsHmrCache } from '../response-cache';
export type GetDynamicParamFromSegment = (segment: string) => {
    param: string;
    value: string | string[] | null;
    treeSegment: Segment;
    type: DynamicParamTypesShort;
} | null;
type AppRenderBaseContext = {
    staticGenerationStore: StaticGenerationStore;
    requestStore: RequestStore;
    componentMod: AppPageModule;
    renderOpts: RenderOpts;
    parsedRequestHeaders: ParsedRequestHeaders;
};
export type GenerateFlight = typeof generateFlight;
export type AppRenderContext = AppRenderBaseContext & {
    getDynamicParamFromSegment: GetDynamicParamFromSegment;
    query: NextParsedUrlQuery;
    isPrefetch: boolean;
    requestTimestamp: number;
    appUsingSizeAdjustment: boolean;
    flightRouterState?: FlightRouterState;
    requestId: string;
    defaultRevalidate: Revalidate;
    pagePath: string;
    clientReferenceManifest: DeepReadonly<ClientReferenceManifest>;
    assetPrefix: string;
    flightDataRendererErrorHandler: ErrorHandler;
    serverComponentsErrorHandler: ErrorHandler;
    isNotFoundPath: boolean;
    nonce: string | undefined;
    res: BaseNextResponse;
};
interface ParsedRequestHeaders {
    /**
     * Router state provided from the client-side router. Used to handle rendering
     * from the common layout down. This value will be undefined if the request is
     * not a client-side navigation request, or if the request is a prefetch
     * request.
     */
    readonly flightRouterState: FlightRouterState | undefined;
    readonly isPrefetchRequest: boolean;
    readonly isHmrRefresh: boolean;
    readonly isRSCRequest: boolean;
    readonly nonce: string | undefined;
}
export type CreateSegmentPath = (child: FlightSegmentPath) => FlightSegmentPath;
declare function generateFlight(ctx: AppRenderContext, options?: {
    actionResult: ActionResult;
    skipFlight: boolean;
    asNotFound?: boolean;
}): Promise<RenderResult>;
export type BinaryStreamOf<T> = ReadableStream<Uint8Array>;
export type AppPageRender = (req: BaseNextRequest, res: BaseNextResponse, pagePath: string, query: NextParsedUrlQuery, renderOpts: RenderOpts, serverComponentsHmrCache?: ServerComponentsHmrCache) => Promise<RenderResult<AppPageRenderResultMetadata>>;
export declare const renderToHTMLOrFlight: AppPageRender;
export {};
