@editora/plugins 1.0.9 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +5 -0
  2. package/dist/_commonjsHelpers-6763f629.js +1 -0
  3. package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
  4. package/dist/a11y-checker.cjs.js +12 -12
  5. package/dist/a11y-checker.esm.js +98 -80
  6. package/dist/anchor.cjs.js +12 -12
  7. package/dist/anchor.esm.js +128 -115
  8. package/dist/anchoredPopover-33f1358d.mjs +109 -0
  9. package/dist/anchoredPopover-8151d535.js +1 -0
  10. package/dist/approval-workflow.cjs.js +40 -40
  11. package/dist/approval-workflow.esm.js +249 -208
  12. package/dist/background-color.cjs.js +2 -2
  13. package/dist/background-color.esm.js +68 -55
  14. package/dist/blockquote.esm.js +2 -1
  15. package/dist/blocks-library.cjs.js +45 -45
  16. package/dist/blocks-library.esm.js +245 -178
  17. package/dist/capitalization.esm.js +2 -1
  18. package/dist/checklist.cjs.js +1 -1
  19. package/dist/checklist.esm.js +82 -58
  20. package/dist/citations.cjs.js +37 -37
  21. package/dist/citations.esm.js +512 -439
  22. package/dist/clear-formatting.cjs.js +1 -1
  23. package/dist/clear-formatting.esm.js +33 -27
  24. package/dist/code-sample.cjs.js +14 -14
  25. package/dist/code-sample.esm.js +93 -82
  26. package/dist/code.cjs.js +32 -32
  27. package/dist/code.esm.js +653 -594
  28. package/dist/comments.cjs.js +6 -6
  29. package/dist/comments.esm.js +158 -116
  30. package/dist/conditional-content.cjs.js +90 -90
  31. package/dist/conditional-content.esm.js +432 -371
  32. package/dist/content-rules.cjs.js +7 -7
  33. package/dist/content-rules.esm.js +159 -105
  34. package/dist/data-binding.cjs.js +46 -46
  35. package/dist/data-binding.esm.js +368 -328
  36. package/dist/direction.esm.js +18 -9
  37. package/dist/doc-schema.cjs.js +29 -29
  38. package/dist/doc-schema.esm.js +308 -240
  39. package/dist/document-manager.cjs.js +1 -1
  40. package/dist/document-manager.esm.js +5 -4
  41. package/dist/documentManager-25b6203c.mjs +9122 -0
  42. package/dist/documentManager-b69e7054.js +17 -0
  43. package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
  44. package/dist/embed-iframe.cjs.js +4 -4
  45. package/dist/embed-iframe.esm.js +81 -73
  46. package/dist/emojis.cjs.js +8 -8
  47. package/dist/emojis.esm.js +77 -65
  48. package/dist/enterprise.cjs.js +1 -1
  49. package/dist/enterprise.esm.js +56 -54
  50. package/dist/font-family.cjs.js +1 -1
  51. package/dist/font-family.esm.js +47 -39
  52. package/dist/font-size.cjs.js +1 -1
  53. package/dist/font-size.esm.js +53 -37
  54. package/dist/footnote.cjs.js +2 -2
  55. package/dist/footnote.esm.js +117 -76
  56. package/dist/history.cjs.js +1 -1
  57. package/dist/history.esm.js +92 -70
  58. package/dist/html2canvas.esm-09133e29.js +22 -0
  59. package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
  60. package/dist/indent.cjs.js +1 -1
  61. package/dist/indent.esm.js +24 -12
  62. package/dist/index-656d224b.js +231 -0
  63. package/dist/index-6a8c48bb.js +1 -0
  64. package/dist/index-d027b7e2.mjs +16859 -0
  65. package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
  66. package/dist/index.cjs.js +1 -1
  67. package/dist/index.es-730f2d98.mjs +5775 -0
  68. package/dist/index.es-dd40173b.js +18 -0
  69. package/dist/index.esm.js +128 -125
  70. package/dist/italic.cjs.js +1 -1
  71. package/dist/italic.esm.js +9 -8
  72. package/dist/jspdf.es.min-90db2c97.js +243 -0
  73. package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
  74. package/dist/line-height.cjs.js +1 -1
  75. package/dist/line-height.esm.js +24 -11
  76. package/dist/link.cjs.js +5 -5
  77. package/dist/link.esm.js +30 -24
  78. package/dist/list.cjs.js +1 -1
  79. package/dist/list.esm.js +25 -20
  80. package/dist/lite.cjs.js +1 -1
  81. package/dist/lite.esm.js +61 -59
  82. package/dist/math.cjs.js +21 -21
  83. package/dist/math.esm.js +146 -139
  84. package/dist/media-manager.cjs.js +38 -38
  85. package/dist/media-manager.esm.js +325 -308
  86. package/dist/mentions.cjs.js +9 -9
  87. package/dist/mentions.esm.js +286 -238
  88. package/dist/merge-tag.cjs.js +2 -2
  89. package/dist/merge-tag.esm.js +216 -177
  90. package/dist/page-break.cjs.js +2 -2
  91. package/dist/page-break.esm.js +49 -33
  92. package/dist/pii-redaction.cjs.js +19 -19
  93. package/dist/pii-redaction.esm.js +463 -393
  94. package/dist/preview.esm.js +10 -5
  95. package/dist/print.cjs.js +4 -4
  96. package/dist/print.esm.js +20 -17
  97. package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
  98. package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
  99. package/dist/slash-commands.cjs.js +3 -3
  100. package/dist/slash-commands.esm.js +212 -176
  101. package/dist/smart-paste.cjs.js +27 -27
  102. package/dist/smart-paste.esm.js +336 -280
  103. package/dist/special-characters.cjs.js +7 -7
  104. package/dist/special-characters.esm.js +69 -61
  105. package/dist/spell-check.cjs.js +5 -5
  106. package/dist/spell-check.esm.js +123 -97
  107. package/dist/strikethrough.cjs.js +1 -1
  108. package/dist/strikethrough.esm.js +19 -14
  109. package/dist/style.css +1 -0
  110. package/dist/table.cjs.js +4 -4
  111. package/dist/table.esm.js +225 -191
  112. package/dist/template.cjs.js +11 -11
  113. package/dist/template.esm.js +153 -124
  114. package/dist/text-alignment.cjs.js +1 -1
  115. package/dist/text-alignment.esm.js +27 -21
  116. package/dist/text-color.cjs.js +3 -3
  117. package/dist/text-color.esm.js +87 -70
  118. package/dist/track-changes.cjs.js +2 -2
  119. package/dist/track-changes.esm.js +162 -100
  120. package/dist/translation-workflow.cjs.js +74 -74
  121. package/dist/translation-workflow.esm.js +678 -602
  122. package/dist/version-diff.cjs.js +14 -14
  123. package/dist/version-diff.esm.js +157 -128
  124. package/package.json +13 -7
  125. package/LICENSE +0 -21
  126. package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
  127. package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
  128. package/dist/anchoredPopover-BzqGPOAE.js +0 -1
  129. package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
  130. package/dist/documentManager-CTqRftU8.mjs +0 -8369
  131. package/dist/documentManager-Jf0RbSks.js +0 -17
  132. package/dist/html2canvas.esm-B5qzocYs.js +0 -5
  133. package/dist/index-CvJk4DKa.js +0 -221
  134. package/dist/index-D3CycEFU.mjs +0 -16543
  135. package/dist/index-tqLTHcO6.js +0 -1
  136. package/dist/index.es-CE_A4QSm.js +0 -5
  137. package/dist/index.es-DQ78mYYo.mjs +0 -6665
  138. package/dist/jspdf.es.min-BoS80556.js +0 -77
  139. package/dist/plugins.css +0 -1
  140. /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
@@ -1,4 +1,4 @@
1
- const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", ke = "__editoraCommandEditorRoot", we = "rte-pii-redaction-styles", u = "rte-pii-redaction-panel", k = "pii-redaction", v = "piiRedaction", $ = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pe = typeof NodeFilter < "u" ? NodeFilter.SHOW_TEXT : 4, Ne = [
1
+ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-editor, .editora-editor, editora-editor", we = "__editoraCommandEditorRoot", Ee = "rte-pii-redaction-styles", u = "rte-pii-redaction-panel", k = "pii-redaction", v = "piiRedaction", $ = ':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)', pe = typeof NodeFilter < "u" ? NodeFilter.SHOW_TEXT : 4, Oe = [
2
2
  "email",
3
3
  "phone",
4
4
  "ssn",
@@ -6,7 +6,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
6
6
  "ipv4",
7
7
  "api-key",
8
8
  "jwt"
9
- ], Oe = {
9
+ ], ze = {
10
10
  panelTitle: "PII Redaction",
11
11
  panelAriaLabel: "PII redaction panel",
12
12
  scanText: "Scan PII",
@@ -23,7 +23,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
23
23
  matchLabel: "Detected",
24
24
  maskedLabel: "Masked",
25
25
  excerptLabel: "Context"
26
- }, ze = {
26
+ }, Fe = {
27
27
  email: {
28
28
  label: "Email",
29
29
  severity: "medium",
@@ -43,7 +43,7 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
43
43
  label: "Credit Card",
44
44
  severity: "high",
45
45
  pattern: /\b(?:\d[ -]*?){13,19}\b/g,
46
- validator: (e) => qe(e)
46
+ validator: (e) => We(e)
47
47
  },
48
48
  ipv4: {
49
49
  label: "IPv4",
@@ -60,12 +60,12 @@ const x = ".rte-content, .editora-content", ae = "[data-editora-editor], .rte-ed
60
60
  severity: "high",
61
61
  pattern: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g
62
62
  }
63
- }, f = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Set();
64
- let G = 0, Fe = 0, Ee = 0, A = null, g = null, P = null, L = null, D = null, R = null, _ = null;
65
- function p(e) {
63
+ }, f = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), te = /* @__PURE__ */ new WeakMap(), de = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new Set(), j = /* @__PURE__ */ new Set();
64
+ let G = 0, He = 0, ve = 0, M = null, g = null, L = null, D = null, _ = null, R = null, N = null;
65
+ function b(e) {
66
66
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
67
67
  }
68
- function He(e) {
68
+ function Be(e) {
69
69
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
70
70
  }
71
71
  function Y(e) {
@@ -78,31 +78,32 @@ function be(e) {
78
78
  function X(e, t, n) {
79
79
  return Math.max(t, Math.min(n, e));
80
80
  }
81
- function Be(e, t) {
81
+ function Ke(e, t) {
82
82
  return e === "high" || e === "medium" || e === "low" ? e : t;
83
83
  }
84
- function Ke(e) {
84
+ function qe(e) {
85
85
  const t = (e || "*").slice(0, 1) || "*";
86
86
  return /[A-Za-z0-9._%+\-\s]/.test(t) ? "*" : t;
87
87
  }
88
- function ve(e) {
88
+ function $e(e) {
89
89
  let t = 2166136261;
90
90
  for (let n = 0; n < e.length; n += 1)
91
91
  t ^= e.charCodeAt(n), t = Math.imul(t, 16777619);
92
92
  return t >>> 0;
93
93
  }
94
- function qe(e) {
94
+ function We(e) {
95
95
  const t = e.replace(/\D/g, "");
96
- if (t.length < 13 || t.length > 19) return !1;
96
+ if (t.length < 13 || t.length > 19)
97
+ return !1;
97
98
  let n = 0, r = !1;
98
- for (let i = t.length - 1; i >= 0; i -= 1) {
99
- let o = Number(t[i]);
100
- r && (o *= 2, o > 9 && (o -= 9)), n += o, r = !r;
99
+ for (let o = t.length - 1; o >= 0; o -= 1) {
100
+ let i = Number(t[o]);
101
+ r && (i *= 2, i > 9 && (i -= 9)), n += i, r = !r;
101
102
  }
102
103
  return n % 10 === 0;
103
104
  }
104
- function We(e, t) {
105
- const n = ze[e];
105
+ function je(e, t) {
106
+ const n = Fe[e];
106
107
  if (typeof t == "boolean")
107
108
  return {
108
109
  type: e,
@@ -125,29 +126,32 @@ function We(e, t) {
125
126
  return {
126
127
  type: e,
127
128
  label: n.label,
128
- severity: Be(t.severity, n.severity),
129
+ severity: Ke(t.severity, n.severity),
129
130
  enabled: t.enabled !== !1,
130
131
  pattern: r,
131
132
  validator: n.validator
132
133
  };
133
134
  }
134
135
  function ee(e = {}) {
135
- const t = Ne.map((r) => We(r, e.detectors?.[r])), n = t.map((r) => `${r.type}:${r.enabled ? "1" : "0"}:${r.severity}:${r.pattern.source}:${r.pattern.flags}`).join("|");
136
+ const t = Oe.map((r) => {
137
+ var o;
138
+ return je(r, (o = e.detectors) == null ? void 0 : o[r]);
139
+ }), n = t.map((r) => `${r.type}:${r.enabled ? "1" : "0"}:${r.severity}:${r.pattern.source}:${r.pattern.flags}`).join("|");
136
140
  return {
137
141
  enableRealtime: e.enableRealtime !== !1,
138
142
  debounceMs: X(Number(e.debounceMs ?? 220), 60, 3e3),
139
143
  maxFindings: X(Number(e.maxFindings ?? 140), 1, 500),
140
- maskChar: Ke(e.maskChar),
144
+ maskChar: qe(e.maskChar),
141
145
  revealStart: X(Number(e.revealStart ?? 2), 0, 12),
142
146
  revealEnd: X(Number(e.revealEnd ?? 2), 0, 12),
143
147
  redactionMode: e.redactionMode === "mask" ? "mask" : "token",
144
148
  redactionToken: (e.redactionToken || "REDACTED").trim() || "REDACTED",
145
149
  skipInCodeBlocks: e.skipInCodeBlocks !== !1,
146
150
  labels: {
147
- ...Oe,
151
+ ...ze,
148
152
  ...e.labels || {}
149
153
  },
150
- normalizeText: e.normalizeText || He,
154
+ normalizeText: e.normalizeText || Be,
151
155
  detectors: t,
152
156
  detectorSignature: n
153
157
  };
@@ -178,35 +182,41 @@ function ce(e) {
178
182
  function ge(e) {
179
183
  return e.closest(ae) || e;
180
184
  }
181
- function je(e) {
185
+ function Ze(e) {
182
186
  const t = e.closest("[data-editora-editor]");
183
- if (t && O(t) === e)
187
+ if (t && z(t) === e)
184
188
  return t;
185
189
  let n = e;
186
190
  for (; n; ) {
187
- if (n.matches(ae) && (n === e || O(n) === e))
191
+ if (n.matches(ae) && (n === e || z(n) === e))
188
192
  return n;
189
193
  n = n.parentElement;
190
194
  }
191
195
  return ge(e);
192
196
  }
193
- function O(e) {
194
- if (!e) return null;
195
- if (e.matches(x)) return e;
197
+ function z(e) {
198
+ if (!e)
199
+ return null;
200
+ if (e.matches(x))
201
+ return e;
196
202
  const t = e.querySelector(x);
197
203
  return t instanceof HTMLElement ? t : null;
198
204
  }
199
- function Ze() {
200
- if (typeof window > "u") return null;
201
- const e = window[ke];
202
- if (!(e instanceof HTMLElement)) return null;
203
- window[ke] = null;
204
- const t = O(e);
205
- if (t) return t;
205
+ function Ve() {
206
+ if (typeof window > "u")
207
+ return null;
208
+ const e = window[we];
209
+ if (!(e instanceof HTMLElement))
210
+ return null;
211
+ window[we] = null;
212
+ const t = z(e);
213
+ if (t)
214
+ return t;
206
215
  const n = e.closest(ae);
207
216
  if (n) {
208
- const i = O(n);
209
- if (i) return i;
217
+ const o = z(n);
218
+ if (o)
219
+ return o;
210
220
  }
211
221
  const r = e.closest(x);
212
222
  return r instanceof HTMLElement ? r : null;
@@ -214,23 +224,24 @@ function Ze() {
214
224
  function J(e) {
215
225
  return e ? (e.getAttribute("data-theme") || e.getAttribute("theme") || "").toLowerCase() === "dark" ? !0 : e.classList.contains("dark") || e.classList.contains("editora-theme-dark") || e.classList.contains("rte-theme-dark") : !1;
216
226
  }
217
- function Ve(e) {
227
+ function Ue(e) {
218
228
  const t = ge(e);
219
- if (J(t)) return !0;
229
+ if (J(t))
230
+ return !0;
220
231
  const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
221
232
  return J(n) ? !0 : J(document.documentElement) || J(document.body);
222
233
  }
223
234
  function ne(e, t) {
224
- e.classList.remove("rte-pii-redaction-theme-dark"), Ve(t) && e.classList.add("rte-pii-redaction-theme-dark");
235
+ e.classList.remove("rte-pii-redaction-theme-dark"), Ue(t) && e.classList.add("rte-pii-redaction-theme-dark");
225
236
  }
226
237
  function re(e) {
227
238
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
228
239
  }
229
240
  function me(e) {
230
241
  const t = te.get(e);
231
- typeof t == "number" && (window.clearTimeout(t), W.delete(t), te.delete(e));
242
+ typeof t == "number" && (window.clearTimeout(t), j.delete(t), te.delete(e));
232
243
  }
233
- function V(e) {
244
+ function U(e) {
234
245
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
235
246
  }
236
247
  function le(e = 0) {
@@ -251,197 +262,213 @@ function le(e = 0) {
251
262
  }
252
263
  };
253
264
  }
254
- function K() {
255
- Array.from(q).forEach((t) => {
256
- t.isConnected || Ie(t);
265
+ function q() {
266
+ Array.from(W).forEach((t) => {
267
+ t.isConnected || Te(t);
257
268
  });
258
269
  }
259
- function Ue(e) {
260
- for (let t = 0; t < e.length; t += 1) {
261
- const n = e[t];
262
- if (!(n.type !== "childList" || n.removedNodes.length === 0))
263
- for (let r = 0; r < n.removedNodes.length; r += 1) {
264
- const i = n.removedNodes[r];
265
- if (i.nodeType !== Node.ELEMENT_NODE) continue;
266
- const o = i;
267
- if (o.matches?.(x) || o.matches?.(`.${u}`) || o.querySelector?.(x) || o.querySelector?.(`.${u}`))
270
+ function Ge(e) {
271
+ var t, n, r, o;
272
+ for (let i = 0; i < e.length; i += 1) {
273
+ const a = e[i];
274
+ if (!(a.type !== "childList" || a.removedNodes.length === 0))
275
+ for (let l = 0; l < a.removedNodes.length; l += 1) {
276
+ const c = a.removedNodes[l];
277
+ if (c.nodeType !== Node.ELEMENT_NODE)
278
+ continue;
279
+ const s = c;
280
+ if ((t = s.matches) != null && t.call(s, x) || (n = s.matches) != null && n.call(s, `.${u}`) || (r = s.querySelector) != null && r.call(s, x) || (o = s.querySelector) != null && o.call(s, `.${u}`))
268
281
  return !0;
269
282
  }
270
283
  }
271
284
  return !1;
272
285
  }
273
286
  function T(e, t = !0) {
274
- if (K(), e?.contentElement instanceof HTMLElement) return e.contentElement;
275
- if (e?.editorElement instanceof HTMLElement) {
276
- const o = e.editorElement, a = O(o);
277
- if (a) return a;
287
+ if (q(), (e == null ? void 0 : e.contentElement) instanceof HTMLElement)
288
+ return e.contentElement;
289
+ if ((e == null ? void 0 : e.editorElement) instanceof HTMLElement) {
290
+ const i = e.editorElement, a = z(i);
291
+ if (a)
292
+ return a;
278
293
  }
279
- const n = Ze();
280
- if (n) return n;
294
+ const n = Ve();
295
+ if (n)
296
+ return n;
281
297
  const r = window.getSelection();
282
298
  if (r && r.rangeCount > 0) {
283
- const a = re(r.getRangeAt(0).startContainer)?.closest(x);
284
- if (a) return a;
299
+ const i = re(r.getRangeAt(0).startContainer), a = i == null ? void 0 : i.closest(x);
300
+ if (a)
301
+ return a;
285
302
  }
286
- const i = document.activeElement;
287
- if (i) {
288
- if (i.matches(x)) return i;
289
- const o = i.closest(x);
290
- if (o) return o;
303
+ const o = document.activeElement;
304
+ if (o) {
305
+ if (o.matches(x))
306
+ return o;
307
+ const i = o.closest(x);
308
+ if (i)
309
+ return i;
291
310
  }
292
311
  return g && g.isConnected ? g : (g && !g.isConnected && (g = null), t ? document.querySelector(x) : null);
293
312
  }
294
- function Ie(e) {
295
- me(e), m.get(e)?.remove(), m.delete(e), Z.delete(e), f.delete(e), I.delete(e), E.delete(e), S.delete(e), de.delete(e), Q.delete(e), q.delete(e), g === e && (g = null);
313
+ function Te(e) {
314
+ var t;
315
+ me(e), (t = m.get(e)) == null || t.remove(), m.delete(e), V.delete(e), f.delete(e), I.delete(e), E.delete(e), S.delete(e), de.delete(e), Q.delete(e), W.delete(e), g === e && (g = null);
296
316
  }
297
317
  function C(e, t, n) {
298
- const r = je(e);
318
+ const r = Ze(e);
299
319
  Array.from(
300
320
  r.querySelectorAll(
301
321
  `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
302
322
  )
303
- ).forEach((o) => {
304
- o.classList.toggle("active", n), o.setAttribute("data-active", n ? "true" : "false"), o.setAttribute("aria-pressed", n ? "true" : "false");
323
+ ).forEach((i) => {
324
+ i.classList.toggle("active", n), i.setAttribute("data-active", n ? "true" : "false"), i.setAttribute("aria-pressed", n ? "true" : "false");
305
325
  });
306
326
  }
307
327
  function w(e, t) {
308
- f.has(e) || f.set(e, t), I.has(e) || I.set(e, []), E.has(e) || E.set(e, le(0)), S.has(e) || S.set(e, t.enableRealtime), q.add(e);
328
+ f.has(e) || f.set(e, t), I.has(e) || I.set(e, []), E.has(e) || E.set(e, le(0)), S.has(e) || S.set(e, t.enableRealtime), W.add(e);
309
329
  }
310
- function oe(e) {
311
- return Z.get(e) === !0;
330
+ function ie(e) {
331
+ return V.get(e) === !0;
312
332
  }
313
- function $e(e, t, n, r) {
314
- if (!e) return e;
333
+ function Ie(e, t, n, r) {
334
+ if (!e)
335
+ return e;
315
336
  if (e.length <= n + r)
316
337
  return t.repeat(e.length);
317
- const i = e.slice(0, n), o = r > 0 ? e.slice(e.length - r) : "";
318
- return `${i}${t.repeat(Math.max(1, e.length - n - r))}${o}`;
338
+ const o = e.slice(0, n), i = r > 0 ? e.slice(e.length - r) : "";
339
+ return `${o}${t.repeat(Math.max(1, e.length - n - r))}${i}`;
319
340
  }
320
341
  function se(e, t, n) {
321
342
  const r = e.replace(/\D/g, "");
322
- if (r.length === 0) return e;
323
- let i = 0;
324
- const o = Math.max(0, r.length - n);
325
- return e.split("").map((a) => /\d/.test(a) ? (i += 1, i <= o ? t : a) : a).join("");
343
+ if (r.length === 0)
344
+ return e;
345
+ let o = 0;
346
+ const i = Math.max(0, r.length - n);
347
+ return e.split("").map((a) => /\d/.test(a) ? (o += 1, o <= i ? t : a) : a).join("");
326
348
  }
327
- function Ge(e, t) {
349
+ function Ye(e, t) {
328
350
  const n = e.indexOf("@");
329
- if (n <= 0) return e;
330
- const r = e.slice(0, n), i = e.slice(n + 1);
331
- return r.length <= 2 ? `${r[0] || ""}${t}[at]${i}` : `${r[0]}${t.repeat(Math.max(1, r.length - 2))}${r[r.length - 1]}[at]${i}`;
351
+ if (n <= 0)
352
+ return e;
353
+ const r = e.slice(0, n), o = e.slice(n + 1);
354
+ return r.length <= 2 ? `${r[0] || ""}${t}[at]${o}` : `${r[0]}${t.repeat(Math.max(1, r.length - 2))}${r[r.length - 1]}[at]${o}`;
332
355
  }
333
- function Ye(e, t) {
356
+ function Xe(e, t) {
334
357
  const n = e.split(".");
335
358
  return n.length !== 4 ? e : `${n[0]}.${n[1]}.${n[2]}.${t.repeat(Math.max(1, n[3].length))}`;
336
359
  }
337
- function Te(e, t, n) {
338
- return e && (t === "email" ? Ge(e, n.maskChar) : t === "phone" || t === "ssn" || t === "credit-card" ? se(e, n.maskChar, 4) : t === "ipv4" ? Ye(e, n.maskChar) : t === "api-key" || t === "jwt" ? $e(e, n.maskChar, 0, 0) : $e(e, n.maskChar, n.revealStart, n.revealEnd));
339
- }
340
360
  function Ce(e, t, n) {
341
- return n.redactionMode === "mask" ? Te(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
361
+ return e && (t === "email" ? Ye(e, n.maskChar) : t === "phone" || t === "ssn" || t === "credit-card" ? se(e, n.maskChar, 4) : t === "ipv4" ? Xe(e, n.maskChar) : t === "api-key" || t === "jwt" ? Ie(e, n.maskChar, 0, 0) : Ie(e, n.maskChar, n.revealStart, n.revealEnd));
362
+ }
363
+ function Re(e, t, n) {
364
+ return n.redactionMode === "mask" ? Ce(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
342
365
  }
343
- function Xe(e) {
344
- return Ee += 1, `pii-${e}-${Date.now().toString(36)}-${Ee.toString(36)}`;
366
+ function Je(e) {
367
+ return ve += 1, `pii-${e}-${Date.now().toString(36)}-${ve.toString(36)}`;
345
368
  }
346
369
  function he(e, t) {
347
- return t.skipInCodeBlocks ? !!e.parentElement?.closest("code, pre, kbd, samp") : !1;
370
+ var n;
371
+ return t.skipInCodeBlocks ? !!((n = e.parentElement) != null && n.closest("code, pre, kbd, samp")) : !1;
348
372
  }
349
- function Je(e, t) {
373
+ function Qe(e, t) {
350
374
  return t.some((n) => e.start < n.end && n.start < e.end);
351
375
  }
352
- function Qe(e, t, n) {
376
+ function et(e, t, n) {
353
377
  const r = [];
354
378
  t.filter((a) => a.enabled).forEach((a) => {
355
379
  const l = be(a.pattern);
356
380
  let c = l.exec(e);
357
381
  for (; c && r.length < n * 5; ) {
358
- const d = c[0] || "", s = c.index, b = s + d.length;
359
- d && b > s && (!a.validator || a.validator(d)) && r.push({
382
+ const s = c[0] || "", d = c.index, p = d + s.length;
383
+ s && p > d && (!a.validator || a.validator(s)) && r.push({
360
384
  type: a.type,
361
385
  severity: a.severity,
362
- value: d,
363
- start: s,
364
- end: b
386
+ value: s,
387
+ start: d,
388
+ end: p
365
389
  }), l.lastIndex === c.index && (l.lastIndex += 1), c = l.exec(e);
366
390
  }
367
391
  }), r.sort((a, l) => a.start !== l.start ? a.start - l.start : l.end - a.end);
368
- const o = [];
369
- for (let a = 0; a < r.length && !(o.length >= n); a += 1) {
392
+ const i = [];
393
+ for (let a = 0; a < r.length && !(i.length >= n); a += 1) {
370
394
  const l = r[a];
371
- Je({ start: l.start, end: l.end }, o) || o.push(l);
395
+ Qe({ start: l.start, end: l.end }, i) || i.push(l);
372
396
  }
373
- return o;
397
+ return i;
374
398
  }
375
399
  function ue(e, t = 120) {
376
400
  return e.length <= t ? e : `${e.slice(0, t - 1).trimEnd()}...`;
377
401
  }
378
- function et(e, t, n) {
379
- const r = Math.max(0, t - 28), i = Math.min(e.length, n + 28);
380
- return ue(e.slice(r, i).trim(), 180);
402
+ function tt(e, t, n) {
403
+ const r = Math.max(0, t - 28), o = Math.min(e.length, n + 28);
404
+ return ue(e.slice(r, o).trim(), 180);
381
405
  }
382
- function tt(e, t) {
406
+ function nt(e, t) {
383
407
  const n = le(t);
384
408
  return n.total = e.length, e.forEach((r) => {
385
409
  n.byType[r.type] += 1, r.severity === "high" ? n.high += 1 : r.severity === "medium" ? n.medium += 1 : n.low += 1;
386
410
  }), n;
387
411
  }
388
- function ie(e, t) {
412
+ function oe(e, t) {
389
413
  const n = e.querySelector(".rte-pii-redaction-live");
390
414
  n && (n.textContent = t);
391
415
  }
392
- function z(e, t, n) {
416
+ function F(e, t, n) {
393
417
  const r = t.querySelector('[data-action="toggle-realtime"]');
394
- if (!r) return;
395
- const i = F(e, n);
396
- r.textContent = i ? n.labels.realtimeOnText : n.labels.realtimeOffText, r.setAttribute("aria-pressed", i ? "true" : "false"), C(e, "togglePIIRealtime", i);
418
+ if (!r)
419
+ return;
420
+ const o = H(e, n);
421
+ r.textContent = o ? n.labels.realtimeOnText : n.labels.realtimeOffText, r.setAttribute("aria-pressed", o ? "true" : "false"), C(e, "togglePIIRealtime", o);
397
422
  }
398
- function nt(e, t) {
423
+ function rt(e, t) {
399
424
  e.setAttribute("aria-label", t.labels.panelAriaLabel);
400
425
  const n = e.querySelector(".rte-pii-redaction-title");
401
426
  n && (n.textContent = t.labels.panelTitle);
402
427
  const r = e.querySelector('[data-action="close"]');
403
428
  r && r.setAttribute("aria-label", t.labels.closeText);
404
- const i = e.querySelector('[data-action="run-scan"]');
405
- i && (i.textContent = t.labels.scanText);
406
- const o = e.querySelector('[data-action="redact-all"]');
407
- o && (o.textContent = t.labels.redactAllText);
429
+ const o = e.querySelector('[data-action="run-scan"]');
430
+ o && (o.textContent = t.labels.scanText);
431
+ const i = e.querySelector('[data-action="redact-all"]');
432
+ i && (i.textContent = t.labels.redactAllText);
408
433
  const a = e.querySelector(".rte-pii-redaction-shortcut");
409
434
  a && (a.textContent = t.labels.shortcutText);
410
435
  }
411
- function H(e) {
436
+ function B(e) {
412
437
  const t = m.get(e);
413
- if (!t) return;
414
- const n = f.get(e) || A;
415
- if (!n) return;
416
- const r = I.get(e) || [], i = E.get(e) || le(0), o = V(e), a = t.querySelector(".rte-pii-redaction-count"), l = t.querySelector(".rte-pii-redaction-summary"), c = t.querySelector(".rte-pii-redaction-list"), d = t.querySelector('[data-action="redact-all"]');
417
- if (!(!a || !l || !c || !d)) {
418
- if (a.textContent = String(i.total), l.textContent = `${n.labels.summaryPrefix}: ${i.total} | High ${i.high} | Medium ${i.medium} | Low ${i.low} | Redacted ${i.redactedCount}`, d.disabled = o || r.length === 0, o ? ie(t, n.labels.readonlyRedactionText) : ie(t, `${i.total} PII findings detected.`), z(e, t, n), r.length === 0) {
419
- c.innerHTML = `<li class="rte-pii-redaction-empty">${p(n.labels.noFindingsText)}</li>`;
438
+ if (!t)
439
+ return;
440
+ const n = f.get(e) || M;
441
+ if (!n)
442
+ return;
443
+ const r = I.get(e) || [], o = E.get(e) || le(0), i = U(e), a = t.querySelector(".rte-pii-redaction-count"), l = t.querySelector(".rte-pii-redaction-summary"), c = t.querySelector(".rte-pii-redaction-list"), s = t.querySelector('[data-action="redact-all"]');
444
+ if (!(!a || !l || !c || !s)) {
445
+ if (a.textContent = String(o.total), l.textContent = `${n.labels.summaryPrefix}: ${o.total} | High ${o.high} | Medium ${o.medium} | Low ${o.low} | Redacted ${o.redactedCount}`, s.disabled = i || r.length === 0, i ? oe(t, n.labels.readonlyRedactionText) : oe(t, `${o.total} PII findings detected.`), F(e, t, n), r.length === 0) {
446
+ c.innerHTML = `<li class="rte-pii-redaction-empty">${b(n.labels.noFindingsText)}</li>`;
420
447
  return;
421
448
  }
422
- c.innerHTML = r.map((s) => {
423
- const b = s.type.toUpperCase(), M = s.suggestion || "Redact this finding before export/share.", B = `${n.labels.locateText}: ${s.match}`, y = `${n.labels.redactText}: ${s.match}`, U = o ? 'disabled aria-disabled="true"' : "";
449
+ c.innerHTML = r.map((d) => {
450
+ const p = d.type.toUpperCase(), A = d.suggestion || "Redact this finding before export/share.", P = `${n.labels.locateText}: ${d.match}`, K = `${n.labels.redactText}: ${d.match}`, y = i ? 'disabled aria-disabled="true"' : "";
424
451
  return `
425
- <li class="rte-pii-redaction-item rte-pii-redaction-item-${s.severity}">
452
+ <li class="rte-pii-redaction-item rte-pii-redaction-item-${d.severity}">
426
453
  <button
427
454
  type="button"
428
455
  class="rte-pii-redaction-item-btn"
429
456
  data-action="locate-finding"
430
- data-finding-id="${p(s.id)}"
457
+ data-finding-id="${b(d.id)}"
431
458
  data-role="finding-button"
432
- aria-label="${p(B)}"
459
+ aria-label="${b(P)}"
433
460
  >
434
- <span class="rte-pii-redaction-badge">${p(s.severity.toUpperCase())}</span>
435
- <span class="rte-pii-redaction-type">${p(b)}</span>
461
+ <span class="rte-pii-redaction-badge">${b(d.severity.toUpperCase())}</span>
462
+ <span class="rte-pii-redaction-type">${b(p)}</span>
436
463
  </button>
437
- <p class="rte-pii-redaction-line"><strong>${p(n.labels.matchLabel)}:</strong> ${p(ue(s.match, 80))}</p>
438
- <p class="rte-pii-redaction-line"><strong>${p(n.labels.maskedLabel)}:</strong> ${p(ue(s.masked, 80))}</p>
439
- ${s.excerpt ? `<p class="rte-pii-redaction-line"><strong>${p(n.labels.excerptLabel)}:</strong> ${p(s.excerpt)}</p>` : ""}
440
- <p class="rte-pii-redaction-help">${p(M)}</p>
464
+ <p class="rte-pii-redaction-line"><strong>${b(n.labels.matchLabel)}:</strong> ${b(ue(d.match, 80))}</p>
465
+ <p class="rte-pii-redaction-line"><strong>${b(n.labels.maskedLabel)}:</strong> ${b(ue(d.masked, 80))}</p>
466
+ ${d.excerpt ? `<p class="rte-pii-redaction-line"><strong>${b(n.labels.excerptLabel)}:</strong> ${b(d.excerpt)}</p>` : ""}
467
+ <p class="rte-pii-redaction-help">${b(A)}</p>
441
468
  <div class="rte-pii-redaction-item-actions">
442
- <button type="button" class="rte-pii-redaction-btn" data-action="redact-finding" data-finding-id="${p(
443
- s.id
444
- )}" aria-label="${p(y)}" ${U}>${p(n.labels.redactText)}</button>
469
+ <button type="button" class="rte-pii-redaction-btn" data-action="redact-finding" data-finding-id="${b(
470
+ d.id
471
+ )}" aria-label="${b(K)}" ${y}>${b(n.labels.redactText)}</button>
445
472
  </div>
446
473
  </li>
447
474
  `;
@@ -449,16 +476,18 @@ function H(e) {
449
476
  }
450
477
  }
451
478
  function fe(e, t) {
452
- if (!t.classList.contains("show")) return;
453
- const r = ge(e).getBoundingClientRect(), i = Math.min(window.innerWidth - 20, 390), o = Math.max(10, window.innerWidth - i - 10), a = Math.min(Math.max(10, r.right - i), o), l = Math.max(10, Math.min(window.innerHeight - 10 - 280, r.top + 10));
454
- t.style.width = `${i}px`, t.style.left = `${a}px`, t.style.top = `${l}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
479
+ if (!t.classList.contains("show"))
480
+ return;
481
+ const r = ge(e).getBoundingClientRect(), o = Math.min(window.innerWidth - 20, 390), i = Math.max(10, window.innerWidth - o - 10), a = Math.min(Math.max(10, r.right - o), i), l = Math.max(10, Math.min(window.innerHeight - 10 - 280, r.top + 10));
482
+ t.style.width = `${o}px`, t.style.left = `${a}px`, t.style.top = `${l}px`, t.style.maxHeight = `${Math.max(260, window.innerHeight - 20)}px`;
455
483
  }
456
- function F(e, t) {
484
+ function H(e, t) {
457
485
  const n = S.get(e);
458
486
  return typeof n == "boolean" ? n : t ? t.enableRealtime : !0;
459
487
  }
460
- function Re(e, t) {
461
- if (t === e.innerHTML) return;
488
+ function Se(e, t) {
489
+ if (t === e.innerHTML)
490
+ return;
462
491
  const n = window.execEditorCommand || window.executeEditorCommand;
463
492
  if (typeof n == "function")
464
493
  try {
@@ -466,10 +495,10 @@ function Re(e, t) {
466
495
  } catch {
467
496
  }
468
497
  }
469
- function Se(e) {
498
+ function Ae(e) {
470
499
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
471
500
  }
472
- function Ae(e, t) {
501
+ function Me(e, t) {
473
502
  e.dispatchEvent(
474
503
  new CustomEvent("editora:pii-redacted", {
475
504
  bubbles: !0,
@@ -479,17 +508,18 @@ function Ae(e, t) {
479
508
  })
480
509
  );
481
510
  }
482
- function Me(e, t) {
511
+ function Pe(e, t) {
483
512
  return (I.get(e) || []).find((r) => r.id === t);
484
513
  }
485
- function rt(e) {
514
+ function it(e) {
486
515
  const t = m.get(e);
487
- if (t) return t;
488
- const n = f.get(e) || A || ee(), r = `rte-pii-redaction-panel-${Fe++}`, i = document.createElement("section");
489
- return i.className = u, i.id = r, i.setAttribute("role", "dialog"), i.setAttribute("aria-modal", "false"), i.setAttribute("aria-label", n.labels.panelAriaLabel), i.innerHTML = `
516
+ if (t)
517
+ return t;
518
+ const n = f.get(e) || M || ee(), r = `rte-pii-redaction-panel-${He++}`, o = document.createElement("section");
519
+ return o.className = u, o.id = r, o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "false"), o.setAttribute("aria-label", n.labels.panelAriaLabel), o.innerHTML = `
490
520
  <header class="rte-pii-redaction-header">
491
- <h2 class="rte-pii-redaction-title">${p(n.labels.panelTitle)}</h2>
492
- <button type="button" class="rte-pii-redaction-icon-btn" data-action="close" aria-label="${p(
521
+ <h2 class="rte-pii-redaction-title">${b(n.labels.panelTitle)}</h2>
522
+ <button type="button" class="rte-pii-redaction-icon-btn" data-action="close" aria-label="${b(
493
523
  n.labels.closeText
494
524
  )}">✕</button>
495
525
  </header>
@@ -499,107 +529,115 @@ function rt(e) {
499
529
  <span class="rte-pii-redaction-count" aria-hidden="true">0</span>
500
530
  </div>
501
531
  <div class="rte-pii-redaction-controls" role="toolbar" aria-label="PII redaction controls">
502
- <button type="button" class="rte-pii-redaction-btn rte-pii-redaction-btn-primary" data-action="run-scan">${p(
532
+ <button type="button" class="rte-pii-redaction-btn rte-pii-redaction-btn-primary" data-action="run-scan">${b(
503
533
  n.labels.scanText
504
534
  )}</button>
505
- <button type="button" class="rte-pii-redaction-btn" data-action="redact-all">${p(
535
+ <button type="button" class="rte-pii-redaction-btn" data-action="redact-all">${b(
506
536
  n.labels.redactAllText
507
537
  )}</button>
508
538
  <button type="button" class="rte-pii-redaction-btn" data-action="toggle-realtime" aria-pressed="false"></button>
509
539
  </div>
510
540
  <ul class="rte-pii-redaction-list" role="list" aria-label="Detected PII findings"></ul>
511
- <p class="rte-pii-redaction-shortcut">${p(n.labels.shortcutText)}</p>
541
+ <p class="rte-pii-redaction-shortcut">${b(n.labels.shortcutText)}</p>
512
542
  <span class="rte-pii-redaction-live" aria-live="polite"></span>
513
543
  </div>
514
- `, i.addEventListener("click", (o) => {
515
- const l = o.target?.closest("[data-action]");
516
- if (!l) return;
517
- const c = l.getAttribute("data-action") || "", d = f.get(e) || A || n;
518
- if (f.set(e, d), w(e, d), c === "close") {
519
- j(e, !0);
544
+ `, o.addEventListener("click", (i) => {
545
+ const a = i.target, l = a == null ? void 0 : a.closest("[data-action]");
546
+ if (!l)
547
+ return;
548
+ const c = l.getAttribute("data-action") || "", s = f.get(e) || M || n;
549
+ if (f.set(e, s), w(e, s), c === "close") {
550
+ Z(e, !0);
520
551
  return;
521
552
  }
522
553
  if (c === "run-scan") {
523
- h(e, d, !0);
554
+ h(e, s, !0);
524
555
  return;
525
556
  }
526
557
  if (c === "toggle-realtime") {
527
- const s = !F(e, d);
528
- S.set(e, s), z(e, i, d), s && h(e, d, !0);
558
+ const d = !H(e, s);
559
+ S.set(e, d), F(e, o, s), d && h(e, s, !0);
529
560
  return;
530
561
  }
531
562
  if (c === "redact-all") {
532
- xe(e, d);
563
+ xe(e, s);
533
564
  return;
534
565
  }
535
566
  if (c === "locate-finding") {
536
- const s = l.getAttribute("data-finding-id") || "", b = Me(e, s);
537
- if (!b) return;
538
- at(e, b, d);
567
+ const d = l.getAttribute("data-finding-id") || "", p = Pe(e, d);
568
+ if (!p)
569
+ return;
570
+ lt(e, p, s);
539
571
  return;
540
572
  }
541
573
  if (c === "redact-finding") {
542
- const s = l.getAttribute("data-finding-id") || "";
543
- De(e, s, d);
574
+ const d = l.getAttribute("data-finding-id") || "";
575
+ _e(e, d, s);
544
576
  }
545
- }), i.addEventListener("keydown", (o) => {
546
- if (o.key === "Escape") {
547
- o.preventDefault(), j(e, !0);
577
+ }), o.addEventListener("keydown", (i) => {
578
+ if (i.key === "Escape") {
579
+ i.preventDefault(), Z(e, !0);
548
580
  return;
549
581
  }
550
- if (o.key !== "ArrowDown" && o.key !== "ArrowUp") return;
551
- const a = Array.from(i.querySelectorAll('[data-role="finding-button"]'));
552
- if (a.length === 0) return;
553
- const l = document.activeElement, c = a.findIndex((b) => b === l);
554
- if (c === -1) return;
555
- o.preventDefault();
556
- const d = o.key === "ArrowDown" ? 1 : -1, s = (c + d + a.length) % a.length;
557
- a[s].focus();
558
- }), ne(i, e), document.body.appendChild(i), m.set(e, i), Z.set(e, !1), H(e), i;
559
- }
560
- function j(e, t = !1) {
561
- const n = m.get(e);
562
- n && (n.classList.remove("show"), Z.set(e, !1), C(e, "togglePIIRedactionPanel", !1), t && e.focus({ preventScroll: !0 }));
582
+ if (i.key !== "ArrowDown" && i.key !== "ArrowUp")
583
+ return;
584
+ const a = Array.from(o.querySelectorAll('[data-role="finding-button"]'));
585
+ if (a.length === 0)
586
+ return;
587
+ const l = document.activeElement, c = a.findIndex((p) => p === l);
588
+ if (c === -1)
589
+ return;
590
+ i.preventDefault();
591
+ const s = i.key === "ArrowDown" ? 1 : -1, d = (c + s + a.length) % a.length;
592
+ a[d].focus();
593
+ }), ne(o, e), document.body.appendChild(o), m.set(e, o), V.set(e, !1), B(e), o;
563
594
  }
564
- function N(e) {
565
- K();
566
- const t = rt(e);
567
- m.forEach((r, i) => {
568
- i !== e && j(i, !1);
569
- }), t.classList.add("show"), Z.set(e, !0), C(e, "togglePIIRedactionPanel", !0), ne(t, e), fe(e, t), H(e), t.querySelector('[data-action="run-scan"]')?.focus();
595
+ function Z(e, t = !1) {
596
+ const n = m.get(e);
597
+ n && (n.classList.remove("show"), V.set(e, !1), C(e, "togglePIIRedactionPanel", !1), t && e.focus({ preventScroll: !0 }));
570
598
  }
571
- function Pe(e, t) {
572
- const n = oe(e);
573
- return (typeof t == "boolean" ? t : !n) ? N(e) : j(e), !0;
599
+ function O(e) {
600
+ q();
601
+ const t = it(e);
602
+ m.forEach((r, o) => {
603
+ o !== e && Z(o, !1);
604
+ }), t.classList.add("show"), V.set(e, !0), C(e, "togglePIIRedactionPanel", !0), ne(t, e), fe(e, t), B(e);
605
+ const n = t.querySelector('[data-action="run-scan"]');
606
+ n == null || n.focus();
607
+ }
608
+ function Le(e, t) {
609
+ const n = ie(e);
610
+ return (typeof t == "boolean" ? t : !n) ? O(e) : Z(e), !0;
574
611
  }
575
612
  function ot(e, t) {
576
613
  const n = t.normalizeText(e.innerText || e.textContent || ""), r = e.innerHTML;
577
- return `${n.length}:${ve(n)}:${r.length}:${ve(r)}:${t.detectorSignature}`;
614
+ return `${n.length}:${$e(n)}:${r.length}:${$e(r)}:${t.detectorSignature}`;
578
615
  }
579
- function it(e, t) {
616
+ function at(e, t) {
580
617
  const n = [], r = be(e.pattern);
581
- let i = r.exec(t);
582
- for (; i; ) {
583
- const o = i[0] || "", a = i.index, l = a + o.length;
584
- o && l > a && (!e.validator || e.validator(o)) && n.push({ value: o, start: a, end: l }), r.lastIndex === i.index && (r.lastIndex += 1), i = r.exec(t);
618
+ let o = r.exec(t);
619
+ for (; o; ) {
620
+ const i = o[0] || "", a = o.index, l = a + i.length;
621
+ i && l > a && (!e.validator || e.validator(i)) && n.push({ value: i, start: a, end: l }), r.lastIndex === o.index && (r.lastIndex += 1), o = r.exec(t);
585
622
  }
586
623
  return n;
587
624
  }
588
- function Le(e, t, n) {
625
+ function De(e, t, n) {
589
626
  const r = n.detectors.find((c) => c.type === t.type && c.enabled);
590
- if (!r) return null;
591
- const i = t.match.toLowerCase();
592
- let o = 0;
627
+ if (!r)
628
+ return null;
629
+ const o = t.match.toLowerCase();
630
+ let i = 0;
593
631
  const a = document.createTreeWalker(e, pe, null);
594
632
  let l = a.nextNode();
595
633
  for (; l; ) {
596
634
  if (!he(l, n)) {
597
- const c = it(r, l.data);
598
- for (let d = 0; d < c.length; d += 1) {
599
- const s = c[d];
600
- if (s.value.toLowerCase() === i && (o += 1, o === t.occurrence)) {
601
- const b = document.createRange();
602
- return b.setStart(l, s.start), b.setEnd(l, s.end), b;
635
+ const c = at(r, l.data);
636
+ for (let s = 0; s < c.length; s += 1) {
637
+ const d = c[s];
638
+ if (d.value.toLowerCase() === o && (i += 1, i === t.occurrence)) {
639
+ const p = document.createRange();
640
+ return p.setStart(l, d.start), p.setEnd(l, d.end), p;
603
641
  }
604
642
  }
605
643
  }
@@ -607,166 +645,184 @@ function Le(e, t, n) {
607
645
  }
608
646
  return null;
609
647
  }
610
- function at(e, t, n) {
611
- const r = Le(e, t, n);
612
- if (!r) return !1;
613
- const i = window.getSelection();
614
- return i ? (i.removeAllRanges(), i.addRange(r), re(r.startContainer)?.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 }), !0) : !1;
648
+ function lt(e, t, n) {
649
+ const r = De(e, t, n);
650
+ if (!r)
651
+ return !1;
652
+ const o = window.getSelection();
653
+ if (!o)
654
+ return !1;
655
+ o.removeAllRanges(), o.addRange(r);
656
+ const i = re(r.startContainer);
657
+ return i == null || i.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }), e.focus({ preventScroll: !0 }), !0;
615
658
  }
616
659
  async function h(e, t, n = !1) {
660
+ var p;
617
661
  w(e, t);
618
662
  const r = ot(e, t);
619
663
  if (!n && de.get(e) === r)
620
664
  return I.get(e) || [];
621
- const i = (Q.get(e) || 0) + 1;
622
- Q.set(e, i);
623
- const o = [], a = /* @__PURE__ */ new Map(), l = document.createTreeWalker(e, pe, null);
665
+ const o = (Q.get(e) || 0) + 1;
666
+ Q.set(e, o);
667
+ const i = [], a = /* @__PURE__ */ new Map(), l = document.createTreeWalker(e, pe, null);
624
668
  let c = l.nextNode();
625
- for (; c && o.length < t.maxFindings; ) {
626
- const b = c.data || "";
627
- if (b.trim() && !he(c, t)) {
628
- const M = Qe(b, t.detectors, t.maxFindings - o.length);
629
- for (let B = 0; B < M.length && !(o.length >= t.maxFindings); B += 1) {
630
- const y = M[B], U = `${y.type}:${y.value.toLowerCase()}`, ye = (a.get(U) || 0) + 1;
631
- a.set(U, ye), o.push({
632
- id: Xe(y.type),
669
+ for (; c && i.length < t.maxFindings; ) {
670
+ const A = c.data || "";
671
+ if (A.trim() && !he(c, t)) {
672
+ const P = et(A, t.detectors, t.maxFindings - i.length);
673
+ for (let K = 0; K < P.length && !(i.length >= t.maxFindings); K += 1) {
674
+ const y = P[K], ye = `${y.type}:${y.value.toLowerCase()}`, ke = (a.get(ye) || 0) + 1;
675
+ a.set(ye, ke), i.push({
676
+ id: Je(y.type),
633
677
  type: y.type,
634
678
  severity: y.severity,
635
679
  match: y.value,
636
- masked: Te(y.value, y.type, t),
637
- occurrence: ye,
638
- excerpt: et(b, y.start, y.end),
680
+ masked: Ce(y.value, y.type, t),
681
+ occurrence: ke,
682
+ excerpt: tt(A, y.start, y.end),
639
683
  suggestion: "Review and redact this value before external sharing."
640
684
  });
641
685
  }
642
686
  }
643
687
  c = l.nextNode();
644
688
  }
645
- if (Q.get(e) !== i)
689
+ if (Q.get(e) !== o)
646
690
  return I.get(e) || [];
647
- const d = E.get(e)?.redactedCount || 0, s = tt(o, d);
648
- return de.set(e, r), I.set(e, o), E.set(e, s), H(e), e.dispatchEvent(
691
+ const s = ((p = E.get(e)) == null ? void 0 : p.redactedCount) || 0, d = nt(i, s);
692
+ return de.set(e, r), I.set(e, i), E.set(e, d), B(e), e.dispatchEvent(
649
693
  new CustomEvent("editora:pii-scan", {
650
694
  bubbles: !0,
651
695
  detail: {
652
- findings: o,
653
- stats: s
696
+ findings: i,
697
+ stats: d
654
698
  }
655
699
  })
656
- ), o;
700
+ ), i;
657
701
  }
658
- function lt(e, t) {
702
+ function ct(e, t) {
659
703
  let n = e, r = 0;
660
- return t.detectors.filter((o) => o.enabled).forEach((o) => {
661
- const a = be(o.pattern);
662
- n = n.replace(a, (l) => o.validator && !o.validator(l) ? l : (r += 1, Ce(l, o.type, t)));
704
+ return t.detectors.filter((i) => i.enabled).forEach((i) => {
705
+ const a = be(i.pattern);
706
+ n = n.replace(a, (l) => i.validator && !i.validator(l) ? l : (r += 1, Re(l, i.type, t)));
663
707
  }), { nextValue: n, count: r };
664
708
  }
665
- async function De(e, t, n) {
666
- if (V(e)) {
709
+ async function _e(e, t, n) {
710
+ var s;
711
+ if (U(e)) {
667
712
  const d = m.get(e);
668
- return d && ie(d, n.labels.readonlyRedactionText), !1;
713
+ return d && oe(d, n.labels.readonlyRedactionText), !1;
669
714
  }
670
- const r = Me(e, t);
671
- if (!r) return !1;
672
- const i = Le(e, r, n);
673
- if (!i) return !1;
674
- const o = e.innerHTML, a = Ce(r.match, r.type, n);
675
- if (i.startContainer === i.endContainer && i.startContainer.nodeType === Node.TEXT_NODE) {
676
- const d = i.startContainer, s = d.data, b = i.startOffset, M = i.endOffset;
677
- d.data = `${s.slice(0, b)}${a}${s.slice(M)}`;
715
+ const r = Pe(e, t);
716
+ if (!r)
717
+ return !1;
718
+ const o = De(e, r, n);
719
+ if (!o)
720
+ return !1;
721
+ const i = e.innerHTML, a = Re(r.match, r.type, n);
722
+ if (o.startContainer === o.endContainer && o.startContainer.nodeType === Node.TEXT_NODE) {
723
+ const d = o.startContainer, p = d.data, A = o.startOffset, P = o.endOffset;
724
+ d.data = `${p.slice(0, A)}${a}${p.slice(P)}`;
678
725
  } else
679
- i.deleteContents(), i.insertNode(document.createTextNode(a));
680
- Se(e), Re(e, o);
681
- const l = E.get(e)?.redactedCount || 0;
726
+ o.deleteContents(), o.insertNode(document.createTextNode(a));
727
+ Ae(e), Se(e, i);
728
+ const l = ((s = E.get(e)) == null ? void 0 : s.redactedCount) || 0;
682
729
  await h(e, n, !0);
683
730
  const c = E.get(e);
684
- return c && (c.redactedCount = l + 1, H(e)), Ae(e, 1), !0;
731
+ return c && (c.redactedCount = l + 1, B(e)), Me(e, 1), !0;
685
732
  }
686
733
  async function xe(e, t) {
687
- if (V(e)) {
734
+ var s;
735
+ if (U(e)) {
688
736
  const d = m.get(e);
689
- return d && ie(d, t.labels.readonlyRedactionText), 0;
737
+ return d && oe(d, t.labels.readonlyRedactionText), 0;
690
738
  }
691
739
  (I.get(e) || []).length === 0 && await h(e, t, !0);
692
740
  const r = e.innerHTML;
693
- let i = 0;
694
- const o = document.createTreeWalker(e, pe, null);
695
- let a = o.nextNode();
741
+ let o = 0;
742
+ const i = document.createTreeWalker(e, pe, null);
743
+ let a = i.nextNode();
696
744
  for (; a; ) {
697
745
  if (he(a, t)) {
698
- a = o.nextNode();
746
+ a = i.nextNode();
699
747
  continue;
700
748
  }
701
749
  const d = a.data || "";
702
750
  if (!d) {
703
- a = o.nextNode();
751
+ a = i.nextNode();
704
752
  continue;
705
753
  }
706
- const s = lt(d, t);
707
- s.count > 0 && s.nextValue !== d && (a.data = s.nextValue, i += s.count), a = o.nextNode();
754
+ const p = ct(d, t);
755
+ p.count > 0 && p.nextValue !== d && (a.data = p.nextValue, o += p.count), a = i.nextNode();
708
756
  }
709
- if (i === 0) return 0;
710
- Se(e), Re(e, r);
711
- const l = E.get(e)?.redactedCount || 0;
757
+ if (o === 0)
758
+ return 0;
759
+ Ae(e), Se(e, r);
760
+ const l = ((s = E.get(e)) == null ? void 0 : s.redactedCount) || 0;
712
761
  await h(e, t, !0);
713
762
  const c = E.get(e);
714
- return c && (c.redactedCount = l + i, H(e)), Ae(e, i), i;
763
+ return c && (c.redactedCount = l + o, B(e)), Me(e, o), o;
715
764
  }
716
- function _e(e) {
717
- const t = f.get(e) || A;
718
- if (!t || !F(e, t) || V(e)) return;
765
+ function Ne(e) {
766
+ const t = f.get(e) || M;
767
+ if (!t || !H(e, t) || U(e))
768
+ return;
719
769
  me(e);
720
770
  const n = window.setTimeout(() => {
721
- W.delete(n), te.delete(e), h(e, t, !1);
771
+ j.delete(n), te.delete(e), h(e, t, !1);
722
772
  }, t.debounceMs);
723
- W.add(n), te.set(e, n);
773
+ j.add(n), te.set(e, n);
724
774
  }
725
- function ct(e) {
775
+ function st(e) {
726
776
  const t = e.key.toLowerCase();
727
777
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "i";
728
778
  }
729
- function st(e) {
779
+ function dt(e) {
730
780
  const t = e.key.toLowerCase();
731
781
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "u";
732
782
  }
733
- function dt(e) {
783
+ function ut(e) {
734
784
  const t = e.key.toLowerCase();
735
785
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "m";
736
786
  }
737
- function ut(e) {
787
+ function ft(e) {
738
788
  const t = e.key.toLowerCase();
739
789
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "y";
740
790
  }
741
- function ft(e) {
791
+ function pt(e) {
792
+ var r;
742
793
  const t = re(e.target);
743
794
  if (t) {
744
- const r = t.closest(x);
745
- if (r) return r;
795
+ const o = t.closest(x);
796
+ if (o)
797
+ return o;
746
798
  const i = t.closest(ae);
747
799
  if (i) {
748
- const a = O(i);
749
- if (a) return a;
800
+ const l = z(i);
801
+ if (l)
802
+ return l;
750
803
  }
751
- const o = t.closest(`.${u}`);
752
- if (o) {
753
- const a = Array.from(m.entries()).find(([, l]) => l === o);
754
- if (a) return a[0];
804
+ const a = t.closest(`.${u}`);
805
+ if (a) {
806
+ const l = Array.from(m.entries()).find(([, c]) => c === a);
807
+ if (l)
808
+ return l[0];
755
809
  }
756
810
  }
757
811
  const n = window.getSelection();
758
812
  if (n && n.rangeCount > 0) {
759
- const r = re(n.getRangeAt(0).startContainer)?.closest(
813
+ const o = (r = re(n.getRangeAt(0).startContainer)) == null ? void 0 : r.closest(
760
814
  x
761
815
  );
762
- if (r) return r;
816
+ if (o)
817
+ return o;
763
818
  }
764
819
  return null;
765
820
  }
766
- function pt() {
767
- if (typeof document > "u" || document.getElementById(we)) return;
821
+ function bt() {
822
+ if (typeof document > "u" || document.getElementById(Ee))
823
+ return;
768
824
  const e = document.createElement("style");
769
- e.id = we, e.textContent = `
825
+ e.id = Ee, e.textContent = `
770
826
  .rte-toolbar-group-items.${k},
771
827
  .editora-toolbar-group-items.${k},
772
828
  .rte-toolbar-group-items.${v},
@@ -1163,64 +1219,70 @@ function pt() {
1163
1219
  }
1164
1220
  `, document.head.appendChild(e);
1165
1221
  }
1166
- function bt(e) {
1167
- A = e, P || (P = (t) => {
1168
- K();
1169
- const r = t.target?.closest(x);
1170
- if (!r) return;
1222
+ function gt(e) {
1223
+ M = e, L || (L = (t) => {
1224
+ q();
1225
+ const n = t.target, r = n == null ? void 0 : n.closest(x);
1226
+ if (!r)
1227
+ return;
1171
1228
  g = r;
1172
- const i = f.get(r) || e;
1173
- w(r, i), f.set(r, i), C(r, "togglePIIRedactionPanel", oe(r)), C(r, "togglePIIRealtime", F(r, i));
1174
- const o = m.get(r);
1175
- o && (ne(o, r), fe(r, o), z(r, o, i));
1176
- }, document.addEventListener("focusin", P, !0)), L || (L = (t) => {
1177
- const r = t.target?.closest(x);
1178
- r && (g = r, _e(r));
1179
- }, document.addEventListener("input", L, !0)), D || (D = (t) => {
1180
- if (t.defaultPrevented || t.target?.closest(`.${u} input, .${u} textarea, .${u} select`)) return;
1181
- const r = ft(t);
1182
- if (!r) return;
1183
- const i = f.get(r) || A || e;
1184
- if (w(r, i), f.set(r, i), g = r, t.key === "Escape" && oe(r)) {
1185
- t.preventDefault(), j(r, !0);
1229
+ const o = f.get(r) || e;
1230
+ w(r, o), f.set(r, o), C(r, "togglePIIRedactionPanel", ie(r)), C(r, "togglePIIRealtime", H(r, o));
1231
+ const i = m.get(r);
1232
+ i && (ne(i, r), fe(r, i), F(r, i, o));
1233
+ }, document.addEventListener("focusin", L, !0)), D || (D = (t) => {
1234
+ const n = t.target, r = n == null ? void 0 : n.closest(x);
1235
+ r && (g = r, Ne(r));
1236
+ }, document.addEventListener("input", D, !0)), _ || (_ = (t) => {
1237
+ if (t.defaultPrevented)
1186
1238
  return;
1187
- }
1188
- if (ct(t)) {
1189
- t.preventDefault(), t.stopPropagation(), Pe(r);
1239
+ const n = t.target;
1240
+ if (n != null && n.closest(`.${u} input, .${u} textarea, .${u} select`))
1241
+ return;
1242
+ const r = pt(t);
1243
+ if (!r)
1244
+ return;
1245
+ const o = f.get(r) || M || e;
1246
+ if (w(r, o), f.set(r, o), g = r, t.key === "Escape" && ie(r)) {
1247
+ t.preventDefault(), Z(r, !0);
1190
1248
  return;
1191
1249
  }
1192
1250
  if (st(t)) {
1193
- t.preventDefault(), t.stopPropagation(), h(r, i, !0), N(r);
1251
+ t.preventDefault(), t.stopPropagation(), Le(r);
1194
1252
  return;
1195
1253
  }
1196
1254
  if (dt(t)) {
1197
- t.preventDefault(), t.stopPropagation(), V(r) || (xe(r, i), N(r));
1255
+ t.preventDefault(), t.stopPropagation(), h(r, o, !0), O(r);
1198
1256
  return;
1199
1257
  }
1200
1258
  if (ut(t)) {
1259
+ t.preventDefault(), t.stopPropagation(), U(r) || (xe(r, o), O(r));
1260
+ return;
1261
+ }
1262
+ if (ft(t)) {
1201
1263
  t.preventDefault(), t.stopPropagation();
1202
- const o = !F(r, i);
1203
- S.set(r, o);
1264
+ const i = !H(r, o);
1265
+ S.set(r, i);
1204
1266
  const a = m.get(r);
1205
- a && z(r, a, i), C(r, "togglePIIRealtime", o), o && h(r, i, !0);
1267
+ a && F(r, a, o), C(r, "togglePIIRealtime", i), i && h(r, o, !0);
1206
1268
  }
1207
- }, document.addEventListener("keydown", D, !0)), R || (R = () => {
1208
- K(), m.forEach((t, n) => {
1269
+ }, document.addEventListener("keydown", _, !0)), R || (R = () => {
1270
+ q(), m.forEach((t, n) => {
1209
1271
  !n.isConnected || !t.isConnected || (ne(t, n), fe(n, t));
1210
1272
  });
1211
- }, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !_ && typeof MutationObserver < "u" && document.body && (_ = new MutationObserver((t) => {
1212
- Ue(t) && K();
1213
- }), _.observe(document.body, {
1273
+ }, window.addEventListener("scroll", R, !0), window.addEventListener("resize", R)), !N && typeof MutationObserver < "u" && document.body && (N = new MutationObserver((t) => {
1274
+ Ge(t) && q();
1275
+ }), N.observe(document.body, {
1214
1276
  childList: !0,
1215
1277
  subtree: !0
1216
1278
  }));
1217
1279
  }
1218
- function gt() {
1219
- P && (document.removeEventListener("focusin", P, !0), P = null), L && (document.removeEventListener("input", L, !0), L = null), D && (document.removeEventListener("keydown", D, !0), D = null), R && (window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R), R = null), _ && (_.disconnect(), _ = null), m.forEach((e) => e.remove()), m.clear(), q.forEach((e) => me(e)), q.clear(), A = null, g = null;
1280
+ function mt() {
1281
+ L && (document.removeEventListener("focusin", L, !0), L = null), D && (document.removeEventListener("input", D, !0), D = null), _ && (document.removeEventListener("keydown", _, !0), _ = null), R && (window.removeEventListener("scroll", R, !0), window.removeEventListener("resize", R), R = null), N && (N.disconnect(), N = null), m.forEach((e) => e.remove()), m.clear(), W.forEach((e) => me(e)), W.clear(), M = null, g = null;
1220
1282
  }
1221
- const mt = (e = {}) => {
1283
+ const ht = (e = {}) => {
1222
1284
  const t = ee(e), n = /* @__PURE__ */ new Set();
1223
- return pt(), {
1285
+ return bt(), {
1224
1286
  name: "piiRedaction",
1225
1287
  toolbar: [
1226
1288
  {
@@ -1261,73 +1323,81 @@ const mt = (e = {}) => {
1261
1323
  }
1262
1324
  ],
1263
1325
  commands: {
1264
- piiRedaction: (r, i) => {
1265
- const o = T(i);
1266
- if (!o) return !1;
1267
- const a = f.get(o) || t;
1268
- return w(o, a), f.set(o, a), g = o, N(o), h(o, a, !1), !0;
1326
+ piiRedaction: (r, o) => {
1327
+ const i = T(o);
1328
+ if (!i)
1329
+ return !1;
1330
+ const a = f.get(i) || t;
1331
+ return w(i, a), f.set(i, a), g = i, O(i), h(i, a, !1), !0;
1269
1332
  },
1270
- togglePIIRedactionPanel: (r, i) => {
1271
- const o = T(i);
1272
- if (!o) return !1;
1273
- const a = f.get(o) || t;
1274
- w(o, a), f.set(o, a), g = o;
1275
- const l = Pe(o, typeof r == "boolean" ? r : void 0);
1276
- return oe(o) && h(o, a, !1), l;
1333
+ togglePIIRedactionPanel: (r, o) => {
1334
+ const i = T(o);
1335
+ if (!i)
1336
+ return !1;
1337
+ const a = f.get(i) || t;
1338
+ w(i, a), f.set(i, a), g = i;
1339
+ const l = Le(i, typeof r == "boolean" ? r : void 0);
1340
+ return ie(i) && h(i, a, !1), l;
1277
1341
  },
1278
- runPIIScan: async (r, i) => {
1279
- const o = T(i);
1280
- if (!o) return !1;
1281
- const a = f.get(o) || t;
1282
- return w(o, a), f.set(o, a), g = o, await h(o, a, !0), N(o), !0;
1342
+ runPIIScan: async (r, o) => {
1343
+ const i = T(o);
1344
+ if (!i)
1345
+ return !1;
1346
+ const a = f.get(i) || t;
1347
+ return w(i, a), f.set(i, a), g = i, await h(i, a, !0), O(i), !0;
1283
1348
  },
1284
- redactAllPII: async (r, i) => {
1285
- const o = T(i);
1286
- if (!o) return !1;
1287
- const a = f.get(o) || t;
1288
- w(o, a), f.set(o, a), g = o;
1289
- const l = await xe(o, a);
1290
- return l > 0 && N(o), l > 0;
1349
+ redactAllPII: async (r, o) => {
1350
+ const i = T(o);
1351
+ if (!i)
1352
+ return !1;
1353
+ const a = f.get(i) || t;
1354
+ w(i, a), f.set(i, a), g = i;
1355
+ const l = await xe(i, a);
1356
+ return l > 0 && O(i), l > 0;
1291
1357
  },
1292
- redactPIIFinding: async (r, i) => {
1293
- const o = T(i);
1294
- if (!o || typeof r != "string" || !r) return !1;
1295
- const a = f.get(o) || t;
1296
- return w(o, a), f.set(o, a), g = o, De(o, r, a);
1358
+ redactPIIFinding: async (r, o) => {
1359
+ const i = T(o);
1360
+ if (!i || typeof r != "string" || !r)
1361
+ return !1;
1362
+ const a = f.get(i) || t;
1363
+ return w(i, a), f.set(i, a), g = i, _e(i, r, a);
1297
1364
  },
1298
- togglePIIRealtime: (r, i) => {
1299
- const o = T(i);
1300
- if (!o) return !1;
1301
- const a = f.get(o) || t;
1302
- w(o, a), f.set(o, a);
1303
- const l = typeof r == "boolean" ? r : !F(o, a);
1304
- S.set(o, l);
1305
- const c = m.get(o);
1306
- return c && z(o, c, a), C(o, "togglePIIRealtime", l), l && h(o, a, !0), !0;
1365
+ togglePIIRealtime: (r, o) => {
1366
+ const i = T(o);
1367
+ if (!i)
1368
+ return !1;
1369
+ const a = f.get(i) || t;
1370
+ w(i, a), f.set(i, a);
1371
+ const l = typeof r == "boolean" ? r : !H(i, a);
1372
+ S.set(i, l);
1373
+ const c = m.get(i);
1374
+ return c && F(i, c, a), C(i, "togglePIIRealtime", l), l && h(i, a, !0), !0;
1307
1375
  },
1308
- getPIIRedactionFindings: (r, i) => {
1309
- const o = T(i);
1310
- if (!o) return !1;
1311
- const a = I.get(o) || [], l = E.get(o) || le(0), c = a.map((s) => ({ ...s })), d = {
1376
+ getPIIRedactionFindings: (r, o) => {
1377
+ const i = T(o);
1378
+ if (!i)
1379
+ return !1;
1380
+ const a = I.get(i) || [], l = E.get(i) || le(0), c = a.map((d) => ({ ...d })), s = {
1312
1381
  ...l,
1313
1382
  byType: { ...l.byType }
1314
1383
  };
1315
1384
  if (typeof r == "function")
1316
1385
  try {
1317
- r(c, d);
1386
+ r(c, s);
1318
1387
  } catch {
1319
1388
  }
1320
- return o.__piiRedactionFindings = c, o.dispatchEvent(
1389
+ return i.__piiRedactionFindings = c, i.dispatchEvent(
1321
1390
  new CustomEvent("editora:pii-findings", {
1322
1391
  bubbles: !0,
1323
- detail: { findings: c, stats: d }
1392
+ detail: { findings: c, stats: s }
1324
1393
  })
1325
1394
  ), !0;
1326
1395
  },
1327
- setPIIRedactionOptions: (r, i) => {
1328
- const o = T(i);
1329
- if (!o || !r || typeof r != "object") return !1;
1330
- const a = f.get(o) || t, l = ee({
1396
+ setPIIRedactionOptions: (r, o) => {
1397
+ const i = T(o);
1398
+ if (!i || !r || typeof r != "object")
1399
+ return !1;
1400
+ const a = f.get(i) || t, l = ee({
1331
1401
  ...ce(a),
1332
1402
  ...r,
1333
1403
  labels: {
@@ -1340,9 +1410,9 @@ const mt = (e = {}) => {
1340
1410
  },
1341
1411
  normalizeText: r.normalizeText || a.normalizeText
1342
1412
  });
1343
- f.set(o, l), typeof r.enableRealtime == "boolean" && S.set(o, r.enableRealtime);
1344
- const c = m.get(o);
1345
- return c && (nt(c, l), H(o), z(o, c, l)), h(o, l, !0), !0;
1413
+ f.set(i, l), typeof r.enableRealtime == "boolean" && S.set(i, r.enableRealtime);
1414
+ const c = m.get(i);
1415
+ return c && (rt(c, l), B(i), F(i, c, l)), h(i, l, !0), !0;
1346
1416
  }
1347
1417
  },
1348
1418
  keymap: {
@@ -1355,23 +1425,23 @@ const mt = (e = {}) => {
1355
1425
  "Mod-Alt-Shift-y": "togglePIIRealtime",
1356
1426
  "Mod-Alt-Shift-Y": "togglePIIRealtime"
1357
1427
  },
1358
- init: function(i) {
1428
+ init: function(o) {
1359
1429
  G += 1;
1360
- const o = this && typeof this.__pluginConfig == "object" ? ee({ ...ce(t), ...this.__pluginConfig }) : t;
1361
- bt(o);
1430
+ const i = this && typeof this.__pluginConfig == "object" ? ee({ ...ce(t), ...this.__pluginConfig }) : t;
1431
+ gt(i);
1362
1432
  const a = T(
1363
- i?.editorElement ? { editorElement: i.editorElement } : void 0,
1433
+ o != null && o.editorElement ? { editorElement: o.editorElement } : void 0,
1364
1434
  !1
1365
1435
  );
1366
- a && (g = a, n.add(a), w(a, o), f.set(a, o), C(a, "togglePIIRedactionPanel", !1), C(a, "togglePIIRealtime", o.enableRealtime), o.enableRealtime && _e(a));
1436
+ a && (g = a, n.add(a), w(a, i), f.set(a, i), C(a, "togglePIIRedactionPanel", !1), C(a, "togglePIIRealtime", i.enableRealtime), i.enableRealtime && Ne(a));
1367
1437
  },
1368
1438
  destroy: () => {
1369
- n.forEach((r) => Ie(r)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (W.forEach((r) => {
1439
+ n.forEach((r) => Te(r)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (j.forEach((r) => {
1370
1440
  window.clearTimeout(r);
1371
- }), W.clear(), gt());
1441
+ }), j.clear(), mt());
1372
1442
  }
1373
1443
  };
1374
1444
  };
1375
1445
  export {
1376
- mt as PIIRedactionPlugin
1446
+ ht as PIIRedactionPlugin
1377
1447
  };