@fluidframework/merge-tree 2.0.0-rc.1.0.3 → 2.0.0-rc.2.0.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 (770) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +4 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +4 -0
  4. package/api-extractor-cjs.json +8 -0
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -9
  7. package/api-report/merge-tree.api.md +6 -12
  8. package/dist/MergeTreeTextHelper.d.ts +2 -2
  9. package/dist/MergeTreeTextHelper.d.ts.map +1 -1
  10. package/dist/MergeTreeTextHelper.js +3 -3
  11. package/dist/MergeTreeTextHelper.js.map +1 -1
  12. package/dist/attributionCollection.d.ts +1 -1
  13. package/dist/attributionCollection.d.ts.map +1 -1
  14. package/dist/attributionCollection.js.map +1 -1
  15. package/dist/attributionPolicy.d.ts +1 -1
  16. package/dist/attributionPolicy.d.ts.map +1 -1
  17. package/dist/attributionPolicy.js +15 -15
  18. package/dist/attributionPolicy.js.map +1 -1
  19. package/dist/client.d.ts +31 -12
  20. package/dist/client.d.ts.map +1 -1
  21. package/dist/client.js +103 -92
  22. package/dist/client.js.map +1 -1
  23. package/dist/collections/index.d.ts +2 -2
  24. package/dist/collections/index.d.ts.map +1 -1
  25. package/dist/collections/index.js +6 -6
  26. package/dist/collections/index.js.map +1 -1
  27. package/dist/endOfTreeSegment.d.ts +3 -3
  28. package/dist/endOfTreeSegment.d.ts.map +1 -1
  29. package/dist/endOfTreeSegment.js +8 -8
  30. package/dist/endOfTreeSegment.js.map +1 -1
  31. package/dist/index.d.ts +20 -20
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +71 -71
  34. package/dist/index.js.map +1 -1
  35. package/dist/localReference.d.ts +9 -39
  36. package/dist/localReference.d.ts.map +1 -1
  37. package/dist/localReference.js +29 -24
  38. package/dist/localReference.js.map +1 -1
  39. package/dist/merge-tree-alpha.d.ts +28 -450
  40. package/dist/merge-tree-beta.d.ts +0 -438
  41. package/dist/merge-tree-public.d.ts +0 -438
  42. package/dist/merge-tree-untrimmed.d.ts +28 -787
  43. package/dist/mergeTree.d.ts +11 -19
  44. package/dist/mergeTree.d.ts.map +1 -1
  45. package/dist/mergeTree.js +201 -189
  46. package/dist/mergeTree.js.map +1 -1
  47. package/dist/mergeTreeDeltaCallback.d.ts +3 -7
  48. package/dist/mergeTreeDeltaCallback.d.ts.map +1 -1
  49. package/dist/mergeTreeDeltaCallback.js.map +1 -1
  50. package/dist/mergeTreeNodeWalk.d.ts +1 -1
  51. package/dist/mergeTreeNodeWalk.d.ts.map +1 -1
  52. package/dist/mergeTreeNodeWalk.js.map +1 -1
  53. package/dist/mergeTreeNodes.d.ts +17 -14
  54. package/dist/mergeTreeNodes.d.ts.map +1 -1
  55. package/dist/mergeTreeNodes.js +32 -32
  56. package/dist/mergeTreeNodes.js.map +1 -1
  57. package/dist/mergeTreeTracking.d.ts +2 -2
  58. package/dist/mergeTreeTracking.d.ts.map +1 -1
  59. package/dist/mergeTreeTracking.js +2 -2
  60. package/dist/mergeTreeTracking.js.map +1 -1
  61. package/dist/opBuilder.d.ts +3 -3
  62. package/dist/opBuilder.d.ts.map +1 -1
  63. package/dist/opBuilder.js +7 -7
  64. package/dist/opBuilder.js.map +1 -1
  65. package/dist/package.json +3 -0
  66. package/dist/partialLengths.d.ts +5 -5
  67. package/dist/partialLengths.d.ts.map +1 -1
  68. package/dist/partialLengths.js +29 -29
  69. package/dist/partialLengths.js.map +1 -1
  70. package/dist/referencePositions.d.ts +4 -4
  71. package/dist/referencePositions.d.ts.map +1 -1
  72. package/dist/referencePositions.js +2 -2
  73. package/dist/referencePositions.js.map +1 -1
  74. package/dist/revertibles.d.ts +7 -7
  75. package/dist/revertibles.d.ts.map +1 -1
  76. package/dist/revertibles.js +39 -39
  77. package/dist/revertibles.js.map +1 -1
  78. package/dist/segmentGroupCollection.d.ts +1 -1
  79. package/dist/segmentGroupCollection.d.ts.map +1 -1
  80. package/dist/segmentGroupCollection.js +3 -3
  81. package/dist/segmentGroupCollection.js.map +1 -1
  82. package/dist/segmentPropertiesManager.d.ts +2 -2
  83. package/dist/segmentPropertiesManager.d.ts.map +1 -1
  84. package/dist/segmentPropertiesManager.js +8 -8
  85. package/dist/segmentPropertiesManager.js.map +1 -1
  86. package/dist/snapshotChunks.d.ts +3 -3
  87. package/dist/snapshotChunks.d.ts.map +1 -1
  88. package/dist/snapshotChunks.js +5 -5
  89. package/dist/snapshotChunks.js.map +1 -1
  90. package/dist/snapshotLoader.d.ts +3 -3
  91. package/dist/snapshotLoader.d.ts.map +1 -1
  92. package/dist/snapshotLoader.js +19 -19
  93. package/dist/snapshotLoader.js.map +1 -1
  94. package/dist/snapshotV1.d.ts +3 -3
  95. package/dist/snapshotV1.d.ts.map +1 -1
  96. package/dist/snapshotV1.js +35 -18
  97. package/dist/snapshotV1.js.map +1 -1
  98. package/dist/snapshotlegacy.d.ts +2 -2
  99. package/dist/snapshotlegacy.d.ts.map +1 -1
  100. package/dist/snapshotlegacy.js +22 -10
  101. package/dist/snapshotlegacy.js.map +1 -1
  102. package/dist/sortedSegmentSet.d.ts +3 -3
  103. package/dist/sortedSegmentSet.d.ts.map +1 -1
  104. package/dist/sortedSegmentSet.js +7 -5
  105. package/dist/sortedSegmentSet.js.map +1 -1
  106. package/dist/test/Insertion.perf.spec.js +15 -15
  107. package/dist/test/Insertion.perf.spec.js.map +1 -1
  108. package/dist/test/PartialLengths.perf.spec.js +13 -13
  109. package/dist/test/PartialLengths.perf.spec.js.map +1 -1
  110. package/dist/test/Removal.perf.spec.js +25 -25
  111. package/dist/test/Removal.perf.spec.js.map +1 -1
  112. package/dist/test/Snapshot.perf.spec.js +3 -3
  113. package/dist/test/Snapshot.perf.spec.js.map +1 -1
  114. package/dist/test/attributionCollection.perf.spec.js +9 -9
  115. package/dist/test/attributionCollection.perf.spec.js.map +1 -1
  116. package/dist/test/attributionCollection.spec.js +46 -46
  117. package/dist/test/attributionCollection.spec.js.map +1 -1
  118. package/dist/test/attributionPolicy.spec.js +13 -13
  119. package/dist/test/attributionPolicy.spec.js.map +1 -1
  120. package/dist/test/{beastTest.d.ts → beastTest.spec.d.ts} +3 -3
  121. package/dist/test/beastTest.spec.d.ts.map +1 -0
  122. package/dist/test/{beastTest.js → beastTest.spec.js} +120 -119
  123. package/dist/test/beastTest.spec.js.map +1 -0
  124. package/dist/test/client.annotateMarker.spec.js +13 -13
  125. package/dist/test/client.annotateMarker.spec.js.map +1 -1
  126. package/dist/test/{client.apis.d.ts → client.apis.spec.d.ts} +1 -1
  127. package/dist/test/client.apis.spec.d.ts.map +1 -0
  128. package/dist/test/{client.apis.js → client.apis.spec.js} +8 -8
  129. package/dist/test/client.apis.spec.js.map +1 -0
  130. package/dist/test/client.applyMsg.spec.js +106 -43
  131. package/dist/test/client.applyMsg.spec.js.map +1 -1
  132. package/dist/test/client.applyStashedOpFarm.spec.d.ts +1 -1
  133. package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -1
  134. package/dist/test/client.applyStashedOpFarm.spec.js +33 -21
  135. package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -1
  136. package/dist/test/client.attributionFarm.spec.d.ts +1 -1
  137. package/dist/test/client.attributionFarm.spec.d.ts.map +1 -1
  138. package/dist/test/client.attributionFarm.spec.js +13 -13
  139. package/dist/test/client.attributionFarm.spec.js.map +1 -1
  140. package/dist/test/client.conflictFarm.spec.d.ts +1 -1
  141. package/dist/test/client.conflictFarm.spec.d.ts.map +1 -1
  142. package/dist/test/client.conflictFarm.spec.js +9 -9
  143. package/dist/test/client.conflictFarm.spec.js.map +1 -1
  144. package/dist/test/client.getPosition.spec.js +4 -4
  145. package/dist/test/client.getPosition.spec.js.map +1 -1
  146. package/dist/test/client.localReference.spec.js +140 -109
  147. package/dist/test/client.localReference.spec.js.map +1 -1
  148. package/dist/test/client.localReferenceFarm.spec.js +18 -18
  149. package/dist/test/client.localReferenceFarm.spec.js.map +1 -1
  150. package/dist/test/client.rebasePosition.spec.js +2 -2
  151. package/dist/test/client.rebasePosition.spec.js.map +1 -1
  152. package/dist/test/client.reconnectFarm.spec.d.ts +1 -1
  153. package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -1
  154. package/dist/test/client.reconnectFarm.spec.js +10 -10
  155. package/dist/test/client.reconnectFarm.spec.js.map +1 -1
  156. package/dist/test/client.replay.spec.js +11 -11
  157. package/dist/test/client.replay.spec.js.map +1 -1
  158. package/dist/test/client.rollback.spec.js +83 -83
  159. package/dist/test/client.rollback.spec.js.map +1 -1
  160. package/dist/test/client.rollbackFarm.spec.js +9 -9
  161. package/dist/test/client.rollbackFarm.spec.js.map +1 -1
  162. package/dist/test/client.searchForMarker.spec.js +137 -137
  163. package/dist/test/client.searchForMarker.spec.js.map +1 -1
  164. package/dist/test/client.walkSegments.spec.js +2 -2
  165. package/dist/test/client.walkSegments.spec.js.map +1 -1
  166. package/dist/test/collections.list.spec.js +4 -4
  167. package/dist/test/collections.list.spec.js.map +1 -1
  168. package/dist/test/createInsertOnlyAttributionPolicy.spec.js +4 -4
  169. package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -1
  170. package/dist/test/dirname.cjs +16 -0
  171. package/dist/test/dirname.cjs.map +1 -0
  172. package/dist/test/dirname.d.cts +6 -0
  173. package/dist/test/dirname.d.cts.map +1 -0
  174. package/dist/test/index.d.ts +8 -8
  175. package/dist/test/index.d.ts.map +1 -1
  176. package/dist/test/index.js +82 -81
  177. package/dist/test/index.js.map +1 -1
  178. package/dist/test/mergeTree.annotate.deltaCallback.spec.js +39 -39
  179. package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -1
  180. package/dist/test/mergeTree.annotate.spec.js +39 -39
  181. package/dist/test/mergeTree.annotate.spec.js.map +1 -1
  182. package/dist/test/mergeTree.insert.deltaCallback.spec.js +35 -35
  183. package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -1
  184. package/dist/test/mergeTree.insertingWalk.spec.js +77 -77
  185. package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -1
  186. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +42 -42
  187. package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -1
  188. package/dist/test/mergeTree.markRangeRemoved.spec.js +15 -15
  189. package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -1
  190. package/dist/test/mergeTree.walk.spec.js +14 -14
  191. package/dist/test/mergeTree.walk.spec.js.map +1 -1
  192. package/dist/test/mergeTree.zamboni.spec.js +9 -9
  193. package/dist/test/mergeTree.zamboni.spec.js.map +1 -1
  194. package/dist/test/mergeTreeOperationRunner.d.ts +4 -4
  195. package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -1
  196. package/dist/test/mergeTreeOperationRunner.js +16 -15
  197. package/dist/test/mergeTreeOperationRunner.js.map +1 -1
  198. package/dist/test/mergeTreeOperationRunner.spec.js +5 -5
  199. package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -1
  200. package/dist/test/obliterate.concurrent.spec.js +85 -88
  201. package/dist/test/obliterate.concurrent.spec.js.map +1 -1
  202. package/dist/test/obliterate.deltaCallback.spec.d.ts +6 -0
  203. package/dist/test/obliterate.deltaCallback.spec.d.ts.map +1 -0
  204. package/dist/test/obliterate.deltaCallback.spec.js +146 -0
  205. package/dist/test/obliterate.deltaCallback.spec.js.map +1 -0
  206. package/dist/test/obliterate.partialLength.spec.js +39 -44
  207. package/dist/test/obliterate.partialLength.spec.js.map +1 -1
  208. package/dist/test/obliterate.reconnect.spec.js +15 -18
  209. package/dist/test/obliterate.reconnect.spec.js.map +1 -1
  210. package/dist/test/obliterate.spec.js +16 -16
  211. package/dist/test/obliterate.spec.js.map +1 -1
  212. package/dist/test/ordinal.spec.js +5 -5
  213. package/dist/test/ordinal.spec.js.map +1 -1
  214. package/dist/test/partialLength.spec.js +58 -64
  215. package/dist/test/partialLength.spec.js.map +1 -1
  216. package/dist/test/properties.spec.js +15 -15
  217. package/dist/test/properties.spec.js.map +1 -1
  218. package/dist/test/reconnectHelper.d.ts +8 -8
  219. package/dist/test/reconnectHelper.d.ts.map +1 -1
  220. package/dist/test/reconnectHelper.js +3 -3
  221. package/dist/test/reconnectHelper.js.map +1 -1
  222. package/dist/test/resetPendingSegmentsToOp.spec.js +18 -18
  223. package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -1
  224. package/dist/test/revertibleFarm.spec.js +21 -21
  225. package/dist/test/revertibleFarm.spec.js.map +1 -1
  226. package/dist/test/revertibles.spec.js +67 -67
  227. package/dist/test/revertibles.spec.js.map +1 -1
  228. package/dist/test/segmentGroupCollection.spec.js +3 -3
  229. package/dist/test/segmentGroupCollection.spec.js.map +1 -1
  230. package/dist/test/snapshot.spec.js +16 -16
  231. package/dist/test/snapshot.spec.js.map +1 -1
  232. package/dist/test/snapshot.utils.d.ts +4 -4
  233. package/dist/test/snapshot.utils.d.ts.map +1 -1
  234. package/dist/test/snapshot.utils.js +11 -11
  235. package/dist/test/snapshot.utils.js.map +1 -1
  236. package/dist/test/snapshotlegacy.spec.js +22 -22
  237. package/dist/test/snapshotlegacy.spec.js.map +1 -1
  238. package/dist/test/sortedSegmentSet.spec.js +9 -9
  239. package/dist/test/sortedSegmentSet.spec.js.map +1 -1
  240. package/dist/test/testClient.d.ts +13 -16
  241. package/dist/test/testClient.d.ts.map +1 -1
  242. package/dist/test/testClient.js +57 -59
  243. package/dist/test/testClient.js.map +1 -1
  244. package/dist/test/testClientLogger.d.ts +3 -3
  245. package/dist/test/testClientLogger.d.ts.map +1 -1
  246. package/dist/test/testClientLogger.js +19 -19
  247. package/dist/test/testClientLogger.js.map +1 -1
  248. package/dist/test/testServer.d.ts +3 -3
  249. package/dist/test/testServer.d.ts.map +1 -1
  250. package/dist/test/testServer.js +8 -8
  251. package/dist/test/testServer.js.map +1 -1
  252. package/dist/test/testUtils.d.ts +14 -6
  253. package/dist/test/testUtils.d.ts.map +1 -1
  254. package/dist/test/testUtils.js +36 -17
  255. package/dist/test/testUtils.js.map +1 -1
  256. package/dist/test/text.d.ts +2 -2
  257. package/dist/test/text.d.ts.map +1 -1
  258. package/dist/test/text.js +10 -10
  259. package/dist/test/text.js.map +1 -1
  260. package/dist/test/tracking.spec.js +12 -12
  261. package/dist/test/tracking.spec.js.map +1 -1
  262. package/dist/test/{wordUnitTests.d.ts → wordUnitTests.spec.d.ts} +1 -1
  263. package/dist/test/wordUnitTests.spec.d.ts.map +1 -0
  264. package/dist/test/{wordUnitTests.js → wordUnitTests.spec.js} +16 -15
  265. package/dist/test/wordUnitTests.spec.js.map +1 -0
  266. package/dist/textSegment.d.ts +3 -3
  267. package/dist/textSegment.d.ts.map +1 -1
  268. package/dist/textSegment.js +2 -2
  269. package/dist/textSegment.js.map +1 -1
  270. package/dist/tsdoc-metadata.json +1 -1
  271. package/dist/zamboni.d.ts +2 -2
  272. package/dist/zamboni.d.ts.map +1 -1
  273. package/dist/zamboni.js +19 -19
  274. package/dist/zamboni.js.map +1 -1
  275. package/lib/{MergeTreeTextHelper.d.mts → MergeTreeTextHelper.d.ts} +3 -3
  276. package/lib/MergeTreeTextHelper.d.ts.map +1 -0
  277. package/lib/{MergeTreeTextHelper.mjs → MergeTreeTextHelper.js} +3 -2
  278. package/lib/MergeTreeTextHelper.js.map +1 -0
  279. package/lib/{attributionCollection.d.mts → attributionCollection.d.ts} +2 -2
  280. package/lib/attributionCollection.d.ts.map +1 -0
  281. package/lib/{attributionCollection.mjs → attributionCollection.js} +1 -1
  282. package/lib/attributionCollection.js.map +1 -0
  283. package/lib/{attributionPolicy.d.mts → attributionPolicy.d.ts} +2 -2
  284. package/lib/attributionPolicy.d.ts.map +1 -0
  285. package/lib/{attributionPolicy.mjs → attributionPolicy.js} +4 -4
  286. package/lib/attributionPolicy.js.map +1 -0
  287. package/lib/{client.d.mts → client.d.ts} +32 -13
  288. package/lib/client.d.ts.map +1 -0
  289. package/lib/{client.mjs → client.js} +42 -31
  290. package/lib/client.js.map +1 -0
  291. package/lib/collections/{index.d.mts → index.d.ts} +3 -3
  292. package/lib/collections/index.d.ts.map +1 -0
  293. package/lib/collections/index.js +7 -0
  294. package/lib/collections/index.js.map +1 -0
  295. package/lib/collections/{list.d.mts → list.d.ts} +1 -1
  296. package/lib/collections/list.d.ts.map +1 -0
  297. package/lib/collections/{list.mjs → list.js} +1 -1
  298. package/lib/collections/list.js.map +1 -0
  299. package/lib/collections/{rbTree.d.mts → rbTree.d.ts} +1 -1
  300. package/lib/collections/rbTree.d.ts.map +1 -0
  301. package/lib/collections/{rbTree.mjs → rbTree.js} +1 -1
  302. package/lib/collections/rbTree.js.map +1 -0
  303. package/lib/{constants.d.mts → constants.d.ts} +1 -1
  304. package/lib/constants.d.ts.map +1 -0
  305. package/lib/{constants.mjs → constants.js} +1 -1
  306. package/lib/constants.js.map +1 -0
  307. package/lib/{endOfTreeSegment.d.mts → endOfTreeSegment.d.ts} +4 -4
  308. package/lib/endOfTreeSegment.d.ts.map +1 -0
  309. package/lib/{endOfTreeSegment.mjs → endOfTreeSegment.js} +3 -3
  310. package/lib/endOfTreeSegment.js.map +1 -0
  311. package/lib/{index.d.mts → index.d.ts} +21 -21
  312. package/lib/index.d.ts.map +1 -0
  313. package/lib/{index.mjs → index.js} +20 -20
  314. package/lib/index.js.map +1 -0
  315. package/lib/{localReference.d.mts → localReference.d.ts} +10 -40
  316. package/lib/localReference.d.ts.map +1 -0
  317. package/lib/{localReference.mjs → localReference.js} +12 -6
  318. package/lib/localReference.js.map +1 -0
  319. package/lib/{merge-tree-alpha.d.mts → merge-tree-alpha.d.ts} +28 -450
  320. package/lib/merge-tree-beta.d.ts +230 -0
  321. package/lib/merge-tree-public.d.ts +230 -0
  322. package/lib/{merge-tree-untrimmed.d.mts → merge-tree-untrimmed.d.ts} +28 -787
  323. package/lib/{mergeTree.d.mts → mergeTree.d.ts} +12 -20
  324. package/lib/mergeTree.d.ts.map +1 -0
  325. package/lib/{mergeTree.mjs → mergeTree.js} +47 -32
  326. package/lib/mergeTree.js.map +1 -0
  327. package/lib/{mergeTreeDeltaCallback.d.mts → mergeTreeDeltaCallback.d.ts} +8 -8
  328. package/lib/mergeTreeDeltaCallback.d.ts.map +1 -0
  329. package/lib/{mergeTreeDeltaCallback.mjs → mergeTreeDeltaCallback.js} +1 -1
  330. package/lib/mergeTreeDeltaCallback.js.map +1 -0
  331. package/lib/{mergeTreeNodeWalk.d.mts → mergeTreeNodeWalk.d.ts} +2 -2
  332. package/lib/mergeTreeNodeWalk.d.ts.map +1 -0
  333. package/lib/{mergeTreeNodeWalk.mjs → mergeTreeNodeWalk.js} +1 -1
  334. package/lib/mergeTreeNodeWalk.js.map +1 -0
  335. package/lib/{mergeTreeNodes.d.mts → mergeTreeNodes.d.ts} +18 -15
  336. package/lib/mergeTreeNodes.d.ts.map +1 -0
  337. package/lib/{mergeTreeNodes.mjs → mergeTreeNodes.js} +12 -10
  338. package/lib/mergeTreeNodes.js.map +1 -0
  339. package/lib/{mergeTreeTracking.d.mts → mergeTreeTracking.d.ts} +3 -3
  340. package/lib/mergeTreeTracking.d.ts.map +1 -0
  341. package/lib/{mergeTreeTracking.mjs → mergeTreeTracking.js} +3 -2
  342. package/lib/mergeTreeTracking.js.map +1 -0
  343. package/lib/{opBuilder.d.mts → opBuilder.d.ts} +4 -4
  344. package/lib/{opBuilder.d.mts.map → opBuilder.d.ts.map} +1 -1
  345. package/lib/{opBuilder.mjs → opBuilder.js} +2 -2
  346. package/lib/opBuilder.js.map +1 -0
  347. package/lib/{ops.d.mts → ops.d.ts} +1 -1
  348. package/lib/ops.d.ts.map +1 -0
  349. package/lib/{ops.mjs → ops.js} +1 -1
  350. package/lib/ops.js.map +1 -0
  351. package/lib/{ordinal.d.mts → ordinal.d.ts} +1 -1
  352. package/lib/ordinal.d.ts.map +1 -0
  353. package/lib/{ordinal.mjs → ordinal.js} +2 -1
  354. package/lib/ordinal.js.map +1 -0
  355. package/lib/{partialLengths.d.mts → partialLengths.d.ts} +6 -6
  356. package/lib/partialLengths.d.ts.map +1 -0
  357. package/lib/{partialLengths.mjs → partialLengths.js} +11 -10
  358. package/lib/partialLengths.js.map +1 -0
  359. package/lib/{properties.d.mts → properties.d.ts} +1 -1
  360. package/lib/properties.d.ts.map +1 -0
  361. package/lib/{properties.mjs → properties.js} +1 -1
  362. package/lib/properties.js.map +1 -0
  363. package/lib/{referencePositions.d.mts → referencePositions.d.ts} +5 -5
  364. package/lib/referencePositions.d.ts.map +1 -0
  365. package/lib/{referencePositions.mjs → referencePositions.js} +2 -2
  366. package/lib/referencePositions.js.map +1 -0
  367. package/lib/{revertibles.d.mts → revertibles.d.ts} +8 -8
  368. package/lib/revertibles.d.ts.map +1 -0
  369. package/lib/{revertibles.mjs → revertibles.js} +13 -13
  370. package/lib/revertibles.js.map +1 -0
  371. package/lib/{segmentGroupCollection.d.mts → segmentGroupCollection.d.ts} +2 -2
  372. package/lib/segmentGroupCollection.d.ts.map +1 -0
  373. package/lib/{segmentGroupCollection.mjs → segmentGroupCollection.js} +2 -2
  374. package/lib/segmentGroupCollection.js.map +1 -0
  375. package/lib/{segmentPropertiesManager.d.mts → segmentPropertiesManager.d.ts} +3 -3
  376. package/lib/segmentPropertiesManager.d.ts.map +1 -0
  377. package/lib/{segmentPropertiesManager.mjs → segmentPropertiesManager.js} +5 -3
  378. package/lib/segmentPropertiesManager.js.map +1 -0
  379. package/lib/{snapshotChunks.d.mts → snapshotChunks.d.ts} +4 -4
  380. package/lib/snapshotChunks.d.ts.map +1 -0
  381. package/lib/{snapshotChunks.mjs → snapshotChunks.js} +2 -2
  382. package/lib/snapshotChunks.js.map +1 -0
  383. package/lib/{snapshotLoader.d.mts → snapshotLoader.d.ts} +4 -4
  384. package/lib/snapshotLoader.d.ts.map +1 -0
  385. package/lib/{snapshotLoader.mjs → snapshotLoader.js} +10 -9
  386. package/lib/snapshotLoader.js.map +1 -0
  387. package/lib/{snapshotV1.d.mts → snapshotV1.d.ts} +4 -4
  388. package/lib/snapshotV1.d.ts.map +1 -0
  389. package/lib/{snapshotV1.mjs → snapshotV1.js} +24 -7
  390. package/lib/snapshotV1.js.map +1 -0
  391. package/lib/{snapshotlegacy.d.mts → snapshotlegacy.d.ts} +3 -3
  392. package/lib/snapshotlegacy.d.ts.map +1 -0
  393. package/lib/{snapshotlegacy.mjs → snapshotlegacy.js} +17 -4
  394. package/lib/snapshotlegacy.js.map +1 -0
  395. package/lib/{sortedSegmentSet.d.mts → sortedSegmentSet.d.ts} +4 -4
  396. package/lib/sortedSegmentSet.d.ts.map +1 -0
  397. package/lib/{sortedSegmentSet.mjs → sortedSegmentSet.js} +8 -5
  398. package/lib/sortedSegmentSet.js.map +1 -0
  399. package/lib/{sortedSet.d.mts → sortedSet.d.ts} +1 -1
  400. package/lib/sortedSet.d.ts.map +1 -0
  401. package/lib/{sortedSet.mjs → sortedSet.js} +1 -1
  402. package/lib/sortedSet.js.map +1 -0
  403. package/lib/test/Insertion.perf.spec.d.ts +6 -0
  404. package/lib/test/Insertion.perf.spec.d.ts.map +1 -0
  405. package/lib/test/Insertion.perf.spec.js +111 -0
  406. package/lib/test/Insertion.perf.spec.js.map +1 -0
  407. package/lib/test/PartialLengths.perf.spec.d.ts +6 -0
  408. package/lib/test/PartialLengths.perf.spec.d.ts.map +1 -0
  409. package/lib/test/PartialLengths.perf.spec.js +65 -0
  410. package/lib/test/PartialLengths.perf.spec.js.map +1 -0
  411. package/lib/test/Removal.perf.spec.d.ts +6 -0
  412. package/lib/test/Removal.perf.spec.d.ts.map +1 -0
  413. package/lib/test/Removal.perf.spec.js +164 -0
  414. package/lib/test/Removal.perf.spec.js.map +1 -0
  415. package/lib/test/Snapshot.perf.spec.d.ts +6 -0
  416. package/lib/test/Snapshot.perf.spec.d.ts.map +1 -0
  417. package/lib/test/Snapshot.perf.spec.js +31 -0
  418. package/lib/test/Snapshot.perf.spec.js.map +1 -0
  419. package/lib/test/attributionCollection.perf.spec.d.ts +6 -0
  420. package/lib/test/attributionCollection.perf.spec.d.ts.map +1 -0
  421. package/lib/test/attributionCollection.perf.spec.js +229 -0
  422. package/lib/test/attributionCollection.perf.spec.js.map +1 -0
  423. package/lib/test/attributionCollection.spec.d.ts +6 -0
  424. package/lib/test/attributionCollection.spec.d.ts.map +1 -0
  425. package/lib/test/attributionCollection.spec.js +484 -0
  426. package/lib/test/attributionCollection.spec.js.map +1 -0
  427. package/lib/test/attributionPolicy.spec.d.ts +6 -0
  428. package/lib/test/attributionPolicy.spec.d.ts.map +1 -0
  429. package/lib/test/attributionPolicy.spec.js +187 -0
  430. package/lib/test/attributionPolicy.spec.js.map +1 -0
  431. package/lib/test/beastTest.spec.d.ts +54 -0
  432. package/lib/test/beastTest.spec.d.ts.map +1 -0
  433. package/lib/test/beastTest.spec.js +1318 -0
  434. package/lib/test/beastTest.spec.js.map +1 -0
  435. package/lib/test/client.annotateMarker.spec.d.ts +6 -0
  436. package/lib/test/client.annotateMarker.spec.d.ts.map +1 -0
  437. package/lib/test/client.annotateMarker.spec.js +43 -0
  438. package/lib/test/client.annotateMarker.spec.js.map +1 -0
  439. package/lib/test/client.apis.spec.d.ts +7 -0
  440. package/lib/test/client.apis.spec.d.ts.map +1 -0
  441. package/lib/test/client.apis.spec.js +67 -0
  442. package/lib/test/client.apis.spec.js.map +1 -0
  443. package/lib/test/client.applyMsg.spec.d.ts +6 -0
  444. package/lib/test/client.applyMsg.spec.d.ts.map +1 -0
  445. package/lib/test/client.applyMsg.spec.js +561 -0
  446. package/lib/test/client.applyMsg.spec.js.map +1 -0
  447. package/lib/test/client.applyStashedOpFarm.spec.d.ts +12 -0
  448. package/lib/test/client.applyStashedOpFarm.spec.d.ts.map +1 -0
  449. package/lib/test/client.applyStashedOpFarm.spec.js +153 -0
  450. package/lib/test/client.applyStashedOpFarm.spec.js.map +1 -0
  451. package/lib/test/client.attributionFarm.spec.d.ts +7 -0
  452. package/lib/test/client.attributionFarm.spec.d.ts.map +1 -0
  453. package/lib/test/client.attributionFarm.spec.js +92 -0
  454. package/lib/test/client.attributionFarm.spec.js.map +1 -0
  455. package/lib/test/client.conflictFarm.spec.d.ts +15 -0
  456. package/lib/test/client.conflictFarm.spec.d.ts.map +1 -0
  457. package/lib/test/client.conflictFarm.spec.js +85 -0
  458. package/lib/test/client.conflictFarm.spec.js.map +1 -0
  459. package/lib/test/client.getPosition.spec.d.ts +6 -0
  460. package/lib/test/client.getPosition.spec.d.ts.map +1 -0
  461. package/lib/test/client.getPosition.spec.js +52 -0
  462. package/lib/test/client.getPosition.spec.js.map +1 -0
  463. package/lib/test/client.localReference.spec.d.ts +6 -0
  464. package/lib/test/client.localReference.spec.d.ts.map +1 -0
  465. package/lib/test/client.localReference.spec.js +468 -0
  466. package/lib/test/client.localReference.spec.js.map +1 -0
  467. package/lib/test/client.localReferenceFarm.spec.d.ts +6 -0
  468. package/lib/test/client.localReferenceFarm.spec.d.ts.map +1 -0
  469. package/lib/test/client.localReferenceFarm.spec.js +86 -0
  470. package/lib/test/client.localReferenceFarm.spec.js.map +1 -0
  471. package/lib/test/client.rebasePosition.spec.d.ts +6 -0
  472. package/lib/test/client.rebasePosition.spec.d.ts.map +1 -0
  473. package/lib/test/client.rebasePosition.spec.js +100 -0
  474. package/lib/test/client.rebasePosition.spec.js.map +1 -0
  475. package/lib/test/client.reconnectFarm.spec.d.ts +12 -0
  476. package/lib/test/client.reconnectFarm.spec.d.ts.map +1 -0
  477. package/lib/test/client.reconnectFarm.spec.js +88 -0
  478. package/lib/test/client.reconnectFarm.spec.js.map +1 -0
  479. package/lib/test/client.replay.spec.d.ts +6 -0
  480. package/lib/test/client.replay.spec.d.ts.map +1 -0
  481. package/lib/test/client.replay.spec.js +57 -0
  482. package/lib/test/client.replay.spec.js.map +1 -0
  483. package/lib/test/client.rollback.spec.d.ts +6 -0
  484. package/lib/test/client.rollback.spec.d.ts.map +1 -0
  485. package/lib/test/client.rollback.spec.js +451 -0
  486. package/lib/test/client.rollback.spec.js.map +1 -0
  487. package/lib/test/client.rollbackFarm.spec.d.ts +6 -0
  488. package/lib/test/client.rollbackFarm.spec.d.ts.map +1 -0
  489. package/lib/test/client.rollbackFarm.spec.js +46 -0
  490. package/lib/test/client.rollbackFarm.spec.js.map +1 -0
  491. package/lib/test/client.searchForMarker.spec.d.ts +6 -0
  492. package/lib/test/client.searchForMarker.spec.d.ts.map +1 -0
  493. package/lib/test/client.searchForMarker.spec.js +495 -0
  494. package/lib/test/client.searchForMarker.spec.js.map +1 -0
  495. package/lib/test/client.walkSegments.spec.d.ts +6 -0
  496. package/lib/test/client.walkSegments.spec.d.ts.map +1 -0
  497. package/lib/test/client.walkSegments.spec.js +52 -0
  498. package/lib/test/client.walkSegments.spec.js.map +1 -0
  499. package/lib/test/collections.list.spec.d.ts +6 -0
  500. package/lib/test/collections.list.spec.d.ts.map +1 -0
  501. package/lib/test/collections.list.spec.js +82 -0
  502. package/lib/test/collections.list.spec.js.map +1 -0
  503. package/lib/test/createInsertOnlyAttributionPolicy.spec.d.ts +6 -0
  504. package/lib/test/createInsertOnlyAttributionPolicy.spec.d.ts.map +1 -0
  505. package/lib/test/createInsertOnlyAttributionPolicy.spec.js +33 -0
  506. package/lib/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -0
  507. package/lib/test/dirname.cjs +16 -0
  508. package/lib/test/dirname.cjs.map +1 -0
  509. package/lib/test/dirname.d.cts +6 -0
  510. package/lib/test/dirname.d.cts.map +1 -0
  511. package/lib/test/index.d.ts +13 -0
  512. package/lib/test/index.d.ts.map +1 -0
  513. package/lib/test/index.js +13 -0
  514. package/lib/test/index.js.map +1 -0
  515. package/lib/test/mergeTree.annotate.deltaCallback.spec.d.ts +6 -0
  516. package/lib/test/mergeTree.annotate.deltaCallback.spec.d.ts.map +1 -0
  517. package/lib/test/mergeTree.annotate.deltaCallback.spec.js +140 -0
  518. package/lib/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -0
  519. package/lib/test/mergeTree.annotate.spec.d.ts +6 -0
  520. package/lib/test/mergeTree.annotate.spec.d.ts.map +1 -0
  521. package/lib/test/mergeTree.annotate.spec.js +446 -0
  522. package/lib/test/mergeTree.annotate.spec.js.map +1 -0
  523. package/lib/test/mergeTree.insert.deltaCallback.spec.d.ts +6 -0
  524. package/lib/test/mergeTree.insert.deltaCallback.spec.d.ts.map +1 -0
  525. package/lib/test/mergeTree.insert.deltaCallback.spec.js +124 -0
  526. package/lib/test/mergeTree.insert.deltaCallback.spec.js.map +1 -0
  527. package/lib/test/mergeTree.insertingWalk.spec.d.ts +6 -0
  528. package/lib/test/mergeTree.insertingWalk.spec.d.ts.map +1 -0
  529. package/lib/test/mergeTree.insertingWalk.spec.js +277 -0
  530. package/lib/test/mergeTree.insertingWalk.spec.js.map +1 -0
  531. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts +6 -0
  532. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts.map +1 -0
  533. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +176 -0
  534. package/lib/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -0
  535. package/lib/test/mergeTree.markRangeRemoved.spec.d.ts +6 -0
  536. package/lib/test/mergeTree.markRangeRemoved.spec.d.ts.map +1 -0
  537. package/lib/test/mergeTree.markRangeRemoved.spec.js +128 -0
  538. package/lib/test/mergeTree.markRangeRemoved.spec.js.map +1 -0
  539. package/lib/test/mergeTree.walk.spec.d.ts +6 -0
  540. package/lib/test/mergeTree.walk.spec.d.ts.map +1 -0
  541. package/lib/test/mergeTree.walk.spec.js +61 -0
  542. package/lib/test/mergeTree.walk.spec.js.map +1 -0
  543. package/lib/test/mergeTree.zamboni.spec.d.ts +6 -0
  544. package/lib/test/mergeTree.zamboni.spec.d.ts.map +1 -0
  545. package/lib/test/mergeTree.zamboni.spec.js +50 -0
  546. package/lib/test/mergeTree.zamboni.spec.js.map +1 -0
  547. package/lib/test/mergeTreeOperationRunner.d.ts +63 -0
  548. package/lib/test/mergeTreeOperationRunner.d.ts.map +1 -0
  549. package/lib/test/mergeTreeOperationRunner.js +207 -0
  550. package/lib/test/mergeTreeOperationRunner.js.map +1 -0
  551. package/lib/test/mergeTreeOperationRunner.spec.d.ts +6 -0
  552. package/lib/test/mergeTreeOperationRunner.spec.d.ts.map +1 -0
  553. package/lib/test/mergeTreeOperationRunner.spec.js +154 -0
  554. package/lib/test/mergeTreeOperationRunner.spec.js.map +1 -0
  555. package/lib/test/obliterate.concurrent.spec.d.ts +6 -0
  556. package/lib/test/obliterate.concurrent.spec.d.ts.map +1 -0
  557. package/lib/test/obliterate.concurrent.spec.js +1441 -0
  558. package/lib/test/obliterate.concurrent.spec.js.map +1 -0
  559. package/lib/test/obliterate.deltaCallback.spec.d.ts +6 -0
  560. package/lib/test/obliterate.deltaCallback.spec.d.ts.map +1 -0
  561. package/lib/test/obliterate.deltaCallback.spec.js +144 -0
  562. package/lib/test/obliterate.deltaCallback.spec.js.map +1 -0
  563. package/lib/test/obliterate.partialLength.spec.d.ts +6 -0
  564. package/lib/test/obliterate.partialLength.spec.d.ts.map +1 -0
  565. package/lib/test/obliterate.partialLength.spec.js +272 -0
  566. package/lib/test/obliterate.partialLength.spec.js.map +1 -0
  567. package/lib/test/obliterate.reconnect.spec.d.ts +6 -0
  568. package/lib/test/obliterate.reconnect.spec.d.ts.map +1 -0
  569. package/lib/test/obliterate.reconnect.spec.js +159 -0
  570. package/lib/test/obliterate.reconnect.spec.js.map +1 -0
  571. package/lib/test/obliterate.spec.d.ts +6 -0
  572. package/lib/test/obliterate.spec.d.ts.map +1 -0
  573. package/lib/test/obliterate.spec.js +160 -0
  574. package/lib/test/obliterate.spec.js.map +1 -0
  575. package/lib/test/ordinal.spec.d.ts +2 -0
  576. package/lib/test/ordinal.spec.d.ts.map +1 -0
  577. package/lib/test/ordinal.spec.js +38 -0
  578. package/lib/test/ordinal.spec.js.map +1 -0
  579. package/lib/test/partialLength.spec.d.ts +6 -0
  580. package/lib/test/partialLength.spec.d.ts.map +1 -0
  581. package/lib/test/partialLength.spec.js +274 -0
  582. package/lib/test/partialLength.spec.js.map +1 -0
  583. package/lib/test/properties.spec.d.ts +6 -0
  584. package/lib/test/properties.spec.d.ts.map +1 -0
  585. package/lib/test/properties.spec.js +53 -0
  586. package/lib/test/properties.spec.js.map +1 -0
  587. package/lib/test/reconnectHelper.d.ts +48 -0
  588. package/lib/test/reconnectHelper.d.ts.map +1 -0
  589. package/lib/test/reconnectHelper.js +82 -0
  590. package/lib/test/reconnectHelper.js.map +1 -0
  591. package/lib/test/resetPendingSegmentsToOp.spec.d.ts +6 -0
  592. package/lib/test/resetPendingSegmentsToOp.spec.d.ts.map +1 -0
  593. package/lib/test/resetPendingSegmentsToOp.spec.js +235 -0
  594. package/lib/test/resetPendingSegmentsToOp.spec.js.map +1 -0
  595. package/lib/test/revertibleFarm.spec.d.ts +6 -0
  596. package/lib/test/revertibleFarm.spec.d.ts.map +1 -0
  597. package/lib/test/revertibleFarm.spec.js +119 -0
  598. package/lib/test/revertibleFarm.spec.js.map +1 -0
  599. package/lib/test/revertibles.spec.d.ts +17 -0
  600. package/lib/test/revertibles.spec.d.ts.map +1 -0
  601. package/lib/test/revertibles.spec.js +381 -0
  602. package/lib/test/revertibles.spec.js.map +1 -0
  603. package/lib/test/segmentGroupCollection.spec.d.ts +6 -0
  604. package/lib/test/segmentGroupCollection.spec.d.ts.map +1 -0
  605. package/lib/test/segmentGroupCollection.spec.js +58 -0
  606. package/lib/test/segmentGroupCollection.spec.js.map +1 -0
  607. package/lib/test/snapshot.spec.d.ts +6 -0
  608. package/lib/test/snapshot.spec.d.ts.map +1 -0
  609. package/lib/test/snapshot.spec.js +176 -0
  610. package/lib/test/snapshot.spec.js.map +1 -0
  611. package/lib/test/snapshot.utils.d.ts +33 -0
  612. package/lib/test/snapshot.utils.d.ts.map +1 -0
  613. package/lib/test/snapshot.utils.js +104 -0
  614. package/lib/test/snapshot.utils.js.map +1 -0
  615. package/lib/test/snapshotlegacy.spec.d.ts +6 -0
  616. package/lib/test/snapshotlegacy.spec.d.ts.map +1 -0
  617. package/lib/test/snapshotlegacy.spec.js +137 -0
  618. package/lib/test/snapshotlegacy.spec.js.map +1 -0
  619. package/lib/test/sortedSegmentSet.spec.d.ts +6 -0
  620. package/lib/test/sortedSegmentSet.spec.d.ts.map +1 -0
  621. package/lib/test/sortedSegmentSet.spec.js +93 -0
  622. package/lib/test/sortedSegmentSet.spec.js.map +1 -0
  623. package/lib/test/testClient.d.ts +116 -0
  624. package/lib/test/testClient.d.ts.map +1 -0
  625. package/lib/test/testClient.js +430 -0
  626. package/lib/test/testClient.js.map +1 -0
  627. package/lib/test/testClientLogger.d.ts +44 -0
  628. package/lib/test/testClientLogger.d.ts.map +1 -0
  629. package/lib/test/testClientLogger.js +282 -0
  630. package/lib/test/testClientLogger.js.map +1 -0
  631. package/lib/test/testSerializer.d.ts +18 -0
  632. package/lib/test/testSerializer.d.ts.map +1 -0
  633. package/lib/test/testSerializer.js +29 -0
  634. package/lib/test/testSerializer.js.map +1 -0
  635. package/lib/test/testServer.d.ts +36 -0
  636. package/lib/test/testServer.d.ts.map +1 -0
  637. package/lib/test/testServer.js +133 -0
  638. package/lib/test/testServer.js.map +1 -0
  639. package/lib/test/testUtils.d.ts +77 -0
  640. package/lib/test/testUtils.d.ts.map +1 -0
  641. package/lib/test/testUtils.js +151 -0
  642. package/lib/test/testUtils.js.map +1 -0
  643. package/lib/test/text.d.ts +9 -0
  644. package/lib/test/text.d.ts.map +1 -0
  645. package/lib/test/text.js +71 -0
  646. package/lib/test/text.js.map +1 -0
  647. package/lib/test/tracking.spec.d.ts +6 -0
  648. package/lib/test/tracking.spec.d.ts.map +1 -0
  649. package/lib/test/tracking.spec.js +118 -0
  650. package/lib/test/tracking.spec.js.map +1 -0
  651. package/lib/test/types/validateMergeTreePrevious.generated.d.ts +2 -0
  652. package/lib/test/types/validateMergeTreePrevious.generated.d.ts.map +1 -0
  653. package/lib/test/types/validateMergeTreePrevious.generated.js +228 -0
  654. package/lib/test/types/validateMergeTreePrevious.generated.js.map +1 -0
  655. package/lib/test/wordUnitTests.spec.d.ts +6 -0
  656. package/lib/test/wordUnitTests.spec.d.ts.map +1 -0
  657. package/lib/test/wordUnitTests.spec.js +166 -0
  658. package/lib/test/wordUnitTests.spec.js.map +1 -0
  659. package/lib/{textSegment.d.mts → textSegment.d.ts} +4 -4
  660. package/lib/textSegment.d.ts.map +1 -0
  661. package/lib/{textSegment.mjs → textSegment.js} +2 -2
  662. package/lib/textSegment.js.map +1 -0
  663. package/lib/{zamboni.d.mts → zamboni.d.ts} +3 -3
  664. package/lib/zamboni.d.ts.map +1 -0
  665. package/lib/{zamboni.mjs → zamboni.js} +7 -6
  666. package/lib/zamboni.js.map +1 -0
  667. package/package.json +50 -57
  668. package/src/MergeTreeTextHelper.ts +4 -4
  669. package/src/attributionCollection.ts +1 -1
  670. package/src/attributionPolicy.ts +5 -5
  671. package/src/client.ts +50 -41
  672. package/src/collections/index.ts +2 -2
  673. package/src/endOfTreeSegment.ts +5 -5
  674. package/src/index.ts +20 -20
  675. package/src/localReference.ts +13 -7
  676. package/src/mergeTree.ts +53 -44
  677. package/src/mergeTreeDeltaCallback.ts +3 -8
  678. package/src/mergeTreeNodeWalk.ts +1 -1
  679. package/src/mergeTreeNodes.ts +21 -19
  680. package/src/mergeTreeTracking.ts +3 -3
  681. package/src/opBuilder.ts +3 -3
  682. package/src/partialLengths.ts +10 -10
  683. package/src/referencePositions.ts +4 -4
  684. package/src/revertibles.ts +14 -18
  685. package/src/segmentGroupCollection.ts +2 -2
  686. package/src/segmentPropertiesManager.ts +3 -3
  687. package/src/snapshotChunks.ts +4 -4
  688. package/src/snapshotLoader.ts +14 -11
  689. package/src/snapshotV1.ts +29 -9
  690. package/src/snapshotlegacy.ts +19 -5
  691. package/src/sortedSegmentSet.ts +8 -6
  692. package/src/textSegment.ts +3 -3
  693. package/src/zamboni.ts +7 -7
  694. package/tsconfig.cjs.json +7 -0
  695. package/tsconfig.json +2 -5
  696. package/api-extractor-esm.json +0 -17
  697. package/dist/test/beastTest.d.ts.map +0 -1
  698. package/dist/test/beastTest.js.map +0 -1
  699. package/dist/test/client.apis.d.ts.map +0 -1
  700. package/dist/test/client.apis.js.map +0 -1
  701. package/dist/test/wordUnitTests.d.ts.map +0 -1
  702. package/dist/test/wordUnitTests.js.map +0 -1
  703. package/lib/MergeTreeTextHelper.d.mts.map +0 -1
  704. package/lib/MergeTreeTextHelper.mjs.map +0 -1
  705. package/lib/attributionCollection.d.mts.map +0 -1
  706. package/lib/attributionCollection.mjs.map +0 -1
  707. package/lib/attributionPolicy.d.mts.map +0 -1
  708. package/lib/attributionPolicy.mjs.map +0 -1
  709. package/lib/client.d.mts.map +0 -1
  710. package/lib/client.mjs.map +0 -1
  711. package/lib/collections/index.d.mts.map +0 -1
  712. package/lib/collections/index.mjs +0 -7
  713. package/lib/collections/index.mjs.map +0 -1
  714. package/lib/collections/list.d.mts.map +0 -1
  715. package/lib/collections/list.mjs.map +0 -1
  716. package/lib/collections/rbTree.d.mts.map +0 -1
  717. package/lib/collections/rbTree.mjs.map +0 -1
  718. package/lib/constants.d.mts.map +0 -1
  719. package/lib/constants.mjs.map +0 -1
  720. package/lib/endOfTreeSegment.d.mts.map +0 -1
  721. package/lib/endOfTreeSegment.mjs.map +0 -1
  722. package/lib/index.d.mts.map +0 -1
  723. package/lib/index.mjs.map +0 -1
  724. package/lib/localReference.d.mts.map +0 -1
  725. package/lib/localReference.mjs.map +0 -1
  726. package/lib/merge-tree-beta.d.mts +0 -668
  727. package/lib/merge-tree-public.d.mts +0 -668
  728. package/lib/mergeTree.d.mts.map +0 -1
  729. package/lib/mergeTree.mjs.map +0 -1
  730. package/lib/mergeTreeDeltaCallback.d.mts.map +0 -1
  731. package/lib/mergeTreeDeltaCallback.mjs.map +0 -1
  732. package/lib/mergeTreeNodeWalk.d.mts.map +0 -1
  733. package/lib/mergeTreeNodeWalk.mjs.map +0 -1
  734. package/lib/mergeTreeNodes.d.mts.map +0 -1
  735. package/lib/mergeTreeNodes.mjs.map +0 -1
  736. package/lib/mergeTreeTracking.d.mts.map +0 -1
  737. package/lib/mergeTreeTracking.mjs.map +0 -1
  738. package/lib/opBuilder.mjs.map +0 -1
  739. package/lib/ops.d.mts.map +0 -1
  740. package/lib/ops.mjs.map +0 -1
  741. package/lib/ordinal.d.mts.map +0 -1
  742. package/lib/ordinal.mjs.map +0 -1
  743. package/lib/partialLengths.d.mts.map +0 -1
  744. package/lib/partialLengths.mjs.map +0 -1
  745. package/lib/properties.d.mts.map +0 -1
  746. package/lib/properties.mjs.map +0 -1
  747. package/lib/referencePositions.d.mts.map +0 -1
  748. package/lib/referencePositions.mjs.map +0 -1
  749. package/lib/revertibles.d.mts.map +0 -1
  750. package/lib/revertibles.mjs.map +0 -1
  751. package/lib/segmentGroupCollection.d.mts.map +0 -1
  752. package/lib/segmentGroupCollection.mjs.map +0 -1
  753. package/lib/segmentPropertiesManager.d.mts.map +0 -1
  754. package/lib/segmentPropertiesManager.mjs.map +0 -1
  755. package/lib/snapshotChunks.d.mts.map +0 -1
  756. package/lib/snapshotChunks.mjs.map +0 -1
  757. package/lib/snapshotLoader.d.mts.map +0 -1
  758. package/lib/snapshotLoader.mjs.map +0 -1
  759. package/lib/snapshotV1.d.mts.map +0 -1
  760. package/lib/snapshotV1.mjs.map +0 -1
  761. package/lib/snapshotlegacy.d.mts.map +0 -1
  762. package/lib/snapshotlegacy.mjs.map +0 -1
  763. package/lib/sortedSegmentSet.d.mts.map +0 -1
  764. package/lib/sortedSegmentSet.mjs.map +0 -1
  765. package/lib/sortedSet.d.mts.map +0 -1
  766. package/lib/sortedSet.mjs.map +0 -1
  767. package/lib/textSegment.d.mts.map +0 -1
  768. package/lib/textSegment.mjs.map +0 -1
  769. package/lib/zamboni.d.mts.map +0 -1
  770. package/lib/zamboni.mjs.map +0 -1
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
6
- import { IMergeTreeGroupMsg, IMergeTreeOp, MergeTreeDeltaType } from "./ops";
7
- import { PropertySet } from "./properties";
8
- import { ISegment } from "./mergeTreeNodes";
6
+ import { IMergeTreeGroupMsg, IMergeTreeOp, MergeTreeDeltaType } from "./ops.js";
7
+ import { PropertySet } from "./properties.js";
8
+ import { ISegment } from "./mergeTreeNodes.js";
9
9
  /**
10
10
  * @alpha
11
11
  */
@@ -84,10 +84,6 @@ export interface IMergeTreeDeltaOpArgs {
84
84
  * Delta op args are for an unacked local change
85
85
  */
86
86
  readonly sequencedMessage?: ISequencedDocumentMessage;
87
- /**
88
- * If the operation is being applied as a stashed op, which means it may have been previously submitted, and therefore should not be resubmitted
89
- */
90
- readonly stashed?: boolean;
91
87
  }
92
88
  /**
93
89
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTreeDeltaCallback.d.ts","sourceRoot":"","sources":["../src/mergeTreeDeltaCallback.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,2BAA2B,GACpC,OAAO,kBAAkB,CAAC,QAAQ,GAClC,OAAO,kBAAkB,CAAC,MAAM,GAChC,OAAO,kBAAkB,CAAC,MAAM,GAChC,OAAO,kBAAkB,CAAC,UAAU,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;IACpC;;;;;;OAMG;;IAEH;;;OAGG;;IAEH;;;;;OAKG;;IAEH;;;OAGG;;CAEM,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,wBAAwB,GACnC,CAAC,OAA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G;IACH,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;CACtD;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,uBAAuB,EAAE,MAAM,CAAC;IACzC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG,CACpC,MAAM,EAAE,qBAAqB,EAC7B,SAAS,EAAE,2BAA2B,KAClC,IAAI,CAAC;AAEV;;GAEG;AAEH,MAAM,WAAW,iCAChB,SAAQ,2BAA2B,CAAC,wBAAwB,CAAC;CAAG;AAEjE;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,CAC1C,eAAe,EAAE,iCAAiC,EAClD,MAAM,EAAE,qBAAqB,GAAG,SAAS,KACrC,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTreeDeltaCallback.js","sourceRoot":"","sources":["../src/mergeTreeDeltaCallback.ts"],"names":[],"mappings":";;;AAmBA;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAG;IACvC;;;;;;OAMG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC;IACT;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC;CACP,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n// eslint-disable-next-line import/no-deprecated\nimport { IMergeTreeGroupMsg, IMergeTreeOp, MergeTreeDeltaType } from \"./ops\";\nimport { PropertySet } from \"./properties\";\nimport { ISegment } from \"./mergeTreeNodes\";\n\n/**\n * @alpha\n */\nexport type MergeTreeDeltaOperationType =\n\t| typeof MergeTreeDeltaType.ANNOTATE\n\t| typeof MergeTreeDeltaType.INSERT\n\t| typeof MergeTreeDeltaType.REMOVE\n\t| typeof MergeTreeDeltaType.OBLITERATE;\n\n/**\n * Enum-like constant defining the types of \"maintenance\" events on a merge tree.\n * Maintenance events correspond to structural segment changes or acks of pending segments.\n *\n * Note: these values are assigned negative integers to avoid clashing with `MergeTreeDeltaType`.\n * @alpha\n */\nexport const MergeTreeMaintenanceType = {\n\t/**\n\t * Notification that a segment \"append\" has occurred, i.e. two adjacent segments have been merged.\n\t * BEWARE: `deltaSegments` on the corresponding event will contain both the merged segment and the latter\n\t * segment, pre-merge.\n\t * For example, if the merge tree originally had two adjacent segments [A][B] and called A.append(B) to get\n\t * segment [AB], `deltaSegments` would contain [AB] and [B].\n\t */\n\tAPPEND: -1,\n\t/**\n\t * Notification that a segment has been split in two.\n\t * `deltaSegments` on the corresponding event will contain the resulting two segments.\n\t */\n\tSPLIT: -2,\n\t/**\n\t * Notification that a segment has been unlinked (i.e. removed) from the MergeTree.\n\t * This occurs on leaf segments during Zamboni when the segment's tracking collection is empty\n\t * (e.g., not being tracked for undo/redo).\n\t * It also occurs on internal merge tree segments when re-packing children to maintain tree balancing invariants.\n\t */\n\tUNLINK: -3,\n\t/**\n\t * Notification that a local change has been acknowledged by the server.\n\t * This means that it has made the round trip to the server and has had a sequence number assigned.\n\t */\n\tACKNOWLEDGED: -4,\n} as const;\n/**\n * @alpha\n */\nexport type MergeTreeMaintenanceType =\n\t(typeof MergeTreeMaintenanceType)[keyof typeof MergeTreeMaintenanceType];\n\n/**\n * @alpha\n */\nexport type MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType | MergeTreeMaintenanceType;\n\n/**\n * @alpha\n */\nexport interface IMergeTreeDeltaCallbackArgs<\n\tTOperationType extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType,\n> {\n\treadonly operation: TOperationType;\n\treadonly deltaSegments: IMergeTreeSegmentDelta[];\n}\n\n/**\n * @alpha\n */\nexport interface IMergeTreeSegmentDelta {\n\tsegment: ISegment;\n\tpropertyDeltas?: PropertySet;\n}\n\n/**\n * @alpha\n */\nexport interface IMergeTreeDeltaOpArgs {\n\t/**\n\t * The group op which contains the operation\n\t * if there operation is part of a group op.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly groupOp?: IMergeTreeGroupMsg;\n\t/**\n\t * The merge tree operation\n\t */\n\treadonly op: IMergeTreeOp;\n\t/**\n\t * Get the sequence message, should only be null if the\n\t * Delta op args are for an unacked local change\n\t */\n\treadonly sequencedMessage?: ISequencedDocumentMessage;\n\n\t/**\n\t * If the operation is being applied as a stashed op, which means it may have been previously submitted, and therefore should not be resubmitted\n\t */\n\treadonly stashed?: boolean;\n}\n\n/**\n * @internal\n */\nexport interface IMergeTreeClientSequenceArgs {\n\treadonly clientId: number;\n\treadonly referenceSequenceNumber: number;\n\treadonly sequenceNumber: number;\n}\n\n/**\n * @internal\n */\nexport type MergeTreeDeltaCallback = (\n\topArgs: IMergeTreeDeltaOpArgs,\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n) => void;\n\n/**\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IMergeTreeMaintenanceCallbackArgs\n\textends IMergeTreeDeltaCallbackArgs<MergeTreeMaintenanceType> {}\n\n/**\n * @internal\n */\nexport type MergeTreeMaintenanceCallback = (\n\tMaintenanceArgs: IMergeTreeMaintenanceCallbackArgs,\n\topArgs: IMergeTreeDeltaOpArgs | undefined,\n) => void;\n"]}
1
+ {"version":3,"file":"mergeTreeDeltaCallback.js","sourceRoot":"","sources":["../src/mergeTreeDeltaCallback.ts"],"names":[],"mappings":";;;AAmBA;;;;;;GAMG;AACU,QAAA,wBAAwB,GAAG;IACvC;;;;;;OAMG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,KAAK,EAAE,CAAC,CAAC;IACT;;;;;OAKG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;;OAGG;IACH,YAAY,EAAE,CAAC,CAAC;CACP,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\n// eslint-disable-next-line import/no-deprecated\nimport { IMergeTreeGroupMsg, IMergeTreeOp, MergeTreeDeltaType } from \"./ops.js\";\nimport { PropertySet } from \"./properties.js\";\nimport { ISegment } from \"./mergeTreeNodes.js\";\n\n/**\n * @alpha\n */\nexport type MergeTreeDeltaOperationType =\n\t| typeof MergeTreeDeltaType.ANNOTATE\n\t| typeof MergeTreeDeltaType.INSERT\n\t| typeof MergeTreeDeltaType.REMOVE\n\t| typeof MergeTreeDeltaType.OBLITERATE;\n\n/**\n * Enum-like constant defining the types of \"maintenance\" events on a merge tree.\n * Maintenance events correspond to structural segment changes or acks of pending segments.\n *\n * Note: these values are assigned negative integers to avoid clashing with `MergeTreeDeltaType`.\n * @alpha\n */\nexport const MergeTreeMaintenanceType = {\n\t/**\n\t * Notification that a segment \"append\" has occurred, i.e. two adjacent segments have been merged.\n\t * BEWARE: `deltaSegments` on the corresponding event will contain both the merged segment and the latter\n\t * segment, pre-merge.\n\t * For example, if the merge tree originally had two adjacent segments [A][B] and called A.append(B) to get\n\t * segment [AB], `deltaSegments` would contain [AB] and [B].\n\t */\n\tAPPEND: -1,\n\t/**\n\t * Notification that a segment has been split in two.\n\t * `deltaSegments` on the corresponding event will contain the resulting two segments.\n\t */\n\tSPLIT: -2,\n\t/**\n\t * Notification that a segment has been unlinked (i.e. removed) from the MergeTree.\n\t * This occurs on leaf segments during Zamboni when the segment's tracking collection is empty\n\t * (e.g., not being tracked for undo/redo).\n\t * It also occurs on internal merge tree segments when re-packing children to maintain tree balancing invariants.\n\t */\n\tUNLINK: -3,\n\t/**\n\t * Notification that a local change has been acknowledged by the server.\n\t * This means that it has made the round trip to the server and has had a sequence number assigned.\n\t */\n\tACKNOWLEDGED: -4,\n} as const;\n/**\n * @alpha\n */\nexport type MergeTreeMaintenanceType =\n\t(typeof MergeTreeMaintenanceType)[keyof typeof MergeTreeMaintenanceType];\n\n/**\n * @alpha\n */\nexport type MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType | MergeTreeMaintenanceType;\n\n/**\n * @alpha\n */\nexport interface IMergeTreeDeltaCallbackArgs<\n\tTOperationType extends MergeTreeDeltaOperationTypes = MergeTreeDeltaOperationType,\n> {\n\treadonly operation: TOperationType;\n\treadonly deltaSegments: IMergeTreeSegmentDelta[];\n}\n\n/**\n * @alpha\n */\nexport interface IMergeTreeSegmentDelta {\n\tsegment: ISegment;\n\tpropertyDeltas?: PropertySet;\n}\n\n/**\n * @alpha\n */\nexport interface IMergeTreeDeltaOpArgs {\n\t/**\n\t * The group op which contains the operation\n\t * if there operation is part of a group op.\n\t */\n\t// eslint-disable-next-line import/no-deprecated\n\treadonly groupOp?: IMergeTreeGroupMsg;\n\t/**\n\t * The merge tree operation\n\t */\n\treadonly op: IMergeTreeOp;\n\t/**\n\t * Get the sequence message, should only be null if the\n\t * Delta op args are for an unacked local change\n\t */\n\treadonly sequencedMessage?: ISequencedDocumentMessage;\n}\n\n/**\n * @internal\n */\nexport interface IMergeTreeClientSequenceArgs {\n\treadonly clientId: number;\n\treadonly referenceSequenceNumber: number;\n\treadonly sequenceNumber: number;\n}\n\n/**\n * @internal\n */\nexport type MergeTreeDeltaCallback = (\n\topArgs: IMergeTreeDeltaOpArgs,\n\tdeltaArgs: IMergeTreeDeltaCallbackArgs,\n) => void;\n\n/**\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\nexport interface IMergeTreeMaintenanceCallbackArgs\n\textends IMergeTreeDeltaCallbackArgs<MergeTreeMaintenanceType> {}\n\n/**\n * @internal\n */\nexport type MergeTreeMaintenanceCallback = (\n\tMaintenanceArgs: IMergeTreeMaintenanceCallbackArgs,\n\topArgs: IMergeTreeDeltaOpArgs | undefined,\n) => void;\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IMergeBlock, IMergeNode, ISegment } from "./mergeTreeNodes";
5
+ import { IMergeBlock, IMergeNode, ISegment } from "./mergeTreeNodes.js";
6
6
  export declare const LeafAction: {
7
7
  readonly Exit: false;
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTreeNodeWalk.d.ts","sourceRoot":"","sources":["../src/mergeTreeNodeWalk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAErE,eAAO,MAAM,UAAU;;CAEb,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;AAEpD,eAAO,MAAM,UAAU;;;;CAKb,CAAC;AAGX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;AAElG;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,UAAU,EAAE,WAAW,EACvB,UAAU,EAAE,UAAU,GAAG,SAAS,EAClC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,UAAU,EAC7C,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,UAAU,EAClD,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,WAAW,KAAK,IAAI,EACvC,OAAO,GAAE,OAAc,GACrB,OAAO,CAyET;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAC/B,SAAS,EAAE,UAAU,EACrB,UAAU,EAAE,CAAC,GAAG,EAAE,QAAQ,KAAK,OAAO,GAAG,SAAS,GAChD,OAAO,CAcT;AAED;;;GAG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BD,8CAkBC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CACnC,UAAuB,EACvB,UAA6D;IAE7D,IAAI,UAAU,CAAC,UAAU,KAAK,CAAC,EAAE;QAChC,OAAO,IAAI,CAAC;KACZ;IAED,yGAAyG;IACzG,gCAAgC;IAChC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;IACrD,KAAK,IAAI,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,KAAK,SAAS,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE;QACtE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACnB;IAED,OAAO,kBAAkB,CACxB,UAAU,EACV,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EACtB,SAAS,CAAC,IAAI,KAAK,CAAC;QACnB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,kBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAU,CAAC,QAAQ,CAAC,EACjF,UAAU,CACV,CAAC;AACH,CAAC;AAvBD,oDAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IMergeBlock, IMergeNode, ISegment } from \"./mergeTreeNodes\";\n\nexport const LeafAction = {\n\tExit: false,\n} as const;\n\nexport type LeafAction = boolean | undefined | void;\n\nexport const NodeAction = {\n\tContinue: undefined,\n\t// exit is false to unify with leafActionOverride\n\tExit: LeafAction.Exit,\n\tSkip: 2,\n} as const;\n\n// we exclude true from, as we only want one continue value, undefined\nexport type NodeAction = (typeof NodeAction)[keyof typeof NodeAction] | Exclude<LeafAction, true>;\n\n/**\n * Does a depth first walk of the tree from the specific start.\n *\n * @param startBlock - The block of the tree to start the walk from\n * @param startChild - The child of that block to start from\n * @param downAction - Called as we walk down the tree to the leaves.\n * @param leafActionOverride - Overrides downAction for leaves, generally used without downAction\n * @param upAction - Called after all the children of a block are walked.\n * @param forward - whether to walk forward or backward\n * @returns true if we naturally exit, false if exiting due to Exit action result\n */\nexport function depthFirstNodeWalk(\n\tstartBlock: IMergeBlock,\n\tstartChild: IMergeNode | undefined,\n\tdownAction?: (node: IMergeNode) => NodeAction,\n\tleafActionOverride?: (seg: ISegment) => LeafAction,\n\tupAction?: (block: IMergeBlock) => void,\n\tforward: boolean = true,\n): boolean {\n\tconst increment = forward ? 1 : -1;\n\tconst leafAction = leafActionOverride ?? downAction;\n\tif (leafAction === undefined) {\n\t\treturn true;\n\t}\n\n\tlet block = startBlock;\n\tlet childCount = block.childCount;\n\tlet start: IMergeNode | undefined = startChild;\n\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// go down to the leaf level\n\t\tlet blockResult: NodeAction;\n\t\twhile (start?.isLeaf() === false) {\n\t\t\t// cast is safe due to isLeaf === false in while above\n\t\t\tblock = start as IMergeBlock;\n\t\t\tchildCount = block.childCount;\n\t\t\tblockResult = downAction?.(block);\n\t\t\t// setting start undefined will skip the leaf walk\n\t\t\t// so if the block result isn't continue, set it\n\t\t\t// undefined\n\t\t\tstart =\n\t\t\t\tblockResult === NodeAction.Continue\n\t\t\t\t\t? block.children[forward ? 0 : childCount - 1]\n\t\t\t\t\t: undefined;\n\t\t}\n\n\t\tlet exit = blockResult === NodeAction.Exit;\n\n\t\t// walk the leaves if we reached them\n\t\tif (start !== undefined) {\n\t\t\tfor (let i = start.index; i !== -1 && i !== childCount; i += increment) {\n\t\t\t\t// the above loop ensures start is a leaf or undefined, so all children\n\t\t\t\t// will be leaves if start exits, so the cast is safe\n\t\t\t\tif (leafAction(block.children[i] as ISegment) === LeafAction.Exit) {\n\t\t\t\t\texit = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if there is no upAction, we don't need to walk up before exiting\n\t\tif (upAction === undefined && exit) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// since we already enumerated the children\n\t\t// we walk up to the next level until there is a sibling\n\t\t// or all the way up if exit is true\n\t\tlet nextIndex = -1;\n\t\tdo {\n\t\t\t// if the blockAction was exit or skip\n\t\t\t// we shouldn't process that block again,\n\t\t\t// if there are subsequent parents while walking up\n\t\t\t// we will process those.\n\t\t\tif (blockResult === NodeAction.Continue) {\n\t\t\t\tupAction?.(block);\n\t\t\t} else {\n\t\t\t\tblockResult = NodeAction.Continue;\n\t\t\t}\n\t\t\tif (block.parent === undefined) {\n\t\t\t\treturn !exit;\n\t\t\t}\n\t\t\tstart = block;\n\t\t\tblock = block.parent;\n\t\t\tchildCount = block.childCount;\n\t\t\tnextIndex = start.index + increment;\n\t\t} while (exit || nextIndex === -1 || nextIndex === childCount);\n\t\t// the above loop ensured that siblings are possible\n\t\tstart = block.children[nextIndex];\n\t}\n}\n\n/**\n * Visit segments starting from node's right/far/forward siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function forwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index + 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t);\n}\n\n/**\n * Visit segments starting from node's left/near/backwards siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function backwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index - 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t\tundefined /* upAction */,\n\t\tfalse /* forward */,\n\t);\n}\n\n/**\n * Walks all segments below the specific start block\n * @param startBlock - The block to start the walk at\n * @param leafAction - The action to perform on the leaves\n * @returns true if we naturally exit, false if exiting due to leaf action result\n */\nexport function walkAllChildSegments(\n\tstartBlock: IMergeBlock,\n\tleafAction: (segment: ISegment) => boolean | undefined | void,\n): boolean {\n\tif (startBlock.childCount === 0) {\n\t\treturn true;\n\t}\n\n\t// undefined shouldn't actually be added, but this allows subsequent check for `node.parent` to typecheck\n\t// without further runtime work.\n\tconst ancestors = new Set<IMergeBlock | undefined>();\n\tfor (let cur = startBlock.parent; cur !== undefined; cur = cur.parent) {\n\t\tancestors.add(cur);\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartBlock,\n\t\tstartBlock.children[0],\n\t\tancestors.size === 0\n\t\t\t? undefined\n\t\t\t: (node) => (ancestors.has(node.parent) ? NodeAction.Exit : NodeAction.Continue),\n\t\tleafAction,\n\t);\n}\n"]}
1
+ {"version":3,"file":"mergeTreeNodeWalk.js","sourceRoot":"","sources":["../src/mergeTreeNodeWalk.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIU,QAAA,UAAU,GAAG;IACzB,IAAI,EAAE,KAAK;CACF,CAAC;AAIE,QAAA,UAAU,GAAG;IACzB,QAAQ,EAAE,SAAS;IACnB,iDAAiD;IACjD,IAAI,EAAE,kBAAU,CAAC,IAAI;IACrB,IAAI,EAAE,CAAC;CACE,CAAC;AAKX;;;;;;;;;;GAUG;AACH,SAAgB,kBAAkB,CACjC,UAAuB,EACvB,UAAkC,EAClC,UAA6C,EAC7C,kBAAkD,EAClD,QAAuC,EACvC,UAAmB,IAAI;IAEvB,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,kBAAkB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,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;QACnC,OAAO,IAAI,CAAC;KACZ;IACD,OAAO,kBAAkB,CACxB,SAAS,CAAC,MAAM;IAChB,gDAAgD;IAChD,8CAA8C;IAC9C,qBAAqB;IACrB,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,EAC9C,SAAS,CAAC,gBAAgB,EAC1B,UAAU,EACV,SAAS,CAAC,cAAc,EACxB,KAAK,CAAC,aAAa,CACnB,CAAC;AACH,CAAC;AAlBD,8CAkBC;AAED;;;;;GAKG;AACH,SAAgB,oBAAoB,CACnC,UAAuB,EACvB,UAA6D;IAE7D,IAAI,UAAU,CAAC,UAAU,KAAK,CAAC,EAAE;QAChC,OAAO,IAAI,CAAC;KACZ;IAED,yGAAyG;IACzG,gCAAgC;IAChC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;IACrD,KAAK,IAAI,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,KAAK,SAAS,EAAE,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE;QACtE,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;KACnB;IAED,OAAO,kBAAkB,CACxB,UAAU,EACV,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,EACtB,SAAS,CAAC,IAAI,KAAK,CAAC;QACnB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,kBAAU,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAU,CAAC,QAAQ,CAAC,EACjF,UAAU,CACV,CAAC;AACH,CAAC;AAvBD,oDAuBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IMergeBlock, IMergeNode, ISegment } from \"./mergeTreeNodes.js\";\n\nexport const LeafAction = {\n\tExit: false,\n} as const;\n\nexport type LeafAction = boolean | undefined | void;\n\nexport const NodeAction = {\n\tContinue: undefined,\n\t// exit is false to unify with leafActionOverride\n\tExit: LeafAction.Exit,\n\tSkip: 2,\n} as const;\n\n// we exclude true from, as we only want one continue value, undefined\nexport type NodeAction = (typeof NodeAction)[keyof typeof NodeAction] | Exclude<LeafAction, true>;\n\n/**\n * Does a depth first walk of the tree from the specific start.\n *\n * @param startBlock - The block of the tree to start the walk from\n * @param startChild - The child of that block to start from\n * @param downAction - Called as we walk down the tree to the leaves.\n * @param leafActionOverride - Overrides downAction for leaves, generally used without downAction\n * @param upAction - Called after all the children of a block are walked.\n * @param forward - whether to walk forward or backward\n * @returns true if we naturally exit, false if exiting due to Exit action result\n */\nexport function depthFirstNodeWalk(\n\tstartBlock: IMergeBlock,\n\tstartChild: IMergeNode | undefined,\n\tdownAction?: (node: IMergeNode) => NodeAction,\n\tleafActionOverride?: (seg: ISegment) => LeafAction,\n\tupAction?: (block: IMergeBlock) => void,\n\tforward: boolean = true,\n): boolean {\n\tconst increment = forward ? 1 : -1;\n\tconst leafAction = leafActionOverride ?? downAction;\n\tif (leafAction === undefined) {\n\t\treturn true;\n\t}\n\n\tlet block = startBlock;\n\tlet childCount = block.childCount;\n\tlet start: IMergeNode | undefined = startChild;\n\n\t// eslint-disable-next-line no-constant-condition\n\twhile (true) {\n\t\t// go down to the leaf level\n\t\tlet blockResult: NodeAction;\n\t\twhile (start?.isLeaf() === false) {\n\t\t\t// cast is safe due to isLeaf === false in while above\n\t\t\tblock = start as IMergeBlock;\n\t\t\tchildCount = block.childCount;\n\t\t\tblockResult = downAction?.(block);\n\t\t\t// setting start undefined will skip the leaf walk\n\t\t\t// so if the block result isn't continue, set it\n\t\t\t// undefined\n\t\t\tstart =\n\t\t\t\tblockResult === NodeAction.Continue\n\t\t\t\t\t? block.children[forward ? 0 : childCount - 1]\n\t\t\t\t\t: undefined;\n\t\t}\n\n\t\tlet exit = blockResult === NodeAction.Exit;\n\n\t\t// walk the leaves if we reached them\n\t\tif (start !== undefined) {\n\t\t\tfor (let i = start.index; i !== -1 && i !== childCount; i += increment) {\n\t\t\t\t// the above loop ensures start is a leaf or undefined, so all children\n\t\t\t\t// will be leaves if start exits, so the cast is safe\n\t\t\t\tif (leafAction(block.children[i] as ISegment) === LeafAction.Exit) {\n\t\t\t\t\texit = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if there is no upAction, we don't need to walk up before exiting\n\t\tif (upAction === undefined && exit) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// since we already enumerated the children\n\t\t// we walk up to the next level until there is a sibling\n\t\t// or all the way up if exit is true\n\t\tlet nextIndex = -1;\n\t\tdo {\n\t\t\t// if the blockAction was exit or skip\n\t\t\t// we shouldn't process that block again,\n\t\t\t// if there are subsequent parents while walking up\n\t\t\t// we will process those.\n\t\t\tif (blockResult === NodeAction.Continue) {\n\t\t\t\tupAction?.(block);\n\t\t\t} else {\n\t\t\t\tblockResult = NodeAction.Continue;\n\t\t\t}\n\t\t\tif (block.parent === undefined) {\n\t\t\t\treturn !exit;\n\t\t\t}\n\t\t\tstart = block;\n\t\t\tblock = block.parent;\n\t\t\tchildCount = block.childCount;\n\t\t\tnextIndex = start.index + increment;\n\t\t} while (exit || nextIndex === -1 || nextIndex === childCount);\n\t\t// the above loop ensured that siblings are possible\n\t\tstart = block.children[nextIndex];\n\t}\n}\n\n/**\n * Visit segments starting from node's right/far/forward siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function forwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index + 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t);\n}\n\n/**\n * Visit segments starting from node's left/near/backwards siblings, then up to node's parent.\n * All segments past `node` are visited, regardless of their visibility.\n */\nexport function backwardExcursion(\n\tstartNode: IMergeNode,\n\tleafAction: (seg: ISegment) => boolean | undefined,\n): boolean {\n\tif (startNode.parent === undefined) {\n\t\treturn true;\n\t}\n\treturn depthFirstNodeWalk(\n\t\tstartNode.parent,\n\t\t// this will either be the sibling, or undefined\n\t\t// either is fine, and will result in skipping\n\t\t// the startNode only\n\t\tstartNode.parent.children[startNode.index - 1],\n\t\tundefined /* downAction */,\n\t\tleafAction,\n\t\tundefined /* upAction */,\n\t\tfalse /* forward */,\n\t);\n}\n\n/**\n * Walks all segments below the specific start block\n * @param startBlock - The block to start the walk at\n * @param leafAction - The action to perform on the leaves\n * @returns true if we naturally exit, false if exiting due to leaf action result\n */\nexport function walkAllChildSegments(\n\tstartBlock: IMergeBlock,\n\tleafAction: (segment: ISegment) => boolean | undefined | void,\n): boolean {\n\tif (startBlock.childCount === 0) {\n\t\treturn true;\n\t}\n\n\t// undefined shouldn't actually be added, but this allows subsequent check for `node.parent` to typecheck\n\t// without further runtime work.\n\tconst ancestors = new Set<IMergeBlock | undefined>();\n\tfor (let cur = startBlock.parent; cur !== undefined; cur = cur.parent) {\n\t\tancestors.add(cur);\n\t}\n\n\treturn depthFirstNodeWalk(\n\t\tstartBlock,\n\t\tstartBlock.children[0],\n\t\tancestors.size === 0\n\t\t\t? undefined\n\t\t\t: (node) => (ancestors.has(node.parent) ? NodeAction.Exit : NodeAction.Continue),\n\t\tleafAction,\n\t);\n}\n"]}
@@ -3,17 +3,16 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { AttributionKey } from "@fluidframework/runtime-definitions";
6
- import { IAttributionCollection } from "./attributionCollection";
7
- import { LocalReferenceCollection } from "./localReference";
8
- import { ISegmentLeaf } from "./mergeTree";
9
- import { IMergeTreeDeltaOpArgs } from "./mergeTreeDeltaCallback";
10
- import { TrackingGroupCollection } from "./mergeTreeTracking";
11
- import { IJSONSegment, IMarkerDef, ReferenceType } from "./ops";
12
- import { PartialSequenceLengths } from "./partialLengths";
13
- import { MapLike, PropertySet } from "./properties";
14
- import { ReferencePosition } from "./referencePositions";
15
- import { SegmentGroupCollection } from "./segmentGroupCollection";
16
- import { PropertiesManager, PropertiesRollback } from "./segmentPropertiesManager";
6
+ import { IAttributionCollection } from "./attributionCollection.js";
7
+ import { LocalReferenceCollection } from "./localReference.js";
8
+ import { IMergeTreeDeltaOpArgs } from "./mergeTreeDeltaCallback.js";
9
+ import { TrackingGroupCollection } from "./mergeTreeTracking.js";
10
+ import { IJSONSegment, IMarkerDef, ReferenceType } from "./ops.js";
11
+ import { PartialSequenceLengths } from "./partialLengths.js";
12
+ import { MapLike, PropertySet } from "./properties.js";
13
+ import { ReferencePosition } from "./referencePositions.js";
14
+ import { SegmentGroupCollection } from "./segmentGroupCollection.js";
15
+ import { PropertiesManager, PropertiesRollback } from "./segmentPropertiesManager.js";
17
16
  /**
18
17
  * Common properties for a node in a merge tree.
19
18
  * @alpha
@@ -30,10 +29,14 @@ export interface IMergeNodeCommon {
30
29
  ordinal: string;
31
30
  isLeaf(): this is ISegment;
32
31
  }
33
- export type IMergeLeaf = ISegment & {
32
+ /**
33
+ * someday we may split tree leaves from segments, but for now they are the same
34
+ * this is just a convenience type that makes it clear that we need something that is both a segment and a leaf node
35
+ */
36
+ export type ISegmentLeaf = ISegment & {
34
37
  parent?: IMergeBlock;
35
38
  };
36
- export type IMergeNode = IMergeBlock | IMergeLeaf;
39
+ export type IMergeNode = IMergeBlock | ISegmentLeaf;
37
40
  /**
38
41
  * Internal (i.e. non-leaf) node in a merge tree.
39
42
  * @internal
@@ -319,7 +322,7 @@ export interface SegmentActions<TClientData> {
319
322
  * @alpha
320
323
  */
321
324
  export interface SegmentGroup {
322
- segments: ISegmentLeaf[];
325
+ segments: ISegment[];
323
326
  previousProps?: PropertySet[];
324
327
  localSeq?: number;
325
328
  refSeq: number;
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTreeNodes.d.ts","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,UAAU,EAAsB,aAAa,EAAE,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAoB,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAuB,iBAAiB,EAAoB,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEnF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,IAAI,IAAI,IAAI,QAAQ,CAAC;CAC3B;AAED,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC;AAC7D,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;AAClD;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACpD,MAAM,CAAC,E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"}
@@ -7,16 +7,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.debugMarkerToString = exports.compareStrings = exports.compareNumbers = exports.CollaborationWindow = exports.Marker = exports.reservedMarkerSimpleTypeKey = exports.reservedMarkerIdKey = exports.BaseSegment = exports.seqLTE = exports.MergeBlock = exports.MaxNodesInBlock = exports.MergeNode = exports.toMoveInfo = exports.toRemovalInfo = void 0;
8
8
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
9
9
  const core_utils_1 = require("@fluidframework/core-utils");
10
- const constants_1 = require("./constants");
11
- const localReference_1 = require("./localReference");
12
- const mergeTreeTracking_1 = require("./mergeTreeTracking");
13
- const ops_1 = require("./ops");
14
- const ordinal_1 = require("./ordinal");
10
+ const constants_js_1 = require("./constants.js");
11
+ const localReference_js_1 = require("./localReference.js");
12
+ const mergeTreeTracking_js_1 = require("./mergeTreeTracking.js");
13
+ const ops_js_1 = require("./ops.js");
14
+ const ordinal_js_1 = require("./ordinal.js");
15
15
  // eslint-disable-next-line import/no-deprecated
16
- const properties_1 = require("./properties");
17
- const referencePositions_1 = require("./referencePositions");
18
- const segmentGroupCollection_1 = require("./segmentGroupCollection");
19
- const segmentPropertiesManager_1 = require("./segmentPropertiesManager");
16
+ const properties_js_1 = require("./properties.js");
17
+ const referencePositions_js_1 = require("./referencePositions.js");
18
+ const segmentGroupCollection_js_1 = require("./segmentGroupCollection.js");
19
+ const segmentPropertiesManager_js_1 = require("./segmentPropertiesManager.js");
20
20
  /**
21
21
  * @internal
22
22
  */
@@ -74,7 +74,7 @@ class MergeBlock extends MergeNode {
74
74
  setOrdinal(child, index) {
75
75
  const childCount = this.childCount;
76
76
  (0, core_utils_1.assert)(childCount >= 1 && childCount <= exports.MaxNodesInBlock, 0x040 /* "Child count is not within [1,8] range!" */);
77
- child.ordinal = (0, ordinal_1.computeHierarchicalOrdinal)(exports.MaxNodesInBlock, childCount, this.ordinal, index === 0 ? undefined : this.children[index - 1]?.ordinal);
77
+ child.ordinal = (0, ordinal_js_1.computeHierarchicalOrdinal)(exports.MaxNodesInBlock, childCount, this.ordinal, index === 0 ? undefined : this.children[index - 1]?.ordinal);
78
78
  }
79
79
  assignChild(child, index, updateOrdinal = true) {
80
80
  child.parent = this;
@@ -87,7 +87,7 @@ class MergeBlock extends MergeNode {
87
87
  }
88
88
  exports.MergeBlock = MergeBlock;
89
89
  function seqLTE(seq, minOrRefSeq) {
90
- return seq !== constants_1.UnassignedSequenceNumber && seq <= minOrRefSeq;
90
+ return seq !== constants_js_1.UnassignedSequenceNumber && seq <= minOrRefSeq;
91
91
  }
92
92
  exports.seqLTE = seqLTE;
93
93
  /**
@@ -96,15 +96,15 @@ exports.seqLTE = seqLTE;
96
96
  class BaseSegment extends MergeNode {
97
97
  constructor() {
98
98
  super(...arguments);
99
- this.clientId = constants_1.LocalClientId;
100
- this.seq = constants_1.UniversalSequenceNumber;
101
- this.segmentGroups = new segmentGroupCollection_1.SegmentGroupCollection(this);
102
- this.trackingCollection = new mergeTreeTracking_1.TrackingGroupCollection(this);
99
+ this.clientId = constants_js_1.LocalClientId;
100
+ this.seq = constants_js_1.UniversalSequenceNumber;
101
+ this.segmentGroups = new segmentGroupCollection_js_1.SegmentGroupCollection(this);
102
+ this.trackingCollection = new mergeTreeTracking_js_1.TrackingGroupCollection(this);
103
103
  }
104
- addProperties(newProps, seq, collaborating, rollback = segmentPropertiesManager_1.PropertiesRollback.None) {
105
- this.propertyManager ?? (this.propertyManager = new segmentPropertiesManager_1.PropertiesManager());
104
+ addProperties(newProps, seq, collaborating, rollback = segmentPropertiesManager_js_1.PropertiesRollback.None) {
105
+ this.propertyManager ?? (this.propertyManager = new segmentPropertiesManager_js_1.PropertiesManager());
106
106
  // eslint-disable-next-line import/no-deprecated
107
- this.properties ?? (this.properties = (0, properties_1.createMap)());
107
+ this.properties ?? (this.properties = (0, properties_js_1.createMap)());
108
108
  return this.propertyManager.addProperties(this.properties, newProps, seq, collaborating, rollback);
109
109
  }
110
110
  hasProperty(key) {
@@ -117,7 +117,7 @@ class BaseSegment extends MergeNode {
117
117
  b.clientId = this.clientId;
118
118
  // TODO: deep clone properties
119
119
  // eslint-disable-next-line import/no-deprecated
120
- b.properties = (0, properties_1.clone)(this.properties);
120
+ b.properties = (0, properties_js_1.clone)(this.properties);
121
121
  b.removedClientIds = this.removedClientIds?.slice();
122
122
  // TODO: copy removed client overlap and branch removal info
123
123
  b.removedSeq = this.removedSeq;
@@ -141,32 +141,32 @@ class BaseSegment extends MergeNode {
141
141
  const currentSegmentGroup = this.segmentGroups.dequeue();
142
142
  (0, core_utils_1.assert)(currentSegmentGroup === segmentGroup, 0x043 /* "On ack, unexpected segmentGroup!" */);
143
143
  switch (opArgs.op.type) {
144
- case ops_1.MergeTreeDeltaType.ANNOTATE:
144
+ case ops_js_1.MergeTreeDeltaType.ANNOTATE:
145
145
  (0, core_utils_1.assert)(!!this.propertyManager, 0x044 /* "On annotate ack, missing segment property manager!" */);
146
146
  this.propertyManager.ackPendingProperties(opArgs.op);
147
147
  return true;
148
- case ops_1.MergeTreeDeltaType.INSERT:
149
- (0, core_utils_1.assert)(this.seq === constants_1.UnassignedSequenceNumber, 0x045 /* "On insert, seq number already assigned!" */);
148
+ case ops_js_1.MergeTreeDeltaType.INSERT:
149
+ (0, core_utils_1.assert)(this.seq === constants_js_1.UnassignedSequenceNumber, 0x045 /* "On insert, seq number already assigned!" */);
150
150
  this.seq = opArgs.sequencedMessage.sequenceNumber;
151
151
  this.localSeq = undefined;
152
152
  return true;
153
- case ops_1.MergeTreeDeltaType.REMOVE:
153
+ case ops_js_1.MergeTreeDeltaType.REMOVE:
154
154
  const removalInfo = toRemovalInfo(this);
155
155
  (0, core_utils_1.assert)(removalInfo !== undefined, 0x046 /* "On remove ack, missing removal info!" */);
156
156
  this.localRemovedSeq = undefined;
157
- if (removalInfo.removedSeq === constants_1.UnassignedSequenceNumber) {
157
+ if (removalInfo.removedSeq === constants_js_1.UnassignedSequenceNumber) {
158
158
  removalInfo.removedSeq = opArgs.sequencedMessage.sequenceNumber;
159
159
  return true;
160
160
  }
161
161
  return false;
162
- case ops_1.MergeTreeDeltaType.OBLITERATE:
162
+ case ops_js_1.MergeTreeDeltaType.OBLITERATE:
163
163
  const moveInfo = toMoveInfo(this);
164
164
  (0, core_utils_1.assert)(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);
165
165
  this.localMovedSeq = undefined;
166
- const seqIdx = moveInfo.movedSeqs.indexOf(constants_1.UnassignedSequenceNumber);
166
+ const seqIdx = moveInfo.movedSeqs.indexOf(constants_js_1.UnassignedSequenceNumber);
167
167
  (0, core_utils_1.assert)(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);
168
168
  moveInfo.movedSeqs[seqIdx] = opArgs.sequencedMessage.sequenceNumber;
169
- if (moveInfo.movedSeq === constants_1.UnassignedSequenceNumber) {
169
+ if (moveInfo.movedSeq === constants_js_1.UnassignedSequenceNumber) {
170
170
  moveInfo.movedSeq = opArgs.sequencedMessage.sequenceNumber;
171
171
  return true;
172
172
  }
@@ -215,7 +215,7 @@ class BaseSegment extends MergeNode {
215
215
  copyPropertiesTo(other) {
216
216
  if (this.propertyManager) {
217
217
  if (this.properties) {
218
- other.propertyManager = new segmentPropertiesManager_1.PropertiesManager();
218
+ other.propertyManager = new segmentPropertiesManager_js_1.PropertiesManager();
219
219
  other.properties = this.propertyManager.copyTo(this.properties, other.properties, other.propertyManager);
220
220
  }
221
221
  }
@@ -223,7 +223,7 @@ class BaseSegment extends MergeNode {
223
223
  append(other) {
224
224
  // Note: Must call 'appendLocalRefs' before modifying this segment's length as
225
225
  // 'this.cachedLength' is used to adjust the offsets of the local refs.
226
- localReference_1.LocalReferenceCollection.append(this, other);
226
+ localReference_js_1.LocalReferenceCollection.append(this, other);
227
227
  if (this.attribution) {
228
228
  (0, core_utils_1.assert)(other.attribution !== undefined, 0x4bd /* attribution should be set on appendee */);
229
229
  this.attribution.append(other.attribution);
@@ -325,7 +325,7 @@ Marker.type = "Marker";
325
325
  */
326
326
  class CollaborationWindow {
327
327
  constructor() {
328
- this.clientId = constants_1.LocalClientId;
328
+ this.clientId = constants_js_1.LocalClientId;
329
329
  this.collaborating = false;
330
330
  /**
331
331
  * Lowest-numbered segment in window; no client can reference a state before this one
@@ -427,7 +427,7 @@ exports.compareStrings = compareStrings;
427
427
  */
428
428
  function debugMarkerToString(marker) {
429
429
  let bbuf = "";
430
- if ((0, referencePositions_1.refTypeIncludesFlag)(marker, ops_1.ReferenceType.Tile)) {
430
+ if ((0, referencePositions_js_1.refTypeIncludesFlag)(marker, ops_js_1.ReferenceType.Tile)) {
431
431
  bbuf += "Tile";
432
432
  }
433
433
  let lbuf = "";
@@ -435,7 +435,7 @@ function debugMarkerToString(marker) {
435
435
  if (id) {
436
436
  bbuf += ` (${id}) `;
437
437
  }
438
- const tileLabels = (0, referencePositions_1.refGetTileLabels)(marker);
438
+ const tileLabels = (0, referencePositions_js_1.refGetTileLabels)(marker);
439
439
  if (tileLabels) {
440
440
  lbuf += "tile -- ";
441
441
  for (let i = 0, len = tileLabels.length; i < len; i++) {
@@ -1 +1 @@
1
- {"version":3,"file":"mergeTreeNodes.js","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA6D;AAE7D,2DAAoD;AAGpD,2CAA+F;AAC/F,qDAA4D;AAG5D,2DAA8D;AAC9D,+BAAoF;AACpF,uCAAuD;AAEvD,gDAAgD;AAChD,6CAAsE;AACtE,6DAAgG;AAChG,qEAAkE;AAClE,yEAAmF;AAwFnF;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAwC;IACrE,IAAI,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EAAE;QAC7E,OAAO,KAAqB,CAAC;KAC7B;IACD,IAAA,mBAAM,EACL,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,E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,IAAI,KAAK,EAAE,IAAI,CAAC;KACpB;IACD,MAAM,UAAU,GAAG,IAAA,qCAAgB,EAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,UAAU,EAAE;QACf,IAAI,IAAI,UAAU,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YACtD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACV,IAAI,IAAI,IAAI,CAAC;aACb;YACD,IAAI,IAAI,SAAS,CAAC;SAClB;KACD;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,MAAM,CAAC,UAAU,EAAE;QACtB,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxD,wEAAwE;YACxE,uCAAuC;YACvC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC;YAE7C,+DAA+D;YAC/D,OAAO,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,YAAY,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/E,CAAC,CAAC,CAAC;KACH;IACD,OAAO,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC;AACrC,CAAC;AAlCD,kDAkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport { IAttributionCollection } from \"./attributionCollection\";\nimport { LocalClientId, UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants\";\nimport { LocalReferenceCollection } from \"./localReference\";\nimport { ISegmentLeaf } from \"./mergeTree\";\nimport { IMergeTreeDeltaOpArgs } from \"./mergeTreeDeltaCallback\";\nimport { TrackingGroupCollection } from \"./mergeTreeTracking\";\nimport { IJSONSegment, IMarkerDef, MergeTreeDeltaType, ReferenceType } from \"./ops\";\nimport { computeHierarchicalOrdinal } from \"./ordinal\";\nimport { PartialSequenceLengths } from \"./partialLengths\";\n// eslint-disable-next-line import/no-deprecated\nimport { clone, createMap, MapLike, PropertySet } from \"./properties\";\nimport { refTypeIncludesFlag, ReferencePosition, refGetTileLabels } from \"./referencePositions\";\nimport { SegmentGroupCollection } from \"./segmentGroupCollection\";\nimport { PropertiesManager, PropertiesRollback } from \"./segmentPropertiesManager\";\n\n/**\n * Common properties for a node in a merge tree.\n * @alpha\n */\nexport interface IMergeNodeCommon {\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\t/**\n\t * A string that can be used for comparing the location of this node to other `MergeNode`s in the same tree.\n\t * `a.ordinal < b.ordinal` if and only if `a` comes before `b` in a pre-order traversal of the tree.\n\t */\n\tordinal: string;\n\tisLeaf(): this is ISegment;\n}\n\nexport type IMergeLeaf = ISegment & { parent?: IMergeBlock };\nexport type IMergeNode = IMergeBlock | IMergeLeaf;\n/**\n * Internal (i.e. non-leaf) node in a merge tree.\n * @internal\n */\nexport interface IMergeBlock extends IMergeNodeCommon {\n\tparent?: IMergeBlock;\n\n\tneedsScour?: boolean;\n\t/**\n\t * Number of direct children of this node\n\t */\n\tchildCount: number;\n\t/**\n\t * Array of child nodes.\n\t *\n\t * @remarks To avoid reallocation, this is always initialized to have maximum length as deemed by\n\t * the merge tree's branching factor. Use `childCount` to determine how many children this node actually has.\n\t */\n\tchildren: IMergeNode[];\n\t/**\n\t * Supports querying the total length of all descendants of this IMergeBlock from the perspective of any\n\t * (clientId, seq) within the collab window.\n\t *\n\t * @remarks This is only optional for implementation reasons (internal nodes can be created/moved without\n\t * immediately initializing the partial lengths). Aside from mid-update on tree operations, these lengths\n\t * objects are always defined.\n\t */\n\tpartialLengths?: PartialSequenceLengths;\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number | undefined;\n\thierBlock(): IHierBlock | undefined;\n\tassignChild(child: IMergeNode, index: number, updateOrdinal?: boolean): void;\n\tsetOrdinal(child: IMergeNode, index: number): void;\n}\n\n/**\n * @internal\n */\nexport interface IHierBlock extends IMergeBlock {\n\trightmostTiles: MapLike<ReferencePosition>;\n\tleftmostTiles: MapLike<ReferencePosition>;\n}\n\n/**\n * Contains removal information associated to an {@link ISegment}.\n * @alpha\n */\nexport interface IRemovalInfo {\n\t/**\n\t * Local seq at which this segment was removed, if the removal is yet-to-be acked.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was removed.\n\t */\n\tremovedSeq: number;\n\t/**\n\t * List of client IDs that have removed this segment.\n\t * The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first\n\t * client in this list. Other clients in the list have all issued concurrent ops to remove the segment.\n\t * @remarks When this list has length \\> 1, this is referred to as the \"overlapping remove\" case.\n\t */\n\tremovedClientIds: number[];\n}\n\n/**\n * @internal\n */\nexport function toRemovalInfo(maybe: Partial<IRemovalInfo> | undefined): IRemovalInfo | undefined {\n\tif (maybe?.removedClientIds !== undefined && maybe?.removedSeq !== undefined) {\n\t\treturn maybe as IRemovalInfo;\n\t}\n\tassert(\n\t\tmaybe?.removedClientIds === undefined && maybe?.removedSeq === undefined,\n\t\t0x2bf /* \"both removedClientIds and removedSeq should be set or not set\" */,\n\t);\n}\n\n/**\n * Tracks information about when and where this segment was moved to.\n *\n * Note that merge-tree does not currently support moving and only supports\n * obliterate. The fields below include \"move\" in their names to avoid renaming\n * in the future, when moves _are_ supported.\n * @alpha\n */\nexport interface IMoveInfo {\n\t/**\n\t * Local seq at which this segment was moved if the move is yet-to-be\n\t * acked.\n\t */\n\tlocalMovedSeq?: number;\n\n\t/**\n\t * The first seq at which this segment was moved.\n\t */\n\tmovedSeq: number;\n\n\t/**\n\t * All seqs at which this segment was moved. In the case of overlapping,\n\t * concurrent moves this array will contain multiple seqs.\n\t *\n\t * The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.\n\t *\n\t * The first element corresponds to the seq of the first move\n\t */\n\tmovedSeqs: number[];\n\n\t/**\n\t * A reference to the inserted destination segment corresponding to this\n\t * segment's move.\n\t *\n\t * If undefined, the move was an obliterate.\n\t *\n\t * Currently this field is unused, as we only support obliterate operations\n\t */\n\tmoveDst?: ReferencePosition;\n\n\t/**\n\t * List of client IDs that have moved this segment.\n\t *\n\t * The client that actually moved the segment (i.e. whose move op was sequenced\n\t * first) is stored as the first client in this list. Other clients in the\n\t * list have all issued concurrent ops to move the segment.\n\t */\n\tmovedClientIds: number[];\n\n\t/**\n\t * If this segment was inserted into a concurrently moved range and\n\t * the move op was sequenced before the insertion op. In this case,\n\t * the segment is visible only to the inserting client\n\t *\n\t * `wasMovedOnInsert` only applies for acked obliterates. That is, if\n\t * a segment inserted by a remote client is moved on insertion by a local\n\t * and unacked obliterate, we do not consider it as having been moved\n\t * on insert\n\t *\n\t * If a segment is moved on insertion, its length is only ever visible to\n\t * the client that inserted the segment. This is relevant in partial length\n\t * calculations\n\t */\n\twasMovedOnInsert: boolean;\n}\n\nexport function toMoveInfo(maybe: Partial<IMoveInfo> | undefined): IMoveInfo | undefined {\n\tif (maybe?.movedClientIds !== undefined && maybe?.movedSeq !== undefined) {\n\t\treturn maybe as IMoveInfo;\n\t}\n\tassert(\n\t\tmaybe?.movedClientIds === undefined &&\n\t\t\tmaybe?.movedSeq === undefined &&\n\t\t\tmaybe?.movedSeqs === undefined &&\n\t\t\tmaybe?.wasMovedOnInsert === undefined,\n\t\t0x86d /* movedClientIds, movedSeq, wasMovedOnInsert, and movedSeqs should all be either set or not set */,\n\t);\n}\n\n/**\n * A segment representing a portion of the merge tree.\n * Segments are leaf nodes of the merge tree and contain data.\n * @alpha\n */\nexport interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {\n\treadonly type: string;\n\treadonly segmentGroups: SegmentGroupCollection;\n\treadonly trackingCollection: TrackingGroupCollection;\n\t/**\n\t * Whether or not this segment is a special segment denoting the start or\n\t * end of the tree\n\t *\n\t * Endpoint segments are imaginary segments positioned immediately before or\n\t * after the tree. These segments cannot be referenced by regular operations\n\t * and exist primarily as a bucket for local references to slide onto during\n\t * deletion of regular segments.\n\t */\n\treadonly endpointType?: \"start\" | \"end\";\n\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number;\n\t/**\n\t * Stores attribution keys associated with offsets of this segment.\n\t * This data is only persisted if MergeTree's `attributions.track` flag is set to true.\n\t * Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have\n\t * `attribution === undefined` until ack.\n\t *\n\t * Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.\n\t * @remarks There are plans to make the shape of the data stored extensible in a couple ways:\n\t *\n\t * 1. Injection of custom attribution information associated with the segment (ex: copy-paste of\n\t * content but keeping the old attribution information).\n\t *\n\t * 2. Storage of multiple \"channels\" of information (ex: track property changes separately from insertion,\n\t * or only attribute certain property modifications, etc.)\n\t */\n\tattribution?: IAttributionCollection<AttributionKey>;\n\n\t/**\n\t * Manages pending local state for properties on this segment.\n\t */\n\tpropertyManager?: PropertiesManager;\n\t/**\n\t * Local seq at which this segment was inserted.\n\t * This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.\n\t * Once the segment is acked, this field is cleared.\n\t *\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalSeq?: number;\n\t/**\n\t * Local seq at which this segment was removed. If this is defined, `removedSeq` will initially be set to\n\t * UnassignedSequenceNumber. However, if another client concurrently removes the same segment, `removedSeq`\n\t * will be updated to the seq at which that client removed this segment.\n\t *\n\t * Like {@link ISegment.localSeq}, this field is cleared once the local removal of the segment is acked.\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was inserted.\n\t * If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.\n\t */\n\tseq?: number;\n\t/**\n\t * Short clientId for the client that inserted this segment.\n\t */\n\tclientId: number;\n\t/**\n\t * Local references added to this segment.\n\t */\n\tlocalRefs?: LocalReferenceCollection;\n\t/**\n\t * Properties that have been added to this segment via annotation.\n\t */\n\tproperties?: PropertySet;\n\n\t/**\n\t * Add properties to this segment via annotation.\n\t *\n\t * @remarks This function should not be called directly. Properties should\n\t * be added through the `annotateRange` functions.\n\t */\n\taddProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback?: PropertiesRollback,\n\t): PropertySet;\n\tclone(): ISegment;\n\tcanAppend(segment: ISegment): boolean;\n\tappend(segment: ISegment): void;\n\tsplitAt(pos: number): ISegment | undefined;\n\ttoJSONObject(): any;\n\t/**\n\t * Acks the current segment against the segment group, op, and merge tree.\n\t *\n\t * @param segmentGroup - Pending segment group associated with this op.\n\t * @param opArgs - Information about the op that was acked\n\t * @returns `true` if the op modifies the segment, otherwise `false`.\n\t * The only current false case is overlapping remove, where a segment is removed\n\t * by a previously sequenced operation before the current operation is acked.\n\t * @throws - error if the segment state doesn't match segment group or op.\n\t * E.g. if the segment group is not first in the pending queue, or\n\t * an inserted segment does not have unassigned sequence number.\n\t */\n\tack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;\n}\n\n/**\n * @internal\n */\nexport interface IMarkerModifiedAction {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(marker: Marker): void;\n}\n\n/**\n * @alpha\n */\nexport interface ISegmentAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tsegment: ISegment,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number,\n\t\tend: number,\n\t\taccum: TClientData,\n\t): boolean;\n}\n/**\n * @internal\n */\nexport interface ISegmentChanges {\n\tnext?: ISegment;\n\treplaceCurrent?: ISegment;\n}\n/**\n * @internal\n */\nexport interface BlockAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tblock: IMergeBlock,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\taccum: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface NodeAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tnode: IMergeNode,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tclientData: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface InsertContext {\n\tcandidateSegment?: ISegment;\n\tleaf: (segment: ISegment | undefined, pos: number, ic: InsertContext) => ISegmentChanges;\n\tcontinuePredicate?: (continueFromBlock: IMergeBlock) => boolean;\n}\n\n/**\n * @internal\n */\nexport interface SegmentActions<TClientData> {\n\tleaf?: ISegmentAction<TClientData>;\n\tshift?: NodeAction<TClientData>;\n\tcontains?: NodeAction<TClientData>;\n\tpre?: BlockAction<TClientData>;\n\tpost?: BlockAction<TClientData>;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport interface SegmentGroup {\n\tsegments: ISegmentLeaf[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\n}\n\n/**\n * @alpha\n */\nexport class MergeNode implements IMergeNodeCommon {\n\tindex: number = 0;\n\tordinal: string = \"\";\n\tcachedLength: number = 0;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n}\n\n/**\n * Note that the actual branching factor of the MergeTree is `MaxNodesInBlock - 1`. This is because\n * the MergeTree always inserts first, then checks for overflow and splits if the child count equals\n * `MaxNodesInBlock`. (i.e., `MaxNodesInBlock` contains 1 extra slot for temporary storage to\n * facilitate splits.)\n * @internal\n */\nexport const MaxNodesInBlock = 8;\n/**\n * @internal\n */\nexport class MergeBlock extends MergeNode implements IMergeBlock {\n\tparent?: IMergeBlock;\n\tpublic children: IMergeNode[];\n\tpublic constructor(public childCount: number) {\n\t\tsuper();\n\t\tthis.children = new Array<IMergeNode>(MaxNodesInBlock);\n\t}\n\n\tpublic hierBlock(): IHierBlock | undefined {\n\t\treturn undefined;\n\t}\n\n\tpublic setOrdinal(child: IMergeNode, index: number) {\n\t\tconst childCount = this.childCount;\n\t\tassert(\n\t\t\tchildCount >= 1 && childCount <= MaxNodesInBlock,\n\t\t\t0x040 /* \"Child count is not within [1,8] range!\" */,\n\t\t);\n\t\tchild.ordinal = computeHierarchicalOrdinal(\n\t\t\tMaxNodesInBlock,\n\t\t\tchildCount,\n\t\t\tthis.ordinal,\n\t\t\tindex === 0 ? undefined : this.children[index - 1]?.ordinal,\n\t\t);\n\t}\n\n\tpublic assignChild(child: IMergeNode, index: number, updateOrdinal = true) {\n\t\tchild.parent = this;\n\t\tchild.index = index;\n\t\tif (updateOrdinal) {\n\t\t\tthis.setOrdinal(child, index);\n\t\t}\n\t\tthis.children[index] = child;\n\t}\n}\n\nexport function seqLTE(seq: number, minOrRefSeq: number) {\n\treturn seq !== UnassignedSequenceNumber && seq <= minOrRefSeq;\n}\n\n/**\n * @alpha\n */\nexport abstract class BaseSegment extends MergeNode implements ISegment {\n\tpublic clientId: number = LocalClientId;\n\tpublic seq: number = UniversalSequenceNumber;\n\tpublic removedSeq?: number;\n\tpublic removedClientIds?: number[];\n\tpublic movedSeq?: number;\n\tpublic movedSeqs?: number[];\n\tpublic movedClientIds?: number[];\n\tpublic wasMovedOnInsert?: boolean | undefined;\n\tpublic readonly segmentGroups: SegmentGroupCollection = new SegmentGroupCollection(this);\n\tpublic readonly trackingCollection: TrackingGroupCollection = new TrackingGroupCollection(this);\n\t/***/\n\tpublic attribution?: IAttributionCollection<AttributionKey>;\n\tpublic propertyManager?: PropertiesManager;\n\tpublic properties?: PropertySet;\n\tpublic localRefs?: LocalReferenceCollection;\n\tpublic abstract readonly type: string;\n\tpublic localSeq?: number;\n\tpublic localRemovedSeq?: number;\n\tpublic localMovedSeq?: number;\n\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t) {\n\t\tthis.propertyManager ??= new PropertiesManager();\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.properties ??= createMap<any>();\n\t\treturn this.propertyManager.addProperties(\n\t\t\tthis.properties,\n\t\t\tnewProps,\n\t\t\tseq,\n\t\t\tcollaborating,\n\t\t\trollback,\n\t\t);\n\t}\n\n\tpublic hasProperty(key: string): boolean {\n\t\treturn !!this.properties && this.properties[key] !== undefined;\n\t}\n\n\tpublic isLeaf(): this is ISegment {\n\t\treturn true;\n\t}\n\n\tprotected cloneInto(b: ISegment) {\n\t\tb.clientId = this.clientId;\n\t\t// TODO: deep clone properties\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tb.properties = clone(this.properties);\n\t\tb.removedClientIds = this.removedClientIds?.slice();\n\t\t// TODO: copy removed client overlap and branch removal info\n\t\tb.removedSeq = this.removedSeq;\n\t\tb.movedClientIds = this.movedClientIds?.slice();\n\t\tb.movedSeq = this.movedSeq;\n\t\tb.movedSeqs = this.movedSeqs;\n\t\tb.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tb.seq = this.seq;\n\t\tb.attribution = this.attribution?.clone();\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tprotected addSerializedProps(jseg: IJSONSegment) {\n\t\tif (this.properties) {\n\t\t\tjseg.props = this.properties;\n\t\t}\n\t}\n\n\tpublic abstract toJSONObject(): any;\n\n\t/***/\n\tpublic ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean {\n\t\tconst currentSegmentGroup = this.segmentGroups.dequeue();\n\t\tassert(\n\t\t\tcurrentSegmentGroup === segmentGroup,\n\t\t\t0x043 /* \"On ack, unexpected segmentGroup!\" */,\n\t\t);\n\t\tswitch (opArgs.op.type) {\n\t\t\tcase MergeTreeDeltaType.ANNOTATE:\n\t\t\t\tassert(\n\t\t\t\t\t!!this.propertyManager,\n\t\t\t\t\t0x044 /* \"On annotate ack, missing segment property manager!\" */,\n\t\t\t\t);\n\t\t\t\tthis.propertyManager.ackPendingProperties(opArgs.op);\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\tassert(\n\t\t\t\t\tthis.seq === UnassignedSequenceNumber,\n\t\t\t\t\t0x045 /* \"On insert, seq number already assigned!\" */,\n\t\t\t\t);\n\t\t\t\tthis.seq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\tthis.localSeq = undefined;\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.REMOVE:\n\t\t\t\tconst removalInfo: IRemovalInfo | undefined = toRemovalInfo(this);\n\t\t\t\tassert(\n\t\t\t\t\tremovalInfo !== undefined,\n\t\t\t\t\t0x046 /* \"On remove ack, missing removal info!\" */,\n\t\t\t\t);\n\t\t\t\tthis.localRemovedSeq = undefined;\n\t\t\t\tif (removalInfo.removedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tremovalInfo.removedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\n\t\t\tcase MergeTreeDeltaType.OBLITERATE:\n\t\t\t\tconst moveInfo: IMoveInfo | undefined = toMoveInfo(this);\n\t\t\t\tassert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);\n\t\t\t\tthis.localMovedSeq = undefined;\n\t\t\t\tconst seqIdx = moveInfo.movedSeqs.indexOf(UnassignedSequenceNumber);\n\t\t\t\tassert(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);\n\t\t\t\tmoveInfo.movedSeqs[seqIdx] = opArgs.sequencedMessage!.sequenceNumber;\n\n\t\t\t\tif (moveInfo.movedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tmoveInfo.movedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`${opArgs.op.type} is in unrecognized operation type`);\n\t\t}\n\t}\n\n\tpublic splitAt(pos: number): ISegment | undefined {\n\t\tif (pos <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst leafSegment: IMergeLeaf | undefined = this.createSplitSegmentAt(pos);\n\n\t\tif (!leafSegment) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.copyPropertiesTo(leafSegment);\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\tconst thisAsMergeSegment: IMergeLeaf = this;\n\t\tleafSegment.parent = thisAsMergeSegment.parent;\n\n\t\t// Give the leaf a temporary yet valid ordinal.\n\t\t// when this segment is put in the tree, it will get its real ordinal,\n\t\t// but this ordinal meets all the necessary invariants for now.\n\t\tleafSegment.ordinal = this.ordinal + String.fromCharCode(0);\n\n\t\tleafSegment.removedClientIds = this.removedClientIds?.slice();\n\t\tleafSegment.removedSeq = this.removedSeq;\n\t\tleafSegment.localRemovedSeq = this.localRemovedSeq;\n\t\tleafSegment.seq = this.seq;\n\t\tleafSegment.localSeq = this.localSeq;\n\t\tleafSegment.clientId = this.clientId;\n\t\tleafSegment.movedClientIds = this.movedClientIds?.slice();\n\t\tleafSegment.movedSeq = this.movedSeq;\n\t\tleafSegment.movedSeqs = this.movedSeqs?.slice();\n\t\tleafSegment.localMovedSeq = this.localMovedSeq;\n\t\tleafSegment.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tthis.segmentGroups.copyTo(leafSegment);\n\t\tthis.trackingCollection.copyTo(leafSegment);\n\t\tif (this.localRefs) {\n\t\t\tthis.localRefs.split(pos, leafSegment);\n\t\t}\n\t\tif (this.attribution) {\n\t\t\tleafSegment.attribution = this.attribution.splitAt(pos);\n\t\t}\n\n\t\treturn leafSegment;\n\t}\n\n\tprivate copyPropertiesTo(other: ISegment) {\n\t\tif (this.propertyManager) {\n\t\t\tif (this.properties) {\n\t\t\t\tother.propertyManager = new PropertiesManager();\n\t\t\t\tother.properties = this.propertyManager.copyTo(\n\t\t\t\t\tthis.properties,\n\t\t\t\t\tother.properties,\n\t\t\t\t\tother.propertyManager,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic abstract clone(): ISegment;\n\n\tpublic append(other: ISegment): void {\n\t\t// Note: Must call 'appendLocalRefs' before modifying this segment's length as\n\t\t// 'this.cachedLength' is used to adjust the offsets of the local refs.\n\t\tLocalReferenceCollection.append(this, other);\n\t\tif (this.attribution) {\n\t\t\tassert(\n\t\t\t\tother.attribution !== undefined,\n\t\t\t\t0x4bd /* attribution should be set on appendee */,\n\t\t\t);\n\t\t\tthis.attribution.append(other.attribution);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tother.attribution === undefined,\n\t\t\t\t0x4be /* attribution should not be set on appendee */,\n\t\t\t);\n\t\t}\n\n\t\tthis.cachedLength ??= 0;\n\t\tthis.cachedLength += other.cachedLength;\n\t}\n\n\tprotected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;\n}\n\n/**\n * The special-cased property key that tracks the id of a {@link Marker}.\n *\n * @remarks In general, marker ids should be accessed using the inherent method\n * {@link Marker.getId}. Marker ids should not be updated after creation.\n * @internal\n */\nexport const reservedMarkerIdKey = \"markerId\";\n/**\n * @internal\n */\nexport const reservedMarkerSimpleTypeKey = \"markerSimpleType\";\n\n/**\n * @alpha\n */\nexport interface IJSONMarkerSegment extends IJSONSegment {\n\tmarker: IMarkerDef;\n}\n\n/**\n * Markers are a special kind of segment that do not hold any content.\n *\n * Markers with a reference type of {@link ReferenceType.Tile} support spatially\n * accelerated queries for finding the next marker to the left or right of it in\n * sub-linear time. This is useful, for example, in the case of jumping from the\n * start of a paragraph to the end, assuming a paragraph is bound by markers at\n * the start and end.\n *\n * @alpha\n */\nexport class Marker extends BaseSegment implements ReferencePosition, ISegment {\n\tpublic static readonly type = \"Marker\";\n\tpublic static is(segment: ISegment): segment is Marker {\n\t\treturn segment.type === Marker.type;\n\t}\n\tpublic readonly type = Marker.type;\n\n\tpublic static make(refType: ReferenceType, props?: PropertySet) {\n\t\tconst marker = new Marker(refType);\n\t\tif (props) {\n\t\t\tmarker.addProperties(props);\n\t\t}\n\t\treturn marker;\n\t}\n\n\tconstructor(public refType: ReferenceType) {\n\t\tsuper();\n\t\tthis.cachedLength = 1;\n\t}\n\n\ttoJSONObject() {\n\t\tconst obj: IJSONMarkerSegment = { marker: { refType: this.refType } };\n\t\tsuper.addSerializedProps(obj);\n\t\treturn obj;\n\t}\n\n\tstatic fromJSONObject(spec: any) {\n\t\tif (spec && typeof spec === \"object\" && \"marker\" in spec) {\n\t\t\treturn Marker.make(spec.marker.refType, spec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tclone() {\n\t\tconst b = Marker.make(this.refType, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tgetSegment() {\n\t\treturn this;\n\t}\n\n\tgetOffset() {\n\t\treturn 0;\n\t}\n\n\tgetProperties() {\n\t\treturn this.properties;\n\t}\n\n\tgetId(): string | undefined {\n\t\treturn this.properties?.[reservedMarkerIdKey] as string;\n\t}\n\n\ttoString() {\n\t\treturn `M${this.getId()}`;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\treturn undefined;\n\t}\n\n\tcanAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tappend() {\n\t\tthrow new Error(\"Can not append to marker\");\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport class CollaborationWindow {\n\tclientId = LocalClientId;\n\tcollaborating = false;\n\n\t/**\n\t * Lowest-numbered segment in window; no client can reference a state before this one\n\t */\n\tminSeq = 0;\n\t/**\n\t * Highest-numbered segment in window and current reference sequence number for this client.\n\t */\n\tcurrentSeq = 0;\n\n\t/**\n\t * Highest-numbered localSeq used for a pending segment.\n\t * Semantically, `localSeq`s provide an ordering on in-flight merge-tree operations:\n\t * for operations stamped with localSeqs `a` and `b`, `a < b` if and only if `a` was submitted before `b`.\n\t *\n\t * @remarks - This field is analogous to the `clientSequenceNumber` field on ops, but it's accessible to merge-tree\n\t * at op submission time rather than only at ack time. This enables more natural state tracking for in-flight ops.\n\t *\n\t * It's useful to stamp ops with such an incrementing counter because it enables reasoning about which segments existed from\n\t * the perspective of the local client at a given point in 'un-acked' time, which is necessary to support the reconnect flow.\n\t *\n\t * For example, imagine a client with initial state \"123456\" submits some ops to create the text \"123456ABC\".\n\t * If they insert the \"C\" first, then \"B\", then \"A\", their local segment state might look like this:\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t * (note that {@link ISegment.localSeq} tracks the localSeq at which a segment was inserted)\n\t *\n\t * Suppose the client then disconnects and reconnects before any of its insertions are acked. The reconnect flow will necessitate\n\t * that the client regenerates and resubmits ops based on its current segment state as well as the original op that was sent.\n\t *\n\t * It will generate the ops\n\t * 1. \\{ pos: 6, text: \"C\" \\}\n\t * 2. \\{ pos: 6, text: \"B\" \\}\n\t * 3. \\{ pos: 6, text: \"A\" \\}\n\t *\n\t * since when submitting the first op, remote clients don't know that this client is about to submit the \"A\" and \"B\".\n\t *\n\t * On the other hand, imagine if the client had originally submitted the ops in the order \"A\", \"B\", \"C\"\n\t * such that the segments' local state was instead:\n\t *\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t *\n\t * The resubmitted ops should instead be:\n\t * 1. \\{ pos: 6, text: \"A\" \\}\n\t * 2. \\{ pos: 7, text: \"B\" \\}\n\t * 3. \\{ pos: 8, text: \"C\" \\}\n\t *\n\t * since remote clients will have seen the \"A\" when processing the \"B\" as well as both the \"A\" and \"B\" when processing the \"C\".\n\t * As can be seen, the list of resubmitted ops is different in the two cases despite the merge-tree's segment state only differing\n\t * in `localSeq`.\n\t *\n\t * This example is a bit simplified from the general scenario: since no remote clients modified the merge-tree while the client\n\t * was disconnected, the resubmitted ops end up matching the original ops exactly.\n\t * However, this is not generally true: the production reconnect code takes into account visibility of segments based on both acked\n\t * and local information as appropriate.\n\t * Nonetheless, this simple scenario is enough to understand why it's useful to be able to determine if a segment should be visible\n\t * from a given (seq, localSeq) perspective.\n\t */\n\tlocalSeq = 0;\n\n\tloadFrom(a: CollaborationWindow) {\n\t\tthis.clientId = a.clientId;\n\t\tthis.collaborating = a.collaborating;\n\t\tthis.minSeq = a.minSeq;\n\t\tthis.currentSeq = a.currentSeq;\n\t}\n}\n\n/**\n * @internal\n */\nexport const compareNumbers = (a: number, b: number) => a - b;\n\n/**\n * @internal\n */\nexport const compareStrings = (a: string, b: string) => a.localeCompare(b);\n\n/**\n * Get a human-readable string for a given {@link Marker}.\n *\n * @remarks This function is intended for debugging only. The exact format of\n * this string should not be relied upon between versions.\n * @internal\n */\nexport function debugMarkerToString(marker: Marker): string {\n\tlet bbuf = \"\";\n\tif (refTypeIncludesFlag(marker, ReferenceType.Tile)) {\n\t\tbbuf += \"Tile\";\n\t}\n\tlet lbuf = \"\";\n\tconst id = marker.getId();\n\tif (id) {\n\t\tbbuf += ` (${id}) `;\n\t}\n\tconst tileLabels = refGetTileLabels(marker);\n\tif (tileLabels) {\n\t\tlbuf += \"tile -- \";\n\t\tfor (let i = 0, len = tileLabels.length; i < len; i++) {\n\t\t\tconst tileLabel = tileLabels[i];\n\t\t\tif (i > 0) {\n\t\t\t\tlbuf += \"; \";\n\t\t\t}\n\t\t\tlbuf += tileLabel;\n\t\t}\n\t}\n\n\tlet pbuf = \"\";\n\tif (marker.properties) {\n\t\tpbuf += JSON.stringify(marker.properties, (key, value) => {\n\t\t\t// Avoid circular reference when stringifying makers containing handles.\n\t\t\t// (Substitute a debug string instead.)\n\t\t\tconst handle = !!value && value.IFluidHandle;\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value;\n\t\t});\n\t}\n\treturn `M ${bbuf}: ${lbuf} ${pbuf}`;\n}\n"]}
1
+ {"version":3,"file":"mergeTreeNodes.js","sourceRoot":"","sources":["../src/mergeTreeNodes.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6DAA6D;AAE7D,2DAAoD;AAGpD,iDAAkG;AAClG,2DAA+D;AAE/D,iEAAiE;AACjE,qCAAuF;AACvF,6CAA0D;AAE1D,gDAAgD;AAChD,mDAAyE;AACzE,mEAAmG;AACnG,2EAAqE;AACrE,+EAAsF;AA2FtF;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAwC;IACrE,IAAI,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EAAE;QAC7E,OAAO,KAAqB,CAAC;KAC7B;IACD,IAAA,mBAAM,EACL,KAAK,EAAE,gBAAgB,KAAK,SAAS,IAAI,KAAK,EAAE,UAAU,KAAK,SAAS,EACxE,KAAK,CAAC,qEAAqE,CAC3E,CAAC;AACH,CAAC;AARD,sCAQC;AA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AA,wCAAgB,EAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,UAAU,EAAE;QACf,IAAI,IAAI,UAAU,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;YACtD,MAAM,SAAS,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,GAAG,CAAC,EAAE;gBACV,IAAI,IAAI,IAAI,CAAC;aACb;YACD,IAAI,IAAI,SAAS,CAAC;SAClB;KACD;IAED,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,MAAM,CAAC,UAAU,EAAE;QACtB,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACxD,wEAAwE;YACxE,uCAAuC;YACvC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,YAAY,CAAC;YAE7C,+DAA+D;YAC/D,OAAO,MAAM,CAAC,CAAC,CAAC,WAAW,MAAM,CAAC,YAAY,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;QAC/E,CAAC,CAAC,CAAC;KACH;IACD,OAAO,KAAK,IAAI,KAAK,IAAI,IAAI,IAAI,EAAE,CAAC;AACrC,CAAC;AAlCD,kDAkCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { AttributionKey } from \"@fluidframework/runtime-definitions\";\nimport { IAttributionCollection } from \"./attributionCollection.js\";\nimport { LocalClientId, UnassignedSequenceNumber, UniversalSequenceNumber } from \"./constants.js\";\nimport { LocalReferenceCollection } from \"./localReference.js\";\nimport { IMergeTreeDeltaOpArgs } from \"./mergeTreeDeltaCallback.js\";\nimport { TrackingGroupCollection } from \"./mergeTreeTracking.js\";\nimport { IJSONSegment, IMarkerDef, MergeTreeDeltaType, ReferenceType } from \"./ops.js\";\nimport { computeHierarchicalOrdinal } from \"./ordinal.js\";\nimport { PartialSequenceLengths } from \"./partialLengths.js\";\n// eslint-disable-next-line import/no-deprecated\nimport { clone, createMap, MapLike, PropertySet } from \"./properties.js\";\nimport { refTypeIncludesFlag, ReferencePosition, refGetTileLabels } from \"./referencePositions.js\";\nimport { SegmentGroupCollection } from \"./segmentGroupCollection.js\";\nimport { PropertiesManager, PropertiesRollback } from \"./segmentPropertiesManager.js\";\n\n/**\n * Common properties for a node in a merge tree.\n * @alpha\n */\nexport interface IMergeNodeCommon {\n\t/**\n\t * The index of this node in its parent's list of children.\n\t */\n\tindex: number;\n\t/**\n\t * A string that can be used for comparing the location of this node to other `MergeNode`s in the same tree.\n\t * `a.ordinal < b.ordinal` if and only if `a` comes before `b` in a pre-order traversal of the tree.\n\t */\n\tordinal: string;\n\tisLeaf(): this is ISegment;\n}\n/**\n * someday we may split tree leaves from segments, but for now they are the same\n * this is just a convenience type that makes it clear that we need something that is both a segment and a leaf node\n */\nexport type ISegmentLeaf = ISegment & { parent?: IMergeBlock };\nexport type IMergeNode = IMergeBlock | ISegmentLeaf;\n/**\n * Internal (i.e. non-leaf) node in a merge tree.\n * @internal\n */\nexport interface IMergeBlock extends IMergeNodeCommon {\n\tparent?: IMergeBlock;\n\n\tneedsScour?: boolean;\n\t/**\n\t * Number of direct children of this node\n\t */\n\tchildCount: number;\n\t/**\n\t * Array of child nodes.\n\t *\n\t * @remarks To avoid reallocation, this is always initialized to have maximum length as deemed by\n\t * the merge tree's branching factor. Use `childCount` to determine how many children this node actually has.\n\t */\n\tchildren: IMergeNode[];\n\t/**\n\t * Supports querying the total length of all descendants of this IMergeBlock from the perspective of any\n\t * (clientId, seq) within the collab window.\n\t *\n\t * @remarks This is only optional for implementation reasons (internal nodes can be created/moved without\n\t * immediately initializing the partial lengths). Aside from mid-update on tree operations, these lengths\n\t * objects are always defined.\n\t */\n\tpartialLengths?: PartialSequenceLengths;\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number | undefined;\n\thierBlock(): IHierBlock | undefined;\n\tassignChild(child: IMergeNode, index: number, updateOrdinal?: boolean): void;\n\tsetOrdinal(child: IMergeNode, index: number): void;\n}\n\n/**\n * @internal\n */\nexport interface IHierBlock extends IMergeBlock {\n\trightmostTiles: MapLike<ReferencePosition>;\n\tleftmostTiles: MapLike<ReferencePosition>;\n}\n\n/**\n * Contains removal information associated to an {@link ISegment}.\n * @alpha\n */\nexport interface IRemovalInfo {\n\t/**\n\t * Local seq at which this segment was removed, if the removal is yet-to-be acked.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was removed.\n\t */\n\tremovedSeq: number;\n\t/**\n\t * List of client IDs that have removed this segment.\n\t * The client that actually removed the segment (i.e. whose removal op was sequenced first) is stored as the first\n\t * client in this list. Other clients in the list have all issued concurrent ops to remove the segment.\n\t * @remarks When this list has length \\> 1, this is referred to as the \"overlapping remove\" case.\n\t */\n\tremovedClientIds: number[];\n}\n\n/**\n * @internal\n */\nexport function toRemovalInfo(maybe: Partial<IRemovalInfo> | undefined): IRemovalInfo | undefined {\n\tif (maybe?.removedClientIds !== undefined && maybe?.removedSeq !== undefined) {\n\t\treturn maybe as IRemovalInfo;\n\t}\n\tassert(\n\t\tmaybe?.removedClientIds === undefined && maybe?.removedSeq === undefined,\n\t\t0x2bf /* \"both removedClientIds and removedSeq should be set or not set\" */,\n\t);\n}\n\n/**\n * Tracks information about when and where this segment was moved to.\n *\n * Note that merge-tree does not currently support moving and only supports\n * obliterate. The fields below include \"move\" in their names to avoid renaming\n * in the future, when moves _are_ supported.\n * @alpha\n */\nexport interface IMoveInfo {\n\t/**\n\t * Local seq at which this segment was moved if the move is yet-to-be\n\t * acked.\n\t */\n\tlocalMovedSeq?: number;\n\n\t/**\n\t * The first seq at which this segment was moved.\n\t */\n\tmovedSeq: number;\n\n\t/**\n\t * All seqs at which this segment was moved. In the case of overlapping,\n\t * concurrent moves this array will contain multiple seqs.\n\t *\n\t * The seq at `movedSeqs[i]` corresponds to the client id at `movedClientIds[i]`.\n\t *\n\t * The first element corresponds to the seq of the first move\n\t */\n\tmovedSeqs: number[];\n\n\t/**\n\t * A reference to the inserted destination segment corresponding to this\n\t * segment's move.\n\t *\n\t * If undefined, the move was an obliterate.\n\t *\n\t * Currently this field is unused, as we only support obliterate operations\n\t */\n\tmoveDst?: ReferencePosition;\n\n\t/**\n\t * List of client IDs that have moved this segment.\n\t *\n\t * The client that actually moved the segment (i.e. whose move op was sequenced\n\t * first) is stored as the first client in this list. Other clients in the\n\t * list have all issued concurrent ops to move the segment.\n\t */\n\tmovedClientIds: number[];\n\n\t/**\n\t * If this segment was inserted into a concurrently moved range and\n\t * the move op was sequenced before the insertion op. In this case,\n\t * the segment is visible only to the inserting client\n\t *\n\t * `wasMovedOnInsert` only applies for acked obliterates. That is, if\n\t * a segment inserted by a remote client is moved on insertion by a local\n\t * and unacked obliterate, we do not consider it as having been moved\n\t * on insert\n\t *\n\t * If a segment is moved on insertion, its length is only ever visible to\n\t * the client that inserted the segment. This is relevant in partial length\n\t * calculations\n\t */\n\twasMovedOnInsert: boolean;\n}\n\nexport function toMoveInfo(maybe: Partial<IMoveInfo> | undefined): IMoveInfo | undefined {\n\tif (maybe?.movedClientIds !== undefined && maybe?.movedSeq !== undefined) {\n\t\treturn maybe as IMoveInfo;\n\t}\n\tassert(\n\t\tmaybe?.movedClientIds === undefined &&\n\t\t\tmaybe?.movedSeq === undefined &&\n\t\t\tmaybe?.movedSeqs === undefined &&\n\t\t\tmaybe?.wasMovedOnInsert === undefined,\n\t\t0x86d /* movedClientIds, movedSeq, wasMovedOnInsert, and movedSeqs should all be either set or not set */,\n\t);\n}\n\n/**\n * A segment representing a portion of the merge tree.\n * Segments are leaf nodes of the merge tree and contain data.\n * @alpha\n */\nexport interface ISegment extends IMergeNodeCommon, Partial<IRemovalInfo>, Partial<IMoveInfo> {\n\treadonly type: string;\n\treadonly segmentGroups: SegmentGroupCollection;\n\treadonly trackingCollection: TrackingGroupCollection;\n\t/**\n\t * Whether or not this segment is a special segment denoting the start or\n\t * end of the tree\n\t *\n\t * Endpoint segments are imaginary segments positioned immediately before or\n\t * after the tree. These segments cannot be referenced by regular operations\n\t * and exist primarily as a bucket for local references to slide onto during\n\t * deletion of regular segments.\n\t */\n\treadonly endpointType?: \"start\" | \"end\";\n\n\t/**\n\t * The length of the contents of the node.\n\t */\n\tcachedLength: number;\n\t/**\n\t * Stores attribution keys associated with offsets of this segment.\n\t * This data is only persisted if MergeTree's `attributions.track` flag is set to true.\n\t * Pending segments (i.e. ones that only exist locally and haven't been acked by the server) also have\n\t * `attribution === undefined` until ack.\n\t *\n\t * Keys can be used opaquely with an IAttributor or a container runtime that provides attribution.\n\t * @remarks There are plans to make the shape of the data stored extensible in a couple ways:\n\t *\n\t * 1. Injection of custom attribution information associated with the segment (ex: copy-paste of\n\t * content but keeping the old attribution information).\n\t *\n\t * 2. Storage of multiple \"channels\" of information (ex: track property changes separately from insertion,\n\t * or only attribute certain property modifications, etc.)\n\t */\n\tattribution?: IAttributionCollection<AttributionKey>;\n\n\t/**\n\t * Manages pending local state for properties on this segment.\n\t */\n\tpropertyManager?: PropertiesManager;\n\t/**\n\t * Local seq at which this segment was inserted.\n\t * This is defined if and only if the insertion of the segment is pending ack, i.e. `seq` is UnassignedSequenceNumber.\n\t * Once the segment is acked, this field is cleared.\n\t *\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalSeq?: number;\n\t/**\n\t * Local seq at which this segment was removed. If this is defined, `removedSeq` will initially be set to\n\t * UnassignedSequenceNumber. However, if another client concurrently removes the same segment, `removedSeq`\n\t * will be updated to the seq at which that client removed this segment.\n\t *\n\t * Like {@link ISegment.localSeq}, this field is cleared once the local removal of the segment is acked.\n\t * See {@link CollaborationWindow.localSeq} for more information on the semantics of localSeq.\n\t */\n\tlocalRemovedSeq?: number;\n\t/**\n\t * Seq at which this segment was inserted.\n\t * If undefined, it is assumed the segment was inserted prior to the collab window's minimum sequence number.\n\t */\n\tseq?: number;\n\t/**\n\t * Short clientId for the client that inserted this segment.\n\t */\n\tclientId: number;\n\t/**\n\t * Local references added to this segment.\n\t */\n\tlocalRefs?: LocalReferenceCollection;\n\t/**\n\t * Properties that have been added to this segment via annotation.\n\t */\n\tproperties?: PropertySet;\n\n\t/**\n\t * Add properties to this segment via annotation.\n\t *\n\t * @remarks This function should not be called directly. Properties should\n\t * be added through the `annotateRange` functions.\n\t */\n\taddProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback?: PropertiesRollback,\n\t): PropertySet;\n\tclone(): ISegment;\n\tcanAppend(segment: ISegment): boolean;\n\tappend(segment: ISegment): void;\n\tsplitAt(pos: number): ISegment | undefined;\n\ttoJSONObject(): any;\n\t/**\n\t * Acks the current segment against the segment group, op, and merge tree.\n\t *\n\t * @param segmentGroup - Pending segment group associated with this op.\n\t * @param opArgs - Information about the op that was acked\n\t * @returns `true` if the op modifies the segment, otherwise `false`.\n\t * The only current false case is overlapping remove, where a segment is removed\n\t * by a previously sequenced operation before the current operation is acked.\n\t * @throws - error if the segment state doesn't match segment group or op.\n\t * E.g. if the segment group is not first in the pending queue, or\n\t * an inserted segment does not have unassigned sequence number.\n\t */\n\tack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean;\n}\n\n/**\n * @internal\n */\nexport interface IMarkerModifiedAction {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(marker: Marker): void;\n}\n\n/**\n * @alpha\n */\nexport interface ISegmentAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tsegment: ISegment,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number,\n\t\tend: number,\n\t\taccum: TClientData,\n\t): boolean;\n}\n/**\n * @internal\n */\nexport interface ISegmentChanges {\n\tnext?: ISegment;\n\treplaceCurrent?: ISegment;\n}\n/**\n * @internal\n */\nexport interface BlockAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tblock: IMergeBlock,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\taccum: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface NodeAction<TClientData> {\n\t// eslint-disable-next-line @typescript-eslint/prefer-function-type\n\t(\n\t\tnode: IMergeNode,\n\t\tpos: number,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\tclientData: TClientData,\n\t): boolean;\n}\n\n/**\n * @internal\n */\nexport interface InsertContext {\n\tcandidateSegment?: ISegment;\n\tleaf: (segment: ISegment | undefined, pos: number, ic: InsertContext) => ISegmentChanges;\n\tcontinuePredicate?: (continueFromBlock: IMergeBlock) => boolean;\n}\n\n/**\n * @internal\n */\nexport interface SegmentActions<TClientData> {\n\tleaf?: ISegmentAction<TClientData>;\n\tshift?: NodeAction<TClientData>;\n\tcontains?: NodeAction<TClientData>;\n\tpre?: BlockAction<TClientData>;\n\tpost?: BlockAction<TClientData>;\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport interface SegmentGroup {\n\tsegments: ISegment[];\n\tpreviousProps?: PropertySet[];\n\tlocalSeq?: number;\n\trefSeq: number;\n}\n\n/**\n * @alpha\n */\nexport class MergeNode implements IMergeNodeCommon {\n\tindex: number = 0;\n\tordinal: string = \"\";\n\tcachedLength: number = 0;\n\n\tisLeaf(): this is ISegment {\n\t\treturn false;\n\t}\n}\n\n/**\n * Note that the actual branching factor of the MergeTree is `MaxNodesInBlock - 1`. This is because\n * the MergeTree always inserts first, then checks for overflow and splits if the child count equals\n * `MaxNodesInBlock`. (i.e., `MaxNodesInBlock` contains 1 extra slot for temporary storage to\n * facilitate splits.)\n * @internal\n */\nexport const MaxNodesInBlock = 8;\n/**\n * @internal\n */\nexport class MergeBlock extends MergeNode implements IMergeBlock {\n\tparent?: IMergeBlock;\n\tpublic children: IMergeNode[];\n\tpublic constructor(public childCount: number) {\n\t\tsuper();\n\t\tthis.children = new Array<IMergeNode>(MaxNodesInBlock);\n\t}\n\n\tpublic hierBlock(): IHierBlock | undefined {\n\t\treturn undefined;\n\t}\n\n\tpublic setOrdinal(child: IMergeNode, index: number) {\n\t\tconst childCount = this.childCount;\n\t\tassert(\n\t\t\tchildCount >= 1 && childCount <= MaxNodesInBlock,\n\t\t\t0x040 /* \"Child count is not within [1,8] range!\" */,\n\t\t);\n\t\tchild.ordinal = computeHierarchicalOrdinal(\n\t\t\tMaxNodesInBlock,\n\t\t\tchildCount,\n\t\t\tthis.ordinal,\n\t\t\tindex === 0 ? undefined : this.children[index - 1]?.ordinal,\n\t\t);\n\t}\n\n\tpublic assignChild(child: IMergeNode, index: number, updateOrdinal = true) {\n\t\tchild.parent = this;\n\t\tchild.index = index;\n\t\tif (updateOrdinal) {\n\t\t\tthis.setOrdinal(child, index);\n\t\t}\n\t\tthis.children[index] = child;\n\t}\n}\n\nexport function seqLTE(seq: number, minOrRefSeq: number) {\n\treturn seq !== UnassignedSequenceNumber && seq <= minOrRefSeq;\n}\n\n/**\n * @alpha\n */\nexport abstract class BaseSegment extends MergeNode implements ISegment {\n\tpublic clientId: number = LocalClientId;\n\tpublic seq: number = UniversalSequenceNumber;\n\tpublic removedSeq?: number;\n\tpublic removedClientIds?: number[];\n\tpublic movedSeq?: number;\n\tpublic movedSeqs?: number[];\n\tpublic movedClientIds?: number[];\n\tpublic wasMovedOnInsert?: boolean | undefined;\n\tpublic readonly segmentGroups: SegmentGroupCollection = new SegmentGroupCollection(this);\n\tpublic readonly trackingCollection: TrackingGroupCollection = new TrackingGroupCollection(this);\n\t/***/\n\tpublic attribution?: IAttributionCollection<AttributionKey>;\n\tpublic propertyManager?: PropertiesManager;\n\tpublic properties?: PropertySet;\n\tpublic localRefs?: LocalReferenceCollection;\n\tpublic abstract readonly type: string;\n\tpublic localSeq?: number;\n\tpublic localRemovedSeq?: number;\n\tpublic localMovedSeq?: number;\n\n\tpublic addProperties(\n\t\tnewProps: PropertySet,\n\t\tseq?: number,\n\t\tcollaborating?: boolean,\n\t\trollback: PropertiesRollback = PropertiesRollback.None,\n\t) {\n\t\tthis.propertyManager ??= new PropertiesManager();\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.properties ??= createMap<any>();\n\t\treturn this.propertyManager.addProperties(\n\t\t\tthis.properties,\n\t\t\tnewProps,\n\t\t\tseq,\n\t\t\tcollaborating,\n\t\t\trollback,\n\t\t);\n\t}\n\n\tpublic hasProperty(key: string): boolean {\n\t\treturn !!this.properties && this.properties[key] !== undefined;\n\t}\n\n\tpublic isLeaf(): this is ISegment {\n\t\treturn true;\n\t}\n\n\tprotected cloneInto(b: ISegment) {\n\t\tb.clientId = this.clientId;\n\t\t// TODO: deep clone properties\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tb.properties = clone(this.properties);\n\t\tb.removedClientIds = this.removedClientIds?.slice();\n\t\t// TODO: copy removed client overlap and branch removal info\n\t\tb.removedSeq = this.removedSeq;\n\t\tb.movedClientIds = this.movedClientIds?.slice();\n\t\tb.movedSeq = this.movedSeq;\n\t\tb.movedSeqs = this.movedSeqs;\n\t\tb.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tb.seq = this.seq;\n\t\tb.attribution = this.attribution?.clone();\n\t}\n\n\tpublic canAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tprotected addSerializedProps(jseg: IJSONSegment) {\n\t\tif (this.properties) {\n\t\t\tjseg.props = this.properties;\n\t\t}\n\t}\n\n\tpublic abstract toJSONObject(): any;\n\n\t/***/\n\tpublic ack(segmentGroup: SegmentGroup, opArgs: IMergeTreeDeltaOpArgs): boolean {\n\t\tconst currentSegmentGroup = this.segmentGroups.dequeue();\n\t\tassert(\n\t\t\tcurrentSegmentGroup === segmentGroup,\n\t\t\t0x043 /* \"On ack, unexpected segmentGroup!\" */,\n\t\t);\n\t\tswitch (opArgs.op.type) {\n\t\t\tcase MergeTreeDeltaType.ANNOTATE:\n\t\t\t\tassert(\n\t\t\t\t\t!!this.propertyManager,\n\t\t\t\t\t0x044 /* \"On annotate ack, missing segment property manager!\" */,\n\t\t\t\t);\n\t\t\t\tthis.propertyManager.ackPendingProperties(opArgs.op);\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.INSERT:\n\t\t\t\tassert(\n\t\t\t\t\tthis.seq === UnassignedSequenceNumber,\n\t\t\t\t\t0x045 /* \"On insert, seq number already assigned!\" */,\n\t\t\t\t);\n\t\t\t\tthis.seq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\tthis.localSeq = undefined;\n\t\t\t\treturn true;\n\n\t\t\tcase MergeTreeDeltaType.REMOVE:\n\t\t\t\tconst removalInfo: IRemovalInfo | undefined = toRemovalInfo(this);\n\t\t\t\tassert(\n\t\t\t\t\tremovalInfo !== undefined,\n\t\t\t\t\t0x046 /* \"On remove ack, missing removal info!\" */,\n\t\t\t\t);\n\t\t\t\tthis.localRemovedSeq = undefined;\n\t\t\t\tif (removalInfo.removedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tremovalInfo.removedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn false;\n\n\t\t\tcase MergeTreeDeltaType.OBLITERATE:\n\t\t\t\tconst moveInfo: IMoveInfo | undefined = toMoveInfo(this);\n\t\t\t\tassert(moveInfo !== undefined, 0x86e /* On obliterate ack, missing move info! */);\n\t\t\t\tthis.localMovedSeq = undefined;\n\t\t\t\tconst seqIdx = moveInfo.movedSeqs.indexOf(UnassignedSequenceNumber);\n\t\t\t\tassert(seqIdx !== -1, 0x86f /* expected movedSeqs to contain unacked seq */);\n\t\t\t\tmoveInfo.movedSeqs[seqIdx] = opArgs.sequencedMessage!.sequenceNumber;\n\n\t\t\t\tif (moveInfo.movedSeq === UnassignedSequenceNumber) {\n\t\t\t\t\tmoveInfo.movedSeq = opArgs.sequencedMessage!.sequenceNumber;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\n\t\t\tdefault:\n\t\t\t\tthrow new Error(`${opArgs.op.type} is in unrecognized operation type`);\n\t\t}\n\t}\n\n\tpublic splitAt(pos: number): ISegment | undefined {\n\t\tif (pos <= 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst leafSegment: ISegmentLeaf | undefined = this.createSplitSegmentAt(pos);\n\n\t\tif (!leafSegment) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tthis.copyPropertiesTo(leafSegment);\n\t\t// eslint-disable-next-line @typescript-eslint/no-this-alias\n\t\tconst thisAsMergeSegment: ISegmentLeaf = this;\n\t\tleafSegment.parent = thisAsMergeSegment.parent;\n\n\t\t// Give the leaf a temporary yet valid ordinal.\n\t\t// when this segment is put in the tree, it will get its real ordinal,\n\t\t// but this ordinal meets all the necessary invariants for now.\n\t\tleafSegment.ordinal = this.ordinal + String.fromCharCode(0);\n\n\t\tleafSegment.removedClientIds = this.removedClientIds?.slice();\n\t\tleafSegment.removedSeq = this.removedSeq;\n\t\tleafSegment.localRemovedSeq = this.localRemovedSeq;\n\t\tleafSegment.seq = this.seq;\n\t\tleafSegment.localSeq = this.localSeq;\n\t\tleafSegment.clientId = this.clientId;\n\t\tleafSegment.movedClientIds = this.movedClientIds?.slice();\n\t\tleafSegment.movedSeq = this.movedSeq;\n\t\tleafSegment.movedSeqs = this.movedSeqs?.slice();\n\t\tleafSegment.localMovedSeq = this.localMovedSeq;\n\t\tleafSegment.wasMovedOnInsert = this.wasMovedOnInsert;\n\t\tthis.segmentGroups.copyTo(leafSegment);\n\t\tthis.trackingCollection.copyTo(leafSegment);\n\t\tif (this.localRefs) {\n\t\t\tthis.localRefs.split(pos, leafSegment);\n\t\t}\n\t\tif (this.attribution) {\n\t\t\tleafSegment.attribution = this.attribution.splitAt(pos);\n\t\t}\n\n\t\treturn leafSegment;\n\t}\n\n\tprivate copyPropertiesTo(other: ISegment) {\n\t\tif (this.propertyManager) {\n\t\t\tif (this.properties) {\n\t\t\t\tother.propertyManager = new PropertiesManager();\n\t\t\t\tother.properties = this.propertyManager.copyTo(\n\t\t\t\t\tthis.properties,\n\t\t\t\t\tother.properties,\n\t\t\t\t\tother.propertyManager,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic abstract clone(): ISegment;\n\n\tpublic append(other: ISegment): void {\n\t\t// Note: Must call 'appendLocalRefs' before modifying this segment's length as\n\t\t// 'this.cachedLength' is used to adjust the offsets of the local refs.\n\t\tLocalReferenceCollection.append(this, other);\n\t\tif (this.attribution) {\n\t\t\tassert(\n\t\t\t\tother.attribution !== undefined,\n\t\t\t\t0x4bd /* attribution should be set on appendee */,\n\t\t\t);\n\t\t\tthis.attribution.append(other.attribution);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tother.attribution === undefined,\n\t\t\t\t0x4be /* attribution should not be set on appendee */,\n\t\t\t);\n\t\t}\n\n\t\tthis.cachedLength ??= 0;\n\t\tthis.cachedLength += other.cachedLength;\n\t}\n\n\tprotected abstract createSplitSegmentAt(pos: number): BaseSegment | undefined;\n}\n\n/**\n * The special-cased property key that tracks the id of a {@link Marker}.\n *\n * @remarks In general, marker ids should be accessed using the inherent method\n * {@link Marker.getId}. Marker ids should not be updated after creation.\n * @internal\n */\nexport const reservedMarkerIdKey = \"markerId\";\n/**\n * @internal\n */\nexport const reservedMarkerSimpleTypeKey = \"markerSimpleType\";\n\n/**\n * @alpha\n */\nexport interface IJSONMarkerSegment extends IJSONSegment {\n\tmarker: IMarkerDef;\n}\n\n/**\n * Markers are a special kind of segment that do not hold any content.\n *\n * Markers with a reference type of {@link ReferenceType.Tile} support spatially\n * accelerated queries for finding the next marker to the left or right of it in\n * sub-linear time. This is useful, for example, in the case of jumping from the\n * start of a paragraph to the end, assuming a paragraph is bound by markers at\n * the start and end.\n *\n * @alpha\n */\nexport class Marker extends BaseSegment implements ReferencePosition, ISegment {\n\tpublic static readonly type = \"Marker\";\n\tpublic static is(segment: ISegment): segment is Marker {\n\t\treturn segment.type === Marker.type;\n\t}\n\tpublic readonly type = Marker.type;\n\n\tpublic static make(refType: ReferenceType, props?: PropertySet) {\n\t\tconst marker = new Marker(refType);\n\t\tif (props) {\n\t\t\tmarker.addProperties(props);\n\t\t}\n\t\treturn marker;\n\t}\n\n\tconstructor(public refType: ReferenceType) {\n\t\tsuper();\n\t\tthis.cachedLength = 1;\n\t}\n\n\ttoJSONObject() {\n\t\tconst obj: IJSONMarkerSegment = { marker: { refType: this.refType } };\n\t\tsuper.addSerializedProps(obj);\n\t\treturn obj;\n\t}\n\n\tstatic fromJSONObject(spec: any) {\n\t\tif (spec && typeof spec === \"object\" && \"marker\" in spec) {\n\t\t\treturn Marker.make(spec.marker.refType, spec.props as PropertySet);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tclone() {\n\t\tconst b = Marker.make(this.refType, this.properties);\n\t\tthis.cloneInto(b);\n\t\treturn b;\n\t}\n\n\tgetSegment() {\n\t\treturn this;\n\t}\n\n\tgetOffset() {\n\t\treturn 0;\n\t}\n\n\tgetProperties() {\n\t\treturn this.properties;\n\t}\n\n\tgetId(): string | undefined {\n\t\treturn this.properties?.[reservedMarkerIdKey] as string;\n\t}\n\n\ttoString() {\n\t\treturn `M${this.getId()}`;\n\t}\n\n\tprotected createSplitSegmentAt(pos: number) {\n\t\treturn undefined;\n\t}\n\n\tcanAppend(segment: ISegment): boolean {\n\t\treturn false;\n\t}\n\n\tappend() {\n\t\tthrow new Error(\"Can not append to marker\");\n\t}\n}\n\n/**\n * @deprecated This functionality was not meant to be exported and will be removed in a future release\n * @alpha\n */\nexport class CollaborationWindow {\n\tclientId = LocalClientId;\n\tcollaborating = false;\n\n\t/**\n\t * Lowest-numbered segment in window; no client can reference a state before this one\n\t */\n\tminSeq = 0;\n\t/**\n\t * Highest-numbered segment in window and current reference sequence number for this client.\n\t */\n\tcurrentSeq = 0;\n\n\t/**\n\t * Highest-numbered localSeq used for a pending segment.\n\t * Semantically, `localSeq`s provide an ordering on in-flight merge-tree operations:\n\t * for operations stamped with localSeqs `a` and `b`, `a < b` if and only if `a` was submitted before `b`.\n\t *\n\t * @remarks - This field is analogous to the `clientSequenceNumber` field on ops, but it's accessible to merge-tree\n\t * at op submission time rather than only at ack time. This enables more natural state tracking for in-flight ops.\n\t *\n\t * It's useful to stamp ops with such an incrementing counter because it enables reasoning about which segments existed from\n\t * the perspective of the local client at a given point in 'un-acked' time, which is necessary to support the reconnect flow.\n\t *\n\t * For example, imagine a client with initial state \"123456\" submits some ops to create the text \"123456ABC\".\n\t * If they insert the \"C\" first, then \"B\", then \"A\", their local segment state might look like this:\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t * (note that {@link ISegment.localSeq} tracks the localSeq at which a segment was inserted)\n\t *\n\t * Suppose the client then disconnects and reconnects before any of its insertions are acked. The reconnect flow will necessitate\n\t * that the client regenerates and resubmits ops based on its current segment state as well as the original op that was sent.\n\t *\n\t * It will generate the ops\n\t * 1. \\{ pos: 6, text: \"C\" \\}\n\t * 2. \\{ pos: 6, text: \"B\" \\}\n\t * 3. \\{ pos: 6, text: \"A\" \\}\n\t *\n\t * since when submitting the first op, remote clients don't know that this client is about to submit the \"A\" and \"B\".\n\t *\n\t * On the other hand, imagine if the client had originally submitted the ops in the order \"A\", \"B\", \"C\"\n\t * such that the segments' local state was instead:\n\t *\n\t * ```js\n\t * [\n\t * { seq: 0, text: \"1234\" },\n\t * { seq: 5, text: \"56\" },\n\t * { localSeq: 1, seq: UnassignedSequenceNumber, text: \"A\" },\n\t * { localSeq: 2, seq: UnassignedSequenceNumber, text: \"B\" },\n\t * { localSeq: 3, seq: UnassignedSequenceNumber, text: \"C\" },\n\t * ]\n\t * ```\n\t *\n\t * The resubmitted ops should instead be:\n\t * 1. \\{ pos: 6, text: \"A\" \\}\n\t * 2. \\{ pos: 7, text: \"B\" \\}\n\t * 3. \\{ pos: 8, text: \"C\" \\}\n\t *\n\t * since remote clients will have seen the \"A\" when processing the \"B\" as well as both the \"A\" and \"B\" when processing the \"C\".\n\t * As can be seen, the list of resubmitted ops is different in the two cases despite the merge-tree's segment state only differing\n\t * in `localSeq`.\n\t *\n\t * This example is a bit simplified from the general scenario: since no remote clients modified the merge-tree while the client\n\t * was disconnected, the resubmitted ops end up matching the original ops exactly.\n\t * However, this is not generally true: the production reconnect code takes into account visibility of segments based on both acked\n\t * and local information as appropriate.\n\t * Nonetheless, this simple scenario is enough to understand why it's useful to be able to determine if a segment should be visible\n\t * from a given (seq, localSeq) perspective.\n\t */\n\tlocalSeq = 0;\n\n\tloadFrom(a: CollaborationWindow) {\n\t\tthis.clientId = a.clientId;\n\t\tthis.collaborating = a.collaborating;\n\t\tthis.minSeq = a.minSeq;\n\t\tthis.currentSeq = a.currentSeq;\n\t}\n}\n\n/**\n * @internal\n */\nexport const compareNumbers = (a: number, b: number) => a - b;\n\n/**\n * @internal\n */\nexport const compareStrings = (a: string, b: string) => a.localeCompare(b);\n\n/**\n * Get a human-readable string for a given {@link Marker}.\n *\n * @remarks This function is intended for debugging only. The exact format of\n * this string should not be relied upon between versions.\n * @internal\n */\nexport function debugMarkerToString(marker: Marker): string {\n\tlet bbuf = \"\";\n\tif (refTypeIncludesFlag(marker, ReferenceType.Tile)) {\n\t\tbbuf += \"Tile\";\n\t}\n\tlet lbuf = \"\";\n\tconst id = marker.getId();\n\tif (id) {\n\t\tbbuf += ` (${id}) `;\n\t}\n\tconst tileLabels = refGetTileLabels(marker);\n\tif (tileLabels) {\n\t\tlbuf += \"tile -- \";\n\t\tfor (let i = 0, len = tileLabels.length; i < len; i++) {\n\t\t\tconst tileLabel = tileLabels[i];\n\t\t\tif (i > 0) {\n\t\t\t\tlbuf += \"; \";\n\t\t\t}\n\t\t\tlbuf += tileLabel;\n\t\t}\n\t}\n\n\tlet pbuf = \"\";\n\tif (marker.properties) {\n\t\tpbuf += JSON.stringify(marker.properties, (key, value) => {\n\t\t\t// Avoid circular reference when stringifying makers containing handles.\n\t\t\t// (Substitute a debug string instead.)\n\t\t\tconst handle = !!value && value.IFluidHandle;\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn handle ? `#Handle(${handle.routeContext.path}/${handle.path})` : value;\n\t\t});\n\t}\n\treturn `M ${bbuf}: ${lbuf} ${pbuf}`;\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { LocalReferencePosition } from "./localReference";
6
- import { ISegment } from "./mergeTreeNodes";
5
+ import { LocalReferencePosition } from "./localReference.js";
6
+ import { ISegment } from "./mergeTreeNodes.js";
7
7
  /**
8
8
  * @alpha
9
9
  */