@openleaf-editor/core 0.1.0-beta.2 → 0.1.0-beta.4
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/README.md +127 -0
- package/dist/autolink.d.ts +7 -4
- package/dist/autolink.d.ts.map +1 -1
- package/dist/autolink.js +90 -11
- package/dist/autolink.js.map +1 -1
- package/dist/command-helpers.d.ts +8 -0
- package/dist/command-helpers.d.ts.map +1 -0
- package/dist/command-helpers.js +36 -0
- package/dist/command-helpers.js.map +1 -0
- package/dist/commands.d.ts +21 -63
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +430 -346
- package/dist/commands.js.map +1 -1
- package/dist/css.d.ts +1 -175
- package/dist/css.d.ts.map +1 -1
- package/dist/css.js +1 -516
- package/dist/css.js.map +1 -1
- package/dist/disclosure.d.ts +21 -0
- package/dist/disclosure.d.ts.map +1 -0
- package/dist/disclosure.js +144 -0
- package/dist/disclosure.js.map +1 -0
- package/dist/elements.d.ts +2 -0
- package/dist/elements.d.ts.map +1 -0
- package/dist/elements.js +2 -0
- package/dist/elements.js.map +1 -0
- package/dist/embed.d.ts +1 -51
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +1 -115
- package/dist/embed.js.map +1 -1
- package/dist/errors.d.ts +38 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +40 -0
- package/dist/errors.js.map +1 -0
- package/dist/extensions.d.ts +46 -5
- package/dist/extensions.d.ts.map +1 -1
- package/dist/extensions.js +272 -52
- package/dist/extensions.js.map +1 -1
- package/dist/figure-drag.d.ts +26 -0
- package/dist/figure-drag.d.ts.map +1 -0
- package/dist/figure-drag.js +75 -0
- package/dist/figure-drag.js.map +1 -0
- package/dist/formats.d.ts.map +1 -1
- package/dist/formats.js +19 -7
- package/dist/formats.js.map +1 -1
- package/dist/gapcursor.d.ts +14 -0
- package/dist/gapcursor.d.ts.map +1 -0
- package/dist/gapcursor.js +17 -0
- package/dist/gapcursor.js.map +1 -0
- package/dist/html.d.ts +32 -2
- package/dist/html.d.ts.map +1 -1
- package/dist/html.js +185 -31
- package/dist/html.js.map +1 -1
- package/dist/index.d.ts +23 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -6
- package/dist/index.js.map +1 -1
- package/dist/insert-commands.d.ts +172 -0
- package/dist/insert-commands.d.ts.map +1 -0
- package/dist/insert-commands.js +560 -0
- package/dist/insert-commands.js.map +1 -0
- package/dist/isolating-selection.d.ts +59 -0
- package/dist/isolating-selection.d.ts.map +1 -0
- package/dist/isolating-selection.js +251 -0
- package/dist/isolating-selection.js.map +1 -0
- package/dist/noneditable.d.ts.map +1 -1
- package/dist/noneditable.js +18 -4
- package/dist/noneditable.js.map +1 -1
- package/dist/plugins.d.ts +20 -2
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +27 -2
- package/dist/plugins.js.map +1 -1
- package/dist/preserve.d.ts +48 -17
- package/dist/preserve.d.ts.map +1 -1
- package/dist/preserve.js +214 -43
- package/dist/preserve.js.map +1 -1
- package/dist/schema.d.ts +15 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +157 -28
- package/dist/schema.js.map +1 -1
- package/dist/structure.d.ts +32 -0
- package/dist/structure.d.ts.map +1 -1
- package/dist/structure.js +53 -10
- package/dist/structure.js.map +1 -1
- package/dist/tables.d.ts +47 -1
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +417 -40
- package/dist/tables.js.map +1 -1
- package/dist/testing.d.ts +3 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +3 -0
- package/dist/testing.js.map +1 -0
- package/dist/tokens.d.ts +8 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +54 -6
- package/dist/tokens.js.map +1 -1
- package/dist/url.d.ts +1 -25
- package/dist/url.d.ts.map +1 -1
- package/dist/url.js +1 -77
- package/dist/url.js.map +1 -1
- package/dist/visual-aids.d.ts +11 -1
- package/dist/visual-aids.d.ts.map +1 -1
- package/dist/visual-aids.js +124 -36
- package/dist/visual-aids.js.map +1 -1
- package/package.json +17 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
export { OpenLeafError, isOpenLeafError } from './errors.js';
|
|
1
2
|
export { baseSchema, coreMarks, coreNodes } from './schema.js';
|
|
2
3
|
export { ALIGNMENTS, COLOUR_PROPERTIES, FONT_FAMILIES, FONT_SIZE_PRESETS, INDENT_EM, INLINE_STYLE_PROPERTIES, LINE_HEIGHT_PRESETS, LIST_STYLES, MAX_INDENT, MODELLED_PROPERTIES, indentCss, indentLevels, isFullyModelledStyle, modelledValue, parseDeclarations, safeAlign, safeColor, safeDir, safeFontFamily, safeFontSize, safeLang, safeLineHeight, safeListStyle, serializeDeclarations, } from './css.js';
|
|
3
|
-
export { parseHtml, serializeHtml, roundTrip } from './html.js';
|
|
4
|
-
export { isLosslesslyUnwrappable,
|
|
4
|
+
export { MAX_PARSE_DEPTH, parseHtml, serializeHtml, roundTrip } from './html.js';
|
|
5
|
+
export { isLosslesslyUnwrappable,
|
|
6
|
+
// Required reading for plugin authors -- `docs/authoring-plugins.md` §4.1 tells
|
|
7
|
+
// a command to call this before touching a node, because editing inside
|
|
8
|
+
// preserved markup breaks the byte-identical promise the layer exists to keep.
|
|
9
|
+
// It was documented as mandatory and was not exported.
|
|
10
|
+
isInsidePreserved, unknownBlock, unknownInline, } from './preserve.js';
|
|
5
11
|
export { URL_ATTRIBUTES, isEventHandlerAttribute, isSafeUrl, safeUrlOrNull, } from './url.js';
|
|
6
|
-
export { EMBED_HOSTS, isAllowedEmbedSrc, safeAllowList, safeEmbedSrc, } from './embed.js';
|
|
12
|
+
export { EMBED_HOSTS, embedSrcFor, isAllowedEmbedSrc, safeAllowList, safeEmbedSrc, } from './embed.js';
|
|
7
13
|
export { IMAGE_ALIGNMENTS, IMAGE_ALIGN_CLASS, IMAGE_ALIGN_CLASSES, imageAlignFromClass, safeClassList, safeId, } from './tokens.js';
|
|
8
14
|
export {
|
|
9
15
|
// predicates
|
|
@@ -19,15 +25,37 @@ insertHorizontalRule, setDir, setHeading, setLineHeight, setParagraph, setTextAl
|
|
|
19
25
|
// lists
|
|
20
26
|
indent, indentListItem, outdent, outdentListItem, setListStyle, splitListItemCommand, toggleBulletList, toggleOrderedList,
|
|
21
27
|
// links and images
|
|
22
|
-
insertImage, setLink, unsetLink,
|
|
28
|
+
insertImage, selectedImage, selectedMedia, setLink, unsetLink, updateImage, updateMedia,
|
|
23
29
|
// history
|
|
24
30
|
redo, undo, } from './commands.js';
|
|
25
31
|
export { buildKeymap, shortcutFor, shortcuts, } from './keymap.js';
|
|
26
32
|
export { autolinkPlugin, hrefFromTypedUrl } from './autolink.js';
|
|
27
33
|
export { visualAidsPlugin } from './visual-aids.js';
|
|
34
|
+
export { disclosurePlugin } from './disclosure.js';
|
|
35
|
+
export { gapCursorPlugin } from './gapcursor.js';
|
|
36
|
+
export { clampIsolatingTextSelection, innermostIsolatingDepth, isolatingSelectionPlugin, textSelectionCrossesIsolating, } from './isolating-selection.js';
|
|
37
|
+
export { figureDragPlugin } from './figure-drag.js';
|
|
28
38
|
export { isNonEditableNode, nonEditablePlugin } from './noneditable.js';
|
|
29
39
|
export { activeBlockClass, carriedClass, formatParts, parseFormatList, setBlockClass, } from './formats.js';
|
|
30
40
|
export { createRegisteredPlugins, onEditorPluginsChange, registerEditorPlugin, } from './plugins.js';
|
|
31
|
-
|
|
32
|
-
|
|
41
|
+
// The table node specs themselves are no longer exported. They were raw,
|
|
42
|
+
// mutable `NodeSpec` objects, and a consumer holding one could edit the schema
|
|
43
|
+
// every editor on the page is built from. `coreSchema().nodes['table']` is the
|
|
44
|
+
// supported way to reach a table node type, and nothing outside this package
|
|
45
|
+
// ever imported the specs. `safeTableStyleValue` stays: the property dialogs in
|
|
46
|
+
// @openleaf-editor/plugins-table share it with the parse path, so a dialog
|
|
47
|
+
// writing attributes directly cannot disagree with the schema about an
|
|
48
|
+
// acceptable padding -- which is how `padding: 0;position:fixed;inset:0` got in.
|
|
49
|
+
export { safeTableStyleValue, tableCaptionPlugin } from './tables.js';
|
|
50
|
+
// `CARRIED_ATTR` is no longer exported. Its own docstring said "it is not for
|
|
51
|
+
// plugin authors", and it names an internal attribute slot whose contents the
|
|
52
|
+
// carry mechanism owns; a plugin writing to it corrupts the residue that keeps
|
|
53
|
+
// unmodelled attributes alive across a round trip.
|
|
54
|
+
export { coreSchema, createSchema,
|
|
55
|
+
// Kept, and both are load-bearing across a package boundary: the element
|
|
56
|
+
// subscribes to `onSchemaExtensionsChange` to warn about a schema that
|
|
57
|
+
// arrived too late, and `registeredSchemaExtensions` returns a fresh array
|
|
58
|
+
// rather than the registry, so it publishes what is installed without
|
|
59
|
+
// publishing the ability to change it.
|
|
60
|
+
onSchemaExtensionsChange, registerSchemaExtension, registeredSchemaExtensions, } from './extensions.js';
|
|
33
61
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,eAAe,EAA0B,MAAM,aAAa,CAAA;AACpF,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC9D,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,uBAAuB,EACvB,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,OAAO,EACP,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,cAAc,EACd,aAAa,EACb,qBAAqB,GAItB,MAAM,UAAU,CAAA;AACjB,OAAO,EA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;AACvE,2EAA2E;AAC3E,sEAAsE;AACtE,uCAAuC;AACvC,wBAAwB,EACxB,uBAAuB,EACvB,0BAA0B,GAE3B,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import type { Command, EditorState } from 'prosemirror-state';
|
|
2
|
+
import { type ImageAlign } from './tokens.js';
|
|
3
|
+
export interface LinkAttrs {
|
|
4
|
+
href: string;
|
|
5
|
+
title?: string | null;
|
|
6
|
+
target?: string | null;
|
|
7
|
+
rel?: string | null;
|
|
8
|
+
id?: string | null;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Apply or update a link across the selection.
|
|
12
|
+
*
|
|
13
|
+
* Removes any existing link first: without that, updating a link that only
|
|
14
|
+
* partially overlaps the selection leaves two adjacent links with different
|
|
15
|
+
* hrefs, which looks fine and is wrong.
|
|
16
|
+
*
|
|
17
|
+
* Declines an href the schema would refuse. The parse rule at `schema.ts:541`
|
|
18
|
+
* already rejects `javascript:`, but only on the way *in* -- so without this
|
|
19
|
+
* check the hostile href lives in the document, serializes into the bound
|
|
20
|
+
* textarea and is submitted. It disappears on the next parse, one round trip
|
|
21
|
+
* after the server stored it, which is the wrong side of the write.
|
|
22
|
+
*/
|
|
23
|
+
export declare function setLink(attrs: LinkAttrs): Command;
|
|
24
|
+
export declare const unsetLink: Command;
|
|
25
|
+
export interface ImageAttrs {
|
|
26
|
+
src: string;
|
|
27
|
+
alt?: string | null;
|
|
28
|
+
title?: string | null;
|
|
29
|
+
width?: string | null;
|
|
30
|
+
height?: string | null;
|
|
31
|
+
align?: ImageAlign | null;
|
|
32
|
+
className?: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* When present, the image is wrapped in `<figure>` with this caption.
|
|
35
|
+
* An empty string still wraps: a figure with no caption text is how an
|
|
36
|
+
* author says "this will have a caption" without writing one yet.
|
|
37
|
+
*/
|
|
38
|
+
caption?: string | null;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Insert an image, optionally wrapped in a captioned `<figure>`.
|
|
42
|
+
*
|
|
43
|
+
* Declines a `src` the schema would refuse, for the same reason `setLink` does:
|
|
44
|
+
* the parse rule only guards the way in, so an unchecked `javascript:` src is
|
|
45
|
+
* live in the document and submitted with the form before anything strips it.
|
|
46
|
+
*/
|
|
47
|
+
export declare function insertImage(attrs: ImageAttrs): Command;
|
|
48
|
+
export interface SelectedImage {
|
|
49
|
+
/** Document position of the `image` node, for `setNodeMarkup`. */
|
|
50
|
+
pos: number;
|
|
51
|
+
src: string;
|
|
52
|
+
alt: string | null;
|
|
53
|
+
title: string | null;
|
|
54
|
+
width: string | null;
|
|
55
|
+
height: string | null;
|
|
56
|
+
align: ImageAlign | null;
|
|
57
|
+
className: string | null;
|
|
58
|
+
/**
|
|
59
|
+
* Caption text when the image lives in a `<figure>`, including `''` for a
|
|
60
|
+
* figure whose figcaption is still empty. `null` means there is no figure.
|
|
61
|
+
*/
|
|
62
|
+
caption: string | null;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The image the selection is on, or null.
|
|
66
|
+
*
|
|
67
|
+
* A `NodeSelection` on `image` counts, and so does one on a `figure` that
|
|
68
|
+
* contains an image -- clicking the picture and clicking the figure around it
|
|
69
|
+
* are the same author intent. A caret beside an image is not: treating that as
|
|
70
|
+
* a selection would let the dialog retarget a neighbour when the author meant
|
|
71
|
+
* to insert, the same trap `selectedMedia` refuses.
|
|
72
|
+
*/
|
|
73
|
+
export declare function selectedImage(state: EditorState): SelectedImage | null;
|
|
74
|
+
/**
|
|
75
|
+
* Update the selected image in place.
|
|
76
|
+
*
|
|
77
|
+
* `setNodeMarkup` rather than replace-with-a-new-node: the surrounding
|
|
78
|
+
* `<figure>`, the author's `class`, and dimensions the dialog does not edit
|
|
79
|
+
* all survive a save that only changed the address or the alt text. Replacing
|
|
80
|
+
* the `NodeSelection` dropped every one of those, including the figcaption.
|
|
81
|
+
*
|
|
82
|
+
* Attributes omitted from `attrs` (`undefined`) stay as they were. `null` is
|
|
83
|
+
* an explicit clear -- except `src`, which must be a storeable address.
|
|
84
|
+
*/
|
|
85
|
+
export declare function updateImage(attrs: ImageAttrs): Command;
|
|
86
|
+
export declare function insertText(text: string): Command;
|
|
87
|
+
export declare const insertNonBreakingSpace: Command;
|
|
88
|
+
export declare const insertPageBreak: Command;
|
|
89
|
+
export declare function insertNamedAnchor(id: string): Command;
|
|
90
|
+
export declare function setHeadingId(id: string | null): Command;
|
|
91
|
+
export declare function insertDetails(summaryText?: string): Command;
|
|
92
|
+
/**
|
|
93
|
+
* One `<source>` row from the insert-media dialog.
|
|
94
|
+
*
|
|
95
|
+
* `type` is the MIME hint a browser uses to pick between alternatives without
|
|
96
|
+
* downloading them. It is optional because a dialog cannot always know it, and
|
|
97
|
+
* a `<source>` with no type is still a working source.
|
|
98
|
+
*/
|
|
99
|
+
export interface MediaSource {
|
|
100
|
+
src: string;
|
|
101
|
+
type?: string | null;
|
|
102
|
+
}
|
|
103
|
+
export interface MediaAttrs {
|
|
104
|
+
/**
|
|
105
|
+
* Optional, because a player may carry its addresses in `sources` instead --
|
|
106
|
+
* the source-only shape `mediaAttrs` accepts on parse. One or the other must
|
|
107
|
+
* be present; a player with neither has nothing to play.
|
|
108
|
+
*/
|
|
109
|
+
src?: string | null;
|
|
110
|
+
title?: string | null;
|
|
111
|
+
width?: string | null;
|
|
112
|
+
height?: string | null;
|
|
113
|
+
/**
|
|
114
|
+
* Omitted means different things on the two paths, deliberately. Inserting a
|
|
115
|
+
* player with no opinion gets controls, because a player nobody can start is
|
|
116
|
+
* not much of one. Updating one with no opinion changes nothing, because the
|
|
117
|
+
* caller did not ask to.
|
|
118
|
+
*/
|
|
119
|
+
controls?: boolean;
|
|
120
|
+
poster?: string | null;
|
|
121
|
+
allow?: string | null;
|
|
122
|
+
allowfullscreen?: boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Alternative addresses, stored as the `<source>` children of the player.
|
|
125
|
+
*
|
|
126
|
+
* Authoritative for `<source>` on an update: what is passed replaces what is
|
|
127
|
+
* there. Other furniture -- `<track>` captions -- is carried through, so a
|
|
128
|
+
* caller that cannot see them cannot delete them.
|
|
129
|
+
*/
|
|
130
|
+
sources?: readonly MediaSource[];
|
|
131
|
+
}
|
|
132
|
+
export declare function insertVideo(attrs: MediaAttrs): Command;
|
|
133
|
+
export declare function insertAudio(attrs: MediaAttrs): Command;
|
|
134
|
+
export interface SelectedMedia {
|
|
135
|
+
kind: 'video' | 'audio' | 'iframe';
|
|
136
|
+
/** Document position of the node, for `setNodeMarkup`. */
|
|
137
|
+
pos: number;
|
|
138
|
+
src: string | null;
|
|
139
|
+
title: string | null;
|
|
140
|
+
width: string | null;
|
|
141
|
+
height: string | null;
|
|
142
|
+
controls: boolean;
|
|
143
|
+
poster: string | null;
|
|
144
|
+
/** Alternative addresses read back out of the stored `<source>` children. */
|
|
145
|
+
sources: MediaSource[];
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The media node the selection is on, or null.
|
|
149
|
+
*
|
|
150
|
+
* Only a `NodeSelection` counts. A caret beside a player is not a selection of
|
|
151
|
+
* it, and treating it as one would let the dialog silently retarget: the author
|
|
152
|
+
* clicks away, opens the dialog expecting to insert, and edits the node they
|
|
153
|
+
* had selected a moment ago instead.
|
|
154
|
+
*/
|
|
155
|
+
export declare function selectedMedia(state: EditorState): SelectedMedia | null;
|
|
156
|
+
/**
|
|
157
|
+
* Update the selected media node in place.
|
|
158
|
+
*
|
|
159
|
+
* `setNodeMarkup` rather than replace-with-a-new-node: the position and the
|
|
160
|
+
* selection both survive, so the player the author was editing is still the
|
|
161
|
+
* selected one afterwards and a second edit does not have to find it again.
|
|
162
|
+
*/
|
|
163
|
+
export declare function updateMedia(attrs: MediaAttrs): Command;
|
|
164
|
+
export declare function insertIframe(attrs: MediaAttrs): Command;
|
|
165
|
+
/**
|
|
166
|
+
* Parse HTML against the live schema and insert it.
|
|
167
|
+
*
|
|
168
|
+
* Used by the snippet picker. The HTML still goes through the same parse
|
|
169
|
+
* pipeline as stored content, so a snippet cannot smuggle in a `<script>`.
|
|
170
|
+
*/
|
|
171
|
+
export declare function insertHtml(html: string): Command;
|
|
172
|
+
//# sourceMappingURL=insert-commands.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-commands.d.ts","sourceRoot":"","sources":["../src/insert-commands.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAM7D,OAAO,EAA8C,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AASzF,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CA0BjD;AAED,eAAO,MAAM,SAAS,EAAE,OAYvB,CAAA;AAED,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,KAAK,CAAC,EAAE,UAAU,GAAG,IAAI,CAAA;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,G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