@editora/core 1.0.15 → 1.0.16

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 (68) hide show
  1. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-DIKuCeFw.mjs} +82 -79
  2. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-DXZdK3zr.mjs} +72 -71
  3. package/dist/{ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs → ApprovalWorkflowPlugin.native-ZsS_2xmn.mjs} +239 -238
  4. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-H3XyYD7_.mjs} +2 -2
  5. package/dist/{BlocksLibraryPlugin.native-5sdsXsiE.mjs → BlocksLibraryPlugin.native-CownM6Rk.mjs} +140 -116
  6. package/dist/{CapitalizationPlugin.native-DLV4oPmB.mjs → CapitalizationPlugin.native-C-HRbXGh.mjs} +10 -5
  7. package/dist/{ChecklistPlugin.native-BS-kMz9O.mjs → ChecklistPlugin.native-NVrBUkaL.mjs} +141 -103
  8. package/dist/{CitationsPlugin.native-DQgoCd1B.mjs → CitationsPlugin.native-C_7wWQ-k.mjs} +441 -422
  9. package/dist/{ClearFormattingPlugin.native-B6ro3a1h.mjs → ClearFormattingPlugin.native-Pp0O-SBf.mjs} +24 -23
  10. package/dist/{CodePlugin.native-knhM8NNo.mjs → CodePlugin.native-BH-K4xmW.mjs} +474 -342
  11. package/dist/CodePlugin.native-hNgfXlfS.mjs +4767 -0
  12. package/dist/CodeSamplePlugin.native-svbAFWh_.mjs +501 -0
  13. package/dist/CollaborationPlugin.native-oSybCGPW.mjs +7468 -0
  14. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-CLip9wAO.mjs} +233 -185
  15. package/dist/{ConditionalContentPlugin.native-CfhY46rU.mjs → ConditionalContentPlugin.native-Bf7XgRSW.mjs} +401 -351
  16. package/dist/{DataBindingPlugin.native-BoXwghTz.mjs → DataBindingPlugin.native-B7lpI_0c.mjs} +29 -28
  17. package/dist/{DocumentManagerPlugin.native-D1YHQ2NN.mjs → DocumentManagerPlugin.native-iFip6s4Q.mjs} +94 -45
  18. package/dist/{EmbedIframePlugin.native-BF_-LjTq.mjs → EmbedIframePlugin.native-BfZ_HGlV.mjs} +231 -186
  19. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-D92aaOKi.mjs} +288 -76
  20. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-M3cNQ0KA.mjs} +57 -50
  21. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-DsLrH8eq.mjs} +41 -34
  22. package/dist/{FormatPainterPlugin.native-CsMrKfFU.mjs → FormatPainterPlugin.native-BhjzsiVq.mjs} +3 -2
  23. package/dist/{HistoryPlugin.native-D2wl32jV.mjs → HistoryPlugin.native-DPvhks6h.mjs} +36 -32
  24. package/dist/LinkPlugin.native-BsQXYsK6.mjs +352 -0
  25. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-Bt0LANbO.mjs} +68 -35
  26. package/dist/{MathPlugin.native-NwWPHVmj.mjs → MathPlugin.native-Byo3WL0f.mjs} +211 -115
  27. package/dist/{MediaManagerPlugin.native-eOsTJFpw.mjs → MediaManagerPlugin.native-BT1NZIJS.mjs} +139 -134
  28. package/dist/{MentionPlugin.native-BMDlOqur.mjs → MentionPlugin.native-S_lwGZQO.mjs} +23 -18
  29. package/dist/{MergeTagPlugin.native-BzRVoD9-.mjs → MergeTagPlugin.native-7-6F3S1Y.mjs} +44 -43
  30. package/dist/{PreviewPlugin.native-WuIwOAOR.mjs → PreviewPlugin.native-CiR51jql.mjs} +31 -28
  31. package/dist/{SlashCommandsPlugin.native-BiN6ODw5.mjs → SlashCommandsPlugin.native-BDIIwGNs.mjs} +90 -79
  32. package/dist/{SmartPastePlugin.native-CZAEHkyt.mjs → SmartPastePlugin.native-BATLCds5.mjs} +89 -85
  33. package/dist/{SpecialCharactersPlugin.native-DaG4b19I.mjs → SpecialCharactersPlugin.native-CdZoc1GB.mjs} +73 -26
  34. package/dist/SpellCheckPlugin.native-Bef2oTLB.mjs +10935 -0
  35. package/dist/TablePlugin.native-BjIxYZ2X.mjs +772 -0
  36. package/dist/{TemplatePlugin.native-DLjFUaPW.mjs → TemplatePlugin.native-D6n5RUnC.mjs} +288 -262
  37. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-KMZ2uzlq.mjs} +2 -2
  38. package/dist/{TranslationWorkflowPlugin.native-DdF16tgT.mjs → TranslationWorkflowPlugin.native-CZtG--06.mjs} +67 -65
  39. package/dist/{VersionDiffPlugin.native-Bvxgy--t.mjs → VersionDiffPlugin.native-Ca1fMWUJ.mjs} +42 -42
  40. package/dist/anchoredPopover-DJFD2oAP.mjs +116 -0
  41. package/dist/core.css +1 -1
  42. package/dist/dialogHelpers-DBf7WqYH.mjs +40 -0
  43. package/dist/editora.min.js +26 -24
  44. package/dist/editora.umd.js +26 -24
  45. package/dist/escapeHtml-CX8RelZ1.mjs +7 -0
  46. package/dist/historyHelpers-B0-4mq1E.mjs +15 -0
  47. package/dist/index-B1_vtXRz.mjs +3910 -0
  48. package/dist/index-C6BoNR2t.js +12 -0
  49. package/dist/index.cjs.js +3 -3
  50. package/dist/index.esm.js +17 -14
  51. package/dist/plugin-loader.js +53 -52
  52. package/dist/webcomponent-core.js +2039 -473
  53. package/dist/webcomponent-core.min.css +1 -1
  54. package/dist/webcomponent-core.min.js +96 -66
  55. package/dist/webcomponent.cjs.js +1 -1
  56. package/dist/webcomponent.esm.js +1 -1
  57. package/dist/webcomponent.js +2208 -641
  58. package/dist/webcomponent.min.css +1 -1
  59. package/dist/webcomponent.min.js +1564 -1198
  60. package/index.d.ts +32 -0
  61. package/package.json +10 -3
  62. package/dist/CodeSamplePlugin.native-CgGoH-X4.mjs +0 -384
  63. package/dist/LinkPlugin.native-DYCIcdTm.mjs +0 -283
  64. package/dist/SpellCheckPlugin.native-BZB9AewP.mjs +0 -1039
  65. package/dist/TablePlugin.native-DrHX-efe.mjs +0 -495
  66. package/dist/anchoredPopover-Bxds0VoB.mjs +0 -110
  67. package/dist/index-BLm1MtzH.js +0 -10
  68. package/dist/index-Cd9jEuZP.mjs +0 -2341
@@ -0,0 +1,3910 @@
1
+ class Gt {
2
+ constructor(t, e, o) {
3
+ this.doc = t, this.selection = e, this.schema = o;
4
+ }
5
+ static create(t, e) {
6
+ const o = e || t.node("doc", {}, [t.node("paragraph")]);
7
+ return new Gt(o, { anchor: 0, head: 0 }, t);
8
+ }
9
+ apply(t, e) {
10
+ return new Gt(t, e || this.selection, this.schema);
11
+ }
12
+ }
13
+ class nn {
14
+ constructor(t, e) {
15
+ this.nodes = new Map(Object.entries(t)), this.marks = new Map(Object.entries(e));
16
+ }
17
+ node(t, e, o) {
18
+ return { type: t, attrs: e, content: o };
19
+ }
20
+ text(t, e) {
21
+ return { type: "text", text: t, marks: e };
22
+ }
23
+ }
24
+ class rn {
25
+ constructor() {
26
+ this.plugins = [], this.pluginConfigs = /* @__PURE__ */ new Map();
27
+ }
28
+ register(t, e) {
29
+ this.plugins.push(t), e && this.pluginConfigs.set(t.name, e);
30
+ const o = this.pluginConfigs.get(t.name) || t.config;
31
+ if (t.initialize)
32
+ try {
33
+ t.initialize(o);
34
+ } catch (i) {
35
+ console.error(`Failed to initialize plugin "${t.name}":`, i);
36
+ }
37
+ if (t.init && t.init !== t.initialize)
38
+ try {
39
+ t.init(o);
40
+ } catch (i) {
41
+ console.error(`Failed to run init hook for plugin "${t.name}":`, i);
42
+ }
43
+ }
44
+ unregister(t) {
45
+ const e = this.plugins.findIndex((o) => o.name === t);
46
+ if (e > -1) {
47
+ const o = this.plugins[e];
48
+ o.destroy && o.destroy(), this.plugins.splice(e, 1), this.pluginConfigs.delete(t);
49
+ }
50
+ }
51
+ getPlugin(t) {
52
+ return this.plugins.find((e) => e.name === t);
53
+ }
54
+ getPluginConfig(t) {
55
+ return this.pluginConfigs.get(t);
56
+ }
57
+ buildSchema() {
58
+ const t = {}, e = {};
59
+ return this.plugins.forEach((o) => {
60
+ o.nodes && Object.assign(t, o.nodes), o.marks && Object.assign(e, o.marks);
61
+ }), new nn(t, e);
62
+ }
63
+ getCommands() {
64
+ const t = {};
65
+ return this.plugins.forEach((e) => {
66
+ e.commands && Object.assign(t, e.commands);
67
+ }), t;
68
+ }
69
+ getToolbarItems() {
70
+ return this.plugins.flatMap((t) => t.toolbar || []);
71
+ }
72
+ /**
73
+ * Execute plugin command with mode awareness
74
+ */
75
+ async executePluginCommand(t, e, ...o) {
76
+ const i = this.getPlugin(t);
77
+ if (!i)
78
+ throw new Error(`Plugin not found: ${t}`);
79
+ const r = this.getPluginConfig(t) || i.config || {}, l = r.mode || "local";
80
+ try {
81
+ switch (l) {
82
+ case "local":
83
+ return i.executeLocal ? i.executeLocal(e, ...o) : null;
84
+ case "api":
85
+ if (!i.executeAPI)
86
+ throw new Error(`Plugin ${t} does not support API mode`);
87
+ return await i.executeAPI(e, ...o);
88
+ case "hybrid":
89
+ if (i.executeHybrid)
90
+ return await i.executeHybrid(e, ...o);
91
+ try {
92
+ if (i.executeAPI)
93
+ return await i.executeAPI(e, ...o);
94
+ } catch (c) {
95
+ if (console.warn(`API execution failed for ${t}, falling back to local`, c), i.executeLocal && r.fallbackToLocal !== !1)
96
+ return i.executeLocal(e, ...o);
97
+ throw c;
98
+ }
99
+ break;
100
+ default:
101
+ throw new Error(`Unknown plugin mode: ${l}`);
102
+ }
103
+ } catch (c) {
104
+ throw console.error(`Error executing command ${e} on plugin ${t}:`, c), c;
105
+ }
106
+ }
107
+ /**
108
+ * Destroy all plugins
109
+ */
110
+ async destroyAll() {
111
+ const t = this.plugins.filter((e) => e.destroy).map((e) => e.destroy());
112
+ await Promise.all(t), this.plugins = [], this.pluginConfigs.clear();
113
+ }
114
+ }
115
+ class an {
116
+ constructor(t) {
117
+ this.shortcuts = /* @__PURE__ */ new Map(), this.enabled = !0, this.isMac = typeof navigator != "undefined" && navigator.platform.toUpperCase().indexOf("MAC") >= 0, (t == null ? void 0 : t.enabled) === !1 && (this.enabled = !1), this.registerDefaultShortcuts(), t != null && t.shortcuts && t.shortcuts.forEach((e) => this.registerShortcut(e)), t != null && t.customShortcuts && Object.values(t.customShortcuts).forEach((e) => {
118
+ this.registerShortcut(e);
119
+ });
120
+ }
121
+ registerDefaultShortcuts() {
122
+ this.registerShortcut({
123
+ key: "b",
124
+ ctrl: !this.isMac,
125
+ meta: this.isMac,
126
+ command: "toggleBold",
127
+ description: "Bold",
128
+ preventDefault: !0
129
+ }), this.registerShortcut({
130
+ key: "i",
131
+ ctrl: !this.isMac,
132
+ meta: this.isMac,
133
+ command: "toggleItalic",
134
+ description: "Italic",
135
+ preventDefault: !0
136
+ }), this.registerShortcut({
137
+ key: "u",
138
+ ctrl: !this.isMac,
139
+ meta: this.isMac,
140
+ command: "toggleUnderline",
141
+ description: "Underline",
142
+ preventDefault: !0
143
+ }), this.registerShortcut({
144
+ key: "d",
145
+ ctrl: !this.isMac,
146
+ meta: this.isMac,
147
+ command: "toggleStrikethrough",
148
+ description: "Strikethrough",
149
+ preventDefault: !0
150
+ }), this.registerShortcut({
151
+ key: "z",
152
+ ctrl: !this.isMac,
153
+ meta: this.isMac,
154
+ command: "undo",
155
+ description: "Undo",
156
+ preventDefault: !0
157
+ }), this.registerShortcut({
158
+ key: "z",
159
+ ctrl: !this.isMac,
160
+ meta: this.isMac,
161
+ shift: !0,
162
+ command: "redo",
163
+ description: "Redo",
164
+ preventDefault: !0
165
+ }), this.registerShortcut({
166
+ key: "y",
167
+ ctrl: !this.isMac,
168
+ meta: this.isMac,
169
+ command: "redo",
170
+ description: "Redo",
171
+ preventDefault: !0
172
+ });
173
+ for (let t = 1; t <= 6; t++)
174
+ this.registerShortcut({
175
+ key: String(t),
176
+ ctrl: !this.isMac,
177
+ meta: this.isMac,
178
+ alt: !0,
179
+ command: "setBlockType",
180
+ params: `h${t}`,
181
+ description: `Heading ${t}`,
182
+ preventDefault: !0
183
+ });
184
+ this.registerShortcut({
185
+ key: "7",
186
+ ctrl: !this.isMac,
187
+ meta: this.isMac,
188
+ alt: !0,
189
+ command: "setBlockType",
190
+ params: "p",
191
+ description: "Paragraph",
192
+ preventDefault: !0
193
+ }), this.registerShortcut({
194
+ key: "7",
195
+ ctrl: !this.isMac,
196
+ meta: this.isMac,
197
+ shift: !0,
198
+ command: "toggleOrderedList",
199
+ description: "Numbered List",
200
+ preventDefault: !0
201
+ }), this.registerShortcut({
202
+ key: "8",
203
+ ctrl: !this.isMac,
204
+ meta: this.isMac,
205
+ shift: !0,
206
+ command: "toggleBulletList",
207
+ description: "Bullet List",
208
+ preventDefault: !0
209
+ }), this.registerShortcut({
210
+ key: "k",
211
+ ctrl: !this.isMac,
212
+ meta: this.isMac,
213
+ command: "openLinkDialog",
214
+ description: "Insert/Edit Link",
215
+ preventDefault: !0
216
+ }), this.registerShortcut({
217
+ key: "e",
218
+ ctrl: !this.isMac,
219
+ meta: this.isMac,
220
+ alt: !0,
221
+ command: "insertCodeBlock",
222
+ description: "Code Block",
223
+ preventDefault: !0
224
+ }), this.registerShortcut({
225
+ key: "q",
226
+ ctrl: !this.isMac,
227
+ meta: this.isMac,
228
+ shift: !0,
229
+ command: "toggleBlockquote",
230
+ description: "Blockquote",
231
+ preventDefault: !0
232
+ }), this.registerShortcut({
233
+ key: "l",
234
+ ctrl: !this.isMac,
235
+ meta: this.isMac,
236
+ shift: !0,
237
+ command: "setTextAlignment",
238
+ params: "left",
239
+ description: "Align Left",
240
+ preventDefault: !0
241
+ }), this.registerShortcut({
242
+ key: "e",
243
+ ctrl: !this.isMac,
244
+ meta: this.isMac,
245
+ shift: !0,
246
+ alt: !0,
247
+ command: "setTextAlignment",
248
+ params: "center",
249
+ description: "Align Center",
250
+ preventDefault: !0
251
+ }), this.registerShortcut({
252
+ key: "r",
253
+ ctrl: !this.isMac,
254
+ meta: this.isMac,
255
+ shift: !0,
256
+ command: "setTextAlignment",
257
+ params: "right",
258
+ description: "Align Right",
259
+ preventDefault: !0
260
+ }), this.registerShortcut({
261
+ key: "j",
262
+ ctrl: !this.isMac,
263
+ meta: this.isMac,
264
+ shift: !0,
265
+ command: "setTextAlignment",
266
+ params: "justify",
267
+ description: "Justify",
268
+ preventDefault: !0
269
+ }), this.registerShortcut({
270
+ key: "\\",
271
+ ctrl: !this.isMac,
272
+ meta: this.isMac,
273
+ command: "clearFormatting",
274
+ description: "Clear Formatting",
275
+ preventDefault: !0
276
+ }), this.registerShortcut({
277
+ key: "]",
278
+ ctrl: !this.isMac,
279
+ meta: this.isMac,
280
+ command: "increaseIndent",
281
+ description: "Indent",
282
+ preventDefault: !0
283
+ }), this.registerShortcut({
284
+ key: "[",
285
+ ctrl: !this.isMac,
286
+ meta: this.isMac,
287
+ command: "decreaseIndent",
288
+ description: "Outdent",
289
+ preventDefault: !0
290
+ }), this.registerShortcut({
291
+ key: "g",
292
+ ctrl: !this.isMac,
293
+ meta: this.isMac,
294
+ shift: !0,
295
+ command: "insertImage",
296
+ description: "Insert Image",
297
+ preventDefault: !0
298
+ }), this.registerShortcut({
299
+ key: "t",
300
+ ctrl: !this.isMac,
301
+ meta: this.isMac,
302
+ shift: !0,
303
+ alt: !0,
304
+ command: "insertTable",
305
+ description: "Insert Table",
306
+ preventDefault: !0
307
+ }), this.registerShortcut({
308
+ key: "f11",
309
+ command: "toggleFullscreen",
310
+ description: "Toggle Fullscreen",
311
+ preventDefault: !0
312
+ }), this.registerShortcut({
313
+ key: "p",
314
+ ctrl: !this.isMac,
315
+ meta: this.isMac,
316
+ shift: !0,
317
+ command: "togglePreview",
318
+ description: "Preview",
319
+ preventDefault: !0
320
+ }), this.registerShortcut({
321
+ key: "p",
322
+ ctrl: !this.isMac,
323
+ meta: this.isMac,
324
+ command: "print",
325
+ description: "Print",
326
+ preventDefault: !0
327
+ }), this.registerShortcut({
328
+ key: "s",
329
+ ctrl: !this.isMac,
330
+ meta: this.isMac,
331
+ shift: !0,
332
+ alt: !0,
333
+ command: "insertSpecialCharacter",
334
+ description: "Insert Special Character",
335
+ preventDefault: !0
336
+ }), this.registerShortcut({
337
+ key: "m",
338
+ ctrl: !this.isMac,
339
+ meta: this.isMac,
340
+ shift: !0,
341
+ command: "insertEmoji",
342
+ description: "Insert Emoji",
343
+ preventDefault: !0
344
+ }), this.registerShortcut({
345
+ key: "9",
346
+ ctrl: !this.isMac,
347
+ meta: this.isMac,
348
+ shift: !0,
349
+ command: "toggleChecklist",
350
+ description: "Checklist",
351
+ preventDefault: !0
352
+ }), this.registerShortcut({
353
+ key: "a",
354
+ ctrl: !this.isMac,
355
+ meta: this.isMac,
356
+ shift: !0,
357
+ alt: !0,
358
+ command: "toggleA11yChecker",
359
+ description: "Accessibility Checker",
360
+ preventDefault: !0
361
+ }), this.registerShortcut({
362
+ key: "F7",
363
+ command: "toggleSpellCheck",
364
+ description: "Spell Check",
365
+ preventDefault: !0
366
+ }), this.registerShortcut({
367
+ key: "m",
368
+ ctrl: !this.isMac,
369
+ meta: this.isMac,
370
+ alt: !0,
371
+ command: "insertMath",
372
+ description: "Insert Math",
373
+ preventDefault: !0
374
+ }), this.registerShortcut({
375
+ key: "f",
376
+ ctrl: !this.isMac,
377
+ meta: this.isMac,
378
+ alt: !0,
379
+ command: "insertFootnote",
380
+ description: "Insert Footnote",
381
+ preventDefault: !0
382
+ });
383
+ }
384
+ registerShortcut(t) {
385
+ const e = this.getShortcutKey(t);
386
+ this.shortcuts.set(e, t);
387
+ }
388
+ unregisterShortcut(t) {
389
+ const e = this.getShortcutKey(t);
390
+ this.shortcuts.delete(e);
391
+ }
392
+ getShortcutKey(t) {
393
+ const e = [];
394
+ return t.ctrl && e.push("ctrl"), t.alt && e.push("alt"), t.shift && e.push("shift"), t.meta && e.push("meta"), e.push(t.key.toLowerCase()), e.join("+");
395
+ }
396
+ getEventKey(t) {
397
+ const e = [];
398
+ return t.ctrlKey && e.push("ctrl"), t.altKey && e.push("alt"), t.shiftKey && e.push("shift"), t.metaKey && e.push("meta"), e.push(t.key.toLowerCase()), e.join("+");
399
+ }
400
+ handleKeyDown(t, e) {
401
+ if (!this.enabled) return !1;
402
+ const o = this.getEventKey(t), i = this.shortcuts.get(o);
403
+ return i ? (i.preventDefault !== !1 && (t.preventDefault(), t.stopPropagation()), e(i.command, i.params), !0) : !1;
404
+ }
405
+ enable() {
406
+ this.enabled = !0;
407
+ }
408
+ disable() {
409
+ this.enabled = !1;
410
+ }
411
+ isEnabled() {
412
+ return this.enabled;
413
+ }
414
+ getAllShortcuts() {
415
+ return Array.from(this.shortcuts.values());
416
+ }
417
+ getShortcutForCommand(t) {
418
+ return Array.from(this.shortcuts.values()).find((e) => e.command === t);
419
+ }
420
+ getShortcutDescription(t) {
421
+ const e = [];
422
+ this.isMac ? (t.meta && e.push("⌘"), t.ctrl && e.push("⌃"), t.alt && e.push("⌥"), t.shift && e.push("⇧")) : (t.ctrl && e.push("Ctrl"), t.alt && e.push("Alt"), t.shift && e.push("Shift"));
423
+ const o = t.key.length === 1 ? t.key.toUpperCase() : t.key;
424
+ return e.push(o), e.join("+");
425
+ }
426
+ getShortcutsHelp() {
427
+ const t = this.getAllShortcuts(), e = /* @__PURE__ */ new Map();
428
+ t.forEach((i) => {
429
+ const r = this.getShortcutCategory(i.command);
430
+ e.has(r) || e.set(r, []), e.get(r).push(i);
431
+ });
432
+ let o = `# Keyboard Shortcuts
433
+
434
+ `;
435
+ return e.forEach((i, r) => {
436
+ o += `## ${r}
437
+
438
+ `, i.forEach((l) => {
439
+ const c = this.getShortcutDescription(l);
440
+ o += `- **${c}**: ${l.description || l.command}
441
+ `;
442
+ }), o += `
443
+ `;
444
+ }), o;
445
+ }
446
+ getShortcutCategory(t) {
447
+ return t.includes("toggle") && (t.includes("Bold") || t.includes("Italic") || t.includes("Underline") || t.includes("Strike") || t.includes("Code") || t.includes("Super") || t.includes("Sub")) ? "Text Formatting" : t.includes("Heading") || t.includes("Paragraph") ? "Block Formatting" : t.includes("List") || t.includes("Checklist") ? "Lists" : t.includes("Alignment") || t.includes("Indent") ? "Alignment & Indentation" : t.includes("undo") || t.includes("redo") ? "History" : t.includes("insert") ? "Insert" : t.includes("find") || t.includes("replace") ? "Find & Replace" : t.includes("Accessibility") || t.includes("spell") ? "Tools" : "Other";
448
+ }
449
+ }
450
+ class sn {
451
+ constructor(t = {}) {
452
+ this.commands = /* @__PURE__ */ new Map(), Object.entries(t).forEach(([e, o]) => {
453
+ this.register(e, o);
454
+ });
455
+ }
456
+ /**
457
+ * Register a command
458
+ */
459
+ register(t, e) {
460
+ this.commands.has(t) && console.warn(`Command ${t} is being overwritten`), this.commands.set(t, e);
461
+ }
462
+ /**
463
+ * Unregister a command
464
+ */
465
+ unregister(t) {
466
+ this.commands.delete(t);
467
+ }
468
+ /**
469
+ * Get a command handler
470
+ */
471
+ get(t) {
472
+ return this.commands.get(t);
473
+ }
474
+ /**
475
+ * Check if command exists
476
+ */
477
+ has(t) {
478
+ return this.commands.has(t);
479
+ }
480
+ /**
481
+ * Get all command names
482
+ */
483
+ getCommandNames() {
484
+ return Array.from(this.commands.keys());
485
+ }
486
+ /**
487
+ * Clear all commands
488
+ */
489
+ clear() {
490
+ this.commands.clear();
491
+ }
492
+ }
493
+ class ln {
494
+ constructor(t = {}) {
495
+ this.listeners = /* @__PURE__ */ new Map(), this.isReadonly = !1, this.isDestroyed = !1, this.isReadonly = t.readonly || !1, this.pluginManager = new rn(), t.plugins && Array.isArray(t.plugins) && t.plugins.forEach((o) => this.pluginManager.register(o));
496
+ const e = this.pluginManager.buildSchema();
497
+ this.state = Gt.create(e), this.commandRegistry = new sn(this.pluginManager.getCommands());
498
+ }
499
+ /**
500
+ * Execute a command
501
+ */
502
+ execCommand(t, ...e) {
503
+ if (this.isReadonly)
504
+ return console.warn("Cannot execute commands in readonly mode"), !1;
505
+ if (this.isDestroyed)
506
+ return console.warn("Cannot execute commands on destroyed editor"), !1;
507
+ const o = this.commandRegistry.get(t);
508
+ if (!o)
509
+ return console.warn(`Command not found: ${t}`), !1;
510
+ let i;
511
+ return e.length === 0 ? i = o(this.state) : e.length === 1 ? i = o(this.state, e[0]) : i = o(this.state, ...e), i instanceof Promise ? (i.then((r) => {
512
+ r && typeof r == "object" && "doc" in r && "selection" in r && (this.setState(r), this.emit("change", this.state));
513
+ }).catch((r) => {
514
+ console.error(`Async command failed: ${t}`, r);
515
+ }), !0) : i && typeof i == "object" && "doc" in i && "selection" in i ? (this.setState(i), this.emit("change", this.state), !0) : i !== !1 && i != null;
516
+ }
517
+ /**
518
+ * Update editor state
519
+ */
520
+ setState(t) {
521
+ this.isDestroyed || (this.state = t, this.emit("stateChange", t));
522
+ }
523
+ /**
524
+ * Get current state
525
+ */
526
+ getState() {
527
+ return this.state;
528
+ }
529
+ /**
530
+ * Set readonly mode
531
+ */
532
+ setReadonly(t) {
533
+ this.isReadonly = t, this.emit("readonlyChange", t);
534
+ }
535
+ /**
536
+ * Check if readonly
537
+ */
538
+ isReadOnly() {
539
+ return this.isReadonly;
540
+ }
541
+ /**
542
+ * Event emitter
543
+ */
544
+ on(t, e) {
545
+ return this.listeners.has(t) || this.listeners.set(t, []), this.listeners.get(t).push(e), () => {
546
+ const o = this.listeners.get(t);
547
+ if (o) {
548
+ const i = o.indexOf(e);
549
+ i > -1 && o.splice(i, 1);
550
+ }
551
+ };
552
+ }
553
+ /**
554
+ * Emit event
555
+ */
556
+ emit(t, ...e) {
557
+ const o = this.listeners.get(t);
558
+ o && o.forEach((i) => {
559
+ try {
560
+ i(...e);
561
+ } catch (r) {
562
+ console.error(`Error in ${t} handler:`, r);
563
+ }
564
+ });
565
+ }
566
+ /**
567
+ * Destroy editor instance
568
+ */
569
+ destroy() {
570
+ this.isDestroyed || (this.isDestroyed = !0, this.listeners.clear(), this.emit("destroy"));
571
+ }
572
+ /**
573
+ * Check if destroyed
574
+ */
575
+ isEditorDestroyed() {
576
+ return this.isDestroyed;
577
+ }
578
+ }
579
+ class cn {
580
+ constructor(t, e, o) {
581
+ this.overflowUnits = [], this.overflowUnitHomes = /* @__PURE__ */ new WeakMap(), this.expandedOpen = !1, this.onDocumentPointerDownForOverflow = (i) => {
582
+ var l, c;
583
+ if (!this.expandedOpen) return;
584
+ const r = i.target;
585
+ r && ((l = this.moreButton) != null && l.contains(r) || (c = this.expandedRow) != null && c.contains(r)) || this.setExpandedOpen(!1);
586
+ }, this.config = t, this.plugins = e, this.pluginLoader = o;
587
+ }
588
+ setLastCommandTrigger(t, e) {
589
+ if (typeof window == "undefined" || !t) return;
590
+ const o = e || t.getAttribute("data-command") || void 0;
591
+ o && (window.__editoraLastCommandButton = t, window.__editoraLastCommand = o);
592
+ }
593
+ /**
594
+ * Set command handler for toolbar buttons
595
+ */
596
+ setCommandHandler(t) {
597
+ this.commandHandler = t;
598
+ }
599
+ /**
600
+ * Parse toolbar string into button groups
601
+ */
602
+ parseToolbarString(t) {
603
+ const e = [], o = t.split("|").map((c) => c.trim()), i = this.getAvailableToolbarItems(), r = /* @__PURE__ */ new Map();
604
+ i.forEach((c) => {
605
+ c.command && r.set(c.command, c), c.type === "group" && c.label && r.set(c.label, c);
606
+ });
607
+ const l = {
608
+ bold: "toggleBold",
609
+ italic: "toggleItalic",
610
+ underline: "toggleUnderline",
611
+ strikethrough: "toggleStrikethrough",
612
+ bullist: "toggleBulletList",
613
+ numlist: "toggleOrderedList",
614
+ checklist: "toggleChecklist",
615
+ link: "openLinkDialog",
616
+ image: "openImageDialog",
617
+ table: "insertTable",
618
+ trackChanges: "toggleTrackChanges",
619
+ acceptTrackChanges: "acceptAllTrackChanges",
620
+ rejectTrackChanges: "rejectAllTrackChanges",
621
+ anchor: "insertAnchor",
622
+ code: "toggleSourceView",
623
+ blockquote: "toggleBlockquote",
624
+ undo: "undo",
625
+ redo: "redo",
626
+ textColor: "openTextColorPicker",
627
+ backgroundColor: "openBackgroundColorPicker",
628
+ fontSize: "fontSize",
629
+ fontFamily: "setFontFamily",
630
+ lineHeight: "setLineHeight",
631
+ heading: "setBlockType",
632
+ paragraph: "setParagraph",
633
+ textAlignment: "setTextAlignment",
634
+ direction: "setDirectionLTR",
635
+ indent: "increaseIndent",
636
+ outdent: "decreaseIndent",
637
+ capitalization: "setCapitalization",
638
+ math: "insertMath",
639
+ specialCharacters: "insertSpecialCharacter",
640
+ emojis: "openEmojiDialog",
641
+ embedIframe: "openEmbedIframeDialog",
642
+ fullscreen: "toggleFullscreen",
643
+ preview: "togglePreview",
644
+ print: "print",
645
+ a11yChecker: "toggleA11yChecker",
646
+ spellCheck: "toggleSpellCheck",
647
+ comments: "addComment",
648
+ showHideComments: "toggleComments",
649
+ toggleComments: "toggleComments",
650
+ footnote: "insertFootnote",
651
+ mergeTags: "insertMergeTag",
652
+ dataBinding: "openDataBindingDialog",
653
+ dataBindingPreview: "openDataBindingDialog",
654
+ contentRules: "toggleContentRulesPanel",
655
+ contentRulesAudit: "runContentRulesAudit",
656
+ contentRulesRealtime: "toggleContentRulesRealtime",
657
+ mention: "insertMention",
658
+ slash: "openSlashCommands",
659
+ slashCommands: "openSlashCommands",
660
+ pageBreak: "insertPageBreak",
661
+ template: "insertTemplate",
662
+ importWord: "importWord",
663
+ exportWord: "exportWord",
664
+ exportPdf: "exportPdf",
665
+ insertImage: "insertImage",
666
+ insertVideo: "insertVideo",
667
+ codeBlock: "insertCodeBlock"
668
+ };
669
+ return o.forEach((c) => {
670
+ const p = [];
671
+ c.split(/\s+/).filter(Boolean).forEach((b) => {
672
+ if (b === "direction") {
673
+ const T = r.get("setDirectionLTR"), E = r.get("setDirectionRTL");
674
+ T && p.push({
675
+ id: "directionLTR",
676
+ label: T.label,
677
+ command: T.command,
678
+ icon: T.icon,
679
+ type: T.type || "button",
680
+ options: T.options
681
+ }), E && p.push({
682
+ id: "directionRTL",
683
+ label: E.label,
684
+ command: E.command,
685
+ icon: E.icon,
686
+ type: E.type || "button",
687
+ options: E.options
688
+ });
689
+ return;
690
+ }
691
+ if (b === "comments") {
692
+ const T = r.get("addComment"), E = r.get("toggleComments");
693
+ T && p.push({
694
+ id: "addComment",
695
+ label: T.label,
696
+ command: T.command,
697
+ icon: T.icon,
698
+ type: T.type || "button",
699
+ options: T.options
700
+ }), E && p.push({
701
+ id: "toggleComments",
702
+ label: E.label,
703
+ command: E.command,
704
+ icon: E.icon,
705
+ type: E.type || "button",
706
+ options: E.options
707
+ });
708
+ return;
709
+ }
710
+ const w = l[b] || b;
711
+ let _ = r.get(w);
712
+ _ || (_ = r.get(b)), _ && p.push({
713
+ id: b,
714
+ label: _.label,
715
+ command: _.command,
716
+ icon: _.icon,
717
+ type: _.type === "separator" ? "separator" : _.type || "button",
718
+ options: _.options,
719
+ items: _.items
720
+ });
721
+ }), p.length > 0 && e.push(p);
722
+ }), e;
723
+ }
724
+ /**
725
+ * Get all available toolbar items from plugins
726
+ */
727
+ getAvailableToolbarItems() {
728
+ return this.plugins.flatMap((e) => e.toolbar || []);
729
+ }
730
+ /**
731
+ * Render toolbar to DOM element
732
+ */
733
+ render(t) {
734
+ this.container = t, t.innerHTML = "", t.className = "editora-toolbar", this.config.sticky && t.classList.add("editora-toolbar-sticky"), this.config.position && t.classList.add(`editora-toolbar-${this.config.position}`);
735
+ const e = document.createElement("div");
736
+ e.className = "editora-toolbar-items-container", this.itemsContainer = e, this.overflowUnits = [];
737
+ const o = this.config.items || this.getDefaultToolbarString(), i = this.parseToolbarString(o);
738
+ i.forEach((r, l) => {
739
+ const c = document.createElement("div");
740
+ if (c.className = "editora-toolbar-group", r.forEach((p) => {
741
+ this.appendToolbarButton(c, p);
742
+ const m = c.lastElementChild;
743
+ m instanceof HTMLElement && (this.overflowUnits.push(m), this.overflowUnitHomes.set(m, c));
744
+ }), e.appendChild(c), l < i.length - 1) {
745
+ const p = document.createElement("div");
746
+ p.className = "editora-toolbar-separator", e.appendChild(p);
747
+ }
748
+ }), t.appendChild(e), this.setupOverflow(t);
749
+ }
750
+ /** Measures top-level items in `itemsContainer` and moves whatever doesn't
751
+ * fit into a collapsible "more options" row, re-measuring on resize. */
752
+ setupOverflow(t) {
753
+ if (!this.itemsContainer || typeof ResizeObserver == "undefined") return;
754
+ const o = document.createElement("button");
755
+ o.type = "button", o.className = "editora-toolbar-more-button", o.title = "Show more options", o.setAttribute("aria-label", "More toolbar options"), o.textContent = "☰", o.style.display = "none", o.addEventListener("click", (c) => {
756
+ c.preventDefault(), this.setExpandedOpen(!this.expandedOpen);
757
+ }), this.moreButton = o, t.appendChild(o);
758
+ const i = document.createElement("div");
759
+ i.className = "editora-toolbar-expanded-row", this.expandedRow = i, t.appendChild(i), document.addEventListener("mousedown", this.onDocumentPointerDownForOverflow, !0);
760
+ const r = () => {
761
+ const c = this.overflowUnits;
762
+ if (c.length === 0) return;
763
+ c.forEach((D) => {
764
+ var N;
765
+ D.parentElement === i && ((N = this.overflowUnitHomes.get(D)) == null || N.appendChild(D));
766
+ });
767
+ const p = t.clientWidth, m = 16, b = 40, w = 4, _ = Math.max(0, p - m - b - w);
768
+ let T = 0, E = 0;
769
+ for (const D of c) {
770
+ const N = D.getBoundingClientRect().width + w;
771
+ if (T + N <= _)
772
+ T += N, E++;
773
+ else
774
+ break;
775
+ }
776
+ E = Math.max(1, Math.min(E, c.length));
777
+ const K = E < c.length;
778
+ o.style.display = K ? "" : "none", o.classList.toggle("active", K && this.expandedOpen), !K && this.expandedOpen && this.setExpandedOpen(!1), c.forEach((D, N) => {
779
+ N >= E && i.appendChild(D);
780
+ });
781
+ }, l = () => {
782
+ this.overflowRafId !== void 0 && cancelAnimationFrame(this.overflowRafId), this.overflowRafId = requestAnimationFrame(r);
783
+ };
784
+ this.resizeObserver = new ResizeObserver(() => l()), this.resizeObserver.observe(t), l();
785
+ }
786
+ setExpandedOpen(t) {
787
+ var e, o;
788
+ this.expandedOpen = t, (e = this.expandedRow) == null || e.classList.toggle("show", t), (o = this.moreButton) == null || o.classList.toggle("active", t);
789
+ }
790
+ /**
791
+ * Append a toolbar button or group to a parent element
792
+ */
793
+ appendToolbarButton(t, e) {
794
+ if (e.type === "separator") {
795
+ const o = document.createElement("div");
796
+ o.className = "editora-toolbar-separator", t.appendChild(o);
797
+ } else if (e.type === "dropdown") {
798
+ const o = this.createDropdown(e);
799
+ t.appendChild(o);
800
+ } else if (e.type === "inline-menu") {
801
+ const o = this.createInlineMenu(e);
802
+ t.appendChild(o);
803
+ } else if (e.type === "group" && e.items && e.items.length) {
804
+ const o = this.createGroupButton(e);
805
+ t.appendChild(o);
806
+ } else if (e.type === "input") {
807
+ const o = this.createInput(e);
808
+ t.appendChild(o);
809
+ } else {
810
+ const o = this.createButton(e);
811
+ t.appendChild(o);
812
+ }
813
+ }
814
+ /**
815
+ * Create a toolbar button element
816
+ */
817
+ createGroupButton(t) {
818
+ const e = document.createElement("div"), o = t.label.toLowerCase().replace(/\s+/g, "-");
819
+ if (e.className = `editora-toolbar-group-button ${o}`, e.title = t.label, t.icon)
820
+ if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
821
+ const i = document.createElement("span");
822
+ i.className = "editora-toolbar-icon", i.innerHTML = t.icon, e.appendChild(i);
823
+ } else
824
+ e.innerHTML = t.icon;
825
+ if (t.items && t.items.length) {
826
+ const i = document.createElement("div");
827
+ i.className = `editora-toolbar-group-items ${o}`, t.items.forEach((r) => {
828
+ this.appendToolbarButton(i, r);
829
+ }), e.appendChild(i);
830
+ }
831
+ return e;
832
+ }
833
+ /**
834
+ * Create a toolbar button element
835
+ */
836
+ createInput(t) {
837
+ const e = document.createElement("input");
838
+ return e.className = `editora-toolbar-input ${t.label.toLowerCase().replace(/\s+/g, "-")}`, e.type = "text", e.title = t.label, e.placeholder = t.placeholder || "", t.command && e.setAttribute("data-command", t.command), t.active && e.classList.add("active"), t.disabled && (e.disabled = !0), e.addEventListener("click", (o) => {
839
+ o.preventDefault(), this.setLastCommandTrigger(e, t.command), this.commandHandler && t.command && this.commandHandler(t.command);
840
+ }), e;
841
+ }
842
+ /**
843
+ * Create a toolbar button element
844
+ */
845
+ createButton(t) {
846
+ const e = document.createElement("button");
847
+ if (e.className = "editora-toolbar-button", e.type = "button", e.title = t.label, t.command && e.setAttribute("data-command", t.command), t.icon)
848
+ if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
849
+ const o = document.createElement("span");
850
+ o.className = "editora-toolbar-icon", o.innerHTML = t.icon, e.appendChild(o);
851
+ } else
852
+ e.innerHTML = t.icon;
853
+ else
854
+ e.textContent = t.label;
855
+ return t.active && e.classList.add("active"), t.disabled && (e.disabled = !0), e.addEventListener("click", (o) => {
856
+ o.preventDefault(), this.commandHandler && t.command && this.commandHandler(t.command);
857
+ }), e;
858
+ }
859
+ /**
860
+ * Create a dropdown element
861
+ */
862
+ createDropdown(t) {
863
+ const e = document.createElement("div");
864
+ e.className = "editora-toolbar-dropdown";
865
+ const o = document.createElement("button");
866
+ o.className = "editora-toolbar-button editora-toolbar-dropdown-trigger", o.type = "button", o.textContent = t.label;
867
+ const i = document.createElement("div");
868
+ i.className = "editora-toolbar-dropdown-menu", i.style.display = "none", t.options && t.options.forEach((c) => {
869
+ const p = document.createElement("button");
870
+ p.className = "editora-toolbar-dropdown-item", p.type = "button", p.textContent = c.label, p.setAttribute("data-value", c.value), p.addEventListener("click", (m) => {
871
+ m.preventDefault(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, c.value), i.style.display = "none";
872
+ }), i.appendChild(p);
873
+ }), o.addEventListener("click", (c) => {
874
+ c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command);
875
+ const p = i.style.display === "block";
876
+ i.style.display = p ? "none" : "block";
877
+ });
878
+ const r = (c) => {
879
+ e.contains(c.target) || (i.style.display = "none");
880
+ }, l = (c) => {
881
+ c.key === "Escape" && (i.style.display = "none");
882
+ };
883
+ return document.addEventListener("mousedown", r, !0), document.addEventListener("keydown", l), e._cleanupDropdown = () => {
884
+ document.removeEventListener("mousedown", r, !0), document.removeEventListener("keydown", l);
885
+ }, e.appendChild(o), e.appendChild(i), e;
886
+ }
887
+ /**
888
+ * Create an inline menu element (like dropdown but triggered by button click)
889
+ */
890
+ createInlineMenu(t) {
891
+ const e = document.createElement("div");
892
+ e.className = "editora-toolbar-dropdown editora-toolbar-inline-menu";
893
+ const o = document.createElement("button");
894
+ if (o.className = "editora-toolbar-button", o.type = "button", o.title = t.label, t.icon)
895
+ if (t.icon.startsWith("<svg") && t.icon.endsWith("</svg>")) {
896
+ const c = document.createElement("span");
897
+ c.className = "editora-toolbar-icon", c.innerHTML = t.icon, o.appendChild(c);
898
+ } else
899
+ o.innerHTML = t.icon;
900
+ else
901
+ o.textContent = t.label;
902
+ const i = document.createElement("div");
903
+ i.className = "editora-toolbar-dropdown-menu", i.style.display = "none", t.options && t.options.forEach((c) => {
904
+ const p = document.createElement("button");
905
+ p.className = "editora-toolbar-dropdown-item", p.type = "button", p.textContent = c.label, p.setAttribute("data-value", c.value), p.addEventListener("click", (m) => {
906
+ m.preventDefault(), m.stopPropagation(), this.setLastCommandTrigger(o, t.command), this.commandHandler && t.command && this.commandHandler(t.command, c.value), i.style.display = "none";
907
+ }), i.appendChild(p);
908
+ }), o.addEventListener("click", (c) => {
909
+ var m;
910
+ c.preventDefault(), c.stopPropagation(), this.setLastCommandTrigger(o, t.command);
911
+ const p = (m = this.container) == null ? void 0 : m.querySelectorAll(
912
+ ".editora-toolbar-dropdown-menu"
913
+ );
914
+ p == null || p.forEach((b) => {
915
+ b !== i && (b.style.display = "none");
916
+ }), i.style.display = i.style.display === "none" ? "block" : "none";
917
+ });
918
+ const r = (c) => {
919
+ e.contains(c.target) || (i.style.display = "none");
920
+ }, l = (c) => {
921
+ c.key === "Escape" && (i.style.display = "none");
922
+ };
923
+ return document.addEventListener("mousedown", r, !0), document.addEventListener("keydown", l), e._cleanupDropdown = () => {
924
+ document.removeEventListener("mousedown", r, !0), document.removeEventListener("keydown", l);
925
+ }, e.appendChild(o), e.appendChild(i), e;
926
+ }
927
+ /**
928
+ * Get default toolbar string if none provided
929
+ */
930
+ getDefaultToolbarString() {
931
+ return this.getAvailableToolbarItems().map((e) => e.command).join(" ");
932
+ }
933
+ /**
934
+ * Update button state
935
+ */
936
+ updateButtonState(t, e) {
937
+ if (!this.container) return;
938
+ const o = this.container.querySelector(
939
+ `[data-command="${t}"]`
940
+ );
941
+ o && (e.active !== void 0 && o.classList.toggle("active", e.active), e.disabled !== void 0 && (o.disabled = e.disabled));
942
+ }
943
+ /**
944
+ * Destroy toolbar
945
+ */
946
+ destroy() {
947
+ var t;
948
+ this.container && (this.container.querySelectorAll(".editora-toolbar-dropdown").forEach((o) => {
949
+ const i = o._cleanupDropdown;
950
+ i && i();
951
+ }), this.container.innerHTML = ""), (t = this.resizeObserver) == null || t.disconnect(), this.resizeObserver = void 0, this.overflowRafId !== void 0 && cancelAnimationFrame(this.overflowRafId), document.removeEventListener("mousedown", this.onDocumentPointerDownForOverflow, !0), this.itemsContainer = void 0, this.moreButton = void 0, this.expandedRow = void 0, this.commandHandler = void 0;
952
+ }
953
+ }
954
+ class dn {
955
+ constructor(t) {
956
+ this.visible = !1, this.config = t;
957
+ }
958
+ /**
959
+ * Create and mount floating toolbar
960
+ */
961
+ create(t) {
962
+ const e = document.createElement("div");
963
+ return e.className = "editora-floating-toolbar", e.style.display = "none", e.style.position = "absolute", e.style.zIndex = "1000", this.container = e, t.appendChild(e), e;
964
+ }
965
+ /**
966
+ * Show toolbar at position
967
+ */
968
+ show(t, e) {
969
+ this.container && (this.container.style.display = "block", this.container.style.left = `${t}px`, this.container.style.top = `${e}px`, this.visible = !0);
970
+ }
971
+ /**
972
+ * Hide toolbar
973
+ */
974
+ hide() {
975
+ this.container && (this.container.style.display = "none", this.visible = !1);
976
+ }
977
+ /**
978
+ * Update position
979
+ */
980
+ updatePosition(t, e) {
981
+ !this.container || !this.visible || (this.container.style.left = `${t}px`, this.container.style.top = `${e}px`);
982
+ }
983
+ /**
984
+ * Check if visible
985
+ */
986
+ isVisible() {
987
+ return this.visible;
988
+ }
989
+ /**
990
+ * Destroy floating toolbar
991
+ */
992
+ destroy() {
993
+ this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0, this.visible = !1;
994
+ }
995
+ }
996
+ class un {
997
+ constructor(t = {}) {
998
+ this.statusInfo = {}, this.config = t;
999
+ }
1000
+ /**
1001
+ * Create and mount status bar
1002
+ */
1003
+ create(t) {
1004
+ const e = document.createElement("div");
1005
+ return e.className = "editora-statusbar", this.config.position && e.classList.add(`editora-statusbar-${this.config.position}`), this.container = e, t.appendChild(e), e;
1006
+ }
1007
+ /**
1008
+ * Update status information
1009
+ */
1010
+ update(t) {
1011
+ this.statusInfo = { ...this.statusInfo, ...t }, this.render();
1012
+ }
1013
+ /**
1014
+ * Render status bar content
1015
+ */
1016
+ render() {
1017
+ if (!this.container) return;
1018
+ this.container.innerHTML = "";
1019
+ const t = document.createElement("div");
1020
+ t.className = "editora-statusbar-left";
1021
+ const e = document.createElement("div");
1022
+ e.className = "editora-statusbar-right";
1023
+ const o = [];
1024
+ if (this.statusInfo.selectionInfo) {
1025
+ const r = this.statusInfo.selectionInfo;
1026
+ r.startLine === r.endLine && r.startColumn === r.endColumn ? o.push(`Ln ${r.startLine}, Col ${r.startColumn}`) : (r.startLine === r.endLine ? o.push(`Ln ${r.startLine}, Col ${r.startColumn}-${r.endColumn}`) : o.push(`Ln ${r.startLine}:${r.startColumn} - ${r.endLine}:${r.endColumn}`), o.push(`${r.selectedChars} chars selected`));
1027
+ } else if (this.statusInfo.cursorPosition) {
1028
+ const r = this.statusInfo.cursorPosition;
1029
+ o.push(`Ln ${r.line}, Col ${r.column}`);
1030
+ }
1031
+ this.statusInfo.language && o.push(this.statusInfo.language);
1032
+ const i = [];
1033
+ this.statusInfo.wordCount !== void 0 && i.push(`${this.statusInfo.wordCount} words`), this.statusInfo.charCount !== void 0 && i.push(`${this.statusInfo.charCount} chars`), this.statusInfo.lineCount !== void 0 && i.push(`${this.statusInfo.lineCount} lines`), this.statusInfo.custom && Object.entries(this.statusInfo.custom).forEach(([r, l]) => {
1034
+ i.push(`${r}: ${l}`);
1035
+ }), o.forEach((r, l) => {
1036
+ const c = document.createElement("span");
1037
+ if (c.className = "editora-statusbar-item", c.textContent = r, t.appendChild(c), l < o.length - 1) {
1038
+ const p = document.createElement("span");
1039
+ p.className = "editora-statusbar-separator", p.textContent = "|", t.appendChild(p);
1040
+ }
1041
+ }), i.forEach((r, l) => {
1042
+ const c = document.createElement("span");
1043
+ if (c.className = "editora-statusbar-item", c.textContent = r, e.appendChild(c), l < i.length - 1) {
1044
+ const p = document.createElement("span");
1045
+ p.className = "editora-statusbar-separator", p.textContent = "|", e.appendChild(p);
1046
+ }
1047
+ }), this.container.appendChild(t), this.container.appendChild(e);
1048
+ }
1049
+ /**
1050
+ * Destroy status bar
1051
+ */
1052
+ destroy() {
1053
+ this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container), this.container = void 0;
1054
+ }
1055
+ }
1056
+ function fn(s, t) {
1057
+ const e = s.textContent || "", o = pn(s, t.startContainer, t.startOffset), r = e.substring(0, o).split(`
1058
+ `), l = r.length, c = r[r.length - 1].length + 1;
1059
+ return { line: l, column: c };
1060
+ }
1061
+ function pn(s, t, e) {
1062
+ var l;
1063
+ let o = 0;
1064
+ const i = document.createTreeWalker(
1065
+ s,
1066
+ NodeFilter.SHOW_TEXT,
1067
+ null
1068
+ );
1069
+ let r = i.firstChild();
1070
+ for (; r; ) {
1071
+ if (r === t) {
1072
+ o += e;
1073
+ break;
1074
+ } else r.nodeType === Node.TEXT_NODE && (o += ((l = r.textContent) == null ? void 0 : l.length) || 0);
1075
+ r = i.nextNode();
1076
+ }
1077
+ return o;
1078
+ }
1079
+ function hn(s) {
1080
+ var o, i;
1081
+ const t = s.querySelectorAll("div, p, br, h1, h2, h3, h4, h5, h6, blockquote, li, pre");
1082
+ let e = 1;
1083
+ if (t.length > 0) {
1084
+ e = t.length;
1085
+ const r = t[t.length - 1];
1086
+ (r.tagName === "BR" || ((o = r.innerHTML) == null ? void 0 : o.trim()) === "" || ((i = r.textContent) == null ? void 0 : i.trim()) === "") && e++;
1087
+ } else {
1088
+ const l = (s.textContent || "").split(`
1089
+ `).length;
1090
+ e = Math.max(1, l);
1091
+ }
1092
+ return e;
1093
+ }
1094
+ function mn(s) {
1095
+ const t = s.trim() ? s.trim().split(/\s+/).length : 0, e = s.length;
1096
+ return { words: t, chars: e };
1097
+ }
1098
+ function gn(s, t) {
1099
+ const e = s.toString();
1100
+ return {
1101
+ startLine: t.line,
1102
+ startColumn: t.column,
1103
+ endLine: t.line,
1104
+ // For now, assuming single line selections
1105
+ endColumn: t.column + e.length,
1106
+ selectedChars: e.length,
1107
+ selectedWords: e.trim().split(/\s+/).filter(Boolean).length
1108
+ };
1109
+ }
1110
+ function no(s, t) {
1111
+ (t == null || t > s.length) && (t = s.length);
1112
+ for (var e = 0, o = Array(t); e < t; e++) o[e] = s[e];
1113
+ return o;
1114
+ }
1115
+ function bn(s) {
1116
+ if (Array.isArray(s)) return s;
1117
+ }
1118
+ function yn(s, t) {
1119
+ var e = s == null ? null : typeof Symbol != "undefined" && s[Symbol.iterator] || s["@@iterator"];
1120
+ if (e != null) {
1121
+ var o, i, r, l, c = [], p = !0, m = !1;
1122
+ try {
1123
+ if (r = (e = e.call(s)).next, t !== 0) for (; !(p = (o = r.call(e)).done) && (c.push(o.value), c.length !== t); p = !0) ;
1124
+ } catch (b) {
1125
+ m = !0, i = b;
1126
+ } finally {
1127
+ try {
1128
+ if (!p && e.return != null && (l = e.return(), Object(l) !== l)) return;
1129
+ } finally {
1130
+ if (m) throw i;
1131
+ }
1132
+ }
1133
+ return c;
1134
+ }
1135
+ }
1136
+ function vn() {
1137
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1138
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1139
+ }
1140
+ function En(s, t) {
1141
+ return bn(s) || yn(s, t) || wn(s, t) || vn();
1142
+ }
1143
+ function wn(s, t) {
1144
+ if (s) {
1145
+ if (typeof s == "string") return no(s, t);
1146
+ var e = {}.toString.call(s).slice(8, -1);
1147
+ return e === "Object" && s.constructor && (e = s.constructor.name), e === "Map" || e === "Set" ? Array.from(s) : e === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e) ? no(s, t) : void 0;
1148
+ }
1149
+ }
1150
+ const ko = Object.entries, io = Object.setPrototypeOf, Tn = Object.isFrozen, kn = Object.getPrototypeOf, xn = Object.getOwnPropertyDescriptor;
1151
+ let M = Object.freeze, I = Object.seal, mt = Object.create, xo = typeof Reflect != "undefined" && Reflect, Ee = xo.apply, we = xo.construct;
1152
+ M || (M = function(t) {
1153
+ return t;
1154
+ });
1155
+ I || (I = function(t) {
1156
+ return t;
1157
+ });
1158
+ Ee || (Ee = function(t, e) {
1159
+ for (var o = arguments.length, i = new Array(o > 2 ? o - 2 : 0), r = 2; r < o; r++) i[r - 2] = arguments[r];
1160
+ return t.apply(e, i);
1161
+ });
1162
+ we || (we = function(t) {
1163
+ for (var e = arguments.length, o = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) o[i - 1] = arguments[i];
1164
+ return new t(...o);
1165
+ });
1166
+ const it = L(Array.prototype.forEach), An = L(Array.prototype.lastIndexOf), ro = L(Array.prototype.pop), kt = L(Array.prototype.push), Cn = L(Array.prototype.splice), bt = Array.isArray, St = L(String.prototype.toLowerCase), fe = L(String.prototype.toString), ao = L(String.prototype.match), xt = L(String.prototype.replace), so = L(String.prototype.indexOf), Sn = L(String.prototype.trim), _n = L(Number.prototype.toString), Ln = L(Boolean.prototype.toString), lo = typeof BigInt == "undefined" ? null : L(BigInt.prototype.toString), co = typeof Symbol == "undefined" ? null : L(Symbol.prototype.toString), z = L(Object.prototype.hasOwnProperty), At = L(Object.prototype.toString), O = L(RegExp.prototype.test), X = Mn(TypeError);
1167
+ function L(s) {
1168
+ return function(t) {
1169
+ t instanceof RegExp && (t.lastIndex = 0);
1170
+ for (var e = arguments.length, o = new Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) o[i - 1] = arguments[i];
1171
+ return Ee(s, t, o);
1172
+ };
1173
+ }
1174
+ function Mn(s) {
1175
+ return function() {
1176
+ for (var t = arguments.length, e = new Array(t), o = 0; o < t; o++) e[o] = arguments[o];
1177
+ return we(s, e);
1178
+ };
1179
+ }
1180
+ function v(s, t) {
1181
+ let e = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : St;
1182
+ if (io && io(s, null), !bt(t)) return s;
1183
+ let o = t.length;
1184
+ for (; o--; ) {
1185
+ let i = t[o];
1186
+ if (typeof i == "string") {
1187
+ const r = e(i);
1188
+ r !== i && (Tn(t) || (t[o] = r), i = r);
1189
+ }
1190
+ s[i] = !0;
1191
+ }
1192
+ return s;
1193
+ }
1194
+ function In(s) {
1195
+ for (let t = 0; t < s.length; t++) z(s, t) || (s[t] = null);
1196
+ return s;
1197
+ }
1198
+ function H(s) {
1199
+ const t = mt(null);
1200
+ for (const o of ko(s)) {
1201
+ var e = En(o, 2);
1202
+ const i = e[0], r = e[1];
1203
+ z(s, i) && (bt(r) ? t[i] = In(r) : r && typeof r == "object" && r.constructor === Object ? t[i] = H(r) : t[i] = r);
1204
+ }
1205
+ return t;
1206
+ }
1207
+ function On(s) {
1208
+ switch (typeof s) {
1209
+ case "string":
1210
+ return s;
1211
+ case "number":
1212
+ return _n(s);
1213
+ case "boolean":
1214
+ return Ln(s);
1215
+ case "bigint":
1216
+ return lo ? lo(s) : "0";
1217
+ case "symbol":
1218
+ return co ? co(s) : "Symbol()";
1219
+ case "undefined":
1220
+ return At(s);
1221
+ case "function":
1222
+ case "object": {
1223
+ if (s === null) return At(s);
1224
+ const t = s, e = j(t, "toString");
1225
+ if (typeof e == "function") {
1226
+ const o = e(t);
1227
+ return typeof o == "string" ? o : At(o);
1228
+ }
1229
+ return At(s);
1230
+ }
1231
+ default:
1232
+ return At(s);
1233
+ }
1234
+ }
1235
+ function j(s, t) {
1236
+ for (; s !== null; ) {
1237
+ const o = xn(s, t);
1238
+ if (o) {
1239
+ if (o.get) return L(o.get);
1240
+ if (typeof o.value == "function") return L(o.value);
1241
+ }
1242
+ s = kn(s);
1243
+ }
1244
+ function e() {
1245
+ return null;
1246
+ }
1247
+ return e;
1248
+ }
1249
+ function Dn(s) {
1250
+ try {
1251
+ return O(s, ""), !0;
1252
+ } catch (t) {
1253
+ return !1;
1254
+ }
1255
+ }
1256
+ const uo = M([
1257
+ "a",
1258
+ "abbr",
1259
+ "acronym",
1260
+ "address",
1261
+ "area",
1262
+ "article",
1263
+ "aside",
1264
+ "audio",
1265
+ "b",
1266
+ "bdi",
1267
+ "bdo",
1268
+ "big",
1269
+ "blink",
1270
+ "blockquote",
1271
+ "body",
1272
+ "br",
1273
+ "button",
1274
+ "canvas",
1275
+ "caption",
1276
+ "center",
1277
+ "cite",
1278
+ "code",
1279
+ "col",
1280
+ "colgroup",
1281
+ "content",
1282
+ "data",
1283
+ "datalist",
1284
+ "dd",
1285
+ "decorator",
1286
+ "del",
1287
+ "details",
1288
+ "dfn",
1289
+ "dialog",
1290
+ "dir",
1291
+ "div",
1292
+ "dl",
1293
+ "dt",
1294
+ "element",
1295
+ "em",
1296
+ "fieldset",
1297
+ "figcaption",
1298
+ "figure",
1299
+ "font",
1300
+ "footer",
1301
+ "form",
1302
+ "h1",
1303
+ "h2",
1304
+ "h3",
1305
+ "h4",
1306
+ "h5",
1307
+ "h6",
1308
+ "head",
1309
+ "header",
1310
+ "hgroup",
1311
+ "hr",
1312
+ "html",
1313
+ "i",
1314
+ "img",
1315
+ "input",
1316
+ "ins",
1317
+ "kbd",
1318
+ "label",
1319
+ "legend",
1320
+ "li",
1321
+ "main",
1322
+ "map",
1323
+ "mark",
1324
+ "marquee",
1325
+ "menu",
1326
+ "menuitem",
1327
+ "meter",
1328
+ "nav",
1329
+ "nobr",
1330
+ "ol",
1331
+ "optgroup",
1332
+ "option",
1333
+ "output",
1334
+ "p",
1335
+ "picture",
1336
+ "pre",
1337
+ "progress",
1338
+ "q",
1339
+ "rp",
1340
+ "rt",
1341
+ "ruby",
1342
+ "s",
1343
+ "samp",
1344
+ "search",
1345
+ "section",
1346
+ "select",
1347
+ "shadow",
1348
+ "slot",
1349
+ "small",
1350
+ "source",
1351
+ "spacer",
1352
+ "span",
1353
+ "strike",
1354
+ "strong",
1355
+ "style",
1356
+ "sub",
1357
+ "summary",
1358
+ "sup",
1359
+ "table",
1360
+ "tbody",
1361
+ "td",
1362
+ "template",
1363
+ "textarea",
1364
+ "tfoot",
1365
+ "th",
1366
+ "thead",
1367
+ "time",
1368
+ "tr",
1369
+ "track",
1370
+ "tt",
1371
+ "u",
1372
+ "ul",
1373
+ "var",
1374
+ "video",
1375
+ "wbr"
1376
+ ]), pe = M([
1377
+ "svg",
1378
+ "a",
1379
+ "altglyph",
1380
+ "altglyphdef",
1381
+ "altglyphitem",
1382
+ "animatecolor",
1383
+ "animatemotion",
1384
+ "animatetransform",
1385
+ "circle",
1386
+ "clippath",
1387
+ "defs",
1388
+ "desc",
1389
+ "ellipse",
1390
+ "enterkeyhint",
1391
+ "exportparts",
1392
+ "filter",
1393
+ "font",
1394
+ "g",
1395
+ "glyph",
1396
+ "glyphref",
1397
+ "hkern",
1398
+ "image",
1399
+ "inputmode",
1400
+ "line",
1401
+ "lineargradient",
1402
+ "marker",
1403
+ "mask",
1404
+ "metadata",
1405
+ "mpath",
1406
+ "part",
1407
+ "path",
1408
+ "pattern",
1409
+ "polygon",
1410
+ "polyline",
1411
+ "radialgradient",
1412
+ "rect",
1413
+ "stop",
1414
+ "style",
1415
+ "switch",
1416
+ "symbol",
1417
+ "text",
1418
+ "textpath",
1419
+ "title",
1420
+ "tref",
1421
+ "tspan",
1422
+ "view",
1423
+ "vkern"
1424
+ ]), he = M([
1425
+ "feBlend",
1426
+ "feColorMatrix",
1427
+ "feComponentTransfer",
1428
+ "feComposite",
1429
+ "feConvolveMatrix",
1430
+ "feDiffuseLighting",
1431
+ "feDisplacementMap",
1432
+ "feDistantLight",
1433
+ "feDropShadow",
1434
+ "feFlood",
1435
+ "feFuncA",
1436
+ "feFuncB",
1437
+ "feFuncG",
1438
+ "feFuncR",
1439
+ "feGaussianBlur",
1440
+ "feImage",
1441
+ "feMerge",
1442
+ "feMergeNode",
1443
+ "feMorphology",
1444
+ "feOffset",
1445
+ "fePointLight",
1446
+ "feSpecularLighting",
1447
+ "feSpotLight",
1448
+ "feTile",
1449
+ "feTurbulence"
1450
+ ]), Rn = M([
1451
+ "animate",
1452
+ "color-profile",
1453
+ "cursor",
1454
+ "discard",
1455
+ "font-face",
1456
+ "font-face-format",
1457
+ "font-face-name",
1458
+ "font-face-src",
1459
+ "font-face-uri",
1460
+ "foreignobject",
1461
+ "hatch",
1462
+ "hatchpath",
1463
+ "mesh",
1464
+ "meshgradient",
1465
+ "meshpatch",
1466
+ "meshrow",
1467
+ "missing-glyph",
1468
+ "script",
1469
+ "set",
1470
+ "solidcolor",
1471
+ "unknown",
1472
+ "use"
1473
+ ]), me = M([
1474
+ "math",
1475
+ "menclose",
1476
+ "merror",
1477
+ "mfenced",
1478
+ "mfrac",
1479
+ "mglyph",
1480
+ "mi",
1481
+ "mlabeledtr",
1482
+ "mmultiscripts",
1483
+ "mn",
1484
+ "mo",
1485
+ "mover",
1486
+ "mpadded",
1487
+ "mphantom",
1488
+ "mroot",
1489
+ "mrow",
1490
+ "ms",
1491
+ "mspace",
1492
+ "msqrt",
1493
+ "mstyle",
1494
+ "msub",
1495
+ "msup",
1496
+ "msubsup",
1497
+ "mtable",
1498
+ "mtd",
1499
+ "mtext",
1500
+ "mtr",
1501
+ "munder",
1502
+ "munderover",
1503
+ "mprescripts"
1504
+ ]), Nn = M([
1505
+ "maction",
1506
+ "maligngroup",
1507
+ "malignmark",
1508
+ "mlongdiv",
1509
+ "mscarries",
1510
+ "mscarry",
1511
+ "msgroup",
1512
+ "mstack",
1513
+ "msline",
1514
+ "msrow",
1515
+ "semantics",
1516
+ "annotation",
1517
+ "annotation-xml",
1518
+ "mprescripts",
1519
+ "none"
1520
+ ]), fo = M(["#text"]), po = M([
1521
+ "accept",
1522
+ "action",
1523
+ "align",
1524
+ "alt",
1525
+ "autocapitalize",
1526
+ "autocomplete",
1527
+ "autopictureinpicture",
1528
+ "autoplay",
1529
+ "background",
1530
+ "bgcolor",
1531
+ "border",
1532
+ "capture",
1533
+ "cellpadding",
1534
+ "cellspacing",
1535
+ "checked",
1536
+ "cite",
1537
+ "class",
1538
+ "clear",
1539
+ "color",
1540
+ "cols",
1541
+ "colspan",
1542
+ "command",
1543
+ "commandfor",
1544
+ "controls",
1545
+ "controlslist",
1546
+ "coords",
1547
+ "crossorigin",
1548
+ "datetime",
1549
+ "decoding",
1550
+ "default",
1551
+ "dir",
1552
+ "disabled",
1553
+ "disablepictureinpicture",
1554
+ "disableremoteplayback",
1555
+ "download",
1556
+ "draggable",
1557
+ "enctype",
1558
+ "enterkeyhint",
1559
+ "exportparts",
1560
+ "face",
1561
+ "for",
1562
+ "headers",
1563
+ "height",
1564
+ "hidden",
1565
+ "high",
1566
+ "href",
1567
+ "hreflang",
1568
+ "id",
1569
+ "inert",
1570
+ "inputmode",
1571
+ "integrity",
1572
+ "ismap",
1573
+ "kind",
1574
+ "label",
1575
+ "lang",
1576
+ "list",
1577
+ "loading",
1578
+ "loop",
1579
+ "low",
1580
+ "max",
1581
+ "maxlength",
1582
+ "media",
1583
+ "method",
1584
+ "min",
1585
+ "minlength",
1586
+ "multiple",
1587
+ "muted",
1588
+ "name",
1589
+ "nonce",
1590
+ "noshade",
1591
+ "novalidate",
1592
+ "nowrap",
1593
+ "open",
1594
+ "optimum",
1595
+ "part",
1596
+ "pattern",
1597
+ "placeholder",
1598
+ "playsinline",
1599
+ "popover",
1600
+ "popovertarget",
1601
+ "popovertargetaction",
1602
+ "poster",
1603
+ "preload",
1604
+ "pubdate",
1605
+ "radiogroup",
1606
+ "readonly",
1607
+ "rel",
1608
+ "required",
1609
+ "rev",
1610
+ "reversed",
1611
+ "role",
1612
+ "rows",
1613
+ "rowspan",
1614
+ "spellcheck",
1615
+ "scope",
1616
+ "selected",
1617
+ "shape",
1618
+ "size",
1619
+ "sizes",
1620
+ "slot",
1621
+ "span",
1622
+ "srclang",
1623
+ "start",
1624
+ "src",
1625
+ "srcset",
1626
+ "step",
1627
+ "style",
1628
+ "summary",
1629
+ "tabindex",
1630
+ "title",
1631
+ "translate",
1632
+ "type",
1633
+ "usemap",
1634
+ "valign",
1635
+ "value",
1636
+ "width",
1637
+ "wrap",
1638
+ "xmlns"
1639
+ ]), ge = M([
1640
+ "accent-height",
1641
+ "accumulate",
1642
+ "additive",
1643
+ "alignment-baseline",
1644
+ "amplitude",
1645
+ "ascent",
1646
+ "attributename",
1647
+ "attributetype",
1648
+ "azimuth",
1649
+ "basefrequency",
1650
+ "baseline-shift",
1651
+ "begin",
1652
+ "bias",
1653
+ "by",
1654
+ "class",
1655
+ "clip",
1656
+ "clippathunits",
1657
+ "clip-path",
1658
+ "clip-rule",
1659
+ "color",
1660
+ "color-interpolation",
1661
+ "color-interpolation-filters",
1662
+ "color-profile",
1663
+ "color-rendering",
1664
+ "cx",
1665
+ "cy",
1666
+ "d",
1667
+ "dx",
1668
+ "dy",
1669
+ "diffuseconstant",
1670
+ "direction",
1671
+ "display",
1672
+ "divisor",
1673
+ "dominant-baseline",
1674
+ "dur",
1675
+ "edgemode",
1676
+ "elevation",
1677
+ "end",
1678
+ "exponent",
1679
+ "fill",
1680
+ "fill-opacity",
1681
+ "fill-rule",
1682
+ "filter",
1683
+ "filterunits",
1684
+ "flood-color",
1685
+ "flood-opacity",
1686
+ "font-family",
1687
+ "font-size",
1688
+ "font-size-adjust",
1689
+ "font-stretch",
1690
+ "font-style",
1691
+ "font-variant",
1692
+ "font-weight",
1693
+ "fx",
1694
+ "fy",
1695
+ "g1",
1696
+ "g2",
1697
+ "glyph-name",
1698
+ "glyphref",
1699
+ "gradientunits",
1700
+ "gradienttransform",
1701
+ "height",
1702
+ "href",
1703
+ "id",
1704
+ "image-rendering",
1705
+ "in",
1706
+ "in2",
1707
+ "intercept",
1708
+ "k",
1709
+ "k1",
1710
+ "k2",
1711
+ "k3",
1712
+ "k4",
1713
+ "kerning",
1714
+ "keypoints",
1715
+ "keysplines",
1716
+ "keytimes",
1717
+ "lang",
1718
+ "lengthadjust",
1719
+ "letter-spacing",
1720
+ "kernelmatrix",
1721
+ "kernelunitlength",
1722
+ "lighting-color",
1723
+ "local",
1724
+ "marker-end",
1725
+ "marker-mid",
1726
+ "marker-start",
1727
+ "markerheight",
1728
+ "markerunits",
1729
+ "markerwidth",
1730
+ "maskcontentunits",
1731
+ "maskunits",
1732
+ "max",
1733
+ "mask",
1734
+ "mask-type",
1735
+ "media",
1736
+ "method",
1737
+ "mode",
1738
+ "min",
1739
+ "name",
1740
+ "numoctaves",
1741
+ "offset",
1742
+ "operator",
1743
+ "opacity",
1744
+ "order",
1745
+ "orient",
1746
+ "orientation",
1747
+ "origin",
1748
+ "overflow",
1749
+ "paint-order",
1750
+ "path",
1751
+ "pathlength",
1752
+ "patterncontentunits",
1753
+ "patterntransform",
1754
+ "patternunits",
1755
+ "pointer-events",
1756
+ "points",
1757
+ "preservealpha",
1758
+ "preserveaspectratio",
1759
+ "primitiveunits",
1760
+ "r",
1761
+ "rx",
1762
+ "ry",
1763
+ "radius",
1764
+ "refx",
1765
+ "refy",
1766
+ "repeatcount",
1767
+ "repeatdur",
1768
+ "restart",
1769
+ "result",
1770
+ "rotate",
1771
+ "scale",
1772
+ "seed",
1773
+ "shape-rendering",
1774
+ "slope",
1775
+ "specularconstant",
1776
+ "specularexponent",
1777
+ "spreadmethod",
1778
+ "startoffset",
1779
+ "stddeviation",
1780
+ "stitchtiles",
1781
+ "stop-color",
1782
+ "stop-opacity",
1783
+ "stroke-dasharray",
1784
+ "stroke-dashoffset",
1785
+ "stroke-linecap",
1786
+ "stroke-linejoin",
1787
+ "stroke-miterlimit",
1788
+ "stroke-opacity",
1789
+ "stroke",
1790
+ "stroke-width",
1791
+ "style",
1792
+ "surfacescale",
1793
+ "systemlanguage",
1794
+ "tabindex",
1795
+ "tablevalues",
1796
+ "targetx",
1797
+ "targety",
1798
+ "transform",
1799
+ "transform-origin",
1800
+ "text-anchor",
1801
+ "text-decoration",
1802
+ "text-orientation",
1803
+ "text-rendering",
1804
+ "textlength",
1805
+ "type",
1806
+ "u1",
1807
+ "u2",
1808
+ "unicode",
1809
+ "values",
1810
+ "vector-effect",
1811
+ "viewbox",
1812
+ "visibility",
1813
+ "version",
1814
+ "vert-adv-y",
1815
+ "vert-origin-x",
1816
+ "vert-origin-y",
1817
+ "width",
1818
+ "word-spacing",
1819
+ "wrap",
1820
+ "writing-mode",
1821
+ "xchannelselector",
1822
+ "ychannelselector",
1823
+ "x",
1824
+ "x1",
1825
+ "x2",
1826
+ "xmlns",
1827
+ "y",
1828
+ "y1",
1829
+ "y2",
1830
+ "z",
1831
+ "zoomandpan"
1832
+ ]), ho = M([
1833
+ "accent",
1834
+ "accentunder",
1835
+ "align",
1836
+ "bevelled",
1837
+ "close",
1838
+ "columnalign",
1839
+ "columnlines",
1840
+ "columnspacing",
1841
+ "columnspan",
1842
+ "denomalign",
1843
+ "depth",
1844
+ "dir",
1845
+ "display",
1846
+ "displaystyle",
1847
+ "encoding",
1848
+ "fence",
1849
+ "frame",
1850
+ "height",
1851
+ "href",
1852
+ "id",
1853
+ "largeop",
1854
+ "length",
1855
+ "linethickness",
1856
+ "lquote",
1857
+ "lspace",
1858
+ "mathbackground",
1859
+ "mathcolor",
1860
+ "mathsize",
1861
+ "mathvariant",
1862
+ "maxsize",
1863
+ "minsize",
1864
+ "movablelimits",
1865
+ "notation",
1866
+ "numalign",
1867
+ "open",
1868
+ "rowalign",
1869
+ "rowlines",
1870
+ "rowspacing",
1871
+ "rowspan",
1872
+ "rspace",
1873
+ "rquote",
1874
+ "scriptlevel",
1875
+ "scriptminsize",
1876
+ "scriptsizemultiplier",
1877
+ "selection",
1878
+ "separator",
1879
+ "separators",
1880
+ "stretchy",
1881
+ "subscriptshift",
1882
+ "supscriptshift",
1883
+ "symmetric",
1884
+ "voffset",
1885
+ "width",
1886
+ "xmlns"
1887
+ ]), jt = M([
1888
+ "xlink:href",
1889
+ "xml:id",
1890
+ "xlink:title",
1891
+ "xml:space",
1892
+ "xmlns:xlink"
1893
+ ]), Pn = I(/{{[\w\W]*|^[\w\W]*}}/g), zn = I(/<%[\w\W]*|^[\w\W]*%>/g), Bn = I(/\${[\w\W]*/g), Fn = I(/^data-[\-\w.\u00B7-\uFFFF]+$/), Hn = I(/^aria-[\-\w]+$/), mo = I(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), Un = I(/^(?:\w+script|data):/i), jn = I(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Wn = I(/^html$/i), $n = I(/^[a-z][.\w]*(-[.\w]+)+$/i), go = I(/<[/\w!]/g), bo = I(/<[/\w]/g), Gn = I(/<\/no(script|embed|frames)/i), Kn = I(/\/>/i), F = {
1894
+ element: 1,
1895
+ attribute: 2,
1896
+ text: 3,
1897
+ cdataSection: 4,
1898
+ entityReference: 5,
1899
+ entityNode: 6,
1900
+ processingInstruction: 7,
1901
+ comment: 8,
1902
+ document: 9,
1903
+ documentType: 10,
1904
+ documentFragment: 11,
1905
+ notation: 12
1906
+ }, Ao = [
1907
+ "style",
1908
+ "script",
1909
+ "xmp",
1910
+ "iframe",
1911
+ "noembed",
1912
+ "noframes",
1913
+ "plaintext",
1914
+ "noscript"
1915
+ ], Yn = M(v({}, Ao)), qn = (function() {
1916
+ const s = {};
1917
+ return it(Ao, (t) => {
1918
+ s[t] = I(new RegExp("</" + t + "(?=[\\t\\n\\f\\r />])", "i"));
1919
+ }), M(s);
1920
+ })(), Vn = function() {
1921
+ return typeof window == "undefined" ? null : window;
1922
+ }, Xn = function(t, e) {
1923
+ if (typeof t != "object" || typeof t.createPolicy != "function") return null;
1924
+ let o = null;
1925
+ const i = "data-tt-policy-suffix";
1926
+ e && e.hasAttribute(i) && (o = e.getAttribute(i));
1927
+ const r = "dompurify" + (o ? "#" + o : "");
1928
+ try {
1929
+ return t.createPolicy(r, {
1930
+ createHTML(l) {
1931
+ return l;
1932
+ },
1933
+ createScriptURL(l) {
1934
+ return l;
1935
+ }
1936
+ });
1937
+ } catch (l) {
1938
+ return console.warn("TrustedTypes policy " + r + " could not be created."), null;
1939
+ }
1940
+ }, yo = function() {
1941
+ return {
1942
+ afterSanitizeAttributes: [],
1943
+ afterSanitizeElements: [],
1944
+ afterSanitizeShadowDOM: [],
1945
+ beforeSanitizeAttributes: [],
1946
+ beforeSanitizeElements: [],
1947
+ beforeSanitizeShadowDOM: [],
1948
+ uponSanitizeAttribute: [],
1949
+ uponSanitizeElement: [],
1950
+ uponSanitizeShadowNode: []
1951
+ };
1952
+ }, Z = function(t, e, o, i) {
1953
+ return z(t, e) && bt(t[e]) ? v(i.base ? H(i.base) : {}, t[e], i.transform) : o;
1954
+ }, be = function(t, e, o) {
1955
+ const i = z(t, e) ? t[e] : void 0;
1956
+ return i && typeof i == "object" ? H(i) : o();
1957
+ };
1958
+ function Co() {
1959
+ let s = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Vn();
1960
+ const t = (u) => Co(u);
1961
+ if (t.version = "3.4.16", t.removed = [], !s || !s.document || s.document.nodeType !== F.document || !s.Element)
1962
+ return t.isSupported = !1, t;
1963
+ let e = s.document;
1964
+ const o = e, i = o.currentScript;
1965
+ s.DocumentFragment;
1966
+ const r = s.HTMLTemplateElement, l = s.Node, c = s.Element, p = s.NodeFilter;
1967
+ s.NamedNodeMap === void 0 && (s.NamedNodeMap || s.MozNamedAttrMap), s.HTMLFormElement;
1968
+ const m = s.DOMParser, b = s.trustedTypes, w = c.prototype, _ = j(w, "cloneNode"), T = j(w, "remove"), E = j(w, "removeAttributeNode"), K = j(w, "nextSibling"), D = j(w, "childNodes"), N = j(w, "parentNode"), xe = j(w, "shadowRoot"), Yt = j(w, "attributes"), Q = l && l.prototype ? j(l.prototype, "nodeType") : null, rt = l && l.prototype ? j(l.prototype, "nodeName") : null, _t = l && l.prototype ? j(l.prototype, "ownerDocument") : null, yt = function(n) {
1969
+ return Q ? Q(n) : n.nodeType;
1970
+ }, qt = function(n) {
1971
+ return rt ? rt(n) : n.nodeName;
1972
+ };
1973
+ if (typeof r == "function") {
1974
+ const u = e.createElement("template");
1975
+ u.content && u.content.ownerDocument && (e = u.content.ownerDocument);
1976
+ }
1977
+ let P, tt = "", Vt, Ae = !1, vt = 0;
1978
+ const Ce = function() {
1979
+ if (vt > 0) throw X('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
1980
+ }, at = function(n) {
1981
+ Ce(), vt++;
1982
+ try {
1983
+ return P.createHTML(n);
1984
+ } finally {
1985
+ vt--;
1986
+ }
1987
+ }, Lo = function(n) {
1988
+ Ce(), vt++;
1989
+ try {
1990
+ return P.createScriptURL(n);
1991
+ } finally {
1992
+ vt--;
1993
+ }
1994
+ }, Mo = function() {
1995
+ return Ae || (Vt = Xn(b, i), Ae = !0), Vt;
1996
+ }, Lt = e, Xt = Lt.implementation, Se = Lt.createNodeIterator, Io = Lt.createDocumentFragment, Oo = Lt.getElementsByTagName, Do = o.importNode;
1997
+ let k = yo();
1998
+ t.isSupported = typeof ko == "function" && typeof N == "function" && Xt && Xt.createHTMLDocument !== void 0;
1999
+ const Ro = Pn, No = zn, Po = Bn, zo = Fn, Bo = Hn, Fo = Un, _e = jn, Ho = $n;
2000
+ let Le = mo, x = null;
2001
+ const Zt = v({}, [
2002
+ ...uo,
2003
+ ...pe,
2004
+ ...he,
2005
+ ...me,
2006
+ ...fo
2007
+ ]);
2008
+ let A = null;
2009
+ const Jt = v({}, [
2010
+ ...po,
2011
+ ...ge,
2012
+ ...ho,
2013
+ ...jt
2014
+ ]);
2015
+ let W = Object.seal(mt(null, {
2016
+ tagNameCheck: {
2017
+ writable: !0,
2018
+ configurable: !1,
2019
+ enumerable: !0,
2020
+ value: null
2021
+ },
2022
+ attributeNameCheck: {
2023
+ writable: !0,
2024
+ configurable: !1,
2025
+ enumerable: !0,
2026
+ value: null
2027
+ },
2028
+ allowCustomizedBuiltInElements: {
2029
+ writable: !0,
2030
+ configurable: !1,
2031
+ enumerable: !0,
2032
+ value: !1
2033
+ }
2034
+ })), Et = null, Me = null;
2035
+ const Y = Object.seal(mt(null, {
2036
+ tagCheck: {
2037
+ writable: !0,
2038
+ configurable: !1,
2039
+ enumerable: !0,
2040
+ value: null
2041
+ },
2042
+ attributeCheck: {
2043
+ writable: !0,
2044
+ configurable: !1,
2045
+ enumerable: !0,
2046
+ value: null
2047
+ }
2048
+ }));
2049
+ let Ie = !0, Qt = !0, Oe = !1, De = !0, q = !1, et = !0, ot = !1, te = !1, Mt = null, It = null, ee = !1, st = !1, Ot = !1, Dt = !1, Re = !0, Ne = !1;
2050
+ const Pe = "user-content-";
2051
+ let oe = !0, ne = !1, lt = {}, ct = null;
2052
+ const ze = v({}, [
2053
+ "annotation-xml",
2054
+ "audio",
2055
+ "colgroup",
2056
+ "desc",
2057
+ "foreignobject",
2058
+ "head",
2059
+ "iframe",
2060
+ "math",
2061
+ "mi",
2062
+ "mn",
2063
+ "mo",
2064
+ "ms",
2065
+ "mtext",
2066
+ "noembed",
2067
+ "noframes",
2068
+ "noscript",
2069
+ "plaintext",
2070
+ "script",
2071
+ "selectedcontent",
2072
+ "style",
2073
+ "svg",
2074
+ "template",
2075
+ "thead",
2076
+ "title",
2077
+ "video",
2078
+ "xmp"
2079
+ ]);
2080
+ let Be = null;
2081
+ const Fe = v({}, [
2082
+ "audio",
2083
+ "video",
2084
+ "img",
2085
+ "source",
2086
+ "image",
2087
+ "track"
2088
+ ]);
2089
+ let He = null;
2090
+ const Ue = v({}, [
2091
+ "alt",
2092
+ "class",
2093
+ "for",
2094
+ "id",
2095
+ "label",
2096
+ "name",
2097
+ "pattern",
2098
+ "placeholder",
2099
+ "role",
2100
+ "summary",
2101
+ "title",
2102
+ "value",
2103
+ "style",
2104
+ "xmlns"
2105
+ ]), Rt = "http://www.w3.org/1998/Math/MathML", Nt = "http://www.w3.org/2000/svg", $ = "http://www.w3.org/1999/xhtml";
2106
+ let dt = $, ie = !1, re = null;
2107
+ const Uo = v({}, [
2108
+ Rt,
2109
+ Nt,
2110
+ $
2111
+ ], fe), je = M([
2112
+ "mi",
2113
+ "mo",
2114
+ "mn",
2115
+ "ms",
2116
+ "mtext"
2117
+ ]);
2118
+ let ae = v({}, je);
2119
+ const We = M(["annotation-xml"]);
2120
+ let se = v({}, We);
2121
+ const jo = v({}, [
2122
+ "title",
2123
+ "style",
2124
+ "font",
2125
+ "a",
2126
+ "script"
2127
+ ]);
2128
+ let wt = null;
2129
+ const Wo = ["application/xhtml+xml", "text/html"], $o = "text/html";
2130
+ let S = null, ut = null;
2131
+ const Go = e.createElement("form"), $e = function(n) {
2132
+ return n instanceof RegExp || n instanceof Function;
2133
+ }, le = function() {
2134
+ let n = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2135
+ if (ut && ut === n) return;
2136
+ (!n || typeof n != "object") && (n = {}), n = H(n), wt = Wo.indexOf(n.PARSER_MEDIA_TYPE) === -1 ? $o : n.PARSER_MEDIA_TYPE, S = wt === "application/xhtml+xml" ? fe : St, x = Z(n, "ALLOWED_TAGS", Zt, { transform: S }), A = Z(n, "ALLOWED_ATTR", Jt, { transform: S }), re = Z(n, "ALLOWED_NAMESPACES", Uo, { transform: fe }), He = Z(n, "ADD_URI_SAFE_ATTR", Ue, {
2137
+ transform: S,
2138
+ base: Ue
2139
+ }), Be = Z(n, "ADD_DATA_URI_TAGS", Fe, {
2140
+ transform: S,
2141
+ base: Fe
2142
+ }), ct = Z(n, "FORBID_CONTENTS", ze, { transform: S }), Et = Z(n, "FORBID_TAGS", H({}), { transform: S }), Me = Z(n, "FORBID_ATTR", H({}), { transform: S }), lt = z(n, "USE_PROFILES") ? n.USE_PROFILES && typeof n.USE_PROFILES == "object" ? H(n.USE_PROFILES) : n.USE_PROFILES : !1, Ie = n.ALLOW_ARIA_ATTR !== !1, Qt = n.ALLOW_DATA_ATTR !== !1, Oe = n.ALLOW_UNKNOWN_PROTOCOLS || !1, De = n.ALLOW_SELF_CLOSE_IN_ATTR !== !1, q = n.SAFE_FOR_TEMPLATES || !1, et = n.SAFE_FOR_XML !== !1, ot = n.WHOLE_DOCUMENT || !1, st = n.RETURN_DOM || !1, Ot = n.RETURN_DOM_FRAGMENT || !1, Dt = n.RETURN_TRUSTED_TYPE || !1, ee = n.FORCE_BODY || !1, Re = n.SANITIZE_DOM !== !1, Ne = n.SANITIZE_NAMED_PROPS || !1, oe = n.KEEP_CONTENT !== !1, ne = n.IN_PLACE || !1, Le = Dn(n.ALLOWED_URI_REGEXP) ? n.ALLOWED_URI_REGEXP : mo, dt = typeof n.NAMESPACE == "string" ? n.NAMESPACE : $, ae = be(n, "MATHML_TEXT_INTEGRATION_POINTS", () => v({}, je)), se = be(n, "HTML_INTEGRATION_POINTS", () => v({}, We));
2143
+ const a = be(n, "CUSTOM_ELEMENT_HANDLING", () => mt(null));
2144
+ if (W = mt(null), z(a, "tagNameCheck") && $e(a.tagNameCheck) && (W.tagNameCheck = a.tagNameCheck), z(a, "attributeNameCheck") && $e(a.attributeNameCheck) && (W.attributeNameCheck = a.attributeNameCheck), z(a, "allowCustomizedBuiltInElements") && typeof a.allowCustomizedBuiltInElements == "boolean" && (W.allowCustomizedBuiltInElements = a.allowCustomizedBuiltInElements), I(W), q && (Qt = !1), Ot && (st = !0), lt && (x = v({}, fo), A = mt(null), lt.html === !0 && (v(x, uo), v(A, po)), lt.svg === !0 && (v(x, pe), v(A, ge), v(A, jt)), lt.svgFilters === !0 && (v(x, he), v(A, ge), v(A, jt)), lt.mathMl === !0 && (v(x, me), v(A, ho), v(A, jt))), Y.tagCheck = null, Y.attributeCheck = null, z(n, "ADD_TAGS") && (typeof n.ADD_TAGS == "function" ? Y.tagCheck = n.ADD_TAGS : bt(n.ADD_TAGS) && (x === Zt && (x = H(x)), v(x, n.ADD_TAGS, S))), z(n, "ADD_ATTR") && (typeof n.ADD_ATTR == "function" ? Y.attributeCheck = n.ADD_ATTR : bt(n.ADD_ATTR) && (A === Jt && (A = H(A)), v(A, n.ADD_ATTR, S))), z(n, "ADD_FORBID_CONTENTS") && bt(n.ADD_FORBID_CONTENTS) && (ct === ze && (ct = H(ct)), v(ct, n.ADD_FORBID_CONTENTS, S)), oe && (x["#text"] = !0), ot && v(x, [
2145
+ "html",
2146
+ "head",
2147
+ "body"
2148
+ ]), x.table && (v(x, ["tbody"]), delete Et.tbody), n.TRUSTED_TYPES_POLICY) {
2149
+ if (typeof n.TRUSTED_TYPES_POLICY.createHTML != "function") throw X('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
2150
+ if (typeof n.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw X('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
2151
+ const d = P;
2152
+ P = n.TRUSTED_TYPES_POLICY;
2153
+ try {
2154
+ tt = at("");
2155
+ } catch (f) {
2156
+ throw P = d, f;
2157
+ }
2158
+ } else n.TRUSTED_TYPES_POLICY === null ? (P = void 0, tt = "") : (P === void 0 && (P = Mo()), P && typeof tt == "string" && (tt = at("")));
2159
+ M && M(n), ut = n;
2160
+ }, Ge = v({}, [
2161
+ ...pe,
2162
+ ...he,
2163
+ ...Rn
2164
+ ]), Ke = v({}, [...me, ...Nn]), Ko = function(n, a, d) {
2165
+ return a.namespaceURI === $ ? n === "svg" : a.namespaceURI === Rt ? n === "svg" && (d === "annotation-xml" || ae[d]) : !!Ge[n];
2166
+ }, Yo = function(n, a, d) {
2167
+ return a.namespaceURI === $ ? n === "math" : a.namespaceURI === Nt ? n === "math" && se[d] : !!Ke[n];
2168
+ }, qo = function(n, a, d) {
2169
+ return a.namespaceURI === Nt && !se[d] || a.namespaceURI === Rt && !ae[d] ? !1 : !Ke[n] && (jo[n] || !Ge[n]);
2170
+ }, Vo = function(n) {
2171
+ let a = N(n);
2172
+ (!a || !a.tagName) && (a = {
2173
+ namespaceURI: dt,
2174
+ tagName: "template"
2175
+ });
2176
+ const d = St(n.tagName), f = St(a.tagName);
2177
+ return re[n.namespaceURI] ? n.namespaceURI === Nt ? Ko(d, a, f) : n.namespaceURI === Rt ? Yo(d, a, f) : n.namespaceURI === $ ? qo(d, a, f) : !!(wt === "application/xhtml+xml" && re[n.namespaceURI]) : !1;
2178
+ }, V = function(n) {
2179
+ kt(t.removed, { element: n });
2180
+ try {
2181
+ N(n).removeChild(n);
2182
+ } catch (a) {
2183
+ if (T(n), !N(n)) throw X("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
2184
+ }
2185
+ }, Ye = function(n, a, d) {
2186
+ try {
2187
+ E(n, a);
2188
+ } catch (f) {
2189
+ try {
2190
+ n.removeAttribute(d);
2191
+ } catch (h) {
2192
+ }
2193
+ }
2194
+ }, Pt = function(n) {
2195
+ zt(n);
2196
+ const a = D(n);
2197
+ if (a) {
2198
+ const f = [];
2199
+ it(a, (h) => {
2200
+ kt(f, h);
2201
+ }), it(f, (h) => {
2202
+ try {
2203
+ T(h);
2204
+ } catch (g) {
2205
+ }
2206
+ });
2207
+ }
2208
+ const d = Yt(n);
2209
+ if (d) for (let f = d.length - 1; f >= 0; --f) {
2210
+ const h = d[f], g = h && h.name;
2211
+ typeof g == "string" && Ye(n, h, g);
2212
+ }
2213
+ }, nt = function(n, a, d) {
2214
+ if (!d) try {
2215
+ d = a.getAttributeNode(n);
2216
+ } catch (f) {
2217
+ d = null;
2218
+ }
2219
+ kt(t.removed, {
2220
+ attribute: d || null,
2221
+ from: a
2222
+ });
2223
+ try {
2224
+ d ? E(a, d) : a.removeAttribute(n);
2225
+ } catch (f) {
2226
+ try {
2227
+ a.removeAttribute(n);
2228
+ } catch (h) {
2229
+ }
2230
+ }
2231
+ if (n === "is")
2232
+ if (st || Ot) try {
2233
+ V(a);
2234
+ } catch (f) {
2235
+ }
2236
+ else try {
2237
+ a.setAttribute(n, "");
2238
+ } catch (f) {
2239
+ }
2240
+ }, Xo = function(n) {
2241
+ const a = Yt(n);
2242
+ if (a)
2243
+ for (let d = a.length - 1; d >= 0; --d) {
2244
+ const f = a[d], h = f && f.name;
2245
+ typeof h != "string" || A[S(h)] || Ye(n, f, h);
2246
+ }
2247
+ }, zt = function(n) {
2248
+ const a = [n];
2249
+ for (; a.length > 0; ) {
2250
+ const d = a.pop();
2251
+ yt(d) === F.element && Xo(d);
2252
+ const f = D(d);
2253
+ if (f) for (let h = f.length - 1; h >= 0; --h) a.push(f[h]);
2254
+ }
2255
+ }, qe = function(n, a) {
2256
+ return et ? n === "patchsrc" ? !0 : n === "for" && a !== "label" && a !== "output" : !1;
2257
+ }, Zo = function(n) {
2258
+ if (!et) return;
2259
+ const a = [n];
2260
+ for (; a.length > 0; ) {
2261
+ const d = a.pop(), f = yt(d);
2262
+ if (f === F.processingInstruction || f === F.comment && O(bo, d.data)) {
2263
+ try {
2264
+ T(d);
2265
+ } catch (g) {
2266
+ }
2267
+ continue;
2268
+ }
2269
+ if (f === F.element) {
2270
+ const g = d, y = S(qt(d));
2271
+ try {
2272
+ g.hasAttribute && g.hasAttribute("patchsrc") && g.removeAttribute("patchsrc"), g.hasAttribute && g.hasAttribute("for") && qe("for", y) && g.removeAttribute("for");
2273
+ } catch (C) {
2274
+ }
2275
+ }
2276
+ const h = D(d);
2277
+ if (h) for (let g = h.length - 1; g >= 0; --g) a.push(h[g]);
2278
+ }
2279
+ }, Ve = function(n) {
2280
+ let a = null, d = null;
2281
+ if (ee) n = "<remove></remove>" + n;
2282
+ else {
2283
+ const g = ao(n, /^[\r\n\t ]+/);
2284
+ d = g && g[0];
2285
+ }
2286
+ wt === "application/xhtml+xml" && dt === $ && (n = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + n + "</body></html>");
2287
+ const f = P ? at(n) : n;
2288
+ if (dt === $) try {
2289
+ a = new m().parseFromString(f, wt);
2290
+ } catch (g) {
2291
+ }
2292
+ if (!a || !a.documentElement) {
2293
+ a = Xt.createDocument(dt, "template", null);
2294
+ try {
2295
+ a.documentElement.innerHTML = ie ? tt : f;
2296
+ } catch (g) {
2297
+ }
2298
+ }
2299
+ const h = a.body || a.documentElement;
2300
+ return n && d && h.insertBefore(e.createTextNode(d), h.childNodes[0] || null), dt === $ ? Oo.call(a, ot ? "html" : "body")[0] : ot ? a.documentElement : h;
2301
+ }, Xe = function(n) {
2302
+ const a = _t ? _t(n) : n.ownerDocument;
2303
+ return Se.call(a || n, n, p.SHOW_ELEMENT | p.SHOW_COMMENT | p.SHOW_TEXT | p.SHOW_PROCESSING_INSTRUCTION | p.SHOW_CDATA_SECTION, null);
2304
+ }, Bt = function(n) {
2305
+ return n = xt(n, Ro, " "), n = xt(n, No, " "), n = xt(n, Po, " "), n;
2306
+ }, ce = function(n) {
2307
+ var a;
2308
+ n.normalize();
2309
+ const d = _t ? _t(n) : n.ownerDocument, f = Se.call(d || n, n, p.SHOW_TEXT | p.SHOW_COMMENT | p.SHOW_CDATA_SECTION | p.SHOW_PROCESSING_INSTRUCTION, null);
2310
+ let h = f.nextNode();
2311
+ for (; h; )
2312
+ h.data = Bt(h.data), h = f.nextNode();
2313
+ const g = (a = n.querySelectorAll) === null || a === void 0 ? void 0 : a.call(n, "template");
2314
+ g && it(g, (y) => {
2315
+ ft(y.content) && ce(y.content);
2316
+ });
2317
+ }, Ft = function(n) {
2318
+ const a = rt ? rt(n) : null;
2319
+ return typeof a != "string" || S(a) !== "form" ? !1 : typeof n.nodeName != "string" || typeof n.textContent != "string" || typeof n.removeChild != "function" || n.attributes !== Yt(n) || typeof n.removeAttribute != "function" || typeof n.removeAttributeNode != "function" || typeof n.getAttributeNode != "function" || typeof n.setAttribute != "function" || typeof n.namespaceURI != "string" || typeof n.insertBefore != "function" || typeof n.hasChildNodes != "function" || n.nodeType !== Q(n) || n.childNodes !== D(n);
2320
+ }, ft = function(n) {
2321
+ if (!Q || typeof n != "object" || n === null) return !1;
2322
+ try {
2323
+ return Q(n) === F.documentFragment;
2324
+ } catch (a) {
2325
+ return !1;
2326
+ }
2327
+ }, Tt = function(n) {
2328
+ if (!Q || typeof n != "object" || n === null) return !1;
2329
+ try {
2330
+ return typeof Q(n) == "number";
2331
+ } catch (a) {
2332
+ return !1;
2333
+ }
2334
+ };
2335
+ function G(u, n, a) {
2336
+ u.length !== 0 && it(u, (d) => {
2337
+ d.call(t, n, a, ut);
2338
+ });
2339
+ }
2340
+ const Jo = function(n, a) {
2341
+ return !!(et && n.hasChildNodes() && !Tt(n.firstElementChild) && O(go, n.textContent) && O(go, n.innerHTML) || et && n.namespaceURI === $ && Yn[a] && (Tt(n.firstElementChild) || typeof n.textContent == "string" && O(qn[a], n.textContent)) || n.nodeType === F.processingInstruction || et && n.nodeType === F.comment && O(bo, n.data));
2342
+ }, Ht = function(n, a) {
2343
+ if (n instanceof RegExp) return O(n, a);
2344
+ if (n instanceof Function) {
2345
+ for (var d = arguments.length, f = new Array(d > 2 ? d - 2 : 0), h = 2; h < d; h++) f[h - 2] = arguments[h];
2346
+ return !!n(a, ...f);
2347
+ }
2348
+ return !1;
2349
+ }, Qo = function(n, a, d) {
2350
+ if (!Et[a] && to(a) && Ht(W.tagNameCheck, a)) return !1;
2351
+ if (oe && !ct[a]) {
2352
+ const f = N(n), h = D(n);
2353
+ if (h && f) {
2354
+ const g = h.length;
2355
+ for (let y = g - 1; y >= 0; --y) {
2356
+ const C = n === d ? _(h[y], !0) : h[y];
2357
+ f.insertBefore(C, K(n));
2358
+ }
2359
+ }
2360
+ }
2361
+ return V(n), !0;
2362
+ }, Ze = function(n, a, d, f) {
2363
+ return n.length === 0 ? a : a === d || a === f ? H(a) : a;
2364
+ }, pt = function(n, a) {
2365
+ return n === a || N(n) !== null ? !1 : (ne && zt(n), !0);
2366
+ }, Je = function(n, a) {
2367
+ if (G(k.beforeSanitizeElements, n, null), pt(n, a)) return !0;
2368
+ if (Ft(n))
2369
+ return V(n), !0;
2370
+ const d = S(qt(n));
2371
+ if (x = Ze(k.uponSanitizeElement, x, Zt, Mt), G(k.uponSanitizeElement, n, {
2372
+ tagName: d,
2373
+ allowedTags: x
2374
+ }), pt(n, a)) return !0;
2375
+ if (Jo(n, d))
2376
+ return V(n), !0;
2377
+ if (Et[d] || !(Y.tagCheck instanceof Function && Y.tagCheck(d)) && !x[d]) {
2378
+ const f = Qo(n, d, a);
2379
+ return f === !1 && (G(k.afterSanitizeElements, n, null), pt(n, a)) ? !0 : f;
2380
+ }
2381
+ if (yt(n) === F.element && !Vo(n) || (d === "noscript" || d === "noembed" || d === "noframes") && O(Gn, n.innerHTML))
2382
+ return V(n), !0;
2383
+ if (q && n.nodeType === F.text) {
2384
+ const f = Bt(n.textContent);
2385
+ n.textContent !== f && (kt(t.removed, { element: n.cloneNode() }), n.textContent = f);
2386
+ }
2387
+ return G(k.afterSanitizeElements, n, null), pt(n, a);
2388
+ }, Qe = function(n, a, d) {
2389
+ if (Me[a] || qe(a, n) || Re && (a === "id" || a === "name") && (d in e || d in Go)) return !1;
2390
+ const f = A[a] || Y.attributeCheck instanceof Function && Y.attributeCheck(a, n);
2391
+ return Qt && O(zo, a) || Ie && O(Bo, a) ? !0 : f ? He[a] || O(Le, xt(d, _e, "")) || (a === "src" || a === "xlink:href" || a === "href") && n !== "script" && so(d, "data:") === 0 && Be[n] || Oe && !O(Fo, xt(d, _e, "")) ? !0 : !d : to(n) && Ht(W.tagNameCheck, n) && Ht(W.attributeNameCheck, a, n) || a === "is" && W.allowCustomizedBuiltInElements && Ht(W.tagNameCheck, d);
2392
+ }, tn = v({}, [
2393
+ "annotation-xml",
2394
+ "color-profile",
2395
+ "font-face",
2396
+ "font-face-format",
2397
+ "font-face-name",
2398
+ "font-face-src",
2399
+ "font-face-uri",
2400
+ "missing-glyph"
2401
+ ]), to = function(n) {
2402
+ return !tn[St(n)] && O(Ho, n);
2403
+ }, en = function(n, a, d, f) {
2404
+ if (P && typeof b == "object" && typeof b.getAttributeType == "function" && !d) switch (b.getAttributeType(n, a)) {
2405
+ case "TrustedHTML":
2406
+ return at(f);
2407
+ case "TrustedScriptURL":
2408
+ return Lo(f);
2409
+ }
2410
+ return f;
2411
+ }, on = function(n, a, d, f) {
2412
+ try {
2413
+ return d ? n.setAttributeNS(d, a, f) : n.setAttribute(a, f), Ft(n) ? (V(n), !1) : !0;
2414
+ } catch (h) {
2415
+ return nt(a, n), !1;
2416
+ }
2417
+ }, eo = function(n, a) {
2418
+ if (G(k.beforeSanitizeAttributes, n, null), pt(n, a)) return;
2419
+ const d = n.attributes;
2420
+ if (!d || Ft(n)) return;
2421
+ A = Ze(k.uponSanitizeAttribute, A, Jt, It);
2422
+ const f = {
2423
+ attrName: "",
2424
+ attrValue: "",
2425
+ keepAttr: !0,
2426
+ allowedAttributes: A,
2427
+ forceKeepAttr: void 0
2428
+ };
2429
+ let h = d.length;
2430
+ const g = S(n.nodeName);
2431
+ for (; h--; ) {
2432
+ const y = d[h], C = y.name, U = y.namespaceURI, B = y.value, ht = S(C), ue = B;
2433
+ let R = C === "value" ? ue : Sn(ue), oo = !1;
2434
+ if (f.attrName = ht, f.attrValue = R, f.keepAttr = !0, f.forceKeepAttr = void 0, G(k.uponSanitizeAttribute, n, f), R = f.attrValue, Ne && (ht === "id" || ht === "name") && so(R, Pe) !== 0 && (nt(C, n, y), R = Pe + R, oo = !0), et && O(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, R)) {
2435
+ nt(C, n, y);
2436
+ continue;
2437
+ }
2438
+ if (ht === "attributename" && ao(R, "href")) {
2439
+ nt(C, n, y);
2440
+ continue;
2441
+ }
2442
+ if (!f.forceKeepAttr) {
2443
+ if (!f.keepAttr) {
2444
+ nt(C, n, y);
2445
+ continue;
2446
+ }
2447
+ if (!De && O(Kn, R)) {
2448
+ nt(C, n, y);
2449
+ continue;
2450
+ }
2451
+ if (q && (R = Bt(R)), !Qe(g, ht, R)) {
2452
+ nt(C, n, y);
2453
+ continue;
2454
+ }
2455
+ R = en(g, ht, U, R), R !== ue && on(n, C, U, R) && oo && ro(t.removed);
2456
+ }
2457
+ }
2458
+ G(k.afterSanitizeAttributes, n, null), pt(n, a);
2459
+ }, Ut = function(n) {
2460
+ let a = null;
2461
+ const d = Xe(n);
2462
+ for (G(k.beforeSanitizeShadowDOM, n, null); a = d.nextNode(); )
2463
+ if (G(k.uponSanitizeShadowNode, a, null), Je(a, n), eo(a, n), ft(a.content) && Ut(a.content), yt(a) === F.element) {
2464
+ const f = xe(a);
2465
+ ft(f) && (de(f), Ut(f));
2466
+ }
2467
+ G(k.afterSanitizeShadowDOM, n, null);
2468
+ }, de = function(n) {
2469
+ const a = [{
2470
+ node: n,
2471
+ shadow: null
2472
+ }];
2473
+ for (; a.length > 0; ) {
2474
+ const d = a.pop();
2475
+ if (d.shadow) {
2476
+ Ut(d.shadow);
2477
+ continue;
2478
+ }
2479
+ const f = d.node, h = yt(f) === F.element, g = D(f);
2480
+ if (g) for (let y = g.length - 1; y >= 0; --y) a.push({
2481
+ node: g[y],
2482
+ shadow: null
2483
+ });
2484
+ if (h) {
2485
+ const y = rt ? rt(f) : null;
2486
+ if (typeof y == "string" && S(y) === "template") {
2487
+ const C = f.content;
2488
+ ft(C) && a.push({
2489
+ node: C,
2490
+ shadow: null
2491
+ });
2492
+ }
2493
+ }
2494
+ if (h) {
2495
+ const y = xe(f);
2496
+ ft(y) && a.push({
2497
+ node: null,
2498
+ shadow: y
2499
+ }, {
2500
+ node: y,
2501
+ shadow: null
2502
+ });
2503
+ }
2504
+ }
2505
+ };
2506
+ return t.sanitize = function(u) {
2507
+ let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, a = null, d = null, f = null, h = null;
2508
+ if (ie = !u, ie && (u = "<!-->"), typeof u != "string" && !Tt(u) && (u = On(u), typeof u != "string"))
2509
+ throw X("dirty is not a string, aborting");
2510
+ if (!t.isSupported) return u;
2511
+ te ? (x = Mt, A = It) : le(n), (k.uponSanitizeElement.length > 0 || k.uponSanitizeAttribute.length > 0) && (x = H(x)), k.uponSanitizeAttribute.length > 0 && (A = H(A)), t.removed = [];
2512
+ const g = ne && typeof u != "string" && Tt(u);
2513
+ if (g) {
2514
+ Zo(u);
2515
+ const U = qt(u);
2516
+ if (typeof U == "string") {
2517
+ const B = S(U);
2518
+ if (!x[B] || Et[B])
2519
+ throw Pt(u), X("root node is forbidden and cannot be sanitized in-place");
2520
+ }
2521
+ if (Ft(u))
2522
+ throw Pt(u), X("root node is clobbered and cannot be sanitized in-place");
2523
+ try {
2524
+ de(u);
2525
+ } catch (B) {
2526
+ throw Pt(u), B;
2527
+ }
2528
+ } else if (Tt(u))
2529
+ a = Ve("<!---->"), d = a.ownerDocument.importNode(u, !0), d.nodeType === F.element && d.nodeName === "BODY" || d.nodeName === "HTML" ? a = d : a.appendChild(d), de(a);
2530
+ else {
2531
+ if (!st && !q && !ot && u.indexOf("<") === -1) return P && Dt ? at(u) : u;
2532
+ if (a = Ve(u), !a) return st ? null : Dt ? tt : "";
2533
+ }
2534
+ a && ee && V(a.firstChild);
2535
+ const y = g ? u : a;
2536
+ try {
2537
+ const U = Xe(y);
2538
+ for (; f = U.nextNode(); )
2539
+ Je(f, y), eo(f, y), ft(f.content) && Ut(f.content);
2540
+ } catch (U) {
2541
+ throw g && (Pt(u), it(t.removed, (B) => {
2542
+ B.element && zt(B.element);
2543
+ })), U;
2544
+ }
2545
+ if (g) {
2546
+ let U = !1;
2547
+ if (it(t.removed, (B) => {
2548
+ B.element && (B.element === u && (U = !0), zt(B.element));
2549
+ }), U) throw X("a node selected for removal could not be safely returned; refusing to sanitize in place");
2550
+ return q && ce(u), u;
2551
+ }
2552
+ if (st) {
2553
+ if (q && ce(a), Ot)
2554
+ for (h = Io.call(a.ownerDocument); a.firstChild; ) h.appendChild(a.firstChild);
2555
+ else h = a;
2556
+ return (A.shadowroot || A.shadowrootmode) && (h = Do.call(o, h, !0)), h;
2557
+ }
2558
+ let C = ot ? a.outerHTML : a.innerHTML;
2559
+ return ot && x["!doctype"] && a.ownerDocument && a.ownerDocument.doctype && a.ownerDocument.doctype.name && O(Wn, a.ownerDocument.doctype.name) && (C = "<!DOCTYPE " + a.ownerDocument.doctype.name + `>
2560
+ ` + C), q && (C = Bt(C)), P && Dt ? at(C) : C;
2561
+ }, t.setConfig = function() {
2562
+ let u = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2563
+ le(u), te = !0, Mt = x, It = A;
2564
+ }, t.clearConfig = function() {
2565
+ ut = null, te = !1, Mt = null, It = null, P = Vt, tt = "";
2566
+ }, t.isValidAttribute = function(u, n, a) {
2567
+ ut || le({});
2568
+ const d = S(u), f = S(n);
2569
+ return Qe(d, f, a);
2570
+ }, t.addHook = function(u, n) {
2571
+ typeof n == "function" && z(k, u) && kt(k[u], n);
2572
+ }, t.removeHook = function(u, n) {
2573
+ if (z(k, u)) {
2574
+ if (n !== void 0) {
2575
+ const a = An(k[u], n);
2576
+ return a === -1 ? void 0 : Cn(k[u], a, 1)[0];
2577
+ }
2578
+ return ro(k[u]);
2579
+ }
2580
+ }, t.removeHooks = function(u) {
2581
+ z(k, u) && (k[u] = []);
2582
+ }, t.removeAllHooks = function() {
2583
+ k = yo();
2584
+ }, t;
2585
+ }
2586
+ var Wt = Co();
2587
+ const Zn = [
2588
+ "p",
2589
+ "br",
2590
+ "strong",
2591
+ "em",
2592
+ "u",
2593
+ "s",
2594
+ "strike",
2595
+ "del",
2596
+ "b",
2597
+ "i",
2598
+ "h1",
2599
+ "h2",
2600
+ "h3",
2601
+ "h4",
2602
+ "h5",
2603
+ "h6",
2604
+ "ul",
2605
+ "ol",
2606
+ "li",
2607
+ "a",
2608
+ "img",
2609
+ "video",
2610
+ "audio",
2611
+ "table",
2612
+ "thead",
2613
+ "tbody",
2614
+ "tr",
2615
+ "th",
2616
+ "td",
2617
+ "blockquote",
2618
+ "pre",
2619
+ "code",
2620
+ "span",
2621
+ "div",
2622
+ "section",
2623
+ "sup",
2624
+ "sub",
2625
+ "hr"
2626
+ // 'iframe' is deliberately not in the default allowlist. Arbitrary pasted
2627
+ // or typed content should not be able to silently embed an iframe - that's
2628
+ // a real vector (e.g. pasting from a compromised page). The editor's
2629
+ // embed-iframe plugin inserts iframes through its own explicit,
2630
+ // user-initiated dialog, a different trust boundary that never calls
2631
+ // through this sanitizer. A consumer that genuinely wants iframes in
2632
+ // pasted/typed content can still opt in via a custom allowedTags list.
2633
+ ], Jn = {
2634
+ "*": ["class", "style", "id", "data-*", "role", "aria-*", "tabindex", "contenteditable", "spellcheck", "dir", "lang"],
2635
+ a: ["href", "target", "rel", "title"],
2636
+ img: ["src", "alt", "width", "height", "loading"],
2637
+ video: ["src", "controls", "width", "height", "autoplay", "loop", "muted"],
2638
+ audio: ["src", "controls", "autoplay", "loop", "muted"],
2639
+ table: ["border", "cellpadding", "cellspacing"],
2640
+ td: ["colspan", "rowspan", "align", "valign"],
2641
+ th: ["colspan", "rowspan", "align", "valign"],
2642
+ // 'iframe' itself is still excluded from DEFAULT_ALLOWED_TAGS above, so this
2643
+ // entry is inert for ordinary input/paste - it only takes effect for the
2644
+ // embed-iframe plugin's trust-marked insertions (see sanitizeInputHTML's
2645
+ // additionalAllowedTags), restoring the attributes that make an inserted
2646
+ // iframe actually usable (src, sizing, fullscreen, scrolling/border).
2647
+ iframe: ["src", "width", "height", "name", "title", "frameborder", "scrolling", "allowfullscreen", "longdesc", "allow"]
2648
+ }, Qn = "data-editora-embed";
2649
+ function ti(s) {
2650
+ if (!s || /\s/.test(s.trim())) return !1;
2651
+ try {
2652
+ const t = new URL(s.trim());
2653
+ return (t.protocol === "https:" || t.protocol === "http:") && t.hostname.length > 0;
2654
+ } catch (t) {
2655
+ return !1;
2656
+ }
2657
+ }
2658
+ function So(s, t, e, o) {
2659
+ if ((t == null ? void 0 : t.sanitize) === !1)
2660
+ return s;
2661
+ const i = t != null && t.allowedTags && t.allowedTags.length > 0 ? t.allowedTags : Zn, r = e != null && e.length ? Array.from(/* @__PURE__ */ new Set([...i, ...e])) : i, c = !!(t != null && t.allowedAttributes) && Object.keys(t.allowedAttributes).length > 0 ? t.allowedAttributes : Jn, p = /* @__PURE__ */ new Set();
2662
+ for (const b of Object.values(c))
2663
+ for (const w of b) p.add(w);
2664
+ const m = {
2665
+ ALLOWED_TAGS: r,
2666
+ ALLOWED_ATTR: Array.from(p)
2667
+ };
2668
+ if (!o)
2669
+ return Wt.sanitize(s, m);
2670
+ Wt.addHook(
2671
+ "uponSanitizeElement",
2672
+ (b, w) => {
2673
+ var _;
2674
+ w.tagName === "iframe" && ((_ = b.getAttribute) == null ? void 0 : _.call(b, Qn)) === "true" && ti(b.getAttribute("src")) && (w.allowedTags.iframe = !0);
2675
+ }
2676
+ );
2677
+ try {
2678
+ return Wt.sanitize(s, m);
2679
+ } finally {
2680
+ Wt.removeHook("uponSanitizeElement");
2681
+ }
2682
+ }
2683
+ function ei(s, t, e, o) {
2684
+ return So(s, t, o, !1);
2685
+ }
2686
+ function oi(s, t, e) {
2687
+ return (e == null ? void 0 : e.sanitizeOnPaste) === !1 ? s : ei(s, t);
2688
+ }
2689
+ function ni(s, t, e, o) {
2690
+ return (e == null ? void 0 : e.sanitizeOnInput) === !1 ? s : So(s, t, o, !0);
2691
+ }
2692
+ const Kt = class Kt {
2693
+ /**
2694
+ * Resolve configuration from multiple sources with priority
2695
+ */
2696
+ static resolve(t) {
2697
+ const e = {};
2698
+ if (Object.assign(e, this.EDITOR_DEFAULTS), t.pluginDefaults && Object.assign(e, t.pluginDefaults), t.attributes) {
2699
+ const o = this.parseAttributes(t.attributes);
2700
+ Object.assign(e, o);
2701
+ }
2702
+ return t.jsConfig && Object.assign(e, t.jsConfig), this.normalizeConfig(e);
2703
+ }
2704
+ /**
2705
+ * Normalize mixed legacy/new config shapes
2706
+ */
2707
+ static normalizeConfig(t) {
2708
+ const e = { ...t };
2709
+ if (e.toolbarFloating !== void 0 || e.toolbarSticky !== void 0) {
2710
+ const l = typeof e.toolbar == "object" && e.toolbar ? { ...e.toolbar } : typeof e.toolbar == "string" ? { items: e.toolbar } : {};
2711
+ e.toolbarFloating !== void 0 && (l.floating = !!e.toolbarFloating), e.toolbarSticky !== void 0 && (l.sticky = !!e.toolbarSticky), e.toolbar = l;
2712
+ }
2713
+ if (e.toolbarItems !== void 0 && typeof e.toolbar == "object" && e.toolbar && (e.toolbar.items = e.toolbarItems), e.autosaveEnabled !== void 0 || e.autosaveIntervalMs !== void 0 || e.autosaveStorageKey !== void 0 || e.autosaveProvider !== void 0 || e.autosaveApiUrl !== void 0) {
2714
+ const l = typeof e.autosave == "object" && e.autosave ? { ...e.autosave } : {};
2715
+ e.autosaveEnabled !== void 0 && (l.enabled = !!e.autosaveEnabled), e.autosaveIntervalMs !== void 0 && (l.intervalMs = Number(e.autosaveIntervalMs)), e.autosaveStorageKey !== void 0 && (l.storageKey = e.autosaveStorageKey), e.autosaveProvider !== void 0 && (l.provider = e.autosaveProvider), e.autosaveApiUrl !== void 0 && (l.apiUrl = e.autosaveApiUrl), e.autosave = l;
2716
+ }
2717
+ const o = {
2718
+ enabled: !1,
2719
+ intervalMs: 3e4,
2720
+ storageKey: "rte-autosave",
2721
+ provider: "localStorage",
2722
+ apiUrl: ""
2723
+ };
2724
+ if (typeof e.autosave == "boolean")
2725
+ e.autosave = {
2726
+ ...o,
2727
+ enabled: e.autosave
2728
+ };
2729
+ else if (typeof e.autosave == "object" && e.autosave) {
2730
+ const l = {
2731
+ ...o,
2732
+ ...e.autosave
2733
+ };
2734
+ l.intervalMs === void 0 && l.interval !== void 0 && (l.intervalMs = Number(l.interval)), l.enabled === void 0 && (l.enabled = !0), (!Number.isFinite(l.intervalMs) || l.intervalMs <= 0) && (l.intervalMs = o.intervalMs), e.autosave = l;
2735
+ } else
2736
+ e.autosave = o;
2737
+ if (e.languageLocale !== void 0 || e.languageDirection !== void 0) {
2738
+ const l = typeof e.language == "object" && e.language ? { ...e.language } : {};
2739
+ e.languageLocale !== void 0 && (l.locale = e.languageLocale), e.languageDirection !== void 0 && (l.direction = e.languageDirection), e.language = l;
2740
+ }
2741
+ const i = { locale: "en", direction: "ltr" };
2742
+ if (typeof e.language == "string" ? e.language = {
2743
+ locale: e.language,
2744
+ direction: i.direction
2745
+ } : typeof e.language == "object" && e.language ? e.language = {
2746
+ ...i,
2747
+ ...e.language
2748
+ } : e.language = i, e.spellcheckEnabled !== void 0 || e.spellcheckProvider !== void 0 || e.spellcheckApiUrl !== void 0) {
2749
+ const l = typeof e.spellcheck == "object" && e.spellcheck ? { ...e.spellcheck } : {};
2750
+ e.spellcheckEnabled !== void 0 && (l.enabled = !!e.spellcheckEnabled), e.spellcheckProvider !== void 0 && (l.provider = e.spellcheckProvider), e.spellcheckApiUrl !== void 0 && (l.apiUrl = e.spellcheckApiUrl), e.spellcheck = l;
2751
+ }
2752
+ const r = {
2753
+ enabled: !1,
2754
+ provider: "browser",
2755
+ apiUrl: ""
2756
+ };
2757
+ if (typeof e.spellcheck == "boolean")
2758
+ e.spellcheck = {
2759
+ ...r,
2760
+ enabled: e.spellcheck
2761
+ };
2762
+ else if (typeof e.spellcheck == "object" && e.spellcheck) {
2763
+ const l = {
2764
+ ...r,
2765
+ ...e.spellcheck
2766
+ };
2767
+ !l.provider && l.mode && (l.provider = l.mode === "local" ? "browser" : "api"), l.enabled === void 0 && (l.enabled = !!(l.mode || l.provider || l.apiUrl)), e.spellcheck = l;
2768
+ } else
2769
+ e.spellcheck = r;
2770
+ return e.contextMenuEnabled !== void 0 && (e.contextMenu = {
2771
+ enabled: !!e.contextMenuEnabled
2772
+ }), typeof e.contextMenu == "boolean" ? e.contextMenu = { enabled: e.contextMenu } : typeof e.contextMenu == "object" && e.contextMenu ? e.contextMenu = {
2773
+ enabled: e.contextMenu.enabled !== !1
2774
+ } : e.contextMenu = { enabled: !0 }, (e.pasteClean !== void 0 || e.pasteKeepFormatting !== void 0 || e.pasteConvertWord !== void 0) && (e.paste = {
2775
+ ...e.paste || {},
2776
+ ...e.pasteClean !== void 0 ? { clean: !!e.pasteClean } : {},
2777
+ ...e.pasteKeepFormatting !== void 0 ? { keepFormatting: !!e.pasteKeepFormatting } : {},
2778
+ ...e.pasteConvertWord !== void 0 ? { convertWord: !!e.pasteConvertWord } : {}
2779
+ }), e.paste = {
2780
+ clean: !0,
2781
+ keepFormatting: !1,
2782
+ convertWord: !0,
2783
+ ...e.paste || {}
2784
+ }, e.contentConfig = {
2785
+ allowedTags: [],
2786
+ allowedAttributes: {},
2787
+ sanitize: !0,
2788
+ ...e.contentConfig || {}
2789
+ }, (e.securitySanitizeOnPaste !== void 0 || e.securitySanitizeOnInput !== void 0) && (e.security = {
2790
+ ...e.security || {},
2791
+ ...e.securitySanitizeOnPaste !== void 0 ? { sanitizeOnPaste: !!e.securitySanitizeOnPaste } : {},
2792
+ ...e.securitySanitizeOnInput !== void 0 ? { sanitizeOnInput: !!e.securitySanitizeOnInput } : {}
2793
+ }), e.security = {
2794
+ sanitizeOnPaste: !0,
2795
+ sanitizeOnInput: !0,
2796
+ ...e.security || {}
2797
+ }, (e.accessibilityEnableAria !== void 0 || e.accessibilityKeyboardNavigation !== void 0 || e.accessibilityChecker !== void 0) && (e.accessibility = {
2798
+ ...e.accessibility || {},
2799
+ ...e.accessibilityEnableAria !== void 0 ? { enableARIA: !!e.accessibilityEnableAria } : {},
2800
+ ...e.accessibilityKeyboardNavigation !== void 0 ? { keyboardNavigation: !!e.accessibilityKeyboardNavigation } : {},
2801
+ ...e.accessibilityChecker !== void 0 ? { checker: !!e.accessibilityChecker } : {}
2802
+ }), typeof e.accessibility == "boolean" && (e.accessibility = {
2803
+ enableARIA: e.accessibility,
2804
+ keyboardNavigation: e.accessibility,
2805
+ checker: !1
2806
+ }), e.accessibility = {
2807
+ enableARIA: !0,
2808
+ keyboardNavigation: !0,
2809
+ checker: !1,
2810
+ ...e.accessibility || {}
2811
+ }, (e.performanceDebounceInputMs !== void 0 || e.performanceViewportOnlyScan !== void 0) && (e.performance = {
2812
+ ...e.performance || {},
2813
+ ...e.performanceDebounceInputMs !== void 0 ? { debounceInputMs: Number(e.performanceDebounceInputMs) } : {},
2814
+ ...e.performanceViewportOnlyScan !== void 0 ? { viewportOnlyScan: !!e.performanceViewportOnlyScan } : {}
2815
+ }), typeof e.performance == "boolean" && (e.performance = {
2816
+ debounceInputMs: 100,
2817
+ viewportOnlyScan: e.performance
2818
+ }), e.performance = {
2819
+ debounceInputMs: 100,
2820
+ viewportOnlyScan: !0,
2821
+ ...e.performance || {}
2822
+ }, (typeof e.performance.debounceInputMs != "number" || !Number.isFinite(e.performance.debounceInputMs) || e.performance.debounceInputMs < 0) && (e.performance.debounceInputMs = 100), e;
2823
+ }
2824
+ /**
2825
+ * Parse web component attributes
2826
+ */
2827
+ static parseAttributes(t) {
2828
+ const e = {};
2829
+ for (const [o, i] of Object.entries(t)) {
2830
+ const r = this.kebabToCamel(o);
2831
+ e[r] = this.BOOLEAN_ATTRIBUTES.has(o) && (i === "" || i === o) ? !0 : this.parseAttributeValue(i);
2832
+ }
2833
+ return e;
2834
+ }
2835
+ /**
2836
+ * Parse attribute value to appropriate type
2837
+ */
2838
+ static parseAttributeValue(t) {
2839
+ if (t === "true") return !0;
2840
+ if (t === "false") return !1;
2841
+ if (/^\d+$/.test(t)) return parseInt(t, 10);
2842
+ if (/^\d+\.\d+$/.test(t)) return parseFloat(t);
2843
+ if (t.startsWith("{") || t.startsWith("["))
2844
+ try {
2845
+ return JSON.parse(t);
2846
+ } catch (e) {
2847
+ return t;
2848
+ }
2849
+ return t;
2850
+ }
2851
+ /**
2852
+ * Convert kebab-case to camelCase
2853
+ */
2854
+ static kebabToCamel(t) {
2855
+ return t.replace(/-([a-z])/g, (e, o) => o.toUpperCase());
2856
+ }
2857
+ /**
2858
+ * Validate configuration
2859
+ */
2860
+ static validate(t) {
2861
+ const e = [];
2862
+ return t.height !== void 0 && typeof t.height == "number" && t.height < 0 && e.push("height must be a positive number"), t.width !== void 0 && typeof t.width == "number" && t.width < 0 && e.push("width must be a positive number"), t.plugins !== void 0 && !Array.isArray(t.plugins) && typeof t.plugins != "string" && e.push("plugins must be an array or string"), t.theme !== void 0 && typeof t.theme != "string" && e.push("theme must be a string"), {
2863
+ valid: e.length === 0,
2864
+ errors: e
2865
+ };
2866
+ }
2867
+ /**
2868
+ * Get default configuration
2869
+ */
2870
+ static getDefaults() {
2871
+ return { ...this.EDITOR_DEFAULTS };
2872
+ }
2873
+ /**
2874
+ * Merge configurations (deep merge)
2875
+ */
2876
+ static merge(...t) {
2877
+ const e = {};
2878
+ for (const o of t)
2879
+ for (const [i, r] of Object.entries(o))
2880
+ r != null && (typeof r == "object" && !Array.isArray(r) && e[i] ? e[i] = this.merge(e[i], r) : e[i] = r);
2881
+ return e;
2882
+ }
2883
+ };
2884
+ Kt.EDITOR_DEFAULTS = {
2885
+ height: 400,
2886
+ width: "100%",
2887
+ readonly: !1,
2888
+ disabled: !1,
2889
+ menubar: !0,
2890
+ toolbar: !0,
2891
+ plugins: [],
2892
+ theme: "light",
2893
+ content: "",
2894
+ placeholder: "Start typing...",
2895
+ autofocus: !1,
2896
+ autosave: !1,
2897
+ accessibility: {
2898
+ enableARIA: !0,
2899
+ keyboardNavigation: !0,
2900
+ checker: !1
2901
+ },
2902
+ performance: {
2903
+ debounceInputMs: 100,
2904
+ viewportOnlyScan: !0
2905
+ },
2906
+ spellcheck: {
2907
+ enabled: !1,
2908
+ provider: "browser",
2909
+ apiUrl: ""
2910
+ },
2911
+ language: {
2912
+ locale: "en",
2913
+ direction: "ltr"
2914
+ },
2915
+ contextMenu: {
2916
+ enabled: !0
2917
+ },
2918
+ contentConfig: {
2919
+ allowedTags: [],
2920
+ allowedAttributes: {},
2921
+ sanitize: !0
2922
+ },
2923
+ paste: {
2924
+ clean: !0,
2925
+ keepFormatting: !1,
2926
+ convertWord: !0
2927
+ },
2928
+ security: {
2929
+ sanitizeOnPaste: !0,
2930
+ sanitizeOnInput: !0
2931
+ },
2932
+ statusbar: !1
2933
+ }, Kt.BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
2934
+ "readonly",
2935
+ "disabled",
2936
+ "autofocus",
2937
+ "statusbar",
2938
+ "toolbar-floating",
2939
+ "toolbar-sticky",
2940
+ "autosave-enabled",
2941
+ "accessibility-enable-aria",
2942
+ "accessibility-keyboard-navigation",
2943
+ "accessibility-checker",
2944
+ "performance-viewport-only-scan",
2945
+ "spellcheck-enabled",
2946
+ "context-menu-enabled",
2947
+ "paste-clean",
2948
+ "paste-keep-formatting",
2949
+ "paste-convert-word",
2950
+ "security-sanitize-on-paste",
2951
+ "security-sanitize-on-input"
2952
+ ]);
2953
+ let Te = Kt;
2954
+ class ii {
2955
+ constructor() {
2956
+ this.loadedPlugins = /* @__PURE__ */ new Map(), this.pluginRegistry = /* @__PURE__ */ new Map();
2957
+ }
2958
+ /**
2959
+ * Register a plugin factory (sync or async)
2960
+ */
2961
+ register(t, e) {
2962
+ this.pluginRegistry.set(t, e);
2963
+ }
2964
+ /**
2965
+ * Load a plugin by name (async)
2966
+ */
2967
+ async load(t, e) {
2968
+ if (this.loadedPlugins.has(t))
2969
+ return this.loadedPlugins.get(t);
2970
+ const o = this.pluginRegistry.get(t);
2971
+ if (!o)
2972
+ return console.warn(`Plugin not found: ${t}`), null;
2973
+ const i = await o();
2974
+ return e && this.applyPluginConfig(i, e), this.loadedPlugins.set(t, i), i;
2975
+ }
2976
+ /**
2977
+ * Load multiple plugins
2978
+ */
2979
+ async loadMultiple(t, e) {
2980
+ return (await Promise.all(
2981
+ t.map((i) => this.load(i, e))
2982
+ )).filter((i) => i !== null);
2983
+ }
2984
+ /**
2985
+ * Parse plugin string "lists link image media"
2986
+ */
2987
+ async parsePluginString(t, e) {
2988
+ const o = t.split(/\s+/).filter(Boolean);
2989
+ return this.loadMultiple(o, e);
2990
+ }
2991
+ /**
2992
+ * Apply configuration to plugin
2993
+ */
2994
+ applyPluginConfig(t, e) {
2995
+ t.__pluginConfig = e;
2996
+ }
2997
+ /**
2998
+ * Unload a plugin
2999
+ */
3000
+ unload(t) {
3001
+ this.loadedPlugins.delete(t);
3002
+ }
3003
+ /**
3004
+ * Clear all loaded plugins
3005
+ */
3006
+ clear() {
3007
+ this.loadedPlugins.clear();
3008
+ }
3009
+ /**
3010
+ * Get all loaded plugins
3011
+ */
3012
+ getLoadedPlugins() {
3013
+ return Array.from(this.loadedPlugins.values());
3014
+ }
3015
+ /**
3016
+ * Get all registered plugin names (available for loading)
3017
+ */
3018
+ getRegisteredPluginNames() {
3019
+ return Array.from(this.pluginRegistry.keys());
3020
+ }
3021
+ /**
3022
+ * Check if plugin is loaded
3023
+ */
3024
+ isLoaded(t) {
3025
+ return this.loadedPlugins.has(t);
3026
+ }
3027
+ }
3028
+ const ri = '.editora-editor{display:flex;flex-direction:column;border:1px solid #ddd;border-radius:4px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;font-size:14px;overflow:hidden}.editora-editor *{box-sizing:border-box}.editora-theme-light{background:#fff;color:#333}.editora-theme-dark{--editora-dark-toolbar-bg-start: #353d48;--editora-dark-toolbar-bg-end: #2d3540;--editora-dark-button-bg-start: #46505f;--editora-dark-button-bg-end: #3b4553;--editora-dark-button-hover-start: #525d6d;--editora-dark-button-hover-end: #465262;--editora-dark-button-active-start: #5eaaf6;--editora-dark-button-active-end: #4a95de;--editora-dark-border: #475263;--editora-dark-border-strong: #566275;--editora-dark-text: #e1e9f5;--editora-dark-text-strong: #f3f7ff;--editora-dark-text-muted: #aeb9cc;--editora-dark-surface: #1d242d;--editora-dark-content: #1f2732;background:linear-gradient(180deg,#1b2330,#1c2430);color:var(--editora-dark-text);border-color:var(--editora-dark-border)}.editora-toolbar{display:flex;align-items:center;gap:4px;padding:8px;background:#f5f5f5;border-bottom:1px solid #ddd;flex-wrap:wrap}.editora-theme-dark .editora-toolbar{background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%);border-bottom-color:var(--editora-dark-border);box-shadow:inset 0 1px #ffffff0d}.editora-toolbar-sticky{position:sticky;top:0;z-index:100;position:-webkit-sticky}.editora-toolbar-group{display:flex;align-items:center;gap:2px}.editora-toolbar-button{padding:6px 12px;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-weight:600;font-size:14px;height:30px;display:flex;align-items:center;white-space:nowrap}.editora-toolbar-group-button{display:flex;align-items:center}.editora-toolbar-input.font-size{width:40px;padding:.25rem;text-align:center;font-size:14px;background:#fff;border:1px solid var(--rte-color-border-light);border-radius:var(--rte-radius-sm)}.editora-toolbar-group-items{display:flex;align-items:center;border:1px solid #ccc;.editora-toolbar-button{border:none;border-radius:0;&:first-child{border-right:1px solid #ccc;border-top-left-radius:3px;border-bottom-left-radius:3px}&:last-child{border:0px solid #ccc;border-radius:0!important}&:hover{background:#e0e0e0;border-color:#ccc}}}.editora-theme-dark .editora-toolbar-button{background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%);border-color:var(--editora-dark-border-strong);color:var(--editora-dark-text);box-shadow:inset 0 1px #ffffff14,0 1px 1px #00000059}.editora-theme-dark .editora-toolbar-group-items{border-color:var(--editora-dark-border-strong);background:linear-gradient(180deg,var(--editora-dark-button-bg-start) 0%,var(--editora-dark-button-bg-end) 100%)}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:first-child{border-right-color:#566275}.editora-theme-dark .editora-toolbar-group-items .editora-toolbar-button:last-child{border-left-color:#566275}.editora-theme-dark .editora-toolbar-input.font-size{background-color:#2e3642;color:var(--editora-dark-text-strong);border-color:var(--editora-dark-border-strong);caret-color:var(--editora-dark-text-strong)}.editora-theme-dark .editora-toolbar-input.font-size::placeholder{color:var(--editora-dark-text-strong);opacity:1}.editora-toolbar-button:hover{background:#e0e0e0;border-color:#ccc}.editora-theme-dark .editora-toolbar-button:hover{background:linear-gradient(180deg,var(--editora-dark-button-hover-start) 0%,var(--editora-dark-button-hover-end) 100%);border-color:#66748a;color:var(--editora-dark-text-strong)}.editora-toolbar-button:active,.editora-toolbar-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-button:active,.editora-theme-dark .editora-toolbar-button.active{background:linear-gradient(180deg,var(--editora-dark-button-active-start) 0%,var(--editora-dark-button-active-end) 100%);border-color:#67adf4;color:#0f1b2a}.editora-theme-dark .editora-toolbar-button:disabled{background:#313946;border-color:#424d5e;color:#7f8ca1}.editora-theme-dark .editora-toolbar-button[data-command=insertTable],.editora-theme-dark .editora-toolbar-button[data-command=print],.editora-theme-dark .editora-toolbar-button[data-command=toggleSpellCheck],.editora-theme-dark .editora-toolbar-button[data-command=toggleA11yChecker],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionLTR],.editora-theme-dark .editora-toolbar-button[data-command=setDirectionRTL]{color:#f1f6ff}.editora-toolbar-button:disabled{opacity:.5;cursor:not-allowed}.editora-toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;line-height:1}.editora-toolbar-button svg,.editora-toolbar-icon svg{width:20px;height:20px;display:block;color:currentColor}.editora-theme-dark .editora-toolbar-button svg:not([fill=none i]),.editora-theme-dark .editora-toolbar-icon svg:not([fill=none i]){fill:currentColor}.editora-theme-dark .editora-toolbar-icon,.editora-theme-dark .editora-toolbar-icon *{color:inherit}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([stroke="#000" i],[stroke="#000000" i],[stroke=black i],[stroke="#0f0f0f" i],[stroke="#111111" i],[style*="stroke:#000" i],[style*="stroke: #000" i],[style*="stroke:black" i],[style*="stroke: black" i],[style*="stroke:#0f0f0f" i],[style*="stroke: #0f0f0f" i]){stroke:currentColor!important}.editora-theme-dark :is(.editora-toolbar-button,.editora-toolbar-icon) svg :is([fill="#000" i],[fill="#000000" i],[fill=black i],[fill="#0f0f0f" i],[fill="#111111" i],[style*="fill:#000" i],[style*="fill: #000" i],[style*="fill:black" i],[style*="fill: black" i],[style*="fill:#0f0f0f" i],[style*="fill: #0f0f0f" i]){fill:currentColor!important}.editora-toolbar-separator{width:1px;height:24px;background:#ddd;margin:0 4px}.editora-theme-dark .editora-toolbar-separator{background:#4d596b}.editora-toolbar-items-container{display:flex;align-items:center;gap:4px;flex:1;min-width:0;overflow:hidden}.editora-toolbar-more-button{display:flex;align-items:center;justify-content:center;width:30px;height:30px;flex-shrink:0;padding:0;border:1px solid #ccc;background:#fff;cursor:pointer;border-radius:3px;font-size:16px}.editora-toolbar-more-button:hover{background:#e0e0e0}.editora-toolbar-more-button.active{background:#d0d0d0;border-color:#999}.editora-theme-dark .editora-toolbar-more-button{background:var(--editora-dark-content);border-color:var(--editora-dark-border);color:var(--editora-dark-text)}.editora-theme-dark .editora-toolbar-more-button:hover,.editora-theme-dark .editora-toolbar-more-button.active{background:#3a4554;border-color:#607088}.editora-toolbar-expanded-row{display:none;flex-wrap:wrap;align-items:center;gap:4px;width:100%;padding:8px;border-top:1px solid #ddd;background:#f5f5f5}.editora-toolbar-expanded-row.show{display:flex}.editora-theme-dark .editora-toolbar-expanded-row{border-top-color:var(--editora-dark-border);background:linear-gradient(180deg,var(--editora-dark-toolbar-bg-start) 0%,var(--editora-dark-toolbar-bg-end) 100%)}.editora-toolbar-dropdown{position:relative}.editora-toolbar-dropdown-menu{position:absolute;top:100%;left:0;min-width:150px;margin-top:4px;padding:4px 0;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-toolbar-dropdown-menu{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;color:#333;text-align:left;cursor:pointer;font-size:13px;transition:background .15s ease}.editora-theme-dark .editora-toolbar-dropdown-item{color:#d7deea}.editora-toolbar-dropdown-item:hover{background:#f5f5f5}.editora-theme-dark .editora-toolbar-dropdown-item:hover{background:#3a4554;color:#f0f6ff}.editora-content{flex:1;min-height:200px;padding:16px;outline:none;overflow-y:auto;line-height:1.6}.editora-theme-dark .editora-content{color:#ecf3ff;background:linear-gradient(180deg,var(--editora-dark-content) 0%,#1c232e 100%)}.editora-content:empty:before{content:attr(data-placeholder);color:#999;pointer-events:none}.editora-theme-dark .editora-content:empty:before{color:#8f9bb0}.editora-content h1{font-size:2em;margin:.67em 0;font-weight:600}.editora-content h2{font-size:1.5em;margin:.75em 0;font-weight:600}.editora-content h3{font-size:1.17em;margin:.83em 0;font-weight:600}.editora-content p{margin:1em 0}.editora-theme-dark .editora-content,.editora-theme-dark .editora-content :is(p,span,div,li,ul,ol,td,th,h1,h2,h3,h4,h5,h6,strong,em,u,s,small,sub,sup,blockquote,code,pre,a){color:#ecf3ff}.editora-content ul,.editora-content ol{margin:1em 0;padding-left:2em}.editora-content a{color:#06c;text-decoration:underline}.editora-theme-dark .editora-content a{color:#ecf3ff}.editora-content code{padding:2px 4px;background:#f5f5f5;border-radius:3px;font-family:Monaco,Menlo,Consolas,monospace;font-size:.9em}.editora-theme-dark .editora-content code{background:#1e1e1e}.editora-content pre{padding:12px;background:#f5f5f5;border-radius:4px;overflow-x:auto;margin:1em 0}.editora-theme-dark .editora-content pre{background:#1e1e1e}.editora-theme-dark .rte-code-block{background:linear-gradient(180deg,#212a36,#1b2430)!important;border-color:#4f5b70!important;color:#e7effc!important}.editora-theme-dark .rte-code-block code{color:#e7effc!important}.editora-theme-dark .rte-code-block:before{background:#111927!important;color:#dce8ff!important}.editora-theme-dark .rte-code-block .rte-code-copy{background:#2b3441!important;border-color:#5a667b!important;color:#dce8ff!important}.editora-content blockquote{margin:1em 0;padding-left:1em;border-left:4px solid #ddd;color:#666}.editora-theme-dark .editora-content blockquote{border-left-color:#3c3c3c;color:#ecf3ff}.editora-floating-toolbar{position:absolute;padding:4px;background:#fff;border:1px solid #ddd;border-radius:4px;box-shadow:0 2px 8px #00000026;z-index:1000}.editora-theme-dark .editora-floating-toolbar{background:#29323d;border-color:#4d596b;box-shadow:0 8px 20px #00000073}.editora-statusbar-container{display:flex;flex-direction:column}.editora-statusbar-left{display:flex;align-items:center;gap:8px}.editora-statusbar-right{display:flex;align-items:center;gap:8px;margin-left:auto}.editora-statusbar{display:flex;align-items:center;gap:12px;padding:6px 12px;background:#f5f5f5;border-top:1px solid #ddd;font-size:12px;color:#666}.editora-theme-dark .editora-statusbar{background:linear-gradient(180deg,#2c3440,#252d37);border-top-color:#3f4a5b;color:#d7deea}.editora-statusbar-item{white-space:nowrap}.editora-statusbar-separator{color:#ddd}.editora-theme-dark .editora-statusbar-separator{color:#566275}.editora-editor[readonly] .editora-content{background:#fafafa;cursor:not-allowed}.editora-theme-dark.editora-editor[readonly] .editora-content{background:#1a1a1a}.editora-editor:focus-within{border-color:#06c;box-shadow:0 0 0 3px #0066cc1a}.editora-theme-dark.editora-editor:focus-within{border-color:#4db8ff;box-shadow:0 0 0 3px #4db8ff1a}.editora-editor[disabled]{opacity:.6;pointer-events:none}@media(max-width:768px){.editora-toolbar{padding:4px}.editora-toolbar-button{min-width:28px;min-height:28px;padding:4px 8px;font-size:12px}.editora-content{padding:12px}}.editora-content ::selection{background:#06c3}.editora-theme-dark .editora-content ::selection{background:#4db8ff33}.editora-content table{border-collapse:collapse;width:100%;margin:1em 0}.editora-content th,.editora-content td{border:1px solid #ddd;padding:8px 12px;text-align:left}.editora-theme-dark .editora-content th,.editora-theme-dark .editora-content td{border-color:#3c3c3c}.editora-content th{background:#f5f5f5;font-weight:600}.editora-theme-dark .editora-content th{background:#252526}.editora-content img{max-width:100%;height:auto;border-radius:4px;display:block}.editora-content video{max-width:100%;height:auto;border-radius:4px;display:block}.editora-editor.loading{opacity:.7;pointer-events:none}.editora-editor.loading:after{content:"";position:absolute;top:50%;left:50%;width:24px;height:24px;margin:-12px 0 0 -12px;border:3px solid #ddd;border-top-color:#06c;border-radius:50%;animation:editora-spin .8s linear infinite}@keyframes editora-spin{to{transform:rotate(360deg)}}.toolbar-container-wrapper{display:flex;align-items:center;background:#fff;border-bottom:1px solid #e0e0e0;padding:0;margin:0;width:100%;box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;font-size:14px;line-height:1.5;position:relative}.toolbar-container-wrapper[data-toolbar-sticky=true]{position:sticky;top:0;z-index:999;box-shadow:0 2px 4px #0000001a}.toolbar-container-wrapper[data-toolbar-floating=true]{position:fixed;top:0;left:0;right:0;z-index:1000;box-shadow:0 4px 12px #00000026}.toolbar-container-wrapper[data-toolbar-position=bottom]{border-bottom:none;border-top:1px solid #e0e0e0}.toolbar-container-wrapper .toolbar-wrapper{display:flex;width:100%;padding:8px;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar{display:flex;width:100%;gap:4px;flex-wrap:wrap;align-items:center}.toolbar-container-wrapper .toolbar-container{display:flex;gap:4px;flex-wrap:wrap;align-items:center;flex:1;position:relative}.toolbar-container-wrapper .toolbar-item{display:flex;align-items:center;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:6px 10px;border:1px solid #d1d5db;background:#fff;border-radius:4px;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center;gap:4px;transition:all .15s ease;min-height:32px;white-space:nowrap}.toolbar-container-wrapper .toolbar-button:hover{background-color:#f3f4f6;border-color:#9ca3af}.toolbar-container-wrapper .toolbar-button:active,.toolbar-container-wrapper .toolbar-button[data-active=true]{background-color:#06c;color:#fff;border-color:#0052a3;box-shadow:inset 0 1px 3px #0000001a}.toolbar-container-wrapper .toolbar-button:disabled{opacity:.5;cursor:not-allowed;background-color:#f9fafb}.toolbar-container-wrapper .toolbar-more-button{padding:6px 8px;font-size:16px;font-weight:500;line-height:1}.toolbar-container-wrapper .toolbar-separator{width:1px;height:24px;background-color:#d1d5db;margin:0 4px}.toolbar-container-wrapper .toolbar-icon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;flex-shrink:0}.toolbar-container-wrapper .toolbar-icon svg{width:100%;height:100%}.toolbar-container-wrapper .toolbar-dropdown{position:relative;display:flex;align-items:center}.toolbar-container-wrapper .toolbar-dropdown-arrow{font-size:10px;margin-left:2px;line-height:1}.toolbar-container-wrapper .toolbar-dropdown-menu{position:absolute;top:100%;left:0;background:#fff;border:1px solid #d1d5db;border-radius:6px;box-shadow:0 4px 12px #00000026;z-index:1000;min-width:160px;padding:4px 0;margin-top:4px;display:none}.toolbar-container-wrapper .toolbar-dropdown-menu.show{display:block}.toolbar-container-wrapper .toolbar-dropdown-item{display:block;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;font-size:13px;color:#1f2937;transition:background-color .15s ease;font-family:inherit}.toolbar-container-wrapper .toolbar-dropdown-item:hover{background-color:#f3f4f6}.toolbar-container-wrapper .toolbar-dropdown-item:active{background-color:#e5e7eb}.toolbar-container-wrapper .toolbar-input{padding:6px 8px;border:1px solid #d1d5db;border-radius:4px;font-size:13px;font-family:inherit;background-color:#fff;color:#1f2937;transition:all .15s ease}.toolbar-container-wrapper .toolbar-input:focus{outline:none;border-color:#06c;box-shadow:0 0 0 3px #0066cc1a;background-color:#fff}.toolbar-container-wrapper .toolbar-input::placeholder{color:#9ca3af}.toolbar-overflow-menu{animation:slideDown .2s ease-out}@keyframes slideDown{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.toolbar-overflow-item{transition:background-color .15s ease}.floating-toolbar{user-select:none;-webkit-user-select:none;font-family:system-ui,-apple-system,sans-serif;font-size:14px;animation:fadeInUp .15s ease-out}@keyframes fadeInUp{0%{opacity:0;transform:translate(-50%) translateY(10px)}to{opacity:1;transform:translate(-50%) translateY(0)}}.floating-toolbar-btn{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:none;background:transparent;border-radius:4px;color:#495057;cursor:pointer;font-size:14px;font-weight:500;transition:all .15s ease;outline:none}.floating-toolbar-btn:hover{background:#f8f9fa;color:#212529}.floating-toolbar-btn:active{background:#e9ecef;transform:scale(.95)}.floating-toolbar-btn.floating-toolbar-toggle{color:#dc3545;font-weight:700}.floating-toolbar-btn.floating-toolbar-toggle:hover{background:#f8d7da;color:#721c24}.floating-toolbar-separator{width:1px;height:20px;background:#e1e5e9;margin:0 2px}@media(max-width:768px){.toolbar-container-wrapper .toolbar-button{padding:5px 8px;font-size:12px;min-height:28px}.toolbar-container-wrapper .toolbar-icon{width:16px;height:16px}.toolbar-container-wrapper .toolbar-dropdown-menu{min-width:140px}.toolbar-container-wrapper .toolbar-dropdown-item{padding:6px 10px;font-size:12px}.floating-toolbar{padding:4px;gap:2px}.floating-toolbar-btn{width:28px;height:28px;font-size:12px}}@media(max-width:480px){.toolbar-container-wrapper{padding:4px}.toolbar-container-wrapper .toolbar-wrapper{padding:4px;gap:2px}.toolbar-container-wrapper .toolbar-button{padding:4px 6px;font-size:11px;min-height:24px}.toolbar-container-wrapper .toolbar-icon{width:14px;height:14px}}.floating-toolbar{pointer-events:auto}.floating-toolbar{max-width:calc(100vw - 20px);overflow-x:auto}@media(prefers-color-scheme:dark){.floating-toolbar{background:#2d3748;border-color:#4a5568;color:#e2e8f0}.floating-toolbar-btn:hover{background:#4a5568;color:#f7fafc}.floating-toolbar-btn:active{background:#718096}.floating-toolbar-separator{background:#4a5568}}';
3029
+ let $t;
3030
+ const ai = "__editoraCommandEditorRoot", si = "__editoraLastCommandButton", vo = "editora-editor, [data-editora-editor], .rte-editor, .editora-editor", Eo = ".rte-content, .editora-content", ke = /* @__PURE__ */ new Set();
3031
+ let J = null, wo = !1, ye = null, ve = null;
3032
+ function To(s) {
3033
+ if (!(s instanceof HTMLElement)) return !1;
3034
+ const t = s;
3035
+ return typeof t.execCommand == "function" && (t.tagName.toLowerCase() === "editora-editor" || t.classList.contains("editora-editor") || t.hasAttribute("data-editora-editor"));
3036
+ }
3037
+ function li(s) {
3038
+ return s ? s.nodeType === Node.ELEMENT_NODE ? s : s.parentElement : null;
3039
+ }
3040
+ function Ct(s) {
3041
+ if (!s) return null;
3042
+ if (To(s))
3043
+ return s;
3044
+ const t = s.matches(vo) ? s : s.closest(vo);
3045
+ return !t || !To(t) ? null : t;
3046
+ }
3047
+ function ci() {
3048
+ var i;
3049
+ if (typeof window == "undefined") return null;
3050
+ const s = window[ai];
3051
+ if (s instanceof HTMLElement) {
3052
+ const r = Ct(s);
3053
+ if (r) return r;
3054
+ const l = s.matches(Eo) ? s : s.querySelector(Eo);
3055
+ if (l) {
3056
+ const c = Ct(l);
3057
+ if (c) return c;
3058
+ }
3059
+ }
3060
+ const t = window[si];
3061
+ if (t instanceof HTMLElement) {
3062
+ const r = Ct(t);
3063
+ if (r) return r;
3064
+ }
3065
+ const e = document.activeElement;
3066
+ if (e) {
3067
+ const r = Ct(e);
3068
+ if (r) return r;
3069
+ }
3070
+ const o = (i = window.getSelection) == null ? void 0 : i.call(window);
3071
+ if (o && o.rangeCount > 0) {
3072
+ const r = Ct(li(o.getRangeAt(0).startContainer));
3073
+ if (r) return r;
3074
+ }
3075
+ if (J && J.isConnected)
3076
+ return J;
3077
+ for (const r of ke)
3078
+ if (r.isConnected) return r;
3079
+ return null;
3080
+ }
3081
+ function di() {
3082
+ if (typeof window == "undefined" || wo) return;
3083
+ ye = typeof window.executeEditorCommand == "function" ? window.executeEditorCommand.bind(window) : null, ve = typeof window.execEditorCommand == "function" ? window.execEditorCommand.bind(window) : null;
3084
+ const s = (t, ...e) => {
3085
+ const o = ci();
3086
+ return o ? o.execCommand(t, ...e) : ye ? ye(t, ...e) : ve ? ve(t, ...e) : !1;
3087
+ };
3088
+ window.executeEditorCommand = s, window.execEditorCommand = s, wo = !0;
3089
+ }
3090
+ function ui() {
3091
+ const s = "editora-webcomponent-styles";
3092
+ if (!document.getElementById(s)) {
3093
+ const t = document.createElement("style");
3094
+ t.id = s, t.textContent = ri, document.head.appendChild(t);
3095
+ }
3096
+ }
3097
+ function _o() {
3098
+ if (!$t) {
3099
+ const s = gt.__globalPluginLoader;
3100
+ s ? $t = s : $t = new ii();
3101
+ }
3102
+ return $t;
3103
+ }
3104
+ function fi(s) {
3105
+ const t = _o();
3106
+ Object.entries(s).forEach(([e, o]) => {
3107
+ t.register(e, o);
3108
+ });
3109
+ }
3110
+ class gt extends HTMLElement {
3111
+ constructor() {
3112
+ if (super(), this.pluginLoader = _o(), this.config = {}, this.isInitialized = !1, this.keyboardShortcutManager = new an(), this.lastAutosavedContent = "", this.loadedPlugins = [], this.lastBeforeInputType = null, ui(), !this.hasAttribute("data-initial-content")) {
3113
+ const t = this.innerHTML.trim();
3114
+ t && this.setAttribute("data-initial-content", t);
3115
+ }
3116
+ }
3117
+ // Observed attributes for reactive updates
3118
+ static get observedAttributes() {
3119
+ return [
3120
+ "height",
3121
+ "width",
3122
+ "menubar",
3123
+ "plugins",
3124
+ "toolbar",
3125
+ "toolbar-items",
3126
+ "toolbar-floating",
3127
+ "toolbar-sticky",
3128
+ "readonly",
3129
+ "disabled",
3130
+ "theme",
3131
+ "placeholder",
3132
+ "autofocus",
3133
+ "autosave",
3134
+ "autosave-enabled",
3135
+ "autosave-interval-ms",
3136
+ "autosave-storage-key",
3137
+ "autosave-provider",
3138
+ "autosave-api-url",
3139
+ "accessibility",
3140
+ "accessibility-enable-aria",
3141
+ "accessibility-keyboard-navigation",
3142
+ "accessibility-checker",
3143
+ "performance",
3144
+ "performance-debounce-input-ms",
3145
+ "performance-viewport-only-scan",
3146
+ "language",
3147
+ "language-locale",
3148
+ "language-direction",
3149
+ "spellcheck",
3150
+ "spellcheck-enabled",
3151
+ "spellcheck-provider",
3152
+ "context-menu",
3153
+ "context-menu-enabled",
3154
+ "paste",
3155
+ "paste-clean",
3156
+ "paste-keep-formatting",
3157
+ "paste-convert-word",
3158
+ "security",
3159
+ "security-sanitize-on-paste",
3160
+ "security-sanitize-on-input",
3161
+ "statusbar"
3162
+ ];
3163
+ }
3164
+ /**
3165
+ * Called when element is added to DOM
3166
+ */
3167
+ connectedCallback() {
3168
+ this.config = this.resolveConfig(), this.waitForPluginLoader().then(() => {
3169
+ setTimeout(async () => {
3170
+ await this.initialize();
3171
+ }, 0);
3172
+ });
3173
+ }
3174
+ /**
3175
+ * Wait for the global plugin loader to be available
3176
+ */
3177
+ async waitForPluginLoader() {
3178
+ if (gt.__globalPluginLoader) {
3179
+ this.pluginLoader = gt.__globalPluginLoader;
3180
+ return;
3181
+ }
3182
+ return new Promise((t) => {
3183
+ const e = () => {
3184
+ gt.__globalPluginLoader ? (this.pluginLoader = gt.__globalPluginLoader, t()) : setTimeout(e, 0);
3185
+ };
3186
+ e();
3187
+ });
3188
+ }
3189
+ /**
3190
+ * Called when element is removed from DOM
3191
+ */
3192
+ disconnectedCallback() {
3193
+ this.destroy();
3194
+ }
3195
+ /**
3196
+ * Called when an observed attribute changes
3197
+ */
3198
+ attributeChangedCallback(t, e, o) {
3199
+ e !== o && (this.config = this.resolveConfig(), this.handleAttributeChange(t, o));
3200
+ }
3201
+ /**
3202
+ * Set configuration via JavaScript API
3203
+ */
3204
+ async setConfig(t) {
3205
+ this.jsConfig = t, this.config = this.resolveConfig(), this.isConnected && (this.destroy(), await this.waitForPluginLoader(), await this.initialize());
3206
+ }
3207
+ /**
3208
+ * Initialize the editor
3209
+ */
3210
+ async initialize() {
3211
+ var o;
3212
+ if (this.querySelector(".editora-toolbar") || this.isInitialized) return;
3213
+ this.setAttribute("data-editora-editor", "true"), ke.add(this), J || (J = this), di(), this.config.height && (this.style.height = typeof this.config.height == "number" ? `${this.config.height}px` : this.config.height), this.config.width && (this.style.width = typeof this.config.width == "number" ? `${this.config.width}px` : this.config.width), this.classList.add("editora-editor"), this.config.theme && this.classList.add(`editora-theme-${this.config.theme}`);
3214
+ const t = await this.loadPlugins();
3215
+ if (this.loadedPlugins = t, t.forEach((i) => {
3216
+ if (i.init && typeof i.init == "function")
3217
+ try {
3218
+ i.init({ editorElement: this });
3219
+ } catch (r) {
3220
+ console.error(`[RichTextEditor] Error initializing plugin ${i.name}:`, r);
3221
+ }
3222
+ }), !this.hasAttribute("data-initial-content") && !this.contentElement) {
3223
+ const i = this.innerHTML.trim();
3224
+ i && this.setAttribute("data-initial-content", i);
3225
+ }
3226
+ const e = (o = this.restoreAutosavedContent()) != null ? o : this.getAttribute("data-initial-content") || "";
3227
+ this.engine = new ln({
3228
+ content: e,
3229
+ plugins: t,
3230
+ readonly: this.config.readonly
3231
+ }), this.createUI(t, e), this.setupEventListeners(), this.startAutosave(), this.isInitialized = !0, this.dispatchEvent(new CustomEvent("editor-ready", {
3232
+ detail: { api: this.getAPI() },
3233
+ bubbles: !0
3234
+ }));
3235
+ }
3236
+ /**
3237
+ * Get initial content from slot or attribute
3238
+ */
3239
+ getInitialContent() {
3240
+ if (this.config.content)
3241
+ return this.config.content;
3242
+ const t = this.querySelector("[slot]");
3243
+ return t ? t.innerHTML : this.hasChildNodes() ? Array.from(this.childNodes).map((o) => o.nodeType === Node.TEXT_NODE ? o.textContent : o.nodeType === Node.ELEMENT_NODE ? o.outerHTML : "").join("").trim() : "";
3244
+ }
3245
+ /**
3246
+ * Load plugins based on configuration
3247
+ */
3248
+ async loadPlugins() {
3249
+ this.pluginLoader || await this.waitForPluginLoader();
3250
+ const t = [], e = this.config.plugins && (typeof this.config.plugins == "string" && this.config.plugins.length > 0 || Array.isArray(this.config.plugins) && this.config.plugins.length > 0), i = this.getAccessibilityConfig().checker === !0;
3251
+ if (e) {
3252
+ if (typeof this.config.plugins == "string") {
3253
+ const r = this.config.plugins.split(/\s+/).filter(Boolean);
3254
+ i && !r.includes("a11yChecker") && r.push("a11yChecker");
3255
+ for (const l of r) {
3256
+ const c = await this.pluginLoader.load(l, this.getPluginLoadConfig(l));
3257
+ c && t.push(c);
3258
+ }
3259
+ } else if (Array.isArray(this.config.plugins)) {
3260
+ for (const r of this.config.plugins)
3261
+ if (typeof r == "string") {
3262
+ const l = await this.pluginLoader.load(r, this.getPluginLoadConfig(r));
3263
+ l && t.push(l);
3264
+ } else
3265
+ t.push(r);
3266
+ if (i && !t.some((r) => (r == null ? void 0 : r.name) === "a11yChecker")) {
3267
+ const r = await this.pluginLoader.load("a11yChecker", this.getPluginLoadConfig("a11yChecker"));
3268
+ r && t.push(r);
3269
+ }
3270
+ }
3271
+ } else {
3272
+ const r = this.pluginLoader.getRegisteredPluginNames();
3273
+ for (const l of r) {
3274
+ const c = await this.pluginLoader.load(l, this.getPluginLoadConfig(l));
3275
+ c && t.push(c);
3276
+ }
3277
+ }
3278
+ return t;
3279
+ }
3280
+ resolveToolbarItems() {
3281
+ const t = this.config.toolbarItems;
3282
+ if (typeof t == "string") return t;
3283
+ if (Array.isArray(t)) return t.join(" ");
3284
+ const e = this.config.toolbar;
3285
+ if (typeof e == "string") return e;
3286
+ if (!e || typeof e != "object") return;
3287
+ const o = e.items;
3288
+ if (typeof o == "string") return o;
3289
+ if (Array.isArray(o)) return o.join(" ");
3290
+ }
3291
+ isToolbarStickyEnabled() {
3292
+ const t = this.config.toolbar;
3293
+ return !t || typeof t != "object" ? !1 : !!t.sticky;
3294
+ }
3295
+ isToolbarFloatingEnabled() {
3296
+ const t = this.config.toolbar;
3297
+ return !t || typeof t != "object" ? !1 : !!t.floating;
3298
+ }
3299
+ isStatusbarEnabled() {
3300
+ const t = this.config.statusbar;
3301
+ return typeof t == "boolean" ? t : t && typeof t == "object" ? t.enabled !== !1 : !1;
3302
+ }
3303
+ getStatusbarPosition() {
3304
+ const t = this.config.statusbar;
3305
+ return t && typeof t == "object" && t.position === "top" ? "top" : "bottom";
3306
+ }
3307
+ getLanguageConfig() {
3308
+ const t = this.config.language;
3309
+ return typeof t == "string" ? { locale: t, direction: "ltr" } : t && typeof t == "object" ? {
3310
+ locale: t.locale || "en",
3311
+ direction: t.direction === "rtl" ? "rtl" : "ltr"
3312
+ } : { locale: "en", direction: "ltr" };
3313
+ }
3314
+ getAccessibilityConfig() {
3315
+ const t = this.config.accessibility;
3316
+ return typeof t == "boolean" ? {
3317
+ enableARIA: t,
3318
+ keyboardNavigation: t,
3319
+ checker: !1
3320
+ } : t && typeof t == "object" ? {
3321
+ enableARIA: t.enableARIA !== !1,
3322
+ keyboardNavigation: t.keyboardNavigation !== !1,
3323
+ checker: !!t.checker
3324
+ } : {
3325
+ enableARIA: !0,
3326
+ keyboardNavigation: !0,
3327
+ checker: !1
3328
+ };
3329
+ }
3330
+ getPerformanceConfig() {
3331
+ var e;
3332
+ const t = this.config.performance;
3333
+ if (typeof t == "boolean")
3334
+ return {
3335
+ debounceInputMs: 100,
3336
+ viewportOnlyScan: t
3337
+ };
3338
+ if (t && typeof t == "object") {
3339
+ const o = Number((e = t.debounceInputMs) != null ? e : 100);
3340
+ return {
3341
+ debounceInputMs: Number.isFinite(o) && o >= 0 ? o : 100,
3342
+ viewportOnlyScan: t.viewportOnlyScan !== !1
3343
+ };
3344
+ }
3345
+ return {
3346
+ debounceInputMs: 100,
3347
+ viewportOnlyScan: !0
3348
+ };
3349
+ }
3350
+ isEditorInViewport() {
3351
+ if (!this.contentElement || typeof window == "undefined") return !0;
3352
+ const t = this.contentElement.getBoundingClientRect();
3353
+ return t.bottom >= 0 && t.top <= window.innerHeight;
3354
+ }
3355
+ applyAccessibilitySettings() {
3356
+ if (!this.contentElement) return;
3357
+ const t = this.getAccessibilityConfig();
3358
+ if (t.enableARIA) {
3359
+ this.contentElement.setAttribute("role", "textbox"), this.contentElement.setAttribute("aria-multiline", "true"), this.contentElement.setAttribute("aria-disabled", this.config.readonly ? "true" : "false");
3360
+ const e = typeof this.config.placeholder == "string" ? this.config.placeholder.trim() : "";
3361
+ e ? this.contentElement.setAttribute("aria-label", e) : this.contentElement.removeAttribute("aria-label");
3362
+ } else
3363
+ this.contentElement.removeAttribute("role"), this.contentElement.removeAttribute("aria-multiline"), this.contentElement.removeAttribute("aria-disabled"), this.contentElement.removeAttribute("aria-label");
3364
+ this.contentElement.tabIndex = t.keyboardNavigation ? 0 : -1;
3365
+ }
3366
+ applyLanguageSettings() {
3367
+ if (!this.contentElement) return;
3368
+ const t = this.getLanguageConfig();
3369
+ this.contentElement.setAttribute("lang", t.locale), this.contentElement.setAttribute("dir", t.direction);
3370
+ }
3371
+ getSpellcheckConfig() {
3372
+ const t = this.config.spellcheck;
3373
+ if (typeof t == "boolean")
3374
+ return {
3375
+ enabled: t,
3376
+ provider: "browser"
3377
+ };
3378
+ if (t && typeof t == "object") {
3379
+ const e = t.provider || "browser";
3380
+ return {
3381
+ enabled: !!t.enabled,
3382
+ provider: e,
3383
+ mode: t.mode
3384
+ };
3385
+ }
3386
+ return { enabled: !1, provider: "browser" };
3387
+ }
3388
+ applySpellcheckSettings() {
3389
+ if (!this.contentElement) return;
3390
+ const t = this.getSpellcheckConfig(), e = t.enabled && t.provider === "browser";
3391
+ this.contentElement.spellcheck = e, this.contentElement.setAttribute("spellcheck", e ? "true" : "false");
3392
+ }
3393
+ executeCommand(t, ...e) {
3394
+ var r;
3395
+ typeof window != "undefined" && (window.__editoraCommandEditorRoot = this);
3396
+ const o = {
3397
+ editorElement: this,
3398
+ contentElement: this.contentElement,
3399
+ toolbarElement: this.toolbarElement
3400
+ }, i = this.loadedPlugins.find((l) => l.commands && l.commands[t]);
3401
+ if (i && i.commands) {
3402
+ const l = i.commands[t];
3403
+ if (typeof l == "function")
3404
+ try {
3405
+ return t === "toggleFullscreen" ? l(this, o) : l(...e, o), !0;
3406
+ } catch (c) {
3407
+ return console.error(`[RichTextEditor] Error executing native command ${t}:`, c), !1;
3408
+ }
3409
+ }
3410
+ return ((r = this.engine) == null ? void 0 : r.execCommand(t, ...e)) || !1;
3411
+ }
3412
+ getPluginLoadConfig(t) {
3413
+ const e = this.config.pluginConfig;
3414
+ if (e && typeof e == "object") {
3415
+ const r = e[t];
3416
+ if (r && typeof r == "object")
3417
+ return r;
3418
+ }
3419
+ const o = {
3420
+ spellCheck: ["spellcheck", "spellCheck"],
3421
+ trackChanges: ["trackchanges", "track-changes", "trackChanges"],
3422
+ versionDiff: ["versiondiff", "version-diff", "versionDiff"],
3423
+ "version-diff": ["versiondiff", "version-diff", "versionDiff"],
3424
+ conditionalContent: ["conditionalcontent", "conditional-content", "conditionalContent"],
3425
+ "conditional-content": ["conditionalcontent", "conditional-content", "conditionalContent"],
3426
+ dataBinding: ["databinding", "data-binding", "dataBinding"],
3427
+ "data-binding": ["databinding", "data-binding", "dataBinding"],
3428
+ contentRules: ["contentrules", "content-rules", "contentRules"],
3429
+ "content-rules": ["contentrules", "content-rules", "contentRules"],
3430
+ mentions: ["mention", "mentions"],
3431
+ mention: ["mention", "mentions"],
3432
+ slashCommands: ["slashcommands", "slash-commands", "slashCommands"],
3433
+ "slash-commands": ["slashcommands", "slash-commands", "slashCommands"],
3434
+ formatPainter: ["formatpainter", "format-painter", "formatPainter"],
3435
+ "format-painter": ["formatpainter", "format-painter", "formatPainter"]
3436
+ }, i = [
3437
+ t,
3438
+ t.toLowerCase(),
3439
+ ...o[t] || []
3440
+ ];
3441
+ for (const r of i) {
3442
+ const l = this.config[r];
3443
+ if (l && typeof l == "object" && !Array.isArray(l))
3444
+ return l;
3445
+ }
3446
+ }
3447
+ getContentSanitizeConfig() {
3448
+ const t = this.config.contentConfig;
3449
+ return t && typeof t == "object" ? t : { sanitize: !0 };
3450
+ }
3451
+ getSecurityConfig() {
3452
+ const t = this.config.security;
3453
+ return t && typeof t == "object" ? t : { sanitizeOnPaste: !0, sanitizeOnInput: !0 };
3454
+ }
3455
+ getAutosaveConfig() {
3456
+ var e, o;
3457
+ const t = this.config.autosave;
3458
+ if (typeof t == "boolean")
3459
+ return {
3460
+ enabled: t,
3461
+ intervalMs: 3e4,
3462
+ storageKey: "rte-autosave",
3463
+ provider: "localStorage"
3464
+ };
3465
+ if (t && typeof t == "object") {
3466
+ const i = Number((o = (e = t.intervalMs) != null ? e : t.interval) != null ? o : 3e4);
3467
+ return {
3468
+ enabled: !!t.enabled,
3469
+ intervalMs: Number.isFinite(i) && i > 0 ? i : 3e4,
3470
+ storageKey: String(t.storageKey || "rte-autosave"),
3471
+ provider: t.provider || "localStorage",
3472
+ apiUrl: t.apiUrl
3473
+ };
3474
+ }
3475
+ return {
3476
+ enabled: !1,
3477
+ intervalMs: 3e4,
3478
+ storageKey: "rte-autosave",
3479
+ provider: "localStorage"
3480
+ };
3481
+ }
3482
+ persistAutosave(t) {
3483
+ const e = this.getAutosaveConfig();
3484
+ if (e.enabled && t !== this.lastAutosavedContent) {
3485
+ if (this.lastAutosavedContent = t, e.provider === "localStorage") {
3486
+ try {
3487
+ localStorage.setItem(e.storageKey, t), localStorage.setItem(`${e.storageKey}-timestamp`, Date.now().toString());
3488
+ } catch (o) {
3489
+ console.error("[RichTextEditor] Failed to save autosave content to localStorage:", o);
3490
+ }
3491
+ return;
3492
+ }
3493
+ e.provider === "api" && e.apiUrl && fetch(e.apiUrl, {
3494
+ method: "POST",
3495
+ headers: { "Content-Type": "application/json" },
3496
+ body: JSON.stringify({ content: t, timestamp: Date.now() })
3497
+ }).catch((o) => {
3498
+ console.error("[RichTextEditor] Failed to save autosave content to API:", o);
3499
+ });
3500
+ }
3501
+ }
3502
+ restoreAutosavedContent() {
3503
+ const t = this.getAutosaveConfig();
3504
+ if (!t.enabled || t.provider !== "localStorage") return null;
3505
+ try {
3506
+ const e = localStorage.getItem(t.storageKey);
3507
+ if (e)
3508
+ return this.lastAutosavedContent = e, e;
3509
+ } catch (e) {
3510
+ console.error("[RichTextEditor] Failed to restore autosaved content:", e);
3511
+ }
3512
+ return null;
3513
+ }
3514
+ stopAutosave() {
3515
+ this.autosaveTimer && (clearInterval(this.autosaveTimer), this.autosaveTimer = void 0);
3516
+ }
3517
+ startAutosave() {
3518
+ this.stopAutosave();
3519
+ const t = this.getAutosaveConfig();
3520
+ !t.enabled || !this.contentElement || (this.autosaveTimer = setInterval(() => {
3521
+ var e;
3522
+ this.persistAutosave(((e = this.contentElement) == null ? void 0 : e.innerHTML) || "");
3523
+ }, t.intervalMs));
3524
+ }
3525
+ insertHTMLAtSelection(t) {
3526
+ if (!this.contentElement) return;
3527
+ const e = window.getSelection();
3528
+ if (e && e.rangeCount > 0) {
3529
+ const o = e.getRangeAt(0);
3530
+ o.deleteContents();
3531
+ const i = document.createElement("div");
3532
+ i.innerHTML = t;
3533
+ const r = document.createDocumentFragment();
3534
+ for (; i.firstChild; )
3535
+ r.appendChild(i.firstChild);
3536
+ o.insertNode(r), o.collapse(!1), e.removeAllRanges(), e.addRange(o);
3537
+ } else
3538
+ this.contentElement.focus(), document.execCommand("insertHTML", !1, t);
3539
+ }
3540
+ /**
3541
+ * Create UI elements
3542
+ */
3543
+ createUI(t, e) {
3544
+ const o = this.querySelector('[slot="toolbar"]'), i = this.querySelector('[slot="statusbar"]');
3545
+ this.innerHTML = "", this.config.toolbar !== !1 && !o ? (this.toolbarElement = document.createElement("div"), this.toolbarElement.className = "editora-toolbar-container", this.appendChild(this.toolbarElement), this.toolbar = new cn(
3546
+ {
3547
+ items: this.resolveToolbarItems(),
3548
+ sticky: this.isToolbarStickyEnabled(),
3549
+ position: "top"
3550
+ },
3551
+ t,
3552
+ this.pluginLoader
3553
+ // Pass plugin loader to get all registered plugins
3554
+ ), this.toolbar.setCommandHandler((r, l) => {
3555
+ var c;
3556
+ if (this.contentElement) {
3557
+ this.contentElement.focus();
3558
+ const p = window.getSelection();
3559
+ if (!p || p.rangeCount === 0 || !this.contentElement.contains(p.anchorNode)) {
3560
+ const m = document.createRange(), b = this.contentElement.lastChild || this.contentElement;
3561
+ b.nodeType === Node.TEXT_NODE ? m.setStart(b, ((c = b.textContent) == null ? void 0 : c.length) || 0) : b.nodeType === Node.ELEMENT_NODE ? (m.selectNodeContents(b), m.collapse(!1)) : m.setStart(this.contentElement, 0), m.collapse(!0), p == null || p.removeAllRanges(), p == null || p.addRange(m);
3562
+ }
3563
+ }
3564
+ return this.executeCommand(r, l);
3565
+ }), this.toolbar.render(this.toolbarElement)) : o && this.appendChild(o), this.contentElement = document.createElement("div"), this.contentElement.className = "editora-content rte-content", this.contentElement.contentEditable = this.config.readonly ? "false" : "true", this.applyLanguageSettings(), this.applyAccessibilitySettings(), this.applySpellcheckSettings(), this.config.placeholder && this.contentElement.setAttribute("data-placeholder", this.config.placeholder);
3566
+ try {
3567
+ document.execCommand("defaultParagraphSeparator", !1, "p");
3568
+ } catch (r) {
3569
+ console.warn("defaultParagraphSeparator not supported:", r);
3570
+ }
3571
+ if (e) {
3572
+ const r = document.createElement("div");
3573
+ r.innerHTML = e.trim(), !Array.from(r.childNodes).some((c) => {
3574
+ if (c.nodeType === Node.ELEMENT_NODE) {
3575
+ const p = c.tagName;
3576
+ return ["P", "DIV", "H1", "H2", "H3", "H4", "H5", "H6", "UL", "OL", "BLOCKQUOTE", "PRE"].includes(p);
3577
+ }
3578
+ return !1;
3579
+ }) && e.trim() ? this.contentElement.innerHTML = `<p>${e.trim()}</p>` : this.contentElement.innerHTML = e;
3580
+ } else
3581
+ this.config.placeholder ? this.contentElement.innerHTML = "" : this.contentElement.innerHTML = "<p><br></p>";
3582
+ this.appendChild(this.contentElement), this.isToolbarFloatingEnabled() && (this.floatingToolbar = new dn({ enabled: !0 }), this.floatingToolbar.create(this)), i ? this.appendChild(i) : this.isStatusbarEnabled() && (this.statusBarElement = document.createElement("div"), this.statusBarElement.className = "editora-statusbar-container", this.appendChild(this.statusBarElement), this.statusBar = new un({ position: this.getStatusbarPosition() }), this.statusBar.create(this.statusBarElement)), this.config.autofocus && setTimeout(() => {
3583
+ var r;
3584
+ return (r = this.contentElement) == null ? void 0 : r.focus();
3585
+ }, 0);
3586
+ }
3587
+ /**
3588
+ * Setup event listeners
3589
+ */
3590
+ setupEventListeners() {
3591
+ if (!this.contentElement || !this.engine) return;
3592
+ const t = this.keyboardShortcutManager;
3593
+ this.contentElement.addEventListener("beforeinput", (o) => {
3594
+ this.lastBeforeInputType = o.inputType || null;
3595
+ }), this.contentElement.addEventListener("input", (o) => {
3596
+ var _;
3597
+ if (!this.contentElement) return;
3598
+ let i = this.contentElement.innerHTML;
3599
+ const r = (_ = o == null ? void 0 : o.detail) == null ? void 0 : _.allowedTags, l = this.getPerformanceConfig(), c = this.getContentSanitizeConfig(), p = this.getSecurityConfig(), m = this.lastBeforeInputType;
3600
+ if (this.lastBeforeInputType = null, p.sanitizeOnInput !== !1 && c.sanitize !== !1 && !m) {
3601
+ const T = ni(i, c, p, r);
3602
+ if (T !== i) {
3603
+ const E = window.getSelection(), K = E && E.rangeCount > 0 ? E.getRangeAt(0) : null;
3604
+ if (this.contentElement.innerHTML = T, K && E)
3605
+ try {
3606
+ E.removeAllRanges(), E.addRange(K);
3607
+ } catch (D) {
3608
+ }
3609
+ i = T;
3610
+ }
3611
+ }
3612
+ this.contentChangeDebounceTimer && clearTimeout(this.contentChangeDebounceTimer);
3613
+ const w = () => {
3614
+ this.dispatchEvent(new CustomEvent("content-change", {
3615
+ detail: { html: i },
3616
+ bubbles: !0
3617
+ }));
3618
+ };
3619
+ l.debounceInputMs > 0 ? this.contentChangeDebounceTimer = setTimeout(w, l.debounceInputMs) : w(), this.updateStatusBar();
3620
+ }), this.contentElement.addEventListener("contextmenu", (o) => {
3621
+ const i = this.config.contextMenu;
3622
+ (i === !1 || typeof i == "object" && i !== null && i.enabled === !1) && o.preventDefault();
3623
+ }), this.contentElement.addEventListener("paste", (o) => {
3624
+ var b, w;
3625
+ if (o.__editoraSmartPasteHandled === !0 || o.defaultPrevented)
3626
+ return;
3627
+ o.preventDefault();
3628
+ const i = this.config.paste || {};
3629
+ let r = ((b = o.clipboardData) == null ? void 0 : b.getData("text/html")) || "";
3630
+ const l = ((w = o.clipboardData) == null ? void 0 : w.getData("text/plain")) || "", c = this.getContentSanitizeConfig(), p = this.getSecurityConfig(), m = !!r && /class=["'][^"']*Mso|xmlns:w=|urn:schemas-microsoft-com:office/i.test(r);
3631
+ if ((i.clean || !i.keepFormatting) && l) {
3632
+ document.execCommand("insertText", !1, l);
3633
+ return;
3634
+ }
3635
+ if (i.convertWord === !1 && m && l) {
3636
+ document.execCommand("insertText", !1, l);
3637
+ return;
3638
+ }
3639
+ if (r) {
3640
+ p.sanitizeOnPaste !== !1 && c.sanitize !== !1 && (r = oi(r, c, p)), this.insertHTMLAtSelection(r);
3641
+ return;
3642
+ }
3643
+ l && document.execCommand("insertText", !1, l);
3644
+ }), this.contentElement.addEventListener("focus", () => {
3645
+ J = this, this.dispatchEvent(new Event("editor-focus", { bubbles: !0 })), this.updateStatusBar();
3646
+ }), this.contentElement.addEventListener("blur", () => {
3647
+ this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.dispatchEvent(new CustomEvent("content-change", {
3648
+ detail: { html: this.contentElement.innerHTML },
3649
+ bubbles: !0
3650
+ })), this.dispatchEvent(new Event("editor-blur", { bubbles: !0 })), this.updateFloatingToolbar(), this.updateStatusBar();
3651
+ }), this.contentElement.addEventListener("keydown", (o) => {
3652
+ this.getAccessibilityConfig().keyboardNavigation && t.handleKeyDown(o, (r, l) => {
3653
+ this.executeCommand(r, l);
3654
+ });
3655
+ });
3656
+ const e = () => {
3657
+ const o = this.getSelectionRangeInEditor(), i = document.activeElement, r = !!i && !!this.contentElement && (i === this.contentElement || this.contentElement.contains(i));
3658
+ this.getPerformanceConfig().viewportOnlyScan && !this.isEditorInViewport() && !r || !o && !r || (this.updateFloatingToolbar(), this.updateStatusBar());
3659
+ };
3660
+ this.selectionChangeHandler = e, document.addEventListener("selectionchange", this.selectionChangeHandler);
3661
+ }
3662
+ getSelectionRangeInEditor() {
3663
+ if (!this.contentElement) return null;
3664
+ const t = window.getSelection();
3665
+ if (!t || t.rangeCount === 0)
3666
+ return null;
3667
+ const e = t.getRangeAt(0), o = e.commonAncestorContainer;
3668
+ return this.contentElement.contains(o) ? e : null;
3669
+ }
3670
+ isSelectionBackward(t) {
3671
+ if (!t.anchorNode || !t.focusNode) return !1;
3672
+ try {
3673
+ const e = document.createRange();
3674
+ return e.setStart(t.anchorNode, t.anchorOffset), e.setEnd(t.focusNode, t.focusOffset), e.collapsed;
3675
+ } catch (e) {
3676
+ return !1;
3677
+ }
3678
+ }
3679
+ getSelectionAnchorRect(t, e) {
3680
+ const o = Array.from(e.getClientRects()).filter((r) => r.width > 0 || r.height > 0);
3681
+ return o.length === 0 ? e.getBoundingClientRect() : this.isSelectionBackward(t) ? o[0] : o[o.length - 1];
3682
+ }
3683
+ /**
3684
+ * Update floating toolbar position
3685
+ */
3686
+ updateFloatingToolbar() {
3687
+ if (!this.floatingToolbar || !this.contentElement) return;
3688
+ if (this.config.readonly || this.contentElement.contentEditable === "false" || this.contentElement.getAttribute("data-readonly") === "true" || this.isReadonlyAttribute(this.getAttribute("readonly")) || this.getAttribute("data-readonly") === "true") {
3689
+ this.floatingToolbar.hide();
3690
+ return;
3691
+ }
3692
+ const e = this.getPerformanceConfig(), o = document.activeElement === this.contentElement || !!this.contentElement && this.contentElement.contains(document.activeElement);
3693
+ if (e.viewportOnlyScan && !this.isEditorInViewport() && !o) {
3694
+ this.floatingToolbar.hide();
3695
+ return;
3696
+ }
3697
+ const i = this.getSelectionRangeInEditor();
3698
+ if (!i) {
3699
+ this.floatingToolbar.hide();
3700
+ return;
3701
+ }
3702
+ if (i.collapsed) {
3703
+ this.floatingToolbar.hide();
3704
+ return;
3705
+ }
3706
+ const r = window.getSelection();
3707
+ if (!r) {
3708
+ this.floatingToolbar.hide();
3709
+ return;
3710
+ }
3711
+ const l = this.getSelectionAnchorRect(r, i);
3712
+ if (!l) {
3713
+ this.floatingToolbar.hide();
3714
+ return;
3715
+ }
3716
+ this.floatingToolbar.show(l.left, l.top - 40);
3717
+ }
3718
+ /**
3719
+ * Update status bar with selection and cursor information
3720
+ */
3721
+ /**
3722
+ * Update status bar with current content and cursor information
3723
+ */
3724
+ updateStatusBar() {
3725
+ if (!this.statusBar || !this.contentElement) return;
3726
+ const t = this.getPerformanceConfig(), e = document.activeElement === this.contentElement || this.contentElement.contains(document.activeElement);
3727
+ if (t.viewportOnlyScan && !this.isEditorInViewport() && !e)
3728
+ return;
3729
+ const o = this.contentElement.textContent || "", { words: i, chars: r } = mn(o), l = hn(this.contentElement);
3730
+ let c, p;
3731
+ const m = this.getSelectionRangeInEditor();
3732
+ m && (c = fn(this.contentElement, m), m.collapsed || (p = gn(m, c), c = void 0)), this.statusBar.update({
3733
+ wordCount: i,
3734
+ charCount: r,
3735
+ lineCount: l,
3736
+ cursorPosition: c,
3737
+ selectionInfo: p
3738
+ });
3739
+ }
3740
+ /**
3741
+ * `<editora-editor readonly>` and `readonly="true"` both lock the editor; only
3742
+ * removing the attribute or `readonly="false"` unlocks it.
3743
+ */
3744
+ isReadonlyAttribute(t) {
3745
+ return t !== null && t !== "false";
3746
+ }
3747
+ /**
3748
+ * Handle attribute changes
3749
+ */
3750
+ handleAttributeChange(t, e) {
3751
+ switch (t) {
3752
+ case "readonly":
3753
+ this.contentElement && (this.contentElement.contentEditable = this.isReadonlyAttribute(e) ? "false" : "true", this.applyAccessibilitySettings()), this.engine && this.engine.setReadonly(this.isReadonlyAttribute(e));
3754
+ break;
3755
+ case "theme":
3756
+ this.classList.forEach((o) => {
3757
+ o.startsWith("editora-theme-") && this.classList.remove(o);
3758
+ }), e && this.classList.add(`editora-theme-${e}`);
3759
+ break;
3760
+ case "placeholder":
3761
+ this.contentElement && (this.contentElement.setAttribute("data-placeholder", e), this.applyAccessibilitySettings());
3762
+ break;
3763
+ case "accessibility":
3764
+ case "accessibility-enable-aria":
3765
+ case "accessibility-keyboard-navigation":
3766
+ case "accessibility-checker":
3767
+ this.applyAccessibilitySettings();
3768
+ break;
3769
+ case "performance":
3770
+ case "performance-debounce-input-ms":
3771
+ case "performance-viewport-only-scan":
3772
+ break;
3773
+ case "language":
3774
+ case "language-locale":
3775
+ case "language-direction":
3776
+ this.applyLanguageSettings();
3777
+ break;
3778
+ case "spellcheck":
3779
+ case "spellcheck-enabled":
3780
+ case "spellcheck-provider":
3781
+ this.applySpellcheckSettings();
3782
+ break;
3783
+ case "autosave":
3784
+ case "autosave-enabled":
3785
+ case "autosave-interval-ms":
3786
+ case "autosave-storage-key":
3787
+ case "autosave-provider":
3788
+ case "autosave-api-url":
3789
+ this.startAutosave();
3790
+ break;
3791
+ case "security":
3792
+ case "security-sanitize-on-paste":
3793
+ case "security-sanitize-on-input":
3794
+ case "paste":
3795
+ case "paste-clean":
3796
+ case "paste-keep-formatting":
3797
+ case "paste-convert-word":
3798
+ case "context-menu":
3799
+ case "context-menu-enabled":
3800
+ break;
3801
+ case "toolbar":
3802
+ case "toolbar-items":
3803
+ case "toolbar-floating":
3804
+ case "toolbar-sticky":
3805
+ case "plugins":
3806
+ case "statusbar":
3807
+ this.isConnected && (this.destroy(), this.waitForPluginLoader().then(() => {
3808
+ this.initialize().catch((o) => {
3809
+ console.error("[RichTextEditor] Error during attribute change re-initialization:", o);
3810
+ });
3811
+ }));
3812
+ break;
3813
+ }
3814
+ }
3815
+ /**
3816
+ * Resolve configuration from all sources
3817
+ */
3818
+ resolveConfig() {
3819
+ const t = {};
3820
+ for (let e = 0; e < this.attributes.length; e++) {
3821
+ const o = this.attributes[e];
3822
+ t[o.name] = o.value;
3823
+ }
3824
+ return Te.resolve({
3825
+ jsConfig: this.jsConfig,
3826
+ attributes: t
3827
+ });
3828
+ }
3829
+ /**
3830
+ * Get public API
3831
+ */
3832
+ getAPI() {
3833
+ return {
3834
+ getContent: () => {
3835
+ var t;
3836
+ return ((t = this.contentElement) == null ? void 0 : t.innerHTML) || "";
3837
+ },
3838
+ setContent: (t) => {
3839
+ this.contentElement && (this.contentElement.innerHTML = t);
3840
+ },
3841
+ execCommand: (t, e) => this.executeCommand(t, e),
3842
+ focus: () => {
3843
+ var t;
3844
+ (t = this.contentElement) == null || t.focus();
3845
+ },
3846
+ blur: () => {
3847
+ var t;
3848
+ (t = this.contentElement) == null || t.blur();
3849
+ },
3850
+ destroy: () => {
3851
+ this.destroy();
3852
+ },
3853
+ on: (t, e) => (this.addEventListener(t, e), () => this.removeEventListener(t, e)),
3854
+ getConfig: () => ({ ...this.config }),
3855
+ setReadonly: (t) => {
3856
+ this.setAttribute("readonly", t.toString());
3857
+ }
3858
+ };
3859
+ }
3860
+ /**
3861
+ * Destroy the editor
3862
+ */
3863
+ destroy() {
3864
+ var t, e, o, i;
3865
+ this.contentChangeDebounceTimer && (clearTimeout(this.contentChangeDebounceTimer), this.contentChangeDebounceTimer = void 0), this.contentElement && this.persistAutosave(this.contentElement.innerHTML || ""), this.stopAutosave(), this.selectionChangeHandler && (document.removeEventListener("selectionchange", this.selectionChangeHandler), this.selectionChangeHandler = void 0), (t = this.engine) == null || t.destroy(), (e = this.toolbar) == null || e.destroy(), (o = this.floatingToolbar) == null || o.destroy(), (i = this.statusBar) == null || i.destroy(), this.innerHTML = "", this.contentElement = void 0, this.toolbarElement = void 0, this.statusBarElement = void 0, this.loadedPlugins = [], this.isInitialized = !1, ke.delete(this), J === this && (J = null), this.dispatchEvent(new Event("editor-destroy", { bubbles: !0 }));
3866
+ }
3867
+ // Public API methods
3868
+ getContent() {
3869
+ var t;
3870
+ return ((t = this.contentElement) == null ? void 0 : t.innerHTML) || "";
3871
+ }
3872
+ setContent(t) {
3873
+ this.contentElement && (this.contentElement.innerHTML = t);
3874
+ }
3875
+ execCommand(t, ...e) {
3876
+ return this.executeCommand(t, ...e);
3877
+ }
3878
+ focus() {
3879
+ var t;
3880
+ (t = this.contentElement) == null || t.focus();
3881
+ }
3882
+ blur() {
3883
+ var t;
3884
+ (t = this.contentElement) == null || t.blur();
3885
+ }
3886
+ }
3887
+ export {
3888
+ sn as C,
3889
+ Gt as E,
3890
+ dn as F,
3891
+ an as K,
3892
+ rn as P,
3893
+ gt as R,
3894
+ nn as S,
3895
+ cn as T,
3896
+ ln as a,
3897
+ Te as b,
3898
+ ii as c,
3899
+ un as d,
3900
+ mn as e,
3901
+ hn as f,
3902
+ fn as g,
3903
+ gn as h,
3904
+ pn as i,
3905
+ ni as j,
3906
+ oi as k,
3907
+ fi as l,
3908
+ ei as s
3909
+ };
3910
+ //# sourceMappingURL=index-B1_vtXRz.mjs.map