@noma.to/qwik-testing-library 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/README.md +4 -3
  2. package/lib/lib/mock.qwik.cjs +3 -3
  3. package/lib/lib/mock.qwik.mjs +1 -1
  4. package/lib/lib/qwikloader.qwik.cjs +1 -1
  5. package/lib/lib/qwikloader.qwik.mjs +1 -1
  6. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.cjs +89 -0
  7. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.qwik.mjs +89 -0
  8. package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@2.1.8}/node_modules/@vitest/expect/dist/index.qwik.cjs +155 -71
  9. package/lib/node_modules/.pnpm/{@vitest_expect@2.1.1 → @vitest_expect@2.1.8}/node_modules/@vitest/expect/dist/index.qwik.mjs +148 -64
  10. package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@2.1.8}/node_modules/@vitest/pretty-format/dist/index.qwik.cjs +11 -5
  11. package/lib/node_modules/.pnpm/{@vitest_pretty-format@2.1.1 → @vitest_pretty-format@2.1.8}/node_modules/@vitest/pretty-format/dist/index.qwik.mjs +11 -5
  12. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.cjs +2 -2
  13. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/chunk-tasks.qwik.mjs +2 -2
  14. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/index.qwik.cjs +34 -28
  15. package/lib/node_modules/.pnpm/{@vitest_runner@2.1.1 → @vitest_runner@2.1.8}/node_modules/@vitest/runner/dist/index.qwik.mjs +31 -25
  16. package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@2.1.8}/node_modules/@vitest/snapshot/dist/index.qwik.cjs +863 -460
  17. package/lib/node_modules/.pnpm/{@vitest_snapshot@2.1.1 → @vitest_snapshot@2.1.8}/node_modules/@vitest/snapshot/dist/index.qwik.mjs +863 -460
  18. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.cjs → @vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.cjs} +6 -2
  19. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/chunk-display.qwik.mjs → @vitest_utils@2.1.8/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.qwik.mjs} +6 -2
  20. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/diff.qwik.cjs +458 -450
  21. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/diff.qwik.mjs +456 -448
  22. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/error.qwik.cjs +5 -5
  23. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/error.qwik.mjs +2 -2
  24. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/helpers.qwik.cjs +1 -1
  25. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/helpers.qwik.mjs +1 -1
  26. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.cjs +472 -0
  27. package/lib/node_modules/.pnpm/@vitest_utils@2.1.8/node_modules/@vitest/utils/dist/index.qwik.mjs +472 -0
  28. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/source-map.qwik.cjs +20 -20
  29. package/lib/node_modules/.pnpm/{@vitest_utils@2.1.1 → @vitest_utils@2.1.8}/node_modules/@vitest/utils/dist/source-map.qwik.mjs +20 -20
  30. package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.cjs +71 -39
  31. package/lib/node_modules/.pnpm/{chai@5.1.1 → chai@5.1.2}/node_modules/chai/chai.qwik.mjs +71 -39
  32. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/error.qwik.cjs +7 -1
  33. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/error.qwik.mjs +7 -1
  34. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/object.qwik.cjs +1 -1
  35. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/object.qwik.mjs +1 -1
  36. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/string.qwik.cjs +1 -2
  37. package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/string.qwik.mjs +1 -2
  38. package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.cjs +44 -33
  39. package/lib/node_modules/.pnpm/{magic-string@0.30.11 → magic-string@0.30.17}/node_modules/magic-string/dist/magic-string.es.qwik.mjs +44 -33
  40. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.cjs +66 -0
  41. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/utils.C8RiOc4B.qwik.mjs +66 -0
  42. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.cjs +2749 -0
  43. package/lib/node_modules/.pnpm/vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0/node_modules/vitest/dist/chunks/vi.DgezovHB.qwik.mjs +2749 -0
  44. package/package.json +13 -13
  45. package/lib/_virtual/_commonjsHelpers.qwik.cjs +0 -4
  46. package/lib/_virtual/_commonjsHelpers.qwik.mjs +0 -4
  47. package/lib/_virtual/sourcemap-codec.umd.qwik.cjs +0 -4
  48. package/lib/_virtual/sourcemap-codec.umd.qwik.mjs +0 -4
  49. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.cjs +0 -425
  50. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.0/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.qwik.mjs +0 -425
  51. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.cjs +0 -81
  52. package/lib/node_modules/.pnpm/@vitest_utils@2.1.1/node_modules/@vitest/utils/dist/index.qwik.mjs +0 -81
  53. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.cjs +0 -6
  54. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/base.BlXpj3e_.qwik.mjs +0 -6
  55. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.cjs +0 -16
  56. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/utils.Ck2hJTRs.qwik.mjs +0 -16
  57. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.cjs +0 -2556
  58. package/lib/node_modules/.pnpm/vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1/node_modules/vitest/dist/chunks/vi.D6IHiKAI.qwik.mjs +0 -2556
  59. /package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@2.1.8}/node_modules/@vitest/spy/dist/index.qwik.cjs +0 -0
  60. /package/lib/node_modules/.pnpm/{@vitest_spy@2.1.1 → @vitest_spy@2.1.8}/node_modules/@vitest/spy/dist/index.qwik.mjs +0 -0
  61. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/arguments.qwik.cjs +0 -0
  62. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/arguments.qwik.mjs +0 -0
  63. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/array.qwik.cjs +0 -0
  64. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/array.qwik.mjs +0 -0
  65. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/bigint.qwik.cjs +0 -0
  66. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/bigint.qwik.mjs +0 -0
  67. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/class.qwik.cjs +0 -0
  68. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/class.qwik.mjs +0 -0
  69. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/date.qwik.cjs +0 -0
  70. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/date.qwik.mjs +0 -0
  71. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/function.qwik.cjs +0 -0
  72. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/function.qwik.mjs +0 -0
  73. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/helpers.qwik.cjs +0 -0
  74. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/helpers.qwik.mjs +0 -0
  75. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/html.qwik.cjs +0 -0
  76. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/html.qwik.mjs +0 -0
  77. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/index.qwik.cjs +0 -0
  78. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/index.qwik.mjs +0 -0
  79. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/map.qwik.cjs +0 -0
  80. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/map.qwik.mjs +0 -0
  81. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/number.qwik.cjs +0 -0
  82. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/number.qwik.mjs +0 -0
  83. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/promise.qwik.cjs +0 -0
  84. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/promise.qwik.mjs +0 -0
  85. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/regexp.qwik.cjs +0 -0
  86. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/regexp.qwik.mjs +0 -0
  87. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/set.qwik.cjs +0 -0
  88. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/set.qwik.mjs +0 -0
  89. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/symbol.qwik.cjs +0 -0
  90. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/symbol.qwik.mjs +0 -0
  91. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/typedarray.qwik.cjs +0 -0
  92. /package/lib/node_modules/.pnpm/{loupe@3.1.1 → loupe@3.1.2}/node_modules/loupe/lib/typedarray.qwik.mjs +0 -0
  93. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.cjs +0 -0
  94. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.qwik.mjs +0 -0
  95. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.cjs +0 -0
  96. /package/lib/node_modules/.pnpm/{vitest@2.1.1_@types_node@22.7.4_@vitest_ui@2.1.1_jsdom@25.0.1 → vitest@2.1.8_@types_node@22.10.3_@vitest_ui@2.1.8_jsdom@26.0.0}/node_modules/vitest/dist/chunks/date.W2xKR2qe.qwik.mjs +0 -0
@@ -1,46 +1,11 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { format, plugins } from "../../../../../@vitest_pretty-format@2.1.1/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
4
+ import { format, plugins } from "../../../../../@vitest_pretty-format@2.1.8/node_modules/@vitest/pretty-format/dist/index.qwik.mjs";
5
5
  import f from "../../../../../tinyrainbow@1.2.0/node_modules/tinyrainbow/dist/browser.qwik.mjs";
6
- import { s as stringify } from "./chunk-display.qwik.mjs";
6
+ import { s as stringify, g as getDefaultExportFromCjs } from "./chunk-_commonjsHelpers.qwik.mjs";
7
7
  import { deepClone, getOwnProperties, getType as getType$1 } from "./helpers.qwik.mjs";
8
- import "../../../../../loupe@3.1.1/node_modules/loupe/lib/index.qwik.mjs";
9
- function getType(value) {
10
- if (value === void 0) {
11
- return "undefined";
12
- } else if (value === null) {
13
- return "null";
14
- } else if (Array.isArray(value)) {
15
- return "array";
16
- } else if (typeof value === "boolean") {
17
- return "boolean";
18
- } else if (typeof value === "function") {
19
- return "function";
20
- } else if (typeof value === "number") {
21
- return "number";
22
- } else if (typeof value === "string") {
23
- return "string";
24
- } else if (typeof value === "bigint") {
25
- return "bigint";
26
- } else if (typeof value === "object") {
27
- if (value != null) {
28
- if (value.constructor === RegExp) {
29
- return "regexp";
30
- } else if (value.constructor === Map) {
31
- return "map";
32
- } else if (value.constructor === Set) {
33
- return "set";
34
- } else if (value.constructor === Date) {
35
- return "date";
36
- }
37
- }
38
- return "object";
39
- } else if (typeof value === "symbol") {
40
- return "symbol";
41
- }
42
- throw new Error(`value of unknown type: ${value}`);
43
- }
8
+ import "../../../../../loupe@3.1.2/node_modules/loupe/lib/index.qwik.mjs";
44
9
  const DIFF_DELETE = -1;
45
10
  const DIFF_INSERT = 1;
46
11
  const DIFF_EQUAL = 0;
@@ -400,225 +365,154 @@ function diff_cleanupSemanticScore_(one, two) {
400
365
  const NO_DIFF_MESSAGE = "Compared values have no visual difference.";
401
366
  const SIMILAR_MESSAGE = "Compared values serialize to the same structure.\nPrinting internal object structure without calling `toJSON` instead.";
402
367
  var build = {};
403
- Object.defineProperty(build, "__esModule", {
404
- value: true
405
- });
406
- var _default = build.default = diffSequence;
407
- const pkg = "diff-sequences";
408
- const NOT_YET_SET = 0;
409
- const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => {
410
- let nCommon = 0;
411
- while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
412
- aIndex += 1;
413
- bIndex += 1;
414
- nCommon += 1;
415
- }
416
- return nCommon;
417
- };
418
- const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => {
419
- let nCommon = 0;
420
- while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
421
- aIndex -= 1;
422
- bIndex -= 1;
423
- nCommon += 1;
424
- }
425
- return nCommon;
426
- };
427
- const extendPathsF = (d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) => {
428
- let iF = 0;
429
- let kF = -d;
430
- let aFirst = aIndexesF[iF];
431
- let aIndexPrev1 = aFirst;
432
- aIndexesF[iF] += countCommonItemsF(
433
- aFirst + 1,
434
- aEnd,
435
- bF + aFirst - kF + 1,
436
- bEnd,
437
- isCommon
438
- );
439
- const nF = d < iMaxF ? d : iMaxF;
440
- for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
441
- if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
442
- aFirst = aIndexesF[iF];
443
- } else {
444
- aFirst = aIndexPrev1 + 1;
445
- if (aEnd <= aFirst) {
446
- return iF - 1;
447
- }
368
+ var hasRequiredBuild;
369
+ function requireBuild() {
370
+ if (hasRequiredBuild) return build;
371
+ hasRequiredBuild = 1;
372
+ Object.defineProperty(build, "__esModule", {
373
+ value: true
374
+ });
375
+ build.default = diffSequence;
376
+ const pkg = "diff-sequences";
377
+ const NOT_YET_SET = 0;
378
+ const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => {
379
+ let nCommon = 0;
380
+ while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
381
+ aIndex += 1;
382
+ bIndex += 1;
383
+ nCommon += 1;
448
384
  }
449
- aIndexPrev1 = aIndexesF[iF];
450
- aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
451
- }
452
- return iMaxF;
453
- };
454
- const extendPathsR = (d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR) => {
455
- let iR = 0;
456
- let kR = d;
457
- let aFirst = aIndexesR[iR];
458
- let aIndexPrev1 = aFirst;
459
- aIndexesR[iR] -= countCommonItemsR(
460
- aStart,
461
- aFirst - 1,
462
- bStart,
463
- bR + aFirst - kR - 1,
464
- isCommon
465
- );
466
- const nR = d < iMaxR ? d : iMaxR;
467
- for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
468
- if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
469
- aFirst = aIndexesR[iR];
470
- } else {
471
- aFirst = aIndexPrev1 - 1;
472
- if (aFirst < aStart) {
473
- return iR - 1;
474
- }
385
+ return nCommon;
386
+ };
387
+ const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => {
388
+ let nCommon = 0;
389
+ while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
390
+ aIndex -= 1;
391
+ bIndex -= 1;
392
+ nCommon += 1;
475
393
  }
476
- aIndexPrev1 = aIndexesR[iR];
477
- aIndexesR[iR] = aFirst - countCommonItemsR(
478
- aStart,
479
- aFirst - 1,
480
- bStart,
481
- bR + aFirst - kR - 1,
482
- isCommon
483
- );
484
- }
485
- return iMaxR;
486
- };
487
- const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
488
- const bF = bStart - aStart;
489
- const aLength = aEnd - aStart;
490
- const bLength = bEnd - bStart;
491
- const baDeltaLength = bLength - aLength;
492
- const kMinOverlapF = -baDeltaLength - (d - 1);
493
- const kMaxOverlapF = -baDeltaLength + (d - 1);
494
- let aIndexPrev1 = NOT_YET_SET;
495
- const nF = d < iMaxF ? d : iMaxF;
496
- for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
497
- const insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
498
- const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
499
- const aFirst = insert ? aLastPrev : aLastPrev + 1;
500
- const bFirst = bF + aFirst - kF;
501
- const nCommonF = countCommonItemsF(
394
+ return nCommon;
395
+ };
396
+ const extendPathsF = (d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF) => {
397
+ let iF = 0;
398
+ let kF = -d;
399
+ let aFirst = aIndexesF[iF];
400
+ let aIndexPrev1 = aFirst;
401
+ aIndexesF[iF] += countCommonItemsF(
502
402
  aFirst + 1,
503
403
  aEnd,
504
- bFirst + 1,
404
+ bF + aFirst - kF + 1,
505
405
  bEnd,
506
406
  isCommon
507
407
  );
508
- const aLast = aFirst + nCommonF;
509
- aIndexPrev1 = aIndexesF[iF];
510
- aIndexesF[iF] = aLast;
511
- if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
512
- const iR = (d - 1 - (kF + baDeltaLength)) / 2;
513
- if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
514
- const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
515
- const nCommonR = countCommonItemsR(
516
- aStart,
517
- aLastPrev,
518
- bStart,
519
- bLastPrev,
520
- isCommon
521
- );
522
- const aIndexPrevFirst = aLastPrev - nCommonR;
523
- const bIndexPrevFirst = bLastPrev - nCommonR;
524
- const aEndPreceding = aIndexPrevFirst + 1;
525
- const bEndPreceding = bIndexPrevFirst + 1;
526
- division.nChangePreceding = d - 1;
527
- if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
528
- division.aEndPreceding = aStart;
529
- division.bEndPreceding = bStart;
530
- } else {
531
- division.aEndPreceding = aEndPreceding;
532
- division.bEndPreceding = bEndPreceding;
533
- }
534
- division.nCommonPreceding = nCommonR;
535
- if (nCommonR !== 0) {
536
- division.aCommonPreceding = aEndPreceding;
537
- division.bCommonPreceding = bEndPreceding;
538
- }
539
- division.nCommonFollowing = nCommonF;
540
- if (nCommonF !== 0) {
541
- division.aCommonFollowing = aFirst + 1;
542
- division.bCommonFollowing = bFirst + 1;
543
- }
544
- const aStartFollowing = aLast + 1;
545
- const bStartFollowing = bFirst + nCommonF + 1;
546
- division.nChangeFollowing = d - 1;
547
- if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
548
- division.aStartFollowing = aEnd;
549
- division.bStartFollowing = bEnd;
550
- } else {
551
- division.aStartFollowing = aStartFollowing;
552
- division.bStartFollowing = bStartFollowing;
408
+ const nF = d < iMaxF ? d : iMaxF;
409
+ for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
410
+ if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
411
+ aFirst = aIndexesF[iF];
412
+ } else {
413
+ aFirst = aIndexPrev1 + 1;
414
+ if (aEnd <= aFirst) {
415
+ return iF - 1;
553
416
  }
554
- return true;
555
417
  }
418
+ aIndexPrev1 = aIndexesF[iF];
419
+ aIndexesF[iF] = aFirst + countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
556
420
  }
557
- }
558
- return false;
559
- };
560
- const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
561
- const bR = bEnd - aEnd;
562
- const aLength = aEnd - aStart;
563
- const bLength = bEnd - bStart;
564
- const baDeltaLength = bLength - aLength;
565
- const kMinOverlapR = baDeltaLength - d;
566
- const kMaxOverlapR = baDeltaLength + d;
567
- let aIndexPrev1 = NOT_YET_SET;
568
- const nR = d < iMaxR ? d : iMaxR;
569
- for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
570
- const insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
571
- const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
572
- const aFirst = insert ? aLastPrev : aLastPrev - 1;
573
- const bFirst = bR + aFirst - kR;
574
- const nCommonR = countCommonItemsR(
421
+ return iMaxF;
422
+ };
423
+ const extendPathsR = (d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR) => {
424
+ let iR = 0;
425
+ let kR = d;
426
+ let aFirst = aIndexesR[iR];
427
+ let aIndexPrev1 = aFirst;
428
+ aIndexesR[iR] -= countCommonItemsR(
575
429
  aStart,
576
430
  aFirst - 1,
577
431
  bStart,
578
- bFirst - 1,
432
+ bR + aFirst - kR - 1,
579
433
  isCommon
580
434
  );
581
- const aLast = aFirst - nCommonR;
582
- aIndexPrev1 = aIndexesR[iR];
583
- aIndexesR[iR] = aLast;
584
- if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
585
- const iF = (d + (kR - baDeltaLength)) / 2;
586
- if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
587
- const bLast = bFirst - nCommonR;
588
- division.nChangePreceding = d;
589
- if (d === aLast + bLast - aStart - bStart) {
590
- division.aEndPreceding = aStart;
591
- division.bEndPreceding = bStart;
592
- } else {
593
- division.aEndPreceding = aLast;
594
- division.bEndPreceding = bLast;
595
- }
596
- division.nCommonPreceding = nCommonR;
597
- if (nCommonR !== 0) {
598
- division.aCommonPreceding = aLast;
599
- division.bCommonPreceding = bLast;
435
+ const nR = d < iMaxR ? d : iMaxR;
436
+ for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
437
+ if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
438
+ aFirst = aIndexesR[iR];
439
+ } else {
440
+ aFirst = aIndexPrev1 - 1;
441
+ if (aFirst < aStart) {
442
+ return iR - 1;
600
443
  }
601
- division.nChangeFollowing = d - 1;
602
- if (d === 1) {
603
- division.nCommonFollowing = 0;
604
- division.aStartFollowing = aEnd;
605
- division.bStartFollowing = bEnd;
606
- } else {
607
- const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
608
- const nCommonF = countCommonItemsF(
444
+ }
445
+ aIndexPrev1 = aIndexesR[iR];
446
+ aIndexesR[iR] = aFirst - countCommonItemsR(
447
+ aStart,
448
+ aFirst - 1,
449
+ bStart,
450
+ bR + aFirst - kR - 1,
451
+ isCommon
452
+ );
453
+ }
454
+ return iMaxR;
455
+ };
456
+ const extendOverlappablePathsF = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
457
+ const bF = bStart - aStart;
458
+ const aLength = aEnd - aStart;
459
+ const bLength = bEnd - bStart;
460
+ const baDeltaLength = bLength - aLength;
461
+ const kMinOverlapF = -baDeltaLength - (d - 1);
462
+ const kMaxOverlapF = -baDeltaLength + (d - 1);
463
+ let aIndexPrev1 = NOT_YET_SET;
464
+ const nF = d < iMaxF ? d : iMaxF;
465
+ for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
466
+ const insert = iF === 0 || iF !== d && aIndexPrev1 < aIndexesF[iF];
467
+ const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
468
+ const aFirst = insert ? aLastPrev : aLastPrev + 1;
469
+ const bFirst = bF + aFirst - kF;
470
+ const nCommonF = countCommonItemsF(
471
+ aFirst + 1,
472
+ aEnd,
473
+ bFirst + 1,
474
+ bEnd,
475
+ isCommon
476
+ );
477
+ const aLast = aFirst + nCommonF;
478
+ aIndexPrev1 = aIndexesF[iF];
479
+ aIndexesF[iF] = aLast;
480
+ if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
481
+ const iR = (d - 1 - (kF + baDeltaLength)) / 2;
482
+ if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
483
+ const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
484
+ const nCommonR = countCommonItemsR(
485
+ aStart,
609
486
  aLastPrev,
610
- aEnd,
487
+ bStart,
611
488
  bLastPrev,
612
- bEnd,
613
489
  isCommon
614
490
  );
491
+ const aIndexPrevFirst = aLastPrev - nCommonR;
492
+ const bIndexPrevFirst = bLastPrev - nCommonR;
493
+ const aEndPreceding = aIndexPrevFirst + 1;
494
+ const bEndPreceding = bIndexPrevFirst + 1;
495
+ division.nChangePreceding = d - 1;
496
+ if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
497
+ division.aEndPreceding = aStart;
498
+ division.bEndPreceding = bStart;
499
+ } else {
500
+ division.aEndPreceding = aEndPreceding;
501
+ division.bEndPreceding = bEndPreceding;
502
+ }
503
+ division.nCommonPreceding = nCommonR;
504
+ if (nCommonR !== 0) {
505
+ division.aCommonPreceding = aEndPreceding;
506
+ division.bCommonPreceding = bEndPreceding;
507
+ }
615
508
  division.nCommonFollowing = nCommonF;
616
509
  if (nCommonF !== 0) {
617
- division.aCommonFollowing = aLastPrev;
618
- division.bCommonFollowing = bLastPrev;
510
+ division.aCommonFollowing = aFirst + 1;
511
+ division.bCommonFollowing = bFirst + 1;
619
512
  }
620
- const aStartFollowing = aLastPrev + nCommonF;
621
- const bStartFollowing = bLastPrev + nCommonF;
513
+ const aStartFollowing = aLast + 1;
514
+ const bStartFollowing = bFirst + nCommonF + 1;
515
+ division.nChangeFollowing = d - 1;
622
516
  if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
623
517
  division.aStartFollowing = aEnd;
624
518
  division.bStartFollowing = bEnd;
@@ -626,241 +520,238 @@ const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aInde
626
520
  division.aStartFollowing = aStartFollowing;
627
521
  division.bStartFollowing = bStartFollowing;
628
522
  }
523
+ return true;
629
524
  }
630
- return true;
631
- }
632
- }
633
- }
634
- return false;
635
- };
636
- const divide = (nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division) => {
637
- const bF = bStart - aStart;
638
- const bR = bEnd - aEnd;
639
- const aLength = aEnd - aStart;
640
- const bLength = bEnd - bStart;
641
- const baDeltaLength = bLength - aLength;
642
- let iMaxF = aLength;
643
- let iMaxR = aLength;
644
- aIndexesF[0] = aStart - 1;
645
- aIndexesR[0] = aEnd;
646
- if (baDeltaLength % 2 === 0) {
647
- const dMin = (nChange || baDeltaLength) / 2;
648
- const dMax = (aLength + bLength) / 2;
649
- for (let d = 1; d <= dMax; d += 1) {
650
- iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
651
- if (d < dMin) {
652
- iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
653
- } else if (
654
- // If a reverse path overlaps a forward path in the same diagonal,
655
- // return a division of the index intervals at the middle change.
656
- extendOverlappablePathsR(
657
- d,
658
- aStart,
659
- aEnd,
660
- bStart,
661
- bEnd,
662
- isCommon,
663
- aIndexesF,
664
- iMaxF,
665
- aIndexesR,
666
- iMaxR,
667
- division
668
- )
669
- ) {
670
- return;
671
525
  }
672
526
  }
673
- } else {
674
- const dMin = ((nChange || baDeltaLength) + 1) / 2;
675
- const dMax = (aLength + bLength + 1) / 2;
676
- let d = 1;
677
- iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
678
- for (d += 1; d <= dMax; d += 1) {
679
- iMaxR = extendPathsR(
680
- d - 1,
527
+ return false;
528
+ };
529
+ const extendOverlappablePathsR = (d, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, iMaxF, aIndexesR, iMaxR, division) => {
530
+ const bR = bEnd - aEnd;
531
+ const aLength = aEnd - aStart;
532
+ const bLength = bEnd - bStart;
533
+ const baDeltaLength = bLength - aLength;
534
+ const kMinOverlapR = baDeltaLength - d;
535
+ const kMaxOverlapR = baDeltaLength + d;
536
+ let aIndexPrev1 = NOT_YET_SET;
537
+ const nR = d < iMaxR ? d : iMaxR;
538
+ for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
539
+ const insert = iR === 0 || iR !== d && aIndexesR[iR] < aIndexPrev1;
540
+ const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
541
+ const aFirst = insert ? aLastPrev : aLastPrev - 1;
542
+ const bFirst = bR + aFirst - kR;
543
+ const nCommonR = countCommonItemsR(
681
544
  aStart,
545
+ aFirst - 1,
682
546
  bStart,
683
- bR,
684
- isCommon,
685
- aIndexesR,
686
- iMaxR
547
+ bFirst - 1,
548
+ isCommon
687
549
  );
688
- if (d < dMin) {
550
+ const aLast = aFirst - nCommonR;
551
+ aIndexPrev1 = aIndexesR[iR];
552
+ aIndexesR[iR] = aLast;
553
+ if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
554
+ const iF = (d + (kR - baDeltaLength)) / 2;
555
+ if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
556
+ const bLast = bFirst - nCommonR;
557
+ division.nChangePreceding = d;
558
+ if (d === aLast + bLast - aStart - bStart) {
559
+ division.aEndPreceding = aStart;
560
+ division.bEndPreceding = bStart;
561
+ } else {
562
+ division.aEndPreceding = aLast;
563
+ division.bEndPreceding = bLast;
564
+ }
565
+ division.nCommonPreceding = nCommonR;
566
+ if (nCommonR !== 0) {
567
+ division.aCommonPreceding = aLast;
568
+ division.bCommonPreceding = bLast;
569
+ }
570
+ division.nChangeFollowing = d - 1;
571
+ if (d === 1) {
572
+ division.nCommonFollowing = 0;
573
+ division.aStartFollowing = aEnd;
574
+ division.bStartFollowing = bEnd;
575
+ } else {
576
+ const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
577
+ const nCommonF = countCommonItemsF(
578
+ aLastPrev,
579
+ aEnd,
580
+ bLastPrev,
581
+ bEnd,
582
+ isCommon
583
+ );
584
+ division.nCommonFollowing = nCommonF;
585
+ if (nCommonF !== 0) {
586
+ division.aCommonFollowing = aLastPrev;
587
+ division.bCommonFollowing = bLastPrev;
588
+ }
589
+ const aStartFollowing = aLastPrev + nCommonF;
590
+ const bStartFollowing = bLastPrev + nCommonF;
591
+ if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
592
+ division.aStartFollowing = aEnd;
593
+ division.bStartFollowing = bEnd;
594
+ } else {
595
+ division.aStartFollowing = aStartFollowing;
596
+ division.bStartFollowing = bStartFollowing;
597
+ }
598
+ }
599
+ return true;
600
+ }
601
+ }
602
+ }
603
+ return false;
604
+ };
605
+ const divide = (nChange, aStart, aEnd, bStart, bEnd, isCommon, aIndexesF, aIndexesR, division) => {
606
+ const bF = bStart - aStart;
607
+ const bR = bEnd - aEnd;
608
+ const aLength = aEnd - aStart;
609
+ const bLength = bEnd - bStart;
610
+ const baDeltaLength = bLength - aLength;
611
+ let iMaxF = aLength;
612
+ let iMaxR = aLength;
613
+ aIndexesF[0] = aStart - 1;
614
+ aIndexesR[0] = aEnd;
615
+ if (baDeltaLength % 2 === 0) {
616
+ const dMin = (nChange || baDeltaLength) / 2;
617
+ const dMax = (aLength + bLength) / 2;
618
+ for (let d = 1; d <= dMax; d += 1) {
689
619
  iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
690
- } else if (
691
- // If a forward path overlaps a reverse path in the same diagonal,
692
- // return a division of the index intervals at the middle change.
693
- extendOverlappablePathsF(
694
- d,
620
+ if (d < dMin) {
621
+ iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
622
+ } else if (
623
+ // If a reverse path overlaps a forward path in the same diagonal,
624
+ // return a division of the index intervals at the middle change.
625
+ extendOverlappablePathsR(
626
+ d,
627
+ aStart,
628
+ aEnd,
629
+ bStart,
630
+ bEnd,
631
+ isCommon,
632
+ aIndexesF,
633
+ iMaxF,
634
+ aIndexesR,
635
+ iMaxR,
636
+ division
637
+ )
638
+ ) {
639
+ return;
640
+ }
641
+ }
642
+ } else {
643
+ const dMin = ((nChange || baDeltaLength) + 1) / 2;
644
+ const dMax = (aLength + bLength + 1) / 2;
645
+ let d = 1;
646
+ iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
647
+ for (d += 1; d <= dMax; d += 1) {
648
+ iMaxR = extendPathsR(
649
+ d - 1,
695
650
  aStart,
696
- aEnd,
697
651
  bStart,
698
- bEnd,
652
+ bR,
699
653
  isCommon,
700
- aIndexesF,
701
- iMaxF,
702
654
  aIndexesR,
703
- iMaxR,
704
- division
705
- )
706
- ) {
707
- return;
655
+ iMaxR
656
+ );
657
+ if (d < dMin) {
658
+ iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
659
+ } else if (
660
+ // If a forward path overlaps a reverse path in the same diagonal,
661
+ // return a division of the index intervals at the middle change.
662
+ extendOverlappablePathsF(
663
+ d,
664
+ aStart,
665
+ aEnd,
666
+ bStart,
667
+ bEnd,
668
+ isCommon,
669
+ aIndexesF,
670
+ iMaxF,
671
+ aIndexesR,
672
+ iMaxR,
673
+ division
674
+ )
675
+ ) {
676
+ return;
677
+ }
708
678
  }
709
679
  }
710
- }
711
- throw new Error(
712
- `${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`
713
- );
714
- };
715
- const findSubsequences = (nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division) => {
716
- if (bEnd - bStart < aEnd - aStart) {
717
- transposed = !transposed;
718
- if (transposed && callbacks.length === 1) {
719
- const { foundSubsequence: foundSubsequence2, isCommon: isCommon2 } = callbacks[0];
720
- callbacks[1] = {
721
- foundSubsequence: (nCommon, bCommon, aCommon) => {
722
- foundSubsequence2(nCommon, aCommon, bCommon);
723
- },
724
- isCommon: (bIndex, aIndex) => isCommon2(aIndex, bIndex)
725
- };
680
+ throw new Error(
681
+ `${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`
682
+ );
683
+ };
684
+ const findSubsequences = (nChange, aStart, aEnd, bStart, bEnd, transposed, callbacks, aIndexesF, aIndexesR, division) => {
685
+ if (bEnd - bStart < aEnd - aStart) {
686
+ transposed = !transposed;
687
+ if (transposed && callbacks.length === 1) {
688
+ const { foundSubsequence: foundSubsequence2, isCommon: isCommon2 } = callbacks[0];
689
+ callbacks[1] = {
690
+ foundSubsequence: (nCommon, bCommon, aCommon) => {
691
+ foundSubsequence2(nCommon, aCommon, bCommon);
692
+ },
693
+ isCommon: (bIndex, aIndex) => isCommon2(aIndex, bIndex)
694
+ };
695
+ }
696
+ const tStart = aStart;
697
+ const tEnd = aEnd;
698
+ aStart = bStart;
699
+ aEnd = bEnd;
700
+ bStart = tStart;
701
+ bEnd = tEnd;
726
702
  }
727
- const tStart = aStart;
728
- const tEnd = aEnd;
729
- aStart = bStart;
730
- aEnd = bEnd;
731
- bStart = tStart;
732
- bEnd = tEnd;
733
- }
734
- const { foundSubsequence, isCommon } = callbacks[transposed ? 1 : 0];
735
- divide(
736
- nChange,
737
- aStart,
738
- aEnd,
739
- bStart,
740
- bEnd,
741
- isCommon,
742
- aIndexesF,
743
- aIndexesR,
744
- division
745
- );
746
- const {
747
- nChangePreceding,
748
- aEndPreceding,
749
- bEndPreceding,
750
- nCommonPreceding,
751
- aCommonPreceding,
752
- bCommonPreceding,
753
- nCommonFollowing,
754
- aCommonFollowing,
755
- bCommonFollowing,
756
- nChangeFollowing,
757
- aStartFollowing,
758
- bStartFollowing
759
- } = division;
760
- if (aStart < aEndPreceding && bStart < bEndPreceding) {
761
- findSubsequences(
762
- nChangePreceding,
703
+ const { foundSubsequence, isCommon } = callbacks[transposed ? 1 : 0];
704
+ divide(
705
+ nChange,
763
706
  aStart,
764
- aEndPreceding,
707
+ aEnd,
765
708
  bStart,
766
- bEndPreceding,
767
- transposed,
768
- callbacks,
709
+ bEnd,
710
+ isCommon,
769
711
  aIndexesF,
770
712
  aIndexesR,
771
713
  division
772
714
  );
773
- }
774
- if (nCommonPreceding !== 0) {
775
- foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
776
- }
777
- if (nCommonFollowing !== 0) {
778
- foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
779
- }
780
- if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
781
- findSubsequences(
715
+ const {
716
+ nChangePreceding,
717
+ aEndPreceding,
718
+ bEndPreceding,
719
+ nCommonPreceding,
720
+ aCommonPreceding,
721
+ bCommonPreceding,
722
+ nCommonFollowing,
723
+ aCommonFollowing,
724
+ bCommonFollowing,
782
725
  nChangeFollowing,
783
726
  aStartFollowing,
784
- aEnd,
785
- bStartFollowing,
786
- bEnd,
787
- transposed,
788
- callbacks,
789
- aIndexesF,
790
- aIndexesR,
791
- division
792
- );
793
- }
794
- };
795
- const validateLength = (name, arg) => {
796
- if (typeof arg !== "number") {
797
- throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
798
- }
799
- if (!Number.isSafeInteger(arg)) {
800
- throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
801
- }
802
- if (arg < 0) {
803
- throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
804
- }
805
- };
806
- const validateCallback = (name, arg) => {
807
- const type = typeof arg;
808
- if (type !== "function") {
809
- throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
810
- }
811
- };
812
- function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
813
- validateLength("aLength", aLength);
814
- validateLength("bLength", bLength);
815
- validateCallback("isCommon", isCommon);
816
- validateCallback("foundSubsequence", foundSubsequence);
817
- const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
818
- if (nCommonF !== 0) {
819
- foundSubsequence(nCommonF, 0, 0);
820
- }
821
- if (aLength !== nCommonF || bLength !== nCommonF) {
822
- const aStart = nCommonF;
823
- const bStart = nCommonF;
824
- const nCommonR = countCommonItemsR(
825
- aStart,
826
- aLength - 1,
827
- bStart,
828
- bLength - 1,
829
- isCommon
830
- );
831
- const aEnd = aLength - nCommonR;
832
- const bEnd = bLength - nCommonR;
833
- const nCommonFR = nCommonF + nCommonR;
834
- if (aLength !== nCommonFR && bLength !== nCommonFR) {
835
- const nChange = 0;
836
- const transposed = false;
837
- const callbacks = [
838
- {
839
- foundSubsequence,
840
- isCommon
841
- }
842
- ];
843
- const aIndexesF = [NOT_YET_SET];
844
- const aIndexesR = [NOT_YET_SET];
845
- const division = {
846
- aCommonFollowing: NOT_YET_SET,
847
- aCommonPreceding: NOT_YET_SET,
848
- aEndPreceding: NOT_YET_SET,
849
- aStartFollowing: NOT_YET_SET,
850
- bCommonFollowing: NOT_YET_SET,
851
- bCommonPreceding: NOT_YET_SET,
852
- bEndPreceding: NOT_YET_SET,
853
- bStartFollowing: NOT_YET_SET,
854
- nChangeFollowing: NOT_YET_SET,
855
- nChangePreceding: NOT_YET_SET,
856
- nCommonFollowing: NOT_YET_SET,
857
- nCommonPreceding: NOT_YET_SET
858
- };
727
+ bStartFollowing
728
+ } = division;
729
+ if (aStart < aEndPreceding && bStart < bEndPreceding) {
859
730
  findSubsequences(
860
- nChange,
731
+ nChangePreceding,
861
732
  aStart,
862
- aEnd,
733
+ aEndPreceding,
863
734
  bStart,
735
+ bEndPreceding,
736
+ transposed,
737
+ callbacks,
738
+ aIndexesF,
739
+ aIndexesR,
740
+ division
741
+ );
742
+ }
743
+ if (nCommonPreceding !== 0) {
744
+ foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
745
+ }
746
+ if (nCommonFollowing !== 0) {
747
+ foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
748
+ }
749
+ if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
750
+ findSubsequences(
751
+ nChangeFollowing,
752
+ aStartFollowing,
753
+ aEnd,
754
+ bStartFollowing,
864
755
  bEnd,
865
756
  transposed,
866
757
  callbacks,
@@ -869,11 +760,93 @@ function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
869
760
  division
870
761
  );
871
762
  }
872
- if (nCommonR !== 0) {
873
- foundSubsequence(nCommonR, aEnd, bEnd);
763
+ };
764
+ const validateLength = (name, arg) => {
765
+ if (typeof arg !== "number") {
766
+ throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
767
+ }
768
+ if (!Number.isSafeInteger(arg)) {
769
+ throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
770
+ }
771
+ if (arg < 0) {
772
+ throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
773
+ }
774
+ };
775
+ const validateCallback = (name, arg) => {
776
+ const type = typeof arg;
777
+ if (type !== "function") {
778
+ throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
779
+ }
780
+ };
781
+ function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
782
+ validateLength("aLength", aLength);
783
+ validateLength("bLength", bLength);
784
+ validateCallback("isCommon", isCommon);
785
+ validateCallback("foundSubsequence", foundSubsequence);
786
+ const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
787
+ if (nCommonF !== 0) {
788
+ foundSubsequence(nCommonF, 0, 0);
789
+ }
790
+ if (aLength !== nCommonF || bLength !== nCommonF) {
791
+ const aStart = nCommonF;
792
+ const bStart = nCommonF;
793
+ const nCommonR = countCommonItemsR(
794
+ aStart,
795
+ aLength - 1,
796
+ bStart,
797
+ bLength - 1,
798
+ isCommon
799
+ );
800
+ const aEnd = aLength - nCommonR;
801
+ const bEnd = bLength - nCommonR;
802
+ const nCommonFR = nCommonF + nCommonR;
803
+ if (aLength !== nCommonFR && bLength !== nCommonFR) {
804
+ const nChange = 0;
805
+ const transposed = false;
806
+ const callbacks = [
807
+ {
808
+ foundSubsequence,
809
+ isCommon
810
+ }
811
+ ];
812
+ const aIndexesF = [NOT_YET_SET];
813
+ const aIndexesR = [NOT_YET_SET];
814
+ const division = {
815
+ aCommonFollowing: NOT_YET_SET,
816
+ aCommonPreceding: NOT_YET_SET,
817
+ aEndPreceding: NOT_YET_SET,
818
+ aStartFollowing: NOT_YET_SET,
819
+ bCommonFollowing: NOT_YET_SET,
820
+ bCommonPreceding: NOT_YET_SET,
821
+ bEndPreceding: NOT_YET_SET,
822
+ bStartFollowing: NOT_YET_SET,
823
+ nChangeFollowing: NOT_YET_SET,
824
+ nChangePreceding: NOT_YET_SET,
825
+ nCommonFollowing: NOT_YET_SET,
826
+ nCommonPreceding: NOT_YET_SET
827
+ };
828
+ findSubsequences(
829
+ nChange,
830
+ aStart,
831
+ aEnd,
832
+ bStart,
833
+ bEnd,
834
+ transposed,
835
+ callbacks,
836
+ aIndexesF,
837
+ aIndexesR,
838
+ division
839
+ );
840
+ }
841
+ if (nCommonR !== 0) {
842
+ foundSubsequence(nCommonR, aEnd, bEnd);
843
+ }
874
844
  }
875
845
  }
846
+ return build;
876
847
  }
848
+ var buildExports = requireBuild();
849
+ var diffSequences = /* @__PURE__ */ getDefaultExportFromCjs(buildExports);
877
850
  function formatTrailingSpaces(line, trailingSpaceFormatter) {
878
851
  return line.replace(/\s+$/, (match) => trailingSpaceFormatter(match));
879
852
  }
@@ -1251,7 +1224,7 @@ function diffLinesRaw(aLines, bLines, options) {
1251
1224
  diffs.push(new Diff(DIFF_EQUAL, bLines[bIndex]));
1252
1225
  }
1253
1226
  };
1254
- _default(aLength, bLength, isCommon, foundSubsequence);
1227
+ diffSequences(aLength, bLength, isCommon, foundSubsequence);
1255
1228
  for (; aIndex !== aLength; aIndex += 1) {
1256
1229
  diffs.push(new Diff(DIFF_DELETE, aLines[aIndex]));
1257
1230
  }
@@ -1260,6 +1233,41 @@ function diffLinesRaw(aLines, bLines, options) {
1260
1233
  }
1261
1234
  return [diffs, truncated];
1262
1235
  }
1236
+ function getType(value) {
1237
+ if (value === void 0) {
1238
+ return "undefined";
1239
+ } else if (value === null) {
1240
+ return "null";
1241
+ } else if (Array.isArray(value)) {
1242
+ return "array";
1243
+ } else if (typeof value === "boolean") {
1244
+ return "boolean";
1245
+ } else if (typeof value === "function") {
1246
+ return "function";
1247
+ } else if (typeof value === "number") {
1248
+ return "number";
1249
+ } else if (typeof value === "string") {
1250
+ return "string";
1251
+ } else if (typeof value === "bigint") {
1252
+ return "bigint";
1253
+ } else if (typeof value === "object") {
1254
+ if (value != null) {
1255
+ if (value.constructor === RegExp) {
1256
+ return "regexp";
1257
+ } else if (value.constructor === Map) {
1258
+ return "map";
1259
+ } else if (value.constructor === Set) {
1260
+ return "set";
1261
+ } else if (value.constructor === Date) {
1262
+ return "date";
1263
+ }
1264
+ }
1265
+ return "object";
1266
+ } else if (typeof value === "symbol") {
1267
+ return "symbol";
1268
+ }
1269
+ throw new Error(`value of unknown type: ${value}`);
1270
+ }
1263
1271
  function getNewLineSymbol(string) {
1264
1272
  return string.includes("\r\n") ? "\r\n" : "\n";
1265
1273
  }
@@ -1299,7 +1307,7 @@ function diffStrings(a, b, options) {
1299
1307
  bIndex = bCommon + nCommon;
1300
1308
  diffs.push(new Diff(DIFF_EQUAL, b.slice(bCommon, bIndex)));
1301
1309
  };
1302
- _default(aLength, bLength, isCommon, foundSubsequence);
1310
+ diffSequences(aLength, bLength, isCommon, foundSubsequence);
1303
1311
  if (aIndex !== aLength) {
1304
1312
  diffs.push(new Diff(DIFF_DELETE, a.slice(aIndex)));
1305
1313
  }