import type { HandleRscRenderFn } from "./types.js";
/**
 * Handles the rendering of React Server Component streams in the RSC worker thread.
 *
 * **Purpose**: Creates React Server Component streams using ReactDOMServer.renderToPipeableStream
 * and manages the stream lifecycle, error handling, and element reuse for performance optimization.
 *
 * **Key Features**:
 * - **Stream Creation**: Uses ReactDOMServer.renderToPipeableStream for RSC rendering
 * - **Error Handling**: Catches React rendering errors via onError callback and communicates to main thread
 * - **Stream Reuse**: Manages headless stream element reuse for performance optimization
 * - **Metrics Collection**: Tracks rendering performance and memory usage
 *
 * **Error Handling Strategy**:
 * - React rendering errors are caught by ReactDOMServer.onError callback
 * - Errors are sent to main thread via handlers.onError with context information
 * - Headless stream errors are tracked for conditional reuse logic
 * - Stream is properly ended even when errors occur
 *
 * **Stream Types**:
 * - **Headless Streams**: Page content only (no HTML wrapper) for .rsc files
 * - **Full Streams**: Complete HTML structure for HTML generation
 *
 * @param handlerOptions - Configuration options for RSC rendering
 * @param handlers - Event handlers for stream lifecycle management
 * @param rscStreamOverride - Optional override for RSC stream (for testing)
 * @param headlessStreamElements - Map for storing reusable headless stream elements
 * @param headlessStreamErrors - Map for tracking headless stream errors
 * @returns RSC stream result with metrics and lifecycle management
 */
export declare const handleRscRender: HandleRscRenderFn;
//# sourceMappingURL=handleRscRender.server.d.ts.map