/**
 * @license
 * Copyright 2026 Steven Roussey <sroussey@gmail.com>
 * SPDX-License-Identifier: Apache-2.0
 */
/**
 * Maximum number of decoded pixels (width * height) accepted by the image raster codec.
 *
 * Caps worst-case RGBA allocation at ~400 MiB (100 MP * 4 bytes/pixel). Legitimate
 * photographic content rarely exceeds ~50 MP; synthetic pipelines that need more
 * should bypass the codec and operate on RawPixelBuffer directly.
 *
 * Defends against header-declared pixel bombs where a small compressed payload
 * claims billions of pixels to force a downstream OOM.
 */
export declare const MAX_DECODED_PIXELS = 100000000;
/**
 * Maximum raw (base64-decoded) byte size of an incoming data URI on the Node codec.
 *
 * This is a coarse pre-filter before format-specific decoding. The Node codec
 * additionally enforces {@link MAX_DECODED_PIXELS} via sharp's header-level
 * `limitInputPixels`, so 64 MiB is a comfortable ceiling on the server side.
 */
export declare const MAX_INPUT_BYTES_NODE: number;
/**
 * Maximum raw byte size of an incoming data URI on the browser codec.
 *
 * `createImageBitmap` eagerly decompresses before we can observe the bitmap's
 * dimensions, so bounding the compressed input is the primary defense — the
 * post-bitmap `assertWithinPixelBudget` check only avoids the subsequent
 * canvas + ImageData allocations.
 *
 * Sized to fit a worst-case 4K PNG (3840×2160 RGBA = ~32 MiB raw, which a
 * maximum-entropy lossless encode can approach byte-for-byte). Routine 4K
 * photos sit at 10–20 MiB. Anything larger than this is either an 8K image
 * or a malformed input and should be downscaled before upload.
 */
export declare const MAX_INPUT_BYTES_BROWSER: number;
/**
 * Mime types rejected at decode time because rasterization would silently lose
 * information (vector data, animation frames). Callers that need these formats
 * must convert to PNG/JPEG/WebP externally before invoking the codec.
 *
 * Known limitations:
 * - APNG declared as `image/png` cannot be distinguished by mime type alone;
 *   sharp will decode only the first frame. True APNG rejection requires
 *   post-decode metadata inspection (`pages > 1`).
 * - Animated WebP declared as `image/webp` has the same limitation.
 */
export declare const REJECTED_DECODE_MIME_TYPES: ReadonlySet<string>;
/** Output formats the codec is willing to produce. Everything else throws at encode. */
export declare const SUPPORTED_OUTPUT_MIME_TYPES: readonly ["image/jpeg", "image/png", "image/webp"];
export type SupportedOutputMimeType = (typeof SUPPORTED_OUTPUT_MIME_TYPES)[number];
/**
 * Throws if the decoded image would exceed {@link MAX_DECODED_PIXELS}, or if
 * the dimensions are non-finite or non-positive.
 */
export declare function assertWithinPixelBudget(width: number, height: number): void;
/** Throws if `byteLength` exceeds `limit`. */
export declare function assertWithinByteBudget(byteLength: number, limit: number): void;
/**
 * Throws unless `value` is a string that starts with `data:`. Defense in depth
 * at the codec boundary — prevents the browser codec's `fetch(value)` from ever
 * reaching the network (`http:`, `file:`, etc.) even if an upstream validator
 * is removed or bypassed.
 */
export declare function assertIsDataUri(value: string): void;
/**
 * Extracts the mime type from a data URI for pre-decode validation. Returns
 * the lowercased mime type, or `undefined` if not parseable.
 *
 * Intentionally looser than `parseDataUri` in `@workglow/util/media`: this lets
 * us report "unsupported svg+xml" before failing on an otherwise-malformed data
 * URI, so the caller gets the most actionable error.
 */
export declare function extractDataUriMimeType(dataUri: string): string | undefined;
/**
 * Normalizes and validates an output mime type. Throws for unsupported or
 * lossy types (e.g. `image/svg+xml`, `image/gif`) instead of silently falling
 * through to PNG. Replaces the per-file `normalizeMimeType` helpers that used
 * to mask format mismatches.
 */
export declare function normalizeOutputMimeType(mimeType: string): SupportedOutputMimeType;
//# sourceMappingURL=imageCodecLimits.d.ts.map