@tiptap/extension-list 3.20.1 → 3.20.3

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 (50) hide show
  1. package/package.json +5 -5
  2. package/src/item/list-item.ts +4 -3
  3. package/dist/bullet-list/index.cjs +0 -112
  4. package/dist/bullet-list/index.cjs.map +0 -1
  5. package/dist/bullet-list/index.d.cts +0 -51
  6. package/dist/bullet-list/index.d.ts +0 -51
  7. package/dist/bullet-list/index.js +0 -84
  8. package/dist/bullet-list/index.js.map +0 -1
  9. package/dist/index.cjs +0 -1128
  10. package/dist/index.cjs.map +0 -1
  11. package/dist/index.d.cts +0 -300
  12. package/dist/index.d.ts +0 -300
  13. package/dist/index.js +0 -1103
  14. package/dist/index.js.map +0 -1
  15. package/dist/item/index.cjs +0 -123
  16. package/dist/item/index.cjs.map +0 -1
  17. package/dist/item/index.d.cts +0 -29
  18. package/dist/item/index.d.ts +0 -29
  19. package/dist/item/index.js +0 -96
  20. package/dist/item/index.js.map +0 -1
  21. package/dist/keymap/index.cjs +0 -308
  22. package/dist/keymap/index.cjs.map +0 -1
  23. package/dist/keymap/index.d.cts +0 -63
  24. package/dist/keymap/index.d.ts +0 -63
  25. package/dist/keymap/index.js +0 -286
  26. package/dist/keymap/index.js.map +0 -1
  27. package/dist/kit/index.cjs +0 -1106
  28. package/dist/kit/index.cjs.map +0 -1
  29. package/dist/kit/index.d.cts +0 -212
  30. package/dist/kit/index.d.ts +0 -212
  31. package/dist/kit/index.js +0 -1093
  32. package/dist/kit/index.js.map +0 -1
  33. package/dist/ordered-list/index.cjs +0 -302
  34. package/dist/ordered-list/index.cjs.map +0 -1
  35. package/dist/ordered-list/index.d.cts +0 -52
  36. package/dist/ordered-list/index.d.ts +0 -52
  37. package/dist/ordered-list/index.js +0 -274
  38. package/dist/ordered-list/index.js.map +0 -1
  39. package/dist/task-item/index.cjs +0 -231
  40. package/dist/task-item/index.cjs.map +0 -1
  41. package/dist/task-item/index.d.cts +0 -53
  42. package/dist/task-item/index.d.ts +0 -53
  43. package/dist/task-item/index.js +0 -209
  44. package/dist/task-item/index.js.map +0 -1
  45. package/dist/task-list/index.cjs +0 -160
  46. package/dist/task-list/index.cjs.map +0 -1
  47. package/dist/task-list/index.d.cts +0 -34
  48. package/dist/task-list/index.d.ts +0 -34
  49. package/dist/task-list/index.js +0 -133
  50. package/dist/task-list/index.js.map +0 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-list",
3
3
  "description": "List extension for tiptap",
4
- "version": "3.20.1",
4
+ "version": "3.20.3",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -87,12 +87,12 @@
87
87
  "dist"
88
88
  ],
89
89
  "devDependencies": {
90
- "@tiptap/core": "^3.20.1",
91
- "@tiptap/pm": "^3.20.1"
90
+ "@tiptap/core": "^3.20.3",
91
+ "@tiptap/pm": "^3.20.3"
92
92
  },
93
93
  "peerDependencies": {
94
- "@tiptap/core": "^3.20.1",
95
- "@tiptap/pm": "^3.20.1"
94
+ "@tiptap/core": "^3.20.3",
95
+ "@tiptap/pm": "^3.20.3"
96
96
  },
97
97
  "repository": {
98
98
  "type": "git",
@@ -61,6 +61,7 @@ export const ListItem = Node.create<ListItemOptions>({
61
61
  return []
62
62
  }
63
63
 
64
+ const parseBlockChildren = helpers.parseBlockChildren ?? helpers.parseChildren
64
65
  let content: any[] = []
65
66
 
66
67
  if (token.tokens && token.tokens.length > 0) {
@@ -69,7 +70,7 @@ export const ListItem = Node.create<ListItemOptions>({
69
70
 
70
71
  if (hasParagraphTokens) {
71
72
  // If we have paragraph tokens, parse them as block elements
72
- content = helpers.parseChildren(token.tokens)
73
+ content = parseBlockChildren(token.tokens)
73
74
  } else {
74
75
  // Check if the first token is a text token with nested inline tokens
75
76
  const firstToken = token.tokens[0]
@@ -90,12 +91,12 @@ export const ListItem = Node.create<ListItemOptions>({
90
91
  // parse them as block elements and add them
91
92
  if (token.tokens.length > 1) {
92
93
  const remainingTokens = token.tokens.slice(1)
93
- const additionalContent = helpers.parseChildren(remainingTokens)
94
+ const additionalContent = parseBlockChildren(remainingTokens)
94
95
  content.push(...additionalContent)
95
96
  }
96
97
  } else {
97
98
  // Fallback: parse all tokens as block elements
98
- content = helpers.parseChildren(token.tokens)
99
+ content = parseBlockChildren(token.tokens)
99
100
  }
100
101
  }
101
102
  }
@@ -1,112 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/bullet-list/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- BulletList: () => BulletList,
24
- bulletListInputRegex: () => bulletListInputRegex
25
- });
26
- module.exports = __toCommonJS(index_exports);
27
-
28
- // src/bullet-list/bullet-list.ts
29
- var import_core = require("@tiptap/core");
30
- var ListItemName = "listItem";
31
- var TextStyleName = "textStyle";
32
- var bulletListInputRegex = /^\s*([-+*])\s$/;
33
- var BulletList = import_core.Node.create({
34
- name: "bulletList",
35
- addOptions() {
36
- return {
37
- itemTypeName: "listItem",
38
- HTMLAttributes: {},
39
- keepMarks: false,
40
- keepAttributes: false
41
- };
42
- },
43
- group: "block list",
44
- content() {
45
- return `${this.options.itemTypeName}+`;
46
- },
47
- parseHTML() {
48
- return [{ tag: "ul" }];
49
- },
50
- renderHTML({ HTMLAttributes }) {
51
- return ["ul", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
52
- },
53
- markdownTokenName: "list",
54
- parseMarkdown: (token, helpers) => {
55
- if (token.type !== "list" || token.ordered) {
56
- return [];
57
- }
58
- return {
59
- type: "bulletList",
60
- content: token.items ? helpers.parseChildren(token.items) : []
61
- };
62
- },
63
- renderMarkdown: (node, h) => {
64
- if (!node.content) {
65
- return "";
66
- }
67
- return h.renderChildren(node.content, "\n");
68
- },
69
- markdownOptions: {
70
- indentsContent: true
71
- },
72
- addCommands() {
73
- return {
74
- toggleBulletList: () => ({ commands, chain }) => {
75
- if (this.options.keepAttributes) {
76
- return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
77
- }
78
- return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
79
- }
80
- };
81
- },
82
- addKeyboardShortcuts() {
83
- return {
84
- "Mod-Shift-8": () => this.editor.commands.toggleBulletList()
85
- };
86
- },
87
- addInputRules() {
88
- let inputRule = (0, import_core.wrappingInputRule)({
89
- find: bulletListInputRegex,
90
- type: this.type
91
- });
92
- if (this.options.keepMarks || this.options.keepAttributes) {
93
- inputRule = (0, import_core.wrappingInputRule)({
94
- find: bulletListInputRegex,
95
- type: this.type,
96
- keepMarks: this.options.keepMarks,
97
- keepAttributes: this.options.keepAttributes,
98
- getAttributes: () => {
99
- return this.editor.getAttributes(TextStyleName);
100
- },
101
- editor: this.editor
102
- });
103
- }
104
- return [inputRule];
105
- }
106
- });
107
- // Annotate the CommonJS export names for ESM import in node:
108
- 0 && (module.exports = {
109
- BulletList,
110
- bulletListInputRegex
111
- });
112
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/bullet-list/index.ts","../../src/bullet-list/bullet-list.ts"],"sourcesContent":["export * from './bullet-list.js'\n","import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nconst ListItemName = 'listItem'\nconst TextStyleName = 'textStyle'\n\nexport interface BulletListOptions {\n /**\n * The node name for the list items\n * @default 'listItem'\n * @example 'paragraph'\n */\n itemTypeName: string\n\n /**\n * HTML attributes to add to the bullet list element\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n\n /**\n * Keep the marks when splitting the list\n * @default false\n * @example true\n */\n keepMarks: boolean\n\n /**\n * Keep the attributes when splitting the list\n * @default false\n * @example true\n */\n keepAttributes: boolean\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n bulletList: {\n /**\n * Toggle a bullet list\n */\n toggleBulletList: () => ReturnType\n }\n }\n}\n\n/**\n * Matches a bullet list to a dash or asterisk.\n */\nexport const bulletListInputRegex = /^\\s*([-+*])\\s$/\n\n/**\n * This extension allows you to create bullet lists.\n * This requires the ListItem extension\n * @see https://tiptap.dev/api/nodes/bullet-list\n * @see https://tiptap.dev/api/nodes/list-item.\n */\nexport const BulletList = Node.create<BulletListOptions>({\n name: 'bulletList',\n\n addOptions() {\n return {\n itemTypeName: 'listItem',\n HTMLAttributes: {},\n keepMarks: false,\n keepAttributes: false,\n }\n },\n\n group: 'block list',\n\n content() {\n return `${this.options.itemTypeName}+`\n },\n\n parseHTML() {\n return [{ tag: 'ul' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n markdownTokenName: 'list',\n\n parseMarkdown: (token, helpers) => {\n if (token.type !== 'list' || (token as any).ordered) {\n return []\n }\n\n return {\n type: 'bulletList',\n content: token.items ? helpers.parseChildren(token.items) : [],\n }\n },\n\n renderMarkdown: (node, h) => {\n if (!node.content) {\n return ''\n }\n\n return h.renderChildren(node.content, '\\n')\n },\n\n markdownOptions: {\n indentsContent: true,\n },\n\n addCommands() {\n return {\n toggleBulletList:\n () =>\n ({ commands, chain }) => {\n if (this.options.keepAttributes) {\n return chain()\n .toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)\n .updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName))\n .run()\n }\n return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),\n }\n },\n\n addInputRules() {\n let inputRule = wrappingInputRule({\n find: bulletListInputRegex,\n type: this.type,\n })\n\n if (this.options.keepMarks || this.options.keepAttributes) {\n inputRule = wrappingInputRule({\n find: bulletListInputRegex,\n type: this.type,\n keepMarks: this.options.keepMarks,\n keepAttributes: this.options.keepAttributes,\n getAttributes: () => {\n return this.editor.getAttributes(TextStyleName)\n },\n editor: this.editor,\n })\n }\n return [inputRule]\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAyD;AAEzD,IAAM,eAAe;AACrB,IAAM,gBAAgB;AA8Cf,IAAM,uBAAuB;AAQ7B,IAAM,aAAa,iBAAK,OAA0B;AAAA,EACvD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,cAAc;AAAA,MACd,gBAAgB,CAAC;AAAA,MACjB,WAAW;AAAA,MACX,gBAAgB;AAAA,IAClB;AAAA,EACF;AAAA,EAEA,OAAO;AAAA,EAEP,UAAU;AACR,WAAO,GAAG,KAAK,QAAQ,YAAY;AAAA,EACrC;AAAA,EAEA,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,KAAK,CAAC;AAAA,EACvB;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,UAAM,6BAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAC/E;AAAA,EAEA,mBAAmB;AAAA,EAEnB,eAAe,CAAC,OAAO,YAAY;AACjC,QAAI,MAAM,SAAS,UAAW,MAAc,SAAS;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;AAAA,IACH;AACA,WAAO,CAAC,SAAS;AAAA,EACnB;AACF,CAAC;","names":[]}
@@ -1,51 +0,0 @@
1
- import { Node } from '@tiptap/core';
2
-
3
- interface BulletListOptions {
4
- /**
5
- * The node name for the list items
6
- * @default 'listItem'
7
- * @example 'paragraph'
8
- */
9
- itemTypeName: string;
10
- /**
11
- * HTML attributes to add to the bullet list element
12
- * @default {}
13
- * @example { class: 'foo' }
14
- */
15
- HTMLAttributes: Record<string, any>;
16
- /**
17
- * Keep the marks when splitting the list
18
- * @default false
19
- * @example true
20
- */
21
- keepMarks: boolean;
22
- /**
23
- * Keep the attributes when splitting the list
24
- * @default false
25
- * @example true
26
- */
27
- keepAttributes: boolean;
28
- }
29
- declare module '@tiptap/core' {
30
- interface Commands<ReturnType> {
31
- bulletList: {
32
- /**
33
- * Toggle a bullet list
34
- */
35
- toggleBulletList: () => ReturnType;
36
- };
37
- }
38
- }
39
- /**
40
- * Matches a bullet list to a dash or asterisk.
41
- */
42
- declare const bulletListInputRegex: RegExp;
43
- /**
44
- * This extension allows you to create bullet lists.
45
- * This requires the ListItem extension
46
- * @see https://tiptap.dev/api/nodes/bullet-list
47
- * @see https://tiptap.dev/api/nodes/list-item.
48
- */
49
- declare const BulletList: Node<BulletListOptions, any>;
50
-
51
- export { BulletList, type BulletListOptions, bulletListInputRegex };
@@ -1,51 +0,0 @@
1
- import { Node } from '@tiptap/core';
2
-
3
- interface BulletListOptions {
4
- /**
5
- * The node name for the list items
6
- * @default 'listItem'
7
- * @example 'paragraph'
8
- */
9
- itemTypeName: string;
10
- /**
11
- * HTML attributes to add to the bullet list element
12
- * @default {}
13
- * @example { class: 'foo' }
14
- */
15
- HTMLAttributes: Record<string, any>;
16
- /**
17
- * Keep the marks when splitting the list
18
- * @default false
19
- * @example true
20
- */
21
- keepMarks: boolean;
22
- /**
23
- * Keep the attributes when splitting the list
24
- * @default false
25
- * @example true
26
- */
27
- keepAttributes: boolean;
28
- }
29
- declare module '@tiptap/core' {
30
- interface Commands<ReturnType> {
31
- bulletList: {
32
- /**
33
- * Toggle a bullet list
34
- */
35
- toggleBulletList: () => ReturnType;
36
- };
37
- }
38
- }
39
- /**
40
- * Matches a bullet list to a dash or asterisk.
41
- */
42
- declare const bulletListInputRegex: RegExp;
43
- /**
44
- * This extension allows you to create bullet lists.
45
- * This requires the ListItem extension
46
- * @see https://tiptap.dev/api/nodes/bullet-list
47
- * @see https://tiptap.dev/api/nodes/list-item.
48
- */
49
- declare const BulletList: Node<BulletListOptions, any>;
50
-
51
- export { BulletList, type BulletListOptions, bulletListInputRegex };
@@ -1,84 +0,0 @@
1
- // src/bullet-list/bullet-list.ts
2
- import { mergeAttributes, Node, wrappingInputRule } from "@tiptap/core";
3
- var ListItemName = "listItem";
4
- var TextStyleName = "textStyle";
5
- var bulletListInputRegex = /^\s*([-+*])\s$/;
6
- var BulletList = Node.create({
7
- name: "bulletList",
8
- addOptions() {
9
- return {
10
- itemTypeName: "listItem",
11
- HTMLAttributes: {},
12
- keepMarks: false,
13
- keepAttributes: false
14
- };
15
- },
16
- group: "block list",
17
- content() {
18
- return `${this.options.itemTypeName}+`;
19
- },
20
- parseHTML() {
21
- return [{ tag: "ul" }];
22
- },
23
- renderHTML({ HTMLAttributes }) {
24
- return ["ul", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
25
- },
26
- markdownTokenName: "list",
27
- parseMarkdown: (token, helpers) => {
28
- if (token.type !== "list" || token.ordered) {
29
- return [];
30
- }
31
- return {
32
- type: "bulletList",
33
- content: token.items ? helpers.parseChildren(token.items) : []
34
- };
35
- },
36
- renderMarkdown: (node, h) => {
37
- if (!node.content) {
38
- return "";
39
- }
40
- return h.renderChildren(node.content, "\n");
41
- },
42
- markdownOptions: {
43
- indentsContent: true
44
- },
45
- addCommands() {
46
- return {
47
- toggleBulletList: () => ({ commands, chain }) => {
48
- if (this.options.keepAttributes) {
49
- return chain().toggleList(this.name, this.options.itemTypeName, this.options.keepMarks).updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName)).run();
50
- }
51
- return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks);
52
- }
53
- };
54
- },
55
- addKeyboardShortcuts() {
56
- return {
57
- "Mod-Shift-8": () => this.editor.commands.toggleBulletList()
58
- };
59
- },
60
- addInputRules() {
61
- let inputRule = wrappingInputRule({
62
- find: bulletListInputRegex,
63
- type: this.type
64
- });
65
- if (this.options.keepMarks || this.options.keepAttributes) {
66
- inputRule = wrappingInputRule({
67
- find: bulletListInputRegex,
68
- type: this.type,
69
- keepMarks: this.options.keepMarks,
70
- keepAttributes: this.options.keepAttributes,
71
- getAttributes: () => {
72
- return this.editor.getAttributes(TextStyleName);
73
- },
74
- editor: this.editor
75
- });
76
- }
77
- return [inputRule];
78
- }
79
- });
80
- export {
81
- BulletList,
82
- bulletListInputRegex
83
- };
84
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/bullet-list/bullet-list.ts"],"sourcesContent":["import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nconst ListItemName = 'listItem'\nconst TextStyleName = 'textStyle'\n\nexport interface BulletListOptions {\n /**\n * The node name for the list items\n * @default 'listItem'\n * @example 'paragraph'\n */\n itemTypeName: string\n\n /**\n * HTML attributes to add to the bullet list element\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n\n /**\n * Keep the marks when splitting the list\n * @default false\n * @example true\n */\n keepMarks: boolean\n\n /**\n * Keep the attributes when splitting the list\n * @default false\n * @example true\n */\n keepAttributes: boolean\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n bulletList: {\n /**\n * Toggle a bullet list\n */\n toggleBulletList: () => ReturnType\n }\n }\n}\n\n/**\n * Matches a bullet list to a dash or asterisk.\n */\nexport const bulletListInputRegex = /^\\s*([-+*])\\s$/\n\n/**\n * This extension allows you to create bullet lists.\n * This requires the ListItem extension\n * @see https://tiptap.dev/api/nodes/bullet-list\n * @see https://tiptap.dev/api/nodes/list-item.\n */\nexport const BulletList = Node.create<BulletListOptions>({\n name: 'bulletList',\n\n addOptions() {\n return {\n itemTypeName: 'listItem',\n HTMLAttributes: {},\n keepMarks: false,\n keepAttributes: false,\n }\n },\n\n group: 'block list',\n\n content() {\n return `${this.options.itemTypeName}+`\n },\n\n parseHTML() {\n return [{ tag: 'ul' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['ul', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n markdownTokenName: 'list',\n\n parseMarkdown: (token, helpers) => {\n if (token.type !== 'list' || (token as any).ordered) {\n return []\n }\n\n return {\n type: 'bulletList',\n content: token.items ? helpers.parseChildren(token.items) : [],\n }\n },\n\n renderMarkdown: (node, h) => {\n if (!node.content) {\n return ''\n }\n\n return h.renderChildren(node.content, '\\n')\n },\n\n markdownOptions: {\n indentsContent: true,\n },\n\n addCommands() {\n return {\n toggleBulletList:\n () =>\n ({ commands, chain }) => {\n if (this.options.keepAttributes) {\n return chain()\n .toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)\n .updateAttributes(ListItemName, this.editor.getAttributes(TextStyleName))\n .run()\n }\n return commands.toggleList(this.name, this.options.itemTypeName, this.options.keepMarks)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-8': () => this.editor.commands.toggleBulletList(),\n }\n },\n\n addInputRules() {\n let inputRule = wrappingInputRule({\n find: bulletListInputRegex,\n type: this.type,\n })\n\n if (this.options.keepMarks || this.options.keepAttributes) {\n inputRule = wrappingInputRule({\n find: bulletListInputRegex,\n type: this.type,\n keepMarks: this.options.keepMarks,\n keepAttributes: this.options.keepAttributes,\n getAttributes: () => {\n return this.editor.getAttributes(TextStyleName)\n },\n editor: this.editor,\n })\n }\n return [inputRule]\n },\n})\n"],"mappings":";AAAA,SAAS,iBAAiB,MAAM,yBAAyB;AAEzD,IAAM,eAAe;AACrB,IAAM,gBAAgB;AA8Cf,IAAM,u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