@getpinax/widget 1.0.0-beta.1 → 1.0.0-beta.2
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 +270 -24
- package/dist/a11y/scan.d.ts +25 -0
- package/dist/api.d.ts +25 -4
- package/dist/capture/breadcrumbs.d.ts +1 -1
- package/dist/capture/network.d.ts +1 -1
- package/dist/capture/signature.d.ts +5 -0
- package/dist/capture/text.d.ts +17 -1
- package/dist/chunks/{editor-DbHLGwOA.mjs → editor-0Kr31Uly.mjs} +35 -35
- package/dist/chunks/{privacy-DmU6v5Fr.mjs → privacy-B_b1_Y1n.mjs} +2 -2
- package/dist/chunks/{recorder-BUtEB_em.mjs → recorder-tu4yugLw.mjs} +52 -37
- package/dist/chunks/scan-CFQwrtAQ.mjs +46137 -0
- package/dist/chunks/text-D9SaDBT0.mjs +36 -0
- package/dist/chunks/{widget-CkR1Ptzb.mjs → widget-BpTBdX2R.mjs} +530 -219
- package/dist/editor-loader.d.ts +3 -0
- package/dist/editor-loader.embed.d.ts +2 -1
- package/dist/fixcheck.d.ts +11 -0
- package/dist/index.d.ts +41 -2
- package/dist/known.d.ts +27 -0
- package/dist/pinax-axe.js +46167 -0
- package/dist/pinax-editor.js +252 -252
- package/dist/pinax-recorder.js +52 -39
- package/dist/pinax.js +28 -6
- package/dist/pinax.mjs +598 -369
- package/dist/preview.d.ts +14 -1
- package/dist/preview.mjs +36 -23
- package/dist/privacy.d.ts +4 -2
- package/dist/queue.d.ts +2 -1
- package/dist/replay/recorder.d.ts +10 -0
- package/dist/replay/sanitize.d.ts +9 -3
- package/dist/report.d.ts +21 -2
- package/dist/settings.d.ts +11 -2
- package/dist/types.d.ts +113 -3
- package/dist/ui/widget.d.ts +82 -2
- package/package.json +5 -4
- package/dist/chunks/text-8QYEyRYs.mjs +0 -18
package/dist/pinax-editor.js
CHANGED
|
@@ -111,14 +111,14 @@ function d(t, r, a, d = []) {
|
|
|
111
111
|
return n.addEventListener("click", () => {
|
|
112
112
|
y = e, L = !1, v || (b = "full"), U();
|
|
113
113
|
}), n;
|
|
114
|
-
}), N = k("Undo"), P = k("Clear"), F = k("Cancel"),
|
|
114
|
+
}), N = k("Undo"), P = k("Clear"), F = k("Cancel"), te = k("Done", "ed-t ed-done"), ne = e("p", {
|
|
115
115
|
class: "ed-hint",
|
|
116
116
|
id: "pnx-ed-hint"
|
|
117
|
-
}),
|
|
117
|
+
}), I = d.length ? e("p", {
|
|
118
118
|
class: "ed-auto",
|
|
119
119
|
id: "pnx-ed-auto"
|
|
120
120
|
}, e("i", { "aria-hidden": "true" }), `${d.length === 1 ? "1 private detail was" : `${d.length} private details were`} blurred automatically (outlined). They stay blurred.`) : null;
|
|
121
|
-
D.setAttribute("aria-describedby",
|
|
121
|
+
D.setAttribute("aria-describedby", I ? "pnx-ed-hint pnx-ed-auto" : "pnx-ed-hint");
|
|
122
122
|
let L = !1;
|
|
123
123
|
A.addEventListener("click", () => {
|
|
124
124
|
v = null, b = "full", L = !1, E("Whole screen selected."), U();
|
|
@@ -147,12 +147,12 @@ function d(t, r, a, d = []) {
|
|
|
147
147
|
}, ...M), e("span", {
|
|
148
148
|
class: "ed-sep",
|
|
149
149
|
"aria-hidden": "true"
|
|
150
|
-
}), e("div", { class: "ed-grp" }, N, P), e("span", { class: "ed-sp" }), e("div", { class: "ed-grp" }, F,
|
|
150
|
+
}), e("div", { class: "ed-grp" }, N, P), e("span", { class: "ed-sp" }), e("div", { class: "ed-grp" }, F, te)), R = e("div", { class: "ed-stage" }, D), z = e("div", {
|
|
151
151
|
class: "ed",
|
|
152
152
|
role: "dialog",
|
|
153
153
|
"aria-modal": "true",
|
|
154
154
|
"aria-label": "Mark up screenshot"
|
|
155
|
-
}, re, R,
|
|
155
|
+
}, re, R, ne, I, T), B = (e) => o(O, e.text ?? "", i(h, g));
|
|
156
156
|
function V() {
|
|
157
157
|
O.clearRect(0, 0, h, g), O.drawImage(r, 0, 0);
|
|
158
158
|
for (let e of _) s(O, e, r, h, g);
|
|
@@ -177,7 +177,7 @@ function d(t, r, a, d = []) {
|
|
|
177
177
|
for (let e of M) e.setAttribute("aria-pressed", String(!L && e.dataset.tool === y));
|
|
178
178
|
N.disabled = _.length === 0, P.disabled = _.length === 0;
|
|
179
179
|
let e = _.length;
|
|
180
|
-
D.setAttribute("aria-label", `Screenshot of the page${e ? `, ${e} ${e === 1 ? "mark" : "marks"}` : ""}${d.length ? `, ${d.length} blurred automatically` : ""}${v ? ", area selected" : ""}`),
|
|
180
|
+
D.setAttribute("aria-label", `Screenshot of the page${e ? `, ${e} ${e === 1 ? "mark" : "marks"}` : ""}${d.length ? `, ${d.length} blurred automatically` : ""}${v ? ", area selected" : ""}`), ne.textContent = L ? "Drag over the part you want to send." : y === "text" ? "Tap where the label should go, then type." : `Drag to draw a ${y === "blur" ? "blurred area" : y}, or tap to place one.`, V();
|
|
181
181
|
}
|
|
182
182
|
function W(e) {
|
|
183
183
|
let t = D.getBoundingClientRect();
|
|
@@ -186,7 +186,7 @@ function d(t, r, a, d = []) {
|
|
|
186
186
|
y: (e.clientY - t.top) / t.height * g
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
function
|
|
189
|
+
function ie(e, t, n) {
|
|
190
190
|
let r = h * .16, i = g * .12;
|
|
191
191
|
if (e === "arrow") {
|
|
192
192
|
let e = h * .08, r = g * .08, i = t - e < 0 ? 1 : -1, a = n - r < 0 ? 1 : -1;
|
|
@@ -200,17 +200,17 @@ function d(t, r, a, d = []) {
|
|
|
200
200
|
}
|
|
201
201
|
return {
|
|
202
202
|
type: e,
|
|
203
|
-
x:
|
|
204
|
-
y:
|
|
203
|
+
x: ae(t - r / 2, r),
|
|
204
|
+
y: oe(n - i / 2, i),
|
|
205
205
|
w: r,
|
|
206
206
|
h: i
|
|
207
207
|
};
|
|
208
208
|
}
|
|
209
|
-
let
|
|
210
|
-
function
|
|
209
|
+
let ae = (e, t) => Math.min(Math.max(0, e), h - t), oe = (e, t) => Math.min(Math.max(0, e), g - t);
|
|
210
|
+
function G(e) {
|
|
211
211
|
_.push(n(e)), E(`${e.type === "blur" ? "Blurred area" : e.type[0].toUpperCase() + e.type.slice(1)} added.`), U();
|
|
212
212
|
}
|
|
213
|
-
function
|
|
213
|
+
function K(t, n) {
|
|
214
214
|
C?.remove();
|
|
215
215
|
let r = e("input", {
|
|
216
216
|
class: "ed-txt",
|
|
@@ -227,10 +227,10 @@ function d(t, r, a, d = []) {
|
|
|
227
227
|
let a = r.value.trim();
|
|
228
228
|
if (r.remove(), C = null, e && a) {
|
|
229
229
|
let e = i(h, g), r = o(O, a, e);
|
|
230
|
-
|
|
230
|
+
G({
|
|
231
231
|
type: "text",
|
|
232
|
-
x:
|
|
233
|
-
y:
|
|
232
|
+
x: ae(t, r.w),
|
|
233
|
+
y: oe(n, r.h),
|
|
234
234
|
w: r.w,
|
|
235
235
|
h: r.h,
|
|
236
236
|
text: a
|
|
@@ -242,34 +242,34 @@ function d(t, r, a, d = []) {
|
|
|
242
242
|
e.stopPropagation(), e.key === "Enter" && d(!0), e.key === "Escape" && d(!1);
|
|
243
243
|
}), r.addEventListener("blur", () => d(!0)), R.append(r), C = r, r.focus();
|
|
244
244
|
}
|
|
245
|
-
let
|
|
245
|
+
let q = null;
|
|
246
246
|
D.addEventListener("pointerdown", (e) => {
|
|
247
|
-
|
|
247
|
+
q || e.pointerType === "mouse" && e.button !== 0 || (e.preventDefault(), D.setPointerCapture?.(e.pointerId), q = {
|
|
248
248
|
...W(e),
|
|
249
249
|
cx: e.clientX,
|
|
250
250
|
cy: e.clientY,
|
|
251
251
|
id: e.pointerId
|
|
252
252
|
});
|
|
253
253
|
}), D.addEventListener("pointermove", (e) => {
|
|
254
|
-
if (!
|
|
254
|
+
if (!q || e.pointerId !== q.id) return;
|
|
255
255
|
let t = W(e);
|
|
256
256
|
L ? S = {
|
|
257
|
-
x:
|
|
258
|
-
y:
|
|
259
|
-
w: t.x -
|
|
260
|
-
h: t.y -
|
|
257
|
+
x: q.x,
|
|
258
|
+
y: q.y,
|
|
259
|
+
w: t.x - q.x,
|
|
260
|
+
h: t.y - q.y
|
|
261
261
|
} : y !== "text" && (x = {
|
|
262
262
|
type: y,
|
|
263
|
-
x:
|
|
264
|
-
y:
|
|
265
|
-
w: t.x -
|
|
266
|
-
h: t.y -
|
|
263
|
+
x: q.x,
|
|
264
|
+
y: q.y,
|
|
265
|
+
w: t.x - q.x,
|
|
266
|
+
h: t.y - q.y
|
|
267
267
|
}), V();
|
|
268
268
|
});
|
|
269
|
-
let
|
|
270
|
-
if (!
|
|
271
|
-
let n =
|
|
272
|
-
|
|
269
|
+
let J = (e, t = !1) => {
|
|
270
|
+
if (!q || e.pointerId !== q.id) return;
|
|
271
|
+
let n = q;
|
|
272
|
+
q = null;
|
|
273
273
|
let r = Math.hypot(e.clientX - n.cx, e.clientY - n.cy) > u, i = W(e);
|
|
274
274
|
if (x = null, t) S = null, V();
|
|
275
275
|
else if (L) {
|
|
@@ -281,30 +281,30 @@ function d(t, r, a, d = []) {
|
|
|
281
281
|
h: i.y - n.y
|
|
282
282
|
}), h, g);
|
|
283
283
|
r && e.w > 8 && e.h > 8 && (v = e, L = !1, E("Area selected.")), U();
|
|
284
|
-
} else y === "text" ?
|
|
284
|
+
} else y === "text" ? K(n.x, n.y) : G(r ? {
|
|
285
285
|
type: y,
|
|
286
286
|
x: n.x,
|
|
287
287
|
y: n.y,
|
|
288
288
|
w: i.x - n.x,
|
|
289
289
|
h: i.y - n.y
|
|
290
|
-
} :
|
|
290
|
+
} : ie(y, n.x, n.y));
|
|
291
291
|
};
|
|
292
|
-
D.addEventListener("pointerup", (e) =>
|
|
292
|
+
D.addEventListener("pointerup", (e) => J(e)), D.addEventListener("pointercancel", (e) => J(e, !0)), D.addEventListener("keydown", (e) => {
|
|
293
293
|
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), L ? (v = {
|
|
294
294
|
x: h * .2,
|
|
295
295
|
y: g * .2,
|
|
296
296
|
w: h * .6,
|
|
297
297
|
h: g * .6
|
|
298
|
-
}, L = !1, E("Middle of the screenshot selected."), U()) : y === "text" ?
|
|
298
|
+
}, L = !1, E("Middle of the screenshot selected."), U()) : y === "text" ? K(h * .4, g * .45) : G(ie(y, h / 2, g / 2)));
|
|
299
299
|
});
|
|
300
|
-
function
|
|
301
|
-
z.removeEventListener("keydown",
|
|
300
|
+
function Y(e) {
|
|
301
|
+
z.removeEventListener("keydown", ce, !0), z.remove(), w.remove();
|
|
302
302
|
try {
|
|
303
303
|
ee?.focus();
|
|
304
304
|
} catch {}
|
|
305
305
|
m(e);
|
|
306
306
|
}
|
|
307
|
-
function
|
|
307
|
+
function se() {
|
|
308
308
|
let e = v ?? {
|
|
309
309
|
x: 0,
|
|
310
310
|
y: 0,
|
|
@@ -317,7 +317,7 @@ function d(t, r, a, d = []) {
|
|
|
317
317
|
let a = i.getContext("2d");
|
|
318
318
|
a.drawImage(r, 0, 0);
|
|
319
319
|
for (let e of _) s(a, e, r, h, g);
|
|
320
|
-
n.drawImage(i, e.x, e.y, e.w, e.h, 0, 0, t.width, t.height), i.width = 0, i.height = 0,
|
|
320
|
+
n.drawImage(i, e.x, e.y, e.w, e.h, 0, 0, t.width, t.height), i.width = 0, i.height = 0, Y({
|
|
321
321
|
canvas: t,
|
|
322
322
|
annotations: c(_, e, B),
|
|
323
323
|
state: {
|
|
@@ -326,9 +326,9 @@ function d(t, r, a, d = []) {
|
|
|
326
326
|
}
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
-
F.addEventListener("click", () =>
|
|
330
|
-
function
|
|
331
|
-
if (e.key === "Escape") e.preventDefault(), e.stopPropagation(),
|
|
329
|
+
F.addEventListener("click", () => Y(null)), te.addEventListener("click", se);
|
|
330
|
+
function ce(e) {
|
|
331
|
+
if (e.key === "Escape") e.preventDefault(), e.stopPropagation(), Y(null);
|
|
332
332
|
else if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "z") e.preventDefault(), _.pop() && E("Last mark removed."), U();
|
|
333
333
|
else if (e.key === "Tab") {
|
|
334
334
|
let n = [...z.querySelectorAll("button:not(:disabled), canvas, input")];
|
|
@@ -337,7 +337,7 @@ function d(t, r, a, d = []) {
|
|
|
337
337
|
e.shiftKey && a === r ? (e.preventDefault(), i.focus()) : !e.shiftKey && a === i && (e.preventDefault(), r.focus());
|
|
338
338
|
}
|
|
339
339
|
}
|
|
340
|
-
z.addEventListener("keydown",
|
|
340
|
+
z.addEventListener("keydown", ce, !0), t.append(w, z), U(), M[0].focus();
|
|
341
341
|
});
|
|
342
342
|
}
|
|
343
343
|
function f(e) {
|
|
@@ -359,7 +359,7 @@ function p(e, t, n) {
|
|
|
359
359
|
}
|
|
360
360
|
var m = "[modern-screenshot]", h = typeof window < "u", g = h && "Worker" in window;
|
|
361
361
|
h && "atob" in window, h && "btoa" in window;
|
|
362
|
-
var _ = h ? window.navigator?.userAgent : "", v = _.includes("Chrome"), y = _.includes("AppleWebKit") && !v, b = _.includes("Firefox"), x = (e) => e && "__CONTEXT__" in e, S = (e) => e.constructor.name === "CSSFontFaceRule", C = (e) => e.constructor.name === "CSSImportRule", ee = (e) => e.constructor.name === "CSSLayerBlockRule", w = (e) => e.nodeType === 1, T = (e) => typeof e.className == "object", E = (e) => e.tagName === "image", D = (e) => e.tagName === "use", O = (e) => w(e) && e.style !== void 0 && !T(e), k = (e) => e.nodeType === 8, A = (e) => e.nodeType === 3, j = (e) => e.tagName === "IMG", M = (e) => e.tagName === "VIDEO", N = (e) => e.tagName === "CANVAS", P = (e) => e.tagName === "TEXTAREA", F = (e) => e.tagName === "INPUT",
|
|
362
|
+
var _ = h ? window.navigator?.userAgent : "", v = _.includes("Chrome"), y = _.includes("AppleWebKit") && !v, b = _.includes("Firefox"), x = (e) => e && "__CONTEXT__" in e, S = (e) => e.constructor.name === "CSSFontFaceRule", C = (e) => e.constructor.name === "CSSImportRule", ee = (e) => e.constructor.name === "CSSLayerBlockRule", w = (e) => e.nodeType === 1, T = (e) => typeof e.className == "object", E = (e) => e.tagName === "image", D = (e) => e.tagName === "use", O = (e) => w(e) && e.style !== void 0 && !T(e), k = (e) => e.nodeType === 8, A = (e) => e.nodeType === 3, j = (e) => e.tagName === "IMG", M = (e) => e.tagName === "VIDEO", N = (e) => e.tagName === "CANVAS", P = (e) => e.tagName === "TEXTAREA", F = (e) => e.tagName === "INPUT", te = (e) => e.tagName === "STYLE", ne = (e) => e.tagName === "SCRIPT", I = (e) => e.tagName === "SELECT", L = (e) => e.tagName === "SLOT", re = (e) => e.tagName === "IFRAME", R = (...e) => console.warn(m, ...e);
|
|
363
363
|
function z(e) {
|
|
364
364
|
let t = e?.createElement?.("canvas");
|
|
365
365
|
return t && (t.height = t.width = 1), !!t && "toDataURL" in t && !!t.toDataURL("image/webp").includes("image/webp");
|
|
@@ -380,30 +380,30 @@ function W(e, t, n) {
|
|
|
380
380
|
let r = H(n).createElementNS(U, "svg");
|
|
381
381
|
return r.setAttributeNS(null, "width", e.toString()), r.setAttributeNS(null, "height", t.toString()), r.setAttributeNS(null, "viewBox", `0 0 ${e} ${t}`), r;
|
|
382
382
|
}
|
|
383
|
-
function
|
|
383
|
+
function ie(e, t) {
|
|
384
384
|
let n = new XMLSerializer().serializeToString(e);
|
|
385
385
|
return t && (n = n.replace(/[\u0000-\u0008\v\f\u000E-\u001F\uD800-\uDFFF\uFFFE\uFFFF]/gu, "")), `data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`;
|
|
386
386
|
}
|
|
387
|
-
function
|
|
387
|
+
function ae(e, t) {
|
|
388
388
|
return new Promise((n, r) => {
|
|
389
389
|
let i = new FileReader();
|
|
390
390
|
i.onload = () => n(i.result), i.onerror = () => r(i.error), i.onabort = () => r(/* @__PURE__ */ Error(`Failed read blob to ${t}`)), t === "dataUrl" ? i.readAsDataURL(e) : t === "arrayBuffer" && i.readAsArrayBuffer(e);
|
|
391
391
|
});
|
|
392
392
|
}
|
|
393
|
-
var
|
|
394
|
-
function
|
|
393
|
+
var oe = (e) => ae(e, "dataUrl");
|
|
394
|
+
function G(e, t) {
|
|
395
395
|
let n = H(t).createElement("img");
|
|
396
396
|
return n.decoding = "sync", n.loading = "eager", n.src = e, n;
|
|
397
397
|
}
|
|
398
|
-
function
|
|
398
|
+
function K(e, t) {
|
|
399
399
|
return new Promise((n) => {
|
|
400
|
-
let { timeout: r, ownerDocument: i, onError: a, onWarn: o } = t ?? {}, s = typeof e == "string" ?
|
|
400
|
+
let { timeout: r, ownerDocument: i, onError: a, onWarn: o } = t ?? {}, s = typeof e == "string" ? G(e, H(i)) : e, c = null, l = null;
|
|
401
401
|
function u() {
|
|
402
402
|
n(s), c && clearTimeout(c), l?.();
|
|
403
403
|
}
|
|
404
404
|
if (r && (c = setTimeout(u, r)), M(s)) {
|
|
405
405
|
let e = s.currentSrc || s.src;
|
|
406
|
-
if (!e) return s.poster ?
|
|
406
|
+
if (!e) return s.poster ? K(s.poster, t).then(n) : u();
|
|
407
407
|
if (s.readyState >= 2) return u();
|
|
408
408
|
let r = u, i = (t) => {
|
|
409
409
|
o?.("Failed video load", e, t), a?.(t), u();
|
|
@@ -431,35 +431,35 @@ function q(e, t) {
|
|
|
431
431
|
}
|
|
432
432
|
});
|
|
433
433
|
}
|
|
434
|
-
async function
|
|
435
|
-
O(e) && (j(e) || M(e) ? await
|
|
434
|
+
async function q(e, t) {
|
|
435
|
+
O(e) && (j(e) || M(e) ? await K(e, t) : await Promise.all(["img", "video"].flatMap((n) => Array.from(e.querySelectorAll(n)).map((e) => K(e, t)))));
|
|
436
436
|
}
|
|
437
|
-
var
|
|
437
|
+
var J = /* @__PURE__ */ function() {
|
|
438
438
|
let e = 0, t = () => `0000${(Math.random() * 36 ** 4 | 0).toString(36)}`.slice(-4);
|
|
439
439
|
return () => (e += 1, `u${t()}${e}`);
|
|
440
440
|
}();
|
|
441
|
-
function
|
|
441
|
+
function Y(e) {
|
|
442
442
|
return e?.split(",").map((e) => e.trim().replace(/"|'/g, "").toLowerCase()).filter(Boolean);
|
|
443
443
|
}
|
|
444
|
-
var
|
|
445
|
-
function
|
|
446
|
-
let t = `${m}[#${
|
|
447
|
-
return
|
|
444
|
+
var se = 0;
|
|
445
|
+
function ce(e) {
|
|
446
|
+
let t = `${m}[#${se}]`;
|
|
447
|
+
return se++, {
|
|
448
448
|
time: (n) => e && console.time(`${t} ${n}`),
|
|
449
449
|
timeEnd: (n) => e && console.timeEnd(`${t} ${n}`),
|
|
450
450
|
warn: (...t) => e && R(...t)
|
|
451
451
|
};
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function le(e) {
|
|
454
454
|
return { cache: e ? "no-cache" : "force-cache" };
|
|
455
455
|
}
|
|
456
|
-
async function
|
|
457
|
-
return x(e) ? e :
|
|
456
|
+
async function ue(e, t) {
|
|
457
|
+
return x(e) ? e : de(e, {
|
|
458
458
|
...t,
|
|
459
459
|
autoDestruct: !0
|
|
460
460
|
});
|
|
461
461
|
}
|
|
462
|
-
async function
|
|
462
|
+
async function de(e, t) {
|
|
463
463
|
let { scale: n = 1, workerUrl: r, workerNumber: i = 1 } = t || {}, a = !!t?.debug, o = t?.features ?? !0, s = e.ownerDocument ?? (h ? window.document : void 0), c = e.ownerDocument?.defaultView ?? (h ? window : void 0), l = /* @__PURE__ */ new Map(), u = {
|
|
464
464
|
width: 0,
|
|
465
465
|
height: 0,
|
|
@@ -474,7 +474,7 @@ async function ue(e, t) {
|
|
|
474
474
|
progress: null,
|
|
475
475
|
debug: a,
|
|
476
476
|
fetch: {
|
|
477
|
-
requestInit:
|
|
477
|
+
requestInit: le(t?.fetch?.bypassingCache),
|
|
478
478
|
placeholderImage: "data:image/png;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",
|
|
479
479
|
bypassingCache: !1,
|
|
480
480
|
...t?.fetch
|
|
@@ -492,12 +492,12 @@ async function ue(e, t) {
|
|
|
492
492
|
autoDestruct: !1,
|
|
493
493
|
...t,
|
|
494
494
|
__CONTEXT__: !0,
|
|
495
|
-
log:
|
|
495
|
+
log: ce(a),
|
|
496
496
|
node: e,
|
|
497
497
|
ownerDocument: s,
|
|
498
498
|
ownerWindow: c,
|
|
499
499
|
dpi: n === 1 ? null : 96 * n,
|
|
500
|
-
svgStyleElement:
|
|
500
|
+
svgStyleElement: fe(s),
|
|
501
501
|
svgDefsElement: s?.createElementNS(U, "defs"),
|
|
502
502
|
svgStyles: /* @__PURE__ */ new Map(),
|
|
503
503
|
defaultComputedStyles: /* @__PURE__ */ new Map(),
|
|
@@ -530,19 +530,19 @@ async function ue(e, t) {
|
|
|
530
530
|
isEnable: (e) => e === "restoreScrollPosition" ? typeof o == "boolean" ? !1 : o[e] ?? !1 : typeof o == "boolean" ? o : o[e] ?? !0,
|
|
531
531
|
shadowRoots: []
|
|
532
532
|
};
|
|
533
|
-
u.log.time("wait until load"), await
|
|
533
|
+
u.log.time("wait until load"), await q(e, {
|
|
534
534
|
timeout: u.timeout,
|
|
535
535
|
onWarn: u.log.warn
|
|
536
536
|
}), u.log.timeEnd("wait until load");
|
|
537
|
-
let { width: d, height: f } =
|
|
537
|
+
let { width: d, height: f } = pe(e, u);
|
|
538
538
|
return u.width = d, u.height = f, u;
|
|
539
539
|
}
|
|
540
|
-
function
|
|
540
|
+
function fe(e) {
|
|
541
541
|
if (!e) return;
|
|
542
542
|
let t = e.createElement("style"), n = t.ownerDocument.createTextNode("\n.______background-clip--text {\n background-clip: text;\n -webkit-background-clip: text;\n}\n");
|
|
543
543
|
return t.appendChild(n), t;
|
|
544
544
|
}
|
|
545
|
-
function
|
|
545
|
+
function pe(e, t) {
|
|
546
546
|
let { width: n, height: r } = t;
|
|
547
547
|
if (w(e) && (!n || !r)) {
|
|
548
548
|
let t = e.getBoundingClientRect();
|
|
@@ -553,13 +553,13 @@ function fe(e, t) {
|
|
|
553
553
|
height: r
|
|
554
554
|
};
|
|
555
555
|
}
|
|
556
|
-
async function
|
|
556
|
+
async function me(e, t) {
|
|
557
557
|
let { log: n, timeout: r, drawImageCount: i, drawImageInterval: a } = t;
|
|
558
558
|
n.time("image to canvas");
|
|
559
|
-
let o = await
|
|
559
|
+
let o = await K(e, {
|
|
560
560
|
timeout: r,
|
|
561
561
|
onWarn: t.log.warn
|
|
562
|
-
}), { canvas: s, context2d: c } =
|
|
562
|
+
}), { canvas: s, context2d: c } = he(e.ownerDocument, t), l = () => {
|
|
563
563
|
try {
|
|
564
564
|
c?.drawImage(o, 0, 0, s.width, s.height);
|
|
565
565
|
} catch (e) {
|
|
@@ -573,7 +573,7 @@ async function pe(e, t) {
|
|
|
573
573
|
});
|
|
574
574
|
return t.drawImageCount = 0, n.timeEnd("image to canvas"), s;
|
|
575
575
|
}
|
|
576
|
-
function
|
|
576
|
+
function he(e, t) {
|
|
577
577
|
let { width: n, height: r, scale: i, backgroundColor: a, maximumCanvasSize: o } = t, s = e.createElement("canvas");
|
|
578
578
|
s.width = Math.floor(n * i), s.height = Math.floor(r * i), s.style.width = `${n}px`, s.style.height = `${r}px`, o && (s.width > o || s.height > o) && (s.width > o && s.height > o ? s.width > s.height ? (s.height *= o / s.width, s.width = o) : (s.width *= o / s.height, s.height = o) : s.width > o ? (s.height *= o / s.width, s.width = o) : (s.width *= o / s.height, s.height = o));
|
|
579
579
|
let c = s.getContext("2d");
|
|
@@ -582,10 +582,10 @@ function me(e, t) {
|
|
|
582
582
|
context2d: c
|
|
583
583
|
};
|
|
584
584
|
}
|
|
585
|
-
function
|
|
585
|
+
function ge(e, t) {
|
|
586
586
|
if (e.ownerDocument) try {
|
|
587
587
|
let t = e.toDataURL();
|
|
588
|
-
if (t !== "data:,") return
|
|
588
|
+
if (t !== "data:,") return G(t, e.ownerDocument);
|
|
589
589
|
} catch (e) {
|
|
590
590
|
t.log.warn("Failed to clone canvas", e);
|
|
591
591
|
}
|
|
@@ -597,29 +597,29 @@ function he(e, t) {
|
|
|
597
597
|
}
|
|
598
598
|
return n;
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function _e(e, t) {
|
|
601
601
|
try {
|
|
602
|
-
if (e?.contentDocument?.documentElement) return
|
|
602
|
+
if (e?.contentDocument?.documentElement) return Le(e.contentDocument.documentElement, t);
|
|
603
603
|
} catch (e) {
|
|
604
604
|
t.log.warn("Failed to clone iframe", e);
|
|
605
605
|
}
|
|
606
606
|
return e.cloneNode(!1);
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function ve(e) {
|
|
609
609
|
let t = e.cloneNode(!1);
|
|
610
610
|
return e.currentSrc && e.currentSrc !== e.src && (t.src = e.currentSrc, t.srcset = ""), t.loading === "lazy" && (t.loading = "eager"), t;
|
|
611
611
|
}
|
|
612
|
-
async function
|
|
613
|
-
if (e.ownerDocument && !e.currentSrc && e.poster) return
|
|
612
|
+
async function ye(e, t) {
|
|
613
|
+
if (e.ownerDocument && !e.currentSrc && e.poster) return G(e.poster, e.ownerDocument);
|
|
614
614
|
let n = e.cloneNode(!1);
|
|
615
615
|
n.crossOrigin = "anonymous", e.currentSrc && e.currentSrc !== e.src && (n.src = e.currentSrc);
|
|
616
616
|
let r = n.ownerDocument;
|
|
617
617
|
if (r) {
|
|
618
618
|
let i = !0;
|
|
619
|
-
if (await
|
|
619
|
+
if (await K(n, {
|
|
620
620
|
onError: () => i = !1,
|
|
621
621
|
onWarn: t.log.warn
|
|
622
|
-
}), !i) return e.poster ?
|
|
622
|
+
}), !i) return e.poster ? G(e.poster, e.ownerDocument) : n;
|
|
623
623
|
n.currentTime = e.currentTime, await new Promise((e) => {
|
|
624
624
|
n.addEventListener("seeked", e, { once: !0 });
|
|
625
625
|
});
|
|
@@ -629,41 +629,41 @@ async function ve(e, t) {
|
|
|
629
629
|
let e = a.getContext("2d");
|
|
630
630
|
e && e.drawImage(n, 0, 0, a.width, a.height);
|
|
631
631
|
} catch (r) {
|
|
632
|
-
return t.log.warn("Failed to clone video", r), e.poster ?
|
|
632
|
+
return t.log.warn("Failed to clone video", r), e.poster ? G(e.poster, e.ownerDocument) : n;
|
|
633
633
|
}
|
|
634
|
-
return
|
|
634
|
+
return ge(a, t);
|
|
635
635
|
}
|
|
636
636
|
return n;
|
|
637
637
|
}
|
|
638
|
-
function
|
|
639
|
-
return N(e) ?
|
|
638
|
+
function be(e, t) {
|
|
639
|
+
return N(e) ? ge(e, t) : re(e) ? _e(e, t) : j(e) ? ve(e) : M(e) ? ye(e, t) : e.cloneNode(!1);
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function xe(e) {
|
|
642
642
|
let t = e.sandbox;
|
|
643
643
|
if (!t) {
|
|
644
644
|
let { ownerDocument: n } = e;
|
|
645
645
|
try {
|
|
646
|
-
n && (t = n.createElement("iframe"), t.id = `__SANDBOX__${
|
|
646
|
+
n && (t = n.createElement("iframe"), t.id = `__SANDBOX__${J()}`, t.width = "0", t.height = "0", t.style.visibility = "hidden", t.style.position = "fixed", n.body.appendChild(t), t.srcdoc = "<!DOCTYPE html><meta charset=\"UTF-8\"><title></title><body>", e.sandbox = t);
|
|
647
647
|
} catch (t) {
|
|
648
648
|
e.log.warn("Failed to getSandBox", t);
|
|
649
649
|
}
|
|
650
650
|
}
|
|
651
651
|
return t;
|
|
652
652
|
}
|
|
653
|
-
var
|
|
653
|
+
var Se = [
|
|
654
654
|
"width",
|
|
655
655
|
"height",
|
|
656
656
|
"-webkit-text-fill-color"
|
|
657
|
-
],
|
|
658
|
-
function
|
|
659
|
-
let { defaultComputedStyles: r } = n, i = e.nodeName.toLowerCase(), a = T(e) && i !== "svg", o = a ?
|
|
657
|
+
], Ce = ["stroke", "fill"];
|
|
658
|
+
function we(e, t, n) {
|
|
659
|
+
let { defaultComputedStyles: r } = n, i = e.nodeName.toLowerCase(), a = T(e) && i !== "svg", o = a ? Ce.map((t) => [t, e.getAttribute(t)]).filter(([, e]) => e !== null) : [], s = [
|
|
660
660
|
a && "svg",
|
|
661
661
|
i,
|
|
662
662
|
o.map((e, t) => `${e}=${t}`).join(","),
|
|
663
663
|
t
|
|
664
664
|
].filter(Boolean).join(":");
|
|
665
665
|
if (r.has(s)) return r.get(s);
|
|
666
|
-
let c =
|
|
666
|
+
let c = xe(n)?.contentWindow;
|
|
667
667
|
if (!c) return /* @__PURE__ */ new Map();
|
|
668
668
|
let l = c?.document, u, d;
|
|
669
669
|
a ? (u = l.createElementNS(U, "svg"), d = u.ownerDocument.createElementNS(u.namespaceURI, i), o.forEach(([e, t]) => {
|
|
@@ -672,11 +672,11 @@ function Ce(e, t, n) {
|
|
|
672
672
|
let f = c.getComputedStyle(d, t), p = /* @__PURE__ */ new Map();
|
|
673
673
|
for (let e = f.length, t = 0; t < e; t++) {
|
|
674
674
|
let e = f.item(t);
|
|
675
|
-
|
|
675
|
+
Se.includes(e) || p.set(e, f.getPropertyValue(e));
|
|
676
676
|
}
|
|
677
677
|
return l.body.removeChild(u), r.set(s, p), p;
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function Te(e, t, n) {
|
|
680
680
|
let r = /* @__PURE__ */ new Map(), i = [], a = /* @__PURE__ */ new Map();
|
|
681
681
|
if (n) for (let e of n) o(e);
|
|
682
682
|
else for (let t = e.length, n = 0; n < t; n++) o(e.item(n));
|
|
@@ -691,22 +691,22 @@ function we(e, t, n) {
|
|
|
691
691
|
}
|
|
692
692
|
return r;
|
|
693
693
|
}
|
|
694
|
-
function
|
|
695
|
-
let { ownerWindow: i, includeStyleProperties: a, currentParentNodeStyle: o } = r, s = t.style, c = i.getComputedStyle(e), l =
|
|
694
|
+
function Ee(e, t, n, r) {
|
|
695
|
+
let { ownerWindow: i, includeStyleProperties: a, currentParentNodeStyle: o } = r, s = t.style, c = i.getComputedStyle(e), l = we(e, null, r);
|
|
696
696
|
o?.forEach((e, t) => {
|
|
697
697
|
l.delete(t);
|
|
698
698
|
});
|
|
699
|
-
let u =
|
|
699
|
+
let u = Te(c, l, a);
|
|
700
700
|
u.delete("transition-property"), u.delete("all"), u.delete("d"), u.delete("content"), n && (u.delete("position"), u.delete("margin-top"), u.delete("margin-right"), u.delete("margin-bottom"), u.delete("margin-left"), u.delete("margin-block-start"), u.delete("margin-block-end"), u.delete("margin-inline-start"), u.delete("margin-inline-end"), u.set("box-sizing", ["border-box", ""])), u.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text"), v && (u.has("font-kerning") || u.set("font-kerning", ["normal", ""]), (u.get("overflow-x")?.[0] === "hidden" || u.get("overflow-y")?.[0] === "hidden") && u.get("text-overflow")?.[0] === "ellipsis" && e.scrollWidth === e.clientWidth && u.set("text-overflow", ["clip", ""]));
|
|
701
701
|
for (let e = s.length, t = 0; t < e; t++) s.removeProperty(s.item(t));
|
|
702
702
|
return u.forEach(([e, t], n) => {
|
|
703
703
|
s.setProperty(n, e, t);
|
|
704
704
|
}), u;
|
|
705
705
|
}
|
|
706
|
-
function
|
|
707
|
-
(P(e) || F(e) ||
|
|
706
|
+
function De(e, t) {
|
|
707
|
+
(P(e) || F(e) || I(e)) && t.setAttribute("value", e.value);
|
|
708
708
|
}
|
|
709
|
-
var
|
|
709
|
+
var Oe = ["::before", "::after"], ke = [
|
|
710
710
|
"::-webkit-scrollbar",
|
|
711
711
|
"::-webkit-scrollbar-button",
|
|
712
712
|
"::-webkit-scrollbar-thumb",
|
|
@@ -715,18 +715,18 @@ var De = ["::before", "::after"], Oe = [
|
|
|
715
715
|
"::-webkit-scrollbar-corner",
|
|
716
716
|
"::-webkit-resizer"
|
|
717
717
|
];
|
|
718
|
-
function
|
|
718
|
+
function Ae(e, t, n, r, i) {
|
|
719
719
|
let { ownerWindow: a, svgStyleElement: o, svgStyles: s, currentNodeStyle: c } = r;
|
|
720
720
|
if (!o || !a) return;
|
|
721
721
|
function l(n) {
|
|
722
722
|
let o = a.getComputedStyle(e, n), l = o.getPropertyValue("content");
|
|
723
723
|
if (!l || l === "none") return;
|
|
724
724
|
i?.(l), l = l.replace(/(')|(")|(counter\(.+\))/g, "");
|
|
725
|
-
let u = [
|
|
725
|
+
let u = [J()], d = we(e, n, r);
|
|
726
726
|
c?.forEach((e, t) => {
|
|
727
727
|
d.delete(t);
|
|
728
728
|
});
|
|
729
|
-
let f =
|
|
729
|
+
let f = Te(o, d, r.includeStyleProperties);
|
|
730
730
|
f.delete("content"), f.delete("-webkit-locale"), f.get("background-clip")?.[0] === "text" && t.classList.add("______background-clip--text");
|
|
731
731
|
let p = [`content: '${l}';`];
|
|
732
732
|
if (f.forEach(([e, t], n) => {
|
|
@@ -741,68 +741,68 @@ function ke(e, t, n, r, i) {
|
|
|
741
741
|
let m = p.join("\n "), h = s.get(m);
|
|
742
742
|
h || (h = [], s.set(m, h)), h.push(`.${u[0]}${n}`);
|
|
743
743
|
}
|
|
744
|
-
|
|
744
|
+
Oe.forEach(l), n && ke.forEach(l);
|
|
745
745
|
}
|
|
746
|
-
var
|
|
747
|
-
async function
|
|
748
|
-
if (w(n) && (
|
|
749
|
-
r.currentParentNodeStyle =
|
|
750
|
-
let a = await
|
|
751
|
-
r.isEnable("restoreScrollPosition") &&
|
|
746
|
+
var je = /* @__PURE__ */ new Set(["symbol"]);
|
|
747
|
+
async function Me(e, t, n, r, i) {
|
|
748
|
+
if (w(n) && (te(n) || ne(n)) || r.filter && !r.filter(n)) return;
|
|
749
|
+
r.currentParentNodeStyle = je.has(t.nodeName) || je.has(n.nodeName) ? void 0 : r.currentNodeStyle;
|
|
750
|
+
let a = await Le(n, r, !1, i);
|
|
751
|
+
r.isEnable("restoreScrollPosition") && Pe(e, a), t.appendChild(a);
|
|
752
752
|
}
|
|
753
|
-
async function
|
|
753
|
+
async function Ne(e, t, n, r) {
|
|
754
754
|
let i = e.firstChild;
|
|
755
755
|
w(e) && e.shadowRoot && (i = e.shadowRoot?.firstChild, n.shadowRoots.push(e.shadowRoot));
|
|
756
756
|
for (let a = i; a; a = a.nextSibling) if (!k(a)) {
|
|
757
757
|
if (w(a) && L(a) && typeof a.assignedNodes == "function") {
|
|
758
758
|
let i = a.assignedNodes();
|
|
759
|
-
for (let a = 0; a < i.length; a++) await
|
|
760
|
-
} else await
|
|
759
|
+
for (let a = 0; a < i.length; a++) await Me(e, t, i[a], n, r);
|
|
760
|
+
} else await Me(e, t, a, n, r);
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
|
-
function
|
|
763
|
+
function Pe(e, t) {
|
|
764
764
|
if (!O(e) || !O(t)) return;
|
|
765
765
|
let { scrollTop: n, scrollLeft: r } = e;
|
|
766
766
|
if (!n && !r) return;
|
|
767
767
|
let { transform: i } = t.style, a = new DOMMatrix(i), { a: o, b: s, c, d: l } = a;
|
|
768
768
|
a.a = 1, a.b = 0, a.c = 0, a.d = 1, a.translateSelf(-r, -n), a.a = o, a.b = s, a.c = c, a.d = l, t.style.transform = a.toString();
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function Fe(e, t) {
|
|
771
771
|
let { backgroundColor: n, width: r, height: i, style: a } = t, o = e.style;
|
|
772
772
|
if (n && o.setProperty("background-color", n, "important"), r && o.setProperty("width", `${r}px`, "important"), i && o.setProperty("height", `${i}px`, "important"), a) for (let e in a) o[e] = a[e];
|
|
773
773
|
}
|
|
774
|
-
var
|
|
775
|
-
async function
|
|
774
|
+
var Ie = /^[\w-:]+$/;
|
|
775
|
+
async function Le(e, t, n = !1, r) {
|
|
776
776
|
let { ownerDocument: i, ownerWindow: a, fontFamilies: o, onCloneEachNode: s } = t;
|
|
777
777
|
if (i && A(e)) return r && /\S/.test(e.data) && r(e.data), i.createTextNode(e.data);
|
|
778
778
|
if (i && a && w(e) && (O(e) || T(e))) {
|
|
779
|
-
let r = await
|
|
779
|
+
let r = await be(e, t);
|
|
780
780
|
if (t.isEnable("removeAbnormalAttributes")) {
|
|
781
781
|
let e = r.getAttributeNames();
|
|
782
782
|
for (let t = e.length, n = 0; n < t; n++) {
|
|
783
783
|
let t = e[n];
|
|
784
|
-
|
|
784
|
+
Ie.test(t) || r.removeAttribute(t);
|
|
785
785
|
}
|
|
786
786
|
}
|
|
787
|
-
let i = t.currentNodeStyle =
|
|
788
|
-
n &&
|
|
787
|
+
let i = t.currentNodeStyle = Ee(e, r, n, t);
|
|
788
|
+
n && Fe(r, t);
|
|
789
789
|
let a = !1;
|
|
790
790
|
if (t.isEnable("copyScrollbar")) {
|
|
791
791
|
let t = [i.get("overflow-x")?.[0], i.get("overflow-y")?.[0]];
|
|
792
792
|
a = t.includes("scroll") || (t.includes("auto") || t.includes("overlay")) && (e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth);
|
|
793
793
|
}
|
|
794
|
-
let c = i.get("text-transform")?.[0], l =
|
|
794
|
+
let c = i.get("text-transform")?.[0], l = Y(i.get("font-family")?.[0]), u = l ? (e) => {
|
|
795
795
|
c === "uppercase" ? e = e.toUpperCase() : c === "lowercase" ? e = e.toLowerCase() : c === "capitalize" && (e = e[0].toUpperCase() + e.substring(1)), l.forEach((t) => {
|
|
796
796
|
let n = o.get(t);
|
|
797
797
|
n || o.set(t, n = /* @__PURE__ */ new Set()), e.split("").forEach((e) => n.add(e));
|
|
798
798
|
});
|
|
799
799
|
} : void 0;
|
|
800
|
-
return
|
|
800
|
+
return Ae(e, r, a, t, u), De(e, r), M(e) || await Ne(e, r, t, u), await s?.(r), r;
|
|
801
801
|
}
|
|
802
802
|
let c = e.cloneNode(!1);
|
|
803
|
-
return await
|
|
803
|
+
return await Ne(e, c, t), await s?.(c), c;
|
|
804
804
|
}
|
|
805
|
-
function
|
|
805
|
+
function Re(e) {
|
|
806
806
|
if (e.ownerDocument = void 0, e.ownerWindow = void 0, e.svgStyleElement = void 0, e.svgDefsElement = void 0, e.svgStyles.clear(), e.defaultComputedStyles.clear(), e.sandbox) {
|
|
807
807
|
try {
|
|
808
808
|
e.sandbox.remove();
|
|
@@ -813,7 +813,7 @@ function Le(e) {
|
|
|
813
813
|
}
|
|
814
814
|
e.workers = [], e.fontFamilies.clear(), e.fontCssTexts.clear(), e.requests.clear(), e.tasks = [], e.shadowRoots = [];
|
|
815
815
|
}
|
|
816
|
-
function
|
|
816
|
+
function ze(e) {
|
|
817
817
|
let { url: t, timeout: n, responseType: r, ...i } = e, a = new AbortController(), o = n ? setTimeout(() => a.abort(), n) : void 0;
|
|
818
818
|
return fetch(t, {
|
|
819
819
|
signal: a.signal,
|
|
@@ -822,12 +822,12 @@ function Re(e) {
|
|
|
822
822
|
if (!e.ok) throw Error("Failed fetch, not 2xx response", { cause: e });
|
|
823
823
|
switch (r) {
|
|
824
824
|
case "arrayBuffer": return e.arrayBuffer();
|
|
825
|
-
case "dataUrl": return e.blob().then(
|
|
825
|
+
case "dataUrl": return e.blob().then(oe);
|
|
826
826
|
default: return e.text();
|
|
827
827
|
}
|
|
828
828
|
}).finally(() => clearTimeout(o));
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function X(e, t) {
|
|
831
831
|
let { url: n, requestType: r = "text", responseType: i = "text", imageDom: a } = t, o = n, { timeout: s, acceptOfImage: c, requests: l, fetchFn: u, fetch: { requestInit: d, bypassingCache: f, placeholderImage: p }, font: m, workers: h, fontFamilies: g } = e;
|
|
832
832
|
r === "image" && (y || b) && e.drawImageCount++;
|
|
833
833
|
let _ = l.get(n);
|
|
@@ -859,7 +859,7 @@ function Z(e, t) {
|
|
|
859
859
|
rawUrl: n,
|
|
860
860
|
...x
|
|
861
861
|
}), _.resolve = e, _.reject = t;
|
|
862
|
-
}) :
|
|
862
|
+
}) : ze(x);
|
|
863
863
|
})().catch((t) => {
|
|
864
864
|
if (l.delete(n), r === "image" && p) return e.log.warn("Failed to fetch image base64, trying to use placeholder image", o), typeof p == "string" ? p : p(a);
|
|
865
865
|
throw t;
|
|
@@ -867,51 +867,51 @@ function Z(e, t) {
|
|
|
867
867
|
}
|
|
868
868
|
return _.response;
|
|
869
869
|
}
|
|
870
|
-
async function
|
|
871
|
-
if (!
|
|
872
|
-
for (let [i, a] of
|
|
873
|
-
let t = await
|
|
870
|
+
async function Be(e, t, n, r) {
|
|
871
|
+
if (!Ve(e)) return e;
|
|
872
|
+
for (let [i, a] of Ue(e, t)) try {
|
|
873
|
+
let t = await X(n, {
|
|
874
874
|
url: a,
|
|
875
875
|
requestType: r ? "image" : "text",
|
|
876
876
|
responseType: "dataUrl"
|
|
877
877
|
});
|
|
878
|
-
e = e.replace(
|
|
878
|
+
e = e.replace(We(i), `$1${t}$3`);
|
|
879
879
|
} catch (e) {
|
|
880
880
|
n.log.warn("Failed to fetch css data url", i, e);
|
|
881
881
|
}
|
|
882
882
|
return e;
|
|
883
883
|
}
|
|
884
|
-
function
|
|
884
|
+
function Ve(e) {
|
|
885
885
|
return /url\((['"]?)([^'"]+?)\1\)/.test(e);
|
|
886
886
|
}
|
|
887
|
-
var
|
|
888
|
-
function
|
|
887
|
+
var He = /url\((['"]?)([^'"]+?)\1\)/g;
|
|
888
|
+
function Ue(e, t) {
|
|
889
889
|
let n = [];
|
|
890
|
-
return e.replace(
|
|
890
|
+
return e.replace(He, (e, r, i) => (n.push([i, V(i, t)]), e)), n.filter(([e]) => !B(e));
|
|
891
891
|
}
|
|
892
|
-
function
|
|
892
|
+
function We(e) {
|
|
893
893
|
let t = e.replace(/([.*+?^${}()|\[\]\/\\])/g, "\\$1");
|
|
894
894
|
return RegExp(`(url\\(['"]?)(${t})(['"]?\\))`, "g");
|
|
895
895
|
}
|
|
896
|
-
var
|
|
896
|
+
var Ge = [
|
|
897
897
|
"background-image",
|
|
898
898
|
"border-image-source",
|
|
899
899
|
"-webkit-border-image",
|
|
900
900
|
"-webkit-mask-image",
|
|
901
901
|
"list-style-image"
|
|
902
902
|
];
|
|
903
|
-
function
|
|
904
|
-
return
|
|
903
|
+
function Ke(e, t) {
|
|
904
|
+
return Ge.map((n) => {
|
|
905
905
|
let r = e.getPropertyValue(n);
|
|
906
|
-
return !r || r === "none" ? null : ((y || b) && t.drawImageCount++,
|
|
906
|
+
return !r || r === "none" ? null : ((y || b) && t.drawImageCount++, Be(r, null, t, !0).then((t) => {
|
|
907
907
|
t && r !== t && e.setProperty(n, t, e.getPropertyPriority(n));
|
|
908
908
|
}));
|
|
909
909
|
}).filter(Boolean);
|
|
910
910
|
}
|
|
911
|
-
function
|
|
911
|
+
function qe(e, t) {
|
|
912
912
|
if (j(e)) {
|
|
913
913
|
let n = e.currentSrc || e.src;
|
|
914
|
-
if (!B(n)) return [
|
|
914
|
+
if (!B(n)) return [X(t, {
|
|
915
915
|
url: n,
|
|
916
916
|
imageDom: e,
|
|
917
917
|
requestType: "image",
|
|
@@ -922,7 +922,7 @@ function Ke(e, t) {
|
|
|
922
922
|
(y || b) && t.drawImageCount++;
|
|
923
923
|
} else if (T(e) && !B(e.href.baseVal)) {
|
|
924
924
|
let n = e.href.baseVal;
|
|
925
|
-
return [
|
|
925
|
+
return [X(t, {
|
|
926
926
|
url: n,
|
|
927
927
|
imageDom: e,
|
|
928
928
|
requestType: "image",
|
|
@@ -933,7 +933,7 @@ function Ke(e, t) {
|
|
|
933
933
|
}
|
|
934
934
|
return [];
|
|
935
935
|
}
|
|
936
|
-
function
|
|
936
|
+
function Je(e, t) {
|
|
937
937
|
let { ownerDocument: n, svgDefsElement: r } = t, i = e.getAttribute("href") ?? e.getAttribute("xlink:href");
|
|
938
938
|
if (!i) return [];
|
|
939
939
|
let [a, o] = i.split("#");
|
|
@@ -941,7 +941,7 @@ function qe(e, t) {
|
|
|
941
941
|
let i = `#${o}`, s = t.shadowRoots.reduce((e, t) => e ?? t.querySelector(`svg ${i}`), n?.querySelector(`svg ${i}`));
|
|
942
942
|
if (a && e.setAttribute("href", i), r?.querySelector(i)) return [];
|
|
943
943
|
if (s) return r?.appendChild(s.cloneNode(!0)), [];
|
|
944
|
-
if (a) return [
|
|
944
|
+
if (a) return [X(t, {
|
|
945
945
|
url: a,
|
|
946
946
|
responseType: "text"
|
|
947
947
|
}).then((e) => {
|
|
@@ -950,17 +950,17 @@ function qe(e, t) {
|
|
|
950
950
|
}
|
|
951
951
|
return [];
|
|
952
952
|
}
|
|
953
|
-
function
|
|
953
|
+
function Ye(e, t) {
|
|
954
954
|
let { tasks: n } = t;
|
|
955
|
-
w(e) && ((j(e) || E(e)) && n.push(...
|
|
956
|
-
|
|
955
|
+
w(e) && ((j(e) || E(e)) && n.push(...qe(e, t)), D(e) && n.push(...Je(e, t))), O(e) && n.push(...Ke(e.style, t)), e.childNodes.forEach((e) => {
|
|
956
|
+
Ye(e, t);
|
|
957
957
|
});
|
|
958
958
|
}
|
|
959
|
-
async function
|
|
959
|
+
async function Xe(e, t) {
|
|
960
960
|
let { ownerDocument: n, svgStyleElement: r, fontFamilies: i, fontCssTexts: a, tasks: o, font: s } = t;
|
|
961
961
|
if (n && r && i.size) {
|
|
962
962
|
if (s && s.cssText) {
|
|
963
|
-
let e =
|
|
963
|
+
let e = nt(s.cssText, t);
|
|
964
964
|
r.appendChild(n.createTextNode(`${e}
|
|
965
965
|
`));
|
|
966
966
|
} else {
|
|
@@ -977,7 +977,7 @@ async function Ye(e, t) {
|
|
|
977
977
|
if (C(e)) {
|
|
978
978
|
let n = e.href, r = "";
|
|
979
979
|
try {
|
|
980
|
-
r = await
|
|
980
|
+
r = await X(t, {
|
|
981
981
|
url: n,
|
|
982
982
|
requestType: "text",
|
|
983
983
|
responseType: "text"
|
|
@@ -985,8 +985,8 @@ async function Ye(e, t) {
|
|
|
985
985
|
} catch (e) {
|
|
986
986
|
t.log.warn(`Error fetch remote css import from ${n}`, e);
|
|
987
987
|
}
|
|
988
|
-
let i = r.replace(
|
|
989
|
-
for (let e of
|
|
988
|
+
let i = r.replace(He, (e, t, r) => e.replace(r, V(r, n)));
|
|
989
|
+
for (let e of $e(i)) try {
|
|
990
990
|
l.insertRule(e, l.cssRules.length);
|
|
991
991
|
} catch (n) {
|
|
992
992
|
t.log.warn("Error inserting rule from remote css import", {
|
|
@@ -998,28 +998,28 @@ async function Ye(e, t) {
|
|
|
998
998
|
}))), l.cssRules.length && e.push(l);
|
|
999
999
|
let u = [];
|
|
1000
1000
|
e.forEach((e) => {
|
|
1001
|
-
|
|
1002
|
-
}), u.filter((e) => S(e) &&
|
|
1001
|
+
rt(e.cssRules, u);
|
|
1002
|
+
}), u.filter((e) => S(e) && Ve(e.style.getPropertyValue("src")) && Y(e.style.getPropertyValue("font-family"))?.some((e) => i.has(e))).forEach((e) => {
|
|
1003
1003
|
let i = e, s = a.get(i.cssText);
|
|
1004
1004
|
s ? r.appendChild(n.createTextNode(`${s}
|
|
1005
|
-
`)) : o.push(
|
|
1006
|
-
e =
|
|
1005
|
+
`)) : o.push(Be(i.cssText, i.parentStyleSheet ? i.parentStyleSheet.href : null, t).then((e) => {
|
|
1006
|
+
e = nt(e, t), a.set(i.cssText, e), r.appendChild(n.createTextNode(`${e}
|
|
1007
1007
|
`));
|
|
1008
1008
|
}));
|
|
1009
1009
|
});
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
1012
1012
|
}
|
|
1013
|
-
var
|
|
1014
|
-
function
|
|
1013
|
+
var Ze = /(\/\*[\s\S]*?\*\/)/g, Qe = /((@.*?keyframes [\s\S]*?){([\s\S]*?}\s*?)})/gi;
|
|
1014
|
+
function $e(e) {
|
|
1015
1015
|
if (e == null) return [];
|
|
1016
|
-
let t = [], n = e.replace(
|
|
1016
|
+
let t = [], n = e.replace(Ze, "");
|
|
1017
1017
|
for (;;) {
|
|
1018
|
-
let e =
|
|
1018
|
+
let e = Qe.exec(n);
|
|
1019
1019
|
if (!e) break;
|
|
1020
1020
|
t.push(e[0]);
|
|
1021
1021
|
}
|
|
1022
|
-
n = n.replace(
|
|
1022
|
+
n = n.replace(Qe, "");
|
|
1023
1023
|
let r = /@import[\s\S]*?url\([^)]*\)[\s\S]*?;/gi, i = /* @__PURE__ */ RegExp("((\\s*?(?:\\/\\*[\\s\\S]*?\\*\\/)?\\s*?@media[\\s\\S]*?){([\\s\\S]*?)}\\s*?})|(([\\s\\S]*?){([\\s\\S]*?)})", "gi");
|
|
1024
1024
|
for (;;) {
|
|
1025
1025
|
let e = r.exec(n);
|
|
@@ -1030,31 +1030,31 @@ function Qe(e) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
return t;
|
|
1032
1032
|
}
|
|
1033
|
-
var
|
|
1034
|
-
function
|
|
1033
|
+
var et = /url\([^)]+\)\s*format\((["']?)([^"']+)\1\)/g, tt = /src:\s*(?:url\([^)]+\)\s*format\([^)]+\)[,;]\s*)+/g;
|
|
1034
|
+
function nt(e, t) {
|
|
1035
1035
|
let { font: n } = t, r = n ? n?.preferredFormat : void 0;
|
|
1036
|
-
return r ? e.replace(
|
|
1036
|
+
return r ? e.replace(tt, (e) => {
|
|
1037
1037
|
for (;;) {
|
|
1038
|
-
let [t, , n] =
|
|
1038
|
+
let [t, , n] = et.exec(e) || [];
|
|
1039
1039
|
if (!n) return "";
|
|
1040
1040
|
if (n === r) return `src: ${t};`;
|
|
1041
1041
|
}
|
|
1042
1042
|
}) : e;
|
|
1043
1043
|
}
|
|
1044
|
-
function
|
|
1045
|
-
for (let n of Array.from(e)) ee(n) ? t.push(...
|
|
1044
|
+
function rt(e, t = []) {
|
|
1045
|
+
for (let n of Array.from(e)) ee(n) ? t.push(...rt(n.cssRules)) : "cssRules" in n ? rt(n.cssRules, t) : t.push(n);
|
|
1046
1046
|
return t;
|
|
1047
1047
|
}
|
|
1048
|
-
var
|
|
1049
|
-
function
|
|
1050
|
-
return
|
|
1048
|
+
var it = /\bx?link:?href\s*=\s*["'](?!data:)[^"']+["']/i;
|
|
1049
|
+
function at(e) {
|
|
1050
|
+
return it.test(e.innerHTML);
|
|
1051
1051
|
}
|
|
1052
|
-
async function
|
|
1053
|
-
let n = await
|
|
1054
|
-
if (w(n.node) && T(n.node) && !
|
|
1052
|
+
async function ot(e, t) {
|
|
1053
|
+
let n = await ue(e, t);
|
|
1054
|
+
if (w(n.node) && T(n.node) && !at(n.node)) return n.node;
|
|
1055
1055
|
let { ownerDocument: r, log: i, tasks: a, svgStyleElement: o, svgDefsElement: s, svgStyles: c, font: l, progress: u, autoDestruct: d, onCloneNode: f, onEmbedNode: p, onCreateForeignObjectSvg: m } = n;
|
|
1056
1056
|
i.time("clone node");
|
|
1057
|
-
let h = await
|
|
1057
|
+
let h = await Le(n.node, n, !0);
|
|
1058
1058
|
if (o && r) {
|
|
1059
1059
|
let e = "";
|
|
1060
1060
|
c.forEach((t, n) => {
|
|
@@ -1064,7 +1064,7 @@ async function at(e, t) {
|
|
|
1064
1064
|
`;
|
|
1065
1065
|
}), o.appendChild(r.createTextNode(e));
|
|
1066
1066
|
}
|
|
1067
|
-
i.timeEnd("clone node"), await f?.(h), l !== !1 && w(h) && (i.time("embed web font"), await
|
|
1067
|
+
i.timeEnd("clone node"), await f?.(h), l !== !1 && w(h) && (i.time("embed web font"), await Xe(h, n), i.timeEnd("embed web font")), i.time("embed node"), Ye(h, n);
|
|
1068
1068
|
let g = a.length, _ = 0, v = async () => {
|
|
1069
1069
|
for (;;) {
|
|
1070
1070
|
let e = a.pop();
|
|
@@ -1078,29 +1078,29 @@ async function at(e, t) {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
};
|
|
1080
1080
|
u?.(_, g), await Promise.all([...Array.from({ length: 4 })].map(v)), i.timeEnd("embed node"), await p?.(h);
|
|
1081
|
-
let y =
|
|
1082
|
-
return s && y.insertBefore(s, y.children[0]), o && y.insertBefore(o, y.children[0]), d &&
|
|
1081
|
+
let y = st(h, n);
|
|
1082
|
+
return s && y.insertBefore(s, y.children[0]), o && y.insertBefore(o, y.children[0]), d && Re(n), await m?.(y), y;
|
|
1083
1083
|
}
|
|
1084
|
-
function
|
|
1084
|
+
function st(e, t) {
|
|
1085
1085
|
let { width: n, height: r } = t, i = W(n, r, e.ownerDocument), a = i.ownerDocument.createElementNS(i.namespaceURI, "foreignObject");
|
|
1086
1086
|
return a.setAttributeNS(null, "x", "0%"), a.setAttributeNS(null, "y", "0%"), a.setAttributeNS(null, "width", "100%"), a.setAttributeNS(null, "height", "100%"), a.append(e), i.appendChild(a), i;
|
|
1087
1087
|
}
|
|
1088
|
-
async function
|
|
1089
|
-
let n = await
|
|
1090
|
-
return n.autoDestruct || (n.svgStyleElement =
|
|
1088
|
+
async function ct(e, t) {
|
|
1089
|
+
let n = await ue(e, t), r = await ot(n), i = ie(r, n.isEnable("removeControlCharacter"));
|
|
1090
|
+
return n.autoDestruct || (n.svgStyleElement = fe(n.ownerDocument), n.svgDefsElement = n.ownerDocument?.createElementNS(U, "defs"), n.svgStyles.clear()), await me(G(i, r.ownerDocument), n);
|
|
1091
1091
|
}
|
|
1092
1092
|
// src/editor/mask.ts
|
|
1093
|
-
var
|
|
1094
|
-
function
|
|
1093
|
+
var lt = "input:not([type=hidden]):not([type=submit]):not([type=button]):not([type=reset]):not([type=image]),textarea,select,[contenteditable]:not([contenteditable=false]),[data-pinax-mask],.pinax-mask";
|
|
1094
|
+
function ut(e) {
|
|
1095
1095
|
try {
|
|
1096
|
-
return e.matches(
|
|
1096
|
+
return e.matches(lt);
|
|
1097
1097
|
} catch {
|
|
1098
1098
|
return !1;
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
|
-
function
|
|
1101
|
+
function dt(e, t, n) {
|
|
1102
1102
|
let r = [];
|
|
1103
|
-
for (let i of e.querySelectorAll(
|
|
1103
|
+
for (let i of e.querySelectorAll(lt)) {
|
|
1104
1104
|
if (n?.contains(i)) continue;
|
|
1105
1105
|
let e = i.getBoundingClientRect();
|
|
1106
1106
|
if (e.width <= 0 || e.height <= 0) continue;
|
|
@@ -1114,10 +1114,10 @@ function ut(e, t, n) {
|
|
|
1114
1114
|
}
|
|
1115
1115
|
return r;
|
|
1116
1116
|
}
|
|
1117
|
-
function
|
|
1117
|
+
function ft(e) {
|
|
1118
1118
|
if (e.nodeType !== 1) return;
|
|
1119
1119
|
let t = e;
|
|
1120
|
-
if (!
|
|
1120
|
+
if (!ut(t)) return;
|
|
1121
1121
|
let n = t.tagName;
|
|
1122
1122
|
if (n === "INPUT" || n === "TEXTAREA") {
|
|
1123
1123
|
let e = t;
|
|
@@ -1128,7 +1128,7 @@ function dt(e) {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
t.style.setProperty("visibility", "hidden", "important");
|
|
1130
1130
|
}
|
|
1131
|
-
function
|
|
1131
|
+
function pt(e, t, n) {
|
|
1132
1132
|
for (let r of t) {
|
|
1133
1133
|
let t = r.x * n, i = r.y * n, a = r.w * n, o = r.h * n;
|
|
1134
1134
|
e.save(), e.beginPath(), e.rect(t, i, a, o), e.clip(), e.fillStyle = "#D8DEE9", e.fillRect(t, i, a, o), e.fillStyle = "#C7CFDC";
|
|
@@ -1138,22 +1138,22 @@ function ft(e, t, n) {
|
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
1140
|
// src/privacy.ts
|
|
1141
|
-
var
|
|
1142
|
-
function
|
|
1141
|
+
var mt = /[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(?:\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}/g, ht = /(?<![\w+])(?:\+\d{1,3}|\(?0\d{1,4}\)?|\(?\d{3}\)?)(?:[ .-]?\(?\d{1,5}\)?){1,6}(?![\w])/g, gt = /^\(?\d{3}\)?[ .-]\d{3}[ .-]\d{4}$/;
|
|
1142
|
+
function _t(e) {
|
|
1143
1143
|
let t = e.trim(), n = t.replace(/\D/g, "").length;
|
|
1144
|
-
return t.startsWith("+") ? n >= 8 && n <= 15 : /^\(?0/.test(t) ? n >= 10 && n <= 12 : n === 10 &&
|
|
1144
|
+
return t.startsWith("+") ? n >= 8 && n <= 15 : /^\(?0/.test(t) ? n >= 10 && n <= 12 : n === 10 && gt.test(t);
|
|
1145
1145
|
}
|
|
1146
|
-
function
|
|
1146
|
+
function vt(e) {
|
|
1147
1147
|
let t = [];
|
|
1148
1148
|
if (e.length < 7) return t;
|
|
1149
|
-
if (e.includes("@")) for (let n of e.matchAll(
|
|
1149
|
+
if (e.includes("@")) for (let n of e.matchAll(mt)) t.push({
|
|
1150
1150
|
start: n.index ?? 0,
|
|
1151
1151
|
end: (n.index ?? 0) + n[0].length,
|
|
1152
1152
|
kind: "email"
|
|
1153
1153
|
});
|
|
1154
|
-
if (/\d{2}/.test(e)) for (let n of e.matchAll(
|
|
1154
|
+
if (/\d{2}/.test(e)) for (let n of e.matchAll(ht)) {
|
|
1155
1155
|
let e = n.index ?? 0, r = e + n[0].length;
|
|
1156
|
-
|
|
1156
|
+
_t(n[0]) && (t.some((t) => e < t.end && r > t.start) || t.push({
|
|
1157
1157
|
start: e,
|
|
1158
1158
|
end: r,
|
|
1159
1159
|
kind: "phone"
|
|
@@ -1161,22 +1161,22 @@ function _t(e) {
|
|
|
1161
1161
|
}
|
|
1162
1162
|
return t.sort((e, t) => e.start - t.start);
|
|
1163
1163
|
}
|
|
1164
|
-
var
|
|
1165
|
-
function
|
|
1164
|
+
var yt = "(?:(?:full|your|first|last|guest|customer|client|contact|booking|patient|member|account|lead)\\s+name|name|customer|guest|client|booked by|card ?holder|account holder)", bt = (e) => RegExp(`^${yt}${e}`, "i"), xt = /* @__PURE__ */ bt("\\s*[::]?$"), St = /* @__PURE__ */ bt("\\s*[::]\\s*"), Ct = /\b(?:signed in as|logged in as|welcome back,?)\s+/i;
|
|
1165
|
+
function Z(e) {
|
|
1166
1166
|
let t = e.trim();
|
|
1167
1167
|
return t.length >= 2 && t.length <= 60 && /\p{L}/u.test(t) && t.split(/\s+/).length <= 5;
|
|
1168
1168
|
}
|
|
1169
1169
|
// src/editor/pii.ts
|
|
1170
|
-
var
|
|
1170
|
+
var wt = /^(SCRIPT|STYLE|NOSCRIPT|TEMPLATE|TEXTAREA|OPTION)$/, Tt = "a[href],button,[role=button],[role=link],summary", Et = "[autocomplete~=name],[autocomplete~=given-name],[autocomplete~=family-name],[autocomplete~=nickname],[autocomplete~=username],[itemtype*=\"schema.org/Person\"] [itemprop=name]", Dt = 2e4;
|
|
1171
1171
|
function Q(e, t) {
|
|
1172
|
-
if (!e || t?.contains(e) ||
|
|
1172
|
+
if (!e || t?.contains(e) || wt.test(e.tagName)) return !0;
|
|
1173
1173
|
try {
|
|
1174
|
-
return !!e.closest(
|
|
1174
|
+
return !!e.closest(lt);
|
|
1175
1175
|
} catch {
|
|
1176
1176
|
return !1;
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
|
-
function
|
|
1179
|
+
function Ot(e) {
|
|
1180
1180
|
let t = e.nodeValue ?? "", n = t.length - t.trimStart().length, r = t.trimEnd().length;
|
|
1181
1181
|
return r > n ? {
|
|
1182
1182
|
node: e,
|
|
@@ -1185,7 +1185,7 @@ function Dt(e) {
|
|
|
1185
1185
|
reason: "name"
|
|
1186
1186
|
} : null;
|
|
1187
1187
|
}
|
|
1188
|
-
function
|
|
1188
|
+
function kt(e, t) {
|
|
1189
1189
|
let n = e.ownerDocument, r = e.parentElement?.parentElement ?? e.parentElement;
|
|
1190
1190
|
if (!r) return null;
|
|
1191
1191
|
let i = n.createTreeWalker(r, NodeFilter.SHOW_TEXT);
|
|
@@ -1196,13 +1196,13 @@ function Ot(e, t) {
|
|
|
1196
1196
|
let e = (a.nodeValue ?? "").trim();
|
|
1197
1197
|
if (!e) continue;
|
|
1198
1198
|
let n = a.parentElement;
|
|
1199
|
-
return Q(n, t) || n?.closest(
|
|
1199
|
+
return Q(n, t) || n?.closest(Tt) ? null : Z(e) ? a : null;
|
|
1200
1200
|
}
|
|
1201
1201
|
return null;
|
|
1202
1202
|
}
|
|
1203
|
-
function
|
|
1203
|
+
function At(e, t, n) {
|
|
1204
1204
|
let r = e.parentElement;
|
|
1205
|
-
if (!r || r.closest(
|
|
1205
|
+
if (!r || r.closest(Tt) || r.closest("label")) return;
|
|
1206
1206
|
let i = r.closest("th");
|
|
1207
1207
|
if (i) {
|
|
1208
1208
|
let e = i.closest("table"), r = i.cellIndex;
|
|
@@ -1225,27 +1225,27 @@ function kt(e, t, n) {
|
|
|
1225
1225
|
}), e = e.nextElementSibling;
|
|
1226
1226
|
return;
|
|
1227
1227
|
}
|
|
1228
|
-
let o =
|
|
1228
|
+
let o = kt(r, t);
|
|
1229
1229
|
if (o) {
|
|
1230
|
-
let e =
|
|
1230
|
+
let e = Ot(o);
|
|
1231
1231
|
e && n.push(e);
|
|
1232
1232
|
}
|
|
1233
1233
|
}
|
|
1234
|
-
function
|
|
1234
|
+
function jt(e, t = null) {
|
|
1235
1235
|
let n = [], r = e.body;
|
|
1236
1236
|
if (!r) return n;
|
|
1237
1237
|
let i = e.createTreeWalker(r, NodeFilter.SHOW_TEXT), a = 0;
|
|
1238
|
-
for (let e = i.nextNode(); e && a <
|
|
1238
|
+
for (let e = i.nextNode(); e && a < Dt; e = i.nextNode(), a++) {
|
|
1239
1239
|
let r = e.nodeValue ?? "";
|
|
1240
1240
|
if (r.trim().length < 2 || Q(e.parentElement, t)) continue;
|
|
1241
|
-
for (let t of
|
|
1241
|
+
for (let t of vt(r)) n.push({
|
|
1242
1242
|
node: e,
|
|
1243
1243
|
start: t.start,
|
|
1244
1244
|
end: t.end,
|
|
1245
1245
|
reason: t.kind
|
|
1246
1246
|
});
|
|
1247
|
-
let i = r.trim(), a = r.length - r.trimStart().length, o =
|
|
1248
|
-
if (o &&
|
|
1247
|
+
let i = r.trim(), a = r.length - r.trimStart().length, o = St.exec(i);
|
|
1248
|
+
if (o && Z(i.slice(o[0].length))) {
|
|
1249
1249
|
n.push({
|
|
1250
1250
|
node: e,
|
|
1251
1251
|
start: a + o[0].length,
|
|
@@ -1254,25 +1254,25 @@ function At(e, t = null) {
|
|
|
1254
1254
|
});
|
|
1255
1255
|
continue;
|
|
1256
1256
|
}
|
|
1257
|
-
let s =
|
|
1257
|
+
let s = Ct.exec(r);
|
|
1258
1258
|
if (s) {
|
|
1259
1259
|
let t = s.index + s[0].length, i = r.slice(t), a = i.search(/[!?|•·\n]|\.(?=\s|$)/), o = (a < 0 ? i : i.slice(0, a)).trimEnd();
|
|
1260
|
-
|
|
1260
|
+
Z(o) && n.push({
|
|
1261
1261
|
node: e,
|
|
1262
1262
|
start: t,
|
|
1263
1263
|
end: t + o.length,
|
|
1264
1264
|
reason: "name"
|
|
1265
1265
|
});
|
|
1266
|
-
} else
|
|
1266
|
+
} else xt.test(i) && At(e, t, n);
|
|
1267
1267
|
}
|
|
1268
|
-
for (let r of e.querySelectorAll(
|
|
1268
|
+
for (let r of e.querySelectorAll(Et)) ut(r) || Q(r, t) || n.push({
|
|
1269
1269
|
element: r,
|
|
1270
1270
|
reason: "name"
|
|
1271
1271
|
});
|
|
1272
1272
|
return n;
|
|
1273
1273
|
}
|
|
1274
1274
|
var $ = 2;
|
|
1275
|
-
function
|
|
1275
|
+
function Mt(e, t, n = null) {
|
|
1276
1276
|
let r = [], i = (e) => {
|
|
1277
1277
|
if (e.width <= 0 || e.height <= 0) return;
|
|
1278
1278
|
let n = Math.max(0, e.left - $), i = Math.max(0, e.top - $), a = Math.min(t.w, e.right + $), o = Math.min(t.h, e.bottom + $);
|
|
@@ -1287,7 +1287,7 @@ function jt(e, t, n = null) {
|
|
|
1287
1287
|
let n = t.checkVisibility;
|
|
1288
1288
|
return typeof n == "function" ? n.call(t) : e.defaultView?.getComputedStyle(t)?.visibility !== "hidden";
|
|
1289
1289
|
};
|
|
1290
|
-
for (let t of
|
|
1290
|
+
for (let t of jt(e, n)) try {
|
|
1291
1291
|
if ("element" in t) {
|
|
1292
1292
|
a(t.element) && i(t.element.getBoundingClientRect());
|
|
1293
1293
|
continue;
|
|
@@ -1297,44 +1297,44 @@ function jt(e, t, n = null) {
|
|
|
1297
1297
|
n.setStart(t.node, t.start), n.setEnd(t.node, t.end);
|
|
1298
1298
|
for (let e of n.getClientRects()) i(e);
|
|
1299
1299
|
} catch {}
|
|
1300
|
-
return
|
|
1300
|
+
return Nt(r);
|
|
1301
1301
|
}
|
|
1302
|
-
function
|
|
1302
|
+
function Nt(e) {
|
|
1303
1303
|
return e.filter((t, n) => !e.some((e, r) => r !== n && e.x <= t.x && e.y <= t.y && e.x + e.w >= t.x + t.w && e.y + e.h >= t.y + t.h && (e.w * e.h > t.w * t.h || r < n)));
|
|
1304
1304
|
}
|
|
1305
1305
|
// src/editor/capture.ts
|
|
1306
|
-
var
|
|
1307
|
-
function
|
|
1306
|
+
var Pt = 2560, Ft = 5e6;
|
|
1307
|
+
function It(e, t) {
|
|
1308
1308
|
let n = Math.max(1, e.w), r = Math.max(1, e.h);
|
|
1309
|
-
return Math.min(t || 1, 2,
|
|
1309
|
+
return Math.min(t || 1, 2, Pt / Math.max(n, r), Math.sqrt(Ft / (n * r)));
|
|
1310
1310
|
}
|
|
1311
|
-
var
|
|
1312
|
-
async function
|
|
1311
|
+
var Lt = "data:image/gif;base64,R0lGODlhAQABAIAAAMfP3AAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
|
|
1312
|
+
async function Rt(e, t = window, n = {}) {
|
|
1313
1313
|
let r = t.document, i = {
|
|
1314
1314
|
w: t.innerWidth,
|
|
1315
1315
|
h: t.innerHeight
|
|
1316
|
-
}, a =
|
|
1316
|
+
}, a = It(i, t.devicePixelRatio), o = dt(r, i, e), s = [];
|
|
1317
1317
|
if (n.autoBlur) try {
|
|
1318
|
-
s =
|
|
1318
|
+
s = Mt(r, i, e);
|
|
1319
1319
|
} catch {
|
|
1320
1320
|
s = [];
|
|
1321
1321
|
}
|
|
1322
|
-
let c = r.documentElement, l = t.scrollX, u = t.scrollY, d = t.getComputedStyle(r.body).backgroundColor || t.getComputedStyle(c).backgroundColor, f = await
|
|
1322
|
+
let c = r.documentElement, l = t.scrollX, u = t.scrollY, d = t.getComputedStyle(r.body).backgroundColor || t.getComputedStyle(c).backgroundColor, f = await ct(c, {
|
|
1323
1323
|
width: i.w,
|
|
1324
1324
|
height: i.h,
|
|
1325
1325
|
scale: a,
|
|
1326
1326
|
backgroundColor: d && d !== "rgba(0, 0, 0, 0)" && d !== "transparent" ? d : "#FFFFFF",
|
|
1327
1327
|
filter: (t) => t !== e,
|
|
1328
|
-
onCloneEachNode: (e) =>
|
|
1328
|
+
onCloneEachNode: (e) => ft(e),
|
|
1329
1329
|
style: {
|
|
1330
1330
|
transform: `translate(${-l}px, ${-u}px)`,
|
|
1331
1331
|
transformOrigin: "0 0"
|
|
1332
1332
|
},
|
|
1333
1333
|
timeout: 15e3,
|
|
1334
|
-
maximumCanvasSize:
|
|
1335
|
-
fetch: { placeholderImage:
|
|
1334
|
+
maximumCanvasSize: Pt,
|
|
1335
|
+
fetch: { placeholderImage: Lt }
|
|
1336
1336
|
}), p = f.getContext("2d"), m = f.width / i.w;
|
|
1337
|
-
return p &&
|
|
1337
|
+
return p && pt(p, [...o, ...s], m), {
|
|
1338
1338
|
canvas: f,
|
|
1339
1339
|
auto: s.map((e) => ({
|
|
1340
1340
|
x: e.x * m,
|
|
@@ -1345,7 +1345,7 @@ async function Lt(e, t = window, n = {}) {
|
|
|
1345
1345
|
};
|
|
1346
1346
|
}
|
|
1347
1347
|
// src/report.ts
|
|
1348
|
-
var
|
|
1348
|
+
var zt = {
|
|
1349
1349
|
message: 5e3,
|
|
1350
1350
|
email: 320,
|
|
1351
1351
|
entries: 50,
|
|
@@ -1360,15 +1360,15 @@ var Rt = {
|
|
|
1360
1360
|
fieldId: 40,
|
|
1361
1361
|
fieldText: 200,
|
|
1362
1362
|
bodyBytes: 11534336
|
|
1363
|
-
},
|
|
1364
|
-
function
|
|
1363
|
+
}, Bt = 1572864;
|
|
1364
|
+
function Vt(e) {
|
|
1365
1365
|
return Math.floor((e.length - e.indexOf(",") - 1) * 3 / 4);
|
|
1366
1366
|
}
|
|
1367
|
-
function
|
|
1367
|
+
function Ht(e, t) {
|
|
1368
1368
|
let n = document.createElement("canvas");
|
|
1369
1369
|
return n.width = Math.max(1, Math.round(e.width * t)), n.height = Math.max(1, Math.round(e.height * t)), n.getContext("2d")?.drawImage(e, 0, 0, n.width, n.height), n;
|
|
1370
1370
|
}
|
|
1371
|
-
function
|
|
1371
|
+
function Ut(e, t = Bt) {
|
|
1372
1372
|
let n = e, r = "";
|
|
1373
1373
|
for (let e = 0; e < 6; e++) {
|
|
1374
1374
|
for (let e of [
|
|
@@ -1377,32 +1377,32 @@ function Ht(e, t = zt) {
|
|
|
1377
1377
|
.55
|
|
1378
1378
|
]) {
|
|
1379
1379
|
let i = n.toDataURL("image/webp", e);
|
|
1380
|
-
if (i.startsWith("data:image/webp") || (i = n.toDataURL("image/jpeg", e)), r = i,
|
|
1380
|
+
if (i.startsWith("data:image/webp") || (i = n.toDataURL("image/jpeg", e)), r = i, Vt(i) <= t) return i;
|
|
1381
1381
|
}
|
|
1382
|
-
n =
|
|
1382
|
+
n = Ht(n, .75);
|
|
1383
1383
|
}
|
|
1384
|
-
if (
|
|
1384
|
+
if (Vt(r) > zt.screenshotBytes || r.length > zt.screenshotChars) throw Error("Screenshot too large");
|
|
1385
1385
|
return r;
|
|
1386
1386
|
}
|
|
1387
1387
|
// src/editor/index.ts
|
|
1388
|
-
async function
|
|
1389
|
-
let { canvas: n, auto: r } = await
|
|
1388
|
+
async function Wt(e, t = {}) {
|
|
1389
|
+
let { canvas: n, auto: r } = await Rt(e, window, t), i = {
|
|
1390
1390
|
base: n,
|
|
1391
1391
|
auto: r
|
|
1392
1392
|
};
|
|
1393
1393
|
return {
|
|
1394
|
-
dataUrl:
|
|
1394
|
+
dataUrl: Ut(n),
|
|
1395
1395
|
annotations: [],
|
|
1396
1396
|
edit: i,
|
|
1397
1397
|
autoBlurred: r.length
|
|
1398
1398
|
};
|
|
1399
1399
|
}
|
|
1400
|
-
async function
|
|
1400
|
+
async function Gt(e, t) {
|
|
1401
1401
|
let n = t.edit;
|
|
1402
1402
|
if (!n?.base) return null;
|
|
1403
1403
|
let r = await d(e, n.base, n.state, n.auto);
|
|
1404
1404
|
return r ? {
|
|
1405
|
-
dataUrl:
|
|
1405
|
+
dataUrl: Ut(r.canvas),
|
|
1406
1406
|
annotations: r.annotations,
|
|
1407
1407
|
edit: {
|
|
1408
1408
|
base: n.base,
|
|
@@ -1412,6 +1412,6 @@ async function Wt(e, t) {
|
|
|
1412
1412
|
autoBlurred: t.autoBlurred
|
|
1413
1413
|
} : null;
|
|
1414
1414
|
}
|
|
1415
|
-
export {
|
|
1415
|
+
export { Gt as markUp, Wt as takeScreenshot };
|
|
1416
1416
|
|
|
1417
1417
|
//# sourceMappingURL=pinax-editor.js.map
|