/** * Returns a substring of an HTML string while preserving HTML structure. * * Core rules: * - Element nodes are re-serialized as tags (start/end) to keep structure. * - Text nodes are always HTML-escaped on output. This prevents that previously * escaped text (like "<div>") turns into real tags during the DOM round trip. * - Attribute values are HTML-escaped on output. * - Void elements are serialized without closing tags. * - For TWIGNORE/TW-IGNORE elements, the innerHTML is passed through so that * their content (including real HTML) remains untouched. * - On early cutoff (once the length limit is reached), already opened tags are * properly closed to keep the result valid HTML. * * Note on length counting: * - The length is based on the decoded textContent length (as the DOM provides), * not on byte length nor escaped entity length. This mirrors how the text is perceived. * * @param html The input HTML string; may contain a mix of real HTML and already escaped HTML. * @param length The maximum number of text characters (based on textContent) to include. * @returns A valid HTML string containing up to the specified number of text characters, * preserving HTML tags and keeping escaped text escaped. */ export declare const getSubTextFromHTML: (html: string, length: number) => string; export declare const getCharactersCount: (html: string) => number; export declare const shuffleArray: (array: T[]) => T[]; export declare const calculateAutoSpeed: (ema: number) => { speed: number; steps: number; }; interface CalculateEMAProps { currentEMA: number; newValue: number; alpha?: number; } export declare const calculateEMA: ({ currentEMA, newValue, alpha }: CalculateEMAProps) => number; export interface ChunkStreamingSpeedState { lastTimestamp?: number; lastLength: number; ema: number; } interface ChunkStreamingSpeedProps { currentLength: number; state: ChunkStreamingSpeedState; } export declare const updateChunkStreamingSpeedEMA: ({ currentLength, state, }: ChunkStreamingSpeedProps) => ChunkStreamingSpeedState; export {};