import { EFVideo } from "../elements/EFVideo.js";

//#region src/preview/RenderContext.d.ts

/**
 * Result of capturing a video frame.
 */
interface CapturedFrame {
  dataUrl: string;
  width: number;
  height: number;
}
/**
 * Options for creating a RenderContext.
 */
interface RenderContextOptions {
  /** Maximum number of canvas dataURLs to cache (default: 50) */
  maxCanvasCacheSize?: number;
  /** Maximum number of video frame dataURLs to cache (default: 100) */
  maxVideoFrameCacheSize?: number;
}
/**
 * RenderContext provides scoped caching for render operations.
 *
 * Create at the start of a render, dispose when complete:
 * ```typescript
 * const context = new RenderContext();
 * try {
 *   // ... render operations
 * } finally {
 *   context.dispose();
 * }
 * ```
 */
declare class RenderContext {
  #private;
  constructor(options?: RenderContextOptions);
  /**
   * Check if the context has been disposed.
   */
  get disposed(): boolean;
  /**
   * Get cache metrics for monitoring.
   */
  get metrics(): {
    canvasCacheHits: number;
    canvasCacheMisses: number;
    videoFrameCacheHits: number;
    videoFrameCacheMisses: number;
  };
  /**
   * Get a cached dataURL for a static element.
   * Returns undefined if not cached or element doesn't support caching.
   */
  getCachedCanvasDataUrl(element: Element): string | undefined;
  /**
   * Cache a dataURL for a static element.
   * Does nothing if the element doesn't support caching.
   */
  setCachedCanvasDataUrl(element: Element, dataUrl: string): void;
  /**
   * Get a cached video frame.
   * Returns undefined if not cached.
   */
  getCachedVideoFrame(videoElement: Element, sourceTimeMs: number): CapturedFrame | undefined;
  /**
   * Cache a video frame.
   */
  setCachedVideoFrame(videoElement: Element, sourceTimeMs: number, frame: CapturedFrame): void;
  /**
   * Convenience method to get or capture a video frame.
   * Checks cache first, then captures if not cached.
   *
   * @param video - The ef-video element
   * @param sourceTimeMs - Source media timestamp
   * @param options - Capture options including quality and signal
   * @returns The captured frame data
   */
  getOrCaptureVideoFrame(video: EFVideo, sourceTimeMs: number, options?: {
    quality?: "auto" | "scrub" | "main";
    signal?: AbortSignal;
  }): Promise<CapturedFrame>;
  /**
   * Get cached document styles.
   * Returns undefined if not cached.
   */
  getCachedDocumentStyles(): string | undefined;
  /**
   * Cache document styles.
   */
  setCachedDocumentStyles(styles: string): void;
  /**
   * Dispose the context and clear all caches.
   * Should be called when rendering is complete.
   */
  dispose(): void;
  /**
   * Symbol.dispose implementation for use with the `using` keyword.
   *
   * @example
   * ```typescript
   * using context = new RenderContext();
   * // ... render operations
   * // context is automatically disposed when scope exits
   * ```
   */
  [Symbol.dispose](): void;
  /**
   * Get the current size of the canvas cache.
   */
  get canvasCacheSize(): number;
  /**
   * Get the current size of the video frame cache.
   */
  get videoFrameCacheSize(): number;
}
//#endregion
export { RenderContext };
//# sourceMappingURL=RenderContext.d.ts.map