@y/y 14.0.0-16
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/LICENSE +23 -0
- package/README.md +1406 -0
- package/dist/Skip-j0kX7pdq.js +12173 -0
- package/dist/Skip-j0kX7pdq.js.map +1 -0
- package/dist/Skip-wRT7BKFP.js +11877 -0
- package/dist/Skip-wRT7BKFP.js.map +1 -0
- package/dist/index-DyTeTfmj.js +163 -0
- package/dist/index-DyTeTfmj.js.map +1 -0
- package/dist/index-R7GxO-36.js +165 -0
- package/dist/index-R7GxO-36.js.map +1 -0
- package/dist/internals.cjs +286 -0
- package/dist/internals.cjs.map +1 -0
- package/dist/internals.mjs +25 -0
- package/dist/internals.mjs.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/internals.d.ts +43 -0
- package/dist/src/internals.d.ts.map +1 -0
- package/dist/src/structs/AbstractStruct.d.ts +42 -0
- package/dist/src/structs/AbstractStruct.d.ts.map +1 -0
- package/dist/src/structs/ContentAny.d.ts +67 -0
- package/dist/src/structs/ContentAny.d.ts.map +1 -0
- package/dist/src/structs/ContentBinary.d.ts +64 -0
- package/dist/src/structs/ContentBinary.d.ts.map +1 -0
- package/dist/src/structs/ContentDeleted.d.ts +64 -0
- package/dist/src/structs/ContentDeleted.d.ts.map +1 -0
- package/dist/src/structs/ContentDoc.d.ts +72 -0
- package/dist/src/structs/ContentDoc.d.ts.map +1 -0
- package/dist/src/structs/ContentEmbed.d.ts +67 -0
- package/dist/src/structs/ContentEmbed.d.ts.map +1 -0
- package/dist/src/structs/ContentFormat.d.ts +69 -0
- package/dist/src/structs/ContentFormat.d.ts.map +1 -0
- package/dist/src/structs/ContentJSON.d.ts +70 -0
- package/dist/src/structs/ContentJSON.d.ts.map +1 -0
- package/dist/src/structs/ContentString.d.ts +70 -0
- package/dist/src/structs/ContentString.d.ts.map +1 -0
- package/dist/src/structs/ContentType.d.ts +83 -0
- package/dist/src/structs/ContentType.d.ts.map +1 -0
- package/dist/src/structs/GC.d.ts +31 -0
- package/dist/src/structs/GC.d.ts.map +1 -0
- package/dist/src/structs/Item.d.ts +212 -0
- package/dist/src/structs/Item.d.ts.map +1 -0
- package/dist/src/structs/Skip.d.ts +33 -0
- package/dist/src/structs/Skip.d.ts.map +1 -0
- package/dist/src/types/AbstractType.d.ts +239 -0
- package/dist/src/types/AbstractType.d.ts.map +1 -0
- package/dist/src/types/YArray.d.ts +128 -0
- package/dist/src/types/YArray.d.ts.map +1 -0
- package/dist/src/types/YMap.d.ts +112 -0
- package/dist/src/types/YMap.d.ts.map +1 -0
- package/dist/src/types/YText.d.ts +216 -0
- package/dist/src/types/YText.d.ts.map +1 -0
- package/dist/src/types/YXmlElement.d.ts +106 -0
- package/dist/src/types/YXmlElement.d.ts.map +1 -0
- package/dist/src/types/YXmlFragment.d.ts +143 -0
- package/dist/src/types/YXmlFragment.d.ts.map +1 -0
- package/dist/src/types/YXmlHook.d.ts +32 -0
- package/dist/src/types/YXmlHook.d.ts.map +1 -0
- package/dist/src/types/YXmlText.d.ts +34 -0
- package/dist/src/types/YXmlText.d.ts.map +1 -0
- package/dist/src/utils/AbstractConnector.d.ts +20 -0
- package/dist/src/utils/AbstractConnector.d.ts.map +1 -0
- package/dist/src/utils/AttributionManager.d.ts +224 -0
- package/dist/src/utils/AttributionManager.d.ts.map +1 -0
- package/dist/src/utils/Doc.d.ts +267 -0
- package/dist/src/utils/Doc.d.ts.map +1 -0
- package/dist/src/utils/EventHandler.d.ts +19 -0
- package/dist/src/utils/EventHandler.d.ts.map +1 -0
- package/dist/src/utils/ID.d.ts +26 -0
- package/dist/src/utils/ID.d.ts.map +1 -0
- package/dist/src/utils/IdMap.d.ts +161 -0
- package/dist/src/utils/IdMap.d.ts.map +1 -0
- package/dist/src/utils/IdSet.d.ts +163 -0
- package/dist/src/utils/IdSet.d.ts.map +1 -0
- package/dist/src/utils/RelativePosition.d.ts +91 -0
- package/dist/src/utils/RelativePosition.d.ts.map +1 -0
- package/dist/src/utils/Snapshot.d.ts +40 -0
- package/dist/src/utils/Snapshot.d.ts.map +1 -0
- package/dist/src/utils/StructSet.d.ts +27 -0
- package/dist/src/utils/StructSet.d.ts.map +1 -0
- package/dist/src/utils/StructStore.d.ts +41 -0
- package/dist/src/utils/StructStore.d.ts.map +1 -0
- package/dist/src/utils/Transaction.d.ts +136 -0
- package/dist/src/utils/Transaction.d.ts.map +1 -0
- package/dist/src/utils/UndoManager.d.ts +188 -0
- package/dist/src/utils/UndoManager.d.ts.map +1 -0
- package/dist/src/utils/UpdateDecoder.d.ts +167 -0
- package/dist/src/utils/UpdateDecoder.d.ts.map +1 -0
- package/dist/src/utils/UpdateEncoder.d.ts +164 -0
- package/dist/src/utils/UpdateEncoder.d.ts.map +1 -0
- package/dist/src/utils/YEvent.d.ts +120 -0
- package/dist/src/utils/YEvent.d.ts.map +1 -0
- package/dist/src/utils/delta-helpers.d.ts +6 -0
- package/dist/src/utils/delta-helpers.d.ts.map +1 -0
- package/dist/src/utils/encoding.d.ts +30 -0
- package/dist/src/utils/encoding.d.ts.map +1 -0
- package/dist/src/utils/isParentOf.d.ts +3 -0
- package/dist/src/utils/isParentOf.d.ts.map +1 -0
- package/dist/src/utils/logging.d.ts +3 -0
- package/dist/src/utils/logging.d.ts.map +1 -0
- package/dist/src/utils/types.d.ts +7 -0
- package/dist/src/utils/types.d.ts.map +1 -0
- package/dist/src/utils/updates.d.ts +89 -0
- package/dist/src/utils/updates.d.ts.map +1 -0
- package/dist/testHelper.cjs +780 -0
- package/dist/testHelper.cjs.map +1 -0
- package/dist/testHelper.mjs +617 -0
- package/dist/testHelper.mjs.map +1 -0
- package/dist/tests/IdMap.tests.d.ts +9 -0
- package/dist/tests/IdMap.tests.d.ts.map +1 -0
- package/dist/tests/IdSet.tests.d.ts +9 -0
- package/dist/tests/IdSet.tests.d.ts.map +1 -0
- package/dist/tests/attribution.tests.d.ts +8 -0
- package/dist/tests/attribution.tests.d.ts.map +1 -0
- package/dist/tests/compatibility.tests.d.ts +5 -0
- package/dist/tests/compatibility.tests.d.ts.map +1 -0
- package/dist/tests/delta.tests.d.ts +7 -0
- package/dist/tests/delta.tests.d.ts.map +1 -0
- package/dist/tests/doc.tests.d.ts +13 -0
- package/dist/tests/doc.tests.d.ts.map +1 -0
- package/dist/tests/encoding.tests.d.ts +5 -0
- package/dist/tests/encoding.tests.d.ts.map +1 -0
- package/dist/tests/index.d.ts +2 -0
- package/dist/tests/index.d.ts.map +1 -0
- package/dist/tests/relativePositions.tests.d.ts +11 -0
- package/dist/tests/relativePositions.tests.d.ts.map +1 -0
- package/dist/tests/snapshot.tests.d.ts +13 -0
- package/dist/tests/snapshot.tests.d.ts.map +1 -0
- package/dist/tests/testHelper.d.ts +167 -0
- package/dist/tests/testHelper.d.ts.map +1 -0
- package/dist/tests/undo-redo.tests.d.ts +27 -0
- package/dist/tests/undo-redo.tests.d.ts.map +1 -0
- package/dist/tests/updates.tests.d.ts +24 -0
- package/dist/tests/updates.tests.d.ts.map +1 -0
- package/dist/tests/y-array.tests.d.ts +45 -0
- package/dist/tests/y-array.tests.d.ts.map +1 -0
- package/dist/tests/y-map.tests.d.ts +45 -0
- package/dist/tests/y-map.tests.d.ts.map +1 -0
- package/dist/tests/y-text.tests.d.ts +49 -0
- package/dist/tests/y-text.tests.d.ts.map +1 -0
- package/dist/tests/y-xml.tests.d.ts +15 -0
- package/dist/tests/y-xml.tests.d.ts.map +1 -0
- package/dist/yjs.cjs +151 -0
- package/dist/yjs.cjs.map +1 -0
- package/dist/yjs.mjs +26 -0
- package/dist/yjs.mjs.map +1 -0
- package/package.json +101 -0
- package/src/index.js +153 -0
- package/src/internals.js +44 -0
- package/src/structs/AbstractStruct.js +59 -0
- package/src/structs/ContentAny.js +115 -0
- package/src/structs/ContentBinary.js +93 -0
- package/src/structs/ContentDeleted.js +101 -0
- package/src/structs/ContentDoc.js +141 -0
- package/src/structs/ContentEmbed.js +98 -0
- package/src/structs/ContentFormat.js +105 -0
- package/src/structs/ContentJSON.js +119 -0
- package/src/structs/ContentString.js +113 -0
- package/src/structs/ContentType.js +176 -0
- package/src/structs/GC.js +80 -0
- package/src/structs/Item.js +845 -0
- package/src/structs/Skip.js +75 -0
- package/src/types/AbstractType.js +1434 -0
- package/src/types/YArray.js +270 -0
- package/src/types/YMap.js +244 -0
- package/src/types/YText.js +934 -0
- package/src/types/YXmlElement.js +227 -0
- package/src/types/YXmlFragment.js +266 -0
- package/src/types/YXmlHook.js +68 -0
- package/src/types/YXmlText.js +66 -0
- package/src/utils/AbstractConnector.js +25 -0
- package/src/utils/AttributionManager.js +619 -0
- package/src/utils/Doc.js +372 -0
- package/src/utils/EventHandler.js +87 -0
- package/src/utils/ID.js +89 -0
- package/src/utils/IdMap.js +629 -0
- package/src/utils/IdSet.js +823 -0
- package/src/utils/RelativePosition.js +352 -0
- package/src/utils/Snapshot.js +220 -0
- package/src/utils/StructSet.js +137 -0
- package/src/utils/StructStore.js +289 -0
- package/src/utils/Transaction.js +489 -0
- package/src/utils/UndoManager.js +391 -0
- package/src/utils/UpdateDecoder.js +281 -0
- package/src/utils/UpdateEncoder.js +320 -0
- package/src/utils/YEvent.js +216 -0
- package/src/utils/delta-helpers.js +54 -0
- package/src/utils/encoding.js +623 -0
- package/src/utils/isParentOf.js +21 -0
- package/src/utils/logging.js +21 -0
- package/src/utils/types.js +28 -0
- package/src/utils/updates.js +715 -0
- package/tests/testHelper.js +600 -0
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
export function warnPrematureAccess(): void;
|
|
2
|
+
export class ArraySearchMarker {
|
|
3
|
+
/**
|
|
4
|
+
* @param {Item} p
|
|
5
|
+
* @param {number} index
|
|
6
|
+
*/
|
|
7
|
+
constructor(p: Item, index: number);
|
|
8
|
+
p: Item;
|
|
9
|
+
index: number;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
}
|
|
12
|
+
export function findMarker(yarray: import("../utils/types.js").YType, index: number): ArraySearchMarker | null;
|
|
13
|
+
export function updateMarkerChanges(searchMarker: Array<ArraySearchMarker>, index: number, len: number): void;
|
|
14
|
+
export function getTypeChildren(t: import("../utils/types.js").YType): Array<Item>;
|
|
15
|
+
export function callTypeObservers(type: import("../utils/types.js").YType, transaction: Transaction, event: YEvent<any>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Abstract Yjs Type class
|
|
18
|
+
* @template {delta.Delta<any,any,any,any,any>} [EventDelta=any]
|
|
19
|
+
* @template {AbstractType<any,any>} [Self=any]
|
|
20
|
+
*/
|
|
21
|
+
export class AbstractType<EventDelta extends delta.Delta<any, any, any, any, any> = any, Self extends AbstractType<any, any> = any> {
|
|
22
|
+
/**
|
|
23
|
+
* @type {Item|null}
|
|
24
|
+
*/
|
|
25
|
+
_item: Item | null;
|
|
26
|
+
/**
|
|
27
|
+
* @type {Map<string,Item>}
|
|
28
|
+
*/
|
|
29
|
+
_map: Map<string, Item>;
|
|
30
|
+
/**
|
|
31
|
+
* @type {Item|null}
|
|
32
|
+
*/
|
|
33
|
+
_start: Item | null;
|
|
34
|
+
/**
|
|
35
|
+
* @type {Doc|null}
|
|
36
|
+
*/
|
|
37
|
+
doc: Doc | null;
|
|
38
|
+
_length: number;
|
|
39
|
+
/**
|
|
40
|
+
* Event handlers
|
|
41
|
+
* @type {EventHandler<YEvent<Self>,Transaction>}
|
|
42
|
+
*/
|
|
43
|
+
_eH: EventHandler<YEvent<Self>, Transaction>;
|
|
44
|
+
/**
|
|
45
|
+
* Deep event handlers
|
|
46
|
+
* @type {EventHandler<Array<YEvent<any>>,Transaction>}
|
|
47
|
+
*/
|
|
48
|
+
_dEH: EventHandler<Array<YEvent<any>>, Transaction>;
|
|
49
|
+
/**
|
|
50
|
+
* @type {null | Array<ArraySearchMarker>}
|
|
51
|
+
*/
|
|
52
|
+
_searchMarker: null | Array<ArraySearchMarker>;
|
|
53
|
+
/**
|
|
54
|
+
* @type {EventDelta?}
|
|
55
|
+
*/
|
|
56
|
+
_prelim: EventDelta | null;
|
|
57
|
+
/**
|
|
58
|
+
* Returns a fresh delta that can be used to change this YType.
|
|
59
|
+
* @type {EventDelta}
|
|
60
|
+
*/
|
|
61
|
+
get change(): EventDelta;
|
|
62
|
+
/**
|
|
63
|
+
* @return {import('../utils/types.js').YType|null}
|
|
64
|
+
*/
|
|
65
|
+
get parent(): import("../utils/types.js").YType | null;
|
|
66
|
+
/**
|
|
67
|
+
* Integrate this type into the Yjs instance.
|
|
68
|
+
*
|
|
69
|
+
* * Save this struct in the os
|
|
70
|
+
* * This type is sent to other client
|
|
71
|
+
* * Observer functions are fired
|
|
72
|
+
*
|
|
73
|
+
* @param {Doc} y The Yjs instance
|
|
74
|
+
* @param {Item|null} item
|
|
75
|
+
*/
|
|
76
|
+
_integrate(y: Doc, item: Item | null): void;
|
|
77
|
+
/**
|
|
78
|
+
* @return {Self}
|
|
79
|
+
*/
|
|
80
|
+
_copy(): Self;
|
|
81
|
+
/**
|
|
82
|
+
* Makes a copy of this data type that can be included somewhere else.
|
|
83
|
+
*
|
|
84
|
+
* Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
|
|
85
|
+
*
|
|
86
|
+
* @return {Self}
|
|
87
|
+
*/
|
|
88
|
+
clone(): Self;
|
|
89
|
+
/**
|
|
90
|
+
* @param {UpdateEncoderV1 | UpdateEncoderV2} _encoder
|
|
91
|
+
*/
|
|
92
|
+
_write(_encoder: UpdateEncoderV1 | UpdateEncoderV2): void;
|
|
93
|
+
/**
|
|
94
|
+
* The first non-deleted item
|
|
95
|
+
*/
|
|
96
|
+
get _first(): Item | null;
|
|
97
|
+
/**
|
|
98
|
+
* Creates YEvent and calls all type observers.
|
|
99
|
+
* Must be implemented by each type.
|
|
100
|
+
*
|
|
101
|
+
* @param {Transaction} transaction
|
|
102
|
+
* @param {Set<null|string>} parentSubs Keys changed on this type. `null` if list was modified.
|
|
103
|
+
*/
|
|
104
|
+
_callObserver(transaction: Transaction, parentSubs: Set<null | string>): void;
|
|
105
|
+
/**
|
|
106
|
+
* Observe all events that are created on this type.
|
|
107
|
+
*
|
|
108
|
+
* @template {(target: YEvent<Self>, tr: Transaction) => void} F
|
|
109
|
+
* @param {F} f Observer function
|
|
110
|
+
* @return {F}
|
|
111
|
+
*/
|
|
112
|
+
observe<F extends (target: YEvent<Self>, tr: Transaction) => void>(f: F): F;
|
|
113
|
+
/**
|
|
114
|
+
* Observe all events that are created by this type and its children.
|
|
115
|
+
*
|
|
116
|
+
* @template {function(Array<YEvent<any>>,Transaction):void} F
|
|
117
|
+
* @param {F} f Observer function
|
|
118
|
+
* @return {F}
|
|
119
|
+
*/
|
|
120
|
+
observeDeep<F extends (arg0: Array<YEvent<any>>, arg1: Transaction) => void>(f: F): F;
|
|
121
|
+
/**
|
|
122
|
+
* Unregister an observer function.
|
|
123
|
+
*
|
|
124
|
+
* @param {(type:YEvent<Self>,tr:Transaction)=>void} f Observer function
|
|
125
|
+
*/
|
|
126
|
+
unobserve(f: (type: YEvent<Self>, tr: Transaction) => void): void;
|
|
127
|
+
/**
|
|
128
|
+
* Unregister an observer function.
|
|
129
|
+
*
|
|
130
|
+
* @param {function(Array<YEvent<any>>,Transaction):void} f Observer function
|
|
131
|
+
*/
|
|
132
|
+
unobserveDeep(f: (arg0: Array<YEvent<any>>, arg1: Transaction) => void): void;
|
|
133
|
+
/**
|
|
134
|
+
* @abstract
|
|
135
|
+
* @return {any}
|
|
136
|
+
*/
|
|
137
|
+
toJSON(): any;
|
|
138
|
+
/**
|
|
139
|
+
* Render the difference to another ydoc (which can be empty) and highlight the differences with
|
|
140
|
+
* attributions.
|
|
141
|
+
*
|
|
142
|
+
* Note that deleted content that was not deleted in prevYdoc is rendered as an insertion with the
|
|
143
|
+
* attribution `{ isDeleted: true, .. }`.
|
|
144
|
+
*
|
|
145
|
+
* @template {boolean} [Deep=false]
|
|
146
|
+
*
|
|
147
|
+
* @param {AbstractAttributionManager} am
|
|
148
|
+
* @param {Object} [opts]
|
|
149
|
+
* @param {import('../utils/IdSet.js').IdSet?} [opts.itemsToRender]
|
|
150
|
+
* @param {boolean} [opts.retainInserts] - if true, retain rendered inserts with attributions
|
|
151
|
+
* @param {boolean} [opts.retainDeletes] - if true, retain rendered+attributed deletes only
|
|
152
|
+
* @param {import('../utils/IdSet.js').IdSet?} [opts.deletedItems] - used for computing prevItem in attributes
|
|
153
|
+
* @param {Map<import('../utils/types.js').YType,Set<string|null>>|null} [opts.modified] - set of types that should be rendered as modified children
|
|
154
|
+
* @param {Deep} [opts.deep] - render child types as delta
|
|
155
|
+
* @return {Deep extends true ? ToDeepEventDelta<EventDelta> : EventDelta} The Delta representation of this type.
|
|
156
|
+
*
|
|
157
|
+
* @public
|
|
158
|
+
*/
|
|
159
|
+
public getContent<Deep extends boolean = false>(am?: AbstractAttributionManager, opts?: {
|
|
160
|
+
itemsToRender?: import("../internals.js").IdSet | null | undefined;
|
|
161
|
+
retainInserts?: boolean | undefined;
|
|
162
|
+
retainDeletes?: boolean | undefined;
|
|
163
|
+
deletedItems?: import("../internals.js").IdSet | null | undefined;
|
|
164
|
+
modified?: Map<AbstractType<any, any>, Set<string | null>> | null | undefined;
|
|
165
|
+
deep?: Deep | undefined;
|
|
166
|
+
}): Deep extends true ? ToDeepEventDelta<EventDelta> : EventDelta;
|
|
167
|
+
/**
|
|
168
|
+
* Render the difference to another ydoc (which can be empty) and highlight the differences with
|
|
169
|
+
* attributions.
|
|
170
|
+
*
|
|
171
|
+
* @param {AbstractAttributionManager} am
|
|
172
|
+
* @return {ToDeepEventDelta<EventDelta>}
|
|
173
|
+
*/
|
|
174
|
+
getContentDeep(am?: AbstractAttributionManager): ToDeepEventDelta<EventDelta>;
|
|
175
|
+
/**
|
|
176
|
+
* Apply a {@link Delta} on this shared type.
|
|
177
|
+
*
|
|
178
|
+
* @param {delta.Delta<any,any,any,any,any>} d The changes to apply on this element.
|
|
179
|
+
* @param {AbstractAttributionManager} am
|
|
180
|
+
*
|
|
181
|
+
* @public
|
|
182
|
+
*/
|
|
183
|
+
public applyDelta(d: delta.Delta<any, any, any, any, any>, am?: AbstractAttributionManager): void;
|
|
184
|
+
}
|
|
185
|
+
export function equalAttrs(a: any, b: any): boolean;
|
|
186
|
+
export function typeListSlice(type: AbstractType<any>, start: number, end: number): Array<any>;
|
|
187
|
+
export function typeListToArray(type: import("../utils/types.js").YType): Array<any>;
|
|
188
|
+
export function typeListToArraySnapshot(type: AbstractType<any>, snapshot: Snapshot): Array<any>;
|
|
189
|
+
export function typeListForEach(type: AbstractType<any>, f: (arg0: any, arg1: number, arg2: any) => void): void;
|
|
190
|
+
export function typeListMap<C, R>(type: AbstractType<any>, f: (arg0: C, arg1: number, arg2: AbstractType<any>) => R): Array<R>;
|
|
191
|
+
export function typeListCreateIterator(type: AbstractType): IterableIterator<any>;
|
|
192
|
+
export function typeListForEachSnapshot(type: AbstractType, f: (arg0: any, arg1: number, arg2: AbstractType) => void, snapshot: Snapshot): void;
|
|
193
|
+
export function typeListGet(type: import("../utils/types.js").YType, index: number): any;
|
|
194
|
+
export function typeListInsertGenericsAfter(transaction: Transaction, parent: YType_, referenceItem: Item | null, content: Array<_YValue>): void;
|
|
195
|
+
export function typeListInsertGenerics(transaction: Transaction, parent: YType_, index: number, content: Array<{
|
|
196
|
+
[x: string]: any;
|
|
197
|
+
} | Array<any> | number | null | string | Uint8Array>): void;
|
|
198
|
+
export function typeListPushGenerics(transaction: Transaction, parent: YType_, content: Array<{
|
|
199
|
+
[x: string]: any;
|
|
200
|
+
} | Array<any> | number | null | string | Uint8Array>): void;
|
|
201
|
+
export function typeListDelete(transaction: Transaction, parent: import("../utils/types.js").YType, index: number, length: number): void;
|
|
202
|
+
export function typeMapDelete(transaction: Transaction, parent: YType_, key: string): void;
|
|
203
|
+
export function typeMapSet(transaction: Transaction, parent: AbstractType, key: string, value: _YValue): void;
|
|
204
|
+
export function typeMapGet(parent: AbstractType<any, any>, key: string): {
|
|
205
|
+
[x: string]: any;
|
|
206
|
+
} | number | null | Array<any> | string | Uint8Array | AbstractType<any> | undefined;
|
|
207
|
+
export function typeMapGetAll(parent: AbstractType<any>): {
|
|
208
|
+
[x: string]: string | number | any[] | Uint8Array<ArrayBufferLike> | AbstractType<any, any> | {
|
|
209
|
+
[x: string]: any;
|
|
210
|
+
} | null | undefined;
|
|
211
|
+
};
|
|
212
|
+
export function typeMapGetDelta<TypeDelta extends delta.DeltaBuilder<any, any, any, any>>(d: TypeDelta, parent: YType_, attrsToRender: Set<string | null> | null, am: import("../internals.js").AbstractAttributionManager, deep: boolean, modified?: Set<import("../utils/types.js").YType> | Map<import("../utils/types.js").YType, any> | null, deletedItems?: import("../utils/IdSet.js").IdSet | null, itemsToRender?: import("../utils/IdSet.js").IdSet | null, opts?: any, optsAll?: any): void;
|
|
213
|
+
export function typeMapHas(parent: AbstractType<any>, key: string): boolean;
|
|
214
|
+
export function typeMapGetSnapshot(parent: AbstractType<any>, key: string, snapshot: Snapshot): {
|
|
215
|
+
[x: string]: any;
|
|
216
|
+
} | number | null | Array<any> | string | Uint8Array | AbstractType<any> | undefined;
|
|
217
|
+
export function typeMapGetAllSnapshot(parent: AbstractType<any>, snapshot: Snapshot): {
|
|
218
|
+
[x: string]: string | number | any[] | Uint8Array<ArrayBufferLike> | AbstractType<any, any> | {
|
|
219
|
+
[x: string]: any;
|
|
220
|
+
} | null | undefined;
|
|
221
|
+
};
|
|
222
|
+
export function createMapIterator(type: AbstractType<any> & {
|
|
223
|
+
_map: Map<string, Item>;
|
|
224
|
+
}): IterableIterator<Array<any>>;
|
|
225
|
+
export type YType_ = import("../utils/types.js").YType;
|
|
226
|
+
export type _YValue = import("../utils/types.js").YValue;
|
|
227
|
+
export type ToDeepEventDelta<D extends delta.Delta<any, any, any, any, any>> = D extends delta.Delta<infer N, infer Attrs, infer Cs, infer Text, any> ? delta.Delta<N, { [K in keyof Attrs]: TypeToDelta<Attrs[K]>; }, TypeToDelta<Cs>, Text> : D;
|
|
228
|
+
export type TypeToDelta<T extends unknown> = (Extract<T, AbstractType<any>> extends AbstractType<infer D> ? (unknown extends D ? never : ToDeepEventDelta<D>) : never) | Exclude<T, AbstractType<any>>;
|
|
229
|
+
import { Item } from '../internals.js';
|
|
230
|
+
import { Transaction } from '../internals.js';
|
|
231
|
+
import { YEvent } from '../internals.js';
|
|
232
|
+
import * as delta from 'lib0/delta';
|
|
233
|
+
import { Doc } from '../internals.js';
|
|
234
|
+
import { EventHandler } from '../internals.js';
|
|
235
|
+
import { UpdateEncoderV1 } from '../internals.js';
|
|
236
|
+
import { UpdateEncoderV2 } from '../internals.js';
|
|
237
|
+
import { AbstractAttributionManager } from '../internals.js';
|
|
238
|
+
import { Snapshot } from '../internals.js';
|
|
239
|
+
//# sourceMappingURL=AbstractType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractType.d.ts","sourceRoot":"","sources":["../../../src/types/AbstractType.js"],"names":[],"mappings":"AA4CO,4CAAiH;AAaxH;IACE;;;OAGG;IACH,eAHW,IAAI,SACJ,MAAM,EAOhB;IAHC,QAAU;IACV,cAAkB;IAClB,kBAA8C;CAEjD;AAqDM,mCAHI,OAAO,mBAAmB,EAAE,KAAK,SACjC,MAAM,4BAyEhB;AAWM,kDAJI,KAAK,CAAC,iBAAiB,CAAC,SACxB,MAAM,OACN,MAAM,QAiChB;AAQM,mCAHI,OAAO,mBAAmB,EAAE,KAAK,GAChC,KAAK,CAAC,IAAI,CAAC,CAWtB;AAUM,wCAJI,OAAO,mBAAmB,EAAE,KAAK,eACjC,WAAW,SACV,MAAM,CAAC,GAAG,CAAC,QActB;AAED;;;;GAIG;AACH,0BAHiD,UAAU,SAA7C,KAAK,CAAC,KAAK,CAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,EAAC,GAAG,CAAE,QACT,IAAI,SAA5B,YAAY,CAAC,GAAG,EAAC,GAAG,CAAE;IAIhC;;OAEG;IACH,OAFU,IAAI,GAAC,IAAI,CAEF;IACjB;;OAEG;IACH,MAFU,GAAG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MAAM,KAAK,EAAC,MAAM,EAAE,EAAC,MAAM,IAAI,EAAC,GAAG,CAAC,GACxE,KAAK,CAAC,KAAK,CACT,CAAC,EACT,GAAW,CAAC,IAAI,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAE,EAC7C,WAAW,CAAC,EAAE,CAAC,EACf,IAAI,CACL,GACD,CAAC;wBAKW,CAAC,oBACP,CAAC,OAAO,CAAC,CAAC,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,OAAO,SAAS,CAAC,GAAG,KAAK,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,OAAO,CAAC,CAAC,EAAC,YAAY,CAAC,GAAG,CAAC,CAAC;qBAzvB7J,iBAAiB;4BAAjB,iBAAiB;uBAAjB,iBAAiB;uBAED,YAAY;oBAF5B,iBAAiB;6BAAjB,iBAAiB;gCAAjB,iBAAiB;gCAAjB,iBAAiB;2CAAjB,iBAAiB;yBAAjB,iBAAiB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A shared Array implementation.
|
|
3
|
+
* @template {import('../utils/types.js').YValue} T
|
|
4
|
+
* @extends {AbstractType<delta.ArrayDelta<T>,YArray<T>>}
|
|
5
|
+
* @implements {Iterable<T>}
|
|
6
|
+
*/
|
|
7
|
+
export class YArray<T extends import("../utils/types.js").YValue> extends AbstractType<delta.ArrayDelta<T>, YArray<T>> implements Iterable<T> {
|
|
8
|
+
/**
|
|
9
|
+
* Construct a new YArray containing the specified items.
|
|
10
|
+
* @template {import('../utils/types.js').YValue} T
|
|
11
|
+
* @param {Array<T>} items
|
|
12
|
+
* @return {YArray<T>}
|
|
13
|
+
*/
|
|
14
|
+
static from<T_1 extends import("../utils/types.js").YValue>(items: Array<T_1>): YArray<T_1>;
|
|
15
|
+
constructor();
|
|
16
|
+
/**
|
|
17
|
+
* @type {Array<any>?}
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private _prelimContent;
|
|
21
|
+
get length(): number;
|
|
22
|
+
/**
|
|
23
|
+
* Inserts new content at an index.
|
|
24
|
+
*
|
|
25
|
+
* Important: This function expects an array of content. Not just a content
|
|
26
|
+
* object. The reason for this "weirdness" is that inserting several elements
|
|
27
|
+
* is very efficient when it is done as a single operation.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* // Insert character 'a' at position 0
|
|
31
|
+
* yarray.insert(0, ['a'])
|
|
32
|
+
* // Insert numbers 1, 2 at position 1
|
|
33
|
+
* yarray.insert(1, [1, 2])
|
|
34
|
+
*
|
|
35
|
+
* @param {number} index The index to insert content at.
|
|
36
|
+
* @param {Array<T>} content The array of content
|
|
37
|
+
*/
|
|
38
|
+
insert(index: number, content: Array<T>): void;
|
|
39
|
+
/**
|
|
40
|
+
* Appends content to this YArray.
|
|
41
|
+
*
|
|
42
|
+
* @param {Array<T>} content Array of content to append.
|
|
43
|
+
*
|
|
44
|
+
* @todo Use the following implementation in all types.
|
|
45
|
+
*/
|
|
46
|
+
push(content: Array<T>): void;
|
|
47
|
+
/**
|
|
48
|
+
* Prepends content to this YArray.
|
|
49
|
+
*
|
|
50
|
+
* @param {Array<T>} content Array of content to prepend.
|
|
51
|
+
*/
|
|
52
|
+
unshift(content: Array<T>): void;
|
|
53
|
+
/**
|
|
54
|
+
* Deletes elements starting from an index.
|
|
55
|
+
*
|
|
56
|
+
* @param {number} index Index at which to start deleting elements
|
|
57
|
+
* @param {number} length The number of elements to remove. Defaults to 1.
|
|
58
|
+
*/
|
|
59
|
+
delete(index: number, length?: number): void;
|
|
60
|
+
/**
|
|
61
|
+
* Returns the i-th element from a YArray.
|
|
62
|
+
*
|
|
63
|
+
* @param {number} index The index of the element to return from the YArray
|
|
64
|
+
* @return {T}
|
|
65
|
+
*/
|
|
66
|
+
get(index: number): T;
|
|
67
|
+
/**
|
|
68
|
+
* Transforms this YArray to a JavaScript Array.
|
|
69
|
+
*
|
|
70
|
+
* @return {Array<T>}
|
|
71
|
+
*/
|
|
72
|
+
toArray(): Array<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Render the difference to another ydoc (which can be empty) and highlight the differences with
|
|
75
|
+
* attributions.
|
|
76
|
+
*
|
|
77
|
+
* Note that deleted content that was not deleted in prevYdoc is rendered as an insertion with the
|
|
78
|
+
* attribution `{ isDeleted: true, .. }`.
|
|
79
|
+
*
|
|
80
|
+
* @param {AbstractAttributionManager} am
|
|
81
|
+
* @return {delta.ArrayDelta<import('./AbstractType.js').TypeToDelta<T>>} The Delta representation of this type.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
public getContentDeep(am?: AbstractAttributionManager): delta.ArrayDelta<import("./AbstractType.js").TypeToDelta<T>>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns a portion of this YArray into a JavaScript Array selected
|
|
88
|
+
* from start to end (end not included).
|
|
89
|
+
*
|
|
90
|
+
* @param {number} [start]
|
|
91
|
+
* @param {number} [end]
|
|
92
|
+
* @return {Array<T>}
|
|
93
|
+
*/
|
|
94
|
+
slice(start?: number, end?: number): Array<T>;
|
|
95
|
+
/**
|
|
96
|
+
* Transforms this Shared Type to a JSON object.
|
|
97
|
+
*
|
|
98
|
+
* @return {Array<any>}
|
|
99
|
+
*/
|
|
100
|
+
toJSON(): Array<any>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns an Array with the result of calling a provided function on every
|
|
103
|
+
* element of this YArray.
|
|
104
|
+
*
|
|
105
|
+
* @template M
|
|
106
|
+
* @param {function(T,number,YArray<T>):M} f Function that produces an element of the new Array
|
|
107
|
+
* @return {Array<M>} A new array with each element being the result of the
|
|
108
|
+
* callback function
|
|
109
|
+
*/
|
|
110
|
+
map<M>(f: (arg0: T, arg1: number, arg2: YArray<T>) => M): Array<M>;
|
|
111
|
+
/**
|
|
112
|
+
* Executes a provided function once on every element of this YArray.
|
|
113
|
+
*
|
|
114
|
+
* @param {function(T,number,YArray<T>):void} f A function to execute on every element of this YArray.
|
|
115
|
+
*/
|
|
116
|
+
forEach(f: (arg0: T, arg1: number, arg2: YArray<T>) => void): void;
|
|
117
|
+
/**
|
|
118
|
+
* @return {IterableIterator<T>}
|
|
119
|
+
*/
|
|
120
|
+
[Symbol.iterator](): IterableIterator<T>;
|
|
121
|
+
}
|
|
122
|
+
export function readYArray(_decoder: UpdateDecoderV1 | UpdateDecoderV2): import("../utils/types.js").YType;
|
|
123
|
+
import * as delta from 'lib0/delta';
|
|
124
|
+
import { AbstractType } from '../internals.js';
|
|
125
|
+
import { AbstractAttributionManager } from '../internals.js';
|
|
126
|
+
import { UpdateDecoderV1 } from '../internals.js';
|
|
127
|
+
import { UpdateDecoderV2 } from '../internals.js';
|
|
128
|
+
//# sourceMappingURL=YArray.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YArray.d.ts","sourceRoot":"","sources":["../../../src/types/YArray.js"],"names":[],"mappings":"AAwBA;;;;;GAKG;AAGH,oBANkD,CAAC,SAAtC,OAAQ,mBAAmB,EAAE,MAAO,kEAEjC,QAAQ,CAAC,CAAC;IAkBxB;;;;;OAKG;IACH,wBAJa,OAAQ,mBAAmB,EAAE,MAAO,SACtC,KAAK,CAAC,GAAC,CAAC,GACP,MAAM,CAAC,GAAC,CAAC,CASpB;IA1BD,cAWC;IATC;;;OAGG;IACH,uBAAwB;IAyD1B,qBAGC;IAED;;;;;;;;;;;;;;;OAeG;IACH,cAHW,MAAM,WACN,KAAK,CAAC,CAAC,CAAC,QAUlB;IAED;;;;;;OAMG;IACH,cAJW,KAAK,CAAC,CAAC,CAAC,QAYlB;IAED;;;;OAIG;IACH,iBAFW,KAAK,CAAC,CAAC,CAAC,QAIlB;IAED;;;;;OAKG;IACH,cAHW,MAAM,WACN,MAAM,QAUhB;IAED;;;;;OAKG;IACH,WAHW,MAAM,GACL,CAAC,CAIZ;IAED;;;;OAIG;IACH,WAFY,KAAK,CAAC,CAAC,CAAC,CAInB;IAED;;;;;;;;;;;OAWG;IACH,2BALW,0BAA0B,GACzB,KAAK,CAAC,UAAU,CAAC,OAAO,mBAAmB,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,CAMvE;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,QACN,MAAM,GACL,KAAK,CAAC,CAAC,CAAC,CAInB;IAED;;;;OAIG;IACH,UAFY,KAAK,CAAC,GAAG,CAAC,CAIrB;IAED;;;;;;;;OAQG;IACH,IALa,CAAC,KACH,CAAS,IAAC,EAAD,CAAC,EAAC,IAAM,EAAN,MAAM,EAAC,IAAS,EAAT,MAAM,CAAC,CAAC,CAAC,KAAE,CAAC,GAC7B,KAAK,CAAC,CAAC,CAAC,CAKnB;IAED;;;;OAIG;IACH,WAFW,CAAS,IAAC,EAAD,CAAC,EAAC,IAAM,EAAN,MAAM,EAAC,IAAS,EAAT,MAAM,CAAC,CAAC,CAAC,KAAE,IAAI,QAI3C;IAED;;OAEG;IACH,qBAFY,gBAAgB,CAAC,CAAC,CAAC,CAI9B;CAQF;AASM,qCANI,eAAe,GAAG,eAAe,GAChC,OAAO,mBAAmB,EAAE,KAAK,CAKK;uBAvP3B,YAAY;6BAF5B,iBAAiB;2CAAjB,iBAAiB;gCAAjB,iBAAiB;gCAAjB,iBAAiB"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @template MapType
|
|
3
|
+
* A shared Map implementation.
|
|
4
|
+
*
|
|
5
|
+
* @extends AbstractType<delta.MapDelta<{[K in string]:MapType}>>
|
|
6
|
+
* @implements {Iterable<[string, MapType]>}
|
|
7
|
+
*/
|
|
8
|
+
export class YMap<MapType> extends AbstractType<delta.MapDelta<{
|
|
9
|
+
[x: string]: MapType;
|
|
10
|
+
}>, any> implements Iterable<[string, MapType]> {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param {Iterable<readonly [string, any]>=} entries - an optional iterable to initialize the YMap
|
|
14
|
+
*/
|
|
15
|
+
constructor(entries?: Iterable<readonly [string, any]> | undefined);
|
|
16
|
+
/**
|
|
17
|
+
* @type {Map<string,any>?}
|
|
18
|
+
* @private
|
|
19
|
+
*/
|
|
20
|
+
private _prelimContent;
|
|
21
|
+
/**
|
|
22
|
+
* Makes a copy of this data type that can be included somewhere else.
|
|
23
|
+
*
|
|
24
|
+
* Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
|
|
25
|
+
*
|
|
26
|
+
* @return {this}
|
|
27
|
+
*/
|
|
28
|
+
clone(): this;
|
|
29
|
+
/**
|
|
30
|
+
* Transforms this Shared Type to a JSON object.
|
|
31
|
+
*
|
|
32
|
+
* @return {Object<string,any>}
|
|
33
|
+
*/
|
|
34
|
+
toJSON(): {
|
|
35
|
+
[x: string]: any;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Returns the size of the YMap (count of key/value pairs)
|
|
39
|
+
*
|
|
40
|
+
* @return {number}
|
|
41
|
+
*/
|
|
42
|
+
get size(): number;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the keys for each element in the YMap Type.
|
|
45
|
+
*
|
|
46
|
+
* @return {IterableIterator<string>}
|
|
47
|
+
*/
|
|
48
|
+
keys(): IterableIterator<string>;
|
|
49
|
+
/**
|
|
50
|
+
* Returns the values for each element in the YMap Type.
|
|
51
|
+
*
|
|
52
|
+
* @return {IterableIterator<MapType>}
|
|
53
|
+
*/
|
|
54
|
+
values(): IterableIterator<MapType>;
|
|
55
|
+
/**
|
|
56
|
+
* Returns an Iterator of [key, value] pairs
|
|
57
|
+
*
|
|
58
|
+
* @return {IterableIterator<[string, MapType]>}
|
|
59
|
+
*/
|
|
60
|
+
entries(): IterableIterator<[string, MapType]>;
|
|
61
|
+
/**
|
|
62
|
+
* Executes a provided function on once on every key-value pair.
|
|
63
|
+
*
|
|
64
|
+
* @param {function(MapType,string,YMap<MapType>):void} f A function to execute on every element of this YArray.
|
|
65
|
+
*/
|
|
66
|
+
forEach(f: (arg0: MapType, arg1: string, arg2: YMap<MapType>) => void): void;
|
|
67
|
+
/**
|
|
68
|
+
* Remove a specified element from this YMap.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} key The key of the element to remove.
|
|
71
|
+
*/
|
|
72
|
+
delete(key: string): void;
|
|
73
|
+
/**
|
|
74
|
+
* Adds or updates an element with a specified key and value.
|
|
75
|
+
* @template {MapType} VAL
|
|
76
|
+
*
|
|
77
|
+
* @param {string} key The key of the element to add to this YMap
|
|
78
|
+
* @param {VAL} value The value of the element to add
|
|
79
|
+
* @return {VAL}
|
|
80
|
+
*/
|
|
81
|
+
set<VAL extends MapType>(key: string, value: VAL): VAL;
|
|
82
|
+
/**
|
|
83
|
+
* Returns a specified element from this YMap.
|
|
84
|
+
*
|
|
85
|
+
* @param {string} key
|
|
86
|
+
* @return {MapType|undefined}
|
|
87
|
+
*/
|
|
88
|
+
get(key: string): MapType | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Returns a boolean indicating whether the specified key exists or not.
|
|
91
|
+
*
|
|
92
|
+
* @param {string} key The key to test.
|
|
93
|
+
* @return {boolean}
|
|
94
|
+
*/
|
|
95
|
+
has(key: string): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* Removes all elements from this YMap.
|
|
98
|
+
*/
|
|
99
|
+
clear(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Returns an Iterator of [key, value] pairs
|
|
102
|
+
*
|
|
103
|
+
* @return {IterableIterator<[string, MapType]>}
|
|
104
|
+
*/
|
|
105
|
+
[Symbol.iterator](): IterableIterator<[string, MapType]>;
|
|
106
|
+
}
|
|
107
|
+
export function readYMap(_decoder: UpdateDecoderV1 | UpdateDecoderV2): import("../utils/types.js").YType;
|
|
108
|
+
import * as delta from 'lib0/delta';
|
|
109
|
+
import { AbstractType } from '../internals.js';
|
|
110
|
+
import { UpdateDecoderV1 } from '../internals.js';
|
|
111
|
+
import { UpdateDecoderV2 } from '../internals.js';
|
|
112
|
+
//# sourceMappingURL=YMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"YMap.d.ts","sourceRoot":"","sources":["../../../src/types/YMap.js"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AACH,kBANa,OAAO;;oBAIJ,QAAQ,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC;IAGxC;;;OAGG;IACH,sBAFW,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,YAAC,EAe3C;IAXC;;;OAGG;IACH,uBAA0B;IA2B5B;;;;;;OAMG;IACH,SAFY,IAAI,CAQf;IAED;;;;OAIG;IACH;;MAaC;IAED;;;;OAIG;IACH,YAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,QAFY,gBAAgB,CAAC,MAAM,CAAC,CAInC;IAED;;;;OAIG;IACH,UAFY,gBAAgB,CAAC,OAAO,CAAC,CAIpC;IAED;;;;OAIG;IACH,WAFY,gBAAgB,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAI9C;IAED;;;;OAIG;IACH,WAFW,CAAS,IAAO,EAAP,OAAO,EAAC,IAAM,EAAN,MAAM,EAAC,IAAa,EAAb,IAAI,CAAC,OAAO,CAAC,KAAE,IAAI,QASrD;IAWD;;;;OAIG;IACH,YAFW,MAAM,QAUhB;IAED;;;;;;;OAOG;IACH,IANuB,GAAG,SAAZ,OAAQ,OAEX,MAAM,SACN,GAAG,GACF,GAAG,CAWd;IAED;;;;;OAKG;IACH,SAHW,MAAM,GACL,OAAO,GAAC,SAAS,CAI5B;IAED;;;;;OAKG;IACH,SAHW,MAAM,GACL,OAAO,CAIlB;IAED;;OAEG;IACH,cAUC;IA5ED;;;;OAIG;IACH,qBAFY,gBAAgB,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAI9C;CA6EF;AASM,mCANI,eAAe,GAAG,eAAe,GAChC,OAAO,mBAAmB,EAAE,KAAK,CAKC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