@editora/core 1.0.7 → 1.0.9

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 (87) hide show
  1. package/README.md +5 -0
  2. package/dist/{A11yCheckerPlugin.native-BRdGYMju.mjs → A11yCheckerPlugin.native-58d12bed.mjs} +23 -12
  3. package/dist/{AnchorPlugin.native-BcYGEtd9.mjs → AnchorPlugin.native-289a112a.mjs} +112 -102
  4. package/dist/ApprovalWorkflowPlugin.native-449ce66c.mjs +1115 -0
  5. package/dist/{BackgroundColorPlugin.native-50iAT9xU.mjs → BackgroundColorPlugin.native-8aceb5cc.mjs} +16 -9
  6. package/dist/{BlockquotePlugin.native-JFmOLsxN.mjs → BlockquotePlugin.native-3541c714.mjs} +3 -2
  7. package/dist/BlocksLibraryPlugin.native-1cc51e63.mjs +1386 -0
  8. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-f9d7f8e4.mjs} +1 -1
  9. package/dist/{CapitalizationPlugin.native-DOMsh5R7.mjs → CapitalizationPlugin.native-42c135dc.mjs} +3 -2
  10. package/dist/{ChecklistPlugin.native-nuSSEFNI.mjs → ChecklistPlugin.native-3b397ee9.mjs} +43 -22
  11. package/dist/CitationsPlugin.native-169fb1e8.mjs +1532 -0
  12. package/dist/{ClearFormattingPlugin.native-Bq_XcTh2.mjs → ClearFormattingPlugin.native-77baa514.mjs} +11 -6
  13. package/dist/{CodePlugin.native-DlpTPdkd.mjs → CodePlugin.native-989cf0aa.mjs} +629 -580
  14. package/dist/{CodeSamplePlugin.native-CgGoH-X4.mjs → CodeSamplePlugin.native-6cc0148e.mjs} +19 -10
  15. package/dist/{CommentsPlugin.native-DPSqTkiv.mjs → CommentsPlugin.native-03659874.mjs} +55 -28
  16. package/dist/ConditionalContentPlugin.native-4983143a.mjs +1424 -0
  17. package/dist/ContentRulesPlugin.native-63ed405b.mjs +1149 -0
  18. package/dist/DataBindingPlugin.native-427e9d75.mjs +956 -0
  19. package/dist/{DirectionPlugin.native-CDnbdNyl.mjs → DirectionPlugin.native-4e742f42.mjs} +19 -10
  20. package/dist/DocSchemaPlugin.native-8e41eda0.mjs +1382 -0
  21. package/dist/{DocumentManagerPlugin.native-C2cs_1w4.mjs → DocumentManagerPlugin.native-e69895ad.mjs} +4 -4
  22. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-55209c87.mjs} +70 -70
  23. package/dist/{EmojisPlugin.native-CitxxlWX.mjs → EmojisPlugin.native-65c5ac47.mjs} +11 -6
  24. package/dist/{FontFamilyPlugin.native-j8hMTbg4.mjs → FontFamilyPlugin.native-f9bc255a.mjs} +7 -4
  25. package/dist/{FontSizePlugin.native-B_jCh7dY.mjs → FontSizePlugin.native-f5647872.mjs} +19 -10
  26. package/dist/{FootnotePlugin.native-D730OGRm.mjs → FootnotePlugin.native-494657b3.mjs} +77 -39
  27. package/dist/{FullscreenPlugin.native-ChXyxeNw.mjs → FullscreenPlugin.native-87ce92e9.mjs} +1 -1
  28. package/dist/{HeadingPlugin.native-DrLYwQnQ.mjs → HeadingPlugin.native-e38c4a16.mjs} +1 -1
  29. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-92ed4be4.mjs} +43 -22
  30. package/dist/{IndentPlugin.native-BHixp8sP.mjs → IndentPlugin.native-e4ee902b.mjs} +23 -12
  31. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-7c95cfbc.mjs} +1 -1
  32. package/dist/{LineHeightPlugin.native-CM7iXdQj.mjs → LineHeightPlugin.native-5668f78c.mjs} +19 -10
  33. package/dist/{LinkPlugin.native-DYCIcdTm.mjs → LinkPlugin.native-6df29111.mjs} +9 -5
  34. package/dist/{ListPlugin.native-V7EZC1lM.mjs → ListPlugin.native-fe2e115a.mjs} +9 -5
  35. package/dist/{MathPlugin.native-f_mDp8VL.mjs → MathPlugin.native-735bbac2.mjs} +9 -5
  36. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-3cf48a00.mjs} +219 -207
  37. package/dist/MentionPlugin.native-3b1e8c05.mjs +778 -0
  38. package/dist/{MergeTagPlugin.native-C3eOfEgw.mjs → MergeTagPlugin.native-31cf7d48.mjs} +51 -26
  39. package/dist/PIIRedactionPlugin.native-7ab10b9f.mjs +1449 -0
  40. package/dist/{PageBreakPlugin.native-CXdX5fAv.mjs → PageBreakPlugin.native-1794c5fb.mjs} +67 -52
  41. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-f7b67cc0.mjs} +38 -33
  42. package/dist/{PrintPlugin.native-7qt5v7L5.mjs → PrintPlugin.native-f6a168c2.mjs} +5 -3
  43. package/dist/SlashCommandsPlugin.native-8d45e511.mjs +790 -0
  44. package/dist/SmartPastePlugin.native-a6c5efec.mjs +1447 -0
  45. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-7f06d4ba.mjs} +17 -9
  46. package/dist/{SpellCheckPlugin.native-BZB9AewP.mjs → SpellCheckPlugin.native-04e20834.mjs} +41 -21
  47. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-905e9501.mjs} +9 -5
  48. package/dist/{TablePlugin.native-DrHX-efe.mjs → TablePlugin.native-7d5458c1.mjs} +58 -30
  49. package/dist/{TemplatePlugin.native-CrpfKRJ8.mjs → TemplatePlugin.native-580f0f63.mjs} +32 -17
  50. package/dist/{TextAlignmentPlugin.native-sM_1s00t.mjs → TextAlignmentPlugin.native-9357b3ed.mjs} +11 -6
  51. package/dist/{TextColorPlugin.native-Bwl_bSmc.mjs → TextColorPlugin.native-d53ed459.mjs} +26 -14
  52. package/dist/TrackChangesPlugin.native-e96da509.mjs +818 -0
  53. package/dist/TranslationWorkflowPlugin.native-4e711b1e.mjs +1797 -0
  54. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-8080c998.mjs} +1 -1
  55. package/dist/VersionDiffPlugin.native-5bbeff85.mjs +801 -0
  56. package/dist/_commonjsHelpers-69d58be2.mjs +31 -0
  57. package/dist/{anchoredPopover-Bxds0VoB.mjs → anchoredPopover-5cca53ba.mjs} +1 -1
  58. package/dist/documentManager-8327fb6e.mjs +9166 -0
  59. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +3 -2
  60. package/dist/editora.min.js +14 -13
  61. package/dist/editora.umd.js +14 -13
  62. package/dist/{html2canvas.esm-AYkPY5LS.mjs → html2canvas.esm-c51cb3b9.mjs} +978 -894
  63. package/dist/index-072ef022.js +11 -0
  64. package/dist/index-49d31221.mjs +16860 -0
  65. package/dist/{index-yzU4NdPT.mjs → index-7da30697.mjs} +490 -358
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-b47a189f.mjs +5782 -0
  68. package/dist/index.esm.js +12 -7
  69. package/dist/{jspdf.es.min-BJGtOnRT.mjs → jspdf.es.min-780c82db.mjs} +4808 -3784
  70. package/dist/plugin-loader.js +77 -40
  71. package/dist/{purify.es-CKpwg8Tk.mjs → purify.es-3bdbcfc5.mjs} +20 -10
  72. package/dist/style.css +1 -0
  73. package/dist/webcomponent-core.js +546 -414
  74. package/dist/webcomponent-core.min.css +1 -1
  75. package/dist/webcomponent-core.min.js +40 -39
  76. package/dist/webcomponent.cjs.js +1 -1
  77. package/dist/webcomponent.esm.js +1 -1
  78. package/dist/webcomponent.js +484 -315
  79. package/dist/webcomponent.min.css +1 -1
  80. package/dist/webcomponent.min.js +6035 -558
  81. package/package.json +11 -5
  82. package/dist/_commonjsHelpers-DOllISpa.mjs +0 -32
  83. package/dist/core.css +0 -1
  84. package/dist/documentManager-vQ1VkbUY.mjs +0 -8418
  85. package/dist/index-BpE6GFbz.js +0 -10
  86. package/dist/index-BslAFzmv.mjs +0 -16544
  87. package/dist/index.es-BYD2KEo6.mjs +0 -6666
@@ -0,0 +1,1424 @@
1
+ const A = ".rte-content, .editora-content", P = '.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)", Se = "rte-conditional-content-styles", c = "rte-conditional-dialog-overlay", u = "rte-conditional-floating-toolbar", k = /* @__PURE__ */ new WeakMap(), Ce = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new Map();
2
+ let de = null, me = 0, J = null, X = null, Q = null, ee = null, te = null, oe = null, H = null, y = null, ne = null;
3
+ const ze = {
4
+ dialogTitleInsert: "Insert Conditional Content",
5
+ dialogTitleEdit: "Edit Conditional Content",
6
+ conditionLabel: "Condition",
7
+ conditionPlaceholder: 'user.role == "admin"',
8
+ audienceLabel: "Audience (comma separated)",
9
+ audiencePlaceholder: "all",
10
+ localeLabel: "Locale (comma separated)",
11
+ localePlaceholder: "all",
12
+ elseLabel: "Enable Else Block",
13
+ saveText: "Save",
14
+ cancelText: "Cancel",
15
+ blockIfLabel: "IF",
16
+ blockElseLabel: "ELSE",
17
+ allAudiencesText: "all audiences",
18
+ allLocalesText: "all locales"
19
+ };
20
+ function $(e) {
21
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
22
+ }
23
+ function R(e) {
24
+ return e ? e.split(",").map((t) => t.trim()).filter(Boolean) : [];
25
+ }
26
+ function Te(e) {
27
+ return !e || e.length === 0 ? "" : e.join(", ");
28
+ }
29
+ function ie(e) {
30
+ return e ? e.map((t) => t.trim()).filter(Boolean) : [];
31
+ }
32
+ function Fe(e) {
33
+ return {
34
+ ...ze,
35
+ ...e || {}
36
+ };
37
+ }
38
+ function D(e) {
39
+ return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
40
+ }
41
+ function se(e) {
42
+ return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor") || e;
43
+ }
44
+ function pe(e) {
45
+ if (!e)
46
+ return !1;
47
+ const t = e.getAttribute("data-theme") || e.getAttribute("theme");
48
+ return t && t.toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark");
49
+ }
50
+ function je(e) {
51
+ const t = se(e);
52
+ if (pe(t))
53
+ return !0;
54
+ const o = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
55
+ return pe(o) ? !0 : pe(document.documentElement) || pe(document.body);
56
+ }
57
+ function he(e) {
58
+ if (!e)
59
+ return !1;
60
+ const t = e.getAttribute("data-theme") || e.getAttribute("theme");
61
+ return t && t.toLowerCase() === "acme" ? !0 : e.classList.contains("editora-theme-acme") || e.classList.contains("rte-theme-acme");
62
+ }
63
+ function Ie(e) {
64
+ const t = se(e);
65
+ if (he(t))
66
+ return !0;
67
+ const o = t.closest("[data-theme], [theme], .editora-theme-acme, .rte-theme-acme");
68
+ return he(o) ? !0 : he(document.documentElement) || he(document.body);
69
+ }
70
+ function Ve(e) {
71
+ return je(e) ? "dark" : Ie(e) ? "acme" : "light";
72
+ }
73
+ function xe(e, t) {
74
+ const o = Ve(t);
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");
76
+ }
77
+ function w(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) {
81
+ const n = e.editorElement;
82
+ if (n.matches(A))
83
+ return n;
84
+ const a = n.querySelector(A);
85
+ if (a instanceof HTMLElement)
86
+ return a;
87
+ }
88
+ const o = window.getSelection();
89
+ if (o && o.rangeCount > 0) {
90
+ const n = o.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(A);
91
+ if (r)
92
+ return r;
93
+ }
94
+ const i = document.activeElement;
95
+ if (i) {
96
+ if (i.matches(A))
97
+ return i;
98
+ const n = i.closest(A);
99
+ if (n)
100
+ return n;
101
+ }
102
+ return y && y.isConnected ? y : t ? document.querySelector(A) : null;
103
+ }
104
+ function Ne(e) {
105
+ const t = window.getSelection();
106
+ if (!t || t.rangeCount === 0)
107
+ return null;
108
+ const o = t.getRangeAt(0);
109
+ return e.contains(o.commonAncestorContainer) ? o.cloneRange() : null;
110
+ }
111
+ function Le(e, t) {
112
+ const o = window.getSelection();
113
+ o && (o.removeAllRanges(), o.addRange(t), e.focus({ preventScroll: !0 }));
114
+ }
115
+ function De(e) {
116
+ e.dispatchEvent(new Event("input", { bubbles: !0 }));
117
+ }
118
+ function He(e, t) {
119
+ if (t === e.innerHTML)
120
+ return;
121
+ const o = window.execEditorCommand || window.executeEditorCommand;
122
+ if (typeof o == "function")
123
+ try {
124
+ o("recordDomTransaction", e, t, e.innerHTML);
125
+ } catch (i) {
126
+ }
127
+ }
128
+ function $e(e, t) {
129
+ const o = document.createRange();
130
+ o.selectNodeContents(t), o.collapse(!1), Le(e, o);
131
+ }
132
+ function ve(e, t) {
133
+ if (t)
134
+ return t.split(".").filter(Boolean).reduce((o, i) => {
135
+ if (o != null && typeof o == "object")
136
+ return o[i];
137
+ }, e);
138
+ }
139
+ function We(e) {
140
+ const t = e.trim();
141
+ if (t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'"))
142
+ return t.slice(1, -1);
143
+ if (t === "true")
144
+ return !0;
145
+ if (t === "false")
146
+ return !1;
147
+ if (t === "null")
148
+ return null;
149
+ const o = Number(t);
150
+ if (!Number.isNaN(o) && t !== "")
151
+ return o;
152
+ if (t.startsWith("[") && t.endsWith("]") || t.startsWith("{") && t.endsWith("}"))
153
+ try {
154
+ return JSON.parse(t);
155
+ } catch (i) {
156
+ return t;
157
+ }
158
+ return t;
159
+ }
160
+ function Ze(e, t) {
161
+ const o = e.trim();
162
+ if (!o)
163
+ return !0;
164
+ if (o.startsWith("!")) {
165
+ const x = o.slice(1).trim();
166
+ return !ve(t, x);
167
+ }
168
+ const i = o.match(/^([a-zA-Z_$][\w.$]*)\s*(==|!=|>=|<=|>|<|in|contains|~=)\s*(.+)$/);
169
+ if (!i)
170
+ return !!ve(t, o);
171
+ const [, n, a, r] = i, l = ve(t, n), d = We(r);
172
+ switch (a) {
173
+ case "==":
174
+ return l == d;
175
+ case "!=":
176
+ return l != d;
177
+ case ">":
178
+ return Number(l) > Number(d);
179
+ case "<":
180
+ return Number(l) < Number(d);
181
+ case ">=":
182
+ return Number(l) >= Number(d);
183
+ case "<=":
184
+ return Number(l) <= Number(d);
185
+ case "in":
186
+ return Array.isArray(d) ? d.some((x) => x == l) : typeof d == "string" ? d.split(",").map((x) => x.trim()).includes(String(l)) : !1;
187
+ case "contains":
188
+ case "~=":
189
+ return Array.isArray(l) ? l.some((x) => String(x).toLowerCase() === String(d).toLowerCase()) : typeof l == "string" ? l.toLowerCase().includes(String(d).toLowerCase()) : !1;
190
+ default:
191
+ return !1;
192
+ }
193
+ }
194
+ function Ge() {
195
+ if (typeof document == "undefined" || document.getElementById(Se))
196
+ return;
197
+ const e = document.createElement("style");
198
+ e.id = Se, e.textContent = `
199
+ .rte-conditional-block {
200
+ border: 1px solid #dbe3ec;
201
+ border-radius: 8px;
202
+ margin: 10px 0;
203
+ background: #f8fafc;
204
+ overflow: hidden;
205
+ }
206
+
207
+ .rte-conditional-header,
208
+ .rte-conditional-else-label {
209
+ display: flex;
210
+ align-items: center;
211
+ gap: 8px;
212
+ background: #eef2f7;
213
+ border-bottom: 1px solid #dbe3ec;
214
+ padding: 8px 10px;
215
+ user-select: none;
216
+ }
217
+
218
+ .rte-conditional-else-label {
219
+ border-top: 1px solid #dbe3ec;
220
+ border-bottom: 1px solid #dbe3ec;
221
+ }
222
+
223
+ .rte-conditional-chip {
224
+ display: inline-flex;
225
+ align-items: center;
226
+ justify-content: center;
227
+ min-width: 34px;
228
+ height: 20px;
229
+ border-radius: 999px;
230
+ border: 1px solid #bfdbfe;
231
+ background: #dbeafe;
232
+ color: #1e3a8a;
233
+ font-size: 11px;
234
+ font-weight: 700;
235
+ letter-spacing: 0.03em;
236
+ text-transform: uppercase;
237
+ padding: 0 7px;
238
+ flex: 0 0 auto;
239
+ }
240
+
241
+ .rte-conditional-chip-else {
242
+ border-color: #fecaca;
243
+ background: #fee2e2;
244
+ color: #991b1b;
245
+ }
246
+
247
+ .rte-conditional-summary {
248
+ font-size: 12px;
249
+ color: #0f172a;
250
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
251
+ overflow: hidden;
252
+ text-overflow: ellipsis;
253
+ white-space: nowrap;
254
+ flex: 1;
255
+ }
256
+
257
+ .rte-conditional-meta {
258
+ font-size: 11px;
259
+ color: #64748b;
260
+ white-space: nowrap;
261
+ flex: 0 0 auto;
262
+ }
263
+
264
+ .rte-conditional-body {
265
+ padding: 10px;
266
+ background: #ffffff;
267
+ min-height: 44px;
268
+ }
269
+
270
+ .rte-conditional-hidden {
271
+ display: none !important;
272
+ }
273
+
274
+ .rte-toolbar-group-items.conditional-content,
275
+ .editora-toolbar-group-items.conditional-content {
276
+ display: flex;
277
+ border: 1px solid #cbd5e1;
278
+ border-radius: 6px;
279
+ background: #ffffff;
280
+ }
281
+
282
+ .rte-toolbar-group-items.conditional-content .rte-toolbar-item,
283
+ .editora-toolbar-group-items.conditional-content .editora-toolbar-item {
284
+ display: flex;
285
+ }
286
+
287
+ .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
288
+ .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
289
+ border: none;
290
+ border-right: 1px solid #cbd5e1;
291
+ border-radius: 0;
292
+ }
293
+
294
+ .rte-toolbar-group-items.conditional-content .rte-toolbar-item:last-child .rte-toolbar-button,
295
+ .editora-toolbar-group-items.conditional-content .editora-toolbar-item:last-child .editora-toolbar-button {
296
+ border-right: none;
297
+ }
298
+
299
+ .rte-toolbar-button[data-command="toggleConditionalPreview"].active,
300
+ .editora-toolbar-button[data-command="toggleConditionalPreview"].active {
301
+ background: #ccc;
302
+ }
303
+
304
+ .rte-conditional-block.rte-conditional-preview {
305
+ border-style: dashed;
306
+ }
307
+
308
+ .rte-conditional-block.rte-conditional-preview .rte-conditional-body[contenteditable="false"] {
309
+ cursor: default;
310
+ }
311
+
312
+ .${c} {
313
+ position: fixed;
314
+ inset: 0;
315
+ background: rgba(15, 23, 42, 0.5);
316
+ z-index: 2147483646;
317
+ display: flex;
318
+ align-items: center;
319
+ justify-content: center;
320
+ padding: 20px;
321
+ }
322
+
323
+ .rte-conditional-dialog {
324
+ width: min(560px, 96vw);
325
+ max-height: min(88vh, 760px);
326
+ border: 1px solid #dbe3ec;
327
+ border-radius: 8px;
328
+ background: #ffffff;
329
+ box-shadow: 0 24px 50px rgba(15, 23, 42, 0.25);
330
+ display: flex;
331
+ flex-direction: column;
332
+ overflow: hidden;
333
+ }
334
+
335
+ .rte-conditional-dialog-header,
336
+ .rte-conditional-dialog-footer {
337
+ padding: 12px 14px;
338
+ border-bottom: 1px solid #e2e8f0;
339
+ background: #f8fafc;
340
+ display: flex;
341
+ align-items: center;
342
+ justify-content: space-between;
343
+ gap: 10px;
344
+ }
345
+
346
+ .rte-conditional-dialog-footer {
347
+ border-top: 1px solid #e2e8f0;
348
+ border-bottom: none;
349
+ justify-content: flex-end;
350
+ }
351
+
352
+ .rte-conditional-dialog-title {
353
+ margin: 0;
354
+ font-size: 16px;
355
+ font-weight: 700;
356
+ color: #0f172a;
357
+ }
358
+
359
+ .rte-conditional-dialog-body {
360
+ padding: 14px;
361
+ overflow: auto;
362
+ display: grid;
363
+ grid-template-columns: 1fr;
364
+ gap: 12px;
365
+ }
366
+
367
+ .rte-conditional-field {
368
+ display: grid;
369
+ gap: 6px;
370
+ }
371
+
372
+ .rte-conditional-field label {
373
+ font-size: 12px;
374
+ font-weight: 600;
375
+ color: #334155;
376
+ }
377
+
378
+ .rte-conditional-field input[type="text"] {
379
+ width: 100%;
380
+ min-height: 36px;
381
+ border: 1px solid #cbd5e1;
382
+ border-radius: 6px;
383
+ padding: 8px 10px;
384
+ font-size: 13px;
385
+ line-height: 1.4;
386
+ box-sizing: border-box;
387
+ color: #0f172a;
388
+ background: #ffffff;
389
+ }
390
+
391
+ .rte-conditional-field input[type="text"]:focus-visible,
392
+ .rte-conditional-btn:focus-visible {
393
+ outline: none;
394
+ border-color: #3b82f6;
395
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
396
+ }
397
+
398
+ .rte-conditional-checkbox {
399
+ display: inline-flex;
400
+ align-items: center;
401
+ gap: 8px;
402
+ font-size: 13px;
403
+ color: #334155;
404
+ min-height: 36px;
405
+ }
406
+
407
+ .rte-conditional-help {
408
+ margin: 0;
409
+ font-size: 12px;
410
+ color: #64748b;
411
+ }
412
+
413
+ .rte-conditional-btn {
414
+ border: 1px solid #cbd5e1;
415
+ border-radius: 6px;
416
+ min-height: 34px;
417
+ padding: 6px 12px;
418
+ background: #ffffff;
419
+ color: #0f172a;
420
+ font-size: 13px;
421
+ cursor: pointer;
422
+ }
423
+
424
+ .rte-conditional-btn-primary {
425
+ border-color: #2563eb;
426
+ background: #2563eb;
427
+ color: #ffffff;
428
+ }
429
+
430
+ .rte-conditional-btn-primary:hover {
431
+ background: #1d4ed8;
432
+ }
433
+
434
+ .${u} {
435
+ position: fixed;
436
+ z-index: 2147483645;
437
+ display: none;
438
+ align-items: center;
439
+ gap: 6px;
440
+ padding: 6px;
441
+ border-radius: 8px;
442
+ border: 1px solid #cbd5e1;
443
+ background: rgba(255, 255, 255, 0.98);
444
+ box-shadow: 0 14px 30px rgba(15, 23, 42, 0.2);
445
+ backdrop-filter: blur(6px);
446
+ }
447
+
448
+ .${u}.show {
449
+ display: inline-flex;
450
+ }
451
+
452
+ .${u} .rte-conditional-float-btn {
453
+ border: 1px solid #cbd5e1;
454
+ border-radius: 6px;
455
+ min-height: 30px;
456
+ min-width: 30px;
457
+ padding: 0 8px;
458
+ display: inline-flex;
459
+ align-items: center;
460
+ justify-content: center;
461
+ gap: 6px;
462
+ background: #ffffff;
463
+ color: #0f172a;
464
+ cursor: pointer;
465
+ font-size: 12px;
466
+ line-height: 1;
467
+ }
468
+
469
+ .${u} .rte-conditional-float-btn:hover {
470
+ background: #f8fafc;
471
+ }
472
+
473
+ .${u} .rte-conditional-float-btn[data-action="delete"] {
474
+ border-color: #fecaca;
475
+ color: #991b1b;
476
+ background: #fff5f5;
477
+ }
478
+
479
+ .rte-conditional-preview-on ${P} {
480
+ border-width: 2px;
481
+ }
482
+
483
+ .rte-conditional-preview-on ${P} .rte-conditional-header {
484
+ background: #ecfeff;
485
+ border-color: #bae6fd;
486
+ }
487
+
488
+ ${b} .rte-conditional-block,
489
+ ${h} .rte-conditional-block,
490
+ .${c}.rte-conditional-theme-dark .rte-conditional-block {
491
+ background: #111827;
492
+ border-color: #334155;
493
+ }
494
+
495
+ ${b} .rte-conditional-header,
496
+ ${b} .rte-conditional-else-label,
497
+ ${h} .rte-conditional-header,
498
+ ${h} .rte-conditional-else-label,
499
+ .${c}.rte-conditional-theme-dark .rte-conditional-header,
500
+ .${c}.rte-conditional-theme-dark .rte-conditional-else-label {
501
+ background: #0f172a;
502
+ border-color: #334155;
503
+ }
504
+
505
+ ${b} .rte-conditional-summary,
506
+ ${h} .rte-conditional-summary,
507
+ .${c}.rte-conditional-theme-dark .rte-conditional-summary {
508
+ color: #e2e8f0;
509
+ }
510
+
511
+ ${b} .rte-conditional-meta,
512
+ ${h} .rte-conditional-meta,
513
+ .${c}.rte-conditional-theme-dark .rte-conditional-meta {
514
+ color: #94a3b8;
515
+ }
516
+
517
+ ${b} .rte-conditional-chip,
518
+ ${h} .rte-conditional-chip,
519
+ .${c}.rte-conditional-theme-dark .rte-conditional-chip {
520
+ background: #1e3a8a;
521
+ border-color: #3b82f6;
522
+ color: #dbeafe;
523
+ }
524
+
525
+ ${b} .rte-conditional-chip-else,
526
+ ${h} .rte-conditional-chip-else,
527
+ .${c}.rte-conditional-theme-dark .rte-conditional-chip-else {
528
+ background: #7f1d1d;
529
+ border-color: #ef4444;
530
+ color: #fee2e2;
531
+ }
532
+
533
+ ${b} .rte-conditional-body,
534
+ ${h} .rte-conditional-body,
535
+ .${c}.rte-conditional-theme-dark .rte-conditional-body {
536
+ background: #1f2937;
537
+ color: #e2e8f0;
538
+ }
539
+
540
+ ${b} .rte-conditional-dialog,
541
+ ${h} .rte-conditional-dialog,
542
+ .${c}.rte-conditional-theme-dark .rte-conditional-dialog {
543
+ background: #1f2937;
544
+ border-color: #334155;
545
+ }
546
+
547
+ ${b} .rte-conditional-dialog-header,
548
+ ${b} .rte-conditional-dialog-footer,
549
+ ${h} .rte-conditional-dialog-header,
550
+ ${h} .rte-conditional-dialog-footer,
551
+ .${c}.rte-conditional-theme-dark .rte-conditional-dialog-header,
552
+ .${c}.rte-conditional-theme-dark .rte-conditional-dialog-footer {
553
+ background: #111827;
554
+ border-color: #334155;
555
+ }
556
+
557
+ ${b} .rte-conditional-dialog-title,
558
+ ${b} .rte-conditional-field label,
559
+ ${b} .rte-conditional-checkbox,
560
+ ${h} .rte-conditional-dialog-title,
561
+ ${h} .rte-conditional-field label,
562
+ ${h} .rte-conditional-checkbox,
563
+ .${c}.rte-conditional-theme-dark .rte-conditional-dialog-title,
564
+ .${c}.rte-conditional-theme-dark .rte-conditional-field label,
565
+ .${c}.rte-conditional-theme-dark .rte-conditional-checkbox {
566
+ color: #e2e8f0;
567
+ }
568
+
569
+ ${b} .rte-conditional-help,
570
+ ${h} .rte-conditional-help,
571
+ .${c}.rte-conditional-theme-dark .rte-conditional-help {
572
+ color: #94a3b8;
573
+ }
574
+
575
+ ${b} .rte-conditional-field input[type="text"],
576
+ ${b} .rte-conditional-btn,
577
+ ${h} .rte-conditional-field input[type="text"],
578
+ ${h} .rte-conditional-btn,
579
+ .${c}.rte-conditional-theme-dark .rte-conditional-field input[type="text"],
580
+ .${c}.rte-conditional-theme-dark .rte-conditional-btn {
581
+ background: #0f172a;
582
+ border-color: #475569;
583
+ color: #e2e8f0;
584
+ }
585
+
586
+ ${b} .rte-conditional-btn-primary,
587
+ ${h} .rte-conditional-btn-primary,
588
+ .${c}.rte-conditional-theme-dark .rte-conditional-btn-primary {
589
+ border-color: #3b82f6;
590
+ background: #2563eb;
591
+ color: #ffffff;
592
+ }
593
+
594
+ ${b} .rte-toolbar-group-items.conditional-content,
595
+ .${c}.rte-conditional-theme-dark .rte-toolbar-group-items.conditional-content,
596
+ ${h} .rte-toolbar-group-items.conditional-content,
597
+ ${b} .editora-toolbar-group-items.conditional-content {
598
+ border-color: #566275;
599
+ }
600
+
601
+ ${b} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
602
+ ${h} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
603
+ ${b} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
604
+ border-right-color: #566275;
605
+ }
606
+
607
+ ${b} .${u},
608
+ .${c}.rte-conditional-theme-dark .${u},
609
+ .${u}.rte-conditional-theme-dark {
610
+ background: rgba(17, 24, 39, 0.98);
611
+ border-color: #334155;
612
+ box-shadow: 0 14px 30px rgba(2, 6, 23, 0.5);
613
+ }
614
+
615
+ ${b} .${u} .rte-conditional-float-btn,
616
+ .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn,
617
+ .${u}.rte-conditional-theme-dark .rte-conditional-float-btn {
618
+ background: #0f172a;
619
+ border-color: #475569;
620
+ color: #e2e8f0;
621
+ }
622
+
623
+ ${b} .${u} .rte-conditional-float-btn[data-action="delete"],
624
+ .${c}.rte-conditional-theme-dark .${u} .rte-conditional-float-btn[data-action="delete"],
625
+ .${u}.rte-conditional-theme-dark .rte-conditional-float-btn[data-action="delete"] {
626
+ border-color: #ef4444;
627
+ color: #fecaca;
628
+ background: rgba(127, 29, 29, 0.45);
629
+ }
630
+
631
+ ${f} .rte-conditional-block,
632
+ ${g} .rte-conditional-block,
633
+ .${c}.rte-conditional-theme-acme .rte-conditional-block {
634
+ background: #f8fbff;
635
+ border-color: #cbd8e8;
636
+ }
637
+
638
+ ${f} .rte-conditional-header,
639
+ ${f} .rte-conditional-else-label,
640
+ ${g} .rte-conditional-header,
641
+ ${g} .rte-conditional-else-label,
642
+ .${c}.rte-conditional-theme-acme .rte-conditional-header,
643
+ .${c}.rte-conditional-theme-acme .rte-conditional-else-label {
644
+ background: linear-gradient(180deg, #eef4fb 0%, #e6eef8 100%);
645
+ border-color: #cbd8e8;
646
+ }
647
+
648
+ ${f} .rte-conditional-summary,
649
+ ${g} .rte-conditional-summary,
650
+ .${c}.rte-conditional-theme-acme .rte-conditional-summary {
651
+ color: #0f172a;
652
+ }
653
+
654
+ ${f} .rte-conditional-meta,
655
+ ${g} .rte-conditional-meta,
656
+ .${c}.rte-conditional-theme-acme .rte-conditional-meta {
657
+ color: #587089;
658
+ }
659
+
660
+ ${f} .rte-conditional-chip,
661
+ ${g} .rte-conditional-chip,
662
+ .${c}.rte-conditional-theme-acme .rte-conditional-chip {
663
+ background: #d9f5ee;
664
+ border-color: #66c6b3;
665
+ color: #0f4f4a;
666
+ }
667
+
668
+ ${f} .rte-conditional-chip-else,
669
+ ${g} .rte-conditional-chip-else,
670
+ .${c}.rte-conditional-theme-acme .rte-conditional-chip-else {
671
+ background: #fde8ea;
672
+ border-color: #f1a7b2;
673
+ color: #8b1f2f;
674
+ }
675
+
676
+ ${f} .rte-conditional-body,
677
+ ${g} .rte-conditional-body,
678
+ .${c}.rte-conditional-theme-acme .rte-conditional-body {
679
+ background: #fcfeff;
680
+ color: #0f172a;
681
+ }
682
+
683
+ ${f} .rte-conditional-dialog,
684
+ ${g} .rte-conditional-dialog,
685
+ .${c}.rte-conditional-theme-acme .rte-conditional-dialog {
686
+ background: #ffffff;
687
+ border-color: #cbd8e8;
688
+ box-shadow: 0 20px 44px rgba(15, 23, 42, 0.18);
689
+ }
690
+
691
+ ${f} .rte-conditional-dialog-header,
692
+ ${f} .rte-conditional-dialog-footer,
693
+ ${g} .rte-conditional-dialog-header,
694
+ ${g} .rte-conditional-dialog-footer,
695
+ .${c}.rte-conditional-theme-acme .rte-conditional-dialog-header,
696
+ .${c}.rte-conditional-theme-acme .rte-conditional-dialog-footer {
697
+ background: #f3f8fd;
698
+ border-color: #d8e4f1;
699
+ }
700
+
701
+ ${f} .rte-conditional-dialog-title,
702
+ ${f} .rte-conditional-field label,
703
+ ${f} .rte-conditional-checkbox,
704
+ ${g} .rte-conditional-dialog-title,
705
+ ${g} .rte-conditional-field label,
706
+ ${g} .rte-conditional-checkbox,
707
+ .${c}.rte-conditional-theme-acme .rte-conditional-dialog-title,
708
+ .${c}.rte-conditional-theme-acme .rte-conditional-field label,
709
+ .${c}.rte-conditional-theme-acme .rte-conditional-checkbox {
710
+ color: #1f334a;
711
+ }
712
+
713
+ ${f} .rte-conditional-help,
714
+ ${g} .rte-conditional-help,
715
+ .${c}.rte-conditional-theme-acme .rte-conditional-help {
716
+ color: #5f738d;
717
+ }
718
+
719
+ ${f} .rte-conditional-field input[type="text"],
720
+ ${f} .rte-conditional-btn,
721
+ ${g} .rte-conditional-field input[type="text"],
722
+ ${g} .rte-conditional-btn,
723
+ .${c}.rte-conditional-theme-acme .rte-conditional-field input[type="text"],
724
+ .${c}.rte-conditional-theme-acme .rte-conditional-btn {
725
+ background: #ffffff;
726
+ border-color: #bfd0e2;
727
+ color: #0f172a;
728
+ }
729
+
730
+ ${f} .rte-conditional-btn-primary,
731
+ ${g} .rte-conditional-btn-primary,
732
+ .${c}.rte-conditional-theme-acme .rte-conditional-btn-primary {
733
+ border-color: #0f766e;
734
+ background: #0f766e;
735
+ color: #ffffff;
736
+ }
737
+
738
+ ${f} .rte-toolbar-group-items.conditional-content,
739
+ .${c}.rte-conditional-theme-acme .rte-toolbar-group-items.conditional-content,
740
+ ${g} .rte-toolbar-group-items.conditional-content,
741
+ ${f} .editora-toolbar-group-items.conditional-content {
742
+ border-color: #bfd0e2;
743
+ }
744
+
745
+ ${f} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
746
+ ${g} .rte-toolbar-group-items.conditional-content .rte-toolbar-button,
747
+ ${f} .editora-toolbar-group-items.conditional-content .editora-toolbar-button {
748
+ border-right-color: #bfd0e2;
749
+ }
750
+
751
+ ${f} .${u},
752
+ .${c}.rte-conditional-theme-acme .${u},
753
+ .${u}.rte-conditional-theme-acme {
754
+ background: rgba(255, 255, 255, 0.98);
755
+ border-color: #bfd0e2;
756
+ box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
757
+ }
758
+
759
+ ${f} .${u} .rte-conditional-float-btn,
760
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn,
761
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn {
762
+ background: #ffffff;
763
+ border-color: #bfd0e2;
764
+ color: #1f334a;
765
+ }
766
+
767
+ ${f} .${u} .rte-conditional-float-btn:hover,
768
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn:hover,
769
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn:hover {
770
+ background: #eef7f5;
771
+ color: #0f4f4a;
772
+ }
773
+
774
+ ${f} .${u} .rte-conditional-float-btn[data-action="delete"],
775
+ .${c}.rte-conditional-theme-acme .${u} .rte-conditional-float-btn[data-action="delete"],
776
+ .${u}.rte-conditional-theme-acme .rte-conditional-float-btn[data-action="delete"] {
777
+ border-color: #f1a7b2;
778
+ color: #8b1f2f;
779
+ background: #fff4f6;
780
+ }
781
+ `, document.head.appendChild(e);
782
+ }
783
+ function Ue(e) {
784
+ return {
785
+ defaultCondition: e.defaultCondition || "",
786
+ defaultAudience: ie(e.defaultAudience || []),
787
+ defaultLocale: ie(e.defaultLocale || []),
788
+ enableElseByDefault: e.enableElseByDefault === !0,
789
+ labels: Fe(e.labels),
790
+ context: e.context,
791
+ getContext: e.getContext,
792
+ currentAudience: e.currentAudience,
793
+ currentLocale: e.currentLocale,
794
+ evaluateCondition: e.evaluateCondition || Ze
795
+ };
796
+ }
797
+ function Oe() {
798
+ de && (de.cleanup(), de = null);
799
+ }
800
+ function Ye(e) {
801
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
802
+ }
803
+ function ae(e, t) {
804
+ e.setAttribute("contenteditable", "false"), e.setAttribute("spellcheck", "false");
805
+ const o = e.querySelector(".rte-conditional-header");
806
+ o && (o.setAttribute("contenteditable", "false"), o.setAttribute("tabindex", "0"), o.setAttribute("role", "button"), o.setAttribute("aria-label", "Edit conditional rule"));
807
+ const i = e.querySelector(".rte-conditional-else-label");
808
+ i && i.setAttribute("contenteditable", "false"), Qe(e, !t);
809
+ }
810
+ function Je(e) {
811
+ const t = e.querySelector('.rte-conditional-body[data-slot="if"]');
812
+ if (!t)
813
+ return;
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"]');
815
+ i && o.add(i), o.add(t), n && o.add(n), a && o.add(a), Array.from(e.childNodes).forEach((l) => {
816
+ if (!(l instanceof HTMLElement && o.has(l))) {
817
+ if (l.nodeType === Node.TEXT_NODE && !(l.textContent || "").trim()) {
818
+ l.remove();
819
+ return;
820
+ }
821
+ t.appendChild(l);
822
+ }
823
+ });
824
+ }
825
+ function U(e) {
826
+ const t = window.getSelection();
827
+ if (t && t.rangeCount > 0) {
828
+ const n = t.getRangeAt(0).startContainer, a = n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement, r = a == null ? void 0 : a.closest(P);
829
+ if (r && e.contains(r))
830
+ return r;
831
+ }
832
+ const o = document.activeElement, i = o == null ? void 0 : o.closest(P);
833
+ return i && e.contains(i) ? i : null;
834
+ }
835
+ function Ae(e, t) {
836
+ let o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
837
+ o || (o = document.createElement("div"), o.className = "rte-conditional-else-label", o.setAttribute("contenteditable", "false"), o.innerHTML = `
838
+ <span class="rte-conditional-chip rte-conditional-chip-else">${$(t.blockElseLabel)}</span>
839
+ <span class="rte-conditional-summary">Else branch</span>
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));
841
+ }
842
+ function Xe(e, t) {
843
+ e.setAttribute("data-has-else", t ? "true" : "false");
844
+ const o = e.querySelector(".rte-conditional-else-label"), i = e.querySelector('.rte-conditional-body[data-slot="else"]');
845
+ o && o.classList.toggle("rte-conditional-hidden", !t), i && i.classList.toggle("rte-conditional-hidden", !t);
846
+ }
847
+ function Qe(e, t) {
848
+ Array.from(e.querySelectorAll(".rte-conditional-body")).forEach((i) => {
849
+ i.setAttribute("contenteditable", t ? "true" : "false");
850
+ }), e.setAttribute("contenteditable", "false");
851
+ }
852
+ function we(e, t) {
853
+ const o = e.getAttribute("data-condition") || "", i = R(e.getAttribute("data-audience")), n = R(e.getAttribute("data-locale"));
854
+ let a = e.querySelector(".rte-conditional-header");
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");
856
+ const r = o || "(always true)", l = i.length > 0 ? i.join(", ") : t.allAudiencesText, d = n.length > 0 ? n.join(", ") : t.allLocalesText;
857
+ if (a.innerHTML = `
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>
861
+ `, !e.querySelector('.rte-conditional-body[data-slot="if"]')) {
862
+ const m = document.createElement("div");
863
+ m.className = "rte-conditional-body", m.setAttribute("data-slot", "if"), m.innerHTML = "<p><br></p>", e.insertBefore(m, e.children[1] || null);
864
+ }
865
+ const v = e.getAttribute("data-has-else") === "true";
866
+ v && Ae(e, t), Je(e), Xe(e, v);
867
+ }
868
+ function Pe(e, t) {
869
+ const o = document.createElement("section");
870
+ o.className = "rte-conditional-block", o.setAttribute("data-conditional-content", "true"), o.setAttribute("data-condition", (e.condition || "").trim()), o.setAttribute("data-audience", ie(e.audience).join(",")), o.setAttribute("data-locale", ie(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");
871
+ const i = document.createElement("div");
872
+ i.className = "rte-conditional-header", i.setAttribute("contenteditable", "false");
873
+ const n = document.createElement("div");
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 && Ae(o, t), we(o, t), ae(o, !1), o;
875
+ }
876
+ function et(e, t) {
877
+ if (t)
878
+ try {
879
+ if (!e.isConnected)
880
+ return;
881
+ const o = e.contains(t.startContainer), i = e.contains(t.endContainer);
882
+ if (!o || !i)
883
+ return;
884
+ Le(e, t);
885
+ } catch (o) {
886
+ }
887
+ }
888
+ function tt(e) {
889
+ return (e.textContent || "").replace(/\u200B/g, "").trim().length > 0 ? !0 : e.querySelector("img, video, table, iframe, hr, pre, blockquote, ul, ol") !== null;
890
+ }
891
+ function Re(e, t, o) {
892
+ let i = null;
893
+ if (o)
894
+ try {
895
+ const r = o.cloneRange();
896
+ e.contains(r.commonAncestorContainer) && (i = r);
897
+ } catch (r) {
898
+ i = null;
899
+ }
900
+ i || (i = Ne(e)), i || (i = document.createRange(), i.selectNodeContents(e), i.collapse(!1));
901
+ let n = null;
902
+ i.collapsed || (n = i.extractContents()), i.insertNode(t);
903
+ const a = t.querySelector('.rte-conditional-body[data-slot="if"]');
904
+ a && n && tt(n) && (a.innerHTML = "", a.appendChild(n)), a ? $e(e, a) : $e(e, t), e.normalize();
905
+ }
906
+ function ot(e) {
907
+ return {
908
+ condition: e.getAttribute("data-condition") || "",
909
+ audience: R(e.getAttribute("data-audience")),
910
+ locale: R(e.getAttribute("data-locale")),
911
+ hasElse: e.getAttribute("data-has-else") === "true"
912
+ };
913
+ }
914
+ function nt(e, t, o) {
915
+ e.setAttribute("data-condition", (t.condition || "").trim()), e.setAttribute("data-audience", ie(t.audience).join(",")), e.setAttribute("data-locale", ie(t.locale).join(",")), e.setAttribute("data-has-else", t.hasElse ? "true" : "false"), t.hasElse && Ae(e, o), we(e, o), ae(e, e.classList.contains("rte-conditional-preview"));
916
+ }
917
+ function re(e, t) {
918
+ xe(e, e);
919
+ const o = Array.from(e.querySelectorAll(P)), i = k.get(e) === !0;
920
+ return o.forEach((n) => {
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"), we(n, t), ae(n, i);
922
+ }), o;
923
+ }
924
+ async function it(e, t) {
925
+ const o = Ce.get(e);
926
+ if (o)
927
+ return o;
928
+ if (typeof t.getContext == "function")
929
+ try {
930
+ const i = se(e), n = await Promise.resolve(t.getContext({ editor: e, editorRoot: i }));
931
+ if (n && typeof n == "object")
932
+ return n;
933
+ } catch (i) {
934
+ return {};
935
+ }
936
+ if (typeof t.context == "function")
937
+ try {
938
+ const i = t.context();
939
+ if (i && typeof i == "object")
940
+ return i;
941
+ } catch (i) {
942
+ return {};
943
+ }
944
+ return t.context && typeof t.context == "object" ? t.context : {};
945
+ }
946
+ function ge(e) {
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) : [];
948
+ }
949
+ function Be(e, t) {
950
+ return e.length === 0 || e.includes("all") ? !0 : t.length === 0 ? !1 : e.some((o) => t.includes(o));
951
+ }
952
+ async function Y(e, t, o) {
953
+ var T, ue, B, V;
954
+ const i = t.labels, n = re(e, i);
955
+ if (k.set(e, o), qe(e, o), se(e).classList.toggle("rte-conditional-preview-on", o), !o) {
956
+ n.forEach((p) => {
957
+ p.classList.remove("rte-conditional-preview"), ae(p, !1);
958
+ const M = p.querySelector('.rte-conditional-body[data-slot="if"]'), C = p.querySelector('.rte-conditional-body[data-slot="else"]'), q = p.querySelector(".rte-conditional-else-label"), N = p.getAttribute("data-has-else") === "true";
959
+ M && (M.classList.remove("rte-conditional-hidden"), M.removeAttribute("aria-hidden")), C && (C.classList.toggle("rte-conditional-hidden", !N), C.setAttribute("aria-hidden", N ? "false" : "true")), q && q.classList.toggle("rte-conditional-hidden", !N);
960
+ });
961
+ return;
962
+ }
963
+ const r = await it(e, t), l = ge(t.currentAudience), d = ge(t.currentLocale), x = ge(
964
+ (ue = r.audience) != null ? ue : (T = r.user) == null ? void 0 : T.audience
965
+ ), v = ge(
966
+ (V = r.locale) != null ? V : (B = r.user) == null ? void 0 : B.locale
967
+ ), m = l.length > 0 ? l : x, S = d.length > 0 ? d : v;
968
+ n.forEach((p) => {
969
+ const M = p.getAttribute("data-condition") || "", C = R(p.getAttribute("data-audience")).map((s) => s.toLowerCase()), q = R(p.getAttribute("data-locale")).map((s) => s.toLowerCase()), N = p.getAttribute("data-has-else") === "true", Ee = t.evaluateCondition(M, r), fe = Be(C, m), be = Be(q, S), K = Ee && fe && be, W = p.querySelector('.rte-conditional-body[data-slot="if"]'), Z = p.querySelector('.rte-conditional-body[data-slot="else"]'), le = p.querySelector(".rte-conditional-else-label");
970
+ if (p.classList.add("rte-conditional-preview"), ae(p, !0), W && (W.classList.toggle("rte-conditional-hidden", !K), W.setAttribute("aria-hidden", K ? "false" : "true")), Z) {
971
+ const s = N && !K;
972
+ Z.classList.toggle("rte-conditional-hidden", !s), Z.setAttribute("aria-hidden", s ? "false" : "true");
973
+ }
974
+ if (le) {
975
+ const s = N && !K;
976
+ le.classList.toggle("rte-conditional-hidden", !s);
977
+ }
978
+ });
979
+ }
980
+ function qe(e, t) {
981
+ const o = se(e);
982
+ Array.from(
983
+ o.querySelectorAll('[data-command="toggleConditionalPreview"], [data-command="conditionalPreview"]')
984
+ ).forEach((n) => {
985
+ n.setAttribute("data-active", t ? "true" : "false"), n.classList.toggle("active", t), n.setAttribute("aria-pressed", t ? "true" : "false");
986
+ });
987
+ }
988
+ function at(e) {
989
+ const t = j.get(e);
990
+ if (t && t.isConnected)
991
+ return t;
992
+ const o = document.createElement("div");
993
+ return o.className = u, o.setAttribute("role", "toolbar"), o.setAttribute("aria-label", "Conditional block actions"), o.innerHTML = `
994
+ <button type="button" class="rte-conditional-float-btn" data-action="edit" title="Edit Condition" aria-label="Edit Condition">
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>
996
+ </button>
997
+ <button type="button" class="rte-conditional-float-btn" data-action="delete" title="Delete Block" aria-label="Delete Block">
998
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8 4h8l1 2h4v2H3V6h4l1-2Zm1 6h2v8H9v-8Zm4 0h2v8h-2v-8Z" fill="currentColor"></path></svg>
999
+ </button>
1000
+ `, o.addEventListener("mousedown", (i) => {
1001
+ i.preventDefault();
1002
+ }), o.addEventListener("click", (i) => {
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;
1007
+ const r = E.get(e) || ne;
1008
+ if (!r)
1009
+ return;
1010
+ const l = I.get(e);
1011
+ if (!(!l || !e.contains(l))) {
1012
+ if (a === "edit") {
1013
+ L(e, r, "edit", void 0, l);
1014
+ return;
1015
+ }
1016
+ a === "delete" && (_e(e, l), I.set(e, null), F(e));
1017
+ }
1018
+ }), document.body.appendChild(o), j.set(e, o), o;
1019
+ }
1020
+ function F(e) {
1021
+ const t = j.get(e);
1022
+ t && t.classList.remove("show");
1023
+ }
1024
+ function Ke(e, t) {
1025
+ const o = t.getBoundingClientRect();
1026
+ e.style.left = "0px", e.style.top = "0px", e.classList.add("show");
1027
+ const i = e.getBoundingClientRect(), n = 8, a = window.innerWidth, r = window.innerHeight;
1028
+ let l = o.top - i.height - n;
1029
+ l < n && (l = o.bottom + n), l = Math.min(l, r - i.height - n);
1030
+ let d = o.right - i.width;
1031
+ d = Math.max(n, Math.min(d, a - i.width - n)), e.style.left = `${d}px`, e.style.top = `${l}px`;
1032
+ }
1033
+ function ye(e, t) {
1034
+ const o = at(e);
1035
+ xe(o, e), I.set(e, t), Ke(o, t);
1036
+ }
1037
+ function O(e) {
1038
+ const t = E.get(e) || ne;
1039
+ if (!t)
1040
+ return;
1041
+ const o = U(e);
1042
+ if (!o || !e.contains(o) || D(e)) {
1043
+ I.set(e, null), F(e);
1044
+ return;
1045
+ }
1046
+ re(e, t.labels), ye(e, o);
1047
+ }
1048
+ function rt() {
1049
+ j.forEach((e, t) => {
1050
+ if (!t.isConnected || !e.isConnected) {
1051
+ e.remove(), j.delete(t), I.delete(t);
1052
+ return;
1053
+ }
1054
+ if (!e.classList.contains("show"))
1055
+ return;
1056
+ xe(e, t);
1057
+ const o = I.get(t);
1058
+ if (!o || !t.contains(o)) {
1059
+ F(t);
1060
+ return;
1061
+ }
1062
+ Ke(e, o);
1063
+ });
1064
+ }
1065
+ function _e(e, t) {
1066
+ if (!e.contains(t))
1067
+ return !1;
1068
+ const o = e.innerHTML, i = t.parentNode, n = t.nextSibling;
1069
+ t.remove(), i === e && e.innerHTML.trim() === "" && (e.innerHTML = "<p><br></p>");
1070
+ const a = document.createRange();
1071
+ return n && e.contains(n) ? a.setStartBefore(n) : (a.selectNodeContents(e), a.collapse(!1)), a.collapse(!0), Le(e, a), De(e), He(e, o), !0;
1072
+ }
1073
+ function Me(e, t, o) {
1074
+ const i = e.cloneRange(), n = document.createRange();
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;
1076
+ }
1077
+ function L(e, t, o, i, n) {
1078
+ var K, W, Z, le;
1079
+ Oe();
1080
+ const a = t.labels, r = o === "insert" ? Ne(e) : null, l = document.createElement("div");
1081
+ l.className = c, xe(l, e);
1082
+ const d = document.createElement("section");
1083
+ d.className = "rte-conditional-dialog", d.setAttribute("role", "dialog"), d.setAttribute("aria-modal", "true"), d.setAttribute("aria-labelledby", "rte-conditional-dialog-title");
1084
+ const x = n ? ot(n) : void 0, v = i || x || {}, m = (K = v.condition) != null ? K : t.defaultCondition, S = (W = v.audience) != null ? W : t.defaultAudience, T = (Z = v.locale) != null ? Z : t.defaultLocale, ue = (le = v.hasElse) != null ? le : t.enableElseByDefault;
1085
+ d.innerHTML = `
1086
+ <header class="rte-conditional-dialog-header">
1087
+ <h2 id="rte-conditional-dialog-title" class="rte-conditional-dialog-title">${$(
1088
+ o === "edit" ? a.dialogTitleEdit : a.dialogTitleInsert
1089
+ )}</h2>
1090
+ <button type="button" class="rte-conditional-btn" data-action="cancel" aria-label="${$(a.cancelText)}">✕</button>
1091
+ </header>
1092
+ <div class="rte-conditional-dialog-body">
1093
+ <div class="rte-conditional-field">
1094
+ <label for="rte-conditional-condition">${$(a.conditionLabel)}</label>
1095
+ <input id="rte-conditional-condition" class="rte-conditional-input-condition" type="text" value="${$(
1096
+ m || ""
1097
+ )}" placeholder="${$(a.conditionPlaceholder)}" />
1098
+ </div>
1099
+ <div class="rte-conditional-field">
1100
+ <label for="rte-conditional-audience">${$(a.audienceLabel)}</label>
1101
+ <input id="rte-conditional-audience" class="rte-conditional-input-audience" type="text" value="${$(
1102
+ Te(S)
1103
+ )}" placeholder="${$(a.audiencePlaceholder)}" />
1104
+ </div>
1105
+ <div class="rte-conditional-field">
1106
+ <label for="rte-conditional-locale">${$(a.localeLabel)}</label>
1107
+ <input id="rte-conditional-locale" class="rte-conditional-input-locale" type="text" value="${$(
1108
+ Te(T)
1109
+ )}" placeholder="${$(a.localePlaceholder)}" />
1110
+ </div>
1111
+ <label class="rte-conditional-checkbox">
1112
+ <input class="rte-conditional-input-else" type="checkbox" ${ue ? "checked" : ""} />
1113
+ <span>${$(a.elseLabel)}</span>
1114
+ </label>
1115
+ <p class="rte-conditional-help">Example condition: <code>user.role == "admin"</code>, <code>locale == "en-US"</code>, <code>!feature.beta</code></p>
1116
+ </div>
1117
+ <footer class="rte-conditional-dialog-footer">
1118
+ <button type="button" class="rte-conditional-btn" data-action="cancel">${$(a.cancelText)}</button>
1119
+ <button type="button" class="rte-conditional-btn rte-conditional-btn-primary" data-action="save">${$(a.saveText)}</button>
1120
+ </footer>
1121
+ `, l.appendChild(d), document.body.appendChild(l);
1122
+ const B = d.querySelector(".rte-conditional-input-condition"), V = d.querySelector(".rte-conditional-input-audience"), p = d.querySelector(".rte-conditional-input-locale"), M = d.querySelector(".rte-conditional-input-else"), C = () => {
1123
+ l.removeEventListener("click", N), l.removeEventListener("keydown", be, !0), document.removeEventListener("keydown", q, !0), l.parentNode && l.parentNode.removeChild(l), de = null, e.focus({ preventScroll: !0 }), O(e);
1124
+ }, q = (s) => {
1125
+ s.key === "Escape" && (s.preventDefault(), s.stopPropagation(), C());
1126
+ }, N = (s) => {
1127
+ s.target === l && C();
1128
+ }, Ee = (s) => {
1129
+ if (s.key !== "Tab")
1130
+ return;
1131
+ const _ = Array.from(
1132
+ d.querySelectorAll('button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')
1133
+ );
1134
+ if (_.length === 0)
1135
+ return;
1136
+ const G = _[0], ce = _[_.length - 1], z = document.activeElement;
1137
+ if (s.shiftKey && z === G) {
1138
+ s.preventDefault(), ce.focus();
1139
+ return;
1140
+ }
1141
+ !s.shiftKey && z === ce && (s.preventDefault(), G.focus());
1142
+ }, fe = async () => {
1143
+ var ce;
1144
+ const s = {
1145
+ condition: ((ce = B == null ? void 0 : B.value) == null ? void 0 : ce.trim()) || "",
1146
+ audience: R(V == null ? void 0 : V.value),
1147
+ locale: R(p == null ? void 0 : p.value),
1148
+ hasElse: (M == null ? void 0 : M.checked) || !1
1149
+ }, _ = e.innerHTML;
1150
+ if (n)
1151
+ nt(n, s, a), ae(n, k.get(e) === !0);
1152
+ else {
1153
+ et(e, r);
1154
+ const z = Pe(s, a);
1155
+ try {
1156
+ Re(e, z);
1157
+ } catch (ut) {
1158
+ e.appendChild(z);
1159
+ const ke = z.querySelector('.rte-conditional-body[data-slot="if"]');
1160
+ ke ? $e(e, ke) : $e(e, z);
1161
+ }
1162
+ }
1163
+ k.get(e) === !0 && await Y(e, t, !0), De(e), He(e, _), O(e), C();
1164
+ }, be = (s) => {
1165
+ if (s.key === "Escape") {
1166
+ s.preventDefault(), C();
1167
+ return;
1168
+ }
1169
+ Ee(s), s.key === "Enter" && !s.shiftKey && s.target instanceof HTMLInputElement && (s.preventDefault(), fe());
1170
+ };
1171
+ d.addEventListener("click", (s) => {
1172
+ const G = s.target.getAttribute("data-action");
1173
+ if (G === "cancel") {
1174
+ C();
1175
+ return;
1176
+ }
1177
+ G === "save" && fe();
1178
+ }), l.addEventListener("click", N), l.addEventListener("keydown", be, !0), document.addEventListener("keydown", q, !0), de = { cleanup: C }, B == null || B.focus();
1179
+ }
1180
+ function lt(e) {
1181
+ 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");
1182
+ return a || r;
1183
+ }
1184
+ function ct(e) {
1185
+ 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");
1186
+ return a || r;
1187
+ }
1188
+ function dt(e) {
1189
+ ne = e, X || (X = (t) => {
1190
+ const o = t.target, i = o == null ? void 0 : o.closest(A);
1191
+ if (!i)
1192
+ return;
1193
+ y = i, E.has(i) || E.set(i, e);
1194
+ const n = E.get(i) || e;
1195
+ re(i, n.labels), qe(i, k.get(i) === !0), O(i);
1196
+ }, document.addEventListener("focusin", X, !0)), J || (J = (t) => {
1197
+ var v;
1198
+ if (document.querySelector(`.${c}`))
1199
+ return;
1200
+ const i = t.target;
1201
+ if (!!(i != null && i.closest("input, textarea, select")))
1202
+ return;
1203
+ const r = (i == null ? void 0 : i.closest(A)) || w(void 0, !1) || y;
1204
+ if (!r || D(r))
1205
+ return;
1206
+ const l = E.get(r) || ne || e, d = document.activeElement, x = (i == null ? void 0 : i.closest(".rte-conditional-header")) || (d == null ? void 0 : d.closest(".rte-conditional-header"));
1207
+ if (x && (t.key === "Enter" || t.key === " ")) {
1208
+ const m = x.closest(P);
1209
+ if (m && r.contains(m)) {
1210
+ t.preventDefault(), t.stopPropagation(), L(r, l, "edit", void 0, m);
1211
+ return;
1212
+ }
1213
+ }
1214
+ if (lt(t)) {
1215
+ t.preventDefault(), t.stopPropagation();
1216
+ const m = U(r);
1217
+ m ? L(r, l, "edit", void 0, m) : L(r, l, "insert");
1218
+ return;
1219
+ }
1220
+ if (ct(t)) {
1221
+ t.preventDefault(), t.stopPropagation();
1222
+ const m = k.get(r) !== !0;
1223
+ Y(r, l, m), O(r);
1224
+ return;
1225
+ }
1226
+ if ((t.key === "Backspace" || t.key === "Delete") && !t.altKey && !t.ctrlKey && !t.metaKey) {
1227
+ const m = window.getSelection();
1228
+ if (!m || m.rangeCount === 0)
1229
+ return;
1230
+ const S = m.getRangeAt(0);
1231
+ if (!S.collapsed || !r.contains(S.commonAncestorContainer))
1232
+ return;
1233
+ const T = (v = Ye(S.startContainer)) == null ? void 0 : v.closest(".rte-conditional-body");
1234
+ if (!T || !r.contains(T))
1235
+ return;
1236
+ if (t.key === "Backspace" && Me(S, T, "start")) {
1237
+ t.preventDefault();
1238
+ return;
1239
+ }
1240
+ if (t.key === "Delete" && Me(S, T, "end")) {
1241
+ t.preventDefault();
1242
+ return;
1243
+ }
1244
+ }
1245
+ }, document.addEventListener("keydown", J, !0)), ee || (ee = (t) => {
1246
+ const o = t.target;
1247
+ if (!o || o.closest(`.${u}`))
1248
+ return;
1249
+ const i = o.closest(A);
1250
+ if (!i) {
1251
+ y && F(y);
1252
+ return;
1253
+ }
1254
+ if (D(i))
1255
+ return;
1256
+ y = i, E.has(i) || E.set(i, e);
1257
+ const n = o.closest(P);
1258
+ if (!n) {
1259
+ F(i);
1260
+ return;
1261
+ }
1262
+ requestAnimationFrame(() => {
1263
+ !i.isConnected || !i.contains(n) || ye(i, n);
1264
+ });
1265
+ }, document.addEventListener("mousedown", ee, !0)), Q || (Q = (t) => {
1266
+ const o = t.target;
1267
+ if (!o || o.closest(`.${u}`))
1268
+ return;
1269
+ const i = o.closest(A);
1270
+ if (!i) {
1271
+ y && F(y);
1272
+ return;
1273
+ }
1274
+ if (D(i))
1275
+ return;
1276
+ y = i, E.has(i) || E.set(i, e);
1277
+ const n = E.get(i) || e, a = o.closest(P), r = !!o.closest(".rte-conditional-header, .rte-conditional-summary, .rte-conditional-meta, .rte-conditional-else-label");
1278
+ if (a && r) {
1279
+ t.preventDefault(), t.stopPropagation(), L(i, n, "edit", void 0, a), ye(i, a);
1280
+ return;
1281
+ }
1282
+ a ? ye(i, a) : F(i);
1283
+ }, document.addEventListener("click", Q, !0)), te || (te = () => {
1284
+ const t = w(void 0, !1) || y;
1285
+ t && t.isConnected && O(t);
1286
+ }, document.addEventListener("selectionchange", te)), oe || (oe = (t) => {
1287
+ const o = t.target, i = o == null ? void 0 : o.closest(A);
1288
+ if (!i)
1289
+ return;
1290
+ const n = E.get(i) || ne || e;
1291
+ re(i, n.labels), O(i);
1292
+ }, document.addEventListener("input", oe, !0)), H || (H = () => {
1293
+ rt();
1294
+ }, window.addEventListener("scroll", H, !0), window.addEventListener("resize", H));
1295
+ }
1296
+ function st() {
1297
+ X && (document.removeEventListener("focusin", X, !0), X = null), J && (document.removeEventListener("keydown", J, !0), J = null), Q && (document.removeEventListener("click", Q, !0), Q = null), ee && (document.removeEventListener("mousedown", ee, !0), ee = null), te && (document.removeEventListener("selectionchange", te), te = null), oe && (document.removeEventListener("input", oe, !0), oe = null), H && (window.removeEventListener("scroll", H, !0), window.removeEventListener("resize", H), H = null), j.forEach((e) => {
1298
+ e.remove();
1299
+ }), j.clear(), I.clear(), ne = null, y = null;
1300
+ }
1301
+ const ft = (e = {}) => {
1302
+ const t = Ue(e);
1303
+ return Ge(), {
1304
+ name: "conditionalContent",
1305
+ toolbar: [
1306
+ {
1307
+ id: "conditionalContentGroup",
1308
+ label: "Conditional Content",
1309
+ type: "group",
1310
+ command: "conditionalContent",
1311
+ items: [
1312
+ {
1313
+ id: "conditionalContent",
1314
+ label: "Conditional Rule",
1315
+ command: "openConditionalDialog",
1316
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 5h12a1 1 0 0 1 1 1v3h-2V7H7v3H5V6a1 1 0 0 1 1-1Zm-1 9h2v3h10v-3h2v4a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1v-4Zm3-2a1 1 0 0 1 1-1h2.6l1.8-2.4a1 1 0 1 1 1.6 1.2L13.8 11H15a1 1 0 1 1 0 2h-2.7l-1.9 2.5a1 1 0 1 1-1.6-1.2L10.1 13H9a1 1 0 0 1-1-1Z" fill="currentColor"></path></svg>',
1317
+ shortcut: "Mod-Alt-Shift-c"
1318
+ },
1319
+ {
1320
+ id: "conditionalPreview",
1321
+ label: "Conditional Preview",
1322
+ command: "toggleConditionalPreview",
1323
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 6h16a1 1 0 0 1 1 1v3h-2V8H5v8h14v-2h2v3a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1Zm5 3h2v2H9V9Zm0 4h2v2H9v-2Zm4-4h6v2h-6V9Zm0 4h6v2h-6v-2Z" fill="currentColor"></path></svg>',
1324
+ shortcut: "Mod-Alt-Shift-p"
1325
+ }
1326
+ ]
1327
+ }
1328
+ ],
1329
+ commands: {
1330
+ conditionalContent: (o, i) => {
1331
+ const n = w(i);
1332
+ if (!n || D(n))
1333
+ return !1;
1334
+ y = n, E.set(n, t), re(n, t.labels);
1335
+ const a = o == null ? void 0 : o.target;
1336
+ if (a === "insert")
1337
+ return L(n, t, "insert", o), !0;
1338
+ const r = U(n);
1339
+ return a === "edit" || r ? !r && a === "edit" ? !1 : (L(n, t, "edit", o, r || void 0), !0) : (L(n, t, "insert", o), !0);
1340
+ },
1341
+ openConditionalDialog: (o, i) => {
1342
+ const n = w(i);
1343
+ if (!n || D(n))
1344
+ return !1;
1345
+ y = n, E.set(n, t), re(n, t.labels);
1346
+ const a = o == null ? void 0 : o.target;
1347
+ if (a === "insert")
1348
+ return L(n, t, "insert", o), !0;
1349
+ const r = U(n);
1350
+ return a === "edit" || r ? !r && a === "edit" ? !1 : (L(n, t, "edit", o, r || void 0), !0) : (L(n, t, "insert", o), !0);
1351
+ },
1352
+ conditionalPreview: async (o, i) => {
1353
+ const n = w(i);
1354
+ if (!n)
1355
+ return !1;
1356
+ y = n, E.set(n, t);
1357
+ const a = typeof o == "boolean" ? o : k.get(n) !== !0;
1358
+ return await Y(n, t, a), O(n), !0;
1359
+ },
1360
+ editConditionalBlock: (o, i) => {
1361
+ const n = w(i);
1362
+ if (!n || D(n))
1363
+ return !1;
1364
+ y = n, E.set(n, t);
1365
+ const a = U(n);
1366
+ return a ? (L(n, t, "edit", o, a), !0) : !1;
1367
+ },
1368
+ deleteConditionalBlock: (o, i) => {
1369
+ const n = w(i);
1370
+ if (!n || D(n))
1371
+ return !1;
1372
+ const a = U(n);
1373
+ if (!a)
1374
+ return !1;
1375
+ const r = _e(n, a);
1376
+ return r && O(n), r;
1377
+ },
1378
+ insertConditionalBlock: (o, i) => {
1379
+ var d, x, v, m;
1380
+ const n = w(i);
1381
+ if (!n || D(n))
1382
+ return !1;
1383
+ y = n, E.set(n, t);
1384
+ const a = {
1385
+ condition: (d = o == null ? void 0 : o.condition) != null ? d : t.defaultCondition,
1386
+ audience: (x = o == null ? void 0 : o.audience) != null ? x : t.defaultAudience,
1387
+ locale: (v = o == null ? void 0 : o.locale) != null ? v : t.defaultLocale,
1388
+ hasElse: (m = o == null ? void 0 : o.hasElse) != null ? m : t.enableElseByDefault
1389
+ }, r = Pe(a, t.labels);
1390
+ return Re(n, r), k.get(n) === !0 && Y(n, t, !0), !0;
1391
+ },
1392
+ toggleConditionalPreview: async (o, i) => {
1393
+ const n = w(i);
1394
+ if (!n)
1395
+ return !1;
1396
+ y = n, E.set(n, t);
1397
+ const a = typeof o == "boolean" ? o : k.get(n) !== !0;
1398
+ return await Y(n, t, a), !0;
1399
+ },
1400
+ setConditionalContext: (o, i) => {
1401
+ const n = w(i);
1402
+ return n ? (y = n, !o || typeof o != "object" ? Ce.delete(n) : Ce.set(n, o), k.get(n) === !0 && Y(n, t, !0), !0) : !1;
1403
+ }
1404
+ },
1405
+ keymap: {
1406
+ "Mod-Alt-Shift-c": "openConditionalDialog",
1407
+ "Mod-Alt-Shift-C": "openConditionalDialog",
1408
+ "Mod-Alt-Shift-p": "toggleConditionalPreview",
1409
+ "Mod-Alt-Shift-P": "toggleConditionalPreview",
1410
+ F9: "openConditionalDialog",
1411
+ F10: "toggleConditionalPreview"
1412
+ },
1413
+ init: () => {
1414
+ me += 1, dt(t);
1415
+ },
1416
+ destroy: () => {
1417
+ me = Math.max(0, me - 1), me === 0 && (Oe(), st());
1418
+ }
1419
+ };
1420
+ };
1421
+ export {
1422
+ ft as ConditionalContentPlugin
1423
+ };
1424
+ //# sourceMappingURL=ConditionalContentPlugin.native-4983143a.mjs.map