@editora/plugins 1.0.10 → 1.0.12

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 (139) hide show
  1. package/README.md +1 -1
  2. package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
  3. package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +80 -98
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +115 -128
  8. package/dist/anchoredPopover-BzqGPOAE.js +1 -0
  9. package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +208 -249
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +55 -68
  14. package/dist/blockquote.esm.js +1 -2
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +178 -245
  17. package/dist/capitalization.esm.js +1 -2
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +58 -82
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +439 -512
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +27 -33
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +82 -93
  26. package/dist/code.cjs.js +119 -42
  27. package/dist/code.esm.js +2560 -760
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +116 -158
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +371 -432
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +105 -159
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +328 -368
  36. package/dist/direction.esm.js +9 -18
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +240 -308
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +4 -5
  41. package/dist/documentManager-CTqRftU8.mjs +8369 -0
  42. package/dist/documentManager-Jf0RbSks.js +17 -0
  43. package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +73 -81
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +65 -77
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +54 -56
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +39 -47
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +37 -53
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +76 -117
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +70 -92
  58. package/dist/html2canvas.esm-B5qzocYs.js +5 -0
  59. package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +12 -24
  62. package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
  63. package/dist/index-CvJk4DKa.js +221 -0
  64. package/dist/index-D3CycEFU.mjs +16543 -0
  65. package/dist/index-tqLTHcO6.js +1 -0
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-CE_A4QSm.js +5 -0
  68. package/dist/index.es-DQ78mYYo.mjs +6665 -0
  69. package/dist/index.esm.js +125 -128
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +8 -9
  72. package/dist/jspdf.es.min-BoS80556.js +77 -0
  73. package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +11 -24
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +24 -30
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +20 -25
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +59 -61
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +139 -146
  84. package/dist/media-manager.cjs.js +31 -31
  85. package/dist/media-manager.esm.js +285 -300
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +238 -286
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +177 -216
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +33 -49
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +393 -463
  94. package/dist/plugins.css +1 -0
  95. package/dist/preview.esm.js +5 -10
  96. package/dist/print.cjs.js +4 -4
  97. package/dist/print.esm.js +17 -20
  98. package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
  99. package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
  100. package/dist/slash-commands.cjs.js +2 -2
  101. package/dist/slash-commands.esm.js +39 -75
  102. package/dist/smart-paste.cjs.js +27 -27
  103. package/dist/smart-paste.esm.js +280 -336
  104. package/dist/special-characters.cjs.js +7 -7
  105. package/dist/special-characters.esm.js +61 -69
  106. package/dist/spell-check.cjs.js +5 -5
  107. package/dist/spell-check.esm.js +97 -123
  108. package/dist/strikethrough.cjs.js +1 -1
  109. package/dist/strikethrough.esm.js +14 -19
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +191 -225
  112. package/dist/template.cjs.js +21 -20
  113. package/dist/template.esm.js +715 -196
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +21 -27
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +70 -87
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +100 -162
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +602 -678
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +128 -157
  124. package/package.json +1 -1
  125. package/dist/_commonjsHelpers-6763f629.js +0 -1
  126. package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
  127. package/dist/anchoredPopover-33f1358d.mjs +0 -109
  128. package/dist/anchoredPopover-8151d535.js +0 -1
  129. package/dist/documentManager-25b6203c.mjs +0 -9122
  130. package/dist/documentManager-b69e7054.js +0 -17
  131. package/dist/html2canvas.esm-09133e29.js +0 -22
  132. package/dist/index-656d224b.js +0 -231
  133. package/dist/index-6a8c48bb.js +0 -1
  134. package/dist/index-d027b7e2.mjs +0 -16859
  135. package/dist/index.es-730f2d98.mjs +0 -5775
  136. package/dist/index.es-dd40173b.js +0 -18
  137. package/dist/jspdf.es.min-90db2c97.js +0 -243
  138. package/dist/style.css +0 -1
  139. /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
@@ -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 S = ".rte-content, .editora-content", mt = "rte-citations-styles", b = "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 = {
2
2
  panelTitle: "Citations",
3
3
  panelAriaLabel: "Citations panel",
4
4
  styleLabel: "Citation style",
@@ -27,42 +27,41 @@ function g(t) {
27
27
  function Pt(t) {
28
28
  return t.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
29
29
  }
30
- function ht(t, n) {
31
- const e = n(t);
32
- if (!e)
33
- return "";
34
- const i = e.match(/\d{4}/);
35
- return i ? i[0] : e;
30
+ function ht(t, e) {
31
+ const n = e(t);
32
+ if (!n) return "";
33
+ const i = n.match(/\d{4}/);
34
+ return i ? i[0] : n;
36
35
  }
37
- function xt(t, n) {
38
- const e = n(t);
39
- return e ? /^https?:\/\//i.test(e) ? e : `https://${e}` : "";
36
+ function xt(t, e) {
37
+ const n = e(t);
38
+ return n ? /^https?:\/\//i.test(n) ? n : `https://${n}` : "";
40
39
  }
41
40
  function F(t) {
42
41
  return t.toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
43
42
  }
44
- function yt(t, n) {
43
+ function yt(t, e) {
45
44
  return {
46
- id: F(n.normalizeText(t.id || "")),
47
- author: n.normalizeText(t.author || ""),
48
- year: ht(t.year || "", n.normalizeText) || void 0,
49
- title: n.normalizeText(t.title || ""),
50
- source: n.normalizeText(t.source || "") || void 0,
51
- url: xt(t.url || "", n.normalizeText) || void 0,
52
- note: n.normalizeText(t.note || "") || void 0
45
+ id: F(e.normalizeText(t.id || "")),
46
+ author: e.normalizeText(t.author || ""),
47
+ year: ht(t.year || "", e.normalizeText) || void 0,
48
+ title: e.normalizeText(t.title || ""),
49
+ source: e.normalizeText(t.source || "") || void 0,
50
+ url: xt(t.url || "", e.normalizeText) || void 0,
51
+ note: e.normalizeText(t.note || "") || void 0
53
52
  };
54
53
  }
55
54
  function Z(t = {}) {
56
- const n = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", e = {
55
+ const e = t.defaultStyle && L.includes(t.defaultStyle) ? t.defaultStyle : "apa", n = {
57
56
  ...Bt,
58
57
  ...t.labels || {}
59
58
  };
60
59
  return {
61
- defaultStyle: n,
60
+ defaultStyle: e,
62
61
  enableFootnoteSync: t.enableFootnoteSync !== !1,
63
62
  debounceMs: Math.max(80, Number(t.debounceMs ?? 220)),
64
63
  maxRecentCitations: Math.max(3, Math.min(30, Number(t.maxRecentCitations ?? 8))),
65
- labels: e,
64
+ labels: n,
66
65
  normalizeText: t.normalizeText || Pt,
67
66
  generateCitationId: typeof t.generateCitationId == "function" ? t.generateCitationId : void 0
68
67
  };
@@ -77,80 +76,72 @@ function X(t) {
77
76
  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
77
  }
79
78
  function Dt(t) {
80
- const n = lt(t);
81
- if (X(n))
82
- return !0;
83
- const e = n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
84
- return X(e) ? !0 : X(document.documentElement) || X(document.body);
85
- }
86
- function tt(t, n) {
87
- t.classList.remove("rte-citations-theme-dark"), Dt(n) && t.classList.add("rte-citations-theme-dark");
88
- }
89
- function h(t, n = !0) {
90
- if ((t == null ? void 0 : t.contentElement) instanceof HTMLElement)
91
- return t.contentElement;
92
- if ((t == null ? void 0 : t.editorElement) instanceof HTMLElement) {
79
+ const e = lt(t);
80
+ if (X(e)) return !0;
81
+ const n = e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
82
+ return X(n) ? !0 : X(document.documentElement) || X(document.body);
83
+ }
84
+ function tt(t, e) {
85
+ t.classList.remove("rte-citations-theme-dark"), Dt(e) && t.classList.add("rte-citations-theme-dark");
86
+ }
87
+ function h(t, e = !0) {
88
+ if (t?.contentElement instanceof HTMLElement) return t.contentElement;
89
+ if (t?.editorElement instanceof HTMLElement) {
93
90
  const o = t.editorElement;
94
- if (o.matches($))
95
- return o;
96
- const r = o.querySelector($);
97
- if (r instanceof HTMLElement)
98
- return r;
91
+ if (o.matches(S)) return o;
92
+ const r = o.querySelector(S);
93
+ if (r instanceof HTMLElement) return r;
99
94
  }
100
- const e = window.getSelection();
101
- if (e && e.rangeCount > 0) {
102
- const o = e.getRangeAt(0).startContainer, r = Ct(o), a = r == null ? void 0 : r.closest($);
103
- if (a)
104
- return a;
95
+ const n = window.getSelection();
96
+ if (n && n.rangeCount > 0) {
97
+ const o = n.getRangeAt(0).startContainer, a = Ct(o)?.closest(S);
98
+ if (a) return a;
105
99
  }
106
100
  const i = document.activeElement;
107
101
  if (i) {
108
- if (i.matches($))
109
- return i;
110
- const o = i.closest($);
111
- if (o)
112
- return o;
102
+ if (i.matches(S)) return i;
103
+ const o = i.closest(S);
104
+ if (o) return o;
113
105
  }
114
- return p && p.isConnected ? p : (p && !p.isConnected && (p = null), n ? document.querySelector($) : null);
106
+ return p && p.isConnected ? p : (p && !p.isConnected && (p = null), e ? document.querySelector(S) : null);
115
107
  }
116
- function S(t) {
108
+ function $(t) {
117
109
  return t.getAttribute("contenteditable") === "false" || t.getAttribute("data-readonly") === "true";
118
110
  }
119
111
  function j(t) {
120
- const n = Ct(t);
121
- return n ? !!(n.closest(W) || n.closest(G)) : !1;
122
- }
123
- function Ht(t, n) {
124
- if (at += 1, n.generateCitationId) {
125
- const e = n.generateCitationId({ editor: t, index: at }), i = F(n.normalizeText(e || ""));
126
- if (i)
127
- return i;
112
+ const e = Ct(t);
113
+ return e ? !!(e.closest(W) || e.closest(G)) : !1;
114
+ }
115
+ function Ht(t, e) {
116
+ if (at += 1, e.generateCitationId) {
117
+ const n = e.generateCitationId({ editor: t, index: at }), i = F(e.normalizeText(n || ""));
118
+ if (i) return i;
128
119
  }
129
120
  return `cite-${Date.now().toString(36)}-${at.toString(36)}`;
130
121
  }
131
122
  function st(t) {
132
- return t.map((n) => (n || "").trim()).filter(Boolean).join(" ").trim();
123
+ return t.map((e) => (e || "").trim()).filter(Boolean).join(" ").trim();
133
124
  }
134
- function Ft(t, n) {
135
- const e = t.author || "Unknown", i = t.year || "n.d.";
136
- return n === "mla" ? `(${e} ${i})` : n === "chicago" ? `(${e} ${i})` : `(${e}, ${i})`;
125
+ function Ft(t, e) {
126
+ const n = t.author || "Unknown", i = t.year || "n.d.";
127
+ return e === "mla" ? `(${n} ${i})` : e === "chicago" ? `(${n} ${i})` : `(${n}, ${i})`;
137
128
  }
138
- function ut(t, n) {
139
- const e = t.author || "Unknown", i = t.year || "n.d.", o = t.title || "Untitled", r = t.source || "", a = t.url || "";
140
- return st(n === "mla" ? [
141
- `${e}.`,
129
+ function ut(t, e) {
130
+ const n = t.author || "Unknown", i = t.year || "n.d.", o = t.title || "Untitled", r = t.source || "", a = t.url || "";
131
+ return st(e === "mla" ? [
132
+ `${n}.`,
142
133
  `"${o}."`,
143
134
  r ? `${r},` : "",
144
135
  `${i}.`,
145
136
  a
146
- ] : n === "chicago" ? [
147
- `${e}.`,
137
+ ] : e === "chicago" ? [
138
+ `${n}.`,
148
139
  `${o}.`,
149
140
  r ? `${r}.` : "",
150
141
  `(${i}).`,
151
142
  a
152
143
  ] : [
153
- `${e}.`,
144
+ `${n}.`,
154
145
  `(${i}).`,
155
146
  `${o}.`,
156
147
  r ? `${r}.` : "",
@@ -159,47 +150,45 @@ function ut(t, n) {
159
150
  }
160
151
  function R(t) {
161
152
  return Array.from(t.querySelectorAll(ot)).filter(
162
- (n) => !n.closest(W) && !n.closest(G)
153
+ (e) => !e.closest(W) && !e.closest(G)
163
154
  );
164
155
  }
165
- function wt(t, n) {
166
- const e = F(n.normalizeText(t.getAttribute("data-citation-id") || ""));
167
- if (!e)
168
- return null;
169
- const i = n.normalizeText(t.getAttribute("data-citation-author") || ""), o = n.normalizeText(t.getAttribute("data-citation-title") || "");
156
+ function wt(t, e) {
157
+ const n = F(e.normalizeText(t.getAttribute("data-citation-id") || ""));
158
+ if (!n) return null;
159
+ const i = e.normalizeText(t.getAttribute("data-citation-author") || ""), o = e.normalizeText(t.getAttribute("data-citation-title") || "");
170
160
  return {
171
- id: e,
161
+ id: n,
172
162
  author: i || "Unknown",
173
- year: ht(t.getAttribute("data-citation-year") || "", n.normalizeText) || void 0,
163
+ year: ht(t.getAttribute("data-citation-year") || "", e.normalizeText) || void 0,
174
164
  title: o || "Untitled",
175
- source: n.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
176
- url: xt(t.getAttribute("data-citation-url") || "", n.normalizeText) || void 0,
177
- note: n.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
165
+ source: e.normalizeText(t.getAttribute("data-citation-source") || "") || void 0,
166
+ url: xt(t.getAttribute("data-citation-url") || "", e.normalizeText) || void 0,
167
+ note: e.normalizeText(t.getAttribute("data-citation-note") || "") || void 0
178
168
  };
179
169
  }
180
- function vt(t, n, e) {
181
- t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", n.id), t.setAttribute("data-citation-author", n.author || ""), t.setAttribute("data-citation-year", n.year || ""), t.setAttribute("data-citation-title", n.title || ""), t.setAttribute("data-citation-source", n.source || ""), t.setAttribute("data-citation-url", n.url || ""), t.setAttribute("data-citation-note", n.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", e), t.textContent = Ft(n, e);
170
+ function vt(t, e, n) {
171
+ t.classList.add("rte-citation-ref"), t.setAttribute("data-citation-id", e.id), t.setAttribute("data-citation-author", e.author || ""), t.setAttribute("data-citation-year", e.year || ""), t.setAttribute("data-citation-title", e.title || ""), t.setAttribute("data-citation-source", e.source || ""), t.setAttribute("data-citation-url", e.url || ""), t.setAttribute("data-citation-note", e.note || ""), t.setAttribute("contenteditable", "false"), t.setAttribute("tabindex", "0"), t.setAttribute("role", "doc-biblioref"), t.setAttribute("data-style", n), t.textContent = Ft(e, n);
182
172
  }
183
- function it(t, n, e) {
173
+ function it(t, e, n) {
184
174
  const i = lt(t);
185
175
  Array.from(
186
176
  i.querySelectorAll(
187
- `.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`
177
+ `.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`
188
178
  )
189
179
  ).forEach((r) => {
190
- r.classList.toggle("active", e), r.setAttribute("data-active", e ? "true" : "false"), r.setAttribute("aria-pressed", e ? "true" : "false");
180
+ r.classList.toggle("active", n), r.setAttribute("data-active", n ? "true" : "false"), r.setAttribute("aria-pressed", n ? "true" : "false");
191
181
  });
192
182
  }
193
- function N(t, n) {
194
- const e = T.get(t);
195
- return e && L.includes(e) ? e : (n == null ? void 0 : n.defaultStyle) || "apa";
183
+ function N(t, e) {
184
+ const n = T.get(t);
185
+ return n && L.includes(n) ? n : e?.defaultStyle || "apa";
196
186
  }
197
- function K(t, n) {
198
- const e = R(t), i = /* @__PURE__ */ new Map();
199
- return e.forEach((o) => {
200
- const r = wt(o, n);
201
- if (!r)
202
- return;
187
+ function K(t, e) {
188
+ const n = R(t), i = /* @__PURE__ */ new Map();
189
+ return n.forEach((o) => {
190
+ const r = wt(o, e);
191
+ if (!r) return;
203
192
  if (!i.has(r.id)) {
204
193
  i.set(r.id, r);
205
194
  return;
@@ -216,145 +205,137 @@ function K(t, n) {
216
205
  });
217
206
  }), Array.from(i.values());
218
207
  }
219
- function _t(t, n, e) {
220
- const i = yt(n, e);
221
- if (!i.id || !i.author || !i.title)
222
- return;
208
+ function _t(t, e, n) {
209
+ const i = yt(e, n);
210
+ if (!i.id || !i.author || !i.title) return;
223
211
  const r = (D.get(t) || []).filter((a) => a.id !== i.id);
224
- D.set(t, [i, ...r].slice(0, e.maxRecentCitations));
212
+ D.set(t, [i, ...r].slice(0, n.maxRecentCitations));
225
213
  }
226
- function rt(t, n, e) {
214
+ function rt(t, e, n) {
227
215
  const i = D.get(t) || [], o = /* @__PURE__ */ new Map();
228
- n.slice(Math.max(0, n.length - e.maxRecentCitations)).reverse().forEach((a) => {
216
+ e.slice(Math.max(0, e.length - n.maxRecentCitations)).reverse().forEach((a) => {
229
217
  a.id && o.set(a.id, a);
230
218
  }), i.forEach((a) => {
231
219
  !a.id || o.has(a.id) || o.set(a.id, a);
232
220
  });
233
- const r = Array.from(o.values()).slice(0, e.maxRecentCitations);
221
+ const r = Array.from(o.values()).slice(0, n.maxRecentCitations);
234
222
  return D.set(t, r), r;
235
223
  }
236
- function Et(t, n, e, i) {
237
- const o = F(i.normalizeText(n || ""));
238
- return o && rt(t, e, i).find((a) => a.id === o) || null;
224
+ function Et(t, e, n, i) {
225
+ const o = F(i.normalizeText(e || ""));
226
+ return o && rt(t, n, i).find((a) => a.id === o) || null;
239
227
  }
240
- function qt(t, n, e) {
241
- const i = F(e.normalizeText(n || ""));
242
- if (!i)
243
- return !1;
228
+ function qt(t, e, n) {
229
+ const i = F(n.normalizeText(e || ""));
230
+ if (!i) return !1;
244
231
  const o = D.get(t) || [], r = o.filter((a) => a.id !== i);
245
232
  return r.length === o.length ? !1 : (D.set(t, r), !0);
246
233
  }
247
- function $t(t, n, e) {
234
+ function St(t, e, n) {
248
235
  const i = document.createElement("section");
249
- i.className = t, i.setAttribute("data-type", n), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", e), n === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : n === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
236
+ i.className = t, i.setAttribute("data-type", e), i.setAttribute("contenteditable", "false"), i.setAttribute("aria-label", n), e === "citation-bibliography" ? i.setAttribute("role", "doc-bibliography") : e === "citation-footnotes" && i.setAttribute("role", "doc-endnotes");
250
237
  const o = document.createElement("h3");
251
- o.className = "rte-citation-section-title", o.textContent = e;
238
+ o.className = "rte-citation-section-title", o.textContent = n;
252
239
  const r = document.createElement("ol");
253
240
  return r.className = "rte-citation-list", r.setAttribute("role", "list"), i.appendChild(o), i.appendChild(r), i;
254
241
  }
255
- function jt(t, n) {
256
- let e = t.querySelector(W);
257
- e || (e = $t("rte-citation-bibliography", "citation-bibliography", n.labels.bibliographyTitle), t.appendChild(e));
258
- const i = e.querySelector(".rte-citation-section-title");
259
- return i && (i.textContent = n.labels.bibliographyTitle), e.setAttribute("aria-label", n.labels.bibliographyTitle), e;
260
- }
261
- function Kt(t, n) {
262
- let e = t.querySelector(G);
263
- e || (e = $t("rte-citation-footnotes", "citation-footnotes", n.labels.footnotesTitle), t.appendChild(e));
264
- const i = e.querySelector(".rte-citation-section-title");
265
- return i && (i.textContent = n.labels.footnotesTitle), e.setAttribute("aria-label", n.labels.footnotesTitle), e;
266
- }
267
- function St(t, n) {
268
- const e = t.querySelector(n);
269
- e == null || e.remove();
270
- }
271
- function Ut(t, n, e, i) {
272
- if (n.length === 0) {
273
- St(t, W);
242
+ function jt(t, e) {
243
+ let n = t.querySelector(W);
244
+ n || (n = St("rte-citation-bibliography", "citation-bibliography", e.labels.bibliographyTitle), t.appendChild(n));
245
+ const i = n.querySelector(".rte-citation-section-title");
246
+ return i && (i.textContent = e.labels.bibliographyTitle), n.setAttribute("aria-label", e.labels.bibliographyTitle), n;
247
+ }
248
+ function Kt(t, e) {
249
+ let n = t.querySelector(G);
250
+ n || (n = St("rte-citation-footnotes", "citation-footnotes", e.labels.footnotesTitle), t.appendChild(n));
251
+ const i = n.querySelector(".rte-citation-section-title");
252
+ return i && (i.textContent = e.labels.footnotesTitle), n.setAttribute("aria-label", e.labels.footnotesTitle), n;
253
+ }
254
+ function $t(t, e) {
255
+ t.querySelector(e)?.remove();
256
+ }
257
+ function Ut(t, e, n, i) {
258
+ if (e.length === 0) {
259
+ $t(t, W);
274
260
  return;
275
261
  }
276
- const r = jt(t, e).querySelector(".rte-citation-list");
277
- if (!r)
278
- return;
262
+ const r = jt(t, n).querySelector(".rte-citation-list");
263
+ if (!r) return;
279
264
  const a = document.createDocumentFragment();
280
- n.forEach((s, d) => {
265
+ e.forEach((s, u) => {
281
266
  const c = document.createElement("li");
282
- 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);
267
+ 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(u + 1)), c.textContent = ut(s, i), a.appendChild(c);
283
268
  }), r.innerHTML = "", r.appendChild(a);
284
269
  }
285
- function Wt(t, n, e, i) {
286
- if (!e.enableFootnoteSync || n.length === 0) {
287
- St(t, G), R(t).forEach((l) => {
270
+ function Wt(t, e, n, i) {
271
+ if (!n.enableFootnoteSync || e.length === 0) {
272
+ $t(t, G), R(t).forEach((l) => {
288
273
  l.removeAttribute("data-footnote-number"), l.removeAttribute("data-footnote-target");
289
274
  });
290
275
  return;
291
276
  }
292
- const r = Kt(t, e).querySelector(".rte-citation-list");
293
- if (!r)
294
- return;
277
+ const r = Kt(t, n).querySelector(".rte-citation-list");
278
+ if (!r) return;
295
279
  const a = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
296
- n.forEach((l, u) => {
297
- s.set(l.id, u + 1);
280
+ e.forEach((l, d) => {
281
+ s.set(l.id, d + 1);
298
282
  });
299
- const d = /* @__PURE__ */ new Map();
283
+ const u = /* @__PURE__ */ new Map();
300
284
  R(t).forEach((l) => {
301
- const u = l.getAttribute("data-citation-id") || "";
302
- if (!u || !s.has(u))
303
- return;
304
- const b = (d.get(u) || 0) + 1;
305
- d.set(u, b);
306
- const w = `rte-citation-ref-${u}-${b}`;
285
+ const d = l.getAttribute("data-citation-id") || "";
286
+ if (!d || !s.has(d)) return;
287
+ const m = (u.get(d) || 0) + 1;
288
+ u.set(d, m);
289
+ const w = `rte-citation-ref-${d}-${m}`;
307
290
  l.id = w;
308
- const A = s.get(u);
309
- l.setAttribute("data-footnote-number", String(A)), l.setAttribute("data-footnote-target", `rte-citation-note-${u}`), a.has(u) || a.set(u, w);
291
+ const A = s.get(d);
292
+ l.setAttribute("data-footnote-number", String(A)), l.setAttribute("data-footnote-target", `rte-citation-note-${d}`), a.has(d) || a.set(d, w);
310
293
  });
311
294
  const c = document.createDocumentFragment();
312
- n.forEach((l, u) => {
313
- const b = document.createElement("li");
314
- b.className = "rte-citation-item rte-citation-footnote-item", b.id = `rte-citation-note-${l.id}`, b.setAttribute("data-citation-id", l.id);
295
+ e.forEach((l, d) => {
296
+ const m = document.createElement("li");
297
+ m.className = "rte-citation-item rte-citation-footnote-item", m.id = `rte-citation-note-${l.id}`, m.setAttribute("data-citation-id", l.id);
315
298
  const w = document.createElement("span");
316
- w.className = "rte-citation-footnote-number", w.textContent = `${u + 1}. `;
299
+ w.className = "rte-citation-footnote-number", w.textContent = `${d + 1}. `;
317
300
  const A = document.createElement("span");
318
301
  A.className = "rte-citation-footnote-text";
319
302
  const It = l.note ? `${l.note}. ` : "";
320
- A.textContent = `${It}${ut(l, i)}`, b.appendChild(w), b.appendChild(A);
321
- const mt = a.get(l.id);
322
- if (mt) {
303
+ A.textContent = `${It}${ut(l, i)}`, m.appendChild(w), m.appendChild(A);
304
+ const gt = a.get(l.id);
305
+ if (gt) {
323
306
  const _ = document.createElement("a");
324
- _.className = "rte-citation-backref", _.href = `#${mt}`, _.setAttribute("aria-label", `Back to citation ${u + 1}`), _.textContent = "Back", b.appendChild(_);
307
+ _.className = "rte-citation-backref", _.href = `#${gt}`, _.setAttribute("aria-label", `Back to citation ${d + 1}`), _.textContent = "Back", m.appendChild(_);
325
308
  }
326
- c.appendChild(b);
309
+ c.appendChild(m);
327
310
  }), r.innerHTML = "", r.appendChild(c);
328
311
  }
329
- function Gt(t, n, e, i) {
330
- const o = ut(n, e);
312
+ function Gt(t, e, n, i) {
313
+ const o = ut(e, n);
331
314
  t.setAttribute("data-citation-number", String(i)), t.setAttribute("aria-label", `Citation ${i}: ${o}`);
332
315
  }
333
- function Vt(t, n, e) {
316
+ function Vt(t, e, n) {
334
317
  const i = R(t);
335
- let o = `${n}:${e ? "1" : "0"}:${i.length}`;
318
+ let o = `${e}:${n ? "1" : "0"}:${i.length}`;
336
319
  return i.forEach((r) => {
337
320
  o += `|${r.getAttribute("data-citation-id") || ""}`, o += `|${r.getAttribute("data-citation-author") || ""}`, o += `|${r.getAttribute("data-citation-year") || ""}`, o += `|${r.getAttribute("data-citation-title") || ""}`, o += `|${r.getAttribute("data-citation-source") || ""}`, o += `|${r.getAttribute("data-citation-url") || ""}`, o += `|${r.getAttribute("data-citation-note") || ""}`;
338
321
  }), o;
339
322
  }
340
323
  function H(t) {
341
- const n = v.get(t);
342
- if (!n)
343
- return;
344
- const e = f.get(t) || M;
345
- if (!e)
346
- return;
347
- const i = N(t, e), o = K(t, e), r = rt(t, o, e), a = n.querySelector(".rte-citations-status"), s = n.querySelector('[data-action="cycle-style"]'), d = n.querySelector(".rte-citations-recent-list");
324
+ const e = v.get(t);
325
+ if (!e) return;
326
+ const n = f.get(t) || M;
327
+ if (!n) return;
328
+ const i = N(t, n), o = K(t, n), r = rt(t, o, n), a = e.querySelector(".rte-citations-status"), s = e.querySelector('[data-action="cycle-style"]'), u = e.querySelector(".rte-citations-recent-list");
348
329
  if (a) {
349
330
  const c = o.length;
350
- a.textContent = `${e.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${e.enableFootnoteSync ? "On" : "Off"}`;
331
+ a.textContent = `${n.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${n.enableFootnoteSync ? "On" : "Off"}`;
351
332
  }
352
- if (s && (s.textContent = `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${e.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), d) {
333
+ if (s && (s.textContent = `${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`, s.setAttribute("aria-label", `${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`)), u) {
353
334
  if (r.length === 0) {
354
- d.innerHTML = `<li class="rte-citations-empty">${g(e.labels.noCitationsText)}</li>`;
335
+ u.innerHTML = `<li class="rte-citations-empty">${g(n.labels.noCitationsText)}</li>`;
355
336
  return;
356
337
  }
357
- d.innerHTML = r.map(
338
+ u.innerHTML = r.map(
358
339
  (c) => `
359
340
  <li class="rte-citations-recent-item">
360
341
  <div class="rte-citations-recent-row">
@@ -374,211 +355,191 @@ function H(t) {
374
355
  data-action="delete-by-id"
375
356
  data-citation-id="${g(c.id)}"
376
357
  aria-label="Delete citation: ${g(c.title)}"
377
- >${g(e.labels.deleteRecentText)}</button>
358
+ >${g(n.labels.deleteRecentText)}</button>
378
359
  </div>
379
360
  </li>
380
361
  `
381
362
  ).join("");
382
363
  }
383
364
  }
384
- function y(t, n, e = !1) {
385
- const i = N(t, n), o = Vt(t, i, n.enableFootnoteSync);
386
- if (!e && pt.get(t) === o)
387
- return K(t, n);
365
+ function y(t, e, n = !1) {
366
+ const i = N(t, e), o = Vt(t, i, e.enableFootnoteSync);
367
+ if (!n && pt.get(t) === o)
368
+ return K(t, e);
388
369
  const r = R(t), a = /* @__PURE__ */ new Map();
389
370
  r.forEach((c) => {
390
- const l = wt(c, n);
371
+ const l = wt(c, e);
391
372
  l && (a.has(l.id) || a.set(l.id, l));
392
373
  });
393
374
  const s = Array.from(a.values());
394
- rt(t, s, n);
395
- const d = /* @__PURE__ */ new Map();
375
+ rt(t, s, e);
376
+ const u = /* @__PURE__ */ new Map();
396
377
  return s.forEach((c, l) => {
397
- d.set(c.id, l + 1);
378
+ u.set(c.id, l + 1);
398
379
  }), r.forEach((c) => {
399
- const l = c.getAttribute("data-citation-id") || "", u = a.get(l);
400
- if (!u)
401
- return;
402
- vt(c, u, i);
403
- const b = d.get(u.id) || 1;
404
- Gt(c, u, i, Math.max(1, b));
405
- }), Ut(t, s, n, i), Wt(t, s, n, i), pt.set(t, o), H(t), t.dispatchEvent(
380
+ const l = c.getAttribute("data-citation-id") || "", d = a.get(l);
381
+ if (!d) return;
382
+ vt(c, d, i);
383
+ const m = u.get(d.id) || 1;
384
+ Gt(c, d, i, Math.max(1, m));
385
+ }), Ut(t, s, e, i), Wt(t, s, e, i), pt.set(t, o), H(t), t.dispatchEvent(
406
386
  new CustomEvent("editora:citations-refreshed", {
407
387
  bubbles: !0,
408
388
  detail: {
409
389
  citations: s,
410
390
  style: i,
411
- footnoteSync: n.enableFootnoteSync
391
+ footnoteSync: e.enableFootnoteSync
412
392
  }
413
393
  })
414
394
  ), s;
415
395
  }
416
396
  function At(t) {
417
- const n = Q.get(t);
418
- typeof n == "number" && (window.clearTimeout(n), q.delete(n), Q.delete(t));
397
+ const e = Q.get(t);
398
+ typeof e == "number" && (window.clearTimeout(e), q.delete(e), Q.delete(t));
419
399
  }
420
400
  function kt(t) {
421
- const n = f.get(t) || M;
422
- if (!n)
423
- return;
401
+ const e = f.get(t) || M;
402
+ if (!e) return;
424
403
  At(t);
425
- const e = window.setTimeout(() => {
426
- q.delete(e), Q.delete(t), y(t, n, !1);
427
- }, n.debounceMs);
428
- q.add(e), Q.set(t, e);
404
+ const n = window.setTimeout(() => {
405
+ q.delete(n), Q.delete(t), y(t, e, !1);
406
+ }, e.debounceMs);
407
+ q.add(n), Q.set(t, n);
429
408
  }
430
409
  function Yt(t) {
431
- const n = window.getSelection();
432
- if (!n)
433
- throw new Error("Selection unavailable");
434
- if (n.rangeCount > 0) {
435
- const a = n.getRangeAt(0);
410
+ const e = window.getSelection();
411
+ if (!e) throw new Error("Selection unavailable");
412
+ if (e.rangeCount > 0) {
413
+ const a = e.getRangeAt(0);
436
414
  if (t.contains(a.commonAncestorContainer) && !j(a.commonAncestorContainer))
437
415
  return a.cloneRange();
438
416
  }
439
- const e = document.createRange(), i = t.querySelector(W), o = t.querySelector(G), r = i || o;
440
- return r ? (e.setStartBefore(r), e.collapse(!0), e) : (e.selectNodeContents(t), e.collapse(!1), e);
417
+ const n = document.createRange(), i = t.querySelector(W), o = t.querySelector(G), r = i || o;
418
+ return r ? (n.setStartBefore(r), n.collapse(!0), n) : (n.selectNodeContents(t), n.collapse(!1), n);
441
419
  }
442
420
  function dt(t) {
443
421
  t.dispatchEvent(new Event("input", { bubbles: !0 }));
444
422
  }
445
- function ft(t, n) {
446
- if (n === t.innerHTML)
447
- return;
448
- const e = window.execEditorCommand || window.executeEditorCommand;
449
- if (typeof e == "function")
423
+ function ft(t, e) {
424
+ if (e === t.innerHTML) return;
425
+ const n = window.execEditorCommand || window.executeEditorCommand;
426
+ if (typeof n == "function")
450
427
  try {
451
- e("recordDomTransaction", t, n, t.innerHTML);
428
+ n("recordDomTransaction", t, e, t.innerHTML);
452
429
  } catch {
453
430
  }
454
431
  }
455
- function Tt(t, n) {
456
- const e = window.getSelection();
457
- if (!e)
458
- return;
432
+ function Tt(t, e) {
433
+ const n = window.getSelection();
434
+ if (!n) return;
459
435
  const i = document.createRange();
460
436
  if (t.nodeType === Node.TEXT_NODE) {
461
- const o = t, r = Math.max(0, Math.min(n, o.length));
437
+ const o = t, r = Math.max(0, Math.min(e, o.length));
462
438
  i.setStart(o, r);
463
439
  } else {
464
- const o = t.childNodes.length, r = Math.max(0, Math.min(n, o));
440
+ const o = t.childNodes.length, r = Math.max(0, Math.min(e, o));
465
441
  i.setStart(t, r);
466
442
  }
467
- i.collapse(!0), e.removeAllRanges(), e.addRange(i);
443
+ i.collapse(!0), n.removeAllRanges(), n.addRange(i);
468
444
  }
469
445
  function Mt(t) {
470
446
  if (t.collapsed || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1 || !(t.startContainer instanceof Element || t.startContainer instanceof DocumentFragment))
471
447
  return null;
472
- const n = t.startContainer.childNodes[t.startOffset];
473
- return !(n instanceof HTMLElement) || !n.matches(ot) ? null : n;
448
+ const e = t.startContainer.childNodes[t.startOffset];
449
+ return !(e instanceof HTMLElement) || !e.matches(ot) ? null : e;
474
450
  }
475
- function J(t, n, e) {
451
+ function J(t, e, n) {
476
452
  const { startContainer: i, startOffset: o } = t;
477
453
  if (i.nodeType === Node.ELEMENT_NODE) {
478
454
  const a = i;
479
- if (e === "previous") {
480
- if (o > 0)
481
- return a.childNodes[o - 1] || null;
455
+ if (n === "previous") {
456
+ if (o > 0) return a.childNodes[o - 1] || null;
482
457
  } else if (o < a.childNodes.length)
483
458
  return a.childNodes[o] || null;
484
459
  }
485
- if (i.nodeType === Node.TEXT_NODE && (e === "previous" && o < i.data.length || e === "next" && o > 0))
460
+ if (i.nodeType === Node.TEXT_NODE && (n === "previous" && o < i.data.length || n === "next" && o > 0))
486
461
  return null;
487
462
  let r = i;
488
- for (; r && r !== n; ) {
489
- const a = e === "previous" ? r.previousSibling : r.nextSibling;
490
- if (a)
491
- return a;
463
+ for (; r && r !== e; ) {
464
+ const a = n === "previous" ? r.previousSibling : r.nextSibling;
465
+ if (a) return a;
492
466
  r = r.parentNode;
493
467
  }
494
468
  return null;
495
469
  }
496
- function Lt(t, n, e) {
497
- if (!t.collapsed)
498
- return null;
470
+ function Lt(t, e, n) {
471
+ if (!t.collapsed) return null;
499
472
  const i = (a) => a instanceof HTMLElement && a.matches(ot) ? a : null, { startContainer: o, startOffset: r } = t;
500
473
  if (o.nodeType === Node.ELEMENT_NODE) {
501
474
  const a = o;
502
- return e === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : e === "Delete" ? i(a.childNodes[r] || null) : null;
475
+ return n === "Backspace" && r > 0 ? i(a.childNodes[r - 1] || null) : n === "Delete" ? i(a.childNodes[r] || null) : null;
503
476
  }
504
477
  if (o.nodeType === Node.TEXT_NODE) {
505
478
  const a = o;
506
- if (e === "Backspace" && r === 0) {
479
+ if (n === "Backspace" && r === 0) {
507
480
  const s = i(a.previousSibling);
508
- return s || i(J(t, n, "previous"));
481
+ return s || i(J(t, e, "previous"));
509
482
  }
510
- if (e === "Delete" && r === a.data.length) {
483
+ if (n === "Delete" && r === a.data.length) {
511
484
  const s = i(a.nextSibling);
512
- return s || i(J(t, n, "next"));
485
+ return s || i(J(t, e, "next"));
513
486
  }
514
487
  }
515
- return i(e === "Backspace" ? J(t, n, "previous") : J(t, n, "next"));
488
+ return i(n === "Backspace" ? J(t, e, "previous") : J(t, e, "next"));
516
489
  }
517
- function P(t, n, e) {
518
- const i = t.closest($);
519
- if (!i || j(t))
520
- return !1;
490
+ function P(t, e, n) {
491
+ const i = t.closest(S);
492
+ if (!i || j(t)) return !1;
521
493
  const o = t.parentNode;
522
- if (!o)
523
- return !1;
494
+ if (!o) return !1;
524
495
  const r = i.innerHTML, a = Array.from(o.childNodes).indexOf(t);
525
- if (a < 0)
526
- return !1;
496
+ if (a < 0) return !1;
527
497
  const s = t.nextSibling;
528
- return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Tt(o, a), y(i, e, !0), ft(i, r), dt(i), n === "Delete" && i.focus({ preventScroll: !0 }), !0;
498
+ return s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), t.remove(), Tt(o, a), y(i, n, !0), ft(i, r), dt(i), e === "Delete" && i.focus({ preventScroll: !0 }), !0;
529
499
  }
530
- function Xt(t, n, e) {
531
- if (t.key !== "Backspace" && t.key !== "Delete")
532
- return !1;
500
+ function Xt(t, e, n) {
501
+ if (t.key !== "Backspace" && t.key !== "Delete") return !1;
533
502
  const i = t.key, o = t.target;
534
- if (o != null && o.matches(ot) && n.contains(o) && !j(o))
535
- return t.preventDefault(), t.stopPropagation(), P(o, i, e);
503
+ if (o?.matches(ot) && e.contains(o) && !j(o))
504
+ return t.preventDefault(), t.stopPropagation(), P(o, i, n);
536
505
  const r = window.getSelection();
537
- if (!r || r.rangeCount === 0)
538
- return !1;
506
+ if (!r || r.rangeCount === 0) return !1;
539
507
  const a = r.getRangeAt(0);
540
- if (!n.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer))
541
- return !1;
508
+ if (!e.contains(a.commonAncestorContainer) || j(a.commonAncestorContainer)) return !1;
542
509
  const s = Mt(a);
543
510
  if (s)
544
- return t.preventDefault(), t.stopPropagation(), P(s, i, e);
545
- const d = Lt(a, n, i);
546
- return d ? (t.preventDefault(), t.stopPropagation(), P(d, i, e)) : !1;
511
+ return t.preventDefault(), t.stopPropagation(), P(s, i, n);
512
+ const u = Lt(a, e, i);
513
+ return u ? (t.preventDefault(), t.stopPropagation(), P(u, i, n)) : !1;
547
514
  }
548
- function Rt(t, n, e) {
549
- const i = F(e.normalizeText(n || ""));
550
- if (!i)
551
- return !1;
515
+ function Rt(t, e, n) {
516
+ const i = F(n.normalizeText(e || ""));
517
+ if (!i) return !1;
552
518
  const o = R(t).filter((a) => a.getAttribute("data-citation-id") === i);
553
- if (o.length === 0)
554
- return !1;
519
+ if (o.length === 0) return !1;
555
520
  if (o.length === 1)
556
- return P(o[0], "Delete", e);
521
+ return P(o[0], "Delete", n);
557
522
  const r = t.innerHTML;
558
523
  return o.forEach((a) => {
559
524
  const s = a.nextSibling;
560
525
  s instanceof Text && (s.data === " " ? s.remove() : s.data.startsWith(" ") && (s.data = s.data.slice(1))), a.remove();
561
- }), Tt(t, t.childNodes.length), y(t, e, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
526
+ }), Tt(t, t.childNodes.length), y(t, n, !0), ft(t, r), dt(t), t.focus({ preventScroll: !0 }), !0;
562
527
  }
563
- function Jt(t, n) {
564
- const e = window.getSelection();
565
- if (!e || e.rangeCount === 0)
566
- return !1;
567
- const i = e.getRangeAt(0);
568
- if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer))
569
- return !1;
528
+ function Jt(t, e) {
529
+ const n = window.getSelection();
530
+ if (!n || n.rangeCount === 0) return !1;
531
+ const i = n.getRangeAt(0);
532
+ if (!t.contains(i.commonAncestorContainer) || j(i.commonAncestorContainer)) return !1;
570
533
  const o = Mt(i);
571
534
  if (o)
572
- return P(o, "Delete", n);
535
+ return P(o, "Delete", e);
573
536
  const r = Lt(i, t, "Backspace");
574
- return r ? P(r, "Backspace", n) : !1;
537
+ return r ? P(r, "Backspace", e) : !1;
575
538
  }
576
- function et(t, n, e) {
577
- var l, u;
578
- const i = yt(n, e);
579
- if (!i.author || !i.title)
580
- return !1;
581
- i.id || (i.id = Ht(t, e));
539
+ function et(t, e, n) {
540
+ const i = yt(e, n);
541
+ if (!i.author || !i.title) return !1;
542
+ i.id || (i.id = Ht(t, n));
582
543
  const o = t.innerHTML;
583
544
  let r;
584
545
  try {
@@ -587,104 +548,97 @@ function et(t, n, e) {
587
548
  return !1;
588
549
  }
589
550
  const a = window.getSelection();
590
- if (!a)
591
- return !1;
551
+ if (!a) return !1;
592
552
  r.collapsed || r.deleteContents();
593
553
  const s = document.createElement("span");
594
- vt(s, i, N(t, e));
554
+ vt(s, i, N(t, n));
595
555
  try {
596
556
  r.insertNode(s);
597
557
  } catch {
598
558
  return !1;
599
559
  }
600
- const d = document.createTextNode(" ");
601
- s.nextSibling ? (l = s.parentNode) == null || l.insertBefore(d, s.nextSibling) : (u = s.parentNode) == null || u.appendChild(d);
560
+ const u = document.createTextNode(" ");
561
+ s.nextSibling ? s.parentNode?.insertBefore(u, s.nextSibling) : s.parentNode?.appendChild(u);
602
562
  const c = document.createRange();
603
- if (d.parentNode) {
604
- const b = Array.from(d.parentNode.childNodes).indexOf(d) + 1;
605
- c.setStart(d.parentNode, Math.max(0, b));
563
+ if (u.parentNode) {
564
+ const l = Array.from(u.parentNode.childNodes).indexOf(u) + 1;
565
+ c.setStart(u.parentNode, Math.max(0, l));
606
566
  } else
607
567
  c.setStartAfter(s);
608
- return c.collapse(!0), a.removeAllRanges(), a.addRange(c), _t(t, i, e), y(t, e, !0), ft(t, o), dt(t), !0;
568
+ return c.collapse(!0), a.removeAllRanges(), a.addRange(c), _t(t, i, n), y(t, n, !0), ft(t, o), dt(t), !0;
609
569
  }
610
- function Zt(t, n) {
611
- if (!n)
612
- return !1;
613
- const e = R(t).find((r) => r.getAttribute("data-citation-id") === n) || null;
614
- if (!e)
615
- return !1;
616
- e.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 });
570
+ function Zt(t, e) {
571
+ if (!e) return !1;
572
+ const n = R(t).find((r) => r.getAttribute("data-citation-id") === e) || null;
573
+ if (!n) return !1;
574
+ n.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), n.focus({ preventScroll: !0 });
617
575
  const i = window.getSelection();
618
- if (!i)
619
- return !0;
576
+ if (!i) return !0;
620
577
  const o = document.createRange();
621
- return o.selectNode(e), i.removeAllRanges(), i.addRange(o), !0;
578
+ return o.selectNode(n), i.removeAllRanges(), i.addRange(o), !0;
622
579
  }
623
580
  function nt(t) {
624
581
  return V.get(t) === !0;
625
582
  }
626
- function U(t, n = !1) {
627
- const e = v.get(t);
628
- e && (e.classList.remove("show"), V.set(t, !1), it(t, "toggleCitationsPanel", !1), n && t.focus({ preventScroll: !0 }));
583
+ function U(t, e = !1) {
584
+ const n = v.get(t);
585
+ n && (n.classList.remove("show"), V.set(t, !1), it(t, "toggleCitationsPanel", !1), e && t.focus({ preventScroll: !0 }));
629
586
  }
630
587
  function Qt(t) {
631
- v.forEach((n, e) => {
632
- e !== t && U(e, !1);
588
+ v.forEach((e, n) => {
589
+ n !== t && U(n, !1);
633
590
  });
634
591
  }
635
- function ct(t, n) {
636
- if (!n.classList.contains("show"))
637
- return;
592
+ function ct(t, e) {
593
+ if (!e.classList.contains("show")) return;
638
594
  const i = lt(t).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 380), r = Math.max(10, window.innerWidth - o - 10), a = Math.min(Math.max(10, i.right - o), r), s = Math.max(10, Math.min(window.innerHeight - 10 - 260, i.top + 10));
639
- n.style.width = `${o}px`, n.style.left = `${a}px`, n.style.top = `${s}px`, n.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
595
+ e.style.width = `${o}px`, e.style.left = `${a}px`, e.style.top = `${s}px`, e.style.maxHeight = `${Math.max(260, window.innerHeight - 24)}px`;
640
596
  }
641
- function C(t, n) {
642
- return t.querySelector(`[data-field="${n}"]`);
597
+ function C(t, e) {
598
+ return t.querySelector(`[data-field="${e}"]`);
643
599
  }
644
600
  function te(t) {
645
- var s, d, c, l, u, b;
646
- const n = ((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) || "", o = ((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) || "";
601
+ const e = C(t, "author")?.value || "", n = C(t, "year")?.value || "", i = C(t, "title")?.value || "", o = C(t, "source")?.value || "", r = C(t, "url")?.value || "", a = C(t, "note")?.value || "";
647
602
  return {
648
- author: n,
649
- year: e,
603
+ author: e,
604
+ year: n,
650
605
  title: i,
651
606
  source: o,
652
607
  url: r,
653
608
  note: a
654
609
  };
655
610
  }
656
- function E(t, n) {
657
- const e = t.querySelector(".rte-citations-live");
658
- e && (e.textContent = n);
611
+ function E(t, e) {
612
+ const n = t.querySelector(".rte-citations-live");
613
+ n && (n.textContent = e);
659
614
  }
660
- function ee(t, n, e) {
661
- const i = C(n, "style");
662
- i && (i.value = N(t, e));
615
+ function ee(t, e, n) {
616
+ const i = C(e, "style");
617
+ i && (i.value = N(t, n));
663
618
  }
664
- function Nt(t, n, e) {
665
- const i = L.includes(n) ? n : e.defaultStyle;
666
- return T.set(t, i), y(t, e, !0), i;
619
+ function Nt(t, e, n) {
620
+ const i = L.includes(e) ? e : n.defaultStyle;
621
+ return T.set(t, i), y(t, n, !0), i;
667
622
  }
668
- function bt(t, n) {
669
- const e = N(t, n), i = L.indexOf(e), o = L[(i + 1) % L.length];
670
- return T.set(t, o), y(t, n, !0), o;
623
+ function bt(t, e) {
624
+ const n = N(t, e), i = L.indexOf(n), o = L[(i + 1) % L.length];
625
+ return T.set(t, o), y(t, e, !0), o;
671
626
  }
672
627
  function ne(t) {
673
- const n = v.get(t);
674
- if (n)
675
- return n;
676
- const e = f.get(t) || M || Z(), i = `rte-citations-panel-${Ot++}`, o = document.createElement("section");
677
- o.className = m, o.id = i, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", e.labels.panelAriaLabel), o.setAttribute("tabindex", "-1"), o.innerHTML = `
628
+ const e = v.get(t);
629
+ if (e) return e;
630
+ const n = f.get(t) || M || Z(), i = `rte-citations-panel-${Ot++}`, o = document.createElement("section");
631
+ o.className = b, o.id = i, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", n.labels.panelAriaLabel), o.setAttribute("tabindex", "-1"), o.innerHTML = `
678
632
  <header class="rte-citations-header">
679
- <h2 class="rte-citations-title">${g(e.labels.panelTitle)}</h2>
680
- <button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(e.labels.closeText)}">✕</button>
633
+ <h2 class="rte-citations-title">${g(n.labels.panelTitle)}</h2>
634
+ <button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(n.labels.closeText)}">✕</button>
681
635
  </header>
682
636
  <div class="rte-citations-body">
683
637
  <p class="rte-citations-status" aria-live="polite"></p>
684
638
 
685
639
  <div class="rte-citations-grid">
686
640
  <label class="rte-citations-label">
687
- ${g(e.labels.styleLabel)}
641
+ ${g(n.labels.styleLabel)}
688
642
  <select data-field="style" class="rte-citations-field">
689
643
  <option value="apa">APA</option>
690
644
  <option value="mla">MLA</option>
@@ -692,39 +646,39 @@ function ne(t) {
692
646
  </select>
693
647
  </label>
694
648
  <label class="rte-citations-label">
695
- ${g(e.labels.authorLabel)}
649
+ ${g(n.labels.authorLabel)}
696
650
  <input type="text" data-field="author" class="rte-citations-field" autocomplete="off" />
697
651
  </label>
698
652
  <label class="rte-citations-label">
699
- ${g(e.labels.yearLabel)}
653
+ ${g(n.labels.yearLabel)}
700
654
  <input type="text" data-field="year" class="rte-citations-field" inputmode="numeric" autocomplete="off" />
701
655
  </label>
702
656
  <label class="rte-citations-label">
703
- ${g(e.labels.titleLabel)}
657
+ ${g(n.labels.titleLabel)}
704
658
  <input type="text" data-field="title" class="rte-citations-field" autocomplete="off" />
705
659
  </label>
706
660
  <label class="rte-citations-label">
707
- ${g(e.labels.sourceLabel)}
661
+ ${g(n.labels.sourceLabel)}
708
662
  <input type="text" data-field="source" class="rte-citations-field" autocomplete="off" />
709
663
  </label>
710
664
  <label class="rte-citations-label">
711
- ${g(e.labels.urlLabel)}
665
+ ${g(n.labels.urlLabel)}
712
666
  <input type="url" data-field="url" class="rte-citations-field" autocomplete="off" />
713
667
  </label>
714
668
  <label class="rte-citations-label rte-citations-label-note">
715
- ${g(e.labels.noteLabel)}
669
+ ${g(n.labels.noteLabel)}
716
670
  <textarea data-field="note" class="rte-citations-field" rows="2"></textarea>
717
671
  </label>
718
672
  </div>
719
673
 
720
674
  <div class="rte-citations-controls" role="toolbar" aria-label="Citation actions">
721
- <button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(e.labels.insertText)}</button>
722
- <button type="button" class="rte-citations-btn" data-action="refresh">${g(e.labels.refreshText)}</button>
675
+ <button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(n.labels.insertText)}</button>
676
+ <button type="button" class="rte-citations-btn" data-action="refresh">${g(n.labels.refreshText)}</button>
723
677
  <button type="button" class="rte-citations-btn" data-action="cycle-style"></button>
724
678
  </div>
725
679
 
726
- <section class="rte-citations-recent" aria-label="${g(e.labels.recentHeading)}">
727
- <h3 class="rte-citations-recent-heading">${g(e.labels.recentHeading)}</h3>
680
+ <section class="rte-citations-recent" aria-label="${g(n.labels.recentHeading)}">
681
+ <h3 class="rte-citations-recent-heading">${g(n.labels.recentHeading)}</h3>
728
682
  <ul class="rte-citations-recent-list" role="list"></ul>
729
683
  </section>
730
684
 
@@ -733,25 +687,22 @@ function ne(t) {
733
687
  </div>
734
688
  `, o.addEventListener("click", (a) => {
735
689
  const s = a.target;
736
- if (!s)
737
- return;
738
- const d = s.closest("[data-action]");
739
- if (!d)
740
- return;
741
- const c = d.getAttribute("data-action") || "", l = f.get(t) || M || e;
690
+ if (!s) return;
691
+ const u = s.closest("[data-action]");
692
+ if (!u) return;
693
+ const c = u.getAttribute("data-action") || "", l = f.get(t) || M || n;
742
694
  if (f.set(t, l), c === "close") {
743
695
  U(t, !0);
744
696
  return;
745
697
  }
746
698
  if (c === "insert") {
747
- if (S(t))
748
- return;
749
- const u = te(o);
750
- if (!l.normalizeText(u.author) || !l.normalizeText(u.title)) {
699
+ if ($(t)) return;
700
+ const d = te(o);
701
+ if (!l.normalizeText(d.author) || !l.normalizeText(d.title)) {
751
702
  E(o, l.labels.invalidMessage);
752
703
  return;
753
704
  }
754
- if (!et(t, u, l)) {
705
+ if (!et(t, d, l)) {
755
706
  E(o, l.labels.invalidMessage);
756
707
  return;
757
708
  }
@@ -761,33 +712,30 @@ function ne(t) {
761
712
  return;
762
713
  }
763
714
  if (c === "refresh") {
764
- const u = y(t, l, !0);
765
- E(o, `Refreshed ${u.length} citation${u.length === 1 ? "" : "s"}.`);
715
+ const d = y(t, l, !0);
716
+ E(o, `Refreshed ${d.length} citation${d.length === 1 ? "" : "s"}.`);
766
717
  return;
767
718
  }
768
719
  if (c === "cycle-style") {
769
- const u = bt(t, l);
770
- ee(t, o, l), E(o, `Style changed to ${u.toUpperCase()}.`);
720
+ const d = bt(t, l);
721
+ ee(t, o, l), E(o, `Style changed to ${d.toUpperCase()}.`);
771
722
  return;
772
723
  }
773
724
  if (c === "insert-from-recent") {
774
- if (S(t))
775
- return;
776
- const u = d.getAttribute("data-citation-id") || "", b = Et(t, u, K(t, l), l);
777
- if (!b)
778
- return;
779
- et(t, b, l), E(o, `Inserted citation: ${b.title}.`);
725
+ if ($(t)) return;
726
+ const d = u.getAttribute("data-citation-id") || "", m = Et(t, d, K(t, l), l);
727
+ if (!m) return;
728
+ et(t, m, l), E(o, `Inserted citation: ${m.title}.`);
780
729
  return;
781
730
  }
782
731
  if (c === "delete-by-id") {
783
- if (S(t))
784
- return;
785
- const u = d.getAttribute("data-citation-id") || "";
786
- if (Rt(t, u, l)) {
732
+ if ($(t)) return;
733
+ const d = u.getAttribute("data-citation-id") || "";
734
+ if (Rt(t, d, l)) {
787
735
  E(o, "Citation deleted.");
788
736
  return;
789
737
  }
790
- qt(t, u, l) && (H(t), E(o, "Removed from recent citations."));
738
+ qt(t, d, l) && (H(t), E(o, "Removed from recent citations."));
791
739
  }
792
740
  }), o.addEventListener("keydown", (a) => {
793
741
  if (a.key === "Escape") {
@@ -795,86 +743,78 @@ function ne(t) {
795
743
  return;
796
744
  }
797
745
  const s = a.target;
798
- if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp")
799
- return;
800
- const d = Array.from(o.querySelectorAll(".rte-citations-recent-btn"));
801
- if (d.length === 0)
802
- return;
803
- const c = d.indexOf(s);
804
- if (c < 0)
805
- return;
746
+ if (!s || !s.matches(".rte-citations-recent-btn") || a.key !== "ArrowDown" && a.key !== "ArrowUp") return;
747
+ const u = Array.from(o.querySelectorAll(".rte-citations-recent-btn"));
748
+ if (u.length === 0) return;
749
+ const c = u.indexOf(s);
750
+ if (c < 0) return;
806
751
  a.preventDefault();
807
- const l = a.key === "ArrowDown" ? 1 : -1, u = (c + l + d.length) % d.length;
808
- d[u].focus();
752
+ const l = a.key === "ArrowDown" ? 1 : -1, d = (c + l + u.length) % u.length;
753
+ u[d].focus();
809
754
  });
810
755
  const r = C(o, "style");
811
- return r == null || r.addEventListener("change", () => {
812
- const a = f.get(t) || M || e, s = r.value;
756
+ return r?.addEventListener("change", () => {
757
+ const a = f.get(t) || M || n, s = r.value;
813
758
  Nt(t, s, a), E(o, `Style changed to ${s.toUpperCase()}.`);
814
759
  }), tt(o, t), document.body.appendChild(o), v.set(t, o), V.set(t, !1), H(t), o;
815
760
  }
816
761
  function z(t) {
817
- const n = ne(t);
818
- Qt(t), n.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(n, t), ct(t, n), H(t);
819
- const e = C(n, "author");
820
- e == null || e.focus();
762
+ const e = ne(t);
763
+ Qt(t), e.classList.add("show"), V.set(t, !0), it(t, "toggleCitationsPanel", !0), tt(e, t), ct(t, e), H(t), C(e, "author")?.focus();
821
764
  }
822
- function zt(t, n) {
823
- const e = nt(t);
824
- return (typeof n == "boolean" ? n : !e) ? z(t) : U(t, !1), !0;
765
+ function zt(t, e) {
766
+ const n = nt(t);
767
+ return (typeof e == "boolean" ? e : !n) ? z(t) : U(t, !1), !0;
825
768
  }
826
769
  function oe(t) {
827
- const n = t.key.toLowerCase();
828
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "c";
770
+ const e = t.key.toLowerCase();
771
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "c";
829
772
  }
830
773
  function ie(t) {
831
- const n = t.key.toLowerCase();
832
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "b";
774
+ const e = t.key.toLowerCase();
775
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "b";
833
776
  }
834
777
  function re(t) {
835
- const n = t.key.toLowerCase();
836
- return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && n === "j";
778
+ const e = t.key.toLowerCase();
779
+ return (t.metaKey || t.ctrlKey) && t.altKey && t.shiftKey && e === "j";
837
780
  }
838
781
  function ae(t) {
839
- M = t, I || (I = (n) => {
840
- const e = n.target, i = e == null ? void 0 : e.closest($);
841
- if (!i)
842
- return;
782
+ M = t, I || (I = (e) => {
783
+ const i = e.target?.closest(S);
784
+ if (!i) return;
843
785
  p = i, f.has(i) || f.set(i, t), T.has(i) || T.set(i, t.defaultStyle);
844
786
  const o = v.get(i);
845
787
  o && (tt(o, i), ct(i, o)), it(i, "toggleCitationsPanel", nt(i));
846
- }, document.addEventListener("focusin", I, !0)), B || (B = (n) => {
847
- const e = n.target, i = e == null ? void 0 : e.closest($);
788
+ }, document.addEventListener("focusin", I, !0)), B || (B = (e) => {
789
+ const i = e.target?.closest(S);
848
790
  i && (p = i, kt(i));
849
- }, document.addEventListener("input", B, !0)), O || (O = (n) => {
850
- if (n.defaultPrevented)
851
- return;
852
- const e = n.target, i = !!(e != null && e.closest(`.${m} input, .${m} textarea, .${m} select`)), o = h(void 0, !1);
853
- if (!o || S(o))
854
- return;
791
+ }, document.addEventListener("input", B, !0)), O || (O = (e) => {
792
+ if (e.defaultPrevented) return;
793
+ const i = !!e.target?.closest(`.${b} input, .${b} textarea, .${b} select`), o = h(void 0, !1);
794
+ if (!o || $(o)) return;
855
795
  const r = f.get(o) || M || t;
856
- if (f.set(o, r), p = o, n.key === "Escape" && nt(o)) {
857
- n.preventDefault(), U(o, !0);
796
+ if (f.set(o, r), p = o, e.key === "Escape" && nt(o)) {
797
+ e.preventDefault(), U(o, !0);
858
798
  return;
859
799
  }
860
- if (!i && !Xt(n, o, r)) {
861
- if (oe(n)) {
862
- n.preventDefault(), n.stopPropagation(), zt(o);
800
+ if (!i && !Xt(e, o, r)) {
801
+ if (oe(e)) {
802
+ e.preventDefault(), e.stopPropagation(), zt(o);
863
803
  return;
864
804
  }
865
- if (ie(n)) {
866
- n.preventDefault(), n.stopPropagation(), y(o, r, !0), z(o);
805
+ if (ie(e)) {
806
+ e.preventDefault(), e.stopPropagation(), y(o, r, !0), z(o);
867
807
  return;
868
808
  }
869
- re(n) && (n.preventDefault(), n.stopPropagation(), bt(o, r));
809
+ re(e) && (e.preventDefault(), e.stopPropagation(), bt(o, r));
870
810
  }
871
811
  }, document.addEventListener("keydown", O, !0)), k || (k = () => {
872
- v.forEach((n, e) => {
873
- if (!e.isConnected || !n.isConnected) {
874
- At(e), n.remove(), v.delete(e), V.delete(e);
812
+ v.forEach((e, n) => {
813
+ if (!n.isConnected || !e.isConnected) {
814
+ At(n), e.remove(), v.delete(n), V.delete(n);
875
815
  return;
876
816
  }
877
- tt(n, e), ct(e, n);
817
+ tt(e, n), ct(n, e);
878
818
  });
879
819
  }, window.addEventListener("scroll", k, !0), window.addEventListener("resize", k));
880
820
  }
@@ -882,10 +822,9 @@ function se() {
882
822
  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;
883
823
  }
884
824
  function ce() {
885
- if (typeof document > "u" || document.getElementById(gt))
886
- return;
825
+ if (typeof document > "u" || document.getElementById(mt)) return;
887
826
  const t = document.createElement("style");
888
- t.id = gt, t.textContent = `
827
+ t.id = mt, t.textContent = `
889
828
  .rte-toolbar-group-items.citations,
890
829
  .editora-toolbar-group-items.citations {
891
830
  display: flex;
@@ -913,7 +852,7 @@ function ce() {
913
852
 
914
853
  ${x} .rte-toolbar-group-items.citations,
915
854
  ${x} .editora-toolbar-group-items.citations,
916
- .${m}.rte-citations-theme-dark {
855
+ .${b}.rte-citations-theme-dark {
917
856
  border-color: #566275;
918
857
  }
919
858
 
@@ -931,7 +870,7 @@ function ce() {
931
870
  ${x} .editora-toolbar-button[data-command="toggleCitationsPanel"].active {
932
871
  background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
933
872
  }
934
- .${m} {
873
+ .${b} {
935
874
  position: fixed;
936
875
  z-index: 1500;
937
876
  right: 16px;
@@ -948,11 +887,11 @@ function ce() {
948
887
  overflow: hidden;
949
888
  }
950
889
 
951
- .${m}.show {
890
+ .${b}.show {
952
891
  display: flex;
953
892
  }
954
893
 
955
- .${m}.rte-citations-theme-dark {
894
+ .${b}.rte-citations-theme-dark {
956
895
  background: #0f172a;
957
896
  color: #e2e8f0;
958
897
  border-color: #334155;
@@ -968,7 +907,7 @@ function ce() {
968
907
  background: #f8fafc;
969
908
  }
970
909
 
971
- .${m}.rte-citations-theme-dark .rte-citations-header {
910
+ .${b}.rte-citations-theme-dark .rte-citations-header {
972
911
  border-bottom-color: #334155;
973
912
  background: #111827;
974
913
  }
@@ -1005,14 +944,14 @@ function ce() {
1005
944
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
1006
945
  }
1007
946
 
1008
- .${m}.rte-citations-theme-dark .rte-citations-icon-btn {
947
+ .${b}.rte-citations-theme-dark .rte-citations-icon-btn {
1009
948
  background: #0f172a;
1010
949
  border-color: #475569;
1011
950
  color: #e2e8f0;
1012
951
  }
1013
952
 
1014
- .${m}.rte-citations-theme-dark .rte-citations-icon-btn:hover,
1015
- .${m}.rte-citations-theme-dark .rte-citations-icon-btn:focus-visible {
953
+ .${b}.rte-citations-theme-dark .rte-citations-icon-btn:hover,
954
+ .${b}.rte-citations-theme-dark .rte-citations-icon-btn:focus-visible {
1016
955
  border-color: #60a5fa;
1017
956
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
1018
957
  }
@@ -1031,7 +970,7 @@ function ce() {
1031
970
  color: #475569;
1032
971
  }
1033
972
 
1034
- .${m}.rte-citations-theme-dark .rte-citations-status {
973
+ .${b}.rte-citations-theme-dark .rte-citations-status {
1035
974
  color: #94a3b8;
1036
975
  }
1037
976
 
@@ -1072,7 +1011,7 @@ function ce() {
1072
1011
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
1073
1012
  }
1074
1013
 
1075
- .${m}.rte-citations-theme-dark .rte-citations-field {
1014
+ .${b}.rte-citations-theme-dark .rte-citations-field {
1076
1015
  border-color: #334155;
1077
1016
  background: #0b1220;
1078
1017
  color: #e2e8f0;
@@ -1114,13 +1053,13 @@ function ce() {
1114
1053
  border-color: #1e40af;
1115
1054
  }
1116
1055
 
1117
- .${m}.rte-citations-theme-dark .rte-citations-btn {
1056
+ .${b}.rte-citations-theme-dark .rte-citations-btn {
1118
1057
  border-color: #334155;
1119
1058
  background: #0b1220;
1120
1059
  color: #e2e8f0;
1121
1060
  }
1122
1061
 
1123
- .${m}.rte-citations-theme-dark .rte-citations-btn-primary {
1062
+ .${b}.rte-citations-theme-dark .rte-citations-btn-primary {
1124
1063
  border-color: #2563eb;
1125
1064
  background: #2563eb;
1126
1065
  color: #ffffff;
@@ -1132,7 +1071,7 @@ function ce() {
1132
1071
  padding: 8px;
1133
1072
  }
1134
1073
 
1135
- .${m}.rte-citations-theme-dark .rte-citations-recent {
1074
+ .${b}.rte-citations-theme-dark .rte-citations-recent {
1136
1075
  border-color: #334155;
1137
1076
  }
1138
1077
 
@@ -1200,13 +1139,13 @@ function ce() {
1200
1139
  box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.18);
1201
1140
  }
1202
1141
 
1203
- .${m}.rte-citations-theme-dark .rte-citations-recent-btn {
1142
+ .${b}.rte-citations-theme-dark .rte-citations-recent-btn {
1204
1143
  border-color: #334155;
1205
1144
  background: #0b1220;
1206
1145
  color: #e2e8f0;
1207
1146
  }
1208
1147
 
1209
- .${m}.rte-citations-theme-dark .rte-citations-recent-delete {
1148
+ .${b}.rte-citations-theme-dark .rte-citations-recent-delete {
1210
1149
  border-color: #7f1d1d;
1211
1150
  background: #2b1218;
1212
1151
  color: #fca5a5;
@@ -1224,7 +1163,7 @@ function ce() {
1224
1163
  line-height: 1.3;
1225
1164
  }
1226
1165
 
1227
- .${m}.rte-citations-theme-dark .rte-citations-recent-meta {
1166
+ .${b}.rte-citations-theme-dark .rte-citations-recent-meta {
1228
1167
  color: #94a3b8;
1229
1168
  }
1230
1169
 
@@ -1236,7 +1175,7 @@ function ce() {
1236
1175
  color: #64748b;
1237
1176
  }
1238
1177
 
1239
- .${m}.rte-citations-theme-dark .rte-citations-empty {
1178
+ .${b}.rte-citations-theme-dark .rte-citations-empty {
1240
1179
  border-color: #334155;
1241
1180
  color: #94a3b8;
1242
1181
  }
@@ -1247,7 +1186,7 @@ function ce() {
1247
1186
  color: #64748b;
1248
1187
  }
1249
1188
 
1250
- .${m}.rte-citations-theme-dark .rte-citations-shortcut {
1189
+ .${b}.rte-citations-theme-dark .rte-citations-shortcut {
1251
1190
  color: #94a3b8;
1252
1191
  }
1253
1192
 
@@ -1337,7 +1276,7 @@ function ce() {
1337
1276
  }
1338
1277
 
1339
1278
  @media (max-width: 768px) {
1340
- .${m} {
1279
+ .${b} {
1341
1280
  left: 10px !important;
1342
1281
  right: 10px;
1343
1282
  top: 10px !important;
@@ -1356,7 +1295,7 @@ function ce() {
1356
1295
  `, document.head.appendChild(t);
1357
1296
  }
1358
1297
  const le = (t = {}) => {
1359
- const n = Z(t);
1298
+ const e = Z(t);
1360
1299
  return ce(), {
1361
1300
  name: "citations",
1362
1301
  toolbar: [
@@ -1391,60 +1330,53 @@ const le = (t = {}) => {
1391
1330
  }
1392
1331
  ],
1393
1332
  commands: {
1394
- citations: (e, i) => {
1333
+ citations: (n, i) => {
1395
1334
  const o = h(i);
1396
- if (!o || S(o))
1397
- return !1;
1398
- const r = f.get(o) || n;
1335
+ if (!o || $(o)) return !1;
1336
+ const r = f.get(o) || e;
1399
1337
  return f.set(o, r), T.set(o, N(o, r)), p = o, z(o), y(o, r, !1), !0;
1400
1338
  },
1401
- toggleCitationsPanel: (e, i) => {
1339
+ toggleCitationsPanel: (n, i) => {
1402
1340
  const o = h(i);
1403
- if (!o || S(o))
1404
- return !1;
1405
- const r = f.get(o) || n;
1341
+ if (!o || $(o)) return !1;
1342
+ const r = f.get(o) || e;
1406
1343
  f.set(o, r), p = o;
1407
- const a = zt(o, typeof e == "boolean" ? e : void 0);
1344
+ const a = zt(o, typeof n == "boolean" ? n : void 0);
1408
1345
  return nt(o) && y(o, r, !1), a;
1409
1346
  },
1410
- insertCitation: (e, i) => {
1347
+ insertCitation: (n, i) => {
1411
1348
  const o = h(i);
1412
- if (!o || S(o) || !e || typeof e != "object")
1413
- return !1;
1414
- const r = f.get(o) || n;
1349
+ if (!o || $(o) || !n || typeof n != "object") return !1;
1350
+ const r = f.get(o) || e;
1415
1351
  f.set(o, r), p = o;
1416
- const a = et(o, e, r);
1352
+ const a = et(o, n, r);
1417
1353
  return a && z(o), a;
1418
1354
  },
1419
- refreshCitations: (e, i) => {
1355
+ refreshCitations: (n, i) => {
1420
1356
  const o = h(i);
1421
- if (!o)
1422
- return !1;
1423
- const r = f.get(o) || n;
1357
+ if (!o) return !1;
1358
+ const r = f.get(o) || e;
1424
1359
  return f.set(o, r), p = o, y(o, r, !0), z(o), !0;
1425
1360
  },
1426
- setCitationStyle: (e, i) => {
1361
+ setCitationStyle: (n, i) => {
1427
1362
  const o = h(i);
1428
- if (!o || !e)
1429
- return !1;
1430
- const r = f.get(o) || n;
1431
- return f.set(o, r), p = o, Nt(o, e, r), !0;
1363
+ if (!o || !n) return !1;
1364
+ const r = f.get(o) || e;
1365
+ return f.set(o, r), p = o, Nt(o, n, r), !0;
1432
1366
  },
1433
- cycleCitationStyle: (e, i) => {
1367
+ cycleCitationStyle: (n, i) => {
1434
1368
  const o = h(i);
1435
- if (!o)
1436
- return !1;
1437
- const r = f.get(o) || n;
1369
+ if (!o) return !1;
1370
+ const r = f.get(o) || e;
1438
1371
  return f.set(o, r), p = o, bt(o, r), H(o), !0;
1439
1372
  },
1440
- getCitationRecords: (e, i) => {
1373
+ getCitationRecords: (n, i) => {
1441
1374
  const o = h(i);
1442
- if (!o)
1443
- return !1;
1444
- const r = f.get(o) || n, a = K(o, r);
1445
- if (typeof e == "function")
1375
+ if (!o) return !1;
1376
+ const r = f.get(o) || e, a = K(o, r);
1377
+ if (typeof n == "function")
1446
1378
  try {
1447
- e(a);
1379
+ n(a);
1448
1380
  } catch {
1449
1381
  }
1450
1382
  return o.__citationRecords = a, o.dispatchEvent(
@@ -1457,46 +1389,41 @@ const le = (t = {}) => {
1457
1389
  })
1458
1390
  ), !0;
1459
1391
  },
1460
- setCitationsOptions: (e, i) => {
1392
+ setCitationsOptions: (n, i) => {
1461
1393
  const o = h(i);
1462
- if (!o || !e || typeof e != "object")
1463
- return !1;
1464
- const r = f.get(o) || n, a = Z({
1394
+ if (!o || !n || typeof n != "object") return !1;
1395
+ const r = f.get(o) || e, a = Z({
1465
1396
  ...r,
1466
- ...e,
1397
+ ...n,
1467
1398
  labels: {
1468
1399
  ...r.labels,
1469
- ...e.labels || {}
1400
+ ...n.labels || {}
1470
1401
  },
1471
- normalizeText: e.normalizeText || r.normalizeText,
1472
- generateCitationId: e.generateCitationId || r.generateCitationId
1402
+ normalizeText: n.normalizeText || r.normalizeText,
1403
+ generateCitationId: n.generateCitationId || r.generateCitationId
1473
1404
  });
1474
- return f.set(o, a), e.defaultStyle && L.includes(e.defaultStyle) && T.set(o, e.defaultStyle), y(o, a, !0), H(o), !0;
1405
+ return f.set(o, a), n.defaultStyle && L.includes(n.defaultStyle) && T.set(o, n.defaultStyle), y(o, a, !0), H(o), !0;
1475
1406
  },
1476
- locateCitation: (e, i) => {
1407
+ locateCitation: (n, i) => {
1477
1408
  const o = h(i);
1478
- return !o || typeof e != "string" ? !1 : Zt(o, e);
1409
+ return !o || typeof n != "string" ? !1 : Zt(o, n);
1479
1410
  },
1480
- deleteCitation: (e, i) => {
1411
+ deleteCitation: (n, i) => {
1481
1412
  const o = h(i);
1482
- if (!o || S(o))
1483
- return !1;
1484
- const r = f.get(o) || n;
1485
- return f.set(o, r), typeof e == "string" && e.trim() ? Rt(o, e, r) : Jt(o, r);
1413
+ if (!o || $(o)) return !1;
1414
+ const r = f.get(o) || e;
1415
+ return f.set(o, r), typeof n == "string" && n.trim() ? Rt(o, n, r) : Jt(o, r);
1486
1416
  },
1487
- insertRecentCitation: (e, i) => {
1417
+ insertRecentCitation: (n, i) => {
1488
1418
  const o = h(i);
1489
- if (!o || S(o))
1490
- return !1;
1491
- const r = f.get(o) || n;
1419
+ if (!o || $(o)) return !1;
1420
+ const r = f.get(o) || e;
1492
1421
  f.set(o, r);
1493
1422
  const a = K(o, r), s = rt(o, a, r);
1494
- if (s.length === 0)
1495
- return !1;
1496
- const d = typeof e == "string" && e.trim() ? Et(o, e, a, r) : s[0];
1497
- if (!d)
1498
- return !1;
1499
- const c = et(o, d, r);
1423
+ if (s.length === 0) return !1;
1424
+ const u = typeof n == "string" && n.trim() ? Et(o, n, a, r) : s[0];
1425
+ if (!u) return !1;
1426
+ const c = et(o, u, r);
1500
1427
  return c && z(o), c;
1501
1428
  }
1502
1429
  },
@@ -1510,7 +1437,7 @@ const le = (t = {}) => {
1510
1437
  },
1511
1438
  init: function(i) {
1512
1439
  Y += 1;
1513
- const o = this && typeof this.__pluginConfig == "object" ? Z({ ...n, ...this.__pluginConfig }) : n;
1440
+ const o = this && typeof this.__pluginConfig == "object" ? Z({ ...e, ...this.__pluginConfig }) : e;
1514
1441
  ae(o);
1515
1442
  const r = h(
1516
1443
  i && i.editorElement ? { editorElement: i.editorElement } : void 0,
@@ -1519,8 +1446,8 @@ const le = (t = {}) => {
1519
1446
  r && (p = r, f.set(r, o), T.set(r, o.defaultStyle), it(r, "toggleCitationsPanel", !1), kt(r));
1520
1447
  },
1521
1448
  destroy: () => {
1522
- Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((e) => {
1523
- window.clearTimeout(e);
1449
+ Y = Math.max(0, Y - 1), !(Y > 0) && (q.forEach((n) => {
1450
+ window.clearTimeout(n);
1524
1451
  }), q.clear(), se());
1525
1452
  }
1526
1453
  };