@editora/plugins 1.0.10 → 1.0.12

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 (139) hide show
  1. package/README.md +1 -1
  2. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  3. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +80 -98
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +115 -128
  8. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  9. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +208 -249
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +55 -68
  14. package/dist/blockquote.esm.js +1 -2
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +178 -245
  17. package/dist/capitalization.esm.js +1 -2
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +58 -82
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +439 -512
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +27 -33
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +82 -93
  26. package/dist/code.cjs.js +119 -42
  27. package/dist/code.esm.js +2560 -760
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +116 -158
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +371 -432
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +105 -159
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +328 -368
  36. package/dist/direction.esm.js +9 -18
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +240 -308
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +4 -5
  41. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  42. package/dist/documentManager-Jf0RbSks.js +17 -0
  43. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +73 -81
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +65 -77
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +54 -56
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +39 -47
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +37 -53
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +76 -117
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +70 -92
  58. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  59. package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +12 -24
  62. package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
  63. package/dist/index-CvJk4DKa.js +221 -0
  64. package/dist/index-D3CycEFU.mjs +16543 -0
  65. package/dist/index-tqLTHcO6.js +1 -0
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-CE_A4QSm.js +5 -0
  68. package/dist/index.es-DQ78mYYo.mjs +6665 -0
  69. package/dist/index.esm.js +125 -128
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +8 -9
  72. package/dist/jspdf.es.min-BoS80556.js +77 -0
  73. package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +11 -24
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +24 -30
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +20 -25
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +59 -61
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +139 -146
  84. package/dist/media-manager.cjs.js +31 -31
  85. package/dist/media-manager.esm.js +285 -300
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +238 -286
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +177 -216
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +33 -49
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +393 -463
  94. package/dist/plugins.css +1 -0
  95. package/dist/preview.esm.js +5 -10
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +17 -20
  98. package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
  99. package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
  100. package/dist/slash-commands.cjs.js +2 -2
  101. package/dist/slash-commands.esm.js +39 -75
  102. package/dist/smart-paste.cjs.js +27 -27
  103. package/dist/smart-paste.esm.js +280 -336
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +61 -69
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +97 -123
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +14 -19
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +191 -225
  112. package/dist/template.cjs.js +21 -20
  113. package/dist/template.esm.js +715 -196
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +21 -27
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +70 -87
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +100 -162
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +602 -678
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +128 -157
  124. package/package.json +1 -1
  125. package/dist/_commonjsHelpers-6763f629.js +0 -1
  126. package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
  127. package/dist/anchoredPopover-33f1358d.mjs +0 -109
  128. package/dist/anchoredPopover-8151d535.js +0 -1
  129. package/dist/documentManager-25b6203c.mjs +0 -9122
  130. package/dist/documentManager-b69e7054.js +0 -17
  131. package/dist/html2canvas.esm-09133e29.js +0 -22
  132. package/dist/index-656d224b.js +0 -231
  133. package/dist/index-6a8c48bb.js +0 -1
  134. package/dist/index-d027b7e2.mjs +0 -16859
  135. package/dist/index.es-730f2d98.mjs +0 -5775
  136. package/dist/index.es-dd40173b.js +0 -18
  137. package/dist/jspdf.es.min-90db2c97.js +0 -243
  138. package/dist/style.css +0 -1
  139. /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
@@ -1,4 +1,4 @@
1
- const T = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding="true"]', it = "rte-data-binding-styles", p = "rte-data-binding-dialog-overlay", b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pt = {
1
+ const A = ".rte-content, .editora-content", C = '.rte-data-binding[data-binding="true"]', it = "rte-data-binding-styles", g = "rte-data-binding-dialog-overlay", f = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pt = {
2
2
  dialogTitleInsert: "Insert Data Binding",
3
3
  dialogTitleEdit: "Edit Data Binding",
4
4
  keyLabel: "Data Key",
@@ -13,8 +13,8 @@ const T = ".rte-content, .editora-content", P = '.rte-data-binding[data-binding=
13
13
  previewOnText: "Preview On",
14
14
  previewOffText: "Preview Off",
15
15
  tokenAriaPrefix: "Data binding token"
16
- }, x = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), g = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap();
17
- let R = null, k = null, q = 0, O = null, M = null, B = null, _ = null;
16
+ }, x = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap();
17
+ let R = null, h = null, U = 0, P = null, O = null, M = null, z = null;
18
18
  function yt(t) {
19
19
  return {
20
20
  ...pt,
@@ -22,7 +22,7 @@ function yt(t) {
22
22
  };
23
23
  }
24
24
  function ot(t = {}) {
25
- const a = (t.locale || (typeof navigator < "u" ? navigator.language : "en-US")).trim() || "en-US";
25
+ const n = (t.locale || (typeof navigator < "u" ? navigator.language : "en-US")).trim() || "en-US";
26
26
  return {
27
27
  data: t.data,
28
28
  getData: t.getData,
@@ -31,82 +31,73 @@ function ot(t = {}) {
31
31
  labels: yt(t.labels),
32
32
  defaultFormat: t.defaultFormat || "text",
33
33
  defaultFallback: t.defaultFallback || "",
34
- locale: a,
34
+ locale: n,
35
35
  numberFormatOptions: t.numberFormatOptions || {},
36
36
  dateFormatOptions: t.dateFormatOptions || { year: "numeric", month: "short", day: "2-digit" }
37
37
  };
38
38
  }
39
- function h(t) {
39
+ function y(t) {
40
40
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
41
41
  }
42
42
  function dt(t) {
43
43
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
44
44
  }
45
- function U(t) {
45
+ function j(t) {
46
46
  return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || t;
47
47
  }
48
- function z(t) {
48
+ function q(t) {
49
49
  return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
50
50
  }
51
51
  function ht(t) {
52
- const a = U(t);
53
- if (z(a))
54
- return !0;
55
- const n = a.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
56
- return z(n) ? !0 : z(document.documentElement) || z(document.body);
57
- }
58
- function S(t, a = !0) {
59
- if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement)
60
- return t.contentElement;
61
- if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
52
+ const n = j(t);
53
+ if (q(n)) return !0;
54
+ const a = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
55
+ return q(a) ? !0 : q(document.documentElement) || q(document.body);
56
+ }
57
+ function D(t, n = !0) {
58
+ if (t?.contentElement instanceof HTMLElement) return t.contentElement;
59
+ if (t?.editorElement instanceof HTMLElement) {
62
60
  const e = t.editorElement;
63
- if (e.matches(T))
64
- return e;
65
- const i = e.querySelector(T);
66
- if (i instanceof HTMLElement)
67
- return i;
61
+ if (e.matches(A)) return e;
62
+ const i = e.querySelector(A);
63
+ if (i instanceof HTMLElement) return i;
68
64
  }
69
- const n = window.getSelection();
70
- if (n && n.rangeCount > 0) {
71
- const e = n.getRangeAt(0).startContainer, i = dt(e), o = i == null ? void 0 : i.closest(T);
72
- if (o)
73
- return o;
65
+ const a = window.getSelection();
66
+ if (a && a.rangeCount > 0) {
67
+ const e = a.getRangeAt(0).startContainer, o = dt(e)?.closest(A);
68
+ if (o) return o;
74
69
  }
75
70
  const r = document.activeElement;
76
71
  if (r) {
77
- if (r.matches(T))
78
- return r;
79
- const e = r.closest(T);
80
- if (e)
81
- return e;
72
+ if (r.matches(A)) return r;
73
+ const e = r.closest(A);
74
+ if (e) return e;
82
75
  }
83
- return k && k.isConnected ? k : a ? document.querySelector(T) : null;
76
+ return h && h.isConnected ? h : n ? document.querySelector(A) : null;
84
77
  }
85
78
  function K(t) {
86
79
  return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
87
80
  }
88
81
  function lt(t) {
89
- const a = window.getSelection();
90
- if (!a || a.rangeCount === 0)
91
- return null;
92
- const n = a.getRangeAt(0);
93
- return t.contains(n.commonAncestorContainer) ? n.cloneRange() : null;
94
- }
95
- function st(t, a) {
96
82
  const n = window.getSelection();
97
- n && (n.removeAllRanges(), n.addRange(a), t.focus({ preventScroll: !0 }));
83
+ if (!n || n.rangeCount === 0) return null;
84
+ const a = n.getRangeAt(0);
85
+ return t.contains(a.commonAncestorContainer) ? a.cloneRange() : null;
98
86
  }
99
- function kt(t, a) {
100
- const n = (a || "").trim();
101
- if (n)
102
- return n.split(".").filter(Boolean).reduce((r, e) => {
87
+ function st(t, n) {
88
+ const a = window.getSelection();
89
+ a && (a.removeAllRanges(), a.addRange(n), t.focus({ preventScroll: !0 }));
90
+ }
91
+ function kt(t, n) {
92
+ const a = (n || "").trim();
93
+ if (a)
94
+ return a.split(".").filter(Boolean).reduce((r, e) => {
103
95
  if (!(r == null || typeof r != "object"))
104
96
  return r[e];
105
97
  }, t);
106
98
  }
107
- function vt() {
108
- if (typeof document > "u" || document.getElementById(it))
109
- return;
99
+ function xt() {
100
+ if (typeof document > "u" || document.getElementById(it)) return;
110
101
  const t = document.createElement("style");
111
102
  t.id = it, t.textContent = `
112
103
  .rte-data-binding {
@@ -311,85 +302,85 @@ function vt() {
311
302
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
312
303
  }
313
304
 
314
- ${b} .rte-data-binding,
315
- .${p}.rte-data-binding-theme-dark .rte-data-binding {
305
+ ${f} .rte-data-binding,
306
+ .${g}.rte-data-binding-theme-dark .rte-data-binding {
316
307
  background: linear-gradient(180deg, #3b0764 0%, #2e1065 100%);
317
308
  border-color: #a78bfa;
318
309
  color: #ede9fe;
319
310
  }
320
311
 
321
- ${b} .rte-data-binding::before,
322
- .${p}.rte-data-binding-theme-dark .rte-data-binding::before {
312
+ ${f} .rte-data-binding::before,
313
+ .${g}.rte-data-binding-theme-dark .rte-data-binding::before {
323
314
  background: rgba(167, 139, 250, 0.22);
324
315
  color: #ddd6fe;
325
316
  }
326
317
 
327
- ${b} .rte-data-binding.rte-data-binding-preview,
328
- .${p}.rte-data-binding-theme-dark .rte-data-binding.rte-data-binding-preview {
318
+ ${f} .rte-data-binding.rte-data-binding-preview,
319
+ .${g}.rte-data-binding-theme-dark .rte-data-binding.rte-data-binding-preview {
329
320
  background: #064e3b;
330
321
  border-color: #10b981;
331
322
  color: #d1fae5;
332
323
  }
333
324
 
334
- ${b} .rte-data-binding.rte-data-binding-missing,
335
- .${p}.rte-data-binding-theme-dark .rte-data-binding.rte-data-binding-missing {
325
+ ${f} .rte-data-binding.rte-data-binding-missing,
326
+ .${g}.rte-data-binding-theme-dark .rte-data-binding.rte-data-binding-missing {
336
327
  background: #7f1d1d;
337
328
  border-color: #ef4444;
338
329
  color: #fee2e2;
339
330
  }
340
331
 
341
- ${b} .rte-toolbar-group-items.data-binding,
342
- ${b} .editora-toolbar-group-items.data-binding {
332
+ ${f} .rte-toolbar-group-items.data-binding,
333
+ ${f} .editora-toolbar-group-items.data-binding {
343
334
  display: flex;
344
335
  border: 1px solid #566275;
345
336
  border-radius: 6px;
346
337
  overflow: hidden;
347
338
  }
348
339
 
349
- ${b} .rte-toolbar-group-items.data-binding .rte-toolbar-button,
350
- ${b} .editora-toolbar-group-items.data-binding .editora-toolbar-button {
340
+ ${f} .rte-toolbar-group-items.data-binding .rte-toolbar-button,
341
+ ${f} .editora-toolbar-group-items.data-binding .editora-toolbar-button {
351
342
  border-right-color: #566275;
352
343
  }
353
344
 
354
- ${b} .rte-data-binding-dialog,
355
- .${p}.rte-data-binding-theme-dark .rte-data-binding-dialog {
345
+ ${f} .rte-data-binding-dialog,
346
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-dialog {
356
347
  background: #1f2937;
357
348
  border-color: #334155;
358
349
  }
359
350
 
360
- ${b} .rte-data-binding-header,
361
- ${b} .rte-data-binding-footer,
362
- .${p}.rte-data-binding-theme-dark .rte-data-binding-header,
363
- .${p}.rte-data-binding-theme-dark .rte-data-binding-footer {
351
+ ${f} .rte-data-binding-header,
352
+ ${f} .rte-data-binding-footer,
353
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-header,
354
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-footer {
364
355
  background: #111827;
365
356
  border-color: #334155;
366
357
  }
367
358
 
368
- ${b} .rte-data-binding-title,
369
- ${b} .rte-data-binding-field label,
370
- .${p}.rte-data-binding-theme-dark .rte-data-binding-title,
371
- .${p}.rte-data-binding-theme-dark .rte-data-binding-field label {
359
+ ${f} .rte-data-binding-title,
360
+ ${f} .rte-data-binding-field label,
361
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-title,
362
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-field label {
372
363
  color: #e2e8f0;
373
364
  }
374
365
 
375
- ${b} .rte-data-binding-help,
376
- .${p}.rte-data-binding-theme-dark .rte-data-binding-help {
366
+ ${f} .rte-data-binding-help,
367
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-help {
377
368
  color: #94a3b8;
378
369
  }
379
370
 
380
- ${b} .rte-data-binding-field input,
381
- ${b} .rte-data-binding-field select,
382
- ${b} .rte-data-binding-btn,
383
- .${p}.rte-data-binding-theme-dark .rte-data-binding-field input,
384
- .${p}.rte-data-binding-theme-dark .rte-data-binding-field select,
385
- .${p}.rte-data-binding-theme-dark .rte-data-binding-btn {
371
+ ${f} .rte-data-binding-field input,
372
+ ${f} .rte-data-binding-field select,
373
+ ${f} .rte-data-binding-btn,
374
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-field input,
375
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-field select,
376
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-btn {
386
377
  background: #0f172a;
387
378
  border-color: #475569;
388
379
  color: #e2e8f0;
389
380
  }
390
381
 
391
- ${b} .rte-data-binding-btn-primary,
392
- .${p}.rte-data-binding-theme-dark .rte-data-binding-btn-primary {
382
+ ${f} .rte-data-binding-btn-primary,
383
+ .${g}.rte-data-binding-theme-dark .rte-data-binding-btn-primary {
393
384
  background: #2563eb;
394
385
  border-color: #2563eb;
395
386
  color: #ffffff;
@@ -399,81 +390,77 @@ function vt() {
399
390
  function J(t) {
400
391
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
401
392
  }
402
- function Y(t, a) {
403
- if (a === t.innerHTML)
404
- return;
405
- const n = window.execEditorCommand || window.executeEditorCommand;
406
- if (typeof n == "function")
393
+ function Y(t, n) {
394
+ if (n === t.innerHTML) return;
395
+ const a = window.execEditorCommand || window.executeEditorCommand;
396
+ if (typeof a == "function")
407
397
  try {
408
- n("recordDomTransaction", t, a, t.innerHTML);
398
+ a("recordDomTransaction", t, n, t.innerHTML);
409
399
  } catch {
410
400
  }
411
401
  }
412
- function H(t, a) {
402
+ function H(t, n) {
413
403
  return {
414
404
  key: String(t.key || "").trim(),
415
- fallback: String(t.fallback ?? a.defaultFallback ?? ""),
416
- format: t.format || a.defaultFormat || "text",
405
+ fallback: String(t.fallback ?? n.defaultFallback ?? ""),
406
+ format: t.format || n.defaultFormat || "text",
417
407
  currency: String(t.currency || "USD").trim().toUpperCase() || "USD"
418
408
  };
419
409
  }
420
410
  function ct(t) {
421
411
  return `{{${t.key}}}`;
422
412
  }
423
- function ut(t, a) {
424
- const n = document.createElement("span");
425
- return n.className = "rte-data-binding", n.setAttribute("data-binding", "true"), n.setAttribute("data-binding-key", t.key), n.setAttribute("data-binding-fallback", t.fallback || ""), n.setAttribute("data-binding-format", t.format || "text"), n.setAttribute("data-binding-currency", t.currency || "USD"), n.setAttribute("contenteditable", "false"), n.setAttribute("spellcheck", "false"), n.setAttribute("draggable", "false"), n.setAttribute("tabindex", "0"), n.setAttribute("role", "button"), n.setAttribute("aria-label", `${a.tokenAriaPrefix}: ${t.key}. Press Enter to edit.`), n.textContent = ct(t), n;
413
+ function ut(t, n) {
414
+ const a = document.createElement("span");
415
+ return a.className = "rte-data-binding", a.setAttribute("data-binding", "true"), a.setAttribute("data-binding-key", t.key), a.setAttribute("data-binding-fallback", t.fallback || ""), a.setAttribute("data-binding-format", t.format || "text"), a.setAttribute("data-binding-currency", t.currency || "USD"), a.setAttribute("contenteditable", "false"), a.setAttribute("spellcheck", "false"), a.setAttribute("draggable", "false"), a.setAttribute("tabindex", "0"), a.setAttribute("role", "button"), a.setAttribute("aria-label", `${n.tokenAriaPrefix}: ${t.key}. Press Enter to edit.`), a.textContent = ct(t), a;
426
416
  }
427
- function G(t, a) {
417
+ function Z(t, n) {
428
418
  return H(
429
419
  {
430
420
  key: t.getAttribute("data-binding-key") || "",
431
- fallback: t.getAttribute("data-binding-fallback") || a.defaultFallback,
432
- format: t.getAttribute("data-binding-format") || a.defaultFormat,
421
+ fallback: t.getAttribute("data-binding-fallback") || n.defaultFallback,
422
+ format: t.getAttribute("data-binding-format") || n.defaultFormat,
433
423
  currency: t.getAttribute("data-binding-currency") || "USD"
434
424
  },
435
- a
425
+ n
436
426
  );
437
427
  }
438
- function X(t, a, n) {
439
- t.classList.add("rte-data-binding"), t.setAttribute("data-binding", "true"), t.setAttribute("data-binding-key", a.key), t.setAttribute("data-binding-fallback", a.fallback || ""), t.setAttribute("data-binding-format", a.format || "text"), t.setAttribute("data-binding-currency", a.currency || "USD"), t.setAttribute("contenteditable", "false"), t.setAttribute("spellcheck", "false"), t.setAttribute("draggable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "button"), t.setAttribute("aria-label", `${n.tokenAriaPrefix}: ${a.key}. Press Enter to edit.`);
428
+ function X(t, n, a) {
429
+ t.classList.add("rte-data-binding"), t.setAttribute("data-binding", "true"), t.setAttribute("data-binding-key", n.key), t.setAttribute("data-binding-fallback", n.fallback || ""), t.setAttribute("data-binding-format", n.format || "text"), t.setAttribute("data-binding-currency", n.currency || "USD"), t.setAttribute("contenteditable", "false"), t.setAttribute("spellcheck", "false"), t.setAttribute("draggable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "button"), t.setAttribute("aria-label", `${a.tokenAriaPrefix}: ${n.key}. Press Enter to edit.`);
440
430
  }
441
- function Z(t, a) {
442
- const n = Array.from(t.querySelectorAll(P));
443
- return n.forEach((r) => {
444
- const e = G(r, a);
445
- X(r, e, a.labels);
446
- }), n;
431
+ function V(t, n) {
432
+ const a = Array.from(t.querySelectorAll(C));
433
+ return a.forEach((r) => {
434
+ const e = Z(r, n);
435
+ X(r, e, n.labels);
436
+ }), a;
447
437
  }
448
438
  function Q(t) {
449
- const a = window.getSelection();
450
- if (a && a.rangeCount > 0) {
451
- const e = a.getRangeAt(0).startContainer, i = dt(e), o = i == null ? void 0 : i.closest(P);
452
- if (o && t.contains(o))
453
- return o;
439
+ const n = window.getSelection();
440
+ if (n && n.rangeCount > 0) {
441
+ const e = n.getRangeAt(0).startContainer, o = dt(e)?.closest(C);
442
+ if (o && t.contains(o)) return o;
454
443
  }
455
- const n = document.activeElement, r = n == null ? void 0 : n.closest(P);
444
+ const r = document.activeElement?.closest(C);
456
445
  return r && t.contains(r) ? r : null;
457
446
  }
458
447
  function ft() {
459
448
  R && (R.cleanup(), R = null);
460
449
  }
461
- function tt(t, a, n) {
462
- const r = U(t);
450
+ function tt(t, n, a) {
451
+ const r = j(t);
463
452
  Array.from(r.querySelectorAll('[data-command="toggleDataBindingPreview"]')).forEach((i) => {
464
- if (i.setAttribute("data-active", a ? "true" : "false"), i.classList.toggle("active", a), i.setAttribute("aria-pressed", a ? "true" : "false"), n) {
465
- const o = a ? n.labels.previewOnText : n.labels.previewOffText;
453
+ if (i.setAttribute("data-active", n ? "true" : "false"), i.classList.toggle("active", n), i.setAttribute("aria-pressed", n ? "true" : "false"), a) {
454
+ const o = n ? a.labels.previewOnText : a.labels.previewOffText;
466
455
  i.setAttribute("title", o), i.setAttribute("aria-label", o);
467
456
  }
468
457
  });
469
458
  }
470
- function xt(t, a, n) {
471
- const r = a.format || "text";
472
- if (t == null)
473
- return a.fallback || "";
459
+ function vt(t, n, a) {
460
+ const r = n.format || "text";
461
+ if (t == null) return n.fallback || "";
474
462
  if (r === "json") {
475
- if (typeof t == "string")
476
- return t;
463
+ if (typeof t == "string") return t;
477
464
  try {
478
465
  return JSON.stringify(t);
479
466
  } catch {
@@ -482,58 +469,56 @@ function xt(t, a, n) {
482
469
  }
483
470
  if (r === "date") {
484
471
  const e = t instanceof Date ? t : new Date(String(t));
485
- if (Number.isNaN(e.getTime()))
486
- return String(t);
472
+ if (Number.isNaN(e.getTime())) return String(t);
487
473
  try {
488
- return new Intl.DateTimeFormat(n.locale, n.dateFormatOptions).format(e);
474
+ return new Intl.DateTimeFormat(a.locale, a.dateFormatOptions).format(e);
489
475
  } catch {
490
476
  return e.toISOString();
491
477
  }
492
478
  }
493
479
  if (r === "number" || r === "currency") {
494
480
  const e = typeof t == "number" ? t : Number(t);
495
- if (!Number.isFinite(e))
496
- return String(t);
497
- const i = { ...n.numberFormatOptions };
481
+ if (!Number.isFinite(e)) return String(t);
482
+ const i = { ...a.numberFormatOptions };
498
483
  if (r === "currency") {
499
- const o = (a.currency || "USD").toUpperCase();
484
+ const o = (n.currency || "USD").toUpperCase();
500
485
  Object.assign(i, { style: "currency", currency: o });
501
486
  }
502
487
  try {
503
- return new Intl.NumberFormat(n.locale, i).format(e);
488
+ return new Intl.NumberFormat(a.locale, i).format(e);
504
489
  } catch {
505
490
  return String(e);
506
491
  }
507
492
  }
508
493
  return String(t);
509
494
  }
510
- function L(t, a, n, r) {
511
- const e = G(t, a), i = e.key;
512
- if (t.classList.remove("rte-data-binding-preview", "rte-data-binding-missing"), !n) {
513
- t.textContent = ct(e), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i}. Press Enter to edit.`);
495
+ function T(t, n, a, r) {
496
+ const e = Z(t, n), i = e.key;
497
+ if (t.classList.remove("rte-data-binding-preview", "rte-data-binding-missing"), !a) {
498
+ t.textContent = ct(e), t.setAttribute("aria-label", `${n.labels.tokenAriaPrefix}: ${i}. Press Enter to edit.`);
514
499
  return;
515
500
  }
516
- const o = kt(r, i), l = o == null, d = l ? e.fallback || "" : xt(o, e, a);
517
- t.textContent = d || e.fallback || "", t.classList.add("rte-data-binding-preview"), l && !(e.fallback || "").trim() && t.classList.add("rte-data-binding-missing"), t.setAttribute("aria-label", `${a.labels.tokenAriaPrefix}: ${i} = ${t.textContent || ""}. Press Enter to edit.`);
501
+ const o = kt(r, i), l = o == null, d = l ? e.fallback || "" : vt(o, e, n);
502
+ t.textContent = d || e.fallback || "", t.classList.add("rte-data-binding-preview"), l && !(e.fallback || "").trim() && t.classList.add("rte-data-binding-missing"), t.setAttribute("aria-label", `${n.labels.tokenAriaPrefix}: ${i} = ${t.textContent || ""}. Press Enter to edit.`);
518
503
  }
519
- function E(t) {
504
+ function v(t) {
520
505
  return typeof t == "object" && t !== null && !Array.isArray(t);
521
506
  }
522
- function wt(t, a) {
523
- return a ? a.split(".").filter(Boolean).reduce((n, r) => {
524
- if (!(!E(n) && !Array.isArray(n)))
525
- return n[r];
507
+ function wt(t, n) {
508
+ return n ? n.split(".").filter(Boolean).reduce((a, r) => {
509
+ if (!(!v(a) && !Array.isArray(a)))
510
+ return a[r];
526
511
  }, t) : t;
527
512
  }
528
- function Et(t, a, n) {
529
- const r = a.api, e = U(t), i = { editor: t, editorRoot: e, signal: n };
513
+ function Et(t, n, a) {
514
+ const r = n.api, e = j(t), i = { editor: t, editorRoot: e, signal: a };
530
515
  if (r.buildRequest) {
531
- const f = r.buildRequest(i);
532
- return { url: f.url, init: { ...f.init || {}, signal: n } };
516
+ const p = r.buildRequest(i);
517
+ return { url: p.url, init: { ...p.init || {}, signal: a } };
533
518
  }
534
519
  const o = (r.method || "GET").toUpperCase(), l = typeof r.headers == "function" ? r.headers(i) : r.headers || {}, d = typeof r.params == "function" ? r.params(i) : r.params, c = new URL(r.url, window.location.origin);
535
- d && Object.entries(d).forEach(([f, m]) => {
536
- m != null && c.searchParams.set(f, String(m));
520
+ d && Object.entries(d).forEach(([p, m]) => {
521
+ m != null && c.searchParams.set(p, String(m));
537
522
  });
538
523
  const u = {
539
524
  method: o,
@@ -541,133 +526,126 @@ function Et(t, a, n) {
541
526
  credentials: r.credentials,
542
527
  mode: r.mode,
543
528
  cache: r.cache,
544
- signal: n
529
+ signal: a
545
530
  };
546
531
  if (o !== "GET" && o !== "HEAD") {
547
- const f = typeof r.body == "function" ? r.body(i) : r.body;
548
- if (f != null)
549
- if (E(f)) {
550
- u.body = JSON.stringify(f);
532
+ const p = typeof r.body == "function" ? r.body(i) : r.body;
533
+ if (p != null)
534
+ if (v(p)) {
535
+ u.body = JSON.stringify(p);
551
536
  const m = u.headers;
552
537
  !m["Content-Type"] && !m["content-type"] && (m["Content-Type"] = "application/json");
553
538
  } else
554
- u.body = f;
539
+ u.body = p;
555
540
  }
556
541
  return { url: c.toString(), init: u };
557
542
  }
558
- async function Dt(t, a) {
559
- var d;
560
- const n = a.api;
561
- if (!n)
562
- return {};
563
- const r = new AbortController(), e = U(t), i = { editor: t, editorRoot: e, signal: r.signal }, o = Math.max(0, Number(n.timeoutMs ?? 1e4));
543
+ async function Dt(t, n) {
544
+ const a = n.api;
545
+ if (!a) return {};
546
+ const r = new AbortController(), e = j(t), i = { editor: t, editorRoot: e, signal: r.signal }, o = Math.max(0, Number(a.timeoutMs ?? 1e4));
564
547
  let l = null;
565
548
  o > 0 && (l = window.setTimeout(() => r.abort(), o));
566
549
  try {
567
- const { url: c, init: u } = Et(t, a, r.signal), f = await fetch(c, { ...u, signal: r.signal });
568
- if (!f.ok)
569
- throw new Error(`Data binding API request failed: ${f.status}`);
570
- const v = (n.responseType || "json") === "text" ? await f.text() : await f.json();
571
- if (n.transformResponse) {
572
- const w = n.transformResponse(v, i);
573
- return E(w) ? w : {};
574
- }
575
- const C = wt(v, n.responsePath);
576
- return E(C) ? C : E(v) ? v : { value: C };
577
- } catch (c) {
578
- return (c == null ? void 0 : c.name) !== "AbortError" && ((d = n.onError) == null || d.call(n, c, i)), {};
550
+ const { url: d, init: c } = Et(t, n, r.signal), u = await fetch(d, { ...c, signal: r.signal });
551
+ if (!u.ok)
552
+ throw new Error(`Data binding API request failed: ${u.status}`);
553
+ const m = (a.responseType || "json") === "text" ? await u.text() : await u.json();
554
+ if (a.transformResponse) {
555
+ const B = a.transformResponse(m, i);
556
+ return v(B) ? B : {};
557
+ }
558
+ const $ = wt(m, a.responsePath);
559
+ return v($) ? $ : v(m) ? m : { value: $ };
560
+ } catch (d) {
561
+ return d?.name !== "AbortError" && a.onError?.(d, i), {};
579
562
  } finally {
580
563
  l !== null && window.clearTimeout(l);
581
564
  }
582
565
  }
583
- async function j(t, a) {
584
- const n = I.get(t);
585
- if (n)
586
- return n;
566
+ async function I(t, n) {
567
+ const a = W.get(t);
568
+ if (a) return a;
587
569
  const r = N.get(t), e = Date.now();
588
- if (r && e - r.timestamp <= a.cacheTtlMs)
570
+ if (r && e - r.timestamp <= n.cacheTtlMs)
589
571
  return r.data;
590
- const i = W.get(t);
591
- if (i)
592
- return i;
572
+ const i = G.get(t);
573
+ if (i) return i;
593
574
  const o = (async () => {
594
575
  try {
595
- if (typeof a.getData == "function") {
596
- const d = await Promise.resolve(a.getData({ editor: t, editorRoot: U(t) }));
597
- if (E(d))
598
- return d;
576
+ if (typeof n.getData == "function") {
577
+ const d = await Promise.resolve(n.getData({ editor: t, editorRoot: j(t) }));
578
+ if (v(d)) return d;
599
579
  }
600
- if (a.api) {
601
- const d = await Dt(t, a);
602
- if (E(d))
603
- return d;
580
+ if (n.api) {
581
+ const d = await Dt(t, n);
582
+ if (v(d)) return d;
604
583
  }
605
- if (typeof a.data == "function") {
606
- const d = await Promise.resolve(a.data());
607
- if (E(d))
608
- return d;
584
+ if (typeof n.data == "function") {
585
+ const d = await Promise.resolve(n.data());
586
+ if (v(d)) return d;
609
587
  }
610
- return E(a.data) ? a.data : {};
588
+ return v(n.data) ? n.data : {};
611
589
  } finally {
612
- W.delete(t);
590
+ G.delete(t);
613
591
  }
614
592
  })();
615
- W.set(t, o);
593
+ G.set(t, o);
616
594
  const l = await o;
617
595
  return N.set(t, { timestamp: e, data: l }), l;
618
596
  }
619
- async function V(t, a, n) {
620
- const r = Z(t, a);
621
- if (x.set(t, n), tt(t, n, a), !n) {
622
- r.forEach((i) => L(i, a, !1));
597
+ async function _(t, n, a) {
598
+ const r = V(t, n);
599
+ if (x.set(t, a), tt(t, a, n), !a) {
600
+ r.forEach((i) => T(i, n, !1));
623
601
  return;
624
602
  }
625
- const e = await j(t, a);
626
- r.forEach((i) => L(i, a, !0, e));
603
+ const e = await I(t, n);
604
+ r.forEach((i) => T(i, n, !0, e));
627
605
  }
628
- function bt(t, a) {
629
- let n = lt(t);
630
- n || (n = document.createRange(), n.selectNodeContents(t), n.collapse(!1)), n.collapsed || n.deleteContents(), n.insertNode(a);
606
+ function bt(t, n) {
607
+ let a = lt(t);
608
+ a || (a = document.createRange(), a.selectNodeContents(t), a.collapse(!1)), a.collapsed || a.deleteContents(), a.insertNode(n);
631
609
  const r = document.createTextNode(" ");
632
- a.after(r);
610
+ n.after(r);
633
611
  const e = document.createRange();
634
612
  e.setStart(r, 1), e.collapse(!0), st(t, e), t.normalize();
635
613
  }
636
614
  function At(t) {
637
- const a = t.metaKey || t.ctrlKey, n = t.key.toLowerCase(), r = a && t.altKey && t.shiftKey && n === "d", e = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && n === "f7";
615
+ const n = t.metaKey || t.ctrlKey, a = t.key.toLowerCase(), r = n && t.altKey && t.shiftKey && a === "d", e = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && a === "f7";
638
616
  return r || e;
639
617
  }
640
618
  function St(t) {
641
- const a = t.metaKey || t.ctrlKey, n = t.key.toLowerCase(), r = a && t.altKey && t.shiftKey && n === "b", e = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && n === "f8";
619
+ const n = t.metaKey || t.ctrlKey, a = t.key.toLowerCase(), r = n && t.altKey && t.shiftKey && a === "b", e = !t.metaKey && !t.ctrlKey && !t.altKey && !t.shiftKey && a === "f8";
642
620
  return r || e;
643
621
  }
644
- function $(t, a, n, r, e) {
622
+ function S(t, n, a, r, e) {
645
623
  ft();
646
- const i = n === "insert" ? lt(t) : null, o = a.labels, l = e ? G(e, a) : H(r || {}, a), d = document.createElement("div");
647
- d.className = p, ht(t) && d.classList.add("rte-data-binding-theme-dark");
624
+ const i = a === "insert" ? lt(t) : null, o = n.labels, l = e ? Z(e, n) : H(r || {}, n), d = document.createElement("div");
625
+ d.className = g, ht(t) && d.classList.add("rte-data-binding-theme-dark");
648
626
  const c = document.createElement("section");
649
627
  c.className = "rte-data-binding-dialog", c.setAttribute("role", "dialog"), c.setAttribute("aria-modal", "true"), c.setAttribute("aria-labelledby", "rte-data-binding-dialog-title"), c.innerHTML = `
650
628
  <header class="rte-data-binding-header">
651
- <h2 id="rte-data-binding-dialog-title" class="rte-data-binding-title">${h(
652
- n === "edit" ? o.dialogTitleEdit : o.dialogTitleInsert
629
+ <h2 id="rte-data-binding-dialog-title" class="rte-data-binding-title">${y(
630
+ a === "edit" ? o.dialogTitleEdit : o.dialogTitleInsert
653
631
  )}</h2>
654
- <button type="button" class="rte-data-binding-btn" data-action="cancel" aria-label="${h(o.cancelText)}">✕</button>
632
+ <button type="button" class="rte-data-binding-btn" data-action="cancel" aria-label="${y(o.cancelText)}">✕</button>
655
633
  </header>
656
634
  <div class="rte-data-binding-body">
657
635
  <div class="rte-data-binding-field">
658
- <label for="rte-data-binding-key">${h(o.keyLabel)}</label>
659
- <input id="rte-data-binding-key" class="rte-data-binding-key" type="text" value="${h(l.key)}" placeholder="${h(
636
+ <label for="rte-data-binding-key">${y(o.keyLabel)}</label>
637
+ <input id="rte-data-binding-key" class="rte-data-binding-key" type="text" value="${y(l.key)}" placeholder="${y(
660
638
  o.keyPlaceholder
661
639
  )}" />
662
640
  </div>
663
641
  <div class="rte-data-binding-field">
664
- <label for="rte-data-binding-fallback">${h(o.fallbackLabel)}</label>
665
- <input id="rte-data-binding-fallback" class="rte-data-binding-fallback" type="text" value="${h(
642
+ <label for="rte-data-binding-fallback">${y(o.fallbackLabel)}</label>
643
+ <input id="rte-data-binding-fallback" class="rte-data-binding-fallback" type="text" value="${y(
666
644
  l.fallback || ""
667
- )}" placeholder="${h(o.fallbackPlaceholder)}" />
645
+ )}" placeholder="${y(o.fallbackPlaceholder)}" />
668
646
  </div>
669
647
  <div class="rte-data-binding-field">
670
- <label for="rte-data-binding-format">${h(o.formatLabel)}</label>
648
+ <label for="rte-data-binding-format">${y(o.formatLabel)}</label>
671
649
  <select id="rte-data-binding-format" class="rte-data-binding-format">
672
650
  <option value="text" ${l.format === "text" ? "selected" : ""}>Text</option>
673
651
  <option value="number" ${l.format === "number" ? "selected" : ""}>Number</option>
@@ -677,147 +655,138 @@ function $(t, a, n, r, e) {
677
655
  </select>
678
656
  </div>
679
657
  <div class="rte-data-binding-field">
680
- <label for="rte-data-binding-currency">${h(o.currencyLabel)}</label>
681
- <input id="rte-data-binding-currency" class="rte-data-binding-currency" type="text" maxlength="3" value="${h(
658
+ <label for="rte-data-binding-currency">${y(o.currencyLabel)}</label>
659
+ <input id="rte-data-binding-currency" class="rte-data-binding-currency" type="text" maxlength="3" value="${y(
682
660
  l.currency || "USD"
683
- )}" placeholder="${h(o.currencyPlaceholder)}" />
661
+ )}" placeholder="${y(o.currencyPlaceholder)}" />
684
662
  </div>
685
663
  <p class="rte-data-binding-help">Use dot paths like <code>user.name</code> or <code>order.total</code>.</p>
686
664
  </div>
687
665
  <footer class="rte-data-binding-footer">
688
- <button type="button" class="rte-data-binding-btn" data-action="cancel">${h(o.cancelText)}</button>
689
- <button type="button" class="rte-data-binding-btn rte-data-binding-btn-primary" data-action="save">${h(o.saveText)}</button>
666
+ <button type="button" class="rte-data-binding-btn" data-action="cancel">${y(o.cancelText)}</button>
667
+ <button type="button" class="rte-data-binding-btn rte-data-binding-btn-primary" data-action="save">${y(o.saveText)}</button>
690
668
  </footer>
691
669
  `, d.appendChild(c), document.body.appendChild(d);
692
- const u = c.querySelector(".rte-data-binding-key"), f = c.querySelector(".rte-data-binding-fallback"), m = c.querySelector(".rte-data-binding-format"), v = c.querySelector(".rte-data-binding-currency"), C = () => {
693
- const s = (m == null ? void 0 : m.value) === "currency", y = v == null ? void 0 : v.closest(".rte-data-binding-field");
694
- y && (y.style.display = s ? "grid" : "none");
670
+ const u = c.querySelector(".rte-data-binding-key"), p = c.querySelector(".rte-data-binding-fallback"), m = c.querySelector(".rte-data-binding-format"), $ = c.querySelector(".rte-data-binding-currency"), B = () => {
671
+ const s = m?.value === "currency", k = $?.closest(".rte-data-binding-field");
672
+ k && (k.style.display = s ? "grid" : "none");
695
673
  };
696
- C(), m == null || m.addEventListener("change", C);
697
- const w = () => {
674
+ B(), m?.addEventListener("change", B);
675
+ const L = () => {
698
676
  d.removeEventListener("click", nt), d.removeEventListener("keydown", rt, !0), document.removeEventListener("keydown", et, !0), d.parentNode && d.parentNode.removeChild(d), R = null, t.focus({ preventScroll: !0 });
699
677
  }, et = (s) => {
700
- s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), w());
678
+ s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), L());
701
679
  }, nt = (s) => {
702
- s.target === d && w();
680
+ s.target === d && L();
703
681
  }, gt = (s) => {
704
- if (s.key !== "Tab")
705
- return;
706
- const y = Array.from(
682
+ if (s.key !== "Tab") return;
683
+ const k = Array.from(
707
684
  c.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
708
685
  );
709
- if (y.length === 0)
710
- return;
711
- const D = y[0], A = y[y.length - 1], F = document.activeElement;
712
- if (s.shiftKey && F === D) {
713
- s.preventDefault(), A.focus();
686
+ if (k.length === 0) return;
687
+ const w = k[0], E = k[k.length - 1], F = document.activeElement;
688
+ if (s.shiftKey && F === w) {
689
+ s.preventDefault(), E.focus();
714
690
  return;
715
691
  }
716
- !s.shiftKey && F === A && (s.preventDefault(), D.focus());
692
+ !s.shiftKey && F === E && (s.preventDefault(), w.focus());
717
693
  }, at = async () => {
718
- const s = ((u == null ? void 0 : u.value) || "").trim();
694
+ const s = (u?.value || "").trim();
719
695
  if (!s) {
720
- u == null || u.focus();
696
+ u?.focus();
721
697
  return;
722
698
  }
723
- const y = H(
699
+ const k = H(
724
700
  {
725
701
  key: s,
726
- fallback: ((f == null ? void 0 : f.value) || "").trim(),
727
- format: (m == null ? void 0 : m.value) || a.defaultFormat,
728
- currency: ((v == null ? void 0 : v.value) || "USD").trim().toUpperCase()
702
+ fallback: (p?.value || "").trim(),
703
+ format: m?.value || n.defaultFormat,
704
+ currency: ($?.value || "USD").trim().toUpperCase()
729
705
  },
730
- a
731
- ), D = t.innerHTML;
706
+ n
707
+ ), w = t.innerHTML;
732
708
  if (e) {
733
- X(e, y, o);
734
- const A = x.get(t) === !0, F = A ? await j(t, a) : void 0;
735
- L(e, a, A, F);
709
+ X(e, k, o);
710
+ const E = x.get(t) === !0, F = E ? await I(t, n) : void 0;
711
+ T(e, n, E, F);
736
712
  } else {
737
713
  if (i)
738
714
  try {
739
715
  st(t, i);
740
716
  } catch {
741
717
  }
742
- const A = ut(y, o);
743
- if (bt(t, A), x.get(t) === !0) {
744
- const mt = await j(t, a);
745
- L(A, a, !0, mt);
718
+ const E = ut(k, o);
719
+ if (bt(t, E), x.get(t) === !0) {
720
+ const mt = await I(t, n);
721
+ T(E, n, !0, mt);
746
722
  }
747
723
  }
748
- J(t), Y(t, D), w();
724
+ J(t), Y(t, w), L();
749
725
  }, rt = (s) => {
750
726
  if (s.key === "Escape") {
751
- s.preventDefault(), w();
727
+ s.preventDefault(), L();
752
728
  return;
753
729
  }
754
730
  gt(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), at());
755
731
  };
756
732
  c.addEventListener("click", (s) => {
757
- const y = s.target, D = y == null ? void 0 : y.getAttribute("data-action");
758
- if (D) {
759
- if (D === "cancel") {
760
- w();
733
+ const w = s.target?.getAttribute("data-action");
734
+ if (w) {
735
+ if (w === "cancel") {
736
+ L();
761
737
  return;
762
738
  }
763
- D === "save" && at();
739
+ w === "save" && at();
764
740
  }
765
- }), d.addEventListener("click", nt), d.addEventListener("keydown", rt, !0), document.addEventListener("keydown", et, !0), R = { cleanup: w }, u == null || u.focus();
741
+ }), d.addEventListener("click", nt), d.addEventListener("keydown", rt, !0), document.addEventListener("keydown", et, !0), R = { cleanup: L }, u?.focus();
766
742
  }
767
743
  function Tt(t) {
768
- _ = t, M || (M = (a) => {
769
- const n = a.target, r = n == null ? void 0 : n.closest(T);
770
- if (!r)
771
- return;
772
- k = r, g.has(r) || g.set(r, t);
773
- const e = g.get(r) || t;
774
- Z(r, e);
744
+ z = t, O || (O = (n) => {
745
+ const r = n.target?.closest(A);
746
+ if (!r) return;
747
+ h = r, b.has(r) || b.set(r, t);
748
+ const e = b.get(r) || t;
749
+ V(r, e);
775
750
  const i = x.get(r) === !0;
776
- tt(r, i, e), i || Array.from(r.querySelectorAll(P)).forEach((l) => L(l, e, !1));
777
- }, document.addEventListener("focusin", M, !0)), O || (O = (a) => {
778
- if (document.querySelector(`.${p}`))
779
- return;
780
- const n = a.target;
781
- if (n != null && n.closest("input, textarea, select"))
782
- return;
783
- const r = S(void 0, !1);
784
- if (!r || K(r))
785
- return;
786
- const e = g.get(r) || _ || t, i = n == null ? void 0 : n.closest(P);
787
- if (i && (a.key === "Enter" || a.key === " ")) {
788
- a.preventDefault(), a.stopPropagation(), k = r, $(r, e, "edit", void 0, i);
751
+ tt(r, i, e), i || Array.from(r.querySelectorAll(C)).forEach((l) => T(l, e, !1));
752
+ }, document.addEventListener("focusin", O, !0)), P || (P = (n) => {
753
+ if (document.querySelector(`.${g}`)) return;
754
+ const a = n.target;
755
+ if (a?.closest("input, textarea, select")) return;
756
+ const r = D(void 0, !1);
757
+ if (!r || K(r)) return;
758
+ const e = b.get(r) || z || t, i = a?.closest(C);
759
+ if (i && (n.key === "Enter" || n.key === " ")) {
760
+ n.preventDefault(), n.stopPropagation(), h = r, S(r, e, "edit", void 0, i);
789
761
  return;
790
762
  }
791
- if (At(a)) {
792
- a.preventDefault(), a.stopPropagation();
763
+ if (At(n)) {
764
+ n.preventDefault(), n.stopPropagation();
793
765
  const o = Q(r);
794
- o ? $(r, e, "edit", void 0, o) : $(r, e, "insert");
766
+ o ? S(r, e, "edit", void 0, o) : S(r, e, "insert");
795
767
  return;
796
768
  }
797
- if (St(a)) {
798
- a.preventDefault(), a.stopPropagation();
769
+ if (St(n)) {
770
+ n.preventDefault(), n.stopPropagation();
799
771
  const o = x.get(r) !== !0;
800
- V(r, e, o);
801
- }
802
- }, document.addEventListener("keydown", O, !0)), B || (B = (a) => {
803
- if (document.querySelector(`.${p}`) || a.defaultPrevented || a.button !== 0 || a.metaKey || a.ctrlKey || a.altKey || a.shiftKey)
804
- return;
805
- const n = a.target, r = n == null ? void 0 : n.closest(P);
806
- if (!r)
807
- return;
808
- const e = r.closest(T);
809
- if (!e || K(e))
810
- return;
811
- const i = g.get(e) || _ || t;
812
- g.set(e, i), k = e, a.preventDefault(), a.stopPropagation(), r.focus({ preventScroll: !0 }), $(e, i, "edit", void 0, r);
813
- }, document.addEventListener("click", B, !0));
772
+ _(r, e, o);
773
+ }
774
+ }, document.addEventListener("keydown", P, !0)), M || (M = (n) => {
775
+ if (document.querySelector(`.${g}`) || n.defaultPrevented || n.button !== 0 || n.metaKey || n.ctrlKey || n.altKey || n.shiftKey) return;
776
+ const r = n.target?.closest(C);
777
+ if (!r) return;
778
+ const e = r.closest(A);
779
+ if (!e || K(e)) return;
780
+ const i = b.get(e) || z || t;
781
+ b.set(e, i), h = e, n.preventDefault(), n.stopPropagation(), r.focus({ preventScroll: !0 }), S(e, i, "edit", void 0, r);
782
+ }, document.addEventListener("click", M, !0));
814
783
  }
815
784
  function $t() {
816
- M && (document.removeEventListener("focusin", M, !0), M = null), O && (document.removeEventListener("keydown", O, !0), O = null), B && (document.removeEventListener("click", B, !0), B = null), _ = null, k = null;
785
+ O && (document.removeEventListener("focusin", O, !0), O = null), P && (document.removeEventListener("keydown", P, !0), P = null), M && (document.removeEventListener("click", M, !0), M = null), z = null, h = null;
817
786
  }
818
787
  const Lt = (t = {}) => {
819
- const a = ot(t);
820
- return vt(), {
788
+ const n = ot(t);
789
+ return xt(), {
821
790
  name: "dataBinding",
822
791
  toolbar: [
823
792
  {
@@ -842,83 +811,74 @@ const Lt = (t = {}) => {
842
811
  }
843
812
  ],
844
813
  commands: {
845
- openDataBindingDialog: (n, r) => {
846
- const e = S(r);
847
- if (!e || K(e))
848
- return !1;
849
- k = e;
850
- const i = g.get(e) || a;
851
- g.set(e, i), Z(e, i);
852
- const o = n == null ? void 0 : n.target;
814
+ openDataBindingDialog: (a, r) => {
815
+ const e = D(r);
816
+ if (!e || K(e)) return !1;
817
+ h = e;
818
+ const i = b.get(e) || n;
819
+ b.set(e, i), V(e, i);
820
+ const o = a?.target;
853
821
  if (o === "insert")
854
- return $(e, i, "insert", n), !0;
822
+ return S(e, i, "insert", a), !0;
855
823
  const l = Q(e);
856
- return o === "edit" || l ? !l && o === "edit" ? !1 : ($(e, i, "edit", n, l || void 0), !0) : ($(e, i, "insert", n), !0);
824
+ return o === "edit" || l ? !l && o === "edit" ? !1 : (S(e, i, "edit", a, l || void 0), !0) : (S(e, i, "insert", a), !0);
857
825
  },
858
- insertDataBindingToken: async (n, r) => {
859
- const e = S(r);
860
- if (!e || K(e))
861
- return !1;
862
- k = e;
863
- const i = g.get(e) || a;
864
- g.set(e, i);
865
- const o = H(n || {}, i);
866
- if (!o.key)
867
- return !1;
826
+ insertDataBindingToken: async (a, r) => {
827
+ const e = D(r);
828
+ if (!e || K(e)) return !1;
829
+ h = e;
830
+ const i = b.get(e) || n;
831
+ b.set(e, i);
832
+ const o = H(a || {}, i);
833
+ if (!o.key) return !1;
868
834
  const l = e.innerHTML, d = ut(o, i.labels);
869
835
  if (bt(e, d), x.get(e) === !0) {
870
- const u = await j(e, i);
871
- L(d, i, !0, u);
836
+ const u = await I(e, i);
837
+ T(d, i, !0, u);
872
838
  }
873
839
  return J(e), Y(e, l), !0;
874
840
  },
875
- editDataBindingToken: async (n, r) => {
876
- const e = S(r);
877
- if (!e || K(e))
878
- return !1;
879
- k = e;
880
- const i = g.get(e) || a;
881
- g.set(e, i);
841
+ editDataBindingToken: async (a, r) => {
842
+ const e = D(r);
843
+ if (!e || K(e)) return !1;
844
+ h = e;
845
+ const i = b.get(e) || n;
846
+ b.set(e, i);
882
847
  const o = Q(e);
883
- if (!o)
884
- return !1;
885
- const l = G(o, i), d = H({ ...l, ...n || {} }, i);
886
- if (!d.key)
887
- return !1;
848
+ if (!o) return !1;
849
+ const l = Z(o, i), d = H({ ...l, ...a || {} }, i);
850
+ if (!d.key) return !1;
888
851
  const c = e.innerHTML;
889
852
  X(o, d, i.labels);
890
- const u = x.get(e) === !0, f = u ? await j(e, i) : void 0;
891
- return L(o, i, u, f), J(e), Y(e, c), !0;
853
+ const u = x.get(e) === !0, p = u ? await I(e, i) : void 0;
854
+ return T(o, i, u, p), J(e), Y(e, c), !0;
892
855
  },
893
- toggleDataBindingPreview: async (n, r) => {
894
- const e = S(r);
895
- if (!e)
896
- return !1;
897
- k = e;
898
- const i = g.get(e) || a;
899
- g.set(e, i);
900
- const o = typeof n == "boolean" ? n : x.get(e) !== !0;
901
- return await V(e, i, o), !0;
856
+ toggleDataBindingPreview: async (a, r) => {
857
+ const e = D(r);
858
+ if (!e) return !1;
859
+ h = e;
860
+ const i = b.get(e) || n;
861
+ b.set(e, i);
862
+ const o = typeof a == "boolean" ? a : x.get(e) !== !0;
863
+ return await _(e, i, o), !0;
902
864
  },
903
- setDataBindingData: async (n, r) => {
904
- const e = S(r);
905
- if (!e)
906
- return !1;
907
- if (k = e, n && typeof n == "object" ? (I.set(e, n), N.set(e, { timestamp: Date.now(), data: n })) : (I.delete(e), N.delete(e)), x.get(e) === !0) {
908
- const i = g.get(e) || a;
909
- await V(e, i, !0);
865
+ setDataBindingData: async (a, r) => {
866
+ const e = D(r);
867
+ if (!e) return !1;
868
+ if (h = e, a && typeof a == "object" ? (W.set(e, a), N.set(e, { timestamp: Date.now(), data: a })) : (W.delete(e), N.delete(e)), x.get(e) === !0) {
869
+ const i = b.get(e) || n;
870
+ await _(e, i, !0);
910
871
  }
911
872
  return !0;
912
873
  },
913
- refreshDataBindings: async (n, r) => {
914
- const e = S(r);
915
- if (!e)
916
- return !1;
917
- k = e, N.delete(e);
918
- const i = g.get(e) || a;
919
- g.set(e, i);
874
+ refreshDataBindings: async (a, r) => {
875
+ const e = D(r);
876
+ if (!e) return !1;
877
+ h = e, N.delete(e);
878
+ const i = b.get(e) || n;
879
+ b.set(e, i);
920
880
  const o = x.get(e) === !0;
921
- return await V(e, i, o), !0;
881
+ return await _(e, i, o), !0;
922
882
  }
923
883
  },
924
884
  keymap: {
@@ -930,21 +890,21 @@ const Lt = (t = {}) => {
930
890
  F8: "toggleDataBindingPreview"
931
891
  },
932
892
  init: function(r) {
933
- q += 1;
934
- const e = this && typeof this.__pluginConfig == "object" ? ot({ ...a, ...this.__pluginConfig }) : a;
893
+ U += 1;
894
+ const e = this && typeof this.__pluginConfig == "object" ? ot({ ...n, ...this.__pluginConfig }) : n;
935
895
  Tt(e);
936
- const i = S(
896
+ const i = D(
937
897
  r && r.editorElement ? { editorElement: r.editorElement } : void 0,
938
898
  !1
939
899
  );
940
900
  if (i) {
941
- k = i, g.set(i, e), Z(i, e);
901
+ h = i, b.set(i, e), V(i, e);
942
902
  const o = x.get(i) === !0;
943
903
  tt(i, o, e);
944
904
  }
945
905
  },
946
906
  destroy: () => {
947
- q = Math.max(0, q - 1), q === 0 && (ft(), $t());
907
+ U = Math.max(0, U - 1), U === 0 && (ft(), $t());
948
908
  }
949
909
  };
950
910
  };