@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 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 = [
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 = [
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
- ], ze = {
9
+ ], Oe = {
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
- }, Fe = {
26
+ }, ze = {
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) => We(e)
46
+ validator: (e) => qe(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(), 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) {
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) {
66
66
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
67
67
  }
68
- function Be(e) {
68
+ function He(e) {
69
69
  return e.replace(/\u00A0/g, " ").replace(/\s+/g, " ").trim();
70
70
  }
71
71
  function Y(e) {
@@ -78,32 +78,31 @@ function be(e) {
78
78
  function X(e, t, n) {
79
79
  return Math.max(t, Math.min(n, e));
80
80
  }
81
- function Ke(e, t) {
81
+ function Be(e, t) {
82
82
  return e === "high" || e === "medium" || e === "low" ? e : t;
83
83
  }
84
- function qe(e) {
84
+ function Ke(e) {
85
85
  const t = (e || "*").slice(0, 1) || "*";
86
86
  return /[A-Za-z0-9._%+\-\s]/.test(t) ? "*" : t;
87
87
  }
88
- function $e(e) {
88
+ function ve(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 We(e) {
94
+ function qe(e) {
95
95
  const t = e.replace(/\D/g, "");
96
- if (t.length < 13 || t.length > 19)
97
- return !1;
96
+ if (t.length < 13 || t.length > 19) return !1;
98
97
  let n = 0, r = !1;
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;
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;
102
101
  }
103
102
  return n % 10 === 0;
104
103
  }
105
- function je(e, t) {
106
- const n = Fe[e];
104
+ function We(e, t) {
105
+ const n = ze[e];
107
106
  if (typeof t == "boolean")
108
107
  return {
109
108
  type: e,
@@ -126,32 +125,29 @@ function je(e, t) {
126
125
  return {
127
126
  type: e,
128
127
  label: n.label,
129
- severity: Ke(t.severity, n.severity),
128
+ severity: Be(t.severity, n.severity),
130
129
  enabled: t.enabled !== !1,
131
130
  pattern: r,
132
131
  validator: n.validator
133
132
  };
134
133
  }
135
134
  function ee(e = {}) {
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("|");
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("|");
140
136
  return {
141
137
  enableRealtime: e.enableRealtime !== !1,
142
138
  debounceMs: X(Number(e.debounceMs ?? 220), 60, 3e3),
143
139
  maxFindings: X(Number(e.maxFindings ?? 140), 1, 500),
144
- maskChar: qe(e.maskChar),
140
+ maskChar: Ke(e.maskChar),
145
141
  revealStart: X(Number(e.revealStart ?? 2), 0, 12),
146
142
  revealEnd: X(Number(e.revealEnd ?? 2), 0, 12),
147
143
  redactionMode: e.redactionMode === "mask" ? "mask" : "token",
148
144
  redactionToken: (e.redactionToken || "REDACTED").trim() || "REDACTED",
149
145
  skipInCodeBlocks: e.skipInCodeBlocks !== !1,
150
146
  labels: {
151
- ...ze,
147
+ ...Oe,
152
148
  ...e.labels || {}
153
149
  },
154
- normalizeText: e.normalizeText || Be,
150
+ normalizeText: e.normalizeText || He,
155
151
  detectors: t,
156
152
  detectorSignature: n
157
153
  };
@@ -182,41 +178,35 @@ function ce(e) {
182
178
  function ge(e) {
183
179
  return e.closest(ae) || e;
184
180
  }
185
- function Ze(e) {
181
+ function je(e) {
186
182
  const t = e.closest("[data-editora-editor]");
187
- if (t && z(t) === e)
183
+ if (t && O(t) === e)
188
184
  return t;
189
185
  let n = e;
190
186
  for (; n; ) {
191
- if (n.matches(ae) && (n === e || z(n) === e))
187
+ if (n.matches(ae) && (n === e || O(n) === e))
192
188
  return n;
193
189
  n = n.parentElement;
194
190
  }
195
191
  return ge(e);
196
192
  }
197
- function z(e) {
198
- if (!e)
199
- return null;
200
- if (e.matches(x))
201
- return e;
193
+ function O(e) {
194
+ if (!e) return null;
195
+ if (e.matches(x)) return e;
202
196
  const t = e.querySelector(x);
203
197
  return t instanceof HTMLElement ? t : null;
204
198
  }
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;
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;
215
206
  const n = e.closest(ae);
216
207
  if (n) {
217
- const o = z(n);
218
- if (o)
219
- return o;
208
+ const i = O(n);
209
+ if (i) return i;
220
210
  }
221
211
  const r = e.closest(x);
222
212
  return r instanceof HTMLElement ? r : null;
@@ -224,24 +214,23 @@ function Ve() {
224
214
  function J(e) {
225
215
  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;
226
216
  }
227
- function Ue(e) {
217
+ function Ve(e) {
228
218
  const t = ge(e);
229
- if (J(t))
230
- return !0;
219
+ if (J(t)) return !0;
231
220
  const n = t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");
232
221
  return J(n) ? !0 : J(document.documentElement) || J(document.body);
233
222
  }
234
223
  function ne(e, t) {
235
- e.classList.remove("rte-pii-redaction-theme-dark"), Ue(t) && e.classList.add("rte-pii-redaction-theme-dark");
224
+ e.classList.remove("rte-pii-redaction-theme-dark"), Ve(t) && e.classList.add("rte-pii-redaction-theme-dark");
236
225
  }
237
226
  function re(e) {
238
227
  return e ? e.nodeType === Node.ELEMENT_NODE ? e : e.parentElement : null;
239
228
  }
240
229
  function me(e) {
241
230
  const t = te.get(e);
242
- typeof t == "number" && (window.clearTimeout(t), j.delete(t), te.delete(e));
231
+ typeof t == "number" && (window.clearTimeout(t), W.delete(t), te.delete(e));
243
232
  }
244
- function U(e) {
233
+ function V(e) {
245
234
  return e.getAttribute("contenteditable") === "false" || e.getAttribute("data-readonly") === "true";
246
235
  }
247
236
  function le(e = 0) {
@@ -262,213 +251,197 @@ function le(e = 0) {
262
251
  }
263
252
  };
264
253
  }
265
- function q() {
266
- Array.from(W).forEach((t) => {
267
- t.isConnected || Te(t);
254
+ function K() {
255
+ Array.from(q).forEach((t) => {
256
+ t.isConnected || Ie(t);
268
257
  });
269
258
  }
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}`))
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}`))
281
268
  return !0;
282
269
  }
283
270
  }
284
271
  return !1;
285
272
  }
286
273
  function T(e, t = !0) {
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;
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;
293
278
  }
294
- const n = Ve();
295
- if (n)
296
- return n;
279
+ const n = Ze();
280
+ if (n) return n;
297
281
  const r = window.getSelection();
298
282
  if (r && r.rangeCount > 0) {
299
- const i = re(r.getRangeAt(0).startContainer), a = i == null ? void 0 : i.closest(x);
300
- if (a)
301
- return a;
283
+ const a = re(r.getRangeAt(0).startContainer)?.closest(x);
284
+ if (a) return a;
302
285
  }
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;
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;
310
291
  }
311
292
  return g && g.isConnected ? g : (g && !g.isConnected && (g = null), t ? document.querySelector(x) : null);
312
293
  }
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);
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);
316
296
  }
317
297
  function C(e, t, n) {
318
- const r = Ze(e);
298
+ const r = je(e);
319
299
  Array.from(
320
300
  r.querySelectorAll(
321
301
  `.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`
322
302
  )
323
- ).forEach((i) => {
324
- i.classList.toggle("active", n), i.setAttribute("data-active", n ? "true" : "false"), i.setAttribute("aria-pressed", n ? "true" : "false");
303
+ ).forEach((o) => {
304
+ o.classList.toggle("active", n), o.setAttribute("data-active", n ? "true" : "false"), o.setAttribute("aria-pressed", n ? "true" : "false");
325
305
  });
326
306
  }
327
307
  function w(e, t) {
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);
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);
329
309
  }
330
- function ie(e) {
331
- return V.get(e) === !0;
310
+ function oe(e) {
311
+ return Z.get(e) === !0;
332
312
  }
333
- function Ie(e, t, n, r) {
334
- if (!e)
335
- return e;
313
+ function $e(e, t, n, r) {
314
+ if (!e) return e;
336
315
  if (e.length <= n + r)
337
316
  return t.repeat(e.length);
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}`;
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}`;
340
319
  }
341
320
  function se(e, t, n) {
342
321
  const r = e.replace(/\D/g, "");
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("");
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("");
348
326
  }
349
- function Ye(e, t) {
327
+ function Ge(e, t) {
350
328
  const n = e.indexOf("@");
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}`;
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}`;
355
332
  }
356
- function Xe(e, t) {
333
+ function Ye(e, t) {
357
334
  const n = e.split(".");
358
335
  return n.length !== 4 ? e : `${n[0]}.${n[1]}.${n[2]}.${t.repeat(Math.max(1, n[3].length))}`;
359
336
  }
360
- function Ce(e, t, n) {
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));
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));
362
339
  }
363
- function Re(e, t, n) {
364
- return n.redactionMode === "mask" ? Ce(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
340
+ function Ce(e, t, n) {
341
+ return n.redactionMode === "mask" ? Te(e, t, n) : `[${n.redactionToken}:${t.toUpperCase()}]`;
365
342
  }
366
- function Je(e) {
367
- return ve += 1, `pii-${e}-${Date.now().toString(36)}-${ve.toString(36)}`;
343
+ function Xe(e) {
344
+ return Ee += 1, `pii-${e}-${Date.now().toString(36)}-${Ee.toString(36)}`;
368
345
  }
369
346
  function he(e, t) {
370
- var n;
371
- return t.skipInCodeBlocks ? !!((n = e.parentElement) != null && n.closest("code, pre, kbd, samp")) : !1;
347
+ return t.skipInCodeBlocks ? !!e.parentElement?.closest("code, pre, kbd, samp") : !1;
372
348
  }
373
- function Qe(e, t) {
349
+ function Je(e, t) {
374
350
  return t.some((n) => e.start < n.end && n.start < e.end);
375
351
  }
376
- function et(e, t, n) {
352
+ function Qe(e, t, n) {
377
353
  const r = [];
378
354
  t.filter((a) => a.enabled).forEach((a) => {
379
355
  const l = be(a.pattern);
380
356
  let c = l.exec(e);
381
357
  for (; c && r.length < n * 5; ) {
382
- const s = c[0] || "", d = c.index, p = d + s.length;
383
- s && p > d && (!a.validator || a.validator(s)) && r.push({
358
+ const d = c[0] || "", s = c.index, b = s + d.length;
359
+ d && b > s && (!a.validator || a.validator(d)) && r.push({
384
360
  type: a.type,
385
361
  severity: a.severity,
386
- value: s,
387
- start: d,
388
- end: p
362
+ value: d,
363
+ start: s,
364
+ end: b
389
365
  }), l.lastIndex === c.index && (l.lastIndex += 1), c = l.exec(e);
390
366
  }
391
367
  }), r.sort((a, l) => a.start !== l.start ? a.start - l.start : l.end - a.end);
392
- const i = [];
393
- for (let a = 0; a < r.length && !(i.length >= n); a += 1) {
368
+ const o = [];
369
+ for (let a = 0; a < r.length && !(o.length >= n); a += 1) {
394
370
  const l = r[a];
395
- Qe({ start: l.start, end: l.end }, i) || i.push(l);
371
+ Je({ start: l.start, end: l.end }, o) || o.push(l);
396
372
  }
397
- return i;
373
+ return o;
398
374
  }
399
375
  function ue(e, t = 120) {
400
376
  return e.length <= t ? e : `${e.slice(0, t - 1).trimEnd()}...`;
401
377
  }
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);
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);
405
381
  }
406
- function nt(e, t) {
382
+ function tt(e, t) {
407
383
  const n = le(t);
408
384
  return n.total = e.length, e.forEach((r) => {
409
385
  n.byType[r.type] += 1, r.severity === "high" ? n.high += 1 : r.severity === "medium" ? n.medium += 1 : n.low += 1;
410
386
  }), n;
411
387
  }
412
- function oe(e, t) {
388
+ function ie(e, t) {
413
389
  const n = e.querySelector(".rte-pii-redaction-live");
414
390
  n && (n.textContent = t);
415
391
  }
416
- function F(e, t, n) {
392
+ function z(e, t, n) {
417
393
  const r = t.querySelector('[data-action="toggle-realtime"]');
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);
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);
422
397
  }
423
- function rt(e, t) {
398
+ function nt(e, t) {
424
399
  e.setAttribute("aria-label", t.labels.panelAriaLabel);
425
400
  const n = e.querySelector(".rte-pii-redaction-title");
426
401
  n && (n.textContent = t.labels.panelTitle);
427
402
  const r = e.querySelector('[data-action="close"]');
428
403
  r && r.setAttribute("aria-label", t.labels.closeText);
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);
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);
433
408
  const a = e.querySelector(".rte-pii-redaction-shortcut");
434
409
  a && (a.textContent = t.labels.shortcutText);
435
410
  }
436
- function B(e) {
411
+ function H(e) {
437
412
  const t = m.get(e);
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>`;
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>`;
447
420
  return;
448
421
  }
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"' : "";
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"' : "";
451
424
  return `
452
- <li class="rte-pii-redaction-item rte-pii-redaction-item-${d.severity}">
425
+ <li class="rte-pii-redaction-item rte-pii-redaction-item-${s.severity}">
453
426
  <button
454
427
  type="button"
455
428
  class="rte-pii-redaction-item-btn"
456
429
  data-action="locate-finding"
457
- data-finding-id="${b(d.id)}"
430
+ data-finding-id="${p(s.id)}"
458
431
  data-role="finding-button"
459
- aria-label="${b(P)}"
432
+ aria-label="${p(B)}"
460
433
  >
461
- <span class="rte-pii-redaction-badge">${b(d.severity.toUpperCase())}</span>
462
- <span class="rte-pii-redaction-type">${b(p)}</span>
434
+ <span class="rte-pii-redaction-badge">${p(s.severity.toUpperCase())}</span>
435
+ <span class="rte-pii-redaction-type">${p(b)}</span>
463
436
  </button>
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>
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>
468
441
  <div class="rte-pii-redaction-item-actions">
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>
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>
472
445
  </div>
473
446
  </li>
474
447
  `;
@@ -476,18 +449,16 @@ function B(e) {
476
449
  }
477
450
  }
478
451
  function fe(e, t) {
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`;
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`;
483
455
  }
484
- function H(e, t) {
456
+ function F(e, t) {
485
457
  const n = S.get(e);
486
458
  return typeof n == "boolean" ? n : t ? t.enableRealtime : !0;
487
459
  }
488
- function Se(e, t) {
489
- if (t === e.innerHTML)
490
- return;
460
+ function Re(e, t) {
461
+ if (t === e.innerHTML) return;
491
462
  const n = window.execEditorCommand || window.executeEditorCommand;
492
463
  if (typeof n == "function")
493
464
  try {
@@ -495,10 +466,10 @@ function Se(e, t) {
495
466
  } catch {
496
467
  }
497
468
  }
498
- function Ae(e) {
469
+ function Se(e) {
499
470
  e.dispatchEvent(new Event("input", { bubbles: !0 }));
500
471
  }
501
- function Me(e, t) {
472
+ function Ae(e, t) {
502
473
  e.dispatchEvent(
503
474
  new CustomEvent("editora:pii-redacted", {
504
475
  bubbles: !0,
@@ -508,18 +479,17 @@ function Me(e, t) {
508
479
  })
509
480
  );
510
481
  }
511
- function Pe(e, t) {
482
+ function Me(e, t) {
512
483
  return (I.get(e) || []).find((r) => r.id === t);
513
484
  }
514
- function it(e) {
485
+ function rt(e) {
515
486
  const t = m.get(e);
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 = `
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 = `
520
490
  <header class="rte-pii-redaction-header">
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(
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(
523
493
  n.labels.closeText
524
494
  )}">✕</button>
525
495
  </header>
@@ -529,115 +499,107 @@ function it(e) {
529
499
  <span class="rte-pii-redaction-count" aria-hidden="true">0</span>
530
500
  </div>
531
501
  <div class="rte-pii-redaction-controls" role="toolbar" aria-label="PII redaction controls">
532
- <button type="button" class="rte-pii-redaction-btn rte-pii-redaction-btn-primary" data-action="run-scan">${b(
502
+ <button type="button" class="rte-pii-redaction-btn rte-pii-redaction-btn-primary" data-action="run-scan">${p(
533
503
  n.labels.scanText
534
504
  )}</button>
535
- <button type="button" class="rte-pii-redaction-btn" data-action="redact-all">${b(
505
+ <button type="button" class="rte-pii-redaction-btn" data-action="redact-all">${p(
536
506
  n.labels.redactAllText
537
507
  )}</button>
538
508
  <button type="button" class="rte-pii-redaction-btn" data-action="toggle-realtime" aria-pressed="false"></button>
539
509
  </div>
540
510
  <ul class="rte-pii-redaction-list" role="list" aria-label="Detected PII findings"></ul>
541
- <p class="rte-pii-redaction-shortcut">${b(n.labels.shortcutText)}</p>
511
+ <p class="rte-pii-redaction-shortcut">${p(n.labels.shortcutText)}</p>
542
512
  <span class="rte-pii-redaction-live" aria-live="polite"></span>
543
513
  </div>
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);
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);
551
520
  return;
552
521
  }
553
522
  if (c === "run-scan") {
554
- h(e, s, !0);
523
+ h(e, d, !0);
555
524
  return;
556
525
  }
557
526
  if (c === "toggle-realtime") {
558
- const d = !H(e, s);
559
- S.set(e, d), F(e, o, s), d && h(e, s, !0);
527
+ const s = !F(e, d);
528
+ S.set(e, s), z(e, i, d), s && h(e, d, !0);
560
529
  return;
561
530
  }
562
531
  if (c === "redact-all") {
563
- xe(e, s);
532
+ xe(e, d);
564
533
  return;
565
534
  }
566
535
  if (c === "locate-finding") {
567
- const d = l.getAttribute("data-finding-id") || "", p = Pe(e, d);
568
- if (!p)
569
- return;
570
- lt(e, p, s);
536
+ const s = l.getAttribute("data-finding-id") || "", b = Me(e, s);
537
+ if (!b) return;
538
+ at(e, b, d);
571
539
  return;
572
540
  }
573
541
  if (c === "redact-finding") {
574
- const d = l.getAttribute("data-finding-id") || "";
575
- _e(e, d, s);
542
+ const s = l.getAttribute("data-finding-id") || "";
543
+ De(e, s, d);
576
544
  }
577
- }), o.addEventListener("keydown", (i) => {
578
- if (i.key === "Escape") {
579
- i.preventDefault(), Z(e, !0);
545
+ }), i.addEventListener("keydown", (o) => {
546
+ if (o.key === "Escape") {
547
+ o.preventDefault(), j(e, !0);
580
548
  return;
581
549
  }
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;
594
- }
595
- function Z(e, t = !1) {
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) {
596
561
  const n = m.get(e);
597
- n && (n.classList.remove("show"), V.set(e, !1), C(e, "togglePIIRedactionPanel", !1), t && e.focus({ preventScroll: !0 }));
562
+ n && (n.classList.remove("show"), Z.set(e, !1), C(e, "togglePIIRedactionPanel", !1), t && e.focus({ preventScroll: !0 }));
598
563
  }
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;
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();
570
+ }
571
+ function Pe(e, t) {
572
+ const n = oe(e);
573
+ return (typeof t == "boolean" ? t : !n) ? N(e) : j(e), !0;
611
574
  }
612
575
  function ot(e, t) {
613
576
  const n = t.normalizeText(e.innerText || e.textContent || ""), r = e.innerHTML;
614
- return `${n.length}:${$e(n)}:${r.length}:${$e(r)}:${t.detectorSignature}`;
577
+ return `${n.length}:${ve(n)}:${r.length}:${ve(r)}:${t.detectorSignature}`;
615
578
  }
616
- function at(e, t) {
579
+ function it(e, t) {
617
580
  const n = [], r = be(e.pattern);
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);
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);
622
585
  }
623
586
  return n;
624
587
  }
625
- function De(e, t, n) {
588
+ function Le(e, t, n) {
626
589
  const r = n.detectors.find((c) => c.type === t.type && c.enabled);
627
- if (!r)
628
- return null;
629
- const o = t.match.toLowerCase();
630
- let i = 0;
590
+ if (!r) return null;
591
+ const i = t.match.toLowerCase();
592
+ let o = 0;
631
593
  const a = document.createTreeWalker(e, pe, null);
632
594
  let l = a.nextNode();
633
595
  for (; l; ) {
634
596
  if (!he(l, n)) {
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;
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;
641
603
  }
642
604
  }
643
605
  }
@@ -645,184 +607,166 @@ function De(e, t, n) {
645
607
  }
646
608
  return null;
647
609
  }
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;
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;
658
615
  }
659
616
  async function h(e, t, n = !1) {
660
- var p;
661
617
  w(e, t);
662
618
  const r = ot(e, t);
663
619
  if (!n && de.get(e) === r)
664
620
  return I.get(e) || [];
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);
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);
668
624
  let c = l.nextNode();
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),
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),
677
633
  type: y.type,
678
634
  severity: y.severity,
679
635
  match: y.value,
680
- masked: Ce(y.value, y.type, t),
681
- occurrence: ke,
682
- excerpt: tt(A, y.start, y.end),
636
+ masked: Te(y.value, y.type, t),
637
+ occurrence: ye,
638
+ excerpt: et(b, y.start, y.end),
683
639
  suggestion: "Review and redact this value before external sharing."
684
640
  });
685
641
  }
686
642
  }
687
643
  c = l.nextNode();
688
644
  }
689
- if (Q.get(e) !== o)
645
+ if (Q.get(e) !== i)
690
646
  return I.get(e) || [];
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(
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(
693
649
  new CustomEvent("editora:pii-scan", {
694
650
  bubbles: !0,
695
651
  detail: {
696
- findings: i,
697
- stats: d
652
+ findings: o,
653
+ stats: s
698
654
  }
699
655
  })
700
- ), i;
656
+ ), o;
701
657
  }
702
- function ct(e, t) {
658
+ function lt(e, t) {
703
659
  let n = e, r = 0;
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)));
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)));
707
663
  }), { nextValue: n, count: r };
708
664
  }
709
- async function _e(e, t, n) {
710
- var s;
711
- if (U(e)) {
665
+ async function De(e, t, n) {
666
+ if (V(e)) {
712
667
  const d = m.get(e);
713
- return d && oe(d, n.labels.readonlyRedactionText), !1;
668
+ return d && ie(d, n.labels.readonlyRedactionText), !1;
714
669
  }
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)}`;
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)}`;
725
678
  } else
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;
679
+ i.deleteContents(), i.insertNode(document.createTextNode(a));
680
+ Se(e), Re(e, o);
681
+ const l = E.get(e)?.redactedCount || 0;
729
682
  await h(e, n, !0);
730
683
  const c = E.get(e);
731
- return c && (c.redactedCount = l + 1, B(e)), Me(e, 1), !0;
684
+ return c && (c.redactedCount = l + 1, H(e)), Ae(e, 1), !0;
732
685
  }
733
686
  async function xe(e, t) {
734
- var s;
735
- if (U(e)) {
687
+ if (V(e)) {
736
688
  const d = m.get(e);
737
- return d && oe(d, t.labels.readonlyRedactionText), 0;
689
+ return d && ie(d, t.labels.readonlyRedactionText), 0;
738
690
  }
739
691
  (I.get(e) || []).length === 0 && await h(e, t, !0);
740
692
  const r = e.innerHTML;
741
- let o = 0;
742
- const i = document.createTreeWalker(e, pe, null);
743
- let a = i.nextNode();
693
+ let i = 0;
694
+ const o = document.createTreeWalker(e, pe, null);
695
+ let a = o.nextNode();
744
696
  for (; a; ) {
745
697
  if (he(a, t)) {
746
- a = i.nextNode();
698
+ a = o.nextNode();
747
699
  continue;
748
700
  }
749
701
  const d = a.data || "";
750
702
  if (!d) {
751
- a = i.nextNode();
703
+ a = o.nextNode();
752
704
  continue;
753
705
  }
754
- const p = ct(d, t);
755
- p.count > 0 && p.nextValue !== d && (a.data = p.nextValue, o += p.count), a = i.nextNode();
706
+ const s = lt(d, t);
707
+ s.count > 0 && s.nextValue !== d && (a.data = s.nextValue, i += s.count), a = o.nextNode();
756
708
  }
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;
709
+ if (i === 0) return 0;
710
+ Se(e), Re(e, r);
711
+ const l = E.get(e)?.redactedCount || 0;
761
712
  await h(e, t, !0);
762
713
  const c = E.get(e);
763
- return c && (c.redactedCount = l + o, B(e)), Me(e, o), o;
714
+ return c && (c.redactedCount = l + i, H(e)), Ae(e, i), i;
764
715
  }
765
- function Ne(e) {
766
- const t = f.get(e) || M;
767
- if (!t || !H(e, t) || U(e))
768
- return;
716
+ function _e(e) {
717
+ const t = f.get(e) || A;
718
+ if (!t || !F(e, t) || V(e)) return;
769
719
  me(e);
770
720
  const n = window.setTimeout(() => {
771
- j.delete(n), te.delete(e), h(e, t, !1);
721
+ W.delete(n), te.delete(e), h(e, t, !1);
772
722
  }, t.debounceMs);
773
- j.add(n), te.set(e, n);
723
+ W.add(n), te.set(e, n);
774
724
  }
775
- function st(e) {
725
+ function ct(e) {
776
726
  const t = e.key.toLowerCase();
777
727
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "i";
778
728
  }
779
- function dt(e) {
729
+ function st(e) {
780
730
  const t = e.key.toLowerCase();
781
731
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "u";
782
732
  }
783
- function ut(e) {
733
+ function dt(e) {
784
734
  const t = e.key.toLowerCase();
785
735
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "m";
786
736
  }
787
- function ft(e) {
737
+ function ut(e) {
788
738
  const t = e.key.toLowerCase();
789
739
  return (e.metaKey || e.ctrlKey) && e.altKey && e.shiftKey && t === "y";
790
740
  }
791
- function pt(e) {
792
- var r;
741
+ function ft(e) {
793
742
  const t = re(e.target);
794
743
  if (t) {
795
- const o = t.closest(x);
796
- if (o)
797
- return o;
744
+ const r = t.closest(x);
745
+ if (r) return r;
798
746
  const i = t.closest(ae);
799
747
  if (i) {
800
- const l = z(i);
801
- if (l)
802
- return l;
748
+ const a = O(i);
749
+ if (a) return a;
803
750
  }
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];
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];
809
755
  }
810
756
  }
811
757
  const n = window.getSelection();
812
758
  if (n && n.rangeCount > 0) {
813
- const o = (r = re(n.getRangeAt(0).startContainer)) == null ? void 0 : r.closest(
759
+ const r = re(n.getRangeAt(0).startContainer)?.closest(
814
760
  x
815
761
  );
816
- if (o)
817
- return o;
762
+ if (r) return r;
818
763
  }
819
764
  return null;
820
765
  }
821
- function bt() {
822
- if (typeof document > "u" || document.getElementById(Ee))
823
- return;
766
+ function pt() {
767
+ if (typeof document > "u" || document.getElementById(we)) return;
824
768
  const e = document.createElement("style");
825
- e.id = Ee, e.textContent = `
769
+ e.id = we, e.textContent = `
826
770
  .rte-toolbar-group-items.${k},
827
771
  .editora-toolbar-group-items.${k},
828
772
  .rte-toolbar-group-items.${v},
@@ -1219,70 +1163,64 @@ function bt() {
1219
1163
  }
1220
1164
  `, document.head.appendChild(e);
1221
1165
  }
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;
1166
+ function bt(e) {
1167
+ A = e, P || (P = (t) => {
1168
+ K();
1169
+ const r = t.target?.closest(x);
1170
+ if (!r) return;
1228
1171
  g = r;
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)
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);
1238
1186
  return;
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);
1187
+ }
1188
+ if (ct(t)) {
1189
+ t.preventDefault(), t.stopPropagation(), Pe(r);
1248
1190
  return;
1249
1191
  }
1250
1192
  if (st(t)) {
1251
- t.preventDefault(), t.stopPropagation(), Le(r);
1193
+ t.preventDefault(), t.stopPropagation(), h(r, i, !0), N(r);
1252
1194
  return;
1253
1195
  }
1254
1196
  if (dt(t)) {
1255
- t.preventDefault(), t.stopPropagation(), h(r, o, !0), O(r);
1197
+ t.preventDefault(), t.stopPropagation(), V(r) || (xe(r, i), N(r));
1256
1198
  return;
1257
1199
  }
1258
1200
  if (ut(t)) {
1259
- t.preventDefault(), t.stopPropagation(), U(r) || (xe(r, o), O(r));
1260
- return;
1261
- }
1262
- if (ft(t)) {
1263
1201
  t.preventDefault(), t.stopPropagation();
1264
- const i = !H(r, o);
1265
- S.set(r, i);
1202
+ const o = !F(r, i);
1203
+ S.set(r, o);
1266
1204
  const a = m.get(r);
1267
- a && F(r, a, o), C(r, "togglePIIRealtime", i), i && h(r, o, !0);
1205
+ a && z(r, a, i), C(r, "togglePIIRealtime", o), o && h(r, i, !0);
1268
1206
  }
1269
- }, document.addEventListener("keydown", _, !0)), R || (R = () => {
1270
- q(), m.forEach((t, n) => {
1207
+ }, document.addEventListener("keydown", D, !0)), R || (R = () => {
1208
+ K(), m.forEach((t, n) => {
1271
1209
  !n.isConnected || !t.isConnected || (ne(t, n), fe(n, t));
1272
1210
  });
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, {
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, {
1276
1214
  childList: !0,
1277
1215
  subtree: !0
1278
1216
  }));
1279
1217
  }
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;
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;
1282
1220
  }
1283
- const ht = (e = {}) => {
1221
+ const mt = (e = {}) => {
1284
1222
  const t = ee(e), n = /* @__PURE__ */ new Set();
1285
- return bt(), {
1223
+ return pt(), {
1286
1224
  name: "piiRedaction",
1287
1225
  toolbar: [
1288
1226
  {
@@ -1323,81 +1261,73 @@ const ht = (e = {}) => {
1323
1261
  }
1324
1262
  ],
1325
1263
  commands: {
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;
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;
1332
1269
  },
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;
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;
1341
1277
  },
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;
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;
1348
1283
  },
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;
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;
1357
1291
  },
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);
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);
1364
1297
  },
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;
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;
1375
1307
  },
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 = {
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 = {
1381
1312
  ...l,
1382
1313
  byType: { ...l.byType }
1383
1314
  };
1384
1315
  if (typeof r == "function")
1385
1316
  try {
1386
- r(c, s);
1317
+ r(c, d);
1387
1318
  } catch {
1388
1319
  }
1389
- return i.__piiRedactionFindings = c, i.dispatchEvent(
1320
+ return o.__piiRedactionFindings = c, o.dispatchEvent(
1390
1321
  new CustomEvent("editora:pii-findings", {
1391
1322
  bubbles: !0,
1392
- detail: { findings: c, stats: s }
1323
+ detail: { findings: c, stats: d }
1393
1324
  })
1394
1325
  ), !0;
1395
1326
  },
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({
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({
1401
1331
  ...ce(a),
1402
1332
  ...r,
1403
1333
  labels: {
@@ -1410,9 +1340,9 @@ const ht = (e = {}) => {
1410
1340
  },
1411
1341
  normalizeText: r.normalizeText || a.normalizeText
1412
1342
  });
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;
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;
1416
1346
  }
1417
1347
  },
1418
1348
  keymap: {
@@ -1425,23 +1355,23 @@ const ht = (e = {}) => {
1425
1355
  "Mod-Alt-Shift-y": "togglePIIRealtime",
1426
1356
  "Mod-Alt-Shift-Y": "togglePIIRealtime"
1427
1357
  },
1428
- init: function(o) {
1358
+ init: function(i) {
1429
1359
  G += 1;
1430
- const i = this && typeof this.__pluginConfig == "object" ? ee({ ...ce(t), ...this.__pluginConfig }) : t;
1431
- gt(i);
1360
+ const o = this && typeof this.__pluginConfig == "object" ? ee({ ...ce(t), ...this.__pluginConfig }) : t;
1361
+ bt(o);
1432
1362
  const a = T(
1433
- o != null && o.editorElement ? { editorElement: o.editorElement } : void 0,
1363
+ i?.editorElement ? { editorElement: i.editorElement } : void 0,
1434
1364
  !1
1435
1365
  );
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));
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));
1437
1367
  },
1438
1368
  destroy: () => {
1439
- n.forEach((r) => Te(r)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (j.forEach((r) => {
1369
+ n.forEach((r) => Ie(r)), n.clear(), G = Math.max(0, G - 1), !(G > 0) && (W.forEach((r) => {
1440
1370
  window.clearTimeout(r);
1441
- }), j.clear(), mt());
1371
+ }), W.clear(), gt());
1442
1372
  }
1443
1373
  };
1444
1374
  };
1445
1375
  export {
1446
- ht as PIIRedactionPlugin
1376
+ mt as PIIRedactionPlugin
1447
1377
  };