@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.
- package/README.md +5 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +249 -208
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +245 -178
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +512 -439
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +432 -371
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +159 -105
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +368 -328
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +308 -240
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +56 -54
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +128 -125
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +286 -238
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +49 -33
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +463 -393
- package/dist/preview.esm.js +10 -5
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +3 -3
- package/dist/slash-commands.esm.js +212 -176
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +336 -280
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +162 -100
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +678 -602
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +157 -128
- package/package.json +13 -7
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /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",
|
|
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
|
-
],
|
|
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
|
-
},
|
|
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) =>
|
|
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(),
|
|
64
|
-
let G = 0,
|
|
65
|
-
function
|
|
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, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
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
|
|
81
|
+
function Ke(e, t) {
|
|
82
82
|
return e === "high" || e === "medium" || e === "low" ? e : t;
|
|
83
83
|
}
|
|
84
|
-
function
|
|
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
|
|
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
|
|
94
|
+
function We(e) {
|
|
95
95
|
const t = e.replace(/\D/g, "");
|
|
96
|
-
if (t.length < 13 || t.length > 19)
|
|
96
|
+
if (t.length < 13 || t.length > 19)
|
|
97
|
+
return !1;
|
|
97
98
|
let n = 0, r = !1;
|
|
98
|
-
for (let
|
|
99
|
-
let
|
|
100
|
-
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
|
|
105
|
-
const n =
|
|
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:
|
|
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 =
|
|
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:
|
|
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
|
-
...
|
|
151
|
+
...ze,
|
|
148
152
|
...e.labels || {}
|
|
149
153
|
},
|
|
150
|
-
normalizeText: e.normalizeText ||
|
|
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
|
|
185
|
+
function Ze(e) {
|
|
182
186
|
const t = e.closest("[data-editora-editor]");
|
|
183
|
-
if (t &&
|
|
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 ||
|
|
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
|
|
194
|
-
if (!e)
|
|
195
|
-
|
|
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
|
|
200
|
-
if (typeof window > "u")
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
|
209
|
-
if (
|
|
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
|
|
227
|
+
function Ue(e) {
|
|
218
228
|
const t = ge(e);
|
|
219
|
-
if (J(t))
|
|
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"),
|
|
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),
|
|
242
|
+
typeof t == "number" && (window.clearTimeout(t), j.delete(t), te.delete(e));
|
|
232
243
|
}
|
|
233
|
-
function
|
|
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
|
|
255
|
-
Array.from(
|
|
256
|
-
t.isConnected ||
|
|
265
|
+
function q() {
|
|
266
|
+
Array.from(W).forEach((t) => {
|
|
267
|
+
t.isConnected || Te(t);
|
|
257
268
|
});
|
|
258
269
|
}
|
|
259
|
-
function
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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 (
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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 =
|
|
280
|
-
if (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
|
|
284
|
-
if (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
|
|
287
|
-
if (
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
|
|
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
|
|
295
|
-
|
|
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 =
|
|
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((
|
|
304
|
-
|
|
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),
|
|
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
|
|
311
|
-
return
|
|
330
|
+
function ie(e) {
|
|
331
|
+
return V.get(e) === !0;
|
|
312
332
|
}
|
|
313
|
-
function
|
|
314
|
-
if (!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
|
|
318
|
-
return `${
|
|
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)
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
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
|
|
349
|
+
function Ye(e, t) {
|
|
328
350
|
const n = e.indexOf("@");
|
|
329
|
-
if (n <= 0)
|
|
330
|
-
|
|
331
|
-
|
|
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
|
|
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.
|
|
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
|
|
344
|
-
return
|
|
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
|
-
|
|
370
|
+
var n;
|
|
371
|
+
return t.skipInCodeBlocks ? !!((n = e.parentElement) != null && n.closest("code, pre, kbd, samp")) : !1;
|
|
348
372
|
}
|
|
349
|
-
function
|
|
373
|
+
function Qe(e, t) {
|
|
350
374
|
return t.some((n) => e.start < n.end && n.start < e.end);
|
|
351
375
|
}
|
|
352
|
-
function
|
|
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
|
|
359
|
-
|
|
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:
|
|
363
|
-
start:
|
|
364
|
-
end:
|
|
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
|
|
369
|
-
for (let a = 0; a < r.length && !(
|
|
392
|
+
const i = [];
|
|
393
|
+
for (let a = 0; a < r.length && !(i.length >= n); a += 1) {
|
|
370
394
|
const l = r[a];
|
|
371
|
-
|
|
395
|
+
Qe({ start: l.start, end: l.end }, i) || i.push(l);
|
|
372
396
|
}
|
|
373
|
-
return
|
|
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
|
|
379
|
-
const r = Math.max(0, t - 28),
|
|
380
|
-
return ue(e.slice(r,
|
|
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
|
|
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
|
|
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
|
|
416
|
+
function F(e, t, n) {
|
|
393
417
|
const r = t.querySelector('[data-action="toggle-realtime"]');
|
|
394
|
-
if (!r)
|
|
395
|
-
|
|
396
|
-
|
|
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
|
|
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
|
|
405
|
-
|
|
406
|
-
const
|
|
407
|
-
|
|
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
|
|
436
|
+
function B(e) {
|
|
412
437
|
const t = m.get(e);
|
|
413
|
-
if (!t)
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
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((
|
|
423
|
-
const
|
|
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-${
|
|
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="${
|
|
457
|
+
data-finding-id="${b(d.id)}"
|
|
431
458
|
data-role="finding-button"
|
|
432
|
-
aria-label="${
|
|
459
|
+
aria-label="${b(P)}"
|
|
433
460
|
>
|
|
434
|
-
<span class="rte-pii-redaction-badge">${
|
|
435
|
-
<span class="rte-pii-redaction-type">${p
|
|
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>${
|
|
438
|
-
<p class="rte-pii-redaction-line"><strong>${
|
|
439
|
-
${
|
|
440
|
-
<p class="rte-pii-redaction-help">${
|
|
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="${
|
|
443
|
-
|
|
444
|
-
)}" aria-label="${
|
|
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"))
|
|
453
|
-
|
|
454
|
-
|
|
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
|
|
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
|
|
461
|
-
if (t === e.innerHTML)
|
|
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
|
|
498
|
+
function Ae(e) {
|
|
470
499
|
e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
471
500
|
}
|
|
472
|
-
function
|
|
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
|
|
511
|
+
function Pe(e, t) {
|
|
483
512
|
return (I.get(e) || []).find((r) => r.id === t);
|
|
484
513
|
}
|
|
485
|
-
function
|
|
514
|
+
function it(e) {
|
|
486
515
|
const t = m.get(e);
|
|
487
|
-
if (t)
|
|
488
|
-
|
|
489
|
-
|
|
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">${
|
|
492
|
-
<button type="button" class="rte-pii-redaction-icon-btn" data-action="close" aria-label="${
|
|
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">${
|
|
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">${
|
|
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">${
|
|
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
|
-
`,
|
|
515
|
-
const l =
|
|
516
|
-
if (!l)
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
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,
|
|
554
|
+
h(e, s, !0);
|
|
524
555
|
return;
|
|
525
556
|
}
|
|
526
557
|
if (c === "toggle-realtime") {
|
|
527
|
-
const
|
|
528
|
-
S.set(e,
|
|
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,
|
|
563
|
+
xe(e, s);
|
|
533
564
|
return;
|
|
534
565
|
}
|
|
535
566
|
if (c === "locate-finding") {
|
|
536
|
-
const
|
|
537
|
-
if (!
|
|
538
|
-
|
|
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
|
|
543
|
-
|
|
574
|
+
const d = l.getAttribute("data-finding-id") || "";
|
|
575
|
+
_e(e, d, s);
|
|
544
576
|
}
|
|
545
|
-
}),
|
|
546
|
-
if (
|
|
547
|
-
|
|
577
|
+
}), o.addEventListener("keydown", (i) => {
|
|
578
|
+
if (i.key === "Escape") {
|
|
579
|
+
i.preventDefault(), Z(e, !0);
|
|
548
580
|
return;
|
|
549
581
|
}
|
|
550
|
-
if (
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
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
|
|
565
|
-
|
|
566
|
-
|
|
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
|
|
572
|
-
|
|
573
|
-
|
|
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}:${
|
|
614
|
+
return `${n.length}:${$e(n)}:${r.length}:${$e(r)}:${t.detectorSignature}`;
|
|
578
615
|
}
|
|
579
|
-
function
|
|
616
|
+
function at(e, t) {
|
|
580
617
|
const n = [], r = be(e.pattern);
|
|
581
|
-
let
|
|
582
|
-
for (;
|
|
583
|
-
const
|
|
584
|
-
|
|
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
|
|
625
|
+
function De(e, t, n) {
|
|
589
626
|
const r = n.detectors.find((c) => c.type === t.type && c.enabled);
|
|
590
|
-
if (!r)
|
|
591
|
-
|
|
592
|
-
|
|
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 =
|
|
598
|
-
for (let
|
|
599
|
-
const
|
|
600
|
-
if (
|
|
601
|
-
const
|
|
602
|
-
return
|
|
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
|
|
611
|
-
const r =
|
|
612
|
-
if (!r)
|
|
613
|
-
|
|
614
|
-
|
|
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
|
|
622
|
-
Q.set(e,
|
|
623
|
-
const
|
|
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 &&
|
|
626
|
-
const
|
|
627
|
-
if (
|
|
628
|
-
const
|
|
629
|
-
for (let
|
|
630
|
-
const y =
|
|
631
|
-
a.set(
|
|
632
|
-
id:
|
|
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:
|
|
637
|
-
occurrence:
|
|
638
|
-
excerpt:
|
|
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) !==
|
|
689
|
+
if (Q.get(e) !== o)
|
|
646
690
|
return I.get(e) || [];
|
|
647
|
-
const
|
|
648
|
-
return de.set(e, r), I.set(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(
|
|
649
693
|
new CustomEvent("editora:pii-scan", {
|
|
650
694
|
bubbles: !0,
|
|
651
695
|
detail: {
|
|
652
|
-
findings:
|
|
653
|
-
stats:
|
|
696
|
+
findings: i,
|
|
697
|
+
stats: d
|
|
654
698
|
}
|
|
655
699
|
})
|
|
656
|
-
),
|
|
700
|
+
), i;
|
|
657
701
|
}
|
|
658
|
-
function
|
|
702
|
+
function ct(e, t) {
|
|
659
703
|
let n = e, r = 0;
|
|
660
|
-
return t.detectors.filter((
|
|
661
|
-
const a = be(
|
|
662
|
-
n = n.replace(a, (l) =>
|
|
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
|
|
666
|
-
|
|
709
|
+
async function _e(e, t, n) {
|
|
710
|
+
var s;
|
|
711
|
+
if (U(e)) {
|
|
667
712
|
const d = m.get(e);
|
|
668
|
-
return d &&
|
|
713
|
+
return d && oe(d, n.labels.readonlyRedactionText), !1;
|
|
669
714
|
}
|
|
670
|
-
const r =
|
|
671
|
-
if (!r)
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
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
|
-
|
|
680
|
-
|
|
681
|
-
const l = E.get(e)
|
|
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,
|
|
731
|
+
return c && (c.redactedCount = l + 1, B(e)), Me(e, 1), !0;
|
|
685
732
|
}
|
|
686
733
|
async function xe(e, t) {
|
|
687
|
-
|
|
734
|
+
var s;
|
|
735
|
+
if (U(e)) {
|
|
688
736
|
const d = m.get(e);
|
|
689
|
-
return d &&
|
|
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
|
|
694
|
-
const
|
|
695
|
-
let a =
|
|
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 =
|
|
746
|
+
a = i.nextNode();
|
|
699
747
|
continue;
|
|
700
748
|
}
|
|
701
749
|
const d = a.data || "";
|
|
702
750
|
if (!d) {
|
|
703
|
-
a =
|
|
751
|
+
a = i.nextNode();
|
|
704
752
|
continue;
|
|
705
753
|
}
|
|
706
|
-
const
|
|
707
|
-
|
|
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 (
|
|
710
|
-
|
|
711
|
-
|
|
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 +
|
|
763
|
+
return c && (c.redactedCount = l + o, B(e)), Me(e, o), o;
|
|
715
764
|
}
|
|
716
|
-
function
|
|
717
|
-
const t = f.get(e) ||
|
|
718
|
-
if (!t || !
|
|
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
|
-
|
|
771
|
+
j.delete(n), te.delete(e), h(e, t, !1);
|
|
722
772
|
}, t.debounceMs);
|
|
723
|
-
|
|
773
|
+
j.add(n), te.set(e, n);
|
|
724
774
|
}
|
|
725
|
-
function
|
|
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
|
|
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
|
|
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
|
|
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
|
|
791
|
+
function pt(e) {
|
|
792
|
+
var r;
|
|
742
793
|
const t = re(e.target);
|
|
743
794
|
if (t) {
|
|
744
|
-
const
|
|
745
|
-
if (
|
|
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
|
|
749
|
-
if (
|
|
800
|
+
const l = z(i);
|
|
801
|
+
if (l)
|
|
802
|
+
return l;
|
|
750
803
|
}
|
|
751
|
-
const
|
|
752
|
-
if (
|
|
753
|
-
const
|
|
754
|
-
if (
|
|
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)
|
|
813
|
+
const o = (r = re(n.getRangeAt(0).startContainer)) == null ? void 0 : r.closest(
|
|
760
814
|
x
|
|
761
815
|
);
|
|
762
|
-
if (
|
|
816
|
+
if (o)
|
|
817
|
+
return o;
|
|
763
818
|
}
|
|
764
819
|
return null;
|
|
765
820
|
}
|
|
766
|
-
function
|
|
767
|
-
if (typeof document > "u" || document.getElementById(
|
|
821
|
+
function bt() {
|
|
822
|
+
if (typeof document > "u" || document.getElementById(Ee))
|
|
823
|
+
return;
|
|
768
824
|
const e = document.createElement("style");
|
|
769
|
-
e.id =
|
|
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
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
const
|
|
1170
|
-
if (!r)
|
|
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
|
|
1173
|
-
w(r,
|
|
1174
|
-
const
|
|
1175
|
-
|
|
1176
|
-
}, document.addEventListener("focusin",
|
|
1177
|
-
const
|
|
1178
|
-
r && (g = r,
|
|
1179
|
-
}, document.addEventListener("input",
|
|
1180
|
-
if (t.defaultPrevented
|
|
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 (
|
|
1189
|
-
|
|
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(),
|
|
1251
|
+
t.preventDefault(), t.stopPropagation(), Le(r);
|
|
1194
1252
|
return;
|
|
1195
1253
|
}
|
|
1196
1254
|
if (dt(t)) {
|
|
1197
|
-
t.preventDefault(), t.stopPropagation(),
|
|
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
|
|
1203
|
-
S.set(r,
|
|
1264
|
+
const i = !H(r, o);
|
|
1265
|
+
S.set(r, i);
|
|
1204
1266
|
const a = m.get(r);
|
|
1205
|
-
a &&
|
|
1267
|
+
a && F(r, a, o), C(r, "togglePIIRealtime", i), i && h(r, o, !0);
|
|
1206
1268
|
}
|
|
1207
|
-
}, document.addEventListener("keydown",
|
|
1208
|
-
|
|
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)), !
|
|
1212
|
-
|
|
1213
|
-
}),
|
|
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
|
|
1219
|
-
|
|
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
|
|
1283
|
+
const ht = (e = {}) => {
|
|
1222
1284
|
const t = ee(e), n = /* @__PURE__ */ new Set();
|
|
1223
|
-
return
|
|
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,
|
|
1265
|
-
const
|
|
1266
|
-
if (!
|
|
1267
|
-
|
|
1268
|
-
|
|
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,
|
|
1271
|
-
const
|
|
1272
|
-
if (!
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
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,
|
|
1279
|
-
const
|
|
1280
|
-
if (!
|
|
1281
|
-
|
|
1282
|
-
|
|
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,
|
|
1285
|
-
const
|
|
1286
|
-
if (!
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
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,
|
|
1293
|
-
const
|
|
1294
|
-
if (!
|
|
1295
|
-
|
|
1296
|
-
|
|
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,
|
|
1299
|
-
const
|
|
1300
|
-
if (!
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
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,
|
|
1309
|
-
const
|
|
1310
|
-
if (!
|
|
1311
|
-
|
|
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,
|
|
1386
|
+
r(c, s);
|
|
1318
1387
|
} catch {
|
|
1319
1388
|
}
|
|
1320
|
-
return
|
|
1389
|
+
return i.__piiRedactionFindings = c, i.dispatchEvent(
|
|
1321
1390
|
new CustomEvent("editora:pii-findings", {
|
|
1322
1391
|
bubbles: !0,
|
|
1323
|
-
detail: { findings: c, stats:
|
|
1392
|
+
detail: { findings: c, stats: s }
|
|
1324
1393
|
})
|
|
1325
1394
|
), !0;
|
|
1326
1395
|
},
|
|
1327
|
-
setPIIRedactionOptions: (r,
|
|
1328
|
-
const
|
|
1329
|
-
if (!
|
|
1330
|
-
|
|
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(
|
|
1344
|
-
const c = m.get(
|
|
1345
|
-
return c && (
|
|
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(
|
|
1428
|
+
init: function(o) {
|
|
1359
1429
|
G += 1;
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1430
|
+
const i = this && typeof this.__pluginConfig == "object" ? ee({ ...ce(t), ...this.__pluginConfig }) : t;
|
|
1431
|
+
gt(i);
|
|
1362
1432
|
const a = T(
|
|
1363
|
-
|
|
1433
|
+
o != null && o.editorElement ? { editorElement: o.editorElement } : void 0,
|
|
1364
1434
|
!1
|
|
1365
1435
|
);
|
|
1366
|
-
a && (g = a, n.add(a), w(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) =>
|
|
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
|
-
}),
|
|
1441
|
+
}), j.clear(), mt());
|
|
1372
1442
|
}
|
|
1373
1443
|
};
|
|
1374
1444
|
};
|
|
1375
1445
|
export {
|
|
1376
|
-
|
|
1446
|
+
ht as PIIRedactionPlugin
|
|
1377
1447
|
};
|