@sailfish-ai/recorder 1.12.4 → 1.12.6
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 +8 -0
- package/dist/canvas/adapters.js +382 -0
- package/dist/canvas/adapters.js.br +0 -0
- package/dist/canvas/adapters.js.gz +0 -0
- package/dist/canvas/canvasManager.js +1949 -0
- package/dist/canvas/canvasManager.js.br +0 -0
- package/dist/canvas/canvasManager.js.gz +0 -0
- package/dist/canvas/canvasPrivacy.js +233 -0
- package/dist/canvas/canvasPrivacy.js.br +0 -0
- package/dist/canvas/canvasPrivacy.js.gz +0 -0
- package/dist/canvas/codec.js +314 -0
- package/dist/canvas/codec.js.br +0 -0
- package/dist/canvas/codec.js.gz +0 -0
- package/dist/canvas/deviceClass.js +67 -0
- package/dist/canvas/deviceClass.js.br +0 -0
- package/dist/canvas/deviceClass.js.gz +0 -0
- package/dist/canvas/encodeWorker.js +284 -0
- package/dist/canvas/encodeWorker.js.br +0 -0
- package/dist/canvas/encodeWorker.js.gz +0 -0
- package/dist/canvas/governor.js +79 -0
- package/dist/canvas/governor.js.br +0 -0
- package/dist/canvas/governor.js.gz +0 -0
- package/dist/canvas/keyframes.js +183 -0
- package/dist/canvas/keyframes.js.br +0 -0
- package/dist/canvas/keyframes.js.gz +0 -0
- package/dist/canvas/mediaRecorderCapture.js +257 -0
- package/dist/canvas/mediaRecorderCapture.js.br +0 -0
- package/dist/canvas/mediaRecorderCapture.js.gz +0 -0
- package/dist/canvas/objectLog.js +150 -0
- package/dist/canvas/objectLog.js.br +0 -0
- package/dist/canvas/objectLog.js.gz +0 -0
- package/dist/canvas/patch2d.js +1302 -0
- package/dist/canvas/patch2d.js.br +0 -0
- package/dist/canvas/patch2d.js.gz +0 -0
- package/dist/canvas/patchGL.js +371 -0
- package/dist/canvas/patchGL.js.br +0 -0
- package/dist/canvas/patchGL.js.gz +0 -0
- package/dist/canvas/patchWebGPU.js +361 -0
- package/dist/canvas/patchWebGPU.js.br +0 -0
- package/dist/canvas/patchWebGPU.js.gz +0 -0
- package/dist/canvas/piiDetect.js +155 -0
- package/dist/canvas/piiDetect.js.br +0 -0
- package/dist/canvas/piiDetect.js.gz +0 -0
- package/dist/canvas/protocol.js +122 -0
- package/dist/canvas/protocol.js.br +0 -0
- package/dist/canvas/protocol.js.gz +0 -0
- package/dist/canvas/videoCapture.js +252 -0
- package/dist/canvas/videoCapture.js.br +0 -0
- package/dist/canvas/videoCapture.js.gz +0 -0
- package/dist/canvas/workerRelay.js +99 -0
- package/dist/canvas/workerRelay.js.br +0 -0
- package/dist/canvas/workerRelay.js.gz +0 -0
- package/dist/canvas/workerShim.js +227 -0
- package/dist/canvas/workerShim.js.br +0 -0
- package/dist/canvas/workerShim.js.gz +0 -0
- package/dist/canvas-worker.cjs +74 -0
- package/dist/canvas-worker.cjs.br +0 -0
- package/dist/canvas-worker.cjs.gz +0 -0
- package/dist/canvas-worker.js +78 -0
- package/dist/canvas-worker.js.br +0 -0
- package/dist/canvas-worker.js.gz +0 -0
- package/dist/canvasFrameStore.js +198 -0
- package/dist/canvasFrameStore.js.br +0 -0
- package/dist/canvasFrameStore.js.gz +0 -0
- package/dist/chunks/canvasManager-BYn3_oyo.js +1440 -0
- package/dist/chunks/canvasManager-BYn3_oyo.js.br +0 -0
- package/dist/chunks/canvasManager-BYn3_oyo.js.gz +0 -0
- package/dist/chunks/canvasManager-CoX5072G.js +1456 -0
- package/dist/chunks/canvasManager-CoX5072G.js.br +0 -0
- package/dist/chunks/canvasManager-CoX5072G.js.gz +0 -0
- package/dist/chunks/{chunkSerializer-FQtY90Av.js → chunkSerializer-C_K0Wyk0.js} +1 -1
- package/dist/chunks/chunkSerializer-C_K0Wyk0.js.br +0 -0
- package/dist/chunks/chunkSerializer-C_K0Wyk0.js.gz +0 -0
- package/dist/chunks/{chunkSerializer-DDukZpgl.js → chunkSerializer-CghPitF4.js} +1 -1
- package/dist/chunks/chunkSerializer-CghPitF4.js.br +0 -0
- package/dist/chunks/chunkSerializer-CghPitF4.js.gz +0 -0
- package/dist/chunks/{index-C-qbsfKe.js → index-BIj4l3CV.js} +1028 -650
- package/dist/chunks/index-BIj4l3CV.js.br +0 -0
- package/dist/chunks/index-BIj4l3CV.js.gz +0 -0
- package/dist/chunks/{index-D6axlCRu.js → index-DIYomvdD.js} +1119 -720
- package/dist/chunks/index-DIYomvdD.js.br +0 -0
- package/dist/chunks/index-DIYomvdD.js.gz +0 -0
- package/dist/chunks/patch2d-9voowhJ_.js +816 -0
- package/dist/chunks/patch2d-9voowhJ_.js.br +0 -0
- package/dist/chunks/patch2d-9voowhJ_.js.gz +0 -0
- package/dist/chunks/patch2d-PQxcaE6r.js +886 -0
- package/dist/chunks/patch2d-PQxcaE6r.js.br +0 -0
- package/dist/chunks/patch2d-PQxcaE6r.js.gz +0 -0
- package/dist/graphql.js +12 -1
- package/dist/graphql.js.br +0 -0
- package/dist/graphql.js.gz +0 -0
- package/dist/inAppReportIssueModal/index.js +48 -0
- package/dist/inAppReportIssueModal/index.js.br +0 -0
- package/dist/inAppReportIssueModal/index.js.gz +0 -0
- package/dist/index.js +144 -2
- package/dist/index.js.br +0 -0
- package/dist/index.js.gz +0 -0
- package/dist/recorder.cjs +2 -2
- package/dist/recorder.cjs.br +0 -0
- package/dist/recorder.cjs.gz +0 -0
- package/dist/recorder.js +52 -41
- package/dist/recorder.js.br +0 -0
- package/dist/recorder.js.gz +0 -0
- package/dist/recorder.umd.cjs +4847 -2212
- package/dist/recorder.umd.cjs.br +0 -0
- package/dist/recorder.umd.cjs.gz +0 -0
- package/dist/recording.js +119 -10
- package/dist/recording.js.br +0 -0
- package/dist/recording.js.gz +0 -0
- package/dist/types/canvas/adapters.d.ts +71 -0
- package/dist/types/canvas/canvasManager.d.ts +273 -0
- package/dist/types/canvas/canvasPrivacy.d.ts +184 -0
- package/dist/types/canvas/codec.d.ts +27 -0
- package/dist/types/canvas/deviceClass.d.ts +40 -0
- package/dist/types/canvas/encodeWorker.d.ts +54 -0
- package/dist/types/canvas/governor.d.ts +44 -0
- package/dist/types/canvas/keyframes.d.ts +81 -0
- package/dist/types/canvas/mediaRecorderCapture.d.ts +91 -0
- package/dist/types/canvas/objectLog.d.ts +75 -0
- package/dist/types/canvas/patch2d.d.ts +339 -0
- package/dist/types/canvas/patchGL.d.ts +74 -0
- package/dist/types/canvas/patchWebGPU.d.ts +37 -0
- package/dist/types/canvas/piiDetect.d.ts +60 -0
- package/dist/types/canvas/protocol.d.ts +176 -0
- package/dist/types/canvas/videoCapture.d.ts +67 -0
- package/dist/types/canvas/workerRelay.d.ts +29 -0
- package/dist/types/canvas/workerShim.d.ts +10 -0
- package/dist/types/canvasFrameStore.d.ts +23 -0
- package/dist/types/graphql.d.ts +1 -1
- package/dist/types/index.d.ts +99 -1
- package/dist/types/types.d.ts +40 -0
- package/dist/types/websocket.d.ts +19 -0
- package/dist/websocket.js +210 -0
- package/dist/websocket.js.br +0 -0
- package/dist/websocket.js.gz +0 -0
- package/package.json +7 -1
- package/dist/chunks/chunkSerializer-DDukZpgl.js.br +0 -0
- package/dist/chunks/chunkSerializer-DDukZpgl.js.gz +0 -0
- package/dist/chunks/chunkSerializer-FQtY90Av.js.br +0 -0
- package/dist/chunks/chunkSerializer-FQtY90Av.js.gz +0 -0
- package/dist/chunks/index-C-qbsfKe.js.br +0 -0
- package/dist/chunks/index-C-qbsfKe.js.gz +0 -0
- package/dist/chunks/index-D6axlCRu.js.br +0 -0
- package/dist/chunks/index-D6axlCRu.js.gz +0 -0
|
@@ -0,0 +1,816 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
function closestSafe(t2, e2) {
|
|
6
|
+
if (!t2 || !e2) return false;
|
|
7
|
+
try {
|
|
8
|
+
return !!t2.closest(e2);
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function matchesSelectorSafe(t2, e2) {
|
|
14
|
+
if (!e2) return false;
|
|
15
|
+
try {
|
|
16
|
+
return t2.matches(e2);
|
|
17
|
+
} catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
const t = /\d/, e = /\b\d{3}-\d{2}-\d{4}\b/, s = /\b(?:\d[ -]*?){13,16}\b/g, i = /\b\d{3}-\d{2}-\d{4}\b/g, r = /\b\d{1,2}[/\-.]\d{1,2}[/\-.]\d{2,4}\b/g;
|
|
22
|
+
function passesLuhn(t2) {
|
|
23
|
+
let e2 = "";
|
|
24
|
+
for (let s3 = 0; s3 < t2.length; s3++) {
|
|
25
|
+
const i3 = t2.charCodeAt(s3);
|
|
26
|
+
i3 >= 48 && i3 <= 57 && (e2 += t2[s3]);
|
|
27
|
+
}
|
|
28
|
+
const s2 = e2.length;
|
|
29
|
+
if (s2 < 13 || s2 > 16) return false;
|
|
30
|
+
let i2 = 0, r2 = false;
|
|
31
|
+
for (let t3 = s2 - 1; t3 >= 0; t3--) {
|
|
32
|
+
let s3 = e2.charCodeAt(t3) - 48;
|
|
33
|
+
r2 && (s3 *= 2, s3 > 9 && (s3 -= 9)), i2 += s3, r2 = !r2;
|
|
34
|
+
}
|
|
35
|
+
return i2 % 10 == 0;
|
|
36
|
+
}
|
|
37
|
+
function redactCreditCard(t2) {
|
|
38
|
+
return "**** **** **** " + t2.slice(-4);
|
|
39
|
+
}
|
|
40
|
+
function redactSsn(t2) {
|
|
41
|
+
return "***-**-" + t2.slice(-4);
|
|
42
|
+
}
|
|
43
|
+
function redactDob(t2) {
|
|
44
|
+
return "**/**/" + t2.slice(-4);
|
|
45
|
+
}
|
|
46
|
+
function redactSensitiveContent(e2, a2) {
|
|
47
|
+
if ("string" != typeof e2 || 0 === e2.length) return e2;
|
|
48
|
+
if (!t.test(e2)) return e2;
|
|
49
|
+
let o2 = e2;
|
|
50
|
+
return false === a2.recordCreditCardInfo && (s.lastIndex = 0, o2 = o2.replace(s, (t2) => passesLuhn(t2) ? redactCreditCard(t2) : t2)), false === a2.recordSsn && (i.lastIndex = 0, o2 = o2.replace(i, (t2) => redactSsn(t2))), false === a2.recordDob && (r.lastIndex = 0, o2 = o2.replace(r, (t2) => redactDob(t2))), o2;
|
|
51
|
+
}
|
|
52
|
+
function maskCanvasSelector(t2) {
|
|
53
|
+
return `.${t2.maskCanvasClass || "sailfishSanitize"}, [data-sf-mask]`;
|
|
54
|
+
}
|
|
55
|
+
function maskAllText(t2) {
|
|
56
|
+
return t2.replace(/\S/g, "*");
|
|
57
|
+
}
|
|
58
|
+
const a = { text: "asterisks", shape: "color" }, o = "#1f2433";
|
|
59
|
+
function transformedBox(t2, e2, s2, i2, r2, a2 = 1) {
|
|
60
|
+
if (![t2, e2, s2, i2, r2.a, r2.b, r2.c, r2.d, r2.e, r2.f].every(Number.isFinite)) return null;
|
|
61
|
+
const px = (t3, e3) => r2.a * t3 + r2.c * e3 + r2.e, py = (t3, e3) => r2.b * t3 + r2.d * e3 + r2.f, o2 = [px(t2, e2), px(s2, e2), px(s2, i2), px(t2, i2)], c2 = [py(t2, e2), py(s2, e2), py(s2, i2), py(t2, i2)], h2 = Math.min(...o2), l2 = Math.max(...o2), d2 = Math.min(...c2), u2 = Math.max(...c2);
|
|
62
|
+
return Number.isFinite(h2) && Number.isFinite(d2) ? { x: h2 - a2, y: d2 - a2, w: l2 - h2 + 2 * a2, h: u2 - d2 + 2 * a2 } : null;
|
|
63
|
+
}
|
|
64
|
+
function textLocalBox(t2) {
|
|
65
|
+
let e2 = t2.x;
|
|
66
|
+
const s2 = t2.align ?? "start";
|
|
67
|
+
"center" === s2 ? e2 = t2.x - t2.width / 2 : "right" !== s2 && "end" !== s2 || (e2 = t2.x - t2.width);
|
|
68
|
+
const i2 = e2 + t2.width, r2 = t2.ascent, a2 = t2.descent, o2 = r2 + a2;
|
|
69
|
+
let c2, h2;
|
|
70
|
+
switch (t2.baseline) {
|
|
71
|
+
case "top":
|
|
72
|
+
case "hanging":
|
|
73
|
+
c2 = t2.y, h2 = t2.y + o2;
|
|
74
|
+
break;
|
|
75
|
+
case "middle":
|
|
76
|
+
c2 = t2.y - o2 / 2, h2 = t2.y + o2 / 2;
|
|
77
|
+
break;
|
|
78
|
+
case "bottom":
|
|
79
|
+
case "ideographic":
|
|
80
|
+
c2 = t2.y - o2, h2 = t2.y;
|
|
81
|
+
break;
|
|
82
|
+
default:
|
|
83
|
+
c2 = t2.y - r2, h2 = t2.y + a2;
|
|
84
|
+
}
|
|
85
|
+
return { x0: e2, y0: c2, x1: i2, y1: h2 };
|
|
86
|
+
}
|
|
87
|
+
const c = new Map(["__frame", "__create", "__objcall", "arc", "arcTo", "beginPath", "bezierCurveTo", "clearRect", "clip", "closePath", "drawImage", "ellipse", "fill", "fillRect", "fillText", "lineTo", "moveTo", "putImageData", "quadraticCurveTo", "rect", "reset", "resetTransform", "restore", "rotate", "roundRect", "save", "scale", "setLineDash", "setTransform", "stroke", "strokeRect", "strokeText", "transform", "translate", "drawFocusIfNeeded", "fillStyle", "strokeStyle", "globalAlpha", "globalCompositeOperation", "lineWidth", "lineCap", "lineJoin", "miterLimit", "lineDashOffset", "font", "textAlign", "textBaseline", "direction", "shadowBlur", "shadowColor", "shadowOffsetX", "shadowOffsetY", "imageSmoothingEnabled", "imageSmoothingQuality", "filter", "letterSpacing", "wordSpacing", "useProgram", "bindBuffer", "bindTexture", "bindVertexArray", "bindFramebuffer", "bufferData", "bufferSubData", "uniform1f", "uniform1i", "uniform2f", "uniform3f", "uniform4f", "uniform1fv", "uniform2fv", "uniform3fv", "uniform4fv", "uniformMatrix3fv", "uniformMatrix4fv", "vertexAttribPointer", "enableVertexAttribArray", "drawArrays", "drawElements", "drawArraysInstanced", "drawElementsInstanced", "enable", "disable", "depthFunc", "depthMask", "blendFunc", "blendFuncSeparate", "blendEquation", "cullFace", "frontFace", "viewport", "scissor", "clearColor", "clearDepth", "clearStencil", "activeTexture", "texParameteri", "texImage2D", "texSubImage2D", "pixelStorei", "colorMask", "stencilFunc", "stencilOp", "stencilMask", "polygonOffset", "__site"].map((t2, e2) => [t2, e2]));
|
|
88
|
+
class ByteWriter {
|
|
89
|
+
constructor() {
|
|
90
|
+
__publicField(this, "buf", new Uint8Array(65536));
|
|
91
|
+
__publicField(this, "len", 0);
|
|
92
|
+
__publicField(this, "view", new DataView(this.buf.buffer));
|
|
93
|
+
}
|
|
94
|
+
ensure(t2) {
|
|
95
|
+
if (this.len + t2 <= this.buf.length) return;
|
|
96
|
+
const e2 = new Uint8Array(Math.max(2 * this.buf.length, this.len + t2));
|
|
97
|
+
e2.set(this.buf.subarray(0, this.len)), this.buf = e2, this.view = new DataView(e2.buffer);
|
|
98
|
+
}
|
|
99
|
+
u8(t2) {
|
|
100
|
+
this.ensure(1), this.buf[this.len++] = 255 & t2;
|
|
101
|
+
}
|
|
102
|
+
varint(t2) {
|
|
103
|
+
let e2 = t2 < 0 ? 2 * -t2 - 1 : 2 * t2;
|
|
104
|
+
for (this.ensure(10); e2 >= 128; ) this.buf[this.len++] = 127 & e2 | 128, e2 = Math.floor(e2 / 128);
|
|
105
|
+
this.buf[this.len++] = e2;
|
|
106
|
+
}
|
|
107
|
+
f64(t2) {
|
|
108
|
+
this.ensure(8), this.view.setFloat64(this.len, t2, true), this.len += 8;
|
|
109
|
+
}
|
|
110
|
+
bytes(t2) {
|
|
111
|
+
this.ensure(t2.length), this.buf.set(t2, this.len), this.len += t2.length;
|
|
112
|
+
}
|
|
113
|
+
take() {
|
|
114
|
+
const t2 = this.buf.slice(0, this.len);
|
|
115
|
+
return this.len = 0, t2;
|
|
116
|
+
}
|
|
117
|
+
get size() {
|
|
118
|
+
return this.len;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const h = new TextEncoder();
|
|
122
|
+
new TextDecoder();
|
|
123
|
+
async function deflate(t2) {
|
|
124
|
+
return (async function pipeThrough(t3, e2) {
|
|
125
|
+
const s2 = new Uint8Array(e2.buffer.slice(e2.byteOffset, e2.byteOffset + e2.byteLength)), i2 = new Response(t3.readable).arrayBuffer(), r2 = t3.writable.getWriter();
|
|
126
|
+
return await r2.write(s2), await r2.close(), new Uint8Array(await i2);
|
|
127
|
+
})(new CompressionStream("deflate"), t2);
|
|
128
|
+
}
|
|
129
|
+
const l = /* @__PURE__ */ new WeakMap();
|
|
130
|
+
function pushObjectCall(t2, e2, s2) {
|
|
131
|
+
t2 && (t2.calls.length >= 4096 ? t2.callsCapped = true : t2.calls.push({ method: e2, args: s2 }));
|
|
132
|
+
}
|
|
133
|
+
const d = ["createLinearGradient", "createRadialGradient", "createConicGradient", "createPattern"], u = ["addPath", "arc", "arcTo", "bezierCurveTo", "closePath", "ellipse", "lineTo", "moveTo", "quadraticCurveTo", "rect", "roundRect"];
|
|
134
|
+
let f = null;
|
|
135
|
+
const p = /* @__PURE__ */ new WeakSet();
|
|
136
|
+
let g = false;
|
|
137
|
+
function installFactoryLoggingOnProto(t2) {
|
|
138
|
+
if (p.has(t2)) return;
|
|
139
|
+
p.add(t2);
|
|
140
|
+
const e2 = t2;
|
|
141
|
+
for (const s2 of d) {
|
|
142
|
+
const i2 = Object.getOwnPropertyDescriptor(t2, s2);
|
|
143
|
+
if (!i2 || "function" != typeof i2.value) continue;
|
|
144
|
+
const r2 = i2.value;
|
|
145
|
+
e2[s2] = function(...t3) {
|
|
146
|
+
const e3 = r2.apply(this, t3);
|
|
147
|
+
return e3 && "object" == typeof e3 && l.set(e3, { factory: s2, args: t3, calls: [] }), e3;
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function installSharedObjectLogging() {
|
|
152
|
+
if (!g) {
|
|
153
|
+
if (g = true, "undefined" != typeof CanvasGradient) {
|
|
154
|
+
const t2 = CanvasGradient.prototype.addColorStop;
|
|
155
|
+
CanvasGradient.prototype.addColorStop = function(...e2) {
|
|
156
|
+
return pushObjectCall(l.get(this), "addColorStop", e2), t2.apply(this, e2);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
if ("undefined" != typeof Path2D && !f) {
|
|
160
|
+
f = Path2D;
|
|
161
|
+
for (const t3 of u) {
|
|
162
|
+
const e2 = Path2D.prototype[t3];
|
|
163
|
+
"function" == typeof e2 && (Path2D.prototype[t3] = function(...s2) {
|
|
164
|
+
return pushObjectCall(l.get(this), t3, s2), e2.apply(this, s2);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
const t2 = f, Wrapped = function(e2) {
|
|
168
|
+
var _a;
|
|
169
|
+
const s2 = void 0 === e2 ? new t2() : new t2(e2);
|
|
170
|
+
return l.set(s2, { factory: "__path2d", args: ["string" == typeof e2 ? e2 : null], calls: e2 instanceof t2 ? [...((_a = l.get(e2)) == null ? void 0 : _a.calls) ?? []] : [] }), s2;
|
|
171
|
+
};
|
|
172
|
+
Wrapped.prototype = t2.prototype, globalThis.Path2D = Wrapped;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const m = [Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array];
|
|
177
|
+
class BufferSink {
|
|
178
|
+
constructor() {
|
|
179
|
+
__publicField(this, "ops", []);
|
|
180
|
+
__publicField(this, "assetEvents", []);
|
|
181
|
+
__publicField(this, "assetData", []);
|
|
182
|
+
__publicField(this, "notes", []);
|
|
183
|
+
}
|
|
184
|
+
onOp(t2) {
|
|
185
|
+
this.ops.push(t2);
|
|
186
|
+
}
|
|
187
|
+
onAssetBytes(t2, e2, s2) {
|
|
188
|
+
this.assetEvents.push({ id: t2, bytes: e2, t: s2 });
|
|
189
|
+
}
|
|
190
|
+
onAssetData(t2, e2) {
|
|
191
|
+
this.assetData.push({ info: t2, payload: e2 });
|
|
192
|
+
}
|
|
193
|
+
note(t2) {
|
|
194
|
+
this.notes.includes(t2) || this.notes.push(t2);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
class DiscardSink {
|
|
198
|
+
constructor(t2) {
|
|
199
|
+
this.onDirty = t2;
|
|
200
|
+
}
|
|
201
|
+
onOp(t2) {
|
|
202
|
+
this.onDirty();
|
|
203
|
+
}
|
|
204
|
+
onAssetBytes(t2, e2, s2) {
|
|
205
|
+
}
|
|
206
|
+
note(t2) {
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
const y = { t: 0, op: "", args: [] }, x = new TextEncoder();
|
|
210
|
+
new TextDecoder();
|
|
211
|
+
const k = [83, 70, 67, 49];
|
|
212
|
+
const w = ["fillStyle", "strokeStyle", "globalAlpha", "globalCompositeOperation", "lineWidth", "lineCap", "lineJoin", "miterLimit", "lineDashOffset", "font", "textAlign", "textBaseline", "direction", "shadowBlur", "shadowColor", "shadowOffsetX", "shadowOffsetY", "imageSmoothingEnabled", "imageSmoothingQuality", "filter", "letterSpacing", "wordSpacing"];
|
|
213
|
+
let b = 1, S = 1;
|
|
214
|
+
const C = /* @__PURE__ */ new WeakSet();
|
|
215
|
+
let v = false;
|
|
216
|
+
const M = /* @__PURE__ */ new Set(["beginPath", "closePath", "moveTo", "lineTo", "rect", "roundRect", "arc", "arcTo", "ellipse", "bezierCurveTo", "quadraticCurveTo"]), T = /* @__PURE__ */ new Set(["fill", "stroke", "fillRect", "strokeRect", "drawImage", "putImageData"]), R = /* @__PURE__ */ new Set(["setTransform", "transform", "translate", "scale", "rotate", "resetTransform"]);
|
|
217
|
+
const A = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakSet();
|
|
218
|
+
let I = null;
|
|
219
|
+
let O = null;
|
|
220
|
+
let P = null;
|
|
221
|
+
const B = /* @__PURE__ */ new Map(), L = /* @__PURE__ */ new WeakMap();
|
|
222
|
+
class ContextRecorder {
|
|
223
|
+
constructor(t2, e2, s2, i2, r2, a2) {
|
|
224
|
+
__publicField(this, "assets", /* @__PURE__ */ new Map());
|
|
225
|
+
__publicField(this, "assetBySource", /* @__PURE__ */ new WeakMap());
|
|
226
|
+
__publicField(this, "pendingEncodes", /* @__PURE__ */ new Set());
|
|
227
|
+
__publicField(this, "props", {});
|
|
228
|
+
__publicField(this, "stack", []);
|
|
229
|
+
__publicField(this, "cpuMs", 0);
|
|
230
|
+
__publicField(this, "bound", false);
|
|
231
|
+
__publicField(this, "retainAssets");
|
|
232
|
+
__publicField(this, "pendingSiteId");
|
|
233
|
+
__publicField(this, "textRedactor");
|
|
234
|
+
__publicField(this, "maskDepth", 0);
|
|
235
|
+
__publicField(this, "hasMaskedDraws", false);
|
|
236
|
+
__publicField(this, "redactStyle", a);
|
|
237
|
+
__publicField(this, "textOnlyMask", false);
|
|
238
|
+
__publicField(this, "maskedRegions", []);
|
|
239
|
+
__publicField(this, "keyframeUnsafe", false);
|
|
240
|
+
__publicField(this, "maskPathBounds", null);
|
|
241
|
+
__publicField(this, "objRefs", /* @__PURE__ */ new WeakMap());
|
|
242
|
+
this.ctx = t2, this.sink = e2, this.now = s2, this.assetMode = i2, this.encodeImage = r2, this.retainAssets = false !== (a2 == null ? void 0 : a2.retainAssets);
|
|
243
|
+
}
|
|
244
|
+
get rawCtx() {
|
|
245
|
+
return this.ctx;
|
|
246
|
+
}
|
|
247
|
+
swapSink(t2) {
|
|
248
|
+
var _a;
|
|
249
|
+
const e2 = this.sink;
|
|
250
|
+
if (this.sink = t2, this.bound = true, e2 instanceof BufferSink) {
|
|
251
|
+
for (const s2 of e2.ops) t2.onOp(s2);
|
|
252
|
+
for (const s2 of e2.assetEvents) t2.onAssetBytes(s2.id, s2.bytes, s2.t);
|
|
253
|
+
for (const s2 of e2.assetData) (_a = t2.onAssetData) == null ? void 0 : _a.call(t2, s2.info, s2.payload);
|
|
254
|
+
for (const s2 of e2.notes) t2.note(s2);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
addAsset(t2, e2) {
|
|
258
|
+
if (this.assets.set(t2, e2), !this.retainAssets && this.assets.size > 2048) {
|
|
259
|
+
const t3 = this.assets.size - 2048;
|
|
260
|
+
let e3 = 0;
|
|
261
|
+
for (const s2 of this.assets.keys()) {
|
|
262
|
+
if (e3 >= t3) break;
|
|
263
|
+
this.assets.delete(s2), e3++;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
takePendingSiteId() {
|
|
268
|
+
const t2 = this.pendingSiteId;
|
|
269
|
+
return this.pendingSiteId = void 0, t2;
|
|
270
|
+
}
|
|
271
|
+
recordCall(t2, e2) {
|
|
272
|
+
if (this.maskDepth > 0) return this.maskCall(t2, e2), void (this.pendingSiteId = void 0);
|
|
273
|
+
if (this.sink instanceof DiscardSink) return this.sink.onOp(y), void (this.pendingSiteId = void 0);
|
|
274
|
+
"clearRect" === t2 && this.maskedRegions.length > 0 && this.clipRegionsToClear(e2);
|
|
275
|
+
const s2 = performance.now(), i2 = this.now();
|
|
276
|
+
if (void 0 !== this.textRedactor && ("fillText" === t2 || "strokeText" === t2)) {
|
|
277
|
+
const t3 = e2[0];
|
|
278
|
+
if ("string" == typeof t3) {
|
|
279
|
+
const i3 = this.textRedactor(t3);
|
|
280
|
+
if (i3 !== t3) {
|
|
281
|
+
if (this.pushMaskRegion(this.textRegionFor(t3, e2)), "bar" === this.redactStyle.text) return this.emitRedactionBlock(this.textLocalRect(t3, e2)), void (this.cpuMs += performance.now() - s2);
|
|
282
|
+
(e2 = e2.slice())[0] = i3;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if ("save" === t2) this.stack.push({ props: { ...this.props }, transform: this.readTransform() });
|
|
287
|
+
else if ("restore" === t2) {
|
|
288
|
+
const t3 = this.stack.pop();
|
|
289
|
+
t3 && (this.props = t3.props);
|
|
290
|
+
}
|
|
291
|
+
const r2 = this.takePendingSiteId(), a2 = { t: i2, op: t2, args: this.serializeArgs(e2, i2) };
|
|
292
|
+
r2 && (a2.sfId = r2), this.sink.onOp(a2), this.cpuMs += performance.now() - s2;
|
|
293
|
+
}
|
|
294
|
+
serializeArgs(t2, e2) {
|
|
295
|
+
const s2 = t2.length, i2 = new Array(s2);
|
|
296
|
+
for (let r2 = 0; r2 < s2; r2++) {
|
|
297
|
+
const s3 = t2[r2];
|
|
298
|
+
switch (typeof s3) {
|
|
299
|
+
case "number":
|
|
300
|
+
i2[r2] = Number.isFinite(s3) ? s3 : 0;
|
|
301
|
+
break;
|
|
302
|
+
case "string":
|
|
303
|
+
case "boolean":
|
|
304
|
+
i2[r2] = s3;
|
|
305
|
+
break;
|
|
306
|
+
case "undefined":
|
|
307
|
+
i2[r2] = null;
|
|
308
|
+
break;
|
|
309
|
+
default:
|
|
310
|
+
i2[r2] = this.serializeArg(s3, e2);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return i2;
|
|
314
|
+
}
|
|
315
|
+
recordSet(t2, e2) {
|
|
316
|
+
if (this.maskDepth > 0 && !this.textOnlyMask) return this.hasMaskedDraws = true, void (this.pendingSiteId = void 0);
|
|
317
|
+
if (this.maskDepth > 0 && (this.hasMaskedDraws = true), this.sink instanceof DiscardSink) return this.sink.onOp(y), void (this.pendingSiteId = void 0);
|
|
318
|
+
const s2 = performance.now(), i2 = this.now(), r2 = this.serializeArg(e2, i2);
|
|
319
|
+
this.props[t2] = r2;
|
|
320
|
+
const a2 = this.takePendingSiteId(), o2 = { t: i2, op: t2, args: [r2], setter: true };
|
|
321
|
+
a2 && (o2.sfId = a2), this.sink.onOp(o2), this.cpuMs += performance.now() - s2;
|
|
322
|
+
}
|
|
323
|
+
maskCall(t2, e2) {
|
|
324
|
+
if (this.hasMaskedDraws = true, this.sink instanceof DiscardSink) return void this.sink.onOp(y);
|
|
325
|
+
const s2 = this.redactStyle, i2 = "fillText" === t2 || "strokeText" === t2;
|
|
326
|
+
if (!this.textOnlyMask || i2) if ("save" === t2 || "restore" === t2 || R.has(t2)) this.recordPassthrough(t2, e2);
|
|
327
|
+
else {
|
|
328
|
+
if (i2) {
|
|
329
|
+
const i3 = e2[0];
|
|
330
|
+
if ("string" != typeof i3) return;
|
|
331
|
+
if (this.pushMaskRegion(this.textRegionFor(i3, e2)), "asterisks" === s2.text) {
|
|
332
|
+
const s3 = e2.slice();
|
|
333
|
+
s3[0] = maskAllText(i3), this.emitSynthCall(t2, s3);
|
|
334
|
+
} else this.emitRedactionBlock(this.textLocalRect(i3, e2));
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (M.has(t2)) return this.updatePathBounds(t2, e2), void ("color" === s2.shape && this.emitSynthCall(t2, e2));
|
|
338
|
+
if (T.has(t2)) {
|
|
339
|
+
this.pushMaskRegion(this.shapeRegion(t2, e2));
|
|
340
|
+
if (!("remove" === s2.shape || "putImageData" === t2)) if ("color" !== s2.shape || "fill" !== t2 && "stroke" !== t2 && "fillRect" !== t2 && "strokeRect" !== t2) this.emitRedactionBlock(this.shapeLocalRect(t2, e2));
|
|
341
|
+
else {
|
|
342
|
+
const s3 = "stroke" === t2 || "strokeRect" === t2 ? "strokeStyle" : "fillStyle";
|
|
343
|
+
this.emitSynthCall("save", []), this.emitSynthSetter(s3, o), this.emitSynthCall(t2, "fill" === t2 || "stroke" === t2 ? [] : e2), this.emitSynthCall("restore", []);
|
|
344
|
+
}
|
|
345
|
+
return void ("fill" !== t2 && "stroke" !== t2 || (this.maskPathBounds = null));
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
else this.recordPassthrough(t2, e2);
|
|
349
|
+
}
|
|
350
|
+
recordPassthrough(t2, e2) {
|
|
351
|
+
if (this.sink instanceof DiscardSink) return void this.sink.onOp(y);
|
|
352
|
+
const s2 = this.now();
|
|
353
|
+
if ("save" === t2) this.stack.push({ props: { ...this.props }, transform: this.readTransform() });
|
|
354
|
+
else if ("restore" === t2) {
|
|
355
|
+
const t3 = this.stack.pop();
|
|
356
|
+
t3 && (this.props = t3.props);
|
|
357
|
+
}
|
|
358
|
+
this.sink.onOp({ t: s2, op: t2, args: this.serializeArgs(e2, s2) });
|
|
359
|
+
}
|
|
360
|
+
pushRegion(t2) {
|
|
361
|
+
t2 && t2.w > 0 && t2.h > 0 && (this.maskedRegions.push(t2), this.maskedRegions.length > 4096 && this.coalesceRegions());
|
|
362
|
+
}
|
|
363
|
+
coalesceRegions() {
|
|
364
|
+
const t2 = this.canvasSize();
|
|
365
|
+
if (!t2) {
|
|
366
|
+
const t3 = (function unionRegion(t4) {
|
|
367
|
+
if (0 === t4.length) return null;
|
|
368
|
+
let e3 = 1 / 0, s3 = 1 / 0, i3 = -1 / 0, r3 = -1 / 0;
|
|
369
|
+
for (const a3 of t4) a3.x < e3 && (e3 = a3.x), a3.y < s3 && (s3 = a3.y), a3.x + a3.w > i3 && (i3 = a3.x + a3.w), a3.y + a3.h > r3 && (r3 = a3.y + a3.h);
|
|
370
|
+
return { x: e3, y: s3, w: i3 - e3, h: r3 - s3 };
|
|
371
|
+
})(this.maskedRegions);
|
|
372
|
+
return this.maskedRegions.length = 0, void (t3 && this.maskedRegions.push(t3));
|
|
373
|
+
}
|
|
374
|
+
let e2 = 64;
|
|
375
|
+
const fits = () => Math.ceil(t2.w / e2) * Math.ceil(t2.h / e2) <= 4096;
|
|
376
|
+
for (; !fits(); ) e2 *= 2;
|
|
377
|
+
const s2 = Math.max(1, Math.ceil(t2.w / e2)), i2 = s2 - 1, r2 = Math.max(0, Math.ceil(t2.h / e2) - 1), a2 = /* @__PURE__ */ new Map();
|
|
378
|
+
for (const o2 of this.maskedRegions) {
|
|
379
|
+
const c2 = Math.min(i2, Math.max(0, Math.floor(o2.x / e2))), h2 = Math.min(i2, Math.max(c2, Math.floor((o2.x + o2.w - 1) / e2))), l2 = Math.min(r2, Math.max(0, Math.floor(o2.y / e2))), d2 = Math.min(r2, Math.max(l2, Math.floor((o2.y + o2.h - 1) / e2)));
|
|
380
|
+
for (let i3 = l2; i3 <= d2; i3++) for (let r3 = c2; r3 <= h2; r3++) {
|
|
381
|
+
const o3 = i3 * s2 + r3;
|
|
382
|
+
if (!a2.has(o3)) {
|
|
383
|
+
const s3 = r3 * e2, c3 = i3 * e2;
|
|
384
|
+
a2.set(o3, { x: s3, y: c3, w: Math.min(e2, t2.w - s3), h: Math.min(e2, t2.h - c3) });
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
this.maskedRegions.length = 0;
|
|
389
|
+
for (const t3 of a2.values()) this.maskedRegions.push(t3);
|
|
390
|
+
}
|
|
391
|
+
pushMaskRegion(t2) {
|
|
392
|
+
t2 && t2.w > 0 && t2.h > 0 ? this.pushRegion(t2) : this.keyframeUnsafe = true;
|
|
393
|
+
}
|
|
394
|
+
resetMaskedRegions() {
|
|
395
|
+
this.maskedRegions.length = 0, this.maskPathBounds = null, this.keyframeUnsafe = false;
|
|
396
|
+
}
|
|
397
|
+
clipRegionsToClear(t2) {
|
|
398
|
+
if (0 === this.maskedRegions.length) return;
|
|
399
|
+
const e2 = this.getMat();
|
|
400
|
+
if (!e2) return;
|
|
401
|
+
if (!(0 === e2.b && 0 === e2.c || 0 === e2.a && 0 === e2.d)) return;
|
|
402
|
+
const n = (t3) => Number(t3) || 0, s2 = n(t2[0]), i2 = n(t2[1]), r2 = transformedBox(s2, i2, s2 + n(t2[2]), i2 + n(t2[3]), e2, 0);
|
|
403
|
+
if (!r2) return;
|
|
404
|
+
const a2 = r2.x + r2.w, o2 = r2.y + r2.h, c2 = this.maskedRegions.filter((t3) => !(t3.x >= r2.x && t3.y >= r2.y && t3.x + t3.w <= a2 && t3.y + t3.h <= o2));
|
|
405
|
+
if (c2.length !== this.maskedRegions.length) {
|
|
406
|
+
this.maskedRegions.length = 0;
|
|
407
|
+
for (const t3 of c2) this.maskedRegions.push(t3);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
emitSynthCall(t2, e2) {
|
|
411
|
+
const s2 = this.now();
|
|
412
|
+
this.sink.onOp({ t: s2, op: t2, args: this.serializeArgs(e2, s2) });
|
|
413
|
+
}
|
|
414
|
+
emitSynthSetter(t2, e2) {
|
|
415
|
+
const s2 = this.now();
|
|
416
|
+
this.sink.onOp({ t: s2, op: t2, args: [e2], setter: true });
|
|
417
|
+
}
|
|
418
|
+
emitRedactionBlock(t2) {
|
|
419
|
+
t2 && 0 !== t2.w && 0 !== t2.h && (this.emitSynthCall("save", []), this.emitSynthSetter("fillStyle", o), this.emitSynthCall("fillRect", [t2.x, t2.y, t2.w, t2.h]), this.emitSynthCall("restore", []));
|
|
420
|
+
}
|
|
421
|
+
updatePathBounds(t2, e2) {
|
|
422
|
+
if ("beginPath" === t2) return void (this.maskPathBounds = null);
|
|
423
|
+
const n = (t3) => Number(t3) || 0, ext = (t3, e3) => {
|
|
424
|
+
if (!Number.isFinite(t3) || !Number.isFinite(e3)) return;
|
|
425
|
+
const s2 = this.maskPathBounds ?? { minX: t3, minY: e3, maxX: t3, maxY: e3 };
|
|
426
|
+
s2.minX = Math.min(s2.minX, t3), s2.minY = Math.min(s2.minY, e3), s2.maxX = Math.max(s2.maxX, t3), s2.maxY = Math.max(s2.maxY, e3), this.maskPathBounds = s2;
|
|
427
|
+
};
|
|
428
|
+
switch (t2) {
|
|
429
|
+
case "moveTo":
|
|
430
|
+
case "lineTo":
|
|
431
|
+
ext(n(e2[0]), n(e2[1]));
|
|
432
|
+
break;
|
|
433
|
+
case "rect":
|
|
434
|
+
case "roundRect":
|
|
435
|
+
ext(n(e2[0]), n(e2[1])), ext(n(e2[0]) + n(e2[2]), n(e2[1]) + n(e2[3]));
|
|
436
|
+
break;
|
|
437
|
+
case "arc": {
|
|
438
|
+
const t3 = n(e2[2]);
|
|
439
|
+
ext(n(e2[0]) - t3, n(e2[1]) - t3), ext(n(e2[0]) + t3, n(e2[1]) + t3);
|
|
440
|
+
break;
|
|
441
|
+
}
|
|
442
|
+
case "ellipse": {
|
|
443
|
+
const t3 = n(e2[2]), s2 = n(e2[3]);
|
|
444
|
+
ext(n(e2[0]) - t3, n(e2[1]) - s2), ext(n(e2[0]) + t3, n(e2[1]) + s2);
|
|
445
|
+
break;
|
|
446
|
+
}
|
|
447
|
+
case "arcTo":
|
|
448
|
+
case "quadraticCurveTo":
|
|
449
|
+
ext(n(e2[0]), n(e2[1])), ext(n(e2[2]), n(e2[3]));
|
|
450
|
+
break;
|
|
451
|
+
case "bezierCurveTo":
|
|
452
|
+
ext(n(e2[0]), n(e2[1])), ext(n(e2[2]), n(e2[3])), ext(n(e2[4]), n(e2[5]));
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
shapeLocalRect(t2, e2) {
|
|
456
|
+
const n = (t3) => Number(t3) || 0;
|
|
457
|
+
if ("fillRect" === t2 || "strokeRect" === t2) return { x: n(e2[0]), y: n(e2[1]), w: n(e2[2]), h: n(e2[3]) };
|
|
458
|
+
if ("fill" === t2 || "stroke" === t2) {
|
|
459
|
+
const t3 = this.maskPathBounds;
|
|
460
|
+
return t3 ? { x: t3.minX, y: t3.minY, w: t3.maxX - t3.minX, h: t3.maxY - t3.minY } : null;
|
|
461
|
+
}
|
|
462
|
+
return "drawImage" === t2 ? this.drawImageDest(e2) : null;
|
|
463
|
+
}
|
|
464
|
+
shapeRegion(t2, e2) {
|
|
465
|
+
const n = (t3) => Number(t3) || 0;
|
|
466
|
+
if ("putImageData" === t2) {
|
|
467
|
+
const t3 = e2[0], s3 = n(t3 == null ? void 0 : t3.width), i3 = n(t3 == null ? void 0 : t3.height);
|
|
468
|
+
return s3 > 0 && i3 > 0 ? { x: n(e2[1]), y: n(e2[2]), w: s3, h: i3 } : null;
|
|
469
|
+
}
|
|
470
|
+
const s2 = this.getMat(), i2 = this.shapeLocalRect(t2, e2);
|
|
471
|
+
return s2 && i2 ? (function rectRegion(t3, e3, s3, i3, r2) {
|
|
472
|
+
return transformedBox(t3, e3, t3 + s3, e3 + i3, r2);
|
|
473
|
+
})(i2.x, i2.y, i2.w, i2.h, s2) : null;
|
|
474
|
+
}
|
|
475
|
+
drawImageDest(t2) {
|
|
476
|
+
const n = (t3) => Number(t3) || 0;
|
|
477
|
+
if (t2.length >= 9) return { x: n(t2[5]), y: n(t2[6]), w: n(t2[7]), h: n(t2[8]) };
|
|
478
|
+
if (t2.length >= 5) return { x: n(t2[1]), y: n(t2[2]), w: n(t2[3]), h: n(t2[4]) };
|
|
479
|
+
if (t2.length >= 3) {
|
|
480
|
+
const e2 = t2[0];
|
|
481
|
+
return { x: n(t2[1]), y: n(t2[2]), w: n(e2 == null ? void 0 : e2.width), h: n(e2 == null ? void 0 : e2.height) };
|
|
482
|
+
}
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
textRegionFor(t2, e2) {
|
|
486
|
+
const s2 = this.getMat();
|
|
487
|
+
if (!s2) return null;
|
|
488
|
+
const i2 = Math.max(Math.hypot(s2.a, s2.b), Math.hypot(s2.c, s2.d)) || 1, r2 = this.fontSizePx(), a2 = Math.max(256, 0.5 * r2 * i2), o2 = Math.min(Math.max(2, 0.15 * r2 * i2), a2);
|
|
489
|
+
return (function textRegion(t3, e3, s3 = 1) {
|
|
490
|
+
const i3 = textLocalBox(t3);
|
|
491
|
+
return transformedBox(i3.x0, i3.y0, i3.x1, i3.y1, e3, s3);
|
|
492
|
+
})(this.textMetrics(t2, e2), s2, o2);
|
|
493
|
+
}
|
|
494
|
+
textLocalRect(t2, e2) {
|
|
495
|
+
const s2 = textLocalBox(this.textMetrics(t2, e2));
|
|
496
|
+
return { x: s2.x0, y: s2.y0, w: s2.x1 - s2.x0, h: s2.y1 - s2.y0 };
|
|
497
|
+
}
|
|
498
|
+
textMetrics(t2, e2) {
|
|
499
|
+
const s2 = Number(e2[1]) || 0, i2 = Number(e2[2]) || 0, r2 = this.ctx;
|
|
500
|
+
let a2, o2, c2 = NaN, h2 = NaN, l2 = NaN;
|
|
501
|
+
if ("function" == typeof r2.measureText) try {
|
|
502
|
+
const e3 = r2.measureText(t2);
|
|
503
|
+
c2 = e3.width, h2 = e3.actualBoundingBoxAscent, l2 = e3.actualBoundingBoxDescent, a2 = r2.textAlign, o2 = r2.textBaseline;
|
|
504
|
+
} catch {
|
|
505
|
+
}
|
|
506
|
+
const d2 = this.fontSizePx();
|
|
507
|
+
return Number.isFinite(c2) || (c2 = t2.length * d2 * 0.6), (!Number.isFinite(h2) || h2 <= 0) && (h2 = 0.8 * d2), (!Number.isFinite(l2) || l2 < 0) && (l2 = 0.2 * d2), void 0 === a2 && "string" == typeof this.props.textAlign && (a2 = this.props.textAlign), void 0 === o2 && "string" == typeof this.props.textBaseline && (o2 = this.props.textBaseline), { width: c2, ascent: h2, descent: l2, x: s2, y: i2, align: a2, baseline: o2 };
|
|
508
|
+
}
|
|
509
|
+
fontSizePx() {
|
|
510
|
+
const t2 = this.props.font;
|
|
511
|
+
if ("string" == typeof t2) {
|
|
512
|
+
const e2 = t2.match(/(\d+(?:\.\d+)?)px/);
|
|
513
|
+
if (e2) return parseFloat(e2[1]);
|
|
514
|
+
}
|
|
515
|
+
return 12;
|
|
516
|
+
}
|
|
517
|
+
canvasSize() {
|
|
518
|
+
const t2 = this.ctx.canvas;
|
|
519
|
+
return t2 && Number(t2.width) > 0 && Number(t2.height) > 0 ? { w: Number(t2.width), h: Number(t2.height) } : null;
|
|
520
|
+
}
|
|
521
|
+
getMat() {
|
|
522
|
+
try {
|
|
523
|
+
const t2 = this.ctx.getTransform();
|
|
524
|
+
return { a: t2.a, b: t2.b, c: t2.c, d: t2.d, e: t2.e, f: t2.f };
|
|
525
|
+
} catch {
|
|
526
|
+
return null;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
snapshotState() {
|
|
530
|
+
return { stack: this.stack.map((t2) => ({ props: { ...t2.props }, transform: [...t2.transform] })), current: { props: { ...this.props }, transform: this.readTransform() } };
|
|
531
|
+
}
|
|
532
|
+
async settle() {
|
|
533
|
+
for (; this.pendingEncodes.size; ) await Promise.all([...this.pendingEncodes]);
|
|
534
|
+
}
|
|
535
|
+
pendingEncodeCount() {
|
|
536
|
+
return this.pendingEncodes.size;
|
|
537
|
+
}
|
|
538
|
+
trackEncode(t2) {
|
|
539
|
+
this.pendingEncodes.add(t2), t2.then(() => {
|
|
540
|
+
}, () => {
|
|
541
|
+
}).finally(() => this.pendingEncodes.delete(t2));
|
|
542
|
+
}
|
|
543
|
+
readTransform() {
|
|
544
|
+
const t2 = this.ctx.getTransform();
|
|
545
|
+
return [t2.a, t2.b, t2.c, t2.d, t2.e, t2.f];
|
|
546
|
+
}
|
|
547
|
+
serializeArg(t2, e2) {
|
|
548
|
+
var _a;
|
|
549
|
+
if (null === t2) return null;
|
|
550
|
+
switch (typeof t2) {
|
|
551
|
+
case "number":
|
|
552
|
+
return Number.isFinite(t2) ? t2 : 0;
|
|
553
|
+
case "string":
|
|
554
|
+
case "boolean":
|
|
555
|
+
return t2;
|
|
556
|
+
case "undefined":
|
|
557
|
+
return null;
|
|
558
|
+
case "object":
|
|
559
|
+
break;
|
|
560
|
+
default:
|
|
561
|
+
return { $: "unsupported", kind: typeof t2 };
|
|
562
|
+
}
|
|
563
|
+
const s2 = t2;
|
|
564
|
+
if (l.has(s2)) return this.serializeFactoryObject(s2, e2);
|
|
565
|
+
const i2 = /* @__PURE__ */ (function getNativePath2D() {
|
|
566
|
+
return f;
|
|
567
|
+
})();
|
|
568
|
+
return i2 && s2 instanceof i2 ? (this.sink.note("Path2D created before instrumentation — not serialized"), { $: "unsupported", kind: "Path2D" }) : Array.isArray(s2) ? { $: "arr", v: s2.map((t3) => Number(t3) || 0) } : s2 instanceof DOMMatrix || s2 instanceof DOMMatrixReadOnly ? { $: "arr", v: [s2.a, s2.b, s2.c, s2.d, s2.e, s2.f] } : s2 instanceof ImageData ? this.captureImageData(s2, e2) : (function isImageSource(t3) {
|
|
569
|
+
return "undefined" != typeof HTMLImageElement && t3 instanceof HTMLImageElement || "undefined" != typeof HTMLCanvasElement && t3 instanceof HTMLCanvasElement || "undefined" != typeof HTMLVideoElement && t3 instanceof HTMLVideoElement || "undefined" != typeof ImageBitmap && t3 instanceof ImageBitmap || "undefined" != typeof OffscreenCanvas && t3 instanceof OffscreenCanvas;
|
|
570
|
+
})(s2) ? this.captureImageSource(s2, e2) : { $: "unsupported", kind: ((_a = s2.constructor) == null ? void 0 : _a.name) ?? "object" };
|
|
571
|
+
}
|
|
572
|
+
serializeFactoryObject(t2, e2) {
|
|
573
|
+
const s2 = l.get(t2);
|
|
574
|
+
let i2 = this.objRefs.get(t2);
|
|
575
|
+
i2 || (i2 = { id: S++, emittedCalls: 0 }, this.objRefs.set(t2, i2), this.sink.onOp({ t: e2, op: "__create", create: true, args: [s2.factory, i2.id, ...s2.args.map((t3) => this.serializeArg(t3, e2))] }));
|
|
576
|
+
for (let t3 = i2.emittedCalls; t3 < s2.calls.length; t3++) {
|
|
577
|
+
const r2 = s2.calls[t3];
|
|
578
|
+
this.sink.onOp({ t: e2, op: "__objcall", objcall: true, args: [i2.id, r2.method, ...r2.args.map((t4) => this.serializeArg(t4, e2))] });
|
|
579
|
+
}
|
|
580
|
+
return i2.emittedCalls = s2.calls.length, { $: "obj", id: i2.id };
|
|
581
|
+
}
|
|
582
|
+
captureImageData(t2, e2) {
|
|
583
|
+
const s2 = b++, i2 = new ImageData(new Uint8ClampedArray(t2.data), t2.width, t2.height), r2 = { id: s2, kind: "imagedata", t: e2, bytes: 0, w: t2.width, h: t2.height };
|
|
584
|
+
return this.retainAssets && (r2.imageData = i2), this.addAsset(s2, r2), this.trackEncode(deflate(new Uint8Array(i2.data.buffer, i2.data.byteOffset, i2.data.byteLength)).then((i3) => {
|
|
585
|
+
var _a, _b;
|
|
586
|
+
r2.bytes = i3.length, this.sink.onAssetBytes(s2, i3.length, e2), (_b = (_a = this.sink).onAssetData) == null ? void 0 : _b.call(_a, { id: s2, format: "imagedata", w: t2.width, h: t2.height, t: e2 }, i3);
|
|
587
|
+
}).catch((t3) => this.sink.note(`imagedata deflate failed: ${t3.message}`))), { $: "imagedata", id: s2 };
|
|
588
|
+
}
|
|
589
|
+
captureImageSource(t2, e2) {
|
|
590
|
+
var _a, _b, _c, _d;
|
|
591
|
+
const s2 = "undefined" != typeof HTMLVideoElement && t2 instanceof HTMLVideoElement, i2 = s2 || "undefined" != typeof HTMLCanvasElement && t2 instanceof HTMLCanvasElement || "undefined" != typeof OffscreenCanvas && t2 instanceof OffscreenCanvas;
|
|
592
|
+
if (s2 && ((_b = (_a = this.sink).onVideoSource) == null ? void 0 : _b.call(_a, e2)), !i2 && this.assetBySource.has(t2)) return { $: "asset", id: this.assetBySource.get(t2) };
|
|
593
|
+
const r2 = b++;
|
|
594
|
+
i2 || this.assetBySource.set(t2, r2);
|
|
595
|
+
const a2 = { id: r2, kind: "image", t: e2, bytes: 0 };
|
|
596
|
+
if (this.addAsset(r2, a2), "dataurl" === this.assetMode) {
|
|
597
|
+
const s3 = performance.now();
|
|
598
|
+
try {
|
|
599
|
+
const { w: s4, h: i3 } = (function sourceSize(t3) {
|
|
600
|
+
if (t3 instanceof HTMLVideoElement) return { w: t3.videoWidth || 1, h: t3.videoHeight || 1 };
|
|
601
|
+
if (t3 instanceof HTMLImageElement) return { w: t3.naturalWidth || 1, h: t3.naturalHeight || 1 };
|
|
602
|
+
const e3 = t3;
|
|
603
|
+
return { w: Number(e3.width) || 1, h: Number(e3.height) || 1 };
|
|
604
|
+
})(t2), o2 = document.createElement("canvas");
|
|
605
|
+
o2.width = s4, o2.height = i3;
|
|
606
|
+
const c2 = o2.getContext("2d");
|
|
607
|
+
D.add(c2), c2.drawImage(t2, 0, 0);
|
|
608
|
+
const h2 = o2.toDataURL("image/png");
|
|
609
|
+
a2.bytes = h2.length, a2.w = s4, a2.h = i3, this.sink.onAssetBytes(r2, h2.length, e2), this.retainAssets && this.trackEncode(createImageBitmap(o2).then((t3) => {
|
|
610
|
+
a2.bitmap = t3;
|
|
611
|
+
}));
|
|
612
|
+
} catch (t3) {
|
|
613
|
+
this.sink.note(`asset capture failed: ${t3.message}`), isTaintError(t3) && ((_d = (_c = this.sink).onTaint) == null ? void 0 : _d.call(_c, e2));
|
|
614
|
+
}
|
|
615
|
+
this.cpuMs += performance.now() - s3;
|
|
616
|
+
} else {
|
|
617
|
+
const s3 = performance.now();
|
|
618
|
+
this.trackEncode(createImageBitmap(t2).then(async (t3) => {
|
|
619
|
+
var _a2, _b2;
|
|
620
|
+
const s4 = t3.width, i3 = t3.height;
|
|
621
|
+
let o2 = t3;
|
|
622
|
+
this.retainAssets && (a2.bitmap = t3, o2 = await createImageBitmap(t3));
|
|
623
|
+
const c2 = await this.encodeImage(o2);
|
|
624
|
+
a2.bytes = c2.size, a2.w = s4, a2.h = i3, this.sink.onAssetBytes(r2, c2.size, e2), c2.bytes && ((_b2 = (_a2 = this.sink).onAssetData) == null ? void 0 : _b2.call(_a2, { id: r2, format: "webp", w: s4, h: i3, t: e2 }, new Uint8Array(c2.bytes)));
|
|
625
|
+
}).catch((t3) => {
|
|
626
|
+
var _a2, _b2;
|
|
627
|
+
this.sink.note(`asset encode failed: ${t3.message}`), isTaintError(t3) && ((_b2 = (_a2 = this.sink).onTaint) == null ? void 0 : _b2.call(_a2, e2));
|
|
628
|
+
})), this.cpuMs += performance.now() - s3;
|
|
629
|
+
}
|
|
630
|
+
return { $: "asset", id: r2 };
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function isTaintError(t2) {
|
|
634
|
+
if (!t2 || "object" != typeof t2) return false;
|
|
635
|
+
if ("SecurityError" === t2.name) return true;
|
|
636
|
+
const e2 = t2.message;
|
|
637
|
+
return "string" == typeof e2 && /tainted|cross-origin|insecure/i.test(e2);
|
|
638
|
+
}
|
|
639
|
+
let E = false;
|
|
640
|
+
function patch2DProto(t2) {
|
|
641
|
+
const e2 = t2;
|
|
642
|
+
installFactoryLoggingOnProto(t2), installSharedObjectLogging();
|
|
643
|
+
for (const s2 of Object.getOwnPropertyNames(t2)) {
|
|
644
|
+
const i2 = Object.getOwnPropertyDescriptor(t2, s2);
|
|
645
|
+
if (i2) {
|
|
646
|
+
if ("function" == typeof i2.value && "constructor" !== s2) {
|
|
647
|
+
const t3 = i2.value;
|
|
648
|
+
d.includes(s2) || "getImageData" === s2 || "getTransform" === s2 || "isPointInPath" === s2 || "isPointInStroke" === s2 || "measureText" === s2 || "getLineDash" === s2 || "getContextAttributes" === s2 || "createImageData" === s2 || (e2[s2] = function(...e3) {
|
|
649
|
+
const i3 = A.get(this);
|
|
650
|
+
return i3 ? i3.recordCall(s2, e3) : I && !D.has(this) && I(this), t3.apply(this, e3);
|
|
651
|
+
});
|
|
652
|
+
} else if (i2.set && w.includes(s2)) {
|
|
653
|
+
const { get: e3, set: r2 } = i2;
|
|
654
|
+
Object.defineProperty(t2, s2, { configurable: true, get: e3, set(t3) {
|
|
655
|
+
const e4 = A.get(this);
|
|
656
|
+
e4 ? e4.recordSet(s2, t3) : I && !D.has(this) && I(this), r2.call(this, t3);
|
|
657
|
+
} });
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
exports.BufferSink = BufferSink, exports.CommandEncoder = class CommandEncoder {
|
|
663
|
+
constructor() {
|
|
664
|
+
__publicField(this, "w", new ByteWriter());
|
|
665
|
+
__publicField(this, "strings", /* @__PURE__ */ new Map());
|
|
666
|
+
__publicField(this, "lastTUs", 0);
|
|
667
|
+
__publicField(this, "ops", 0);
|
|
668
|
+
}
|
|
669
|
+
encode(t2) {
|
|
670
|
+
const e2 = Math.round(1e3 * t2.t);
|
|
671
|
+
e2 !== this.lastTUs && (this.w.u8(c.get("__frame")), this.w.varint(e2 - this.lastTUs), this.lastTUs = e2), t2.sfId && (this.w.u8(c.get("__site")), this.str(t2.sfId));
|
|
672
|
+
const s2 = c.get(t2.op);
|
|
673
|
+
void 0 === s2 ? (this.w.u8(255), this.str(t2.op)) : this.w.u8(t2.setter ? 128 | s2 : s2), this.w.varint(t2.args.length);
|
|
674
|
+
for (const e3 of t2.args) this.arg(e3);
|
|
675
|
+
this.ops++;
|
|
676
|
+
}
|
|
677
|
+
str(t2) {
|
|
678
|
+
const e2 = this.strings.get(t2);
|
|
679
|
+
if (void 0 !== e2) return this.w.u8(3), void this.w.varint(e2);
|
|
680
|
+
const s2 = this.strings.size;
|
|
681
|
+
this.strings.set(t2, s2);
|
|
682
|
+
const i2 = h.encode(t2);
|
|
683
|
+
this.w.u8(2), this.w.varint(i2.length), this.w.bytes(i2);
|
|
684
|
+
}
|
|
685
|
+
arg(t2) {
|
|
686
|
+
if (null !== t2) {
|
|
687
|
+
switch (typeof t2) {
|
|
688
|
+
case "number":
|
|
689
|
+
return void (Number.isInteger(t2) && Math.abs(t2) < 2 ** 30 ? (this.w.u8(1), this.w.varint(t2)) : (this.w.u8(0), this.w.f64(t2)));
|
|
690
|
+
case "string":
|
|
691
|
+
return void this.str(t2);
|
|
692
|
+
case "boolean":
|
|
693
|
+
return void this.w.u8(t2 ? 4 : 5);
|
|
694
|
+
}
|
|
695
|
+
if ("$" in t2) switch (t2.$) {
|
|
696
|
+
case "asset":
|
|
697
|
+
return this.w.u8(7), void this.w.varint(t2.id);
|
|
698
|
+
case "obj":
|
|
699
|
+
return this.w.u8(8), void this.w.varint(t2.id);
|
|
700
|
+
case "imagedata":
|
|
701
|
+
return this.w.u8(10), void this.w.varint(t2.id);
|
|
702
|
+
case "arr":
|
|
703
|
+
this.w.u8(9), this.w.varint(t2.v.length);
|
|
704
|
+
for (const e2 of t2.v) this.w.f64(e2);
|
|
705
|
+
return;
|
|
706
|
+
case "ta":
|
|
707
|
+
return this.w.u8(12), this.w.u8(t2.k), this.w.varint(t2.b.length), void this.w.bytes(t2.b);
|
|
708
|
+
case "unsupported":
|
|
709
|
+
return this.w.u8(11), void this.str(t2.kind);
|
|
710
|
+
}
|
|
711
|
+
this.w.u8(6);
|
|
712
|
+
} else this.w.u8(6);
|
|
713
|
+
}
|
|
714
|
+
takeBatch() {
|
|
715
|
+
return this.ops = 0, this.strings.clear(), this.lastTUs = 0, this.w.take();
|
|
716
|
+
}
|
|
717
|
+
}, exports.DEFAULT_REDACT_STYLE = a, exports.DIRTY_OP = y, exports.DiscardSink = DiscardSink, exports.REDACTION_COLOR = o, exports.TYPED_ARRAY_KINDS = m, exports.attachRecorder = function attachRecorder(t2, e2, s2, i2, r2, a2) {
|
|
718
|
+
const o2 = B.get(t2);
|
|
719
|
+
if (o2) return o2.swapSink(e2), o2;
|
|
720
|
+
let c2 = null;
|
|
721
|
+
try {
|
|
722
|
+
c2 = t2.getContext("2d");
|
|
723
|
+
} catch {
|
|
724
|
+
return null;
|
|
725
|
+
}
|
|
726
|
+
if (!c2) return null;
|
|
727
|
+
const h2 = new ContextRecorder(c2, e2, s2, i2, r2, a2);
|
|
728
|
+
return h2.bound = true, A.set(c2, h2), h2;
|
|
729
|
+
}, exports.attachRecorderToContext = function attachRecorderToContext(t2, e2, s2, i2, r2, a2) {
|
|
730
|
+
const o2 = new ContextRecorder(t2, e2, s2, i2, r2, a2);
|
|
731
|
+
return o2.bound = true, A.set(t2, o2), o2;
|
|
732
|
+
}, exports.buildFrame = function buildFrame(t2, e2) {
|
|
733
|
+
const s2 = null == e2 ? new Uint8Array(0) : e2 instanceof ArrayBuffer ? new Uint8Array(e2) : e2, i2 = x.encode(JSON.stringify({ ...t2, pLen: s2.byteLength })), r2 = new ArrayBuffer(8 + i2.length + s2.byteLength), a2 = new Uint8Array(r2);
|
|
734
|
+
return a2[0] = k[0], a2[1] = k[1], a2[2] = k[2], a2[3] = k[3], new DataView(r2).setUint32(4, i2.length, true), a2.set(i2, 8), a2.set(s2, 8 + i2.length), r2;
|
|
735
|
+
}, exports.buildMaskInputFn = function buildMaskInputFn(t2) {
|
|
736
|
+
const { baseFn: e2, unmaskSelector: s2, maskInputSelector: i2, adminMaskInputOptions: r2 } = t2;
|
|
737
|
+
return s2 || i2 ? (t3, a2) => {
|
|
738
|
+
if ("hidden" === a2.type) return "";
|
|
739
|
+
if (closestSafe(a2, s2)) return t3;
|
|
740
|
+
const o2 = (a2.type || "").toLowerCase(), c2 = (a2.tagName || "").toLowerCase(), h2 = true === r2[o2] || true === r2[c2], l2 = matchesSelectorSafe(a2, i2);
|
|
741
|
+
return h2 || l2 ? e2(t3, a2) : t3;
|
|
742
|
+
} : e2;
|
|
743
|
+
}, exports.bytesToBase64 = function bytesToBase64(t2) {
|
|
744
|
+
const e2 = t2 instanceof Uint8Array ? t2 : new Uint8Array(t2);
|
|
745
|
+
let s2 = "";
|
|
746
|
+
for (let t3 = 0; t3 < e2.length; t3 += 32768) s2 += String.fromCharCode.apply(null, e2.subarray(t3, t3 + 32768));
|
|
747
|
+
return btoa(s2);
|
|
748
|
+
}, exports.classifyCanvasPrivacy = function classifyCanvasPrivacy(t2, e2) {
|
|
749
|
+
return closestSafe(t2, e2.unmaskSelector) ? "normal" : closestSafe(t2, e2.blockSelector) || closestSafe(t2, maskCanvasSelector(e2)) ? "suppress" : e2.maskTextClass && closestSafe(t2, `.${e2.maskTextClass}`) || matchesSelectorSafe(t2, e2.maskTextSelector) || closestSafe(t2, e2.maskTextSelector) || true === e2.maskCanvasText || false !== e2.maskCanvasText && (function domTextMaskingConfigured(t3) {
|
|
750
|
+
return !(!t3.maskTextSelector && !t3.maskTextClass);
|
|
751
|
+
})(e2) ? "redact" : "normal";
|
|
752
|
+
}, exports.deflate = deflate, exports.detachRecorderFromContext = function detachRecorderFromContext(t2) {
|
|
753
|
+
A.delete(t2);
|
|
754
|
+
}, exports.getContextInfo = function getContextInfo(t2) {
|
|
755
|
+
return L.get(t2);
|
|
756
|
+
}, exports.ignore2DContext = function ignore2DContext(t2) {
|
|
757
|
+
D.add(t2);
|
|
758
|
+
}, exports.installCommandHooks = function installCommandHooks() {
|
|
759
|
+
if (E) return;
|
|
760
|
+
E = true, patch2DProto(CanvasRenderingContext2D.prototype);
|
|
761
|
+
const t2 = HTMLCanvasElement.prototype.getContext;
|
|
762
|
+
HTMLCanvasElement.prototype.getContext = function(e2, s2) {
|
|
763
|
+
const i2 = t2.call(this, e2, s2);
|
|
764
|
+
if (i2 && !L.has(this) && L.set(this, { type: e2, attrs: s2 ?? void 0 }), "2d" === e2 && i2 && P && !A.has(i2)) {
|
|
765
|
+
const t3 = new ContextRecorder(i2, new BufferSink(), P.now, P.assetMode, P.encodeImage, { retainAssets: P.retainAssets });
|
|
766
|
+
A.set(i2, t3), B.set(this, t3);
|
|
767
|
+
}
|
|
768
|
+
return i2 && O && O(this, e2), i2;
|
|
769
|
+
};
|
|
770
|
+
}, exports.installEarlyObjectLogging = function installEarlyObjectLogging() {
|
|
771
|
+
"undefined" != typeof CanvasRenderingContext2D && installFactoryLoggingOnProto(CanvasRenderingContext2D.prototype), "undefined" != typeof OffscreenCanvasRenderingContext2D && installFactoryLoggingOnProto(OffscreenCanvasRenderingContext2D.prototype), installSharedObjectLogging();
|
|
772
|
+
}, exports.isTaintError = isTaintError, exports.looksLikeCreditCard = function looksLikeCreditCard(t2) {
|
|
773
|
+
if ("string" != typeof t2) return false;
|
|
774
|
+
let e2;
|
|
775
|
+
for (s.lastIndex = 0; null !== (e2 = s.exec(t2)); ) {
|
|
776
|
+
if (passesLuhn(e2[0])) return true;
|
|
777
|
+
e2.index === s.lastIndex && s.lastIndex++;
|
|
778
|
+
}
|
|
779
|
+
return false;
|
|
780
|
+
}, exports.looksLikeSsn = function looksLikeSsn(t2) {
|
|
781
|
+
return "string" == typeof t2 && e.test(t2);
|
|
782
|
+
}, exports.makeMaskTextFn = function makeMaskTextFn(t2) {
|
|
783
|
+
return (e2, s2) => closestSafe(s2, t2) ? e2 : e2.replace(/\S/g, "*");
|
|
784
|
+
}, exports.noteCtxPendingSiteId = function noteCtxPendingSiteId(t2, e2) {
|
|
785
|
+
const s2 = A.get(t2);
|
|
786
|
+
return !!s2 && (s2.pendingSiteId = e2, true);
|
|
787
|
+
}, exports.notePreAttachMaskUsed = function notePreAttachMaskUsed(t2) {
|
|
788
|
+
t2 ? C.add(t2) : v = true;
|
|
789
|
+
}, exports.patch2DProto = patch2DProto, exports.pruneUnboundRecorders = function pruneUnboundRecorders() {
|
|
790
|
+
for (const [t2, e2] of B) e2.bound || (A.delete(e2.rawCtx), B.delete(t2));
|
|
791
|
+
}, exports.recorderForContext = function recorderForContext(t2) {
|
|
792
|
+
if (t2) return A.get(t2) ?? B.get(t2);
|
|
793
|
+
}, exports.redactCanvasText = function redactCanvasText(t2, e2, s2) {
|
|
794
|
+
return "string" != typeof t2 ? t2 : "redact" === e2 ? maskAllText(t2) : "normal" === e2 ? redactSensitiveContent(t2, s2) : t2;
|
|
795
|
+
}, exports.redactCreditCard = redactCreditCard, exports.redactDob = redactDob, exports.redactSensitiveContent = redactSensitiveContent, exports.redactSsn = redactSsn, exports.releaseAutoRecorder = function releaseAutoRecorder(t2) {
|
|
796
|
+
const e2 = B.get(t2);
|
|
797
|
+
e2 && !e2.bound && (A.delete(e2.rawCtx), B.delete(t2));
|
|
798
|
+
}, exports.resolveRedactStyle = function resolveRedactStyle(t2, e2) {
|
|
799
|
+
const s2 = t2 ?? a;
|
|
800
|
+
return e2 ? { text: e2.text ?? s2.text, shape: e2.shape ?? s2.shape } : s2;
|
|
801
|
+
}, exports.serializeTypedArray = function serializeTypedArray(t2) {
|
|
802
|
+
var _a;
|
|
803
|
+
if (t2 instanceof ArrayBuffer) return { $: "ta", k: 1, b: new Uint8Array(t2.slice(0)) };
|
|
804
|
+
const e2 = m.findIndex((e3) => t2 instanceof e3);
|
|
805
|
+
return e2 < 0 ? { $: "unsupported", kind: ((_a = t2.constructor) == null ? void 0 : _a.name) ?? "view" } : { $: "ta", k: e2, b: new Uint8Array(t2.buffer.slice(t2.byteOffset, t2.byteOffset + t2.byteLength)) };
|
|
806
|
+
}, exports.setAutoAttach = function setAutoAttach(t2) {
|
|
807
|
+
P = t2, t2 && B.clear();
|
|
808
|
+
}, exports.setContextCreatedNotifier = function setContextCreatedNotifier(t2) {
|
|
809
|
+
O = t2;
|
|
810
|
+
}, exports.setUntracked2DContextNotifier = function setUntracked2DContextNotifier(t2) {
|
|
811
|
+
I = t2;
|
|
812
|
+
}, exports.suppressReason = function suppressReason(t2, e2) {
|
|
813
|
+
if (!closestSafe(t2, e2.unmaskSelector)) return closestSafe(t2, e2.blockSelector) ? "block" : closestSafe(t2, maskCanvasSelector(e2)) ? "mask" : void 0;
|
|
814
|
+
}, exports.wasPreAttachMaskUsed = function wasPreAttachMaskUsed(t2) {
|
|
815
|
+
return !!v || !!t2 && C.has(t2);
|
|
816
|
+
};
|