export type DiffResult = { /** * - The actual string content of the segment. */ value: string; /** * - The status of the segment relative to the comparison. */ type: "normal" | "added" | "deleted"; }; /** * Represents the result of a single text segment comparison. * @typedef {Object} DiffResult * @property {string} value - The actual string content of the segment. * @property {"normal"|"added"|"deleted"} type - The status of the segment relative to the comparison. */ /** * A utility class to store a history of text strings and compute the differences * between any two versions, generating a detailed diff output. */ declare class TinyTextDiffer { #private; get destroyed(): boolean; /** * Retrieves a shallow copy of the current history array. * @returns {string[]} */ get history(): string[]; /** * Overwrites the current history array, ensuring all elements are valid strings. * @param {string[]} history */ set history(history: string[]); /** * Gets the total number of versions currently stored in the history. * @returns {number} */ get size(): number; /** * Initializes a new instance of TinyTextDiffer. * @param {string[]} [history=[]] */ constructor(history?: string[]); /** * Retrieves the text string at the specified index. * @param {number} index * @returns {string} */ get(index: number): string; /** * Checks if a text string exists at the specified index. * @param {number} index * @returns {boolean} */ has(index: number): boolean; /** * Appends a new text string to the end of the history. * @param {string} text * @returns {void} */ add(text: string): void; /** * Removes and returns the last text string from the history. * @returns {string | undefined} */ remove(): string | undefined; /** * Inserts a text string at the specified index position. * @param {number} index * @param {string} text * @returns {void} */ addAt(index: number, text: string): void; /** * Removes the text string at the specified index position. * @param {number} index * @returns {boolean} */ removeAt(index: number): boolean; /** * Empties the entire history. * @returns {void} */ clear(): void; /** * Compares multiple pairs of text strings from the history based on their indices. * Each pair of indices (e.g., index1 and index2) will produce a DiffResult array. * @param {...number} indexes - An even number of indices to be compared in pairs. * @returns {(DiffResult[])[]} An array of DiffResult arrays for each compared pair. */ compare(...indexes: number[]): (DiffResult[])[]; /** * Computes the Longest Common Subsequence (LCS) to generate the diff result. * @private * @param {string} str1 * @param {string} str2 * @returns {DiffResult[]} */ private _computeDiff; /** * Cleans up internal references and marks the instance as destroyed to prevent memory leaks. * @returns {void} */ destroy(): void; } export default TinyTextDiffer; //# sourceMappingURL=TinyTextDiffer.d.mts.map