@editora/plugins 1.0.9 → 1.0.10

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