@react-email/editor 0.0.0-canary.49

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 (80) hide show
  1. package/dist/columns-D1gzbJr5.cjs +404 -0
  2. package/dist/columns-TFI4L-IC.mjs +277 -0
  3. package/dist/columns-TFI4L-IC.mjs.map +1 -0
  4. package/dist/core/index.cjs +9 -0
  5. package/dist/core/index.d.cts +2 -0
  6. package/dist/core/index.d.mts +2 -0
  7. package/dist/core/index.mjs +4 -0
  8. package/dist/core-Dp3tVCOZ.mjs +156 -0
  9. package/dist/core-Dp3tVCOZ.mjs.map +1 -0
  10. package/dist/core-NV1Aun-R.cjs +173 -0
  11. package/dist/event-bus-BxVEXi1L.mjs +88 -0
  12. package/dist/event-bus-BxVEXi1L.mjs.map +1 -0
  13. package/dist/event-bus-WI0H5tIM.cjs +105 -0
  14. package/dist/extension-CfIsm0_p.cjs +1504 -0
  15. package/dist/extension-n2yYIR7e.mjs +1403 -0
  16. package/dist/extension-n2yYIR7e.mjs.map +1 -0
  17. package/dist/extensions/index.cjs +51 -0
  18. package/dist/extensions/index.d.cts +401 -0
  19. package/dist/extensions/index.d.cts.map +1 -0
  20. package/dist/extensions/index.d.mts +401 -0
  21. package/dist/extensions/index.d.mts.map +1 -0
  22. package/dist/extensions/index.mjs +5 -0
  23. package/dist/extensions-BsDsFFkk.mjs +1785 -0
  24. package/dist/extensions-BsDsFFkk.mjs.map +1 -0
  25. package/dist/extensions-D9BbHnEV.cjs +2029 -0
  26. package/dist/global-content-CaNsyaPw.mjs +78 -0
  27. package/dist/global-content-CaNsyaPw.mjs.map +1 -0
  28. package/dist/global-content-CxV8qpMp.cjs +89 -0
  29. package/dist/index-BMsf5s28.d.mts +194 -0
  30. package/dist/index-BMsf5s28.d.mts.map +1 -0
  31. package/dist/index-DNriNUPU.d.cts +194 -0
  32. package/dist/index-DNriNUPU.d.cts.map +1 -0
  33. package/dist/index.cjs +199 -0
  34. package/dist/index.css +1171 -0
  35. package/dist/index.css.map +1 -0
  36. package/dist/index.d.cts +43 -0
  37. package/dist/index.d.cts.map +1 -0
  38. package/dist/index.d.mts +43 -0
  39. package/dist/index.d.mts.map +1 -0
  40. package/dist/index.mjs +199 -0
  41. package/dist/index.mjs.map +1 -0
  42. package/dist/plugins/index.cjs +19 -0
  43. package/dist/plugins/index.d.cts +73 -0
  44. package/dist/plugins/index.d.cts.map +1 -0
  45. package/dist/plugins/index.d.mts +73 -0
  46. package/dist/plugins/index.d.mts.map +1 -0
  47. package/dist/plugins/index.mjs +3 -0
  48. package/dist/root-BWiLr5WO.mjs +2363 -0
  49. package/dist/root-BWiLr5WO.mjs.map +1 -0
  50. package/dist/root-Bm_YBU0n.cjs +2873 -0
  51. package/dist/set-text-alignment-BDkB4Vfh.mjs +19 -0
  52. package/dist/set-text-alignment-BDkB4Vfh.mjs.map +1 -0
  53. package/dist/set-text-alignment-BlyZq1GA.cjs +24 -0
  54. package/dist/styles-BBXVfEv-.mjs +223 -0
  55. package/dist/styles-BBXVfEv-.mjs.map +1 -0
  56. package/dist/styles-D5jB7Yx-.cjs +252 -0
  57. package/dist/types-B-hiUAR9.d.cts +47 -0
  58. package/dist/types-B-hiUAR9.d.cts.map +1 -0
  59. package/dist/types-J7sLqbPy.d.mts +47 -0
  60. package/dist/types-J7sLqbPy.d.mts.map +1 -0
  61. package/dist/ui/bubble-menu/bubble-menu.css +285 -0
  62. package/dist/ui/index.cjs +3052 -0
  63. package/dist/ui/index.d.cts +1220 -0
  64. package/dist/ui/index.d.cts.map +1 -0
  65. package/dist/ui/index.d.mts +1220 -0
  66. package/dist/ui/index.d.mts.map +1 -0
  67. package/dist/ui/index.mjs +2942 -0
  68. package/dist/ui/index.mjs.map +1 -0
  69. package/dist/ui/inspector/inspector.css +338 -0
  70. package/dist/ui/slash-command/slash-command.css +44 -0
  71. package/dist/ui/themes/default.css +1169 -0
  72. package/dist/utils/index.cjs +3 -0
  73. package/dist/utils/index.d.cts +7 -0
  74. package/dist/utils/index.d.cts.map +1 -0
  75. package/dist/utils/index.d.mts +7 -0
  76. package/dist/utils/index.d.mts.map +1 -0
  77. package/dist/utils/index.mjs +3 -0
  78. package/license.md +7 -0
  79. package/package.json +159 -0
  80. package/readme.md +69 -0
@@ -0,0 +1,19 @@
1
+ //#region src/utils/set-text-alignment.ts
2
+ function setTextAlignment(editor, alignment) {
3
+ const { from, to } = editor.state.selection;
4
+ const tr = editor.state.tr;
5
+ editor.state.doc.nodesBetween(from, to, (node, pos) => {
6
+ if (node.isTextblock) {
7
+ const prop = "align" in node.attrs ? "align" : "alignment";
8
+ tr.setNodeMarkup(pos, null, {
9
+ ...node.attrs,
10
+ [prop]: alignment
11
+ });
12
+ }
13
+ });
14
+ editor.view.dispatch(tr);
15
+ }
16
+
17
+ //#endregion
18
+ export { setTextAlignment as t };
19
+ //# sourceMappingURL=set-text-alignment-BDkB4Vfh.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-text-alignment-BDkB4Vfh.mjs","names":[],"sources":["../src/utils/set-text-alignment.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core';\n\nexport function setTextAlignment(editor: Editor, alignment: string) {\n const { from, to } = editor.state.selection;\n const tr = editor.state.tr;\n editor.state.doc.nodesBetween(from, to, (node, pos) => {\n if (node.isTextblock) {\n const prop = 'align' in node.attrs ? 'align' : 'alignment';\n tr.setNodeMarkup(pos, null, { ...node.attrs, [prop]: alignment });\n }\n });\n editor.view.dispatch(tr);\n}\n"],"mappings":";AAEA,SAAgB,iBAAiB,QAAgB,WAAmB;CAClE,MAAM,EAAE,MAAM,OAAO,OAAO,MAAM;CAClC,MAAM,KAAK,OAAO,MAAM;AACxB,QAAO,MAAM,IAAI,aAAa,MAAM,KAAK,MAAM,QAAQ;AACrD,MAAI,KAAK,aAAa;GACpB,MAAM,OAAO,WAAW,KAAK,QAAQ,UAAU;AAC/C,MAAG,cAAc,KAAK,MAAM;IAAE,GAAG,KAAK;KAAQ,OAAO;IAAW,CAAC;;GAEnE;AACF,QAAO,KAAK,SAAS,GAAG"}
@@ -0,0 +1,24 @@
1
+
2
+ //#region src/utils/set-text-alignment.ts
3
+ function setTextAlignment(editor, alignment) {
4
+ const { from, to } = editor.state.selection;
5
+ const tr = editor.state.tr;
6
+ editor.state.doc.nodesBetween(from, to, (node, pos) => {
7
+ if (node.isTextblock) {
8
+ const prop = "align" in node.attrs ? "align" : "alignment";
9
+ tr.setNodeMarkup(pos, null, {
10
+ ...node.attrs,
11
+ [prop]: alignment
12
+ });
13
+ }
14
+ });
15
+ editor.view.dispatch(tr);
16
+ }
17
+
18
+ //#endregion
19
+ Object.defineProperty(exports, 'setTextAlignment', {
20
+ enumerable: true,
21
+ get: function () {
22
+ return setTextAlignment;
23
+ }
24
+ });
@@ -0,0 +1,223 @@
1
+ //#region src/utils/styles.ts
2
+ const WHITE_SPACE_REGEX = /\s+/;
3
+ const BORDER_WIDTH_TO_STYLE = {
4
+ borderWidth: "borderStyle",
5
+ borderTopWidth: "borderTopStyle",
6
+ borderRightWidth: "borderRightStyle",
7
+ borderBottomWidth: "borderBottomStyle",
8
+ borderLeftWidth: "borderLeftStyle"
9
+ };
10
+ const jsToInlineCss = (styleObject) => {
11
+ const parts = [];
12
+ for (const key in styleObject) {
13
+ const value = styleObject[key];
14
+ if (value !== 0 && value !== void 0 && value !== null && value !== "") {
15
+ const formattedKey = key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
16
+ parts.push(`${formattedKey}:${value}`);
17
+ }
18
+ }
19
+ return parts.join(";") + (parts.length ? ";" : "");
20
+ };
21
+ const splitDeclarations = (input) => {
22
+ const results = [];
23
+ let current = "";
24
+ let depth = 0;
25
+ for (const char of input) {
26
+ if (char === "(") depth++;
27
+ if (char === ")") depth--;
28
+ if (char === ";" && depth === 0) {
29
+ results.push(current);
30
+ current = "";
31
+ } else current += char;
32
+ }
33
+ if (current) results.push(current);
34
+ return results;
35
+ };
36
+ const inlineCssToJs = (inlineStyle, options = {}) => {
37
+ const styleObject = {};
38
+ if (!inlineStyle || inlineStyle === "" || typeof inlineStyle === "object") return styleObject;
39
+ splitDeclarations(inlineStyle).forEach((style) => {
40
+ const trimmed = style.trim();
41
+ if (trimmed) {
42
+ const separatorIndex = trimmed.indexOf(":");
43
+ if (separatorIndex === -1) return;
44
+ const key = trimmed.slice(0, separatorIndex);
45
+ const valueTrimmed = trimmed.slice(separatorIndex + 1).trim();
46
+ if (!valueTrimmed) return;
47
+ const formattedKey = key.trim().replace(/-\w/g, (match) => match[1].toUpperCase());
48
+ styleObject[formattedKey] = options?.removeUnit ? valueTrimmed.replace(/px|%/g, "") : valueTrimmed;
49
+ }
50
+ });
51
+ return styleObject;
52
+ };
53
+ /**
54
+ * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.
55
+ * This prevents shorthand properties from overriding specific longhand properties in email clients.
56
+ *
57
+ * @param styles - Style object that may contain shorthand properties
58
+ * @returns New style object with shorthand properties expanded to longhand
59
+ *
60
+ * @example
61
+ * expandShorthandProperties({ margin: '0', paddingTop: '10px' })
62
+ * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }
63
+ */
64
+ function expandShorthandProperties(styles) {
65
+ if (!styles || typeof styles !== "object") return {};
66
+ const expanded = {};
67
+ for (const key in styles) {
68
+ const value = styles[key];
69
+ if (value === void 0 || value === null || value === "") continue;
70
+ switch (key) {
71
+ case "margin": {
72
+ const values = parseShorthandValue(value);
73
+ expanded.marginTop = values.top;
74
+ expanded.marginRight = values.right;
75
+ expanded.marginBottom = values.bottom;
76
+ expanded.marginLeft = values.left;
77
+ break;
78
+ }
79
+ case "padding": {
80
+ const values = parseShorthandValue(value);
81
+ expanded.paddingTop = values.top;
82
+ expanded.paddingRight = values.right;
83
+ expanded.paddingBottom = values.bottom;
84
+ expanded.paddingLeft = values.left;
85
+ break;
86
+ }
87
+ case "border": {
88
+ const values = convertBorderValue(value);
89
+ expanded.borderStyle = values.style;
90
+ expanded.borderWidth = values.width;
91
+ expanded.borderColor = values.color;
92
+ break;
93
+ }
94
+ case "borderTopLeftRadius":
95
+ case "borderTopRightRadius":
96
+ case "borderBottomLeftRadius":
97
+ case "borderBottomRightRadius":
98
+ expanded[key] = value;
99
+ if (styles.borderTopLeftRadius && styles.borderTopRightRadius && styles.borderBottomLeftRadius && styles.borderBottomRightRadius) {
100
+ const values = [
101
+ styles.borderTopLeftRadius,
102
+ styles.borderTopRightRadius,
103
+ styles.borderBottomLeftRadius,
104
+ styles.borderBottomRightRadius
105
+ ];
106
+ if (new Set(values).size === 1) expanded.borderRadius = values[0];
107
+ }
108
+ break;
109
+ default: expanded[key] = value;
110
+ }
111
+ }
112
+ return expanded;
113
+ }
114
+ /**
115
+ * Parses CSS shorthand value (1-4 values) into individual side values.
116
+ * Follows CSS specification for shorthand property value parsing.
117
+ *
118
+ * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')
119
+ * @returns Object with top, right, bottom, left values
120
+ */
121
+ function parseShorthandValue(value) {
122
+ const stringValue = String(value).trim();
123
+ const parts = stringValue.split(WHITE_SPACE_REGEX);
124
+ const len = parts.length;
125
+ if (len === 1) return {
126
+ top: parts[0],
127
+ right: parts[0],
128
+ bottom: parts[0],
129
+ left: parts[0]
130
+ };
131
+ if (len === 2) return {
132
+ top: parts[0],
133
+ right: parts[1],
134
+ bottom: parts[0],
135
+ left: parts[1]
136
+ };
137
+ if (len === 3) return {
138
+ top: parts[0],
139
+ right: parts[1],
140
+ bottom: parts[2],
141
+ left: parts[1]
142
+ };
143
+ if (len === 4) return {
144
+ top: parts[0],
145
+ right: parts[1],
146
+ bottom: parts[2],
147
+ left: parts[3]
148
+ };
149
+ return {
150
+ top: stringValue,
151
+ right: stringValue,
152
+ bottom: stringValue,
153
+ left: stringValue
154
+ };
155
+ }
156
+ function convertBorderValue(value) {
157
+ const stringValue = String(value).trim();
158
+ const parts = stringValue.split(WHITE_SPACE_REGEX);
159
+ switch (parts.length) {
160
+ case 1: return {
161
+ style: "solid",
162
+ width: parts[0],
163
+ color: "black"
164
+ };
165
+ case 2: return {
166
+ style: parts[1],
167
+ width: parts[0],
168
+ color: "black"
169
+ };
170
+ case 3: return {
171
+ style: parts[1],
172
+ width: parts[0],
173
+ color: parts[2]
174
+ };
175
+ case 4: return {
176
+ style: parts[1],
177
+ width: parts[0],
178
+ color: parts[2]
179
+ };
180
+ default: return {
181
+ style: "solid",
182
+ width: stringValue,
183
+ color: "black"
184
+ };
185
+ }
186
+ }
187
+ /**
188
+ * When a border-width is present but border-style is missing, browsers default
189
+ * to `none` and the border is invisible. This adds `solid` as a sensible
190
+ * fallback so borders show up immediately after setting a width.
191
+ */
192
+ function ensureBorderStyleFallback(styles) {
193
+ for (const [widthKey, styleKey] of Object.entries(BORDER_WIDTH_TO_STYLE)) {
194
+ const widthValue = styles[widthKey];
195
+ if (!widthValue || widthValue === "0" || widthValue === "0px") continue;
196
+ if (!styles[styleKey]) {
197
+ if (styleKey !== "borderStyle" && styles.borderStyle) continue;
198
+ styles[styleKey] = "solid";
199
+ }
200
+ }
201
+ return styles;
202
+ }
203
+ /**
204
+ * Resolves conflicts between reset styles and inline styles by expanding
205
+ * shorthand properties (margin, padding) to longhand before merging.
206
+ * This prevents shorthand properties from overriding specific longhand properties.
207
+ *
208
+ * @param resetStyles - Base reset styles that may contain shorthand properties
209
+ * @param inlineStyles - Inline styles that should override reset styles
210
+ * @returns Merged styles with inline styles taking precedence
211
+ */
212
+ function resolveConflictingStyles(resetStyles, inlineStyles) {
213
+ const expandedResetStyles = expandShorthandProperties(resetStyles);
214
+ const expandedInlineStyles = expandShorthandProperties(inlineStyles);
215
+ return {
216
+ ...expandedResetStyles,
217
+ ...expandedInlineStyles
218
+ };
219
+ }
220
+
221
+ //#endregion
222
+ export { resolveConflictingStyles as a, jsToInlineCss as i, expandShorthandProperties as n, inlineCssToJs as r, ensureBorderStyleFallback as t };
223
+ //# sourceMappingURL=styles-BBXVfEv-.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles-BBXVfEv-.mjs","names":[],"sources":["../src/utils/styles.ts"],"sourcesContent":["import type { CssJs } from '../plugins/email-theming/types';\n\nconst WHITE_SPACE_REGEX = /\\s+/;\n\nconst BORDER_WIDTH_TO_STYLE: Record<string, string> = {\n borderWidth: 'borderStyle',\n borderTopWidth: 'borderTopStyle',\n borderRightWidth: 'borderRightStyle',\n borderBottomWidth: 'borderBottomStyle',\n borderLeftWidth: 'borderLeftStyle',\n};\n\nexport const jsToInlineCss = (styleObject: { [key: string]: any }) => {\n const parts: string[] = [];\n\n for (const key in styleObject) {\n const value = styleObject[key];\n if (value !== 0 && value !== undefined && value !== null && value !== '') {\n const KEBAB_CASE_REGEX = /[A-Z]/g;\n const formattedKey = key.replace(\n KEBAB_CASE_REGEX,\n (match) => `-${match.toLowerCase()}`,\n );\n parts.push(`${formattedKey}:${value}`);\n }\n }\n\n return parts.join(';') + (parts.length ? ';' : '');\n};\n\nconst splitDeclarations = (input: string): string[] => {\n const results: string[] = [];\n let current = '';\n let depth = 0;\n\n for (const char of input) {\n if (char === '(') depth++;\n if (char === ')') depth--;\n\n if (char === ';' && depth === 0) {\n results.push(current);\n current = '';\n } else {\n current += char;\n }\n }\n\n if (current) results.push(current);\n return results;\n};\n\nexport const inlineCssToJs = (\n inlineStyle: string,\n options: { removeUnit?: boolean } = {},\n) => {\n const styleObject: { [key: string]: string } = {};\n\n if (!inlineStyle || inlineStyle === '' || typeof inlineStyle === 'object') {\n return styleObject;\n }\n\n splitDeclarations(inlineStyle).forEach((style: string) => {\n const trimmed = style.trim();\n if (trimmed) {\n const separatorIndex = trimmed.indexOf(':');\n if (separatorIndex === -1) return;\n\n const key = trimmed.slice(0, separatorIndex);\n const value = trimmed.slice(separatorIndex + 1);\n const valueTrimmed = value.trim();\n\n if (!valueTrimmed) {\n return;\n }\n\n const formattedKey = key\n .trim()\n .replace(/-\\w/g, (match) => match[1].toUpperCase());\n\n const UNIT_REGEX = /px|%/g;\n const sanitizedValue = options?.removeUnit\n ? valueTrimmed.replace(UNIT_REGEX, '')\n : valueTrimmed;\n\n styleObject[formattedKey] = sanitizedValue;\n }\n });\n\n return styleObject;\n};\n\n/**\n * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.\n * This prevents shorthand properties from overriding specific longhand properties in email clients.\n *\n * @param styles - Style object that may contain shorthand properties\n * @returns New style object with shorthand properties expanded to longhand\n *\n * @example\n * expandShorthandProperties({ margin: '0', paddingTop: '10px' })\n * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }\n */\nexport function expandShorthandProperties(\n styles: Record<string, string>,\n): Record<string, string> {\n if (!styles || typeof styles !== 'object') {\n return {};\n }\n\n const expanded: Record<string, any> = {};\n\n for (const key in styles) {\n const value = styles[key];\n if (value === undefined || value === null || value === '') {\n continue;\n }\n\n switch (key) {\n case 'margin': {\n const values = parseShorthandValue(value);\n expanded.marginTop = values.top;\n expanded.marginRight = values.right;\n expanded.marginBottom = values.bottom;\n expanded.marginLeft = values.left;\n break;\n }\n case 'padding': {\n const values = parseShorthandValue(value);\n expanded.paddingTop = values.top;\n expanded.paddingRight = values.right;\n expanded.paddingBottom = values.bottom;\n expanded.paddingLeft = values.left;\n break;\n }\n case 'border': {\n const values = convertBorderValue(value);\n expanded.borderStyle = values.style;\n expanded.borderWidth = values.width;\n expanded.borderColor = values.color;\n break;\n }\n case 'borderTopLeftRadius':\n case 'borderTopRightRadius':\n case 'borderBottomLeftRadius':\n case 'borderBottomRightRadius': {\n // Always preserve the longhand property\n expanded[key] = value;\n\n // When all four corners are present and identical, also add the shorthand\n if (\n styles.borderTopLeftRadius &&\n styles.borderTopRightRadius &&\n styles.borderBottomLeftRadius &&\n styles.borderBottomRightRadius\n ) {\n const values = [\n styles.borderTopLeftRadius,\n styles.borderTopRightRadius,\n styles.borderBottomLeftRadius,\n styles.borderBottomRightRadius,\n ];\n\n if (new Set(values).size === 1) {\n expanded.borderRadius = values[0];\n }\n }\n\n break;\n }\n\n default: {\n // Keep all other properties as-is\n expanded[key] = value;\n }\n }\n }\n\n return expanded;\n}\n\n/**\n * Parses CSS shorthand value (1-4 values) into individual side values.\n * Follows CSS specification for shorthand property value parsing.\n *\n * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')\n * @returns Object with top, right, bottom, left values\n */\nfunction parseShorthandValue(value: string | number): {\n top: string;\n right: string;\n bottom: string;\n left: string;\n} {\n const stringValue = String(value).trim();\n const parts = stringValue.split(WHITE_SPACE_REGEX);\n const len = parts.length;\n\n if (len === 1) {\n return { top: parts[0], right: parts[0], bottom: parts[0], left: parts[0] };\n }\n if (len === 2) {\n return { top: parts[0], right: parts[1], bottom: parts[0], left: parts[1] };\n }\n if (len === 3) {\n return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[1] };\n }\n if (len === 4) {\n return { top: parts[0], right: parts[1], bottom: parts[2], left: parts[3] };\n }\n\n return {\n top: stringValue,\n right: stringValue,\n bottom: stringValue,\n left: stringValue,\n };\n}\n\nfunction convertBorderValue(value: string | number): {\n style: string;\n width: string;\n color: string;\n} {\n const stringValue = String(value).trim();\n const parts = stringValue.split(WHITE_SPACE_REGEX);\n\n switch (parts.length) {\n case 1:\n // border: 1px → all sides\n return {\n style: 'solid',\n width: parts[0],\n color: 'black',\n };\n case 2:\n // border: 1px solid → top/bottom, left/right\n return {\n style: parts[1],\n width: parts[0],\n color: 'black',\n };\n case 3:\n // border: 1px solid #000 → top, left/right, bottom\n return {\n style: parts[1],\n width: parts[0],\n color: parts[2],\n };\n case 4:\n // border: 1px solid #000 #fff → top, right, bottom, left\n return {\n style: parts[1],\n width: parts[0],\n color: parts[2],\n };\n default:\n // Invalid format, return the original value for all sides\n return {\n style: 'solid',\n width: stringValue,\n color: 'black',\n };\n }\n}\n\n/**\n * When a border-width is present but border-style is missing, browsers default\n * to `none` and the border is invisible. This adds `solid` as a sensible\n * fallback so borders show up immediately after setting a width.\n */\nexport function ensureBorderStyleFallback(\n styles: Record<string, string | number>,\n): Record<string, string | number> {\n for (const [widthKey, styleKey] of Object.entries(BORDER_WIDTH_TO_STYLE)) {\n const widthValue = styles[widthKey];\n if (!widthValue || widthValue === '0' || widthValue === '0px') {\n continue;\n }\n if (!styles[styleKey]) {\n // Keep shorthand borderStyle authoritative for each side when present.\n if (styleKey !== 'borderStyle' && styles.borderStyle) {\n continue;\n }\n styles[styleKey] = 'solid';\n }\n }\n return styles;\n}\n\n/**\n * Resolves conflicts between reset styles and inline styles by expanding\n * shorthand properties (margin, padding) to longhand before merging.\n * This prevents shorthand properties from overriding specific longhand properties.\n *\n * @param resetStyles - Base reset styles that may contain shorthand properties\n * @param inlineStyles - Inline styles that should override reset styles\n * @returns Merged styles with inline styles taking precedence\n */\nexport function resolveConflictingStyles(\n resetStyles: CssJs['reset'],\n inlineStyles: Record<string, string>,\n) {\n const expandedResetStyles = expandShorthandProperties(\n resetStyles as Record<string, string>,\n );\n const expandedInlineStyles = expandShorthandProperties(inlineStyles);\n\n return {\n ...expandedResetStyles,\n ...expandedInlineStyles,\n };\n}\n"],"mappings":";AAEA,MAAM,oBAAoB;AAE1B,MAAM,wBAAgD;CACpD,aAAa;CACb,gBAAgB;CAChB,kBAAkB;CAClB,mBAAmB;CACnB,iBAAiB;CAClB;AAED,MAAa,iBAAiB,gBAAwC;CACpE,MAAM,QAAkB,EAAE;AAE1B,MAAK,MAAM,OAAO,aAAa;EAC7B,MAAM,QAAQ,YAAY;AAC1B,MAAI,UAAU,KAAK,UAAU,UAAa,UAAU,QAAQ,UAAU,IAAI;GAExE,MAAM,eAAe,IAAI,QADA,WAGtB,UAAU,IAAI,MAAM,aAAa,GACnC;AACD,SAAM,KAAK,GAAG,aAAa,GAAG,QAAQ;;;AAI1C,QAAO,MAAM,KAAK,IAAI,IAAI,MAAM,SAAS,MAAM;;AAGjD,MAAM,qBAAqB,UAA4B;CACrD,MAAM,UAAoB,EAAE;CAC5B,IAAI,UAAU;CAC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SAAS,mBAAmB,OAI1B;CACA,MAAM,cAAc,OAAO,MAAM,CAAC,MAAM;CACxC,MAAM,QAAQ,YAAY,MAAM,kBAAkB;AAElD,SAAQ,MAAM,QAAd;EACE,KAAK,EAEH,QAAO;GACL,OAAO;GACP,OAAO,MAAM;GACb,OAAO;GACR;EACH,KAAK,EAEH,QAAO;GACL,OAAO,MAAM;GACb,OAAO,MAAM;GACb,OAAO;GACR;EACH,KAAK,EAEH,QAAO;GACL,OAAO,MAAM;GACb,OAAO,MAAM;GACb,OAAO,MAAM;GACd;EACH,KAAK,EAEH,QAAO;GACL,OAAO,MAAM;GACb,OAAO,MAAM;GACb,OAAO,MAAM;GACd;EACH,QAEE,QAAO;GACL,OAAO;GACP,OAAO;GACP,OAAO;GACR;;;;;;;;AASP,SAAgB,0BACd,QACiC;AACjC,MAAK,MAAM,CAAC,UAAU,aAAa,OAAO,QAAQ,sBAAsB,EAAE;EACxE,MAAM,aAAa,OAAO;AAC1B,MAAI,CAAC,cAAc,eAAe,OAAO,eAAe,MACtD;AAEF,MAAI,CAAC,OAAO,WAAW;AAErB,OAAI,aAAa,iBAAiB,OAAO,YACvC;AAEF,UAAO,YAAY;;;AAGvB,QAAO;;;;;;;;;;;AAYT,SAAgB,yBACd,aACA,cACA;CACA,MAAM,sBAAsB,0BAC1B,YACD;CACD,MAAM,uBAAuB,0BAA0B,aAAa;AAEpE,QAAO;EACL,GAAG;EACH,GAAG;EACJ"}
@@ -0,0 +1,252 @@
1
+
2
+ //#region src/utils/styles.ts
3
+ const WHITE_SPACE_REGEX = /\s+/;
4
+ const BORDER_WIDTH_TO_STYLE = {
5
+ borderWidth: "borderStyle",
6
+ borderTopWidth: "borderTopStyle",
7
+ borderRightWidth: "borderRightStyle",
8
+ borderBottomWidth: "borderBottomStyle",
9
+ borderLeftWidth: "borderLeftStyle"
10
+ };
11
+ const jsToInlineCss = (styleObject) => {
12
+ const parts = [];
13
+ for (const key in styleObject) {
14
+ const value = styleObject[key];
15
+ if (value !== 0 && value !== void 0 && value !== null && value !== "") {
16
+ const formattedKey = key.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
17
+ parts.push(`${formattedKey}:${value}`);
18
+ }
19
+ }
20
+ return parts.join(";") + (parts.length ? ";" : "");
21
+ };
22
+ const splitDeclarations = (input) => {
23
+ const results = [];
24
+ let current = "";
25
+ let depth = 0;
26
+ for (const char of input) {
27
+ if (char === "(") depth++;
28
+ if (char === ")") depth--;
29
+ if (char === ";" && depth === 0) {
30
+ results.push(current);
31
+ current = "";
32
+ } else current += char;
33
+ }
34
+ if (current) results.push(current);
35
+ return results;
36
+ };
37
+ const inlineCssToJs = (inlineStyle, options = {}) => {
38
+ const styleObject = {};
39
+ if (!inlineStyle || inlineStyle === "" || typeof inlineStyle === "object") return styleObject;
40
+ splitDeclarations(inlineStyle).forEach((style) => {
41
+ const trimmed = style.trim();
42
+ if (trimmed) {
43
+ const separatorIndex = trimmed.indexOf(":");
44
+ if (separatorIndex === -1) return;
45
+ const key = trimmed.slice(0, separatorIndex);
46
+ const valueTrimmed = trimmed.slice(separatorIndex + 1).trim();
47
+ if (!valueTrimmed) return;
48
+ const formattedKey = key.trim().replace(/-\w/g, (match) => match[1].toUpperCase());
49
+ styleObject[formattedKey] = options?.removeUnit ? valueTrimmed.replace(/px|%/g, "") : valueTrimmed;
50
+ }
51
+ });
52
+ return styleObject;
53
+ };
54
+ /**
55
+ * Expands CSS shorthand properties (margin, padding) into their longhand equivalents.
56
+ * This prevents shorthand properties from overriding specific longhand properties in email clients.
57
+ *
58
+ * @param styles - Style object that may contain shorthand properties
59
+ * @returns New style object with shorthand properties expanded to longhand
60
+ *
61
+ * @example
62
+ * expandShorthandProperties({ margin: '0', paddingTop: '10px' })
63
+ * // Returns: { marginTop: '0', marginRight: '0', marginBottom: '0', marginLeft: '0', paddingTop: '10px' }
64
+ */
65
+ function expandShorthandProperties(styles) {
66
+ if (!styles || typeof styles !== "object") return {};
67
+ const expanded = {};
68
+ for (const key in styles) {
69
+ const value = styles[key];
70
+ if (value === void 0 || value === null || value === "") continue;
71
+ switch (key) {
72
+ case "margin": {
73
+ const values = parseShorthandValue(value);
74
+ expanded.marginTop = values.top;
75
+ expanded.marginRight = values.right;
76
+ expanded.marginBottom = values.bottom;
77
+ expanded.marginLeft = values.left;
78
+ break;
79
+ }
80
+ case "padding": {
81
+ const values = parseShorthandValue(value);
82
+ expanded.paddingTop = values.top;
83
+ expanded.paddingRight = values.right;
84
+ expanded.paddingBottom = values.bottom;
85
+ expanded.paddingLeft = values.left;
86
+ break;
87
+ }
88
+ case "border": {
89
+ const values = convertBorderValue(value);
90
+ expanded.borderStyle = values.style;
91
+ expanded.borderWidth = values.width;
92
+ expanded.borderColor = values.color;
93
+ break;
94
+ }
95
+ case "borderTopLeftRadius":
96
+ case "borderTopRightRadius":
97
+ case "borderBottomLeftRadius":
98
+ case "borderBottomRightRadius":
99
+ expanded[key] = value;
100
+ if (styles.borderTopLeftRadius && styles.borderTopRightRadius && styles.borderBottomLeftRadius && styles.borderBottomRightRadius) {
101
+ const values = [
102
+ styles.borderTopLeftRadius,
103
+ styles.borderTopRightRadius,
104
+ styles.borderBottomLeftRadius,
105
+ styles.borderBottomRightRadius
106
+ ];
107
+ if (new Set(values).size === 1) expanded.borderRadius = values[0];
108
+ }
109
+ break;
110
+ default: expanded[key] = value;
111
+ }
112
+ }
113
+ return expanded;
114
+ }
115
+ /**
116
+ * Parses CSS shorthand value (1-4 values) into individual side values.
117
+ * Follows CSS specification for shorthand property value parsing.
118
+ *
119
+ * @param value - Shorthand value string (e.g., '0', '10px 20px', '5px 10px 15px 20px')
120
+ * @returns Object with top, right, bottom, left values
121
+ */
122
+ function parseShorthandValue(value) {
123
+ const stringValue = String(value).trim();
124
+ const parts = stringValue.split(WHITE_SPACE_REGEX);
125
+ const len = parts.length;
126
+ if (len === 1) return {
127
+ top: parts[0],
128
+ right: parts[0],
129
+ bottom: parts[0],
130
+ left: parts[0]
131
+ };
132
+ if (len === 2) return {
133
+ top: parts[0],
134
+ right: parts[1],
135
+ bottom: parts[0],
136
+ left: parts[1]
137
+ };
138
+ if (len === 3) return {
139
+ top: parts[0],
140
+ right: parts[1],
141
+ bottom: parts[2],
142
+ left: parts[1]
143
+ };
144
+ if (len === 4) return {
145
+ top: parts[0],
146
+ right: parts[1],
147
+ bottom: parts[2],
148
+ left: parts[3]
149
+ };
150
+ return {
151
+ top: stringValue,
152
+ right: stringValue,
153
+ bottom: stringValue,
154
+ left: stringValue
155
+ };
156
+ }
157
+ function convertBorderValue(value) {
158
+ const stringValue = String(value).trim();
159
+ const parts = stringValue.split(WHITE_SPACE_REGEX);
160
+ switch (parts.length) {
161
+ case 1: return {
162
+ style: "solid",
163
+ width: parts[0],
164
+ color: "black"
165
+ };
166
+ case 2: return {
167
+ style: parts[1],
168
+ width: parts[0],
169
+ color: "black"
170
+ };
171
+ case 3: return {
172
+ style: parts[1],
173
+ width: parts[0],
174
+ color: parts[2]
175
+ };
176
+ case 4: return {
177
+ style: parts[1],
178
+ width: parts[0],
179
+ color: parts[2]
180
+ };
181
+ default: return {
182
+ style: "solid",
183
+ width: stringValue,
184
+ color: "black"
185
+ };
186
+ }
187
+ }
188
+ /**
189
+ * When a border-width is present but border-style is missing, browsers default
190
+ * to `none` and the border is invisible. This adds `solid` as a sensible
191
+ * fallback so borders show up immediately after setting a width.
192
+ */
193
+ function ensureBorderStyleFallback(styles) {
194
+ for (const [widthKey, styleKey] of Object.entries(BORDER_WIDTH_TO_STYLE)) {
195
+ const widthValue = styles[widthKey];
196
+ if (!widthValue || widthValue === "0" || widthValue === "0px") continue;
197
+ if (!styles[styleKey]) {
198
+ if (styleKey !== "borderStyle" && styles.borderStyle) continue;
199
+ styles[styleKey] = "solid";
200
+ }
201
+ }
202
+ return styles;
203
+ }
204
+ /**
205
+ * Resolves conflicts between reset styles and inline styles by expanding
206
+ * shorthand properties (margin, padding) to longhand before merging.
207
+ * This prevents shorthand properties from overriding specific longhand properties.
208
+ *
209
+ * @param resetStyles - Base reset styles that may contain shorthand properties
210
+ * @param inlineStyles - Inline styles that should override reset styles
211
+ * @returns Merged styles with inline styles taking precedence
212
+ */
213
+ function resolveConflictingStyles(resetStyles, inlineStyles) {
214
+ const expandedResetStyles = expandShorthandProperties(resetStyles);
215
+ const expandedInlineStyles = expandShorthandProperties(inlineStyles);
216
+ return {
217
+ ...expandedResetStyles,
218
+ ...expandedInlineStyles
219
+ };
220
+ }
221
+
222
+ //#endregion
223
+ Object.defineProperty(exports, 'ensureBorderStyleFallback', {
224
+ enumerable: true,
225
+ get: function () {
226
+ return ensureBorderStyleFallback;
227
+ }
228
+ });
229
+ Object.defineProperty(exports, 'expandShorthandProperties', {
230
+ enumerable: true,
231
+ get: function () {
232
+ return expandShorthandProperties;
233
+ }
234
+ });
235
+ Object.defineProperty(exports, 'inlineCssToJs', {
236
+ enumerable: true,
237
+ get: function () {
238
+ return inlineCssToJs;
239
+ }
240
+ });
241
+ Object.defineProperty(exports, 'jsToInlineCss', {
242
+ enumerable: true,
243
+ get: function () {
244
+ return jsToInlineCss;
245
+ }
246
+ });
247
+ Object.defineProperty(exports, 'resolveConflictingStyles', {
248
+ enumerable: true,
249
+ get: function () {
250
+ return resolveConflictingStyles;
251
+ }
252
+ });
@@ -0,0 +1,47 @@
1
+ import * as React$1 from "react";
2
+
3
+ //#region src/plugins/email-theming/types.d.ts
4
+ type InputType = 'color' | 'number' | 'select' | 'text' | 'textarea';
5
+ type InputUnit = 'px' | '%';
6
+ type Options = Record<string, string>;
7
+ type EditorTheme = 'basic' | 'minimal';
8
+ type PanelSectionId = 'body' | 'container' | 'typography' | 'h1' | 'h2' | 'h3' | 'link' | 'image' | 'button' | 'code-block' | 'inline-code';
9
+ type KnownThemeComponents = 'reset' | 'body' | 'container' | 'h1' | 'h2' | 'h3' | 'paragraph' | 'nestedList' | 'list' | 'listItem' | 'listParagraph' | 'blockquote' | 'codeBlock' | 'inlineCode' | 'codeTag' | 'link' | 'footer' | 'hr' | 'image' | 'button' | 'section';
10
+ type KnownCssProperties = 'align' | 'backgroundColor' | 'color' | 'fontSize' | 'fontWeight' | 'letterSpacing' | 'lineHeight' | 'textDecoration' | 'borderRadius' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderWidth' | 'borderTopWidth' | 'borderRightWidth' | 'borderBottomWidth' | 'borderLeftWidth' | 'borderStyle' | 'borderTopStyle' | 'borderRightStyle' | 'borderBottomStyle' | 'borderLeftStyle' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'width' | 'height';
11
+ type ResetTheme = Record<KnownThemeComponents, React$1.CSSProperties>;
12
+ type CssJs = { [K in KnownThemeComponents]: React$1.CSSProperties & {
13
+ align?: 'center' | 'left' | 'right';
14
+ } };
15
+ type SupportedCssProperties = { [K in KnownCssProperties]: {
16
+ category: 'layout' | 'appearance' | 'typography';
17
+ label: string;
18
+ type: InputType;
19
+ defaultValue: string | number;
20
+ unit?: InputUnit;
21
+ options?: Options;
22
+ excludeNodes?: string[];
23
+ placeholder?: string;
24
+ customUpdate?: (props: Record<string, unknown>, update: (func: (tree: PanelGroup[]) => PanelGroup[]) => void) => void;
25
+ } };
26
+ interface PanelInputProperty {
27
+ label: string;
28
+ type: InputType;
29
+ value?: string | number;
30
+ prop: KnownCssProperties;
31
+ classReference?: KnownThemeComponents;
32
+ unit?: InputUnit;
33
+ options?: Options;
34
+ placeholder?: string;
35
+ category: SupportedCssProperties[KnownCssProperties]['category'];
36
+ }
37
+ interface PanelGroup {
38
+ id?: PanelSectionId;
39
+ title: string;
40
+ category?: string;
41
+ headerSlot?: React$1.ReactNode;
42
+ classReference?: KnownThemeComponents;
43
+ inputs: Omit<PanelInputProperty, 'category'>[];
44
+ }
45
+ //#endregion
46
+ export { PanelGroup as a, ResetTheme as c, KnownThemeComponents as i, SupportedCssProperties as l, EditorTheme as n, PanelInputProperty as o, KnownCssProperties as r, PanelSectionId as s, CssJs as t };
47
+ //# sourceMappingURL=types-B-hiUAR9.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-B-hiUAR9.d.cts","names":[],"sources":["../src/plugins/email-theming/types.ts"],"sourcesContent":[],"mappings":";;;KAEK,SAAA;KACA,SAAA;AAH+B,KAI/B,OAAA,GAAU,MAFD,CAAA,MAAA,EAAA,MAAA,CAAA;AACT,KAGO,WAAA,GAHE,OAAA,GAAA,SAAA;AACT,KAGO,cAAA,GAHG,MAAM,GAAA,WAAA,GAAA,YAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAAA,MAAA,GAAA,OAAA,GAAA,QAAA,GAAA,YAAA,GAAA,aAAA;AAET,KAaA,oBAAA,GAbW,OAAA,GAAA,MAAA,GAAA,WAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAAA,WAAA,GAAA,YAAA,GAAA,MAAA,GAAA,UAAA,GAAA,eAAA,GAAA,YAAA,GAAA,WAAA,GAAA,YAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,IAAA,GAAA,OAAA,GAAA,QAAA,GAAA,SAAA;AACX,KAmCA,kBAAA,GAnCc,OAAA,GAAA,iBAAA,GAAA,OAAA,GAAA,UAAA,GAAA,YAAA,GAAA,eAAA,GAAA,YAAA,GAAA,gBAAA,GAAA,cAAA,GAAA,qBAAA,GAAA,sBAAA,GAAA,wBAAA,GAAA,yBAAA,GAAA,aAAA,GAAA,gBAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,iBAAA,GAAA,aAAA,GAAA,gBAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,iBAAA,GAAA,aAAA,GAAA,gBAAA,GAAA,kBAAA,GAAA,mBAAA,GAAA,iBAAA,GAAA,SAAA,GAAA,YAAA,GAAA,cAAA,GAAA,eAAA,GAAA,aAAA,GAAA,OAAA,GAAA,QAAA;AAYd,KA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";
2
+
3
+ //#region src/plugins/email-theming/types.d.ts
4
+ type InputType = 'color' | 'number' | 'select' | 'text' | 'textarea';
5
+ type InputUnit = 'px' | '%';
6
+ type Options = Record<string, string>;
7
+ type EditorTheme = 'basic' | 'minimal';
8
+ type PanelSectionId = 'body' | 'container' | 'typography' | 'h1' | 'h2' | 'h3' | 'link' | 'image' | 'button' | 'code-block' | 'inline-code';
9
+ type KnownThemeComponents = 'reset' | 'body' | 'container' | 'h1' | 'h2' | 'h3' | 'paragraph' | 'nestedList' | 'list' | 'listItem' | 'listParagraph' | 'blockquote' | 'codeBlock' | 'inlineCode' | 'codeTag' | 'link' | 'footer' | 'hr' | 'image' | 'button' | 'section';
10
+ type KnownCssProperties = 'align' | 'backgroundColor' | 'color' | 'fontSize' | 'fontWeight' | 'letterSpacing' | 'lineHeight' | 'textDecoration' | 'borderRadius' | 'borderTopLeftRadius' | 'borderTopRightRadius' | 'borderBottomLeftRadius' | 'borderBottomRightRadius' | 'borderWidth' | 'borderTopWidth' | 'borderRightWidth' | 'borderBottomWidth' | 'borderLeftWidth' | 'borderStyle' | 'borderTopStyle' | 'borderRightStyle' | 'borderBottomStyle' | 'borderLeftStyle' | 'borderColor' | 'borderTopColor' | 'borderRightColor' | 'borderBottomColor' | 'borderLeftColor' | 'padding' | 'paddingTop' | 'paddingRight' | 'paddingBottom' | 'paddingLeft' | 'width' | 'height';
11
+ type ResetTheme = Record<KnownThemeComponents, React$1.CSSProperties>;
12
+ type CssJs = { [K in KnownThemeComponents]: React$1.CSSProperties & {
13
+ align?: 'center' | 'left' | 'right';
14
+ } };
15
+ type SupportedCssProperties = { [K in KnownCssProperties]: {
16
+ category: 'layout' | 'appearance' | 'typography';
17
+ label: string;
18
+ type: InputType;
19
+ defaultValue: string | number;
20
+ unit?: InputUnit;
21
+ options?: Options;
22
+ excludeNodes?: string[];
23
+ placeholder?: string;
24
+ customUpdate?: (props: Record<string, unknown>, update: (func: (tree: PanelGroup[]) => PanelGroup[]) => void) => void;
25
+ } };
26
+ interface PanelInputProperty {
27
+ label: string;
28
+ type: InputType;
29
+ value?: string | number;
30
+ prop: KnownCssProperties;
31
+ classReference?: KnownThemeComponents;
32
+ unit?: InputUnit;
33
+ options?: Options;
34
+ placeholder?: string;
35
+ category: SupportedCssProperties[KnownCssProperties]['category'];
36
+ }
37
+ interface PanelGroup {
38
+ id?: PanelSectionId;
39
+ title: string;
40
+ category?: string;
41
+ headerSlot?: React$1.ReactNode;
42
+ classReference?: KnownThemeComponents;
43
+ inputs: Omit<PanelInputProperty, 'category'>[];
44
+ }
45
+ //#endregion
46
+ export { PanelGroup as a, ResetTheme as c, KnownThemeComponents as i, SupportedCssProperties as l, EditorTheme as n, PanelInputProperty as o, KnownCssProperties as r, PanelSectionId as s, CssJs as t };
47
+ //# sourceMappingURL=types-J7sLqbPy.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types-J7sLqbPy.d.mts","names":[],"sources":["../src/plugins/email-theming/types.ts"],"sourcesContent":[],"mappings":";;;KAEK,SAAA;KACA,SAAA;AAH+B,KAI/B,OAAA,GAAU,MAFD,CAAA,MAAA,EAAA,MAAA,CAAA;AACT,KAGO,WAAA,GAHE,OAAA,GAAA,SAAA;AACT,KAGO,cAAA,GAHG,MAAM,GAAA,WAAA,GAAA,YAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAAA,MAAA,GAAA,OAAA,GAAA,QAAA,GAAA,YAAA,GAAA,aAAA;AAET,KAaA,oBAAA,GAbW,OAAA,GAAA,MAAA,GAAA,WAAA,GAAA,IAAA,GAAA,IAAA,GAAA,IAAA,GAAA,WAAA,GAAA,YAAA,GAAA,MAAA,GAAA,UAAA,GAAA,eAAA,GAAA,YAAA,GAAA,WAAA,GAAA,YAAA,GAAA,SAAA,GAAA,MAAA,GAAA,QAAA,GAAA,IAAA,GAAA,OAAA,GAAA,QAAA,GAAA,SAAA;AACX,KAmCA,kBAAA,GAnCc,OAAA,GAAA,iBAAA,GAAA,OAA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