{"version":3,"file":"diff-match-patch-ts.cjs","sources":["../src/diff-op.enum.ts","../src/patch-operation.class.ts","../src/diff-match-patch.class.ts"],"sourcesContent":["export enum DiffOp {\n  Delete = -1,\n  Equal = 0,\n  Insert = 1\n}\n","/**\n * PatchOperation has been derived from patch_obj in diff-match-patch by Neil Fraser\n * and the TypeScript of diffMatchPatch.ts in ng-diff-match-patch by Elliot Forbes.\n * See LICENSE.md for licensing details.\n *\n * Changes have been made to correct tslint errors and use the Diff and DiffOp types\n * by Richard Russell.\n *\n * ----------------------------------------------------------------------------------------\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DiffOp } from './diff-op.enum';\nimport { Diff } from './diff.type';\n\nconst OP_SYMBOLS: Record<DiffOp, string> = {\n  [DiffOp.Insert]: '+',\n  [DiffOp.Delete]: '-',\n  [DiffOp.Equal]: ' ',\n};\n\nconst formatCoords = (start: number, length: number): string => {\n  if (length === 0) {\n    return start + ',0';\n  } else if (length === 1) {\n    return `${start + 1}`;\n  }\n\n  return `${start + 1},${length}`;\n};\n\n/**\n * Class representing one patch operation.\n * @constructor\n */\nexport class PatchOperation {\n  public diffs: Diff[] = [];\n  public length1: number = 0;\n  public length2: number = 0;\n\n  public constructor(\n    public start1: number,\n    public start2: number,\n  ) {}\n\n  public clone(): PatchOperation {\n    const patchCopy = new PatchOperation(this.start1, this.start2);\n\n    patchCopy.diffs = this.diffs.map((diff) => [...diff] as Diff);\n\n    patchCopy.length1 = this.length1;\n    patchCopy.length2 = this.length2;\n\n    return patchCopy;\n  }\n\n  /**\n   * Emmulate GNU diff's format.\n   * Header: @@ -382,8 +481,9 @@\n   * Indicies are printed as 1-based, not 0-based.\n   */\n  public toString(): string {\n    const coords1 = formatCoords(this.start1, this.length1);\n    const coords2 = formatCoords(this.start2, this.length2);\n\n    const text = [`@@ -${coords1} +${coords2} @@\\n`];\n\n    // Escape the body of the patch with %xx notation.\n    for (const diff of this.diffs) {\n      const op = OP_SYMBOLS[diff[0]];\n      text.push(op + encodeURI(diff[1]) + '\\n');\n    }\n\n    return text.join('').replace(/%20/g, ' ');\n  }\n}\n","/**\n * DiffMatchPatch has been derived from diff_match_patch in diff-match-patch by Neil Fraser\n * and the TypeScript of diffMatchPatch.ts in ng-diff-match-patch by Elliot Forbes.\n * See LICENSE.md for licensing details.\n *\n * Changes have been made to correct tslint errors and use the Diff and DiffOp types\n * by Richard Russell.\n *\n * ----------------------------------------------------------------------------------------\n * Diff Match and Patch\n *\n * Copyright 2006 Google Inc.\n * http://code.google.com/p/google-diff-match-patch/\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DiffOp } from './diff-op.enum';\nimport { Diff } from './diff.type';\nimport { PatchOperation } from './patch-operation.class';\n\ntype HalfMatchResult = [string, string, string, string, string];\n\n/**\n * Class containing the diff, match and patch methods.\n * @constructor\n */\nexport class DiffMatchPatch {\n  // Defaults.\n  // Redefine these in your program to override the defaults.\n\n  // Number of seconds to map a diff before giving up (0 for infinity).\n  public Diff_Timeout = 1.0;\n  // Cost of an empty edit operation in terms of edit characters.\n  public Diff_EditCost = 4;\n  // At what point is no match declared (0.0 = perfection, 1.0 = very loose).\n  public Match_Threshold = 0.5;\n  // How far to search for a match (0 = exact location, 1000+ = broad match).\n  // A match this many characters away from the expected location will add\n  // 1.0 to the score (0.0 is a perfect match).\n  public Match_Distance = 1000;\n  // When deleting a large block of text (over ~64 characters), how close do\n  // the contents have to be to match the expected contents. (0.0 = perfection,\n  // 1.0 = very loose).  Note that Match_Threshold controls how closely the\n  // end points of a delete need to match.\n  public Patch_DeleteThreshold = 0.5;\n  // Chunk size for context length.\n  public Patch_Margin = 4;\n\n  // The number of bits in an int.\n  public Match_MaxBits = 32;\n  /**\n   * The data structure representing a diff is an array of tuples:\n   * [[DiffOp.Delete, 'Hello'], [DiffOp.Insert, 'Goodbye'], [DiffOp.Equal, ' world.']]\n   * which means: delete 'Hello', add 'Goodbye' and keep ' world.'\n   */\n\n  // Define some regex patterns for matching boundaries.\n  private readonly whitespaceRegex = /\\s/;\n  private readonly linebreakRegex = /\\r\\n/;\n  private readonly blanklineEndRegex = /\\n\\r?\\n$/;\n  private readonly blanklineStartRegex = /^\\r?\\n\\r?\\n/;\n\n  /**\n   * Find the differences between two texts.  Simplifies the problem by stripping\n   * any common prefix or suffix off the texts before diffing.\n   * @param {string} text1 Old string to be diffed.\n   * @param {string} text2 New string to be diffed.\n   * @param {boolean=} opt_checklines Optional speedup flag. If present and false,\n   *     then don't run a line-level diff first to identify the changed areas.\n   *     Defaults to true, which does a faster, slightly less optimal diff.\n   * @param {number} opt_deadline Optional time when the diff should be complete\n   *     by.  Used internally for recursive calls.  Users should set DiffTimeout\n   *     instead.\n   * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n   */\n  public diff_main(\n    text1: string,\n    text2: string,\n    opt_checklines?: boolean,\n    opt_deadline?: number,\n  ): Diff[] {\n    // Set a deadline by which time the diff must be complete.\n    if (typeof opt_deadline === 'undefined') {\n      if (this.Diff_Timeout <= 0) {\n        opt_deadline = Number.MAX_VALUE;\n      } else {\n        opt_deadline = new Date().getTime() + this.Diff_Timeout * 1000;\n      }\n    }\n    const deadline = opt_deadline;\n\n    // Check for null inputs.\n    if (text1 == null || text2 == null) {\n      throw new Error('Null input. (diff_main)');\n    }\n\n    // Check for equality (speedup).\n    if (text1 === text2) {\n      if (text1) {\n        return [[DiffOp.Equal, text1]];\n      }\n      return [];\n    }\n\n    if (typeof opt_checklines === 'undefined') {\n      opt_checklines = true;\n    }\n    const checklines = opt_checklines;\n\n    // Trim off common prefix (speedup).\n    let commonlength = this.diff_commonPrefix(text1, text2);\n    const commonprefix = text1.substring(0, commonlength);\n    text1 = text1.substring(commonlength);\n    text2 = text2.substring(commonlength);\n\n    // Trim off common suffix (speedup).\n    commonlength = this.diff_commonSuffix(text1, text2);\n    const commonsuffix = text1.substring(text1.length - commonlength);\n    text1 = text1.substring(0, text1.length - commonlength);\n    text2 = text2.substring(0, text2.length - commonlength);\n\n    // Compute the diff on the middle block.\n    const diffs = this.diff_compute_(text1, text2, checklines, deadline);\n\n    // Restore the prefix and suffix.\n    if (commonprefix) {\n      diffs.unshift([DiffOp.Equal, commonprefix]);\n    }\n    if (commonsuffix) {\n      diffs.push([DiffOp.Equal, commonsuffix]);\n    }\n    this.diff_cleanupMerge(diffs);\n    return diffs;\n  }\n\n  /**\n   * Reduce the number of edits by eliminating semantically trivial equalities.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   */\n  public diff_cleanupSemantic(diffs: Diff[]): void {\n    let changes = false;\n    const equalities = []; // Stack of indices where equalities are found.\n    let equalitiesLength = 0; // Keeping our own length const is faster in JS.\n    /** @type {?string} */\n    let lastequality = null;\n    // Always equal to diffs[equalities[equalitiesLength - 1]][1]\n    let pointer = 0; // Index of current position.\n    // Number of characters that changed prior to the equality.\n    let length_insertions1 = 0;\n    let length_deletions1 = 0;\n    // Number of characters that changed after the equality.\n    let length_insertions2 = 0;\n    let length_deletions2 = 0;\n    while (pointer < diffs.length) {\n      if (diffs[pointer][0] === DiffOp.Equal) {\n        // Equality found.\n        equalities[equalitiesLength++] = pointer;\n        length_insertions1 = length_insertions2;\n        length_deletions1 = length_deletions2;\n        length_insertions2 = 0;\n        length_deletions2 = 0;\n        lastequality = diffs[pointer][1];\n      } else {\n        // An insertion or deletion.\n        if (diffs[pointer][0] === DiffOp.Insert) {\n          length_insertions2 += diffs[pointer][1].length;\n        } else {\n          length_deletions2 += diffs[pointer][1].length;\n        }\n        // Eliminate an equality that is smaller or equal to the edits on both\n        // sides of it.\n        if (\n          lastequality &&\n          lastequality.length <=\n            Math.max(length_insertions1, length_deletions1) &&\n          lastequality.length <= Math.max(length_insertions2, length_deletions2)\n        ) {\n          // Duplicate record.\n          diffs.splice(equalities[equalitiesLength - 1], 0, [\n            DiffOp.Delete,\n            lastequality,\n          ]);\n          // Change second copy to insert.\n          diffs[equalities[equalitiesLength - 1] + 1][0] = DiffOp.Insert;\n          // Throw away the equality we just deleted.\n          equalitiesLength--;\n          // Throw away the previous equality (it needs to be reevaluated).\n          equalitiesLength--;\n          pointer =\n            equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;\n          length_insertions1 = 0; // Reset the counters.\n          length_deletions1 = 0;\n          length_insertions2 = 0;\n          length_deletions2 = 0;\n          lastequality = null;\n          changes = true;\n        }\n      }\n      pointer++;\n    }\n\n    // Normalize the diff.\n    if (changes) {\n      this.diff_cleanupMerge(diffs);\n    }\n    this.diff_cleanupSemanticLossless(diffs);\n\n    // Find any overlaps between deletions and insertions.\n    // e.g: <del>abcxxx</del><ins>xxxdef</ins>\n    //   -> <del>abc</del>xxx<ins>def</ins>\n    // e.g: <del>xxxabc</del><ins>defxxx</ins>\n    //   -> <ins>def</ins>xxx<del>abc</del>\n    // Only extract an overlap if it is as big as the edit ahead or behind it.\n    pointer = 1;\n    while (pointer < diffs.length) {\n      if (\n        diffs[pointer - 1][0] === DiffOp.Delete &&\n        diffs[pointer][0] === DiffOp.Insert\n      ) {\n        const deletion = diffs[pointer - 1][1];\n        const insertion = diffs[pointer][1];\n        const overlap_length1 = this.diff_commonOverlap_(deletion, insertion);\n        const overlap_length2 = this.diff_commonOverlap_(insertion, deletion);\n        if (overlap_length1 >= overlap_length2) {\n          if (\n            overlap_length1 >= deletion.length / 2 ||\n            overlap_length1 >= insertion.length / 2\n          ) {\n            // Overlap found.  Insert an equality and trim the surrounding edits.\n            diffs.splice(pointer, 0, [\n              DiffOp.Equal,\n              insertion.substring(0, overlap_length1),\n            ]);\n            diffs[pointer - 1][1] = deletion.substring(\n              0,\n              deletion.length - overlap_length1,\n            );\n            diffs[pointer + 1][1] = insertion.substring(overlap_length1);\n            pointer++;\n          }\n        } else {\n          if (\n            overlap_length2 >= deletion.length / 2 ||\n            overlap_length2 >= insertion.length / 2\n          ) {\n            // Reverse overlap found.\n            // Insert an equality and swap and trim the surrounding edits.\n            diffs.splice(pointer, 0, [\n              DiffOp.Equal,\n              deletion.substring(0, overlap_length2),\n            ]);\n            diffs[pointer - 1][0] = DiffOp.Insert;\n            diffs[pointer - 1][1] = insertion.substring(\n              0,\n              insertion.length - overlap_length2,\n            );\n            diffs[pointer + 1][0] = DiffOp.Delete;\n            diffs[pointer + 1][1] = deletion.substring(overlap_length2);\n            pointer++;\n          }\n        }\n        pointer++;\n      }\n      pointer++;\n    }\n  }\n\n  /**\n   * Reduce the number of edits by eliminating operationally trivial equalities.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   */\n  public diff_cleanupEfficiency(diffs: Diff[]): void {\n    let changes = false;\n    const equalities = []; // Stack of indices where equalities are found.\n    let equalitiesLength = 0; // Keeping our own length const is faster in JS.\n    /** @type {?string} */\n    let lastequality = null;\n    // Always equal to diffs[equalities[equalitiesLength - 1]][1]\n    let pointer = 0; // Index of current position.\n    // Is there an insertion operation before the last equality.\n    let pre_ins = false;\n    // Is there a deletion operation before the last equality.\n    let pre_del = false;\n    // Is there an insertion operation after the last equality.\n    let post_ins = false;\n    // Is there a deletion operation after the last equality.\n    let post_del = false;\n    while (pointer < diffs.length) {\n      if (diffs[pointer][0] === DiffOp.Equal) {\n        // Equality found.\n        if (\n          diffs[pointer][1].length < this.Diff_EditCost &&\n          (post_ins || post_del)\n        ) {\n          // Candidate found.\n          equalities[equalitiesLength++] = pointer;\n          pre_ins = post_ins;\n          pre_del = post_del;\n          lastequality = diffs[pointer][1];\n        } else {\n          // Not a candidate, and can never become one.\n          equalitiesLength = 0;\n          lastequality = null;\n        }\n        post_ins = post_del = false;\n      } else {\n        // An insertion or deletion.\n        if (diffs[pointer][0] === DiffOp.Delete) {\n          post_del = true;\n        } else {\n          post_ins = true;\n        }\n        /*\n         * Five types to be split:\n         * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del>\n         * <ins>A</ins>X<ins>C</ins><del>D</del>\n         * <ins>A</ins><del>B</del>X<ins>C</ins>\n         * <ins>A</del>X<ins>C</ins><del>D</del>\n         * <ins>A</ins><del>B</del>X<del>C</del>\n         */\n        if (\n          lastequality &&\n          ((pre_ins && pre_del && post_ins && post_del) ||\n            (lastequality.length < this.Diff_EditCost / 2 &&\n              (pre_ins ? 1 : 0) +\n                (pre_del ? 1 : 0) +\n                (post_ins ? 1 : 0) +\n                (post_del ? 1 : 0) ===\n                3))\n        ) {\n          // Duplicate record.\n          diffs.splice(equalities[equalitiesLength - 1], 0, [\n            DiffOp.Delete,\n            lastequality,\n          ]);\n          // Change second copy to insert.\n          diffs[equalities[equalitiesLength - 1] + 1][0] = DiffOp.Insert;\n          equalitiesLength--; // Throw away the equality we just deleted;\n          lastequality = null;\n          if (pre_ins && pre_del) {\n            // No changes made which could affect previous entry, keep going.\n            post_ins = post_del = true;\n            equalitiesLength = 0;\n          } else {\n            equalitiesLength--; // Throw away the previous equality.\n            pointer =\n              equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1;\n            post_ins = post_del = false;\n          }\n          changes = true;\n        }\n      }\n      pointer++;\n    }\n\n    if (changes) {\n      this.diff_cleanupMerge(diffs);\n    }\n  }\n\n  /**\n   * Convert a diff array into a pretty HTML report.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   * @return {string} HTML representation.\n   */\n  public diff_prettyHtml(diffs: Diff[]): string {\n    const html = [];\n    const pattern_amp = /&/g;\n    const pattern_lt = /</g;\n    const pattern_gt = />/g;\n    const pattern_para = /\\n/g;\n    for (let x = 0; x < diffs.length; x++) {\n      const op = diffs[x][0]; // Operation (insert, delete, equal)\n      const data = diffs[x][1]; // Text of change.\n      const text = data\n        .replace(pattern_amp, '&amp;')\n        .replace(pattern_lt, '&lt;')\n        .replace(pattern_gt, '&gt;')\n        .replace(pattern_para, '&para;<br>');\n      switch (op) {\n        case DiffOp.Insert:\n          html[x] = '<ins style=\"background:#e6ffe6;\">' + text + '</ins>';\n          break;\n        case DiffOp.Delete:\n          html[x] = '<del style=\"background:#ffe6e6;\">' + text + '</del>';\n          break;\n        case DiffOp.Equal:\n          html[x] = '<span>' + text + '</span>';\n          break;\n      }\n    }\n    return html.join('');\n  }\n\n  /**\n   * Compute the Levenshtein distance; the number of inserted, deleted or\n   * substituted characters.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   * @return {number} Number of changes.\n   */\n  public diff_levenshtein(diffs: Diff[]): number {\n    let levenshtein = 0;\n    let insertions = 0;\n    let deletions = 0;\n    for (const diff of diffs) {\n      const op = diff[0];\n      const data = diff[1];\n      switch (op) {\n        case DiffOp.Insert:\n          insertions += data.length;\n          break;\n        case DiffOp.Delete:\n          deletions += data.length;\n          break;\n        case DiffOp.Equal:\n          // A deletion and an insertion is one substitution.\n          levenshtein += Math.max(insertions, deletions);\n          insertions = 0;\n          deletions = 0;\n          break;\n      }\n    }\n    levenshtein += Math.max(insertions, deletions);\n    return levenshtein;\n  }\n\n  /**\n   * Compute a list of patches to turn text1 into text2.\n   * Use diffs if provided, otherwise compute it ourselves.\n   * There are four ways to call this function, depending on what data is\n   * available to the caller:\n   * Method 1:\n   * a = text1, b = text2\n   * Method 2:\n   * a = diffs\n   * Method 3 (optimal):\n   * a = text1, b = diffs\n   * Method 4 (deprecated, use method 3):\n   * a = text1, b = text2, c = diffs\n   *\n   * @param {string|!Array.<!diff_match_patch.Diff>} a text1 (methods 1,3,4) or\n   * Array of diff tuples for text1 to text2 (method 2).\n   * @param {string|!Array.<!diff_match_patch.Diff>} opt_b text2 (methods 1,4) or\n   * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2).\n   * @param {string|!Array.<!diff_match_patch.Diff>} opt_c Array of diff tuples\n   * for text1 to text2 (method 4) or undefined (methods 1,2,3).\n   * @return {!Array.<!diff_match_patch.PatchOperation>} Array of Patch objects.\n   */\n  public patch_make(\n    a: string | Diff[],\n    opt_b?: string | Diff[],\n    opt_c?: string | Diff[],\n  ): PatchOperation[] {\n    let text1;\n    let diffs;\n    if (\n      typeof a === 'string' &&\n      typeof opt_b === 'string' &&\n      typeof opt_c === 'undefined'\n    ) {\n      // Method 1: text1, text2\n      // Compute diffs from text1 and text2.\n      text1 = /** @type {string} */ a;\n      diffs = this.diff_main(text1, /** @type {string} */ opt_b, true);\n      if (diffs.length > 2) {\n        this.diff_cleanupSemantic(diffs);\n        this.diff_cleanupEfficiency(diffs);\n      }\n    } else if (\n      a &&\n      typeof a === 'object' &&\n      typeof opt_b === 'undefined' &&\n      typeof opt_c === 'undefined'\n    ) {\n      // Method 2: diffs\n      // Compute text1 from diffs.\n      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */ a;\n      text1 = this.diff_text1(diffs);\n    } else if (\n      typeof a === 'string' &&\n      opt_b &&\n      typeof opt_b === 'object' &&\n      typeof opt_c === 'undefined'\n    ) {\n      // Method 3: text1, diffs\n      text1 = /** @type {string} */ a;\n      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */ opt_b;\n    } else if (\n      typeof a === 'string' &&\n      typeof opt_b === 'string' &&\n      opt_c &&\n      typeof opt_c === 'object'\n    ) {\n      // Method 4: text1, text2, diffs\n      // text2 is not used.\n      text1 = /** @type {string} */ a;\n      diffs = /** @type {!Array.<!diff_match_patch.Diff>} */ opt_c;\n    } else {\n      throw new Error('Unknown call format to patch_make.');\n    }\n\n    if (diffs.length === 0) {\n      return []; // Get rid of the null case.\n    }\n    const patches = [];\n    let patch = new PatchOperation(0, 0);\n    let patchDiffLength = 0; // Keeping our own length const is faster in JS.\n    let char_count1 = 0; // Number of characters into the text1 string.\n    let char_count2 = 0; // Number of characters into the text2 string.\n    // Start with text1 (prepatch_text) and apply the diffs until we arrive at\n    // text2 (postpatch_text).  We recreate the patches one by one to determine\n    // context info.\n    let prepatch_text = text1;\n    let postpatch_text = text1;\n    for (let x = 0; x < diffs.length; x++) {\n      const diff_type = diffs[x][0];\n      const diff_text = diffs[x][1];\n\n      if (!patchDiffLength && diff_type !== DiffOp.Equal) {\n        // A new patch starts here.\n        patch.start1 = char_count1;\n        patch.start2 = char_count2;\n      }\n\n      switch (diff_type) {\n        case DiffOp.Insert:\n          patch.diffs[patchDiffLength++] = diffs[x];\n          patch.length2 += diff_text.length;\n          postpatch_text =\n            postpatch_text.substring(0, char_count2) +\n            diff_text +\n            postpatch_text.substring(char_count2);\n          break;\n        case DiffOp.Delete:\n          patch.length1 += diff_text.length;\n          patch.diffs[patchDiffLength++] = diffs[x];\n          postpatch_text =\n            postpatch_text.substring(0, char_count2) +\n            postpatch_text.substring(char_count2 + diff_text.length);\n          break;\n        case DiffOp.Equal:\n          if (\n            diff_text.length <= 2 * this.Patch_Margin &&\n            patchDiffLength &&\n            diffs.length !== x + 1\n          ) {\n            // Small equality inside a patch.\n            patch.diffs[patchDiffLength++] = diffs[x];\n            patch.length1 += diff_text.length;\n            patch.length2 += diff_text.length;\n          } else if (diff_text.length >= 2 * this.Patch_Margin) {\n            // Time for a new patch.\n            if (patchDiffLength) {\n              this.patch_addContext_(patch, prepatch_text);\n              patches.push(patch);\n              patch = new PatchOperation(0, 0);\n              patchDiffLength = 0;\n              // Unlike Unidiff, our patch lists have a rolling context.\n              // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff\n              // Update prepatch text & pos to reflect the application of the\n              // just completed patch.\n              prepatch_text = postpatch_text;\n              char_count1 = char_count2;\n            }\n          }\n          break;\n      }\n\n      // Update the current character count.\n      if (diff_type !== DiffOp.Insert) {\n        char_count1 += diff_text.length;\n      }\n      if (diff_type !== DiffOp.Delete) {\n        char_count2 += diff_text.length;\n      }\n    }\n    // Pick up the leftover patch if not empty.\n    if (patchDiffLength) {\n      this.patch_addContext_(patch, prepatch_text);\n      patches.push(patch);\n    }\n\n    return patches;\n  }\n\n  /**\n   * Merge a set of patches onto the text.  Return a patched text, as well\n   * as a list of true/false values indicating which patches were applied.\n   * @param {!Array.<!diff_match_patch.PatchOperation>} patches Array of Patch objects.\n   * @param {string} text Old text.\n   * @return {!Array.<string|!Array.<boolean>>} Two element Array, containing the\n   *      new text and an array of boolean values.\n   */\n  public patch_apply(\n    patches: PatchOperation[],\n    text: string,\n  ): [string, boolean[]] {\n    if (patches.length === 0) {\n      return [text, []];\n    }\n\n    // Deep copy the patches so that no changes are made to originals.\n    patches = this.patch_deepCopy(patches);\n\n    const nullPadding = this.patch_addPadding(patches);\n    text = nullPadding + text + nullPadding;\n\n    this.patch_splitMax(patches);\n    // delta keeps track of the offset between the expected and actual location\n    // of the previous patch.  If there are patches expected at positions 10 and\n    // 20, but the first patch was found at 12, delta is 2 and the second patch\n    // has an effective expected position of 22.\n    let delta = 0;\n    const results = [];\n    for (let x = 0; x < patches.length; x++) {\n      const expected_loc = patches[x].start2 + delta;\n      const text1 = this.diff_text1(patches[x].diffs);\n      let start_loc;\n      let end_loc = -1;\n      if (text1.length > this.Match_MaxBits) {\n        // patch_splitMax will only provide an oversized pattern in the case of\n        // a monster delete.\n        start_loc = this.match_main(\n          text,\n          text1.substring(0, this.Match_MaxBits),\n          expected_loc,\n        );\n        if (start_loc !== -1) {\n          end_loc = this.match_main(\n            text,\n            text1.substring(text1.length - this.Match_MaxBits),\n            expected_loc + text1.length - this.Match_MaxBits,\n          );\n          if (end_loc === -1 || start_loc >= end_loc) {\n            // Can't find valid trailing context.  Drop this patch.\n            start_loc = -1;\n          }\n        }\n      } else {\n        start_loc = this.match_main(text, text1, expected_loc);\n      }\n      if (start_loc === -1) {\n        // No match found.  :(\n        results[x] = false;\n        // Subtract the delta for this failed patch from subsequent patches.\n        delta -= patches[x].length2 - patches[x].length1;\n      } else {\n        // Found a match.  :)\n        results[x] = true;\n        delta = start_loc - expected_loc;\n        let text2;\n        if (end_loc === -1) {\n          text2 = text.substring(start_loc, start_loc + text1.length);\n        } else {\n          text2 = text.substring(start_loc, end_loc + this.Match_MaxBits);\n        }\n        if (text1 === text2) {\n          // Perfect match, just shove the replacement text in.\n          text =\n            text.substring(0, start_loc) +\n            this.diff_text2(patches[x].diffs) +\n            text.substring(start_loc + text1.length);\n        } else {\n          // Imperfect match.  Run a diff to get a framework of equivalent\n          // indices.\n          const diffs = this.diff_main(text1, text2, false);\n          if (\n            text1.length > this.Match_MaxBits &&\n            this.diff_levenshtein(diffs) / text1.length >\n              this.Patch_DeleteThreshold\n          ) {\n            // The end points match, but the content is unacceptably bad.\n            results[x] = false;\n          } else {\n            this.diff_cleanupSemanticLossless(diffs);\n            let index1 = 0;\n            let index2;\n            for (const diff of patches[x].diffs) {\n              if (diff[0] !== DiffOp.Equal) {\n                index2 = this.diff_xIndex(diffs, index1);\n\n                if (diff[0] === DiffOp.Insert) {\n                  // Insertion\n                  text =\n                    text.substring(0, start_loc + index2) +\n                    diff[1] +\n                    text.substring(start_loc + index2);\n                } else if (diff[0] === DiffOp.Delete) {\n                  // Deletion\n                  text =\n                    text.substring(0, start_loc + index2) +\n                    text.substring(\n                      start_loc +\n                        this.diff_xIndex(diffs, index1 + diff[1].length),\n                    );\n                }\n              }\n              if (diff[0] !== DiffOp.Delete) {\n                index1 += diff[1].length;\n              }\n            }\n          }\n        }\n      }\n    }\n    // Strip the padding off.\n    text = text.substring(nullPadding.length, text.length - nullPadding.length);\n    return [text, results];\n  }\n\n  /**\n   * Take a list of patches and return a textual representation.\n   * @param {!Array.<!diff_match_patch.PatchOperation>} patches Array of Patch objects.\n   * @return {string} Text representation of patches.\n   */\n  public patch_toText(patches: PatchOperation[]): string {\n    const text = [];\n    for (let x = 0; x < patches.length; x++) {\n      text[x] = patches[x];\n    }\n    return text.join('');\n  }\n\n  /**\n   * Parse a textual representation of patches and return a list of Patch objects.\n   * @param {string} textline Text representation of patches.\n   * @return {!Array.<!diff_match_patch.PatchOperation>} Array of Patch objects.\n   * @throws {!Error} If invalid input.\n   */\n  public patch_fromText(textline: string): PatchOperation[] {\n    const patches: PatchOperation[] = [];\n    if (!textline) {\n      return patches;\n    }\n    const text = textline.split('\\n');\n    let textPointer = 0;\n    const patchHeader = /^@@ -(\\d+),?(\\d*) \\+(\\d+),?(\\d*) @@$/;\n    while (textPointer < text.length) {\n      const m = text[textPointer].match(patchHeader);\n      if (!m) {\n        throw new Error('Invalid patch string: ' + text[textPointer]);\n      }\n      const patch = new PatchOperation(parseInt(m[1], 10), parseInt(m[3], 10));\n      patches.push(patch);\n      if (m[2] === '') {\n        patch.start1--;\n        patch.length1 = 1;\n      } else if (m[2] === '0') {\n        patch.length1 = 0;\n      } else {\n        patch.start1--;\n        patch.length1 = parseInt(m[2], 10);\n      }\n\n      if (m[4] === '') {\n        patch.start2--;\n        patch.length2 = 1;\n      } else if (m[4] === '0') {\n        patch.length2 = 0;\n      } else {\n        patch.start2--;\n        patch.length2 = parseInt(m[4], 10);\n      }\n      textPointer++;\n\n      while (textPointer < text.length) {\n        const sign = text[textPointer].charAt(0);\n        let line: string | undefined;\n        try {\n          line = decodeURI(text[textPointer].substring(1));\n        } catch (ex) {\n          // Malformed URI sequence.\n          throw new Error('Illegal escape in patch_fromText: ' + line, {\n            cause: ex,\n          });\n        }\n        if (sign === '-') {\n          // Deletion.\n          patch.diffs.push([DiffOp.Delete, line]);\n        } else if (sign === '+') {\n          // Insertion.\n          patch.diffs.push([DiffOp.Insert, line]);\n        } else if (sign === ' ') {\n          // Minor equality.\n          patch.diffs.push([DiffOp.Equal, line]);\n        } else if (sign === '@') {\n          // Start of next patch.\n          break;\n        } else if (sign === '') {\n          // Blank line?  Whatever.\n        } else {\n          // WTF?\n          throw new Error('Invalid patch mode \"' + sign + '\" in: ' + line);\n        }\n        textPointer++;\n      }\n    }\n    return patches;\n  }\n\n  /**\n   * Determine the common prefix of two strings.\n   * @param {string} text1 First string.\n   * @param {string} text2 Second string.\n   * @return {number} The number of characters common to the start of each\n   *     string.\n   */\n  public diff_commonPrefix(text1: string, text2: string): number {\n    // Quick check for common null cases.\n    if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) {\n      return 0;\n    }\n    // Binary search.\n    // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n    let pointermin = 0;\n    let pointermax = Math.min(text1.length, text2.length);\n    let pointermid = pointermax;\n    let pointerstart = 0;\n    while (pointermin < pointermid) {\n      if (\n        text1.substring(pointerstart, pointermid) ===\n        text2.substring(pointerstart, pointermid)\n      ) {\n        pointermin = pointermid;\n        pointerstart = pointermin;\n      } else {\n        pointermax = pointermid;\n      }\n      pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n    }\n    return pointermid;\n  }\n\n  /**\n   * Determine the common suffix of two strings.\n   * @param {string} text1 First string.\n   * @param {string} text2 Second string.\n   * @return {number} The number of characters common to the end of each string.\n   */\n  public diff_commonSuffix(text1: string, text2: string): number {\n    // Quick check for common null cases.\n    if (\n      !text1 ||\n      !text2 ||\n      text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)\n    ) {\n      return 0;\n    }\n    // Binary search.\n    // Performance analysis: http://neil.fraser.name/news/2007/10/09/\n    let pointermin = 0;\n    let pointermax = Math.min(text1.length, text2.length);\n    let pointermid = pointermax;\n    let pointerend = 0;\n    while (pointermin < pointermid) {\n      if (\n        text1.substring(\n          text1.length - pointermid,\n          text1.length - pointerend,\n        ) ===\n        text2.substring(text2.length - pointermid, text2.length - pointerend)\n      ) {\n        pointermin = pointermid;\n        pointerend = pointermin;\n      } else {\n        pointermax = pointermid;\n      }\n      pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);\n    }\n    return pointermid;\n  }\n\n  /**\n   * Reorder and merge like edit sections.  Merge equalities.\n   * Any edit section can move as long as it doesn't cross an equality.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   */\n  public diff_cleanupMerge(diffs: Diff[]): void {\n    diffs.push([DiffOp.Equal, '']); // Add a dummy entry at the end.\n    let pointer = 0;\n    let count_delete = 0;\n    let count_insert = 0;\n    let text_delete = '';\n    let text_insert = '';\n    let commonlength;\n    while (pointer < diffs.length) {\n      switch (diffs[pointer][0]) {\n        case DiffOp.Insert:\n          count_insert++;\n          text_insert += diffs[pointer][1];\n          pointer++;\n          break;\n        case DiffOp.Delete:\n          count_delete++;\n          text_delete += diffs[pointer][1];\n          pointer++;\n          break;\n        case DiffOp.Equal:\n          // Upon reaching an equality, check for prior redundancies.\n          if (count_delete + count_insert > 1) {\n            if (count_delete !== 0 && count_insert !== 0) {\n              // Factor out any common prefixies.\n              commonlength = this.diff_commonPrefix(text_insert, text_delete);\n              if (commonlength !== 0) {\n                if (\n                  pointer - count_delete - count_insert > 0 &&\n                  diffs[pointer - count_delete - count_insert - 1][0] ===\n                    DiffOp.Equal\n                ) {\n                  diffs[pointer - count_delete - count_insert - 1][1] +=\n                    text_insert.substring(0, commonlength);\n                } else {\n                  diffs.splice(0, 0, [\n                    DiffOp.Equal,\n                    text_insert.substring(0, commonlength),\n                  ]);\n                  pointer++;\n                }\n                text_insert = text_insert.substring(commonlength);\n                text_delete = text_delete.substring(commonlength);\n              }\n              // Factor out any common suffixies.\n              commonlength = this.diff_commonSuffix(text_insert, text_delete);\n              if (commonlength !== 0) {\n                diffs[pointer][1] =\n                  text_insert.substring(text_insert.length - commonlength) +\n                  diffs[pointer][1];\n                text_insert = text_insert.substring(\n                  0,\n                  text_insert.length - commonlength,\n                );\n                text_delete = text_delete.substring(\n                  0,\n                  text_delete.length - commonlength,\n                );\n              }\n            }\n            // Delete the offending records and add the merged ones.\n            if (count_delete === 0) {\n              diffs.splice(\n                pointer - count_insert,\n                count_delete + count_insert,\n                [DiffOp.Insert, text_insert],\n              );\n            } else if (count_insert === 0) {\n              diffs.splice(\n                pointer - count_delete,\n                count_delete + count_insert,\n                [DiffOp.Delete, text_delete],\n              );\n            } else {\n              diffs.splice(\n                pointer - count_delete - count_insert,\n                count_delete + count_insert,\n                [DiffOp.Delete, text_delete],\n                [DiffOp.Insert, text_insert],\n              );\n            }\n            pointer =\n              pointer -\n              count_delete -\n              count_insert +\n              (count_delete ? 1 : 0) +\n              (count_insert ? 1 : 0) +\n              1;\n          } else if (pointer !== 0 && diffs[pointer - 1][0] === DiffOp.Equal) {\n            // Merge this equality with the previous one.\n            diffs[pointer - 1][1] += diffs[pointer][1];\n            diffs.splice(pointer, 1);\n          } else {\n            pointer++;\n          }\n          count_insert = 0;\n          count_delete = 0;\n          text_delete = '';\n          text_insert = '';\n          break;\n      }\n    }\n    if (diffs[diffs.length - 1][1] === '') {\n      diffs.pop(); // Remove the dummy entry at the end.\n    }\n\n    // Second pass: look for single edits surrounded on both sides by equalities\n    // which can be shifted sideways to eliminate an equality.\n    // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC\n    let changes = false;\n    pointer = 1;\n    // Intentionally ignore the first and last element (don't need checking).\n    while (pointer < diffs.length - 1) {\n      if (\n        diffs[pointer - 1][0] === DiffOp.Equal &&\n        diffs[pointer + 1][0] === DiffOp.Equal\n      ) {\n        // This is a single edit surrounded by equalities.\n        if (\n          diffs[pointer][1].substring(\n            diffs[pointer][1].length - diffs[pointer - 1][1].length,\n          ) === diffs[pointer - 1][1]\n        ) {\n          // Shift the edit over the previous equality.\n          diffs[pointer][1] =\n            diffs[pointer - 1][1] +\n            diffs[pointer][1].substring(\n              0,\n              diffs[pointer][1].length - diffs[pointer - 1][1].length,\n            );\n          diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];\n          diffs.splice(pointer - 1, 1);\n          changes = true;\n        } else if (\n          diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ===\n          diffs[pointer + 1][1]\n        ) {\n          // Shift the edit over the next equality.\n          diffs[pointer - 1][1] += diffs[pointer + 1][1];\n          diffs[pointer][1] =\n            diffs[pointer][1].substring(diffs[pointer + 1][1].length) +\n            diffs[pointer + 1][1];\n          diffs.splice(pointer + 1, 1);\n          changes = true;\n        }\n      }\n      pointer++;\n    }\n    // If shifts were made, the diff needs reordering and another shift sweep.\n    if (changes) {\n      this.diff_cleanupMerge(diffs);\n    }\n  }\n\n  /**\n   * Compute and return the source text (all equalities and deletions).\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   * @return {string} Source text.\n   */\n  public diff_text1(diffs: Diff[]): string {\n    const text = [];\n    for (let x = 0; x < diffs.length; x++) {\n      if (diffs[x][0] !== DiffOp.Insert) {\n        text[x] = diffs[x][1];\n      }\n    }\n    return text.join('');\n  }\n\n  /**\n   * Compute and return the destination text (all equalities and insertions).\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   * @return {string} Destination text.\n   */\n  public diff_text2(diffs: Diff[]): string {\n    const text = [];\n    for (let x = 0; x < diffs.length; x++) {\n      if (diffs[x][0] !== DiffOp.Delete) {\n        text[x] = diffs[x][1];\n      }\n    }\n    return text.join('');\n  }\n\n  /**\n   * Compute and return a line-mode diff.\n   * @param {string} text1 Old string to be diffed.\n   * @param {string} text2 New string to be diffed.\n   * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n   */\n  public diff_lineMode(text1: string, text2: string): Diff[] {\n    const encodedStrings = this.diff_linesToChars_(text1, text2);\n    const diffs = this.diff_main(\n      encodedStrings.chars1,\n      encodedStrings.chars2,\n      false,\n    );\n    this.diff_charsToLines_(diffs, encodedStrings.lineArray);\n    return diffs;\n  }\n\n  /**\n   * Find the differences between two texts.  Assumes that the texts do not\n   * have any common prefix or suffix.\n   * @param {string} text1 Old string to be diffed.\n   * @param {string} text2 New string to be diffed.\n   * @param {boolean} checklines Speedup flag.  If false, then don't run a\n   *     line-level diff first to identify the changed areas.\n   *     If true, then run a faster, slightly less optimal diff.\n   * @param {number} deadline Time when the diff should be complete by.\n   * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n   * @private\n   */\n  private diff_compute_(\n    text1: string,\n    text2: string,\n    checklines: boolean,\n    deadline: number,\n  ): Diff[] {\n    let diffs: Diff[];\n\n    if (!text1) {\n      // Just add some text (speedup).\n      return [[DiffOp.Insert, text2]];\n    }\n\n    if (!text2) {\n      // Just delete some text (speedup).\n      return [[DiffOp.Delete, text1]];\n    }\n\n    const longtext = text1.length > text2.length ? text1 : text2;\n    const shorttext = text1.length > text2.length ? text2 : text1;\n    const i = longtext.indexOf(shorttext);\n    if (i !== -1) {\n      // Shorter text is inside the longer text (speedup).\n      diffs = [\n        [DiffOp.Insert, longtext.substring(0, i)],\n        [DiffOp.Equal, shorttext],\n        [DiffOp.Insert, longtext.substring(i + shorttext.length)],\n      ];\n      // Swap insertions for deletions if diff is reversed.\n      if (text1.length > text2.length) {\n        diffs[0][0] = diffs[2][0] = DiffOp.Delete;\n      }\n      return diffs;\n    }\n\n    if (shorttext.length === 1) {\n      // Single character string.\n      // After the previous speedup, the character can't be an equality.\n      return [\n        [DiffOp.Delete, text1],\n        [DiffOp.Insert, text2],\n      ];\n    }\n\n    // Check to see if the problem can be split in two.\n    const hm = this.diff_halfMatch_(text1, text2);\n    if (hm) {\n      // A half-match was found, sort out the return data.\n      const text1_a = hm[0];\n      const text1_b = hm[1];\n      const text2_a = hm[2];\n      const text2_b = hm[3];\n      const mid_common = hm[4];\n      // Send both pairs off for separate processing.\n      const diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline);\n      const diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline);\n      // Merge the results.\n      return diffs_a.concat([[DiffOp.Equal, mid_common]], diffs_b);\n    }\n\n    if (checklines && text1.length > 100 && text2.length > 100) {\n      return this.diff_lineMode_(text1, text2, deadline);\n    }\n\n    return this.diff_bisect_(text1, text2, deadline);\n  }\n\n  /**\n   * Do a quick line-level diff on both strings, then rediff the parts for\n   * greater accuracy.\n   * This speedup can produce non-minimal diffs.\n   * @param {string} text1 Old string to be diffed.\n   * @param {string} text2 New string to be diffed.\n   * @param {number} deadline Time when the diff should be complete by.\n   * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n   * @private\n   */\n  private diff_lineMode_(\n    text1: string,\n    text2: string,\n    deadline: number,\n  ): Diff[] {\n    // Scan the text on a line-by-line basis first.\n    const a = this.diff_linesToChars_(text1, text2);\n    text1 = a.chars1;\n    text2 = a.chars2;\n    const linearray = a.lineArray;\n\n    const diffs = this.diff_main(text1, text2, false, deadline);\n\n    // Convert the diff back to original text.\n    this.diff_charsToLines_(diffs, linearray);\n    // Eliminate freak matches (e.g. blank lines)\n    this.diff_cleanupSemantic(diffs);\n\n    // Rediff any replacement blocks, this time character-by-character.\n    // Add a dummy entry at the end.\n    diffs.push([DiffOp.Equal, '']);\n    let pointer = 0;\n    let count_delete = 0;\n    let count_insert = 0;\n    let text_delete = '';\n    let text_insert = '';\n    while (pointer < diffs.length) {\n      switch (diffs[pointer][0]) {\n        case DiffOp.Insert:\n          count_insert++;\n          text_insert += diffs[pointer][1];\n          break;\n        case DiffOp.Delete:\n          count_delete++;\n          text_delete += diffs[pointer][1];\n          break;\n        case DiffOp.Equal:\n          // Upon reaching an equality, check for prior redundancies.\n          if (count_delete >= 1 && count_insert >= 1) {\n            // Delete the offending records and add the merged ones.\n            diffs.splice(\n              pointer - count_delete - count_insert,\n              count_delete + count_insert,\n            );\n            pointer = pointer - count_delete - count_insert;\n            const b = this.diff_main(text_delete, text_insert, false, deadline);\n            for (let j = b.length - 1; j >= 0; j--) {\n              diffs.splice(pointer, 0, b[j]);\n            }\n            pointer = pointer + b.length;\n          }\n          count_insert = 0;\n          count_delete = 0;\n          text_delete = '';\n          text_insert = '';\n          break;\n      }\n      pointer++;\n    }\n    diffs.pop(); // Remove the dummy entry at the end.\n\n    return diffs;\n  }\n\n  /**\n   * Find the 'middle snake' of a diff, split the problem in two\n   * and return the recursively constructed diff.\n   * See Myers 1986 paper: An O(ND) Difference Algorithm and Its constiations.\n   * @param {string} text1 Old string to be diffed.\n   * @param {string} text2 New string to be diffed.\n   * @param {number} deadline Time at which to bail if not yet complete.\n   * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n   * @private\n   */\n  private diff_bisect_(text1: string, text2: string, deadline: number): Diff[] {\n    // Cache the text lengths to prevent multiple calls.\n    const text1_length = text1.length;\n    const text2_length = text2.length;\n    const max_d = Math.ceil((text1_length + text2_length) / 2);\n    const v_offset = max_d;\n    const v_length = 2 * max_d;\n    const v1 = new Array(v_length);\n    const v2 = new Array(v_length);\n    // Setting all elements to -1 is faster in Chrome & Firefox than mixing\n    // integers and undefined.\n    for (let x = 0; x < v_length; x++) {\n      v1[x] = -1;\n      v2[x] = -1;\n    }\n    v1[v_offset + 1] = 0;\n    v2[v_offset + 1] = 0;\n    const delta = text1_length - text2_length;\n    // If the total number of characters is odd, then the front path will collide\n    // with the reverse path.\n    const front = delta % 2 !== 0;\n    // Offsets for start and end of k loop.\n    // Prevents mapping of space beyond the grid.\n    let k1start = 0;\n    let k1end = 0;\n    let k2start = 0;\n    let k2end = 0;\n    for (let d = 0; d < max_d; d++) {\n      // Bail out if deadline is reached.\n      if (new Date().getTime() > deadline) {\n        break;\n      }\n\n      // Walk the front path one step.\n      for (let k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {\n        const k1_offset = v_offset + k1;\n        let x1;\n        if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) {\n          x1 = v1[k1_offset + 1];\n        } else {\n          x1 = v1[k1_offset - 1] + 1;\n        }\n        let y1 = x1 - k1;\n        while (\n          x1 < text1_length &&\n          y1 < text2_length &&\n          text1.charAt(x1) === text2.charAt(y1)\n        ) {\n          x1++;\n          y1++;\n        }\n        v1[k1_offset] = x1;\n        if (x1 > text1_length) {\n          // Ran off the right of the graph.\n          k1end += 2;\n        } else if (y1 > text2_length) {\n          // Ran off the bottom of the graph.\n          k1start += 2;\n        } else if (front) {\n          const k2_offset = v_offset + delta - k1;\n          if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) {\n            // Mirror x2 onto top-left coordinate system.\n            const x2 = text1_length - v2[k2_offset];\n            if (x1 >= x2) {\n              // Overlap detected.\n              return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);\n            }\n          }\n        }\n      }\n\n      // Walk the reverse path one step.\n      for (let k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {\n        const k2_offset = v_offset + k2;\n        let x2: number;\n        if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) {\n          x2 = v2[k2_offset + 1];\n        } else {\n          x2 = v2[k2_offset - 1] + 1;\n        }\n        let y2 = x2 - k2;\n        while (\n          x2 < text1_length &&\n          y2 < text2_length &&\n          text1.charAt(text1_length - x2 - 1) ===\n            text2.charAt(text2_length - y2 - 1)\n        ) {\n          x2++;\n          y2++;\n        }\n        v2[k2_offset] = x2;\n        if (x2 > text1_length) {\n          // Ran off the left of the graph.\n          k2end += 2;\n        } else if (y2 > text2_length) {\n          // Ran off the top of the graph.\n          k2start += 2;\n        } else if (!front) {\n          const k1_offset = v_offset + delta - k2;\n          if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) {\n            const x1 = v1[k1_offset];\n            const y1 = v_offset + x1 - k1_offset;\n            // Mirror x2 onto top-left coordinate system.\n            x2 = text1_length - x2;\n            if (x1 >= x2) {\n              // Overlap detected.\n              return this.diff_bisectSplit_(text1, text2, x1, y1, deadline);\n            }\n          }\n        }\n      }\n    }\n    // Diff took too long and hit the deadline or\n    // number of diffs equals number of characters, no commonality at all.\n    return [\n      [DiffOp.Delete, text1],\n      [DiffOp.Insert, text2],\n    ];\n  }\n\n  /**\n   * Given the location of the 'middle snake', split the diff in two parts\n   * and recurse.\n   * @param {string} text1 Old string to be diffed.\n   * @param {string} text2 New string to be diffed.\n   * @param {number} x Index of split point in text1.\n   * @param {number} y Index of split point in text2.\n   * @param {number} deadline Time at which to bail if not yet complete.\n   * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n   * @private\n   */\n  private diff_bisectSplit_(\n    text1: string,\n    text2: string,\n    x: number,\n    y: number,\n    deadline: number,\n  ): Diff[] {\n    const text1a = text1.substring(0, x);\n    const text2a = text2.substring(0, y);\n    const text1b = text1.substring(x);\n    const text2b = text2.substring(y);\n\n    // Compute both diffs serially.\n    const diffs = this.diff_main(text1a, text2a, false, deadline);\n    const diffsb = this.diff_main(text1b, text2b, false, deadline);\n\n    return diffs.concat(diffsb);\n  }\n\n  /**\n   * Split two texts into an array of strings.  Reduce the texts to a string of\n   * hashes where each Unicode character represents one line.\n   * @param {string} text1 First string.\n   * @param {string} text2 Second string.\n   * @return {{chars1: string, chars2: string, lineArray: !Array.<string>}}\n   *     An object containing the encoded text1, the encoded text2 and\n   *     the array of unique strings.\n   *     The zeroth element of the array of unique strings is intentionally blank.\n   * @private\n   */\n  private diff_linesToChars_(\n    text1: string,\n    text2: string,\n  ): { chars1: string; chars2: string; lineArray: string[] } {\n    const lineArray = []; // e.g. lineArray[4] == 'Hello\\n'\n    const lineHash = {}; // e.g. lineHash['Hello\\n'] == 4\n\n    // '\\x00' is a valid character, but constious debuggers don't like it.\n    // So we'll insert a junk entry to avoid generating a null character.\n    lineArray[0] = '';\n\n    const chars1 = this.diff_linesToCharsMunge_(text1, lineArray, lineHash);\n    const chars2 = this.diff_linesToCharsMunge_(text2, lineArray, lineHash);\n    return { chars1, chars2, lineArray };\n  }\n\n  /**\n   * Split a text into an array of strings.  Reduce the texts to a string of\n   * hashes where each Unicode character represents one line.\n   * Modifies linearray and linehash through being a closure.\n   * @param {string} text String to encode.\n   * @return {string} Encoded string.\n   * @private\n   */\n  private diff_linesToCharsMunge_(\n    text: string,\n    lineArray: string[],\n    lineHash: { [key: string]: number },\n  ): string {\n    let chars = '';\n    // Walk the text, pulling out a substring for each line.\n    // text.split('\\n') would would temporarily double our memory footprint.\n    // Modifying text would create many large strings to garbage collect.\n    let lineStart = 0;\n    let lineEnd = -1;\n    // Keeping our own length constiable is faster than looking it up.\n    let lineArrayLength = lineArray.length;\n    while (lineEnd < text.length - 1) {\n      lineEnd = text.indexOf('\\n', lineStart);\n      if (lineEnd === -1) {\n        lineEnd = text.length - 1;\n      }\n      const line = text.substring(lineStart, lineEnd + 1);\n      lineStart = lineEnd + 1;\n\n      if (Object.hasOwn(lineHash, line) || lineHash[line] !== undefined) {\n        chars += String.fromCharCode(lineHash[line]);\n      } else {\n        chars += String.fromCharCode(lineArrayLength);\n        lineHash[line] = lineArrayLength;\n        lineArray[lineArrayLength++] = line;\n      }\n    }\n    return chars;\n  }\n\n  /**\n   * Rehydrate the text in a diff from a string of line hashes to real lines of\n   * text.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   * @param {!Array.<string>} lineArray Array of unique strings.\n   * @private\n   */\n  private diff_charsToLines_(diffs: Diff[], lineArray: string[]): void {\n    for (const diff of diffs) {\n      const chars = diff[1];\n      const text = [];\n      for (let y = 0; y < chars.length; y++) {\n        text[y] = lineArray[chars.charCodeAt(y)];\n      }\n      diff[1] = text.join('');\n    }\n  }\n\n  /**\n   * Determine if the suffix of one string is the prefix of another.\n   * @param {string} text1 First string.\n   * @param {string} text2 Second string.\n   * @return {number} The number of characters common to the end of the first\n   *     string and the start of the second string.\n   * @private\n   */\n  private diff_commonOverlap_(text1: string, text2: string): number {\n    // Cache the text lengths to prevent multiple calls.\n    const text1_length = text1.length;\n    const text2_length = text2.length;\n    // Eliminate the null case.\n    if (text1_length === 0 || text2_length === 0) {\n      return 0;\n    }\n    // Truncate the longer string.\n    if (text1_length > text2_length) {\n      text1 = text1.substring(text1_length - text2_length);\n    } else if (text1_length < text2_length) {\n      text2 = text2.substring(0, text1_length);\n    }\n    const text_length = Math.min(text1_length, text2_length);\n    // Quick check for the worst case.\n    if (text1 === text2) {\n      return text_length;\n    }\n\n    // Start by looking for a single character match\n    // and increase length until no match is found.\n    // Performance analysis: http://neil.fraser.name/news/2010/11/04/\n    let best = 0;\n    let length = 1;\n    for (;;) {\n      const pattern = text1.substring(text_length - length);\n      const found = text2.indexOf(pattern);\n      if (found === -1) {\n        return best;\n      }\n      length += found;\n      if (\n        found === 0 ||\n        text1.substring(text_length - length) === text2.substring(0, length)\n      ) {\n        best = length;\n        length++;\n      }\n    }\n  }\n\n  /**\n   * Do the two texts share a substring which is at least half the length of the\n   * longer text?\n   * This speedup can produce non-minimal diffs.\n   * @param {string} text1 First string.\n   * @param {string} text2 Second string.\n   * @return {Array.<string>} Five element Array, containing the prefix of\n   *     text1, the suffix of text1, the prefix of text2, the suffix of\n   *     text2 and the common middle.  Or null if there was no match.\n   * @private\n   */\n  private diff_halfMatch_(\n    text1: string,\n    text2: string,\n  ): HalfMatchResult | null {\n    if (this.Diff_Timeout <= 0) {\n      // Don't risk returning a non-optimal diff if we have unlimited time.\n      return null;\n    }\n    const longtext = text1.length > text2.length ? text1 : text2;\n    const shorttext = text1.length > text2.length ? text2 : text1;\n    if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {\n      return null; // Pointless.\n    }\n\n    // First check if the second quarter is the seed for a half-match.\n    const hm1 = this.diff_halfMatchI_(\n      longtext,\n      shorttext,\n      Math.ceil(longtext.length / 4),\n      this,\n    );\n    // Check again based on the third quarter.\n    const hm2 = this.diff_halfMatchI_(\n      longtext,\n      shorttext,\n      Math.ceil(longtext.length / 2),\n      this,\n    );\n    let hm: HalfMatchResult | undefined;\n    if (hm1 === null && hm2 === null) {\n      return null;\n    } else if (hm1 !== null && hm2 !== null) {\n      // Both matched.  Select the longest.\n      hm = hm1[4].length > hm2[4].length ? hm1 : hm2;\n    } else if (hm1 !== null) {\n      hm = hm1;\n    } else if (hm2 !== null) {\n      hm = hm2;\n    }\n\n    if (hm === undefined) {\n      throw new Error('hm expected to be defined but was undefined');\n    }\n\n    // A half-match was found, sort out the return data.\n    let text1_a;\n    let text1_b;\n    let text2_a;\n    let text2_b;\n    if (text1.length > text2.length) {\n      text1_a = hm[0];\n      text1_b = hm[1];\n      text2_a = hm[2];\n      text2_b = hm[3];\n    } else {\n      text2_a = hm[0];\n      text2_b = hm[1];\n      text1_a = hm[2];\n      text1_b = hm[3];\n    }\n    const mid_common = hm[4];\n    return [text1_a, text1_b, text2_a, text2_b, mid_common];\n  }\n\n  /**\n   * Does a substring of shorttext exist within longtext such that the substring\n   * is at least half the length of longtext?\n   * Closure, but does not reference any external constiables.\n   * @param {string} longtext Longer string.\n   * @param {string} shorttext Shorter string.\n   * @param {number} i Start index of quarter length substring within longtext.\n   * @return {Array.<string>} Five element Array, containing the prefix of\n   *     longtext, the suffix of longtext, the prefix of shorttext, the suffix\n   *     of shorttext and the common middle.  Or null if there was no match.\n   * @private\n   */\n  private diff_halfMatchI_(\n    longtext: string,\n    shorttext: string,\n    i: number,\n    dmp: DiffMatchPatch,\n  ): HalfMatchResult | null {\n    // Start with a 1/4 length substring at position i as a seed.\n    const seed = longtext.substring(i, i + Math.floor(longtext.length / 4));\n    let j = -1;\n    let best_common = '';\n    let best_longtext_a = '';\n    let best_longtext_b = '';\n    let best_shorttext_a = '';\n    let best_shorttext_b = '';\n    // tslint:disable-next-line:no-conditional-assignment\n    while ((j = shorttext.indexOf(seed, j + 1)) !== -1) {\n      const prefixLength = dmp.diff_commonPrefix(\n        longtext.substring(i),\n        shorttext.substring(j),\n      );\n      const suffixLength = dmp.diff_commonSuffix(\n        longtext.substring(0, i),\n        shorttext.substring(0, j),\n      );\n      if (best_common.length < suffixLength + prefixLength) {\n        best_common =\n          shorttext.substring(j - suffixLength, j) +\n          shorttext.substring(j, j + prefixLength);\n        best_longtext_a = longtext.substring(0, i - suffixLength);\n        best_longtext_b = longtext.substring(i + prefixLength);\n        best_shorttext_a = shorttext.substring(0, j - suffixLength);\n        best_shorttext_b = shorttext.substring(j + prefixLength);\n      }\n    }\n    if (best_common.length * 2 >= longtext.length) {\n      return [\n        best_longtext_a,\n        best_longtext_b,\n        best_shorttext_a,\n        best_shorttext_b,\n        best_common,\n      ];\n    }\n\n    return null;\n  }\n\n  /**\n   * Look for single edits surrounded on both sides by equalities\n   * which can be shifted sideways to align the edit to a word boundary.\n   * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   */\n  private diff_cleanupSemanticLossless(diffs: Diff[]): void {\n    /**\n     * Given two strings, compute a score representing whether the internal\n     * boundary falls on logical boundaries.\n     * Scores range from 6 (best) to 0 (worst).\n     * Closure, but does not reference any external constiables.\n     * @param {string} one First string.\n     * @param {string} two Second string.\n     * @return {number} The score.\n     * @private\n     */\n    const diff_cleanupSemanticScore_ = (one: string, two: string): number => {\n      if (!one || !two) {\n        // Edges are the best.\n        return 6;\n      }\n\n      const nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/;\n\n      // Each port of this function behaves slightly differently due to\n      // subtle differences in each language's definition of things like\n      // 'whitespace'.  Since this function's purpose is largely cosmetic,\n      // the choice has been made to use each language's native features\n      // rather than force total conformity.\n      const char1 = one.charAt(one.length - 1);\n      const char2 = two.charAt(0);\n      const nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_);\n      const nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_);\n      const whitespace1 = nonAlphaNumeric1 && char1.match(this.whitespaceRegex);\n      const whitespace2 = nonAlphaNumeric2 && char2.match(this.whitespaceRegex);\n      const lineBreak1 = whitespace1 && char1.match(this.linebreakRegex);\n      const lineBreak2 = whitespace2 && char2.match(this.linebreakRegex);\n      const blankLine1 = lineBreak1 && one.match(this.blanklineEndRegex);\n      const blankLine2 = lineBreak2 && two.match(this.blanklineStartRegex);\n\n      if (blankLine1 || blankLine2) {\n        // Five points for blank lines.\n        return 5;\n      } else if (lineBreak1 || lineBreak2) {\n        // Four points for line breaks.\n        return 4;\n      } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {\n        // Three points for end of sentences.\n        return 3;\n      } else if (whitespace1 || whitespace2) {\n        // Two points for whitespace.\n        return 2;\n      } else if (nonAlphaNumeric1 || nonAlphaNumeric2) {\n        // One point for non-alphanumeric.\n        return 1;\n      }\n      return 0;\n    };\n\n    let pointer = 1;\n    // Intentionally ignore the first and last element (don't need checking).\n    while (pointer < diffs.length - 1) {\n      if (\n        diffs[pointer - 1][0] === DiffOp.Equal &&\n        diffs[pointer + 1][0] === DiffOp.Equal\n      ) {\n        // This is a single edit surrounded by equalities.\n        let equality1 = diffs[pointer - 1][1];\n        let edit = diffs[pointer][1];\n        let equality2 = diffs[pointer + 1][1];\n\n        // First, shift the edit as far left as possible.\n        const commonOffset = this.diff_commonSuffix(equality1, edit);\n        if (commonOffset) {\n          const commonString = edit.substring(edit.length - commonOffset);\n          equality1 = equality1.substring(0, equality1.length - commonOffset);\n          edit = commonString + edit.substring(0, edit.length - commonOffset);\n          equality2 = commonString + equality2;\n        }\n\n        // Second, step character by character right, looking for the best fit.\n        let bestEquality1 = equality1;\n        let bestEdit = edit;\n        let bestEquality2 = equality2;\n        let bestScore =\n          diff_cleanupSemanticScore_(equality1, edit) +\n          diff_cleanupSemanticScore_(edit, equality2);\n        while (edit.charAt(0) === equality2.charAt(0)) {\n          equality1 += edit.charAt(0);\n          edit = edit.substring(1) + equality2.charAt(0);\n          equality2 = equality2.substring(1);\n          const score =\n            diff_cleanupSemanticScore_(equality1, edit) +\n            diff_cleanupSemanticScore_(edit, equality2);\n          // The >= encourages trailing rather than leading whitespace on edits.\n          if (score >= bestScore) {\n            bestScore = score;\n            bestEquality1 = equality1;\n            bestEdit = edit;\n            bestEquality2 = equality2;\n          }\n        }\n\n        if (diffs[pointer - 1][1] !== bestEquality1) {\n          // We have an improvement, save it back to the diff.\n          if (bestEquality1) {\n            diffs[pointer - 1][1] = bestEquality1;\n          } else {\n            diffs.splice(pointer - 1, 1);\n            pointer--;\n          }\n          diffs[pointer][1] = bestEdit;\n          if (bestEquality2) {\n            diffs[pointer + 1][1] = bestEquality2;\n          } else {\n            diffs.splice(pointer + 1, 1);\n            pointer--;\n          }\n        }\n      }\n      pointer++;\n    }\n  }\n\n  /**\n   * loc is a location in text1, compute and return the equivalent location in\n   * text2.\n   * e.g. 'The cat' vs 'The big cat', 1->1, 5->8\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   * @param {number} loc Location within text1.\n   * @return {number} Location within text2.\n   */\n  private diff_xIndex(diffs: Diff[], loc: number): number {\n    let chars1 = 0;\n    let chars2 = 0;\n    let last_chars1 = 0;\n    let last_chars2 = 0;\n    let x;\n    for (x = 0; x < diffs.length; x++) {\n      if (diffs[x][0] !== DiffOp.Insert) {\n        // Equality or deletion.\n        chars1 += diffs[x][1].length;\n      }\n      if (diffs[x][0] !== DiffOp.Delete) {\n        // Equality or insertion.\n        chars2 += diffs[x][1].length;\n      }\n      if (chars1 > loc) {\n        // Overshot the location.\n        break;\n      }\n      last_chars1 = chars1;\n      last_chars2 = chars2;\n    }\n    // Was the location was deleted?\n    if (diffs.length !== x && diffs[x][0] === DiffOp.Delete) {\n      return last_chars2;\n    }\n    // Add the remaining character length.\n    return last_chars2 + (loc - last_chars1);\n  }\n\n  /**\n   * Crush the diff into an encoded string which describes the operations\n   * required to transform text1 into text2.\n   * E.g. =3\\t-2\\t+ing  -> Keep 3 chars, delete 2 chars, insert 'ing'.\n   * Operations are tab-separated.  Inserted text is escaped using %xx notation.\n   * @param {!Array.<!diff_match_patch.Diff>} diffs Array of diff tuples.\n   * @return {string} Delta text.\n   */\n  private diff_toDelta(diffs: Diff[]): string {\n    const text = [];\n    for (let x = 0; x < diffs.length; x++) {\n      switch (diffs[x][0]) {\n        case DiffOp.Insert:\n          text[x] = '+' + encodeURI(diffs[x][1]);\n          break;\n        case DiffOp.Delete:\n          text[x] = '-' + diffs[x][1].length;\n          break;\n        case DiffOp.Equal:\n          text[x] = '=' + diffs[x][1].length;\n          break;\n      }\n    }\n    return text.join('\\t').replace(/%20/g, ' ');\n  }\n\n  /**\n   * Given the original text1, and an encoded string which describes the\n   * operations required to transform text1 into text2, compute the full diff.\n   * @param {string} text1 Source string for the diff.\n   * @param {string} delta Delta text.\n   * @return {!Array.<!diff_match_patch.Diff>} Array of diff tuples.\n   * @throws {!Error} If invalid input.\n   */\n  private diff_fromDelta(text1: string, delta: string): Diff[] {\n    const diffs: Diff[] = [];\n    let diffsLength = 0; // Keeping our own length const is faster in JS.\n    let pointer = 0; // Cursor in text1\n    const tokens = delta.split(/\\t/g);\n    for (const token of tokens) {\n      // Each token begins with a one character parameter which specifies the\n      // operation of this token (delete, insert, equality).\n      const param = token.substring(1);\n      switch (token.charAt(0)) {\n        case '+': {\n          try {\n            diffs[diffsLength++] = [DiffOp.Insert, decodeURI(param)];\n          } catch (ex) {\n            // Malformed URI sequence.\n            throw new Error('Illegal escape in diff_fromDelta: ' + param, {\n              cause: ex,\n            });\n          }\n          break;\n        }\n        case '-':\n        // Fall through.\n        case '=': {\n          const n = parseInt(param, 10);\n          if (isNaN(n) || n < 0) {\n            throw new Error('Invalid number in diff_fromDelta: ' + param);\n          }\n          const text = text1.substring(pointer, (pointer += n));\n          if (token.charAt(0) === '=') {\n            diffs[diffsLength++] = [DiffOp.Equal, text];\n          } else {\n            diffs[diffsLength++] = [DiffOp.Delete, text];\n          }\n          break;\n        }\n        default: {\n          // Blank tokens are ok (from a trailing \\t).\n          // Anything else is an error.\n          if (token) {\n            throw new Error(\n              `Invalid diff operation in diff_fromDelta: ${token}`,\n            );\n          }\n        }\n      }\n    }\n    if (pointer !== text1.length) {\n      throw new Error(\n        'Delta length (' +\n          pointer +\n          ') does not equal source text length (' +\n          text1.length +\n          ').',\n      );\n    }\n    return diffs;\n  }\n\n  /**\n   * Locate the best instance of 'pattern' in 'text' near 'loc'.\n   * @param {string} text The text to search.\n   * @param {string} pattern The pattern to search for.\n   * @param {number} loc The location to search around.\n   * @return {number} Best match index or -1.\n   */\n  private match_main(text: string, pattern: string, loc: number): number {\n    // Check for null inputs.\n    if (text == null || pattern == null || loc == null) {\n      throw new Error('Null input. (match_main)');\n    }\n\n    loc = Math.max(0, Math.min(loc, text.length));\n    if (text === pattern) {\n      // Shortcut (potentially not guaranteed by the algorithm)\n      return 0;\n    } else if (!text.length) {\n      // Nothing to match.\n      return -1;\n    } else if (text.substring(loc, loc + pattern.length) === pattern) {\n      // Perfect match at the perfect spot!  (Includes case of null pattern)\n      return loc;\n    } else {\n      // Do a fuzzy compare.\n      return this.match_bitap_(text, pattern, loc);\n    }\n  }\n\n  /**\n   * Locate the best instance of 'pattern' in 'text' near 'loc' using the\n   * Bitap algorithm.\n   * @param {string} text The text to search.\n   * @param {string} pattern The pattern to search for.\n   * @param {number} loc The location to search around.\n   * @return {number} Best match index or -1.\n   * @private\n   */\n  private match_bitap_(text: string, pattern: string, loc: number): number {\n    if (pattern.length > this.Match_MaxBits) {\n      throw new Error('Pattern too long for this browser.');\n    }\n\n    // Initialise the alphabet.\n    const s = this.match_alphabet_(pattern);\n\n    /**\n     * Compute and return the score for a match with e errors and x location.\n     * Accesses loc and pattern through being a closure.\n     * @param {number} e Number of errors in match.\n     * @param {number} x Location of match.\n     * @return {number} Overall score for match (0.0 = good, 1.0 = bad).\n     * @private\n     */\n    const match_bitapScore_ = (e: number, x: number): number => {\n      const accuracy = e / pattern.length;\n      const proximity = Math.abs(loc - x);\n      if (!this.Match_Distance) {\n        // Dodge divide by zero error.\n        return proximity ? 1.0 : accuracy;\n      }\n      return accuracy + proximity / this.Match_Distance;\n    };\n\n    // Highest score beyond which we give up.\n    let score_threshold = this.Match_Threshold;\n    // Is there a nearby exact match? (speedup)\n    let best_loc = text.indexOf(pattern, loc);\n    if (best_loc !== -1) {\n      score_threshold = Math.min(\n        match_bitapScore_(0, best_loc),\n        score_threshold,\n      );\n      // What about in the other direction? (speedup)\n      best_loc = text.lastIndexOf(pattern, loc + pattern.length);\n      if (best_loc !== -1) {\n        score_threshold = Math.min(\n          match_bitapScore_(0, best_loc),\n          score_threshold,\n        );\n      }\n    }\n\n    // Initialise the bit arrays.\n    const matchmask = 1 << (pattern.length - 1);\n    best_loc = -1;\n\n    let bin_min;\n    let bin_mid;\n    let bin_max = pattern.length + text.length;\n    let last_rd;\n    for (let d = 0; d < pattern.length; d++) {\n      // Scan for the best match; each iteration allows for one more error.\n      // Run a binary search to determine how far from 'loc' we can stray at this\n      // error level.\n      bin_min = 0;\n      bin_mid = bin_max;\n      while (bin_min < bin_mid) {\n        if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) {\n          bin_min = bin_mid;\n        } else {\n          bin_max = bin_mid;\n        }\n        bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min);\n      }\n      // Use the result from this iteration as the maximum for the next.\n      bin_max = bin_mid;\n      let start = Math.max(1, loc - bin_mid + 1);\n      const finish = Math.min(loc + bin_mid, text.length) + pattern.length;\n\n      const rd = Array(finish + 2);\n      rd[finish + 1] = (1 << d) - 1;\n      for (let j = finish; j >= start; j--) {\n        // The alphabet (s) is a sparse hash, so the following line generates\n        // warnings.\n        const charMatch = s[text.charAt(j - 1)];\n        if (d === 0) {\n          // First pass: exact match.\n          rd[j] = ((rd[j + 1] << 1) | 1) & charMatch;\n        } else {\n          if (last_rd === undefined) {\n            throw new Error(\n              'last_rd should have been set by the previous loop but is undefined',\n            );\n          }\n\n          // Subsequent passes: fuzzy match.\n          rd[j] =\n            (((rd[j + 1] << 1) | 1) & charMatch) |\n            (((last_rd[j + 1] | last_rd[j]) << 1) | 1) |\n            last_rd[j + 1];\n        }\n        if (rd[j] & matchmask) {\n          const score = match_bitapScore_(d, j - 1);\n          // This match will almost certainly be better than any existing match.\n          // But check anyway.\n          if (score <= score_threshold) {\n            // Told you so.\n            score_threshold = score;\n            best_loc = j - 1;\n            if (best_loc > loc) {\n              // When passing loc, don't exceed our current distance from loc.\n              start = Math.max(1, 2 * loc - best_loc);\n            } else {\n              // Already passed loc, downhill from here on in.\n              break;\n            }\n          }\n        }\n      }\n      // No hope for a (better) match at greater error levels.\n      if (match_bitapScore_(d + 1, loc) > score_threshold) {\n        break;\n      }\n      last_rd = rd;\n    }\n    return best_loc;\n  }\n\n  /**\n   * Initialise the alphabet for the Bitap algorithm.\n   * @param {string} pattern The text to encode.\n   * @return {!Object} Hash of character locations.\n   * @private\n   */\n  private match_alphabet_(pattern: string): { [character: string]: number } {\n    const s: { [character: string]: number } = {};\n    for (let i = 0; i < pattern.length; i++) {\n      s[pattern.charAt(i)] = 0;\n    }\n    for (let i = 0; i < pattern.length; i++) {\n      s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1);\n    }\n    return s;\n  }\n\n  /**\n   * Increase the context until it is unique,\n   * but don't let the pattern expand beyond Match_MaxBits.\n   * @param {!diff_match_patch.PatchOperation} patch The patch to grow.\n   * @param {string} text Source text.\n   * @private\n   */\n  private patch_addContext_(patch: PatchOperation, text: string): void {\n    if (text.length === 0) {\n      return;\n    }\n    let pattern = text.substring(patch.start2, patch.start2 + patch.length1);\n    let padding = 0;\n\n    // Look for the first and last matches of pattern in text.  If two different\n    // matches are found, increase the pattern length.\n    while (\n      text.indexOf(pattern) !== text.lastIndexOf(pattern) &&\n      pattern.length <\n        this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin\n    ) {\n      padding += this.Patch_Margin;\n      pattern = text.substring(\n        patch.start2 - padding,\n        patch.start2 + patch.length1 + padding,\n      );\n    }\n    // Add one chunk for good luck.\n    padding += this.Patch_Margin;\n\n    // Add the prefix.\n    const prefix = text.substring(patch.start2 - padding, patch.start2);\n    if (prefix) {\n      patch.diffs.unshift([DiffOp.Equal, prefix]);\n    }\n    // Add the suffix.\n    const suffix = text.substring(\n      patch.start2 + patch.length1,\n      patch.start2 + patch.length1 + padding,\n    );\n    if (suffix) {\n      patch.diffs.push([DiffOp.Equal, suffix]);\n    }\n\n    // Roll back the start points.\n    patch.start1 -= prefix.length;\n    patch.start2 -= prefix.length;\n    // Extend the lengths.\n    patch.length1 += prefix.length + suffix.length;\n    patch.length2 += prefix.length + suffix.length;\n  }\n\n  /**\n   * Given an array of patches, return another array that is identical.\n   * @param {!Array.<!diff_match_patch.PatchOperation>} patches Array of Patch objects.\n   * @return {!Array.<!diff_match_patch.PatchOperation>} Array of Patch objects.\n   */\n  private patch_deepCopy(patches: PatchOperation[]): PatchOperation[] {\n    return patches.map((x) => x.clone());\n  }\n\n  /**\n   * Add some padding on text start and end so that edges can match something.\n   * Intended to be called only from within patch_apply.\n   * @param {!Array.<!diff_match_patch.PatchOperation>} patches Array of Patch objects.\n   * @return {string} The padding string added to each side.\n   */\n  private patch_addPadding(patches: PatchOperation[]): string {\n    const paddingLength = this.Patch_Margin;\n    let nullPadding = '';\n    for (let x = 1; x <= paddingLength; x++) {\n      nullPadding += String.fromCharCode(x);\n    }\n\n    // Bump all the patches forward.\n    for (const patchElement of patches) {\n      patchElement.start1 += paddingLength;\n      patchElement.start2 += paddingLength;\n    }\n\n    // Add some padding on start of first diff.\n    let patch = patches[0];\n    let diffs = patch.diffs;\n    if (diffs.length === 0 || diffs[0][0] !== DiffOp.Equal) {\n      // Add nullPadding equality.\n      diffs.unshift([DiffOp.Equal, nullPadding]);\n      patch.start1 -= paddingLength; // Should be 0.\n      patch.start2 -= paddingLength; // Should be 0.\n      patch.length1 += paddingLength;\n      patch.length2 += paddingLength;\n    } else if (paddingLength > diffs[0][1].length) {\n      // Grow first equality.\n      const extraLength = paddingLength - diffs[0][1].length;\n      diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1];\n      patch.start1 -= extraLength;\n      patch.start2 -= extraLength;\n      patch.length1 += extraLength;\n      patch.length2 += extraLength;\n    }\n\n    // Add some padding on end of last diff.\n    patch = patches[patches.length - 1];\n    diffs = patch.diffs;\n    if (diffs.length === 0 || diffs[diffs.length - 1][0] !== DiffOp.Equal) {\n      // Add nullPadding equality.\n      diffs.push([DiffOp.Equal, nullPadding]);\n      patch.length1 += paddingLength;\n      patch.length2 += paddingLength;\n    } else if (paddingLength > diffs[diffs.length - 1][1].length) {\n      // Grow last equality.\n      const extraLength = paddingLength - diffs[diffs.length - 1][1].length;\n      diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength);\n      patch.length1 += extraLength;\n      patch.length2 += extraLength;\n    }\n\n    return nullPadding;\n  }\n\n  /**\n   * Look through the patches and break up any which are longer than the maximum\n   * limit of the match algorithm.\n   * Intended to be called only from within patch_apply.\n   * @param {!Array.<!diff_match_patch.PatchOperation>} patches Array of Patch objects.\n   */\n  private patch_splitMax(patches: PatchOperation[]): void {\n    const patch_size = this.Match_MaxBits;\n    for (let x = 0; x < patches.length; x++) {\n      if (patches[x].length1 <= patch_size) {\n        continue;\n      }\n      const bigpatch = patches[x];\n      // Remove the big old patch.\n      patches.splice(x--, 1);\n      let { start1, start2 } = bigpatch;\n      let precontext = '';\n      while (bigpatch.diffs.length !== 0) {\n        // Create one of several smaller patches.\n        const patch = new PatchOperation(\n          start1 - precontext.length,\n          start2 - precontext.length,\n        );\n        let empty = true;\n        if (precontext !== '') {\n          patch.length1 = patch.length2 = precontext.length;\n          patch.diffs.push([DiffOp.Equal, precontext]);\n        }\n        while (\n          bigpatch.diffs.length !== 0 &&\n          patch.length1 < patch_size - this.Patch_Margin\n        ) {\n          const diff_type = bigpatch.diffs[0][0];\n          let diff_text = bigpatch.diffs[0][1];\n          if (diff_type === DiffOp.Insert) {\n            // Insertions are harmless.\n            patch.length2 += diff_text.length;\n            start2 += diff_text.length;\n            patch.diffs.push(bigpatch.diffs.shift()!);\n            empty = false;\n          } else if (\n            diff_type === DiffOp.Delete &&\n            patch.diffs.length === 1 &&\n            patch.diffs[0][0] === DiffOp.Equal &&\n            diff_text.length > 2 * patch_size\n          ) {\n            // This is a large deletion.  Let it pass in one chunk.\n            patch.length1 += diff_text.length;\n            start1 += diff_text.length;\n            empty = false;\n            patch.diffs.push([diff_type, diff_text]);\n            bigpatch.diffs.shift();\n          } else {\n            // Deletion or equality.  Only take as much as we can stomach.\n            diff_text = diff_text.substring(\n              0,\n              patch_size - patch.length1 - this.Patch_Margin,\n            );\n            patch.length1 += diff_text.length;\n            start1 += diff_text.length;\n            if (diff_type === DiffOp.Equal) {\n              patch.length2 += diff_text.length;\n              start2 += diff_text.length;\n            } else {\n              empty = false;\n            }\n            patch.diffs.push([diff_type, diff_text]);\n            if (diff_text === bigpatch.diffs[0][1]) {\n              bigpatch.diffs.shift();\n            } else {\n              bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(\n                diff_text.length,\n              );\n            }\n          }\n        }\n        // Compute the head context for the next patch.\n        precontext = this.diff_text2(patch.diffs);\n        precontext = precontext.substring(\n          precontext.length - this.Patch_Margin,\n        );\n        // Append the end context for this patch.\n        const postcontext = this.diff_text1(bigpatch.diffs).substring(\n          0,\n          this.Patch_Margin,\n        );\n        if (postcontext !== '') {\n          patch.length1 += postcontext.length;\n          patch.length2 += postcontext.length;\n          if (\n            patch.diffs.length !== 0 &&\n            patch.diffs[patch.diffs.length - 1][0] === DiffOp.Equal\n          ) {\n            patch.diffs[patch.diffs.length - 1][1] += postcontext;\n          } else {\n            patch.diffs.push([DiffOp.Equal, postcontext]);\n          }\n        }\n        if (!empty) {\n          patches.splice(++x, 0, patch);\n        }\n      }\n    }\n  }\n}\n"],"names":["DiffOp"],"mappings":";;AAAYA;AAAZ,CAAA,UAAY,MAAM,EAAA;AAChB,IAAA,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA,GAAA,EAAA,CAAA,GAAA,QAAW;AACX,IAAA,MAAA,CAAA,MAAA,CAAA,OAAA,CAAA,GAAA,CAAA,CAAA,GAAA,OAAS;AACT,IAAA,MAAA,CAAA,MAAA,CAAA,QAAA,CAAA,GAAA,CAAA,CAAA,GAAA,QAAU;AACZ,CAAC,EAJWA,cAAM,KAANA,cAAM,GAAA,EAAA,CAAA,CAAA;;ACAlB;;;;;;;;;;;;;;;;;;;;;;;;;AA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