ibm-cloud-sdk-core 4.3.3 → 4.3.4

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 (457) hide show
  1. package/iamtest.env +3 -0
  2. package/package.json +2 -2
  3. package/sdk-test-utilities/node_modules/.package-lock.json +508 -0
  4. package/sdk-test-utilities/node_modules/@babel/code-frame/LICENSE +22 -0
  5. package/sdk-test-utilities/node_modules/@babel/code-frame/README.md +19 -0
  6. package/sdk-test-utilities/node_modules/@babel/code-frame/lib/index.js +156 -0
  7. package/sdk-test-utilities/node_modules/@babel/code-frame/lib/index.js.map +1 -0
  8. package/sdk-test-utilities/node_modules/@babel/code-frame/package.json +30 -0
  9. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/LICENSE +22 -0
  10. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/README.md +19 -0
  11. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/identifier.js +70 -0
  12. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/identifier.js.map +1 -0
  13. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/index.js +57 -0
  14. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/index.js.map +1 -0
  15. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/keyword.js +35 -0
  16. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/lib/keyword.js.map +1 -0
  17. package/sdk-test-utilities/node_modules/@babel/helper-validator-identifier/package.json +31 -0
  18. package/sdk-test-utilities/node_modules/@babel/highlight/LICENSE +22 -0
  19. package/sdk-test-utilities/node_modules/@babel/highlight/README.md +19 -0
  20. package/sdk-test-utilities/node_modules/@babel/highlight/lib/index.js +119 -0
  21. package/sdk-test-utilities/node_modules/@babel/highlight/lib/index.js.map +1 -0
  22. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/index.js +165 -0
  23. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/license +9 -0
  24. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/package.json +56 -0
  25. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/ansi-styles/readme.md +147 -0
  26. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/index.js +228 -0
  27. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/index.js.flow +93 -0
  28. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/license +9 -0
  29. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/package.json +71 -0
  30. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/readme.md +314 -0
  31. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/templates.js +128 -0
  32. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/chalk/types/index.d.ts +97 -0
  33. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/CHANGELOG.md +54 -0
  34. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/LICENSE +21 -0
  35. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/README.md +68 -0
  36. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/conversions.js +868 -0
  37. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/index.js +78 -0
  38. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/package.json +46 -0
  39. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-convert/route.js +97 -0
  40. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/.eslintrc.json +43 -0
  41. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/LICENSE +8 -0
  42. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/README.md +11 -0
  43. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/index.js +152 -0
  44. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/package.json +25 -0
  45. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/color-name/test.js +7 -0
  46. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/index.js +11 -0
  47. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/license +21 -0
  48. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/package.json +41 -0
  49. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/escape-string-regexp/readme.md +27 -0
  50. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/index.js +8 -0
  51. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/license +9 -0
  52. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/package.json +44 -0
  53. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/has-flag/readme.md +70 -0
  54. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/browser.js +5 -0
  55. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/index.js +131 -0
  56. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/license +9 -0
  57. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/package.json +53 -0
  58. package/sdk-test-utilities/node_modules/@babel/highlight/node_modules/supports-color/readme.md +66 -0
  59. package/sdk-test-utilities/node_modules/@babel/highlight/package.json +30 -0
  60. package/sdk-test-utilities/node_modules/@jest/expect-utils/LICENSE +21 -0
  61. package/sdk-test-utilities/node_modules/@jest/expect-utils/README.md +5 -0
  62. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/immutableUtils.js +66 -0
  63. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/index.d.ts +94 -0
  64. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/index.js +34 -0
  65. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/jasmineUtils.js +218 -0
  66. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/types.js +1 -0
  67. package/sdk-test-utilities/node_modules/@jest/expect-utils/build/utils.js +462 -0
  68. package/sdk-test-utilities/node_modules/@jest/expect-utils/package.json +35 -0
  69. package/sdk-test-utilities/node_modules/@jest/schemas/LICENSE +21 -0
  70. package/sdk-test-utilities/node_modules/@jest/schemas/README.md +3 -0
  71. package/sdk-test-utilities/node_modules/@jest/schemas/build/index.d.ts +63 -0
  72. package/sdk-test-utilities/node_modules/@jest/schemas/build/index.js +60 -0
  73. package/sdk-test-utilities/node_modules/@jest/schemas/package.json +29 -0
  74. package/sdk-test-utilities/node_modules/@jest/types/LICENSE +21 -0
  75. package/sdk-test-utilities/node_modules/@jest/types/README.md +30 -0
  76. package/sdk-test-utilities/node_modules/@jest/types/build/Circus.js +1 -0
  77. package/sdk-test-utilities/node_modules/@jest/types/build/Config.js +1 -0
  78. package/sdk-test-utilities/node_modules/@jest/types/build/Global.js +1 -0
  79. package/sdk-test-utilities/node_modules/@jest/types/build/TestResult.js +1 -0
  80. package/sdk-test-utilities/node_modules/@jest/types/build/index.d.ts +1204 -0
  81. package/sdk-test-utilities/node_modules/@jest/types/build/index.js +1 -0
  82. package/sdk-test-utilities/node_modules/@jest/types/package.json +38 -0
  83. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/compiler.d.ts +35 -0
  84. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/compiler.js +577 -0
  85. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/index.d.ts +2 -0
  86. package/sdk-test-utilities/node_modules/@sinclair/typebox/compiler/index.js +47 -0
  87. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/errors.d.ts +88 -0
  88. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/errors.js +609 -0
  89. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/index.d.ts +1 -0
  90. package/sdk-test-utilities/node_modules/@sinclair/typebox/errors/index.js +44 -0
  91. package/sdk-test-utilities/node_modules/@sinclair/typebox/license +23 -0
  92. package/sdk-test-utilities/node_modules/@sinclair/typebox/package.json +47 -0
  93. package/sdk-test-utilities/node_modules/@sinclair/typebox/readme.md +1424 -0
  94. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/index.d.ts +1 -0
  95. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/index.js +44 -0
  96. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/system.d.ts +26 -0
  97. package/sdk-test-utilities/node_modules/@sinclair/typebox/system/system.js +90 -0
  98. package/sdk-test-utilities/node_modules/@sinclair/typebox/typebox.d.ts +723 -0
  99. package/sdk-test-utilities/node_modules/@sinclair/typebox/typebox.js +2220 -0
  100. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/cast.d.ts +30 -0
  101. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/cast.js +372 -0
  102. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/check.d.ts +12 -0
  103. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/check.js +484 -0
  104. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/clone.d.ts +3 -0
  105. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/clone.js +71 -0
  106. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/convert.d.ts +13 -0
  107. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/convert.js +372 -0
  108. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/create.d.ts +26 -0
  109. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/create.js +480 -0
  110. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/delta.d.ts +43 -0
  111. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/delta.js +204 -0
  112. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/equal.d.ts +3 -0
  113. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/equal.js +80 -0
  114. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/hash.d.ts +8 -0
  115. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/hash.js +208 -0
  116. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/index.d.ts +6 -0
  117. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/index.js +56 -0
  118. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/is.d.ts +11 -0
  119. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/is.js +53 -0
  120. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/mutate.d.ts +13 -0
  121. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/mutate.js +121 -0
  122. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/pointer.d.ts +24 -0
  123. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/pointer.js +142 -0
  124. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/value.d.ts +39 -0
  125. package/sdk-test-utilities/node_modules/@sinclair/typebox/value/value.js +99 -0
  126. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/LICENSE +21 -0
  127. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/README.md +15 -0
  128. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/index.d.ts +111 -0
  129. package/sdk-test-utilities/node_modules/@types/istanbul-lib-coverage/package.json +25 -0
  130. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/LICENSE +21 -0
  131. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/README.md +15 -0
  132. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/index.d.ts +184 -0
  133. package/sdk-test-utilities/node_modules/@types/istanbul-lib-report/package.json +32 -0
  134. package/sdk-test-utilities/node_modules/@types/istanbul-reports/LICENSE +21 -0
  135. package/sdk-test-utilities/node_modules/@types/istanbul-reports/README.md +86 -0
  136. package/sdk-test-utilities/node_modules/@types/istanbul-reports/index.d.ts +67 -0
  137. package/sdk-test-utilities/node_modules/@types/istanbul-reports/package.json +32 -0
  138. package/sdk-test-utilities/node_modules/@types/node/LICENSE +21 -0
  139. package/sdk-test-utilities/node_modules/@types/node/README.md +15 -0
  140. package/sdk-test-utilities/node_modules/@types/node/assert/strict.d.ts +8 -0
  141. package/sdk-test-utilities/node_modules/@types/node/assert.d.ts +1040 -0
  142. package/sdk-test-utilities/node_modules/@types/node/async_hooks.d.ts +541 -0
  143. package/sdk-test-utilities/node_modules/@types/node/buffer.d.ts +2363 -0
  144. package/sdk-test-utilities/node_modules/@types/node/child_process.d.ts +1544 -0
  145. package/sdk-test-utilities/node_modules/@types/node/cluster.d.ts +578 -0
  146. package/sdk-test-utilities/node_modules/@types/node/console.d.ts +452 -0
  147. package/sdk-test-utilities/node_modules/@types/node/constants.d.ts +19 -0
  148. package/sdk-test-utilities/node_modules/@types/node/crypto.d.ts +4523 -0
  149. package/sdk-test-utilities/node_modules/@types/node/dgram.d.ts +596 -0
  150. package/sdk-test-utilities/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
  151. package/sdk-test-utilities/node_modules/@types/node/dns/promises.d.ts +474 -0
  152. package/sdk-test-utilities/node_modules/@types/node/dns.d.ts +864 -0
  153. package/sdk-test-utilities/node_modules/@types/node/dom-events.d.ts +124 -0
  154. package/sdk-test-utilities/node_modules/@types/node/domain.d.ts +170 -0
  155. package/sdk-test-utilities/node_modules/@types/node/events.d.ts +909 -0
  156. package/sdk-test-utilities/node_modules/@types/node/fs/promises.d.ts +1245 -0
  157. package/sdk-test-utilities/node_modules/@types/node/fs.d.ts +4317 -0
  158. package/sdk-test-utilities/node_modules/@types/node/globals.d.ts +411 -0
  159. package/sdk-test-utilities/node_modules/@types/node/globals.global.d.ts +1 -0
  160. package/sdk-test-utilities/node_modules/@types/node/http.d.ts +1908 -0
  161. package/sdk-test-utilities/node_modules/@types/node/http2.d.ts +2418 -0
  162. package/sdk-test-utilities/node_modules/@types/node/https.d.ts +550 -0
  163. package/sdk-test-utilities/node_modules/@types/node/index.d.ts +89 -0
  164. package/sdk-test-utilities/node_modules/@types/node/inspector.d.ts +2746 -0
  165. package/sdk-test-utilities/node_modules/@types/node/module.d.ts +315 -0
  166. package/sdk-test-utilities/node_modules/@types/node/net.d.ts +999 -0
  167. package/sdk-test-utilities/node_modules/@types/node/os.d.ts +495 -0
  168. package/sdk-test-utilities/node_modules/@types/node/package.json +217 -0
  169. package/sdk-test-utilities/node_modules/@types/node/path.d.ts +191 -0
  170. package/sdk-test-utilities/node_modules/@types/node/perf_hooks.d.ts +905 -0
  171. package/sdk-test-utilities/node_modules/@types/node/process.d.ts +1754 -0
  172. package/sdk-test-utilities/node_modules/@types/node/punycode.d.ts +117 -0
  173. package/sdk-test-utilities/node_modules/@types/node/querystring.d.ts +153 -0
  174. package/sdk-test-utilities/node_modules/@types/node/readline/promises.d.ts +150 -0
  175. package/sdk-test-utilities/node_modules/@types/node/readline.d.ts +540 -0
  176. package/sdk-test-utilities/node_modules/@types/node/repl.d.ts +430 -0
  177. package/sdk-test-utilities/node_modules/@types/node/sea.d.ts +153 -0
  178. package/sdk-test-utilities/node_modules/@types/node/stream/consumers.d.ts +12 -0
  179. package/sdk-test-utilities/node_modules/@types/node/stream/promises.d.ts +83 -0
  180. package/sdk-test-utilities/node_modules/@types/node/stream/web.d.ts +367 -0
  181. package/sdk-test-utilities/node_modules/@types/node/stream.d.ts +1707 -0
  182. package/sdk-test-utilities/node_modules/@types/node/string_decoder.d.ts +67 -0
  183. package/sdk-test-utilities/node_modules/@types/node/test.d.ts +1718 -0
  184. package/sdk-test-utilities/node_modules/@types/node/timers/promises.d.ts +97 -0
  185. package/sdk-test-utilities/node_modules/@types/node/timers.d.ts +240 -0
  186. package/sdk-test-utilities/node_modules/@types/node/tls.d.ts +1217 -0
  187. package/sdk-test-utilities/node_modules/@types/node/trace_events.d.ts +197 -0
  188. package/sdk-test-utilities/node_modules/@types/node/tty.d.ts +208 -0
  189. package/sdk-test-utilities/node_modules/@types/node/url.d.ts +952 -0
  190. package/sdk-test-utilities/node_modules/@types/node/util.d.ts +2292 -0
  191. package/sdk-test-utilities/node_modules/@types/node/v8.d.ts +808 -0
  192. package/sdk-test-utilities/node_modules/@types/node/vm.d.ts +924 -0
  193. package/sdk-test-utilities/node_modules/@types/node/wasi.d.ts +181 -0
  194. package/sdk-test-utilities/node_modules/@types/node/worker_threads.d.ts +691 -0
  195. package/sdk-test-utilities/node_modules/@types/node/zlib.d.ts +530 -0
  196. package/sdk-test-utilities/node_modules/@types/stack-utils/LICENSE +21 -0
  197. package/sdk-test-utilities/node_modules/@types/stack-utils/README.md +78 -0
  198. package/sdk-test-utilities/node_modules/@types/stack-utils/index.d.ts +59 -0
  199. package/sdk-test-utilities/node_modules/@types/stack-utils/package.json +25 -0
  200. package/sdk-test-utilities/node_modules/@types/yargs/LICENSE +21 -0
  201. package/sdk-test-utilities/node_modules/@types/yargs/README.md +15 -0
  202. package/sdk-test-utilities/node_modules/@types/yargs/helpers.d.mts +1 -0
  203. package/sdk-test-utilities/node_modules/@types/yargs/helpers.d.ts +5 -0
  204. package/sdk-test-utilities/node_modules/@types/yargs/index.d.mts +46 -0
  205. package/sdk-test-utilities/node_modules/@types/yargs/index.d.ts +1031 -0
  206. package/sdk-test-utilities/node_modules/@types/yargs/package.json +87 -0
  207. package/sdk-test-utilities/node_modules/@types/yargs/yargs.d.ts +9 -0
  208. package/sdk-test-utilities/node_modules/@types/yargs-parser/LICENSE +21 -0
  209. package/sdk-test-utilities/node_modules/@types/yargs-parser/README.md +15 -0
  210. package/sdk-test-utilities/node_modules/@types/yargs-parser/index.d.ts +112 -0
  211. package/sdk-test-utilities/node_modules/@types/yargs-parser/package.json +25 -0
  212. package/sdk-test-utilities/node_modules/ansi-styles/index.d.ts +345 -0
  213. package/sdk-test-utilities/node_modules/ansi-styles/index.js +163 -0
  214. package/sdk-test-utilities/node_modules/ansi-styles/license +9 -0
  215. package/sdk-test-utilities/node_modules/ansi-styles/package.json +56 -0
  216. package/sdk-test-utilities/node_modules/ansi-styles/readme.md +152 -0
  217. package/sdk-test-utilities/node_modules/braces/LICENSE +21 -0
  218. package/sdk-test-utilities/node_modules/braces/README.md +586 -0
  219. package/sdk-test-utilities/node_modules/braces/index.js +170 -0
  220. package/sdk-test-utilities/node_modules/braces/lib/compile.js +60 -0
  221. package/sdk-test-utilities/node_modules/braces/lib/constants.js +57 -0
  222. package/sdk-test-utilities/node_modules/braces/lib/expand.js +113 -0
  223. package/sdk-test-utilities/node_modules/braces/lib/parse.js +331 -0
  224. package/sdk-test-utilities/node_modules/braces/lib/stringify.js +32 -0
  225. package/sdk-test-utilities/node_modules/braces/lib/utils.js +122 -0
  226. package/sdk-test-utilities/node_modules/braces/package.json +77 -0
  227. package/sdk-test-utilities/node_modules/chalk/index.d.ts +415 -0
  228. package/sdk-test-utilities/node_modules/chalk/license +9 -0
  229. package/sdk-test-utilities/node_modules/chalk/package.json +68 -0
  230. package/sdk-test-utilities/node_modules/chalk/readme.md +341 -0
  231. package/sdk-test-utilities/node_modules/chalk/source/index.js +229 -0
  232. package/sdk-test-utilities/node_modules/chalk/source/templates.js +134 -0
  233. package/sdk-test-utilities/node_modules/chalk/source/util.js +39 -0
  234. package/sdk-test-utilities/node_modules/ci-info/CHANGELOG.md +178 -0
  235. package/sdk-test-utilities/node_modules/ci-info/LICENSE +21 -0
  236. package/sdk-test-utilities/node_modules/ci-info/README.md +135 -0
  237. package/sdk-test-utilities/node_modules/ci-info/index.d.ts +75 -0
  238. package/sdk-test-utilities/node_modules/ci-info/index.js +90 -0
  239. package/sdk-test-utilities/node_modules/ci-info/package.json +45 -0
  240. package/sdk-test-utilities/node_modules/ci-info/vendors.json +321 -0
  241. package/sdk-test-utilities/node_modules/color-convert/CHANGELOG.md +54 -0
  242. package/sdk-test-utilities/node_modules/color-convert/LICENSE +21 -0
  243. package/sdk-test-utilities/node_modules/color-convert/README.md +68 -0
  244. package/sdk-test-utilities/node_modules/color-convert/conversions.js +839 -0
  245. package/sdk-test-utilities/node_modules/color-convert/index.js +81 -0
  246. package/sdk-test-utilities/node_modules/color-convert/package.json +48 -0
  247. package/sdk-test-utilities/node_modules/color-convert/route.js +97 -0
  248. package/sdk-test-utilities/node_modules/color-name/LICENSE +8 -0
  249. package/sdk-test-utilities/node_modules/color-name/README.md +11 -0
  250. package/sdk-test-utilities/node_modules/color-name/index.js +152 -0
  251. package/sdk-test-utilities/node_modules/color-name/package.json +28 -0
  252. package/sdk-test-utilities/node_modules/diff-sequences/LICENSE +21 -0
  253. package/sdk-test-utilities/node_modules/diff-sequences/README.md +404 -0
  254. package/sdk-test-utilities/node_modules/diff-sequences/build/index.d.ts +38 -0
  255. package/sdk-test-utilities/node_modules/diff-sequences/build/index.js +798 -0
  256. package/sdk-test-utilities/node_modules/diff-sequences/package.json +39 -0
  257. package/sdk-test-utilities/node_modules/escape-string-regexp/index.d.ts +18 -0
  258. package/sdk-test-utilities/node_modules/escape-string-regexp/index.js +11 -0
  259. package/sdk-test-utilities/node_modules/escape-string-regexp/license +9 -0
  260. package/sdk-test-utilities/node_modules/escape-string-regexp/package.json +43 -0
  261. package/sdk-test-utilities/node_modules/escape-string-regexp/readme.md +29 -0
  262. package/sdk-test-utilities/node_modules/expect/LICENSE +21 -0
  263. package/sdk-test-utilities/node_modules/expect/README.md +3 -0
  264. package/sdk-test-utilities/node_modules/expect/build/asymmetricMatchers.js +375 -0
  265. package/sdk-test-utilities/node_modules/expect/build/extractExpectedAssertionsErrors.js +86 -0
  266. package/sdk-test-utilities/node_modules/expect/build/index.d.ts +370 -0
  267. package/sdk-test-utilities/node_modules/expect/build/index.js +410 -0
  268. package/sdk-test-utilities/node_modules/expect/build/jestMatchersObject.js +123 -0
  269. package/sdk-test-utilities/node_modules/expect/build/matchers.js +1292 -0
  270. package/sdk-test-utilities/node_modules/expect/build/print.js +122 -0
  271. package/sdk-test-utilities/node_modules/expect/build/spyMatchers.js +1254 -0
  272. package/sdk-test-utilities/node_modules/expect/build/toThrowMatchers.js +481 -0
  273. package/sdk-test-utilities/node_modules/expect/build/types.js +3 -0
  274. package/sdk-test-utilities/node_modules/expect/package.json +43 -0
  275. package/sdk-test-utilities/node_modules/fill-range/LICENSE +21 -0
  276. package/sdk-test-utilities/node_modules/fill-range/README.md +237 -0
  277. package/sdk-test-utilities/node_modules/fill-range/index.js +248 -0
  278. package/sdk-test-utilities/node_modules/fill-range/package.json +74 -0
  279. package/sdk-test-utilities/node_modules/graceful-fs/LICENSE +15 -0
  280. package/sdk-test-utilities/node_modules/graceful-fs/README.md +143 -0
  281. package/sdk-test-utilities/node_modules/graceful-fs/clone.js +23 -0
  282. package/sdk-test-utilities/node_modules/graceful-fs/graceful-fs.js +448 -0
  283. package/sdk-test-utilities/node_modules/graceful-fs/legacy-streams.js +118 -0
  284. package/sdk-test-utilities/node_modules/graceful-fs/package.json +53 -0
  285. package/sdk-test-utilities/node_modules/graceful-fs/polyfills.js +355 -0
  286. package/sdk-test-utilities/node_modules/has-flag/index.d.ts +39 -0
  287. package/sdk-test-utilities/node_modules/has-flag/index.js +8 -0
  288. package/sdk-test-utilities/node_modules/has-flag/license +9 -0
  289. package/sdk-test-utilities/node_modules/has-flag/package.json +46 -0
  290. package/sdk-test-utilities/node_modules/has-flag/readme.md +89 -0
  291. package/sdk-test-utilities/node_modules/is-number/LICENSE +21 -0
  292. package/sdk-test-utilities/node_modules/is-number/README.md +187 -0
  293. package/sdk-test-utilities/node_modules/is-number/index.js +18 -0
  294. package/sdk-test-utilities/node_modules/is-number/package.json +82 -0
  295. package/sdk-test-utilities/node_modules/jest-diff/LICENSE +21 -0
  296. package/sdk-test-utilities/node_modules/jest-diff/README.md +671 -0
  297. package/sdk-test-utilities/node_modules/jest-diff/build/cleanupSemantic.js +599 -0
  298. package/sdk-test-utilities/node_modules/jest-diff/build/constants.js +19 -0
  299. package/sdk-test-utilities/node_modules/jest-diff/build/diffLines.js +193 -0
  300. package/sdk-test-utilities/node_modules/jest-diff/build/diffStrings.js +66 -0
  301. package/sdk-test-utilities/node_modules/jest-diff/build/getAlignedDiffs.js +223 -0
  302. package/sdk-test-utilities/node_modules/jest-diff/build/index.d.ts +93 -0
  303. package/sdk-test-utilities/node_modules/jest-diff/build/index.js +232 -0
  304. package/sdk-test-utilities/node_modules/jest-diff/build/joinAlignedDiffs.js +271 -0
  305. package/sdk-test-utilities/node_modules/jest-diff/build/normalizeDiffOptions.js +59 -0
  306. package/sdk-test-utilities/node_modules/jest-diff/build/printDiffs.js +79 -0
  307. package/sdk-test-utilities/node_modules/jest-diff/build/types.js +1 -0
  308. package/sdk-test-utilities/node_modules/jest-diff/package.json +36 -0
  309. package/sdk-test-utilities/node_modules/jest-get-type/LICENSE +21 -0
  310. package/sdk-test-utilities/node_modules/jest-get-type/build/index.d.ts +27 -0
  311. package/sdk-test-utilities/node_modules/jest-get-type/build/index.js +53 -0
  312. package/sdk-test-utilities/node_modules/jest-get-type/package.json +27 -0
  313. package/sdk-test-utilities/node_modules/jest-matcher-utils/LICENSE +21 -0
  314. package/sdk-test-utilities/node_modules/jest-matcher-utils/README.md +24 -0
  315. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/Replaceable.js +64 -0
  316. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/deepCyclicCopyReplaceable.js +111 -0
  317. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/index.d.ts +138 -0
  318. package/sdk-test-utilities/node_modules/jest-matcher-utils/build/index.js +542 -0
  319. package/sdk-test-utilities/node_modules/jest-matcher-utils/package.json +37 -0
  320. package/sdk-test-utilities/node_modules/jest-message-util/LICENSE +21 -0
  321. package/sdk-test-utilities/node_modules/jest-message-util/build/index.d.ts +68 -0
  322. package/sdk-test-utilities/node_modules/jest-message-util/build/index.js +518 -0
  323. package/sdk-test-utilities/node_modules/jest-message-util/build/types.js +1 -0
  324. package/sdk-test-utilities/node_modules/jest-message-util/package.json +43 -0
  325. package/sdk-test-utilities/node_modules/jest-util/LICENSE +21 -0
  326. package/sdk-test-utilities/node_modules/jest-util/Readme.md +87 -0
  327. package/sdk-test-utilities/node_modules/jest-util/build/ErrorWithStack.js +28 -0
  328. package/sdk-test-utilities/node_modules/jest-util/build/clearLine.js +18 -0
  329. package/sdk-test-utilities/node_modules/jest-util/build/convertDescriptorToString.js +30 -0
  330. package/sdk-test-utilities/node_modules/jest-util/build/createDirectory.js +71 -0
  331. package/sdk-test-utilities/node_modules/jest-util/build/createProcessObject.js +109 -0
  332. package/sdk-test-utilities/node_modules/jest-util/build/deepCyclicCopy.js +76 -0
  333. package/sdk-test-utilities/node_modules/jest-util/build/formatTime.js +24 -0
  334. package/sdk-test-utilities/node_modules/jest-util/build/globsToMatcher.js +98 -0
  335. package/sdk-test-utilities/node_modules/jest-util/build/index.d.ts +136 -0
  336. package/sdk-test-utilities/node_modules/jest-util/build/index.js +199 -0
  337. package/sdk-test-utilities/node_modules/jest-util/build/installCommonGlobals.js +115 -0
  338. package/sdk-test-utilities/node_modules/jest-util/build/interopRequireDefault.js +22 -0
  339. package/sdk-test-utilities/node_modules/jest-util/build/invariant.js +18 -0
  340. package/sdk-test-utilities/node_modules/jest-util/build/isInteractive.js +22 -0
  341. package/sdk-test-utilities/node_modules/jest-util/build/isNonNullable.js +16 -0
  342. package/sdk-test-utilities/node_modules/jest-util/build/isPromise.js +20 -0
  343. package/sdk-test-utilities/node_modules/jest-util/build/pluralize.js +16 -0
  344. package/sdk-test-utilities/node_modules/jest-util/build/preRunMessage.js +38 -0
  345. package/sdk-test-utilities/node_modules/jest-util/build/replacePathSepForGlob.js +16 -0
  346. package/sdk-test-utilities/node_modules/jest-util/build/requireOrImportModule.js +77 -0
  347. package/sdk-test-utilities/node_modules/jest-util/build/setGlobal.js +17 -0
  348. package/sdk-test-utilities/node_modules/jest-util/build/specialChars.js +25 -0
  349. package/sdk-test-utilities/node_modules/jest-util/build/testPathPatternToRegExp.js +19 -0
  350. package/sdk-test-utilities/node_modules/jest-util/build/tryRealpath.js +30 -0
  351. package/sdk-test-utilities/node_modules/jest-util/package.json +38 -0
  352. package/sdk-test-utilities/node_modules/js-tokens/CHANGELOG.md +151 -0
  353. package/sdk-test-utilities/node_modules/js-tokens/LICENSE +21 -0
  354. package/sdk-test-utilities/node_modules/js-tokens/README.md +240 -0
  355. package/sdk-test-utilities/node_modules/js-tokens/index.js +23 -0
  356. package/sdk-test-utilities/node_modules/js-tokens/package.json +30 -0
  357. package/sdk-test-utilities/node_modules/micromatch/LICENSE +21 -0
  358. package/sdk-test-utilities/node_modules/micromatch/README.md +1017 -0
  359. package/sdk-test-utilities/node_modules/micromatch/index.js +467 -0
  360. package/sdk-test-utilities/node_modules/micromatch/package.json +101 -0
  361. package/sdk-test-utilities/node_modules/picocolors/LICENSE +15 -0
  362. package/sdk-test-utilities/node_modules/picocolors/README.md +21 -0
  363. package/sdk-test-utilities/node_modules/picocolors/package.json +25 -0
  364. package/sdk-test-utilities/node_modules/picocolors/picocolors.browser.js +4 -0
  365. package/sdk-test-utilities/node_modules/picocolors/picocolors.d.ts +5 -0
  366. package/sdk-test-utilities/node_modules/picocolors/picocolors.js +65 -0
  367. package/sdk-test-utilities/node_modules/picomatch/CHANGELOG.md +136 -0
  368. package/sdk-test-utilities/node_modules/picomatch/LICENSE +21 -0
  369. package/sdk-test-utilities/node_modules/picomatch/README.md +708 -0
  370. package/sdk-test-utilities/node_modules/picomatch/index.js +3 -0
  371. package/sdk-test-utilities/node_modules/picomatch/lib/constants.js +179 -0
  372. package/sdk-test-utilities/node_modules/picomatch/lib/parse.js +1091 -0
  373. package/sdk-test-utilities/node_modules/picomatch/lib/picomatch.js +342 -0
  374. package/sdk-test-utilities/node_modules/picomatch/lib/scan.js +391 -0
  375. package/sdk-test-utilities/node_modules/picomatch/lib/utils.js +64 -0
  376. package/sdk-test-utilities/node_modules/picomatch/package.json +81 -0
  377. package/sdk-test-utilities/node_modules/pretty-format/LICENSE +21 -0
  378. package/sdk-test-utilities/node_modules/pretty-format/README.md +463 -0
  379. package/sdk-test-utilities/node_modules/pretty-format/build/collections.js +180 -0
  380. package/sdk-test-utilities/node_modules/pretty-format/build/index.d.ts +163 -0
  381. package/sdk-test-utilities/node_modules/pretty-format/build/index.js +478 -0
  382. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/AsymmetricMatcher.js +89 -0
  383. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/DOMCollection.js +67 -0
  384. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/DOMElement.js +101 -0
  385. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/Immutable.js +217 -0
  386. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/ReactElement.js +143 -0
  387. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/ReactTestComponent.js +66 -0
  388. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/lib/escapeHTML.js +16 -0
  389. package/sdk-test-utilities/node_modules/pretty-format/build/plugins/lib/markup.js +113 -0
  390. package/sdk-test-utilities/node_modules/pretty-format/build/types.js +1 -0
  391. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/index.d.ts +167 -0
  392. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/index.js +164 -0
  393. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/license +9 -0
  394. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/package.json +52 -0
  395. package/sdk-test-utilities/node_modules/pretty-format/node_modules/ansi-styles/readme.md +144 -0
  396. package/sdk-test-utilities/node_modules/pretty-format/package.json +43 -0
  397. package/sdk-test-utilities/node_modules/react-is/LICENSE +21 -0
  398. package/sdk-test-utilities/node_modules/react-is/README.md +104 -0
  399. package/sdk-test-utilities/node_modules/react-is/cjs/react-is.development.js +221 -0
  400. package/sdk-test-utilities/node_modules/react-is/cjs/react-is.production.min.js +14 -0
  401. package/sdk-test-utilities/node_modules/react-is/index.js +7 -0
  402. package/sdk-test-utilities/node_modules/react-is/package.json +26 -0
  403. package/sdk-test-utilities/node_modules/react-is/umd/react-is.development.js +220 -0
  404. package/sdk-test-utilities/node_modules/react-is/umd/react-is.production.min.js +15 -0
  405. package/sdk-test-utilities/node_modules/slash/index.d.ts +25 -0
  406. package/sdk-test-utilities/node_modules/slash/index.js +11 -0
  407. package/sdk-test-utilities/node_modules/slash/license +9 -0
  408. package/sdk-test-utilities/node_modules/slash/package.json +35 -0
  409. package/sdk-test-utilities/node_modules/slash/readme.md +44 -0
  410. package/sdk-test-utilities/node_modules/stack-utils/LICENSE.md +21 -0
  411. package/sdk-test-utilities/node_modules/stack-utils/index.js +344 -0
  412. package/sdk-test-utilities/node_modules/stack-utils/package.json +39 -0
  413. package/sdk-test-utilities/node_modules/stack-utils/readme.md +143 -0
  414. package/sdk-test-utilities/node_modules/supports-color/browser.js +5 -0
  415. package/sdk-test-utilities/node_modules/supports-color/index.js +135 -0
  416. package/sdk-test-utilities/node_modules/supports-color/license +9 -0
  417. package/sdk-test-utilities/node_modules/supports-color/package.json +53 -0
  418. package/sdk-test-utilities/node_modules/supports-color/readme.md +76 -0
  419. package/sdk-test-utilities/node_modules/to-regex-range/LICENSE +21 -0
  420. package/sdk-test-utilities/node_modules/to-regex-range/README.md +305 -0
  421. package/sdk-test-utilities/node_modules/to-regex-range/index.js +288 -0
  422. package/sdk-test-utilities/node_modules/to-regex-range/package.json +88 -0
  423. package/sdk-test-utilities/node_modules/undici-types/README.md +6 -0
  424. package/sdk-test-utilities/node_modules/undici-types/agent.d.ts +31 -0
  425. package/sdk-test-utilities/node_modules/undici-types/api.d.ts +43 -0
  426. package/sdk-test-utilities/node_modules/undici-types/balanced-pool.d.ts +18 -0
  427. package/sdk-test-utilities/node_modules/undici-types/cache.d.ts +36 -0
  428. package/sdk-test-utilities/node_modules/undici-types/client.d.ts +97 -0
  429. package/sdk-test-utilities/node_modules/undici-types/connector.d.ts +34 -0
  430. package/sdk-test-utilities/node_modules/undici-types/content-type.d.ts +21 -0
  431. package/sdk-test-utilities/node_modules/undici-types/cookies.d.ts +28 -0
  432. package/sdk-test-utilities/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
  433. package/sdk-test-utilities/node_modules/undici-types/dispatcher.d.ts +241 -0
  434. package/sdk-test-utilities/node_modules/undici-types/errors.d.ts +128 -0
  435. package/sdk-test-utilities/node_modules/undici-types/fetch.d.ts +209 -0
  436. package/sdk-test-utilities/node_modules/undici-types/file.d.ts +39 -0
  437. package/sdk-test-utilities/node_modules/undici-types/filereader.d.ts +54 -0
  438. package/sdk-test-utilities/node_modules/undici-types/formdata.d.ts +108 -0
  439. package/sdk-test-utilities/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  440. package/sdk-test-utilities/node_modules/undici-types/global-origin.d.ts +7 -0
  441. package/sdk-test-utilities/node_modules/undici-types/handlers.d.ts +9 -0
  442. package/sdk-test-utilities/node_modules/undici-types/header.d.ts +4 -0
  443. package/sdk-test-utilities/node_modules/undici-types/index.d.ts +63 -0
  444. package/sdk-test-utilities/node_modules/undici-types/interceptors.d.ts +5 -0
  445. package/sdk-test-utilities/node_modules/undici-types/mock-agent.d.ts +50 -0
  446. package/sdk-test-utilities/node_modules/undici-types/mock-client.d.ts +25 -0
  447. package/sdk-test-utilities/node_modules/undici-types/mock-errors.d.ts +12 -0
  448. package/sdk-test-utilities/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  449. package/sdk-test-utilities/node_modules/undici-types/mock-pool.d.ts +25 -0
  450. package/sdk-test-utilities/node_modules/undici-types/package.json +55 -0
  451. package/sdk-test-utilities/node_modules/undici-types/patch.d.ts +71 -0
  452. package/sdk-test-utilities/node_modules/undici-types/pool-stats.d.ts +19 -0
  453. package/sdk-test-utilities/node_modules/undici-types/pool.d.ts +28 -0
  454. package/sdk-test-utilities/node_modules/undici-types/proxy-agent.d.ts +30 -0
  455. package/sdk-test-utilities/node_modules/undici-types/readable.d.ts +61 -0
  456. package/sdk-test-utilities/node_modules/undici-types/webidl.d.ts +220 -0
  457. package/sdk-test-utilities/node_modules/undici-types/websocket.d.ts +131 -0
@@ -0,0 +1,798 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', {
4
+ value: true
5
+ });
6
+ exports.default = diffSequence;
7
+ /**
8
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
9
+ *
10
+ * This source code is licensed under the MIT license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ *
13
+ */
14
+
15
+ // This diff-sequences package implements the linear space variation in
16
+ // An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers
17
+
18
+ // Relationship in notation between Myers paper and this package:
19
+ // A is a
20
+ // N is aLength, aEnd - aStart, and so on
21
+ // x is aIndex, aFirst, aLast, and so on
22
+ // B is b
23
+ // M is bLength, bEnd - bStart, and so on
24
+ // y is bIndex, bFirst, bLast, and so on
25
+ // Δ = N - M is negative of baDeltaLength = bLength - aLength
26
+ // D is d
27
+ // k is kF
28
+ // k + Δ is kF = kR - baDeltaLength
29
+ // V is aIndexesF or aIndexesR (see comment below about Indexes type)
30
+ // index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength)
31
+ // starting point in forward direction (0, 0) is (-1, -1)
32
+ // starting point in reverse direction (N + 1, M + 1) is (aLength, bLength)
33
+
34
+ // The “edit graph” for sequences a and b corresponds to items:
35
+ // in a on the horizontal axis
36
+ // in b on the vertical axis
37
+ //
38
+ // Given a-coordinate of a point in a diagonal, you can compute b-coordinate.
39
+ //
40
+ // Forward diagonals kF:
41
+ // zero diagonal intersects top left corner
42
+ // positive diagonals intersect top edge
43
+ // negative diagonals insersect left edge
44
+ //
45
+ // Reverse diagonals kR:
46
+ // zero diagonal intersects bottom right corner
47
+ // positive diagonals intersect right edge
48
+ // negative diagonals intersect bottom edge
49
+
50
+ // The graph contains a directed acyclic graph of edges:
51
+ // horizontal: delete an item from a
52
+ // vertical: insert an item from b
53
+ // diagonal: common item in a and b
54
+ //
55
+ // The algorithm solves dual problems in the graph analogy:
56
+ // Find longest common subsequence: path with maximum number of diagonal edges
57
+ // Find shortest edit script: path with minimum number of non-diagonal edges
58
+
59
+ // Input callback function compares items at indexes in the sequences.
60
+
61
+ // Output callback function receives the number of adjacent items
62
+ // and starting indexes of each common subsequence.
63
+ // Either original functions or wrapped to swap indexes if graph is transposed.
64
+ // Indexes in sequence a of last point of forward or reverse paths in graph.
65
+ // Myers algorithm indexes by diagonal k which for negative is bad deopt in V8.
66
+ // This package indexes by iF and iR which are greater than or equal to zero.
67
+ // and also updates the index arrays in place to cut memory in half.
68
+ // kF = 2 * iF - d
69
+ // kR = d - 2 * iR
70
+ // Division of index intervals in sequences a and b at the middle change.
71
+ // Invariant: intervals do not have common items at the start or end.
72
+ const pkg = 'diff-sequences'; // for error messages
73
+ const NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8
74
+
75
+ // Return the number of common items that follow in forward direction.
76
+ // The length of what Myers paper calls a “snake” in a forward path.
77
+ const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => {
78
+ let nCommon = 0;
79
+ while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) {
80
+ aIndex += 1;
81
+ bIndex += 1;
82
+ nCommon += 1;
83
+ }
84
+ return nCommon;
85
+ };
86
+
87
+ // Return the number of common items that precede in reverse direction.
88
+ // The length of what Myers paper calls a “snake” in a reverse path.
89
+ const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => {
90
+ let nCommon = 0;
91
+ while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) {
92
+ aIndex -= 1;
93
+ bIndex -= 1;
94
+ nCommon += 1;
95
+ }
96
+ return nCommon;
97
+ };
98
+
99
+ // A simple function to extend forward paths from (d - 1) to d changes
100
+ // when forward and reverse paths cannot yet overlap.
101
+ const extendPathsF = (
102
+ d,
103
+ aEnd,
104
+ bEnd,
105
+ bF,
106
+ isCommon,
107
+ aIndexesF,
108
+ iMaxF // return the value because optimization might decrease it
109
+ ) => {
110
+ // Unroll the first iteration.
111
+ let iF = 0;
112
+ let kF = -d; // kF = 2 * iF - d
113
+ let aFirst = aIndexesF[iF]; // in first iteration always insert
114
+ let aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration
115
+ aIndexesF[iF] += countCommonItemsF(
116
+ aFirst + 1,
117
+ aEnd,
118
+ bF + aFirst - kF + 1,
119
+ bEnd,
120
+ isCommon
121
+ );
122
+
123
+ // Optimization: skip diagonals in which paths cannot ever overlap.
124
+ const nF = d < iMaxF ? d : iMaxF;
125
+
126
+ // The diagonals kF are odd when d is odd and even when d is even.
127
+ for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) {
128
+ // To get first point of path segment, move one change in forward direction
129
+ // from last point of previous path segment in an adjacent diagonal.
130
+ // In last possible iteration when iF === d and kF === d always delete.
131
+ if (iF !== d && aIndexPrev1 < aIndexesF[iF]) {
132
+ aFirst = aIndexesF[iF]; // vertical to insert from b
133
+ } else {
134
+ aFirst = aIndexPrev1 + 1; // horizontal to delete from a
135
+
136
+ if (aEnd <= aFirst) {
137
+ // Optimization: delete moved past right of graph.
138
+ return iF - 1;
139
+ }
140
+ }
141
+
142
+ // To get last point of path segment, move along diagonal of common items.
143
+ aIndexPrev1 = aIndexesF[iF];
144
+ aIndexesF[iF] =
145
+ aFirst +
146
+ countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon);
147
+ }
148
+ return iMaxF;
149
+ };
150
+
151
+ // A simple function to extend reverse paths from (d - 1) to d changes
152
+ // when reverse and forward paths cannot yet overlap.
153
+ const extendPathsR = (
154
+ d,
155
+ aStart,
156
+ bStart,
157
+ bR,
158
+ isCommon,
159
+ aIndexesR,
160
+ iMaxR // return the value because optimization might decrease it
161
+ ) => {
162
+ // Unroll the first iteration.
163
+ let iR = 0;
164
+ let kR = d; // kR = d - 2 * iR
165
+ let aFirst = aIndexesR[iR]; // in first iteration always insert
166
+ let aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration
167
+ aIndexesR[iR] -= countCommonItemsR(
168
+ aStart,
169
+ aFirst - 1,
170
+ bStart,
171
+ bR + aFirst - kR - 1,
172
+ isCommon
173
+ );
174
+
175
+ // Optimization: skip diagonals in which paths cannot ever overlap.
176
+ const nR = d < iMaxR ? d : iMaxR;
177
+
178
+ // The diagonals kR are odd when d is odd and even when d is even.
179
+ for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) {
180
+ // To get first point of path segment, move one change in reverse direction
181
+ // from last point of previous path segment in an adjacent diagonal.
182
+ // In last possible iteration when iR === d and kR === -d always delete.
183
+ if (iR !== d && aIndexesR[iR] < aIndexPrev1) {
184
+ aFirst = aIndexesR[iR]; // vertical to insert from b
185
+ } else {
186
+ aFirst = aIndexPrev1 - 1; // horizontal to delete from a
187
+
188
+ if (aFirst < aStart) {
189
+ // Optimization: delete moved past left of graph.
190
+ return iR - 1;
191
+ }
192
+ }
193
+
194
+ // To get last point of path segment, move along diagonal of common items.
195
+ aIndexPrev1 = aIndexesR[iR];
196
+ aIndexesR[iR] =
197
+ aFirst -
198
+ countCommonItemsR(
199
+ aStart,
200
+ aFirst - 1,
201
+ bStart,
202
+ bR + aFirst - kR - 1,
203
+ isCommon
204
+ );
205
+ }
206
+ return iMaxR;
207
+ };
208
+
209
+ // A complete function to extend forward paths from (d - 1) to d changes.
210
+ // Return true if a path overlaps reverse path of (d - 1) changes in its diagonal.
211
+ const extendOverlappablePathsF = (
212
+ d,
213
+ aStart,
214
+ aEnd,
215
+ bStart,
216
+ bEnd,
217
+ isCommon,
218
+ aIndexesF,
219
+ iMaxF,
220
+ aIndexesR,
221
+ iMaxR,
222
+ division // update prop values if return true
223
+ ) => {
224
+ const bF = bStart - aStart; // bIndex = bF + aIndex - kF
225
+ const aLength = aEnd - aStart;
226
+ const bLength = bEnd - bStart;
227
+ const baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength
228
+
229
+ // Range of diagonals in which forward and reverse paths might overlap.
230
+ const kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR
231
+ const kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1)
232
+
233
+ let aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration
234
+
235
+ // Optimization: skip diagonals in which paths cannot ever overlap.
236
+ const nF = d < iMaxF ? d : iMaxF;
237
+
238
+ // The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even.
239
+ for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) {
240
+ // To get first point of path segment, move one change in forward direction
241
+ // from last point of previous path segment in an adjacent diagonal.
242
+ // In first iteration when iF === 0 and kF === -d always insert.
243
+ // In last possible iteration when iF === d and kF === d always delete.
244
+ const insert = iF === 0 || (iF !== d && aIndexPrev1 < aIndexesF[iF]);
245
+ const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1;
246
+ const aFirst = insert
247
+ ? aLastPrev // vertical to insert from b
248
+ : aLastPrev + 1; // horizontal to delete from a
249
+
250
+ // To get last point of path segment, move along diagonal of common items.
251
+ const bFirst = bF + aFirst - kF;
252
+ const nCommonF = countCommonItemsF(
253
+ aFirst + 1,
254
+ aEnd,
255
+ bFirst + 1,
256
+ bEnd,
257
+ isCommon
258
+ );
259
+ const aLast = aFirst + nCommonF;
260
+ aIndexPrev1 = aIndexesF[iF];
261
+ aIndexesF[iF] = aLast;
262
+ if (kMinOverlapF <= kF && kF <= kMaxOverlapF) {
263
+ // Solve for iR of reverse path with (d - 1) changes in diagonal kF:
264
+ // kR = kF + baDeltaLength
265
+ // kR = (d - 1) - 2 * iR
266
+ const iR = (d - 1 - (kF + baDeltaLength)) / 2;
267
+
268
+ // If this forward path overlaps the reverse path in this diagonal,
269
+ // then this is the middle change of the index intervals.
270
+ if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) {
271
+ // Unlike the Myers algorithm which finds only the middle “snake”
272
+ // this package can find two common subsequences per division.
273
+ // Last point of previous path segment is on an adjacent diagonal.
274
+ const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1);
275
+
276
+ // Because of invariant that intervals preceding the middle change
277
+ // cannot have common items at the end,
278
+ // move in reverse direction along a diagonal of common items.
279
+ const nCommonR = countCommonItemsR(
280
+ aStart,
281
+ aLastPrev,
282
+ bStart,
283
+ bLastPrev,
284
+ isCommon
285
+ );
286
+ const aIndexPrevFirst = aLastPrev - nCommonR;
287
+ const bIndexPrevFirst = bLastPrev - nCommonR;
288
+ const aEndPreceding = aIndexPrevFirst + 1;
289
+ const bEndPreceding = bIndexPrevFirst + 1;
290
+ division.nChangePreceding = d - 1;
291
+ if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) {
292
+ // Optimization: number of preceding changes in forward direction
293
+ // is equal to number of items in preceding interval,
294
+ // therefore it cannot contain any common items.
295
+ division.aEndPreceding = aStart;
296
+ division.bEndPreceding = bStart;
297
+ } else {
298
+ division.aEndPreceding = aEndPreceding;
299
+ division.bEndPreceding = bEndPreceding;
300
+ }
301
+ division.nCommonPreceding = nCommonR;
302
+ if (nCommonR !== 0) {
303
+ division.aCommonPreceding = aEndPreceding;
304
+ division.bCommonPreceding = bEndPreceding;
305
+ }
306
+ division.nCommonFollowing = nCommonF;
307
+ if (nCommonF !== 0) {
308
+ division.aCommonFollowing = aFirst + 1;
309
+ division.bCommonFollowing = bFirst + 1;
310
+ }
311
+ const aStartFollowing = aLast + 1;
312
+ const bStartFollowing = bFirst + nCommonF + 1;
313
+ division.nChangeFollowing = d - 1;
314
+ if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
315
+ // Optimization: number of changes in reverse direction
316
+ // is equal to number of items in following interval,
317
+ // therefore it cannot contain any common items.
318
+ division.aStartFollowing = aEnd;
319
+ division.bStartFollowing = bEnd;
320
+ } else {
321
+ division.aStartFollowing = aStartFollowing;
322
+ division.bStartFollowing = bStartFollowing;
323
+ }
324
+ return true;
325
+ }
326
+ }
327
+ }
328
+ return false;
329
+ };
330
+
331
+ // A complete function to extend reverse paths from (d - 1) to d changes.
332
+ // Return true if a path overlaps forward path of d changes in its diagonal.
333
+ const extendOverlappablePathsR = (
334
+ d,
335
+ aStart,
336
+ aEnd,
337
+ bStart,
338
+ bEnd,
339
+ isCommon,
340
+ aIndexesF,
341
+ iMaxF,
342
+ aIndexesR,
343
+ iMaxR,
344
+ division // update prop values if return true
345
+ ) => {
346
+ const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
347
+ const aLength = aEnd - aStart;
348
+ const bLength = bEnd - bStart;
349
+ const baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength
350
+
351
+ // Range of diagonals in which forward and reverse paths might overlap.
352
+ const kMinOverlapR = baDeltaLength - d; // -d <= kF
353
+ const kMaxOverlapR = baDeltaLength + d; // kF <= d
354
+
355
+ let aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration
356
+
357
+ // Optimization: skip diagonals in which paths cannot ever overlap.
358
+ const nR = d < iMaxR ? d : iMaxR;
359
+
360
+ // The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even.
361
+ for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) {
362
+ // To get first point of path segment, move one change in reverse direction
363
+ // from last point of previous path segment in an adjacent diagonal.
364
+ // In first iteration when iR === 0 and kR === d always insert.
365
+ // In last possible iteration when iR === d and kR === -d always delete.
366
+ const insert = iR === 0 || (iR !== d && aIndexesR[iR] < aIndexPrev1);
367
+ const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1;
368
+ const aFirst = insert
369
+ ? aLastPrev // vertical to insert from b
370
+ : aLastPrev - 1; // horizontal to delete from a
371
+
372
+ // To get last point of path segment, move along diagonal of common items.
373
+ const bFirst = bR + aFirst - kR;
374
+ const nCommonR = countCommonItemsR(
375
+ aStart,
376
+ aFirst - 1,
377
+ bStart,
378
+ bFirst - 1,
379
+ isCommon
380
+ );
381
+ const aLast = aFirst - nCommonR;
382
+ aIndexPrev1 = aIndexesR[iR];
383
+ aIndexesR[iR] = aLast;
384
+ if (kMinOverlapR <= kR && kR <= kMaxOverlapR) {
385
+ // Solve for iF of forward path with d changes in diagonal kR:
386
+ // kF = kR - baDeltaLength
387
+ // kF = 2 * iF - d
388
+ const iF = (d + (kR - baDeltaLength)) / 2;
389
+
390
+ // If this reverse path overlaps the forward path in this diagonal,
391
+ // then this is a middle change of the index intervals.
392
+ if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) {
393
+ const bLast = bFirst - nCommonR;
394
+ division.nChangePreceding = d;
395
+ if (d === aLast + bLast - aStart - bStart) {
396
+ // Optimization: number of changes in reverse direction
397
+ // is equal to number of items in preceding interval,
398
+ // therefore it cannot contain any common items.
399
+ division.aEndPreceding = aStart;
400
+ division.bEndPreceding = bStart;
401
+ } else {
402
+ division.aEndPreceding = aLast;
403
+ division.bEndPreceding = bLast;
404
+ }
405
+ division.nCommonPreceding = nCommonR;
406
+ if (nCommonR !== 0) {
407
+ // The last point of reverse path segment is start of common subsequence.
408
+ division.aCommonPreceding = aLast;
409
+ division.bCommonPreceding = bLast;
410
+ }
411
+ division.nChangeFollowing = d - 1;
412
+ if (d === 1) {
413
+ // There is no previous path segment.
414
+ division.nCommonFollowing = 0;
415
+ division.aStartFollowing = aEnd;
416
+ division.bStartFollowing = bEnd;
417
+ } else {
418
+ // Unlike the Myers algorithm which finds only the middle “snake”
419
+ // this package can find two common subsequences per division.
420
+ // Last point of previous path segment is on an adjacent diagonal.
421
+ const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1);
422
+
423
+ // Because of invariant that intervals following the middle change
424
+ // cannot have common items at the start,
425
+ // move in forward direction along a diagonal of common items.
426
+ const nCommonF = countCommonItemsF(
427
+ aLastPrev,
428
+ aEnd,
429
+ bLastPrev,
430
+ bEnd,
431
+ isCommon
432
+ );
433
+ division.nCommonFollowing = nCommonF;
434
+ if (nCommonF !== 0) {
435
+ // The last point of reverse path segment is start of common subsequence.
436
+ division.aCommonFollowing = aLastPrev;
437
+ division.bCommonFollowing = bLastPrev;
438
+ }
439
+ const aStartFollowing = aLastPrev + nCommonF; // aFirstPrev
440
+ const bStartFollowing = bLastPrev + nCommonF; // bFirstPrev
441
+
442
+ if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) {
443
+ // Optimization: number of changes in forward direction
444
+ // is equal to number of items in following interval,
445
+ // therefore it cannot contain any common items.
446
+ division.aStartFollowing = aEnd;
447
+ division.bStartFollowing = bEnd;
448
+ } else {
449
+ division.aStartFollowing = aStartFollowing;
450
+ division.bStartFollowing = bStartFollowing;
451
+ }
452
+ }
453
+ return true;
454
+ }
455
+ }
456
+ }
457
+ return false;
458
+ };
459
+
460
+ // Given index intervals and input function to compare items at indexes,
461
+ // divide at the middle change.
462
+ //
463
+ // DO NOT CALL if start === end, because interval cannot contain common items
464
+ // and because this function will throw the “no overlap” error.
465
+ const divide = (
466
+ nChange,
467
+ aStart,
468
+ aEnd,
469
+ bStart,
470
+ bEnd,
471
+ isCommon,
472
+ aIndexesF,
473
+ aIndexesR,
474
+ division // output
475
+ ) => {
476
+ const bF = bStart - aStart; // bIndex = bF + aIndex - kF
477
+ const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR
478
+ const aLength = aEnd - aStart;
479
+ const bLength = bEnd - bStart;
480
+
481
+ // Because graph has square or portrait orientation,
482
+ // length difference is minimum number of items to insert from b.
483
+ // Corresponding forward and reverse diagonals in graph
484
+ // depend on length difference of the sequences:
485
+ // kF = kR - baDeltaLength
486
+ // kR = kF + baDeltaLength
487
+ const baDeltaLength = bLength - aLength;
488
+
489
+ // Optimization: max diagonal in graph intersects corner of shorter side.
490
+ let iMaxF = aLength;
491
+ let iMaxR = aLength;
492
+
493
+ // Initialize no changes yet in forward or reverse direction:
494
+ aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start
495
+ aIndexesR[0] = aEnd; // at open end of interval
496
+
497
+ if (baDeltaLength % 2 === 0) {
498
+ // The number of changes in paths is 2 * d if length difference is even.
499
+ const dMin = (nChange || baDeltaLength) / 2;
500
+ const dMax = (aLength + bLength) / 2;
501
+ for (let d = 1; d <= dMax; d += 1) {
502
+ iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
503
+ if (d < dMin) {
504
+ iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR);
505
+ } else if (
506
+ // If a reverse path overlaps a forward path in the same diagonal,
507
+ // return a division of the index intervals at the middle change.
508
+ extendOverlappablePathsR(
509
+ d,
510
+ aStart,
511
+ aEnd,
512
+ bStart,
513
+ bEnd,
514
+ isCommon,
515
+ aIndexesF,
516
+ iMaxF,
517
+ aIndexesR,
518
+ iMaxR,
519
+ division
520
+ )
521
+ ) {
522
+ return;
523
+ }
524
+ }
525
+ } else {
526
+ // The number of changes in paths is 2 * d - 1 if length difference is odd.
527
+ const dMin = ((nChange || baDeltaLength) + 1) / 2;
528
+ const dMax = (aLength + bLength + 1) / 2;
529
+
530
+ // Unroll first half iteration so loop extends the relevant pairs of paths.
531
+ // Because of invariant that intervals have no common items at start or end,
532
+ // and limitation not to call divide with empty intervals,
533
+ // therefore it cannot be called if a forward path with one change
534
+ // would overlap a reverse path with no changes, even if dMin === 1.
535
+ let d = 1;
536
+ iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
537
+ for (d += 1; d <= dMax; d += 1) {
538
+ iMaxR = extendPathsR(
539
+ d - 1,
540
+ aStart,
541
+ bStart,
542
+ bR,
543
+ isCommon,
544
+ aIndexesR,
545
+ iMaxR
546
+ );
547
+ if (d < dMin) {
548
+ iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF);
549
+ } else if (
550
+ // If a forward path overlaps a reverse path in the same diagonal,
551
+ // return a division of the index intervals at the middle change.
552
+ extendOverlappablePathsF(
553
+ d,
554
+ aStart,
555
+ aEnd,
556
+ bStart,
557
+ bEnd,
558
+ isCommon,
559
+ aIndexesF,
560
+ iMaxF,
561
+ aIndexesR,
562
+ iMaxR,
563
+ division
564
+ )
565
+ ) {
566
+ return;
567
+ }
568
+ }
569
+ }
570
+
571
+ /* istanbul ignore next */
572
+ throw new Error(
573
+ `${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}`
574
+ );
575
+ };
576
+
577
+ // Given index intervals and input function to compare items at indexes,
578
+ // return by output function the number of adjacent items and starting indexes
579
+ // of each common subsequence. Divide and conquer with only linear space.
580
+ //
581
+ // The index intervals are half open [start, end) like array slice method.
582
+ // DO NOT CALL if start === end, because interval cannot contain common items
583
+ // and because divide function will throw the “no overlap” error.
584
+ const findSubsequences = (
585
+ nChange,
586
+ aStart,
587
+ aEnd,
588
+ bStart,
589
+ bEnd,
590
+ transposed,
591
+ callbacks,
592
+ aIndexesF,
593
+ aIndexesR,
594
+ division // temporary memory, not input nor output
595
+ ) => {
596
+ if (bEnd - bStart < aEnd - aStart) {
597
+ // Transpose graph so it has portrait instead of landscape orientation.
598
+ // Always compare shorter to longer sequence for consistency and optimization.
599
+ transposed = !transposed;
600
+ if (transposed && callbacks.length === 1) {
601
+ // Lazily wrap callback functions to swap args if graph is transposed.
602
+ const {foundSubsequence, isCommon} = callbacks[0];
603
+ callbacks[1] = {
604
+ foundSubsequence: (nCommon, bCommon, aCommon) => {
605
+ foundSubsequence(nCommon, aCommon, bCommon);
606
+ },
607
+ isCommon: (bIndex, aIndex) => isCommon(aIndex, bIndex)
608
+ };
609
+ }
610
+ const tStart = aStart;
611
+ const tEnd = aEnd;
612
+ aStart = bStart;
613
+ aEnd = bEnd;
614
+ bStart = tStart;
615
+ bEnd = tEnd;
616
+ }
617
+ const {foundSubsequence, isCommon} = callbacks[transposed ? 1 : 0];
618
+
619
+ // Divide the index intervals at the middle change.
620
+ divide(
621
+ nChange,
622
+ aStart,
623
+ aEnd,
624
+ bStart,
625
+ bEnd,
626
+ isCommon,
627
+ aIndexesF,
628
+ aIndexesR,
629
+ division
630
+ );
631
+ const {
632
+ nChangePreceding,
633
+ aEndPreceding,
634
+ bEndPreceding,
635
+ nCommonPreceding,
636
+ aCommonPreceding,
637
+ bCommonPreceding,
638
+ nCommonFollowing,
639
+ aCommonFollowing,
640
+ bCommonFollowing,
641
+ nChangeFollowing,
642
+ aStartFollowing,
643
+ bStartFollowing
644
+ } = division;
645
+
646
+ // Unless either index interval is empty, they might contain common items.
647
+ if (aStart < aEndPreceding && bStart < bEndPreceding) {
648
+ // Recursely find and return common subsequences preceding the division.
649
+ findSubsequences(
650
+ nChangePreceding,
651
+ aStart,
652
+ aEndPreceding,
653
+ bStart,
654
+ bEndPreceding,
655
+ transposed,
656
+ callbacks,
657
+ aIndexesF,
658
+ aIndexesR,
659
+ division
660
+ );
661
+ }
662
+
663
+ // Return common subsequences that are adjacent to the middle change.
664
+ if (nCommonPreceding !== 0) {
665
+ foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding);
666
+ }
667
+ if (nCommonFollowing !== 0) {
668
+ foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing);
669
+ }
670
+
671
+ // Unless either index interval is empty, they might contain common items.
672
+ if (aStartFollowing < aEnd && bStartFollowing < bEnd) {
673
+ // Recursely find and return common subsequences following the division.
674
+ findSubsequences(
675
+ nChangeFollowing,
676
+ aStartFollowing,
677
+ aEnd,
678
+ bStartFollowing,
679
+ bEnd,
680
+ transposed,
681
+ callbacks,
682
+ aIndexesF,
683
+ aIndexesR,
684
+ division
685
+ );
686
+ }
687
+ };
688
+ const validateLength = (name, arg) => {
689
+ if (typeof arg !== 'number') {
690
+ throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`);
691
+ }
692
+ if (!Number.isSafeInteger(arg)) {
693
+ throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`);
694
+ }
695
+ if (arg < 0) {
696
+ throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`);
697
+ }
698
+ };
699
+ const validateCallback = (name, arg) => {
700
+ const type = typeof arg;
701
+ if (type !== 'function') {
702
+ throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`);
703
+ }
704
+ };
705
+
706
+ // Compare items in two sequences to find a longest common subsequence.
707
+ // Given lengths of sequences and input function to compare items at indexes,
708
+ // return by output function the number of adjacent items and starting indexes
709
+ // of each common subsequence.
710
+ function diffSequence(aLength, bLength, isCommon, foundSubsequence) {
711
+ validateLength('aLength', aLength);
712
+ validateLength('bLength', bLength);
713
+ validateCallback('isCommon', isCommon);
714
+ validateCallback('foundSubsequence', foundSubsequence);
715
+
716
+ // Count common items from the start in the forward direction.
717
+ const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon);
718
+ if (nCommonF !== 0) {
719
+ foundSubsequence(nCommonF, 0, 0);
720
+ }
721
+
722
+ // Unless both sequences consist of common items only,
723
+ // find common items in the half-trimmed index intervals.
724
+ if (aLength !== nCommonF || bLength !== nCommonF) {
725
+ // Invariant: intervals do not have common items at the start.
726
+ // The start of an index interval is closed like array slice method.
727
+ const aStart = nCommonF;
728
+ const bStart = nCommonF;
729
+
730
+ // Count common items from the end in the reverse direction.
731
+ const nCommonR = countCommonItemsR(
732
+ aStart,
733
+ aLength - 1,
734
+ bStart,
735
+ bLength - 1,
736
+ isCommon
737
+ );
738
+
739
+ // Invariant: intervals do not have common items at the end.
740
+ // The end of an index interval is open like array slice method.
741
+ const aEnd = aLength - nCommonR;
742
+ const bEnd = bLength - nCommonR;
743
+
744
+ // Unless one sequence consists of common items only,
745
+ // therefore the other trimmed index interval consists of changes only,
746
+ // find common items in the trimmed index intervals.
747
+ const nCommonFR = nCommonF + nCommonR;
748
+ if (aLength !== nCommonFR && bLength !== nCommonFR) {
749
+ const nChange = 0; // number of change items is not yet known
750
+ const transposed = false; // call the original unwrapped functions
751
+ const callbacks = [
752
+ {
753
+ foundSubsequence,
754
+ isCommon
755
+ }
756
+ ];
757
+
758
+ // Indexes in sequence a of last points in furthest reaching paths
759
+ // from outside the start at top left in the forward direction:
760
+ const aIndexesF = [NOT_YET_SET];
761
+ // from the end at bottom right in the reverse direction:
762
+ const aIndexesR = [NOT_YET_SET];
763
+
764
+ // Initialize one object as output of all calls to divide function.
765
+ const division = {
766
+ aCommonFollowing: NOT_YET_SET,
767
+ aCommonPreceding: NOT_YET_SET,
768
+ aEndPreceding: NOT_YET_SET,
769
+ aStartFollowing: NOT_YET_SET,
770
+ bCommonFollowing: NOT_YET_SET,
771
+ bCommonPreceding: NOT_YET_SET,
772
+ bEndPreceding: NOT_YET_SET,
773
+ bStartFollowing: NOT_YET_SET,
774
+ nChangeFollowing: NOT_YET_SET,
775
+ nChangePreceding: NOT_YET_SET,
776
+ nCommonFollowing: NOT_YET_SET,
777
+ nCommonPreceding: NOT_YET_SET
778
+ };
779
+
780
+ // Find and return common subsequences in the trimmed index intervals.
781
+ findSubsequences(
782
+ nChange,
783
+ aStart,
784
+ aEnd,
785
+ bStart,
786
+ bEnd,
787
+ transposed,
788
+ callbacks,
789
+ aIndexesF,
790
+ aIndexesR,
791
+ division
792
+ );
793
+ }
794
+ if (nCommonR !== 0) {
795
+ foundSubsequence(nCommonR, aEnd, bEnd);
796
+ }
797
+ }
798
+ }