@editora/core 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/README.md +6 -1
  2. package/dist/{ApprovalWorkflowPlugin.native-C3jtAYjG.mjs → ApprovalWorkflowPlugin.native-BZ6jO-Wj.mjs} +136 -133
  3. package/dist/BlockquotePlugin.native-57_Xcjl1.mjs +212 -0
  4. package/dist/{BlocksLibraryPlugin.native-HMWKxWNs.mjs → BlocksLibraryPlugin.native-5sdsXsiE.mjs} +90 -87
  5. package/dist/{BoldPlugin.native-BAzzoqU5.mjs → BoldPlugin.native-CSh_LiIJ.mjs} +11 -7
  6. package/dist/CapitalizationPlugin.native-DLV4oPmB.mjs +159 -0
  7. package/dist/ChecklistPlugin.native-BS-kMz9O.mjs +371 -0
  8. package/dist/{CitationsPlugin.native-BnU0qCwR.mjs → CitationsPlugin.native-DQgoCd1B.mjs} +132 -129
  9. package/dist/ClearFormattingPlugin.native-DIS6AN2t.mjs +172 -0
  10. package/dist/CodePlugin.native-C5l1IeSS.mjs +4570 -0
  11. package/dist/{ContentRulesPlugin.native-nBLQ8QFZ.mjs → ContentRulesPlugin.native-vPx5nC73.mjs} +105 -102
  12. package/dist/{DataBindingPlugin.native-jQ1JPRTp.mjs → DataBindingPlugin.native-BoXwghTz.mjs} +49 -46
  13. package/dist/DirectionPlugin.native-Bl-QLFzO.mjs +153 -0
  14. package/dist/{DocSchemaPlugin.native-CHOge18O.mjs → DocSchemaPlugin.native-DUSVRHqT.mjs} +55 -52
  15. package/dist/{EmbedIframePlugin.native-DKJx2OS7.mjs → EmbedIframePlugin.native-BF_-LjTq.mjs} +287 -115
  16. package/dist/HeadingPlugin.native-DZdvubrQ.mjs +249 -0
  17. package/dist/{HistoryPlugin.native-TDnVMsEO.mjs → HistoryPlugin.native-D2wl32jV.mjs} +88 -103
  18. package/dist/{ItalicPlugin.native-CQjjDyUL.mjs → ItalicPlugin.native-CmnlwFHB.mjs} +15 -11
  19. package/dist/MathPlugin.native-NwWPHVmj.mjs +369 -0
  20. package/dist/{MediaManagerPlugin.native-BiXiK8FC.mjs → MediaManagerPlugin.native-eOsTJFpw.mjs} +204 -202
  21. package/dist/MergeTagPlugin.native-BzRVoD9-.mjs +580 -0
  22. package/dist/{PIIRedactionPlugin.native-DcsjmtV1.mjs → PIIRedactionPlugin.native-g7j4jOmm.mjs} +158 -155
  23. package/dist/{SlashCommandsPlugin.native-CmxvMEaE.mjs → SlashCommandsPlugin.native-BiN6ODw5.mjs} +2 -2
  24. package/dist/{SmartPastePlugin.native-BOKKtF07.mjs → SmartPastePlugin.native-CZAEHkyt.mjs} +127 -124
  25. package/dist/{SpecialCharactersPlugin.native-CZDato89.mjs → SpecialCharactersPlugin.native-DaG4b19I.mjs} +100 -76
  26. package/dist/{StrikethroughPlugin.native-0Be7j49s.mjs → StrikethroughPlugin.native-V0TL4F48.mjs} +12 -26
  27. package/dist/TemplatePlugin.native-DLjFUaPW.mjs +1150 -0
  28. package/dist/{TranslationWorkflowPlugin.native-Bz6jDGvj.mjs → TranslationWorkflowPlugin.native-DdF16tgT.mjs} +104 -101
  29. package/dist/{UnderlinePlugin.native-QpIcK4L2.mjs → UnderlinePlugin.native-DZzg23rv.mjs} +8 -4
  30. package/dist/editora.min.js +1 -1
  31. package/dist/editora.umd.js +1 -1
  32. package/dist/index-CPMGUZfB.js +10 -0
  33. package/dist/{index-DqC57IEH.mjs → index-DBoj6QfW.mjs} +17 -15
  34. package/dist/index.cjs.js +1 -1
  35. package/dist/index.esm.js +2 -2
  36. package/dist/inlineFormatting-DJ0-NZtx.mjs +97 -0
  37. package/dist/plugin-loader.js +37 -37
  38. package/dist/webcomponent-core.js +18 -16
  39. package/dist/webcomponent-core.min.css +1 -1
  40. package/dist/webcomponent-core.min.js +139 -62
  41. package/dist/webcomponent.cjs.js +1 -1
  42. package/dist/webcomponent.esm.js +1 -1
  43. package/dist/webcomponent.js +50 -48
  44. package/dist/webcomponent.min.css +1 -1
  45. package/dist/webcomponent.min.js +1174 -1071
  46. package/package.json +11 -5
  47. package/LICENSE +0 -21
  48. package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +0 -48
  49. package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +0 -79
  50. package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +0 -309
  51. package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +0 -140
  52. package/dist/CodePlugin.native-DlpTPdkd.mjs +0 -2691
  53. package/dist/DirectionPlugin.native-CDnbdNyl.mjs +0 -130
  54. package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +0 -64
  55. package/dist/MathPlugin.native-f_mDp8VL.mjs +0 -292
  56. package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +0 -559
  57. package/dist/TemplatePlugin.native-CrpfKRJ8.mjs +0 -602
  58. package/dist/index-D1LOqg5C.js +0 -10
@@ -1,4 +1,4 @@
1
- const $ = ".rte-content, .editora-content", gt = "rte-citations-styles", m = "rte-citations-panel", ot = ".rte-citation-ref[data-citation-id]", W = '.rte-citation-bibliography[data-type="citation-bibliography"]', G = '.rte-citation-footnotes[data-type="citation-footnotes"]', x = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', L = ["apa", "mla", "chicago"], Bt = {
1
+ const $ = ".rte-content, .editora-content", pt = "rte-citations-styles", m = "rte-citations-panel", ot = ".rte-citation-ref[data-citation-id]", W = '.rte-citation-bibliography[data-type="citation-bibliography"]', G = '.rte-citation-footnotes[data-type="citation-footnotes"]', x = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', L = ["apa", "mla", "chicago"], Ot = {
2
2
  panelTitle: "Citations",
3
3
  panelAriaLabel: "Citations panel",
4
4
  styleLabel: "Citation style",
@@ -19,42 +19,42 @@ const $ = ".rte-content, .editora-content", gt = "rte-citations-styles", m = "rt
19
19
  deleteRecentText: "x",
20
20
  summaryPrefix: "Citations",
21
21
  invalidMessage: "Author and title are required."
22
- }, f = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new Set();
23
- let I = null, B = null, O = null, k = null, Y = 0, Ot = 0, at = 0, M = null, p = null;
22
+ }, f = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new Set();
23
+ let I = null, B = null, O = null, k = null, Y = 0, Pt = 0, at = 0, M = null, p = null;
24
24
  function g(t) {
25
25
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
26
26
  }
27
- function Pt(t) {
27
+ function Dt(t) {
28
28
  return t.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
29
29
  }
30
- function ht(t, o) {
30
+ function xt(t, o) {
31
31
  const e = o(t);
32
32
  if (!e) return "";
33
33
  const i = e.match(/\d{4}/);
34
34
  return i ? i[0] : e;
35
35
  }
36
- function xt(t, o) {
36
+ function yt(t, o) {
37
37
  const e = o(t);
38
38
  return e ? /^https?:\/\//i.test(e) ? e : `https://${e}` : "";
39
39
  }
40
40
  function F(t) {
41
41
  return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
42
42
  }
43
- function yt(t, o) {
43
+ function Ct(t, o) {
44
44
  return {
45
45
  id: F(o.normalizeText(t.id || "")),
46
46
  author: o.normalizeText(t.author || ""),
47
- year: ht(t.year || "", o.normalizeText) || void 0,
47
+ year: xt(t.year || "", o.normalizeText) || void 0,
48
48
  title: o.normalizeText(t.title || ""),
49
49
  source: o.normalizeText(t.source || "") || void 0,
50
- url: xt(t.url || "", o.normalizeText) || void 0,
50
+ url: yt(t.url || "", o.normalizeText) || void 0,
51
51
  note: o.normalizeText(t.note || "") || void 0
52
52
  };
53
53
  }
54
54
  function Z(t = {}) {
55
55
  var i, n;
56
56
  const o = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", e = {
57
- ...Bt,
57
+ ...Ot,
58
58
  ...t.labels || {}
59
59
  };
60
60
  return {
@@ -63,11 +63,11 @@ function Z(t = {}) {
63
63
  debounceMs: Math.max(80, Number((i = t.debounceMs) != null ? i : 220)),
64
64
  maxRecentCitations: Math.max(3, Math.min(30, Number((n = t.maxRecentCitations) != null ? n : 8))),
65
65
  labels: e,
66
- normalizeText: t.normalizeText || Pt,
66
+ normalizeText: t.normalizeText || Dt,
67
67
  generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
68
68
  };
69
69
  }
70
- function Ct(t) {
70
+ function wt(t) {
71
71
  return t ? t.nodeType === Node.ELEMENT_NODE ? t : t.parentElement : null;
72
72
  }
73
73
  function lt(t) {
@@ -76,14 +76,14 @@ function lt(t) {
76
76
  function X(t) {
77
77
  return t ? (t.getAttribute("data-theme") || t.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : t.classList.contains("dark") || t.classList.contains("editora-theme-dark") || t.classList.contains("rte-theme-dark") : !1;
78
78
  }
79
- function Dt(t) {
79
+ function Ht(t) {
80
80
  const o = lt(t);
81
81
  if (X(o)) return !0;
82
82
  const e = o.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
83
83
  return X(e) ? !0 : X(document.documentElement) || X(document.body);
84
84
  }
85
85
  function tt(t, o) {
86
- t.classList.remove("rte-citations-theme-dark"), Dt(o) && t.classList.add("rte-citations-theme-dark");
86
+ t.classList.remove("rte-citations-theme-dark"), Ht(o) && t.classList.add("rte-citations-theme-dark");
87
87
  }
88
88
  function h(t, o = !0) {
89
89
  if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement) return t.contentElement;
@@ -95,7 +95,7 @@ function h(t, o = !0) {
95
95
  }
96
96
  const e = window.getSelection();
97
97
  if (e && e.rangeCount > 0) {
98
- const n = e.getRangeAt(0).startContainer, r = Ct(n), a = r == null ? void 0 : r.closest($);
98
+ const n = e.getRangeAt(0).startContainer, r = wt(n), a = r == null ? void 0 : r.closest($);
99
99
  if (a) return a;
100
100
  }
101
101
  const i = document.activeElement;
@@ -109,11 +109,11 @@ function h(t, o = !0) {
109
109
  function S(t) {
110
110
  return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
111
111
  }
112
- function j(t) {
113
- const o = Ct(t);
112
+ function K(t) {
113
+ const o = wt(t);
114
114
  return o ? !!(o.closest(W) || o.closest(G)) : !1;
115
115
  }
116
- function Ht(t, o) {
116
+ function Ft(t, o) {
117
117
  if (at += 1, o.generateCitationId) {
118
118
  const e = o.generateCitationId({ editor: t, index: at }), i = F(o.normalizeText(e || ""));
119
119
  if (i) return i;
@@ -123,7 +123,7 @@ function Ht(t, o) {
123
123
  function st(t) {
124
124
  return t.map((o) => (o || "").trim()).filter(Boolean).join(" ").trim();
125
125
  }
126
- function Ft(t, o) {
126
+ function _t(t, o) {
127
127
  const e = t.author || "Unknown", i = t.year || "n.d.";
128
128
  return o === "mla" ? `(${e} ${i})` : o === "chicago" ? `(${e} ${i})` : `(${e}, ${i})`;
129
129
  }
@@ -154,22 +154,22 @@ function R(t) {
154
154
  (o) => !o.closest(W) && !o.closest(G)
155
155
  );
156
156
  }
157
- function wt(t, o) {
157
+ function vt(t, o) {
158
158
  const e = F(o.normalizeText(t.getAttribute("data-citation-id") || ""));
159
159
  if (!e) return null;
160
160
  const i = o.normalizeText(t.getAttribute("data-citation-author") || ""), n = o.normalizeText(t.getAttribute("data-citation-title") || "");
161
161
  return {
162
162
  id: e,
163
163
  author: i || "Unknown",
164
- year: ht(t.getAttribute("data-citation-year") || "", o.normalizeText) || void 0,
164
+ year: xt(t.getAttribute("data-citation-year") || "", o.normalizeText) || void 0,
165
165
  title: n || "Untitled",
166
166
  source: o.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
167
- url: xt(t.getAttribute("data-citation-url") || "", o.normalizeText) || void 0,
167
+ url: yt(t.getAttribute("data-citation-url") || "", o.normalizeText) || void 0,
168
168
  note: o.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
169
169
  };
170
170
  }
171
- function vt(t, o, e) {
172
- t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", o.id), t.setAttribute("data-citation-author", o.author || ""), t.setAttribute("data-citation-year", o.year || ""), t.setAttribute("data-citation-title", o.title || ""), t.setAttribute("data-citation-source", o.source || ""), t.setAttribute("data-citation-url", o.url || ""), t.setAttribute("data-citation-note", o.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", e), t.textContent = Ft(o, e);
171
+ function Et(t, o, e) {
172
+ t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", o.id), t.setAttribute("data-citation-author", o.author || ""), t.setAttribute("data-citation-year", o.year || ""), t.setAttribute("data-citation-title", o.title || ""), t.setAttribute("data-citation-source", o.source || ""), t.setAttribute("data-citation-url", o.url || ""), t.setAttribute("data-citation-note", o.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", e), t.textContent = _t(o, e);
173
173
  }
174
174
  function it(t, o, e) {
175
175
  const i = lt(t);
@@ -185,10 +185,10 @@ function N(t, o) {
185
185
  const e = T.get(t);
186
186
  return e && L.includes(e) ? e : (o == null ? void 0 : o.defaultStyle) || "apa";
187
187
  }
188
- function K(t, o) {
188
+ function j(t, o) {
189
189
  const e = R(t), i = /* @__PURE__ */ new Map();
190
190
  return e.forEach((n) => {
191
- const r = wt(n, o);
191
+ const r = vt(n, o);
192
192
  if (!r) return;
193
193
  if (!i.has(r.id)) {
194
194
  i.set(r.id, r);
@@ -206,8 +206,8 @@ function K(t, o) {
206
206
  });
207
207
  }), Array.from(i.values());
208
208
  }
209
- function _t(t, o, e) {
210
- const i = yt(o, e);
209
+ function qt(t, o, e) {
210
+ const i = Ct(o, e);
211
211
  if (!i.id || !i.author || !i.title) return;
212
212
  const r = (D.get(t) || []).filter((a) => a.id !== i.id);
213
213
  D.set(t, [i, ...r].slice(0, e.maxRecentCitations));
@@ -222,17 +222,17 @@ function rt(t, o, e) {
222
222
  const r = Array.from(n.values()).slice(0, e.maxRecentCitations);
223
223
  return D.set(t, r), r;
224
224
  }
225
- function Et(t, o, e, i) {
225
+ function $t(t, o, e, i) {
226
226
  const n = F(i.normalizeText(o || ""));
227
227
  return n && rt(t, e, i).find((a) => a.id === n) || null;
228
228
  }
229
- function qt(t, o, e) {
229
+ function Kt(t, o, e) {
230
230
  const i = F(e.normalizeText(o || ""));
231
231
  if (!i) return !1;
232
232
  const n = D.get(t) || [], r = n.filter((a) => a.id !== i);
233
233
  return r.length === n.length ? !1 : (D.set(t, r), !0);
234
234
  }
235
- function $t(t, o, e) {
235
+ function St(t, o, e) {
236
236
  const i = document.createElement("section");
237
237
  i.className = t, i.setAttribute("data-type", o), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", e), o === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : o === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
238
238
  const n = document.createElement("h3");
@@ -242,23 +242,23 @@ function $t(t, o, e) {
242
242
  }
243
243
  function jt(t, o) {
244
244
  let e = t.querySelector(W);
245
- e || (e = $t("rte-citation-bibliography", "citation-bibliography", o.labels.bibliographyTitle), t.appendChild(e));
245
+ e || (e = St("rte-citation-bibliography", "citation-bibliography", o.labels.bibliographyTitle), t.appendChild(e));
246
246
  const i = e.querySelector(".rte-citation-section-title");
247
247
  return i && (i.textContent = o.labels.bibliographyTitle), e.setAttribute("aria-label", o.labels.bibliographyTitle), e;
248
248
  }
249
- function Kt(t, o) {
249
+ function Ut(t, o) {
250
250
  let e = t.querySelector(G);
251
- e || (e = $t("rte-citation-footnotes", "citation-footnotes", o.labels.footnotesTitle), t.appendChild(e));
251
+ e || (e = St("rte-citation-footnotes", "citation-footnotes", o.labels.footnotesTitle), t.appendChild(e));
252
252
  const i = e.querySelector(".rte-citation-section-title");
253
253
  return i && (i.textContent = o.labels.footnotesTitle), e.setAttribute("aria-label", o.labels.footnotesTitle), e;
254
254
  }
255
- function St(t, o) {
255
+ function At(t, o) {
256
256
  const e = t.querySelector(o);
257
257
  e == null || e.remove();
258
258
  }
259
- function Ut(t, o, e, i) {
259
+ function Wt(t, o, e, i) {
260
260
  if (o.length === 0) {
261
- St(t, W);
261
+ At(t, W);
262
262
  return;
263
263
  }
264
264
  const r = jt(t, e).querySelector(".rte-citation-list");
@@ -269,14 +269,14 @@ function Ut(t, o, e, i) {
269
269
  c.className = "rte-citation-item", c.id = `rte-citation-entry-${s.id}`, c.setAttribute("data-citation-id", s.id), c.setAttribute("data-citation-number", String(d + 1)), c.textContent = ut(s, i), a.appendChild(c);
270
270
  }), r.innerHTML = "", r.appendChild(a);
271
271
  }
272
- function Wt(t, o, e, i) {
272
+ function Gt(t, o, e, i) {
273
273
  if (!e.enableFootnoteSync || o.length === 0) {
274
- St(t, G), R(t).forEach((l) => {
274
+ At(t, G), R(t).forEach((l) => {
275
275
  l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
276
276
  });
277
277
  return;
278
278
  }
279
- const r = Kt(t, e).querySelector(".rte-citation-list");
279
+ const r = Ut(t, e).querySelector(".rte-citation-list");
280
280
  if (!r) return;
281
281
  const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
282
282
  o.forEach((l, u) => {
@@ -301,21 +301,21 @@ function Wt(t, o, e, i) {
301
301
  w.className = "rte-citation-footnote-number", w.textContent = `${u + 1}. `;
302
302
  const A = document.createElement("span");
303
303
  A.className = "rte-citation-footnote-text";
304
- const It = l.note ? `${l.note}. ` : "";
305
- A.textContent = `${It}${ut(l, i)}`, b.appendChild(w), b.appendChild(A);
306
- const mt = a.get(l.id);
307
- if (mt) {
304
+ const Bt = l.note ? `${l.note}. ` : "";
305
+ A.textContent = `${Bt}${ut(l, i)}`, b.appendChild(w), b.appendChild(A);
306
+ const gt = a.get(l.id);
307
+ if (gt) {
308
308
  const _ = document.createElement("a");
309
- _.className = "rte-citation-backref", _.href = `#${mt}`, _.setAttribute("aria-label", `Back to citation ${u + 1}`), _.textContent = "Back", b.appendChild(_);
309
+ _.className = "rte-citation-backref", _.href = `#${gt}`, _.setAttribute("aria-label", `Back to citation ${u + 1}`), _.textContent = "Back", b.appendChild(_);
310
310
  }
311
311
  c.appendChild(b);
312
312
  }), r.innerHTML = "", r.appendChild(c);
313
313
  }
314
- function Gt(t, o, e, i) {
314
+ function Vt(t, o, e, i) {
315
315
  const n = ut(o, e);
316
316
  t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${n}`);
317
317
  }
318
- function Vt(t, o, e) {
318
+ function Yt(t, o, e) {
319
319
  const i = R(t);
320
320
  let n = `${o}:${e ? "1" : "0"}:${i.length}`;
321
321
  return i.forEach((r) => {
@@ -327,7 +327,7 @@ function H(t) {
327
327
  if (!o) return;
328
328
  const e = f.get(t) || M;
329
329
  if (!e) return;
330
- const i = N(t, e), n = K(t, e), r = rt(t, n, e), a = o.querySelector(".rte-citations-status"), s = o.querySelector('[data-action="cycle-style"]'), d = o.querySelector(".rte-citations-recent-list");
330
+ const i = N(t, e), n = j(t, e), r = rt(t, n, e), a = o.querySelector(".rte-citations-status"), s = o.querySelector('[data-action="cycle-style"]'), d = o.querySelector(".rte-citations-recent-list");
331
331
  if (a) {
332
332
  const c = n.length;
333
333
  a.textContent = `${e.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${e.enableFootnoteSync ? "On" : "Off"}`;
@@ -365,12 +365,12 @@ function H(t) {
365
365
  }
366
366
  }
367
367
  function y(t, o, e = !1) {
368
- const i = N(t, o), n = Vt(t, i, o.enableFootnoteSync);
369
- if (!e && pt.get(t) === n)
370
- return K(t, o);
368
+ const i = N(t, o), n = Yt(t, i, o.enableFootnoteSync);
369
+ if (!e && ht.get(t) === n)
370
+ return j(t, o);
371
371
  const r = R(t), a = /* @__PURE__ */ new Map();
372
372
  r.forEach((c) => {
373
- const l = wt(c, o);
373
+ const l = vt(c, o);
374
374
  l && (a.has(l.id) || a.set(l.id, l));
375
375
  });
376
376
  const s = Array.from(a.values());
@@ -381,10 +381,10 @@ function y(t, o, e = !1) {
381
381
  }), r.forEach((c) => {
382
382
  const l = c.getAttribute("data-citation-id") || "", u = a.get(l);
383
383
  if (!u) return;
384
- vt(c, u, i);
384
+ Et(c, u, i);
385
385
  const b = d.get(u.id) || 1;
386
- Gt(c, u, i, Math.max(1, b));
387
- }), Ut(t, s, o, i), Wt(t, s, o, i), pt.set(t, n), H(t), t.dispatchEvent(
386
+ Vt(c, u, i, Math.max(1, b));
387
+ }), Wt(t, s, o, i), Gt(t, s, o, i), ht.set(t, n), H(t), t.dispatchEvent(
388
388
  new CustomEvent("editora:citations-refreshed", {
389
389
  bubbles: !0,
390
390
  detail: {
@@ -395,25 +395,25 @@ function y(t, o, e = !1) {
395
395
  })
396
396
  ), s;
397
397
  }
398
- function At(t) {
398
+ function kt(t) {
399
399
  const o = Q.get(t);
400
400
  typeof o == "number" && (window.clearTimeout(o), q.delete(o), Q.delete(t));
401
401
  }
402
- function kt(t) {
402
+ function Tt(t) {
403
403
  const o = f.get(t) || M;
404
404
  if (!o) return;
405
- At(t);
405
+ kt(t);
406
406
  const e = window.setTimeout(() => {
407
407
  q.delete(e), Q.delete(t), y(t, o, !1);
408
408
  }, o.debounceMs);
409
409
  q.add(e), Q.set(t, e);
410
410
  }
411
- function Yt(t) {
411
+ function Xt(t) {
412
412
  const o = window.getSelection();
413
413
  if (!o) throw new Error("Selection unavailable");
414
414
  if (o.rangeCount > 0) {
415
415
  const a = o.getRangeAt(0);
416
- if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
416
+ if (t.contains(a.commonAncestorContainer) && !K(a.commonAncestorContainer))
417
417
  return a.cloneRange();
418
418
  }
419
419
  const e = document.createRange(), i = t.querySelector(W), n = t.querySelector(G), r = i || n;
@@ -431,7 +431,7 @@ function ft(t, o) {
431
431
  } catch (i) {
432
432
  }
433
433
  }
434
- function Tt(t, o) {
434
+ function Mt(t, o) {
435
435
  const e = window.getSelection();
436
436
  if (!e) return;
437
437
  const i = document.createRange();
@@ -444,7 +444,7 @@ function Tt(t, o) {
444
444
  }
445
445
  i.collapse(!0), e.removeAllRanges(), e.addRange(i);
446
446
  }
447
- function Mt(t) {
447
+ function Lt(t) {
448
448
  if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
449
449
  return null;
450
450
  const o = t.startContainer.childNodes[t.startOffset];
@@ -469,7 +469,7 @@ function J(t, o, e) {
469
469
  }
470
470
  return null;
471
471
  }
472
- function Lt(t, o, e) {
472
+ function Rt(t, o, e) {
473
473
  if (!t.collapsed) return null;
474
474
  const i = (a) => a instanceof HTMLElement && a.matches(ot) ? a : null, { startContainer: n, startOffset: r } = t;
475
475
  if (n.nodeType === Node.ELEMENT_NODE) {
@@ -491,30 +491,30 @@ function Lt(t, o, e) {
491
491
  }
492
492
  function P(t, o, e) {
493
493
  const i = t.closest($);
494
- if (!i || j(t)) return !1;
494
+ if (!i || K(t)) return !1;
495
495
  const n = t.parentNode;
496
496
  if (!n) return !1;
497
497
  const r = i.innerHTML, a = Array.from(n.childNodes).indexOf(t);
498
498
  if (a < 0) return !1;
499
499
  const s = t.nextSibling;
500
- return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Tt(n, a), y(i, e, !0), ft(i, r), dt(i), o === "Delete" && i.focus({ preventScroll: !0 }), !0;
500
+ return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Mt(n, a), y(i, e, !0), ft(i, r), dt(i), o === "Delete" && i.focus({ preventScroll: !0 }), !0;
501
501
  }
502
- function Xt(t, o, e) {
502
+ function Jt(t, o, e) {
503
503
  if (t.key !== "Backspace" && t.key !== "Delete") return !1;
504
504
  const i = t.key, n = t.target;
505
- if (n != null && n.matches(ot) && o.contains(n) && !j(n))
505
+ if (n != null && n.matches(ot) && o.contains(n) && !K(n))
506
506
  return t.preventDefault(), t.stopPropagation(), P(n, i, e);
507
507
  const r = window.getSelection();
508
508
  if (!r || r.rangeCount === 0) return !1;
509
509
  const a = r.getRangeAt(0);
510
- if (!o.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer)) return !1;
511
- const s = Mt(a);
510
+ if (!o.contains(a.commonAncestorContainer) || K(a.commonAncestorContainer)) return !1;
511
+ const s = Lt(a);
512
512
  if (s)
513
513
  return t.preventDefault(), t.stopPropagation(), P(s, i, e);
514
- const d = Lt(a, o, i);
514
+ const d = Rt(a, o, i);
515
515
  return d ? (t.preventDefault(), t.stopPropagation(), P(d, i, e)) : !1;
516
516
  }
517
- function Rt(t, o, e) {
517
+ function Nt(t, o, e) {
518
518
  const i = F(e.normalizeText(o || ""));
519
519
  if (!i) return !1;
520
520
  const n = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
@@ -525,28 +525,28 @@ function Rt(t, o, e) {
525
525
  return n.forEach((a) => {
526
526
  const s = a.nextSibling;
527
527
  s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
528
- }), Tt(t, t.childNodes.length), y(t, e, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
528
+ }), Mt(t, t.childNodes.length), y(t, e, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
529
529
  }
530
- function Jt(t, o) {
530
+ function Zt(t, o) {
531
531
  const e = window.getSelection();
532
532
  if (!e || e.rangeCount === 0) return !1;
533
533
  const i = e.getRangeAt(0);
534
- if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer)) return !1;
535
- const n = Mt(i);
534
+ if (!t.contains(i.commonAncestorContainer) || K(i.commonAncestorContainer)) return !1;
535
+ const n = Lt(i);
536
536
  if (n)
537
537
  return P(n, "Delete", o);
538
- const r = Lt(i, t, "Backspace");
538
+ const r = Rt(i, t, "Backspace");
539
539
  return r ? P(r, "Backspace", o) : !1;
540
540
  }
541
541
  function et(t, o, e) {
542
542
  var l, u;
543
- const i = yt(o, e);
543
+ const i = Ct(o, e);
544
544
  if (!i.author || !i.title) return !1;
545
- i.id || (i.id = Ht(t, e));
545
+ i.id || (i.id = Ft(t, e));
546
546
  const n = t.innerHTML;
547
547
  let r;
548
548
  try {
549
- r = Yt(t);
549
+ r = Xt(t);
550
550
  } catch (b) {
551
551
  return !1;
552
552
  }
@@ -554,7 +554,7 @@ function et(t, o, e) {
554
554
  if (!a) return !1;
555
555
  r.collapsed || r.deleteContents();
556
556
  const s = document.createElement("span");
557
- vt(s, i, N(t, e));
557
+ Et(s, i, N(t, e));
558
558
  try {
559
559
  r.insertNode(s);
560
560
  } catch (b) {
@@ -568,9 +568,9 @@ function et(t, o, e) {
568
568
  c.setStart(d.parentNode, Math.max(0, b));
569
569
  } else
570
570
  c.setStartAfter(s);
571
- return c.collapse(!0), a.removeAllRanges(), a.addRange(c), _t(t, i, e), y(t, e, !0), ft(t, n), dt(t), !0;
571
+ return c.collapse(!0), a.removeAllRanges(), a.addRange(c), qt(t, i, e), y(t, e, !0), ft(t, n), dt(t), !0;
572
572
  }
573
- function Zt(t, o) {
573
+ function Qt(t, o) {
574
574
  if (!o) return !1;
575
575
  const e = R(t).find((r) => r.getAttribute("data-citation-id") === o) || null;
576
576
  if (!e) return !1;
@@ -587,7 +587,7 @@ function U(t, o = !1) {
587
587
  const e = v.get(t);
588
588
  e && (e.classList.remove("show"), V.set(t, !1), it(t, "toggleCitationsPanel", !1), o && t.focus({ preventScroll: !0 }));
589
589
  }
590
- function Qt(t) {
590
+ function te(t) {
591
591
  v.forEach((o, e) => {
592
592
  e !== t && U(e, !1);
593
593
  });
@@ -600,7 +600,7 @@ function ct(t, o) {
600
600
  function C(t, o) {
601
601
  return t.querySelector(`[data-field="${o}"]`);
602
602
  }
603
- function te(t) {
603
+ function ee(t) {
604
604
  var s, d, c, l, u, b;
605
605
  const o = ((s = C(t, "author")) == null ? void 0 : s.value) || "", e = ((d = C(t, "year")) == null ? void 0 : d.value) || "", i = ((c = C(t, "title")) == null ? void 0 : c.value) || "", n = ((l = C(t, "source")) == null ? void 0 : l.value) || "", r = ((u = C(t, "url")) == null ? void 0 : u.value) || "", a = ((b = C(t, "note")) == null ? void 0 : b.value) || "";
606
606
  return {
@@ -616,11 +616,11 @@ function E(t, o) {
616
616
  const e = t.querySelector(".rte-citations-live");
617
617
  e && (e.textContent = o);
618
618
  }
619
- function ee(t, o, e) {
619
+ function ne(t, o, e) {
620
620
  const i = C(o, "style");
621
621
  i && (i.value = N(t, e));
622
622
  }
623
- function Nt(t, o, e) {
623
+ function zt(t, o, e) {
624
624
  const i = L.includes(o) ? o : e.defaultStyle;
625
625
  return T.set(t, i), y(t, e, !0), i;
626
626
  }
@@ -628,10 +628,10 @@ function bt(t, o) {
628
628
  const e = N(t, o), i = L.indexOf(e), n = L[(i + 1) % L.length];
629
629
  return T.set(t, n), y(t, o, !0), n;
630
630
  }
631
- function ne(t) {
631
+ function oe(t) {
632
632
  const o = v.get(t);
633
633
  if (o) return o;
634
- const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Ot++}`, n = document.createElement("section");
634
+ const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Pt++}`, n = document.createElement("section");
635
635
  n.className = m, n.id = i, n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "false"), n.setAttribute("aria-label", e.labels.panelAriaLabel), n.setAttribute("tabindex", "-1"), n.innerHTML = `
636
636
  <header class="rte-citations-header">
637
637
  <h2 class="rte-citations-title">${g(e.labels.panelTitle)}</h2>
@@ -701,7 +701,7 @@ function ne(t) {
701
701
  }
702
702
  if (c === "insert") {
703
703
  if (S(t)) return;
704
- const u = te(n);
704
+ const u = ee(n);
705
705
  if (!l.normalizeText(u.author) || !l.normalizeText(u.title)) {
706
706
  E(n, l.labels.invalidMessage);
707
707
  return;
@@ -722,12 +722,12 @@ function ne(t) {
722
722
  }
723
723
  if (c === "cycle-style") {
724
724
  const u = bt(t, l);
725
- ee(t, n, l), E(n, `Style changed to ${u.toUpperCase()}.`);
725
+ ne(t, n, l), E(n, `Style changed to ${u.toUpperCase()}.`);
726
726
  return;
727
727
  }
728
728
  if (c === "insert-from-recent") {
729
729
  if (S(t)) return;
730
- const u = d.getAttribute("data-citation-id") || "", b = Et(t, u, K(t, l), l);
730
+ const u = d.getAttribute("data-citation-id") || "", b = $t(t, u, j(t, l), l);
731
731
  if (!b) return;
732
732
  et(t, b, l), E(n, `Inserted citation: ${b.title}.`);
733
733
  return;
@@ -735,11 +735,11 @@ function ne(t) {
735
735
  if (c === "delete-by-id") {
736
736
  if (S(t)) return;
737
737
  const u = d.getAttribute("data-citation-id") || "";
738
- if (Rt(t, u, l)) {
738
+ if (Nt(t, u, l)) {
739
739
  E(n, "Citation deleted.");
740
740
  return;
741
741
  }
742
- qt(t, u, l) && (H(t), E(n, "Removed from recent citations."));
742
+ Kt(t, u, l) && (H(t), E(n, "Removed from recent citations."));
743
743
  }
744
744
  }), n.addEventListener("keydown", (a) => {
745
745
  if (a.key === "Escape") {
@@ -759,32 +759,35 @@ function ne(t) {
759
759
  const r = C(n, "style");
760
760
  return r == null || r.addEventListener("change", () => {
761
761
  const a = f.get(t) || M || e, s = r.value;
762
- Nt(t, s, a), E(n, `Style changed to ${s.toUpperCase()}.`);
762
+ zt(t, s, a), E(n, `Style changed to ${s.toUpperCase()}.`);
763
763
  }), tt(n, t), document.body.appendChild(n), v.set(t, n), V.set(t, !1), H(t), n;
764
764
  }
765
765
  function z(t) {
766
- const o = ne(t);
767
- Qt(t), o.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(o, t), ct(t, o), H(t);
766
+ const o = oe(t);
767
+ te(t), o.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(o, t), ct(t, o), H(t);
768
768
  const e = C(o, "author");
769
769
  e == null || e.focus();
770
770
  }
771
- function zt(t, o) {
771
+ function It(t, o) {
772
772
  const e = nt(t);
773
773
  return (typeof o == "boolean" ? o : !e) ? z(t) : U(t, !1), !0;
774
774
  }
775
- function oe(t) {
776
- const o = t.key.toLowerCase();
777
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "c";
775
+ function mt(t) {
776
+ return typeof t.key == "string" ? t.key.toLowerCase() : "";
778
777
  }
779
778
  function ie(t) {
780
- const o = t.key.toLowerCase();
781
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "b";
779
+ const o = mt(t);
780
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "c";
782
781
  }
783
782
  function re(t) {
784
- const o = t.key.toLowerCase();
785
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "j";
783
+ const o = mt(t);
784
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "b";
786
785
  }
787
786
  function ae(t) {
787
+ const o = mt(t);
788
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && o === "j";
789
+ }
790
+ function se(t) {
788
791
  M = t, I || (I = (o) => {
789
792
  const e = o.target, i = e == null ? void 0 : e.closest($);
790
793
  if (!i) return;
@@ -793,7 +796,7 @@ function ae(t) {
793
796
  n && (tt(n, i), ct(i, n)), it(i, "toggleCitationsPanel", nt(i));
794
797
  }, document.addEventListener("focusin", I, !0)), B || (B = (o) => {
795
798
  const e = o.target, i = e == null ? void 0 : e.closest($);
796
- i && (p = i, kt(i));
799
+ i && (p = i, Tt(i));
797
800
  }, document.addEventListener("input", B, !0)), O || (O = (o) => {
798
801
  if (o.defaultPrevented) return;
799
802
  const e = o.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), n = h(void 0, !1);
@@ -803,34 +806,34 @@ function ae(t) {
803
806
  o.preventDefault(), U(n, !0);
804
807
  return;
805
808
  }
806
- if (!i && !Xt(o, n, r)) {
807
- if (oe(o)) {
808
- o.preventDefault(), o.stopPropagation(), zt(n);
809
+ if (!i && !Jt(o, n, r)) {
810
+ if (ie(o)) {
811
+ o.preventDefault(), o.stopPropagation(), It(n);
809
812
  return;
810
813
  }
811
- if (ie(o)) {
814
+ if (re(o)) {
812
815
  o.preventDefault(), o.stopPropagation(), y(n, r, !0), z(n);
813
816
  return;
814
817
  }
815
- re(o) && (o.preventDefault(), o.stopPropagation(), bt(n, r));
818
+ ae(o) && (o.preventDefault(), o.stopPropagation(), bt(n, r));
816
819
  }
817
820
  }, document.addEventListener("keydown", O, !0)), k || (k = () => {
818
821
  v.forEach((o, e) => {
819
822
  if (!e.isConnected || !o.isConnected) {
820
- At(e), o.remove(), v.delete(e), V.delete(e);
823
+ kt(e), o.remove(), v.delete(e), V.delete(e);
821
824
  return;
822
825
  }
823
826
  tt(o, e), ct(e, o);
824
827
  });
825
828
  }, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
826
829
  }
827
- function se() {
830
+ function ce() {
828
831
  I && (document.removeEventListener("focusin", I, !0), I = null), B && (document.removeEventListener("input", B, !0), B = null), O && (document.removeEventListener("keydown", O, !0), O = null), k && (window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k), k = null), v.forEach((t) => t.remove()), v.clear(), M = null, p = null;
829
832
  }
830
- function ce() {
831
- if (typeof document == "undefined" || document.getElementById(gt)) return;
833
+ function le() {
834
+ if (typeof document == "undefined" || document.getElementById(pt)) return;
832
835
  const t = document.createElement("style");
833
- t.id = gt, t.textContent = `
836
+ t.id = pt, t.textContent = `
834
837
  .rte-toolbar-group-items.citations,
835
838
  .editora-toolbar-group-items.citations {
836
839
  display: flex;
@@ -1300,9 +1303,9 @@ function ce() {
1300
1303
  }
1301
1304
  `, document.head.appendChild(t);
1302
1305
  }
1303
- const le = (t = {}) => {
1306
+ const ue = (t = {}) => {
1304
1307
  const o = Z(t);
1305
- return ce(), {
1308
+ return le(), {
1306
1309
  name: "citations",
1307
1310
  toolbar: [
1308
1311
  {
@@ -1347,7 +1350,7 @@ const le = (t = {}) => {
1347
1350
  if (!n || S(n)) return !1;
1348
1351
  const r = f.get(n) || o;
1349
1352
  f.set(n, r), p = n;
1350
- const a = zt(n, typeof e == "boolean" ? e : void 0);
1353
+ const a = It(n, typeof e == "boolean" ? e : void 0);
1351
1354
  return nt(n) && y(n, r, !1), a;
1352
1355
  },
1353
1356
  insertCitation: (e, i) => {
@@ -1368,7 +1371,7 @@ const le = (t = {}) => {
1368
1371
  const n = h(i);
1369
1372
  if (!n || !e) return !1;
1370
1373
  const r = f.get(n) || o;
1371
- return f.set(n, r), p = n, Nt(n, e, r), !0;
1374
+ return f.set(n, r), p = n, zt(n, e, r), !0;
1372
1375
  },
1373
1376
  cycleCitationStyle: (e, i) => {
1374
1377
  const n = h(i);
@@ -1379,7 +1382,7 @@ const le = (t = {}) => {
1379
1382
  getCitationRecords: (e, i) => {
1380
1383
  const n = h(i);
1381
1384
  if (!n) return !1;
1382
- const r = f.get(n) || o, a = K(n, r);
1385
+ const r = f.get(n) || o, a = j(n, r);
1383
1386
  if (typeof e == "function")
1384
1387
  try {
1385
1388
  e(a);
@@ -1412,22 +1415,22 @@ const le = (t = {}) => {
1412
1415
  },
1413
1416
  locateCitation: (e, i) => {
1414
1417
  const n = h(i);
1415
- return !n || typeof e != "string" ? !1 : Zt(n, e);
1418
+ return !n || typeof e != "string" ? !1 : Qt(n, e);
1416
1419
  },
1417
1420
  deleteCitation: (e, i) => {
1418
1421
  const n = h(i);
1419
1422
  if (!n || S(n)) return !1;
1420
1423
  const r = f.get(n) || o;
1421
- return f.set(n, r), typeof e == "string" && e.trim() ? Rt(n, e, r) : Jt(n, r);
1424
+ return f.set(n, r), typeof e == "string" && e.trim() ? Nt(n, e, r) : Zt(n, r);
1422
1425
  },
1423
1426
  insertRecentCitation: (e, i) => {
1424
1427
  const n = h(i);
1425
1428
  if (!n || S(n)) return !1;
1426
1429
  const r = f.get(n) || o;
1427
1430
  f.set(n, r);
1428
- const a = K(n, r), s = rt(n, a, r);
1431
+ const a = j(n, r), s = rt(n, a, r);
1429
1432
  if (s.length === 0) return !1;
1430
- const d = typeof e == "string" && e.trim() ? Et(n, e, a, r) : s[0];
1433
+ const d = typeof e == "string" && e.trim() ? $t(n, e, a, r) : s[0];
1431
1434
  if (!d) return !1;
1432
1435
  const c = et(n, d, r);
1433
1436
  return c && z(n), c;
@@ -1444,21 +1447,21 @@ const le = (t = {}) => {
1444
1447
  init: function(i) {
1445
1448
  Y += 1;
1446
1449
  const n = this && typeof this.__pluginConfig == "object" ? Z({ ...o, ...this.__pluginConfig }) : o;
1447
- ae(n);
1450
+ se(n);
1448
1451
  const r = h(
1449
1452
  i && i.editorElement ? { editorElement: i.editorElement } : void 0,
1450
1453
  !1
1451
1454
  );
1452
- r && (p = r, f.set(r, n), T.set(r, n.defaultStyle), it(r, "toggleCitationsPanel", !1), kt(r));
1455
+ r && (p = r, f.set(r, n), T.set(r, n.defaultStyle), it(r, "toggleCitationsPanel", !1), Tt(r));
1453
1456
  },
1454
1457
  destroy: () => {
1455
1458
  Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((e) => {
1456
1459
  window.clearTimeout(e);
1457
- }), q.clear(), se());
1460
+ }), q.clear(), ce());
1458
1461
  }
1459
1462
  };
1460
1463
  };
1461
1464
  export {
1462
- le as CitationsPlugin
1465
+ ue as CitationsPlugin
1463
1466
  };
1464
- //# sourceMappingURL=CitationsPlugin.native-BnU0qCwR.mjs.map
1467
+ //# sourceMappingURL=CitationsPlugin.native-DQgoCd1B.mjs.map