@kerebron/extension-basic-editor 0.8.4 → 0.8.6

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.
@@ -0,0 +1,634 @@
1
+ // Fork of https://code.haverbeke.berlin/prosemirror/prosemirror-history/
2
+ // @TODO: https://code.haverbeke.berlin/prosemirror/prosemirror-history/src/branch/main/test/test-history.ts
3
+
4
+ import { emptyRopeSequence, RopeSequence } from './RopeSequence.js';
5
+ import { Mapping, Step, StepMap, Transform } from 'prosemirror-transform';
6
+ import {
7
+ Command,
8
+ EditorState,
9
+ Plugin,
10
+ PluginKey,
11
+ SelectionBookmark,
12
+ Transaction,
13
+ } from 'prosemirror-state';
14
+
15
+ // ProseMirror's history isn't simply a way to roll back to a previous
16
+ // state, because ProseMirror supports applying changes without adding
17
+ // them to the history (for example during collaboration).
18
+ //
19
+ // To this end, each 'Branch' (one for the undo history and one for
20
+ // the redo history) keeps an array of 'Items', which can optionally
21
+ // hold a step (an actual undoable change), and always hold a position
22
+ // map (which is needed to move changes below them to apply to the
23
+ // current document).
24
+ //
25
+ // An item that has both a step and a selection bookmark is the start
26
+ // of an 'event' — a group of changes that will be undone or redone at
27
+ // once. (It stores only the bookmark, since that way we don't have to
28
+ // provide a document until the selection is actually applied, which
29
+ // is useful when compressing.)
30
+
31
+ // Used to schedule history compression
32
+ const max_empty_items = 500;
33
+
34
+ class Branch {
35
+ constructor(
36
+ readonly items: RopeSequence<Item>,
37
+ readonly eventCount: number,
38
+ ) {}
39
+
40
+ // Pop the latest event off the branch's history and apply it
41
+ // to a document transform.
42
+ popEvent(state: EditorState, preserveItems: boolean) {
43
+ if (this.eventCount == 0) return null;
44
+
45
+ let end = this.items.length;
46
+ for (;; end--) {
47
+ let next = this.items.get(end - 1)!;
48
+ if (next.selection) {
49
+ --end;
50
+ break;
51
+ }
52
+ }
53
+
54
+ let remap: Mapping | undefined, mapFrom: number | undefined;
55
+ if (preserveItems) {
56
+ remap = this.remapping(end, this.items.length);
57
+ mapFrom = remap.maps.length;
58
+ }
59
+ let transform = state.tr;
60
+ let selection: SelectionBookmark | undefined, remaining: Branch | undefined;
61
+ let addAfter: Item[] = [], addBefore: Item[] = [];
62
+
63
+ this.items.forEach(
64
+ (item, i) => {
65
+ if (!item.step) {
66
+ if (!remap) {
67
+ remap = this.remapping(end, i + 1);
68
+ mapFrom = remap.maps.length;
69
+ }
70
+ mapFrom!--;
71
+ addBefore.push(item);
72
+ return item;
73
+ }
74
+
75
+ if (remap) {
76
+ addBefore.push(new Item(item.map));
77
+ let step = item.step.map(remap.slice(mapFrom)), map;
78
+
79
+ if (step && transform.maybeStep(step).doc) {
80
+ map = transform.mapping.maps[transform.mapping.maps.length - 1];
81
+ addAfter.push(
82
+ new Item(
83
+ map,
84
+ undefined,
85
+ undefined,
86
+ addAfter.length + addBefore.length,
87
+ ),
88
+ );
89
+ }
90
+ mapFrom!--;
91
+ if (map) remap.appendMap(map, mapFrom);
92
+ } else {
93
+ transform.maybeStep(item.step);
94
+ }
95
+
96
+ if (item.selection) {
97
+ selection = remap
98
+ ? item.selection.map(remap.slice(mapFrom))
99
+ : item.selection;
100
+ remaining = new Branch(
101
+ this.items.slice(0, end).append(
102
+ addBefore.reverse().concat(addAfter),
103
+ ),
104
+ this.eventCount - 1,
105
+ );
106
+ return false;
107
+ }
108
+
109
+ return item;
110
+ },
111
+ this.items.length,
112
+ 0,
113
+ );
114
+
115
+ return { remaining: remaining!, transform, selection: selection! };
116
+ }
117
+
118
+ // Create a new branch with the given transform added.
119
+ addTransform(
120
+ transform: Transform,
121
+ selection: SelectionBookmark | undefined,
122
+ histOptions: Required<HistoryOptions>,
123
+ preserveItems: boolean,
124
+ ) {
125
+ let newItems = [], eventCount = this.eventCount;
126
+ let oldItems = this.items,
127
+ lastItem = !preserveItems && oldItems.length
128
+ ? oldItems.get(oldItems.length - 1)
129
+ : null;
130
+
131
+ for (let i = 0; i < transform.steps.length; i++) {
132
+ let step = transform.steps[i].invert(transform.docs[i]);
133
+ let item = new Item(transform.mapping.maps[i], step, selection), merged;
134
+ if (merged = lastItem && lastItem.merge(item)) {
135
+ item = merged;
136
+ if (i) newItems.pop();
137
+ else oldItems = oldItems.slice(0, oldItems.length - 1);
138
+ }
139
+ newItems.push(item);
140
+ if (selection) {
141
+ eventCount++;
142
+ selection = undefined;
143
+ }
144
+ if (!preserveItems) lastItem = item;
145
+ }
146
+ let overflow = eventCount - histOptions.depth;
147
+ if (overflow > DEPTH_OVERFLOW) {
148
+ oldItems = cutOffEvents(oldItems, overflow);
149
+ eventCount -= overflow;
150
+ }
151
+ return new Branch(oldItems.append(newItems), eventCount);
152
+ }
153
+
154
+ remapping(from: number, to: number): Mapping {
155
+ let maps = new Mapping();
156
+ this.items.forEach(
157
+ (item, i) => {
158
+ let mirrorPos =
159
+ item.mirrorOffset != null && i - item.mirrorOffset >= from
160
+ ? maps.maps.length - item.mirrorOffset
161
+ : undefined;
162
+ maps.appendMap(item.map, mirrorPos);
163
+ return item;
164
+ },
165
+ from,
166
+ to,
167
+ );
168
+ return maps;
169
+ }
170
+
171
+ addMaps(array: readonly StepMap[]) {
172
+ if (this.eventCount == 0) return this;
173
+ return new Branch(
174
+ this.items.append(array.map((map) => new Item(map))),
175
+ this.eventCount,
176
+ );
177
+ }
178
+
179
+ // When the collab module receives remote changes, the history has
180
+ // to know about those, so that it can adjust the steps that were
181
+ // rebased on top of the remote changes, and include the position
182
+ // maps for the remote changes in its array of items.
183
+ rebased(rebasedTransform: Transform, rebasedCount: number) {
184
+ if (!this.eventCount) return this;
185
+
186
+ let rebasedItems: Item[] = [],
187
+ start = Math.max(0, this.items.length - rebasedCount);
188
+
189
+ let mapping = rebasedTransform.mapping;
190
+ let newUntil = rebasedTransform.steps.length;
191
+ let eventCount = this.eventCount;
192
+ this.items.forEach((item) => {
193
+ if (item.selection) eventCount--;
194
+ return item;
195
+ }, start);
196
+
197
+ let iRebased = rebasedCount;
198
+ this.items.forEach((item) => {
199
+ let pos = mapping.getMirror(--iRebased);
200
+ if (pos == null) return false;
201
+ newUntil = Math.min(newUntil, pos);
202
+ let map = mapping.maps[pos];
203
+ if (item.step) {
204
+ let step = rebasedTransform.steps[pos].invert(
205
+ rebasedTransform.docs[pos],
206
+ );
207
+ let selection = item.selection &&
208
+ item.selection.map(mapping.slice(iRebased + 1, pos));
209
+ if (selection) eventCount++;
210
+ rebasedItems.push(new Item(map, step, selection));
211
+ } else {
212
+ rebasedItems.push(new Item(map));
213
+ }
214
+
215
+ return item;
216
+ }, start);
217
+
218
+ let newMaps = [];
219
+ for (let i = rebasedCount; i < newUntil; i++) {
220
+ newMaps.push(new Item(mapping.maps[i]));
221
+ }
222
+ let items = this.items.slice(0, start).append(newMaps).append(rebasedItems);
223
+ let branch = new Branch(items, eventCount);
224
+
225
+ if (branch.emptyItemCount() > max_empty_items) {
226
+ branch = branch.compress(this.items.length - rebasedItems.length);
227
+ }
228
+ return branch;
229
+ }
230
+
231
+ emptyItemCount() {
232
+ let count = 0;
233
+ this.items.forEach((item) => {
234
+ if (!item.step) count++;
235
+ return item;
236
+ });
237
+ return count;
238
+ }
239
+
240
+ // Compressing a branch means rewriting it to push the air (map-only
241
+ // items) out. During collaboration, these naturally accumulate
242
+ // because each remote change adds one. The `upto` argument is used
243
+ // to ensure that only the items below a given level are compressed,
244
+ // because `rebased` relies on a clean, untouched set of items in
245
+ // order to associate old items with rebased steps.
246
+ compress(upto = this.items.length) {
247
+ let remap = this.remapping(0, upto), mapFrom = remap.maps.length;
248
+ let items: Item[] = [], events = 0;
249
+ this.items.forEach(
250
+ (item, i) => {
251
+ if (i >= upto) {
252
+ items.push(item);
253
+ if (item.selection) events++;
254
+ } else if (item.step) {
255
+ let step = item.step.map(remap.slice(mapFrom)),
256
+ map = step && step.getMap();
257
+ mapFrom--;
258
+ if (map) remap.appendMap(map, mapFrom);
259
+ if (step) {
260
+ let selection = item.selection &&
261
+ item.selection.map(remap.slice(mapFrom));
262
+ if (selection) events++;
263
+ let newItem = new Item(map!.invert(), step, selection),
264
+ merged,
265
+ last = items.length - 1;
266
+ if (merged = items.length && items[last].merge(newItem)) {
267
+ items[last] = merged;
268
+ } else {
269
+ items.push(newItem);
270
+ }
271
+ }
272
+ } else if (item.map) {
273
+ mapFrom--;
274
+ }
275
+
276
+ return item;
277
+ },
278
+ this.items.length,
279
+ 0,
280
+ );
281
+ return new Branch(RopeSequence.from(items.reverse()), events);
282
+ }
283
+
284
+ static empty = new Branch(emptyRopeSequence(), 0);
285
+ }
286
+
287
+ function cutOffEvents(items: RopeSequence<Item>, n: number) {
288
+ let cutPoint: number | undefined;
289
+ items.forEach((item, i) => {
290
+ if (item.selection && (n-- == 0)) {
291
+ cutPoint = i;
292
+ return false;
293
+ }
294
+
295
+ return item;
296
+ });
297
+ return items.slice(cutPoint!);
298
+ }
299
+
300
+ class Item {
301
+ constructor(
302
+ // The (forward) step map for this item.
303
+ readonly map: StepMap,
304
+ // The inverted step
305
+ readonly step?: Step,
306
+ // If this is non-null, this item is the start of a group, and
307
+ // this selection is the starting selection for the group (the one
308
+ // that was active before the first step was applied)
309
+ readonly selection?: SelectionBookmark,
310
+ // If this item is the inverse of a previous mapping on the stack,
311
+ // this points at the inverse's offset
312
+ readonly mirrorOffset?: number,
313
+ ) {}
314
+
315
+ merge(other: Item) {
316
+ if (this.step && other.step && !other.selection) {
317
+ let step = other.step.merge(this.step);
318
+ if (step) return new Item(step.getMap().invert(), step, this.selection);
319
+ }
320
+ }
321
+ }
322
+
323
+ // The value of the state field that tracks undo/redo history for that
324
+ // state. Will be stored in the plugin state when the history plugin
325
+ // is active.
326
+ class HistoryState {
327
+ constructor(
328
+ readonly done: Branch,
329
+ readonly undone: Branch,
330
+ readonly prevRanges: readonly number[] | null,
331
+ readonly prevTime: number,
332
+ readonly prevComposition: number,
333
+ ) {}
334
+ }
335
+
336
+ const DEPTH_OVERFLOW = 20;
337
+
338
+ // Record a transformation in undo history.
339
+ function applyTransaction(
340
+ history: HistoryState,
341
+ state: EditorState,
342
+ tr: Transaction,
343
+ options: Required<HistoryOptions>,
344
+ ) {
345
+ let historyTr = tr.getMeta(historyKey), rebased;
346
+ if (historyTr) return historyTr.historyState;
347
+
348
+ if (tr.getMeta(closeHistoryKey)) {
349
+ history = new HistoryState(history.done, history.undone, null, 0, -1);
350
+ }
351
+
352
+ let appended = tr.getMeta('appendedTransaction');
353
+
354
+ if (tr.steps.length == 0) {
355
+ return history;
356
+ } else if (appended && appended.getMeta(historyKey)) {
357
+ if (appended.getMeta(historyKey).redo) {
358
+ return new HistoryState(
359
+ history.done.addTransform(
360
+ tr,
361
+ undefined,
362
+ options,
363
+ mustPreserveItems(state),
364
+ ),
365
+ history.undone,
366
+ rangesFor(tr.mapping.maps),
367
+ history.prevTime,
368
+ history.prevComposition,
369
+ );
370
+ } else {
371
+ return new HistoryState(
372
+ history.done,
373
+ history.undone.addTransform(
374
+ tr,
375
+ undefined,
376
+ options,
377
+ mustPreserveItems(state),
378
+ ),
379
+ null,
380
+ history.prevTime,
381
+ history.prevComposition,
382
+ );
383
+ }
384
+ } else if (
385
+ tr.getMeta('addToHistory') !== false &&
386
+ !(appended && appended.getMeta('addToHistory') === false)
387
+ ) {
388
+ // Group transforms that occur in quick succession into one event.
389
+ let composition = tr.getMeta('composition');
390
+ let newGroup = history.prevTime == 0 ||
391
+ (!appended && history.prevComposition != composition &&
392
+ (history.prevTime < (tr.time || 0) - options.newGroupDelay ||
393
+ !isAdjacentTo(tr, history.prevRanges!)));
394
+ let prevRanges = appended
395
+ ? mapRanges(history.prevRanges!, tr.mapping)
396
+ : rangesFor(tr.mapping.maps);
397
+ return new HistoryState(
398
+ history.done.addTransform(
399
+ tr,
400
+ newGroup ? state.selection.getBookmark() : undefined,
401
+ options,
402
+ mustPreserveItems(state),
403
+ ),
404
+ Branch.empty,
405
+ prevRanges,
406
+ tr.time,
407
+ composition == null ? history.prevComposition : composition,
408
+ );
409
+ } else if (rebased = tr.getMeta('rebased')) {
410
+ // Used by the collab module to tell the history that some of its
411
+ // content has been rebased.
412
+ return new HistoryState(
413
+ history.done.rebased(tr, rebased),
414
+ history.undone.rebased(tr, rebased),
415
+ mapRanges(history.prevRanges!, tr.mapping),
416
+ history.prevTime,
417
+ history.prevComposition,
418
+ );
419
+ } else {
420
+ return new HistoryState(
421
+ history.done.addMaps(tr.mapping.maps),
422
+ history.undone.addMaps(tr.mapping.maps),
423
+ mapRanges(history.prevRanges!, tr.mapping),
424
+ history.prevTime,
425
+ history.prevComposition,
426
+ );
427
+ }
428
+ }
429
+
430
+ function isAdjacentTo(transform: Transform, prevRanges: readonly number[]) {
431
+ if (!prevRanges) return false;
432
+ if (!transform.docChanged) return true;
433
+ let adjacent = false;
434
+ transform.mapping.maps[0].forEach((start, end) => {
435
+ for (let i = 0; i < prevRanges.length; i += 2) {
436
+ if (start <= prevRanges[i + 1] && end >= prevRanges[i]) {
437
+ adjacent = true;
438
+ }
439
+ }
440
+ });
441
+ return adjacent;
442
+ }
443
+
444
+ function rangesFor(maps: readonly StepMap[]) {
445
+ let result: number[] = [];
446
+ for (let i = maps.length - 1; i >= 0 && result.length == 0; i--) {
447
+ maps[i].forEach((_from, _to, from, to) => result.push(from, to));
448
+ }
449
+ return result;
450
+ }
451
+
452
+ function mapRanges(ranges: readonly number[], mapping: Mapping) {
453
+ if (!ranges) return null;
454
+ let result = [];
455
+ for (let i = 0; i < ranges.length; i += 2) {
456
+ let from = mapping.map(ranges[i], 1), to = mapping.map(ranges[i + 1], -1);
457
+ if (from <= to) result.push(from, to);
458
+ }
459
+ return result;
460
+ }
461
+
462
+ // Apply the latest event from one branch to the document and shift the event
463
+ // onto the other branch.
464
+ function histTransaction(
465
+ history: HistoryState,
466
+ state: EditorState,
467
+ redo: boolean,
468
+ ): Transaction | null {
469
+ let preserveItems = mustPreserveItems(state);
470
+ let histOptions = (historyKey.get(state)!.spec as any).config as Required<
471
+ HistoryOptions
472
+ >;
473
+ let pop = (redo ? history.undone : history.done).popEvent(
474
+ state,
475
+ preserveItems,
476
+ );
477
+ if (!pop) return null;
478
+
479
+ let selection = pop.selection!.resolve(pop.transform.doc);
480
+ let added = (redo ? history.done : history.undone).addTransform(
481
+ pop.transform,
482
+ state.selection.getBookmark(),
483
+ histOptions,
484
+ preserveItems,
485
+ );
486
+
487
+ let newHist = new HistoryState(
488
+ redo ? added : pop.remaining,
489
+ redo ? pop.remaining : added,
490
+ null,
491
+ 0,
492
+ -1,
493
+ );
494
+ return pop.transform.setSelection(selection).setMeta(historyKey, {
495
+ redo,
496
+ historyState: newHist,
497
+ });
498
+ }
499
+
500
+ let cachedPreserveItems = false,
501
+ cachedPreserveItemsPlugins: readonly Plugin[] | null = null;
502
+ // Check whether any plugin in the given state has a
503
+ // `historyPreserveItems` property in its spec, in which case we must
504
+ // preserve steps exactly as they came in, so that they can be
505
+ // rebased.
506
+ function mustPreserveItems(state: EditorState) {
507
+ let plugins = state.plugins;
508
+ if (cachedPreserveItemsPlugins != plugins) {
509
+ cachedPreserveItems = false;
510
+ cachedPreserveItemsPlugins = plugins;
511
+ for (let i = 0; i < plugins.length; i++) {
512
+ if ((plugins[i].spec as any).historyPreserveItems) {
513
+ cachedPreserveItems = true;
514
+ break;
515
+ }
516
+ }
517
+ }
518
+ return cachedPreserveItems;
519
+ }
520
+
521
+ /// Set a flag on the given transaction that will prevent further steps
522
+ /// from being appended to an existing history event (so that they
523
+ /// require a separate undo command to undo).
524
+ export function closeHistory(tr: Transaction) {
525
+ return tr.setMeta(closeHistoryKey, true);
526
+ }
527
+
528
+ const historyKey = new PluginKey('history');
529
+ const closeHistoryKey = new PluginKey('closeHistory');
530
+
531
+ interface HistoryOptions {
532
+ /// The amount of history events that are collected before the
533
+ /// oldest events are discarded. Defaults to 100.
534
+ depth?: number;
535
+
536
+ /// The delay between changes after which a new group should be
537
+ /// started. Defaults to 500 (milliseconds). Note that when changes
538
+ /// aren't adjacent, a new group is always started.
539
+ newGroupDelay?: number;
540
+ }
541
+
542
+ /// Returns a plugin that enables the undo history for an editor. The
543
+ /// plugin will track undo and redo stacks, which can be used with the
544
+ /// [`undo`](#history.undo) and [`redo`](#history.redo) commands.
545
+ ///
546
+ /// You can set an `"addToHistory"` [metadata
547
+ /// property](#state.Transaction.setMeta) of `false` on a transaction
548
+ /// to prevent it from being rolled back by undo.
549
+ export function history(config: HistoryOptions = {}): Plugin {
550
+ config = {
551
+ depth: config.depth || 100,
552
+ newGroupDelay: config.newGroupDelay || 500,
553
+ };
554
+
555
+ return new Plugin({
556
+ key: historyKey,
557
+
558
+ state: {
559
+ init() {
560
+ return new HistoryState(Branch.empty, Branch.empty, null, 0, -1);
561
+ },
562
+ apply(tr, hist, state) {
563
+ return applyTransaction(
564
+ hist,
565
+ state,
566
+ tr,
567
+ config as Required<HistoryOptions>,
568
+ );
569
+ },
570
+ },
571
+
572
+ config,
573
+
574
+ props: {
575
+ handleDOMEvents: {
576
+ beforeinput(view, e: Event) {
577
+ let inputType = (e as InputEvent).inputType;
578
+ let command = inputType == 'historyUndo'
579
+ ? undo
580
+ : inputType == 'historyRedo'
581
+ ? redo
582
+ : null;
583
+ if (!command || !view.editable) return false;
584
+ e.preventDefault();
585
+ return command(view.state, view.dispatch);
586
+ },
587
+ },
588
+ },
589
+ });
590
+ }
591
+
592
+ function buildCommand(redo: boolean, scroll: boolean): Command {
593
+ return (state, dispatch) => {
594
+ let hist = historyKey.getState(state);
595
+ if (!hist || (redo ? hist.undone : hist.done).eventCount == 0) return false;
596
+ if (dispatch) {
597
+ let tr = histTransaction(hist, state, redo);
598
+ if (tr) dispatch(scroll ? tr.scrollIntoView() : tr);
599
+ }
600
+ return true;
601
+ };
602
+ }
603
+
604
+ /// A command function that undoes the last change, if any.
605
+ export const undo = buildCommand(false, true);
606
+
607
+ /// A command function that redoes the last undone change, if any.
608
+ export const redo = buildCommand(true, true);
609
+
610
+ /// A command function that undoes the last change. Don't scroll the
611
+ /// selection into view.
612
+ export const undoNoScroll = buildCommand(false, false);
613
+
614
+ /// A command function that redoes the last undone change. Don't
615
+ /// scroll the selection into view.
616
+ export const redoNoScroll = buildCommand(true, false);
617
+
618
+ /// The amount of undoable events available in a given state.
619
+ export function undoDepth(state: EditorState) {
620
+ let hist = historyKey.getState(state);
621
+ return hist ? hist.done.eventCount : 0;
622
+ }
623
+
624
+ /// The amount of redoable events available in a given editor state.
625
+ export function redoDepth(state: EditorState) {
626
+ let hist = historyKey.getState(state);
627
+ return hist ? hist.undone.eventCount : 0;
628
+ }
629
+
630
+ /// Returns true if the given transaction was generated by the history
631
+ /// plugin.
632
+ export function isHistoryTransaction(tr: Transaction) {
633
+ return tr.getMeta(historyKey) != null;
634
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExtensionHistory.d.ts","sourceRoot":"","sources":["../src/ExtensionHistory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,OAAO,EAAE,KAAK,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,2BAA2B,CAAC;AAEnC,qBAAa,gBAAiB,SAAQ,SAAS;IAC7C,IAAI,SAAa;IAEjB,OAAO;;;MAGL;IAEO,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOlE,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAiBjD,qBAAqB,IAAI,MAAM,EAAE;CAK3C"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ExtensionHistory.js","sourceRoot":"","sources":["../src/ExtensionHistory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAG1D,OAAO,EAAmB,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAO9D,MAAM,OAAO,gBAAiB,SAAQ,SAAS;IAC7C,IAAI,GAAG,SAAS,CAAC;IAEjB,OAAO,GAAG;QACR,KAAK,EAAE,GAAG;QACV,aAAa,EAAE,GAAG;KACnB,CAAC;IAEO,mBAAmB,CAAC,MAAkB;QAC7C,OAAO;YACL,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;SACnB,CAAC;IACJ,CAAC;IAEQ,oBAAoB;QAC3B,uCAAuC;QACvC,MAAM,GAAG,GAAG,OAAO,SAAS,IAAI,WAAW;YACzC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC;YAChD,CAAC,CAAC,KAAK,CAAC;QAEV,MAAM,SAAS,GAAG;YAChB,OAAO,EAAE,MAAM;YACf,OAAO,EAAE,MAAM;SAChB,CAAC;QACF,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,SAAS,CAAC,OAAO,CAAC,GAAG,MAAM,CAAC;QAC9B,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAEQ,qBAAqB;QAC5B,OAAO;YACL,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;SACtB,CAAC;IACJ,CAAC;CACF"}