@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,6 +1,6 @@
1
- const L = ".rte-content, .editora-content", H = '.rte-conditional-block[data-conditional-content="true"]', b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', f = ':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)', p = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", h = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Ce = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", w = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), _ = /* @__PURE__ */ new Map(), z = /* @__PURE__ */ new Map();
2
- let le = null, se = 0, G = null, U = null, Y = null, J = null, X = null, Q = null, N = null, g = null, ee = null;
3
- const Pe = {
1
+ const w = ".rte-content, .editora-content", q = '.rte-conditional-block[data-conditional-content="true"]', b = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', f = ':is([data-theme="acme"], .editora-theme-acme, .rte-theme-acme)', h = ":is(.rte-content.rte-conditional-theme-dark, .editora-content.rte-conditional-theme-dark)", g = ":is(.rte-content.rte-conditional-theme-acme, .editora-content.rte-conditional-theme-acme)", Le = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", s = "rte-conditional-floating-toolbar", T = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
2
+ let ae = null, se = 0, G = null, U = null, Y = null, J = null, X = null, Q = null, P = null, y = null, ee = null;
3
+ const Re = {
4
4
  dialogTitleInsert: "Insert Conditional Content",
5
5
  dialogTitleEdit: "Edit Conditional Content",
6
6
  conditionLabel: "Condition",
@@ -17,83 +17,94 @@ const Pe = {
17
17
  allAudiencesText: "all audiences",
18
18
  allLocalesText: "all locales"
19
19
  };
20
- function y(e) {
20
+ function $(e) {
21
21
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
22
22
  }
23
- function O(e) {
23
+ function K(e) {
24
24
  return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : [];
25
25
  }
26
- function Le(e) {
26
+ function Ae(e) {
27
27
  return !e || e.length === 0 ? "" : e.join(", ");
28
28
  }
29
29
  function te(e) {
30
30
  return e ? e.map((t) => t.trim()).filter(Boolean) : [];
31
31
  }
32
- function Re(e) {
32
+ function qe(e) {
33
33
  return {
34
- ...Pe,
34
+ ...Re,
35
35
  ...e || {}
36
36
  };
37
37
  }
38
- function k(e) {
38
+ function H(e) {
39
39
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
40
40
  }
41
- function ce(e) {
41
+ function re(e) {
42
42
  return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || e;
43
43
  }
44
44
  function ue(e) {
45
- if (!e) return !1;
45
+ if (!e)
46
+ return !1;
46
47
  const t = e.getAttribute("data-theme") || e.getAttribute("theme");
47
48
  return t && t.toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark");
48
49
  }
49
- function qe(e) {
50
- const t = ce(e);
51
- if (ue(t)) return !0;
50
+ function Ke(e) {
51
+ const t = re(e);
52
+ if (ue(t))
53
+ return !0;
52
54
  const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
53
55
  return ue(o) ? !0 : ue(document.documentElement) || ue(document.body);
54
56
  }
55
57
  function fe(e) {
56
- if (!e) return !1;
58
+ if (!e)
59
+ return !1;
57
60
  const t = e.getAttribute("data-theme") || e.getAttribute("theme");
58
61
  return t && t.toLowerCase() === "acme" ? !0 : e.classList.contains("editora-theme-acme") || e.classList.contains("rte-theme-acme");
59
62
  }
60
- function Ke(e) {
61
- const t = ce(e);
62
- if (fe(t)) return !0;
63
+ function _e(e) {
64
+ const t = re(e);
65
+ if (fe(t))
66
+ return !0;
63
67
  const o = t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");
64
68
  return fe(o) ? !0 : fe(document.documentElement) || fe(document.body);
65
69
  }
66
- function Ie(e) {
67
- return qe(e) ? "dark" : Ke(e) ? "acme" : "light";
70
+ function ze(e) {
71
+ return Ke(e) ? "dark" : _e(e) ? "acme" : "light";
68
72
  }
69
73
  function he(e, t) {
70
- const o = Ie(t);
74
+ const o = ze(t);
71
75
  e.classList.remove("rte-conditional-theme-dark", "rte-conditional-theme-acme"), o === "dark" ? e.classList.add("rte-conditional-theme-dark") : o === "acme" && e.classList.add("rte-conditional-theme-acme");
72
76
  }
73
- function A(e, t = !0) {
74
- if (e?.contentElement instanceof HTMLElement) return e.contentElement;
75
- if (e?.editorElement instanceof HTMLElement) {
77
+ function S(e, t = !0) {
78
+ if ((e == null ? void 0 : e.contentElement) instanceof HTMLElement)
79
+ return e.contentElement;
80
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
76
81
  const n = e.editorElement;
77
- if (n.matches(L)) return n;
78
- const a = n.querySelector(L);
79
- if (a instanceof HTMLElement) return a;
82
+ if (n.matches(w))
83
+ return n;
84
+ const a = n.querySelector(w);
85
+ if (a instanceof HTMLElement)
86
+ return a;
80
87
  }
81
88
  const o = window.getSelection();
82
89
  if (o && o.rangeCount > 0) {
83
- const n = o.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(L);
84
- if (r) return r;
90
+ const n = o.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(w);
91
+ if (r)
92
+ return r;
85
93
  }
86
94
  const i = document.activeElement;
87
95
  if (i) {
88
- if (i.matches(L)) return i;
89
- const n = i.closest(L);
90
- if (n) return n;
96
+ if (i.matches(w))
97
+ return i;
98
+ const n = i.closest(w);
99
+ if (n)
100
+ return n;
91
101
  }
92
- return g && g.isConnected ? g : t ? document.querySelector(L) : null;
102
+ return y && y.isConnected ? y : t ? document.querySelector(w) : null;
93
103
  }
94
- function ke(e) {
104
+ function Se(e) {
95
105
  const t = window.getSelection();
96
- if (!t || t.rangeCount === 0) return null;
106
+ if (!t || t.rangeCount === 0)
107
+ return null;
97
108
  const o = t.getRangeAt(0);
98
109
  return e.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
99
110
  }
@@ -101,11 +112,12 @@ function xe(e, t) {
101
112
  const o = window.getSelection();
102
113
  o && (o.removeAllRanges(), o.addRange(t), e.focus({ preventScroll: !0 }));
103
114
  }
104
- function Se(e) {
115
+ function Te(e) {
105
116
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
106
117
  }
107
- function Te(e, t) {
108
- if (t === e.innerHTML) return;
118
+ function Be(e, t) {
119
+ if (t === e.innerHTML)
120
+ return;
109
121
  const o = window.execEditorCommand || window.executeEditorCommand;
110
122
  if (typeof o == "function")
111
123
  try {
@@ -124,15 +136,19 @@ function ye(e, t) {
124
136
  return o[i];
125
137
  }, e);
126
138
  }
127
- function _e(e) {
139
+ function Fe(e) {
128
140
  const t = e.trim();
129
141
  if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'"))
130
142
  return t.slice(1, -1);
131
- if (t === "true") return !0;
132
- if (t === "false") return !1;
133
- if (t === "null") return null;
143
+ if (t === "true")
144
+ return !0;
145
+ if (t === "false")
146
+ return !1;
147
+ if (t === "null")
148
+ return null;
134
149
  const o = Number(t);
135
- if (!Number.isNaN(o) && t !== "") return o;
150
+ if (!Number.isNaN(o) && t !== "")
151
+ return o;
136
152
  if (t.startsWith("[") && t.endsWith("]") || t.startsWith("{") && t.endsWith("}"))
137
153
  try {
138
154
  return JSON.parse(t);
@@ -141,9 +157,10 @@ function _e(e) {
141
157
  }
142
158
  return t;
143
159
  }
144
- function ze(e, t) {
160
+ function je(e, t) {
145
161
  const o = e.trim();
146
- if (!o) return !0;
162
+ if (!o)
163
+ return !0;
147
164
  if (o.startsWith("!")) {
148
165
  const E = o.slice(1).trim();
149
166
  return !ye(t, E);
@@ -151,7 +168,7 @@ function ze(e, t) {
151
168
  const i = o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);
152
169
  if (!i)
153
170
  return !!ye(t, o);
154
- const [, n, a, r] = i, l = ye(t, n), d = _e(r);
171
+ const [, n, a, r] = i, l = ye(t, n), d = Fe(r);
155
172
  switch (a) {
156
173
  case "==":
157
174
  return l == d;
@@ -174,10 +191,11 @@ function ze(e, t) {
174
191
  return !1;
175
192
  }
176
193
  }
177
- function Fe() {
178
- if (typeof document > "u" || document.getElementById(Ce)) return;
194
+ function Ie() {
195
+ if (typeof document > "u" || document.getElementById(Le))
196
+ return;
179
197
  const e = document.createElement("style");
180
- e.id = Ce, e.textContent = `
198
+ e.id = Le, e.textContent = `
181
199
  .rte-conditional-block {
182
200
  border: 1px solid #dbe3ec;
183
201
  border-radius: 8px;
@@ -413,7 +431,7 @@ function Fe() {
413
431
  background: #1d4ed8;
414
432
  }
415
433
 
416
- .${u} {
434
+ .${s} {
417
435
  position: fixed;
418
436
  z-index: 2147483645;
419
437
  display: none;
@@ -427,11 +445,11 @@ function Fe() {
427
445
  backdrop-filter: blur(6px);
428
446
  }
429
447
 
430
- .${u}.show {
448
+ .${s}.show {
431
449
  display: inline-flex;
432
450
  }
433
451
 
434
- .${u} .rte-conditional-float-btn {
452
+ .${s} .rte-conditional-float-btn {
435
453
  border: 1px solid #cbd5e1;
436
454
  border-radius: 6px;
437
455
  min-height: 30px;
@@ -448,27 +466,27 @@ function Fe() {
448
466
  line-height: 1;
449
467
  }
450
468
 
451
- .${u} .rte-conditional-float-btn:hover {
469
+ .${s} .rte-conditional-float-btn:hover {
452
470
  background: #f8fafc;
453
471
  }
454
472
 
455
- .${u} .rte-conditional-float-btn[data-action="delete"] {
473
+ .${s} .rte-conditional-float-btn[data-action="delete"] {
456
474
  border-color: #fecaca;
457
475
  color: #991b1b;
458
476
  background: #fff5f5;
459
477
  }
460
478
 
461
- .rte-conditional-preview-on ${H} {
479
+ .rte-conditional-preview-on ${q} {
462
480
  border-width: 2px;
463
481
  }
464
482
 
465
- .rte-conditional-preview-on ${H} .rte-conditional-header {
483
+ .rte-conditional-preview-on ${q} .rte-conditional-header {
466
484
  background: #ecfeff;
467
485
  border-color: #bae6fd;
468
486
  }
469
487
 
470
488
  ${b} .rte-conditional-block,
471
- ${p} .rte-conditional-block,
489
+ ${h} .rte-conditional-block,
472
490
  .${c}.rte-conditional-theme-dark .rte-conditional-block {
473
491
  background: #111827;
474
492
  border-color: #334155;
@@ -476,8 +494,8 @@ function Fe() {
476
494
 
477
495
  ${b} .rte-conditional-header,
478
496
  ${b} .rte-conditional-else-label,
479
- ${p} .rte-conditional-header,
480
- ${p} .rte-conditional-else-label,
497
+ ${h} .rte-conditional-header,
498
+ ${h} .rte-conditional-else-label,
481
499
  .${c}.rte-conditional-theme-dark .rte-conditional-header,
482
500
  .${c}.rte-conditional-theme-dark .rte-conditional-else-label {
483
501
  background: #0f172a;
@@ -485,19 +503,19 @@ function Fe() {
485
503
  }
486
504
 
487
505
  ${b} .rte-conditional-summary,
488
- ${p} .rte-conditional-summary,
506
+ ${h} .rte-conditional-summary,
489
507
  .${c}.rte-conditional-theme-dark .rte-conditional-summary {
490
508
  color: #e2e8f0;
491
509
  }
492
510
 
493
511
  ${b} .rte-conditional-meta,
494
- ${p} .rte-conditional-meta,
512
+ ${h} .rte-conditional-meta,
495
513
  .${c}.rte-conditional-theme-dark .rte-conditional-meta {
496
514
  color: #94a3b8;
497
515
  }
498
516
 
499
517
  ${b} .rte-conditional-chip,
500
- ${p} .rte-conditional-chip,
518
+ ${h} .rte-conditional-chip,
501
519
  .${c}.rte-conditional-theme-dark .rte-conditional-chip {
502
520
  background: #1e3a8a;
503
521
  border-color: #3b82f6;
@@ -505,7 +523,7 @@ function Fe() {
505
523
  }
506
524
 
507
525
  ${b} .rte-conditional-chip-else,
508
- ${p} .rte-conditional-chip-else,
526
+ ${h} .rte-conditional-chip-else,
509
527
  .${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
510
528
  background: #7f1d1d;
511
529
  border-color: #ef4444;
@@ -513,14 +531,14 @@ function Fe() {
513
531
  }
514
532
 
515
533
  ${b} .rte-conditional-body,
516
- ${p} .rte-conditional-body,
534
+ ${h} .rte-conditional-body,
517
535
  .${c}.rte-conditional-theme-dark .rte-conditional-body {
518
536
  background: #1f2937;
519
537
  color: #e2e8f0;
520
538
  }
521
539
 
522
540
  ${b} .rte-conditional-dialog,
523
- ${p} .rte-conditional-dialog,
541
+ ${h} .rte-conditional-dialog,
524
542
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog {
525
543
  background: #1f2937;
526
544
  border-color: #334155;
@@ -528,8 +546,8 @@ function Fe() {
528
546
 
529
547
  ${b} .rte-conditional-dialog-header,
530
548
  ${b} .rte-conditional-dialog-footer,
531
- ${p} .rte-conditional-dialog-header,
532
- ${p} .rte-conditional-dialog-footer,
549
+ ${h} .rte-conditional-dialog-header,
550
+ ${h} .rte-conditional-dialog-footer,
533
551
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
534
552
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-footer {
535
553
  background: #111827;
@@ -539,9 +557,9 @@ function Fe() {
539
557
  ${b} .rte-conditional-dialog-title,
540
558
  ${b} .rte-conditional-field label,
541
559
  ${b} .rte-conditional-checkbox,
542
- ${p} .rte-conditional-dialog-title,
543
- ${p} .rte-conditional-field label,
544
- ${p} .rte-conditional-checkbox,
560
+ ${h} .rte-conditional-dialog-title,
561
+ ${h} .rte-conditional-field label,
562
+ ${h} .rte-conditional-checkbox,
545
563
  .${c}.rte-conditional-theme-dark .rte-conditional-dialog-title,
546
564
  .${c}.rte-conditional-theme-dark .rte-conditional-field label,
547
565
  .${c}.rte-conditional-theme-dark .rte-conditional-checkbox {
@@ -549,15 +567,15 @@ function Fe() {
549
567
  }
550
568
 
551
569
  ${b} .rte-conditional-help,
552
- ${p} .rte-conditional-help,
570
+ ${h} .rte-conditional-help,
553
571
  .${c}.rte-conditional-theme-dark .rte-conditional-help {
554
572
  color: #94a3b8;
555
573
  }
556
574
 
557
575
  ${b} .rte-conditional-field input[type="text"],
558
576
  ${b} .rte-conditional-btn,
559
- ${p} .rte-conditional-field input[type="text"],
560
- ${p} .rte-conditional-btn,
577
+ ${h} .rte-conditional-field input[type="text"],
578
+ ${h} .rte-conditional-btn,
561
579
  .${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
562
580
  .${c}.rte-conditional-theme-dark .rte-conditional-btn {
563
581
  background: #0f172a;
@@ -566,7 +584,7 @@ function Fe() {
566
584
  }
567
585
 
568
586
  ${b} .rte-conditional-btn-primary,
569
- ${p} .rte-conditional-btn-primary,
587
+ ${h} .rte-conditional-btn-primary,
570
588
  .${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
571
589
  border-color: #3b82f6;
572
590
  background: #2563eb;
@@ -575,43 +593,43 @@ function Fe() {
575
593
 
576
594
  ${b} .rte-toolbar-group-items.conditional-content,
577
595
  .${c}.rte-conditional-theme-dark .rte-toolbar-group-items.conditional-content,
578
- ${p} .rte-toolbar-group-items.conditional-content,
596
+ ${h} .rte-toolbar-group-items.conditional-content,
579
597
  ${b} .editora-toolbar-group-items.conditional-content {
580
598
  border-color: #566275;
581
599
  }
582
600
 
583
601
  ${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
584
- ${p} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
602
+ ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
585
603
  ${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
586
604
  border-right-color: #566275;
587
605
  }
588
606
 
589
- ${b} .${u},
590
- .${c}.rte-conditional-theme-dark .${u},
591
- .${u}.rte-conditional-theme-dark {
607
+ ${b} .${s},
608
+ .${c}.rte-conditional-theme-dark .${s},
609
+ .${s}.rte-conditional-theme-dark {
592
610
  background: rgba(17, 24, 39, 0.98);
593
611
  border-color: #334155;
594
612
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
595
613
  }
596
614
 
597
- ${b} .${u} .rte-conditional-float-btn,
598
- .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn,
599
- .${u}.rte-conditional-theme-dark .rte-conditional-float-btn {
615
+ ${b} .${s} .rte-conditional-float-btn,
616
+ .${c}.rte-conditional-theme-dark .${s} .rte-conditional-float-btn,
617
+ .${s}.rte-conditional-theme-dark .rte-conditional-float-btn {
600
618
  background: #0f172a;
601
619
  border-color: #475569;
602
620
  color: #e2e8f0;
603
621
  }
604
622
 
605
- ${b} .${u} .rte-conditional-float-btn[data-action="delete"],
606
- .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn[data-action="delete"],
607
- .${u}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
623
+ ${b} .${s} .rte-conditional-float-btn[data-action="delete"],
624
+ .${c}.rte-conditional-theme-dark .${s} .rte-conditional-float-btn[data-action="delete"],
625
+ .${s}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
608
626
  border-color: #ef4444;
609
627
  color: #fecaca;
610
628
  background: rgba(127, 29, 29, 0.45);
611
629
  }
612
630
 
613
631
  ${f} .rte-conditional-block,
614
- ${h} .rte-conditional-block,
632
+ ${g} .rte-conditional-block,
615
633
  .${c}.rte-conditional-theme-acme .rte-conditional-block {
616
634
  background: #f8fbff;
617
635
  border-color: #cbd8e8;
@@ -619,8 +637,8 @@ function Fe() {
619
637
 
620
638
  ${f} .rte-conditional-header,
621
639
  ${f} .rte-conditional-else-label,
622
- ${h} .rte-conditional-header,
623
- ${h} .rte-conditional-else-label,
640
+ ${g} .rte-conditional-header,
641
+ ${g} .rte-conditional-else-label,
624
642
  .${c}.rte-conditional-theme-acme .rte-conditional-header,
625
643
  .${c}.rte-conditional-theme-acme .rte-conditional-else-label {
626
644
  background: linear-gradient(180deg, #eef4fb 0%, #e6eef8 100%);
@@ -628,19 +646,19 @@ function Fe() {
628
646
  }
629
647
 
630
648
  ${f} .rte-conditional-summary,
631
- ${h} .rte-conditional-summary,
649
+ ${g} .rte-conditional-summary,
632
650
  .${c}.rte-conditional-theme-acme .rte-conditional-summary {
633
651
  color: #0f172a;
634
652
  }
635
653
 
636
654
  ${f} .rte-conditional-meta,
637
- ${h} .rte-conditional-meta,
655
+ ${g} .rte-conditional-meta,
638
656
  .${c}.rte-conditional-theme-acme .rte-conditional-meta {
639
657
  color: #587089;
640
658
  }
641
659
 
642
660
  ${f} .rte-conditional-chip,
643
- ${h} .rte-conditional-chip,
661
+ ${g} .rte-conditional-chip,
644
662
  .${c}.rte-conditional-theme-acme .rte-conditional-chip {
645
663
  background: #d9f5ee;
646
664
  border-color: #66c6b3;
@@ -648,7 +666,7 @@ function Fe() {
648
666
  }
649
667
 
650
668
  ${f} .rte-conditional-chip-else,
651
- ${h} .rte-conditional-chip-else,
669
+ ${g} .rte-conditional-chip-else,
652
670
  .${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
653
671
  background: #fde8ea;
654
672
  border-color: #f1a7b2;
@@ -656,14 +674,14 @@ function Fe() {
656
674
  }
657
675
 
658
676
  ${f} .rte-conditional-body,
659
- ${h} .rte-conditional-body,
677
+ ${g} .rte-conditional-body,
660
678
  .${c}.rte-conditional-theme-acme .rte-conditional-body {
661
679
  background: #fcfeff;
662
680
  color: #0f172a;
663
681
  }
664
682
 
665
683
  ${f} .rte-conditional-dialog,
666
- ${h} .rte-conditional-dialog,
684
+ ${g} .rte-conditional-dialog,
667
685
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog {
668
686
  background: #ffffff;
669
687
  border-color: #cbd8e8;
@@ -672,8 +690,8 @@ function Fe() {
672
690
 
673
691
  ${f} .rte-conditional-dialog-header,
674
692
  ${f} .rte-conditional-dialog-footer,
675
- ${h} .rte-conditional-dialog-header,
676
- ${h} .rte-conditional-dialog-footer,
693
+ ${g} .rte-conditional-dialog-header,
694
+ ${g} .rte-conditional-dialog-footer,
677
695
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
678
696
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-footer {
679
697
  background: #f3f8fd;
@@ -683,9 +701,9 @@ function Fe() {
683
701
  ${f} .rte-conditional-dialog-title,
684
702
  ${f} .rte-conditional-field label,
685
703
  ${f} .rte-conditional-checkbox,
686
- ${h} .rte-conditional-dialog-title,
687
- ${h} .rte-conditional-field label,
688
- ${h} .rte-conditional-checkbox,
704
+ ${g} .rte-conditional-dialog-title,
705
+ ${g} .rte-conditional-field label,
706
+ ${g} .rte-conditional-checkbox,
689
707
  .${c}.rte-conditional-theme-acme .rte-conditional-dialog-title,
690
708
  .${c}.rte-conditional-theme-acme .rte-conditional-field label,
691
709
  .${c}.rte-conditional-theme-acme .rte-conditional-checkbox {
@@ -693,15 +711,15 @@ function Fe() {
693
711
  }
694
712
 
695
713
  ${f} .rte-conditional-help,
696
- ${h} .rte-conditional-help,
714
+ ${g} .rte-conditional-help,
697
715
  .${c}.rte-conditional-theme-acme .rte-conditional-help {
698
716
  color: #5f738d;
699
717
  }
700
718
 
701
719
  ${f} .rte-conditional-field input[type="text"],
702
720
  ${f} .rte-conditional-btn,
703
- ${h} .rte-conditional-field input[type="text"],
704
- ${h} .rte-conditional-btn,
721
+ ${g} .rte-conditional-field input[type="text"],
722
+ ${g} .rte-conditional-btn,
705
723
  .${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
706
724
  .${c}.rte-conditional-theme-acme .rte-conditional-btn {
707
725
  background: #ffffff;
@@ -710,7 +728,7 @@ function Fe() {
710
728
  }
711
729
 
712
730
  ${f} .rte-conditional-btn-primary,
713
- ${h} .rte-conditional-btn-primary,
731
+ ${g} .rte-conditional-btn-primary,
714
732
  .${c}.rte-conditional-theme-acme .rte-conditional-btn-primary {
715
733
  border-color: #0f766e;
716
734
  background: #0f766e;
@@ -719,67 +737,67 @@ function Fe() {
719
737
 
720
738
  ${f} .rte-toolbar-group-items.conditional-content,
721
739
  .${c}.rte-conditional-theme-acme .rte-toolbar-group-items.conditional-content,
722
- ${h} .rte-toolbar-group-items.conditional-content,
740
+ ${g} .rte-toolbar-group-items.conditional-content,
723
741
  ${f} .editora-toolbar-group-items.conditional-content {
724
742
  border-color: #bfd0e2;
725
743
  }
726
744
 
727
745
  ${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
728
- ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
746
+ ${g} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
729
747
  ${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
730
748
  border-right-color: #bfd0e2;
731
749
  }
732
750
 
733
- ${f} .${u},
734
- .${c}.rte-conditional-theme-acme .${u},
735
- .${u}.rte-conditional-theme-acme {
751
+ ${f} .${s},
752
+ .${c}.rte-conditional-theme-acme .${s},
753
+ .${s}.rte-conditional-theme-acme {
736
754
  background: rgba(255, 255, 255, 0.98);
737
755
  border-color: #bfd0e2;
738
756
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
739
757
  }
740
758
 
741
- ${f} .${u} .rte-conditional-float-btn,
742
- .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn,
743
- .${u}.rte-conditional-theme-acme .rte-conditional-float-btn {
759
+ ${f} .${s} .rte-conditional-float-btn,
760
+ .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn,
761
+ .${s}.rte-conditional-theme-acme .rte-conditional-float-btn {
744
762
  background: #ffffff;
745
763
  border-color: #bfd0e2;
746
764
  color: #1f334a;
747
765
  }
748
766
 
749
- ${f} .${u} .rte-conditional-float-btn:hover,
750
- .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn:hover,
751
- .${u}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
767
+ ${f} .${s} .rte-conditional-float-btn:hover,
768
+ .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn:hover,
769
+ .${s}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
752
770
  background: #eef7f5;
753
771
  color: #0f4f4a;
754
772
  }
755
773
 
756
- ${f} .${u} .rte-conditional-float-btn[data-action="delete"],
757
- .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn[data-action="delete"],
758
- .${u}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
774
+ ${f} .${s} .rte-conditional-float-btn[data-action="delete"],
775
+ .${c}.rte-conditional-theme-acme .${s} .rte-conditional-float-btn[data-action="delete"],
776
+ .${s}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
759
777
  border-color: #f1a7b2;
760
778
  color: #8b1f2f;
761
779
  background: #fff4f6;
762
780
  }
763
781
  `, document.head.appendChild(e);
764
782
  }
765
- function je(e) {
783
+ function Ve(e) {
766
784
  return {
767
785
  defaultCondition: e.defaultCondition || "",
768
786
  defaultAudience: te(e.defaultAudience || []),
769
787
  defaultLocale: te(e.defaultLocale || []),
770
788
  enableElseByDefault: e.enableElseByDefault === !0,
771
- labels: Re(e.labels),
789
+ labels: qe(e.labels),
772
790
  context: e.context,
773
791
  getContext: e.getContext,
774
792
  currentAudience: e.currentAudience,
775
793
  currentLocale: e.currentLocale,
776
- evaluateCondition: e.evaluateCondition || ze
794
+ evaluateCondition: e.evaluateCondition || je
777
795
  };
778
796
  }
779
- function Be() {
780
- le && (le.cleanup(), le = null);
797
+ function Me() {
798
+ ae && (ae.cleanup(), ae = null);
781
799
  }
782
- function Ve(e) {
800
+ function We(e) {
783
801
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
784
802
  }
785
803
  function oe(e, t) {
@@ -787,11 +805,12 @@ function oe(e, t) {
787
805
  const o = e.querySelector(".rte-conditional-header");
788
806
  o && (o.setAttribute("contenteditable", "false"), o.setAttribute("tabindex", "0"), o.setAttribute("role", "button"), o.setAttribute("aria-label", "Edit conditional rule"));
789
807
  const i = e.querySelector(".rte-conditional-else-label");
790
- i && i.setAttribute("contenteditable", "false"), Ge(e, !t);
808
+ i && i.setAttribute("contenteditable", "false"), Ue(e, !t);
791
809
  }
792
- function We(e) {
810
+ function Ze(e) {
793
811
  const t = e.querySelector('.rte-conditional-body[data-slot="if"]');
794
- if (!t) return;
812
+ if (!t)
813
+ return;
795
814
  const o = /* @__PURE__ */ new Set(), i = e.querySelector(".rte-conditional-header"), n = e.querySelector(".rte-conditional-else-label"), a = e.querySelector('.rte-conditional-body[data-slot="else"]');
796
815
  i && o.add(i), o.add(t), n && o.add(n), a && o.add(a), Array.from(e.childNodes).forEach((l) => {
797
816
  if (!(l instanceof HTMLElement && o.has(l))) {
@@ -806,46 +825,47 @@ function We(e) {
806
825
  function W(e) {
807
826
  const t = window.getSelection();
808
827
  if (t && t.rangeCount > 0) {
809
- const n = t.getRangeAt(0).startContainer, r = (n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(H);
810
- if (r && e.contains(r)) return r;
828
+ const n = t.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(q);
829
+ if (r && e.contains(r))
830
+ return r;
811
831
  }
812
- const i = document.activeElement?.closest(H);
832
+ const o = document.activeElement, i = o == null ? void 0 : o.closest(q);
813
833
  return i && e.contains(i) ? i : null;
814
834
  }
815
835
  function Ee(e, t) {
816
836
  let o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
817
837
  o || (o = document.createElement("div"), o.className = "rte-conditional-else-label", o.setAttribute("contenteditable", "false"), o.innerHTML = `
818
- <span class="rte-conditional-chip rte-conditional-chip-else">${y(t.blockElseLabel)}</span>
838
+ <span class="rte-conditional-chip rte-conditional-chip-else">${$(t.blockElseLabel)}</span>
819
839
  <span class="rte-conditional-summary">Else branch</span>
820
840
  `, e.appendChild(o)), i || (i = document.createElement("div"), i.className = "rte-conditional-body rte-conditional-else-body", i.setAttribute("data-slot", "else"), i.innerHTML = "<p><br></p>", e.appendChild(i));
821
841
  }
822
- function Ze(e, t) {
842
+ function Ge(e, t) {
823
843
  e.setAttribute("data-has-else", t ? "true" : "false");
824
844
  const o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
825
845
  o && o.classList.toggle("rte-conditional-hidden", !t), i && i.classList.toggle("rte-conditional-hidden", !t);
826
846
  }
827
- function Ge(e, t) {
847
+ function Ue(e, t) {
828
848
  Array.from(e.querySelectorAll(".rte-conditional-body")).forEach((i) => {
829
849
  i.setAttribute("contenteditable", t ? "true" : "false");
830
850
  }), e.setAttribute("contenteditable", "false");
831
851
  }
832
852
  function ve(e, t) {
833
- const o = e.getAttribute("data-condition") || "", i = O(e.getAttribute("data-audience")), n = O(e.getAttribute("data-locale"));
853
+ const o = e.getAttribute("data-condition") || "", i = K(e.getAttribute("data-audience")), n = K(e.getAttribute("data-locale"));
834
854
  let a = e.querySelector(".rte-conditional-header");
835
855
  a || (a = document.createElement("div"), a.className = "rte-conditional-header", e.prepend(a)), a.setAttribute("contenteditable", "false"), a.setAttribute("tabindex", "0"), a.setAttribute("role", "button"), a.setAttribute("aria-label", "Edit conditional rule");
836
856
  const r = o || "(always true)", l = i.length > 0 ? i.join(", ") : t.allAudiencesText, d = n.length > 0 ? n.join(", ") : t.allLocalesText;
837
857
  if (a.innerHTML = `
838
- <span class="rte-conditional-chip">${y(t.blockIfLabel)}</span>
839
- <span class="rte-conditional-summary">${y(r)}</span>
840
- <span class="rte-conditional-meta">${y(l)} · ${y(d)}</span>
858
+ <span class="rte-conditional-chip">${$(t.blockIfLabel)}</span>
859
+ <span class="rte-conditional-summary">${$(r)}</span>
860
+ <span class="rte-conditional-meta">${$(l)} · ${$(d)}</span>
841
861
  `, !e.querySelector('.rte-conditional-body[data-slot="if"]')) {
842
- const v = document.createElement("div");
843
- v.className = "rte-conditional-body", v.setAttribute("data-slot", "if"), v.innerHTML = "<p><br></p>", e.insertBefore(v, e.children[1] || null);
862
+ const p = document.createElement("div");
863
+ p.className = "rte-conditional-body", p.setAttribute("data-slot", "if"), p.innerHTML = "<p><br></p>", e.insertBefore(p, e.children[1] || null);
844
864
  }
845
- const m = e.getAttribute("data-has-else") === "true";
846
- m && Ee(e, t), We(e), Ze(e, m);
865
+ const L = e.getAttribute("data-has-else") === "true";
866
+ L && Ee(e, t), Ze(e), Ge(e, L);
847
867
  }
848
- function Me(e, t) {
868
+ function Ne(e, t) {
849
869
  const o = document.createElement("section");
850
870
  o.className = "rte-conditional-block", o.setAttribute("data-conditional-content", "true"), o.setAttribute("data-condition", (e.condition || "").trim()), o.setAttribute("data-audience", te(e.audience).join(",")), o.setAttribute("data-locale", te(e.locale).join(",")), o.setAttribute("data-has-else", e.hasElse ? "true" : "false"), o.setAttribute("role", "group"), o.setAttribute("aria-label", "Conditional content block"), o.setAttribute("contenteditable", "false"), o.setAttribute("spellcheck", "false");
851
871
  const i = document.createElement("div");
@@ -853,52 +873,61 @@ function Me(e, t) {
853
873
  const n = document.createElement("div");
854
874
  return n.className = "rte-conditional-body", n.setAttribute("data-slot", "if"), n.innerHTML = "<p><br></p>", o.appendChild(i), o.appendChild(n), e.hasElse && Ee(o, t), ve(o, t), oe(o, !1), o;
855
875
  }
856
- function Ue(e, t) {
876
+ function Ye(e, t) {
857
877
  if (t)
858
878
  try {
859
- if (!e.isConnected) return;
879
+ if (!e.isConnected)
880
+ return;
860
881
  const o = e.contains(t.startContainer), i = e.contains(t.endContainer);
861
- if (!o || !i) return;
882
+ if (!o || !i)
883
+ return;
862
884
  xe(e, t);
863
885
  } catch {
864
886
  }
865
887
  }
866
- function Ye(e) {
888
+ function Je(e) {
867
889
  return (e.textContent || "").replace(/\u200B/g, "").trim().length > 0 ? !0 : e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol") !== null;
868
890
  }
869
- function Ne(e, t, o) {
891
+ function De(e, t, o) {
870
892
  let i = null;
871
- i || (i = ke(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
893
+ if (o)
894
+ try {
895
+ const r = o.cloneRange();
896
+ e.contains(r.commonAncestorContainer) && (i = r);
897
+ } catch {
898
+ i = null;
899
+ }
900
+ i || (i = Se(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
872
901
  let n = null;
873
902
  i.collapsed || (n = i.extractContents()), i.insertNode(t);
874
903
  const a = t.querySelector('.rte-conditional-body[data-slot="if"]');
875
- a && n && Ye(n) && (a.innerHTML = "", a.appendChild(n)), a ? pe(e, a) : pe(e, t), e.normalize();
904
+ a && n && Je(n) && (a.innerHTML = "", a.appendChild(n)), a ? pe(e, a) : pe(e, t), e.normalize();
876
905
  }
877
- function Je(e) {
906
+ function Xe(e) {
878
907
  return {
879
908
  condition: e.getAttribute("data-condition") || "",
880
- audience: O(e.getAttribute("data-audience")),
881
- locale: O(e.getAttribute("data-locale")),
909
+ audience: K(e.getAttribute("data-audience")),
910
+ locale: K(e.getAttribute("data-locale")),
882
911
  hasElse: e.getAttribute("data-has-else") === "true"
883
912
  };
884
913
  }
885
- function Xe(e, t, o) {
914
+ function Qe(e, t, o) {
886
915
  e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", te(t.audience).join(",")), e.setAttribute("data-locale", te(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse && Ee(e, o), ve(e, o), oe(e, e.classList.contains("rte-conditional-preview"));
887
916
  }
888
917
  function ne(e, t) {
889
918
  he(e, e);
890
- const o = Array.from(e.querySelectorAll(H)), i = w.get(e) === !0;
919
+ const o = Array.from(e.querySelectorAll(q)), i = T.get(e) === !0;
891
920
  return o.forEach((n) => {
892
921
  n.classList.add("rte-conditional-block"), n.setAttribute("data-conditional-content", "true"), n.hasAttribute("data-condition") || n.setAttribute("data-condition", ""), n.hasAttribute("data-audience") || n.setAttribute("data-audience", ""), n.hasAttribute("data-locale") || n.setAttribute("data-locale", ""), n.hasAttribute("data-has-else") || n.setAttribute("data-has-else", "false"), n.setAttribute("role", "group"), n.setAttribute("aria-label", "Conditional content block"), n.setAttribute("contenteditable", "false"), n.setAttribute("spellcheck", "false"), ve(n, t), oe(n, i);
893
922
  }), o;
894
923
  }
895
- async function Qe(e, t) {
924
+ async function et(e, t) {
896
925
  const o = $e.get(e);
897
926
  if (o)
898
927
  return o;
899
928
  if (typeof t.getContext == "function")
900
929
  try {
901
- const i = ce(e), n = await Promise.resolve(t.getContext({ editor: e, editorRoot: i }));
930
+ const i = re(e), n = await Promise.resolve(t.getContext({ editor: e, editorRoot: i }));
902
931
  if (n && typeof n == "object")
903
932
  return n;
904
933
  } catch {
@@ -917,49 +946,51 @@ async function Qe(e, t) {
917
946
  function be(e) {
918
947
  return Array.isArray(e) ? e.map((t) => t.trim().toLowerCase()).filter(Boolean) : typeof e == "string" ? e.split(",").map((t) => t.trim().toLowerCase()).filter(Boolean) : [];
919
948
  }
920
- function Ae(e, t) {
949
+ function we(e, t) {
921
950
  return e.length === 0 || e.includes("all") ? !0 : t.length === 0 ? !1 : e.some((o) => t.includes(o));
922
951
  }
923
952
  async function Z(e, t, o) {
953
+ var M, le;
924
954
  const i = t.labels, n = ne(e, i);
925
- if (w.set(e, o), De(e, o), ce(e).classList.toggle("rte-conditional-preview-on", o), !o) {
926
- n.forEach(($) => {
927
- $.classList.remove("rte-conditional-preview"), oe($, !1);
928
- const P = $.querySelector('.rte-conditional-body[data-slot="if"]'), T = $.querySelector('.rte-conditional-body[data-slot="else"]'), F = $.querySelector(".rte-conditional-else-label"), B = $.getAttribute("data-has-else") === "true";
929
- P && (P.classList.remove("rte-conditional-hidden"), P.removeAttribute("aria-hidden")), T && (T.classList.toggle("rte-conditional-hidden", !B), T.setAttribute("aria-hidden", B ? "false" : "true")), F && F.classList.toggle("rte-conditional-hidden", !B);
955
+ if (T.set(e, o), He(e, o), re(e).classList.toggle("rte-conditional-preview-on", o), !o) {
956
+ n.forEach((m) => {
957
+ m.classList.remove("rte-conditional-preview"), oe(m, !1);
958
+ const N = m.querySelector('.rte-conditional-body[data-slot="if"]'), D = m.querySelector('.rte-conditional-body[data-slot="else"]'), O = m.querySelector(".rte-conditional-else-label"), C = m.getAttribute("data-has-else") === "true";
959
+ N && (N.classList.remove("rte-conditional-hidden"), N.removeAttribute("aria-hidden")), D && (D.classList.toggle("rte-conditional-hidden", !C), D.setAttribute("aria-hidden", C ? "false" : "true")), O && O.classList.toggle("rte-conditional-hidden", !C);
930
960
  });
931
961
  return;
932
962
  }
933
- const r = await Qe(e, t), l = be(t.currentAudience), d = be(t.currentLocale), E = be(
934
- r.audience ?? r.user?.audience
935
- ), m = be(
936
- r.locale ?? r.user?.locale
937
- ), v = l.length > 0 ? l : E, S = d.length > 0 ? d : m;
938
- n.forEach(($) => {
939
- const P = $.getAttribute("data-condition") || "", T = O($.getAttribute("data-audience")).map((s) => s.toLowerCase()), F = O($.getAttribute("data-locale")).map((s) => s.toLowerCase()), B = $.getAttribute("data-has-else") === "true", ge = t.evaluateCondition(P, r), M = Ae(T, v), de = Ae(F, S), R = ge && M && de, ie = $.querySelector('.rte-conditional-body[data-slot="if"]'), j = $.querySelector('.rte-conditional-body[data-slot="else"]'), ae = $.querySelector(".rte-conditional-else-label");
940
- if ($.classList.add("rte-conditional-preview"), oe($, !0), ie && (ie.classList.toggle("rte-conditional-hidden", !R), ie.setAttribute("aria-hidden", R ? "false" : "true")), j) {
941
- const s = B && !R;
942
- j.classList.toggle("rte-conditional-hidden", !s), j.setAttribute("aria-hidden", s ? "false" : "true");
943
- }
944
- if (ae) {
945
- const s = B && !R;
946
- ae.classList.toggle("rte-conditional-hidden", !s);
963
+ const r = await et(e, t), l = be(t.currentAudience), d = be(t.currentLocale), E = be(
964
+ r.audience ?? ((M = r.user) == null ? void 0 : M.audience)
965
+ ), L = be(
966
+ r.locale ?? ((le = r.user) == null ? void 0 : le.locale)
967
+ ), p = l.length > 0 ? l : E, B = d.length > 0 ? d : L;
968
+ n.forEach((m) => {
969
+ const N = m.getAttribute("data-condition") || "", D = K(m.getAttribute("data-audience")).map((v) => v.toLowerCase()), O = K(m.getAttribute("data-locale")).map((v) => v.toLowerCase()), C = m.getAttribute("data-has-else") === "true", ce = t.evaluateCondition(N, r), de = we(D, p), ge = we(O, B), _ = ce && de && ge, V = m.querySelector('.rte-conditional-body[data-slot="if"]'), u = m.querySelector('.rte-conditional-body[data-slot="else"]'), k = m.querySelector(".rte-conditional-else-label");
970
+ if (m.classList.add("rte-conditional-preview"), oe(m, !0), V && (V.classList.toggle("rte-conditional-hidden", !_), V.setAttribute("aria-hidden", _ ? "false" : "true")), u) {
971
+ const v = C && !_;
972
+ u.classList.toggle("rte-conditional-hidden", !v), u.setAttribute("aria-hidden", v ? "false" : "true");
973
+ }
974
+ if (k) {
975
+ const v = C && !_;
976
+ k.classList.toggle("rte-conditional-hidden", !v);
947
977
  }
948
978
  });
949
979
  }
950
- function De(e, t) {
951
- const o = ce(e);
980
+ function He(e, t) {
981
+ const o = re(e);
952
982
  Array.from(
953
983
  o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')
954
984
  ).forEach((n) => {
955
985
  n.setAttribute("data-active", t ? "true" : "false"), n.classList.toggle("active", t), n.setAttribute("aria-pressed", t ? "true" : "false");
956
986
  });
957
987
  }
958
- function et(e) {
959
- const t = _.get(e);
960
- if (t && t.isConnected) return t;
988
+ function tt(e) {
989
+ const t = j.get(e);
990
+ if (t && t.isConnected)
991
+ return t;
961
992
  const o = document.createElement("div");
962
- return o.className = u, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
993
+ return o.className = s, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
963
994
  <button type="button" class="rte-conditional-float-btn" data-action="edit" title="Edit Condition" aria-label="Edit Condition">
964
995
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 17.3V20h2.7l9.7-9.7-2.7-2.7L4 17.3Zm14.7-9.4a1 1 0 0 0 0-1.4l-1.2-1.2a1 1 0 0 0-1.4 0l-1.1 1.1 2.7 2.7 1-1.2Z" fill="currentColor"></path></svg>
965
996
  </button>
@@ -969,25 +1000,28 @@ function et(e) {
969
1000
  `, o.addEventListener("mousedown", (i) => {
970
1001
  i.preventDefault();
971
1002
  }), o.addEventListener("click", (i) => {
972
- const a = i.target?.closest("[data-action]")?.getAttribute("data-action");
973
- if (!a) return;
1003
+ var d;
1004
+ const n = i.target, a = (d = n == null ? void 0 : n.closest("[data-action]")) == null ? void 0 : d.getAttribute("data-action");
1005
+ if (!a)
1006
+ return;
974
1007
  const r = x.get(e) || ee;
975
- if (!r) return;
976
- const l = z.get(e);
1008
+ if (!r)
1009
+ return;
1010
+ const l = I.get(e);
977
1011
  if (!(!l || !e.contains(l))) {
978
1012
  if (a === "edit") {
979
- C(e, r, "edit", void 0, l);
1013
+ A(e, r, "edit", void 0, l);
980
1014
  return;
981
1015
  }
982
- a === "delete" && (Oe(e, l), z.set(e, null), I(e));
1016
+ a === "delete" && (Pe(e, l), I.set(e, null), F(e));
983
1017
  }
984
- }), document.body.appendChild(o), _.set(e, o), o;
1018
+ }), document.body.appendChild(o), j.set(e, o), o;
985
1019
  }
986
- function I(e) {
987
- const t = _.get(e);
1020
+ function F(e) {
1021
+ const t = j.get(e);
988
1022
  t && t.classList.remove("show");
989
1023
  }
990
- function He(e, t) {
1024
+ function Oe(e, t) {
991
1025
  const o = t.getBoundingClientRect();
992
1026
  e.style.left = "0px", e.style.top = "0px", e.classList.add("show");
993
1027
  const i = e.getBoundingClientRect(), n = 8, a = window.innerWidth, r = window.innerHeight;
@@ -997,215 +1031,231 @@ function He(e, t) {
997
1031
  d = Math.max(n, Math.min(d, a - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
998
1032
  }
999
1033
  function me(e, t) {
1000
- const o = et(e);
1001
- he(o, e), z.set(e, t), He(o, t);
1034
+ const o = tt(e);
1035
+ he(o, e), I.set(e, t), Oe(o, t);
1002
1036
  }
1003
- function D(e) {
1037
+ function R(e) {
1004
1038
  const t = x.get(e) || ee;
1005
- if (!t) return;
1039
+ if (!t)
1040
+ return;
1006
1041
  const o = W(e);
1007
- if (!o || !e.contains(o) || k(e)) {
1008
- z.set(e, null), I(e);
1042
+ if (!o || !e.contains(o) || H(e)) {
1043
+ I.set(e, null), F(e);
1009
1044
  return;
1010
1045
  }
1011
1046
  ne(e, t.labels), me(e, o);
1012
1047
  }
1013
- function tt() {
1014
- _.forEach((e, t) => {
1048
+ function ot() {
1049
+ j.forEach((e, t) => {
1015
1050
  if (!t.isConnected || !e.isConnected) {
1016
- e.remove(), _.delete(t), z.delete(t);
1051
+ e.remove(), j.delete(t), I.delete(t);
1017
1052
  return;
1018
1053
  }
1019
- if (!e.classList.contains("show")) return;
1054
+ if (!e.classList.contains("show"))
1055
+ return;
1020
1056
  he(e, t);
1021
- const o = z.get(t);
1057
+ const o = I.get(t);
1022
1058
  if (!o || !t.contains(o)) {
1023
- I(t);
1059
+ F(t);
1024
1060
  return;
1025
1061
  }
1026
- He(e, o);
1062
+ Oe(e, o);
1027
1063
  });
1028
1064
  }
1029
- function Oe(e, t) {
1030
- if (!e.contains(t)) return !1;
1065
+ function Pe(e, t) {
1066
+ if (!e.contains(t))
1067
+ return !1;
1031
1068
  const o = e.innerHTML, i = t.parentNode, n = t.nextSibling;
1032
1069
  t.remove(), i === e && e.innerHTML.trim() === "" && (e.innerHTML = "<p><br></p>");
1033
1070
  const a = document.createRange();
1034
- return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), xe(e, a), Se(e), Te(e, o), !0;
1071
+ return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), xe(e, a), Te(e), Be(e, o), !0;
1035
1072
  }
1036
- function we(e, t, o) {
1073
+ function ke(e, t, o) {
1037
1074
  const i = e.cloneRange(), n = document.createRange();
1038
1075
  return n.selectNodeContents(t), n.collapse(o === "start"), i.startContainer === n.startContainer && i.startOffset === n.startOffset && i.endContainer === n.endContainer && i.endOffset === n.endOffset;
1039
1076
  }
1040
- function C(e, t, o, i, n) {
1041
- Be();
1042
- const a = t.labels, r = o === "insert" ? ke(e) : null, l = document.createElement("div");
1077
+ function A(e, t, o, i, n) {
1078
+ Me();
1079
+ const a = t.labels, r = o === "insert" ? Se(e) : null, l = document.createElement("div");
1043
1080
  l.className = c, he(l, e);
1044
1081
  const d = document.createElement("section");
1045
1082
  d.className = "rte-conditional-dialog", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "rte-conditional-dialog-title");
1046
- const E = n ? Je(n) : void 0, m = i || E || {}, v = m.condition ?? t.defaultCondition, S = m.audience ?? t.defaultAudience, $ = m.locale ?? t.defaultLocale, P = m.hasElse ?? t.enableElseByDefault;
1083
+ const E = n ? Xe(n) : void 0, L = i || E || {}, p = L.condition ?? t.defaultCondition, B = L.audience ?? t.defaultAudience, M = L.locale ?? t.defaultLocale, le = L.hasElse ?? t.enableElseByDefault;
1047
1084
  d.innerHTML = `
1048
1085
  <header class="rte-conditional-dialog-header">
1049
- <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${y(
1086
+ <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${$(
1050
1087
  o === "edit" ? a.dialogTitleEdit : a.dialogTitleInsert
1051
1088
  )}</h2>
1052
- <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${y(a.cancelText)}">✕</button>
1089
+ <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(a.cancelText)}">✕</button>
1053
1090
  </header>
1054
1091
  <div class="rte-conditional-dialog-body">
1055
1092
  <div class="rte-conditional-field">
1056
- <label for="rte-conditional-condition">${y(a.conditionLabel)}</label>
1057
- <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${y(
1058
- v || ""
1059
- )}" placeholder="${y(a.conditionPlaceholder)}" />
1093
+ <label for="rte-conditional-condition">${$(a.conditionLabel)}</label>
1094
+ <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${$(
1095
+ p || ""
1096
+ )}" placeholder="${$(a.conditionPlaceholder)}" />
1060
1097
  </div>
1061
1098
  <div class="rte-conditional-field">
1062
- <label for="rte-conditional-audience">${y(a.audienceLabel)}</label>
1063
- <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${y(
1064
- Le(S)
1065
- )}" placeholder="${y(a.audiencePlaceholder)}" />
1099
+ <label for="rte-conditional-audience">${$(a.audienceLabel)}</label>
1100
+ <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${$(
1101
+ Ae(B)
1102
+ )}" placeholder="${$(a.audiencePlaceholder)}" />
1066
1103
  </div>
1067
1104
  <div class="rte-conditional-field">
1068
- <label for="rte-conditional-locale">${y(a.localeLabel)}</label>
1069
- <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${y(
1070
- Le($)
1071
- )}" placeholder="${y(a.localePlaceholder)}" />
1105
+ <label for="rte-conditional-locale">${$(a.localeLabel)}</label>
1106
+ <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${$(
1107
+ Ae(M)
1108
+ )}" placeholder="${$(a.localePlaceholder)}" />
1072
1109
  </div>
1073
1110
  <label class="rte-conditional-checkbox">
1074
- <input class="rte-conditional-input-else" type="checkbox" ${P ? "checked" : ""} />
1075
- <span>${y(a.elseLabel)}</span>
1111
+ <input class="rte-conditional-input-else" type="checkbox" ${le ? "checked" : ""} />
1112
+ <span>${$(a.elseLabel)}</span>
1076
1113
  </label>
1077
1114
  <p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
1078
1115
  </div>
1079
1116
  <footer class="rte-conditional-dialog-footer">
1080
- <button type="button" class="rte-conditional-btn" data-action="cancel">${y(a.cancelText)}</button>
1081
- <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${y(a.saveText)}</button>
1117
+ <button type="button" class="rte-conditional-btn" data-action="cancel">${$(a.cancelText)}</button>
1118
+ <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(a.saveText)}</button>
1082
1119
  </footer>
1083
1120
  `, l.appendChild(d), document.body.appendChild(l);
1084
- const T = d.querySelector(".rte-conditional-input-condition"), F = d.querySelector(".rte-conditional-input-audience"), B = d.querySelector(".rte-conditional-input-locale"), ge = d.querySelector(".rte-conditional-input-else"), M = () => {
1085
- l.removeEventListener("click", R), l.removeEventListener("keydown", ae, !0), document.removeEventListener("keydown", de, !0), l.parentNode && l.parentNode.removeChild(l), le = null, e.focus({ preventScroll: !0 }), D(e);
1086
- }, de = (s) => {
1087
- s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), M());
1088
- }, R = (s) => {
1089
- s.target === l && M();
1090
- }, ie = (s) => {
1091
- if (s.key !== "Tab") return;
1092
- const q = Array.from(
1121
+ const m = d.querySelector(".rte-conditional-input-condition"), N = d.querySelector(".rte-conditional-input-audience"), D = d.querySelector(".rte-conditional-input-locale"), O = d.querySelector(".rte-conditional-input-else"), C = () => {
1122
+ l.removeEventListener("click", de), l.removeEventListener("keydown", V, !0), document.removeEventListener("keydown", ce, !0), l.parentNode && l.parentNode.removeChild(l), ae = null, e.focus({ preventScroll: !0 }), R(e);
1123
+ }, ce = (u) => {
1124
+ u.key === "Escape" && (u.preventDefault(), u.stopPropagation(), C());
1125
+ }, de = (u) => {
1126
+ u.target === l && C();
1127
+ }, ge = (u) => {
1128
+ if (u.key !== "Tab")
1129
+ return;
1130
+ const k = Array.from(
1093
1131
  d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
1094
1132
  );
1095
- if (q.length === 0) return;
1096
- const V = q[0], K = q[q.length - 1], re = document.activeElement;
1097
- if (s.shiftKey && re === V) {
1098
- s.preventDefault(), K.focus();
1133
+ if (k.length === 0)
1134
+ return;
1135
+ const v = k[0], ie = k[k.length - 1], z = document.activeElement;
1136
+ if (u.shiftKey && z === v) {
1137
+ u.preventDefault(), ie.focus();
1099
1138
  return;
1100
1139
  }
1101
- !s.shiftKey && re === K && (s.preventDefault(), V.focus());
1102
- }, j = async () => {
1103
- const s = {
1104
- condition: T?.value?.trim() || "",
1105
- audience: O(F?.value),
1106
- locale: O(B?.value),
1107
- hasElse: ge?.checked || !1
1108
- }, q = e.innerHTML;
1140
+ !u.shiftKey && z === ie && (u.preventDefault(), v.focus());
1141
+ }, _ = async () => {
1142
+ var ie;
1143
+ const u = {
1144
+ condition: ((ie = m == null ? void 0 : m.value) == null ? void 0 : ie.trim()) || "",
1145
+ audience: K(N == null ? void 0 : N.value),
1146
+ locale: K(D == null ? void 0 : D.value),
1147
+ hasElse: (O == null ? void 0 : O.checked) || !1
1148
+ }, k = e.innerHTML;
1109
1149
  if (n)
1110
- Xe(n, s, a), oe(n, w.get(e) === !0);
1150
+ Qe(n, u, a), oe(n, T.get(e) === !0);
1111
1151
  else {
1112
- Ue(e, r);
1113
- const K = Me(s, a);
1152
+ Ye(e, r);
1153
+ const z = Ne(u, a);
1114
1154
  try {
1115
- Ne(e, K);
1155
+ De(e, z);
1116
1156
  } catch {
1117
- e.appendChild(K);
1118
- const re = K.querySelector('.rte-conditional-body[data-slot="if"]');
1119
- re ? pe(e, re) : pe(e, K);
1157
+ e.appendChild(z);
1158
+ const Ce = z.querySelector('.rte-conditional-body[data-slot="if"]');
1159
+ Ce ? pe(e, Ce) : pe(e, z);
1120
1160
  }
1121
1161
  }
1122
- w.get(e) === !0 && await Z(e, t, !0), Se(e), Te(e, q), D(e), M();
1123
- }, ae = (s) => {
1124
- if (s.key === "Escape") {
1125
- s.preventDefault(), M();
1162
+ T.get(e) === !0 && await Z(e, t, !0), Te(e), Be(e, k), R(e), C();
1163
+ }, V = (u) => {
1164
+ if (u.key === "Escape") {
1165
+ u.preventDefault(), C();
1126
1166
  return;
1127
1167
  }
1128
- ie(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), j());
1168
+ ge(u), u.key === "Enter" && !u.shiftKey && u.target instanceof HTMLInputElement && (u.preventDefault(), _());
1129
1169
  };
1130
- d.addEventListener("click", (s) => {
1131
- const V = s.target.getAttribute("data-action");
1132
- if (V === "cancel") {
1133
- M();
1170
+ d.addEventListener("click", (u) => {
1171
+ const v = u.target.getAttribute("data-action");
1172
+ if (v === "cancel") {
1173
+ C();
1134
1174
  return;
1135
1175
  }
1136
- V === "save" && j();
1137
- }), l.addEventListener("click", R), l.addEventListener("keydown", ae, !0), document.addEventListener("keydown", de, !0), le = { cleanup: M }, T?.focus();
1176
+ v === "save" && _();
1177
+ }), l.addEventListener("click", de), l.addEventListener("keydown", V, !0), document.addEventListener("keydown", ce, !0), ae = { cleanup: C }, m == null || m.focus();
1138
1178
  }
1139
- function ot(e) {
1179
+ function nt(e) {
1140
1180
  const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", a = t && e.altKey && e.shiftKey && (i === "c" || n === "keyc"), r = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f9" || n === "f9");
1141
1181
  return a || r;
1142
1182
  }
1143
- function nt(e) {
1183
+ function it(e) {
1144
1184
  const t = e.metaKey || e.ctrlKey, i = (typeof e.key == "string" ? e.key : "").toLowerCase(), n = typeof e.code == "string" ? e.code.toLowerCase() : "", a = t && e.altKey && e.shiftKey && (i === "p" || n === "keyp"), r = !e.metaKey && !e.ctrlKey && !e.altKey && !e.shiftKey && (i === "f10" || n === "f10");
1145
1185
  return a || r;
1146
1186
  }
1147
- function it(e) {
1187
+ function at(e) {
1148
1188
  ee = e, U || (U = (t) => {
1149
- const i = t.target?.closest(L);
1150
- if (!i) return;
1151
- g = i, x.has(i) || x.set(i, e);
1189
+ const o = t.target, i = o == null ? void 0 : o.closest(w);
1190
+ if (!i)
1191
+ return;
1192
+ y = i, x.has(i) || x.set(i, e);
1152
1193
  const n = x.get(i) || e;
1153
- ne(i, n.labels), De(i, w.get(i) === !0), D(i);
1194
+ ne(i, n.labels), He(i, T.get(i) === !0), R(i);
1154
1195
  }, document.addEventListener("focusin", U, !0)), G || (G = (t) => {
1155
- if (document.querySelector(`.${c}`)) return;
1196
+ var L;
1197
+ if (document.querySelector(`.${c}`))
1198
+ return;
1156
1199
  const i = t.target;
1157
- if (!!i?.closest("input, textarea, select")) return;
1158
- const r = i?.closest(L) || A(void 0, !1) || g;
1159
- if (!r || k(r)) return;
1160
- const l = x.get(r) || ee || e, d = document.activeElement, E = i?.closest(".rte-conditional-header") || d?.closest(".rte-conditional-header");
1200
+ if (!!(i != null && i.closest("input, textarea, select")))
1201
+ return;
1202
+ const r = (i == null ? void 0 : i.closest(w)) || S(void 0, !1) || y;
1203
+ if (!r || H(r))
1204
+ return;
1205
+ const l = x.get(r) || ee || e, d = document.activeElement, E = (i == null ? void 0 : i.closest(".rte-conditional-header")) || (d == null ? void 0 : d.closest(".rte-conditional-header"));
1161
1206
  if (E && (t.key === "Enter" || t.key === " ")) {
1162
- const m = E.closest(H);
1163
- if (m && r.contains(m)) {
1164
- t.preventDefault(), t.stopPropagation(), C(r, l, "edit", void 0, m);
1207
+ const p = E.closest(q);
1208
+ if (p && r.contains(p)) {
1209
+ t.preventDefault(), t.stopPropagation(), A(r, l, "edit", void 0, p);
1165
1210
  return;
1166
1211
  }
1167
1212
  }
1168
- if (ot(t)) {
1213
+ if (nt(t)) {
1169
1214
  t.preventDefault(), t.stopPropagation();
1170
- const m = W(r);
1171
- m ? C(r, l, "edit", void 0, m) : C(r, l, "insert");
1215
+ const p = W(r);
1216
+ p ? A(r, l, "edit", void 0, p) : A(r, l, "insert");
1172
1217
  return;
1173
1218
  }
1174
- if (nt(t)) {
1219
+ if (it(t)) {
1175
1220
  t.preventDefault(), t.stopPropagation();
1176
- const m = w.get(r) !== !0;
1177
- Z(r, l, m), D(r);
1221
+ const p = T.get(r) !== !0;
1222
+ Z(r, l, p), R(r);
1178
1223
  return;
1179
1224
  }
1180
1225
  if ((t.key === "Backspace" || t.key === "Delete") && !t.altKey && !t.ctrlKey && !t.metaKey) {
1181
- const m = window.getSelection();
1182
- if (!m || m.rangeCount === 0) return;
1183
- const v = m.getRangeAt(0);
1184
- if (!v.collapsed || !r.contains(v.commonAncestorContainer)) return;
1185
- const S = Ve(v.startContainer)?.closest(".rte-conditional-body");
1186
- if (!S || !r.contains(S)) return;
1187
- if (t.key === "Backspace" && we(v, S, "start")) {
1226
+ const p = window.getSelection();
1227
+ if (!p || p.rangeCount === 0)
1228
+ return;
1229
+ const B = p.getRangeAt(0);
1230
+ if (!B.collapsed || !r.contains(B.commonAncestorContainer))
1231
+ return;
1232
+ const M = (L = We(B.startContainer)) == null ? void 0 : L.closest(".rte-conditional-body");
1233
+ if (!M || !r.contains(M))
1234
+ return;
1235
+ if (t.key === "Backspace" && ke(B, M, "start")) {
1188
1236
  t.preventDefault();
1189
1237
  return;
1190
1238
  }
1191
- if (t.key === "Delete" && we(v, S, "end")) {
1239
+ if (t.key === "Delete" && ke(B, M, "end")) {
1192
1240
  t.preventDefault();
1193
1241
  return;
1194
1242
  }
1195
1243
  }
1196
1244
  }, document.addEventListener("keydown", G, !0)), J || (J = (t) => {
1197
1245
  const o = t.target;
1198
- if (!o || o.closest(`.${u}`)) return;
1199
- const i = o.closest(L);
1246
+ if (!o || o.closest(`.${s}`))
1247
+ return;
1248
+ const i = o.closest(w);
1200
1249
  if (!i) {
1201
- g && I(g);
1250
+ y && F(y);
1202
1251
  return;
1203
1252
  }
1204
- if (k(i)) return;
1205
- g = i, x.has(i) || x.set(i, e);
1206
- const n = o.closest(H);
1253
+ if (H(i))
1254
+ return;
1255
+ y = i, x.has(i) || x.set(i, e);
1256
+ const n = o.closest(q);
1207
1257
  if (!n) {
1208
- I(i);
1258
+ F(i);
1209
1259
  return;
1210
1260
  }
1211
1261
  requestAnimationFrame(() => {
@@ -1213,40 +1263,43 @@ function it(e) {
1213
1263
  });
1214
1264
  }, document.addEventListener("mousedown", J, !0)), Y || (Y = (t) => {
1215
1265
  const o = t.target;
1216
- if (!o || o.closest(`.${u}`)) return;
1217
- const i = o.closest(L);
1266
+ if (!o || o.closest(`.${s}`))
1267
+ return;
1268
+ const i = o.closest(w);
1218
1269
  if (!i) {
1219
- g && I(g);
1270
+ y && F(y);
1220
1271
  return;
1221
1272
  }
1222
- if (k(i)) return;
1223
- g = i, x.has(i) || x.set(i, e);
1224
- const n = x.get(i) || e, a = o.closest(H), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
1273
+ if (H(i))
1274
+ return;
1275
+ y = i, x.has(i) || x.set(i, e);
1276
+ const n = x.get(i) || e, a = o.closest(q), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
1225
1277
  if (a && r) {
1226
- t.preventDefault(), t.stopPropagation(), C(i, n, "edit", void 0, a), me(i, a);
1278
+ t.preventDefault(), t.stopPropagation(), A(i, n, "edit", void 0, a), me(i, a);
1227
1279
  return;
1228
1280
  }
1229
- a ? me(i, a) : I(i);
1281
+ a ? me(i, a) : F(i);
1230
1282
  }, document.addEventListener("click", Y, !0)), X || (X = () => {
1231
- const t = A(void 0, !1) || g;
1232
- t && t.isConnected && D(t);
1283
+ const t = S(void 0, !1) || y;
1284
+ t && t.isConnected && R(t);
1233
1285
  }, document.addEventListener("selectionchange", X)), Q || (Q = (t) => {
1234
- const i = t.target?.closest(L);
1235
- if (!i) return;
1286
+ const o = t.target, i = o == null ? void 0 : o.closest(w);
1287
+ if (!i)
1288
+ return;
1236
1289
  const n = x.get(i) || ee || e;
1237
- ne(i, n.labels), D(i);
1238
- }, document.addEventListener("input", Q, !0)), N || (N = () => {
1239
- tt();
1240
- }, window.addEventListener("scroll", N, !0), window.addEventListener("resize", N));
1290
+ ne(i, n.labels), R(i);
1291
+ }, document.addEventListener("input", Q, !0)), P || (P = () => {
1292
+ ot();
1293
+ }, window.addEventListener("scroll", P, !0), window.addEventListener("resize", P));
1241
1294
  }
1242
- function at() {
1243
- U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null), Y && (document.removeEventListener("click", Y, !0), Y = null), J && (document.removeEventListener("mousedown", J, !0), J = null), X && (document.removeEventListener("selectionchange", X), X = null), Q && (document.removeEventListener("input", Q, !0), Q = null), N && (window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N), N = null), _.forEach((e) => {
1295
+ function rt() {
1296
+ U && (document.removeEventListener("focusin", U, !0), U = null), G && (document.removeEventListener("keydown", G, !0), G = null), Y && (document.removeEventListener("click", Y, !0), Y = null), J && (document.removeEventListener("mousedown", J, !0), J = null), X && (document.removeEventListener("selectionchange", X), X = null), Q && (document.removeEventListener("input", Q, !0), Q = null), P && (window.removeEventListener("scroll", P, !0), window.removeEventListener("resize", P), P = null), j.forEach((e) => {
1244
1297
  e.remove();
1245
- }), _.clear(), z.clear(), ee = null, g = null;
1298
+ }), j.clear(), I.clear(), ee = null, y = null;
1246
1299
  }
1247
- const rt = (e = {}) => {
1248
- const t = je(e);
1249
- return Fe(), {
1300
+ const lt = (e = {}) => {
1301
+ const t = Ve(e);
1302
+ return Ie(), {
1250
1303
  name: "conditionalContent",
1251
1304
  toolbar: [
1252
1305
  {
@@ -1274,69 +1327,77 @@ const rt = (e = {}) => {
1274
1327
  ],
1275
1328
  commands: {
1276
1329
  conditionalContent: (o, i) => {
1277
- const n = A(i);
1278
- if (!n || k(n)) return !1;
1279
- g = n, x.set(n, t), ne(n, t.labels);
1280
- const a = o?.target;
1330
+ const n = S(i);
1331
+ if (!n || H(n))
1332
+ return !1;
1333
+ y = n, x.set(n, t), ne(n, t.labels);
1334
+ const a = o == null ? void 0 : o.target;
1281
1335
  if (a === "insert")
1282
- return C(n, t, "insert", o), !0;
1336
+ return A(n, t, "insert", o), !0;
1283
1337
  const r = W(n);
1284
- return a === "edit" || r ? !r && a === "edit" ? !1 : (C(n, t, "edit", o, r || void 0), !0) : (C(n, t, "insert", o), !0);
1338
+ return a === "edit" || r ? !r && a === "edit" ? !1 : (A(n, t, "edit", o, r || void 0), !0) : (A(n, t, "insert", o), !0);
1285
1339
  },
1286
1340
  openConditionalDialog: (o, i) => {
1287
- const n = A(i);
1288
- if (!n || k(n)) return !1;
1289
- g = n, x.set(n, t), ne(n, t.labels);
1290
- const a = o?.target;
1341
+ const n = S(i);
1342
+ if (!n || H(n))
1343
+ return !1;
1344
+ y = n, x.set(n, t), ne(n, t.labels);
1345
+ const a = o == null ? void 0 : o.target;
1291
1346
  if (a === "insert")
1292
- return C(n, t, "insert", o), !0;
1347
+ return A(n, t, "insert", o), !0;
1293
1348
  const r = W(n);
1294
- return a === "edit" || r ? !r && a === "edit" ? !1 : (C(n, t, "edit", o, r || void 0), !0) : (C(n, t, "insert", o), !0);
1349
+ return a === "edit" || r ? !r && a === "edit" ? !1 : (A(n, t, "edit", o, r || void 0), !0) : (A(n, t, "insert", o), !0);
1295
1350
  },
1296
1351
  conditionalPreview: async (o, i) => {
1297
- const n = A(i);
1298
- if (!n) return !1;
1299
- g = n, x.set(n, t);
1300
- const a = typeof o == "boolean" ? o : w.get(n) !== !0;
1301
- return await Z(n, t, a), D(n), !0;
1352
+ const n = S(i);
1353
+ if (!n)
1354
+ return !1;
1355
+ y = n, x.set(n, t);
1356
+ const a = typeof o == "boolean" ? o : T.get(n) !== !0;
1357
+ return await Z(n, t, a), R(n), !0;
1302
1358
  },
1303
1359
  editConditionalBlock: (o, i) => {
1304
- const n = A(i);
1305
- if (!n || k(n)) return !1;
1306
- g = n, x.set(n, t);
1360
+ const n = S(i);
1361
+ if (!n || H(n))
1362
+ return !1;
1363
+ y = n, x.set(n, t);
1307
1364
  const a = W(n);
1308
- return a ? (C(n, t, "edit", o, a), !0) : !1;
1365
+ return a ? (A(n, t, "edit", o, a), !0) : !1;
1309
1366
  },
1310
1367
  deleteConditionalBlock: (o, i) => {
1311
- const n = A(i);
1312
- if (!n || k(n)) return !1;
1368
+ const n = S(i);
1369
+ if (!n || H(n))
1370
+ return !1;
1313
1371
  const a = W(n);
1314
- if (!a) return !1;
1315
- const r = Oe(n, a);
1316
- return r && D(n), r;
1372
+ if (!a)
1373
+ return !1;
1374
+ const r = Pe(n, a);
1375
+ return r && R(n), r;
1317
1376
  },
1318
1377
  insertConditionalBlock: (o, i) => {
1319
- const n = A(i);
1320
- if (!n || k(n)) return !1;
1321
- g = n, x.set(n, t);
1378
+ const n = S(i);
1379
+ if (!n || H(n))
1380
+ return !1;
1381
+ y = n, x.set(n, t);
1322
1382
  const a = {
1323
- condition: o?.condition ?? t.defaultCondition,
1324
- audience: o?.audience ?? t.defaultAudience,
1325
- locale: o?.locale ?? t.defaultLocale,
1326
- hasElse: o?.hasElse ?? t.enableElseByDefault
1327
- }, r = Me(a, t.labels);
1328
- return Ne(n, r), w.get(n) === !0 && Z(n, t, !0), !0;
1383
+ condition: (o == null ? void 0 : o.condition) ?? t.defaultCondition,
1384
+ audience: (o == null ? void 0 : o.audience) ?? t.defaultAudience,
1385
+ locale: (o == null ? void 0 : o.locale) ?? t.defaultLocale,
1386
+ hasElse: (o == null ? void 0 : o.hasElse) ?? t.enableElseByDefault
1387
+ }, r = Ne(a, t.labels);
1388
+ return De(n, r), T.get(n) === !0 && Z(n, t, !0), !0;
1329
1389
  },
1330
1390
  toggleConditionalPreview: async (o, i) => {
1331
- const n = A(i);
1332
- if (!n) return !1;
1333
- g = n, x.set(n, t);
1334
- const a = typeof o == "boolean" ? o : w.get(n) !== !0;
1391
+ const n = S(i);
1392
+ if (!n)
1393
+ return !1;
1394
+ y = n, x.set(n, t);
1395
+ const a = typeof o == "boolean" ? o : T.get(n) !== !0;
1335
1396
  return await Z(n, t, a), !0;
1336
1397
  },
1337
1398
  setConditionalContext: (o, i) => {
1338
- const n = A(i);
1339
- return n ? (g = n, !o || typeof o != "object" ? $e.delete(n) : $e.set(n, o), w.get(n) === !0 && Z(n, t, !0), !0) : !1;
1399
+ const n = S(i);
1400
+ return n ? (y = n, !o || typeof o != "object" ? $e.delete(n) : $e.set(n, o), T.get(n) === !0 && Z(n, t, !0), !0) : !1;
1340
1401
  }
1341
1402
  },
1342
1403
  keymap: {
@@ -1348,13 +1409,13 @@ const rt = (e = {}) => {
1348
1409
  F10: "toggleConditionalPreview"
1349
1410
  },
1350
1411
  init: () => {
1351
- se += 1, it(t);
1412
+ se += 1, at(t);
1352
1413
  },
1353
1414
  destroy: () => {
1354
- se = Math.max(0, se - 1), se === 0 && (Be(), at());
1415
+ se = Math.max(0, se - 1), se === 0 && (Me(), rt());
1355
1416
  }
1356
1417
  };
1357
1418
  };
1358
1419
  export {
1359
- rt as ConditionalContentPlugin
1420
+ lt as ConditionalContentPlugin
1360
1421
  };