import { DecodingMode, DecodingModeType, EntityDecoder, decodeHTML, decodeHTMLAttribute, decodeHTMLStrict, decodeXML } from "./decode-DoZoVGKY.js"; import { encodeXML, escape, escapeAttribute, escapeText, escapeUTF8 } from "./escape-8nwpUEVF.js"; //#region src/encode.d.ts /** * Encodes all characters in the input using HTML entities. This includes * characters that are valid ASCII characters in HTML documents, such as `#`. * * To get a more compact output, consider using the `encodeNonAsciiHTML` * function, which will only encode characters that are not valid in HTML * documents, as well as non-ASCII characters. * * If a character has no equivalent entity, a numeric hexadecimal reference * (eg. `ü`) will be used. */ declare function encodeHTML(input: string): string; /** * Encodes all non-ASCII characters, as well as characters not valid in HTML * documents using HTML entities. This function will not encode characters that * are valid in HTML documents, such as `#`. * * If a character has no equivalent entity, a numeric hexadecimal reference * (eg. `ü`) will be used. */ declare function encodeNonAsciiHTML(input: string): string; //#endregion //#region src/index.d.ts /** The level of entities to support. */ declare const EntityLevel: { /** Support only XML entities. */ readonly XML: 0; /** Support HTML entities, which are a superset of XML entities. */ readonly HTML: 1; }; type EntityLevelType = (typeof EntityLevel)[keyof typeof EntityLevel]; declare const EncodingMode: { /** * The output is UTF-8 encoded. Only characters that need escaping within * XML will be escaped. */ readonly UTF8: 0; /** * The output consists only of ASCII characters. Characters that need * escaping within HTML, and characters that aren't ASCII characters will * be escaped. */ readonly ASCII: 1; /** * Encode all characters that have an equivalent entity, as well as all * characters that are not ASCII characters. */ readonly Extensive: 2; /** * Encode all characters that have to be escaped in HTML attributes, * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}. */ readonly Attribute: 3; /** * Encode all characters that have to be escaped in HTML text, * following {@link https://html.spec.whatwg.org/multipage/parsing.html#escapingString}. */ readonly Text: 4; }; type EncodingModeType = (typeof EncodingMode)[keyof typeof EncodingMode]; interface DecodingOptions { /** * The level of entities to support. * @default {@link EntityLevel.XML} */ level?: EntityLevelType; /** * Decoding mode. If `Legacy`, will support legacy entities not terminated * with a semicolon (`;`). * * Always `Strict` for XML. For HTML, set this to `true` if you are parsing * an attribute value. * * The deprecated `decodeStrict` function defaults this to `Strict`. * * @default {@link DecodingMode.Legacy} */ mode?: DecodingModeType | undefined; } /** * Decodes a string with entities. * * @param input String to decode. * @param options Decoding options. */ declare function decode(input: string, options?: DecodingOptions | EntityLevelType): string; /** * Decodes a string with entities. Does not allow missing trailing semicolons for entities. * * @param input String to decode. * @param options Decoding options. * @deprecated Use `decode` with the `mode` set to `Strict`. */ declare function decodeStrict(input: string, options?: DecodingOptions | EntityLevelType): string; /** * Options for `encode`. */ interface EncodingOptions { /** * The level of entities to support. * @default {@link EntityLevel.XML} */ level?: EntityLevelType; /** * Output format. * @default {@link EncodingMode.Extensive} */ mode?: EncodingModeType; } /** * Encodes a string with entities. * * @param input String to encode. * @param options Encoding options. */ declare function encode(input: string, options?: EncodingOptions | EntityLevelType): string; //#endregion export { DecodingMode, DecodingOptions, EncodingMode, EncodingModeType, EncodingOptions, EntityDecoder, EntityLevel, EntityLevelType, decode, decodeHTML, decodeHTML as decodeHTML4, decodeHTMLStrict as decodeHTML4Strict, decodeHTML as decodeHTML5, decodeHTMLStrict as decodeHTML5Strict, decodeHTMLAttribute, decodeHTMLStrict, decodeStrict, decodeXML, decodeXML as decodeXMLStrict, encode, encodeHTML, encodeHTML as encodeHTML4, encodeHTML as encodeHTML5, encodeNonAsciiHTML, encodeXML, escape, escapeAttribute, escapeText, escapeUTF8 }; //# sourceMappingURL=index.d.ts.map