@editora/core 1.0.6 → 1.0.8

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 (60) hide show
  1. package/LICENSE +21 -0
  2. package/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
  3. package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
  4. package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
  5. package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
  6. package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
  7. package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
  8. package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
  9. package/dist/ConditionalContentPlugin.native-CfhY46rU.mjs +1367 -0
  10. package/dist/ContentRulesPlugin.native-nBLQ8QFZ.mjs +1099 -0
  11. package/dist/DataBindingPlugin.native-jQ1JPRTp.mjs +917 -0
  12. package/dist/DocSchemaPlugin.native-CHOge18O.mjs +1325 -0
  13. package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
  14. package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
  15. package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
  16. package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
  17. package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
  18. package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
  19. package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
  20. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
  21. package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
  22. package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +86 -77
  23. package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +30 -30
  24. package/dist/SlashCommandsPlugin.native-CmxvMEaE.mjs +755 -0
  25. package/dist/SmartPastePlugin.native-BOKKtF07.mjs +1398 -0
  26. package/dist/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
  27. package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
  28. package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
  29. package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
  30. package/dist/TrackChangesPlugin.native-Bghu2q4a.mjs +761 -0
  31. package/dist/TranslationWorkflowPlugin.native-Bz6jDGvj.mjs +1728 -0
  32. package/dist/VersionDiffPlugin.native-Bvxgy--t.mjs +776 -0
  33. package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
  34. package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
  35. package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
  36. package/dist/editora.min.js +13 -13
  37. package/dist/editora.umd.js +13 -13
  38. package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
  39. package/dist/index-BslAFzmv.mjs +16544 -0
  40. package/dist/index-D1LOqg5C.js +10 -0
  41. package/dist/{index-OwnkG39N.mjs → index-DqC57IEH.mjs} +438 -328
  42. package/dist/index.cjs.js +1 -1
  43. package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
  44. package/dist/index.esm.js +2 -2
  45. package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
  46. package/dist/plugin-loader.js +77 -40
  47. package/dist/webcomponent-core.js +456 -346
  48. package/dist/webcomponent-core.min.css +1 -1
  49. package/dist/webcomponent-core.min.js +87 -107
  50. package/dist/webcomponent.cjs.js +1 -1
  51. package/dist/webcomponent.esm.js +1 -1
  52. package/dist/webcomponent.js +503 -356
  53. package/dist/webcomponent.min.css +1 -1
  54. package/dist/webcomponent.min.js +6003 -658
  55. package/package.json +2 -2
  56. package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
  57. package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
  58. package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
  59. package/dist/documentManager-irzj9n3V.mjs +0 -37627
  60. package/dist/index-CqWQFb3D.js +0 -10
@@ -0,0 +1,1327 @@
1
+ const L = ".rte-content, .editora-content", fe = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ye = "__editoraCommandEditorRoot", he = "rte-blocks-library-styles", u = "rte-blocks-library-panel", E = "blocks-library", $ = "blocksLibrary", T = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)';
2
+ const Ce = /* @__PURE__ */ new Set(["script", "style", "meta", "link", "object", "embed", "iframe"]), Pe = /^(https?:|mailto:|tel:|#|\/)/i, De = /^data:image\/(?:png|gif|jpeg|jpg|webp);base64,/i, Oe = {
3
+ panelTitle: "Blocks Library",
4
+ panelAriaLabel: "Blocks library panel",
5
+ searchLabel: "Search blocks",
6
+ searchPlaceholder: "Search by name, category, or keyword",
7
+ categoryLabel: "Category",
8
+ allCategoriesText: "All categories",
9
+ recentHeading: "Recent inserts",
10
+ insertText: "Insert Selected",
11
+ closeText: "Close",
12
+ noResultsText: "No matching blocks found.",
13
+ summaryPrefix: "Blocks",
14
+ loadingText: "Loading blocks...",
15
+ loadErrorText: "Unable to load blocks right now.",
16
+ readonlyMessage: "Editor is read-only. Block insertion is disabled.",
17
+ shortcutText: "Shortcuts: Ctrl/Cmd+Alt+Shift+B (panel), Ctrl/Cmd+Alt+Shift+L (insert last)",
18
+ helperText: "Use Arrow keys to move through blocks, Enter to insert, Esc to close.",
19
+ lastInsertedPrefix: "Last inserted",
20
+ resultsListLabel: "Block results"
21
+ }, b = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), w = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), O = /* @__PURE__ */ new WeakMap(), j = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new WeakMap(), oe = /* @__PURE__ */ new Set();
22
+ let X = 0, Ne = 0, ke = 0, A = null, y = null, _ = null, P = null, I = null, D = null;
23
+ function m(e) {
24
+ return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
25
+ }
26
+ function Ke(e) {
27
+ return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
28
+ }
29
+ function je(e) {
30
+ return e.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
31
+ }
32
+ function ce(e) {
33
+ const t = e.trim();
34
+ return t && (Pe.test(t) || De.test(t)) ? t : "";
35
+ }
36
+ function xe(e) {
37
+ let t = e;
38
+ return Ce.forEach((r) => {
39
+ const o = new RegExp(`<${r}[\\s\\S]*?>[\\s\\S]*?<\\/${r}>`, "gi"), l = new RegExp(`<${r}\\b[^>]*\\/?>`, "gi");
40
+ t = t.replace(o, "").replace(l, "");
41
+ }), t = t.replace(/\son\w+=(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi, "").replace(/\s(xmlns|xml:[^=\s>]+)\s*=\s*(\"[^\"]*\"|'[^']*'|[^\s>]+)/gi, "").replace(
42
+ /\s(href|src|xlink:href)\s*=\s*("|\')\s*(?:javascript:|vbscript:|data:text\/html)[^"']*\2/gi,
43
+ ""
44
+ ).replace(/\s(href|src|xlink:href)\s*=\s*(?:javascript:|vbscript:|data:text\/html)[^\s>]*/gi, "").replace(
45
+ /\s(href|src|xlink:href)\s*=\s*("([^"]*)"|'([^']*)')/gi,
46
+ (r, o, l, n, a) => {
47
+ const s = typeof n == "string" && n.length > 0 ? n : a || "", i = ce(s);
48
+ if (!i) return "";
49
+ const c = l.startsWith('"') ? '"' : "'";
50
+ return ` ${o}=${c}${i}${c}`;
51
+ }
52
+ ).replace(/\s(href|src|xlink:href)\s*=\s*([^\s>]+)/gi, (r, o, l) => {
53
+ const n = ce(l);
54
+ return n ? ` ${o}="${n}"` : "";
55
+ }).replace(/\sstyle\s*=\s*("([^"]*)"|'([^']*)')/gi, (r, o, l, n) => {
56
+ const a = typeof l == "string" && l.length > 0 ? l : n || "";
57
+ if (/expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(a))
58
+ return "";
59
+ const s = o.startsWith('"') ? '"' : "'";
60
+ return ` style=${s}${a}${s}`;
61
+ }).trim(), t;
62
+ }
63
+ function We(e) {
64
+ if (!e) return "";
65
+ if (typeof document == "undefined")
66
+ return xe(e);
67
+ const t = document.createElement("template");
68
+ t.innerHTML = e;
69
+ const r = t.content;
70
+ return !r || typeof r.querySelectorAll != "function" ? xe(e) : (Array.from(r.querySelectorAll("*")).forEach((l) => {
71
+ const n = l.tagName.toLowerCase();
72
+ if (Ce.has(n)) {
73
+ l.remove();
74
+ return;
75
+ }
76
+ Array.from(l.attributes).forEach((s) => {
77
+ const i = s.name.toLowerCase(), c = s.value;
78
+ if (i.startsWith("on")) {
79
+ l.removeAttribute(s.name);
80
+ return;
81
+ }
82
+ if (i === "style") {
83
+ /expression\s*\(|javascript\s*:|vbscript\s*:|url\s*\(/i.test(c) && l.removeAttribute(s.name);
84
+ return;
85
+ }
86
+ if (i === "href" || i === "src" || i === "xlink:href") {
87
+ const d = ce(c);
88
+ if (!d) {
89
+ l.removeAttribute(s.name);
90
+ return;
91
+ }
92
+ d !== c && l.setAttribute(s.name, d);
93
+ }
94
+ });
95
+ }), t.innerHTML.trim());
96
+ }
97
+ function ne(e) {
98
+ return e.trim().toLowerCase();
99
+ }
100
+ function Fe(e) {
101
+ if (!e) return "";
102
+ if (typeof document == "undefined")
103
+ return e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
104
+ const t = document.createElement("template");
105
+ t.innerHTML = e;
106
+ const r = t.content;
107
+ return !r || typeof r.textContent != "string" ? e.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim() : r.textContent.replace(/\s+/g, " ").trim();
108
+ }
109
+ function Be(e, t) {
110
+ if (!Array.isArray(e) || e.length === 0) return [];
111
+ const r = /* @__PURE__ */ new Set(), o = [];
112
+ return e.forEach((l) => {
113
+ const n = t.normalizeText(l.label || ""), a = t.sanitizeBlockHtml(l.html || "", l).trim();
114
+ if (!n || !a) return;
115
+ const s = t.normalizeText(l.category || "General") || "General", i = ne(s);
116
+ let d = je(t.normalizeText(l.id || n)) || `block-${ke++}`;
117
+ for (; r.has(d); )
118
+ d = `${d}-${ke++}`;
119
+ r.add(d);
120
+ const f = (l.tags || []).map((H) => t.normalizeText(H)).filter(Boolean), g = (l.keywords || []).map((H) => t.normalizeText(H)).filter(Boolean), h = t.normalizeText(l.description || ""), C = Fe(a), V = [n, h, s, ...f, ...g, C].join(" ").toLowerCase();
121
+ o.push({
122
+ id: d,
123
+ label: n,
124
+ html: a,
125
+ description: h,
126
+ category: s,
127
+ categoryKey: i,
128
+ tags: f,
129
+ keywords: g,
130
+ previewText: C,
131
+ searchBlob: V
132
+ });
133
+ }), o;
134
+ }
135
+ function Q(e = {}) {
136
+ var l, n, a, s;
137
+ const t = e.normalizeText || Ke, r = e.sanitizeBlockHtml || We, o = {
138
+ blocks: [],
139
+ defaultCategory: t(e.defaultCategory || ""),
140
+ maxResults: Math.max(4, Math.min(300, Number((l = e.maxResults) != null ? l : 80))),
141
+ maxRecentBlocks: Math.max(1, Math.min(20, Number((n = e.maxRecentBlocks) != null ? n : 6))),
142
+ debounceMs: Math.max(0, Math.min(700, Number((a = e.debounceMs) != null ? a : 90))),
143
+ cacheTtlMs: Math.max(0, Number((s = e.cacheTtlMs) != null ? s : 6e4)),
144
+ labels: {
145
+ ...Oe,
146
+ ...e.labels || {}
147
+ },
148
+ normalizeText: t,
149
+ sanitizeBlockHtml: r,
150
+ getBlocks: typeof e.getBlocks == "function" ? e.getBlocks : void 0
151
+ };
152
+ return o.blocks = Be(e.blocks, o), o;
153
+ }
154
+ function Ge(e) {
155
+ return {
156
+ blocks: e.blocks.map((t) => ({
157
+ id: t.id,
158
+ label: t.label,
159
+ html: t.html,
160
+ description: t.description || void 0,
161
+ category: t.category || void 0,
162
+ tags: t.tags.length ? [...t.tags] : void 0,
163
+ keywords: t.keywords.length ? [...t.keywords] : void 0
164
+ })),
165
+ defaultCategory: e.defaultCategory,
166
+ maxResults: e.maxResults,
167
+ maxRecentBlocks: e.maxRecentBlocks,
168
+ debounceMs: e.debounceMs,
169
+ cacheTtlMs: e.cacheTtlMs,
170
+ labels: { ...e.labels },
171
+ normalizeText: e.normalizeText,
172
+ sanitizeBlockHtml: e.sanitizeBlockHtml,
173
+ getBlocks: e.getBlocks
174
+ };
175
+ }
176
+ function le(e) {
177
+ return e.closest(fe) || e;
178
+ }
179
+ function G(e) {
180
+ if (!e) return null;
181
+ if (e.matches(L)) return e;
182
+ const t = e.querySelector(L);
183
+ return t instanceof HTMLElement ? t : null;
184
+ }
185
+ function Ue() {
186
+ if (typeof window == "undefined") return null;
187
+ const e = window[ye];
188
+ if (!(e instanceof HTMLElement)) return null;
189
+ window[ye] = null;
190
+ const t = G(e);
191
+ if (t) return t;
192
+ const r = e.closest(fe);
193
+ if (r) {
194
+ const l = G(r);
195
+ if (l) return l;
196
+ }
197
+ const o = e.closest(L);
198
+ return o instanceof HTMLElement ? o : null;
199
+ }
200
+ function Ve(e) {
201
+ const t = e.closest("[data-editora-editor]");
202
+ if (t && G(t) === e)
203
+ return t;
204
+ let r = e;
205
+ for (; r; ) {
206
+ if (r.matches(fe) && (r === e || G(r) === e))
207
+ return r;
208
+ r = r.parentElement;
209
+ }
210
+ return le(e);
211
+ }
212
+ function $e(e) {
213
+ return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
214
+ }
215
+ function ee() {
216
+ Array.from(oe).forEach((t) => {
217
+ t.isConnected || ge(t);
218
+ });
219
+ }
220
+ function S(e, t = !0, r = !0) {
221
+ if (ee(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement) return e.contentElement;
222
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
223
+ const a = G(e.editorElement);
224
+ if (a) return a;
225
+ }
226
+ const o = Ue();
227
+ if (o) return o;
228
+ const l = window.getSelection();
229
+ if (l && l.rangeCount > 0) {
230
+ const a = $e(l.getRangeAt(0).startContainer), s = a == null ? void 0 : a.closest(L);
231
+ if (s) return s;
232
+ }
233
+ const n = document.activeElement;
234
+ if (n) {
235
+ if (n.matches(L)) return n;
236
+ const a = n.closest(L);
237
+ if (a) return a;
238
+ }
239
+ if (r) {
240
+ if (y && y.isConnected) return y;
241
+ y && !y.isConnected && (y = null);
242
+ }
243
+ return t ? document.querySelector(L) : null;
244
+ }
245
+ function Ye(e) {
246
+ const t = e.target;
247
+ if (t) {
248
+ const o = t.closest(L);
249
+ if (o) return o;
250
+ }
251
+ const r = window.getSelection();
252
+ if (r && r.rangeCount > 0) {
253
+ const o = $e(r.getRangeAt(0).startContainer), l = o == null ? void 0 : o.closest(L);
254
+ if (l) return l;
255
+ }
256
+ return null;
257
+ }
258
+ function Z(e) {
259
+ return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
260
+ }
261
+ function Xe(e) {
262
+ const t = le(e);
263
+ if (Z(t)) return !0;
264
+ const r = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
265
+ return Z(r) ? !0 : Z(document.documentElement) || Z(document.body);
266
+ }
267
+ function re(e, t) {
268
+ e.classList.remove("rte-blocks-library-theme-dark"), Xe(t) && e.classList.add("rte-blocks-library-theme-dark");
269
+ }
270
+ function Te(e) {
271
+ return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
272
+ }
273
+ function we(e, t, r) {
274
+ const o = Ve(e);
275
+ Array.from(
276
+ o.querySelectorAll(
277
+ `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
278
+ )
279
+ ).forEach((n) => {
280
+ n.classList.toggle("active", r), n.setAttribute("data-active", r ? "true" : "false"), n.setAttribute("aria-pressed", r ? "true" : "false");
281
+ });
282
+ }
283
+ function Ee(e, t) {
284
+ const r = e.querySelector(".rte-blocks-library-live");
285
+ r && (r.textContent = t);
286
+ }
287
+ function se(e) {
288
+ const t = Re(e);
289
+ if (t)
290
+ try {
291
+ q.set(e, t.cloneRange());
292
+ } catch (r) {
293
+ }
294
+ }
295
+ function Se(e) {
296
+ const t = q.get(e);
297
+ if (!t) return null;
298
+ if (!e.isConnected)
299
+ return q.delete(e), null;
300
+ try {
301
+ const r = t.cloneRange();
302
+ return e.contains(r.commonAncestorContainer) ? r : (q.delete(e), null);
303
+ } catch (r) {
304
+ return q.delete(e), null;
305
+ }
306
+ }
307
+ function Ze(e) {
308
+ const t = Se(e);
309
+ return t ? (He(e, t), !0) : !1;
310
+ }
311
+ function Je(e) {
312
+ if (te.has(e)) return;
313
+ const t = () => {
314
+ const r = window.getSelection();
315
+ if (!r || r.rangeCount === 0) return;
316
+ const o = r.getRangeAt(0);
317
+ e.contains(o.commonAncestorContainer) && se(e);
318
+ };
319
+ e.addEventListener("keyup", t), e.addEventListener("mouseup", t), e.addEventListener("touchend", t), te.set(e, t);
320
+ }
321
+ function Qe(e) {
322
+ const t = te.get(e);
323
+ t && (e.removeEventListener("keyup", t), e.removeEventListener("mouseup", t), e.removeEventListener("touchend", t), te.delete(e));
324
+ }
325
+ function k(e, t) {
326
+ b.has(e) || b.set(e, t), R.has(e) || (R.set(e, t.blocks), O.set(e, Date.now()));
327
+ let r = w.get(e);
328
+ return r || (r = {
329
+ query: "",
330
+ category: t.defaultCategory ? ne(t.defaultCategory) : "all",
331
+ selectedBlockId: null,
332
+ recentBlockIds: [],
333
+ lastInsertedBlockId: null,
334
+ loading: !1,
335
+ loadError: null,
336
+ totalMatches: 0,
337
+ visibleMatches: 0,
338
+ filterCache: /* @__PURE__ */ new Map(),
339
+ debounceTimer: null
340
+ }, w.set(e, r)), oe.add(e), Je(e), r;
341
+ }
342
+ function Me(e) {
343
+ const t = w.get(e);
344
+ !t || t.debounceTimer === null || (window.clearTimeout(t.debounceTimer), t.debounceTimer = null);
345
+ }
346
+ function ge(e) {
347
+ var r;
348
+ Me(e), Qe(e), q.delete(e);
349
+ const t = W.get(e);
350
+ t && (t.abort(), W.delete(e)), j.delete(e), z.delete(e), (r = x.get(e)) == null || r.remove(), x.delete(e), U.delete(e), b.delete(e), J.delete(e), w.delete(e), R.delete(e), O.delete(e), oe.delete(e), y === e && (y = null);
351
+ }
352
+ function et(e) {
353
+ var t, r, o, l;
354
+ for (let n = 0; n < e.length; n += 1) {
355
+ const a = e[n];
356
+ if (!(a.type !== "childList" || a.removedNodes.length === 0))
357
+ for (let s = 0; s < a.removedNodes.length; s += 1) {
358
+ const i = a.removedNodes[s];
359
+ if (i.nodeType !== Node.ELEMENT_NODE) continue;
360
+ const c = i;
361
+ if ((t = c.matches) != null && t.call(c, L) || (r = c.matches) != null && r.call(c, `.${u}`) || (o = c.querySelector) != null && o.call(c, L) || (l = c.querySelector) != null && l.call(c, `.${u}`))
362
+ return !0;
363
+ }
364
+ }
365
+ return !1;
366
+ }
367
+ function pe(e) {
368
+ return U.get(e) === !0;
369
+ }
370
+ function de(e, t) {
371
+ if (!t.classList.contains("show")) return;
372
+ const r = le(e).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 420), l = Math.max(10, window.innerWidth - o - 10), n = Math.min(Math.max(10, r.right - o), l), a = Math.max(10, Math.min(window.innerHeight - 10, r.top + 12));
373
+ t.style.width = `${o}px`, t.style.left = `${n}px`, t.style.top = `${a}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
374
+ }
375
+ function ae(e) {
376
+ var t;
377
+ return R.get(e) || ((t = b.get(e)) == null ? void 0 : t.blocks) || [];
378
+ }
379
+ function tt(e, t) {
380
+ const r = /* @__PURE__ */ new Map();
381
+ ae(e).forEach((l) => {
382
+ r.has(l.categoryKey) || r.set(l.categoryKey, l.category);
383
+ });
384
+ const o = Array.from(r.entries()).sort((l, n) => l[1].localeCompare(n[1])).map(([l, n]) => ({ value: l, label: n }));
385
+ return [{ value: "all", label: t.labels.allCategoriesText }, ...o];
386
+ }
387
+ function Ae(e, t) {
388
+ const r = k(e, t), o = ae(e), l = r.query.trim().toLowerCase(), n = r.category || "all", a = `${l}|${n}|${t.maxResults}`, s = r.filterCache.get(a);
389
+ if (s) {
390
+ const d = new Map(o.map((g) => [g.id, g])), f = s.ids.map((g) => d.get(g)).filter(Boolean);
391
+ return r.totalMatches = s.total, r.visibleMatches = f.length, f;
392
+ }
393
+ const i = [];
394
+ let c = 0;
395
+ for (let d = 0; d < o.length; d += 1) {
396
+ const f = o[d];
397
+ n !== "all" && f.categoryKey !== n || l && !f.searchBlob.includes(l) || (c += 1, i.length < t.maxResults && i.push(f));
398
+ }
399
+ if (r.totalMatches = c, r.visibleMatches = i.length, r.filterCache.set(a, {
400
+ ids: i.map((d) => d.id),
401
+ total: c
402
+ }), r.filterCache.size > 80) {
403
+ const d = r.filterCache.keys().next().value;
404
+ typeof d == "string" && r.filterCache.delete(d);
405
+ }
406
+ return i;
407
+ }
408
+ function rt(e, t) {
409
+ const r = w.get(e);
410
+ if (!r) return;
411
+ if (t.length === 0) {
412
+ r.selectedBlockId = null;
413
+ return;
414
+ }
415
+ t.some((l) => l.id === r.selectedBlockId) || (r.selectedBlockId = t[0].id);
416
+ }
417
+ function N(e) {
418
+ const t = w.get(e);
419
+ we(e, "toggleBlocksLibraryPanel", pe(e)), we(e, "insertLastBlockSnippet", !!(t != null && t.lastInsertedBlockId));
420
+ }
421
+ function v(e) {
422
+ const t = x.get(e), r = b.get(e) || A, o = w.get(e);
423
+ if (!t || !r || !o) return;
424
+ re(t, e);
425
+ const l = t.querySelector(".rte-blocks-library-title");
426
+ l && (l.textContent = r.labels.panelTitle);
427
+ const n = t.querySelector('[data-action="close"]');
428
+ n && (n.setAttribute("aria-label", r.labels.closeText), n.textContent = "✕");
429
+ const a = t.querySelector(".rte-blocks-library-search-label");
430
+ a && (a.textContent = r.labels.searchLabel);
431
+ const s = t.querySelector('[data-field="query"]');
432
+ s && (s.setAttribute("placeholder", r.labels.searchPlaceholder), s.value !== o.query && (s.value = o.query));
433
+ const i = t.querySelector(".rte-blocks-library-category-label");
434
+ i && (i.textContent = r.labels.categoryLabel);
435
+ const c = t.querySelector('[data-field="category"]');
436
+ if (c) {
437
+ const B = tt(e, r);
438
+ c.innerHTML = B.map((p) => `<option value="${m(p.value)}">${m(p.label)}</option>`).join(""), B.some((p) => p.value === o.category) || (o.category = "all"), c.value = o.category;
439
+ }
440
+ const d = t.querySelector(".rte-blocks-library-helper");
441
+ d && (d.textContent = r.labels.helperText);
442
+ const f = t.querySelector('.rte-blocks-library-list[role="listbox"]');
443
+ f && f.setAttribute("aria-label", r.labels.resultsListLabel);
444
+ const g = t.querySelector(".rte-blocks-library-shortcut");
445
+ g && (g.textContent = r.labels.shortcutText);
446
+ const h = t.querySelector('[data-action="insert-selected"]');
447
+ if (h) {
448
+ h.textContent = r.labels.insertText;
449
+ const B = !Te(e) && !!o.selectedBlockId;
450
+ h.disabled = !B, h.setAttribute("aria-disabled", B ? "false" : "true");
451
+ }
452
+ const C = t.querySelector(".rte-blocks-library-empty"), V = t.querySelector(".rte-blocks-library-list"), H = Ae(e, r);
453
+ rt(e, H);
454
+ const Y = t.querySelector(".rte-blocks-library-status");
455
+ if (Y && (o.loading ? Y.textContent = r.labels.loadingText : o.loadError ? Y.textContent = o.loadError : Y.textContent = `${r.labels.summaryPrefix}: ${o.visibleMatches}/${o.totalMatches}`), V) {
456
+ const B = new Set(o.recentBlockIds);
457
+ V.innerHTML = H.map((p) => {
458
+ const ie = o.selectedBlockId === p.id, qe = p.tags.length ? ` • ${p.tags.join(", ")}` : "", _e = B.has(p.id), me = p.previewText.slice(0, 180);
459
+ return `
460
+ <li class="rte-blocks-library-item-wrapper" role="presentation">
461
+ <button
462
+ type="button"
463
+ class="rte-blocks-library-item${ie ? " active" : ""}"
464
+ data-block-id="${m(p.id)}"
465
+ role="option"
466
+ aria-selected="${ie ? "true" : "false"}"
467
+ aria-label="${m(p.label)}"
468
+ tabindex="${ie ? "0" : "-1"}"
469
+ >
470
+ <span class="rte-blocks-library-item-head">
471
+ <span class="rte-blocks-library-item-label">${m(p.label)}</span>
472
+ ${_e ? `<span class="rte-blocks-library-recent-pill">${m(r.labels.recentHeading)}</span>` : ""}
473
+ </span>
474
+ <span class="rte-blocks-library-item-meta">${m(p.category)}${m(qe)}</span>
475
+ ${p.description ? `<span class="rte-blocks-library-item-description">${m(p.description)}</span>` : ""}
476
+ ${me ? `<span class="rte-blocks-library-item-preview">${m(me)}</span>` : ""}
477
+ </button>
478
+ </li>
479
+ `;
480
+ }).join("");
481
+ }
482
+ C && (C.hidden = H.length > 0, C.textContent = r.labels.noResultsText);
483
+ const K = t.querySelector(".rte-blocks-library-last-inserted");
484
+ if (K)
485
+ if (o.lastInsertedBlockId) {
486
+ const B = ae(e).find((p) => p.id === o.lastInsertedBlockId);
487
+ B ? (K.hidden = !1, K.textContent = `${r.labels.lastInsertedPrefix}: ${B.label}`) : K.hidden = !0;
488
+ } else
489
+ K.hidden = !0;
490
+ t.setAttribute("aria-label", r.labels.panelAriaLabel);
491
+ }
492
+ function M(e, t = !1) {
493
+ const r = x.get(e);
494
+ r && (r.classList.remove("show"), U.set(e, !1), N(e), t && (e.focus({ preventScroll: !0 }), Ze(e)));
495
+ }
496
+ function ot(e) {
497
+ const t = e.querySelector(".rte-blocks-library-item.active");
498
+ t == null || t.focus();
499
+ }
500
+ function Le(e, t) {
501
+ const r = b.get(e) || A;
502
+ if (!r) return;
503
+ const o = w.get(e);
504
+ if (!o) return;
505
+ const l = Ae(e, r);
506
+ if (l.length === 0) return;
507
+ const a = (Math.max(
508
+ 0,
509
+ l.findIndex((i) => i.id === o.selectedBlockId)
510
+ ) + t + l.length) % l.length;
511
+ o.selectedBlockId = l[a].id, v(e);
512
+ const s = x.get(e);
513
+ s && ot(s);
514
+ }
515
+ function ue(e) {
516
+ const t = it(e);
517
+ se(e), x.forEach((o, l) => {
518
+ l !== e && M(l, !1);
519
+ }), t.classList.add("show"), U.set(e, !0), v(e), de(e, t), N(e);
520
+ const r = t.querySelector('[data-field="query"]');
521
+ r == null || r.focus(), be(e, !1);
522
+ }
523
+ function Ie(e, t) {
524
+ const r = pe(e);
525
+ return (typeof t == "boolean" ? t : !r) ? ue(e) : M(e, !1), !0;
526
+ }
527
+ function Re(e) {
528
+ const t = window.getSelection();
529
+ if (!t || t.rangeCount === 0) return null;
530
+ const r = t.getRangeAt(0);
531
+ return e.contains(r.commonAncestorContainer) ? r : null;
532
+ }
533
+ function He(e, t) {
534
+ if (!e.isConnected) return;
535
+ const r = window.getSelection();
536
+ r && (r.removeAllRanges(), r.addRange(t));
537
+ }
538
+ function ve(e, t, r) {
539
+ const o = t.cloneRange();
540
+ if (!e.contains(o.commonAncestorContainer)) return !1;
541
+ o.deleteContents();
542
+ const l = document.createElement("template");
543
+ l.innerHTML = r;
544
+ const n = l.content;
545
+ if (!n) return !1;
546
+ const a = n.lastChild;
547
+ if (o.insertNode(n), a) {
548
+ const s = document.createRange();
549
+ s.setStartAfter(a), s.collapse(!0), He(e, s);
550
+ }
551
+ return se(e), !0;
552
+ }
553
+ function nt(e, t) {
554
+ e.focus({ preventScroll: !0 });
555
+ const r = Se(e);
556
+ if (r && ve(e, r, t))
557
+ return !0;
558
+ try {
559
+ if (document.execCommand("insertHTML", !1, t))
560
+ return se(e), !0;
561
+ } catch (l) {
562
+ }
563
+ const o = Re(e);
564
+ return o ? ve(e, o, t) : !1;
565
+ }
566
+ function lt(e, t) {
567
+ if (t === e.innerHTML) return;
568
+ const r = window.execEditorCommand || window.executeEditorCommand;
569
+ if (typeof r == "function")
570
+ try {
571
+ r("recordDomTransaction", e, t, e.innerHTML);
572
+ } catch (o) {
573
+ }
574
+ }
575
+ function st(e) {
576
+ e.dispatchEvent(new Event("input", { bubbles: !0 }));
577
+ }
578
+ function F(e, t) {
579
+ const r = b.get(e) || A;
580
+ if (!r) return !1;
581
+ const o = k(e, r), l = x.get(e);
582
+ if (Te(e))
583
+ return l && Ee(l, r.labels.readonlyMessage), !1;
584
+ const n = ae(e).find((i) => i.id === t);
585
+ if (!n) return !1;
586
+ const a = e.innerHTML;
587
+ return nt(e, n.html) ? (o.lastInsertedBlockId = n.id, o.selectedBlockId = n.id, o.recentBlockIds = [n.id, ...o.recentBlockIds.filter((i) => i !== n.id)].slice(
588
+ 0,
589
+ r.maxRecentBlocks
590
+ ), lt(e, a), st(e), N(e), e.dispatchEvent(
591
+ new CustomEvent("editora:blocks-library-insert", {
592
+ bubbles: !0,
593
+ detail: {
594
+ blockId: n.id,
595
+ label: n.label,
596
+ category: n.category
597
+ }
598
+ })
599
+ ), v(e), l && Ee(l, `${r.labels.lastInsertedPrefix}: ${n.label}`), !0) : !1;
600
+ }
601
+ function ze(e) {
602
+ const t = w.get(e);
603
+ return t != null && t.lastInsertedBlockId ? F(e, t.lastInsertedBlockId) : !1;
604
+ }
605
+ function at(e) {
606
+ const t = b.get(e) || A;
607
+ if (!t) return;
608
+ const r = w.get(e);
609
+ if (!r) return;
610
+ Me(e);
611
+ const o = () => {
612
+ r.debounceTimer = null, r.filterCache.clear(), v(e);
613
+ };
614
+ if (t.debounceMs <= 0) {
615
+ o();
616
+ return;
617
+ }
618
+ r.debounceTimer = window.setTimeout(o, t.debounceMs);
619
+ }
620
+ function it(e) {
621
+ const t = x.get(e);
622
+ if (t) return t;
623
+ const r = b.get(e) || A || Q(), o = k(e, r), l = `rte-blocks-library-panel-${Ne++}`, n = `${l}-query`, a = `${l}-category`, s = document.createElement("section");
624
+ return s.className = u, s.id = l, s.setAttribute("role", "dialog"), s.setAttribute("aria-modal", "false"), s.setAttribute("aria-label", r.labels.panelAriaLabel), s.innerHTML = `
625
+ <header class="rte-blocks-library-header">
626
+ <h2 class="rte-blocks-library-title">${m(r.labels.panelTitle)}</h2>
627
+ <button type="button" class="rte-blocks-library-icon-btn" data-action="close" aria-label="${m(r.labels.closeText)}">✕</button>
628
+ </header>
629
+ <div class="rte-blocks-library-body">
630
+ <label class="rte-blocks-library-search-label" for="${m(n)}"></label>
631
+ <input id="${m(n)}" class="rte-blocks-library-input" type="text" data-field="query" autocomplete="off" />
632
+ <label class="rte-blocks-library-category-label" for="${m(a)}"></label>
633
+ <select id="${m(a)}" class="rte-blocks-library-select" data-field="category"></select>
634
+ <p class="rte-blocks-library-status" aria-live="polite"></p>
635
+ <p class="rte-blocks-library-helper"></p>
636
+ <p class="rte-blocks-library-last-inserted" hidden></p>
637
+ <div class="rte-blocks-library-list-wrap">
638
+ <ul class="rte-blocks-library-list" role="listbox" aria-label="${m(r.labels.resultsListLabel)}"></ul>
639
+ <p class="rte-blocks-library-empty" hidden></p>
640
+ </div>
641
+ <div class="rte-blocks-library-actions">
642
+ <button type="button" class="rte-blocks-library-btn rte-blocks-library-btn-primary" data-action="insert-selected"></button>
643
+ </div>
644
+ <p class="rte-blocks-library-shortcut"></p>
645
+ </div>
646
+ <div class="rte-blocks-library-live" aria-live="polite" aria-atomic="true"></div>
647
+ `, s.addEventListener("click", (i) => {
648
+ const c = i.target, d = c == null ? void 0 : c.closest("[data-action]");
649
+ if (d) {
650
+ const h = d.getAttribute("data-action");
651
+ if (h === "close") {
652
+ M(e, !0);
653
+ return;
654
+ }
655
+ if (h === "insert-selected") {
656
+ if (!o.selectedBlockId) return;
657
+ F(e, o.selectedBlockId) && M(e, !0);
658
+ }
659
+ return;
660
+ }
661
+ const f = c == null ? void 0 : c.closest("[data-block-id]");
662
+ if (!f) return;
663
+ const g = f.getAttribute("data-block-id");
664
+ g && (o.selectedBlockId = g, v(e), i.detail >= 2 && F(e, g) && M(e, !0));
665
+ }), s.addEventListener("input", (i) => {
666
+ const c = i.target;
667
+ !(c instanceof HTMLInputElement) || c.getAttribute("data-field") !== "query" || (o.query = r.normalizeText(c.value).toLowerCase(), o.filterCache.clear(), at(e));
668
+ }), s.addEventListener("change", (i) => {
669
+ const c = i.target;
670
+ !(c instanceof HTMLSelectElement) || c.getAttribute("data-field") !== "category" || (o.category = ne(c.value || "all") || "all", o.filterCache.clear(), v(e));
671
+ }), s.addEventListener("keydown", (i) => {
672
+ if (i.key === "Escape") {
673
+ i.preventDefault(), M(e, !0);
674
+ return;
675
+ }
676
+ if (i.key === "ArrowDown") {
677
+ i.preventDefault(), Le(e, 1);
678
+ return;
679
+ }
680
+ if (i.key === "ArrowUp") {
681
+ i.preventDefault(), Le(e, -1);
682
+ return;
683
+ }
684
+ if (i.key === "Enter") {
685
+ const c = i.target;
686
+ if (!(c == null ? void 0 : c.matches('[data-field="query"], [data-field="category"], [data-block-id]')) || !o.selectedBlockId) return;
687
+ i.preventDefault(), F(e, o.selectedBlockId) && M(e, !0);
688
+ }
689
+ }), re(s, e), document.body.appendChild(s), x.set(e, s), U.set(e, !1), v(e), s;
690
+ }
691
+ function ct(e) {
692
+ const t = w.get(e);
693
+ return {
694
+ query: (t == null ? void 0 : t.query) || "",
695
+ category: (t == null ? void 0 : t.category) || "all",
696
+ selectedBlockId: (t == null ? void 0 : t.selectedBlockId) || null,
697
+ totalMatches: (t == null ? void 0 : t.totalMatches) || 0,
698
+ visibleMatches: (t == null ? void 0 : t.visibleMatches) || 0,
699
+ recentBlockIds: t != null && t.recentBlockIds ? [...t.recentBlockIds] : [],
700
+ lastInsertedBlockId: (t == null ? void 0 : t.lastInsertedBlockId) || null,
701
+ loading: (t == null ? void 0 : t.loading) === !0,
702
+ loadError: (t == null ? void 0 : t.loadError) || null
703
+ };
704
+ }
705
+ async function be(e, t) {
706
+ const r = b.get(e) || A;
707
+ if (!r || typeof r.getBlocks != "function") return;
708
+ const o = k(e, r), l = O.get(e) || 0;
709
+ if (!t && r.cacheTtlMs > 0 && Date.now() - l < r.cacheTtlMs)
710
+ return;
711
+ const n = j.get(e);
712
+ if (n && !t)
713
+ return n;
714
+ const a = W.get(e);
715
+ a && a.abort(), t && n && j.delete(e);
716
+ const s = new AbortController();
717
+ W.set(e, s);
718
+ const i = (z.get(e) || 0) + 1;
719
+ z.set(e, i), o.loading = !0, o.loadError = null, v(e);
720
+ const c = Promise.resolve().then(async () => {
721
+ var C;
722
+ const d = {
723
+ editor: e,
724
+ editorRoot: le(e),
725
+ signal: s.signal
726
+ }, f = await ((C = r.getBlocks) == null ? void 0 : C.call(r, d));
727
+ if (s.signal.aborted || z.get(e) !== i) return;
728
+ const g = Be(f || [], r);
729
+ R.set(e, g), O.set(e, Date.now());
730
+ const h = w.get(e);
731
+ h && (h.loading = !1, h.loadError = null, h.filterCache.clear());
732
+ }).catch(() => {
733
+ if (s.signal.aborted || z.get(e) !== i) return;
734
+ const d = w.get(e);
735
+ d && (d.loading = !1, d.loadError = r.labels.loadErrorText);
736
+ }).finally(() => {
737
+ z.get(e) === i && (j.delete(e), W.delete(e)), v(e);
738
+ });
739
+ return j.set(e, c), c;
740
+ }
741
+ function dt(e) {
742
+ const t = e.key.toLowerCase();
743
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "b";
744
+ }
745
+ function ut(e) {
746
+ const t = e.key.toLowerCase();
747
+ return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "l";
748
+ }
749
+ function bt(e) {
750
+ A = e, _ || (_ = (t) => {
751
+ ee();
752
+ const r = t.target, o = r == null ? void 0 : r.closest(L);
753
+ if (!o) return;
754
+ const l = b.get(o) || e;
755
+ k(o, l), b.set(o, l), y = o, N(o);
756
+ const n = x.get(o);
757
+ n && (re(n, o), de(o, n), v(o));
758
+ }, document.addEventListener("focusin", _, !0)), P || (P = (t) => {
759
+ if (t.defaultPrevented) return;
760
+ const r = `.${u} input, .${u} textarea, .${u} select`, o = t.target;
761
+ if (o != null && o.closest(r)) {
762
+ if (t.key === "Escape") {
763
+ const a = o.closest(`.${u}`), s = Array.from(x.entries()).find(([, i]) => i === a);
764
+ s && (t.preventDefault(), M(s[0], !0));
765
+ }
766
+ return;
767
+ }
768
+ const l = Ye(t);
769
+ if (!l) return;
770
+ const n = b.get(l) || A || e;
771
+ if (k(l, n), b.set(l, n), y = l, t.key === "Escape" && pe(l)) {
772
+ t.preventDefault(), M(l, !0);
773
+ return;
774
+ }
775
+ if (dt(t)) {
776
+ t.preventDefault(), t.stopPropagation(), Ie(l);
777
+ return;
778
+ }
779
+ ut(t) && (t.preventDefault(), t.stopPropagation(), ze(l));
780
+ }, document.addEventListener("keydown", P, !0)), I || (I = () => {
781
+ ee(), x.forEach((t, r) => {
782
+ !r.isConnected || !t.isConnected || (re(t, r), de(r, t));
783
+ });
784
+ }, window.addEventListener("scroll", I, !0), window.addEventListener("resize", I)), !D && typeof MutationObserver != "undefined" && document.body && (D = new MutationObserver((t) => {
785
+ et(t) && ee();
786
+ }), D.observe(document.body, {
787
+ childList: !0,
788
+ subtree: !0
789
+ }));
790
+ }
791
+ function ft() {
792
+ _ && (document.removeEventListener("focusin", _, !0), _ = null), P && (document.removeEventListener("keydown", P, !0), P = null), I && (window.removeEventListener("scroll", I, !0), window.removeEventListener("resize", I), I = null), D && (D.disconnect(), D = null), x.forEach((t) => t.remove()), x.clear(), Array.from(oe).forEach((t) => ge(t)), A = null, y = null;
793
+ }
794
+ function gt() {
795
+ if (typeof document == "undefined" || document.getElementById(he)) return;
796
+ const e = document.createElement("style");
797
+ e.id = he, e.textContent = `
798
+ .rte-toolbar-group-items.${E},
799
+ .editora-toolbar-group-items.${E},
800
+ .rte-toolbar-group-items.${$},
801
+ .editora-toolbar-group-items.${$} {
802
+ display: flex;
803
+ border: 1px solid #cbd5e1;
804
+ border-radius: 4px;
805
+ background: #ffffff;
806
+ }
807
+
808
+ .rte-toolbar-group-items.${E} .rte-toolbar-button,
809
+ .editora-toolbar-group-items.${E} .editora-toolbar-button,
810
+ .rte-toolbar-group-items.${$} .rte-toolbar-button,
811
+ .editora-toolbar-group-items.${$} .editora-toolbar-button {
812
+ border: none;
813
+ border-right: 1px solid #cbd5e1;
814
+ border-radius: 0;
815
+ }
816
+
817
+ .rte-toolbar-group-items.${E} .rte-toolbar-item:last-child .rte-toolbar-button,
818
+ .editora-toolbar-group-items.${E} .editora-toolbar-item:last-child .editora-toolbar-button,
819
+ .rte-toolbar-group-items.${$} .rte-toolbar-item:last-child .rte-toolbar-button,
820
+ .editora-toolbar-group-items.${$} .editora-toolbar-item:last-child .editora-toolbar-button {
821
+ border-right: none;
822
+ }
823
+
824
+ .rte-toolbar-button[data-command="insertLastBlockSnippet"].active,
825
+ .editora-toolbar-button[data-command="insertLastBlockSnippet"].active {
826
+ background: rgba(15, 118, 110, 0.12);
827
+ }
828
+
829
+ ${T} .rte-toolbar-group-items.${E},
830
+ ${T} .editora-toolbar-group-items.${E},
831
+ ${T} .rte-toolbar-group-items.${$},
832
+ ${T} .editora-toolbar-group-items.${$} {
833
+ border-color: #566275;
834
+ }
835
+ ${T} .rte-toolbar-group-items.${E} .rte-toolbar-button svg,
836
+ ${T} .editora-toolbar-group-items.${E} .editora-toolbar-button svg,
837
+ ${T} .rte-toolbar-group-items.${$} .rte-toolbar-button svg,
838
+ ${T} .editora-toolbar-group-items.${$} .editora-toolbar-button svg
839
+ {
840
+ fill: none;
841
+ }
842
+ ${T} .rte-toolbar-group-items.${E} .rte-toolbar-button,
843
+ ${T} .editora-toolbar-group-items.${E} .editora-toolbar-button
844
+ {
845
+ border-color: #566275;
846
+ }
847
+ .${u} {
848
+ position: fixed;
849
+ z-index: 12000;
850
+ display: none;
851
+ width: min(420px, calc(100vw - 20px));
852
+ max-height: calc(100vh - 20px);
853
+ border: 1px solid #d1d5db;
854
+ border-radius: 14px;
855
+ background: #ffffff;
856
+ color: #0f172a;
857
+ box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
858
+ overflow: hidden;
859
+ }
860
+
861
+ .${u}.show {
862
+ display: flex;
863
+ flex-direction: column;
864
+ }
865
+
866
+ .${u}.rte-blocks-library-theme-dark {
867
+ border-color: #334155;
868
+ background: #0f172a;
869
+ color: #e2e8f0;
870
+ box-shadow: 0 24px 52px rgba(2, 6, 23, 0.68);
871
+ }
872
+
873
+ .rte-blocks-library-header {
874
+ display: flex;
875
+ align-items: center;
876
+ justify-content: space-between;
877
+ gap: 8px;
878
+ padding: 12px 14px;
879
+ border-bottom: 1px solid #e2e8f0;
880
+ background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
881
+ }
882
+
883
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-header {
884
+ border-color: #1e293b;
885
+ background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
886
+ }
887
+
888
+ .rte-blocks-library-title {
889
+ margin: 0;
890
+ font-size: 15px;
891
+ line-height: 1.2;
892
+ font-weight: 700;
893
+ }
894
+
895
+ .rte-blocks-library-icon-btn {
896
+ border: 1px solid #cbd5e1;
897
+ border-radius: 6px;
898
+ min-height: 34px;
899
+ min-width: 34px;
900
+ width: 34px;
901
+ height: 34px;
902
+ padding: 0;
903
+ background: #ffffff;
904
+ color: #0f172a;
905
+ font-size: 16px;
906
+ line-height: 1;
907
+ font-weight: 600;
908
+ display: inline-flex;
909
+ align-items: center;
910
+ justify-content: center;
911
+ cursor: pointer;
912
+ }
913
+
914
+ .rte-blocks-library-icon-btn:hover,
915
+ .rte-blocks-library-icon-btn:focus-visible {
916
+ outline: none;
917
+ border-color: #3b82f6;
918
+ box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
919
+ }
920
+
921
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn {
922
+ border-color: #475569;
923
+ background: #0f172a;
924
+ color: #e2e8f0;
925
+ }
926
+
927
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn:hover,
928
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-icon-btn:focus-visible {
929
+ border-color: #60a5fa;
930
+ box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
931
+ }
932
+
933
+ .rte-blocks-library-body {
934
+ display: flex;
935
+ flex-direction: column;
936
+ gap: 8px;
937
+ padding: 12px;
938
+ overflow: auto;
939
+ }
940
+
941
+ .rte-blocks-library-search-label,
942
+ .rte-blocks-library-category-label {
943
+ font-size: 12px;
944
+ line-height: 1.3;
945
+ font-weight: 700;
946
+ color: #334155;
947
+ }
948
+
949
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-search-label,
950
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-category-label {
951
+ color: #cbd5e1;
952
+ }
953
+
954
+ .rte-blocks-library-input,
955
+ .rte-blocks-library-select {
956
+ border: 1px solid #cbd5e1;
957
+ border-radius: 8px;
958
+ min-height: 34px;
959
+ padding: 0 10px;
960
+ font-size: 13px;
961
+ background: #ffffff;
962
+ color: inherit;
963
+ }
964
+
965
+ .rte-blocks-library-input:focus-visible,
966
+ .rte-blocks-library-select:focus-visible {
967
+ border-color: #0f766e;
968
+ box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.18);
969
+ outline: none;
970
+ }
971
+
972
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-input,
973
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-select {
974
+ border-color: #334155;
975
+ background: #0b1220;
976
+ color: #e2e8f0;
977
+ }
978
+
979
+ .rte-blocks-library-status,
980
+ .rte-blocks-library-helper,
981
+ .rte-blocks-library-shortcut,
982
+ .rte-blocks-library-last-inserted {
983
+ margin: 0;
984
+ font-size: 12px;
985
+ line-height: 1.35;
986
+ color: #475569;
987
+ }
988
+
989
+ .rte-blocks-library-last-inserted {
990
+ font-weight: 600;
991
+ color: #0f766e;
992
+ }
993
+
994
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-status,
995
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-helper,
996
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-shortcut {
997
+ color: #94a3b8;
998
+ }
999
+
1000
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-last-inserted {
1001
+ color: #5eead4;
1002
+ }
1003
+
1004
+ .rte-blocks-library-list-wrap {
1005
+ border: 1px solid #e2e8f0;
1006
+ border-radius: 10px;
1007
+ padding: 6px;
1008
+ background: #f8fafc;
1009
+ max-height: min(44vh, 360px);
1010
+ overflow: auto;
1011
+ }
1012
+
1013
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-list-wrap {
1014
+ border-color: #334155;
1015
+ background: #0b1220;
1016
+ }
1017
+
1018
+ .rte-blocks-library-list {
1019
+ margin: 0;
1020
+ padding: 0;
1021
+ list-style: none;
1022
+ display: grid;
1023
+ gap: 6px;
1024
+ }
1025
+
1026
+ .rte-blocks-library-item-wrapper {
1027
+ margin: 0;
1028
+ padding: 0;
1029
+ }
1030
+
1031
+ .rte-blocks-library-item {
1032
+ width: 100%;
1033
+ border: 1px solid #cbd5e1;
1034
+ border-radius: 8px;
1035
+ background: #ffffff;
1036
+ color: inherit;
1037
+ text-align: left;
1038
+ padding: 8px;
1039
+ display: grid;
1040
+ gap: 3px;
1041
+ cursor: pointer;
1042
+ }
1043
+
1044
+ .rte-blocks-library-item:hover,
1045
+ .rte-blocks-library-item:focus-visible {
1046
+ border-color: #0f766e;
1047
+ outline: none;
1048
+ }
1049
+
1050
+ .rte-blocks-library-item.active {
1051
+ border-color: #0f766e;
1052
+ background: rgba(15, 118, 110, 0.12);
1053
+ }
1054
+
1055
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-item {
1056
+ border-color: #334155;
1057
+ background: #111827;
1058
+ color: #e2e8f0;
1059
+ }
1060
+
1061
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-item.active {
1062
+ border-color: #2dd4bf;
1063
+ background: rgba(45, 212, 191, 0.15);
1064
+ }
1065
+
1066
+ .rte-blocks-library-item-head {
1067
+ display: flex;
1068
+ align-items: center;
1069
+ justify-content: space-between;
1070
+ gap: 8px;
1071
+ }
1072
+
1073
+ .rte-blocks-library-item-label {
1074
+ font-size: 13px;
1075
+ line-height: 1.3;
1076
+ font-weight: 700;
1077
+ }
1078
+
1079
+ .rte-blocks-library-recent-pill {
1080
+ font-size: 10px;
1081
+ line-height: 1;
1082
+ font-weight: 700;
1083
+ text-transform: uppercase;
1084
+ letter-spacing: 0.02em;
1085
+ color: #0f766e;
1086
+ border: 1px solid rgba(15, 118, 110, 0.38);
1087
+ border-radius: 999px;
1088
+ padding: 2px 6px;
1089
+ }
1090
+
1091
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-recent-pill {
1092
+ color: #5eead4;
1093
+ border-color: rgba(94, 234, 212, 0.45);
1094
+ }
1095
+
1096
+ .rte-blocks-library-item-meta,
1097
+ .rte-blocks-library-item-description,
1098
+ .rte-blocks-library-item-preview {
1099
+ font-size: 11px;
1100
+ line-height: 1.3;
1101
+ color: #64748b;
1102
+ }
1103
+
1104
+ .rte-blocks-library-item-preview {
1105
+ color: #334155;
1106
+ display: -webkit-box;
1107
+ -webkit-line-clamp: 2;
1108
+ line-clamp: 2;
1109
+ -webkit-box-orient: vertical;
1110
+ overflow: hidden;
1111
+ }
1112
+
1113
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-item-meta,
1114
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-item-description {
1115
+ color: #94a3b8;
1116
+ }
1117
+
1118
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-item-preview {
1119
+ color: #cbd5e1;
1120
+ }
1121
+
1122
+ .rte-blocks-library-empty {
1123
+ margin: 8px;
1124
+ font-size: 12px;
1125
+ color: #64748b;
1126
+ }
1127
+
1128
+ .rte-blocks-library-actions {
1129
+ display: flex;
1130
+ gap: 8px;
1131
+ }
1132
+
1133
+ .rte-blocks-library-btn {
1134
+ border: 1px solid #cbd5e1;
1135
+ border-radius: 8px;
1136
+ min-height: 34px;
1137
+ padding: 0 12px;
1138
+ background: #ffffff;
1139
+ color: inherit;
1140
+ font-size: 12px;
1141
+ font-weight: 700;
1142
+ cursor: pointer;
1143
+ }
1144
+
1145
+ .rte-blocks-library-btn:disabled {
1146
+ opacity: 0.6;
1147
+ cursor: not-allowed;
1148
+ }
1149
+
1150
+ .rte-blocks-library-btn-primary {
1151
+ border-color: #0f766e;
1152
+ background: #0f766e;
1153
+ color: #f8fafc;
1154
+ }
1155
+
1156
+ .rte-blocks-library-btn-primary:hover,
1157
+ .rte-blocks-library-btn-primary:focus-visible {
1158
+ border-color: #115e59;
1159
+ background: #115e59;
1160
+ outline: none;
1161
+ }
1162
+
1163
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-btn {
1164
+ border-color: #334155;
1165
+ background: #111827;
1166
+ color: #e2e8f0;
1167
+ }
1168
+
1169
+ .${u}.rte-blocks-library-theme-dark .rte-blocks-library-btn-primary {
1170
+ border-color: #14b8a6;
1171
+ background: #0f766e;
1172
+ color: #f0fdfa;
1173
+ }
1174
+
1175
+ .rte-blocks-library-live {
1176
+ position: absolute;
1177
+ width: 1px;
1178
+ height: 1px;
1179
+ margin: -1px;
1180
+ padding: 0;
1181
+ overflow: hidden;
1182
+ clip: rect(0 0 0 0);
1183
+ border: 0;
1184
+ }
1185
+
1186
+ @media (max-width: 768px) {
1187
+ .${u} {
1188
+ left: 10px !important;
1189
+ right: 10px;
1190
+ top: 10px !important;
1191
+ width: auto !important;
1192
+ max-height: calc(100vh - 20px);
1193
+ }
1194
+ }
1195
+ `, document.head.appendChild(e);
1196
+ }
1197
+ const pt = (e = {}) => {
1198
+ const t = Q(e), r = /* @__PURE__ */ new Set();
1199
+ return gt(), {
1200
+ name: "blocksLibrary",
1201
+ toolbar: [
1202
+ {
1203
+ id: "blocksLibraryGroup",
1204
+ label: "Blocks Library",
1205
+ type: "group",
1206
+ command: "blocksLibrary",
1207
+ items: [
1208
+ {
1209
+ id: "blocksLibraryPanel",
1210
+ label: "Blocks Library Panel",
1211
+ command: "toggleBlocksLibraryPanel",
1212
+ shortcut: "Mod-Alt-Shift-b",
1213
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="5" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="4" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/><rect x="13" y="13" width="7" height="6" rx="1.5" stroke="currentColor" stroke-width="1.6"/></svg>'
1214
+ },
1215
+ {
1216
+ id: "insertLastBlockSnippet",
1217
+ label: "Insert Last Block",
1218
+ command: "insertLastBlockSnippet",
1219
+ shortcut: "Mod-Alt-Shift-l",
1220
+ icon: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M7 5.5h10a1.5 1.5 0 0 1 1.5 1.5v10A1.5 1.5 0 0 1 17 18.5H7A1.5 1.5 0 0 1 5.5 17V7A1.5 1.5 0 0 1 7 5.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M12 8.5v7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M8.5 12h7" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'
1221
+ }
1222
+ ]
1223
+ }
1224
+ ],
1225
+ commands: {
1226
+ blocksLibrary: (o, l) => {
1227
+ const n = S(l, !1, !1);
1228
+ if (!n) return !1;
1229
+ const a = b.get(n) || t;
1230
+ return k(n, a), b.set(n, a), y = n, ue(n), !0;
1231
+ },
1232
+ openBlocksLibraryPanel: (o, l) => {
1233
+ const n = S(l, !1, !1);
1234
+ if (!n) return !1;
1235
+ const a = b.get(n) || t;
1236
+ return k(n, a), b.set(n, a), y = n, ue(n), !0;
1237
+ },
1238
+ toggleBlocksLibraryPanel: (o, l) => {
1239
+ const n = S(l, !1, !1);
1240
+ if (!n) return !1;
1241
+ const a = b.get(n) || t;
1242
+ return k(n, a), b.set(n, a), y = n, Ie(n, typeof o == "boolean" ? o : void 0);
1243
+ },
1244
+ insertBlockSnippet: (o, l) => {
1245
+ const n = S(l, !1, !1);
1246
+ if (!n) return !1;
1247
+ const a = b.get(n) || t;
1248
+ k(n, a), b.set(n, a);
1249
+ const s = typeof o == "string" ? o : o == null ? void 0 : o.id;
1250
+ return s ? (y = n, F(n, s)) : !1;
1251
+ },
1252
+ insertLastBlockSnippet: (o, l) => {
1253
+ const n = S(l, !1, !1);
1254
+ if (!n) return !1;
1255
+ const a = b.get(n) || t;
1256
+ return k(n, a), b.set(n, a), y = n, ze(n);
1257
+ },
1258
+ refreshBlocksLibraryData: (o, l) => {
1259
+ const n = S(l, !1, !1);
1260
+ if (!n) return !1;
1261
+ const a = b.get(n) || t;
1262
+ return k(n, a), b.set(n, a), be(n, !0), !0;
1263
+ },
1264
+ setBlocksLibraryOptions: (o, l) => {
1265
+ const n = S(l, !1, !1);
1266
+ if (!n || !o || typeof o != "object") return !1;
1267
+ const a = b.get(n) || t, s = J.get(n) || Ge(a), i = {
1268
+ ...s,
1269
+ ...o,
1270
+ labels: {
1271
+ ...s.labels || {},
1272
+ ...o.labels || {}
1273
+ },
1274
+ blocks: Array.isArray(o.blocks) ? o.blocks : s.blocks,
1275
+ normalizeText: o.normalizeText || a.normalizeText,
1276
+ sanitizeBlockHtml: o.sanitizeBlockHtml || a.sanitizeBlockHtml,
1277
+ getBlocks: o.getBlocks || a.getBlocks
1278
+ }, c = Q(i), d = Array.isArray(o.blocks), f = o.getBlocks !== void 0;
1279
+ b.set(n, c), J.set(n, i), (d || f || !R.has(n)) && (R.set(n, c.blocks), O.set(n, f ? 0 : Date.now()));
1280
+ const g = k(n, c);
1281
+ return g.filterCache.clear(), typeof o.defaultCategory == "string" && (g.category = ne(c.defaultCategory) || "all"), v(n), N(n), f && be(n, !0), !0;
1282
+ },
1283
+ getBlocksLibraryState: (o, l) => {
1284
+ const n = S(l, !1, !1);
1285
+ if (!n) return !1;
1286
+ const a = b.get(n) || t;
1287
+ k(n, a);
1288
+ const s = ct(n);
1289
+ if (typeof o == "function")
1290
+ try {
1291
+ o(s);
1292
+ } catch (i) {
1293
+ }
1294
+ return n.__blocksLibraryState = s, n.dispatchEvent(
1295
+ new CustomEvent("editora:blocks-library-state", {
1296
+ bubbles: !0,
1297
+ detail: s
1298
+ })
1299
+ ), !0;
1300
+ }
1301
+ },
1302
+ keymap: {
1303
+ "Mod-Alt-Shift-b": "toggleBlocksLibraryPanel",
1304
+ "Mod-Alt-Shift-B": "toggleBlocksLibraryPanel",
1305
+ "Mod-Alt-Shift-l": "insertLastBlockSnippet",
1306
+ "Mod-Alt-Shift-L": "insertLastBlockSnippet"
1307
+ },
1308
+ init: function(l) {
1309
+ X += 1;
1310
+ const n = this && typeof this.__pluginConfig == "object" ? { ...e, ...this.__pluginConfig } : e, a = Q(n);
1311
+ bt(a);
1312
+ const s = S(
1313
+ l != null && l.editorElement ? { editorElement: l.editorElement } : void 0,
1314
+ !1,
1315
+ !1
1316
+ );
1317
+ s && (y = s, r.add(s), k(s, a), b.set(s, a), J.set(s, n), R.set(s, a.blocks), O.set(s, Date.now()), N(s));
1318
+ },
1319
+ destroy: () => {
1320
+ r.forEach((o) => ge(o)), r.clear(), X = Math.max(0, X - 1), !(X > 0) && ft();
1321
+ }
1322
+ };
1323
+ };
1324
+ export {
1325
+ pt as BlocksLibraryPlugin
1326
+ };
1327
+ //# sourceMappingURL=BlocksLibraryPlugin.native-HMWKxWNs.mjs.map