@estiva-app/ui 0.72.0-widgets2.2 → 0.72.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/dist/CommentHighlights.d.ts +100 -0
- package/dist/CommentHighlights.d.ts.map +1 -0
- package/dist/ComposeBox.d.ts +55 -0
- package/dist/ComposeBox.d.ts.map +1 -0
- package/dist/ComposerTriggers.d.ts.map +1 -1
- package/dist/SelectionToolbar.d.ts +17 -1
- package/dist/SelectionToolbar.d.ts.map +1 -1
- package/dist/editor.d.ts +3 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +618 -217
- package/dist/editor.js.map +4 -4
- package/dist/index.js.map +1 -1
- package/dist/looks.d.ts +6 -0
- package/dist/looks.d.ts.map +1 -1
- package/package.json +1 -5
- package/registry.json +309 -3
- package/src/CommentHighlights.mdx +61 -0
- package/src/CommentHighlights.stories.tsx +72 -0
- package/src/CommentHighlights.test.ts +100 -0
- package/src/CommentHighlights.ts +413 -0
- package/src/ComposeBox.mdx +58 -0
- package/src/ComposeBox.stories.tsx +81 -0
- package/src/ComposeBox.tsx +183 -0
- package/src/ComposerTriggers.tsx +9 -3
- package/src/SelectionToolbar.actions.test.tsx +44 -0
- package/src/SelectionToolbar.mdx +1 -0
- package/src/SelectionToolbar.tsx +36 -2
- package/src/editor.ts +15 -1
- package/src/looks.ts +8 -0
- package/src/registry/app.test.ts +7 -1
- package/src/registry/registry.test.ts +6 -6
- package/stories/Choosing.mdx +2 -0
- package/dist/widgets-2/fixtures.d.ts +0 -102
- package/dist/widgets-2/fixtures.d.ts.map +0 -1
- package/dist/widgets-2/places.d.ts +0 -105
- package/dist/widgets-2/places.d.ts.map +0 -1
- package/dist/widgets-2/proposed.d.ts +0 -130
- package/dist/widgets-2/proposed.d.ts.map +0 -1
- package/dist/widgets-2.d.ts +0 -12
- package/dist/widgets-2.d.ts.map +0 -1
- package/dist/widgets-2.js +0 -585
- package/dist/widgets-2.js.map +0 -7
- package/src/widgets-2/fixtures.ts +0 -161
- package/src/widgets-2/places.tsx +0 -316
- package/src/widgets-2/proposed.tsx +0 -596
- package/src/widgets-2.ts +0 -11
- package/stories/widgets-2/ReadMe.mdx +0 -60
- package/stories/widgets-2/Widgets.stories.tsx +0 -504
- package/stories/widgets-2/today.tsx +0 -352
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { Editor } from '@tiptap/react';
|
|
2
|
+
import { Extension } from '@tiptap/core';
|
|
3
|
+
/**
|
|
4
|
+
* Comments on a selection, drawn where they are, from Katerina's Leaf prototype
|
|
5
|
+
* (9 October), with a run, whole blocks and changed words added for LEAF-7.
|
|
6
|
+
*
|
|
7
|
+
* A comment's place is the one SPEC §13.6 gives it: a run of blocks, and the
|
|
8
|
+
* words where the selection starts and where it ends as a quote. Words inside
|
|
9
|
+
* one block are quoted whole; a selection across blocks quotes its start in
|
|
10
|
+
* the first block and its end in the last; a selection of whole blocks quotes
|
|
11
|
+
* nothing and is about the blocks. Nothing is written into the document: the
|
|
12
|
+
* highlight is a decoration, so a save never carries it.
|
|
13
|
+
*
|
|
14
|
+
* Three places a comment can be in, as `@estiva-app/protocol`'s
|
|
15
|
+
* `resolveCommentAnchor` reads them:
|
|
16
|
+
* - **resolved** — its words are found (drawn on them), or it quotes none
|
|
17
|
+
* (drawn on its whole blocks);
|
|
18
|
+
* - **reworded** — its blocks are there and its words are not: nothing is
|
|
19
|
+
* drawn, and the comment stands beside its first block;
|
|
20
|
+
* - **detached** — none of its blocks is left.
|
|
21
|
+
*
|
|
22
|
+
* why: https://github.com/estiva-app/estiva-docs/blob/main/decisions/a-comment-remembers-where-its-selection-starts-and-ends.md
|
|
23
|
+
*/
|
|
24
|
+
/** The words a comment quotes: §13.6's `quote` tag. */
|
|
25
|
+
export interface CommentQuote {
|
|
26
|
+
/** The selection's words in one block, or its first words when it runs across blocks. */
|
|
27
|
+
start: string;
|
|
28
|
+
/** Its last words, in the run's last block. Absent: `start` is the whole selection. */
|
|
29
|
+
end?: string;
|
|
30
|
+
/** A few characters before `start`, only when the words repeat in their block. */
|
|
31
|
+
prefix?: string;
|
|
32
|
+
/** A few characters after the end, only when the words repeat in their block. */
|
|
33
|
+
suffix?: string;
|
|
34
|
+
}
|
|
35
|
+
/** One comment's place: the blocks it is anchored to and the words it is about. */
|
|
36
|
+
export interface CommentAnchor {
|
|
37
|
+
/** The thread's id. Clicks report it; `active` names it. */
|
|
38
|
+
id: string;
|
|
39
|
+
/** The run: the §13.3 block ids the comment's `block` tag lists, in order. */
|
|
40
|
+
blocks: readonly string[];
|
|
41
|
+
/** The words, as they were when the comment was written. Absent: the whole blocks. */
|
|
42
|
+
quote?: CommentQuote;
|
|
43
|
+
}
|
|
44
|
+
/** Where a comment is now, in document positions. */
|
|
45
|
+
export type CommentPlace =
|
|
46
|
+
/** Drawn: on its words (`words`), or on its whole blocks. */
|
|
47
|
+
{
|
|
48
|
+
state: 'resolved';
|
|
49
|
+
from: number;
|
|
50
|
+
to: number;
|
|
51
|
+
words: boolean;
|
|
52
|
+
}
|
|
53
|
+
/** Its blocks (`from`–`to`) are there, its words are not. Draw nothing; show the quote as the commenter's. */
|
|
54
|
+
| {
|
|
55
|
+
state: 'reworded';
|
|
56
|
+
from: number;
|
|
57
|
+
to: number;
|
|
58
|
+
}
|
|
59
|
+
/** None of its blocks is left. */
|
|
60
|
+
| {
|
|
61
|
+
state: 'detached';
|
|
62
|
+
};
|
|
63
|
+
declare module '@tiptap/core' {
|
|
64
|
+
interface EditorEvents {
|
|
65
|
+
/** A comment's highlight was clicked: `editor.on('commentSelect', ({ id }) => …)`. */
|
|
66
|
+
commentSelect: {
|
|
67
|
+
id: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export interface CommentHighlightsOptions {
|
|
72
|
+
/** A highlight was clicked: the thread to show. Or listen for the editor's `commentSelect`. */
|
|
73
|
+
onSelect: ((id: string) => void) | null;
|
|
74
|
+
}
|
|
75
|
+
/** The extension an editor registers to draw comments where they are. */
|
|
76
|
+
export declare const CommentHighlights: Extension<CommentHighlightsOptions, any>;
|
|
77
|
+
/** Draw these comments, `active` the one being read. */
|
|
78
|
+
export declare function setCommentAnchors(editor: Editor, anchors: readonly CommentAnchor[], active?: string | null): void;
|
|
79
|
+
/** Where a comment is now: on its words or blocks, beside its blocks with its words gone, or detached. */
|
|
80
|
+
export declare function commentPlace(editor: Editor, anchor: CommentAnchor): CommentPlace;
|
|
81
|
+
/**
|
|
82
|
+
* What a comment's card stands beside: its drawn highlight, or — its words
|
|
83
|
+
* gone — its first block. Null when it is detached.
|
|
84
|
+
*/
|
|
85
|
+
export declare function commentElement(editor: Editor, anchor: CommentAnchor): HTMLElement | null;
|
|
86
|
+
/** A quote in one line, as a card says it: its start and end words around an ellipsis. */
|
|
87
|
+
export declare function quoteText(quote: CommentQuote): string;
|
|
88
|
+
/** What a comment on the selection would carry: its run, and its words unless it covers whole blocks. */
|
|
89
|
+
export interface SelectionAnchor {
|
|
90
|
+
blocks: string[];
|
|
91
|
+
quote?: CommentQuote;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The anchor a comment on the selection carries, as §13.6 writes it: the
|
|
95
|
+
* selected blocks, and the selected words in one block or the words where it
|
|
96
|
+
* starts and ends across several. No quote when whole blocks are selected.
|
|
97
|
+
* Null when nothing is selected or a selected block has no id.
|
|
98
|
+
*/
|
|
99
|
+
export declare function anchorOfSelection(editor: Editor): SelectionAnchor | null;
|
|
100
|
+
//# sourceMappingURL=CommentHighlights.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommentHighlights.d.ts","sourceRoot":"","sources":["../src/CommentHighlights.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAKxC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,uDAAuD;AACvD,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AAG,IAAW,QAGhH;AAED,0GAA0G;AAC1G,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,YAAY,CAEhF;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,WAAW,GAAG,IAAI,CAOxF;AAED,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAErD;AA6BD,yGAAyG;AACzG,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,KAAK,CAAC,EAAE,YAAY,CAAA;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAqExE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { Extension } from '@tiptap/core';
|
|
3
|
+
import { type Editor } from '@tiptap/react';
|
|
4
|
+
import { type SelectionToolbarProps } from './SelectionToolbar';
|
|
5
|
+
/**
|
|
6
|
+
* The box a message, a reply or a comment is written in, from Katerina's Leaf
|
|
7
|
+
* prototype (9 October). Peek's `ComposeBox`, its look and its keys, with
|
|
8
|
+
* what only Peek knows left in Peek: drafts, uploads, highlights, its text
|
|
9
|
+
* format. The app makes the editor (its extensions are its own) and adds
|
|
10
|
+
* `ComposeKeys`; this draws the box around it and sends.
|
|
11
|
+
*/
|
|
12
|
+
/** The editor's own classes inside the box: Peek's, rich text with no outline. Put them in `editorProps.attributes.class`. */
|
|
13
|
+
export declare const COMPOSE_EDITOR_CLASSES: string;
|
|
14
|
+
type ComposeKeysStorage = {
|
|
15
|
+
send: (() => boolean) | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Enter sends; Shift+Enter is a new line — in a list a new item (or out of the
|
|
19
|
+
* list, on an empty one), in a quote a new line (or out of it, on an empty one).
|
|
20
|
+
* Peek's keys, as its ComposeBox has them. Enter while a `/`, `@` or `[` list is
|
|
21
|
+
* open picks a row instead. `ComposeBox` says what sending does.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ComposeKeys: Extension<Record<string, never>, ComposeKeysStorage>;
|
|
24
|
+
export interface ComposeBoxProps {
|
|
25
|
+
/** The app's editor, with `ComposeKeys` in its extensions and `COMPOSE_EDITOR_CLASSES` on it. `null` while it loads. */
|
|
26
|
+
editor: Editor | null;
|
|
27
|
+
/**
|
|
28
|
+
* Send what is written. The box empties afterwards — unless this returns
|
|
29
|
+
* `false`: nothing was sent, and the words stay.
|
|
30
|
+
*/
|
|
31
|
+
onSend: (editor: Editor) => void | boolean;
|
|
32
|
+
/** Said in the empty box: words, and a `Kbd` where a key helps ("type / for commands"). */
|
|
33
|
+
placeholder: ReactNode;
|
|
34
|
+
/** The tools under the text, left: `ToolbarButton`s (attach, highlight). One Tab stop. */
|
|
35
|
+
tools?: ReactNode;
|
|
36
|
+
/** What is attached, under the text: `AttachmentCard pending`s. */
|
|
37
|
+
attachments?: ReactNode;
|
|
38
|
+
/** Something to send even with no words — a file ready. */
|
|
39
|
+
ready?: boolean;
|
|
40
|
+
/** Sending waits — a file still uploading. */
|
|
41
|
+
holding?: boolean;
|
|
42
|
+
/** The bar down the text's left: an urgent mention or a highlight, as Peek draws it. */
|
|
43
|
+
marked?: boolean;
|
|
44
|
+
/** The selection strip's buttons: its marks, Link, and the app's own (`actions`). */
|
|
45
|
+
selection?: Pick<SelectionToolbarProps, 'marks' | 'link' | 'actions'>;
|
|
46
|
+
className?: string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The box for writing: the text, the selection strip over it, what is
|
|
50
|
+
* attached, the tools and Send. Enter sends (`ComposeKeys`), and so does the
|
|
51
|
+
* button.
|
|
52
|
+
*/
|
|
53
|
+
export declare function ComposeBox({ editor, onSend, placeholder, tools, attachments, ready, holding, marked, selection, className }: ComposeBoxProps): import("react").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AM,CAAA;CACnB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,KAAa,EAAE,OAAe,EAAE,MAAc,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE,eAAe,+BAgFpK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComposerTriggers.d.ts","sourceRoot":"","sources":["../src/ComposerTriggers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AAErD,OAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"ComposerTriggers.d.ts","sourceRoot":"","sources":["../src/ComposerTriggers.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,KAAK,MAAM,EAAE,MAAM,cAAc,CAAA;AAErD,OAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAOxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAmB,KAAK,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAmBhF,mCAAmC;AACnC,MAAM,WAAW,aAAa;IAC5B,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,kDAAkD;IAClD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,wFAAwF;IACxF,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,+EAA+E;IAC/E,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;AAED,sCAAsC;AACtC,eAAO,MAAM,YAAY,IAAI,CAAA;AAE7B,qF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,UAAqB,GAAG,YAAY,CAavE;AAED,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,CAM9D;AAMD,4FAA4F;AAC5F,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,EAAE,CAGpG;AAED,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,QAAQ,EAAE,SAAS,YAAY,EAAE,CAAA;CAClC;AAID;;;;GAIG;AACH,eAAO,MAAM,aAAa,sCAgCxB,CAAA"}
|
|
@@ -65,6 +65,22 @@ export interface SelectionToolbarProps {
|
|
|
65
65
|
* nothing.
|
|
66
66
|
*/
|
|
67
67
|
children?: ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* The app's own buttons after the marks, past a separator: "Comment". Each
|
|
70
|
+
* runs with the selection still in place, and the strip closes after it.
|
|
71
|
+
*/
|
|
72
|
+
actions?: readonly SelectionAction[];
|
|
73
|
+
}
|
|
74
|
+
/** One of the app's buttons in the strip. */
|
|
75
|
+
export interface SelectionAction {
|
|
76
|
+
/** Says what it does: the tooltip and the button's name. */
|
|
77
|
+
label: string;
|
|
78
|
+
/** A 16px icon. */
|
|
79
|
+
icon: ReactNode;
|
|
80
|
+
/** The keys that do the same, shown in the tooltip ("Mod-Shift-M"). */
|
|
81
|
+
keys?: string;
|
|
82
|
+
/** What it does, with the selection as it is. */
|
|
83
|
+
run: (editor: Editor) => void;
|
|
68
84
|
}
|
|
69
|
-
export declare function SelectionToolbar({ editor, marks, link, children }: SelectionToolbarProps): import("react").JSX.Element | null;
|
|
85
|
+
export declare function SelectionToolbar({ editor, marks, link, children, actions }: SelectionToolbarProps): import("react").JSX.Element | null;
|
|
70
86
|
//# sourceMappingURL=SelectionToolbar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionToolbar.d.ts","sourceRoot":"","sources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B;IACpC,2EAA2E;IAC3E,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,gFAAgF;IAChF,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB,+GAA+G;IAC/G,IAAI,CAAC,EAAE,OAAO,CAAA;IACd;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,eAAe,EAAE,CAAA;CACrC;AAED,6CAA6C;AAC7C,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAA;IACb,mBAAmB;IACnB,IAAI,EAAE,SAAS,CAAA;IACf,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,iDAAiD;IACjD,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,KAAuC,EAAE,IAAY,EAAE,QAAQ,EAAE,OAAY,EAAE,EAAE,qBAAqB,sCAuRhJ"}
|
package/dist/editor.d.ts
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* as the eslint ones are. The rest of the package it draws with — `Popover`,
|
|
8
8
|
* `Toolbar`, `MenuItem`, `SuggestionMenu` — is the main entry's own, not a copy.
|
|
9
9
|
*/
|
|
10
|
-
export { KeptSelection, SelectionToolbar, normalizeHref, type MarkId, type SelectionToolbarProps } from './SelectionToolbar';
|
|
10
|
+
export { KeptSelection, SelectionToolbar, keepSelection, releaseSelection, normalizeHref, type MarkId, type SelectionAction, type SelectionToolbarProps } from './SelectionToolbar';
|
|
11
|
+
export { ComposeBox, ComposeKeys, COMPOSE_EDITOR_CLASSES, type ComposeBoxProps } from './ComposeBox';
|
|
12
|
+
export { CommentHighlights, setCommentAnchors, commentPlace, commentElement, anchorOfSelection, quoteText, type CommentAnchor, type CommentHighlightsOptions, type CommentPlace, type CommentQuote, type SelectionAnchor, } from './CommentHighlights';
|
|
11
13
|
export { PastedImages, pastedImages, pastedImageName, type PastedImagesOptions, type ClipboardSource } from './PastedImages';
|
|
12
14
|
export { PastedMarkdown, type PastedMarkdownOptions } from './PastedMarkdown';
|
|
13
15
|
export { CodeBlockColours } from './CodeBlockColours';
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AACnL,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,cAAc,CAAA;AACpG,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAC7B,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC5H,OAAO,EAAE,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,C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