@fluidframework/sequence 2.0.0-internal.6.3.2 → 2.0.0-internal.6.4.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 +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/intervalCollection.d.ts +5 -5
- package/dist/intervalCollection.d.ts.map +1 -1
- package/dist/intervalCollection.js +26 -12
- package/dist/intervalCollection.js.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.d.ts +13 -3
- package/dist/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointInRangeIndex.js +8 -5
- package/dist/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/dist/intervalIndex/endpointIndex.d.ts +13 -2
- package/dist/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/dist/intervalIndex/endpointIndex.js +6 -3
- package/dist/intervalIndex/endpointIndex.js.map +1 -1
- package/dist/intervalIndex/idIntervalIndex.js.map +1 -1
- package/dist/intervalIndex/index.d.ts +4 -4
- package/dist/intervalIndex/index.d.ts.map +1 -1
- package/dist/intervalIndex/index.js +5 -1
- package/dist/intervalIndex/index.js.map +1 -1
- package/dist/intervalIndex/intervalIndex.d.ts +2 -2
- package/dist/intervalIndex/intervalIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts +3 -2
- package/dist/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingIntervalsIndex.js +4 -2
- package/dist/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +2 -2
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js +3 -1
- package/dist/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/dist/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.d.ts +13 -3
- package/dist/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/dist/intervalIndex/startpointInRangeIndex.js +8 -5
- package/dist/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/dist/intervals/interval.d.ts +1 -1
- package/dist/intervals/interval.d.ts.map +1 -1
- package/dist/intervals/interval.js +2 -1
- package/dist/intervals/interval.js.map +1 -1
- package/dist/intervals/intervalUtils.d.ts +3 -2
- package/dist/intervals/intervalUtils.d.ts.map +1 -1
- package/dist/intervals/intervalUtils.js.map +1 -1
- package/dist/intervals/sequenceInterval.d.ts +8 -5
- package/dist/intervals/sequenceInterval.d.ts.map +1 -1
- package/dist/intervals/sequenceInterval.js +8 -4
- package/dist/intervals/sequenceInterval.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/sequence.d.ts +2 -1
- package/dist/sequence.d.ts.map +1 -1
- package/dist/sequence.js +3 -2
- package/dist/sequence.js.map +1 -1
- package/dist/sequenceDeltaEvent.d.ts +8 -3
- package/dist/sequenceDeltaEvent.d.ts.map +1 -1
- package/dist/sequenceDeltaEvent.js.map +1 -1
- package/dist/sequenceFactory.js +1 -1
- package/dist/sequenceFactory.js.map +1 -1
- package/dist/sharedString.js +2 -1
- package/dist/sharedString.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/intervalCollection.d.ts +5 -5
- package/lib/intervalCollection.d.ts.map +1 -1
- package/lib/intervalCollection.js +28 -14
- package/lib/intervalCollection.js.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.d.ts +13 -3
- package/lib/intervalIndex/endpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointInRangeIndex.js +8 -6
- package/lib/intervalIndex/endpointInRangeIndex.js.map +1 -1
- package/lib/intervalIndex/endpointIndex.d.ts +13 -2
- package/lib/intervalIndex/endpointIndex.d.ts.map +1 -1
- package/lib/intervalIndex/endpointIndex.js +6 -4
- package/lib/intervalIndex/endpointIndex.js.map +1 -1
- package/lib/intervalIndex/idIntervalIndex.js.map +1 -1
- package/lib/intervalIndex/index.d.ts +4 -4
- package/lib/intervalIndex/index.d.ts.map +1 -1
- package/lib/intervalIndex/index.js +4 -4
- package/lib/intervalIndex/index.js.map +1 -1
- package/lib/intervalIndex/intervalIndex.d.ts +2 -2
- package/lib/intervalIndex/intervalIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts +3 -2
- package/lib/intervalIndex/overlappingIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingIntervalsIndex.js +5 -3
- package/lib/intervalIndex/overlappingIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts +2 -2
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.d.ts.map +1 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js +3 -1
- package/lib/intervalIndex/overlappingSequenceIntervalsIndex.js.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.d.ts.map +1 -1
- package/lib/intervalIndex/sequenceIntervalIndexes.js.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.d.ts +13 -3
- package/lib/intervalIndex/startpointInRangeIndex.d.ts.map +1 -1
- package/lib/intervalIndex/startpointInRangeIndex.js +8 -6
- package/lib/intervalIndex/startpointInRangeIndex.js.map +1 -1
- package/lib/intervals/interval.d.ts +1 -1
- package/lib/intervals/interval.d.ts.map +1 -1
- package/lib/intervals/interval.js +2 -1
- package/lib/intervals/interval.js.map +1 -1
- package/lib/intervals/intervalUtils.d.ts +3 -2
- package/lib/intervals/intervalUtils.d.ts.map +1 -1
- package/lib/intervals/intervalUtils.js.map +1 -1
- package/lib/intervals/sequenceInterval.d.ts +8 -5
- package/lib/intervals/sequenceInterval.d.ts.map +1 -1
- package/lib/intervals/sequenceInterval.js +8 -4
- package/lib/intervals/sequenceInterval.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/sequence.d.ts +2 -1
- package/lib/sequence.d.ts.map +1 -1
- package/lib/sequence.js +3 -2
- package/lib/sequence.js.map +1 -1
- package/lib/sequenceDeltaEvent.d.ts +8 -3
- package/lib/sequenceDeltaEvent.d.ts.map +1 -1
- package/lib/sequenceDeltaEvent.js.map +1 -1
- package/lib/sequenceFactory.js +1 -1
- package/lib/sequenceFactory.js.map +1 -1
- package/lib/sharedString.js +2 -1
- package/lib/sharedString.js.map +1 -1
- package/package.json +15 -17
- package/src/index.ts +1 -1
- package/src/intervalCollection.ts +39 -19
- package/src/intervalIndex/endpointInRangeIndex.ts +18 -10
- package/src/intervalIndex/endpointIndex.ts +15 -7
- package/src/intervalIndex/idIntervalIndex.ts +1 -1
- package/src/intervalIndex/index.ts +12 -3
- package/src/intervalIndex/intervalIndex.ts +2 -2
- package/src/intervalIndex/overlappingIntervalsIndex.ts +14 -6
- package/src/intervalIndex/overlappingSequenceIntervalsIndex.ts +4 -1
- package/src/intervalIndex/sequenceIntervalIndexes.ts +1 -1
- package/src/intervalIndex/startpointInRangeIndex.ts +18 -10
- package/src/intervals/interval.ts +2 -1
- package/src/intervals/intervalUtils.ts +4 -2
- package/src/intervals/sequenceInterval.ts +8 -4
- package/src/packageVersion.ts +1 -1
- package/src/sequence.ts +3 -2
- package/src/sequenceDeltaEvent.ts +11 -3
- package/src/sequenceFactory.ts +1 -1
- package/src/sharedString.ts +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intervalCollection.js","s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CAAC,eAAe,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACpE,CAAC;IAED;;OAEG;IACI,YAAY,CAAC,GAAW;QAC9B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YAC1B,MAAM,IAAI,8BAAY,CAAC,+BAA+B,CAAC,CAAC;SACxD;QAED,OAAO,IAAI,CAAC,eAAe,CAAC,gBAAgB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAChE,CAAC;CACD;AAh8BD,gDAg8BC;AAgBD;;;;;GAKG;AACH,SAAgB,2BAA2B,CAC1C,iBAAyC;IAEzC,MAAM,EAAE,QAAQ,EAAE,CAAC,mCAAsB,CAAC,EAAE,mBAAmB,EAAE,GAChE,iBAAiB,CAAC,UAAU,IAAI,EAAE,CAAC;IACpC,OAAO,QAAQ,IAAI,mBAAmB,EAAE,MAAM,KAAK,CAAC;QACnD,CAAC,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE;QAC7C,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AARD,kEAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IEvent } from \"@fluidframework/core-interfaces\";\nimport {\n\taddProperties,\n\tClient,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tISegment,\n\tMergeTreeDeltaType,\n\tPropertySet,\n\tLocalReferencePosition,\n\tReferenceType,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tUnassignedSequenceNumber,\n\tDetachedReferencePosition,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils\";\nimport { v4 as uuid } from \"uuid\";\nimport {\n\tIMapMessageLocalMetadata,\n\tIValueFactory,\n\tIValueOpEmitter,\n\tIValueOperation,\n\tIValueType,\n\tIValueTypeOperationValue,\n\tSequenceOptions,\n} from \"./defaultMapInterfaces\";\nimport {\n\tCompressedSerializedInterval,\n\tIIntervalHelpers,\n\tInterval,\n\tIntervalOpType,\n\tIntervalStickiness,\n\tIntervalType,\n\tISerializableInterval,\n\tISerializedInterval,\n\tSequenceInterval,\n\tSerializedIntervalDelta,\n\tcreatePositionReferenceFromSegoff,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\tsequenceIntervalHelpers,\n\tcreateInterval,\n} from \"./intervals\";\nimport {\n\tIEndpointIndex,\n\tIIdIntervalIndex,\n\tIOverlappingIntervalsIndex,\n\tIntervalIndex,\n\tcreateEndpointIndex,\n\tcreateIdIntervalIndex,\n\tcreateOverlappingIntervalsIndex,\n} from \"./intervalIndex\";\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nexport interface ISerializedIntervalCollectionV2 {\n\tlabel: string;\n\tversion: 2;\n\tintervals: CompressedSerializedInterval[];\n}\n\n/**\n * Decompress an interval after loading a summary from JSON. The exact format\n * of this compression is unspecified and subject to change\n */\nfunction decompressInterval(\n\tinterval: CompressedSerializedInterval,\n\tlabel?: string,\n): ISerializedInterval {\n\treturn {\n\t\tstart: interval[0],\n\t\tend: interval[1],\n\t\tsequenceNumber: interval[2],\n\t\tintervalType: interval[3],\n\t\tproperties: { ...interval[4], [reservedRangeLabelsKey]: [label] },\n\t\tstickiness: interval[5],\n\t};\n}\n\n/**\n * Compress an interval prior to serialization as JSON. The exact format of this\n * compression is unspecified and subject to change\n */\nfunction compressInterval(interval: ISerializedInterval): CompressedSerializedInterval {\n\tconst { start, end, sequenceNumber, intervalType, properties } = interval;\n\n\tconst base: CompressedSerializedInterval = [\n\t\tstart,\n\t\tend,\n\t\tsequenceNumber,\n\t\tintervalType,\n\t\t// remove the `referenceRangeLabels` property as it is already stored\n\t\t// in the `label` field of the summary\n\t\t{ ...properties, [reservedRangeLabelsKey]: undefined },\n\t];\n\n\tif (interval.stickiness !== undefined && interval.stickiness !== IntervalStickiness.END) {\n\t\tbase.push(interval.stickiness);\n\t}\n\n\treturn base;\n}\n\nexport function createIntervalIndex() {\n\tconst helpers: IIntervalHelpers<Interval> = {\n\t\tcompareEnds: (a: Interval, b: Interval) => a.end - b.end,\n\t\tcreate: createInterval,\n\t};\n\tconst lc = new LocalIntervalCollection<Interval>(undefined as any as Client, \"\", helpers);\n\treturn lc;\n}\n\nexport class LocalIntervalCollection<TInterval extends ISerializableInterval> {\n\tprivate static readonly legacyIdPrefix = \"legacy\";\n\tpublic readonly overlappingIntervalsIndex: IOverlappingIntervalsIndex<TInterval>;\n\tpublic readonly idIntervalIndex: IIdIntervalIndex<TInterval>;\n\tpublic readonly endIntervalIndex: IEndpointIndex<TInterval>;\n\tprivate readonly indexes: Set<IntervalIndex<TInterval>>;\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly label: string,\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t\t/** Callback invoked each time one of the endpoints of an interval slides. */\n\t\tprivate readonly onPositionChange?: (\n\t\t\tinterval: TInterval,\n\t\t\tpreviousInterval: TInterval,\n\t\t) => void,\n\t) {\n\t\tthis.overlappingIntervalsIndex = createOverlappingIntervalsIndex(client, helpers);\n\t\tthis.idIntervalIndex = createIdIntervalIndex<TInterval>();\n\t\tthis.endIntervalIndex = createEndpointIndex(client, helpers);\n\t\tthis.indexes = new Set([\n\t\t\tthis.overlappingIntervalsIndex,\n\t\t\tthis.idIntervalIndex,\n\t\t\tthis.endIntervalIndex,\n\t\t]);\n\t}\n\n\tpublic createLegacyId(start: number, end: number): string {\n\t\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t\t// without ID's.\n\t\treturn `${LocalIntervalCollection.legacyIdPrefix}${start}-${end}`;\n\t}\n\n\t/**\n\t * Validates that a serialized interval has the ID property. Creates an ID\n\t * if one does not already exist\n\t *\n\t * @param serializedInterval - The interval to be checked\n\t * @returns The interval's existing or newly created id\n\t */\n\tpublic ensureSerializedId(serializedInterval: ISerializedInterval): string {\n\t\tlet id: string | undefined = serializedInterval.properties?.[reservedIntervalIdKey];\n\t\tif (id === undefined) {\n\t\t\t// Back-compat: 0.39 and earlier did not have IDs on intervals. If an interval from such a client\n\t\t\t// comes over the wire, create a non-unique one based on start/end.\n\t\t\t// This will allow all clients to refer to this interval consistently.\n\t\t\tid = this.createLegacyId(serializedInterval.start, serializedInterval.end);\n\t\t\tconst newProps = {\n\t\t\t\t[reservedIntervalIdKey]: id,\n\t\t\t};\n\t\t\tserializedInterval.properties = addProperties(serializedInterval.properties, newProps);\n\t\t}\n\t\t// Make the ID immutable for safety's sake.\n\t\tObject.defineProperty(serializedInterval.properties, reservedIntervalIdKey, {\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\n\t\treturn id;\n\t}\n\n\tprivate removeIntervalFromIndexes(interval: TInterval) {\n\t\tfor (const index of this.indexes) {\n\t\t\tindex.remove(interval);\n\t\t}\n\t}\n\n\tpublic appendIndex(index: IntervalIndex<TInterval>) {\n\t\tthis.indexes.add(index);\n\t}\n\n\tpublic removeIndex(index: IntervalIndex<TInterval>): boolean {\n\t\treturn this.indexes.delete(index);\n\t}\n\n\tpublic removeExistingInterval(interval: TInterval) {\n\t\tthis.removeIntervalFromIndexes(interval);\n\t\tthis.removeIntervalListeners(interval);\n\t}\n\n\tpublic createInterval(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\top?: ISequencedDocumentMessage,\n\t\tstickiness: IntervalStickiness = IntervalStickiness.END,\n\t): TInterval {\n\t\treturn this.helpers.create(\n\t\t\tthis.label,\n\t\t\tstart,\n\t\t\tend,\n\t\t\tthis.client,\n\t\t\tintervalType,\n\t\t\top,\n\t\t\tundefined,\n\t\t\tstickiness,\n\t\t);\n\t}\n\n\tpublic addInterval(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\top?: ISequencedDocumentMessage,\n\t\tstickiness: IntervalStickiness = IntervalStickiness.END,\n\t) {\n\t\tconst interval: TInterval = this.createInterval(start, end, intervalType, op, stickiness);\n\t\tif (interval) {\n\t\t\tif (!interval.properties) {\n\t\t\t\tinterval.properties = createMap<any>();\n\t\t\t}\n\n\t\t\tif (props) {\n\t\t\t\t// This check is intended to prevent scenarios where a random interval is created and then\n\t\t\t\t// inserted into a collection. The aim is to ensure that the collection is created first\n\t\t\t\t// then the user can create/add intervals based on the collection\n\t\t\t\tif (\n\t\t\t\t\tprops[reservedRangeLabelsKey] !== undefined &&\n\t\t\t\t\tprops[reservedRangeLabelsKey][0] !== this.label\n\t\t\t\t) {\n\t\t\t\t\tthrow new LoggingError(\n\t\t\t\t\t\t\"Adding an interval that belongs to another interval collection is not permitted\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tinterval.addProperties(props);\n\t\t\t}\n\t\t\tinterval.properties[reservedIntervalIdKey] ??= uuid();\n\t\t\tthis.add(interval);\n\t\t}\n\t\treturn interval;\n\t}\n\n\tprivate linkEndpointsToInterval(interval: TInterval): void {\n\t\tif (interval instanceof SequenceInterval) {\n\t\t\tinterval.start.addProperties({ interval });\n\t\t\tinterval.end.addProperties({ interval });\n\t\t}\n\t}\n\n\tprivate addIntervalToIndexes(interval: TInterval) {\n\t\tfor (const index of this.indexes) {\n\t\t\tindex.add(interval);\n\t\t}\n\t}\n\n\tpublic add(interval: TInterval): void {\n\t\tthis.linkEndpointsToInterval(interval);\n\t\tthis.addIntervalToIndexes(interval);\n\t\tthis.addIntervalListeners(interval);\n\t}\n\n\tpublic changeInterval(\n\t\tinterval: TInterval,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t) {\n\t\tconst newInterval = interval.modify(this.label, start, end, op, localSeq) as\n\t\t\t| TInterval\n\t\t\t| undefined;\n\t\tif (newInterval) {\n\t\t\tthis.removeExistingInterval(interval);\n\t\t\tthis.add(newInterval);\n\t\t}\n\t\treturn newInterval;\n\t}\n\n\tpublic serialize(): ISerializedIntervalCollectionV2 {\n\t\treturn {\n\t\t\tlabel: this.label,\n\t\t\tintervals: Array.from(this.idIntervalIndex, (interval) =>\n\t\t\t\tcompressInterval(interval.serialize()),\n\t\t\t),\n\t\t\tversion: 2,\n\t\t};\n\t}\n\n\tprivate addIntervalListeners(interval: TInterval) {\n\t\tconst cloneRef = (ref: LocalReferencePosition) => {\n\t\t\tconst segment = ref.getSegment();\n\t\t\tif (segment === undefined) {\n\t\t\t\t// Cloning is unnecessary: refs which have slid off the string entirely\n\t\t\t\t// never get slid back on. Creation code for refs doesn't accept undefined segment\n\t\t\t\t// either, so this must be special-cased.\n\t\t\t\treturn ref;\n\t\t\t}\n\n\t\t\treturn this.client.createLocalReferencePosition(\n\t\t\t\tsegment,\n\t\t\t\tref.getOffset(),\n\t\t\t\tReferenceType.Transient,\n\t\t\t\tref.properties,\n\t\t\t\tref.slidingPreference,\n\t\t\t);\n\t\t};\n\t\tif (interval instanceof SequenceInterval) {\n\t\t\tlet previousInterval: (TInterval & SequenceInterval) | undefined;\n\t\t\tlet pendingChanges = 0;\n\t\t\tinterval.addPositionChangeListeners(\n\t\t\t\t() => {\n\t\t\t\t\tpendingChanges++;\n\t\t\t\t\t// Note: both start and end can change and invoke beforeSlide on each endpoint before afterSlide.\n\t\t\t\t\tif (!previousInterval) {\n\t\t\t\t\t\tpreviousInterval = interval.clone() as TInterval & SequenceInterval;\n\t\t\t\t\t\tpreviousInterval.start = cloneRef(previousInterval.start);\n\t\t\t\t\t\tpreviousInterval.end = cloneRef(previousInterval.end);\n\t\t\t\t\t\tthis.removeIntervalFromIndexes(interval);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpreviousInterval !== undefined,\n\t\t\t\t\t\t0x3fa /* Invalid interleaving of before/after slide */,\n\t\t\t\t\t);\n\t\t\t\t\tpendingChanges--;\n\t\t\t\t\tif (pendingChanges === 0) {\n\t\t\t\t\t\tthis.addIntervalToIndexes(interval);\n\t\t\t\t\t\tthis.onPositionChange?.(interval, previousInterval);\n\t\t\t\t\t\tpreviousInterval = undefined;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate removeIntervalListeners(interval: TInterval) {\n\t\tif (interval instanceof SequenceInterval) {\n\t\t\tinterval.removePositionChangeListeners();\n\t\t}\n\t}\n}\n\nclass SequenceIntervalCollectionFactory\n\timplements IValueFactory<IntervalCollection<SequenceInterval>>\n{\n\tpublic load(\n\t\temitter: IValueOpEmitter,\n\t\traw: ISerializedInterval[] | ISerializedIntervalCollectionV2 = [],\n\t\toptions?: Partial<SequenceOptions>,\n\t): IntervalCollection<SequenceInterval> {\n\t\treturn new IntervalCollection<SequenceInterval>(\n\t\t\tsequenceIntervalHelpers,\n\t\t\ttrue,\n\t\t\temitter,\n\t\t\traw,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic store(\n\t\tvalue: IntervalCollection<SequenceInterval>,\n\t): ISerializedInterval[] | ISerializedIntervalCollectionV2 {\n\t\treturn value.serializeInternal();\n\t}\n}\n\nexport class SequenceIntervalCollectionValueType\n\timplements IValueType<IntervalCollection<SequenceInterval>>\n{\n\tpublic static Name = \"sharedStringIntervalCollection\";\n\n\tpublic get name(): string {\n\t\treturn SequenceIntervalCollectionValueType.Name;\n\t}\n\n\tpublic get factory(): IValueFactory<IntervalCollection<SequenceInterval>> {\n\t\treturn SequenceIntervalCollectionValueType._factory;\n\t}\n\n\tpublic get ops(): Map<string, IValueOperation<IntervalCollection<SequenceInterval>>> {\n\t\treturn SequenceIntervalCollectionValueType._ops;\n\t}\n\n\tprivate static readonly _factory: IValueFactory<IntervalCollection<SequenceInterval>> =\n\t\tnew SequenceIntervalCollectionFactory();\n\n\tprivate static readonly _ops = makeOpsMap<SequenceInterval>();\n}\n\nclass IntervalCollectionFactory implements IValueFactory<IntervalCollection<Interval>> {\n\tpublic load(\n\t\temitter: IValueOpEmitter,\n\t\traw: ISerializedInterval[] | ISerializedIntervalCollectionV2 = [],\n\t\toptions?: Partial<SequenceOptions>,\n\t): IntervalCollection<Interval> {\n\t\tconst helpers: IIntervalHelpers<Interval> = {\n\t\t\tcompareEnds: (a: Interval, b: Interval) => a.end - b.end,\n\t\t\tcreate: createInterval,\n\t\t};\n\t\tconst collection = new IntervalCollection<Interval>(helpers, false, emitter, raw, options);\n\t\tcollection.attachGraph(undefined as any as Client, \"\");\n\t\treturn collection;\n\t}\n\n\tpublic store(value: IntervalCollection<Interval>): ISerializedIntervalCollectionV2 {\n\t\treturn value.serializeInternal();\n\t}\n}\n\nexport class IntervalCollectionValueType implements IValueType<IntervalCollection<Interval>> {\n\tpublic static Name = \"sharedIntervalCollection\";\n\n\tpublic get name(): string {\n\t\treturn IntervalCollectionValueType.Name;\n\t}\n\n\tpublic get factory(): IValueFactory<IntervalCollection<Interval>> {\n\t\treturn IntervalCollectionValueType._factory;\n\t}\n\n\tpublic get ops(): Map<string, IValueOperation<IntervalCollection<Interval>>> {\n\t\treturn IntervalCollectionValueType._ops;\n\t}\n\n\tprivate static readonly _factory: IValueFactory<IntervalCollection<Interval>> =\n\t\tnew IntervalCollectionFactory();\n\tprivate static readonly _ops = makeOpsMap<Interval>();\n}\n\nexport function makeOpsMap<T extends ISerializableInterval>(): Map<\n\tstring,\n\tIValueOperation<IntervalCollection<T>>\n> {\n\tconst rebase = (\n\t\tcollection: IntervalCollection<T>,\n\t\top: IValueTypeOperationValue,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t) => {\n\t\tconst { localSeq } = localOpMetadata;\n\t\tconst rebasedValue = collection.rebaseLocalInterval(op.opName, op.value, localSeq);\n\t\tconst rebasedOp = { ...op, value: rebasedValue };\n\t\treturn { rebasedOp, rebasedLocalOpMetadata: localOpMetadata };\n\t};\n\n\treturn new Map<string, IValueOperation<IntervalCollection<T>>>([\n\t\t[\n\t\t\tIntervalOpType.ADD,\n\t\t\t{\n\t\t\t\tprocess: (collection, params, local, op, localOpMetadata) => {\n\t\t\t\t\t// if params is undefined, the interval was deleted during\n\t\t\t\t\t// rebasing\n\t\t\t\t\tif (!params) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tassert(op !== undefined, 0x3fb /* op should exist here */);\n\t\t\t\t\tcollection.ackAdd(params, local, op, localOpMetadata);\n\t\t\t\t},\n\t\t\t\trebase,\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\tIntervalOpType.DELETE,\n\t\t\t{\n\t\t\t\tprocess: (collection, params, local, op) => {\n\t\t\t\t\tassert(op !== undefined, 0x3fc /* op should exist here */);\n\t\t\t\t\tcollection.ackDelete(params, local, op);\n\t\t\t\t},\n\t\t\t\trebase: (collection, op, localOpMetadata) => {\n\t\t\t\t\t// Deletion of intervals is based on id, so requires no rebasing.\n\t\t\t\t\treturn { rebasedOp: op, rebasedLocalOpMetadata: localOpMetadata };\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\tIntervalOpType.CHANGE,\n\t\t\t{\n\t\t\t\tprocess: (collection, params, local, op, localOpMetadata) => {\n\t\t\t\t\t// if params is undefined, the interval was deleted during\n\t\t\t\t\t// rebasing\n\t\t\t\t\tif (!params) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tassert(op !== undefined, 0x3fd /* op should exist here */);\n\t\t\t\t\tcollection.ackChange(params, local, op, localOpMetadata);\n\t\t\t\t},\n\t\t\t\trebase,\n\t\t\t},\n\t\t],\n\t]);\n}\n\nexport type DeserializeCallback = (properties: PropertySet) => void;\n\nclass IntervalCollectionIterator<TInterval extends ISerializableInterval>\n\timplements Iterator<TInterval>\n{\n\tprivate readonly results: TInterval[];\n\tprivate index: number;\n\n\tconstructor(\n\t\tcollection: IntervalCollection<TInterval>,\n\t\titeratesForward: boolean = true,\n\t\tstart?: number,\n\t\tend?: number,\n\t) {\n\t\tthis.results = [];\n\t\tthis.index = 0;\n\n\t\tcollection.gatherIterationResults(this.results, iteratesForward, start, end);\n\t}\n\n\tpublic next(): IteratorResult<TInterval> {\n\t\tif (this.index < this.results.length) {\n\t\t\treturn {\n\t\t\t\tvalue: this.results[this.index++],\n\t\t\t\tdone: false,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: undefined,\n\t\t\tdone: true,\n\t\t};\n\t}\n}\n\n/**\n * Change events emitted by `IntervalCollection`s\n */\nexport interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {\n\t/**\n\t * This event is invoked whenever the endpoints of an interval may have changed.\n\t * This can happen on:\n\t * - local endpoint modification\n\t * - ack of a remote endpoint modification\n\t * - position change due to segment sliding (slides due to mergeTree segment deletion will always appear local)\n\t * The `interval` argument reflects the new values.\n\t * `previousInterval` contains transient `ReferencePosition`s at the same location as the interval's original\n\t * endpoints. These references should be used for position information only.\n\t * `local` reflects whether the change originated locally.\n\t * `op` is defined if and only if the server has acked this change.\n\t * `slide` is true if the change is due to sliding on removal of position\n\t */\n\t(\n\t\tevent: \"changeInterval\",\n\t\tlistener: (\n\t\t\tinterval: TInterval,\n\t\t\tpreviousInterval: TInterval,\n\t\t\tlocal: boolean,\n\t\t\top: ISequencedDocumentMessage | undefined,\n\t\t\tslide: boolean,\n\t\t) => void,\n\t);\n\t/**\n\t * This event is invoked whenever an interval is added or removed from the collection.\n\t * `local` reflects whether the change originated locally.\n\t * `op` is defined if and only if the server has acked this change.\n\t */\n\t(\n\t\tevent: \"addInterval\" | \"deleteInterval\",\n\t\tlistener: (\n\t\t\tinterval: TInterval,\n\t\t\tlocal: boolean,\n\t\t\top: ISequencedDocumentMessage | undefined,\n\t\t) => void,\n\t);\n\t/**\n\t * This event is invoked whenever an interval's properties have changed.\n\t * `interval` reflects the state of the updated properties.\n\t * `propertyDeltas` is a map-like whose keys contain all values that were changed, and whose\n\t * values contain all previous values of the property set.\n\t * This object can be used directly in a call to `changeProperties` to revert the property change if desired.\n\t * `local` reflects whether the change originated locally.\n\t * `op` is defined if and only if the server has acked this change.\n\t */\n\t(\n\t\tevent: \"propertyChanged\",\n\t\tlistener: (\n\t\t\tinterval: TInterval,\n\t\t\tpropertyDeltas: PropertySet,\n\t\t\tlocal: boolean,\n\t\t\top: ISequencedDocumentMessage | undefined,\n\t\t) => void,\n\t);\n}\n\n/**\n * Collection of intervals that supports addition, modification, removal, and efficient spatial querying.\n * Changes to this collection will be incur updates on collaborating clients (i.e. they are not local-only).\n */\nexport interface IIntervalCollection<TInterval extends ISerializableInterval>\n\textends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {\n\treadonly attached: boolean;\n\t/**\n\t * Attaches an index to this collection.\n\t * All intervals which are part of this collection will be added to the index, and the index will automatically\n\t * be updated when this collection updates due to local or remote changes.\n\t *\n\t * @remarks - After attaching an index to an interval collection, applications should typically store this\n\t * index somewhere in their in-memory data model for future reference and querying.\n\t */\n\tattachIndex(index: IntervalIndex<TInterval>): void;\n\t/**\n\t * Detaches an index from this collection.\n\t * All intervals which are part of this collection will be removed from the index, and updates to this collection\n\t * due to local or remote changes will no longer incur updates to the index.\n\t *\n\t * @returns - Return false if the target index cannot be found in the indexes, otherwise remove all intervals in the index and return true\n\t */\n\tdetachIndex(index: IntervalIndex<TInterval>): boolean;\n\t/**\n\t * @returns the interval in this collection that has the provided `id`.\n\t * If no interval in the collection has this `id`, returns `undefined`.\n\t */\n\tgetIntervalById(id: string): TInterval | undefined;\n\t/**\n\t * Creates a new interval and add it to the collection.\n\t * @param start - interval start position (inclusive)\n\t * @param end - interval end position (exclusive)\n\t * @param intervalType - type of the interval. All intervals are SlideOnRemove. Intervals may not be Transient.\n\t * @param props - properties of the interval\n\t * @param stickiness - {@link (IntervalStickiness:type)} to apply to the added interval.\n\t * @returns - the created interval\n\t * @remarks - See documentation on {@link SequenceInterval} for comments on interval endpoint semantics: there are subtleties\n\t * with how the current half-open behavior is represented.\n\t */\n\tadd(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tstickiness?: IntervalStickiness,\n\t): TInterval;\n\t/**\n\t * Removes an interval from the collection.\n\t * @param id - Id of the interval to remove\n\t * @returns the removed interval\n\t */\n\tremoveIntervalById(id: string): TInterval | undefined;\n\t/**\n\t * Changes the properties on an existing interval.\n\t * @param id - Id of the interval whose properties should be changed\n\t * @param props - Property set to apply to the interval. Shallow merging is used between any existing properties\n\t * and `prop`, i.e. the interval will end up with a property object equivalent to `{ ...oldProps, ...props }`.\n\t */\n\tchangeProperties(id: string, props: PropertySet);\n\t/**\n\t * Changes the endpoints of an existing interval.\n\t * @param id - Id of the interval to change\n\t * @param start - New start value, if defined. `undefined` signifies this endpoint should be left unchanged.\n\t * @param end - New end value, if defined. `undefined` signifies this endpoint should be left unchanged.\n\t * @returns the interval that was changed, if it existed in the collection.\n\t */\n\tchange(id: string, start?: number, end?: number): TInterval | undefined;\n\n\tattachDeserializer(onDeserialize: DeserializeCallback): void;\n\t/**\n\t * @returns an iterator over all intervals in this collection.\n\t */\n\t[Symbol.iterator](): Iterator<TInterval>;\n\n\t/**\n\t * @returns a forward iterator over all intervals in this collection with start point equal to `startPosition`.\n\t */\n\tCreateForwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * @returns a backward iterator over all intervals in this collection with start point equal to `startPosition`.\n\t */\n\tCreateBackwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * @returns a forward iterator over all intervals in this collection with end point equal to `endPosition`.\n\t */\n\tCreateForwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * @returns a backward iterator over all intervals in this collection with end point equal to `endPosition`.\n\t */\n\tCreateBackwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * Gathers iteration results that optionally match a start/end criteria into the provided array.\n\t * @param results - Array to gather the results into. In lieu of a return value, this array will be populated with\n\t * intervals matching the query upon edit.\n\t * @param iteratesForward - whether or not iteration should be in the forward direction\n\t * @param start - If provided, only match intervals whose start point is equal to `start`.\n\t * @param end - If provided, only match intervals whose end point is equal to `end`.\n\t */\n\tgatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: number,\n\t\tend?: number,\n\t): void;\n\n\t/**\n\t * @returns an array of all intervals in this collection that overlap with the interval\n\t * `[startPosition, endPosition]`.\n\t */\n\tfindOverlappingIntervals(startPosition: number, endPosition: number): TInterval[];\n\n\t/**\n\t * Applies a function to each interval in this collection.\n\t */\n\tmap(fn: (interval: TInterval) => void): void;\n\n\tpreviousInterval(pos: number): TInterval | undefined;\n\n\tnextInterval(pos: number): TInterval | undefined;\n}\n\n/**\n * {@inheritdoc IIntervalCollection}\n */\nexport class IntervalCollection<TInterval extends ISerializableInterval>\n\textends TypedEventEmitter<IIntervalCollectionEvent<TInterval>>\n\timplements IIntervalCollection<TInterval>\n{\n\tprivate savedSerializedIntervals?: ISerializedInterval[];\n\tprivate localCollection: LocalIntervalCollection<TInterval> | undefined;\n\tprivate onDeserialize: DeserializeCallback | undefined;\n\tprivate client: Client | undefined;\n\tprivate readonly localSeqToSerializedInterval = new Map<\n\t\tnumber,\n\t\tISerializedInterval | SerializedIntervalDelta\n\t>();\n\tprivate readonly localSeqToRebasedInterval = new Map<\n\t\tnumber,\n\t\tISerializedInterval | SerializedIntervalDelta\n\t>();\n\tprivate readonly pendingChangesStart: Map<string, ISerializedInterval[]> = new Map<\n\t\tstring,\n\t\tISerializedInterval[]\n\t>();\n\tprivate readonly pendingChangesEnd: Map<string, ISerializedInterval[]> = new Map<\n\t\tstring,\n\t\tISerializedInterval[]\n\t>();\n\n\tpublic get attached(): boolean {\n\t\treturn !!this.localCollection;\n\t}\n\n\t/** @internal */\n\tconstructor(\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t\tprivate readonly requiresClient: boolean,\n\t\tprivate readonly emitter: IValueOpEmitter,\n\t\tserializedIntervals: ISerializedInterval[] | ISerializedIntervalCollectionV2,\n\t\tprivate readonly options: Partial<SequenceOptions> = {},\n\t) {\n\t\tsuper();\n\n\t\tthis.savedSerializedIntervals = Array.isArray(serializedIntervals)\n\t\t\t? serializedIntervals\n\t\t\t: serializedIntervals.intervals.map((i) =>\n\t\t\t\t\tdecompressInterval(i, serializedIntervals.label),\n\t\t\t );\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.attachIndex}\n\t */\n\tpublic attachIndex(index: IntervalIndex<TInterval>): void {\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"The local interval collection must exist\");\n\t\t}\n\t\tfor (const interval of this) {\n\t\t\tindex.add(interval);\n\t\t}\n\n\t\tthis.localCollection?.appendIndex(index);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.detachIndex}\n\t */\n\tpublic detachIndex(index: IntervalIndex<TInterval>): boolean {\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"The local interval collection must exist\");\n\t\t}\n\n\t\t// Avoid removing intervals if the index does not exist\n\t\tif (!this.localCollection?.removeIndex(index)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const interval of this) {\n\t\t\tindex.remove(interval);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate rebasePositionWithSegmentSlide(\n\t\tpos: number,\n\t\tseqNumberFrom: number,\n\t\tlocalSeq: number,\n\t): number | undefined {\n\t\tif (!this.client) {\n\t\t\tthrow new LoggingError(\"mergeTree client must exist\");\n\t\t}\n\t\tconst { clientId } = this.client.getCollabWindow();\n\t\tconst { segment, offset } = this.client.getContainingSegment(\n\t\t\tpos,\n\t\t\t{\n\t\t\t\treferenceSequenceNumber: seqNumberFrom,\n\t\t\t\tclientId: this.client.getLongClientId(clientId),\n\t\t\t},\n\t\t\tlocalSeq,\n\t\t);\n\n\t\t// if segment is undefined, it slid off the string\n\t\tassert(segment !== undefined, 0x54e /* No segment found */);\n\n\t\tconst segoff = getSlideToSegoff({ segment, offset }) ?? segment;\n\n\t\t// case happens when rebasing op, but concurrently entire string has been deleted\n\t\tif (segoff.segment === undefined || segoff.offset === undefined) {\n\t\t\treturn DetachedReferencePosition;\n\t\t}\n\n\t\tassert(\n\t\t\toffset !== undefined && 0 <= offset && offset < segment.cachedLength,\n\t\t\t0x54f /* Invalid offset */,\n\t\t);\n\t\treturn this.client.findReconnectionPosition(segoff.segment, localSeq) + segoff.offset;\n\t}\n\n\tprivate computeRebasedPositions(\n\t\tlocalSeq: number,\n\t): ISerializedInterval | SerializedIntervalDelta {\n\t\tassert(\n\t\t\tthis.client !== undefined,\n\t\t\t0x550 /* Client should be defined when computing rebased position */,\n\t\t);\n\t\tconst original = this.localSeqToSerializedInterval.get(localSeq);\n\t\tassert(\n\t\t\toriginal !== undefined,\n\t\t\t0x551 /* Failed to store pending serialized interval info for this localSeq. */,\n\t\t);\n\t\tconst rebased = { ...original };\n\t\tconst { start, end, sequenceNumber } = original;\n\t\tif (start !== undefined) {\n\t\t\trebased.start = this.rebasePositionWithSegmentSlide(start, sequenceNumber, localSeq);\n\t\t}\n\t\tif (end !== undefined) {\n\t\t\trebased.end = this.rebasePositionWithSegmentSlide(end, sequenceNumber, localSeq);\n\t\t}\n\t\treturn rebased;\n\t}\n\n\t/** @internal */\n\tpublic attachGraph(client: Client, label: string) {\n\t\tif (this.attached) {\n\t\t\tthrow new LoggingError(\"Only supports one Sequence attach\");\n\t\t}\n\n\t\tif (client === undefined && this.requiresClient) {\n\t\t\tthrow new LoggingError(\"Client required for this collection\");\n\t\t}\n\n\t\t// Instantiate the local interval collection based on the saved intervals\n\t\tthis.client = client;\n\t\tif (client) {\n\t\t\tclient.on(\"normalize\", () => {\n\t\t\t\tfor (const localSeq of this.localSeqToSerializedInterval.keys()) {\n\t\t\t\t\tthis.localSeqToRebasedInterval.set(\n\t\t\t\t\t\tlocalSeq,\n\t\t\t\t\t\tthis.computeRebasedPositions(localSeq),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tthis.localCollection = new LocalIntervalCollection<TInterval>(\n\t\t\tclient,\n\t\t\tlabel,\n\t\t\tthis.helpers,\n\t\t\t(interval, previousInterval) => this.emitChange(interval, previousInterval, true, true),\n\t\t);\n\t\tif (this.savedSerializedIntervals) {\n\t\t\tfor (const serializedInterval of this.savedSerializedIntervals) {\n\t\t\t\tthis.localCollection.ensureSerializedId(serializedInterval);\n\t\t\t\tconst { start, end, intervalType, properties, stickiness } = serializedInterval;\n\t\t\t\tconst interval = this.helpers.create(\n\t\t\t\t\tlabel,\n\t\t\t\t\tstart,\n\t\t\t\t\tend,\n\t\t\t\t\tclient,\n\t\t\t\t\tintervalType,\n\t\t\t\t\tundefined,\n\t\t\t\t\ttrue,\n\t\t\t\t\tstickiness,\n\t\t\t\t);\n\t\t\t\tif (properties) {\n\t\t\t\t\tinterval.addProperties(properties);\n\t\t\t\t}\n\t\t\t\tthis.localCollection.add(interval);\n\t\t\t}\n\t\t}\n\t\tthis.savedSerializedIntervals = undefined;\n\t}\n\n\t/**\n\t * Gets the next local sequence number, modifying this client's collab window in doing so.\n\t */\n\tprivate getNextLocalSeq(): number {\n\t\tif (this.client) {\n\t\t\treturn ++this.client.getCollabWindow().localSeq;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tprivate emitChange(\n\t\tinterval: TInterval,\n\t\tpreviousInterval: TInterval,\n\t\tlocal: boolean,\n\t\tslide: boolean,\n\t\top?: ISequencedDocumentMessage,\n\t): void {\n\t\t// Temporarily make references transient so that positional queries work (non-transient refs\n\t\t// on resolve to DetachedPosition on any segments that don't contain them). The original refType\n\t\t// is restored as single-endpoint changes re-use previous references.\n\t\tlet startRefType: ReferenceType;\n\t\tlet endRefType: ReferenceType;\n\t\tif (previousInterval instanceof SequenceInterval) {\n\t\t\tstartRefType = previousInterval.start.refType;\n\t\t\tendRefType = previousInterval.end.refType;\n\t\t\tpreviousInterval.start.refType = ReferenceType.Transient;\n\t\t\tpreviousInterval.end.refType = ReferenceType.Transient;\n\t\t\tthis.emit(\"changeInterval\", interval, previousInterval, local, op, slide);\n\t\t\tpreviousInterval.start.refType = startRefType;\n\t\t\tpreviousInterval.end.refType = endRefType;\n\t\t} else {\n\t\t\tthis.emit(\"changeInterval\", interval, previousInterval, local, op, slide);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.getIntervalById}\n\t */\n\tpublic getIntervalById(id: string): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attach must be called before accessing intervals\");\n\t\t}\n\t\treturn this.localCollection.idIntervalIndex.getIntervalById(id);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.add}\n\t */\n\tpublic add(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tstickiness: IntervalStickiness = IntervalStickiness.END,\n\t): TInterval {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attach must be called prior to adding intervals\");\n\t\t}\n\t\tif (intervalType & IntervalType.Transient) {\n\t\t\tthrow new LoggingError(\"Can not add transient intervals\");\n\t\t}\n\t\tif (stickiness !== IntervalStickiness.END && !this.options.intervalStickinessEnabled) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"attempted to set interval stickiness without enabling `intervalStickinessEnabled` feature flag\",\n\t\t\t);\n\t\t}\n\n\t\tconst interval: TInterval = this.localCollection.addInterval(\n\t\t\tstart,\n\t\t\tend,\n\t\t\tintervalType,\n\t\t\tprops,\n\t\t\tundefined,\n\t\t\tstickiness,\n\t\t);\n\n\t\tif (interval) {\n\t\t\tconst serializedInterval = {\n\t\t\t\tend,\n\t\t\t\tintervalType,\n\t\t\t\tproperties: interval.properties,\n\t\t\t\tsequenceNumber: this.client?.getCurrentSeq() ?? 0,\n\t\t\t\tstart,\n\t\t\t\tstickiness,\n\t\t\t};\n\t\t\tconst localSeq = this.getNextLocalSeq();\n\t\t\tthis.localSeqToSerializedInterval.set(localSeq, serializedInterval);\n\t\t\t// Local ops get submitted to the server. Remote ops have the deserializer run.\n\t\t\tthis.emitter.emit(\"add\", undefined, serializedInterval, { localSeq });\n\t\t}\n\n\t\tthis.emit(\"addInterval\", interval, true, undefined);\n\n\t\treturn interval;\n\t}\n\n\tprivate deleteExistingInterval(\n\t\tinterval: TInterval,\n\t\tlocal: boolean,\n\t\top?: ISequencedDocumentMessage,\n\t) {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\t\t// The given interval is known to exist in the collection.\n\t\tthis.localCollection.removeExistingInterval(interval);\n\n\t\tif (interval) {\n\t\t\t// Local ops get submitted to the server. Remote ops have the deserializer run.\n\t\t\tif (local) {\n\t\t\t\tthis.emitter.emit(\"delete\", undefined, interval.serialize(), {\n\t\t\t\t\tlocalSeq: this.getNextLocalSeq(),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (this.onDeserialize) {\n\t\t\t\t\tthis.onDeserialize(interval);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.emit(\"deleteInterval\", interval, local, op);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.removeIntervalById}\n\t */\n\tpublic removeIntervalById(id: string): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\t\tconst interval = this.localCollection.idIntervalIndex.getIntervalById(id);\n\t\tif (interval) {\n\t\t\tthis.deleteExistingInterval(interval, true, undefined);\n\t\t}\n\t\treturn interval;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.changeProperties}\n\t */\n\tpublic changeProperties(id: string, props: PropertySet) {\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\t\tif (typeof id !== \"string\") {\n\t\t\tthrow new LoggingError(\"Change API requires an ID that is a string\");\n\t\t}\n\t\tif (!props) {\n\t\t\tthrow new LoggingError(\"changeProperties should be called with a property set\");\n\t\t}\n\t\t// prevent the overwriting of an interval label, it should remain unchanged\n\t\t// once it has been inserted into the collection.\n\t\tif (props[reservedRangeLabelsKey] !== undefined) {\n\t\t\tthrow new LoggingError(\n\t\t\t\t\"The label property should not be modified once inserted to the collection\",\n\t\t\t);\n\t\t}\n\n\t\tconst interval = this.getIntervalById(id);\n\t\tif (interval) {\n\t\t\t// Pass Unassigned as the sequence number to indicate that this is a local op that is waiting for an ack.\n\t\t\tconst deltaProps = interval.addProperties(props, true, UnassignedSequenceNumber);\n\t\t\tconst serializedInterval: ISerializedInterval = interval.serialize();\n\n\t\t\t// Emit a change op that will only change properties. Add the ID to\n\t\t\t// the property bag provided by the caller.\n\t\t\tserializedInterval.start = undefined as any;\n\t\t\tserializedInterval.end = undefined as any;\n\n\t\t\tserializedInterval.properties = props;\n\t\t\tserializedInterval.properties[reservedIntervalIdKey] = interval.getIntervalId();\n\t\t\tconst localSeq = this.getNextLocalSeq();\n\t\t\tthis.localSeqToSerializedInterval.set(localSeq, serializedInterval);\n\t\t\tthis.emitter.emit(\"change\", undefined, serializedInterval, { localSeq });\n\t\t\tthis.emit(\"propertyChanged\", interval, deltaProps, true, undefined);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.change}\n\t */\n\tpublic change(id: string, start?: number, end?: number): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\n\t\t// Force id to be a string.\n\t\tif (typeof id !== \"string\") {\n\t\t\tthrow new LoggingError(\"Change API requires an ID that is a string\");\n\t\t}\n\n\t\tconst interval = this.getIntervalById(id);\n\t\tif (interval) {\n\t\t\tconst newInterval = this.localCollection.changeInterval(interval, start, end);\n\t\t\tif (!newInterval) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst serializedInterval: SerializedIntervalDelta = interval.serialize();\n\t\t\tserializedInterval.start = start;\n\t\t\tserializedInterval.end = end;\n\t\t\t// Emit a property bag containing only the ID, as we don't intend for this op to change any properties.\n\t\t\tserializedInterval.properties = {\n\t\t\t\t[reservedIntervalIdKey]: interval.getIntervalId(),\n\t\t\t};\n\t\t\tconst localSeq = this.getNextLocalSeq();\n\t\t\tthis.localSeqToSerializedInterval.set(localSeq, serializedInterval);\n\t\t\tthis.emitter.emit(\"change\", undefined, serializedInterval, { localSeq });\n\t\t\tthis.addPendingChange(id, serializedInterval);\n\t\t\tthis.emitChange(newInterval, interval, true, false);\n\t\t\treturn newInterval;\n\t\t}\n\t\t// No interval to change\n\t\treturn undefined;\n\t}\n\n\tprivate addPendingChange(id: string, serializedInterval: SerializedIntervalDelta) {\n\t\tif (serializedInterval.start !== undefined) {\n\t\t\tthis.addPendingChangeHelper(id, this.pendingChangesStart, serializedInterval);\n\t\t}\n\t\tif (serializedInterval.end !== undefined) {\n\t\t\tthis.addPendingChangeHelper(id, this.pendingChangesEnd, serializedInterval);\n\t\t}\n\t}\n\n\tprivate addPendingChangeHelper(\n\t\tid: string,\n\t\tpendingChanges: Map<string, SerializedIntervalDelta[]>,\n\t\tserializedInterval: SerializedIntervalDelta,\n\t) {\n\t\tlet entries: SerializedIntervalDelta[] | undefined = pendingChanges.get(id);\n\t\tif (!entries) {\n\t\t\tentries = [];\n\t\t\tpendingChanges.set(id, entries);\n\t\t}\n\t\tentries.push(serializedInterval);\n\t}\n\n\tprivate removePendingChange(serializedInterval: SerializedIntervalDelta) {\n\t\t// Change ops always have an ID.\n\t\tconst id: string = serializedInterval.properties?.[reservedIntervalIdKey];\n\t\tif (serializedInterval.start !== undefined) {\n\t\t\tthis.removePendingChangeHelper(id, this.pendingChangesStart, serializedInterval);\n\t\t}\n\t\tif (serializedInterval.end !== undefined) {\n\t\t\tthis.removePendingChangeHelper(id, this.pendingChangesEnd, serializedInterval);\n\t\t}\n\t}\n\n\tprivate removePendingChangeHelper(\n\t\tid: string,\n\t\tpendingChanges: Map<string, SerializedIntervalDelta[]>,\n\t\tserializedInterval: SerializedIntervalDelta,\n\t) {\n\t\tconst entries = pendingChanges.get(id);\n\t\tif (entries) {\n\t\t\tconst pendingChange = entries.shift();\n\t\t\tif (entries.length === 0) {\n\t\t\t\tpendingChanges.delete(id);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tpendingChange?.start !== serializedInterval.start ||\n\t\t\t\tpendingChange?.end !== serializedInterval.end\n\t\t\t) {\n\t\t\t\tthrow new LoggingError(\"Mismatch in pending changes\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate hasPendingChangeStart(id: string) {\n\t\tconst entries = this.pendingChangesStart.get(id);\n\t\treturn entries && entries.length !== 0;\n\t}\n\n\tprivate hasPendingChangeEnd(id: string) {\n\t\tconst entries = this.pendingChangesEnd.get(id);\n\t\treturn entries && entries.length !== 0;\n\t}\n\n\t/** @internal */\n\tpublic ackChange(\n\t\tserializedInterval: ISerializedInterval,\n\t\tlocal: boolean,\n\t\top: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t) {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tlocalOpMetadata !== undefined,\n\t\t\t\t0x552 /* op metadata should be defined for local op */,\n\t\t\t);\n\t\t\tthis.localSeqToSerializedInterval.delete(localOpMetadata?.localSeq);\n\t\t\t// This is an ack from the server. Remove the pending change.\n\t\t\tthis.removePendingChange(serializedInterval);\n\t\t}\n\n\t\t// Note that the ID is in the property bag only to allow us to find the interval.\n\t\t// This API cannot change the ID, and writing to the ID property will result in an exception. So we\n\t\t// strip it out of the properties here.\n\t\tconst { [reservedIntervalIdKey]: id, ...newProps } = serializedInterval.properties ?? {};\n\t\tassert(id !== undefined, 0x3fe /* id must exist on the interval */);\n\t\tconst interval: TInterval | undefined = this.getIntervalById(id);\n\t\tif (!interval) {\n\t\t\t// The interval has been removed locally; no-op.\n\t\t\treturn;\n\t\t}\n\n\t\tif (local) {\n\t\t\t// Let the propertyManager prune its pending change-properties set.\n\t\t\tinterval.propertyManager?.ackPendingProperties({\n\t\t\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t\t\t\tprops: serializedInterval.properties ?? {},\n\t\t\t});\n\n\t\t\tthis.ackInterval(interval, op);\n\t\t} else {\n\t\t\t// If there are pending changes with this ID, don't apply the remote start/end change, as the local ack\n\t\t\t// should be the winning change.\n\t\t\tlet start: number | undefined;\n\t\t\tlet end: number | undefined;\n\t\t\t// Track pending start/end independently of one another.\n\t\t\tif (!this.hasPendingChangeStart(id)) {\n\t\t\t\tstart = serializedInterval.start;\n\t\t\t}\n\t\t\tif (!this.hasPendingChangeEnd(id)) {\n\t\t\t\tend = serializedInterval.end;\n\t\t\t}\n\n\t\t\tlet newInterval = interval;\n\t\t\tif (start !== undefined || end !== undefined) {\n\t\t\t\t// If changeInterval gives us a new interval, work with that one. Otherwise keep working with\n\t\t\t\t// the one we originally found in the tree.\n\t\t\t\tnewInterval =\n\t\t\t\t\tthis.localCollection.changeInterval(interval, start, end, op) ?? interval;\n\t\t\t}\n\t\t\tconst deltaProps = newInterval.addProperties(newProps, true, op.sequenceNumber);\n\t\t\tif (this.onDeserialize) {\n\t\t\t\tthis.onDeserialize(newInterval);\n\t\t\t}\n\n\t\t\tif (newInterval !== interval) {\n\t\t\t\tthis.emitChange(newInterval, interval, local, false, op);\n\t\t\t}\n\n\t\t\tconst changedProperties = Object.keys(newProps).length > 0;\n\t\t\tif (changedProperties) {\n\t\t\t\tthis.emit(\"propertyChanged\", interval, deltaProps, local, op);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.attachDeserializer}\n\t */\n\tpublic attachDeserializer(onDeserialize: DeserializeCallback): void {\n\t\t// If no deserializer is specified can skip all processing work\n\t\tif (!onDeserialize) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Start by storing the callbacks so that any subsequent modifications make use of them\n\t\tthis.onDeserialize = onDeserialize;\n\n\t\t// Trigger the async prepare work across all values in the collection\n\t\tif (this.attached) {\n\t\t\tthis.map(onDeserialize);\n\t\t}\n\t}\n\n\t/**\n\t * Returns new interval after rebasing. If undefined, the interval was\n\t * deleted as a result of rebasing. This can occur if the interval applies\n\t * to a range that no longer exists, and the interval was unable to slide.\n\t *\n\t * @internal\n\t */\n\tpublic rebaseLocalInterval(\n\t\topName: string,\n\t\tserializedInterval: SerializedIntervalDelta,\n\t\tlocalSeq: number,\n\t): SerializedIntervalDelta | undefined {\n\t\tif (!this.client) {\n\t\t\t// If there's no associated mergeTree client, the originally submitted op is still correct.\n\t\t\treturn serializedInterval;\n\t\t}\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\tconst { intervalType, properties } = serializedInterval;\n\n\t\tconst { start: startRebased, end: endRebased } =\n\t\t\tthis.localSeqToRebasedInterval.get(localSeq) ?? this.computeRebasedPositions(localSeq);\n\n\t\tconst intervalId = properties?.[reservedIntervalIdKey];\n\t\tconst localInterval = this.localCollection?.idIntervalIndex.getIntervalById(intervalId);\n\n\t\tconst rebased: SerializedIntervalDelta = {\n\t\t\tstart: startRebased,\n\t\t\tend: endRebased,\n\t\t\tintervalType,\n\t\t\tsequenceNumber: this.client?.getCurrentSeq() ?? 0,\n\t\t\tproperties,\n\t\t};\n\n\t\tif (\n\t\t\topName === \"change\" &&\n\t\t\t(this.hasPendingChangeStart(intervalId) || this.hasPendingChangeEnd(intervalId))\n\t\t) {\n\t\t\tthis.removePendingChange(serializedInterval);\n\t\t\tthis.addPendingChange(intervalId, rebased);\n\t\t}\n\n\t\t// if the interval slid off the string, rebase the op to be a noop and delete the interval.\n\t\tif (\n\t\t\tstartRebased === DetachedReferencePosition ||\n\t\t\tendRebased === DetachedReferencePosition\n\t\t) {\n\t\t\tif (localInterval) {\n\t\t\t\tthis.localCollection?.removeExistingInterval(localInterval);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (localInterval !== undefined) {\n\t\t\t// we know we must be using `SequenceInterval` because `this.client` exists\n\t\t\tassert(\n\t\t\t\tlocalInterval instanceof SequenceInterval,\n\t\t\t\t0x3a0 /* localInterval must be `SequenceInterval` when used with client */,\n\t\t\t);\n\t\t\t// The rebased op may place this interval's endpoints on different segments. Calling `changeInterval` here\n\t\t\t// updates the local client's state to be consistent with the emitted op.\n\t\t\tthis.localCollection?.changeInterval(\n\t\t\t\tlocalInterval,\n\t\t\t\tstartRebased,\n\t\t\t\tendRebased,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t);\n\t\t}\n\n\t\treturn rebased;\n\t}\n\n\tprivate getSlideToSegment(\n\t\tlref: LocalReferencePosition,\n\t): { segment: ISegment | undefined; offset: number | undefined } | undefined {\n\t\tif (!this.client) {\n\t\t\tthrow new LoggingError(\"client does not exist\");\n\t\t}\n\t\tconst segoff = { segment: lref.getSegment(), offset: lref.getOffset() };\n\t\tif (segoff.segment?.localRefs?.has(lref) !== true) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst newSegoff = getSlideToSegoff(segoff);\n\t\tconst value: { segment: ISegment | undefined; offset: number | undefined } | undefined =\n\t\t\tsegoff.segment === newSegoff.segment && segoff.offset === newSegoff.offset\n\t\t\t\t? undefined\n\t\t\t\t: newSegoff;\n\t\treturn value;\n\t}\n\n\tprivate setSlideOnRemove(lref: LocalReferencePosition) {\n\t\tlet refType = lref.refType;\n\t\trefType = refType & ~ReferenceType.StayOnRemove;\n\t\trefType = refType | ReferenceType.SlideOnRemove;\n\t\tlref.refType = refType;\n\t}\n\n\tprivate ackInterval(interval: TInterval, op: ISequencedDocumentMessage) {\n\t\t// Only SequenceIntervals need potential sliding\n\t\tif (!(interval instanceof SequenceInterval)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t!refTypeIncludesFlag(interval.start, ReferenceType.StayOnRemove) &&\n\t\t\t!refTypeIncludesFlag(interval.end, ReferenceType.StayOnRemove)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStart = this.getSlideToSegment(interval.start);\n\t\tconst newEnd = this.getSlideToSegment(interval.end);\n\n\t\tconst id = interval.properties[reservedIntervalIdKey];\n\t\tconst hasPendingStartChange = this.hasPendingChangeStart(id);\n\t\tconst hasPendingEndChange = this.hasPendingChangeEnd(id);\n\n\t\tif (!hasPendingStartChange) {\n\t\t\tthis.setSlideOnRemove(interval.start);\n\t\t}\n\n\t\tif (!hasPendingEndChange) {\n\t\t\tthis.setSlideOnRemove(interval.end);\n\t\t}\n\n\t\tconst needsStartUpdate = newStart !== undefined && !hasPendingStartChange;\n\t\tconst needsEndUpdate = newEnd !== undefined && !hasPendingEndChange;\n\n\t\tif (needsStartUpdate || needsEndUpdate) {\n\t\t\tif (!this.localCollection) {\n\t\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t\t}\n\n\t\t\t// `interval`'s endpoints will get modified in-place, so clone it prior to doing so for event emission.\n\t\t\tconst oldInterval = interval.clone() as TInterval & SequenceInterval;\n\n\t\t\t// In this case, where we change the start or end of an interval,\n\t\t\t// it is necessary to remove and re-add the interval listeners.\n\t\t\t// This ensures that the correct listeners are added to the LocalReferencePosition.\n\t\t\tthis.localCollection.removeExistingInterval(interval);\n\t\t\tif (!this.client) {\n\t\t\t\tthrow new LoggingError(\"client does not exist\");\n\t\t\t}\n\n\t\t\tif (needsStartUpdate) {\n\t\t\t\tconst props = interval.start.properties;\n\t\t\t\tinterval.start = createPositionReferenceFromSegoff(\n\t\t\t\t\tthis.client,\n\t\t\t\t\tnewStart,\n\t\t\t\t\tinterval.start.refType,\n\t\t\t\t\top,\n\t\t\t\t\tstartReferenceSlidingPreference(interval.stickiness),\n\t\t\t\t);\n\t\t\t\tif (props) {\n\t\t\t\t\tinterval.start.addProperties(props);\n\t\t\t\t}\n\t\t\t\tconst oldSeg = oldInterval.start.getSegment();\n\t\t\t\t// remove and rebuild start interval as transient for event\n\t\t\t\tthis.client.removeLocalReferencePosition(oldInterval.start);\n\t\t\t\toldInterval.start.refType = ReferenceType.Transient;\n\t\t\t\toldSeg?.localRefs?.addLocalRef(oldInterval.start, oldInterval.start.getOffset());\n\t\t\t}\n\t\t\tif (needsEndUpdate) {\n\t\t\t\tconst props = interval.end.properties;\n\t\t\t\tinterval.end = createPositionReferenceFromSegoff(\n\t\t\t\t\tthis.client,\n\t\t\t\t\tnewEnd,\n\t\t\t\t\tinterval.end.refType,\n\t\t\t\t\top,\n\t\t\t\t\tendReferenceSlidingPreference(interval.stickiness),\n\t\t\t\t);\n\t\t\t\tif (props) {\n\t\t\t\t\tinterval.end.addProperties(props);\n\t\t\t\t}\n\t\t\t\t// remove and rebuild end interval as transient for event\n\t\t\t\tconst oldSeg = oldInterval.end.getSegment();\n\t\t\t\tthis.client.removeLocalReferencePosition(oldInterval.end);\n\t\t\t\toldInterval.end.refType = ReferenceType.Transient;\n\t\t\t\toldSeg?.localRefs?.addLocalRef(oldInterval.end, oldInterval.end.getOffset());\n\t\t\t}\n\t\t\tthis.localCollection.add(interval);\n\t\t\tthis.emitChange(interval, oldInterval as TInterval, true, true, op);\n\t\t}\n\t}\n\n\t/** @internal */\n\tpublic ackAdd(\n\t\tserializedInterval: ISerializedInterval,\n\t\tlocal: boolean,\n\t\top: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t) {\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tlocalOpMetadata !== undefined,\n\t\t\t\t0x553 /* op metadata should be defined for local op */,\n\t\t\t);\n\t\t\tthis.localSeqToSerializedInterval.delete(localOpMetadata.localSeq);\n\t\t\tconst id: string = serializedInterval.properties?.[reservedIntervalIdKey];\n\t\t\tconst localInterval = this.getIntervalById(id);\n\t\t\tif (localInterval) {\n\t\t\t\tthis.ackInterval(localInterval, op);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\tthis.localCollection.ensureSerializedId(serializedInterval);\n\n\t\tconst interval: TInterval = this.localCollection.addInterval(\n\t\t\tserializedInterval.start,\n\t\t\tserializedInterval.end,\n\t\t\tserializedInterval.intervalType,\n\t\t\tserializedInterval.properties,\n\t\t\top,\n\t\t\tserializedInterval.stickiness,\n\t\t);\n\n\t\tif (interval) {\n\t\t\tif (this.onDeserialize) {\n\t\t\t\tthis.onDeserialize(interval);\n\t\t\t}\n\t\t}\n\n\t\tthis.emit(\"addInterval\", interval, local, op);\n\n\t\treturn interval;\n\t}\n\n\t/** @internal */\n\tpublic ackDelete(\n\t\tserializedInterval: ISerializedInterval,\n\t\tlocal: boolean,\n\t\top: ISequencedDocumentMessage,\n\t): void {\n\t\tif (local) {\n\t\t\t// Local ops were applied when the message was created and there's no \"pending delete\"\n\t\t\t// state to bookkeep: remote operation application takes into account possibility of\n\t\t\t// locally deleted interval whenever a lookup happens.\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attach must be called prior to deleting intervals\");\n\t\t}\n\n\t\tconst id = this.localCollection.ensureSerializedId(serializedInterval);\n\t\tconst interval = this.localCollection.idIntervalIndex.getIntervalById(id);\n\t\tif (interval) {\n\t\t\tthis.deleteExistingInterval(interval, local, op);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic serializeInternal(): ISerializedIntervalCollectionV2 {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.serialize();\n\t}\n\n\t/**\n\t * @returns an iterator over all intervals in this collection.\n\t */\n\tpublic [Symbol.iterator](): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(this);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateForwardIteratorWithStartPosition}\n\t */\n\tpublic CreateForwardIteratorWithStartPosition(\n\t\tstartPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(this, true, startPosition);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateBackwardIteratorWithStartPosition}\n\t */\n\tpublic CreateBackwardIteratorWithStartPosition(\n\t\tstartPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(this, false, startPosition);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateForwardIteratorWithEndPosition}\n\t */\n\tpublic CreateForwardIteratorWithEndPosition(\n\t\tendPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(\n\t\t\tthis,\n\t\t\ttrue,\n\t\t\tundefined,\n\t\t\tendPosition,\n\t\t);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateBackwardIteratorWithEndPosition}\n\t */\n\tpublic CreateBackwardIteratorWithEndPosition(\n\t\tendPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(\n\t\t\tthis,\n\t\t\tfalse,\n\t\t\tundefined,\n\t\t\tendPosition,\n\t\t);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.gatherIterationResults}\n\t */\n\tpublic gatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: number,\n\t\tend?: number,\n\t) {\n\t\tif (!this.localCollection) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.localCollection.overlappingIntervalsIndex.gatherIterationResults(\n\t\t\tresults,\n\t\t\titeratesForward,\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.findOverlappingIntervals}\n\t */\n\tpublic findOverlappingIntervals(startPosition: number, endPosition: number): TInterval[] {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.overlappingIntervalsIndex.findOverlappingIntervals(\n\t\t\tstartPosition,\n\t\t\tendPosition,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.map}\n\t */\n\tpublic map(fn: (interval: TInterval) => void) {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\tfor (const interval of this.localCollection.idIntervalIndex) {\n\t\t\tfn(interval);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.previousInterval}\n\t */\n\tpublic previousInterval(pos: number): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.endIntervalIndex.previousInterval(pos);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.nextInterval}\n\t */\n\tpublic nextInterval(pos: number): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.endIntervalIndex.nextInterval(pos);\n\t}\n}\n\n/**\n * Information that identifies an interval within a `Sequence`.\n */\nexport interface IntervalLocator {\n\t/**\n\t * Label for the collection the interval is a part of\n\t */\n\tlabel: string;\n\t/**\n\t * Interval within that collection\n\t */\n\tinterval: SequenceInterval;\n}\n\n/**\n * Returns an object that can be used to find the interval a given LocalReferencePosition belongs to.\n * @returns undefined if the reference position is not the endpoint of any interval (e.g. it was created\n * on the merge tree directly by app code), otherwise an {@link IntervalLocator} for the interval this\n * endpoint is a part of.\n */\nexport function intervalLocatorFromEndpoint(\n\tpotentialEndpoint: LocalReferencePosition,\n): IntervalLocator | undefined {\n\tconst { interval, [reservedRangeLabelsKey]: collectionNameArray } =\n\t\tpotentialEndpoint.properties ?? {};\n\treturn interval && collectionNameArray?.length === 1\n\t\t? { label: collectionNameArray[0], interval }\n\t\t: undefined;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"intervalCollection.js","sourceRoot":"","sources":["../src/intervalCollection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,yCAAyC;AAEzC,+DAAiE;AACjE,2DAAoD;AAEpD,2DAeoC;AAEpC,qEAA2E;AAC3E,+BAAkC;AAUlC,2CAgBqB;AACrB,mDAQyB;AAEzB,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAQ3C;;;GAGG;AACH,SAAS,kBAAkB,CAC1B,QAAsC,EACtC,KAAc;IAEd,OAAO;QACN,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;QAClB,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;QAChB,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC3B,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC;QACzB,UAAU,EAAE,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,mCAAsB,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QACjE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;KACvB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,gBAAgB,CAAC,QAA6B;IACtD,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,cAAc,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IAE1E,MAAM,IAAI,GAAiC;QAC1C,KAAK;QACL,GAAG;QACH,cAAc;QACd,YAAY;QACZ,qEAAqE;QACrE,sCAAsC;QACtC,EAAE,GAAG,UAAU,EAAE,CAAC,mCAAsB,CAAC,EAAE,SAAS,EAAE;KACtD,CAAC;IAEF,I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AAC,EAAE,mBAAmB,EAAE,GAChE,iBAAiB,CAAC,UAAU,IAAI,EAAE,CAAC;IACpC,OAAO,QAAQ,IAAI,mBAAmB,EAAE,MAAM,KAAK,CAAC;QACnD,CAAC,CAAC,EAAE,KAAK,EAAE,mBAAmB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE;QAC7C,CAAC,CAAC,SAAS,CAAC;AACd,CAAC;AARD,kEAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/* eslint-disable no-bitwise */\n/* eslint-disable import/no-deprecated */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IEvent } from \"@fluidframework/core-interfaces\";\nimport {\n\taddProperties,\n\tClient,\n\tcreateMap,\n\tgetSlideToSegoff,\n\tISegment,\n\tMergeTreeDeltaType,\n\tPropertySet,\n\tLocalReferencePosition,\n\tReferenceType,\n\trefTypeIncludesFlag,\n\treservedRangeLabelsKey,\n\tUnassignedSequenceNumber,\n\tDetachedReferencePosition,\n\tUniversalSequenceNumber,\n} from \"@fluidframework/merge-tree\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { LoggingError, UsageError } from \"@fluidframework/telemetry-utils\";\nimport { v4 as uuid } from \"uuid\";\nimport {\n\tIMapMessageLocalMetadata,\n\tIValueFactory,\n\tIValueOpEmitter,\n\tIValueOperation,\n\tIValueType,\n\tIValueTypeOperationValue,\n\tSequenceOptions,\n} from \"./defaultMapInterfaces\";\nimport {\n\tCompressedSerializedInterval,\n\tIIntervalHelpers,\n\tInterval,\n\tIntervalOpType,\n\tIntervalStickiness,\n\tIntervalType,\n\tISerializableInterval,\n\tISerializedInterval,\n\tSequenceInterval,\n\tSerializedIntervalDelta,\n\tcreatePositionReferenceFromSegoff,\n\tendReferenceSlidingPreference,\n\tstartReferenceSlidingPreference,\n\tsequenceIntervalHelpers,\n\tcreateInterval,\n} from \"./intervals\";\nimport {\n\tEndpointIndex,\n\tIEndpointIndex,\n\tIIdIntervalIndex,\n\tIOverlappingIntervalsIndex,\n\tIntervalIndex,\n\tOverlappingIntervalsIndex,\n\tcreateIdIntervalIndex,\n} from \"./intervalIndex\";\n\nconst reservedIntervalIdKey = \"intervalId\";\n\nexport interface ISerializedIntervalCollectionV2 {\n\tlabel: string;\n\tversion: 2;\n\tintervals: CompressedSerializedInterval[];\n}\n\n/**\n * Decompress an interval after loading a summary from JSON. The exact format\n * of this compression is unspecified and subject to change\n */\nfunction decompressInterval(\n\tinterval: CompressedSerializedInterval,\n\tlabel?: string,\n): ISerializedInterval {\n\treturn {\n\t\tstart: interval[0],\n\t\tend: interval[1],\n\t\tsequenceNumber: interval[2],\n\t\tintervalType: interval[3],\n\t\tproperties: { ...interval[4], [reservedRangeLabelsKey]: [label] },\n\t\tstickiness: interval[5],\n\t};\n}\n\n/**\n * Compress an interval prior to serialization as JSON. The exact format of this\n * compression is unspecified and subject to change\n */\nfunction compressInterval(interval: ISerializedInterval): CompressedSerializedInterval {\n\tconst { start, end, sequenceNumber, intervalType, properties } = interval;\n\n\tconst base: CompressedSerializedInterval = [\n\t\tstart,\n\t\tend,\n\t\tsequenceNumber,\n\t\tintervalType,\n\t\t// remove the `referenceRangeLabels` property as it is already stored\n\t\t// in the `label` field of the summary\n\t\t{ ...properties, [reservedRangeLabelsKey]: undefined },\n\t];\n\n\tif (interval.stickiness !== undefined && interval.stickiness !== IntervalStickiness.END) {\n\t\tbase.push(interval.stickiness);\n\t}\n\n\treturn base;\n}\n\nexport function createIntervalIndex() {\n\tconst helpers: IIntervalHelpers<Interval> = {\n\t\tcompareEnds: (a: Interval, b: Interval) => a.end - b.end,\n\t\tcreate: createInterval,\n\t};\n\tconst lc = new LocalIntervalCollection<Interval>(undefined as any as Client, \"\", helpers);\n\treturn lc;\n}\n\nexport class LocalIntervalCollection<TInterval extends ISerializableInterval> {\n\tprivate static readonly legacyIdPrefix = \"legacy\";\n\tpublic readonly overlappingIntervalsIndex: IOverlappingIntervalsIndex<TInterval>;\n\tpublic readonly idIntervalIndex: IIdIntervalIndex<TInterval>;\n\tpublic readonly endIntervalIndex: IEndpointIndex<TInterval>;\n\tprivate readonly indexes: Set<IntervalIndex<TInterval>>;\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly label: string,\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t\t/** Callback invoked each time one of the endpoints of an interval slides. */\n\t\tprivate readonly onPositionChange?: (\n\t\t\tinterval: TInterval,\n\t\t\tpreviousInterval: TInterval,\n\t\t) => void,\n\t) {\n\t\tthis.overlappingIntervalsIndex = new OverlappingIntervalsIndex(client, helpers);\n\t\tthis.idIntervalIndex = createIdIntervalIndex<TInterval>();\n\t\tthis.endIntervalIndex = new EndpointIndex(client, helpers);\n\t\tthis.indexes = new Set([\n\t\t\tthis.overlappingIntervalsIndex,\n\t\t\tthis.idIntervalIndex,\n\t\t\tthis.endIntervalIndex,\n\t\t]);\n\t}\n\n\tpublic createLegacyId(start: number, end: number): string {\n\t\t// Create a non-unique ID based on start and end to be used on intervals that come from legacy clients\n\t\t// without ID's.\n\t\treturn `${LocalIntervalCollection.legacyIdPrefix}${start}-${end}`;\n\t}\n\n\t/**\n\t * Validates that a serialized interval has the ID property. Creates an ID\n\t * if one does not already exist\n\t *\n\t * @param serializedInterval - The interval to be checked\n\t * @returns The interval's existing or newly created id\n\t */\n\tpublic ensureSerializedId(serializedInterval: ISerializedInterval): string {\n\t\tlet id: string | undefined = serializedInterval.properties?.[reservedIntervalIdKey];\n\t\tif (id === undefined) {\n\t\t\t// Back-compat: 0.39 and earlier did not have IDs on intervals. If an interval from such a client\n\t\t\t// comes over the wire, create a non-unique one based on start/end.\n\t\t\t// This will allow all clients to refer to this interval consistently.\n\t\t\tid = this.createLegacyId(serializedInterval.start, serializedInterval.end);\n\t\t\tconst newProps = {\n\t\t\t\t[reservedIntervalIdKey]: id,\n\t\t\t};\n\t\t\tserializedInterval.properties = addProperties(serializedInterval.properties, newProps);\n\t\t}\n\t\t// Make the ID immutable for safety's sake.\n\t\tObject.defineProperty(serializedInterval.properties, reservedIntervalIdKey, {\n\t\t\tconfigurable: false,\n\t\t\tenumerable: true,\n\t\t\twritable: false,\n\t\t});\n\n\t\treturn id;\n\t}\n\n\tprivate removeIntervalFromIndexes(interval: TInterval) {\n\t\tfor (const index of this.indexes) {\n\t\t\tindex.remove(interval);\n\t\t}\n\t}\n\n\tpublic appendIndex(index: IntervalIndex<TInterval>) {\n\t\tthis.indexes.add(index);\n\t}\n\n\tpublic removeIndex(index: IntervalIndex<TInterval>): boolean {\n\t\treturn this.indexes.delete(index);\n\t}\n\n\tpublic removeExistingInterval(interval: TInterval) {\n\t\tthis.removeIntervalFromIndexes(interval);\n\t\tthis.removeIntervalListeners(interval);\n\t}\n\n\tpublic createInterval(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\top?: ISequencedDocumentMessage,\n\t\tstickiness: IntervalStickiness = IntervalStickiness.END,\n\t): TInterval {\n\t\treturn this.helpers.create(\n\t\t\tthis.label,\n\t\t\tstart,\n\t\t\tend,\n\t\t\tthis.client,\n\t\t\tintervalType,\n\t\t\top,\n\t\t\tundefined,\n\t\t\tstickiness,\n\t\t);\n\t}\n\n\tpublic addInterval(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\top?: ISequencedDocumentMessage,\n\t\tstickiness: IntervalStickiness = IntervalStickiness.END,\n\t) {\n\t\tconst interval: TInterval = this.createInterval(start, end, intervalType, op, stickiness);\n\t\tif (interval) {\n\t\t\tif (!interval.properties) {\n\t\t\t\tinterval.properties = createMap<any>();\n\t\t\t}\n\n\t\t\tif (props) {\n\t\t\t\t// This check is intended to prevent scenarios where a random interval is created and then\n\t\t\t\t// inserted into a collection. The aim is to ensure that the collection is created first\n\t\t\t\t// then the user can create/add intervals based on the collection\n\t\t\t\tif (\n\t\t\t\t\tprops[reservedRangeLabelsKey] !== undefined &&\n\t\t\t\t\tprops[reservedRangeLabelsKey][0] !== this.label\n\t\t\t\t) {\n\t\t\t\t\tthrow new LoggingError(\n\t\t\t\t\t\t\"Adding an interval that belongs to another interval collection is not permitted\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tinterval.addProperties(props);\n\t\t\t}\n\t\t\tinterval.properties[reservedIntervalIdKey] ??= uuid();\n\t\t\tthis.add(interval);\n\t\t}\n\t\treturn interval;\n\t}\n\n\tprivate linkEndpointsToInterval(interval: TInterval): void {\n\t\tif (interval instanceof SequenceInterval) {\n\t\t\tinterval.start.addProperties({ interval });\n\t\t\tinterval.end.addProperties({ interval });\n\t\t}\n\t}\n\n\tprivate addIntervalToIndexes(interval: TInterval) {\n\t\tfor (const index of this.indexes) {\n\t\t\tindex.add(interval);\n\t\t}\n\t}\n\n\tpublic add(interval: TInterval): void {\n\t\tthis.linkEndpointsToInterval(interval);\n\t\tthis.addIntervalToIndexes(interval);\n\t\tthis.addIntervalListeners(interval);\n\t}\n\n\tpublic changeInterval(\n\t\tinterval: TInterval,\n\t\tstart: number | undefined,\n\t\tend: number | undefined,\n\t\top?: ISequencedDocumentMessage,\n\t\tlocalSeq?: number,\n\t) {\n\t\tconst newInterval = interval.modify(this.label, start, end, op, localSeq) as\n\t\t\t| TInterval\n\t\t\t| undefined;\n\t\tif (newInterval) {\n\t\t\tthis.removeExistingInterval(interval);\n\t\t\tthis.add(newInterval);\n\t\t}\n\t\treturn newInterval;\n\t}\n\n\tpublic serialize(): ISerializedIntervalCollectionV2 {\n\t\treturn {\n\t\t\tlabel: this.label,\n\t\t\tintervals: Array.from(this.idIntervalIndex, (interval) =>\n\t\t\t\tcompressInterval(interval.serialize()),\n\t\t\t),\n\t\t\tversion: 2,\n\t\t};\n\t}\n\n\tprivate addIntervalListeners(interval: TInterval) {\n\t\tconst cloneRef = (ref: LocalReferencePosition) => {\n\t\t\tconst segment = ref.getSegment();\n\t\t\tif (segment === undefined) {\n\t\t\t\t// Cloning is unnecessary: refs which have slid off the string entirely\n\t\t\t\t// never get slid back on. Creation code for refs doesn't accept undefined segment\n\t\t\t\t// either, so this must be special-cased.\n\t\t\t\treturn ref;\n\t\t\t}\n\n\t\t\treturn this.client.createLocalReferencePosition(\n\t\t\t\tsegment,\n\t\t\t\tref.getOffset(),\n\t\t\t\tReferenceType.Transient,\n\t\t\t\tref.properties,\n\t\t\t\tref.slidingPreference,\n\t\t\t);\n\t\t};\n\t\tif (interval instanceof SequenceInterval) {\n\t\t\tlet previousInterval: (TInterval & SequenceInterval) | undefined;\n\t\t\tlet pendingChanges = 0;\n\t\t\tinterval.addPositionChangeListeners(\n\t\t\t\t() => {\n\t\t\t\t\tpendingChanges++;\n\t\t\t\t\t// Note: both start and end can change and invoke beforeSlide on each endpoint before afterSlide.\n\t\t\t\t\tif (!previousInterval) {\n\t\t\t\t\t\tpreviousInterval = interval.clone() as TInterval & SequenceInterval;\n\t\t\t\t\t\tpreviousInterval.start = cloneRef(previousInterval.start);\n\t\t\t\t\t\tpreviousInterval.end = cloneRef(previousInterval.end);\n\t\t\t\t\t\tthis.removeIntervalFromIndexes(interval);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\tassert(\n\t\t\t\t\t\tpreviousInterval !== undefined,\n\t\t\t\t\t\t0x3fa /* Invalid interleaving of before/after slide */,\n\t\t\t\t\t);\n\t\t\t\t\tpendingChanges--;\n\t\t\t\t\tif (pendingChanges === 0) {\n\t\t\t\t\t\tthis.addIntervalToIndexes(interval);\n\t\t\t\t\t\tthis.onPositionChange?.(interval, previousInterval);\n\t\t\t\t\t\tpreviousInterval = undefined;\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate removeIntervalListeners(interval: TInterval) {\n\t\tif (interval instanceof SequenceInterval) {\n\t\t\tinterval.removePositionChangeListeners();\n\t\t}\n\t}\n}\n\nclass SequenceIntervalCollectionFactory\n\timplements IValueFactory<IntervalCollection<SequenceInterval>>\n{\n\tpublic load(\n\t\temitter: IValueOpEmitter,\n\t\traw: ISerializedInterval[] | ISerializedIntervalCollectionV2 = [],\n\t\toptions?: Partial<SequenceOptions>,\n\t): IntervalCollection<SequenceInterval> {\n\t\treturn new IntervalCollection<SequenceInterval>(\n\t\t\tsequenceIntervalHelpers,\n\t\t\ttrue,\n\t\t\temitter,\n\t\t\traw,\n\t\t\toptions,\n\t\t);\n\t}\n\n\tpublic store(\n\t\tvalue: IntervalCollection<SequenceInterval>,\n\t): ISerializedInterval[] | ISerializedIntervalCollectionV2 {\n\t\treturn value.serializeInternal();\n\t}\n}\n\nexport class SequenceIntervalCollectionValueType\n\timplements IValueType<IntervalCollection<SequenceInterval>>\n{\n\tpublic static Name = \"sharedStringIntervalCollection\";\n\n\tpublic get name(): string {\n\t\treturn SequenceIntervalCollectionValueType.Name;\n\t}\n\n\tpublic get factory(): IValueFactory<IntervalCollection<SequenceInterval>> {\n\t\treturn SequenceIntervalCollectionValueType._factory;\n\t}\n\n\tpublic get ops(): Map<string, IValueOperation<IntervalCollection<SequenceInterval>>> {\n\t\treturn SequenceIntervalCollectionValueType._ops;\n\t}\n\n\tprivate static readonly _factory: IValueFactory<IntervalCollection<SequenceInterval>> =\n\t\tnew SequenceIntervalCollectionFactory();\n\n\tprivate static readonly _ops = makeOpsMap<SequenceInterval>();\n}\n\nclass IntervalCollectionFactory implements IValueFactory<IntervalCollection<Interval>> {\n\tpublic load(\n\t\temitter: IValueOpEmitter,\n\t\traw: ISerializedInterval[] | ISerializedIntervalCollectionV2 = [],\n\t\toptions?: Partial<SequenceOptions>,\n\t): IntervalCollection<Interval> {\n\t\tconst helpers: IIntervalHelpers<Interval> = {\n\t\t\tcompareEnds: (a: Interval, b: Interval) => a.end - b.end,\n\t\t\tcreate: createInterval,\n\t\t};\n\t\tconst collection = new IntervalCollection<Interval>(helpers, false, emitter, raw, options);\n\t\tcollection.attachGraph(undefined as any as Client, \"\");\n\t\treturn collection;\n\t}\n\n\tpublic store(value: IntervalCollection<Interval>): ISerializedIntervalCollectionV2 {\n\t\treturn value.serializeInternal();\n\t}\n}\n\nexport class IntervalCollectionValueType implements IValueType<IntervalCollection<Interval>> {\n\tpublic static Name = \"sharedIntervalCollection\";\n\n\tpublic get name(): string {\n\t\treturn IntervalCollectionValueType.Name;\n\t}\n\n\tpublic get factory(): IValueFactory<IntervalCollection<Interval>> {\n\t\treturn IntervalCollectionValueType._factory;\n\t}\n\n\tpublic get ops(): Map<string, IValueOperation<IntervalCollection<Interval>>> {\n\t\treturn IntervalCollectionValueType._ops;\n\t}\n\n\tprivate static readonly _factory: IValueFactory<IntervalCollection<Interval>> =\n\t\tnew IntervalCollectionFactory();\n\tprivate static readonly _ops = makeOpsMap<Interval>();\n}\n\nexport function makeOpsMap<T extends ISerializableInterval>(): Map<\n\tstring,\n\tIValueOperation<IntervalCollection<T>>\n> {\n\tconst rebase = (\n\t\tcollection: IntervalCollection<T>,\n\t\top: IValueTypeOperationValue,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata,\n\t) => {\n\t\tconst { localSeq } = localOpMetadata;\n\t\tconst rebasedValue = collection.rebaseLocalInterval(op.opName, op.value, localSeq);\n\t\tconst rebasedOp = { ...op, value: rebasedValue };\n\t\treturn { rebasedOp, rebasedLocalOpMetadata: localOpMetadata };\n\t};\n\n\treturn new Map<string, IValueOperation<IntervalCollection<T>>>([\n\t\t[\n\t\t\tIntervalOpType.ADD,\n\t\t\t{\n\t\t\t\tprocess: (collection, params, local, op, localOpMetadata) => {\n\t\t\t\t\t// if params is undefined, the interval was deleted during\n\t\t\t\t\t// rebasing\n\t\t\t\t\tif (!params) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tassert(op !== undefined, 0x3fb /* op should exist here */);\n\t\t\t\t\tcollection.ackAdd(params, local, op, localOpMetadata);\n\t\t\t\t},\n\t\t\t\trebase,\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\tIntervalOpType.DELETE,\n\t\t\t{\n\t\t\t\tprocess: (collection, params, local, op) => {\n\t\t\t\t\tassert(op !== undefined, 0x3fc /* op should exist here */);\n\t\t\t\t\tcollection.ackDelete(params, local, op);\n\t\t\t\t},\n\t\t\t\trebase: (collection, op, localOpMetadata) => {\n\t\t\t\t\t// Deletion of intervals is based on id, so requires no rebasing.\n\t\t\t\t\treturn { rebasedOp: op, rebasedLocalOpMetadata: localOpMetadata };\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[\n\t\t\tIntervalOpType.CHANGE,\n\t\t\t{\n\t\t\t\tprocess: (collection, params, local, op, localOpMetadata) => {\n\t\t\t\t\t// if params is undefined, the interval was deleted during\n\t\t\t\t\t// rebasing\n\t\t\t\t\tif (!params) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tassert(op !== undefined, 0x3fd /* op should exist here */);\n\t\t\t\t\tcollection.ackChange(params, local, op, localOpMetadata);\n\t\t\t\t},\n\t\t\t\trebase,\n\t\t\t},\n\t\t],\n\t]);\n}\n\nexport type DeserializeCallback = (properties: PropertySet) => void;\n\nclass IntervalCollectionIterator<TInterval extends ISerializableInterval>\n\timplements Iterator<TInterval>\n{\n\tprivate readonly results: TInterval[];\n\tprivate index: number;\n\n\tconstructor(\n\t\tcollection: IntervalCollection<TInterval>,\n\t\titeratesForward: boolean = true,\n\t\tstart?: number,\n\t\tend?: number,\n\t) {\n\t\tthis.results = [];\n\t\tthis.index = 0;\n\n\t\tcollection.gatherIterationResults(this.results, iteratesForward, start, end);\n\t}\n\n\tpublic next(): IteratorResult<TInterval> {\n\t\tif (this.index < this.results.length) {\n\t\t\treturn {\n\t\t\t\tvalue: this.results[this.index++],\n\t\t\t\tdone: false,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tvalue: undefined,\n\t\t\tdone: true,\n\t\t};\n\t}\n}\n\n/**\n * Change events emitted by `IntervalCollection`s\n */\nexport interface IIntervalCollectionEvent<TInterval extends ISerializableInterval> extends IEvent {\n\t/**\n\t * This event is invoked whenever the endpoints of an interval may have changed.\n\t * This can happen on:\n\t * - local endpoint modification\n\t * - ack of a remote endpoint modification\n\t * - position change due to segment sliding (slides due to mergeTree segment deletion will always appear local)\n\t * The `interval` argument reflects the new values.\n\t * `previousInterval` contains transient `ReferencePosition`s at the same location as the interval's original\n\t * endpoints. These references should be used for position information only.\n\t * `local` reflects whether the change originated locally.\n\t * `op` is defined if and only if the server has acked this change.\n\t * `slide` is true if the change is due to sliding on removal of position\n\t */\n\t(\n\t\tevent: \"changeInterval\",\n\t\tlistener: (\n\t\t\tinterval: TInterval,\n\t\t\tpreviousInterval: TInterval,\n\t\t\tlocal: boolean,\n\t\t\top: ISequencedDocumentMessage | undefined,\n\t\t\tslide: boolean,\n\t\t) => void,\n\t);\n\t/**\n\t * This event is invoked whenever an interval is added or removed from the collection.\n\t * `local` reflects whether the change originated locally.\n\t * `op` is defined if and only if the server has acked this change.\n\t */\n\t(\n\t\tevent: \"addInterval\" | \"deleteInterval\",\n\t\tlistener: (\n\t\t\tinterval: TInterval,\n\t\t\tlocal: boolean,\n\t\t\top: ISequencedDocumentMessage | undefined,\n\t\t) => void,\n\t);\n\t/**\n\t * This event is invoked whenever an interval's properties have changed.\n\t * `interval` reflects the state of the updated properties.\n\t * `propertyDeltas` is a map-like whose keys contain all values that were changed, and whose\n\t * values contain all previous values of the property set.\n\t * This object can be used directly in a call to `changeProperties` to revert the property change if desired.\n\t * `local` reflects whether the change originated locally.\n\t * `op` is defined if and only if the server has acked this change.\n\t */\n\t(\n\t\tevent: \"propertyChanged\",\n\t\tlistener: (\n\t\t\tinterval: TInterval,\n\t\t\tpropertyDeltas: PropertySet,\n\t\t\tlocal: boolean,\n\t\t\top: ISequencedDocumentMessage | undefined,\n\t\t) => void,\n\t);\n}\n\n/**\n * Collection of intervals that supports addition, modification, removal, and efficient spatial querying.\n * Changes to this collection will be incur updates on collaborating clients (i.e. they are not local-only).\n */\nexport interface IIntervalCollection<TInterval extends ISerializableInterval>\n\textends TypedEventEmitter<IIntervalCollectionEvent<TInterval>> {\n\treadonly attached: boolean;\n\t/**\n\t * Attaches an index to this collection.\n\t * All intervals which are part of this collection will be added to the index, and the index will automatically\n\t * be updated when this collection updates due to local or remote changes.\n\t *\n\t * @remarks After attaching an index to an interval collection, applications should typically store this\n\t * index somewhere in their in-memory data model for future reference and querying.\n\t */\n\tattachIndex(index: IntervalIndex<TInterval>): void;\n\t/**\n\t * Detaches an index from this collection.\n\t * All intervals which are part of this collection will be removed from the index, and updates to this collection\n\t * due to local or remote changes will no longer incur updates to the index.\n\t *\n\t * @returns `false` if the target index cannot be found in the indexes, otherwise remove all intervals in the index and return `true`.\n\t */\n\tdetachIndex(index: IntervalIndex<TInterval>): boolean;\n\t/**\n\t * @returns the interval in this collection that has the provided `id`.\n\t * If no interval in the collection has this `id`, returns `undefined`.\n\t */\n\tgetIntervalById(id: string): TInterval | undefined;\n\t/**\n\t * Creates a new interval and add it to the collection.\n\t * @param start - interval start position (inclusive)\n\t * @param end - interval end position (exclusive)\n\t * @param intervalType - type of the interval. All intervals are SlideOnRemove. Intervals may not be Transient.\n\t * @param props - properties of the interval\n\t * @param stickiness - {@link (IntervalStickiness:type)} to apply to the added interval.\n\t * @returns The created interval\n\t * @remarks See documentation on {@link SequenceInterval} for comments on interval endpoint semantics: there are subtleties\n\t * with how the current half-open behavior is represented.\n\t */\n\tadd(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tstickiness?: IntervalStickiness,\n\t): TInterval;\n\t/**\n\t * Removes an interval from the collection.\n\t * @param id - Id of the interval to remove\n\t * @returns the removed interval\n\t */\n\tremoveIntervalById(id: string): TInterval | undefined;\n\t/**\n\t * Changes the properties on an existing interval.\n\t * @param id - Id of the interval whose properties should be changed\n\t * @param props - Property set to apply to the interval. Shallow merging is used between any existing properties\n\t * and `prop`, i.e. the interval will end up with a property object equivalent to `{ ...oldProps, ...props }`.\n\t */\n\tchangeProperties(id: string, props: PropertySet);\n\t/**\n\t * Changes the endpoints of an existing interval.\n\t * @param id - Id of the interval to change\n\t * @param start - New start value, if defined. `undefined` signifies this endpoint should be left unchanged.\n\t * @param end - New end value, if defined. `undefined` signifies this endpoint should be left unchanged.\n\t * @returns the interval that was changed, if it existed in the collection.\n\t */\n\tchange(id: string, start?: number, end?: number): TInterval | undefined;\n\n\tattachDeserializer(onDeserialize: DeserializeCallback): void;\n\t/**\n\t * @returns an iterator over all intervals in this collection.\n\t */\n\t[Symbol.iterator](): Iterator<TInterval>;\n\n\t/**\n\t * @returns a forward iterator over all intervals in this collection with start point equal to `startPosition`.\n\t */\n\tCreateForwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * @returns a backward iterator over all intervals in this collection with start point equal to `startPosition`.\n\t */\n\tCreateBackwardIteratorWithStartPosition(startPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * @returns a forward iterator over all intervals in this collection with end point equal to `endPosition`.\n\t */\n\tCreateForwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * @returns a backward iterator over all intervals in this collection with end point equal to `endPosition`.\n\t */\n\tCreateBackwardIteratorWithEndPosition(endPosition: number): Iterator<TInterval>;\n\n\t/**\n\t * Gathers iteration results that optionally match a start/end criteria into the provided array.\n\t * @param results - Array to gather the results into. In lieu of a return value, this array will be populated with\n\t * intervals matching the query upon edit.\n\t * @param iteratesForward - whether or not iteration should be in the forward direction\n\t * @param start - If provided, only match intervals whose start point is equal to `start`.\n\t * @param end - If provided, only match intervals whose end point is equal to `end`.\n\t */\n\tgatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: number,\n\t\tend?: number,\n\t): void;\n\n\t/**\n\t * @returns an array of all intervals in this collection that overlap with the interval\n\t * `[startPosition, endPosition]`.\n\t */\n\tfindOverlappingIntervals(startPosition: number, endPosition: number): TInterval[];\n\n\t/**\n\t * Applies a function to each interval in this collection.\n\t */\n\tmap(fn: (interval: TInterval) => void): void;\n\n\tpreviousInterval(pos: number): TInterval | undefined;\n\n\tnextInterval(pos: number): TInterval | undefined;\n}\n\n/**\n * {@inheritdoc IIntervalCollection}\n */\nexport class IntervalCollection<TInterval extends ISerializableInterval>\n\textends TypedEventEmitter<IIntervalCollectionEvent<TInterval>>\n\timplements IIntervalCollection<TInterval>\n{\n\tprivate savedSerializedIntervals?: ISerializedInterval[];\n\tprivate localCollection: LocalIntervalCollection<TInterval> | undefined;\n\tprivate onDeserialize: DeserializeCallback | undefined;\n\tprivate client: Client | undefined;\n\tprivate readonly localSeqToSerializedInterval = new Map<\n\t\tnumber,\n\t\tISerializedInterval | SerializedIntervalDelta\n\t>();\n\tprivate readonly localSeqToRebasedInterval = new Map<\n\t\tnumber,\n\t\tISerializedInterval | SerializedIntervalDelta\n\t>();\n\tprivate readonly pendingChangesStart: Map<string, ISerializedInterval[]> = new Map<\n\t\tstring,\n\t\tISerializedInterval[]\n\t>();\n\tprivate readonly pendingChangesEnd: Map<string, ISerializedInterval[]> = new Map<\n\t\tstring,\n\t\tISerializedInterval[]\n\t>();\n\n\tpublic get attached(): boolean {\n\t\treturn !!this.localCollection;\n\t}\n\n\t/** @internal */\n\tconstructor(\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t\tprivate readonly requiresClient: boolean,\n\t\tprivate readonly emitter: IValueOpEmitter,\n\t\tserializedIntervals: ISerializedInterval[] | ISerializedIntervalCollectionV2,\n\t\tprivate readonly options: Partial<SequenceOptions> = {},\n\t) {\n\t\tsuper();\n\n\t\tthis.savedSerializedIntervals = Array.isArray(serializedIntervals)\n\t\t\t? serializedIntervals\n\t\t\t: serializedIntervals.intervals.map((i) =>\n\t\t\t\t\tdecompressInterval(i, serializedIntervals.label),\n\t\t\t );\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.attachIndex}\n\t */\n\tpublic attachIndex(index: IntervalIndex<TInterval>): void {\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"The local interval collection must exist\");\n\t\t}\n\t\tfor (const interval of this) {\n\t\t\tindex.add(interval);\n\t\t}\n\n\t\tthis.localCollection?.appendIndex(index);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.detachIndex}\n\t */\n\tpublic detachIndex(index: IntervalIndex<TInterval>): boolean {\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"The local interval collection must exist\");\n\t\t}\n\n\t\t// Avoid removing intervals if the index does not exist\n\t\tif (!this.localCollection?.removeIndex(index)) {\n\t\t\treturn false;\n\t\t}\n\n\t\tfor (const interval of this) {\n\t\t\tindex.remove(interval);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate rebasePositionWithSegmentSlide(\n\t\tpos: number,\n\t\tseqNumberFrom: number,\n\t\tlocalSeq: number,\n\t): number | undefined {\n\t\tif (!this.client) {\n\t\t\tthrow new LoggingError(\"mergeTree client must exist\");\n\t\t}\n\t\tconst { clientId } = this.client.getCollabWindow();\n\t\tconst { segment, offset } = this.client.getContainingSegment(\n\t\t\tpos,\n\t\t\t{\n\t\t\t\treferenceSequenceNumber: seqNumberFrom,\n\t\t\t\tclientId: this.client.getLongClientId(clientId),\n\t\t\t},\n\t\t\tlocalSeq,\n\t\t);\n\n\t\t// if segment is undefined, it slid off the string\n\t\tassert(segment !== undefined, 0x54e /* No segment found */);\n\n\t\tconst segoff = getSlideToSegoff({ segment, offset }) ?? segment;\n\n\t\t// case happens when rebasing op, but concurrently entire string has been deleted\n\t\tif (segoff.segment === undefined || segoff.offset === undefined) {\n\t\t\treturn DetachedReferencePosition;\n\t\t}\n\n\t\tassert(\n\t\t\toffset !== undefined && 0 <= offset && offset < segment.cachedLength,\n\t\t\t0x54f /* Invalid offset */,\n\t\t);\n\t\treturn this.client.findReconnectionPosition(segoff.segment, localSeq) + segoff.offset;\n\t}\n\n\tprivate computeRebasedPositions(\n\t\tlocalSeq: number,\n\t): ISerializedInterval | SerializedIntervalDelta {\n\t\tassert(\n\t\t\tthis.client !== undefined,\n\t\t\t0x550 /* Client should be defined when computing rebased position */,\n\t\t);\n\t\tconst original = this.localSeqToSerializedInterval.get(localSeq);\n\t\tassert(\n\t\t\toriginal !== undefined,\n\t\t\t0x551 /* Failed to store pending serialized interval info for this localSeq. */,\n\t\t);\n\t\tconst rebased = { ...original };\n\t\tconst { start, end, sequenceNumber } = original;\n\t\tif (start !== undefined) {\n\t\t\trebased.start = this.rebasePositionWithSegmentSlide(start, sequenceNumber, localSeq);\n\t\t}\n\t\tif (end !== undefined) {\n\t\t\trebased.end = this.rebasePositionWithSegmentSlide(end, sequenceNumber, localSeq);\n\t\t}\n\t\treturn rebased;\n\t}\n\n\t/** @internal */\n\tpublic attachGraph(client: Client, label: string) {\n\t\tif (this.attached) {\n\t\t\tthrow new LoggingError(\"Only supports one Sequence attach\");\n\t\t}\n\n\t\tif (client === undefined && this.requiresClient) {\n\t\t\tthrow new LoggingError(\"Client required for this collection\");\n\t\t}\n\n\t\t// Instantiate the local interval collection based on the saved intervals\n\t\tthis.client = client;\n\t\tif (client) {\n\t\t\tclient.on(\"normalize\", () => {\n\t\t\t\tfor (const localSeq of this.localSeqToSerializedInterval.keys()) {\n\t\t\t\t\tthis.localSeqToRebasedInterval.set(\n\t\t\t\t\t\tlocalSeq,\n\t\t\t\t\t\tthis.computeRebasedPositions(localSeq),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tthis.localCollection = new LocalIntervalCollection<TInterval>(\n\t\t\tclient,\n\t\t\tlabel,\n\t\t\tthis.helpers,\n\t\t\t(interval, previousInterval) => this.emitChange(interval, previousInterval, true, true),\n\t\t);\n\t\tif (this.savedSerializedIntervals) {\n\t\t\tfor (const serializedInterval of this.savedSerializedIntervals) {\n\t\t\t\tthis.localCollection.ensureSerializedId(serializedInterval);\n\t\t\t\tconst { start, end, intervalType, properties, stickiness } = serializedInterval;\n\t\t\t\tconst interval = this.helpers.create(\n\t\t\t\t\tlabel,\n\t\t\t\t\tstart,\n\t\t\t\t\tend,\n\t\t\t\t\tclient,\n\t\t\t\t\tintervalType,\n\t\t\t\t\tundefined,\n\t\t\t\t\ttrue,\n\t\t\t\t\tstickiness,\n\t\t\t\t);\n\t\t\t\tif (properties) {\n\t\t\t\t\tinterval.addProperties(properties);\n\t\t\t\t}\n\t\t\t\tthis.localCollection.add(interval);\n\t\t\t}\n\t\t}\n\t\tthis.savedSerializedIntervals = undefined;\n\t}\n\n\t/**\n\t * Gets the next local sequence number, modifying this client's collab window in doing so.\n\t */\n\tprivate getNextLocalSeq(): number {\n\t\tif (this.client) {\n\t\t\treturn ++this.client.getCollabWindow().localSeq;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tprivate emitChange(\n\t\tinterval: TInterval,\n\t\tpreviousInterval: TInterval,\n\t\tlocal: boolean,\n\t\tslide: boolean,\n\t\top?: ISequencedDocumentMessage,\n\t): void {\n\t\t// Temporarily make references transient so that positional queries work (non-transient refs\n\t\t// on resolve to DetachedPosition on any segments that don't contain them). The original refType\n\t\t// is restored as single-endpoint changes re-use previous references.\n\t\tlet startRefType: ReferenceType;\n\t\tlet endRefType: ReferenceType;\n\t\tif (previousInterval instanceof SequenceInterval) {\n\t\t\tstartRefType = previousInterval.start.refType;\n\t\t\tendRefType = previousInterval.end.refType;\n\t\t\tpreviousInterval.start.refType = ReferenceType.Transient;\n\t\t\tpreviousInterval.end.refType = ReferenceType.Transient;\n\t\t\tthis.emit(\"changeInterval\", interval, previousInterval, local, op, slide);\n\t\t\tpreviousInterval.start.refType = startRefType;\n\t\t\tpreviousInterval.end.refType = endRefType;\n\t\t} else {\n\t\t\tthis.emit(\"changeInterval\", interval, previousInterval, local, op, slide);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.getIntervalById}\n\t */\n\tpublic getIntervalById(id: string): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attach must be called before accessing intervals\");\n\t\t}\n\t\treturn this.localCollection.idIntervalIndex.getIntervalById(id);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.add}\n\t */\n\tpublic add(\n\t\tstart: number,\n\t\tend: number,\n\t\tintervalType: IntervalType,\n\t\tprops?: PropertySet,\n\t\tstickiness: IntervalStickiness = IntervalStickiness.END,\n\t): TInterval {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attach must be called prior to adding intervals\");\n\t\t}\n\t\tif (intervalType & IntervalType.Transient) {\n\t\t\tthrow new LoggingError(\"Can not add transient intervals\");\n\t\t}\n\t\tif (stickiness !== IntervalStickiness.END && !this.options.intervalStickinessEnabled) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"attempted to set interval stickiness without enabling `intervalStickinessEnabled` feature flag\",\n\t\t\t);\n\t\t}\n\n\t\tconst interval: TInterval = this.localCollection.addInterval(\n\t\t\tstart,\n\t\t\tend,\n\t\t\tintervalType,\n\t\t\tprops,\n\t\t\tundefined,\n\t\t\tstickiness,\n\t\t);\n\n\t\tif (interval) {\n\t\t\tif (!this.isCollaborating && interval instanceof SequenceInterval) {\n\t\t\t\tsetSlideOnRemove(interval.start);\n\t\t\t\tsetSlideOnRemove(interval.end);\n\t\t\t}\n\t\t\tconst serializedInterval = {\n\t\t\t\tend,\n\t\t\t\tintervalType,\n\t\t\t\tproperties: interval.properties,\n\t\t\t\tsequenceNumber: this.client?.getCurrentSeq() ?? 0,\n\t\t\t\tstart,\n\t\t\t\tstickiness,\n\t\t\t};\n\t\t\tconst localSeq = this.getNextLocalSeq();\n\t\t\tthis.localSeqToSerializedInterval.set(localSeq, serializedInterval);\n\t\t\t// Local ops get submitted to the server. Remote ops have the deserializer run.\n\t\t\tthis.emitter.emit(\"add\", undefined, serializedInterval, { localSeq });\n\t\t}\n\n\t\tthis.emit(\"addInterval\", interval, true, undefined);\n\n\t\treturn interval;\n\t}\n\n\tprivate deleteExistingInterval(\n\t\tinterval: TInterval,\n\t\tlocal: boolean,\n\t\top?: ISequencedDocumentMessage,\n\t) {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\t\t// The given interval is known to exist in the collection.\n\t\tthis.localCollection.removeExistingInterval(interval);\n\n\t\tif (interval) {\n\t\t\t// Local ops get submitted to the server. Remote ops have the deserializer run.\n\t\t\tif (local) {\n\t\t\t\tthis.emitter.emit(\"delete\", undefined, interval.serialize(), {\n\t\t\t\t\tlocalSeq: this.getNextLocalSeq(),\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif (this.onDeserialize) {\n\t\t\t\t\tthis.onDeserialize(interval);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.emit(\"deleteInterval\", interval, local, op);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.removeIntervalById}\n\t */\n\tpublic removeIntervalById(id: string): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\t\tconst interval = this.localCollection.idIntervalIndex.getIntervalById(id);\n\t\tif (interval) {\n\t\t\tthis.deleteExistingInterval(interval, true, undefined);\n\t\t}\n\t\treturn interval;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.changeProperties}\n\t */\n\tpublic changeProperties(id: string, props: PropertySet) {\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\t\tif (typeof id !== \"string\") {\n\t\t\tthrow new LoggingError(\"Change API requires an ID that is a string\");\n\t\t}\n\t\tif (!props) {\n\t\t\tthrow new LoggingError(\"changeProperties should be called with a property set\");\n\t\t}\n\t\t// prevent the overwriting of an interval label, it should remain unchanged\n\t\t// once it has been inserted into the collection.\n\t\tif (props[reservedRangeLabelsKey] !== undefined) {\n\t\t\tthrow new LoggingError(\n\t\t\t\t\"The label property should not be modified once inserted to the collection\",\n\t\t\t);\n\t\t}\n\n\t\tconst interval = this.getIntervalById(id);\n\t\tif (interval) {\n\t\t\tconst deltaProps = interval.addProperties(\n\t\t\t\tprops,\n\t\t\t\ttrue,\n\t\t\t\tthis.isCollaborating ? UnassignedSequenceNumber : UniversalSequenceNumber,\n\t\t\t);\n\t\t\tconst serializedInterval: ISerializedInterval = interval.serialize();\n\n\t\t\t// Emit a change op that will only change properties. Add the ID to\n\t\t\t// the property bag provided by the caller.\n\t\t\tserializedInterval.start = undefined as any;\n\t\t\tserializedInterval.end = undefined as any;\n\n\t\t\tserializedInterval.properties = props;\n\t\t\tserializedInterval.properties[reservedIntervalIdKey] = interval.getIntervalId();\n\t\t\tconst localSeq = this.getNextLocalSeq();\n\t\t\tthis.localSeqToSerializedInterval.set(localSeq, serializedInterval);\n\t\t\tthis.emitter.emit(\"change\", undefined, serializedInterval, { localSeq });\n\t\t\tthis.emit(\"propertyChanged\", interval, deltaProps, true, undefined);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.change}\n\t */\n\tpublic change(id: string, start?: number, end?: number): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\n\t\t// Force id to be a string.\n\t\tif (typeof id !== \"string\") {\n\t\t\tthrow new LoggingError(\"Change API requires an ID that is a string\");\n\t\t}\n\n\t\tconst interval = this.getIntervalById(id);\n\t\tif (interval) {\n\t\t\tconst newInterval = this.localCollection.changeInterval(interval, start, end);\n\t\t\tif (!newInterval) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tif (!this.isCollaborating && newInterval instanceof SequenceInterval) {\n\t\t\t\tsetSlideOnRemove(newInterval.start);\n\t\t\t\tsetSlideOnRemove(newInterval.end);\n\t\t\t}\n\t\t\tconst serializedInterval: SerializedIntervalDelta = interval.serialize();\n\t\t\tserializedInterval.start = start;\n\t\t\tserializedInterval.end = end;\n\t\t\t// Emit a property bag containing only the ID, as we don't intend for this op to change any properties.\n\t\t\tserializedInterval.properties = {\n\t\t\t\t[reservedIntervalIdKey]: interval.getIntervalId(),\n\t\t\t};\n\t\t\tconst localSeq = this.getNextLocalSeq();\n\t\t\tthis.localSeqToSerializedInterval.set(localSeq, serializedInterval);\n\t\t\tthis.emitter.emit(\"change\", undefined, serializedInterval, { localSeq });\n\t\t\tthis.addPendingChange(id, serializedInterval);\n\t\t\tthis.emitChange(newInterval, interval, true, false);\n\t\t\treturn newInterval;\n\t\t}\n\t\t// No interval to change\n\t\treturn undefined;\n\t}\n\n\tprivate get isCollaborating(): boolean {\n\t\treturn this.client?.getCollabWindow().collaborating ?? false;\n\t}\n\n\tprivate addPendingChange(id: string, serializedInterval: SerializedIntervalDelta) {\n\t\tif (!this.isCollaborating) {\n\t\t\treturn;\n\t\t}\n\t\tif (serializedInterval.start !== undefined) {\n\t\t\tthis.addPendingChangeHelper(id, this.pendingChangesStart, serializedInterval);\n\t\t}\n\t\tif (serializedInterval.end !== undefined) {\n\t\t\tthis.addPendingChangeHelper(id, this.pendingChangesEnd, serializedInterval);\n\t\t}\n\t}\n\n\tprivate addPendingChangeHelper(\n\t\tid: string,\n\t\tpendingChanges: Map<string, SerializedIntervalDelta[]>,\n\t\tserializedInterval: SerializedIntervalDelta,\n\t) {\n\t\tlet entries: SerializedIntervalDelta[] | undefined = pendingChanges.get(id);\n\t\tif (!entries) {\n\t\t\tentries = [];\n\t\t\tpendingChanges.set(id, entries);\n\t\t}\n\t\tentries.push(serializedInterval);\n\t}\n\n\tprivate removePendingChange(serializedInterval: SerializedIntervalDelta) {\n\t\t// Change ops always have an ID.\n\t\tconst id: string = serializedInterval.properties?.[reservedIntervalIdKey];\n\t\tif (serializedInterval.start !== undefined) {\n\t\t\tthis.removePendingChangeHelper(id, this.pendingChangesStart, serializedInterval);\n\t\t}\n\t\tif (serializedInterval.end !== undefined) {\n\t\t\tthis.removePendingChangeHelper(id, this.pendingChangesEnd, serializedInterval);\n\t\t}\n\t}\n\n\tprivate removePendingChangeHelper(\n\t\tid: string,\n\t\tpendingChanges: Map<string, SerializedIntervalDelta[]>,\n\t\tserializedInterval: SerializedIntervalDelta,\n\t) {\n\t\tconst entries = pendingChanges.get(id);\n\t\tif (entries) {\n\t\t\tconst pendingChange = entries.shift();\n\t\t\tif (entries.length === 0) {\n\t\t\t\tpendingChanges.delete(id);\n\t\t\t}\n\t\t\tif (\n\t\t\t\tpendingChange?.start !== serializedInterval.start ||\n\t\t\t\tpendingChange?.end !== serializedInterval.end\n\t\t\t) {\n\t\t\t\tthrow new LoggingError(\"Mismatch in pending changes\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate hasPendingChangeStart(id: string) {\n\t\tconst entries = this.pendingChangesStart.get(id);\n\t\treturn entries && entries.length !== 0;\n\t}\n\n\tprivate hasPendingChangeEnd(id: string) {\n\t\tconst entries = this.pendingChangesEnd.get(id);\n\t\treturn entries && entries.length !== 0;\n\t}\n\n\t/** @internal */\n\tpublic ackChange(\n\t\tserializedInterval: ISerializedInterval,\n\t\tlocal: boolean,\n\t\top: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t) {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t}\n\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tlocalOpMetadata !== undefined,\n\t\t\t\t0x552 /* op metadata should be defined for local op */,\n\t\t\t);\n\t\t\tthis.localSeqToSerializedInterval.delete(localOpMetadata?.localSeq);\n\t\t\t// This is an ack from the server. Remove the pending change.\n\t\t\tthis.removePendingChange(serializedInterval);\n\t\t}\n\n\t\t// Note that the ID is in the property bag only to allow us to find the interval.\n\t\t// This API cannot change the ID, and writing to the ID property will result in an exception. So we\n\t\t// strip it out of the properties here.\n\t\tconst { [reservedIntervalIdKey]: id, ...newProps } = serializedInterval.properties ?? {};\n\t\tassert(id !== undefined, 0x3fe /* id must exist on the interval */);\n\t\tconst interval: TInterval | undefined = this.getIntervalById(id);\n\t\tif (!interval) {\n\t\t\t// The interval has been removed locally; no-op.\n\t\t\treturn;\n\t\t}\n\n\t\tif (local) {\n\t\t\t// Let the propertyManager prune its pending change-properties set.\n\t\t\tinterval.propertyManager?.ackPendingProperties({\n\t\t\t\ttype: MergeTreeDeltaType.ANNOTATE,\n\t\t\t\tprops: serializedInterval.properties ?? {},\n\t\t\t});\n\n\t\t\tthis.ackInterval(interval, op);\n\t\t} else {\n\t\t\t// If there are pending changes with this ID, don't apply the remote start/end change, as the local ack\n\t\t\t// should be the winning change.\n\t\t\tlet start: number | undefined;\n\t\t\tlet end: number | undefined;\n\t\t\t// Track pending start/end independently of one another.\n\t\t\tif (!this.hasPendingChangeStart(id)) {\n\t\t\t\tstart = serializedInterval.start;\n\t\t\t}\n\t\t\tif (!this.hasPendingChangeEnd(id)) {\n\t\t\t\tend = serializedInterval.end;\n\t\t\t}\n\n\t\t\tlet newInterval = interval;\n\t\t\tif (start !== undefined || end !== undefined) {\n\t\t\t\t// If changeInterval gives us a new interval, work with that one. Otherwise keep working with\n\t\t\t\t// the one we originally found in the tree.\n\t\t\t\tnewInterval =\n\t\t\t\t\tthis.localCollection.changeInterval(interval, start, end, op) ?? interval;\n\t\t\t}\n\t\t\tconst deltaProps = newInterval.addProperties(newProps, true, op.sequenceNumber);\n\t\t\tif (this.onDeserialize) {\n\t\t\t\tthis.onDeserialize(newInterval);\n\t\t\t}\n\n\t\t\tif (newInterval !== interval) {\n\t\t\t\tthis.emitChange(newInterval, interval, local, false, op);\n\t\t\t}\n\n\t\t\tconst changedProperties = Object.keys(newProps).length > 0;\n\t\t\tif (changedProperties) {\n\t\t\t\tthis.emit(\"propertyChanged\", interval, deltaProps, local, op);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.attachDeserializer}\n\t */\n\tpublic attachDeserializer(onDeserialize: DeserializeCallback): void {\n\t\t// If no deserializer is specified can skip all processing work\n\t\tif (!onDeserialize) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Start by storing the callbacks so that any subsequent modifications make use of them\n\t\tthis.onDeserialize = onDeserialize;\n\n\t\t// Trigger the async prepare work across all values in the collection\n\t\tif (this.attached) {\n\t\t\tthis.map(onDeserialize);\n\t\t}\n\t}\n\n\t/**\n\t * Returns new interval after rebasing. If undefined, the interval was\n\t * deleted as a result of rebasing. This can occur if the interval applies\n\t * to a range that no longer exists, and the interval was unable to slide.\n\t *\n\t * @internal\n\t */\n\tpublic rebaseLocalInterval(\n\t\topName: string,\n\t\tserializedInterval: SerializedIntervalDelta,\n\t\tlocalSeq: number,\n\t): SerializedIntervalDelta | undefined {\n\t\tif (!this.client) {\n\t\t\t// If there's no associated mergeTree client, the originally submitted op is still correct.\n\t\t\treturn serializedInterval;\n\t\t}\n\t\tif (!this.attached) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\tconst { intervalType, properties } = serializedInterval;\n\n\t\tconst { start: startRebased, end: endRebased } =\n\t\t\tthis.localSeqToRebasedInterval.get(localSeq) ?? this.computeRebasedPositions(localSeq);\n\n\t\tconst intervalId = properties?.[reservedIntervalIdKey];\n\t\tconst localInterval = this.localCollection?.idIntervalIndex.getIntervalById(intervalId);\n\n\t\tconst rebased: SerializedIntervalDelta = {\n\t\t\tstart: startRebased,\n\t\t\tend: endRebased,\n\t\t\tintervalType,\n\t\t\tsequenceNumber: this.client?.getCurrentSeq() ?? 0,\n\t\t\tproperties,\n\t\t};\n\n\t\tif (\n\t\t\topName === \"change\" &&\n\t\t\t(this.hasPendingChangeStart(intervalId) || this.hasPendingChangeEnd(intervalId))\n\t\t) {\n\t\t\tthis.removePendingChange(serializedInterval);\n\t\t\tthis.addPendingChange(intervalId, rebased);\n\t\t}\n\n\t\t// if the interval slid off the string, rebase the op to be a noop and delete the interval.\n\t\tif (\n\t\t\tstartRebased === DetachedReferencePosition ||\n\t\t\tendRebased === DetachedReferencePosition\n\t\t) {\n\t\t\tif (localInterval) {\n\t\t\t\tthis.localCollection?.removeExistingInterval(localInterval);\n\t\t\t}\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (localInterval !== undefined) {\n\t\t\t// we know we must be using `SequenceInterval` because `this.client` exists\n\t\t\tassert(\n\t\t\t\tlocalInterval instanceof SequenceInterval,\n\t\t\t\t0x3a0 /* localInterval must be `SequenceInterval` when used with client */,\n\t\t\t);\n\t\t\t// The rebased op may place this interval's endpoints on different segments. Calling `changeInterval` here\n\t\t\t// updates the local client's state to be consistent with the emitted op.\n\t\t\tthis.localCollection?.changeInterval(\n\t\t\t\tlocalInterval,\n\t\t\t\tstartRebased,\n\t\t\t\tendRebased,\n\t\t\t\tundefined,\n\t\t\t\tlocalSeq,\n\t\t\t);\n\t\t}\n\n\t\treturn rebased;\n\t}\n\n\tprivate getSlideToSegment(\n\t\tlref: LocalReferencePosition,\n\t): { segment: ISegment | undefined; offset: number | undefined } | undefined {\n\t\tif (!this.client) {\n\t\t\tthrow new LoggingError(\"client does not exist\");\n\t\t}\n\t\tconst segoff = { segment: lref.getSegment(), offset: lref.getOffset() };\n\t\tif (segoff.segment?.localRefs?.has(lref) !== true) {\n\t\t\treturn undefined;\n\t\t}\n\t\tconst newSegoff = getSlideToSegoff(segoff);\n\t\tconst value: { segment: ISegment | undefined; offset: number | undefined } | undefined =\n\t\t\tsegoff.segment === newSegoff.segment && segoff.offset === newSegoff.offset\n\t\t\t\t? undefined\n\t\t\t\t: newSegoff;\n\t\treturn value;\n\t}\n\n\tprivate ackInterval(interval: TInterval, op: ISequencedDocumentMessage) {\n\t\t// Only SequenceIntervals need potential sliding\n\t\tif (!(interval instanceof SequenceInterval)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\t!refTypeIncludesFlag(interval.start, ReferenceType.StayOnRemove) &&\n\t\t\t!refTypeIncludesFlag(interval.end, ReferenceType.StayOnRemove)\n\t\t) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStart = this.getSlideToSegment(interval.start);\n\t\tconst newEnd = this.getSlideToSegment(interval.end);\n\n\t\tconst id = interval.properties[reservedIntervalIdKey];\n\t\tconst hasPendingStartChange = this.hasPendingChangeStart(id);\n\t\tconst hasPendingEndChange = this.hasPendingChangeEnd(id);\n\n\t\tif (!hasPendingStartChange) {\n\t\t\tsetSlideOnRemove(interval.start);\n\t\t}\n\n\t\tif (!hasPendingEndChange) {\n\t\t\tsetSlideOnRemove(interval.end);\n\t\t}\n\n\t\tconst needsStartUpdate = newStart !== undefined && !hasPendingStartChange;\n\t\tconst needsEndUpdate = newEnd !== undefined && !hasPendingEndChange;\n\n\t\tif (needsStartUpdate || needsEndUpdate) {\n\t\t\tif (!this.localCollection) {\n\t\t\t\tthrow new LoggingError(\"Attach must be called before accessing intervals\");\n\t\t\t}\n\n\t\t\t// `interval`'s endpoints will get modified in-place, so clone it prior to doing so for event emission.\n\t\t\tconst oldInterval = interval.clone() as TInterval & SequenceInterval;\n\n\t\t\t// In this case, where we change the start or end of an interval,\n\t\t\t// it is necessary to remove and re-add the interval listeners.\n\t\t\t// This ensures that the correct listeners are added to the LocalReferencePosition.\n\t\t\tthis.localCollection.removeExistingInterval(interval);\n\t\t\tif (!this.client) {\n\t\t\t\tthrow new LoggingError(\"client does not exist\");\n\t\t\t}\n\n\t\t\tif (needsStartUpdate) {\n\t\t\t\tconst props = interval.start.properties;\n\t\t\t\tinterval.start = createPositionReferenceFromSegoff(\n\t\t\t\t\tthis.client,\n\t\t\t\t\tnewStart,\n\t\t\t\t\tinterval.start.refType,\n\t\t\t\t\top,\n\t\t\t\t\tstartReferenceSlidingPreference(interval.stickiness),\n\t\t\t\t);\n\t\t\t\tif (props) {\n\t\t\t\t\tinterval.start.addProperties(props);\n\t\t\t\t}\n\t\t\t\tconst oldSeg = oldInterval.start.getSegment();\n\t\t\t\t// remove and rebuild start interval as transient for event\n\t\t\t\tthis.client.removeLocalReferencePosition(oldInterval.start);\n\t\t\t\toldInterval.start.refType = ReferenceType.Transient;\n\t\t\t\toldSeg?.localRefs?.addLocalRef(oldInterval.start, oldInterval.start.getOffset());\n\t\t\t}\n\t\t\tif (needsEndUpdate) {\n\t\t\t\tconst props = interval.end.properties;\n\t\t\t\tinterval.end = createPositionReferenceFromSegoff(\n\t\t\t\t\tthis.client,\n\t\t\t\t\tnewEnd,\n\t\t\t\t\tinterval.end.refType,\n\t\t\t\t\top,\n\t\t\t\t\tendReferenceSlidingPreference(interval.stickiness),\n\t\t\t\t);\n\t\t\t\tif (props) {\n\t\t\t\t\tinterval.end.addProperties(props);\n\t\t\t\t}\n\t\t\t\t// remove and rebuild end interval as transient for event\n\t\t\t\tconst oldSeg = oldInterval.end.getSegment();\n\t\t\t\tthis.client.removeLocalReferencePosition(oldInterval.end);\n\t\t\t\toldInterval.end.refType = ReferenceType.Transient;\n\t\t\t\toldSeg?.localRefs?.addLocalRef(oldInterval.end, oldInterval.end.getOffset());\n\t\t\t}\n\t\t\tthis.localCollection.add(interval);\n\t\t\tthis.emitChange(interval, oldInterval as TInterval, true, true, op);\n\t\t}\n\t}\n\n\t/** @internal */\n\tpublic ackAdd(\n\t\tserializedInterval: ISerializedInterval,\n\t\tlocal: boolean,\n\t\top: ISequencedDocumentMessage,\n\t\tlocalOpMetadata: IMapMessageLocalMetadata | undefined,\n\t) {\n\t\tif (local) {\n\t\t\tassert(\n\t\t\t\tlocalOpMetadata !== undefined,\n\t\t\t\t0x553 /* op metadata should be defined for local op */,\n\t\t\t);\n\t\t\tthis.localSeqToSerializedInterval.delete(localOpMetadata.localSeq);\n\t\t\tconst id: string = serializedInterval.properties?.[reservedIntervalIdKey];\n\t\t\tconst localInterval = this.getIntervalById(id);\n\t\t\tif (localInterval) {\n\t\t\t\tthis.ackInterval(localInterval, op);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\tthis.localCollection.ensureSerializedId(serializedInterval);\n\n\t\tconst interval: TInterval = this.localCollection.addInterval(\n\t\t\tserializedInterval.start,\n\t\t\tserializedInterval.end,\n\t\t\tserializedInterval.intervalType,\n\t\t\tserializedInterval.properties,\n\t\t\top,\n\t\t\tserializedInterval.stickiness,\n\t\t);\n\n\t\tif (interval) {\n\t\t\tif (this.onDeserialize) {\n\t\t\t\tthis.onDeserialize(interval);\n\t\t\t}\n\t\t}\n\n\t\tthis.emit(\"addInterval\", interval, local, op);\n\n\t\treturn interval;\n\t}\n\n\t/** @internal */\n\tpublic ackDelete(\n\t\tserializedInterval: ISerializedInterval,\n\t\tlocal: boolean,\n\t\top: ISequencedDocumentMessage,\n\t): void {\n\t\tif (local) {\n\t\t\t// Local ops were applied when the message was created and there's no \"pending delete\"\n\t\t\t// state to bookkeep: remote operation application takes into account possibility of\n\t\t\t// locally deleted interval whenever a lookup happens.\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attach must be called prior to deleting intervals\");\n\t\t}\n\n\t\tconst id = this.localCollection.ensureSerializedId(serializedInterval);\n\t\tconst interval = this.localCollection.idIntervalIndex.getIntervalById(id);\n\t\tif (interval) {\n\t\t\tthis.deleteExistingInterval(interval, local, op);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic serializeInternal(): ISerializedIntervalCollectionV2 {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.serialize();\n\t}\n\n\t/**\n\t * @returns an iterator over all intervals in this collection.\n\t */\n\tpublic [Symbol.iterator](): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(this);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateForwardIteratorWithStartPosition}\n\t */\n\tpublic CreateForwardIteratorWithStartPosition(\n\t\tstartPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(this, true, startPosition);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateBackwardIteratorWithStartPosition}\n\t */\n\tpublic CreateBackwardIteratorWithStartPosition(\n\t\tstartPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(this, false, startPosition);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateForwardIteratorWithEndPosition}\n\t */\n\tpublic CreateForwardIteratorWithEndPosition(\n\t\tendPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(\n\t\t\tthis,\n\t\t\ttrue,\n\t\t\tundefined,\n\t\t\tendPosition,\n\t\t);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.CreateBackwardIteratorWithEndPosition}\n\t */\n\tpublic CreateBackwardIteratorWithEndPosition(\n\t\tendPosition: number,\n\t): IntervalCollectionIterator<TInterval> {\n\t\tconst iterator = new IntervalCollectionIterator<TInterval>(\n\t\t\tthis,\n\t\t\tfalse,\n\t\t\tundefined,\n\t\t\tendPosition,\n\t\t);\n\t\treturn iterator;\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.gatherIterationResults}\n\t */\n\tpublic gatherIterationResults(\n\t\tresults: TInterval[],\n\t\titeratesForward: boolean,\n\t\tstart?: number,\n\t\tend?: number,\n\t) {\n\t\tif (!this.localCollection) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.localCollection.overlappingIntervalsIndex.gatherIterationResults(\n\t\t\tresults,\n\t\t\titeratesForward,\n\t\t\tstart,\n\t\t\tend,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.findOverlappingIntervals}\n\t */\n\tpublic findOverlappingIntervals(startPosition: number, endPosition: number): TInterval[] {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.overlappingIntervalsIndex.findOverlappingIntervals(\n\t\t\tstartPosition,\n\t\t\tendPosition,\n\t\t);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.map}\n\t */\n\tpublic map(fn: (interval: TInterval) => void) {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\tfor (const interval of this.localCollection.idIntervalIndex) {\n\t\t\tfn(interval);\n\t\t}\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.previousInterval}\n\t */\n\tpublic previousInterval(pos: number): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.endIntervalIndex.previousInterval(pos);\n\t}\n\n\t/**\n\t * {@inheritdoc IIntervalCollection.nextInterval}\n\t */\n\tpublic nextInterval(pos: number): TInterval | undefined {\n\t\tif (!this.localCollection) {\n\t\t\tthrow new LoggingError(\"attachSequence must be called\");\n\t\t}\n\n\t\treturn this.localCollection.endIntervalIndex.nextInterval(pos);\n\t}\n}\n\nfunction setSlideOnRemove(lref: LocalReferencePosition) {\n\tlet refType = lref.refType;\n\trefType = refType & ~ReferenceType.StayOnRemove;\n\trefType = refType | ReferenceType.SlideOnRemove;\n\tlref.refType = refType;\n}\n\n/**\n * Information that identifies an interval within a `Sequence`.\n */\nexport interface IntervalLocator {\n\t/**\n\t * Label for the collection the interval is a part of\n\t */\n\tlabel: string;\n\t/**\n\t * Interval within that collection\n\t */\n\tinterval: SequenceInterval;\n}\n\n/**\n * Returns an object that can be used to find the interval a given LocalReferencePosition belongs to.\n * @returns undefined if the reference position is not the endpoint of any interval (e.g. it was created\n * on the merge tree directly by app code), otherwise an {@link IntervalLocator} for the interval this\n * endpoint is a part of.\n */\nexport function intervalLocatorFromEndpoint(\n\tpotentialEndpoint: LocalReferencePosition,\n): IntervalLocator | undefined {\n\tconst { interval, [reservedRangeLabelsKey]: collectionNameArray } =\n\t\tpotentialEndpoint.properties ?? {};\n\treturn interval && collectionNameArray?.length === 1\n\t\t? { label: collectionNameArray[0], interval }\n\t\t: undefined;\n}\n"]}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { Client } from "@fluidframework/merge-tree";
|
|
6
|
-
import { IIntervalHelpers, ISerializableInterval } from "../intervals";
|
|
6
|
+
import { IIntervalHelpers, ISerializableInterval, SequenceInterval } from "../intervals";
|
|
7
|
+
import { SharedString } from "../sharedString";
|
|
7
8
|
import { IntervalIndex } from "./intervalIndex";
|
|
8
9
|
/**
|
|
9
10
|
* Collection of intervals.
|
|
@@ -14,7 +15,16 @@ export interface IEndpointInRangeIndex<TInterval extends ISerializableInterval>
|
|
|
14
15
|
/**
|
|
15
16
|
* @returns an array of all intervals contained in this collection whose endpoints locate in the range [start, end] (includes both ends)
|
|
16
17
|
*/
|
|
17
|
-
findIntervalsWithEndpointInRange(start: number, end: number):
|
|
18
|
+
findIntervalsWithEndpointInRange(start: number, end: number): TInterval[];
|
|
18
19
|
}
|
|
19
|
-
export declare
|
|
20
|
+
export declare class EndpointInRangeIndex<TInterval extends ISerializableInterval> implements IEndpointInRangeIndex<TInterval> {
|
|
21
|
+
private readonly client;
|
|
22
|
+
private readonly helpers;
|
|
23
|
+
private readonly intervalTree;
|
|
24
|
+
constructor(client: Client, helpers: IIntervalHelpers<TInterval>);
|
|
25
|
+
add(interval: TInterval): void;
|
|
26
|
+
remove(interval: TInterval): void;
|
|
27
|
+
findIntervalsWithEndpointInRange(start: number, end: number): TInterval[];
|
|
28
|
+
}
|
|
29
|
+
export declare function createEndpointInRangeIndex(sharedString: SharedString): IEndpointInRangeIndex<SequenceInterval>;
|
|
20
30
|
//# sourceMappingURL=endpointInRangeIndex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpointInRangeIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/endpointInRangeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"endpointInRangeIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/endpointInRangeIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAgC,MAAM,4BAA4B,CAAC;AAClF,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EAErB,gBAAgB,EAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD;;;;GAIG;AACH,MAAM,WAAW,qBAAqB,CAAC,SAAS,SAAS,qBAAqB,CAC7E,SAAQ,aAAa,CAAC,SAAS,CAAC;IAChC;;OAEG;IACH,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE,CAAC;CAC1E;AAED,qBAAa,oBAAoB,CAAC,SAAS,SAAS,qBAAqB,CACxE,YAAW,qBAAqB,CAAC,SAAS,CAAC;IAK1C,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJzB,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;gBAGZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;IAyB/C,GAAG,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAI9B,MAAM,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAIjC,gCAAgC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,EAAE;CAiChF;AAED,wBAAgB,0BAA0B,CACzC,YAAY,EAAE,YAAY,GACxB,qBAAqB,CAAC,gBAAgB,CAAC,CAGzC"}
|
|
@@ -3,15 +3,16 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
/* eslint-disable import/no-deprecated */
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.createEndpointInRangeIndex = void 0;
|
|
8
|
+
exports.createEndpointInRangeIndex = exports.EndpointInRangeIndex = void 0;
|
|
8
9
|
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
9
10
|
const intervals_1 = require("../intervals");
|
|
10
11
|
const intervalIndexUtils_1 = require("./intervalIndexUtils");
|
|
11
12
|
class EndpointInRangeIndex {
|
|
12
|
-
constructor(
|
|
13
|
-
this.helpers = helpers;
|
|
13
|
+
constructor(client, helpers) {
|
|
14
14
|
this.client = client;
|
|
15
|
+
this.helpers = helpers;
|
|
15
16
|
this.intervalTree = new merge_tree_1.RedBlackTree((a, b) => {
|
|
16
17
|
const compareEndsResult = helpers.compareEnds(a, b);
|
|
17
18
|
if (compareEndsResult !== 0) {
|
|
@@ -53,8 +54,10 @@ class EndpointInRangeIndex {
|
|
|
53
54
|
return results;
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
exports.EndpointInRangeIndex = EndpointInRangeIndex;
|
|
58
|
+
function createEndpointInRangeIndex(sharedString) {
|
|
59
|
+
const client = sharedString.client;
|
|
60
|
+
return new EndpointInRangeIndex(client, intervals_1.sequenceIntervalHelpers);
|
|
58
61
|
}
|
|
59
62
|
exports.createEndpointInRangeIndex = createEndpointInRangeIndex;
|
|
60
63
|
//# sourceMappingURL=endpointInRangeIndex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpointInRangeIndex.js","sourceRoot":"","sources":["../../src/intervalIndex/endpointInRangeIndex.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"endpointInRangeIndex.js","sourceRoot":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I,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE;YAC7D,OAAO,EAAE,CAAC;SACV;QACD,MAAM,OAAO,GAAgB,EAAE,CAAC;QAChC,MAAM,MAAM,GAAyC,CAAC,IAAI,EAAE,EAAE;YAC7D,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACxB,OAAO,IAAI,CAAC;QACb,CAAC,CAAC;QAEF,MAAM,sBAAsB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CACjD,WAAW,EACX,KAAK,EACL,KAAK,EACL,IAAI,CAAC,MAAM,EACX,wBAAY,CAAC,SAAS,CACtB,CAAC;QAEF,MAAM,oBAAoB,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAC/C,WAAW,EACX,GAAG,EACH,GAAG,EACH,IAAI,CAAC,MAAM,EACX,wBAAY,CAAC,SAAS,CACtB,CAAC;QAEF,sDAAsD;QACrD,sBAAyD,CAAC,iCAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC7E,oBAAuD,CAAC,iCAAY,CAAC,GAAG,CAAC,CAAC;QAE3E,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,CAAC,CAAC;QAC1F,OAAO,OAAO,CAAC;IAChB,CAAC;CACD;AAzED,oDAyEC;AAED,SAAgB,0BAA0B,CACzC,YAA0B;IAE1B,MAAM,MAAM,GAAI,YAA8C,CAAC,MAAM,CAAC;IACtE,OAAO,IAAI,oBAAoB,CAAmB,MAAM,EAAE,mCAAuB,CAAC,CAAC;AACpF,CAAC;AALD,gEAKC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/* eslint-disable import/no-deprecated */\n\nimport { Client, PropertyAction, RedBlackTree } from \"@fluidframework/merge-tree\";\nimport {\n\tIIntervalHelpers,\n\tISerializableInterval,\n\tIntervalType,\n\tSequenceInterval,\n\tsequenceIntervalHelpers,\n} from \"../intervals\";\nimport { SharedString } from \"../sharedString\";\nimport { IntervalIndex } from \"./intervalIndex\";\nimport { HasComparisonOverride, compareOverrideables, forceCompare } from \"./intervalIndexUtils\";\n\n/**\n * Collection of intervals.\n *\n * Provide additional APIs to support efficiently querying a collection of intervals whose endpoints fall within a specified range.\n */\nexport interface IEndpointInRangeIndex<TInterval extends ISerializableInterval>\n\textends IntervalIndex<TInterval> {\n\t/**\n\t * @returns an array of all intervals contained in this collection whose endpoints locate in the range [start, end] (includes both ends)\n\t */\n\tfindIntervalsWithEndpointInRange(start: number, end: number): TInterval[];\n}\n\nexport class EndpointInRangeIndex<TInterval extends ISerializableInterval>\n\timplements IEndpointInRangeIndex<TInterval>\n{\n\tprivate readonly intervalTree;\n\n\tconstructor(\n\t\tprivate readonly client: Client,\n\t\tprivate readonly helpers: IIntervalHelpers<TInterval>,\n\t) {\n\t\tthis.intervalTree = new RedBlackTree<TInterval, TInterval>((a: TInterval, b: TInterval) => {\n\t\t\tconst compareEndsResult = helpers.compareEnds(a, b);\n\t\t\tif (compareEndsResult !== 0) {\n\t\t\t\treturn compareEndsResult;\n\t\t\t}\n\n\t\t\tconst overrideablesComparison = compareOverrideables(\n\t\t\t\ta as Partial<HasComparisonOverride>,\n\t\t\t\tb as Partial<HasComparisonOverride>,\n\t\t\t);\n\t\t\tif (overrideablesComparison !== 0) {\n\t\t\t\treturn overrideablesComparison;\n\t\t\t}\n\n\t\t\tconst aId = a.getIntervalId();\n\t\t\tconst bId = b.getIntervalId();\n\t\t\tif (aId !== undefined && bId !== undefined) {\n\t\t\t\treturn aId.localeCompare(bId);\n\t\t\t}\n\t\t\treturn 0;\n\t\t});\n\t}\n\n\tpublic add(interval: TInterval): void {\n\t\tthis.intervalTree.put(interval, interval);\n\t}\n\n\tpublic remove(interval: TInterval): void {\n\t\tthis.intervalTree.remove(interval);\n\t}\n\n\tpublic findIntervalsWithEndpointInRange(start: number, end: number): TInterval[] {\n\t\tif (start <= 0 || start > end || this.intervalTree.isEmpty()) {\n\t\t\treturn [];\n\t\t}\n\t\tconst results: TInterval[] = [];\n\t\tconst action: PropertyAction<TInterval, TInterval> = (node) => {\n\t\t\tresults.push(node.data);\n\t\t\treturn true;\n\t\t};\n\n\t\tconst transientStartInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tstart,\n\t\t\tstart,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\tconst transientEndInterval = this.helpers.create(\n\t\t\t\"transient\",\n\t\t\tend,\n\t\t\tend,\n\t\t\tthis.client,\n\t\t\tIntervalType.Transient,\n\t\t);\n\n\t\t// Add comparison overrides to the transient intervals\n\t\t(transientStartInterval as Partial<HasComparisonOverride>)[forceCompare] = -1;\n\t\t(transientEndInterval as Partial<HasComparisonOverride>)[forceCompare] = 1;\n\n\t\tthis.intervalTree.mapRange(action, results, transientStartInterval, transientEndInterval);\n\t\treturn results;\n\t}\n}\n\nexport function createEndpointInRangeIndex(\n\tsharedString: SharedString,\n): IEndpointInRangeIndex<SequenceInterval> {\n\tconst client = (sharedString as unknown as { client: Client }).client;\n\treturn new EndpointInRangeIndex<SequenceInterval>(client, sequenceIntervalHelpers);\n}\n"]}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { Client } from "@fluidframework/merge-tree";
|
|
6
|
-
import { IIntervalHelpers, ISerializableInterval } from "../intervals";
|
|
6
|
+
import { IIntervalHelpers, ISerializableInterval, SequenceInterval } from "../intervals";
|
|
7
|
+
import { SharedString } from "../sharedString";
|
|
7
8
|
import { IntervalIndex } from "./intervalIndex";
|
|
8
9
|
export interface IEndpointIndex<TInterval extends ISerializableInterval> extends IntervalIndex<TInterval> {
|
|
9
10
|
/**
|
|
@@ -17,5 +18,15 @@ export interface IEndpointIndex<TInterval extends ISerializableInterval> extends
|
|
|
17
18
|
*/
|
|
18
19
|
nextInterval(pos: number): TInterval | undefined;
|
|
19
20
|
}
|
|
20
|
-
export declare
|
|
21
|
+
export declare class EndpointIndex<TInterval extends ISerializableInterval> implements IEndpointIndex<TInterval> {
|
|
22
|
+
private readonly client;
|
|
23
|
+
private readonly helpers;
|
|
24
|
+
private readonly endIntervalTree;
|
|
25
|
+
constructor(client: Client, helpers: IIntervalHelpers<TInterval>);
|
|
26
|
+
previousInterval(pos: number): TInterval | undefined;
|
|
27
|
+
nextInterval(pos: number): TInterval | undefined;
|
|
28
|
+
add(interval: TInterval): void;
|
|
29
|
+
remove(interval: TInterval): void;
|
|
30
|
+
}
|
|
31
|
+
export declare function createEndpointIndex(sharedString: SharedString): IEndpointIndex<SequenceInterval>;
|
|
21
32
|
//# sourceMappingURL=endpointIndex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpointIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/endpointIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"endpointIndex.d.ts","sourceRoot":"","sources":["../../src/intervalIndex/endpointIndex.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAgB,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EAErB,gBAAgB,EAEhB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,WAAW,cAAc,CAAC,SAAS,SAAS,qBAAqB,CACtE,SAAQ,aAAa,CAAC,SAAS,CAAC;IAChC;;;OAGG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IAErD;;;OAGG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACjD;AAED,qBAAa,aAAa,CAAC,SAAS,SAAS,qBAAqB,CACjE,YAAW,cAAc,CAAC,SAAS,CAAC;IAKnC,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJzB,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqC;gBAGnD,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC;IAM/C,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAcpD,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAchD,GAAG,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAI9B,MAAM,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;CAGxC;AAED,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,YAAY,GAAG,cAAc,CAAC,gBAAgB,CAAC,CAGhG"}
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
+
/* eslint-disable import/no-deprecated */
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.createEndpointIndex = void 0;
|
|
8
|
+
exports.createEndpointIndex = exports.EndpointIndex = void 0;
|
|
8
9
|
const merge_tree_1 = require("@fluidframework/merge-tree");
|
|
9
10
|
const intervals_1 = require("../intervals");
|
|
10
11
|
class EndpointIndex {
|
|
@@ -35,8 +36,10 @@ class EndpointIndex {
|
|
|
35
36
|
this.endIntervalTree.remove(interval);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
exports.EndpointIndex = EndpointIndex;
|
|
40
|
+
function createEndpointIndex(sharedString) {
|
|
41
|
+
const client = sharedString.client;
|
|
42
|
+
return new EndpointIndex(client, intervals_1.sequenceIntervalHelpers);
|
|
40
43
|
}
|
|
41
44
|
exports.createEndpointIndex = createEndpointIndex;
|
|
42
45
|
//# sourceMappingURL=endpointIndex.js.map
|