import { TextEncodingLabel, UndecodableTextError } from "byte-codec"; //#region src/svg/text.d.ts /** Thrown when an SVG document's own `` declaration names an encoding outside byte-codec's own bounded decodeText set: a legacy CJK or Cyrillic code page, or a name this package does not recognise as an alias of one of the six it does support (ExaDev/documents.js#1361). */ declare class SvgUnsupportedEncodingError extends Error { /** The declaration's own raw label, exactly as written in the document. */ readonly label: string; constructor(label: string); } /** Thrown when svg bytes cannot be decoded as text under the encoding that settled it: a byte order mark or an `` declaration named one the bytes then contradict, or, with neither present, the bytes are not well-formed UTF-8, XML's own default. */ declare class SvgUndecodableTextError extends Error { /** The encoding the bytes were decoded against and failed. */ readonly encoding: TextEncodingLabel; constructor(encoding: TextEncodingLabel, cause: UndecodableTextError); } /** * Decodes svg bytes to text, honouring the encoding a byte order mark or an `` declaration names and defaulting to strict UTF-8, XML's own default, when neither is present. * @param bytes - The svg bytes. * @throws SvgUnsupportedEncodingError When the declaration names an encoding outside byte-codec's own bounded set. * @throws SvgUndecodableTextError When the bytes contradict the encoding that settled them. * @returns The svg text. */ declare function decodeSvgText(bytes: Uint8Array): string; /** * Encodes svg text as UTF-8 bytes, with no `` declaration of its own. * @param text - The svg text. * @returns The UTF-8 bytes. A byte stream with no declaration and no byte order mark is UTF-8 under XML's own default, so {@link decodeSvgText} reads it back correctly without one. */ declare function encodeSvgText(text: string): Uint8Array; //#endregion export { SvgUndecodableTextError, SvgUnsupportedEncodingError, decodeSvgText, encodeSvgText };