@yurikilian/lex4 1.4.0 → 1.5.1

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.
Files changed (43) hide show
  1. package/README.md +6 -4
  2. package/dist/ast/inline-mapper.d.ts.map +1 -1
  3. package/dist/ast/types.d.ts +1 -1
  4. package/dist/ast/types.d.ts.map +1 -1
  5. package/dist/components/CanvasControls.d.ts.map +1 -1
  6. package/dist/components/HeaderFooterActions.d.ts.map +1 -1
  7. package/dist/components/HeaderFooterToggle.d.ts +1 -0
  8. package/dist/components/HeaderFooterToggle.d.ts.map +1 -1
  9. package/dist/components/Lex4Editor.d.ts.map +1 -1
  10. package/dist/components/Toolbar.d.ts.map +1 -1
  11. package/dist/context/document-context.d.ts +1 -0
  12. package/dist/context/document-context.d.ts.map +1 -1
  13. package/dist/context/document-provider.d.ts.map +1 -1
  14. package/dist/context/toolbar-config.d.ts +18 -0
  15. package/dist/context/toolbar-config.d.ts.map +1 -0
  16. package/dist/extensions/variables-extension.d.ts.map +1 -1
  17. package/dist/i18n/defaults.d.ts.map +1 -1
  18. package/dist/i18n/pt-BR.d.ts.map +1 -1
  19. package/dist/i18n/types.d.ts +25 -0
  20. package/dist/i18n/types.d.ts.map +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/lex4-editor.cjs +773 -178
  24. package/dist/lex4-editor.cjs.map +1 -1
  25. package/dist/lex4-editor.js +757 -162
  26. package/dist/lex4-editor.js.map +1 -1
  27. package/dist/lexical/commands/block-commands.d.ts +5 -0
  28. package/dist/lexical/commands/block-commands.d.ts.map +1 -0
  29. package/dist/lexical/theme.d.ts.map +1 -1
  30. package/dist/lexical/utils/import-document-content.d.ts +4 -0
  31. package/dist/lexical/utils/import-document-content.d.ts.map +1 -0
  32. package/dist/style.css +51 -23
  33. package/dist/types/editor-handle.d.ts +2 -0
  34. package/dist/types/editor-handle.d.ts.map +1 -1
  35. package/dist/types/editor-props.d.ts +16 -0
  36. package/dist/types/editor-props.d.ts.map +1 -1
  37. package/dist/utils/text-style.d.ts +7 -0
  38. package/dist/utils/text-style.d.ts.map +1 -0
  39. package/dist/variables/variable-formatting.d.ts +11 -0
  40. package/dist/variables/variable-formatting.d.ts.map +1 -0
  41. package/dist/variables/variable-node.d.ts +10 -2
  42. package/dist/variables/variable-node.d.ts.map +1 -1
  43. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ export type BlockType = 'paragraph' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
3
+ export declare function setBlockType(editor: LexicalEditor, blockType: BlockType): void;
4
+ export declare function getActiveBlockType(editor: LexicalEditor): BlockType;
5
+ //# sourceMappingURL=block-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-commands.d.ts","sourceRoot":"","sources":["../../../src/lexical/commands/block-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAMjB,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAc9E;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,CAiBnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lexical/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,kBA4B1B,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lexical/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,kBA6B1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ import { Lex4Document } from '../../types/document';
3
+ export declare function insertDocumentContent(editor: LexicalEditor, document: Lex4Document): boolean;
4
+ //# sourceMappingURL=import-document-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-document-content.d.ts","sourceRoot":"","sources":["../../../src/lexical/utils/import-document-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAOjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA6GzD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAiC5F"}
package/dist/style.css CHANGED
@@ -176,10 +176,10 @@
176
176
  .lex4-toolbar-row {
177
177
  display: flex;
178
178
  align-items: center;
179
- -moz-column-gap: 0.25rem;
180
- column-gap: 0.25rem;
179
+ -moz-column-gap: 0.375rem;
180
+ column-gap: 0.375rem;
181
181
  row-gap: 0.375rem;
182
- padding: 0.375rem 0.875rem;
182
+ padding: 0.5rem 0.875rem;
183
183
  flex-wrap: wrap;
184
184
  }
185
185
 
@@ -192,7 +192,11 @@
192
192
  .lex4-toolbar-group-gap {
193
193
  display: flex;
194
194
  align-items: center;
195
- gap: 0.25rem;
195
+ gap: 0.375rem;
196
+ }
197
+
198
+ .lex4-toolbar-group-block {
199
+ min-width: 9rem;
196
200
  }
197
201
 
198
202
  .lex4-toolbar-end {
@@ -207,7 +211,7 @@
207
211
  align-items: center;
208
212
  justify-content: center;
209
213
  gap: 0.5rem;
210
- height: 2rem;
214
+ height: 32px;
211
215
  padding: 0 0.75rem;
212
216
  border-radius: 0.375rem;
213
217
  border: 1px solid var(--color-input);
@@ -216,7 +220,7 @@
216
220
  font-size: 0.75rem;
217
221
  line-height: 1rem;
218
222
  font-weight: 500;
219
- transition: background-color 150ms, color 150ms, border-color 150ms;
223
+ transition: background-color 150ms, color 150ms, border-color 150ms, box-shadow 150ms;
220
224
  white-space: nowrap;
221
225
  }
222
226
 
@@ -240,15 +244,22 @@
240
244
  display: inline-flex;
241
245
  align-items: center;
242
246
  justify-content: center;
243
- height: 1.625rem;
244
- width: 1.625rem;
247
+ height: 32px;
248
+ width: 32px;
245
249
  border-radius: 0.375rem;
250
+ border: 1px solid transparent;
246
251
  color: var(--color-muted-foreground);
247
- transition: color 150ms, background-color 150ms;
252
+ transition: color 150ms, background-color 150ms, border-color 150ms, box-shadow 150ms;
248
253
  }
249
254
  .lex4-editor button.lex4-toolbar-btn svg {
250
255
  flex-shrink: 0;
251
256
  }
257
+ .lex4-editor button.lex4-toolbar-btn:focus-visible,
258
+ .lex4-editor button.lex4-toolbar-toggle-btn:focus-visible {
259
+ outline: none;
260
+ border-color: var(--color-ring);
261
+ box-shadow: 0 0 0 1px var(--color-ring);
262
+ }
252
263
  .lex4-editor button.lex4-toolbar-btn:hover:not(:disabled):not(.active) {
253
264
  background-color: var(--color-secondary);
254
265
  color: var(--color-foreground);
@@ -263,22 +274,24 @@
263
274
  }
264
275
 
265
276
  .lex4-toolbar-select {
266
- height: 1.75rem;
277
+ height: 32px;
267
278
  border-radius: 0.375rem;
268
- border: none;
279
+ border: 1px solid transparent;
269
280
  padding: 0 0.5rem;
270
281
  font-size: 0.75rem;
271
282
  line-height: 1rem;
272
283
  font-weight: 500;
273
- background-color: transparent;
284
+ background-color: var(--color-background);
274
285
  color: var(--color-foreground);
275
- transition: background-color 150ms;
286
+ transition: background-color 150ms, border-color 150ms, box-shadow 150ms;
276
287
  }
277
288
  .lex4-toolbar-select:hover {
278
289
  background-color: var(--color-secondary);
279
290
  }
280
- .lex4-toolbar-select:focus {
291
+ .lex4-toolbar-select:focus,
292
+ .lex4-toolbar-select:focus-visible {
281
293
  outline: none;
294
+ border-color: var(--color-ring);
282
295
  box-shadow: 0 0 0 1px var(--color-ring);
283
296
  }
284
297
 
@@ -287,6 +300,10 @@
287
300
  padding: 0 0.25rem;
288
301
  }
289
302
 
303
+ .lex4-toolbar-select-block {
304
+ min-width: 9rem;
305
+ }
306
+
290
307
  .lex4-toolbar-separator {
291
308
  margin: 0 0.25rem;
292
309
  height: 1.25rem;
@@ -303,7 +320,7 @@
303
320
  display: inline-flex;
304
321
  align-items: center;
305
322
  gap: 0.375rem;
306
- min-height: 1.75rem;
323
+ height: 32px;
307
324
  cursor: pointer;
308
325
  -webkit-user-select: none;
309
326
  -moz-user-select: none;
@@ -325,8 +342,8 @@
325
342
  .lex4-hf-switch {
326
343
  position: relative;
327
344
  display: inline-flex;
328
- height: 0.9375rem;
329
- width: 1.625rem;
345
+ height: 1rem;
346
+ width: 1.75rem;
330
347
  align-items: center;
331
348
  border-radius: 9999px;
332
349
  transition: background-color 200ms;
@@ -334,8 +351,8 @@
334
351
 
335
352
  .lex4-hf-switch-knob {
336
353
  display: inline-block;
337
- height: 0.6875rem;
338
- width: 0.6875rem;
354
+ height: 0.75rem;
355
+ width: 0.75rem;
339
356
  border-radius: 9999px;
340
357
  background-color: white;
341
358
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
@@ -344,7 +361,7 @@
344
361
  }
345
362
 
346
363
  .lex4-hf-switch[aria-checked="true"] .lex4-hf-switch-knob {
347
- transform: translateX(0.8125rem);
364
+ transform: translateX(0.875rem);
348
365
  }
349
366
 
350
367
  /* ── Settings menu (HF actions) ──────────────────────────── */
@@ -363,8 +380,8 @@
363
380
  }
364
381
 
365
382
  .lex4-editor button.lex4-settings-trigger-icon {
366
- width: 1.875rem;
367
- height: 1.875rem;
383
+ width: 32px;
384
+ height: 32px;
368
385
  justify-content: center;
369
386
  padding: 0;
370
387
  border-radius: 0.5rem;
@@ -925,7 +942,7 @@
925
942
  cursor: default;
926
943
  white-space: nowrap;
927
944
  margin: 0 0.125rem;
928
- transition: border-color 150ms, background-color 150ms;
945
+ transition: border-color 150ms, background-color 150ms, box-shadow 150ms;
929
946
  }
930
947
 
931
948
  .lex4-variable-chip::before {
@@ -942,6 +959,12 @@
942
959
  border-color: color-mix(in srgb, var(--lex4-variable-accent, var(--color-border-strong)) 40%, var(--color-border));
943
960
  }
944
961
 
962
+ .lex4-variable-chip-selected {
963
+ border-color: color-mix(in srgb, var(--lex4-variable-accent, var(--color-primary)) 45%, var(--color-primary));
964
+ background-color: color-mix(in srgb, var(--lex4-variable-bg, var(--color-secondary)) 72%, var(--color-selection-bg));
965
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 16%, transparent);
966
+ }
967
+
945
968
  /* ── Document view ───────────────────────────────────────── */
946
969
  .lex4-document-view {
947
970
  display: flex;
@@ -1025,6 +1048,11 @@
1025
1048
  font-weight: 500;
1026
1049
  }
1027
1050
 
1051
+ .lex4-heading-h6 {
1052
+ font-size: 0.9375rem;
1053
+ font-weight: 500;
1054
+ }
1055
+
1028
1056
  .lex4-text-bold {
1029
1057
  font-weight: 700;
1030
1058
  }
@@ -1,3 +1,4 @@
1
+ import { Lex4Document } from './document';
1
2
  /**
2
3
  * Imperative handle exposed by Lex4Editor via React ref.
3
4
  *
@@ -17,5 +18,6 @@
17
18
  export interface Lex4EditorHandle {
18
19
  setHistorySidebarOpen: (open: boolean) => void;
19
20
  toggleHistorySidebar: () => void;
21
+ insertDocumentContent: (document: Lex4Document) => boolean;
20
22
  }
21
23
  //# sourceMappingURL=editor-handle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-handle.d.ts","sourceRoot":"","sources":["../../src/types/editor-handle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC"}
1
+ {"version":3,"file":"editor-handle.d.ts","sourceRoot":"","sources":["../../src/types/editor-handle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,qBAAqB,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC;CAC5D"}
@@ -5,6 +5,20 @@ import { Lex4Translations } from '../i18n/types';
5
5
  type DeepPartial<T> = {
6
6
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
7
7
  };
8
+ export interface Lex4ToolbarControlConfig {
9
+ /** Controls whether the toolbar control is rendered. Defaults to true. */
10
+ visible?: boolean;
11
+ /** Controls whether the toolbar control renders its text label. Defaults to true. */
12
+ showLabel?: boolean;
13
+ }
14
+ export interface Lex4ToolbarConfig {
15
+ /** Configuration for the history toggle. */
16
+ history?: Lex4ToolbarControlConfig;
17
+ /** Configuration for the variables toggle provided by variablesExtension. */
18
+ variables?: Lex4ToolbarControlConfig;
19
+ /** Configuration for the header/footer toggle group. */
20
+ headerFooter?: Lex4ToolbarControlConfig;
21
+ }
8
22
  /** Public props for the Lex4Editor component */
9
23
  export interface Lex4EditorProps {
10
24
  /** Initial document state. Defaults to a single empty page. */
@@ -36,6 +50,8 @@ export interface Lex4EditorProps {
36
50
  * @example translations={{ toolbar: { undo: 'Desfazer' } }}
37
51
  */
38
52
  translations?: DeepPartial<Lex4Translations>;
53
+ /** Configuration for optional toolbar controls such as history and variables. */
54
+ toolbar?: Lex4ToolbarConfig;
39
55
  /** Additional CSS class for the editor root element */
40
56
  className?: string;
41
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor-props.d.ts","sourceRoot":"","sources":["../../src/types/editor-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,E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9G,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,YAAY,CAAC;QAAC,GAAG,EAAE,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAEvF;;;;OAIG;IACH,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC;IAE7B;;;OAGG;IACH,YAAY,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;IAE7C,iFAAiF;IACjF,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAE5B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,7 @@
1
+ export declare function extractStyleValue(style: string, property: string): string | undefined;
2
+ export declare function mergeStyleDeclaration(existingStyle: string, property: string, value: string): string;
3
+ export declare function extractFontFamilyFromStyle(style: string): string | undefined;
4
+ export declare function extractFontSizePtFromStyle(style: string): number | undefined;
5
+ export declare function mergeFontFamilyStyle(existingStyle: string, fontFamily: string): string;
6
+ export declare function mergeFontSizeStyle(existingStyle: string, size: number): string;
7
+ //# sourceMappingURL=text-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-style.d.ts","sourceRoot":"","sources":["../../src/utils/text-style.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIrF;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAQR;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5E;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9E"}
@@ -0,0 +1,11 @@
1
+ import { LexicalEditor, TextFormatType } from 'lexical';
2
+ import { VariableNode } from './variable-node';
3
+ export declare function getSelectedVariableNodes(editor: LexicalEditor): VariableNode[];
4
+ export declare function toggleSelectedVariableFormat(editor: LexicalEditor, format: TextFormatType): boolean;
5
+ export declare function applyFontFamilyToSelectedVariables(editor: LexicalEditor, fontFamily: string): boolean;
6
+ export declare function applyFontSizeToSelectedVariables(editor: LexicalEditor, size: number): boolean;
7
+ export declare function readSelectedVariableFormatting(editor: LexicalEditor): {
8
+ fontFamily?: string;
9
+ fontSize?: number;
10
+ };
11
+ //# sourceMappingURL=variable-formatting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variable-formatting.d.ts","sourceRoot":"","sources":["../../src/variables/variable-formatting.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAiCrE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,EAAE,CAa9E;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,cAAc,GACrB,OAAO,CAgBT;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAMT;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACX,OAAO,CAMT;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,aAAa,GAAG;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAWA"}
@@ -1,6 +1,8 @@
1
1
  import { DecoratorNode, DOMConversionMap, DOMExportOutput, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
2
2
  export type SerializedVariableNode = Spread<{
3
3
  variableKey: string;
4
+ format?: number;
5
+ style?: string;
4
6
  }, SerializedLexicalNode>;
5
7
  /**
6
8
  * VariableNode — a custom Lexical DecoratorNode that represents
@@ -14,10 +16,16 @@ export type SerializedVariableNode = Spread<{
14
16
  */
15
17
  export declare class VariableNode extends DecoratorNode<JSX.Element> {
16
18
  __variableKey: string;
19
+ __format: number;
20
+ __style: string;
17
21
  static getType(): string;
18
22
  static clone(node: VariableNode): VariableNode;
19
- constructor(variableKey: string, key?: NodeKey);
23
+ constructor(variableKey: string, format?: number, style?: string, key?: NodeKey);
20
24
  getVariableKey(): string;
25
+ getFormat(): number;
26
+ setFormat(format: number): this;
27
+ getStyle(): string;
28
+ setStyle(style: string): this;
21
29
  static importJSON(serializedNode: SerializedVariableNode): VariableNode;
22
30
  exportJSON(): SerializedVariableNode;
23
31
  createDOM(): HTMLElement;
@@ -29,6 +37,6 @@ export declare class VariableNode extends DecoratorNode<JSX.Element> {
29
37
  getTextContent(): string;
30
38
  decorate(): JSX.Element;
31
39
  }
32
- export declare function $createVariableNode(variableKey: string): VariableNode;
40
+ export declare function $createVariableNode(variableKey: string, format?: number, style?: string): VariableNode;
33
41
  export declare function $isVariableNode(node: LexicalNode | null | undefined): node is VariableNode;
34
42
  //# sourceMappingURL=variable-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable-node.d.ts","sourceRoot":"","sources":["../../src/variables/variable-node.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,sBAAsB,GAAG,MAAM,CACzC;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