@fluidframework/merge-tree 2.0.0-internal.8.0.0 → 2.0.0-rc.1.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.
- package/CHANGELOG.md +38 -0
- package/README.md +0 -6
- package/api-extractor-esm.json +17 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +0 -4
- package/api-report/merge-tree.api.md +4 -9
- package/dist/client.d.ts +0 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +0 -7
- package/dist/client.js.map +1 -1
- package/dist/merge-tree-alpha.d.ts +27 -12
- package/dist/merge-tree-beta.d.ts +0 -16
- package/dist/merge-tree-public.d.ts +0 -16
- package/dist/merge-tree-untrimmed.d.ts +5 -29
- package/dist/mergeTree.d.ts +0 -17
- package/dist/mergeTree.d.ts.map +1 -1
- package/dist/mergeTree.js +0 -130
- package/dist/mergeTree.js.map +1 -1
- package/dist/ops.d.ts +1 -1
- package/dist/ops.js +1 -1
- package/dist/ops.js.map +1 -1
- package/dist/revertibles.d.ts +4 -4
- package/dist/revertibles.js +3 -3
- package/dist/revertibles.js.map +1 -1
- package/dist/test/Insertion.perf.spec.d.ts +6 -0
- package/dist/test/Insertion.perf.spec.d.ts.map +1 -0
- package/dist/test/Insertion.perf.spec.js +113 -0
- package/dist/test/Insertion.perf.spec.js.map +1 -0
- package/dist/test/PartialLengths.perf.spec.d.ts +6 -0
- package/dist/test/PartialLengths.perf.spec.d.ts.map +1 -0
- package/dist/test/PartialLengths.perf.spec.js +67 -0
- package/dist/test/PartialLengths.perf.spec.js.map +1 -0
- package/dist/test/Removal.perf.spec.d.ts +6 -0
- package/dist/test/Removal.perf.spec.d.ts.map +1 -0
- package/dist/test/Removal.perf.spec.js +166 -0
- package/dist/test/Removal.perf.spec.js.map +1 -0
- package/dist/test/Snapshot.perf.spec.d.ts +6 -0
- package/dist/test/Snapshot.perf.spec.d.ts.map +1 -0
- package/dist/test/Snapshot.perf.spec.js +33 -0
- package/dist/test/Snapshot.perf.spec.js.map +1 -0
- package/dist/test/attributionCollection.perf.spec.d.ts +6 -0
- package/dist/test/attributionCollection.perf.spec.d.ts.map +1 -0
- package/dist/test/attributionCollection.perf.spec.js +231 -0
- package/dist/test/attributionCollection.perf.spec.js.map +1 -0
- package/dist/test/attributionCollection.spec.d.ts +6 -0
- package/dist/test/attributionCollection.spec.d.ts.map +1 -0
- package/dist/test/attributionCollection.spec.js +486 -0
- package/dist/test/attributionCollection.spec.js.map +1 -0
- package/dist/test/attributionPolicy.spec.d.ts +6 -0
- package/dist/test/attributionPolicy.spec.d.ts.map +1 -0
- package/dist/test/attributionPolicy.spec.js +189 -0
- package/dist/test/attributionPolicy.spec.js.map +1 -0
- package/dist/test/beastTest.d.ts +54 -0
- package/dist/test/beastTest.d.ts.map +1 -0
- package/dist/test/beastTest.js +1333 -0
- package/dist/test/beastTest.js.map +1 -0
- package/dist/test/client.annotateMarker.spec.d.ts +6 -0
- package/dist/test/client.annotateMarker.spec.d.ts.map +1 -0
- package/dist/test/client.annotateMarker.spec.js +45 -0
- package/dist/test/client.annotateMarker.spec.js.map +1 -0
- package/dist/test/client.apis.d.ts +7 -0
- package/dist/test/client.apis.d.ts.map +1 -0
- package/dist/test/client.apis.js +72 -0
- package/dist/test/client.apis.js.map +1 -0
- package/dist/test/client.applyMsg.spec.d.ts +6 -0
- package/dist/test/client.applyMsg.spec.d.ts.map +1 -0
- package/dist/test/client.applyMsg.spec.js +500 -0
- package/dist/test/client.applyMsg.spec.js.map +1 -0
- package/dist/test/client.applyStashedOpFarm.spec.d.ts +12 -0
- package/dist/test/client.applyStashedOpFarm.spec.d.ts.map +1 -0
- package/dist/test/client.applyStashedOpFarm.spec.js +144 -0
- package/dist/test/client.applyStashedOpFarm.spec.js.map +1 -0
- package/dist/test/client.attributionFarm.spec.d.ts +7 -0
- package/dist/test/client.attributionFarm.spec.d.ts.map +1 -0
- package/dist/test/client.attributionFarm.spec.js +96 -0
- package/dist/test/client.attributionFarm.spec.js.map +1 -0
- package/dist/test/client.conflictFarm.spec.d.ts +15 -0
- package/dist/test/client.conflictFarm.spec.d.ts.map +1 -0
- package/dist/test/client.conflictFarm.spec.js +88 -0
- package/dist/test/client.conflictFarm.spec.js.map +1 -0
- package/dist/test/client.getPosition.spec.d.ts +6 -0
- package/dist/test/client.getPosition.spec.d.ts.map +1 -0
- package/dist/test/client.getPosition.spec.js +54 -0
- package/dist/test/client.getPosition.spec.js.map +1 -0
- package/dist/test/client.localReference.spec.d.ts +6 -0
- package/dist/test/client.localReference.spec.d.ts.map +1 -0
- package/dist/test/client.localReference.spec.js +439 -0
- package/dist/test/client.localReference.spec.js.map +1 -0
- package/dist/test/client.localReferenceFarm.spec.d.ts +6 -0
- package/dist/test/client.localReferenceFarm.spec.d.ts.map +1 -0
- package/dist/test/client.localReferenceFarm.spec.js +88 -0
- package/dist/test/client.localReferenceFarm.spec.js.map +1 -0
- package/dist/test/client.rebasePosition.spec.d.ts +6 -0
- package/dist/test/client.rebasePosition.spec.d.ts.map +1 -0
- package/dist/test/client.rebasePosition.spec.js +102 -0
- package/dist/test/client.rebasePosition.spec.js.map +1 -0
- package/dist/test/client.reconnectFarm.spec.d.ts +12 -0
- package/dist/test/client.reconnectFarm.spec.d.ts.map +1 -0
- package/dist/test/client.reconnectFarm.spec.js +91 -0
- package/dist/test/client.reconnectFarm.spec.js.map +1 -0
- package/dist/test/client.replay.spec.d.ts +6 -0
- package/dist/test/client.replay.spec.d.ts.map +1 -0
- package/dist/test/client.replay.spec.js +85 -0
- package/dist/test/client.replay.spec.js.map +1 -0
- package/dist/test/client.rollback.spec.d.ts +6 -0
- package/dist/test/client.rollback.spec.d.ts.map +1 -0
- package/dist/test/client.rollback.spec.js +453 -0
- package/dist/test/client.rollback.spec.js.map +1 -0
- package/dist/test/client.rollbackFarm.spec.d.ts +6 -0
- package/dist/test/client.rollbackFarm.spec.d.ts.map +1 -0
- package/dist/test/client.rollbackFarm.spec.js +48 -0
- package/dist/test/client.rollbackFarm.spec.js.map +1 -0
- package/dist/test/client.searchForMarker.spec.d.ts +6 -0
- package/dist/test/client.searchForMarker.spec.d.ts.map +1 -0
- package/dist/test/client.searchForMarker.spec.js +446 -0
- package/dist/test/client.searchForMarker.spec.js.map +1 -0
- package/dist/test/client.walkSegments.spec.d.ts +6 -0
- package/dist/test/client.walkSegments.spec.d.ts.map +1 -0
- package/dist/test/client.walkSegments.spec.js +54 -0
- package/dist/test/client.walkSegments.spec.js.map +1 -0
- package/dist/test/collections.list.spec.d.ts +6 -0
- package/dist/test/collections.list.spec.d.ts.map +1 -0
- package/dist/test/collections.list.spec.js +84 -0
- package/dist/test/collections.list.spec.js.map +1 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.d.ts +6 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.d.ts.map +1 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js +35 -0
- package/dist/test/createInsertOnlyAttributionPolicy.spec.js.map +1 -0
- package/dist/test/index.d.ts +13 -0
- package/dist/test/index.d.ts.map +1 -0
- package/dist/test/index.js +88 -0
- package/dist/test/index.js.map +1 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.d.ts +6 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js +142 -0
- package/dist/test/mergeTree.annotate.deltaCallback.spec.js.map +1 -0
- package/dist/test/mergeTree.annotate.spec.d.ts +6 -0
- package/dist/test/mergeTree.annotate.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.annotate.spec.js +448 -0
- package/dist/test/mergeTree.annotate.spec.js.map +1 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.d.ts +6 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.js +126 -0
- package/dist/test/mergeTree.insert.deltaCallback.spec.js.map +1 -0
- package/dist/test/mergeTree.insertingWalk.spec.d.ts +6 -0
- package/dist/test/mergeTree.insertingWalk.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.insertingWalk.spec.js +279 -0
- package/dist/test/mergeTree.insertingWalk.spec.js.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts +6 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js +178 -0
- package/dist/test/mergeTree.markRangeRemoved.deltaCallback.spec.js.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.d.ts +6 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.js +130 -0
- package/dist/test/mergeTree.markRangeRemoved.spec.js.map +1 -0
- package/dist/test/mergeTree.walk.spec.d.ts +6 -0
- package/dist/test/mergeTree.walk.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.walk.spec.js +63 -0
- package/dist/test/mergeTree.walk.spec.js.map +1 -0
- package/dist/test/mergeTree.zamboni.spec.d.ts +6 -0
- package/dist/test/mergeTree.zamboni.spec.d.ts.map +1 -0
- package/dist/test/mergeTree.zamboni.spec.js +52 -0
- package/dist/test/mergeTree.zamboni.spec.js.map +1 -0
- package/dist/test/mergeTreeOperationRunner.d.ts +63 -0
- package/dist/test/mergeTreeOperationRunner.d.ts.map +1 -0
- package/dist/test/mergeTreeOperationRunner.js +245 -0
- package/dist/test/mergeTreeOperationRunner.js.map +1 -0
- package/dist/test/mergeTreeOperationRunner.spec.d.ts +6 -0
- package/dist/test/mergeTreeOperationRunner.spec.d.ts.map +1 -0
- package/dist/test/mergeTreeOperationRunner.spec.js +156 -0
- package/dist/test/mergeTreeOperationRunner.spec.js.map +1 -0
- package/dist/test/obliterate.concurrent.spec.d.ts +6 -0
- package/dist/test/obliterate.concurrent.spec.d.ts.map +1 -0
- package/dist/test/obliterate.concurrent.spec.js +1446 -0
- package/dist/test/obliterate.concurrent.spec.js.map +1 -0
- package/dist/test/obliterate.partialLength.spec.d.ts +6 -0
- package/dist/test/obliterate.partialLength.spec.d.ts.map +1 -0
- package/dist/test/obliterate.partialLength.spec.js +279 -0
- package/dist/test/obliterate.partialLength.spec.js.map +1 -0
- package/dist/test/obliterate.reconnect.spec.d.ts +6 -0
- package/dist/test/obliterate.reconnect.spec.d.ts.map +1 -0
- package/dist/test/obliterate.reconnect.spec.js +164 -0
- package/dist/test/obliterate.reconnect.spec.js.map +1 -0
- package/dist/test/obliterate.spec.d.ts +6 -0
- package/dist/test/obliterate.spec.d.ts.map +1 -0
- package/dist/test/obliterate.spec.js +162 -0
- package/dist/test/obliterate.spec.js.map +1 -0
- package/dist/test/ordinal.spec.d.ts +2 -0
- package/dist/test/ordinal.spec.d.ts.map +1 -0
- package/dist/test/ordinal.spec.js +43 -0
- package/dist/test/ordinal.spec.js.map +1 -0
- package/dist/test/partialLength.spec.d.ts +6 -0
- package/dist/test/partialLength.spec.d.ts.map +1 -0
- package/dist/test/partialLength.spec.js +282 -0
- package/dist/test/partialLength.spec.js.map +1 -0
- package/dist/test/properties.spec.d.ts +6 -0
- package/dist/test/properties.spec.d.ts.map +1 -0
- package/dist/test/properties.spec.js +55 -0
- package/dist/test/properties.spec.js.map +1 -0
- package/dist/test/reconnectHelper.d.ts +48 -0
- package/dist/test/reconnectHelper.d.ts.map +1 -0
- package/dist/test/reconnectHelper.js +86 -0
- package/dist/test/reconnectHelper.js.map +1 -0
- package/dist/test/resetPendingSegmentsToOp.spec.d.ts +6 -0
- package/dist/test/resetPendingSegmentsToOp.spec.d.ts.map +1 -0
- package/dist/test/resetPendingSegmentsToOp.spec.js +218 -0
- package/dist/test/resetPendingSegmentsToOp.spec.js.map +1 -0
- package/dist/test/revertibleFarm.spec.d.ts +6 -0
- package/dist/test/revertibleFarm.spec.d.ts.map +1 -0
- package/dist/test/revertibleFarm.spec.js +124 -0
- package/dist/test/revertibleFarm.spec.js.map +1 -0
- package/dist/test/revertibles.spec.d.ts +17 -0
- package/dist/test/revertibles.spec.d.ts.map +1 -0
- package/dist/test/revertibles.spec.js +385 -0
- package/dist/test/revertibles.spec.js.map +1 -0
- package/dist/test/segmentGroupCollection.spec.d.ts +6 -0
- package/dist/test/segmentGroupCollection.spec.d.ts.map +1 -0
- package/dist/test/segmentGroupCollection.spec.js +60 -0
- package/dist/test/segmentGroupCollection.spec.js.map +1 -0
- package/dist/test/snapshot.spec.d.ts +6 -0
- package/dist/test/snapshot.spec.d.ts.map +1 -0
- package/dist/test/snapshot.spec.js +178 -0
- package/dist/test/snapshot.spec.js.map +1 -0
- package/dist/test/snapshot.utils.d.ts +33 -0
- package/dist/test/snapshot.utils.d.ts.map +1 -0
- package/dist/test/snapshot.utils.js +109 -0
- package/dist/test/snapshot.utils.js.map +1 -0
- package/dist/test/snapshotlegacy.spec.d.ts +6 -0
- package/dist/test/snapshotlegacy.spec.d.ts.map +1 -0
- package/dist/test/snapshotlegacy.spec.js +139 -0
- package/dist/test/snapshotlegacy.spec.js.map +1 -0
- package/dist/test/sortedSegmentSet.spec.d.ts +6 -0
- package/dist/test/sortedSegmentSet.spec.d.ts.map +1 -0
- package/dist/test/sortedSegmentSet.spec.js +95 -0
- package/dist/test/sortedSegmentSet.spec.js.map +1 -0
- package/dist/test/testClient.d.ts +119 -0
- package/dist/test/testClient.d.ts.map +1 -0
- package/dist/test/testClient.js +439 -0
- package/dist/test/testClient.js.map +1 -0
- package/dist/test/testClientLogger.d.ts +44 -0
- package/dist/test/testClientLogger.d.ts.map +1 -0
- package/dist/test/testClientLogger.js +287 -0
- package/dist/test/testClientLogger.js.map +1 -0
- package/dist/test/testSerializer.d.ts +18 -0
- package/dist/test/testSerializer.d.ts.map +1 -0
- package/dist/test/testSerializer.js +33 -0
- package/dist/test/testSerializer.js.map +1 -0
- package/dist/test/testServer.d.ts +36 -0
- package/dist/test/testServer.d.ts.map +1 -0
- package/dist/test/testServer.js +138 -0
- package/dist/test/testServer.js.map +1 -0
- package/dist/test/testUtils.d.ts +69 -0
- package/dist/test/testUtils.d.ts.map +1 -0
- package/dist/test/testUtils.js +149 -0
- package/dist/test/testUtils.js.map +1 -0
- package/dist/test/text.d.ts +9 -0
- package/dist/test/text.d.ts.map +1 -0
- package/dist/test/text.js +76 -0
- package/dist/test/text.js.map +1 -0
- package/dist/test/tracking.spec.d.ts +6 -0
- package/dist/test/tracking.spec.d.ts.map +1 -0
- package/dist/test/tracking.spec.js +120 -0
- package/dist/test/tracking.spec.js.map +1 -0
- package/dist/test/wordUnitTests.d.ts +6 -0
- package/dist/test/wordUnitTests.d.ts.map +1 -0
- package/dist/test/wordUnitTests.js +172 -0
- package/dist/test/wordUnitTests.js.map +1 -0
- package/lib/{MergeTreeTextHelper.d.ts → MergeTreeTextHelper.d.mts} +3 -3
- package/lib/MergeTreeTextHelper.d.mts.map +1 -0
- package/lib/{MergeTreeTextHelper.js → MergeTreeTextHelper.mjs} +5 -10
- package/lib/MergeTreeTextHelper.mjs.map +1 -0
- package/lib/{attributionCollection.d.ts → attributionCollection.d.mts} +2 -2
- package/lib/attributionCollection.d.mts.map +1 -0
- package/lib/{attributionCollection.js → attributionCollection.mjs} +9 -14
- package/lib/attributionCollection.mjs.map +1 -0
- package/lib/{attributionPolicy.d.ts → attributionPolicy.d.mts} +2 -2
- package/lib/attributionPolicy.d.mts.map +1 -0
- package/lib/{attributionPolicy.js → attributionPolicy.mjs} +21 -27
- package/lib/attributionPolicy.mjs.map +1 -0
- package/lib/{client.d.ts → client.d.mts} +9 -16
- package/lib/client.d.mts.map +1 -0
- package/lib/{client.js → client.mjs} +101 -110
- package/lib/client.mjs.map +1 -0
- package/lib/collections/{index.d.ts → index.d.mts} +3 -3
- package/lib/collections/index.d.mts.map +1 -0
- package/lib/collections/index.mjs +7 -0
- package/lib/collections/index.mjs.map +1 -0
- package/lib/collections/{list.d.ts → list.d.mts} +1 -1
- package/lib/collections/list.d.mts.map +1 -0
- package/lib/collections/{list.js → list.mjs} +6 -11
- package/lib/collections/list.mjs.map +1 -0
- package/lib/collections/{rbTree.d.ts → rbTree.d.mts} +1 -1
- package/lib/collections/rbTree.d.mts.map +1 -0
- package/lib/collections/{rbTree.js → rbTree.mjs} +16 -20
- package/lib/collections/rbTree.mjs.map +1 -0
- package/lib/{constants.d.ts → constants.d.mts} +1 -1
- package/lib/constants.d.mts.map +1 -0
- package/lib/constants.mjs +32 -0
- package/lib/constants.mjs.map +1 -0
- package/lib/{endOfTreeSegment.d.ts → endOfTreeSegment.d.mts} +4 -4
- package/lib/endOfTreeSegment.d.mts.map +1 -0
- package/lib/{endOfTreeSegment.js → endOfTreeSegment.mjs} +13 -18
- package/lib/endOfTreeSegment.mjs.map +1 -0
- package/lib/{index.d.ts → index.d.mts} +21 -21
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +24 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{localReference.d.ts → localReference.d.mts} +7 -7
- package/lib/localReference.d.mts.map +1 -0
- package/lib/{localReference.js → localReference.mjs} +38 -47
- package/lib/localReference.mjs.map +1 -0
- package/lib/{merge-tree-alpha.d.ts → merge-tree-alpha.d.mts} +27 -12
- package/lib/{merge-tree-beta.d.ts → merge-tree-beta.d.mts} +0 -16
- package/lib/{merge-tree-public.d.ts → merge-tree-public.d.mts} +0 -16
- package/lib/{merge-tree-untrimmed.d.ts → merge-tree-untrimmed.d.mts} +5 -29
- package/lib/{mergeTree.d.ts → mergeTree.d.mts} +12 -29
- package/lib/mergeTree.d.mts.map +1 -0
- package/lib/{mergeTree.js → mergeTree.mjs} +203 -340
- package/lib/mergeTree.mjs.map +1 -0
- package/lib/{mergeTreeDeltaCallback.d.ts → mergeTreeDeltaCallback.d.mts} +4 -8
- package/lib/mergeTreeDeltaCallback.d.mts.map +1 -0
- package/lib/{mergeTreeDeltaCallback.js → mergeTreeDeltaCallback.mjs} +2 -5
- package/lib/mergeTreeDeltaCallback.mjs.map +1 -0
- package/lib/{mergeTreeNodeWalk.d.ts → mergeTreeNodeWalk.d.mts} +2 -2
- package/lib/mergeTreeNodeWalk.d.mts.map +1 -0
- package/lib/{mergeTreeNodeWalk.js → mergeTreeNodeWalk.mjs} +14 -21
- package/lib/mergeTreeNodeWalk.mjs.map +1 -0
- package/lib/{mergeTreeNodes.d.ts → mergeTreeNodes.d.mts} +12 -12
- package/lib/mergeTreeNodes.d.mts.map +1 -0
- package/lib/{mergeTreeNodes.js → mergeTreeNodes.mjs} +60 -76
- package/lib/mergeTreeNodes.mjs.map +1 -0
- package/lib/{mergeTreeTracking.d.ts → mergeTreeTracking.d.mts} +3 -3
- package/lib/mergeTreeTracking.d.mts.map +1 -0
- package/lib/{mergeTreeTracking.js → mergeTreeTracking.mjs} +6 -13
- package/lib/mergeTreeTracking.mjs.map +1 -0
- package/lib/{opBuilder.d.ts → opBuilder.d.mts} +4 -4
- package/lib/opBuilder.d.mts.map +1 -0
- package/lib/{opBuilder.js → opBuilder.mjs} +15 -25
- package/lib/opBuilder.mjs.map +1 -0
- package/lib/{ops.d.ts → ops.d.mts} +2 -2
- package/lib/ops.d.mts.map +1 -0
- package/lib/{ops.js → ops.mjs} +5 -8
- package/lib/ops.mjs.map +1 -0
- package/lib/{ordinal.d.ts → ordinal.d.mts} +1 -1
- package/lib/ordinal.d.mts.map +1 -0
- package/lib/{ordinal.js → ordinal.mjs} +4 -9
- package/lib/ordinal.mjs.map +1 -0
- package/lib/{partialLengths.d.ts → partialLengths.d.mts} +4 -4
- package/lib/partialLengths.d.mts.map +1 -0
- package/lib/{partialLengths.js → partialLengths.mjs} +38 -46
- package/lib/partialLengths.mjs.map +1 -0
- package/lib/{properties.d.ts → properties.d.mts} +1 -1
- package/lib/properties.d.mts.map +1 -0
- package/lib/{properties.js → properties.mjs} +7 -16
- package/lib/properties.mjs.map +1 -0
- package/lib/{referencePositions.d.ts → referencePositions.d.mts} +5 -5
- package/lib/referencePositions.d.mts.map +1 -0
- package/lib/referencePositions.mjs +70 -0
- package/lib/referencePositions.mjs.map +1 -0
- package/lib/{revertibles.d.ts → revertibles.d.mts} +12 -12
- package/lib/revertibles.d.mts.map +1 -0
- package/lib/{revertibles.js → revertibles.mjs} +60 -67
- package/lib/revertibles.mjs.map +1 -0
- package/lib/{segmentGroupCollection.d.ts → segmentGroupCollection.d.mts} +2 -2
- package/lib/segmentGroupCollection.d.mts.map +1 -0
- package/lib/{segmentGroupCollection.js → segmentGroupCollection.mjs} +5 -9
- package/lib/segmentGroupCollection.mjs.map +1 -0
- package/lib/{segmentPropertiesManager.d.ts → segmentPropertiesManager.d.mts} +3 -3
- package/lib/segmentPropertiesManager.d.mts.map +1 -0
- package/lib/{segmentPropertiesManager.js → segmentPropertiesManager.mjs} +14 -20
- package/lib/{segmentPropertiesManager.js.map → segmentPropertiesManager.mjs.map} +1 -1
- package/lib/{snapshotChunks.d.ts → snapshotChunks.d.mts} +4 -4
- package/lib/snapshotChunks.d.mts.map +1 -0
- package/lib/{snapshotChunks.js → snapshotChunks.mjs} +10 -17
- package/lib/snapshotChunks.mjs.map +1 -0
- package/lib/{snapshotLoader.d.ts → snapshotLoader.d.mts} +3 -3
- package/lib/snapshotLoader.d.mts.map +1 -0
- package/lib/{snapshotLoader.js → snapshotLoader.mjs} +33 -38
- package/lib/snapshotLoader.mjs.map +1 -0
- package/lib/{snapshotV1.d.ts → snapshotV1.d.mts} +4 -4
- package/lib/snapshotV1.d.mts.map +1 -0
- package/lib/{snapshotV1.js → snapshotV1.mjs} +28 -32
- package/lib/snapshotV1.mjs.map +1 -0
- package/lib/{snapshotlegacy.d.ts → snapshotlegacy.d.mts} +3 -3
- package/lib/snapshotlegacy.d.mts.map +1 -0
- package/lib/{snapshotlegacy.js → snapshotlegacy.mjs} +21 -26
- package/lib/snapshotlegacy.mjs.map +1 -0
- package/lib/{sortedSegmentSet.d.ts → sortedSegmentSet.d.mts} +4 -4
- package/lib/sortedSegmentSet.d.mts.map +1 -0
- package/lib/{sortedSegmentSet.js → sortedSegmentSet.mjs} +3 -8
- package/lib/sortedSegmentSet.mjs.map +1 -0
- package/lib/{sortedSet.d.ts → sortedSet.d.mts} +1 -1
- package/lib/sortedSet.d.mts.map +1 -0
- package/lib/{sortedSet.js → sortedSet.mjs} +2 -6
- package/lib/sortedSet.mjs.map +1 -0
- package/lib/{textSegment.d.ts → textSegment.d.mts} +4 -4
- package/lib/textSegment.d.mts.map +1 -0
- package/lib/{textSegment.js → textSegment.mjs} +8 -12
- package/lib/textSegment.mjs.map +1 -0
- package/lib/{zamboni.d.ts → zamboni.d.mts} +3 -3
- package/lib/zamboni.d.mts.map +1 -0
- package/lib/{zamboni.js → zamboni.mjs} +22 -28
- package/lib/zamboni.mjs.map +1 -0
- package/package.json +95 -164
- package/src/client.ts +0 -8
- package/src/mergeTree.ts +0 -226
- package/src/ops.ts +1 -1
- package/src/revertibles.ts +4 -4
- package/lib/MergeTreeTextHelper.d.ts.map +0 -1
- package/lib/MergeTreeTextHelper.js.map +0 -1
- package/lib/attributionCollection.d.ts.map +0 -1
- package/lib/attributionCollection.js.map +0 -1
- package/lib/attributionPolicy.d.ts.map +0 -1
- package/lib/attributionPolicy.js.map +0 -1
- package/lib/client.d.ts.map +0 -1
- package/lib/client.js.map +0 -1
- package/lib/collections/index.d.ts.map +0 -1
- package/lib/collections/index.js +0 -14
- package/lib/collections/index.js.map +0 -1
- package/lib/collections/list.d.ts.map +0 -1
- package/lib/collections/list.js.map +0 -1
- package/lib/collections/rbTree.d.ts.map +0 -1
- package/lib/collections/rbTree.js.map +0 -1
- package/lib/constants.d.ts.map +0 -1
- package/lib/constants.js +0 -35
- package/lib/constants.js.map +0 -1
- package/lib/endOfTreeSegment.d.ts.map +0 -1
- package/lib/endOfTreeSegment.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -80
- package/lib/index.js.map +0 -1
- package/lib/localReference.d.ts.map +0 -1
- package/lib/localReference.js.map +0 -1
- package/lib/mergeTree.d.ts.map +0 -1
- package/lib/mergeTree.js.map +0 -1
- package/lib/mergeTreeDeltaCallback.d.ts.map +0 -1
- package/lib/mergeTreeDeltaCallback.js.map +0 -1
- package/lib/mergeTreeNodeWalk.d.ts.map +0 -1
- package/lib/mergeTreeNodeWalk.js.map +0 -1
- package/lib/mergeTreeNodes.d.ts.map +0 -1
- package/lib/mergeTreeNodes.js.map +0 -1
- package/lib/mergeTreeTracking.d.ts.map +0 -1
- package/lib/mergeTreeTracking.js.map +0 -1
- package/lib/opBuilder.d.ts.map +0 -1
- package/lib/opBuilder.js.map +0 -1
- package/lib/ops.d.ts.map +0 -1
- package/lib/ops.js.map +0 -1
- package/lib/ordinal.d.ts.map +0 -1
- package/lib/ordinal.js.map +0 -1
- package/lib/partialLengths.d.ts.map +0 -1
- package/lib/partialLengths.js.map +0 -1
- package/lib/properties.d.ts.map +0 -1
- package/lib/properties.js.map +0 -1
- package/lib/referencePositions.d.ts.map +0 -1
- package/lib/referencePositions.js +0 -80
- package/lib/referencePositions.js.map +0 -1
- package/lib/revertibles.d.ts.map +0 -1
- package/lib/revertibles.js.map +0 -1
- package/lib/segmentGroupCollection.d.ts.map +0 -1
- package/lib/segmentGroupCollection.js.map +0 -1
- package/lib/segmentPropertiesManager.d.ts.map +0 -1
- package/lib/snapshotChunks.d.ts.map +0 -1
- package/lib/snapshotChunks.js.map +0 -1
- package/lib/snapshotLoader.d.ts.map +0 -1
- package/lib/snapshotLoader.js.map +0 -1
- package/lib/snapshotV1.d.ts.map +0 -1
- package/lib/snapshotV1.js.map +0 -1
- package/lib/snapshotlegacy.d.ts.map +0 -1
- package/lib/snapshotlegacy.js.map +0 -1
- package/lib/sortedSegmentSet.d.ts.map +0 -1
- package/lib/sortedSegmentSet.js.map +0 -1
- package/lib/sortedSet.d.ts.map +0 -1
- package/lib/sortedSet.js.map +0 -1
- package/lib/textSegment.d.ts.map +0 -1
- package/lib/textSegment.js.map +0 -1
- package/lib/zamboni.d.ts.map +0 -1
- package/lib/zamboni.js.map +0 -1
- package/merge-tree.test-files.tar +0 -0
- package/src/mergeTreeExample1.pdf +0 -0
- package/tsconfig.esnext.json +0 -6
|
@@ -1 +0,0 @@
|
|
|
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,OAAO,wBAAwB,CAAC,CAAC,MAAM,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG,2BAA2B,GAAG,wBAAwB,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,2BAA2B,CAC3C,cAAc,SAAS,4BAA4B,GAAG,2BAA2B;IAEjF,QAAQ,CAAC,SAAS,EAAE,cAAc,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,sBAAsB,EAAE,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,OAAO,EAAE,QAAQ,CAAC;IAClB,cAAc,CAAC,EAAE,WAAW,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;OAGG;IAEH,QAAQ,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,EAAE,YAAY,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,yBAAyB,CAAC;IAEtD;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC3B;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 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeNodeWalk.d.ts","source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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 +0,0 @@
|
|
|
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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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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mergeTreeTracking.d.ts","sourceRoot":"","sources":["../src/mergeTreeTracking.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C;;GAEG;AACH,MAAM,MAAM,S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8DC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { LocalReferencePosition } from \"./localReference\";\nimport { ISegment } from \"./mergeTreeNodes\";\n// eslint-disable-next-line import/no-deprecated\nimport { SortedSegmentSet } from \"./sortedSegmentSet\";\n\n/**\n * @alpha\n */\nexport type Trackable = ISegment | LocalReferencePosition;\n\n/**\n * @alpha\n */\nexport interface ITrackingGroup {\n\ttracked: readonly Trackable[];\n\tsize: number;\n\thas(trackable: Trackable): boolean;\n\tlink(trackable: Trackable): void;\n\tunlink(trackable: Trackable): boolean;\n}\n\n/**\n * @alpha\n */\nexport class TrackingGroup implements ITrackingGroup {\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate readonly trackedSet: SortedSegmentSet<Trackable>;\n\n\tconstructor() {\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tthis.trackedSet = new SortedSegmentSet<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn this.trackedSet.items;\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.addOrUpdate(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.remove(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * Tracking group backed by an unordered set. Lookup, insertion, and deletion are O(1)\n */\nexport class UnorderedTrackingGroup implements ITrackingGroup {\n\tprivate readonly trackedSet: Set<Trackable>;\n\n\tconstructor() {\n\t\tthis.trackedSet = new Set<Trackable>();\n\t}\n\n\tpublic get tracked(): readonly Trackable[] {\n\t\treturn Array.from(this.trackedSet);\n\t}\n\n\tpublic get size(): number {\n\t\treturn this.trackedSet.size;\n\t}\n\n\tpublic has(trackable: Trackable): boolean {\n\t\treturn this.trackedSet.has(trackable);\n\t}\n\n\tpublic link(trackable: Trackable): void {\n\t\tif (!this.trackedSet.has(trackable)) {\n\t\t\tthis.trackedSet.add(trackable);\n\t\t\ttrackable.trackingCollection.link(this);\n\t\t}\n\t}\n\n\tpublic unlink(trackable: Trackable): boolean {\n\t\tif (this.trackedSet.delete(trackable)) {\n\t\t\ttrackable.trackingCollection.unlink(this);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n}\n\n/**\n * A collection of {@link ITrackingGroup}.\n * @alpha\n */\nexport class TrackingGroupCollection {\n\tprivate readonly _trackingGroups: Set<ITrackingGroup>;\n\n\tpublic get trackingGroups(): Set<TrackingGroup> {\n\t\t// Cast here is necessary to avoid a breaking change to\n\t\t// `TrackingGroupCollection`. Ideally we could just return\n\t\t// `Set<ITrackingGroup>`\n\t\treturn this._trackingGroups as Set<TrackingGroup>;\n\t}\n\n\tconstructor(private readonly trackable: Trackable) {\n\t\tthis._trackingGroups = new Set<ITrackingGroup>();\n\t}\n\n\tpublic link(trackingGroup: ITrackingGroup): void {\n\t\tif (trackingGroup) {\n\t\t\tif (!this._trackingGroups.has(trackingGroup)) {\n\t\t\t\tthis._trackingGroups.add(trackingGroup);\n\t\t\t}\n\n\t\t\tif (!trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.link(this.trackable);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic unlink(trackingGroup: ITrackingGroup): boolean {\n\t\tif (this._trackingGroups.has(trackingGroup)) {\n\t\t\tif (trackingGroup.has(this.trackable)) {\n\t\t\t\ttrackingGroup.unlink(this.trackable);\n\t\t\t}\n\t\t\tthis._trackingGroups.delete(trackingGroup);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic copyTo(trackable: Trackable): void {\n\t\tthis._trackingGroups.forEach((sg) => {\n\t\t\ttrackable.trackingCollection.link(sg);\n\t\t});\n\t}\n\n\tpublic get empty(): boolean {\n\t\treturn this._trackingGroups.size === 0;\n\t}\n\n\tpublic matches(trackingCollection: TrackingGroupCollection): boolean {\n\t\tif (\n\t\t\t!trackingCollection ||\n\t\t\tthis._trackingGroups.size !== trackingCollection._trackingGroups.size\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (const tg of this._trackingGroups.values()) {\n\t\t\tif (!trackingCollection._trackingGroups.has(tg)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"]}
|
package/lib/opBuilder.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opBuilder.d.ts","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACN,qBAAqB,EAErB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EAEnB,iBAAiB,EAEjB,uBAAuB,EACvB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACrC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,WAAW,GAChB,qBAAqB,GAAG,SAAS,CAYnC;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACpC,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,WAAW,GAChB,qBAAqB,CAOvB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,mBAAmB,CAMnF;AAED;;;;;;;GAOG;AAEH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,uBAAuB,CAM3F;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,GAAG,mBAAmB,CAEzF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,mBAAmB,CAM7E;AAED;;;;;;;;;;GAUG;AAEH,wBAAgB,aAAa,CAAC,GAAG,GAAG,EAAE,iBAAiB,EAAE,GAAG,kBAAkB,CAK7E"}
|
package/lib/opBuilder.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opBuilder.js","sourceRoot":"","sources":["../src/opBuilder.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,+BAUe;AAGf;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CACrC,MAAc,EACd,KAAkB;IAElB,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,EAAE;QACR,OAAO,SAAS,CAAC;KACjB;IAED,OAAO;QACN,KAAK;QACL,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;QAClC,YAAY,EAAE,EAAE,EAAE,EAAE;QACpB,IAAI,EAAE,wBAAkB,CAAC,QAAQ;KACjC,CAAC;AACH,CAAC;AAfD,wDAeC;AAED;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACpC,KAAa,EACb,GAAW,EACX,KAAkB;IAElB,OAAO;QACN,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,KAAK;QACL,IAAI,EAAE,wBAAkB,CAAC,QAAQ;KACjC,CAAC;AACH,CAAC;AAXD,sDAWC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,KAAa,EAAE,GAAW;IAC7D,OAAO;QACN,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,wBAAkB,CAAC,MAAM;KAC/B,CAAC;AACH,CAAC;AAND,kDAMC;AAED;;;;;;;GAOG;AACH,gDAAgD;AAChD,SAAgB,uBAAuB,CAAC,KAAa,EAAE,GAAW;IACjE,OAAO;QACN,IAAI,EAAE,KAAK;QACX,IAAI,EAAE,GAAG;QACT,IAAI,EAAE,wBAAkB,CAAC,UAAU;KACnC,CAAC;AACH,CAAC;AAND,0DAMC;AAED;;;;;;GAMG;AACH,SAAgB,qBAAqB,CAAC,GAAW,EAAE,OAAiB;IACnE,OAAO,cAAc,CAAC,GAAG,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;AACpD,CAAC;AAFD,sDAEC;AAED;;GAEG;AACH,SAAgB,cAAc,CAAC,GAAW,EAAE,OAAY;IACvD,OAAO;QACN,IAAI,EAAE,GAAG;QACT,GAAG,EAAE,OAAO;QACZ,IAAI,EAAE,wBAAkB,CAAC,MAAM;KAC/B,CAAC;AACH,CAAC;AAND,wCAMC;AAED;;;;;;;;;;GAUG;AACH,gDAAgD;AAChD,SAAgB,aAAa,CAAC,GAAG,GAAwB;IACxD,OAAO;QACN,GAAG;QACH,IAAI,EAAE,wBAAkB,CAAC,KAAK;KAC9B,CAAC;AACH,CAAC;AALD,sCAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISegment, Marker } from \"./mergeTreeNodes\";\nimport {\n\tIMergeTreeAnnotateMsg,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeGroupMsg,\n\tIMergeTreeInsertMsg,\n\tIMergeTreeRemoveMsg,\n\tMergeTreeDeltaType,\n\tIMergeTreeDeltaOp,\n\t// eslint-disable-next-line import/no-deprecated\n\tIMergeTreeObliterateMsg,\n} from \"./ops\";\nimport { PropertySet } from \"./properties\";\n\n/**\n * Creates the op for annotating the markers with the provided properties\n * @param marker - The marker to annotate\n * @param props - The properties to annotate the marker with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateMarkerOp(\n\tmarker: Marker,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg | undefined {\n\tconst id = marker.getId();\n\tif (!id) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tprops,\n\t\trelativePos1: { id, before: true },\n\t\trelativePos2: { id },\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op for annotating the range with the provided properties\n * @param start - The inclusive start position of the range to annotate\n * @param end - The exclusive end position of the range to annotate\n * @param props - The properties to annotate the range with\n * @returns The annotate op\n *\n * @internal\n */\nexport function createAnnotateRangeOp(\n\tstart: number,\n\tend: number,\n\tprops: PropertySet,\n): IMergeTreeAnnotateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\tprops,\n\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t};\n}\n\n/**\n * Creates the op to remove a range\n *\n * @param start - The inclusive start of the range to remove\n * @param end - The exclusive end of the range to remove\n *\n * @internal\n */\nexport function createRemoveRangeOp(start: number, end: number): IMergeTreeRemoveMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.REMOVE,\n\t};\n}\n\n/**\n * Creates the op to obliterate a range\n *\n * @param start - The inclusive start of the range to obliterate\n * @param end - The exclusive end of the range to obliterate\n *\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\nexport function createObliterateRangeOp(start: number, end: number): IMergeTreeObliterateMsg {\n\treturn {\n\t\tpos1: start,\n\t\tpos2: end,\n\t\ttype: MergeTreeDeltaType.OBLITERATE,\n\t};\n}\n\n/**\n *\n * @param pos - The position to insert the segment at\n * @param segment - The segment to insert\n *\n * @internal\n */\nexport function createInsertSegmentOp(pos: number, segment: ISegment): IMergeTreeInsertMsg {\n\treturn createInsertOp(pos, segment.toJSONObject());\n}\n\n/**\n * @internal\n */\nexport function createInsertOp(pos: number, segSpec: any): IMergeTreeInsertMsg {\n\treturn {\n\t\tpos1: pos,\n\t\tseg: segSpec,\n\t\ttype: MergeTreeDeltaType.INSERT,\n\t};\n}\n\n/**\n *\n * @param ops - The ops to group\n *\n * @deprecated The ability to create group ops will be removed in an upcoming\n * release, as group ops are redundant with he native batching capabilities of\n * the runtime\n *\n * @deprecated The ability to create group ops will be removed in an upcoming release, as group ops are redundant with he native batching capabilities of the runtime\n * @internal\n */\n// eslint-disable-next-line import/no-deprecated\nexport function createGroupOp(...ops: IMergeTreeDeltaOp[]): IMergeTreeGroupMsg {\n\treturn {\n\t\tops,\n\t\ttype: MergeTreeDeltaType.GROUP,\n\t};\n}\n"]}
|
package/lib/ops.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,oBAAY,aAAa;IACxB,MAAM,IAAM;IACZ;;OAEG;IACH,IAAI,IAAM;IAEV;;;;OAIG;IACH,UAAU,KAAO;IAEjB;;;;OAIG;IACH,QAAQ,KAAO;IAEf;;;;;;OAMG;IACH,aAAa,KAAO;IACpB;;OAEG;IACH,YAAY,MAAO;IACnB;;;OAGG;IACH,SAAS,MAAQ;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,CAAC,EAAE,aAAa,CAAC;CACxB;AAGD;;GAEG;AACH,eAAO,MAAM,kBAAkB;;;;IAI9B;;OAEG;;;CAGM,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC/B;;OAEG;IACH,IAAI,EAAE,kBAAkB,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,MAAM,CAA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AMG;AACH,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IAC1D,IAAI,EAAE,OAAO,kBAAkB,CAAC,KAAK,CAAC;IACtC,GAAG,EAAE,iBAAiB,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAC1B,mBAAmB,GACnB,mBAAmB,GACnB,qBAAqB,GACrB,uBAAuB,CAAC;AAE3B;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,iBAAiB,GAAG,kBAAkB,CAAC"}
|
package/lib/ops.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../src/ops.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;GAGG;AACH,IAAY,aAsCX;AAtCD,WAAY,aAAa;IACxB,qDAAY,CAAA;IACZ;;OAEG;IACH,iDAAU,CAAA;IAEV;;;;OAIG;IACH,8DAAiB,CAAA;IAEjB;;;;OAIG;IACH,0DAAe,CAAA;IAEf;;;;;;OAMG;IACH,oEAAoB,CAAA;IACpB;;OAEG;IACH,mEAAmB,CAAA;IACnB;;;OAGG;IACH,6DAAiB,CAAA;AAClB,CAAC,EAtCW,aAAa,6BAAb,aAAa,QAsCxB;AASD,mFAAmF;AACnF;;GAEG;AACU,QAAA,kBAAkB,GAAG;IACjC,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX;;OAEG;IACH,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,CAAC;CACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Flags enum that dictates behavior of a {@link ReferencePosition}\n * @alpha\n */\nexport enum ReferenceType {\n\tSimple = 0x0,\n\t/**\n\t * Allows this reference to be located using the `findTile` API on merge-tree.\n\t */\n\tTile = 0x1,\n\n\t/**\n\t * Denotes that this reference begins the start of an interval. This is\n\t * generally not meaningful outside the context of interval collections\n\t * on SharedString.\n\t */\n\tRangeBegin = 0x10,\n\n\t/**\n\t * Denotes that this reference is the end of an interval. This is\n\t * generally not meaningful outside the context of interval collections\n\t * on SharedString.\n\t */\n\tRangeEnd = 0x20,\n\n\t/**\n\t * When a segment is marked removed (locally or with ack), this reference will slide to the first\n\t * valid option of:\n\t * 1. the start of the next furthest segment\n\t * 2. the end of the next nearest segment\n\t * 3. DetachedReferencePosition\n\t */\n\tSlideOnRemove = 0x40,\n\t/**\n\t * When a segment is marked removed (locally or with ack), this reference will remain on that segment.\n\t */\n\tStayOnRemove = 0x80,\n\t/**\n\t * Specifies that the reference position should never be added to the segment it refers to.\n\t * This is useful for comparison/iteration purposes\n\t */\n\tTransient = 0x100,\n}\n\n/**\n * @alpha\n */\nexport interface IMarkerDef {\n\trefType?: ReferenceType;\n}\n\n// Note: Assigned positive integers to avoid clashing with MergeTreeMaintenanceType\n/**\n * @alpha\n */\nexport const MergeTreeDeltaType = {\n\tINSERT: 0,\n\tREMOVE: 1,\n\tANNOTATE: 2,\n\t/**\n\t * @deprecated The ability to create group ops will be removed in an upcoming release, as group ops are redundant with he native batching capabilities of the runtime\n\t */\n\tGROUP: 3,\n\tOBLITERATE: 4,\n} as const;\n\n/**\n * @alpha\n */\nexport type MergeTreeDeltaType = (typeof MergeTreeDeltaType)[keyof typeof MergeTreeDeltaType];\n\n/**\n * @alpha\n */\nexport interface IMergeTreeDelta {\n\t/**\n\t * Type of this change.\n\t */\n\ttype: MergeTreeDeltaType;\n}\n\n/**\n * A position specified relative to a segment.\n * @alpha\n */\nexport interface IRelativePosition {\n\t/**\n\t * String identifier specifying a segment.\n\t */\n\tid?: string;\n\t/**\n\t * If true, insert before the specified segment. If false or not defined,\n\t * insert after the specified segment.\n\t */\n\tbefore?: boolean;\n\t/**\n\t * A positive number \\>= 1. If before is false, offset is added to the position.\n\t * If before is true, offset is subtracted from the position.\n\t */\n\toffset?: number;\n}\n\n/**\n * @alpha\n */\nexport interface IMergeTreeInsertMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.INSERT;\n\tpos1?: number;\n\trelativePos1?: IRelativePosition;\n\tpos2?: number;\n\trelativePos2?: IRelativePosition;\n\tseg?: any;\n}\n\n/**\n * @alpha\n */\nexport interface IMergeTreeRemoveMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.REMOVE;\n\tpos1?: number;\n\trelativePos1?: IRelativePosition;\n\tpos2?: number;\n\trelativePos2?: IRelativePosition;\n}\n\n/**\n * @deprecated We no longer intend to support this functionality and it will\n * be removed in a future release. There is no replacement for this\n * functionality.\n * @alpha\n */\nexport interface IMergeTreeObliterateMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.OBLITERATE;\n\tpos1?: number;\n\t/**\n\t * This field is currently unused, but we keep it around to make the union\n\t * type of all merge-tree messages have the same fields\n\t */\n\trelativePos1?: never;\n\tpos2?: number;\n\t/**\n\t * This field is currently unused, but we keep it around to make the union\n\t * type of all merge-tree messages have the same fields\n\t */\n\trelativePos2?: never;\n}\n\n/**\n * @alpha\n */\nexport interface IMergeTreeAnnotateMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.ANNOTATE;\n\tpos1?: number;\n\trelativePos1?: IRelativePosition;\n\tpos2?: number;\n\trelativePos2?: IRelativePosition;\n\tprops: Record<string, any>;\n}\n\n/**\n * @deprecated The ability to create group ops will be removed in an upcoming\n * release, as group ops are redundant with the native batching capabilities\n * of the runtime\n *\n * @alpha\n */\nexport interface IMergeTreeGroupMsg extends IMergeTreeDelta {\n\ttype: typeof MergeTreeDeltaType.GROUP;\n\tops: IMergeTreeDeltaOp[];\n}\n\n/**\n * @alpha\n */\nexport interface IJSONSegment {\n\tprops?: Record<string, any>;\n}\n\n/**\n * @alpha\n */\nexport type IMergeTreeDeltaOp =\n\t| IMergeTreeInsertMsg\n\t| IMergeTreeRemoveMsg\n\t| IMergeTreeAnnotateMsg\n\t| IMergeTreeObliterateMsg;\n\n/**\n * @alpha\n */\nexport type IMergeTreeOp = IMergeTreeDeltaOp | IMergeTreeGroupMsg;\n"]}
|
package/lib/ordinal.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ordinal.d.ts","sourceRoot":"","sources":["../src/ordinal.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,EACrB,eAAe,EAAE,MAAM,GAAG,SAAS,UAkBnC"}
|
package/lib/ordinal.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ordinal.js","sourceRoot":"","sources":["../src/ordinal.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,2DAAoD;AAEpD,SAAgB,0BAA0B,CACzC,QAAgB,EAChB,WAAmB,EACnB,aAAqB,EACrB,eAAmC;IAEnC,IAAA,mBAAM,EACL,QAAQ,IAAI,EAAE,IAAI,WAAW,IAAI,QAAQ,EACzC,KAAK,CAAC,6DAA6D,CACnE,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,WAAW,CAAC,CAAC;IACnD,IAAI,OAAe,CAAC;IACpB,IAAI,eAAe,KAAK,SAAS,EAAE;QAClC,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;KAChE;SAAM;QACN,MAAM,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC,eAAe,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3E,MAAM,YAAY,GAAG,WAAW,GAAG,YAAY,CAAC;QAChD,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;KAC5D;IAED,OAAO,OAAO,CAAC;AAChB,CAAC;AAtBD,gEAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\nimport { assert } from \"@fluidframework/core-utils\";\n\nexport function computeHierarchicalOrdinal(\n\tmaxCount: number,\n\tactualCount: number,\n\tparentOrdinal: string,\n\tpreviousOrdinal: string | undefined,\n) {\n\tassert(\n\t\tmaxCount <= 16 && actualCount <= maxCount,\n\t\t0x3f0 /* count must be less than max, and max must be 16 or less */,\n\t);\n\n\tconst ordinalWidth = 1 << (maxCount - actualCount);\n\tlet ordinal: string;\n\tif (previousOrdinal === undefined) {\n\t\tordinal = parentOrdinal + String.fromCharCode(ordinalWidth - 1);\n\t} else {\n\t\tconst prevOrdCode = previousOrdinal.charCodeAt(previousOrdinal.length - 1);\n\t\tconst localOrdinal = prevOrdCode + ordinalWidth;\n\t\tordinal = parentOrdinal + String.fromCharCode(localOrdinal);\n\t}\n\n\treturn ordinal;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"partialLengths.d.ts","sourceRoot":"","sources":["../src/partialLengths.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAY,YAAY,EAAE,MAAM,eAAe,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAEN,mBAAmB,EAEnB,WAAW,EAIX,QAAQ,EAIR,MAAM,kBAAkB,CAAC;AAyF1B,UAAU,cAAc;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM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AI,EAAE,IAAI,EAAE,CAAC;aACxC;QACF,CAAC;KACD;IAED,OAAO,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,6BAA6B,CAAC,KAAK,CAAC,EAAE,CAAC;AAC9E,CAAC;AAED,SAAS,cAAc,CAAI,IAAS,EAAE,KAAa,EAAE,IAAO;IAC3D,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE;QACxB,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;SACtB;QACD,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;KACnB;SAAM;QACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAChB;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { Property, RedBlackTree } from \"./collections\";\nimport { UnassignedSequenceNumber } from \"./constants\";\nimport { MergeTree } from \"./mergeTree\";\nimport {\n\t// eslint-disable-next-line import/no-deprecated\n\tCollaborationWindow,\n\tcompareNumbers,\n\tIMergeBlock,\n\tIMergeNode,\n\tIMoveInfo,\n\tIRemovalInfo,\n\tISegment,\n\ttoMoveInfo,\n\tseqLTE,\n\ttoRemovalInfo,\n} from \"./mergeTreeNodes\";\n// eslint-disable-next-line import/no-deprecated\nimport { SortedSet } from \"./sortedSet\";\n\n// eslint-disable-next-line import/no-deprecated\nclass PartialSequenceLengthsSet extends SortedSet<PartialSequenceLength, number> {\n\tprotected getKey(item: PartialSequenceLength): number {\n\t\treturn item.seq;\n\t}\n\n\tpublic addOrUpdate(\n\t\tnewItem: PartialSequenceLength,\n\t\tupdate?: (existingItem: PartialSequenceLength, newItem: PartialSequenceLength) => void,\n\t) {\n\t\tconst prev = this.latestLeq(newItem.seq);\n\n\t\tif (prev?.seq !== newItem.seq) {\n\t\t\t// new element, update len\n\t\t\tnewItem.len = (prev?.len ?? 0) + newItem.seglen;\n\t\t}\n\n\t\t// update the len of all following elements\n\t\tfor (let i = this.keySortedItems.length - 1; i >= 0; i--) {\n\t\t\tconst element = this.keySortedItems[i];\n\t\t\tif (!element || element.seq <= newItem.seq) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\telement.len += newItem.seglen;\n\t\t}\n\n\t\tsuper.addOrUpdate(newItem, (currentPartial, partialLength) => {\n\t\t\tcurrentPartial.seglen += partialLength.seglen;\n\n\t\t\tif (partialLength.remoteObliteratedLen) {\n\t\t\t\tcurrentPartial.remoteObliteratedLen ??= 0;\n\t\t\t\tcurrentPartial.remoteObliteratedLen += partialLength.remoteObliteratedLen;\n\t\t\t}\n\n\t\t\tcurrentPartial.len += partialLength.seglen;\n\t\t\tcombineOverlapClients(currentPartial, partialLength);\n\t\t});\n\t}\n\n\t/**\n\t * Returns the partial length whose sequence number is the greatest sequence\n\t * number that is less than or equal to key.\n\t * @param key - sequence number\n\t */\n\tlatestLeq(key: number): PartialSequenceLength | undefined {\n\t\treturn this.keySortedItems[this.latestLeqIndex(key)];\n\t}\n\n\t/**\n\t * Returns the partial length whose sequence number is the lowest sequence\n\t * number that is greater than or equal to key.\n\t * @param key - sequence number\n\t */\n\tfirstGte(key: number): PartialSequenceLength | undefined {\n\t\tconst { index } = this.findItemPosition({ seq: key, len: 0, seglen: 0 });\n\t\treturn this.keySortedItems[index];\n\t}\n\n\tprivate latestLeqIndex(key: number): number {\n\t\tconst { exists, index } = this.findItemPosition({ seq: key, len: 0, seglen: 0 });\n\t\treturn exists ? index : index - 1;\n\t}\n\n\tcopyDown(minSeq: number): number {\n\t\tconst mindex = this.latestLeqIndex(minSeq);\n\t\tlet minLength = 0;\n\t\tif (mindex >= 0) {\n\t\t\tminLength = this.keySortedItems[mindex].len;\n\t\t\tconst seqCount = this.size;\n\t\t\tif (mindex <= seqCount - 1) {\n\t\t\t\t// Still some entries remaining\n\t\t\t\tconst remainingCount = seqCount - mindex - 1;\n\t\t\t\t// Copy down\n\t\t\t\tfor (let i = 0; i < remainingCount; i++) {\n\t\t\t\t\tthis.keySortedItems[i] = this.keySortedItems[i + mindex + 1];\n\t\t\t\t\tthis.keySortedItems[i].len -= minLength;\n\t\t\t\t}\n\t\t\t\tthis.keySortedItems.length = remainingCount;\n\t\t\t}\n\t\t}\n\t\treturn minLength;\n\t}\n}\n\ninterface IOverlapClient {\n\tclientId: number;\n\tseglen: number;\n}\n\n/**\n * Tracks length information for a part of a MergeTree (block) at a given time (seq).\n * These objects are associated with internal nodes (i.e. blocks).\n */\nexport interface PartialSequenceLength {\n\t/**\n\t * Sequence number\n\t */\n\tseq: number;\n\t/**\n\t * The length of the associated block.\n\t */\n\tlen: number;\n\t/**\n\t * The delta between the current length of the associated block and its length at the previous seq number.\n\t */\n\tseglen: number;\n\t/**\n\t * clientId for the client that submitted the op with sequence number `seq`.\n\t */\n\tclientId?: number;\n\t/**\n\t * If this partial length obliterated remote segments, this is the length of\n\t * those segments\n\t */\n\tremoteObliteratedLen?: number;\n\t/**\n\t * This field maps each client to the size of the intersection between segments deleted at this seq\n\t * and segments concurrently deleted by that client.\n\t *\n\t * For example, this PartialSequenceLength:\n\t * ```typescript\n\t * {\n\t * seq: 5,\n\t * len: 100,\n\t * seglen: -10,\n\t * clientId: 0,\n\t * overlapRemoveClients: <RedBlack tree with key-values expressed by>{\n\t * 1: { clientId: 1, seglen: -5 },\n\t * 3: { clientId: 3, seglen: -10 }\n\t * }\n\t * }\n\t * ```\n\t *\n\t * corresponds to an op submitted by client 0 which:\n\t * - reduces the length of this block by 10 (it may have deleted a single segment of length 10,\n\t * several segments totalling length 10, or even delete and add content for a total reduction of 10 length)\n\t * - was concurrent to one or more ops submitted by client 1 that also removed some of the same segments,\n\t * whose length totalled 5\n\t * - was concurrent to one or more ops submitted by client 3 that removed some of the same segments,\n\t * whose length totalled 10\n\t */\n\toverlapRemoveClients?: RedBlackTree<number, IOverlapClient>;\n\t/**\n\t * This field is the same as `overlapRemoveClients`, except that it tracks\n\t * overlapping obliterates rather than removes.\n\t */\n\toverlapObliterateClients?: RedBlackTree<number, IOverlapClient>;\n}\n\ninterface UnsequencedPartialLengthInfo {\n\t/**\n\t * Contains entries for all local operations.\n\t * The \"seq\" field of each entry actually corresponds to the delta at that localSeq on the local client.\n\t */\n\tpartialLengths: PartialSequenceLengthsSet;\n\n\t/**\n\t * Only contains entries for segments (or aggregates thereof) which were concurrently deleted\n\t * by another client. Ordered by `seq` of the removing client.\n\t *\n\t * The \"length\" field of these entries is not populated. This is because pre-computing the lengths\n\t * of segments doesn't help given the usage pattern.\n\t *\n\t * These entries need both `seq` and `localSeq`, because a given segment remove is double-counted iff\n\t * the refSeq exceeds the seq of the remote remove AND the localSeq exceeds the localSeq of the local remove.\n\t */\n\toverlappingRemoves: LocalPartialSequenceLength[];\n\n\t/**\n\t * Cached keyed on refSeq which stores length information for the total overlap of removed segments at\n\t * that refSeq.\n\t * This information is derivable from the entries of `overlappingRemoves`.\n\t *\n\t * Like the `partialLengths` field, `seq` on each entry is actually the local seq.\n\t * See `computeOverlappingLocalRemoves` for more information.\n\t */\n\tcachedOverlappingByRefSeq: Map<number, PartialSequenceLengthsSet>;\n}\n\ninterface LocalPartialSequenceLength extends PartialSequenceLength {\n\t/**\n\t * Local sequence number\n\t */\n\tlocalSeq: number;\n}\n\nexport interface PartialSequenceLengthsOptions {\n\tverifier?: (partialLengths: PartialSequenceLengths) => void;\n\tverifyExpected?: (\n\t\tmergeTree: MergeTree,\n\t\tnode: IMergeBlock,\n\t\trefSeq: number,\n\t\tclientId: number,\n\t\tlocalSeq?: number,\n\t) => void;\n\tzamboni: boolean;\n}\n\n/**\n * Keeps track of partial sums of segment lengths for all sequence numbers in the current collaboration window.\n * Only used during active collaboration.\n *\n * This class is associated with an internal node (block) of a MergeTree. It efficiently answers queries of the form\n * \"What is the length of `block` from the perspective of some particular seq and clientId?\".\n *\n * It also supports incremental updating of state for newly-sequenced ops that don't affect the structure of the\n * MergeTree.\n *\n * To answer these queries, it pre-builds several lists which track the length of the block at a per-sequence-number\n * level. These lists are:\n *\n * 1. (`partialLengths`): Stores the total length of the block.\n * 2. (`clientSeqNumbers[clientId]`): Stores only the total lengths of segments submitted by `clientId`. [see footnote]\n *\n * The reason both lists are necessary is that resolving the length of the block from the perspective of\n * (clientId, refSeq) requires including both of the following types of segments:\n * 1. Segments sequenced before `refSeq`\n * 2. Segments submitted by `clientId`\n *\n * This is possible with the above bookkeeping, using:\n *\n * (length of the block at the minimum sequence number)\n * + (partialLengths total length at refSeq)\n * + (clientSeqNumbers total length at most recent op)\n * - (clientSeqNumbers total length at refSeq)\n *\n * where the subtraction avoids double-counting segments submitted by clientId sequenced within the collab window.\n *\n * To enable reconnect, if constructed with `computeLocalPartials === true` it also supports querying for the length of\n * the block from the perspective of the local client at a particular `refSeq` and `localSeq`. This computation is\n * similar to the above:\n *\n * (length of the block at the minimum sequence number)\n * + (partialLengths total length at refSeq)\n * + (unsequenced edits' total length submitted before localSeq)\n * - (overlapping remove of the unsequenced edits' total length at refSeq)\n *\n * This algorithm scales roughly linearly with number of editing clients and the size of the collab window.\n * (certain unlikely sequences of operations may introduce log factors on those variables)\n *\n * Note: there is some slight complication with clientSeqNumbers resulting from the possibility of different clients\n * concurrently removing the same segment. See the field's documentation for more details.\n */\nexport class PartialSequenceLengths {\n\tpublic static options: PartialSequenceLengthsOptions = {\n\t\tzamboni: true,\n\t};\n\n\t/**\n\t * Combine the partial lengths of block's children\n\t * @param block - an interior node. If `recur` is false, it is assumed that each interior node child of this block\n\t * has its partials up to date.\n\t * @param collabWindow - segment window of the segment tree containing `block`.\n\t * @param recur - whether to recursively compute partial lengths for internal children of `block`.\n\t * This incurs more work, but gives correct bookkeeping in the case that a descendant in the merge tree has been\n\t * modified without bubbling up the resulting partial length change to this block's partials.\n\t * @param computeLocalPartials - whether to compute partial length information about local unsequenced ops.\n\t * This enables querying for the length of the block at a given localSeq, but incurs extra work.\n\t * Local partial information doesn't support `update`.\n\t */\n\tpublic static combine(\n\t\tblock: IMergeBlock,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tcollabWindow: CollaborationWindow,\n\t\trecur = false,\n\t\tcomputeLocalPartials = false,\n\t): PartialSequenceLengths {\n\t\tconst leafPartialLengths = PartialSequenceLengths.fromLeaves(\n\t\t\tblock,\n\t\t\tcollabWindow,\n\t\t\tcomputeLocalPartials,\n\t\t);\n\n\t\tlet hasInternalChild = false;\n\t\tconst childPartials: PartialSequenceLengths[] = [];\n\t\tfor (let i = 0; i < block.childCount; i++) {\n\t\t\tconst child = block.children[i];\n\t\t\tif (!child.isLeaf()) {\n\t\t\t\thasInternalChild = true;\n\t\t\t\tif (recur) {\n\t\t\t\t\tchild.partialLengths = PartialSequenceLengths.combine(\n\t\t\t\t\t\tchild,\n\t\t\t\t\t\tcollabWindow,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tcomputeLocalPartials,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tchildPartials.push(child.partialLengths!);\n\t\t\t}\n\t\t}\n\n\t\t// If there are no internal children, the PartialSequenceLengths returns from `fromLeaves` is exactly correct.\n\t\t// Otherwise, we must additively combine all of the children partial lengths to get this block's totals.\n\t\tconst combinedPartialLengths = hasInternalChild\n\t\t\t? new PartialSequenceLengths(collabWindow.minSeq, computeLocalPartials)\n\t\t\t: leafPartialLengths;\n\t\tif (hasInternalChild) {\n\t\t\tif (leafPartialLengths.partialLengths.size > 0) {\n\t\t\t\t// Some children were leaves; add combined partials from these segments\n\t\t\t\tchildPartials.push(leafPartialLengths);\n\t\t\t}\n\n\t\t\tconst childPartialsLen = childPartials.length;\n\n\t\t\tconst childPartialLengths: PartialSequenceLength[][] = [];\n\t\t\tconst childUnsequencedPartialLengths: PartialSequenceLength[][] = [];\n\t\t\tconst childOverlapRemoves: LocalPartialSequenceLength[][] = [];\n\t\t\tfor (let i = 0; i < childPartialsLen; i++) {\n\t\t\t\tconst { segmentCount, minLength, partialLengths, unsequencedRecords } =\n\t\t\t\t\tchildPartials[i];\n\t\t\t\tcombinedPartialLengths.segmentCount += segmentCount;\n\t\t\t\tcombinedPartialLengths.minLength += minLength;\n\t\t\t\tchildPartialLengths.push(partialLengths.items as PartialSequenceLength[]);\n\t\t\t\tif (unsequencedRecords) {\n\t\t\t\t\tchildUnsequencedPartialLengths.push(\n\t\t\t\t\t\tunsequencedRecords.partialLengths.items as PartialSequenceLength[],\n\t\t\t\t\t);\n\t\t\t\t\tchildOverlapRemoves.push(unsequencedRecords.overlappingRemoves);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tmergePartialLengths(childPartialLengths, combinedPartialLengths.partialLengths);\n\n\t\t\tif (computeLocalPartials) {\n\t\t\t\tcombinedPartialLengths.unsequencedRecords = {\n\t\t\t\t\tpartialLengths: mergePartialLengths(childUnsequencedPartialLengths),\n\t\t\t\t\toverlappingRemoves: Array.from(mergeSortedListsBySeq(childOverlapRemoves)),\n\t\t\t\t\tcachedOverlappingByRefSeq: new Map(),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tfor (const partial of combinedPartialLengths.partialLengths.items) {\n\t\t\t\tcombinedPartialLengths.addClientSeqNumberFromPartial(partial);\n\t\t\t}\n\t\t}\n\t\t// TODO: incremental zamboni during build\n\t\tif (PartialSequenceLengths.options.zamboni) {\n\t\t\tcombinedPartialLengths.zamboni(collabWindow);\n\t\t}\n\n\t\tPartialSequenceLengths.options.verifier?.(combinedPartialLengths);\n\t\treturn combinedPartialLengths;\n\t}\n\n\t/**\n\t * @returns a PartialSequenceLengths structure which tracks only lengths of leaf children of the provided\n\t * IMergeBlock.\n\t */\n\tprivate static fromLeaves(\n\t\tblock: IMergeBlock,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tcollabWindow: CollaborationWindow,\n\t\tcomputeLocalPartials: boolean,\n\t): PartialSequenceLengths {\n\t\tconst combinedPartialLengths = new PartialSequenceLengths(\n\t\t\tcollabWindow.minSeq,\n\t\t\tcomputeLocalPartials,\n\t\t);\n\t\tcombinedPartialLengths.segmentCount = block.childCount;\n\n\t\tfor (let i = 0; i < block.childCount; i++) {\n\t\t\tconst child = block.children[i];\n\t\t\tif (child.isLeaf()) {\n\t\t\t\t// Leaf segment\n\t\t\t\tconst segment = child;\n\t\t\t\tif (segment.seq !== undefined && seqLTE(segment.seq, collabWindow.minSeq)) {\n\t\t\t\t\tcombinedPartialLengths.minLength += segment.cachedLength;\n\t\t\t\t} else {\n\t\t\t\t\tPartialSequenceLengths.insertSegment(combinedPartialLengths, segment);\n\t\t\t\t}\n\t\t\t\tconst removalInfo = toRemovalInfo(segment);\n\t\t\t\tconst moveInfo = toMoveInfo(segment);\n\t\t\t\tif (\n\t\t\t\t\t(removalInfo?.removedSeq !== undefined &&\n\t\t\t\t\t\tseqLTE(removalInfo.removedSeq, collabWindow.minSeq)) ||\n\t\t\t\t\t(moveInfo?.movedSeq !== undefined &&\n\t\t\t\t\t\tseqLTE(moveInfo.movedSeq, collabWindow.minSeq))\n\t\t\t\t) {\n\t\t\t\t\tcombinedPartialLengths.minLength -= segment.cachedLength;\n\t\t\t\t} else if (removalInfo !== undefined || moveInfo !== undefined) {\n\t\t\t\t\tPartialSequenceLengths.insertSegment(\n\t\t\t\t\t\tcombinedPartialLengths,\n\t\t\t\t\t\tsegment,\n\t\t\t\t\t\tremovalInfo,\n\t\t\t\t\t\tmoveInfo,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// Post-process correctly-ordered partials computing sums and creating\n\t\t// lists for each present client id\n\t\tconst seqPartials = combinedPartialLengths.partialLengths;\n\n\t\tlet prevLen = 0;\n\t\tfor (const partial of seqPartials.items) {\n\t\t\tpartial.len = prevLen + partial.seglen;\n\t\t\tprevLen = partial.len;\n\t\t\tcombinedPartialLengths.addClientSeqNumberFromPartial(partial);\n\t\t}\n\t\tprevLen = 0;\n\n\t\tif (combinedPartialLengths.unsequencedRecords !== undefined) {\n\t\t\tconst localPartials = combinedPartialLengths.unsequencedRecords.partialLengths;\n\t\t\tfor (const partial of localPartials.items) {\n\t\t\t\tpartial.len = prevLen + partial.seglen;\n\t\t\t\tprevLen = partial.len;\n\t\t\t}\n\t\t}\n\n\t\tPartialSequenceLengths.options.verifier?.(combinedPartialLengths);\n\t\treturn combinedPartialLengths;\n\t}\n\n\tprivate static getOverlapClients(overlapClientIds: number[], seglen: number) {\n\t\tconst bst = new RedBlackTree<number, IOverlapClient>(compareNumbers);\n\t\tfor (const clientId of overlapClientIds) {\n\t\t\tbst.put(clientId, { clientId, seglen });\n\t\t}\n\t\treturn bst;\n\t}\n\n\tprivate static accumulateRemoveClientOverlap(\n\t\tpartialLength: PartialSequenceLength,\n\t\toverlapRemoveClientIds: number[],\n\t\tseglen: number,\n\t) {\n\t\tif (partialLength.overlapRemoveClients) {\n\t\t\tfor (const clientId of overlapRemoveClientIds) {\n\t\t\t\tconst overlapClientNode = partialLength.overlapRemoveClients.get(clientId);\n\t\t\t\tif (!overlapClientNode) {\n\t\t\t\t\tpartialLength.overlapRemoveClients.put(clientId, { clientId, seglen });\n\t\t\t\t} else {\n\t\t\t\t\toverlapClientNode.data.seglen += seglen;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tpartialLength.overlapRemoveClients = PartialSequenceLengths.getOverlapClients(\n\t\t\t\toverlapRemoveClientIds,\n\t\t\t\tseglen,\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate static accumulateMoveClientOverlap(\n\t\tpartialLength: PartialSequenceLength,\n\t\toverlapMoveClientIds: number[],\n\t\tseglen: number,\n\t) {\n\t\tif (partialLength.overlapObliterateClients) {\n\t\t\tfor (const clientId of overlapMoveClientIds) {\n\t\t\t\tconst overlapClientNode = partialLength.overlapObliterateClients.get(clientId);\n\t\t\t\tif (!overlapClientNode) {\n\t\t\t\t\tpartialLength.overlapObliterateClients.put(clientId, { clientId, seglen });\n\t\t\t\t} else {\n\t\t\t\t\toverlapClientNode.data.seglen += seglen;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tpartialLength.overlapObliterateClients = PartialSequenceLengths.getOverlapClients(\n\t\t\t\toverlapMoveClientIds,\n\t\t\t\tseglen,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * Coalesce overlapping move lengths for a partial length entry that already\n\t * exists\n\t *\n\t * @param segmentLen - Length of segment with overlapping moves\n\t * @param segment - Segment with overlapping moves\n\t * @param firstGte - Existing partial length entry\n\t * @param clientIds - Ids of clients that concurrently obliterated this segment\n\t */\n\tstatic accumulateMoveOverlapForExisting(\n\t\tsegmentLen: number,\n\t\tsegment: ISegment,\n\t\tfirstGte: PartialSequenceLength,\n\t\tclientIds: number[],\n\t) {\n\t\tconst nonInsertingClientIds = clientIds.filter((id) => id !== segment.clientId);\n\n\t\tPartialSequenceLengths.accumulateMoveClientOverlap(\n\t\t\tfirstGte,\n\t\t\tnonInsertingClientIds,\n\t\t\tsegmentLen,\n\t\t);\n\n\t\t// if this segment was obliterated by the client that inserted it,\n\t\t// and if it overlaps with the obliterate of another client, we need to\n\t\t// take into account whether it was obliterated on insert by the other\n\t\t// client\n\t\tif (clientIds.length !== nonInsertingClientIds.length) {\n\t\t\tPartialSequenceLengths.accumulateMoveClientOverlap(\n\t\t\t\tfirstGte,\n\t\t\t\t[segment.clientId],\n\t\t\t\tsegment.wasMovedOnInsert ? -segment.cachedLength : segmentLen,\n\t\t\t);\n\t\t}\n\t}\n\n\t/**\n\t * @param obliterateOverlapLen - Length of segment with overlap\n\t * @param clientIds - Ids of clients that have concurrently obliterated this\n\t * segment\n\t */\n\tprivate static getMoveOverlapForExisting(\n\t\tsegment: ISegment,\n\t\tobliterateOverlapLen: number,\n\t\tclientIds: number[],\n\t): RedBlackTree<number, IOverlapClient> {\n\t\tconst nonInsertingClientIds = clientIds.filter((id) => id !== segment.clientId);\n\t\tconst overlapObliterateClients = PartialSequenceLengths.getOverlapClients(\n\t\t\tnonInsertingClientIds,\n\t\t\tobliterateOverlapLen,\n\t\t);\n\n\t\tif (clientIds.length !== nonInsertingClientIds.length) {\n\t\t\toverlapObliterateClients.put(segment.clientId, {\n\t\t\t\tclientId: segment.clientId,\n\t\t\t\tseglen: segment.wasMovedOnInsert ? -segment.cachedLength : obliterateOverlapLen,\n\t\t\t});\n\t\t}\n\n\t\treturn overlapObliterateClients;\n\t}\n\n\tprivate static updatePartialsAfterInsertion(\n\t\tsegment: ISegment,\n\t\tsegmentLen: number,\n\t\tremoteObliteratedLen: number | undefined,\n\t\tobliterateOverlapLen: number = segmentLen,\n\t\tpartials: PartialSequenceLengthsSet,\n\t\tseq: number,\n\t\tclientId: number,\n\t\tremoveClientOverlap: number[] | undefined,\n\t\tmoveClientOverlap: number[] | undefined,\n\t) {\n\t\tconst firstGte = partials.firstGte(seq);\n\n\t\tlet partialLengthEntry: PartialSequenceLength;\n\t\tif (firstGte?.seq === seq) {\n\t\t\tpartialLengthEntry = firstGte;\n\t\t\t// Existing entry at this seq--this occurs for ops that insert/delete\n\t\t\t// more than one segment.\n\t\t\tpartialLengthEntry.seglen += segmentLen;\n\t\t\tif (remoteObliteratedLen) {\n\t\t\t\tpartialLengthEntry.remoteObliteratedLen ??= 0;\n\t\t\t\tpartialLengthEntry.remoteObliteratedLen += remoteObliteratedLen;\n\t\t\t}\n\t\t\tif (removeClientOverlap) {\n\t\t\t\tPartialSequenceLengths.accumulateRemoveClientOverlap(\n\t\t\t\t\tfirstGte,\n\t\t\t\t\tremoveClientOverlap,\n\t\t\t\t\tobliterateOverlapLen,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (moveClientOverlap) {\n\t\t\t\tPartialSequenceLengths.accumulateMoveOverlapForExisting(\n\t\t\t\t\tobliterateOverlapLen,\n\t\t\t\t\tsegment,\n\t\t\t\t\tfirstGte,\n\t\t\t\t\tmoveClientOverlap,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tconst overlapObliterateClients = moveClientOverlap\n\t\t\t\t? PartialSequenceLengths.getMoveOverlapForExisting(\n\t\t\t\t\t\tsegment,\n\t\t\t\t\t\tobliterateOverlapLen,\n\t\t\t\t\t\tmoveClientOverlap,\n\t\t\t\t )\n\t\t\t\t: undefined;\n\n\t\t\tpartialLengthEntry = {\n\t\t\t\tseq,\n\t\t\t\tclientId,\n\t\t\t\tlen: 0,\n\t\t\t\tseglen: segmentLen,\n\t\t\t\tremoteObliteratedLen,\n\t\t\t\toverlapRemoveClients: removeClientOverlap\n\t\t\t\t\t? PartialSequenceLengths.getOverlapClients(\n\t\t\t\t\t\t\tremoveClientOverlap,\n\t\t\t\t\t\t\tobliterateOverlapLen,\n\t\t\t\t\t )\n\t\t\t\t\t: undefined,\n\t\t\t\toverlapObliterateClients,\n\t\t\t};\n\n\t\t\tpartials.addOrUpdate(partialLengthEntry);\n\t\t}\n\t}\n\n\t/**\n\t * Inserts length information about the insertion of `segment` into\n\t * `combinedPartialLengths.partialLengths`.\n\t *\n\t * Does not update the clientSeqNumbers field to account for this segment.\n\t *\n\t * If `removalInfo` or `moveInfo` are defined, this operation updates the\n\t * bookkeeping to account for the (re)moval of this segment at the (re)movedSeq\n\t * instead.\n\t *\n\t * When the insertion or (re)moval of the segment is un-acked and\n\t * `combinedPartialLengths` is meant to compute such records, this does the\n\t * analogous addition to the bookkeeping for the local segment in\n\t * `combinedPartialLengths.unsequencedRecords`.\n\t */\n\tprivate static insertSegment(\n\t\tcombinedPartialLengths: PartialSequenceLengths,\n\t\tsegment: ISegment,\n\t\tremovalInfo?: IRemovalInfo,\n\t\tmoveInfo?: IMoveInfo,\n\t) {\n\t\tconst removalIsLocal = !!removalInfo && removalInfo.removedSeq === UnassignedSequenceNumber;\n\t\tconst moveIsLocal = !!moveInfo && moveInfo.movedSeq === UnassignedSequenceNumber;\n\t\tconst isLocal =\n\t\t\tsegment.seq === UnassignedSequenceNumber ||\n\t\t\t(!!removalInfo && removalIsLocal && (!moveInfo || moveIsLocal)) ||\n\t\t\t(!!moveInfo && moveIsLocal && (!removalInfo || removalIsLocal));\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tlet seqOrLocalSeq = isLocal ? segment.localSeq! : segment.seq!;\n\t\tlet segmentLen = segment.cachedLength;\n\t\tlet clientId = segment.clientId;\n\t\tlet removeClientOverlap: number[] | undefined;\n\t\tlet moveClientOverlap: number[] | undefined;\n\t\tlet remoteObliteratedLen: number | undefined;\n\n\t\t// it's not possible to have an overlapping obliterate and remove that are both local\n\t\tassert(\n\t\t\t(!moveIsLocal && !removalIsLocal) || moveIsLocal !== removalIsLocal,\n\t\t\t0x870 /* overlapping local obliterate and remove */,\n\t\t);\n\n\t\tconst removeHappenedFirst =\n\t\t\tremovalInfo &&\n\t\t\t(!moveInfo ||\n\t\t\t\tmoveIsLocal ||\n\t\t\t\t(!removalIsLocal && moveInfo.movedSeq > removalInfo.removedSeq));\n\n\t\tif (removeHappenedFirst) {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tseqOrLocalSeq = removalIsLocal ? removalInfo.localRemovedSeq! : removalInfo.removedSeq;\n\t\t\tsegmentLen = -segmentLen;\n\t\t\t// The client who performed the remove is always stored\n\t\t\t// in the first position of removalInfo.\n\t\t\tclientId = removalInfo.removedClientIds[0];\n\t\t\tconst hasOverlap = removalInfo.removedClientIds.length > 1;\n\t\t\tremoveClientOverlap = hasOverlap ? removalInfo.removedClientIds : undefined;\n\t\t} else if (moveInfo) {\n\t\t\t// The client who performed the move is always stored\n\t\t\t// in the first position of moveInfo.\n\t\t\tclientId = moveInfo.movedClientIds[0];\n\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\tseqOrLocalSeq = moveIsLocal ? moveInfo.localMovedSeq! : moveInfo.movedSeq;\n\n\t\t\tif (segment.wasMovedOnInsert) {\n\t\t\t\tassert(\n\t\t\t\t\tmoveInfo.movedSeq !== -1,\n\t\t\t\t\t0x871 /* wasMovedOnInsert should only be set on acked obliterates */,\n\t\t\t\t);\n\t\t\t\tsegmentLen = 0;\n\t\t\t} else {\n\t\t\t\tsegmentLen = -segmentLen;\n\t\t\t}\n\n\t\t\tconst hasOverlap = moveInfo.movedClientIds.length > 1;\n\t\t\tmoveClientOverlap = hasOverlap ? moveInfo.movedClientIds : undefined;\n\t\t} else if (segment.wasMovedOnInsert) {\n\t\t\t// if this segment was obliterated on insert, its length is only\n\t\t\t// visible to the client that inserted it\n\t\t\tsegmentLen = 0;\n\t\t\tremoteObliteratedLen = segment.cachedLength;\n\t\t}\n\n\t\tconst partials = isLocal\n\t\t\t? combinedPartialLengths.unsequencedRecords?.partialLengths\n\t\t\t: combinedPartialLengths.partialLengths;\n\t\tif (partials === undefined) {\n\t\t\t// Local partial but its computation isn't required\n\t\t\treturn;\n\t\t}\n\n\t\t// overlapping move and remove, remove happened first\n\t\tif (moveInfo && removalInfo && removeHappenedFirst && !moveIsLocal) {\n\t\t\t// The client who performed the remove is always stored\n\t\t\t// in the first position of removalInfo.\n\t\t\tconst moveClientId = moveInfo.movedClientIds[0];\n\t\t\tconst hasOverlap = moveInfo.movedClientIds.length > 1;\n\n\t\t\tPartialSequenceLengths.updatePartialsAfterInsertion(\n\t\t\t\tsegment,\n\t\t\t\t0,\n\t\t\t\t-segment.cachedLength,\n\t\t\t\tsegmentLen,\n\t\t\t\tpartials,\n\t\t\t\tmoveInfo.movedSeq,\n\t\t\t\tmoveClientId,\n\t\t\t\tundefined,\n\t\t\t\thasOverlap ? moveInfo.movedClientIds : undefined,\n\t\t\t);\n\t\t}\n\n\t\tif (removalInfo && !removeHappenedFirst && !removalIsLocal) {\n\t\t\tconst removeSeqOrLocalSeq = removalIsLocal\n\t\t\t\t? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t removalInfo.localRemovedSeq!\n\t\t\t\t: removalInfo.removedSeq;\n\t\t\t// The client who performed the remove is always stored\n\t\t\t// in the first position of removalInfo.\n\t\t\tconst removeClientId = removalInfo.removedClientIds[0];\n\t\t\tconst hasOverlap = removalInfo.removedClientIds.length > 1;\n\n\t\t\tPartialSequenceLengths.updatePartialsAfterInsertion(\n\t\t\t\tsegment,\n\t\t\t\t0,\n\t\t\t\t-segment.cachedLength,\n\t\t\t\tsegmentLen,\n\t\t\t\tpartials,\n\t\t\t\tremoveSeqOrLocalSeq,\n\t\t\t\tremoveClientId,\n\t\t\t\thasOverlap ? removalInfo.removedClientIds : undefined,\n\t\t\t\tundefined,\n\t\t\t);\n\t\t}\n\n\t\tPartialSequenceLengths.updatePartialsAfterInsertion(\n\t\t\tsegment,\n\t\t\tsegmentLen,\n\t\t\tremoteObliteratedLen,\n\t\t\tundefined,\n\t\t\tpartials,\n\t\t\tseqOrLocalSeq,\n\t\t\tclientId,\n\t\t\tremoveClientOverlap,\n\t\t\tmoveClientOverlap,\n\t\t);\n\n\t\t// todo: the below block needs to be changed to handle obliterate, which\n\t\t// doesn't have great support for reconnect at the moment. see ADO #3714\n\t\tconst { unsequencedRecords } = combinedPartialLengths;\n\t\tif (unsequencedRecords && removeClientOverlap && segment.localRemovedSeq !== undefined) {\n\t\t\tconst localSeq = segment.localRemovedSeq;\n\t\t\tconst localPartialLengthEntry: LocalPartialSequenceLength = {\n\t\t\t\tseq: seqOrLocalSeq,\n\t\t\t\tlocalSeq,\n\t\t\t\tclientId,\n\t\t\t\tlen: 0,\n\t\t\t\tseglen: segmentLen,\n\t\t\t};\n\t\t\tlet localIndexFirstGTE = 0;\n\t\t\tfor (\n\t\t\t\t;\n\t\t\t\tlocalIndexFirstGTE < unsequencedRecords.overlappingRemoves.length;\n\t\t\t\tlocalIndexFirstGTE++\n\t\t\t) {\n\t\t\t\tif (\n\t\t\t\t\tunsequencedRecords.overlappingRemoves[localIndexFirstGTE].seq >= seqOrLocalSeq\n\t\t\t\t) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tinsertIntoList(\n\t\t\t\tunsequencedRecords.overlappingRemoves,\n\t\t\t\tlocalIndexFirstGTE,\n\t\t\t\tlocalPartialLengthEntry,\n\t\t\t);\n\n\t\t\tconst tweakedLocalPartialEntry = {\n\t\t\t\t...localPartialLengthEntry,\n\t\t\t\tseq: localSeq,\n\t\t\t};\n\n\t\t\tunsequencedRecords.partialLengths.addOrUpdate(tweakedLocalPartialEntry);\n\t\t}\n\t}\n\n\tprivate static addSeq(\n\t\tpartialLengths: PartialSequenceLengthsSet,\n\t\tseq: number,\n\t\tseqSeglen: number,\n\t\tremoteObliteratedLen?: number,\n\t\tclientId?: number,\n\t) {\n\t\tlet seqPartialLen: PartialSequenceLength | undefined;\n\t\tlet penultPartialLen: PartialSequenceLength | undefined;\n\t\tlet pLen = partialLengths.latestLeq(seq);\n\t\tif (pLen) {\n\t\t\tif (pLen.seq === seq) {\n\t\t\t\tseqPartialLen = pLen;\n\t\t\t\tpLen = partialLengths.latestLeq(seq - 1);\n\t\t\t\tif (pLen) {\n\t\t\t\t\tpenultPartialLen = pLen;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tpenultPartialLen = pLen;\n\t\t\t}\n\t\t}\n\t\tconst len = penultPartialLen !== undefined ? penultPartialLen.len + seqSeglen : seqSeglen;\n\t\tif (seqPartialLen === undefined) {\n\t\t\tseqPartialLen = {\n\t\t\t\tclientId,\n\t\t\t\tlen,\n\t\t\t\tseglen: seqSeglen,\n\t\t\t\tseq,\n\t\t\t\tremoteObliteratedLen,\n\t\t\t};\n\t\t\tpartialLengths.addOrUpdate(seqPartialLen);\n\t\t} else {\n\t\t\tseqPartialLen.remoteObliteratedLen = remoteObliteratedLen;\n\t\t\tseqPartialLen.seglen = seqSeglen;\n\t\t\tseqPartialLen.len = len;\n\t\t\t// Assert client id matches\n\t\t}\n\t}\n\n\t/**\n\t * Length of the block this PartialSequenceLength corresponds to when viewed at `minSeq`.\n\t */\n\tprivate minLength = 0;\n\n\t/**\n\t * Total number of segments in the subtree rooted at the block this PartialSequenceLength corresponds to.\n\t */\n\tprivate segmentCount = 0;\n\n\t/**\n\t * List of PartialSequenceLength objects--ordered by increasing seq--giving length information about\n\t * the block associated with this PartialSequenceLengths object.\n\t *\n\t * `partialLengths[i].len` contains the length of this block considering only sequenced segments with\n\t * `sequenceNumber <= partialLengths[i].seq`.\n\t */\n\tprivate readonly partialLengths: PartialSequenceLengthsSet = new PartialSequenceLengthsSet();\n\n\t/**\n\t * clientSeqNumbers[clientId] is a list of partial lengths for sequenced ops which either:\n\t * - were submitted by `clientId`.\n\t * - deleted a range containing segments that were concurrently deleted by `clientId`\n\t *\n\t * The second case is referred to as the \"overlapping delete\" case. It is necessary to avoid double-counting\n\t * the removal of those segments in queries including clientId.\n\t */\n\tprivate readonly clientSeqNumbers: PartialSequenceLengthsSet[] = [];\n\n\t/**\n\t * Contains information required to answer queries for the length of this segment from the perspective of\n\t * the local client but not including all local segments (i.e., `localSeq !== collabWindow.localSeq`).\n\t * This field is only computed if requested in the constructor (i.e. `computeLocalPartials === true`).\n\t */\n\tprivate unsequencedRecords: UnsequencedPartialLengthInfo | undefined;\n\n\tconstructor(\n\t\t/**\n\t\t * The minimumSequenceNumber as defined by the collab window used in the last call to `update`,\n\t\t * or if no such calls have been made, the one used on construction.\n\t\t */\n\t\tpublic minSeq: number,\n\t\tcomputeLocalPartials: boolean,\n\t) {\n\t\tif (computeLocalPartials) {\n\t\t\tthis.unsequencedRecords = {\n\t\t\t\tpartialLengths: new PartialSequenceLengthsSet(),\n\t\t\t\toverlappingRemoves: [],\n\t\t\t\tcachedOverlappingByRefSeq: new Map(),\n\t\t\t};\n\t\t}\n\t}\n\n\t// Assume: seq is latest sequence number; no structural change to sub-tree, but a segment\n\t// with sequence number seq has been added within the sub-tree (and `update` has been called\n\t// on all descendant PartialSequenceLengths)\n\t// TODO: assert client id matches\n\tpublic update(\n\t\tnode: IMergeBlock,\n\t\tseq: number,\n\t\tclientId: number,\n\t\t// eslint-disable-next-line import/no-deprecated\n\t\tcollabWindow: CollaborationWindow,\n\t) {\n\t\tlet seqSeglen = 0;\n\t\tlet remoteObliteratedLen = 0;\n\t\tlet segCount = 0;\n\t\t// Compute length for seq across children\n\t\tfor (let i = 0; i < node.childCount; i++) {\n\t\t\tconst child = node.children[i];\n\t\t\tif (!child.isLeaf()) {\n\t\t\t\tconst childBlock = child;\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tconst branchPartialLengths = childBlock.partialLengths!;\n\t\t\t\tconst partialLengths = branchPartialLengths.partialLengths;\n\t\t\t\tconst leqPartial = partialLengths.latestLeq(seq);\n\t\t\t\tif (leqPartial && leqPartial.seq === seq) {\n\t\t\t\t\tseqSeglen += leqPartial.seglen;\n\t\t\t\t\tremoteObliteratedLen += leqPartial.remoteObliteratedLen ?? 0;\n\t\t\t\t}\n\t\t\t\tsegCount += branchPartialLengths.segmentCount;\n\t\t\t} else {\n\t\t\t\tconst segment = child;\n\t\t\t\tconst removalInfo = toRemovalInfo(segment);\n\t\t\t\tconst moveInfo = toMoveInfo(segment);\n\n\t\t\t\tconst removalIsLocal =\n\t\t\t\t\t!!removalInfo && removalInfo.removedSeq === UnassignedSequenceNumber;\n\t\t\t\tconst moveIsLocal = !!moveInfo && moveInfo.movedSeq === UnassignedSequenceNumber;\n\n\t\t\t\tconst removeHappenedFirst =\n\t\t\t\t\tremovalInfo &&\n\t\t\t\t\t(!moveInfo ||\n\t\t\t\t\t\tmoveIsLocal ||\n\t\t\t\t\t\t(!removalIsLocal && moveInfo.movedSeq > removalInfo.removedSeq));\n\n\t\t\t\tif (seq === segment.seq) {\n\t\t\t\t\t// if this segment was moved on insert, its length should\n\t\t\t\t\t// only be visible to the inserting client\n\t\t\t\t\tif (\n\t\t\t\t\t\tsegment.wasMovedOnInsert &&\n\t\t\t\t\t\tsegment.seq !== undefined &&\n\t\t\t\t\t\tmoveInfo &&\n\t\t\t\t\t\tmoveInfo.movedSeq < segment.seq\n\t\t\t\t\t) {\n\t\t\t\t\t\tremoteObliteratedLen += segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tseqSeglen += segment.cachedLength;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (seq === removalInfo?.removedSeq) {\n\t\t\t\t\t// if the remove op happened before an overlapping obliterate,\n\t\t\t\t\t// all clients can see the remove at this seq. otherwise, only\n\t\t\t\t\t// the removing client is aware of the remove\n\t\t\t\t\tif (removeHappenedFirst) {\n\t\t\t\t\t\tseqSeglen -= segment.cachedLength;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tremoteObliteratedLen -= segment.cachedLength;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (seq === moveInfo?.movedSeq) {\n\t\t\t\t\tif (removeHappenedFirst) {\n\t\t\t\t\t\tremoteObliteratedLen -= segment.cachedLength;\n\t\t\t\t\t} else if (\n\t\t\t\t\t\tsegment.wasMovedOnInsert &&\n\t\t\t\t\t\tsegment.seq !== UnassignedSequenceNumber &&\n\t\t\t\t\t\tsegment.seq !== undefined &&\n\t\t\t\t\t\tmoveInfo.movedSeq > segment.seq\n\t\t\t\t\t) {\n\t\t\t\t\t\tremoteObliteratedLen += segment.cachedLength;\n\t\t\t\t\t\tseqSeglen -= segment.cachedLength;\n\t\t\t\t\t} else if (segment.seq !== UnassignedSequenceNumber) {\n\t\t\t\t\t\tseqSeglen -= segment.cachedLength;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tsegCount++;\n\t\t\t}\n\t\t}\n\t\tthis.segmentCount = segCount;\n\t\tthis.unsequencedRecords = undefined;\n\n\t\tPartialSequenceLengths.addSeq(\n\t\t\tthis.partialLengths,\n\t\t\tseq,\n\t\t\tseqSeglen,\n\t\t\tremoteObliteratedLen,\n\t\t\tclientId,\n\t\t);\n\t\tthis.clientSeqNumbers[clientId] ??= new PartialSequenceLengthsSet();\n\t\tPartialSequenceLengths.addSeq(\n\t\t\tthis.clientSeqNumbers[clientId],\n\t\t\tseq,\n\t\t\tseqSeglen + remoteObliteratedLen,\n\t\t\tundefined,\n\t\t\tclientId,\n\t\t);\n\t\tif (PartialSequenceLengths.options.zamboni) {\n\t\t\tthis.zamboni(collabWindow);\n\t\t}\n\n\t\tPartialSequenceLengths.options.verifier?.(this);\n\t}\n\n\t/**\n\t * Returns the length of this block as viewed from the perspective of `clientId` at `refSeq`.\n\t * This is the total length of all segments sequenced at or before refSeq OR submitted by `clientId`.\n\t * If `clientId` is the local client, `localSeq` can also be provided. In that case, it is the total\n\t * length of all segments submitted at or before `refSeq` in addition to any local, unacked segments\n\t * with `segment.localSeq <= localSeq`.\n\t *\n\t * Note: the local case (where `localSeq !== undefined`) is only supported on a PartialSequenceLength object\n\t * constructed with `computeLocalPartials` set to true and not subsequently updated with `update`.\n\t */\n\tpublic getPartialLength(refSeq: number, clientId: number, localSeq?: number) {\n\t\tlet pLen = this.minLength;\n\t\tconst cliLatestIndex = this.cliLatest(clientId);\n\t\tconst cliSeq = this.clientSeqNumbers[clientId];\n\t\tpLen += this.partialLengths.latestLeq(refSeq)?.len ?? 0;\n\n\t\tif (localSeq === undefined) {\n\t\t\tif (cliLatestIndex >= 0) {\n\t\t\t\tconst cliLatest = cliSeq.items[cliLatestIndex];\n\t\t\t\tif (cliLatest.seq > refSeq) {\n\t\t\t\t\t// The client has local edits after refSeq, add in the length adjustments\n\t\t\t\t\tpLen += cliLatest.len;\n\t\t\t\t\tconst precedingCli = this.cliLatestLEQ(clientId, refSeq);\n\t\t\t\t\tif (precedingCli) {\n\t\t\t\t\t\t// Subtract out double-counted lengths: segments still in the collab window but before\n\t\t\t\t\t\t// the refSeq submitted by the client we're querying for were counted in each addition above.\n\t\t\t\t\t\tpLen -= precedingCli.len;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tassert(\n\t\t\t\tthis.unsequencedRecords !== undefined,\n\t\t\t\t0x39f /* Local getPartialLength invoked without computing local partials. */,\n\t\t\t);\n\t\t\tconst unsequencedPartialLengths = this.unsequencedRecords.partialLengths;\n\t\t\t// Local segments at or before localSeq should also be included\n\t\t\tconst local = unsequencedPartialLengths.latestLeq(localSeq);\n\t\t\tif (local) {\n\t\t\t\tpLen += local.len;\n\n\t\t\t\t// Lastly, we must subtract out any double-counted removes, which occur if a currently un-acked local\n\t\t\t\t// remove overlaps with a remote client's remove that occurred at sequence number <=refSeq.\n\t\t\t\tpLen -= this.computeOverlappingLocalRemoves(refSeq, localSeq);\n\t\t\t}\n\t\t}\n\t\treturn pLen;\n\t}\n\n\t/**\n\t * Computes the seglen for the double-counted removed overlap at (refSeq, localSeq). This logic is equivalent\n\t * to the following:\n\t *\n\t * ```typescript\n\t * let total = 0;\n\t * for (const partialLength of this.unsequencedRecords!.overlappingRemoves) {\n\t * if (partialLength.seq > refSeq) {\n\t * break;\n\t * }\n\t *\n\t * if (partialLength.localSeq <= localSeq) {\n\t * total += partialLength.seglen;\n\t * }\n\t * }\n\t *\n\t * return total;\n\t * ```\n\t *\n\t * Reconnect happens to only need to compute these lengths for two refSeq values: before and\n\t * after the rebase. Since these lists potentially scale with O(collab window * number of local edits)\n\t * and potentially need to be queried for each local op that gets rebased,\n\t * we cache the results for a given refSeq in `this.unsequencedRecords.cachedOverlappingByRefSeq` so\n\t * that they can be binary-searched the same way the usual partialLengths lists are.\n\t */\n\tprivate computeOverlappingLocalRemoves(refSeq: number, localSeq: number): number {\n\t\tif (this.unsequencedRecords === undefined) {\n\t\t\treturn 0;\n\t\t}\n\n\t\tlet cachedOverlapPartials = this.unsequencedRecords.cachedOverlappingByRefSeq.get(refSeq);\n\t\tif (!cachedOverlapPartials) {\n\t\t\tconst partials: PartialSequenceLengthsSet = new PartialSequenceLengthsSet();\n\t\t\tfor (const partial of this.unsequencedRecords.overlappingRemoves) {\n\t\t\t\tif (partial.seq > refSeq) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tpartials.addOrUpdate({ ...partial, seq: partial.localSeq, len: 0 });\n\t\t\t}\n\t\t\t// This coalesces entries with the same localSeq as well as computes overall lengths.\n\t\t\tcachedOverlapPartials = partials;\n\t\t\tthis.unsequencedRecords.cachedOverlappingByRefSeq.set(refSeq, cachedOverlapPartials);\n\t\t}\n\n\t\tconst overlap = cachedOverlapPartials.latestLeq(localSeq);\n\t\treturn overlap?.len ?? 0;\n\t}\n\n\tpublic toString(glc?: (id: number) => string, indentCount = 0) {\n\t\tlet buf = \"\";\n\t\tfor (const partial of this.partialLengths.items) {\n\t\t\tbuf += `(${partial.seq},${partial.len}) `;\n\t\t}\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-for-in-array, no-restricted-syntax\n\t\tfor (const clientId in this.clientSeqNumbers) {\n\t\t\tif (this.clientSeqNumbers[clientId].size > 0) {\n\t\t\t\tbuf += `Client `;\n\t\t\t\tbuf += glc ? `${glc(+clientId)}` : `${clientId}`;\n\t\t\t\tbuf += \"[\";\n\t\t\t\tfor (const partial of this.clientSeqNumbers[clientId].items) {\n\t\t\t\t\tbuf += `(${partial.seq},${partial.len})`;\n\t\t\t\t}\n\t\t\t\tbuf += \"]\";\n\t\t\t}\n\t\t}\n\t\tbuf = `min(seq ${this.minSeq}): ${this.minLength}; sc: ${this.segmentCount};${buf}`;\n\t\treturn buf;\n\t}\n\n\t// Clear away partial sums for sequence numbers earlier than the current window\n\t// eslint-disable-next-line import/no-deprecated\n\tprivate zamboni(segmentWindow: CollaborationWindow) {\n\t\tthis.minLength += this.partialLengths.copyDown(segmentWindow.minSeq);\n\t\tthis.minSeq = segmentWindow.minSeq;\n\t\t// eslint-disable-next-line @typescript-eslint/no-for-in-array, guard-for-in, no-restricted-syntax\n\t\tfor (const clientId in this.clientSeqNumbers) {\n\t\t\tconst cliPartials = this.clientSeqNumbers[clientId];\n\t\t\tif (cliPartials) {\n\t\t\t\tcliPartials.copyDown(segmentWindow.minSeq);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate addClientSeqNumber(clientId: number, seq: number, seglen: number) {\n\t\tthis.clientSeqNumbers[clientId] ??= new PartialSequenceLengthsSet();\n\t\tconst cli = this.clientSeqNumbers[clientId];\n\t\tcli.addOrUpdate({ seq, len: 0, seglen });\n\t}\n\n\t// Assumes sequence number already coalesced and that this is called in increasing `seq` order.\n\tprivate addClientSeqNumberFromPartial(partialLength: PartialSequenceLength) {\n\t\tconst seglen = partialLength.seglen + (partialLength.remoteObliteratedLen ?? 0);\n\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\tthis.addClientSeqNumber(partialLength.clientId!, partialLength.seq, seglen);\n\t\tif (partialLength.overlapRemoveClients) {\n\t\t\tpartialLength.overlapRemoveClients.map((oc: Property<number, IOverlapClient>) => {\n\t\t\t\t// Original client entry was handled above\n\t\t\t\tif (partialLength.clientId !== oc.data.clientId) {\n\t\t\t\t\tthis.addClientSeqNumber(oc.data.clientId, partialLength.seq, oc.data.seglen);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t});\n\t\t}\n\t\tif (partialLength.overlapObliterateClients) {\n\t\t\tpartialLength.overlapObliterateClients.map((oc: Property<number, IOverlapClient>) => {\n\t\t\t\t// Original client entry was handled above\n\t\t\t\tif (partialLength.clientId !== oc.data.clientId) {\n\t\t\t\t\tthis.addClientSeqNumber(oc.data.clientId, partialLength.seq, oc.data.seglen);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate cliLatestLEQ(clientId: number, refSeq: number): PartialSequenceLength | undefined {\n\t\treturn this.clientSeqNumbers[clientId]?.latestLeq(refSeq);\n\t}\n\n\tprivate cliLatest(clientId: number) {\n\t\tconst cliSeqs = this.clientSeqNumbers[clientId];\n\t\treturn cliSeqs && cliSeqs.size > 0 ? cliSeqs.size - 1 : -1;\n\t}\n}\n\n/* eslint-disable @typescript-eslint/dot-notation */\nfunction verifyPartialLengths(\n\tpartialSeqLengths: PartialSequenceLengths,\n\tpartialLengths: PartialSequenceLengthsSet,\n\tclientPartials: boolean,\n): number {\n\tif (partialLengths.size === 0) {\n\t\treturn 0;\n\t}\n\n\tlet lastSeqNum = 0;\n\tlet accumSegLen = 0;\n\tlet count = 0;\n\n\tfor (const partialLength of partialLengths.items) {\n\t\t// Count total number of partial length entries\n\t\tcount++;\n\n\t\t// Sequence number should be larger or equal to minseq\n\t\tassert(\n\t\t\tpartialSeqLengths.minSeq <= partialLength.seq,\n\t\t\t0x054 /* \"Sequence number less than minSeq!\" */,\n\t\t);\n\n\t\t// Sequence number should be sorted\n\t\tassert(lastSeqNum < partialLength.seq, 0x055 /* \"Sequence number is not sorted!\" */);\n\t\tlastSeqNum = partialLength.seq;\n\n\t\t// Len is a accumulation of all the seglen adjustments\n\t\taccumSegLen += partialLength.seglen;\n\t\tif (accumSegLen !== partialLength.len) {\n\t\t\tassert(\n\t\t\t\tfalse,\n\t\t\t\t0x056 /* \"Unexpected total for accumulation of all seglen adjustments!\" */,\n\t\t\t);\n\t\t}\n\n\t\tif (clientPartials) {\n\t\t\t// Client partials used to track local edits so we can account for them some refSeq.\n\t\t\t// But the information we keep track of are since minSeq, so we keep track of more history\n\t\t\t// then needed, and some of them doesn't make sense to be used for length calculations\n\t\t\t// e.g. if you have this sequence, where the minSeq is #5 because of other clients\n\t\t\t// seq 10: client 1: insert seg #1\n\t\t\t// seq 11: client 2: delete seg #2 refseq: 10\n\t\t\t// minLength is 0, we would have keep a record of seglen: -1 for clientPartialLengths for client 2\n\t\t\t// So if you ask for partial length for client 2 @ seq 5, we will have return -1.\n\t\t\t// However, that combination is invalid, since we should never see any ops with refseq < 10 for\n\t\t\t// client 2 after seq 11.\n\t\t} else {\n\t\t\t// Len adjustment should not make length negative\n\t\t\tif (partialSeqLengths[\"minLength\"] + partialLength.len < 0) {\n\t\t\t\tassert(false, 0x057 /* \"Negative length after length adjustment!\" */);\n\t\t\t}\n\t\t}\n\n\t\tif (partialLength.overlapRemoveClients) {\n\t\t\t// Only the flat partialLengths can have overlapRemoveClients, the per client view shouldn't\n\t\t\tassert(\n\t\t\t\t!clientPartials,\n\t\t\t\t0x058 /* \"Both overlapRemoveClients and clientPartials are set!\" */,\n\t\t\t);\n\n\t\t\t// Each overlap client counts as one, but the first remove to sequence was already counted.\n\t\t\t// (this aligns with the logic to omit the removing client in `addClientSeqNumberFromPartial`)\n\t\t\tcount += partialLength.overlapRemoveClients.size() - 1;\n\t\t}\n\n\t\tif (partialLength.overlapObliterateClients) {\n\t\t\t// Only the flat partialLengths can have overlapObliterateClients, the per client view shouldn't\n\t\t\tassert(\n\t\t\t\t!clientPartials,\n\t\t\t\t0x872 /* Both overlapObliterateClients and clientPartials are set! */,\n\t\t\t);\n\n\t\t\t// Each overlap client counts as one, but the first move to sequence was already counted.\n\t\t\t// (this aligns with the logic to omit the moving client in `addClientSeqNumberFromPartial`)\n\t\t\tcount += partialLength.overlapObliterateClients.size() - 1;\n\t\t}\n\t}\n\treturn count;\n}\n\nexport function verifyExpected(\n\tmergeTree: MergeTree,\n\tnode: IMergeBlock,\n\trefSeq: number,\n\tclientId: number,\n\tlocalSeq?: number,\n) {\n\tif (\n\t\t(!mergeTree.collabWindow.collaborating || mergeTree.collabWindow.clientId === clientId) &&\n\t\t(node.isLeaf() || localSeq === undefined)\n\t) {\n\t\treturn;\n\t}\n\n\tconst partialLen = node.partialLengths?.getPartialLength(refSeq, clientId, localSeq);\n\n\tlet expected = 0;\n\tconst nodesToVisit: IMergeNode[] = [node];\n\n\twhile (nodesToVisit.length > 0) {\n\t\tconst thisNode = nodesToVisit.pop();\n\t\tif (!thisNode) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (thisNode.isLeaf()) {\n\t\t\texpected += mergeTree[\"nodeLength\"](thisNode, refSeq, clientId, localSeq) ?? 0;\n\t\t} else {\n\t\t\tnodesToVisit.push(...thisNode.children.slice(0, thisNode.childCount));\n\t\t}\n\t}\n\n\tif (expected !== partialLen) {\n\t\tnode.partialLengths?.getPartialLength(refSeq, clientId, localSeq);\n\t\tthrow new Error(\n\t\t\t`expected partial length of ${expected} but found ${partialLen}. refSeq: ${refSeq}, clientId: ${clientId}`,\n\t\t);\n\t}\n}\n\nexport function verify(partialSeqLengths: PartialSequenceLengths) {\n\tif (partialSeqLengths[\"clientSeqNumbers\"]) {\n\t\tfor (const cliSeq of partialSeqLengths[\"clientSeqNumbers\"]) {\n\t\t\tif (cliSeq) {\n\t\t\t\tverifyPartialLengths(partialSeqLengths, cliSeq, true);\n\t\t\t}\n\t\t}\n\n\t\t// If we have client view, we should have the flat view\n\t\tassert(\n\t\t\t!!partialSeqLengths[\"partialLengths\"],\n\t\t\t0x059 /* \"Client view exists but flat view does not!\" */,\n\t\t);\n\n\t\tverifyPartialLengths(partialSeqLengths, partialSeqLengths[\"partialLengths\"], false);\n\t} else {\n\t\t// If we don't have a client view, we shouldn't have the flat view either\n\t\tassert(\n\t\t\t!partialSeqLengths[\"partialLengths\"],\n\t\t\t0x05b /* \"Flat view exists but client view does not!\" */,\n\t\t);\n\t}\n}\n/* eslint-enable @typescript-eslint/dot-notation */\n\n/**\n * Clones an `overlapRemoveClients` red-black tree.\n */\nfunction cloneOverlapRemoveClients(\n\toldTree: RedBlackTree<number, IOverlapClient> | undefined,\n): RedBlackTree<number, IOverlapClient> | undefined {\n\tif (!oldTree) {\n\t\treturn undefined;\n\t}\n\tconst newTree = new RedBlackTree<number, IOverlapClient>(compareNumbers);\n\toldTree.map((bProp: Property<number, IOverlapClient>) => {\n\t\tnewTree.put(bProp.data.clientId, { ...bProp.data });\n\t\treturn true;\n\t});\n\treturn newTree;\n}\n\n/**\n * Combines the `overlapRemoveClients` and `overlapObliterateClients` fields of\n * two `PartialSequenceLength` objects, modifying the first PartialSequenceLength's\n * bookkeeping in-place.\n *\n * Combination is performed additively on `seglen` on a per-client basis.\n */\nexport function combineOverlapClients(a: PartialSequenceLength, b: PartialSequenceLength) {\n\tfunction combine(\n\t\ttreeA: RedBlackTree<number, IOverlapClient> | undefined,\n\t\ttreeB: RedBlackTree<number, IOverlapClient> | undefined,\n\t): RedBlackTree<number, IOverlapClient> | undefined {\n\t\tif (treeA) {\n\t\t\tif (treeB) {\n\t\t\t\ttreeB.map((bProp: Property<number, IOverlapClient>) => {\n\t\t\t\t\tconst aProp = treeA.get(bProp.key);\n\t\t\t\t\tif (aProp) {\n\t\t\t\t\t\taProp.data.seglen += bProp.data.seglen;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttreeA.put(bProp.data.clientId, { ...bProp.data });\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t});\n\t\t\t}\n\t\t} else {\n\t\t\treturn cloneOverlapRemoveClients(treeB);\n\t\t}\n\t}\n\n\tconst overlapRemoveClients = combine(a.overlapRemoveClients, b.overlapRemoveClients);\n\tif (overlapRemoveClients) {\n\t\ta.overlapRemoveClients = overlapRemoveClients;\n\t}\n\n\tconst overlapObliterateClients = combine(\n\t\ta.overlapObliterateClients,\n\t\tb.overlapObliterateClients,\n\t);\n\tif (overlapObliterateClients) {\n\t\ta.overlapObliterateClients = overlapObliterateClients;\n\t}\n}\n\n/**\n * Given a number of seq-sorted `partialLength` lists, merges them into a combined seq-sorted `partialLength`\n * list. This merge includes coalescing `PartialSequenceLength` entries at the same seq.\n *\n * Ex: merging the following two lists (some information omitted on each PartialSequenceLength):\n * ```typescript\n * [{ seq: 1, seglen: 5 }, { seq: 3, seglen: -1 }]\n * [{ seq: 1, seglen: -3 }, { seq: 2: seglen: 4 }]\n * ```\n * would produce\n * ```typescript\n * [{ seq: 1, seglen: 2 }, { seq: 2, seglen: 4 }, { seq: 3, seglen: -1 }]\n * ```\n */\nfunction mergePartialLengths(\n\tchildPartialLengths: PartialSequenceLength[][],\n\tmergedLengths: PartialSequenceLengthsSet = new PartialSequenceLengthsSet(),\n): PartialSequenceLengthsSet {\n\tfor (const partialLength of mergeSortedListsBySeq(childPartialLengths)) {\n\t\tmergedLengths.addOrUpdate({\n\t\t\t...partialLength,\n\t\t\toverlapRemoveClients: cloneOverlapRemoveClients(partialLength.overlapRemoveClients),\n\t\t\toverlapObliterateClients: cloneOverlapRemoveClients(\n\t\t\t\tpartialLength.overlapObliterateClients,\n\t\t\t),\n\t\t});\n\t}\n\treturn mergedLengths;\n}\n\n/**\n * Given a collection of PartialSequenceLength lists--each sorted by sequence number--returns an iterable that yields\n * each PartialSequenceLength in sequence order.\n *\n * This is equivalent to flattening the input list and sorting it by sequence number. If the number of lists to merge is\n * a constant, however, this approach is advantageous asymptotically.\n */\nfunction mergeSortedListsBySeq<T extends PartialSequenceLength>(lists: T[][]): Iterable<T> {\n\tclass PartialSequenceLengthIterator {\n\t\t/**\n\t\t * nextSmallestIndex[i] is the next element of sublists[i] to check.\n\t\t * In other words, the iterator has already yielded elements of sublists[i] *up through*\n\t\t * sublists[i][nextSmallestIndex[i] - 1].\n\t\t */\n\t\tprivate readonly nextSmallestIndex: number[];\n\n\t\tconstructor(private readonly sublists: T[][]) {\n\t\t\tthis.nextSmallestIndex = new Array(sublists.length);\n\t\t\tfor (let i = 0; i < sublists.length; i++) {\n\t\t\t\tthis.nextSmallestIndex[i] = 0;\n\t\t\t}\n\t\t}\n\n\t\tpublic next(): { value: T; done: false } | { value: undefined; done: true } {\n\t\t\tconst len = this.sublists.length;\n\t\t\tlet currentMin: T | undefined;\n\t\t\tlet currentMinIndex: number | undefined;\n\t\t\tfor (let i = 0; i < len; i++) {\n\t\t\t\tconst candidateIndex = this.nextSmallestIndex[i];\n\t\t\t\tif (candidateIndex < this.sublists[i].length) {\n\t\t\t\t\tconst candidate = this.sublists[i][candidateIndex];\n\t\t\t\t\tif (!currentMin || candidate.seq < currentMin.seq) {\n\t\t\t\t\t\tcurrentMin = candidate;\n\t\t\t\t\t\tcurrentMinIndex = i;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentMin) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\tthis.nextSmallestIndex[currentMinIndex!]++;\n\t\t\t\treturn { value: currentMin, done: false };\n\t\t\t} else {\n\t\t\t\treturn { value: undefined, done: true };\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { [Symbol.iterator]: () => new PartialSequenceLengthIterator(lists) };\n}\n\nfunction insertIntoList<T>(list: T[], index: number, elem: T): void {\n\tif (index < list.length) {\n\t\tfor (let k = list.length; k > index; k--) {\n\t\t\tlist[k] = list[k - 1];\n\t\t}\n\t\tlist[index] = elem;\n\t} else {\n\t\tlist.push(elem);\n\t}\n}\n"]}
|
package/lib/properties.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../src/properties.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACzB,CAAC,KAAK,EAAE,MAAM,GAAG,CAAC,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;AAEvC;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,WAAW,GAAG,SAAS,EAAE,CAAC,EAAE,WAAW,GAAG,SAAS,WAyBrF;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,cAc5E;AAED;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,0BAazD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,WAAW,GAAG,SAAS,EAAE,QAAQ,EAAE,WAAW,eAIrF;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,IAAI,EAA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AC5B,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;gBAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;aAC3B;SACD;KACD;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAVD,8CAUC;AAED;;;;GAIG;AACH,0CAA0C;AAC1C,SAAgB,SAAS;IACxB,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAe,CAAC;AAC1C,CAAC;AAFD,8BAEC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Any mapping from a string to values of type `T`\n * @alpha\n */\nexport interface MapLike<T> {\n\t[index: string]: T;\n}\n\n/**\n * A loosely-typed mapping from strings to any value.\n *\n * @remarks Property sets are expected to be JSON-stringify-able.\n *\n * @privateRemarks PropertySet is typed using `any` because when you include\n * custom methods such as toJSON(), JSON.stringify accepts most types other than\n * functions\n * @alpha\n */\nexport type PropertySet = MapLike<any>;\n\n/**\n * @internal\n */\nexport function matchProperties(a: PropertySet | undefined, b: PropertySet | undefined) {\n\tif (!a && !b) {\n\t\treturn true;\n\t}\n\n\tconst keysA = a ? Object.keys(a) : [];\n\tconst keysB = b ? Object.keys(b) : [];\n\n\tif (keysA.length !== keysB.length) {\n\t\treturn false;\n\t}\n\n\tfor (const key of keysA) {\n\t\tif (b?.[key] === undefined) {\n\t\t\treturn false;\n\t\t} else if (typeof b[key] === \"object\") {\n\t\t\tif (!matchProperties(a?.[key], b[key])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} else if (b[key] !== a?.[key]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function extend<T>(base: MapLike<T>, extension: MapLike<T> | undefined) {\n\tif (extension !== undefined) {\n\t\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\t\tfor (const key in extension) {\n\t\t\tconst v = extension[key];\n\t\t\tif (v === null) {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n\t\t\t\tdelete base[key];\n\t\t\t} else {\n\t\t\t\tbase[key] = v;\n\t\t\t}\n\t\t}\n\t}\n\treturn base;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function clone<T>(extension: MapLike<T> | undefined) {\n\tif (extension === undefined) {\n\t\treturn undefined;\n\t}\n\tconst cloneMap = createMap<T>();\n\t// eslint-disable-next-line guard-for-in, no-restricted-syntax\n\tfor (const key in extension) {\n\t\tconst v = extension[key];\n\t\tif (v !== null) {\n\t\t\tcloneMap[key] = v;\n\t\t}\n\t}\n\treturn cloneMap;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function addProperties(oldProps: PropertySet | undefined, newProps: PropertySet) {\n\tconst _oldProps = oldProps ?? createMap<any>();\n\textend(_oldProps, newProps);\n\treturn _oldProps;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\nexport function extendIfUndefined<T>(base: MapLike<T>, extension: MapLike<T> | undefined) {\n\tif (extension !== undefined) {\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\tfor (const key in extension) {\n\t\t\tif (base[key] === undefined) {\n\t\t\t\tbase[key] = extension[key];\n\t\t\t}\n\t\t}\n\t}\n\treturn base;\n}\n\n/**\n * @deprecated This functionality was not intended for public export and will\n * be removed in a future release.\n * @internal\n */\n// Create a MapLike with good performance.\nexport function createMap<T>(): MapLike<T> {\n\treturn Object.create(null) as MapLike<T>;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"referencePositions.d.ts","sourceRoot":"","sources":["../src/referencePositions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,O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GAEG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,iBAAiB,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAE/E;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAQ5F"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.compareReferencePositions = exports.maxReferencePosition = exports.minReferencePosition = exports.DetachedReferencePosition = exports.refHasTileLabels = exports.refHasTileLabel = exports.refGetTileLabels = exports.refTypeIncludesFlag = exports.reservedRangeLabelsKey = exports.reservedTileLabelsKey = void 0;
|
|
8
|
-
const ops_1 = require("./ops");
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
exports.reservedTileLabelsKey = "referenceTileLabels";
|
|
13
|
-
/**
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
exports.reservedRangeLabelsKey = "referenceRangeLabels";
|
|
17
|
-
/**
|
|
18
|
-
* @internal
|
|
19
|
-
*/
|
|
20
|
-
function refTypeIncludesFlag(refPosOrType, flags) {
|
|
21
|
-
const refType = typeof refPosOrType === "number" ? refPosOrType : refPosOrType.refType;
|
|
22
|
-
// eslint-disable-next-line no-bitwise
|
|
23
|
-
return (refType & flags) !== 0;
|
|
24
|
-
}
|
|
25
|
-
exports.refTypeIncludesFlag = refTypeIncludesFlag;
|
|
26
|
-
/**
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
const refGetTileLabels = (refPos) => refTypeIncludesFlag(refPos, ops_1.ReferenceType.Tile) && refPos.properties
|
|
30
|
-
? refPos.properties[exports.reservedTileLabelsKey]
|
|
31
|
-
: undefined;
|
|
32
|
-
exports.refGetTileLabels = refGetTileLabels;
|
|
33
|
-
/**
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
36
|
-
function refHasTileLabel(refPos, label) {
|
|
37
|
-
const tileLabels = (0, exports.refGetTileLabels)(refPos);
|
|
38
|
-
return tileLabels?.includes(label) ?? false;
|
|
39
|
-
}
|
|
40
|
-
exports.refHasTileLabel = refHasTileLabel;
|
|
41
|
-
/**
|
|
42
|
-
* @internal
|
|
43
|
-
*/
|
|
44
|
-
function refHasTileLabels(refPos) {
|
|
45
|
-
return (0, exports.refGetTileLabels)(refPos) !== undefined;
|
|
46
|
-
}
|
|
47
|
-
exports.refHasTileLabels = refHasTileLabels;
|
|
48
|
-
/**
|
|
49
|
-
* @internal
|
|
50
|
-
*/
|
|
51
|
-
exports.DetachedReferencePosition = -1;
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
function minReferencePosition(a, b) {
|
|
56
|
-
return compareReferencePositions(a, b) < 0 ? a : b;
|
|
57
|
-
}
|
|
58
|
-
exports.minReferencePosition = minReferencePosition;
|
|
59
|
-
/**
|
|
60
|
-
* @internal
|
|
61
|
-
*/
|
|
62
|
-
function maxReferencePosition(a, b) {
|
|
63
|
-
return compareReferencePositions(a, b) > 0 ? a : b;
|
|
64
|
-
}
|
|
65
|
-
exports.maxReferencePosition = maxReferencePosition;
|
|
66
|
-
/**
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
function compareReferencePositions(a, b) {
|
|
70
|
-
const aSeg = a.getSegment();
|
|
71
|
-
const bSeg = b.getSegment();
|
|
72
|
-
if (aSeg === bSeg) {
|
|
73
|
-
return a.getOffset() - b.getOffset();
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
return aSeg === undefined || (bSeg !== undefined && aSeg.ordinal < bSeg.ordinal) ? -1 : 1;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
exports.compareReferencePositions = compareReferencePositions;
|
|
80
|
-
//# sourceMappingURL=referencePositions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"referencePositions.js","sourceRoot":"","sources":["../src/referencePositions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,+BAAsC;AAGtC;;GAEG;AACU,QAAA,qBAAqB,GAAG,qBAAqB,CAAC;AAC3D;;GAEG;AACU,QAAA,sBAAsB,GAAG,sBAAsB,CAAC;AAE7D;;GAEG;AACH,SAAgB,mBAAmB,CAClC,YAA+C,EAC/C,KAAoB;IAEpB,MAAM,OAAO,GAAG,OAAO,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC;IACvF,sCAAsC;IACtC,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAPD,kDAOC;AAED;;GAEG;AACI,MAAM,gBAAgB,GAAG,CAAC,MAAyB,EAAwB,EAAE,CACnF,mBAAmB,CAAC,MAAM,EAAE,mBAAa,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,UAAU;IACnE,CAAC,CAAE,MAAM,CAAC,UAAU,CAAC,6BAAqB,CAAc;IACxD,CAAC,CAAC,SAAS,CAAC;AAHD,QAAA,gBAAgB,oBAGf;AAEd;;GAEG;AACH,SAAgB,eAAe,CAAC,MAAyB,EAAE,KAAa;IACvE,MAAM,UAAU,GAAG,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC;IAC5C,OAAO,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;AAC7C,CAAC;AAHD,0CAGC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,MAAyB;IACzD,OAAO,IAAA,wBAAgB,EAAC,MAAM,CAAC,KAAK,SAAS,CAAC;AAC/C,CAAC;AAFD,4CAEC;AAiDD;;GAEG;AACU,QAAA,yBAAyB,GAAG,CAAC,CAAC,CAAC;AAE5C;;GAEG;AACH,SAAgB,oBAAoB,CAA8B,CAAI,EAAE,CAAI;IAC3E,OAAO,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,oDAEC;AAED;;GAEG;AACH,SAAgB,oBAAoB,CAA8B,CAAI,EAAE,CAAI;IAC3E,OAAO,yBAAyB,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAFD,oDAEC;AAED;;GAEG;AACH,SAAgB,yBAAyB,CAAC,CAAoB,EAAE,CAAoB;IACnF,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC5B,IAAI,IAAI,KAAK,IAAI,EAAE;QAClB,OAAO,CAAC,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC;KACrC;SAAM;QACN,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;KAC1F;AACF,CAAC;AARD,8DAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { SlidingPreference } from \"./localReference\";\nimport { ISegment } from \"./mergeTreeNodes\";\nimport { ReferenceType } from \"./ops\";\nimport { PropertySet } from \"./properties\";\n\n/**\n * @internal\n */\nexport const reservedTileLabelsKey = \"referenceTileLabels\";\n/**\n * @internal\n */\nexport const reservedRangeLabelsKey = \"referenceRangeLabels\";\n\n/**\n * @internal\n */\nexport function refTypeIncludesFlag(\n\trefPosOrType: ReferencePosition | ReferenceType,\n\tflags: ReferenceType,\n): boolean {\n\tconst refType = typeof refPosOrType === \"number\" ? refPosOrType : refPosOrType.refType;\n\t// eslint-disable-next-line no-bitwise\n\treturn (refType & flags) !== 0;\n}\n\n/**\n * @internal\n */\nexport const refGetTileLabels = (refPos: ReferencePosition): string[] | undefined =>\n\trefTypeIncludesFlag(refPos, ReferenceType.Tile) && refPos.properties\n\t\t? (refPos.properties[reservedTileLabelsKey] as string[])\n\t\t: undefined;\n\n/**\n * @internal\n */\nexport function refHasTileLabel(refPos: ReferencePosition, label: string): boolean {\n\tconst tileLabels = refGetTileLabels(refPos);\n\treturn tileLabels?.includes(label) ?? false;\n}\n\n/**\n * @internal\n */\nexport function refHasTileLabels(refPos: ReferencePosition): boolean {\n\treturn refGetTileLabels(refPos) !== undefined;\n}\n\n/**\n * Represents a reference to a place within a merge tree. This place conceptually remains stable over time\n * by referring to a particular segment and offset within that segment.\n * Thus, this reference's character position changes as the tree is edited.\n * @alpha\n */\nexport interface ReferencePosition {\n\t/**\n\t * Properties associated with this reference\n\t */\n\tproperties?: PropertySet;\n\n\t/**\n\t * The direction for this reference position to slide when the segment it\n\t * points to is removed. See {@link (SlidingPreference:type)} for additional context.\n\t *\n\t * Defaults to SlidingPreference.Forward\n\t */\n\tslidingPreference?: SlidingPreference;\n\n\trefType: ReferenceType;\n\n\t/**\n\t * Gets the segment that this reference position is semantically associated with. Returns undefined iff the\n\t * reference became detached from the string.\n\t */\n\tgetSegment(): ISegment | undefined;\n\n\t/**\n\t * Gets the offset for this reference position within its associated segment.\n\t *\n\t * @example\n\t *\n\t * If a merge-tree has 3 leaf segments [\"hello\", \" \", \"world\"] and a ReferencePosition refers to the \"l\"\n\t * in \"world\", that reference's offset would be 3 as \"l\" is the character at index 3 within \"world\".\n\t */\n\tgetOffset(): number;\n\n\t/**\n\t * @param newProps - Properties to add to this reference.\n\t * @remarks Note that merge-tree does not broadcast changes to other clients. It is up to the consumer\n\t * to ensure broadcast happens if that is desired.\n\t */\n\taddProperties(newProps: PropertySet): void;\n\tisLeaf(): this is ISegment;\n}\n\n/**\n * @internal\n */\nexport const DetachedReferencePosition = -1;\n\n/**\n * @internal\n */\nexport function minReferencePosition<T extends ReferencePosition>(a: T, b: T): T {\n\treturn compareReferencePositions(a, b) < 0 ? a : b;\n}\n\n/**\n * @internal\n */\nexport function maxReferencePosition<T extends ReferencePosition>(a: T, b: T): T {\n\treturn compareReferencePositions(a, b) > 0 ? a : b;\n}\n\n/**\n * @internal\n */\nexport function compareReferencePositions(a: ReferencePosition, b: ReferencePosition): number {\n\tconst aSeg = a.getSegment();\n\tconst bSeg = b.getSegment();\n\tif (aSeg === bSeg) {\n\t\treturn a.getOffset() - b.getOffset();\n\t} else {\n\t\treturn aSeg === undefined || (bSeg !== undefined && aSeg.ordinal < bSeg.ordinal) ? -1 : 1;\n\t}\n}\n"]}
|