      function alignListsWithDiffHandling(raw, ref) {
            const alignedRaw = [];

            const sm = new difflib.SequenceMatcher(null, raw, ref);
            for (const [tag, i1, i2, j1, j2] of sm.getOpcodes()) {
                if (tag == 'equal') {
                    alignedRaw.push(...raw.slice(i1, i2));
                } else if (tag == 'replace') {
                    // Strict comparison
                    if (raw.slice(i1, i2).join("") === ref.slice(j1, j2).join("")) {
                 