@highlight-run/rrweb 2.0.4 → 2.0.7
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/dist/plugins/console-record.js +12 -454
- package/dist/plugins/console-record.min.js +1 -1
- package/dist/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.js +4 -164
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/plugins/sequential-id-record.js +1 -30
- package/dist/plugins/sequential-id-replay.js +1 -33
- package/dist/record/rrweb-record-pack.js +3 -664
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +4 -3202
- package/dist/record/rrweb-record.min.js +3 -3
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.css +1 -0
- package/dist/replay/rrweb-replay-unpack.js +5 -4914
- package/dist/replay/rrweb-replay-unpack.min.css +2 -0
- package/dist/replay/rrweb-replay-unpack.min.css.map +1 -0
- package/dist/replay/rrweb-replay-unpack.min.js +4 -4
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.css +1 -0
- package/dist/replay/rrweb-replay.js +5 -4506
- package/dist/replay/rrweb-replay.min.css +2 -0
- package/dist/replay/rrweb-replay.min.css.map +1 -0
- package/dist/replay/rrweb-replay.min.js +3 -3
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.css +1 -0
- package/dist/rrweb-all.js +16 -8877
- package/dist/rrweb-all.min.css +2 -0
- package/dist/rrweb-all.min.css.map +1 -0
- package/dist/rrweb-all.min.js +12 -12
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.css +1 -0
- package/dist/rrweb.js +6 -7546
- package/dist/rrweb.min.css +2 -0
- package/dist/rrweb.min.css.map +1 -0
- package/dist/rrweb.min.js +5 -5
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/all.css +1 -0
- package/es/rrweb/packages/rrweb/src/record/index.js +5 -2
- package/es/rrweb/packages/rrweb/src/record/mutation.js +23 -11
- package/es/rrweb/packages/rrweb/src/record/observer.js +6 -6
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +1 -1
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +2 -2
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +1 -2
- package/es/rrweb/packages/rrweb/src/utils.js +16 -23
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +283 -243
- package/lib/record/rrweb-record.js +333 -286
- package/lib/replay/rrweb-replay-unpack.css +1 -0
- package/lib/replay/rrweb-replay-unpack.js +1 -1
- package/lib/replay/rrweb-replay.css +1 -0
- package/lib/replay/rrweb-replay.js +1 -1
- package/lib/rrweb-all.css +1 -0
- package/lib/rrweb-all.js +334 -287
- package/lib/rrweb.css +1 -0
- package/lib/rrweb.js +334 -287
- package/package.json +4 -4
- package/typings/utils.d.ts +1 -1
|
@@ -1,3202 +1,4 @@
|
|
|
1
|
-
var rrwebRecord = (function () {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var NodeType;
|
|
5
|
-
(function(NodeType2) {
|
|
6
|
-
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
7
|
-
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
8
|
-
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
9
|
-
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
10
|
-
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
11
|
-
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
12
|
-
})(NodeType || (NodeType = {}));
|
|
13
|
-
function isElement(n) {
|
|
14
|
-
return n.nodeType === n.ELEMENT_NODE;
|
|
15
|
-
}
|
|
16
|
-
function isShadowRoot(n) {
|
|
17
|
-
var _a;
|
|
18
|
-
var host = (_a = n) === null || _a === void 0 ? void 0 : _a.host;
|
|
19
|
-
return Boolean(host && host.shadowRoot && host.shadowRoot === n);
|
|
20
|
-
}
|
|
21
|
-
var Mirror = function() {
|
|
22
|
-
function Mirror2() {
|
|
23
|
-
this.idNodeMap = /* @__PURE__ */ new Map();
|
|
24
|
-
this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
|
|
25
|
-
}
|
|
26
|
-
Mirror2.prototype.getId = function(n) {
|
|
27
|
-
var _a;
|
|
28
|
-
if (!n)
|
|
29
|
-
return -1;
|
|
30
|
-
var id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
|
|
31
|
-
return id !== null && id !== void 0 ? id : -1;
|
|
32
|
-
};
|
|
33
|
-
Mirror2.prototype.getNode = function(id) {
|
|
34
|
-
return this.idNodeMap.get(id) || null;
|
|
35
|
-
};
|
|
36
|
-
Mirror2.prototype.getIds = function() {
|
|
37
|
-
return Array.from(this.idNodeMap.keys());
|
|
38
|
-
};
|
|
39
|
-
Mirror2.prototype.getMeta = function(n) {
|
|
40
|
-
return this.nodeMetaMap.get(n) || null;
|
|
41
|
-
};
|
|
42
|
-
Mirror2.prototype.removeNodeFromMap = function(n) {
|
|
43
|
-
var _this = this;
|
|
44
|
-
var id = this.getId(n);
|
|
45
|
-
this.idNodeMap["delete"](id);
|
|
46
|
-
if (n.childNodes) {
|
|
47
|
-
n.childNodes.forEach(function(childNode) {
|
|
48
|
-
return _this.removeNodeFromMap(childNode);
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
Mirror2.prototype.has = function(id) {
|
|
53
|
-
return this.idNodeMap.has(id);
|
|
54
|
-
};
|
|
55
|
-
Mirror2.prototype.hasNode = function(node) {
|
|
56
|
-
return this.nodeMetaMap.has(node);
|
|
57
|
-
};
|
|
58
|
-
Mirror2.prototype.add = function(n, meta) {
|
|
59
|
-
var id = meta.id;
|
|
60
|
-
this.idNodeMap.set(id, n);
|
|
61
|
-
this.nodeMetaMap.set(n, meta);
|
|
62
|
-
};
|
|
63
|
-
Mirror2.prototype.replace = function(id, n) {
|
|
64
|
-
this.idNodeMap.set(id, n);
|
|
65
|
-
};
|
|
66
|
-
Mirror2.prototype.reset = function() {
|
|
67
|
-
this.idNodeMap = /* @__PURE__ */ new Map();
|
|
68
|
-
this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
|
|
69
|
-
};
|
|
70
|
-
return Mirror2;
|
|
71
|
-
}();
|
|
72
|
-
function createMirror() {
|
|
73
|
-
return new Mirror();
|
|
74
|
-
}
|
|
75
|
-
function maskInputValue(_a) {
|
|
76
|
-
var maskInputOptions = _a.maskInputOptions, tagName = _a.tagName, type = _a.type, value = _a.value, maskInputFn = _a.maskInputFn;
|
|
77
|
-
var text = value || "";
|
|
78
|
-
if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {
|
|
79
|
-
if (maskInputFn) {
|
|
80
|
-
text = maskInputFn(text);
|
|
81
|
-
} else {
|
|
82
|
-
text = "*".repeat(text.length);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return text;
|
|
86
|
-
}
|
|
87
|
-
var ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
|
|
88
|
-
function is2DCanvasBlank(canvas) {
|
|
89
|
-
var ctx = canvas.getContext("2d");
|
|
90
|
-
if (!ctx)
|
|
91
|
-
return true;
|
|
92
|
-
var chunkSize = 50;
|
|
93
|
-
for (var x = 0; x < canvas.width; x += chunkSize) {
|
|
94
|
-
for (var y = 0; y < canvas.height; y += chunkSize) {
|
|
95
|
-
var getImageData = ctx.getImageData;
|
|
96
|
-
var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
|
|
97
|
-
var pixelBuffer = new Uint32Array(originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
|
|
98
|
-
if (pixelBuffer.some(function(pixel) {
|
|
99
|
-
return pixel !== 0;
|
|
100
|
-
}))
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
function obfuscateText(text) {
|
|
107
|
-
text = text.replace(/[^ -~]+/g, "");
|
|
108
|
-
text = (text === null || text === void 0 ? void 0 : text.split(" ").map(function(word) {
|
|
109
|
-
return Math.random().toString(20).substr(2, word.length);
|
|
110
|
-
}).join(" ")) || "";
|
|
111
|
-
return text;
|
|
112
|
-
}
|
|
113
|
-
var _id = 1;
|
|
114
|
-
var tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
115
|
-
var IGNORED_NODE = -2;
|
|
116
|
-
function genId() {
|
|
117
|
-
return _id++;
|
|
118
|
-
}
|
|
119
|
-
function getValidTagName(element) {
|
|
120
|
-
if (element instanceof HTMLFormElement) {
|
|
121
|
-
return "form";
|
|
122
|
-
}
|
|
123
|
-
var processedTagName = element.tagName.toLowerCase().trim();
|
|
124
|
-
if (tagNameRegex.test(processedTagName)) {
|
|
125
|
-
return "div";
|
|
126
|
-
}
|
|
127
|
-
return processedTagName;
|
|
128
|
-
}
|
|
129
|
-
function getCssRulesString(s) {
|
|
130
|
-
try {
|
|
131
|
-
var rules = s.rules || s.cssRules;
|
|
132
|
-
return rules ? Array.from(rules).map(getCssRuleString).join("") : null;
|
|
133
|
-
} catch (error) {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function getCssRuleString(rule) {
|
|
138
|
-
var cssStringified = rule.cssText;
|
|
139
|
-
if (isCSSImportRule(rule)) {
|
|
140
|
-
try {
|
|
141
|
-
cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
|
|
142
|
-
} catch (_a) {
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return cssStringified;
|
|
146
|
-
}
|
|
147
|
-
function isCSSImportRule(rule) {
|
|
148
|
-
return "styleSheet" in rule;
|
|
149
|
-
}
|
|
150
|
-
function stringifyStyleSheet(sheet) {
|
|
151
|
-
return sheet.cssRules ? Array.from(sheet.cssRules).map(function(rule) {
|
|
152
|
-
return rule.cssText || "";
|
|
153
|
-
}).join("") : "";
|
|
154
|
-
}
|
|
155
|
-
function extractOrigin(url) {
|
|
156
|
-
var origin = "";
|
|
157
|
-
if (url.indexOf("//") > -1) {
|
|
158
|
-
origin = url.split("/").slice(0, 3).join("/");
|
|
159
|
-
} else {
|
|
160
|
-
origin = url.split("/")[0];
|
|
161
|
-
}
|
|
162
|
-
origin = origin.split("?")[0];
|
|
163
|
-
return origin;
|
|
164
|
-
}
|
|
165
|
-
var canvasService;
|
|
166
|
-
var canvasCtx;
|
|
167
|
-
var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
|
|
168
|
-
var RELATIVE_PATH = /^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/;
|
|
169
|
-
var DATA_URI = /^(data:)([^,]*),(.*)/i;
|
|
170
|
-
function absoluteToStylesheet(cssText, href) {
|
|
171
|
-
return (cssText || "").replace(URL_IN_CSS_REF, function(origin, quote1, path1, quote2, path2, path3) {
|
|
172
|
-
var filePath = path1 || path2 || path3;
|
|
173
|
-
var maybeQuote = quote1 || quote2 || "";
|
|
174
|
-
if (!filePath) {
|
|
175
|
-
return origin;
|
|
176
|
-
}
|
|
177
|
-
if (!RELATIVE_PATH.test(filePath)) {
|
|
178
|
-
return "url(" + maybeQuote + filePath + maybeQuote + ")";
|
|
179
|
-
}
|
|
180
|
-
if (DATA_URI.test(filePath)) {
|
|
181
|
-
return "url(" + maybeQuote + filePath + maybeQuote + ")";
|
|
182
|
-
}
|
|
183
|
-
if (filePath[0] === "/") {
|
|
184
|
-
return "url(" + maybeQuote + (extractOrigin(href) + filePath) + maybeQuote + ")";
|
|
185
|
-
}
|
|
186
|
-
var stack = href.split("/");
|
|
187
|
-
var parts = filePath.split("/");
|
|
188
|
-
stack.pop();
|
|
189
|
-
for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
|
|
190
|
-
var part = parts_1[_i];
|
|
191
|
-
if (part === ".") {
|
|
192
|
-
continue;
|
|
193
|
-
} else if (part === "..") {
|
|
194
|
-
stack.pop();
|
|
195
|
-
} else {
|
|
196
|
-
stack.push(part);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return "url(" + maybeQuote + stack.join("/") + maybeQuote + ")";
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
203
|
-
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
204
|
-
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
205
|
-
if (attributeValue.trim() === "") {
|
|
206
|
-
return attributeValue;
|
|
207
|
-
}
|
|
208
|
-
var pos = 0;
|
|
209
|
-
function collectCharacters(regEx) {
|
|
210
|
-
var chars;
|
|
211
|
-
var match = regEx.exec(attributeValue.substring(pos));
|
|
212
|
-
if (match) {
|
|
213
|
-
chars = match[0];
|
|
214
|
-
pos += chars.length;
|
|
215
|
-
return chars;
|
|
216
|
-
}
|
|
217
|
-
return "";
|
|
218
|
-
}
|
|
219
|
-
var output = [];
|
|
220
|
-
while (true) {
|
|
221
|
-
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
222
|
-
if (pos >= attributeValue.length) {
|
|
223
|
-
break;
|
|
224
|
-
}
|
|
225
|
-
var url = collectCharacters(SRCSET_NOT_SPACES);
|
|
226
|
-
if (url.slice(-1) === ",") {
|
|
227
|
-
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
228
|
-
output.push(url);
|
|
229
|
-
} else {
|
|
230
|
-
var descriptorsStr = "";
|
|
231
|
-
url = absoluteToDoc(doc, url);
|
|
232
|
-
var inParens = false;
|
|
233
|
-
while (true) {
|
|
234
|
-
var c = attributeValue.charAt(pos);
|
|
235
|
-
if (c === "") {
|
|
236
|
-
output.push((url + descriptorsStr).trim());
|
|
237
|
-
break;
|
|
238
|
-
} else if (!inParens) {
|
|
239
|
-
if (c === ",") {
|
|
240
|
-
pos += 1;
|
|
241
|
-
output.push((url + descriptorsStr).trim());
|
|
242
|
-
break;
|
|
243
|
-
} else if (c === "(") {
|
|
244
|
-
inParens = true;
|
|
245
|
-
}
|
|
246
|
-
} else {
|
|
247
|
-
if (c === ")") {
|
|
248
|
-
inParens = false;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
descriptorsStr += c;
|
|
252
|
-
pos += 1;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
return output.join(", ");
|
|
257
|
-
}
|
|
258
|
-
function absoluteToDoc(doc, attributeValue) {
|
|
259
|
-
if (!attributeValue || attributeValue.trim() === "") {
|
|
260
|
-
return attributeValue;
|
|
261
|
-
}
|
|
262
|
-
var a = doc.createElement("a");
|
|
263
|
-
a.href = attributeValue;
|
|
264
|
-
return a.href;
|
|
265
|
-
}
|
|
266
|
-
function isSVGElement(el) {
|
|
267
|
-
return Boolean(el.tagName === "svg" || el.ownerSVGElement);
|
|
268
|
-
}
|
|
269
|
-
function getHref() {
|
|
270
|
-
var a = document.createElement("a");
|
|
271
|
-
a.href = "";
|
|
272
|
-
return a.href;
|
|
273
|
-
}
|
|
274
|
-
function transformAttribute(doc, tagName, name, value) {
|
|
275
|
-
if (name === "src" || name === "href" && value) {
|
|
276
|
-
return absoluteToDoc(doc, value);
|
|
277
|
-
} else if (name === "xlink:href" && value && value[0] !== "#") {
|
|
278
|
-
return absoluteToDoc(doc, value);
|
|
279
|
-
} else if (name === "background" && value && (tagName === "table" || tagName === "td" || tagName === "th")) {
|
|
280
|
-
return absoluteToDoc(doc, value);
|
|
281
|
-
} else if (name === "srcset" && value) {
|
|
282
|
-
return getAbsoluteSrcsetString(doc, value);
|
|
283
|
-
} else if (name === "style" && value) {
|
|
284
|
-
return absoluteToStylesheet(value, getHref());
|
|
285
|
-
} else if (tagName === "object" && name === "data" && value) {
|
|
286
|
-
return absoluteToDoc(doc, value);
|
|
287
|
-
} else {
|
|
288
|
-
return value;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
292
|
-
if (typeof blockClass === "string") {
|
|
293
|
-
if (element.classList.contains(blockClass)) {
|
|
294
|
-
return true;
|
|
295
|
-
}
|
|
296
|
-
} else {
|
|
297
|
-
for (var eIndex = 0; eIndex < element.classList.length; eIndex++) {
|
|
298
|
-
var className = element.classList[eIndex];
|
|
299
|
-
if (blockClass.test(className)) {
|
|
300
|
-
return true;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
if (blockSelector) {
|
|
305
|
-
return element.matches(blockSelector);
|
|
306
|
-
}
|
|
307
|
-
return false;
|
|
308
|
-
}
|
|
309
|
-
function needMaskingText(node, maskTextClass, maskTextSelector) {
|
|
310
|
-
if (!node) {
|
|
311
|
-
return false;
|
|
312
|
-
}
|
|
313
|
-
if (node.nodeType === node.ELEMENT_NODE) {
|
|
314
|
-
if (typeof maskTextClass === "string") {
|
|
315
|
-
if (node.classList.contains(maskTextClass)) {
|
|
316
|
-
return true;
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
for (var eIndex = 0; eIndex < node.classList.length; eIndex++) {
|
|
320
|
-
var className = node.classList[eIndex];
|
|
321
|
-
if (maskTextClass.test(className)) {
|
|
322
|
-
return true;
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
if (maskTextSelector) {
|
|
327
|
-
if (node.matches(maskTextSelector)) {
|
|
328
|
-
return true;
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
|
|
332
|
-
}
|
|
333
|
-
if (node.nodeType === node.TEXT_NODE) {
|
|
334
|
-
return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
|
|
335
|
-
}
|
|
336
|
-
return needMaskingText(node.parentNode, maskTextClass, maskTextSelector);
|
|
337
|
-
}
|
|
338
|
-
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
339
|
-
var win = iframeEl.contentWindow;
|
|
340
|
-
if (!win) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
var fired = false;
|
|
344
|
-
var readyState;
|
|
345
|
-
try {
|
|
346
|
-
readyState = win.document.readyState;
|
|
347
|
-
} catch (error) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
if (readyState !== "complete") {
|
|
351
|
-
var timer_1 = setTimeout(function() {
|
|
352
|
-
if (!fired) {
|
|
353
|
-
listener();
|
|
354
|
-
fired = true;
|
|
355
|
-
}
|
|
356
|
-
}, iframeLoadTimeout);
|
|
357
|
-
iframeEl.addEventListener("load", function() {
|
|
358
|
-
clearTimeout(timer_1);
|
|
359
|
-
fired = true;
|
|
360
|
-
listener();
|
|
361
|
-
});
|
|
362
|
-
return;
|
|
363
|
-
}
|
|
364
|
-
var blankUrl = "about:blank";
|
|
365
|
-
if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
366
|
-
setTimeout(listener, 0);
|
|
367
|
-
return;
|
|
368
|
-
}
|
|
369
|
-
iframeEl.addEventListener("load", listener);
|
|
370
|
-
}
|
|
371
|
-
function isStylesheetLoaded(link) {
|
|
372
|
-
if (!link.getAttribute("href"))
|
|
373
|
-
return true;
|
|
374
|
-
return link.sheet !== null;
|
|
375
|
-
}
|
|
376
|
-
function onceStylesheetLoaded(link, listener, iframeLoadTimeout) {
|
|
377
|
-
var fired = false;
|
|
378
|
-
var styleSheetLoaded;
|
|
379
|
-
try {
|
|
380
|
-
styleSheetLoaded = link.sheet;
|
|
381
|
-
} catch (error) {
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
if (styleSheetLoaded)
|
|
385
|
-
return;
|
|
386
|
-
var timer = setTimeout(function() {
|
|
387
|
-
if (!fired) {
|
|
388
|
-
listener();
|
|
389
|
-
fired = true;
|
|
390
|
-
}
|
|
391
|
-
}, iframeLoadTimeout);
|
|
392
|
-
link.addEventListener("load", function() {
|
|
393
|
-
clearTimeout(timer);
|
|
394
|
-
fired = true;
|
|
395
|
-
listener();
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
function serializeNode(n, options) {
|
|
399
|
-
var _a;
|
|
400
|
-
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, inlineStylesheet = options.inlineStylesheet, _b = options.maskInputOptions, maskInputOptions = _b === void 0 ? {} : _b, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, _c = options.dataURLOptions, dataURLOptions = _c === void 0 ? {} : _c, inlineImages = options.inlineImages, recordCanvas = options.recordCanvas, keepIframeSrcFn = options.keepIframeSrcFn, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
401
|
-
var rootId;
|
|
402
|
-
if (mirror.getMeta(doc)) {
|
|
403
|
-
var docId = mirror.getId(doc);
|
|
404
|
-
rootId = docId === 1 ? void 0 : docId;
|
|
405
|
-
}
|
|
406
|
-
switch (n.nodeType) {
|
|
407
|
-
case n.DOCUMENT_NODE:
|
|
408
|
-
if (n.compatMode !== "CSS1Compat") {
|
|
409
|
-
return {
|
|
410
|
-
type: NodeType.Document,
|
|
411
|
-
childNodes: [],
|
|
412
|
-
compatMode: n.compatMode,
|
|
413
|
-
rootId
|
|
414
|
-
};
|
|
415
|
-
} else {
|
|
416
|
-
return {
|
|
417
|
-
type: NodeType.Document,
|
|
418
|
-
childNodes: [],
|
|
419
|
-
rootId
|
|
420
|
-
};
|
|
421
|
-
}
|
|
422
|
-
case n.DOCUMENT_TYPE_NODE:
|
|
423
|
-
return {
|
|
424
|
-
type: NodeType.DocumentType,
|
|
425
|
-
name: n.name,
|
|
426
|
-
publicId: n.publicId,
|
|
427
|
-
systemId: n.systemId,
|
|
428
|
-
rootId
|
|
429
|
-
};
|
|
430
|
-
case n.ELEMENT_NODE:
|
|
431
|
-
var needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
432
|
-
var tagName = getValidTagName(n);
|
|
433
|
-
var attributes_1 = {};
|
|
434
|
-
var len = n.attributes.length;
|
|
435
|
-
for (var i = 0; i < len; i++) {
|
|
436
|
-
var attr = n.attributes[i];
|
|
437
|
-
attributes_1[attr.name] = transformAttribute(doc, tagName, attr.name, attr.value);
|
|
438
|
-
}
|
|
439
|
-
if (tagName === "link" && inlineStylesheet) {
|
|
440
|
-
var stylesheet = Array.from(doc.styleSheets).find(function(s) {
|
|
441
|
-
return s.href === n.href;
|
|
442
|
-
});
|
|
443
|
-
var cssText = null;
|
|
444
|
-
if (stylesheet) {
|
|
445
|
-
cssText = getCssRulesString(stylesheet);
|
|
446
|
-
}
|
|
447
|
-
if (cssText) {
|
|
448
|
-
delete attributes_1.rel;
|
|
449
|
-
delete attributes_1.href;
|
|
450
|
-
attributes_1._cssText = absoluteToStylesheet(cssText, stylesheet.href);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
if (tagName === "style" && n.sheet && !(n.innerText || n.textContent || "").trim().length) {
|
|
454
|
-
var cssText = getCssRulesString(n.sheet);
|
|
455
|
-
if (cssText) {
|
|
456
|
-
attributes_1._cssText = absoluteToStylesheet(cssText, getHref());
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
if (tagName === "input" || tagName === "textarea" || tagName === "select") {
|
|
460
|
-
var value = n.value;
|
|
461
|
-
if (attributes_1.type !== "radio" && attributes_1.type !== "checkbox" && attributes_1.type !== "submit" && attributes_1.type !== "button" && value) {
|
|
462
|
-
attributes_1.value = maskInputValue({
|
|
463
|
-
type: attributes_1.type,
|
|
464
|
-
tagName,
|
|
465
|
-
value,
|
|
466
|
-
maskInputOptions,
|
|
467
|
-
maskInputFn
|
|
468
|
-
});
|
|
469
|
-
} else if (n.checked) {
|
|
470
|
-
attributes_1.checked = n.checked;
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
if (tagName === "option") {
|
|
474
|
-
if (n.selected && !maskInputOptions["select"]) {
|
|
475
|
-
attributes_1.selected = true;
|
|
476
|
-
} else {
|
|
477
|
-
delete attributes_1.selected;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
if (tagName === "canvas" && recordCanvas) {
|
|
481
|
-
if (n.__context === "2d") {
|
|
482
|
-
if (!is2DCanvasBlank(n)) {
|
|
483
|
-
attributes_1.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
484
|
-
}
|
|
485
|
-
} else if (!("__context" in n)) {
|
|
486
|
-
var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
487
|
-
var blankCanvas = document.createElement("canvas");
|
|
488
|
-
blankCanvas.width = n.width;
|
|
489
|
-
blankCanvas.height = n.height;
|
|
490
|
-
var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
491
|
-
if (canvasDataURL !== blankCanvasDataURL) {
|
|
492
|
-
attributes_1.rr_dataURL = canvasDataURL;
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
if (tagName === "img" && inlineImages) {
|
|
497
|
-
if (!canvasService) {
|
|
498
|
-
canvasService = doc.createElement("canvas");
|
|
499
|
-
canvasCtx = canvasService.getContext("2d");
|
|
500
|
-
}
|
|
501
|
-
var image_1 = n;
|
|
502
|
-
var oldValue_1 = image_1.crossOrigin;
|
|
503
|
-
image_1.crossOrigin = "anonymous";
|
|
504
|
-
var recordInlineImage = function() {
|
|
505
|
-
try {
|
|
506
|
-
canvasService.width = image_1.naturalWidth;
|
|
507
|
-
canvasService.height = image_1.naturalHeight;
|
|
508
|
-
canvasCtx.drawImage(image_1, 0, 0);
|
|
509
|
-
attributes_1.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
|
|
510
|
-
} catch (err) {
|
|
511
|
-
console.warn("Cannot inline img src=" + image_1.currentSrc + "! Error: " + err);
|
|
512
|
-
}
|
|
513
|
-
oldValue_1 ? attributes_1.crossOrigin = oldValue_1 : image_1.removeAttribute("crossorigin");
|
|
514
|
-
};
|
|
515
|
-
if (image_1.complete && image_1.naturalWidth !== 0)
|
|
516
|
-
recordInlineImage();
|
|
517
|
-
else
|
|
518
|
-
image_1.onload = recordInlineImage;
|
|
519
|
-
}
|
|
520
|
-
if (tagName === "audio" || tagName === "video") {
|
|
521
|
-
attributes_1.rr_mediaState = n.paused ? "paused" : "played";
|
|
522
|
-
attributes_1.rr_mediaCurrentTime = n.currentTime;
|
|
523
|
-
}
|
|
524
|
-
if (n.scrollLeft) {
|
|
525
|
-
attributes_1.rr_scrollLeft = n.scrollLeft;
|
|
526
|
-
}
|
|
527
|
-
if (n.scrollTop) {
|
|
528
|
-
attributes_1.rr_scrollTop = n.scrollTop;
|
|
529
|
-
}
|
|
530
|
-
if (needBlock || tagName === "img" && enableStrictPrivacy) {
|
|
531
|
-
var _d = n.getBoundingClientRect(), width = _d.width, height = _d.height;
|
|
532
|
-
attributes_1 = {
|
|
533
|
-
"class": attributes_1["class"],
|
|
534
|
-
rr_width: width + "px",
|
|
535
|
-
rr_height: height + "px"
|
|
536
|
-
};
|
|
537
|
-
needBlock = true;
|
|
538
|
-
}
|
|
539
|
-
if (tagName === "iframe" && !keepIframeSrcFn(attributes_1.src)) {
|
|
540
|
-
if (!n.contentDocument) {
|
|
541
|
-
attributes_1.rr_src = attributes_1.src;
|
|
542
|
-
}
|
|
543
|
-
delete attributes_1.src;
|
|
544
|
-
}
|
|
545
|
-
return {
|
|
546
|
-
type: NodeType.Element,
|
|
547
|
-
tagName,
|
|
548
|
-
attributes: attributes_1,
|
|
549
|
-
childNodes: [],
|
|
550
|
-
isSVG: isSVGElement(n) || void 0,
|
|
551
|
-
needBlock,
|
|
552
|
-
rootId
|
|
553
|
-
};
|
|
554
|
-
case n.TEXT_NODE:
|
|
555
|
-
var parentTagName = n.parentNode && n.parentNode.tagName;
|
|
556
|
-
var textContent = n.textContent;
|
|
557
|
-
var isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
558
|
-
var isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
559
|
-
var textContentHandled = false;
|
|
560
|
-
if (isStyle && textContent) {
|
|
561
|
-
try {
|
|
562
|
-
if (n.nextSibling || n.previousSibling) {
|
|
563
|
-
} else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
|
|
564
|
-
textContent = stringifyStyleSheet(n.parentNode.sheet);
|
|
565
|
-
}
|
|
566
|
-
} catch (err) {
|
|
567
|
-
console.warn("Cannot get CSS styles from text's parentNode. Error: " + err, n);
|
|
568
|
-
}
|
|
569
|
-
textContent = absoluteToStylesheet(textContent, getHref());
|
|
570
|
-
textContentHandled = true;
|
|
571
|
-
}
|
|
572
|
-
if (isScript) {
|
|
573
|
-
textContent = "SCRIPT_PLACEHOLDER";
|
|
574
|
-
textContentHandled = true;
|
|
575
|
-
} else if (parentTagName === "NOSCRIPT") {
|
|
576
|
-
textContent = "";
|
|
577
|
-
textContentHandled = true;
|
|
578
|
-
}
|
|
579
|
-
if (!isStyle && !isScript && needMaskingText(n, maskTextClass, maskTextSelector) && textContent) {
|
|
580
|
-
textContent = maskTextFn ? maskTextFn(textContent) : textContent.replace(/[\S]/g, "*");
|
|
581
|
-
}
|
|
582
|
-
if (enableStrictPrivacy && !textContentHandled && parentTagName) {
|
|
583
|
-
var IGNORE_TAG_NAMES = /* @__PURE__ */ new Set([
|
|
584
|
-
"HEAD",
|
|
585
|
-
"TITLE",
|
|
586
|
-
"STYLE",
|
|
587
|
-
"SCRIPT",
|
|
588
|
-
"HTML",
|
|
589
|
-
"BODY",
|
|
590
|
-
"NOSCRIPT"
|
|
591
|
-
]);
|
|
592
|
-
if (!IGNORE_TAG_NAMES.has(parentTagName) && textContent) {
|
|
593
|
-
textContent = obfuscateText(textContent);
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
return {
|
|
597
|
-
type: NodeType.Text,
|
|
598
|
-
textContent: textContent || "",
|
|
599
|
-
isStyle,
|
|
600
|
-
rootId
|
|
601
|
-
};
|
|
602
|
-
case n.CDATA_SECTION_NODE:
|
|
603
|
-
return {
|
|
604
|
-
type: NodeType.CDATA,
|
|
605
|
-
textContent: "",
|
|
606
|
-
rootId
|
|
607
|
-
};
|
|
608
|
-
case n.COMMENT_NODE:
|
|
609
|
-
return {
|
|
610
|
-
type: NodeType.Comment,
|
|
611
|
-
textContent: n.textContent || "",
|
|
612
|
-
rootId
|
|
613
|
-
};
|
|
614
|
-
default:
|
|
615
|
-
return false;
|
|
616
|
-
}
|
|
617
|
-
}
|
|
618
|
-
function lowerIfExists(maybeAttr) {
|
|
619
|
-
if (maybeAttr === void 0) {
|
|
620
|
-
return "";
|
|
621
|
-
} else {
|
|
622
|
-
return maybeAttr.toLowerCase();
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
626
|
-
if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
|
|
627
|
-
return true;
|
|
628
|
-
} else if (sn.type === NodeType.Element) {
|
|
629
|
-
if (slimDOMOptions.script && (sn.tagName === "script" || sn.tagName === "link" && sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && sn.attributes.href.endsWith(".js"))) {
|
|
630
|
-
return true;
|
|
631
|
-
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
|
|
632
|
-
return true;
|
|
633
|
-
} else if (sn.tagName === "meta") {
|
|
634
|
-
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
635
|
-
return true;
|
|
636
|
-
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
637
|
-
return true;
|
|
638
|
-
} else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
|
|
639
|
-
return true;
|
|
640
|
-
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
641
|
-
return true;
|
|
642
|
-
} else if (slimDOMOptions.headMetaAuthorship && (lowerIfExists(sn.attributes.name) === "author" || lowerIfExists(sn.attributes.name) === "generator" || lowerIfExists(sn.attributes.name) === "framework" || lowerIfExists(sn.attributes.name) === "publisher" || lowerIfExists(sn.attributes.name) === "progid" || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
643
|
-
return true;
|
|
644
|
-
} else if (slimDOMOptions.headMetaVerification && (lowerIfExists(sn.attributes.name) === "google-site-verification" || lowerIfExists(sn.attributes.name) === "yandex-verification" || lowerIfExists(sn.attributes.name) === "csrf-token" || lowerIfExists(sn.attributes.name) === "p:domain_verify" || lowerIfExists(sn.attributes.name) === "verify-v1" || lowerIfExists(sn.attributes.name) === "verification" || lowerIfExists(sn.attributes.name) === "shopify-checkout-api-token")) {
|
|
645
|
-
return true;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
}
|
|
649
|
-
return false;
|
|
650
|
-
}
|
|
651
|
-
function serializeNodeWithId(n, options) {
|
|
652
|
-
var doc = options.doc, mirror = options.mirror, blockClass = options.blockClass, blockSelector = options.blockSelector, maskTextClass = options.maskTextClass, maskTextSelector = options.maskTextSelector, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.inlineStylesheet, inlineStylesheet = _b === void 0 ? true : _b, _c = options.maskInputOptions, maskInputOptions = _c === void 0 ? {} : _c, maskTextFn = options.maskTextFn, maskInputFn = options.maskInputFn, slimDOMOptions = options.slimDOMOptions, _d = options.dataURLOptions, dataURLOptions = _d === void 0 ? {} : _d, _e = options.inlineImages, inlineImages = _e === void 0 ? false : _e, _f = options.recordCanvas, recordCanvas = _f === void 0 ? false : _f, onSerialize = options.onSerialize, onIframeLoad = options.onIframeLoad, _g = options.iframeLoadTimeout, iframeLoadTimeout = _g === void 0 ? 5e3 : _g, onStylesheetLoad = options.onStylesheetLoad, _h = options.stylesheetLoadTimeout, stylesheetLoadTimeout = _h === void 0 ? 5e3 : _h, _j = options.keepIframeSrcFn, keepIframeSrcFn = _j === void 0 ? function() {
|
|
653
|
-
return false;
|
|
654
|
-
} : _j, enableStrictPrivacy = options.enableStrictPrivacy;
|
|
655
|
-
var _k = options.preserveWhiteSpace, preserveWhiteSpace = _k === void 0 ? true : _k;
|
|
656
|
-
var _serializedNode = serializeNode(n, {
|
|
657
|
-
doc,
|
|
658
|
-
mirror,
|
|
659
|
-
blockClass,
|
|
660
|
-
blockSelector,
|
|
661
|
-
maskTextClass,
|
|
662
|
-
maskTextSelector,
|
|
663
|
-
inlineStylesheet,
|
|
664
|
-
maskInputOptions,
|
|
665
|
-
maskTextFn,
|
|
666
|
-
maskInputFn,
|
|
667
|
-
dataURLOptions,
|
|
668
|
-
inlineImages,
|
|
669
|
-
recordCanvas,
|
|
670
|
-
keepIframeSrcFn,
|
|
671
|
-
enableStrictPrivacy
|
|
672
|
-
});
|
|
673
|
-
if (!_serializedNode) {
|
|
674
|
-
console.warn(n, "not serialized");
|
|
675
|
-
return null;
|
|
676
|
-
}
|
|
677
|
-
var id;
|
|
678
|
-
if (mirror.hasNode(n)) {
|
|
679
|
-
id = mirror.getId(n);
|
|
680
|
-
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
681
|
-
id = IGNORED_NODE;
|
|
682
|
-
} else {
|
|
683
|
-
id = genId();
|
|
684
|
-
}
|
|
685
|
-
if (id === IGNORED_NODE) {
|
|
686
|
-
return null;
|
|
687
|
-
}
|
|
688
|
-
var serializedNode = Object.assign(_serializedNode, { id });
|
|
689
|
-
mirror.add(n, serializedNode);
|
|
690
|
-
if (onSerialize) {
|
|
691
|
-
onSerialize(n);
|
|
692
|
-
}
|
|
693
|
-
var recordChild = !skipChild;
|
|
694
|
-
if (serializedNode.type === NodeType.Element) {
|
|
695
|
-
recordChild = recordChild && !serializedNode.needBlock;
|
|
696
|
-
if (serializedNode.needBlock && serializedNode.tagName === "img") {
|
|
697
|
-
var clone = n.cloneNode();
|
|
698
|
-
clone.src = "";
|
|
699
|
-
mirror.add(clone, serializedNode);
|
|
700
|
-
}
|
|
701
|
-
if (serializedNode.tagName === "link") {
|
|
702
|
-
var clone = n.cloneNode();
|
|
703
|
-
clone.href = "";
|
|
704
|
-
clone.innerText = serializedNode.attributes._cssText;
|
|
705
|
-
mirror.add(clone, serializedNode);
|
|
706
|
-
}
|
|
707
|
-
delete serializedNode.needBlock;
|
|
708
|
-
if (n.shadowRoot)
|
|
709
|
-
serializedNode.isShadowHost = true;
|
|
710
|
-
}
|
|
711
|
-
if ((serializedNode.type === NodeType.Document || serializedNode.type === NodeType.Element) && recordChild) {
|
|
712
|
-
if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType.Element && serializedNode.tagName === "head") {
|
|
713
|
-
preserveWhiteSpace = false;
|
|
714
|
-
}
|
|
715
|
-
var bypassOptions = {
|
|
716
|
-
doc,
|
|
717
|
-
mirror,
|
|
718
|
-
blockClass,
|
|
719
|
-
blockSelector,
|
|
720
|
-
maskTextClass,
|
|
721
|
-
maskTextSelector,
|
|
722
|
-
skipChild,
|
|
723
|
-
inlineStylesheet,
|
|
724
|
-
maskInputOptions,
|
|
725
|
-
maskTextFn,
|
|
726
|
-
maskInputFn,
|
|
727
|
-
slimDOMOptions,
|
|
728
|
-
dataURLOptions,
|
|
729
|
-
inlineImages,
|
|
730
|
-
recordCanvas,
|
|
731
|
-
preserveWhiteSpace,
|
|
732
|
-
onSerialize,
|
|
733
|
-
onIframeLoad,
|
|
734
|
-
iframeLoadTimeout,
|
|
735
|
-
onStylesheetLoad,
|
|
736
|
-
stylesheetLoadTimeout,
|
|
737
|
-
keepIframeSrcFn,
|
|
738
|
-
enableStrictPrivacy
|
|
739
|
-
};
|
|
740
|
-
for (var _i = 0, _l = Array.from(n.childNodes); _i < _l.length; _i++) {
|
|
741
|
-
var childN = _l[_i];
|
|
742
|
-
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
743
|
-
if (serializedChildNode) {
|
|
744
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
if (isElement(n) && n.shadowRoot) {
|
|
748
|
-
for (var _m = 0, _o = Array.from(n.shadowRoot.childNodes); _m < _o.length; _m++) {
|
|
749
|
-
var childN = _o[_m];
|
|
750
|
-
var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
751
|
-
if (serializedChildNode) {
|
|
752
|
-
serializedChildNode.isShadow = true;
|
|
753
|
-
serializedNode.childNodes.push(serializedChildNode);
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
if (n.parentNode && isShadowRoot(n.parentNode)) {
|
|
759
|
-
serializedNode.isShadow = true;
|
|
760
|
-
}
|
|
761
|
-
if (serializedNode.type === NodeType.Element && serializedNode.tagName === "iframe") {
|
|
762
|
-
onceIframeLoaded(n, function() {
|
|
763
|
-
var iframeDoc = n.contentDocument;
|
|
764
|
-
if (iframeDoc && onIframeLoad) {
|
|
765
|
-
var serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
766
|
-
doc: iframeDoc,
|
|
767
|
-
mirror,
|
|
768
|
-
blockClass,
|
|
769
|
-
blockSelector,
|
|
770
|
-
maskTextClass,
|
|
771
|
-
maskTextSelector,
|
|
772
|
-
skipChild: false,
|
|
773
|
-
inlineStylesheet,
|
|
774
|
-
maskInputOptions,
|
|
775
|
-
maskTextFn,
|
|
776
|
-
maskInputFn,
|
|
777
|
-
slimDOMOptions,
|
|
778
|
-
dataURLOptions,
|
|
779
|
-
inlineImages,
|
|
780
|
-
recordCanvas,
|
|
781
|
-
preserveWhiteSpace,
|
|
782
|
-
onSerialize,
|
|
783
|
-
onIframeLoad,
|
|
784
|
-
iframeLoadTimeout,
|
|
785
|
-
keepIframeSrcFn,
|
|
786
|
-
enableStrictPrivacy
|
|
787
|
-
});
|
|
788
|
-
if (serializedIframeNode) {
|
|
789
|
-
onIframeLoad(n, serializedIframeNode);
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
}, iframeLoadTimeout);
|
|
793
|
-
}
|
|
794
|
-
if (serializedNode.type === NodeType.Element && serializedNode.tagName === "link" && serializedNode.attributes.rel === "stylesheet") {
|
|
795
|
-
onceStylesheetLoaded(n, function() {
|
|
796
|
-
if (onStylesheetLoad) {
|
|
797
|
-
var serializedLinkNode = serializeNodeWithId(n, {
|
|
798
|
-
doc,
|
|
799
|
-
mirror,
|
|
800
|
-
blockClass,
|
|
801
|
-
blockSelector,
|
|
802
|
-
maskTextClass,
|
|
803
|
-
maskTextSelector,
|
|
804
|
-
skipChild: false,
|
|
805
|
-
inlineStylesheet,
|
|
806
|
-
maskInputOptions,
|
|
807
|
-
maskTextFn,
|
|
808
|
-
maskInputFn,
|
|
809
|
-
slimDOMOptions,
|
|
810
|
-
dataURLOptions,
|
|
811
|
-
inlineImages,
|
|
812
|
-
recordCanvas,
|
|
813
|
-
preserveWhiteSpace,
|
|
814
|
-
onSerialize,
|
|
815
|
-
onIframeLoad,
|
|
816
|
-
onStylesheetLoad,
|
|
817
|
-
iframeLoadTimeout,
|
|
818
|
-
keepIframeSrcFn,
|
|
819
|
-
enableStrictPrivacy
|
|
820
|
-
});
|
|
821
|
-
if (serializedLinkNode) {
|
|
822
|
-
onStylesheetLoad(n, serializedLinkNode);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
}, stylesheetLoadTimeout);
|
|
826
|
-
if (isStylesheetLoaded(n) === false)
|
|
827
|
-
return null;
|
|
828
|
-
}
|
|
829
|
-
return serializedNode;
|
|
830
|
-
}
|
|
831
|
-
function snapshot(n, options) {
|
|
832
|
-
var _a = options || {}, _b = _a.mirror, mirror = _b === void 0 ? new Mirror() : _b, _c = _a.blockClass, blockClass = _c === void 0 ? "highlight-block" : _c, _d = _a.blockSelector, blockSelector = _d === void 0 ? null : _d, _e = _a.maskTextClass, maskTextClass = _e === void 0 ? "highlight-mask" : _e, _f = _a.maskTextSelector, maskTextSelector = _f === void 0 ? null : _f, _g = _a.inlineStylesheet, inlineStylesheet = _g === void 0 ? true : _g, _h = _a.inlineImages, inlineImages = _h === void 0 ? false : _h, _j = _a.recordCanvas, recordCanvas = _j === void 0 ? false : _j, _k = _a.maskAllInputs, maskAllInputs = _k === void 0 ? false : _k, maskTextFn = _a.maskTextFn, maskInputFn = _a.maskInputFn, _l = _a.slimDOM, slimDOM = _l === void 0 ? false : _l, dataURLOptions = _a.dataURLOptions, preserveWhiteSpace = _a.preserveWhiteSpace, onSerialize = _a.onSerialize, onIframeLoad = _a.onIframeLoad, iframeLoadTimeout = _a.iframeLoadTimeout, onStylesheetLoad = _a.onStylesheetLoad, stylesheetLoadTimeout = _a.stylesheetLoadTimeout, _m = _a.keepIframeSrcFn, keepIframeSrcFn = _m === void 0 ? function() {
|
|
833
|
-
return false;
|
|
834
|
-
} : _m, _o = _a.enableStrictPrivacy, enableStrictPrivacy = _o === void 0 ? false : _o;
|
|
835
|
-
var maskInputOptions = maskAllInputs === true ? {
|
|
836
|
-
color: true,
|
|
837
|
-
date: true,
|
|
838
|
-
"datetime-local": true,
|
|
839
|
-
email: true,
|
|
840
|
-
month: true,
|
|
841
|
-
number: true,
|
|
842
|
-
range: true,
|
|
843
|
-
search: true,
|
|
844
|
-
tel: true,
|
|
845
|
-
text: true,
|
|
846
|
-
time: true,
|
|
847
|
-
url: true,
|
|
848
|
-
week: true,
|
|
849
|
-
textarea: true,
|
|
850
|
-
select: true,
|
|
851
|
-
password: true
|
|
852
|
-
} : maskAllInputs === false ? {
|
|
853
|
-
password: true
|
|
854
|
-
} : maskAllInputs;
|
|
855
|
-
var slimDOMOptions = slimDOM === true || slimDOM === "all" ? {
|
|
856
|
-
script: true,
|
|
857
|
-
comment: true,
|
|
858
|
-
headFavicon: true,
|
|
859
|
-
headWhitespace: true,
|
|
860
|
-
headMetaDescKeywords: slimDOM === "all",
|
|
861
|
-
headMetaSocial: true,
|
|
862
|
-
headMetaRobots: true,
|
|
863
|
-
headMetaHttpEquiv: true,
|
|
864
|
-
headMetaAuthorship: true,
|
|
865
|
-
headMetaVerification: true
|
|
866
|
-
} : slimDOM === false ? {} : slimDOM;
|
|
867
|
-
return serializeNodeWithId(n, {
|
|
868
|
-
doc: n,
|
|
869
|
-
mirror,
|
|
870
|
-
blockClass,
|
|
871
|
-
blockSelector,
|
|
872
|
-
maskTextClass,
|
|
873
|
-
maskTextSelector,
|
|
874
|
-
skipChild: false,
|
|
875
|
-
inlineStylesheet,
|
|
876
|
-
maskInputOptions,
|
|
877
|
-
maskTextFn,
|
|
878
|
-
maskInputFn,
|
|
879
|
-
slimDOMOptions,
|
|
880
|
-
dataURLOptions,
|
|
881
|
-
inlineImages,
|
|
882
|
-
recordCanvas,
|
|
883
|
-
preserveWhiteSpace,
|
|
884
|
-
onSerialize,
|
|
885
|
-
onIframeLoad,
|
|
886
|
-
iframeLoadTimeout,
|
|
887
|
-
onStylesheetLoad,
|
|
888
|
-
stylesheetLoadTimeout,
|
|
889
|
-
keepIframeSrcFn,
|
|
890
|
-
enableStrictPrivacy
|
|
891
|
-
});
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
function on(type, fn, target = document) {
|
|
895
|
-
const options = { capture: true, passive: true };
|
|
896
|
-
target.addEventListener(type, fn, options);
|
|
897
|
-
return () => target.removeEventListener(type, fn, options);
|
|
898
|
-
}
|
|
899
|
-
const DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";
|
|
900
|
-
let _mirror = {
|
|
901
|
-
map: {},
|
|
902
|
-
getId() {
|
|
903
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
904
|
-
return -1;
|
|
905
|
-
},
|
|
906
|
-
getNode() {
|
|
907
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
908
|
-
return null;
|
|
909
|
-
},
|
|
910
|
-
removeNodeFromMap() {
|
|
911
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
912
|
-
},
|
|
913
|
-
has() {
|
|
914
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
915
|
-
return false;
|
|
916
|
-
},
|
|
917
|
-
reset() {
|
|
918
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
|
-
if (typeof window !== "undefined" && window.Proxy && window.Reflect) {
|
|
922
|
-
_mirror = new Proxy(_mirror, {
|
|
923
|
-
get(target, prop, receiver) {
|
|
924
|
-
if (prop === "map") {
|
|
925
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
926
|
-
}
|
|
927
|
-
return Reflect.get(target, prop, receiver);
|
|
928
|
-
}
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
function throttle(func, wait, options = {}) {
|
|
932
|
-
let timeout = null;
|
|
933
|
-
let previous = 0;
|
|
934
|
-
return function(arg) {
|
|
935
|
-
const now = Date.now();
|
|
936
|
-
if (!previous && options.leading === false) {
|
|
937
|
-
previous = now;
|
|
938
|
-
}
|
|
939
|
-
const remaining = wait - (now - previous);
|
|
940
|
-
const context = this;
|
|
941
|
-
const args = arguments;
|
|
942
|
-
if (remaining <= 0 || remaining > wait) {
|
|
943
|
-
if (timeout) {
|
|
944
|
-
clearTimeout(timeout);
|
|
945
|
-
timeout = null;
|
|
946
|
-
}
|
|
947
|
-
previous = now;
|
|
948
|
-
func.apply(context, args);
|
|
949
|
-
} else if (!timeout && options.trailing !== false) {
|
|
950
|
-
timeout = setTimeout(() => {
|
|
951
|
-
previous = options.leading === false ? 0 : Date.now();
|
|
952
|
-
timeout = null;
|
|
953
|
-
func.apply(context, args);
|
|
954
|
-
}, remaining);
|
|
955
|
-
}
|
|
956
|
-
};
|
|
957
|
-
}
|
|
958
|
-
function hookSetter(target, key, d, isRevoked, win = window) {
|
|
959
|
-
const original = win.Object.getOwnPropertyDescriptor(target, key);
|
|
960
|
-
win.Object.defineProperty(target, key, isRevoked ? d : {
|
|
961
|
-
set(value) {
|
|
962
|
-
setTimeout(() => {
|
|
963
|
-
d.set.call(this, value);
|
|
964
|
-
}, 0);
|
|
965
|
-
if (original && original.set) {
|
|
966
|
-
original.set.call(this, value);
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
});
|
|
970
|
-
return () => hookSetter(target, key, original || {}, true);
|
|
971
|
-
}
|
|
972
|
-
function patch(source, name, replacement) {
|
|
973
|
-
try {
|
|
974
|
-
if (!(name in source)) {
|
|
975
|
-
return () => {
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
const original = source[name];
|
|
979
|
-
const wrapped = replacement(original);
|
|
980
|
-
if (typeof wrapped === "function") {
|
|
981
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
982
|
-
Object.defineProperties(wrapped, {
|
|
983
|
-
__rrweb_original__: {
|
|
984
|
-
enumerable: false,
|
|
985
|
-
value: original
|
|
986
|
-
}
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
source[name] = wrapped;
|
|
990
|
-
return () => {
|
|
991
|
-
source[name] = original;
|
|
992
|
-
};
|
|
993
|
-
} catch (e) {
|
|
994
|
-
return () => {
|
|
995
|
-
};
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
function getWindowHeight() {
|
|
999
|
-
return window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body && document.body.clientHeight;
|
|
1000
|
-
}
|
|
1001
|
-
function getWindowWidth() {
|
|
1002
|
-
return window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body && document.body.clientWidth;
|
|
1003
|
-
}
|
|
1004
|
-
const isCanvasNode = (node) => {
|
|
1005
|
-
try {
|
|
1006
|
-
if (node instanceof HTMLElement) {
|
|
1007
|
-
return node.tagName === "CANVAS";
|
|
1008
|
-
}
|
|
1009
|
-
} catch (e) {
|
|
1010
|
-
return false;
|
|
1011
|
-
}
|
|
1012
|
-
return false;
|
|
1013
|
-
};
|
|
1014
|
-
function isBlocked(node, blockClass) {
|
|
1015
|
-
if (!node) {
|
|
1016
|
-
return false;
|
|
1017
|
-
}
|
|
1018
|
-
if (node.nodeType === node.ELEMENT_NODE) {
|
|
1019
|
-
let needBlock = false;
|
|
1020
|
-
if (typeof blockClass === "string") {
|
|
1021
|
-
if (node.closest !== void 0) {
|
|
1022
|
-
return node.closest("." + blockClass) !== null;
|
|
1023
|
-
} else {
|
|
1024
|
-
needBlock = node.classList.contains(blockClass);
|
|
1025
|
-
}
|
|
1026
|
-
} else {
|
|
1027
|
-
node.classList.forEach((className) => {
|
|
1028
|
-
if (blockClass.test(className)) {
|
|
1029
|
-
needBlock = true;
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
return needBlock || isBlocked(node.parentNode, blockClass);
|
|
1034
|
-
}
|
|
1035
|
-
if (node.nodeType === node.TEXT_NODE) {
|
|
1036
|
-
return isBlocked(node.parentNode, blockClass);
|
|
1037
|
-
}
|
|
1038
|
-
return isBlocked(node.parentNode, blockClass);
|
|
1039
|
-
}
|
|
1040
|
-
function isSerialized(n, mirror) {
|
|
1041
|
-
return mirror.getId(n) !== -1;
|
|
1042
|
-
}
|
|
1043
|
-
function isIgnored(n, mirror) {
|
|
1044
|
-
return mirror.getId(n) === IGNORED_NODE;
|
|
1045
|
-
}
|
|
1046
|
-
function isAncestorRemoved(target, mirror) {
|
|
1047
|
-
if (isShadowRoot(target)) {
|
|
1048
|
-
return false;
|
|
1049
|
-
}
|
|
1050
|
-
const id = mirror.getId(target);
|
|
1051
|
-
if (!mirror.has(id)) {
|
|
1052
|
-
return true;
|
|
1053
|
-
}
|
|
1054
|
-
if (target.parentNode && target.parentNode.nodeType === target.DOCUMENT_NODE) {
|
|
1055
|
-
return false;
|
|
1056
|
-
}
|
|
1057
|
-
if (!target.parentNode) {
|
|
1058
|
-
return true;
|
|
1059
|
-
}
|
|
1060
|
-
return isAncestorRemoved(target.parentNode, mirror);
|
|
1061
|
-
}
|
|
1062
|
-
function isTouchEvent(event) {
|
|
1063
|
-
return Boolean(event.changedTouches);
|
|
1064
|
-
}
|
|
1065
|
-
function polyfill(win = window) {
|
|
1066
|
-
if ("NodeList" in win && !win.NodeList.prototype.forEach) {
|
|
1067
|
-
win.NodeList.prototype.forEach = Array.prototype.forEach;
|
|
1068
|
-
}
|
|
1069
|
-
if ("DOMTokenList" in win && !win.DOMTokenList.prototype.forEach) {
|
|
1070
|
-
win.DOMTokenList.prototype.forEach = Array.prototype.forEach;
|
|
1071
|
-
}
|
|
1072
|
-
if (!Node.prototype.contains) {
|
|
1073
|
-
Node.prototype.contains = function contains(node) {
|
|
1074
|
-
if (!(0 in arguments)) {
|
|
1075
|
-
throw new TypeError("1 argument is required");
|
|
1076
|
-
}
|
|
1077
|
-
do {
|
|
1078
|
-
if (this === node) {
|
|
1079
|
-
return true;
|
|
1080
|
-
}
|
|
1081
|
-
} while (node = node && node.parentNode);
|
|
1082
|
-
return false;
|
|
1083
|
-
};
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
function isSerializedIframe(n, mirror) {
|
|
1087
|
-
return Boolean(n.nodeName === "IFRAME" && mirror.getMeta(n));
|
|
1088
|
-
}
|
|
1089
|
-
function isSerializedStylesheet(n, mirror) {
|
|
1090
|
-
return Boolean(n.nodeName === "LINK" && n.nodeType === n.ELEMENT_NODE && n.getAttribute && n.getAttribute("rel") === "stylesheet" && mirror.getMeta(n));
|
|
1091
|
-
}
|
|
1092
|
-
function hasShadowRoot(n) {
|
|
1093
|
-
return Boolean(n == null ? void 0 : n.shadowRoot);
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
1097
|
-
EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
1098
|
-
EventType2[EventType2["Load"] = 1] = "Load";
|
|
1099
|
-
EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
|
|
1100
|
-
EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
1101
|
-
EventType2[EventType2["Meta"] = 4] = "Meta";
|
|
1102
|
-
EventType2[EventType2["Custom"] = 5] = "Custom";
|
|
1103
|
-
EventType2[EventType2["Plugin"] = 6] = "Plugin";
|
|
1104
|
-
return EventType2;
|
|
1105
|
-
})(EventType || {});
|
|
1106
|
-
var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
|
|
1107
|
-
IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
|
|
1108
|
-
IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
|
|
1109
|
-
IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
|
|
1110
|
-
IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
|
|
1111
|
-
IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
|
|
1112
|
-
IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
|
|
1113
|
-
IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
|
|
1114
|
-
IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
|
|
1115
|
-
IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
1116
|
-
IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
|
|
1117
|
-
IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
|
|
1118
|
-
IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
|
|
1119
|
-
IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
|
|
1120
|
-
IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
1121
|
-
return IncrementalSource2;
|
|
1122
|
-
})(IncrementalSource || {});
|
|
1123
|
-
var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
|
|
1124
|
-
MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
|
|
1125
|
-
MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
|
|
1126
|
-
MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
|
|
1127
|
-
MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
|
|
1128
|
-
MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
|
|
1129
|
-
MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
|
|
1130
|
-
MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
|
|
1131
|
-
MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
|
|
1132
|
-
MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
1133
|
-
MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
|
|
1134
|
-
MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
|
|
1135
|
-
return MouseInteractions2;
|
|
1136
|
-
})(MouseInteractions || {});
|
|
1137
|
-
var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
|
|
1138
|
-
CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
|
|
1139
|
-
CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
|
|
1140
|
-
CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
|
|
1141
|
-
return CanvasContext2;
|
|
1142
|
-
})(CanvasContext || {});
|
|
1143
|
-
var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
|
|
1144
|
-
MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";
|
|
1145
|
-
MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";
|
|
1146
|
-
MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";
|
|
1147
|
-
MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";
|
|
1148
|
-
return MediaInteractions2;
|
|
1149
|
-
})(MediaInteractions || {});
|
|
1150
|
-
|
|
1151
|
-
function isNodeInLinkedList(n) {
|
|
1152
|
-
return "__ln" in n;
|
|
1153
|
-
}
|
|
1154
|
-
class DoubleLinkedList {
|
|
1155
|
-
constructor() {
|
|
1156
|
-
this.length = 0;
|
|
1157
|
-
this.head = null;
|
|
1158
|
-
}
|
|
1159
|
-
get(position) {
|
|
1160
|
-
if (position >= this.length) {
|
|
1161
|
-
throw new Error("Position outside of list range");
|
|
1162
|
-
}
|
|
1163
|
-
let current = this.head;
|
|
1164
|
-
for (let index = 0; index < position; index++) {
|
|
1165
|
-
current = (current == null ? void 0 : current.next) || null;
|
|
1166
|
-
}
|
|
1167
|
-
return current;
|
|
1168
|
-
}
|
|
1169
|
-
addNode(n) {
|
|
1170
|
-
const node = {
|
|
1171
|
-
value: n,
|
|
1172
|
-
previous: null,
|
|
1173
|
-
next: null
|
|
1174
|
-
};
|
|
1175
|
-
n.__ln = node;
|
|
1176
|
-
if (n.previousSibling && isNodeInLinkedList(n.previousSibling)) {
|
|
1177
|
-
const current = n.previousSibling.__ln.next;
|
|
1178
|
-
node.next = current;
|
|
1179
|
-
node.previous = n.previousSibling.__ln;
|
|
1180
|
-
n.previousSibling.__ln.next = node;
|
|
1181
|
-
if (current) {
|
|
1182
|
-
current.previous = node;
|
|
1183
|
-
}
|
|
1184
|
-
} else if (n.nextSibling && isNodeInLinkedList(n.nextSibling) && n.nextSibling.__ln.previous) {
|
|
1185
|
-
const current = n.nextSibling.__ln.previous;
|
|
1186
|
-
node.previous = current;
|
|
1187
|
-
node.next = n.nextSibling.__ln;
|
|
1188
|
-
n.nextSibling.__ln.previous = node;
|
|
1189
|
-
if (current) {
|
|
1190
|
-
current.next = node;
|
|
1191
|
-
}
|
|
1192
|
-
} else {
|
|
1193
|
-
if (this.head) {
|
|
1194
|
-
this.head.previous = node;
|
|
1195
|
-
}
|
|
1196
|
-
node.next = this.head;
|
|
1197
|
-
this.head = node;
|
|
1198
|
-
}
|
|
1199
|
-
this.length++;
|
|
1200
|
-
}
|
|
1201
|
-
removeNode(n) {
|
|
1202
|
-
const current = n.__ln;
|
|
1203
|
-
if (!this.head) {
|
|
1204
|
-
return;
|
|
1205
|
-
}
|
|
1206
|
-
if (!current.previous) {
|
|
1207
|
-
this.head = current.next;
|
|
1208
|
-
if (this.head) {
|
|
1209
|
-
this.head.previous = null;
|
|
1210
|
-
}
|
|
1211
|
-
} else {
|
|
1212
|
-
current.previous.next = current.next;
|
|
1213
|
-
if (current.next) {
|
|
1214
|
-
current.next.previous = current.previous;
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
if (n.__ln) {
|
|
1218
|
-
delete n.__ln;
|
|
1219
|
-
}
|
|
1220
|
-
this.length--;
|
|
1221
|
-
}
|
|
1222
|
-
}
|
|
1223
|
-
const moveKey = (id, parentId) => `${id}@${parentId}`;
|
|
1224
|
-
class MutationBuffer {
|
|
1225
|
-
constructor() {
|
|
1226
|
-
this.frozen = false;
|
|
1227
|
-
this.locked = false;
|
|
1228
|
-
this.texts = [];
|
|
1229
|
-
this.attributes = [];
|
|
1230
|
-
this.removes = [];
|
|
1231
|
-
this.mapRemoves = [];
|
|
1232
|
-
this.movedMap = {};
|
|
1233
|
-
this.addedSet = /* @__PURE__ */ new Set();
|
|
1234
|
-
this.movedSet = /* @__PURE__ */ new Set();
|
|
1235
|
-
this.droppedSet = /* @__PURE__ */ new Set();
|
|
1236
|
-
this.processMutations = (mutations) => {
|
|
1237
|
-
mutations.forEach(this.processMutation);
|
|
1238
|
-
this.emit();
|
|
1239
|
-
};
|
|
1240
|
-
this.emit = () => {
|
|
1241
|
-
if (this.frozen || this.locked) {
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
const adds = [];
|
|
1245
|
-
const addList = new DoubleLinkedList();
|
|
1246
|
-
const getNextId = (n) => {
|
|
1247
|
-
let ns = n;
|
|
1248
|
-
let nextId = IGNORED_NODE;
|
|
1249
|
-
while (nextId === IGNORED_NODE) {
|
|
1250
|
-
ns = ns && ns.nextSibling;
|
|
1251
|
-
nextId = ns && this.mirror.getId(ns);
|
|
1252
|
-
}
|
|
1253
|
-
return nextId;
|
|
1254
|
-
};
|
|
1255
|
-
const pushAdd = (n) => {
|
|
1256
|
-
var _a, _b, _c, _d, _e;
|
|
1257
|
-
const shadowHost = n.getRootNode ? (_a = n.getRootNode()) == null ? void 0 : _a.host : null;
|
|
1258
|
-
let rootShadowHost = shadowHost;
|
|
1259
|
-
while ((_c = (_b = rootShadowHost == null ? void 0 : rootShadowHost.getRootNode) == null ? void 0 : _b.call(rootShadowHost)) == null ? void 0 : _c.host)
|
|
1260
|
-
rootShadowHost = ((_e = (_d = rootShadowHost == null ? void 0 : rootShadowHost.getRootNode) == null ? void 0 : _d.call(rootShadowHost)) == null ? void 0 : _e.host) || null;
|
|
1261
|
-
const notInDoc = !this.doc.contains(n) && (!rootShadowHost || !this.doc.contains(rootShadowHost));
|
|
1262
|
-
if (!n.parentNode || notInDoc) {
|
|
1263
|
-
return;
|
|
1264
|
-
}
|
|
1265
|
-
const parentId = isShadowRoot(n.parentNode) ? this.mirror.getId(shadowHost) : this.mirror.getId(n.parentNode);
|
|
1266
|
-
const nextId = getNextId(n);
|
|
1267
|
-
if (parentId === -1 || nextId === -1) {
|
|
1268
|
-
return addList.addNode(n);
|
|
1269
|
-
}
|
|
1270
|
-
const sn = serializeNodeWithId(n, {
|
|
1271
|
-
doc: this.doc,
|
|
1272
|
-
mirror: this.mirror,
|
|
1273
|
-
blockClass: this.blockClass,
|
|
1274
|
-
blockSelector: this.blockSelector,
|
|
1275
|
-
maskTextClass: this.maskTextClass,
|
|
1276
|
-
maskTextSelector: this.maskTextSelector,
|
|
1277
|
-
skipChild: true,
|
|
1278
|
-
inlineStylesheet: this.inlineStylesheet,
|
|
1279
|
-
maskInputOptions: this.maskInputOptions,
|
|
1280
|
-
maskTextFn: this.maskTextFn,
|
|
1281
|
-
maskInputFn: this.maskInputFn,
|
|
1282
|
-
slimDOMOptions: this.slimDOMOptions,
|
|
1283
|
-
recordCanvas: this.recordCanvas,
|
|
1284
|
-
inlineImages: this.inlineImages,
|
|
1285
|
-
enableStrictPrivacy: this.enableStrictPrivacy,
|
|
1286
|
-
onSerialize: (currentN) => {
|
|
1287
|
-
if (isSerializedIframe(currentN, this.mirror)) {
|
|
1288
|
-
this.iframeManager.addIframe(currentN);
|
|
1289
|
-
}
|
|
1290
|
-
if (isSerializedStylesheet(currentN, this.mirror)) {
|
|
1291
|
-
this.stylesheetManager.addStylesheet(currentN);
|
|
1292
|
-
}
|
|
1293
|
-
if (hasShadowRoot(n)) {
|
|
1294
|
-
this.shadowDomManager.addShadowRoot(n.shadowRoot, document);
|
|
1295
|
-
}
|
|
1296
|
-
},
|
|
1297
|
-
onIframeLoad: (iframe, childSn) => {
|
|
1298
|
-
this.iframeManager.attachIframe(iframe, childSn, this.mirror);
|
|
1299
|
-
this.shadowDomManager.observeAttachShadow(iframe);
|
|
1300
|
-
},
|
|
1301
|
-
onStylesheetLoad: (link, childSn) => {
|
|
1302
|
-
this.stylesheetManager.attachStylesheet(link, childSn, this.mirror);
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
if (sn) {
|
|
1306
|
-
adds.push({
|
|
1307
|
-
parentId,
|
|
1308
|
-
nextId,
|
|
1309
|
-
node: sn
|
|
1310
|
-
});
|
|
1311
|
-
}
|
|
1312
|
-
};
|
|
1313
|
-
while (this.mapRemoves.length) {
|
|
1314
|
-
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
1315
|
-
}
|
|
1316
|
-
for (const n of Array.from(this.movedSet.values())) {
|
|
1317
|
-
if (isParentRemoved(this.removes, n, this.mirror) && !this.movedSet.has(n.parentNode)) {
|
|
1318
|
-
continue;
|
|
1319
|
-
}
|
|
1320
|
-
pushAdd(n);
|
|
1321
|
-
}
|
|
1322
|
-
for (const n of Array.from(this.addedSet.values())) {
|
|
1323
|
-
if (!isAncestorInSet(this.droppedSet, n) && !isParentRemoved(this.removes, n, this.mirror)) {
|
|
1324
|
-
pushAdd(n);
|
|
1325
|
-
} else if (isAncestorInSet(this.movedSet, n)) {
|
|
1326
|
-
pushAdd(n);
|
|
1327
|
-
} else {
|
|
1328
|
-
this.droppedSet.add(n);
|
|
1329
|
-
}
|
|
1330
|
-
}
|
|
1331
|
-
let candidate = null;
|
|
1332
|
-
while (addList.length) {
|
|
1333
|
-
let node = null;
|
|
1334
|
-
if (candidate) {
|
|
1335
|
-
const parentId = this.mirror.getId(candidate.value.parentNode);
|
|
1336
|
-
const nextId = getNextId(candidate.value);
|
|
1337
|
-
if (parentId !== -1 && nextId !== -1) {
|
|
1338
|
-
node = candidate;
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
if (!node) {
|
|
1342
|
-
for (let index = addList.length - 1; index >= 0; index--) {
|
|
1343
|
-
const _node = addList.get(index);
|
|
1344
|
-
if (_node) {
|
|
1345
|
-
const parentId = this.mirror.getId(_node.value.parentNode);
|
|
1346
|
-
const nextId = getNextId(_node.value);
|
|
1347
|
-
if (parentId !== -1 && nextId !== -1) {
|
|
1348
|
-
node = _node;
|
|
1349
|
-
break;
|
|
1350
|
-
}
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
}
|
|
1354
|
-
if (!node) {
|
|
1355
|
-
while (addList.head) {
|
|
1356
|
-
addList.removeNode(addList.head.value);
|
|
1357
|
-
}
|
|
1358
|
-
break;
|
|
1359
|
-
}
|
|
1360
|
-
candidate = node.previous;
|
|
1361
|
-
addList.removeNode(node.value);
|
|
1362
|
-
pushAdd(node.value);
|
|
1363
|
-
}
|
|
1364
|
-
const payload = {
|
|
1365
|
-
texts: this.texts.map((text) => {
|
|
1366
|
-
let value = text.value;
|
|
1367
|
-
if (this.enableStrictPrivacy && value) {
|
|
1368
|
-
value = obfuscateText(value);
|
|
1369
|
-
}
|
|
1370
|
-
return {
|
|
1371
|
-
id: this.mirror.getId(text.node),
|
|
1372
|
-
value
|
|
1373
|
-
};
|
|
1374
|
-
}).filter((text) => this.mirror.has(text.id)),
|
|
1375
|
-
attributes: this.attributes.map((attribute) => ({
|
|
1376
|
-
id: this.mirror.getId(attribute.node),
|
|
1377
|
-
attributes: attribute.attributes
|
|
1378
|
-
})).filter((attribute) => this.mirror.has(attribute.id)),
|
|
1379
|
-
removes: this.removes,
|
|
1380
|
-
adds
|
|
1381
|
-
};
|
|
1382
|
-
if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {
|
|
1383
|
-
return;
|
|
1384
|
-
}
|
|
1385
|
-
this.texts = [];
|
|
1386
|
-
this.attributes = [];
|
|
1387
|
-
this.removes = [];
|
|
1388
|
-
this.addedSet = /* @__PURE__ */ new Set();
|
|
1389
|
-
this.movedSet = /* @__PURE__ */ new Set();
|
|
1390
|
-
this.droppedSet = /* @__PURE__ */ new Set();
|
|
1391
|
-
this.movedMap = {};
|
|
1392
|
-
this.mutationCb(payload);
|
|
1393
|
-
};
|
|
1394
|
-
this.processMutation = (m) => {
|
|
1395
|
-
if (isIgnored(m.target, this.mirror)) {
|
|
1396
|
-
return;
|
|
1397
|
-
}
|
|
1398
|
-
switch (m.type) {
|
|
1399
|
-
case "characterData": {
|
|
1400
|
-
const value = m.target.textContent;
|
|
1401
|
-
if (!isBlocked(m.target, this.blockClass) && value !== m.oldValue) {
|
|
1402
|
-
this.texts.push({
|
|
1403
|
-
value: needMaskingText(m.target, this.maskTextClass, this.maskTextSelector) && value ? this.maskTextFn ? this.maskTextFn(value) : value.replace(/[\S]/g, "*") : value,
|
|
1404
|
-
node: m.target
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
break;
|
|
1408
|
-
}
|
|
1409
|
-
case "attributes": {
|
|
1410
|
-
const target = m.target;
|
|
1411
|
-
let value = m.target.getAttribute(m.attributeName);
|
|
1412
|
-
if (m.attributeName === "value") {
|
|
1413
|
-
value = maskInputValue({
|
|
1414
|
-
maskInputOptions: this.maskInputOptions,
|
|
1415
|
-
tagName: m.target.tagName,
|
|
1416
|
-
type: m.target.getAttribute("type"),
|
|
1417
|
-
value,
|
|
1418
|
-
maskInputFn: this.maskInputFn
|
|
1419
|
-
});
|
|
1420
|
-
}
|
|
1421
|
-
if (isBlocked(m.target, this.blockClass) || value === m.oldValue) {
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
1424
|
-
let item = this.attributes.find((a) => a.node === m.target);
|
|
1425
|
-
if (!item) {
|
|
1426
|
-
item = {
|
|
1427
|
-
node: m.target,
|
|
1428
|
-
attributes: {}
|
|
1429
|
-
};
|
|
1430
|
-
this.attributes.push(item);
|
|
1431
|
-
}
|
|
1432
|
-
if (m.attributeName === "style") {
|
|
1433
|
-
const old = this.doc.createElement("span");
|
|
1434
|
-
if (m.oldValue) {
|
|
1435
|
-
old.setAttribute("style", m.oldValue);
|
|
1436
|
-
}
|
|
1437
|
-
if (item.attributes.style === void 0 || item.attributes.style === null) {
|
|
1438
|
-
item.attributes.style = {};
|
|
1439
|
-
}
|
|
1440
|
-
const styleObj = item.attributes.style;
|
|
1441
|
-
for (const pname of Array.from(target.style)) {
|
|
1442
|
-
const newValue = target.style.getPropertyValue(pname);
|
|
1443
|
-
const newPriority = target.style.getPropertyPriority(pname);
|
|
1444
|
-
if (newValue !== old.style.getPropertyValue(pname) || newPriority !== old.style.getPropertyPriority(pname)) {
|
|
1445
|
-
if (newPriority === "") {
|
|
1446
|
-
styleObj[pname] = newValue;
|
|
1447
|
-
} else {
|
|
1448
|
-
styleObj[pname] = [newValue, newPriority];
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
}
|
|
1452
|
-
for (const pname of Array.from(old.style)) {
|
|
1453
|
-
if (target.style.getPropertyValue(pname) === "") {
|
|
1454
|
-
styleObj[pname] = false;
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
} else {
|
|
1458
|
-
const tagName = m.target.tagName;
|
|
1459
|
-
if (tagName === "INPUT") {
|
|
1460
|
-
const node = m.target;
|
|
1461
|
-
if (node.type === "password") {
|
|
1462
|
-
item.attributes["value"] = "*".repeat(node.value.length);
|
|
1463
|
-
break;
|
|
1464
|
-
}
|
|
1465
|
-
}
|
|
1466
|
-
item.attributes[m.attributeName] = transformAttribute(this.doc, m.target.tagName, m.attributeName, value);
|
|
1467
|
-
}
|
|
1468
|
-
break;
|
|
1469
|
-
}
|
|
1470
|
-
case "childList": {
|
|
1471
|
-
m.addedNodes.forEach((n) => this.genAdds(n, m.target));
|
|
1472
|
-
m.removedNodes.forEach((n) => {
|
|
1473
|
-
const nodeId = this.mirror.getId(n);
|
|
1474
|
-
const parentId = isShadowRoot(m.target) ? this.mirror.getId(m.target.host) : this.mirror.getId(m.target);
|
|
1475
|
-
if (isBlocked(m.target, this.blockClass) || isIgnored(n, this.mirror) || !isSerialized(n, this.mirror)) {
|
|
1476
|
-
return;
|
|
1477
|
-
}
|
|
1478
|
-
if (this.addedSet.has(n)) {
|
|
1479
|
-
deepDelete(this.addedSet, n);
|
|
1480
|
-
this.droppedSet.add(n);
|
|
1481
|
-
} else if (this.addedSet.has(m.target) && nodeId === -1) ; else if (isAncestorRemoved(m.target, this.mirror)) ; else if (this.movedSet.has(n) && this.movedMap[moveKey(nodeId, parentId)]) {
|
|
1482
|
-
deepDelete(this.movedSet, n);
|
|
1483
|
-
} else {
|
|
1484
|
-
this.removes.push({
|
|
1485
|
-
parentId,
|
|
1486
|
-
id: nodeId,
|
|
1487
|
-
isShadow: isShadowRoot(m.target) ? true : void 0
|
|
1488
|
-
});
|
|
1489
|
-
}
|
|
1490
|
-
this.mapRemoves.push(n);
|
|
1491
|
-
});
|
|
1492
|
-
break;
|
|
1493
|
-
}
|
|
1494
|
-
}
|
|
1495
|
-
};
|
|
1496
|
-
this.genAdds = (n, target) => {
|
|
1497
|
-
if (target && isBlocked(target, this.blockClass)) {
|
|
1498
|
-
return;
|
|
1499
|
-
}
|
|
1500
|
-
if (this.mirror.getMeta(n)) {
|
|
1501
|
-
if (isIgnored(n, this.mirror)) {
|
|
1502
|
-
return;
|
|
1503
|
-
}
|
|
1504
|
-
this.movedSet.add(n);
|
|
1505
|
-
let targetId = null;
|
|
1506
|
-
if (target && this.mirror.getMeta(target)) {
|
|
1507
|
-
targetId = this.mirror.getId(target);
|
|
1508
|
-
}
|
|
1509
|
-
if (targetId && targetId !== -1) {
|
|
1510
|
-
this.movedMap[moveKey(this.mirror.getId(n), targetId)] = true;
|
|
1511
|
-
}
|
|
1512
|
-
} else {
|
|
1513
|
-
this.addedSet.add(n);
|
|
1514
|
-
this.droppedSet.delete(n);
|
|
1515
|
-
}
|
|
1516
|
-
if (!isBlocked(n, this.blockClass))
|
|
1517
|
-
n.childNodes.forEach((childN) => this.genAdds(childN));
|
|
1518
|
-
};
|
|
1519
|
-
}
|
|
1520
|
-
init(options) {
|
|
1521
|
-
[
|
|
1522
|
-
"mutationCb",
|
|
1523
|
-
"blockClass",
|
|
1524
|
-
"blockSelector",
|
|
1525
|
-
"maskTextClass",
|
|
1526
|
-
"maskTextSelector",
|
|
1527
|
-
"inlineStylesheet",
|
|
1528
|
-
"maskInputOptions",
|
|
1529
|
-
"maskTextFn",
|
|
1530
|
-
"maskInputFn",
|
|
1531
|
-
"recordCanvas",
|
|
1532
|
-
"inlineImages",
|
|
1533
|
-
"slimDOMOptions",
|
|
1534
|
-
"doc",
|
|
1535
|
-
"mirror",
|
|
1536
|
-
"iframeManager",
|
|
1537
|
-
"stylesheetManager",
|
|
1538
|
-
"shadowDomManager",
|
|
1539
|
-
"canvasManager",
|
|
1540
|
-
"enableStrictPrivacy"
|
|
1541
|
-
].forEach((key) => {
|
|
1542
|
-
this[key] = options[key];
|
|
1543
|
-
});
|
|
1544
|
-
}
|
|
1545
|
-
freeze() {
|
|
1546
|
-
this.frozen = true;
|
|
1547
|
-
this.canvasManager.freeze();
|
|
1548
|
-
}
|
|
1549
|
-
unfreeze() {
|
|
1550
|
-
this.frozen = false;
|
|
1551
|
-
this.canvasManager.unfreeze();
|
|
1552
|
-
this.emit();
|
|
1553
|
-
}
|
|
1554
|
-
isFrozen() {
|
|
1555
|
-
return this.frozen;
|
|
1556
|
-
}
|
|
1557
|
-
lock() {
|
|
1558
|
-
this.locked = true;
|
|
1559
|
-
this.canvasManager.lock();
|
|
1560
|
-
}
|
|
1561
|
-
unlock() {
|
|
1562
|
-
this.locked = false;
|
|
1563
|
-
this.canvasManager.unlock();
|
|
1564
|
-
this.emit();
|
|
1565
|
-
}
|
|
1566
|
-
reset() {
|
|
1567
|
-
this.shadowDomManager.reset();
|
|
1568
|
-
this.canvasManager.reset();
|
|
1569
|
-
}
|
|
1570
|
-
}
|
|
1571
|
-
function deepDelete(addsSet, n) {
|
|
1572
|
-
addsSet.delete(n);
|
|
1573
|
-
n.childNodes.forEach((childN) => deepDelete(addsSet, childN));
|
|
1574
|
-
}
|
|
1575
|
-
function isParentRemoved(removes, n, mirror) {
|
|
1576
|
-
const { parentNode } = n;
|
|
1577
|
-
if (!parentNode) {
|
|
1578
|
-
return false;
|
|
1579
|
-
}
|
|
1580
|
-
const parentId = mirror.getId(parentNode);
|
|
1581
|
-
if (removes.some((r) => r.id === parentId)) {
|
|
1582
|
-
return true;
|
|
1583
|
-
}
|
|
1584
|
-
return isParentRemoved(removes, parentNode, mirror);
|
|
1585
|
-
}
|
|
1586
|
-
function isAncestorInSet(set, n) {
|
|
1587
|
-
const { parentNode } = n;
|
|
1588
|
-
if (!parentNode) {
|
|
1589
|
-
return false;
|
|
1590
|
-
}
|
|
1591
|
-
if (set.has(parentNode)) {
|
|
1592
|
-
return true;
|
|
1593
|
-
}
|
|
1594
|
-
return isAncestorInSet(set, parentNode);
|
|
1595
|
-
}
|
|
1596
|
-
|
|
1597
|
-
var __defProp$2 = Object.defineProperty;
|
|
1598
|
-
var __defProps$2 = Object.defineProperties;
|
|
1599
|
-
var __getOwnPropDescs$2 = Object.getOwnPropertyDescriptors;
|
|
1600
|
-
var __getOwnPropSymbols$3 = Object.getOwnPropertySymbols;
|
|
1601
|
-
var __hasOwnProp$3 = Object.prototype.hasOwnProperty;
|
|
1602
|
-
var __propIsEnum$3 = Object.prototype.propertyIsEnumerable;
|
|
1603
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
1604
|
-
var __spreadValues$2 = (a, b) => {
|
|
1605
|
-
for (var prop in b || (b = {}))
|
|
1606
|
-
if (__hasOwnProp$3.call(b, prop))
|
|
1607
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1608
|
-
if (__getOwnPropSymbols$3)
|
|
1609
|
-
for (var prop of __getOwnPropSymbols$3(b)) {
|
|
1610
|
-
if (__propIsEnum$3.call(b, prop))
|
|
1611
|
-
__defNormalProp$2(a, prop, b[prop]);
|
|
1612
|
-
}
|
|
1613
|
-
return a;
|
|
1614
|
-
};
|
|
1615
|
-
var __spreadProps$2 = (a, b) => __defProps$2(a, __getOwnPropDescs$2(b));
|
|
1616
|
-
const mutationBuffers = [];
|
|
1617
|
-
const isCSSGroupingRuleSupported = typeof CSSGroupingRule !== "undefined";
|
|
1618
|
-
const isCSSMediaRuleSupported = typeof CSSMediaRule !== "undefined";
|
|
1619
|
-
const isCSSSupportsRuleSupported = typeof CSSSupportsRule !== "undefined";
|
|
1620
|
-
const isCSSConditionRuleSupported = typeof CSSConditionRule !== "undefined";
|
|
1621
|
-
function getEventTarget(event) {
|
|
1622
|
-
try {
|
|
1623
|
-
if ("composedPath" in event) {
|
|
1624
|
-
const path = event.composedPath();
|
|
1625
|
-
if (path.length) {
|
|
1626
|
-
return path[0];
|
|
1627
|
-
}
|
|
1628
|
-
} else if ("path" in event && event.path.length) {
|
|
1629
|
-
return event.path[0];
|
|
1630
|
-
}
|
|
1631
|
-
return event.target;
|
|
1632
|
-
} catch (e) {
|
|
1633
|
-
return event.target;
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
function initMutationObserver(options, rootEl) {
|
|
1637
|
-
var _a, _b;
|
|
1638
|
-
const mutationBuffer = new MutationBuffer();
|
|
1639
|
-
mutationBuffers.push(mutationBuffer);
|
|
1640
|
-
mutationBuffer.init(options);
|
|
1641
|
-
let mutationObserverCtor = window.MutationObserver || window.__rrMutationObserver;
|
|
1642
|
-
const angularZoneSymbol = (_b = (_a = window == null ? void 0 : window.Zone) == null ? void 0 : _a.__symbol__) == null ? void 0 : _b.call(_a, "MutationObserver");
|
|
1643
|
-
if (angularZoneSymbol && window[angularZoneSymbol]) {
|
|
1644
|
-
mutationObserverCtor = window[angularZoneSymbol];
|
|
1645
|
-
}
|
|
1646
|
-
const observer = new mutationObserverCtor(mutationBuffer.processMutations.bind(mutationBuffer));
|
|
1647
|
-
observer.observe(rootEl, {
|
|
1648
|
-
attributes: true,
|
|
1649
|
-
attributeOldValue: true,
|
|
1650
|
-
characterData: true,
|
|
1651
|
-
characterDataOldValue: true,
|
|
1652
|
-
childList: true,
|
|
1653
|
-
subtree: true
|
|
1654
|
-
});
|
|
1655
|
-
return observer;
|
|
1656
|
-
}
|
|
1657
|
-
function initMoveObserver({
|
|
1658
|
-
mousemoveCb,
|
|
1659
|
-
sampling,
|
|
1660
|
-
doc,
|
|
1661
|
-
mirror
|
|
1662
|
-
}) {
|
|
1663
|
-
if (sampling.mousemove === false) {
|
|
1664
|
-
return () => {
|
|
1665
|
-
};
|
|
1666
|
-
}
|
|
1667
|
-
const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50;
|
|
1668
|
-
const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500;
|
|
1669
|
-
let positions = [];
|
|
1670
|
-
let timeBaseline;
|
|
1671
|
-
const wrappedCb = throttle((source) => {
|
|
1672
|
-
const totalOffset = Date.now() - timeBaseline;
|
|
1673
|
-
mousemoveCb(positions.map((p) => {
|
|
1674
|
-
p.timeOffset -= totalOffset;
|
|
1675
|
-
return p;
|
|
1676
|
-
}), source);
|
|
1677
|
-
positions = [];
|
|
1678
|
-
timeBaseline = null;
|
|
1679
|
-
}, callbackThreshold);
|
|
1680
|
-
const updatePosition = throttle((evt) => {
|
|
1681
|
-
const target = getEventTarget(evt);
|
|
1682
|
-
const { clientX, clientY } = isTouchEvent(evt) ? evt.changedTouches[0] : evt;
|
|
1683
|
-
if (!timeBaseline) {
|
|
1684
|
-
timeBaseline = Date.now();
|
|
1685
|
-
}
|
|
1686
|
-
positions.push({
|
|
1687
|
-
x: clientX,
|
|
1688
|
-
y: clientY,
|
|
1689
|
-
id: mirror.getId(target),
|
|
1690
|
-
timeOffset: Date.now() - timeBaseline
|
|
1691
|
-
});
|
|
1692
|
-
wrappedCb(typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove);
|
|
1693
|
-
}, threshold, {
|
|
1694
|
-
trailing: false
|
|
1695
|
-
});
|
|
1696
|
-
const handlers = [
|
|
1697
|
-
on("mousemove", updatePosition, doc),
|
|
1698
|
-
on("touchmove", updatePosition, doc),
|
|
1699
|
-
on("drag", updatePosition, doc)
|
|
1700
|
-
];
|
|
1701
|
-
return () => {
|
|
1702
|
-
handlers.forEach((h) => h());
|
|
1703
|
-
};
|
|
1704
|
-
}
|
|
1705
|
-
function initMouseInteractionObserver({
|
|
1706
|
-
mouseInteractionCb,
|
|
1707
|
-
doc,
|
|
1708
|
-
mirror,
|
|
1709
|
-
blockClass,
|
|
1710
|
-
sampling
|
|
1711
|
-
}) {
|
|
1712
|
-
if (sampling.mouseInteraction === false) {
|
|
1713
|
-
return () => {
|
|
1714
|
-
};
|
|
1715
|
-
}
|
|
1716
|
-
const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;
|
|
1717
|
-
const handlers = [];
|
|
1718
|
-
const getHandler = (eventKey) => {
|
|
1719
|
-
return (event) => {
|
|
1720
|
-
const target = getEventTarget(event);
|
|
1721
|
-
if (isBlocked(target, blockClass) || isCanvasNode(target)) {
|
|
1722
|
-
return;
|
|
1723
|
-
}
|
|
1724
|
-
const e = isTouchEvent(event) ? event.changedTouches[0] : event;
|
|
1725
|
-
if (!e) {
|
|
1726
|
-
return;
|
|
1727
|
-
}
|
|
1728
|
-
const id = mirror.getId(target);
|
|
1729
|
-
const { clientX, clientY } = e;
|
|
1730
|
-
mouseInteractionCb({
|
|
1731
|
-
type: MouseInteractions[eventKey],
|
|
1732
|
-
id,
|
|
1733
|
-
x: clientX,
|
|
1734
|
-
y: clientY
|
|
1735
|
-
});
|
|
1736
|
-
};
|
|
1737
|
-
};
|
|
1738
|
-
Object.keys(MouseInteractions).filter((key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false).forEach((eventKey) => {
|
|
1739
|
-
const eventName = eventKey.toLowerCase();
|
|
1740
|
-
const handler = getHandler(eventKey);
|
|
1741
|
-
handlers.push(on(eventName, handler, doc));
|
|
1742
|
-
});
|
|
1743
|
-
return () => {
|
|
1744
|
-
handlers.forEach((h) => h());
|
|
1745
|
-
};
|
|
1746
|
-
}
|
|
1747
|
-
function initScrollObserver({
|
|
1748
|
-
scrollCb,
|
|
1749
|
-
doc,
|
|
1750
|
-
mirror,
|
|
1751
|
-
blockClass,
|
|
1752
|
-
sampling
|
|
1753
|
-
}) {
|
|
1754
|
-
const updatePosition = throttle((evt) => {
|
|
1755
|
-
const target = getEventTarget(evt);
|
|
1756
|
-
if (!target || isBlocked(target, blockClass)) {
|
|
1757
|
-
return;
|
|
1758
|
-
}
|
|
1759
|
-
const id = mirror.getId(target);
|
|
1760
|
-
if (target === doc) {
|
|
1761
|
-
const scrollEl = doc.scrollingElement || doc.documentElement;
|
|
1762
|
-
scrollCb({
|
|
1763
|
-
id,
|
|
1764
|
-
x: scrollEl.scrollLeft,
|
|
1765
|
-
y: scrollEl.scrollTop
|
|
1766
|
-
});
|
|
1767
|
-
} else {
|
|
1768
|
-
scrollCb({
|
|
1769
|
-
id,
|
|
1770
|
-
x: target.scrollLeft,
|
|
1771
|
-
y: target.scrollTop
|
|
1772
|
-
});
|
|
1773
|
-
}
|
|
1774
|
-
}, sampling.scroll || 100);
|
|
1775
|
-
return on("scroll", updatePosition, doc);
|
|
1776
|
-
}
|
|
1777
|
-
function initViewportResizeObserver({
|
|
1778
|
-
viewportResizeCb
|
|
1779
|
-
}) {
|
|
1780
|
-
let lastH = -1;
|
|
1781
|
-
let lastW = -1;
|
|
1782
|
-
const updateDimension = throttle(() => {
|
|
1783
|
-
const height = getWindowHeight();
|
|
1784
|
-
const width = getWindowWidth();
|
|
1785
|
-
if (lastH !== height || lastW !== width) {
|
|
1786
|
-
viewportResizeCb({
|
|
1787
|
-
width: Number(width),
|
|
1788
|
-
height: Number(height)
|
|
1789
|
-
});
|
|
1790
|
-
lastH = height;
|
|
1791
|
-
lastW = width;
|
|
1792
|
-
}
|
|
1793
|
-
}, 200);
|
|
1794
|
-
return on("resize", updateDimension, window);
|
|
1795
|
-
}
|
|
1796
|
-
function wrapEventWithUserTriggeredFlag(v, enable) {
|
|
1797
|
-
const value = __spreadValues$2({}, v);
|
|
1798
|
-
if (!enable)
|
|
1799
|
-
delete value.userTriggered;
|
|
1800
|
-
return value;
|
|
1801
|
-
}
|
|
1802
|
-
const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
|
|
1803
|
-
const lastInputValueMap = /* @__PURE__ */ new WeakMap();
|
|
1804
|
-
function initInputObserver({
|
|
1805
|
-
inputCb,
|
|
1806
|
-
doc,
|
|
1807
|
-
mirror,
|
|
1808
|
-
blockClass,
|
|
1809
|
-
ignoreClass,
|
|
1810
|
-
maskInputOptions,
|
|
1811
|
-
maskInputFn,
|
|
1812
|
-
sampling,
|
|
1813
|
-
userTriggeredOnInput
|
|
1814
|
-
}) {
|
|
1815
|
-
function eventHandler(event) {
|
|
1816
|
-
let target = getEventTarget(event);
|
|
1817
|
-
const userTriggered = event.isTrusted;
|
|
1818
|
-
if (target && target.tagName === "OPTION")
|
|
1819
|
-
target = target.parentElement;
|
|
1820
|
-
if (!target || !target.tagName || INPUT_TAGS.indexOf(target.tagName) < 0 || isBlocked(target, blockClass)) {
|
|
1821
|
-
return;
|
|
1822
|
-
}
|
|
1823
|
-
const type = target.type;
|
|
1824
|
-
if (target.classList.contains(ignoreClass)) {
|
|
1825
|
-
return;
|
|
1826
|
-
}
|
|
1827
|
-
let text = target.value;
|
|
1828
|
-
let isChecked = false;
|
|
1829
|
-
if (type === "radio" || type === "checkbox") {
|
|
1830
|
-
isChecked = target.checked;
|
|
1831
|
-
} else if (maskInputOptions[target.tagName.toLowerCase()] || maskInputOptions[type]) {
|
|
1832
|
-
text = maskInputValue({
|
|
1833
|
-
maskInputOptions,
|
|
1834
|
-
tagName: target.tagName,
|
|
1835
|
-
type,
|
|
1836
|
-
value: text,
|
|
1837
|
-
maskInputFn
|
|
1838
|
-
});
|
|
1839
|
-
}
|
|
1840
|
-
cbWithDedup(target, wrapEventWithUserTriggeredFlag({ text, isChecked, userTriggered }, userTriggeredOnInput));
|
|
1841
|
-
const name = target.name;
|
|
1842
|
-
if (type === "radio" && name && isChecked) {
|
|
1843
|
-
doc.querySelectorAll(`input[type="radio"][name="${name}"]`).forEach((el) => {
|
|
1844
|
-
if (el !== target) {
|
|
1845
|
-
cbWithDedup(el, wrapEventWithUserTriggeredFlag({
|
|
1846
|
-
text: el.value,
|
|
1847
|
-
isChecked: !isChecked,
|
|
1848
|
-
userTriggered: false
|
|
1849
|
-
}, userTriggeredOnInput));
|
|
1850
|
-
}
|
|
1851
|
-
});
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
function cbWithDedup(target, v) {
|
|
1855
|
-
const lastInputValue = lastInputValueMap.get(target);
|
|
1856
|
-
if (!lastInputValue || lastInputValue.text !== v.text || lastInputValue.isChecked !== v.isChecked) {
|
|
1857
|
-
lastInputValueMap.set(target, v);
|
|
1858
|
-
const id = mirror.getId(target);
|
|
1859
|
-
inputCb(__spreadProps$2(__spreadValues$2({}, v), {
|
|
1860
|
-
id
|
|
1861
|
-
}));
|
|
1862
|
-
}
|
|
1863
|
-
}
|
|
1864
|
-
const events = sampling.input === "last" ? ["change"] : ["input", "change"];
|
|
1865
|
-
const handlers = events.map((eventName) => on(eventName, eventHandler, doc));
|
|
1866
|
-
const propertyDescriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value");
|
|
1867
|
-
const hookProperties = [
|
|
1868
|
-
[HTMLInputElement.prototype, "value"],
|
|
1869
|
-
[HTMLInputElement.prototype, "checked"],
|
|
1870
|
-
[HTMLSelectElement.prototype, "value"],
|
|
1871
|
-
[HTMLTextAreaElement.prototype, "value"],
|
|
1872
|
-
[HTMLSelectElement.prototype, "selectedIndex"],
|
|
1873
|
-
[HTMLOptionElement.prototype, "selected"]
|
|
1874
|
-
];
|
|
1875
|
-
if (propertyDescriptor && propertyDescriptor.set) {
|
|
1876
|
-
handlers.push(...hookProperties.map((p) => hookSetter(p[0], p[1], {
|
|
1877
|
-
set() {
|
|
1878
|
-
eventHandler({ target: this });
|
|
1879
|
-
}
|
|
1880
|
-
})));
|
|
1881
|
-
}
|
|
1882
|
-
return () => {
|
|
1883
|
-
handlers.forEach((h) => h());
|
|
1884
|
-
};
|
|
1885
|
-
}
|
|
1886
|
-
function getNestedCSSRulePositions(rule) {
|
|
1887
|
-
const positions = [];
|
|
1888
|
-
function recurse(childRule, pos) {
|
|
1889
|
-
if (isCSSGroupingRuleSupported && childRule.parentRule instanceof CSSGroupingRule || isCSSMediaRuleSupported && childRule.parentRule instanceof CSSMediaRule || isCSSSupportsRuleSupported && childRule.parentRule instanceof CSSSupportsRule || isCSSConditionRuleSupported && childRule.parentRule instanceof CSSConditionRule) {
|
|
1890
|
-
const rules = Array.from(childRule.parentRule.cssRules);
|
|
1891
|
-
const index = rules.indexOf(childRule);
|
|
1892
|
-
pos.unshift(index);
|
|
1893
|
-
} else {
|
|
1894
|
-
const rules = Array.from(childRule.parentStyleSheet.cssRules);
|
|
1895
|
-
const index = rules.indexOf(childRule);
|
|
1896
|
-
pos.unshift(index);
|
|
1897
|
-
}
|
|
1898
|
-
return pos;
|
|
1899
|
-
}
|
|
1900
|
-
return recurse(rule, positions);
|
|
1901
|
-
}
|
|
1902
|
-
function initStyleSheetObserver({ styleSheetRuleCb, mirror }, { win }) {
|
|
1903
|
-
const insertRule = win.CSSStyleSheet.prototype.insertRule;
|
|
1904
|
-
win.CSSStyleSheet.prototype.insertRule = function(rule, index) {
|
|
1905
|
-
const id = mirror.getId(this.ownerNode);
|
|
1906
|
-
if (id !== -1) {
|
|
1907
|
-
styleSheetRuleCb({
|
|
1908
|
-
id,
|
|
1909
|
-
adds: [{ rule, index }]
|
|
1910
|
-
});
|
|
1911
|
-
}
|
|
1912
|
-
return insertRule.apply(this, arguments);
|
|
1913
|
-
};
|
|
1914
|
-
const deleteRule = win.CSSStyleSheet.prototype.deleteRule;
|
|
1915
|
-
win.CSSStyleSheet.prototype.deleteRule = function(index) {
|
|
1916
|
-
const id = mirror.getId(this.ownerNode);
|
|
1917
|
-
if (id !== -1) {
|
|
1918
|
-
styleSheetRuleCb({
|
|
1919
|
-
id,
|
|
1920
|
-
removes: [{ index }]
|
|
1921
|
-
});
|
|
1922
|
-
}
|
|
1923
|
-
return deleteRule.apply(this, arguments);
|
|
1924
|
-
};
|
|
1925
|
-
const supportedNestedCSSRuleTypes = {};
|
|
1926
|
-
if (isCSSGroupingRuleSupported) {
|
|
1927
|
-
supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;
|
|
1928
|
-
} else {
|
|
1929
|
-
if (isCSSMediaRuleSupported) {
|
|
1930
|
-
supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;
|
|
1931
|
-
}
|
|
1932
|
-
if (isCSSConditionRuleSupported) {
|
|
1933
|
-
supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;
|
|
1934
|
-
}
|
|
1935
|
-
if (isCSSSupportsRuleSupported) {
|
|
1936
|
-
supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
const unmodifiedFunctions = {};
|
|
1940
|
-
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
1941
|
-
unmodifiedFunctions[typeKey] = {
|
|
1942
|
-
insertRule: type.prototype.insertRule,
|
|
1943
|
-
deleteRule: type.prototype.deleteRule
|
|
1944
|
-
};
|
|
1945
|
-
type.prototype.insertRule = function(rule, index) {
|
|
1946
|
-
const id = mirror.getId(this.parentStyleSheet.ownerNode);
|
|
1947
|
-
if (id !== -1) {
|
|
1948
|
-
styleSheetRuleCb({
|
|
1949
|
-
id,
|
|
1950
|
-
adds: [
|
|
1951
|
-
{
|
|
1952
|
-
rule,
|
|
1953
|
-
index: [
|
|
1954
|
-
...getNestedCSSRulePositions(this),
|
|
1955
|
-
index || 0
|
|
1956
|
-
]
|
|
1957
|
-
}
|
|
1958
|
-
]
|
|
1959
|
-
});
|
|
1960
|
-
}
|
|
1961
|
-
return unmodifiedFunctions[typeKey].insertRule.apply(this, arguments);
|
|
1962
|
-
};
|
|
1963
|
-
type.prototype.deleteRule = function(index) {
|
|
1964
|
-
const id = mirror.getId(this.parentStyleSheet.ownerNode);
|
|
1965
|
-
if (id !== -1) {
|
|
1966
|
-
styleSheetRuleCb({
|
|
1967
|
-
id,
|
|
1968
|
-
removes: [{ index: [...getNestedCSSRulePositions(this), index] }]
|
|
1969
|
-
});
|
|
1970
|
-
}
|
|
1971
|
-
return unmodifiedFunctions[typeKey].deleteRule.apply(this, arguments);
|
|
1972
|
-
};
|
|
1973
|
-
});
|
|
1974
|
-
return () => {
|
|
1975
|
-
win.CSSStyleSheet.prototype.insertRule = insertRule;
|
|
1976
|
-
win.CSSStyleSheet.prototype.deleteRule = deleteRule;
|
|
1977
|
-
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
1978
|
-
type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;
|
|
1979
|
-
type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;
|
|
1980
|
-
});
|
|
1981
|
-
};
|
|
1982
|
-
}
|
|
1983
|
-
function initStyleDeclarationObserver({ styleDeclarationCb, mirror }, { win }) {
|
|
1984
|
-
const setProperty = win.CSSStyleDeclaration.prototype.setProperty;
|
|
1985
|
-
win.CSSStyleDeclaration.prototype.setProperty = function(property, value, priority) {
|
|
1986
|
-
var _a, _b;
|
|
1987
|
-
const id = mirror.getId((_b = (_a = this.parentRule) == null ? void 0 : _a.parentStyleSheet) == null ? void 0 : _b.ownerNode);
|
|
1988
|
-
if (id !== -1) {
|
|
1989
|
-
styleDeclarationCb({
|
|
1990
|
-
id,
|
|
1991
|
-
set: {
|
|
1992
|
-
property,
|
|
1993
|
-
value,
|
|
1994
|
-
priority
|
|
1995
|
-
},
|
|
1996
|
-
index: getNestedCSSRulePositions(this.parentRule)
|
|
1997
|
-
});
|
|
1998
|
-
}
|
|
1999
|
-
return setProperty.apply(this, arguments);
|
|
2000
|
-
};
|
|
2001
|
-
const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
|
|
2002
|
-
win.CSSStyleDeclaration.prototype.removeProperty = function(property) {
|
|
2003
|
-
var _a, _b;
|
|
2004
|
-
const id = mirror.getId((_b = (_a = this.parentRule) == null ? void 0 : _a.parentStyleSheet) == null ? void 0 : _b.ownerNode);
|
|
2005
|
-
if (id !== -1) {
|
|
2006
|
-
styleDeclarationCb({
|
|
2007
|
-
id,
|
|
2008
|
-
remove: {
|
|
2009
|
-
property
|
|
2010
|
-
},
|
|
2011
|
-
index: getNestedCSSRulePositions(this.parentRule)
|
|
2012
|
-
});
|
|
2013
|
-
}
|
|
2014
|
-
return removeProperty.apply(this, arguments);
|
|
2015
|
-
};
|
|
2016
|
-
return () => {
|
|
2017
|
-
win.CSSStyleDeclaration.prototype.setProperty = setProperty;
|
|
2018
|
-
win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;
|
|
2019
|
-
};
|
|
2020
|
-
}
|
|
2021
|
-
function initMediaInteractionObserver({
|
|
2022
|
-
mediaInteractionCb,
|
|
2023
|
-
blockClass,
|
|
2024
|
-
mirror,
|
|
2025
|
-
sampling
|
|
2026
|
-
}) {
|
|
2027
|
-
const handler = (type) => throttle((event) => {
|
|
2028
|
-
const target = getEventTarget(event);
|
|
2029
|
-
if (!target || isBlocked(target, blockClass)) {
|
|
2030
|
-
return;
|
|
2031
|
-
}
|
|
2032
|
-
const { currentTime, volume, muted } = target;
|
|
2033
|
-
mediaInteractionCb({
|
|
2034
|
-
type,
|
|
2035
|
-
id: mirror.getId(target),
|
|
2036
|
-
currentTime,
|
|
2037
|
-
volume,
|
|
2038
|
-
muted
|
|
2039
|
-
});
|
|
2040
|
-
}, sampling.media || 500);
|
|
2041
|
-
const handlers = [
|
|
2042
|
-
on("play", handler(MediaInteractions.Play)),
|
|
2043
|
-
on("pause", handler(MediaInteractions.Pause)),
|
|
2044
|
-
on("seeked", handler(MediaInteractions.Seeked)),
|
|
2045
|
-
on("volumechange", handler(MediaInteractions.VolumeChange))
|
|
2046
|
-
];
|
|
2047
|
-
return () => {
|
|
2048
|
-
handlers.forEach((h) => h());
|
|
2049
|
-
};
|
|
2050
|
-
}
|
|
2051
|
-
function initFontObserver({ fontCb, doc }) {
|
|
2052
|
-
const win = doc.defaultView;
|
|
2053
|
-
if (!win) {
|
|
2054
|
-
return () => {
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
|
-
const handlers = [];
|
|
2058
|
-
const fontMap = /* @__PURE__ */ new WeakMap();
|
|
2059
|
-
const originalFontFace = win.FontFace;
|
|
2060
|
-
win.FontFace = function FontFace(family, source, descriptors) {
|
|
2061
|
-
const fontFace = new originalFontFace(family, source, descriptors);
|
|
2062
|
-
fontMap.set(fontFace, {
|
|
2063
|
-
family,
|
|
2064
|
-
buffer: typeof source !== "string",
|
|
2065
|
-
descriptors,
|
|
2066
|
-
fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source)))
|
|
2067
|
-
});
|
|
2068
|
-
return fontFace;
|
|
2069
|
-
};
|
|
2070
|
-
const restoreHandler = patch(doc.fonts, "add", function(original) {
|
|
2071
|
-
return function(fontFace) {
|
|
2072
|
-
setTimeout(() => {
|
|
2073
|
-
const p = fontMap.get(fontFace);
|
|
2074
|
-
if (p) {
|
|
2075
|
-
fontCb(p);
|
|
2076
|
-
fontMap.delete(fontFace);
|
|
2077
|
-
}
|
|
2078
|
-
}, 0);
|
|
2079
|
-
return original.apply(this, [fontFace]);
|
|
2080
|
-
};
|
|
2081
|
-
});
|
|
2082
|
-
handlers.push(() => {
|
|
2083
|
-
win.FontFace = originalFontFace;
|
|
2084
|
-
});
|
|
2085
|
-
handlers.push(restoreHandler);
|
|
2086
|
-
return () => {
|
|
2087
|
-
handlers.forEach((h) => h());
|
|
2088
|
-
};
|
|
2089
|
-
}
|
|
2090
|
-
function mergeHooks(o, hooks) {
|
|
2091
|
-
const {
|
|
2092
|
-
mutationCb,
|
|
2093
|
-
mousemoveCb,
|
|
2094
|
-
mouseInteractionCb,
|
|
2095
|
-
scrollCb,
|
|
2096
|
-
viewportResizeCb,
|
|
2097
|
-
inputCb,
|
|
2098
|
-
mediaInteractionCb,
|
|
2099
|
-
styleSheetRuleCb,
|
|
2100
|
-
styleDeclarationCb,
|
|
2101
|
-
canvasMutationCb,
|
|
2102
|
-
fontCb
|
|
2103
|
-
} = o;
|
|
2104
|
-
o.mutationCb = (...p) => {
|
|
2105
|
-
if (hooks.mutation) {
|
|
2106
|
-
hooks.mutation(...p);
|
|
2107
|
-
}
|
|
2108
|
-
mutationCb(...p);
|
|
2109
|
-
};
|
|
2110
|
-
o.mousemoveCb = (...p) => {
|
|
2111
|
-
if (hooks.mousemove) {
|
|
2112
|
-
hooks.mousemove(...p);
|
|
2113
|
-
}
|
|
2114
|
-
mousemoveCb(...p);
|
|
2115
|
-
};
|
|
2116
|
-
o.mouseInteractionCb = (...p) => {
|
|
2117
|
-
if (hooks.mouseInteraction) {
|
|
2118
|
-
hooks.mouseInteraction(...p);
|
|
2119
|
-
}
|
|
2120
|
-
mouseInteractionCb(...p);
|
|
2121
|
-
};
|
|
2122
|
-
o.scrollCb = (...p) => {
|
|
2123
|
-
if (hooks.scroll) {
|
|
2124
|
-
hooks.scroll(...p);
|
|
2125
|
-
}
|
|
2126
|
-
scrollCb(...p);
|
|
2127
|
-
};
|
|
2128
|
-
o.viewportResizeCb = (...p) => {
|
|
2129
|
-
if (hooks.viewportResize) {
|
|
2130
|
-
hooks.viewportResize(...p);
|
|
2131
|
-
}
|
|
2132
|
-
viewportResizeCb(...p);
|
|
2133
|
-
};
|
|
2134
|
-
o.inputCb = (...p) => {
|
|
2135
|
-
if (hooks.input) {
|
|
2136
|
-
hooks.input(...p);
|
|
2137
|
-
}
|
|
2138
|
-
inputCb(...p);
|
|
2139
|
-
};
|
|
2140
|
-
o.mediaInteractionCb = (...p) => {
|
|
2141
|
-
if (hooks.mediaInteaction) {
|
|
2142
|
-
hooks.mediaInteaction(...p);
|
|
2143
|
-
}
|
|
2144
|
-
mediaInteractionCb(...p);
|
|
2145
|
-
};
|
|
2146
|
-
o.styleSheetRuleCb = (...p) => {
|
|
2147
|
-
if (hooks.styleSheetRule) {
|
|
2148
|
-
hooks.styleSheetRule(...p);
|
|
2149
|
-
}
|
|
2150
|
-
styleSheetRuleCb(...p);
|
|
2151
|
-
};
|
|
2152
|
-
o.styleDeclarationCb = (...p) => {
|
|
2153
|
-
if (hooks.styleDeclaration) {
|
|
2154
|
-
hooks.styleDeclaration(...p);
|
|
2155
|
-
}
|
|
2156
|
-
styleDeclarationCb(...p);
|
|
2157
|
-
};
|
|
2158
|
-
o.canvasMutationCb = (...p) => {
|
|
2159
|
-
if (hooks.canvasMutation) {
|
|
2160
|
-
hooks.canvasMutation(...p);
|
|
2161
|
-
}
|
|
2162
|
-
canvasMutationCb(...p);
|
|
2163
|
-
};
|
|
2164
|
-
o.fontCb = (...p) => {
|
|
2165
|
-
if (hooks.font) {
|
|
2166
|
-
hooks.font(...p);
|
|
2167
|
-
}
|
|
2168
|
-
fontCb(...p);
|
|
2169
|
-
};
|
|
2170
|
-
}
|
|
2171
|
-
function initObservers(o, hooks = {}) {
|
|
2172
|
-
const currentWindow = o.doc.defaultView;
|
|
2173
|
-
if (!currentWindow) {
|
|
2174
|
-
return () => {
|
|
2175
|
-
};
|
|
2176
|
-
}
|
|
2177
|
-
mergeHooks(o, hooks);
|
|
2178
|
-
const mutationObserver = initMutationObserver(o, o.doc);
|
|
2179
|
-
const mousemoveHandler = initMoveObserver(o);
|
|
2180
|
-
const mouseInteractionHandler = initMouseInteractionObserver(o);
|
|
2181
|
-
const scrollHandler = initScrollObserver(o);
|
|
2182
|
-
const viewportResizeHandler = initViewportResizeObserver(o);
|
|
2183
|
-
const inputHandler = initInputObserver(o);
|
|
2184
|
-
const mediaInteractionHandler = initMediaInteractionObserver(o);
|
|
2185
|
-
const styleSheetObserver = initStyleSheetObserver(o, { win: currentWindow });
|
|
2186
|
-
const styleDeclarationObserver = initStyleDeclarationObserver(o, {
|
|
2187
|
-
win: currentWindow
|
|
2188
|
-
});
|
|
2189
|
-
const fontObserver = o.collectFonts ? initFontObserver(o) : () => {
|
|
2190
|
-
};
|
|
2191
|
-
const pluginHandlers = [];
|
|
2192
|
-
for (const plugin of o.plugins) {
|
|
2193
|
-
pluginHandlers.push(plugin.observer(plugin.callback, currentWindow, plugin.options));
|
|
2194
|
-
}
|
|
2195
|
-
return () => {
|
|
2196
|
-
mutationBuffers.forEach((b) => b.reset());
|
|
2197
|
-
mutationObserver.disconnect();
|
|
2198
|
-
mousemoveHandler();
|
|
2199
|
-
mouseInteractionHandler();
|
|
2200
|
-
scrollHandler();
|
|
2201
|
-
viewportResizeHandler();
|
|
2202
|
-
inputHandler();
|
|
2203
|
-
mediaInteractionHandler();
|
|
2204
|
-
styleSheetObserver();
|
|
2205
|
-
styleDeclarationObserver();
|
|
2206
|
-
fontObserver();
|
|
2207
|
-
pluginHandlers.forEach((h) => h());
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
|
|
2211
|
-
class IframeManager {
|
|
2212
|
-
constructor(options) {
|
|
2213
|
-
this.iframes = /* @__PURE__ */ new WeakMap();
|
|
2214
|
-
this.mutationCb = options.mutationCb;
|
|
2215
|
-
}
|
|
2216
|
-
addIframe(iframeEl) {
|
|
2217
|
-
this.iframes.set(iframeEl, true);
|
|
2218
|
-
}
|
|
2219
|
-
addLoadListener(cb) {
|
|
2220
|
-
this.loadListener = cb;
|
|
2221
|
-
}
|
|
2222
|
-
attachIframe(iframeEl, childSn, mirror) {
|
|
2223
|
-
var _a;
|
|
2224
|
-
this.mutationCb({
|
|
2225
|
-
adds: [
|
|
2226
|
-
{
|
|
2227
|
-
parentId: mirror.getId(iframeEl),
|
|
2228
|
-
nextId: null,
|
|
2229
|
-
node: childSn
|
|
2230
|
-
}
|
|
2231
|
-
],
|
|
2232
|
-
removes: [],
|
|
2233
|
-
texts: [],
|
|
2234
|
-
attributes: [],
|
|
2235
|
-
isAttachIframe: true
|
|
2236
|
-
});
|
|
2237
|
-
(_a = this.loadListener) == null ? void 0 : _a.call(this, iframeEl);
|
|
2238
|
-
}
|
|
2239
|
-
}
|
|
2240
|
-
|
|
2241
|
-
var __defProp$1 = Object.defineProperty;
|
|
2242
|
-
var __defProps$1 = Object.defineProperties;
|
|
2243
|
-
var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
|
|
2244
|
-
var __getOwnPropSymbols$2 = Object.getOwnPropertySymbols;
|
|
2245
|
-
var __hasOwnProp$2 = Object.prototype.hasOwnProperty;
|
|
2246
|
-
var __propIsEnum$2 = Object.prototype.propertyIsEnumerable;
|
|
2247
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2248
|
-
var __spreadValues$1 = (a, b) => {
|
|
2249
|
-
for (var prop in b || (b = {}))
|
|
2250
|
-
if (__hasOwnProp$2.call(b, prop))
|
|
2251
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2252
|
-
if (__getOwnPropSymbols$2)
|
|
2253
|
-
for (var prop of __getOwnPropSymbols$2(b)) {
|
|
2254
|
-
if (__propIsEnum$2.call(b, prop))
|
|
2255
|
-
__defNormalProp$1(a, prop, b[prop]);
|
|
2256
|
-
}
|
|
2257
|
-
return a;
|
|
2258
|
-
};
|
|
2259
|
-
var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
|
|
2260
|
-
class ShadowDomManager {
|
|
2261
|
-
constructor(options) {
|
|
2262
|
-
this.restorePatches = [];
|
|
2263
|
-
this.mutationCb = options.mutationCb;
|
|
2264
|
-
this.scrollCb = options.scrollCb;
|
|
2265
|
-
this.bypassOptions = options.bypassOptions;
|
|
2266
|
-
this.mirror = options.mirror;
|
|
2267
|
-
const manager = this;
|
|
2268
|
-
this.restorePatches.push(patch(HTMLElement.prototype, "attachShadow", function(original) {
|
|
2269
|
-
return function() {
|
|
2270
|
-
const shadowRoot = original.apply(this, arguments);
|
|
2271
|
-
if (this.shadowRoot)
|
|
2272
|
-
manager.addShadowRoot(this.shadowRoot, this.ownerDocument);
|
|
2273
|
-
return shadowRoot;
|
|
2274
|
-
};
|
|
2275
|
-
}));
|
|
2276
|
-
}
|
|
2277
|
-
addShadowRoot(shadowRoot, doc) {
|
|
2278
|
-
initMutationObserver(__spreadProps$1(__spreadValues$1({}, this.bypassOptions), {
|
|
2279
|
-
doc,
|
|
2280
|
-
mutationCb: this.mutationCb,
|
|
2281
|
-
mirror: this.mirror,
|
|
2282
|
-
shadowDomManager: this
|
|
2283
|
-
}), shadowRoot);
|
|
2284
|
-
initScrollObserver(__spreadProps$1(__spreadValues$1({}, this.bypassOptions), {
|
|
2285
|
-
scrollCb: this.scrollCb,
|
|
2286
|
-
doc: shadowRoot,
|
|
2287
|
-
mirror: this.mirror
|
|
2288
|
-
}));
|
|
2289
|
-
}
|
|
2290
|
-
observeAttachShadow(iframeElement) {
|
|
2291
|
-
if (iframeElement.contentWindow) {
|
|
2292
|
-
const manager = this;
|
|
2293
|
-
this.restorePatches.push(patch(iframeElement.contentWindow.HTMLElement.prototype, "attachShadow", function(original) {
|
|
2294
|
-
return function() {
|
|
2295
|
-
const shadowRoot = original.apply(this, arguments);
|
|
2296
|
-
if (this.shadowRoot)
|
|
2297
|
-
manager.addShadowRoot(this.shadowRoot, iframeElement.contentDocument);
|
|
2298
|
-
return shadowRoot;
|
|
2299
|
-
};
|
|
2300
|
-
}));
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
reset() {
|
|
2304
|
-
this.restorePatches.forEach((restorePatch) => restorePatch());
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
|
|
2308
|
-
/*
|
|
2309
|
-
* base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
|
|
2310
|
-
* Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
|
|
2311
|
-
* Released under MIT License
|
|
2312
|
-
*/
|
|
2313
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
2314
|
-
// Use a lookup table to find the index.
|
|
2315
|
-
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
|
|
2316
|
-
for (var i = 0; i < chars.length; i++) {
|
|
2317
|
-
lookup[chars.charCodeAt(i)] = i;
|
|
2318
|
-
}
|
|
2319
|
-
var encode = function (arraybuffer) {
|
|
2320
|
-
var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = '';
|
|
2321
|
-
for (i = 0; i < len; i += 3) {
|
|
2322
|
-
base64 += chars[bytes[i] >> 2];
|
|
2323
|
-
base64 += chars[((bytes[i] & 3) << 4) | (bytes[i + 1] >> 4)];
|
|
2324
|
-
base64 += chars[((bytes[i + 1] & 15) << 2) | (bytes[i + 2] >> 6)];
|
|
2325
|
-
base64 += chars[bytes[i + 2] & 63];
|
|
2326
|
-
}
|
|
2327
|
-
if (len % 3 === 2) {
|
|
2328
|
-
base64 = base64.substring(0, base64.length - 1) + '=';
|
|
2329
|
-
}
|
|
2330
|
-
else if (len % 3 === 1) {
|
|
2331
|
-
base64 = base64.substring(0, base64.length - 2) + '==';
|
|
2332
|
-
}
|
|
2333
|
-
return base64;
|
|
2334
|
-
};
|
|
2335
|
-
|
|
2336
|
-
const canvasVarMap = /* @__PURE__ */ new Map();
|
|
2337
|
-
function variableListFor(ctx, ctor) {
|
|
2338
|
-
let contextMap = canvasVarMap.get(ctx);
|
|
2339
|
-
if (!contextMap) {
|
|
2340
|
-
contextMap = /* @__PURE__ */ new Map();
|
|
2341
|
-
canvasVarMap.set(ctx, contextMap);
|
|
2342
|
-
}
|
|
2343
|
-
if (!contextMap.has(ctor)) {
|
|
2344
|
-
contextMap.set(ctor, []);
|
|
2345
|
-
}
|
|
2346
|
-
return contextMap.get(ctor);
|
|
2347
|
-
}
|
|
2348
|
-
const saveWebGLVar = (value, win, ctx) => {
|
|
2349
|
-
if (!value || !(isInstanceOfWebGLObject(value, win) || typeof value === "object"))
|
|
2350
|
-
return;
|
|
2351
|
-
const name = value.constructor.name;
|
|
2352
|
-
const list = variableListFor(ctx, name);
|
|
2353
|
-
let index = list.indexOf(value);
|
|
2354
|
-
if (index === -1) {
|
|
2355
|
-
index = list.length;
|
|
2356
|
-
list.push(value);
|
|
2357
|
-
}
|
|
2358
|
-
return index;
|
|
2359
|
-
};
|
|
2360
|
-
function serializeArg(value, win, ctx) {
|
|
2361
|
-
if (value instanceof Array) {
|
|
2362
|
-
return value.map((arg) => serializeArg(arg, win, ctx));
|
|
2363
|
-
} else if (value === null) {
|
|
2364
|
-
return value;
|
|
2365
|
-
} else if (value instanceof Float32Array || value instanceof Float64Array || value instanceof Int32Array || value instanceof Uint32Array || value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Int16Array || value instanceof Int8Array || value instanceof Uint8ClampedArray) {
|
|
2366
|
-
const name = value.constructor.name;
|
|
2367
|
-
return {
|
|
2368
|
-
rr_type: name,
|
|
2369
|
-
args: [Object.values(value)]
|
|
2370
|
-
};
|
|
2371
|
-
} else if (value instanceof ArrayBuffer) {
|
|
2372
|
-
const name = value.constructor.name;
|
|
2373
|
-
const base64 = encode(value);
|
|
2374
|
-
return {
|
|
2375
|
-
rr_type: name,
|
|
2376
|
-
base64
|
|
2377
|
-
};
|
|
2378
|
-
} else if (value instanceof DataView) {
|
|
2379
|
-
const name = value.constructor.name;
|
|
2380
|
-
return {
|
|
2381
|
-
rr_type: name,
|
|
2382
|
-
args: [
|
|
2383
|
-
serializeArg(value.buffer, win, ctx),
|
|
2384
|
-
value.byteOffset,
|
|
2385
|
-
value.byteLength
|
|
2386
|
-
]
|
|
2387
|
-
};
|
|
2388
|
-
} else if (value instanceof HTMLImageElement) {
|
|
2389
|
-
const name = value.constructor.name;
|
|
2390
|
-
const { src } = value;
|
|
2391
|
-
return {
|
|
2392
|
-
rr_type: name,
|
|
2393
|
-
src
|
|
2394
|
-
};
|
|
2395
|
-
} else if (value instanceof HTMLCanvasElement) {
|
|
2396
|
-
const name = "HTMLImageElement";
|
|
2397
|
-
const src = value.toDataURL();
|
|
2398
|
-
return {
|
|
2399
|
-
rr_type: name,
|
|
2400
|
-
src
|
|
2401
|
-
};
|
|
2402
|
-
} else if (value instanceof ImageData) {
|
|
2403
|
-
const name = value.constructor.name;
|
|
2404
|
-
return {
|
|
2405
|
-
rr_type: name,
|
|
2406
|
-
args: [serializeArg(value.data, win, ctx), value.width, value.height]
|
|
2407
|
-
};
|
|
2408
|
-
} else if (isInstanceOfWebGLObject(value, win) || typeof value === "object") {
|
|
2409
|
-
const name = value.constructor.name;
|
|
2410
|
-
const index = saveWebGLVar(value, win, ctx);
|
|
2411
|
-
return {
|
|
2412
|
-
rr_type: name,
|
|
2413
|
-
index
|
|
2414
|
-
};
|
|
2415
|
-
}
|
|
2416
|
-
return value;
|
|
2417
|
-
}
|
|
2418
|
-
const serializeArgs = (args, win, ctx) => {
|
|
2419
|
-
return [...args].map((arg) => serializeArg(arg, win, ctx));
|
|
2420
|
-
};
|
|
2421
|
-
const isInstanceOfWebGLObject = (value, win) => {
|
|
2422
|
-
const webGLConstructorNames = [
|
|
2423
|
-
"WebGLActiveInfo",
|
|
2424
|
-
"WebGLBuffer",
|
|
2425
|
-
"WebGLFramebuffer",
|
|
2426
|
-
"WebGLProgram",
|
|
2427
|
-
"WebGLRenderbuffer",
|
|
2428
|
-
"WebGLShader",
|
|
2429
|
-
"WebGLShaderPrecisionFormat",
|
|
2430
|
-
"WebGLTexture",
|
|
2431
|
-
"WebGLUniformLocation",
|
|
2432
|
-
"WebGLVertexArrayObject",
|
|
2433
|
-
"WebGLVertexArrayObjectOES"
|
|
2434
|
-
];
|
|
2435
|
-
const supportedWebGLConstructorNames = webGLConstructorNames.filter((name) => typeof win[name] === "function");
|
|
2436
|
-
return Boolean(supportedWebGLConstructorNames.find((name) => value instanceof win[name]));
|
|
2437
|
-
};
|
|
2438
|
-
|
|
2439
|
-
function initCanvas2DMutationObserver(cb, win, blockClass2, mirror) {
|
|
2440
|
-
const handlers = [];
|
|
2441
|
-
const props2D = Object.getOwnPropertyNames(win.CanvasRenderingContext2D.prototype);
|
|
2442
|
-
for (const prop of props2D) {
|
|
2443
|
-
try {
|
|
2444
|
-
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== "function") {
|
|
2445
|
-
continue;
|
|
2446
|
-
}
|
|
2447
|
-
const restoreHandler = patch(win.CanvasRenderingContext2D.prototype, prop, function(original) {
|
|
2448
|
-
return function(...args) {
|
|
2449
|
-
if (!isBlocked(this.canvas, blockClass2)) {
|
|
2450
|
-
setTimeout(() => {
|
|
2451
|
-
const recordArgs = serializeArgs([...args], win, this);
|
|
2452
|
-
cb(this.canvas, {
|
|
2453
|
-
type: CanvasContext["2D"],
|
|
2454
|
-
property: prop,
|
|
2455
|
-
args: recordArgs
|
|
2456
|
-
});
|
|
2457
|
-
}, 0);
|
|
2458
|
-
}
|
|
2459
|
-
return original.apply(this, args);
|
|
2460
|
-
};
|
|
2461
|
-
});
|
|
2462
|
-
handlers.push(restoreHandler);
|
|
2463
|
-
} catch (e) {
|
|
2464
|
-
const hookHandler = hookSetter(win.CanvasRenderingContext2D.prototype, prop, {
|
|
2465
|
-
set(v) {
|
|
2466
|
-
cb(this.canvas, {
|
|
2467
|
-
type: CanvasContext["2D"],
|
|
2468
|
-
property: prop,
|
|
2469
|
-
args: [v],
|
|
2470
|
-
setter: true
|
|
2471
|
-
});
|
|
2472
|
-
}
|
|
2473
|
-
});
|
|
2474
|
-
handlers.push(hookHandler);
|
|
2475
|
-
}
|
|
2476
|
-
}
|
|
2477
|
-
return () => {
|
|
2478
|
-
handlers.forEach((h) => h());
|
|
2479
|
-
};
|
|
2480
|
-
}
|
|
2481
|
-
|
|
2482
|
-
function initCanvasContextObserver(win, blockClass) {
|
|
2483
|
-
const handlers = [];
|
|
2484
|
-
try {
|
|
2485
|
-
const restoreHandler = patch(win.HTMLCanvasElement.prototype, "getContext", function(original) {
|
|
2486
|
-
return function(contextType, ...args) {
|
|
2487
|
-
if (!isBlocked(this, blockClass)) {
|
|
2488
|
-
if (!("__context" in this))
|
|
2489
|
-
this.__context = contextType;
|
|
2490
|
-
}
|
|
2491
|
-
return original.apply(this, [contextType, ...args]);
|
|
2492
|
-
};
|
|
2493
|
-
});
|
|
2494
|
-
handlers.push(restoreHandler);
|
|
2495
|
-
} catch (e) {
|
|
2496
|
-
console.error("failed to patch HTMLCanvasElement.prototype.getContext");
|
|
2497
|
-
}
|
|
2498
|
-
return () => {
|
|
2499
|
-
handlers.forEach((h) => h());
|
|
2500
|
-
};
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
|
-
function patchGLPrototype(prototype, type, cb, blockClass2, mirror, win) {
|
|
2504
|
-
const handlers = [];
|
|
2505
|
-
const props = Object.getOwnPropertyNames(prototype);
|
|
2506
|
-
for (const prop of props) {
|
|
2507
|
-
try {
|
|
2508
|
-
if (typeof prototype[prop] !== "function") {
|
|
2509
|
-
continue;
|
|
2510
|
-
}
|
|
2511
|
-
const restoreHandler = patch(prototype, prop, function(original) {
|
|
2512
|
-
return function(...args) {
|
|
2513
|
-
const result = original.apply(this, args);
|
|
2514
|
-
saveWebGLVar(result, win, prototype);
|
|
2515
|
-
if (!isBlocked(this.canvas, blockClass2)) {
|
|
2516
|
-
const id = mirror.getId(this.canvas);
|
|
2517
|
-
const recordArgs = serializeArgs([...args], win, prototype);
|
|
2518
|
-
const mutation = {
|
|
2519
|
-
type,
|
|
2520
|
-
property: prop,
|
|
2521
|
-
args: recordArgs
|
|
2522
|
-
};
|
|
2523
|
-
cb(this.canvas, mutation);
|
|
2524
|
-
}
|
|
2525
|
-
return result;
|
|
2526
|
-
};
|
|
2527
|
-
});
|
|
2528
|
-
handlers.push(restoreHandler);
|
|
2529
|
-
} catch (e) {
|
|
2530
|
-
const hookHandler = hookSetter(prototype, prop, {
|
|
2531
|
-
set(v) {
|
|
2532
|
-
cb(this.canvas, {
|
|
2533
|
-
type,
|
|
2534
|
-
property: prop,
|
|
2535
|
-
args: [v],
|
|
2536
|
-
setter: true
|
|
2537
|
-
});
|
|
2538
|
-
}
|
|
2539
|
-
});
|
|
2540
|
-
handlers.push(hookHandler);
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
return handlers;
|
|
2544
|
-
}
|
|
2545
|
-
function initCanvasWebGLMutationObserver(cb, win, blockClass2, mirror) {
|
|
2546
|
-
const handlers = [];
|
|
2547
|
-
handlers.push(...patchGLPrototype(win.WebGLRenderingContext.prototype, CanvasContext.WebGL, cb, blockClass2, mirror, win));
|
|
2548
|
-
if (typeof win.WebGL2RenderingContext !== "undefined") {
|
|
2549
|
-
handlers.push(...patchGLPrototype(win.WebGL2RenderingContext.prototype, CanvasContext.WebGL2, cb, blockClass2, mirror, win));
|
|
2550
|
-
}
|
|
2551
|
-
return () => {
|
|
2552
|
-
handlers.forEach((h) => h());
|
|
2553
|
-
};
|
|
2554
|
-
}
|
|
2555
|
-
|
|
2556
|
-
function decodeBase64(base64, enableUnicode) {
|
|
2557
|
-
var binaryString = atob(base64);
|
|
2558
|
-
if (enableUnicode) {
|
|
2559
|
-
var binaryView = new Uint8Array(binaryString.length);
|
|
2560
|
-
for (var i = 0, n = binaryString.length; i < n; ++i) {
|
|
2561
|
-
binaryView[i] = binaryString.charCodeAt(i);
|
|
2562
|
-
}
|
|
2563
|
-
return String.fromCharCode.apply(null, new Uint16Array(binaryView.buffer));
|
|
2564
|
-
}
|
|
2565
|
-
return binaryString;
|
|
2566
|
-
}
|
|
2567
|
-
|
|
2568
|
-
function createURL(base64, sourcemapArg, enableUnicodeArg) {
|
|
2569
|
-
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg;
|
|
2570
|
-
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg;
|
|
2571
|
-
var source = decodeBase64(base64, enableUnicode);
|
|
2572
|
-
var start = source.indexOf('\n', 10) + 1;
|
|
2573
|
-
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : '');
|
|
2574
|
-
var blob = new Blob([body], { type: 'application/javascript' });
|
|
2575
|
-
return URL.createObjectURL(blob);
|
|
2576
|
-
}
|
|
2577
|
-
|
|
2578
|
-
function createBase64WorkerFactory(base64, sourcemapArg, enableUnicodeArg) {
|
|
2579
|
-
var url;
|
|
2580
|
-
return function WorkerFactory(options) {
|
|
2581
|
-
url = url || createURL(base64, sourcemapArg, enableUnicodeArg);
|
|
2582
|
-
return new Worker(url, options);
|
|
2583
|
-
};
|
|
2584
|
-
}
|
|
2585
|
-
|
|
2586
|
-
var WorkerFactory = createBase64WorkerFactory('Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qCiAgICAgKiBiYXNlNjQtYXJyYXlidWZmZXIgMS4wLjEgPGh0dHBzOi8vZ2l0aHViLmNvbS9uaWtsYXN2aC9iYXNlNjQtYXJyYXlidWZmZXI+CiAgICAgKiBDb3B5cmlnaHQgKGMpIDIwMjEgTmlrbGFzIHZvbiBIZXJ0emVuIDxodHRwczovL2hlcnR6ZW4uY29tPgogICAgICogUmVsZWFzZWQgdW5kZXIgTUlUIExpY2Vuc2UKICAgICAqLwogICAgdmFyIGNoYXJzID0gJ0FCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFlaYWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXowMTIzNDU2Nzg5Ky8nOwogICAgLy8gVXNlIGEgbG9va3VwIHRhYmxlIHRvIGZpbmQgdGhlIGluZGV4LgogICAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAndW5kZWZpbmVkJyA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICAgIGZvciAodmFyIGkgPSAwOyBpIDwgY2hhcnMubGVuZ3RoOyBpKyspIHsKICAgICAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogICAgfQogICAgdmFyIGVuY29kZSA9IGZ1bmN0aW9uIChhcnJheWJ1ZmZlcikgewogICAgICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaSwgbGVuID0gYnl0ZXMubGVuZ3RoLCBiYXNlNjQgPSAnJzsKICAgICAgICBmb3IgKGkgPSAwOyBpIDwgbGVuOyBpICs9IDMpIHsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2ldID4+IDJdOwogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbKChieXRlc1tpXSAmIDMpIDw8IDQpIHwgKGJ5dGVzW2kgKyAxXSA+PiA0KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2kgKyAxXSAmIDE1KSA8PCAyKSB8IChieXRlc1tpICsgMl0gPj4gNildOwogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaSArIDJdICYgNjNdOwogICAgICAgIH0KICAgICAgICBpZiAobGVuICUgMyA9PT0gMikgewogICAgICAgICAgICBiYXNlNjQgPSBiYXNlNjQuc3Vic3RyaW5nKDAsIGJhc2U2NC5sZW5ndGggLSAxKSArICc9JzsKICAgICAgICB9CiAgICAgICAgZWxzZSBpZiAobGVuICUgMyA9PT0gMSkgewogICAgICAgICAgICBiYXNlNjQgPSBiYXNlNjQuc3Vic3RyaW5nKDAsIGJhc2U2NC5sZW5ndGggLSAyKSArICc9PSc7CiAgICAgICAgfQogICAgICAgIHJldHVybiBiYXNlNjQ7CiAgICB9OwoKICAgIGNvbnN0IGxhc3RCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICAgIGNvbnN0IHRyYW5zcGFyZW50QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCkgewogICAgICBjb25zdCBpZCA9IGAke3dpZHRofS0ke2hlaWdodH1gOwogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpCiAgICAgICAgcmV0dXJuIHRyYW5zcGFyZW50QmxvYk1hcC5nZXQoaWQpOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKCk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsKICAgIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICAgIGlmICghKCJPZmZzY3JlZW5DYW52YXMiIGluIGdsb2JhbFRoaXMpKQogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZDogZS5kYXRhLmlkIH0pOwogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQgfSA9IGUuZGF0YTsKICAgICAgY29uc3QgdHJhbnNwYXJlbnRCYXNlNjQgPSBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCk7CiAgICAgIGNvbnN0IG9mZnNjcmVlbiA9IG5ldyBPZmZzY3JlZW5DYW52YXMod2lkdGgsIGhlaWdodCk7CiAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCIyZCIpOwogICAgICBjdHguZHJhd0ltYWdlKGJpdG1hcCwgMCwgMCk7CiAgICAgIGJpdG1hcC5jbG9zZSgpOwogICAgICBjb25zdCBibG9iID0gYXdhaXQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsKICAgICAgICBpZCwKICAgICAgICB0eXBlLAogICAgICAgIGJhc2U2NCwKICAgICAgICB3aWR0aCwKICAgICAgICBoZWlnaHQKICAgICAgfSk7CiAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsKICAgIH07Cgp9KSgpOwoK', null, false);
|
|
2587
|
-
/* eslint-enable */
|
|
2588
|
-
|
|
2589
|
-
var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
|
|
2590
|
-
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
2591
|
-
var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
|
|
2592
|
-
var __objRest = (source, exclude) => {
|
|
2593
|
-
var target = {};
|
|
2594
|
-
for (var prop in source)
|
|
2595
|
-
if (__hasOwnProp$1.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
2596
|
-
target[prop] = source[prop];
|
|
2597
|
-
if (source != null && __getOwnPropSymbols$1)
|
|
2598
|
-
for (var prop of __getOwnPropSymbols$1(source)) {
|
|
2599
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum$1.call(source, prop))
|
|
2600
|
-
target[prop] = source[prop];
|
|
2601
|
-
}
|
|
2602
|
-
return target;
|
|
2603
|
-
};
|
|
2604
|
-
var __async = (__this, __arguments, generator) => {
|
|
2605
|
-
return new Promise((resolve, reject) => {
|
|
2606
|
-
var fulfilled = (value) => {
|
|
2607
|
-
try {
|
|
2608
|
-
step(generator.next(value));
|
|
2609
|
-
} catch (e) {
|
|
2610
|
-
reject(e);
|
|
2611
|
-
}
|
|
2612
|
-
};
|
|
2613
|
-
var rejected = (value) => {
|
|
2614
|
-
try {
|
|
2615
|
-
step(generator.throw(value));
|
|
2616
|
-
} catch (e) {
|
|
2617
|
-
reject(e);
|
|
2618
|
-
}
|
|
2619
|
-
};
|
|
2620
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
2621
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
2622
|
-
});
|
|
2623
|
-
};
|
|
2624
|
-
class CanvasManager {
|
|
2625
|
-
constructor(options) {
|
|
2626
|
-
this.pendingCanvasMutations = /* @__PURE__ */ new Map();
|
|
2627
|
-
this.rafStamps = { latestId: 0, invokeId: null };
|
|
2628
|
-
this.frozen = false;
|
|
2629
|
-
this.locked = false;
|
|
2630
|
-
this.processMutation = function(target, mutation) {
|
|
2631
|
-
const newFrame = this.rafStamps.invokeId && this.rafStamps.latestId !== this.rafStamps.invokeId;
|
|
2632
|
-
if (newFrame || !this.rafStamps.invokeId)
|
|
2633
|
-
this.rafStamps.invokeId = this.rafStamps.latestId;
|
|
2634
|
-
if (!this.pendingCanvasMutations.has(target)) {
|
|
2635
|
-
this.pendingCanvasMutations.set(target, []);
|
|
2636
|
-
}
|
|
2637
|
-
this.pendingCanvasMutations.get(target).push(mutation);
|
|
2638
|
-
};
|
|
2639
|
-
const { sampling = "all", win, blockClass, recordCanvas } = options;
|
|
2640
|
-
this.mutationCb = options.mutationCb;
|
|
2641
|
-
this.mirror = options.mirror;
|
|
2642
|
-
if (recordCanvas && sampling === "all")
|
|
2643
|
-
this.initCanvasMutationObserver(win, blockClass);
|
|
2644
|
-
if (recordCanvas && typeof sampling === "number")
|
|
2645
|
-
this.initCanvasFPSObserver(sampling, win, blockClass);
|
|
2646
|
-
}
|
|
2647
|
-
reset() {
|
|
2648
|
-
this.pendingCanvasMutations.clear();
|
|
2649
|
-
this.resetObservers && this.resetObservers();
|
|
2650
|
-
}
|
|
2651
|
-
freeze() {
|
|
2652
|
-
this.frozen = true;
|
|
2653
|
-
}
|
|
2654
|
-
unfreeze() {
|
|
2655
|
-
this.frozen = false;
|
|
2656
|
-
}
|
|
2657
|
-
lock() {
|
|
2658
|
-
this.locked = true;
|
|
2659
|
-
}
|
|
2660
|
-
unlock() {
|
|
2661
|
-
this.locked = false;
|
|
2662
|
-
}
|
|
2663
|
-
initCanvasFPSObserver(fps, win, blockClass) {
|
|
2664
|
-
const canvasContextReset = initCanvasContextObserver(win, blockClass);
|
|
2665
|
-
const snapshotInProgressMap = /* @__PURE__ */ new Map();
|
|
2666
|
-
const worker = new WorkerFactory();
|
|
2667
|
-
worker.onmessage = (e) => {
|
|
2668
|
-
const { id } = e.data;
|
|
2669
|
-
snapshotInProgressMap.set(id, false);
|
|
2670
|
-
if (!("base64" in e.data))
|
|
2671
|
-
return;
|
|
2672
|
-
const { base64, type, width, height } = e.data;
|
|
2673
|
-
this.mutationCb({
|
|
2674
|
-
id,
|
|
2675
|
-
type: CanvasContext["2D"],
|
|
2676
|
-
commands: [
|
|
2677
|
-
{
|
|
2678
|
-
property: "clearRect",
|
|
2679
|
-
args: [0, 0, width, height]
|
|
2680
|
-
},
|
|
2681
|
-
{
|
|
2682
|
-
property: "drawImage",
|
|
2683
|
-
args: [
|
|
2684
|
-
{
|
|
2685
|
-
rr_type: "ImageBitmap",
|
|
2686
|
-
args: [
|
|
2687
|
-
{
|
|
2688
|
-
rr_type: "Blob",
|
|
2689
|
-
data: [{ rr_type: "ArrayBuffer", base64 }],
|
|
2690
|
-
type
|
|
2691
|
-
}
|
|
2692
|
-
]
|
|
2693
|
-
},
|
|
2694
|
-
0,
|
|
2695
|
-
0
|
|
2696
|
-
]
|
|
2697
|
-
}
|
|
2698
|
-
]
|
|
2699
|
-
});
|
|
2700
|
-
};
|
|
2701
|
-
const timeBetweenSnapshots = 1e3 / fps;
|
|
2702
|
-
let lastSnapshotTime = 0;
|
|
2703
|
-
let rafId;
|
|
2704
|
-
const takeCanvasSnapshots = (timestamp) => {
|
|
2705
|
-
if (lastSnapshotTime && timestamp - lastSnapshotTime < timeBetweenSnapshots) {
|
|
2706
|
-
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
2707
|
-
return;
|
|
2708
|
-
}
|
|
2709
|
-
lastSnapshotTime = timestamp;
|
|
2710
|
-
win.document.querySelectorAll(`canvas:not(.${blockClass} *)`).forEach((canvas) => __async(this, null, function* () {
|
|
2711
|
-
var _a;
|
|
2712
|
-
const id = this.mirror.getId(canvas);
|
|
2713
|
-
if (snapshotInProgressMap.get(id))
|
|
2714
|
-
return;
|
|
2715
|
-
snapshotInProgressMap.set(id, true);
|
|
2716
|
-
if (["webgl", "webgl2"].includes(canvas.__context)) {
|
|
2717
|
-
const context = canvas.getContext(canvas.__context);
|
|
2718
|
-
if (((_a = context == null ? void 0 : context.getContextAttributes()) == null ? void 0 : _a.preserveDrawingBuffer) === false) {
|
|
2719
|
-
context == null ? void 0 : context.clear(context.COLOR_BUFFER_BIT);
|
|
2720
|
-
}
|
|
2721
|
-
}
|
|
2722
|
-
const bitmap = yield createImageBitmap(canvas);
|
|
2723
|
-
worker.postMessage({
|
|
2724
|
-
id,
|
|
2725
|
-
bitmap,
|
|
2726
|
-
width: canvas.width,
|
|
2727
|
-
height: canvas.height
|
|
2728
|
-
}, [bitmap]);
|
|
2729
|
-
}));
|
|
2730
|
-
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
2731
|
-
};
|
|
2732
|
-
rafId = requestAnimationFrame(takeCanvasSnapshots);
|
|
2733
|
-
this.resetObservers = () => {
|
|
2734
|
-
canvasContextReset();
|
|
2735
|
-
cancelAnimationFrame(rafId);
|
|
2736
|
-
};
|
|
2737
|
-
}
|
|
2738
|
-
initCanvasMutationObserver(win, blockClass) {
|
|
2739
|
-
this.startRAFTimestamping();
|
|
2740
|
-
this.startPendingCanvasMutationFlusher();
|
|
2741
|
-
const canvasContextReset = initCanvasContextObserver(win, blockClass);
|
|
2742
|
-
const canvas2DReset = initCanvas2DMutationObserver(this.processMutation.bind(this), win, blockClass, this.mirror);
|
|
2743
|
-
const canvasWebGL1and2Reset = initCanvasWebGLMutationObserver(this.processMutation.bind(this), win, blockClass, this.mirror);
|
|
2744
|
-
this.resetObservers = () => {
|
|
2745
|
-
canvasContextReset();
|
|
2746
|
-
canvas2DReset();
|
|
2747
|
-
canvasWebGL1and2Reset();
|
|
2748
|
-
};
|
|
2749
|
-
}
|
|
2750
|
-
startPendingCanvasMutationFlusher() {
|
|
2751
|
-
requestAnimationFrame(() => this.flushPendingCanvasMutations());
|
|
2752
|
-
}
|
|
2753
|
-
startRAFTimestamping() {
|
|
2754
|
-
const setLatestRAFTimestamp = (timestamp) => {
|
|
2755
|
-
this.rafStamps.latestId = timestamp;
|
|
2756
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
2757
|
-
};
|
|
2758
|
-
requestAnimationFrame(setLatestRAFTimestamp);
|
|
2759
|
-
}
|
|
2760
|
-
flushPendingCanvasMutations() {
|
|
2761
|
-
this.pendingCanvasMutations.forEach((values, canvas) => {
|
|
2762
|
-
const id = this.mirror.getId(canvas);
|
|
2763
|
-
this.flushPendingCanvasMutationFor(canvas, id);
|
|
2764
|
-
});
|
|
2765
|
-
requestAnimationFrame(() => this.flushPendingCanvasMutations());
|
|
2766
|
-
}
|
|
2767
|
-
flushPendingCanvasMutationFor(canvas, id) {
|
|
2768
|
-
if (this.frozen || this.locked) {
|
|
2769
|
-
return;
|
|
2770
|
-
}
|
|
2771
|
-
const valuesWithType = this.pendingCanvasMutations.get(canvas);
|
|
2772
|
-
if (!valuesWithType || id === -1)
|
|
2773
|
-
return;
|
|
2774
|
-
const values = valuesWithType.map((value) => {
|
|
2775
|
-
const _a = value, rest = __objRest(_a, ["type"]);
|
|
2776
|
-
return rest;
|
|
2777
|
-
});
|
|
2778
|
-
const { type } = valuesWithType[0];
|
|
2779
|
-
this.mutationCb({ id, type, commands: values });
|
|
2780
|
-
this.pendingCanvasMutations.delete(canvas);
|
|
2781
|
-
}
|
|
2782
|
-
}
|
|
2783
|
-
|
|
2784
|
-
class StylesheetManager {
|
|
2785
|
-
constructor(options) {
|
|
2786
|
-
this.trackedStylesheets = /* @__PURE__ */ new WeakSet();
|
|
2787
|
-
this.mutationCb = options.mutationCb;
|
|
2788
|
-
}
|
|
2789
|
-
addStylesheet(linkEl) {
|
|
2790
|
-
if (this.trackedStylesheets.has(linkEl))
|
|
2791
|
-
return;
|
|
2792
|
-
this.trackedStylesheets.add(linkEl);
|
|
2793
|
-
this.trackStylesheet(linkEl);
|
|
2794
|
-
}
|
|
2795
|
-
trackStylesheet(linkEl) {
|
|
2796
|
-
}
|
|
2797
|
-
attachStylesheet(linkEl, childSn, mirror) {
|
|
2798
|
-
this.mutationCb({
|
|
2799
|
-
adds: [
|
|
2800
|
-
{
|
|
2801
|
-
parentId: mirror.getId(linkEl),
|
|
2802
|
-
nextId: null,
|
|
2803
|
-
node: childSn
|
|
2804
|
-
}
|
|
2805
|
-
],
|
|
2806
|
-
removes: [],
|
|
2807
|
-
texts: [],
|
|
2808
|
-
attributes: []
|
|
2809
|
-
});
|
|
2810
|
-
this.addStylesheet(linkEl);
|
|
2811
|
-
}
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
|
-
var __defProp = Object.defineProperty;
|
|
2815
|
-
var __defProps = Object.defineProperties;
|
|
2816
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2817
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
2818
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
2819
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
2820
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
2821
|
-
var __spreadValues = (a, b) => {
|
|
2822
|
-
for (var prop in b || (b = {}))
|
|
2823
|
-
if (__hasOwnProp.call(b, prop))
|
|
2824
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2825
|
-
if (__getOwnPropSymbols)
|
|
2826
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
2827
|
-
if (__propIsEnum.call(b, prop))
|
|
2828
|
-
__defNormalProp(a, prop, b[prop]);
|
|
2829
|
-
}
|
|
2830
|
-
return a;
|
|
2831
|
-
};
|
|
2832
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
2833
|
-
function wrapEvent(e) {
|
|
2834
|
-
return __spreadProps(__spreadValues({}, e), {
|
|
2835
|
-
timestamp: Date.now()
|
|
2836
|
-
});
|
|
2837
|
-
}
|
|
2838
|
-
let wrappedEmit;
|
|
2839
|
-
let takeFullSnapshot;
|
|
2840
|
-
const mirror = createMirror();
|
|
2841
|
-
function record(options = {}) {
|
|
2842
|
-
const {
|
|
2843
|
-
emit,
|
|
2844
|
-
checkoutEveryNms,
|
|
2845
|
-
checkoutEveryNth,
|
|
2846
|
-
blockClass = "highlight-block",
|
|
2847
|
-
blockSelector = null,
|
|
2848
|
-
ignoreClass = "highlight-ignore",
|
|
2849
|
-
maskTextClass = "highlight-mask",
|
|
2850
|
-
maskTextSelector = null,
|
|
2851
|
-
inlineStylesheet = true,
|
|
2852
|
-
maskAllInputs,
|
|
2853
|
-
maskInputOptions: _maskInputOptions,
|
|
2854
|
-
slimDOMOptions: _slimDOMOptions,
|
|
2855
|
-
maskInputFn,
|
|
2856
|
-
maskTextFn,
|
|
2857
|
-
hooks,
|
|
2858
|
-
packFn,
|
|
2859
|
-
sampling = {},
|
|
2860
|
-
mousemoveWait,
|
|
2861
|
-
recordCanvas = false,
|
|
2862
|
-
userTriggeredOnInput = false,
|
|
2863
|
-
collectFonts = false,
|
|
2864
|
-
inlineImages = false,
|
|
2865
|
-
plugins,
|
|
2866
|
-
keepIframeSrcFn = () => false,
|
|
2867
|
-
enableStrictPrivacy = false
|
|
2868
|
-
} = options;
|
|
2869
|
-
if (!emit) {
|
|
2870
|
-
throw new Error("emit function is required");
|
|
2871
|
-
}
|
|
2872
|
-
if (mousemoveWait !== void 0 && sampling.mousemove === void 0) {
|
|
2873
|
-
sampling.mousemove = mousemoveWait;
|
|
2874
|
-
}
|
|
2875
|
-
mirror.reset();
|
|
2876
|
-
const maskInputOptions = maskAllInputs === true ? {
|
|
2877
|
-
color: true,
|
|
2878
|
-
date: true,
|
|
2879
|
-
"datetime-local": true,
|
|
2880
|
-
email: true,
|
|
2881
|
-
month: true,
|
|
2882
|
-
number: true,
|
|
2883
|
-
range: true,
|
|
2884
|
-
search: true,
|
|
2885
|
-
tel: true,
|
|
2886
|
-
text: true,
|
|
2887
|
-
time: true,
|
|
2888
|
-
url: true,
|
|
2889
|
-
week: true,
|
|
2890
|
-
textarea: true,
|
|
2891
|
-
select: true,
|
|
2892
|
-
password: true
|
|
2893
|
-
} : _maskInputOptions !== void 0 ? _maskInputOptions : { password: true };
|
|
2894
|
-
const slimDOMOptions = _slimDOMOptions === true || _slimDOMOptions === "all" ? {
|
|
2895
|
-
script: true,
|
|
2896
|
-
comment: true,
|
|
2897
|
-
headFavicon: true,
|
|
2898
|
-
headWhitespace: true,
|
|
2899
|
-
headMetaSocial: true,
|
|
2900
|
-
headMetaRobots: true,
|
|
2901
|
-
headMetaHttpEquiv: true,
|
|
2902
|
-
headMetaVerification: true,
|
|
2903
|
-
headMetaAuthorship: _slimDOMOptions === "all",
|
|
2904
|
-
headMetaDescKeywords: _slimDOMOptions === "all"
|
|
2905
|
-
} : _slimDOMOptions ? _slimDOMOptions : {};
|
|
2906
|
-
polyfill();
|
|
2907
|
-
let lastFullSnapshotEvent;
|
|
2908
|
-
let incrementalSnapshotCount = 0;
|
|
2909
|
-
const eventProcessor = (e) => {
|
|
2910
|
-
for (const plugin of plugins || []) {
|
|
2911
|
-
if (plugin.eventProcessor) {
|
|
2912
|
-
e = plugin.eventProcessor(e);
|
|
2913
|
-
}
|
|
2914
|
-
}
|
|
2915
|
-
if (packFn) {
|
|
2916
|
-
e = packFn(e);
|
|
2917
|
-
}
|
|
2918
|
-
return e;
|
|
2919
|
-
};
|
|
2920
|
-
wrappedEmit = (e, isCheckout) => {
|
|
2921
|
-
var _a;
|
|
2922
|
-
if (((_a = mutationBuffers[0]) == null ? void 0 : _a.isFrozen()) && e.type !== EventType.FullSnapshot && !(e.type === EventType.IncrementalSnapshot && e.data.source === IncrementalSource.Mutation)) {
|
|
2923
|
-
mutationBuffers.forEach((buf) => buf.unfreeze());
|
|
2924
|
-
}
|
|
2925
|
-
emit(eventProcessor(e), isCheckout);
|
|
2926
|
-
if (e.type === EventType.FullSnapshot) {
|
|
2927
|
-
lastFullSnapshotEvent = e;
|
|
2928
|
-
incrementalSnapshotCount = 0;
|
|
2929
|
-
} else if (e.type === EventType.IncrementalSnapshot) {
|
|
2930
|
-
if (e.data.source === IncrementalSource.Mutation && e.data.isAttachIframe) {
|
|
2931
|
-
return;
|
|
2932
|
-
}
|
|
2933
|
-
incrementalSnapshotCount++;
|
|
2934
|
-
const exceedCount = checkoutEveryNth && incrementalSnapshotCount >= checkoutEveryNth;
|
|
2935
|
-
const exceedTime = checkoutEveryNms && e.timestamp - lastFullSnapshotEvent.timestamp > checkoutEveryNms;
|
|
2936
|
-
if (exceedCount || exceedTime) {
|
|
2937
|
-
takeFullSnapshot(true);
|
|
2938
|
-
}
|
|
2939
|
-
}
|
|
2940
|
-
};
|
|
2941
|
-
const wrappedMutationEmit = (m) => {
|
|
2942
|
-
wrappedEmit(wrapEvent({
|
|
2943
|
-
type: EventType.IncrementalSnapshot,
|
|
2944
|
-
data: __spreadValues({
|
|
2945
|
-
source: IncrementalSource.Mutation
|
|
2946
|
-
}, m)
|
|
2947
|
-
}));
|
|
2948
|
-
};
|
|
2949
|
-
const wrappedScrollEmit = (p) => wrappedEmit(wrapEvent({
|
|
2950
|
-
type: EventType.IncrementalSnapshot,
|
|
2951
|
-
data: __spreadValues({
|
|
2952
|
-
source: IncrementalSource.Scroll
|
|
2953
|
-
}, p)
|
|
2954
|
-
}));
|
|
2955
|
-
const wrappedCanvasMutationEmit = (p) => wrappedEmit(wrapEvent({
|
|
2956
|
-
type: EventType.IncrementalSnapshot,
|
|
2957
|
-
data: __spreadValues({
|
|
2958
|
-
source: IncrementalSource.CanvasMutation
|
|
2959
|
-
}, p)
|
|
2960
|
-
}));
|
|
2961
|
-
const iframeManager = new IframeManager({
|
|
2962
|
-
mutationCb: wrappedMutationEmit
|
|
2963
|
-
});
|
|
2964
|
-
const stylesheetManager = new StylesheetManager({
|
|
2965
|
-
mutationCb: wrappedMutationEmit
|
|
2966
|
-
});
|
|
2967
|
-
const canvasManager = new CanvasManager({
|
|
2968
|
-
recordCanvas,
|
|
2969
|
-
mutationCb: wrappedCanvasMutationEmit,
|
|
2970
|
-
win: window,
|
|
2971
|
-
blockClass,
|
|
2972
|
-
mirror,
|
|
2973
|
-
sampling: sampling.canvas
|
|
2974
|
-
});
|
|
2975
|
-
const shadowDomManager = new ShadowDomManager({
|
|
2976
|
-
mutationCb: wrappedMutationEmit,
|
|
2977
|
-
scrollCb: wrappedScrollEmit,
|
|
2978
|
-
bypassOptions: {
|
|
2979
|
-
blockClass,
|
|
2980
|
-
blockSelector,
|
|
2981
|
-
maskTextClass,
|
|
2982
|
-
maskTextSelector,
|
|
2983
|
-
inlineStylesheet,
|
|
2984
|
-
maskInputOptions,
|
|
2985
|
-
maskTextFn,
|
|
2986
|
-
maskInputFn,
|
|
2987
|
-
recordCanvas,
|
|
2988
|
-
inlineImages,
|
|
2989
|
-
sampling,
|
|
2990
|
-
slimDOMOptions,
|
|
2991
|
-
iframeManager,
|
|
2992
|
-
stylesheetManager,
|
|
2993
|
-
canvasManager,
|
|
2994
|
-
enableStrictPrivacy
|
|
2995
|
-
},
|
|
2996
|
-
mirror
|
|
2997
|
-
});
|
|
2998
|
-
takeFullSnapshot = (isCheckout = false) => {
|
|
2999
|
-
var _a, _b, _c, _d;
|
|
3000
|
-
wrappedEmit(wrapEvent({
|
|
3001
|
-
type: EventType.Meta,
|
|
3002
|
-
data: {
|
|
3003
|
-
href: window.location.href,
|
|
3004
|
-
width: getWindowWidth(),
|
|
3005
|
-
height: getWindowHeight()
|
|
3006
|
-
}
|
|
3007
|
-
}), isCheckout);
|
|
3008
|
-
mutationBuffers.forEach((buf) => buf.lock());
|
|
3009
|
-
const node = snapshot(document, {
|
|
3010
|
-
mirror,
|
|
3011
|
-
blockClass,
|
|
3012
|
-
blockSelector,
|
|
3013
|
-
maskTextClass,
|
|
3014
|
-
maskTextSelector,
|
|
3015
|
-
inlineStylesheet,
|
|
3016
|
-
maskAllInputs: maskInputOptions,
|
|
3017
|
-
maskTextFn,
|
|
3018
|
-
slimDOM: slimDOMOptions,
|
|
3019
|
-
recordCanvas,
|
|
3020
|
-
inlineImages,
|
|
3021
|
-
enableStrictPrivacy,
|
|
3022
|
-
onSerialize: (n) => {
|
|
3023
|
-
if (isSerializedIframe(n, mirror)) {
|
|
3024
|
-
iframeManager.addIframe(n);
|
|
3025
|
-
}
|
|
3026
|
-
if (hasShadowRoot(n)) {
|
|
3027
|
-
shadowDomManager.addShadowRoot(n.shadowRoot, document);
|
|
3028
|
-
}
|
|
3029
|
-
},
|
|
3030
|
-
onIframeLoad: (iframe, childSn) => {
|
|
3031
|
-
iframeManager.attachIframe(iframe, childSn, mirror);
|
|
3032
|
-
shadowDomManager.observeAttachShadow(iframe);
|
|
3033
|
-
},
|
|
3034
|
-
onStylesheetLoad: (linkEl, childSn) => {
|
|
3035
|
-
this.stylesheetManager.attachStylesheet(linkEl, childSn, this.mirror);
|
|
3036
|
-
},
|
|
3037
|
-
keepIframeSrcFn
|
|
3038
|
-
});
|
|
3039
|
-
if (!node) {
|
|
3040
|
-
return console.warn("Failed to snapshot the document");
|
|
3041
|
-
}
|
|
3042
|
-
wrappedEmit(wrapEvent({
|
|
3043
|
-
type: EventType.FullSnapshot,
|
|
3044
|
-
data: {
|
|
3045
|
-
node,
|
|
3046
|
-
initialOffset: {
|
|
3047
|
-
left: window.pageXOffset !== void 0 ? window.pageXOffset : (document == null ? void 0 : document.documentElement.scrollLeft) || ((_b = (_a = document == null ? void 0 : document.body) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.scrollLeft) || (document == null ? void 0 : document.body.scrollLeft) || 0,
|
|
3048
|
-
top: window.pageYOffset !== void 0 ? window.pageYOffset : (document == null ? void 0 : document.documentElement.scrollTop) || ((_d = (_c = document == null ? void 0 : document.body) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.scrollTop) || (document == null ? void 0 : document.body.scrollTop) || 0
|
|
3049
|
-
}
|
|
3050
|
-
}
|
|
3051
|
-
}));
|
|
3052
|
-
mutationBuffers.forEach((buf) => buf.unlock());
|
|
3053
|
-
};
|
|
3054
|
-
try {
|
|
3055
|
-
const handlers = [];
|
|
3056
|
-
handlers.push(on("DOMContentLoaded", () => {
|
|
3057
|
-
wrappedEmit(wrapEvent({
|
|
3058
|
-
type: EventType.DomContentLoaded,
|
|
3059
|
-
data: {}
|
|
3060
|
-
}));
|
|
3061
|
-
}));
|
|
3062
|
-
const observe = (doc) => {
|
|
3063
|
-
var _a;
|
|
3064
|
-
return initObservers({
|
|
3065
|
-
mutationCb: wrappedMutationEmit,
|
|
3066
|
-
mousemoveCb: (positions, source) => wrappedEmit(wrapEvent({
|
|
3067
|
-
type: EventType.IncrementalSnapshot,
|
|
3068
|
-
data: {
|
|
3069
|
-
source,
|
|
3070
|
-
positions
|
|
3071
|
-
}
|
|
3072
|
-
})),
|
|
3073
|
-
mouseInteractionCb: (d) => wrappedEmit(wrapEvent({
|
|
3074
|
-
type: EventType.IncrementalSnapshot,
|
|
3075
|
-
data: __spreadValues({
|
|
3076
|
-
source: IncrementalSource.MouseInteraction
|
|
3077
|
-
}, d)
|
|
3078
|
-
})),
|
|
3079
|
-
scrollCb: wrappedScrollEmit,
|
|
3080
|
-
viewportResizeCb: (d) => wrappedEmit(wrapEvent({
|
|
3081
|
-
type: EventType.IncrementalSnapshot,
|
|
3082
|
-
data: __spreadValues({
|
|
3083
|
-
source: IncrementalSource.ViewportResize
|
|
3084
|
-
}, d)
|
|
3085
|
-
})),
|
|
3086
|
-
inputCb: (v) => wrappedEmit(wrapEvent({
|
|
3087
|
-
type: EventType.IncrementalSnapshot,
|
|
3088
|
-
data: __spreadValues({
|
|
3089
|
-
source: IncrementalSource.Input
|
|
3090
|
-
}, v)
|
|
3091
|
-
})),
|
|
3092
|
-
mediaInteractionCb: (p) => wrappedEmit(wrapEvent({
|
|
3093
|
-
type: EventType.IncrementalSnapshot,
|
|
3094
|
-
data: __spreadValues({
|
|
3095
|
-
source: IncrementalSource.MediaInteraction
|
|
3096
|
-
}, p)
|
|
3097
|
-
})),
|
|
3098
|
-
styleSheetRuleCb: (r) => wrappedEmit(wrapEvent({
|
|
3099
|
-
type: EventType.IncrementalSnapshot,
|
|
3100
|
-
data: __spreadValues({
|
|
3101
|
-
source: IncrementalSource.StyleSheetRule
|
|
3102
|
-
}, r)
|
|
3103
|
-
})),
|
|
3104
|
-
styleDeclarationCb: (r) => wrappedEmit(wrapEvent({
|
|
3105
|
-
type: EventType.IncrementalSnapshot,
|
|
3106
|
-
data: __spreadValues({
|
|
3107
|
-
source: IncrementalSource.StyleDeclaration
|
|
3108
|
-
}, r)
|
|
3109
|
-
})),
|
|
3110
|
-
canvasMutationCb: wrappedCanvasMutationEmit,
|
|
3111
|
-
fontCb: (p) => wrappedEmit(wrapEvent({
|
|
3112
|
-
type: EventType.IncrementalSnapshot,
|
|
3113
|
-
data: __spreadValues({
|
|
3114
|
-
source: IncrementalSource.Font
|
|
3115
|
-
}, p)
|
|
3116
|
-
})),
|
|
3117
|
-
blockClass,
|
|
3118
|
-
ignoreClass,
|
|
3119
|
-
maskTextClass,
|
|
3120
|
-
maskTextSelector,
|
|
3121
|
-
maskInputOptions,
|
|
3122
|
-
inlineStylesheet,
|
|
3123
|
-
sampling,
|
|
3124
|
-
recordCanvas,
|
|
3125
|
-
inlineImages,
|
|
3126
|
-
userTriggeredOnInput,
|
|
3127
|
-
collectFonts,
|
|
3128
|
-
doc,
|
|
3129
|
-
maskInputFn,
|
|
3130
|
-
maskTextFn,
|
|
3131
|
-
blockSelector,
|
|
3132
|
-
slimDOMOptions,
|
|
3133
|
-
mirror,
|
|
3134
|
-
iframeManager,
|
|
3135
|
-
stylesheetManager,
|
|
3136
|
-
shadowDomManager,
|
|
3137
|
-
canvasManager,
|
|
3138
|
-
enableStrictPrivacy,
|
|
3139
|
-
plugins: ((_a = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a.map((p) => ({
|
|
3140
|
-
observer: p.observer,
|
|
3141
|
-
options: p.options,
|
|
3142
|
-
callback: (payload) => wrappedEmit(wrapEvent({
|
|
3143
|
-
type: EventType.Plugin,
|
|
3144
|
-
data: {
|
|
3145
|
-
plugin: p.name,
|
|
3146
|
-
payload
|
|
3147
|
-
}
|
|
3148
|
-
}))
|
|
3149
|
-
}))) || []
|
|
3150
|
-
}, hooks);
|
|
3151
|
-
};
|
|
3152
|
-
iframeManager.addLoadListener((iframeEl) => {
|
|
3153
|
-
handlers.push(observe(iframeEl.contentDocument));
|
|
3154
|
-
});
|
|
3155
|
-
const init = () => {
|
|
3156
|
-
takeFullSnapshot();
|
|
3157
|
-
handlers.push(observe(document));
|
|
3158
|
-
};
|
|
3159
|
-
if (document.readyState === "interactive" || document.readyState === "complete") {
|
|
3160
|
-
init();
|
|
3161
|
-
} else {
|
|
3162
|
-
handlers.push(on("load", () => {
|
|
3163
|
-
wrappedEmit(wrapEvent({
|
|
3164
|
-
type: EventType.Load,
|
|
3165
|
-
data: {}
|
|
3166
|
-
}));
|
|
3167
|
-
init();
|
|
3168
|
-
}, window));
|
|
3169
|
-
}
|
|
3170
|
-
return () => {
|
|
3171
|
-
handlers.forEach((h) => h());
|
|
3172
|
-
};
|
|
3173
|
-
} catch (error) {
|
|
3174
|
-
console.warn(error);
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
record.addCustomEvent = (tag, payload) => {
|
|
3178
|
-
if (!wrappedEmit) {
|
|
3179
|
-
return;
|
|
3180
|
-
}
|
|
3181
|
-
wrappedEmit(wrapEvent({
|
|
3182
|
-
type: EventType.Custom,
|
|
3183
|
-
data: {
|
|
3184
|
-
tag,
|
|
3185
|
-
payload
|
|
3186
|
-
}
|
|
3187
|
-
}));
|
|
3188
|
-
};
|
|
3189
|
-
record.freezePage = () => {
|
|
3190
|
-
mutationBuffers.forEach((buf) => buf.freeze());
|
|
3191
|
-
};
|
|
3192
|
-
record.takeFullSnapshot = (isCheckout) => {
|
|
3193
|
-
if (!takeFullSnapshot) {
|
|
3194
|
-
throw new Error("please take full snapshot after start recording");
|
|
3195
|
-
}
|
|
3196
|
-
takeFullSnapshot(isCheckout);
|
|
3197
|
-
};
|
|
3198
|
-
record.mirror = mirror;
|
|
3199
|
-
|
|
3200
|
-
return record;
|
|
3201
|
-
|
|
3202
|
-
})();
|
|
1
|
+
var rrwebRecord=function(){"use strict";var x;(function(t){t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment"})(x||(x={}));function we(t){return t.nodeType===t.ELEMENT_NODE}function dt(t){var e,n=(e=t)===null||e===void 0?void 0:e.host;return Boolean(n?.shadowRoot===t)}var Rt=function(){function t(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return t.prototype.getId=function(e){var n;if(!e)return-1;var r=(n=this.getMeta(e))===null||n===void 0?void 0:n.id;return r??-1},t.prototype.getNode=function(e){return this.idNodeMap.get(e)||null},t.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},t.prototype.getMeta=function(e){return this.nodeMetaMap.get(e)||null},t.prototype.removeNodeFromMap=function(e){var n=this,r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach(function(o){return n.removeNodeFromMap(o)})},t.prototype.has=function(e){return this.idNodeMap.has(e)},t.prototype.hasNode=function(e){return this.nodeMetaMap.has(e)},t.prototype.add=function(e,n){var r=n.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,n)},t.prototype.replace=function(e,n){this.idNodeMap.set(e,n)},t.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t}();function Me(){return new Rt}function Mt(t){var e=t.maskInputOptions,n=t.tagName,r=t.type,o=t.value,i=t.maskInputFn,c=o||"";return(e[n.toLowerCase()]||e[r])&&(i?c=i(c):c="*".repeat(c.length)),c}var Dt="__rrweb_original__";function Te(t){var e=t.getContext("2d");if(!e)return!0;for(var n=50,r=0;r<t.width;r+=n)for(var o=0;o<t.height;o+=n){var i=e.getImageData,c=Dt in i?i[Dt]:i,a=new Uint32Array(c.call(e,r,o,Math.min(n,t.width-r),Math.min(n,t.height-o)).data.buffer);if(a.some(function(s){return s!==0}))return!1}return!0}function Ft(t){return t=t.replace(/[^ -~]+/g,""),t=t?.split(" ").map(function(e){return Math.random().toString(20).substr(2,e.length)}).join(" ")||"",t}var Oe=1,Le=new RegExp("[^a-z0-9-_:]"),pt=-2;function xe(){return Oe++}function Ne(t){if(t instanceof HTMLFormElement)return"form";var e=t.tagName.toLowerCase().trim();return Le.test(e)?"div":e}function Tt(t){try{var e=t.rules||t.cssRules;return e?Array.from(e).map(Ee).join(""):null}catch{return null}}function Ee(t){var e=t.cssText;if(Re(t))try{e=Tt(t.styleSheet)||e}catch{}return e}function Re(t){return"styleSheet"in t}function De(t){return t.cssRules?Array.from(t.cssRules).map(function(e){return e.cssText||""}).join(""):""}function Fe(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var rt,Pt,Pe=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Ae=/^(?!www\.|(?:http|ftp)s?:\/\/|[A-Za-z]:\\|\/\/|#).*/,_e=/^(data:)([^,]*),(.*)/i;function gt(t,e){return(t||"").replace(Pe,function(n,r,o,i,c,a){var s=o||c||a,l=r||i||"";if(!s)return n;if(!Ae.test(s)||_e.test(s))return"url("+l+s+l+")";if(s[0]==="/")return"url("+l+(Fe(e)+s)+l+")";var d=e.split("/"),p=s.split("/");d.pop();for(var m=0,u=p;m<u.length;m++){var h=u[m];h!=="."&&(h===".."?d.pop():d.push(h))}return"url("+l+d.join("/")+l+")"})}var We=/^[^ \t\n\r\u000c]+/,Ge=/^[, \t\n\r\u000c]+/;function ze(t,e){if(e.trim()==="")return e;var n=0;function r(l){var d,p=l.exec(e.substring(n));return p?(d=p[0],n+=d.length,d):""}for(var o=[];r(Ge),!(n>=e.length);){var i=r(We);if(i.slice(-1)===",")i=bt(t,i.substring(0,i.length-1)),o.push(i);else{var c="";i=bt(t,i);for(var a=!1;;){var s=e.charAt(n);if(s===""){o.push((i+c).trim());break}else if(a)s===")"&&(a=!1);else if(s===","){n+=1,o.push((i+c).trim());break}else s==="("&&(a=!0);c+=s,n+=1}}}return o.join(", ")}function bt(t,e){if(!e||e.trim()==="")return e;var n=t.createElement("a");return n.href=e,n.href}function Ve(t){return Boolean(t.tagName==="svg"||t.ownerSVGElement)}function Ot(){var t=document.createElement("a");return t.href="",t.href}function At(t,e,n,r){return n==="src"||n==="href"&&r||n==="xlink:href"&&r&&r[0]!=="#"||n==="background"&&r&&(e==="table"||e==="td"||e==="th")?bt(t,r):n==="srcset"&&r?ze(t,r):n==="style"&&r?gt(r,Ot()):e==="object"&&n==="data"&&r?bt(t,r):r}function je(t,e,n){if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var r=t.classList.length;r--;){var o=t.classList[r];if(e.test(o))return!0}return n?t.matches(n):!1}function St(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return n?St(t.parentNode,e,n):!1;for(var r=t.classList.length;r--;){var o=t.classList[r];if(e.test(o))return!0}return n?St(t.parentNode,e,n):!1}function _t(t,e,n){var r=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(r===null)return!1;if(typeof e=="string"){if(r.classList.contains(e)||r.closest("."+e))return!0}else if(St(r,e,!0))return!0;return!!(n&&(r.matches(n)||r.closest(n)))}function Ze(t,e,n){var r=t.contentWindow;if(r){var o=!1,i;try{i=r.document.readyState}catch{return}if(i!=="complete"){var c=setTimeout(function(){o||(e(),o=!0)},n);t.addEventListener("load",function(){clearTimeout(c),o=!0,e()});return}var a="about:blank";if(r.location.href!==a||t.src===a||t.src===""){setTimeout(e,0);return}t.addEventListener("load",e)}}function Ue(t){return t.getAttribute("href")?t.sheet!==null:!0}function Ye(t,e,n){var r=!1,o;try{o=t.sheet}catch{return}if(!o){var i=setTimeout(function(){r||(e(),r=!0)},n);t.addEventListener("load",function(){clearTimeout(i),r=!0,e()})}}function He(t,e){var n=e.doc,r=e.mirror,o=e.blockClass,i=e.blockSelector,c=e.maskTextClass,a=e.maskTextSelector,s=e.inlineStylesheet,l=e.maskInputOptions,d=l===void 0?{}:l,p=e.maskTextFn,m=e.maskInputFn,u=e.dataURLOptions,h=u===void 0?{}:u,y=e.inlineImages,S=e.recordCanvas,I=e.keepIframeSrcFn,w=e.newlyAddedElement,v=w===void 0?!1:w,f=e.enableStrictPrivacy,O=Xe(n,r);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:x.Document,childNodes:[],compatMode:t.compatMode,rootId:O}:{type:x.Document,childNodes:[],rootId:O};case t.DOCUMENT_TYPE_NODE:return{type:x.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:O};case t.ELEMENT_NODE:return Ke(t,{doc:n,blockClass:o,blockSelector:i,inlineStylesheet:s,maskInputOptions:d,maskInputFn:m,dataURLOptions:h,inlineImages:y,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:v,enableStrictPrivacy:f,rootId:O});case t.TEXT_NODE:return Be(t,{maskTextClass:c,maskTextSelector:a,maskTextFn:p,enableStrictPrivacy:f,rootId:O});case t.CDATA_SECTION_NODE:return{type:x.CDATA,textContent:"",rootId:O};case t.COMMENT_NODE:return{type:x.Comment,textContent:t.textContent||"",rootId:O};default:return!1}}function Xe(t,e){if(e.hasNode(t)){var n=e.getId(t);return n===1?void 0:n}}function Be(t,e){var n,r=e.maskTextClass,o=e.maskTextSelector,i=e.maskTextFn,c=e.enableStrictPrivacy,a=e.rootId,s=t.parentNode&&t.parentNode.tagName,l=t.textContent,d=s==="STYLE"?!0:void 0,p=s==="SCRIPT"?!0:void 0,m=!1;if(d&&l){try{t.nextSibling||t.previousSibling||!((n=t.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(l=De(t.parentNode.sheet))}catch(h){console.warn("Cannot get CSS styles from text's parentNode. Error: "+h,t)}l=gt(l,Ot()),m=!0}if(p?(l="SCRIPT_PLACEHOLDER",m=!0):s==="NOSCRIPT"&&(l="",m=!0),!d&&!p&&l&&_t(t,r,o)&&(l=i?i(l):l.replace(/[\S]/g,"*")),c&&!m&&s){var u=new Set(["HEAD","TITLE","STYLE","SCRIPT","HTML","BODY","NOSCRIPT"]);!u.has(s)&&l&&(l=Ft(l))}return{type:x.Text,textContent:l||"",isStyle:d,rootId:a}}function Ke(t,e){for(var n=e.doc,r=e.blockClass,o=e.blockSelector,i=e.inlineStylesheet,c=e.maskInputOptions,a=c===void 0?{}:c,s=e.maskInputFn,l=e.dataURLOptions,d=l===void 0?{}:l,p=e.inlineImages,m=e.recordCanvas,u=e.keepIframeSrcFn,h=e.newlyAddedElement,y=h===void 0?!1:h,S=e.enableStrictPrivacy,I=e.rootId,w=je(t,r,o),v=Ne(t),f={},O=t.attributes.length,W=0;W<O;W++){var F=t.attributes[W];f[F.name]=At(n,v,F.name,F.value)}if(v==="link"&&i){var E=Array.from(n.styleSheets).find(function(V){return V.href===t.href}),P=null;E&&(P=Tt(E)),P&&(delete f.rel,delete f.href,f._cssText=gt(P,E.href))}if(v==="style"&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){var P=Tt(t.sheet);P&&(f._cssText=gt(P,Ot()))}if(v==="input"||v==="textarea"||v==="select"){var Z=t.value;f.type!=="radio"&&f.type!=="checkbox"&&f.type!=="submit"&&f.type!=="button"&&Z?f.value=Mt({type:f.type,tagName:v,value:Z,maskInputOptions:a,maskInputFn:s}):t.checked&&(f.checked=t.checked)}if(v==="option"&&(t.selected&&!a.select?f.selected=!0:delete f.selected),v==="canvas"&&m){if(t.__context==="2d")Te(t)||(f.rr_dataURL=t.toDataURL(d.type,d.quality));else if(!("__context"in t)){var G=t.toDataURL(d.type,d.quality),K=document.createElement("canvas");K.width=t.width,K.height=t.height;var Y=K.toDataURL(d.type,d.quality);G!==Y&&(f.rr_dataURL=G)}}if(v==="img"&&p){rt||(rt=n.createElement("canvas"),Pt=rt.getContext("2d"));var R=t,z=R.crossOrigin;R.crossOrigin="anonymous";var $=function(){try{rt.width=R.naturalWidth,rt.height=R.naturalHeight,Pt.drawImage(R,0,0),f.rr_dataURL=rt.toDataURL(d.type,d.quality)}catch(V){console.warn("Cannot inline img src="+R.currentSrc+"! Error: "+V)}z?f.crossOrigin=z:R.removeAttribute("crossorigin")};R.complete&&R.naturalWidth!==0?$():R.onload=$}if((v==="audio"||v==="video")&&(f.rr_mediaState=t.paused?"paused":"played",f.rr_mediaCurrentTime=t.currentTime),y||(t.scrollLeft&&(f.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(f.rr_scrollTop=t.scrollTop)),w||v==="img"&&S){var tt=t.getBoundingClientRect(),A=tt.width,J=tt.height;f={class:f.class,rr_width:A+"px",rr_height:J+"px"},w=!0}return v==="iframe"&&!u(f.src)&&(t.contentDocument||(f.rr_src=f.src),delete f.src),{type:x.Element,tagName:v,attributes:f,childNodes:[],isSVG:Ve(t)||void 0,needBlock:w,rootId:I}}function k(t){return t===void 0?"":t.toLowerCase()}function $e(t,e){return!!(e.comment&&t.type===x.Comment||t.type===x.Element&&(e.script&&(t.tagName==="script"||t.tagName==="link"&&t.attributes.rel==="preload"&&t.attributes.as==="script"||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&t.attributes.href.endsWith(".js"))||e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(k(t.attributes.name).match(/^msapplication-tile(image|color)$/)||k(t.attributes.name)==="application-name"||k(t.attributes.rel)==="icon"||k(t.attributes.rel)==="apple-touch-icon"||k(t.attributes.rel)==="shortcut icon"))||t.tagName==="meta"&&(e.headMetaDescKeywords&&k(t.attributes.name).match(/^description|keywords$/)||e.headMetaSocial&&(k(t.attributes.property).match(/^(og|twitter|fb):/)||k(t.attributes.name).match(/^(og|twitter):/)||k(t.attributes.name)==="pinterest")||e.headMetaRobots&&(k(t.attributes.name)==="robots"||k(t.attributes.name)==="googlebot"||k(t.attributes.name)==="bingbot")||e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0||e.headMetaAuthorship&&(k(t.attributes.name)==="author"||k(t.attributes.name)==="generator"||k(t.attributes.name)==="framework"||k(t.attributes.name)==="publisher"||k(t.attributes.name)==="progid"||k(t.attributes.property).match(/^article:/)||k(t.attributes.property).match(/^product:/))||e.headMetaVerification&&(k(t.attributes.name)==="google-site-verification"||k(t.attributes.name)==="yandex-verification"||k(t.attributes.name)==="csrf-token"||k(t.attributes.name)==="p:domain_verify"||k(t.attributes.name)==="verify-v1"||k(t.attributes.name)==="verification"||k(t.attributes.name)==="shopify-checkout-api-token"))))}function ot(t,e){var n=e.doc,r=e.mirror,o=e.blockClass,i=e.blockSelector,c=e.maskTextClass,a=e.maskTextSelector,s=e.skipChild,l=s===void 0?!1:s,d=e.inlineStylesheet,p=d===void 0?!0:d,m=e.maskInputOptions,u=m===void 0?{}:m,h=e.maskTextFn,y=e.maskInputFn,S=e.slimDOMOptions,I=e.dataURLOptions,w=I===void 0?{}:I,v=e.inlineImages,f=v===void 0?!1:v,O=e.recordCanvas,W=O===void 0?!1:O,F=e.onSerialize,E=e.onIframeLoad,P=e.iframeLoadTimeout,Z=P===void 0?5e3:P,G=e.onStylesheetLoad,K=e.stylesheetLoadTimeout,Y=K===void 0?5e3:K,R=e.keepIframeSrcFn,z=R===void 0?function(){return!1}:R,$=e.newlyAddedElement,tt=$===void 0?!1:$,A=e.enableStrictPrivacy,J=e.preserveWhiteSpace,V=J===void 0?!0:J,H=He(t,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:a,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:y,dataURLOptions:w,inlineImages:f,recordCanvas:W,keepIframeSrcFn:z,newlyAddedElement:tt,enableStrictPrivacy:A});if(!H)return console.warn(t,"not serialized"),null;var g;if(r.hasNode(t)?g=r.getId(t):$e(H,S)||!V&&H.type===x.Text&&!H.isStyle&&!H.textContent.replace(/^\s+|\s+$/gm,"").length?g=pt:g=xe(),g===pt)return null;var b=Object.assign(H,{id:g});r.add(t,b),F&&F(t);var X=!l;if(b.type===x.Element){if(X=X&&!b.needBlock,b.needBlock&&b.tagName==="img"){var _=t.cloneNode();_.src="",r.add(_,b)}delete b.needBlock,t.shadowRoot&&(b.isShadowHost=!0)}if((b.type===x.Document||b.type===x.Element)&&X){S.headWhitespace&&b.type===x.Element&&b.tagName==="head"&&(V=!1);for(var Q={doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:a,skipChild:l,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:y,slimDOMOptions:S,dataURLOptions:w,inlineImages:f,recordCanvas:W,preserveWhiteSpace:V,onSerialize:F,onIframeLoad:E,iframeLoadTimeout:Z,onStylesheetLoad:G,stylesheetLoadTimeout:Y,keepIframeSrcFn:z,enableStrictPrivacy:A},C=0,T=Array.from(t.childNodes);C<T.length;C++){var nt=T[C],ct=ot(nt,Q);ct&&b.childNodes.push(ct)}if(we(t)&&t.shadowRoot)for(var Et=0,ke=Array.from(t.shadowRoot.childNodes);Et<ke.length;Et++){var nt=ke[Et],ct=ot(nt,Q);ct&&(ct.isShadow=!0,b.childNodes.push(ct))}}return t.parentNode&&dt(t.parentNode)&&(b.isShadow=!0),b.type===x.Element&&b.tagName==="iframe"&&Ze(t,function(){var ut=t.contentDocument;if(ut&&E){var Ie=ot(ut,{doc:ut,mirror:r,blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:a,skipChild:!1,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:y,slimDOMOptions:S,dataURLOptions:w,inlineImages:f,recordCanvas:W,preserveWhiteSpace:V,onSerialize:F,onIframeLoad:E,iframeLoadTimeout:Z,onStylesheetLoad:G,stylesheetLoadTimeout:Y,keepIframeSrcFn:z,enableStrictPrivacy:A});Ie&&E(t,Ie)}},Z),b.type===x.Element&&b.tagName==="link"&&b.attributes.rel==="stylesheet"&&(Ye(t,function(){if(G){var ut=ot(t,{doc:n,mirror:r,blockClass:o,blockSelector:i,maskTextClass:c,maskTextSelector:a,skipChild:!1,inlineStylesheet:p,maskInputOptions:u,maskTextFn:h,maskInputFn:y,slimDOMOptions:S,dataURLOptions:w,inlineImages:f,recordCanvas:W,preserveWhiteSpace:V,onSerialize:F,onIframeLoad:E,iframeLoadTimeout:Z,onStylesheetLoad:G,stylesheetLoadTimeout:Y,keepIframeSrcFn:z,enableStrictPrivacy:A});ut&&G(t,ut)}},Y),Ue(t)===!1)?null:b}function Je(t,e){var n=e||{},r=n.mirror,o=r===void 0?new Rt:r,i=n.blockClass,c=i===void 0?"highlight-block":i,a=n.blockSelector,s=a===void 0?null:a,l=n.maskTextClass,d=l===void 0?"highlight-mask":l,p=n.maskTextSelector,m=p===void 0?null:p,u=n.inlineStylesheet,h=u===void 0?!0:u,y=n.inlineImages,S=y===void 0?!1:y,I=n.recordCanvas,w=I===void 0?!1:I,v=n.maskAllInputs,f=v===void 0?!1:v,O=n.maskTextFn,W=n.maskInputFn,F=n.slimDOM,E=F===void 0?!1:F,P=n.dataURLOptions,Z=n.preserveWhiteSpace,G=n.onSerialize,K=n.onIframeLoad,Y=n.iframeLoadTimeout,R=n.onStylesheetLoad,z=n.stylesheetLoadTimeout,$=n.keepIframeSrcFn,tt=$===void 0?function(){return!1}:$,A=n.enableStrictPrivacy,J=A===void 0?!1:A,V=f===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f===!1?{password:!0}:f,H=E===!0||E==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:E==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:E===!1?{}:E;return ot(t,{doc:t,mirror:o,blockClass:c,blockSelector:s,maskTextClass:d,maskTextSelector:m,skipChild:!1,inlineStylesheet:h,maskInputOptions:V,maskTextFn:O,maskInputFn:W,slimDOMOptions:H,dataURLOptions:P,inlineImages:S,recordCanvas:w,preserveWhiteSpace:Z,onSerialize:G,onIframeLoad:K,iframeLoadTimeout:Y,onStylesheetLoad:R,stylesheetLoadTimeout:z,keepIframeSrcFn:tt,newlyAddedElement:!1,enableStrictPrivacy:J})}function j(t,e,n=document){const r={capture:!0,passive:!0};return n.addEventListener(t,e,r),()=>n.removeEventListener(t,e,r)}const at=`Please stop import mirror directly. Instead of that,\r
|
|
2
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
3
|
+
or you can use record.mirror to access the mirror instance during recording.`;let Wt={map:{},getId(){return console.error(at),-1},getNode(){return console.error(at),null},removeNodeFromMap(){console.error(at)},has(){return console.error(at),!1},reset(){console.error(at)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(Wt=new Proxy(Wt,{get(t,e,n){return e==="map"&&console.error(at),Reflect.get(t,e,n)}}));function ht(t,e,n={}){let r=null,o=0;return function(i){const c=Date.now();!o&&n.leading===!1&&(o=c);const a=e-(c-o),s=this,l=arguments;a<=0||a>e?(r&&(clearTimeout(r),r=null),o=c,t.apply(s,l)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{o=n.leading===!1?0:Date.now(),r=null,t.apply(s,l)},a))}}function Ct(t,e,n,r,o=window){const i=o.Object.getOwnPropertyDescriptor(t,e);return o.Object.defineProperty(t,e,r?n:{set(c){setTimeout(()=>{n.set.call(this,c)},0),i&&i.set&&i.set.call(this,c)}}),()=>Ct(t,e,i||{},!0)}function st(t,e,n){try{if(!(e in t))return()=>{};const r=t[e],o=n(r);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=o,()=>{t[e]=r}}catch{return()=>{}}}function Gt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function zt(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}const qe=t=>{try{if(t instanceof HTMLElement)return t.tagName==="CANVAS"}catch{return!1}return!1};function U(t,e,n){if(!t)return!1;const r=t.nodeType===t.ELEMENT_NODE?t:t.parentElement;if(!r)return!1;if(typeof e=="string"){if(r.classList.contains(e)||n&&r.closest("."+e)!==null)return!0}else if(St(r,e,n))return!0;return!1}function Qe(t,e){return e.getId(t)!==-1}function Lt(t,e){return e.getId(t)===pt}function Vt(t,e){if(dt(t))return!1;const n=e.getId(t);return e.has(n)?t.parentNode&&t.parentNode.nodeType===t.DOCUMENT_NODE?!1:t.parentNode?Vt(t.parentNode,e):!0:!0}function jt(t){return Boolean(t.changedTouches)}function tn(t=window){"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(e){if(!(0 in arguments))throw new TypeError("1 argument is required");do if(this===e)return!0;while(e=e&&e.parentNode);return!1})}function Zt(t,e){return Boolean(t.nodeName==="IFRAME"&&e.getMeta(t))}function Ut(t,e){return Boolean(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Yt(t){return Boolean(t?.shadowRoot)}var M=(t=>(t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t))(M||{}),D=(t=>(t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t))(D||{}),xt=(t=>(t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t))(xt||{}),it=(t=>(t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t))(it||{}),mt=(t=>(t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t))(mt||{}),en=(t=>(t.Start="start",t.Pause="pause",t.Resume="resume",t.Resize="resize",t.Finish="finish",t.FullsnapshotRebuilded="fullsnapshot-rebuilded",t.LoadStylesheetStart="load-stylesheet-start",t.LoadStylesheetEnd="load-stylesheet-end",t.SkipStart="skip-start",t.SkipEnd="skip-end",t.MouseInteraction="mouse-interaction",t.EventCast="event-cast",t.CustomEvent="custom-event",t.Flush="flush",t.StateChange="state-change",t.PlayBack="play-back",t))(en||{});function Ht(t){return"__ln"in t}class nn{constructor(){this.length=0,this.head=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<e;r++)n=n?.next||null;return n}addNode(e){const n={value:e,previous:null,next:null};if(e.__ln=n,e.previousSibling&&Ht(e.previousSibling)){const r=e.previousSibling.__ln.next;n.next=r,n.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(e.nextSibling&&Ht(e.nextSibling)&&e.nextSibling.__ln.previous){const r=e.nextSibling.__ln.previous;n.previous=r,n.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;this.length++}removeNode(e){const n=e.__ln;!this.head||(n.previous?(n.previous.next=n.next,n.next&&(n.next.previous=n.previous)):(this.head=n.next,this.head&&(this.head.previous=null)),e.__ln&&delete e.__ln,this.length--)}}const Xt=(t,e)=>`${t}@${e}`;class rn{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],n=new nn,r=a=>{let s=a,l=pt;for(;l===pt;)s=s&&s.nextSibling,l=s&&this.mirror.getId(s);return l},o=a=>{var s,l,d,p,m;const u=a.getRootNode?(s=a.getRootNode())==null?void 0:s.host:null;let h=u;for(;(d=(l=h?.getRootNode)==null?void 0:l.call(h))!=null&&d.host;)h=((m=(p=h?.getRootNode)==null?void 0:p.call(h))==null?void 0:m.host)||null;const y=!this.doc.contains(a)&&(!h||!this.doc.contains(h));if(!a.parentNode||y)return;const S=dt(a.parentNode)?this.mirror.getId(u):this.mirror.getId(a.parentNode),I=r(a);if(S===-1||I===-1)return n.addNode(a);const w=ot(a,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,enableStrictPrivacy:this.enableStrictPrivacy,onSerialize:v=>{Zt(v,this.mirror)&&this.iframeManager.addIframe(v),Ut(v,this.mirror)&&this.stylesheetManager.addStylesheet(v),Yt(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,document)},onIframeLoad:(v,f)=>{this.iframeManager.attachIframe(v,f,this.mirror),this.shadowDomManager.observeAttachShadow(v)},onStylesheetLoad:(v,f)=>{this.stylesheetManager.attachStylesheet(v,f,this.mirror)},newlyAddedElement:!0});w&&e.push({parentId:S,nextId:I,node:w})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of Array.from(this.movedSet.values()))Bt(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||o(a);for(const a of Array.from(this.addedSet.values()))!$t(this.droppedSet,a)&&!Bt(this.removes,a,this.mirror)||$t(this.movedSet,a)?o(a):this.droppedSet.add(a);let i=null;for(;n.length;){let a=null;if(i){const s=this.mirror.getId(i.value.parentNode),l=r(i.value);s!==-1&&l!==-1&&(a=i)}if(!a)for(let s=n.length-1;s>=0;s--){const l=n.get(s);if(l){const d=this.mirror.getId(l.value.parentNode),p=r(l.value);if(d!==-1&&p!==-1){a=l;break}}}if(!a){for(;n.head;)n.removeNode(n.head.value);break}i=a.previous,n.removeNode(a.value),o(a.value)}const c={texts:this.texts.map(a=>{let s=a.value;return this.enableStrictPrivacy&&s&&(s=Ft(s)),{id:this.mirror.getId(a.node),value:s}}).filter(a=>this.mirror.has(a.id)),attributes:this.attributes.map(a=>({id:this.mirror.getId(a.node),attributes:a.attributes})).filter(a=>this.mirror.has(a.id)),removes:this.removes,adds:e};!c.texts.length&&!c.attributes.length&&!c.removes.length&&!c.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(c))},this.processMutation=e=>{if(!Lt(e.target,this.mirror))switch(e.type){case"characterData":{const n=e.target.textContent;!U(e.target,this.blockClass,!1)&&n!==e.oldValue&&this.texts.push({value:_t(e.target,this.maskTextClass,this.maskTextSelector)&&n?this.maskTextFn?this.maskTextFn(n):n.replace(/[\S]/g,"*"):n,node:e.target});break}case"attributes":{const n=e.target;let r=e.target.getAttribute(e.attributeName);if(e.attributeName==="value"&&(r=Mt({maskInputOptions:this.maskInputOptions,tagName:e.target.tagName,type:e.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),U(e.target,this.blockClass,!1)||r===e.oldValue)return;let o=this.attributes.find(i=>i.node===e.target);if(o||(o={node:e.target,attributes:{}},this.attributes.push(o)),e.attributeName==="style"){const i=this.doc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue),(o.attributes.style===void 0||o.attributes.style===null)&&(o.attributes.style={});const c=o.attributes.style;for(const a of Array.from(n.style)){const s=n.style.getPropertyValue(a),l=n.style.getPropertyPriority(a);(s!==i.style.getPropertyValue(a)||l!==i.style.getPropertyPriority(a))&&(l===""?c[a]=s:c[a]=[s,l])}for(const a of Array.from(i.style))n.style.getPropertyValue(a)===""&&(c[a]=!1)}else{if(e.target.tagName==="INPUT"){const i=e.target;if(i.type==="password"){o.attributes.value="*".repeat(i.value.length);break}}o.attributes[e.attributeName]=At(this.doc,e.target.tagName,e.attributeName,r)}break}case"childList":{if(U(e.target,this.blockClass,!0))return;e.addedNodes.forEach(n=>this.genAdds(n,e.target)),e.removedNodes.forEach(n=>{const r=this.mirror.getId(n),o=dt(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);U(e.target,this.blockClass,!1)||Lt(n,this.mirror)||!Qe(n,this.mirror)||(this.addedSet.has(n)?(Nt(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(e.target)&&r===-1||Vt(e.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Xt(r,o)]?Nt(this.movedSet,n):this.removes.push({parentId:o,id:r,isShadow:dt(e.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(e,n)=>{if(this.mirror.hasNode(e)){if(Lt(e,this.mirror))return;this.movedSet.add(e);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Xt(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);U(e,this.blockClass,!1)||e.childNodes.forEach(r=>this.genAdds(r))}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","recordCanvas","inlineImages","slimDOMOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","enableStrictPrivacy"].forEach(n=>{this[n]=e[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Nt(t,e){t.delete(e),e.childNodes.forEach(n=>Nt(t,n))}function Bt(t,e,n){return t.length===0?!1:Kt(t,e,n)}function Kt(t,e,n){const{parentNode:r}=e;if(!r)return!1;const o=n.getId(r);return t.some(i=>i.id===o)?!0:Kt(t,r,n)}function $t(t,e){return t.size===0?!1:Jt(t,e)}function Jt(t,e){const{parentNode:n}=e;return n?t.has(n)?!0:Jt(t,n):!1}var on=Object.defineProperty,an=Object.defineProperties,sn=Object.getOwnPropertyDescriptors,qt=Object.getOwnPropertySymbols,ln=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable,Qt=(t,e,n)=>e in t?on(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,te=(t,e)=>{for(var n in e||(e={}))ln.call(e,n)&&Qt(t,n,e[n]);if(qt)for(var n of qt(e))cn.call(e,n)&&Qt(t,n,e[n]);return t},un=(t,e)=>an(t,sn(e));const et=[],ee=typeof CSSGroupingRule<"u",ne=typeof CSSMediaRule<"u",re=typeof CSSSupportsRule<"u",oe=typeof CSSConditionRule<"u";function ft(t){try{if("composedPath"in t){const e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0];return t.target}catch{return t.target}}function ae(t,e){var n,r;const o=new rn;et.push(o),o.init(t);let i=window.MutationObserver||window.__rrMutationObserver;const c=(r=(n=window?.Zone)==null?void 0:n.__symbol__)==null?void 0:r.call(n,"MutationObserver");c&&window[c]&&(i=window[c]);const a=new i(o.processMutations.bind(o));return a.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),a}function dn({mousemoveCb:t,sampling:e,doc:n,mirror:r}){if(e.mousemove===!1)return()=>{};const o=typeof e.mousemove=="number"?e.mousemove:50,i=typeof e.mousemoveCallback=="number"?e.mousemoveCallback:500;let c=[],a;const s=ht(p=>{const m=Date.now()-a;t(c.map(u=>(u.timeOffset-=m,u)),p),c=[],a=null},i),l=ht(p=>{const m=ft(p),{clientX:u,clientY:h}=jt(p)?p.changedTouches[0]:p;a||(a=Date.now()),c.push({x:u,y:h,id:r.getId(m),timeOffset:Date.now()-a}),s(typeof DragEvent<"u"&&p instanceof DragEvent?D.Drag:p instanceof MouseEvent?D.MouseMove:D.TouchMove)},o,{trailing:!1}),d=[j("mousemove",l,n),j("touchmove",l,n),j("drag",l,n)];return()=>{d.forEach(p=>p())}}function pn({mouseInteractionCb:t,doc:e,mirror:n,blockClass:r,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const i=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[],a=s=>l=>{const d=ft(l);if(U(d,r,!0)||qe(d))return;const p=jt(l)?l.changedTouches[0]:l;if(!p)return;const m=n.getId(d),{clientX:u,clientY:h}=p;t({type:xt[s],id:m,x:u,y:h})};return Object.keys(xt).filter(s=>Number.isNaN(Number(s))&&!s.endsWith("_Departed")&&i[s]!==!1).forEach(s=>{const l=s.toLowerCase(),d=a(s);c.push(j(l,d,e))}),()=>{c.forEach(s=>s())}}function se({scrollCb:t,doc:e,mirror:n,blockClass:r,sampling:o}){const i=ht(c=>{const a=ft(c);if(!a||U(a,r,!0))return;const s=n.getId(a);if(a===e){const l=e.scrollingElement||e.documentElement;t({id:s,x:l.scrollLeft,y:l.scrollTop})}else t({id:s,x:a.scrollLeft,y:a.scrollTop})},o.scroll||100);return j("scroll",i,e)}function hn({viewportResizeCb:t}){let e=-1,n=-1;const r=ht(()=>{const o=Gt(),i=zt();(e!==o||n!==i)&&(t({width:Number(i),height:Number(o)}),e=o,n=i)},200);return j("resize",r,window)}function ie(t,e){const n=te({},t);return e||delete n.userTriggered,n}const mn=["INPUT","TEXTAREA","SELECT"],le=new WeakMap;function fn({inputCb:t,doc:e,mirror:n,blockClass:r,ignoreClass:o,maskInputOptions:i,maskInputFn:c,sampling:a,userTriggeredOnInput:s}){function l(h){let y=ft(h);const S=h.isTrusted;if(y&&y.tagName==="OPTION"&&(y=y.parentElement),!y||!y.tagName||mn.indexOf(y.tagName)<0||U(y,r,!0))return;const I=y.type;if(y.classList.contains(o))return;let w=y.value,v=!1;I==="radio"||I==="checkbox"?v=y.checked:(i[y.tagName.toLowerCase()]||i[I])&&(w=Mt({maskInputOptions:i,tagName:y.tagName,type:I,value:w,maskInputFn:c})),d(y,ie({text:w,isChecked:v,userTriggered:S},s));const f=y.name;I==="radio"&&f&&v&&e.querySelectorAll(`input[type="radio"][name="${f}"]`).forEach(O=>{O!==y&&d(O,ie({text:O.value,isChecked:!v,userTriggered:!1},s))})}function d(h,y){const S=le.get(h);if(!S||S.text!==y.text||S.isChecked!==y.isChecked){le.set(h,y);const I=n.getId(h);t(un(te({},y),{id:I}))}}const p=(a.input==="last"?["change"]:["input","change"]).map(h=>j(h,l,e)),m=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),u=[[HTMLInputElement.prototype,"value"],[HTMLInputElement.prototype,"checked"],[HTMLSelectElement.prototype,"value"],[HTMLTextAreaElement.prototype,"value"],[HTMLSelectElement.prototype,"selectedIndex"],[HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...u.map(h=>Ct(h[0],h[1],{set(){l({target:this})}}))),()=>{p.forEach(h=>h())}}function kt(t){const e=[];function n(r,o){if(ee&&r.parentRule instanceof CSSGroupingRule||ne&&r.parentRule instanceof CSSMediaRule||re&&r.parentRule instanceof CSSSupportsRule||oe&&r.parentRule instanceof CSSConditionRule){const i=Array.from(r.parentRule.cssRules).indexOf(r);o.unshift(i)}else{const i=Array.from(r.parentStyleSheet.cssRules).indexOf(r);o.unshift(i)}return o}return n(t,e)}function yn({styleSheetRuleCb:t,mirror:e},{win:n}){const r=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=function(a,s){const l=e.getId(this.ownerNode);return l!==-1&&t({id:l,adds:[{rule:a,index:s}]}),r.apply(this,arguments)};const o=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=function(a){const s=e.getId(this.ownerNode);return s!==-1&&t({id:s,removes:[{index:a}]}),o.apply(this,arguments)};const i={};ee?i.CSSGroupingRule=n.CSSGroupingRule:(ne&&(i.CSSMediaRule=n.CSSMediaRule),oe&&(i.CSSConditionRule=n.CSSConditionRule),re&&(i.CSSSupportsRule=n.CSSSupportsRule));const c={};return Object.entries(i).forEach(([a,s])=>{c[a]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=function(l,d){const p=e.getId(this.parentStyleSheet.ownerNode);return p!==-1&&t({id:p,adds:[{rule:l,index:[...kt(this),d||0]}]}),c[a].insertRule.apply(this,arguments)},s.prototype.deleteRule=function(l){const d=e.getId(this.parentStyleSheet.ownerNode);return d!==-1&&t({id:d,removes:[{index:[...kt(this),l]}]}),c[a].deleteRule.apply(this,arguments)}}),()=>{n.CSSStyleSheet.prototype.insertRule=r,n.CSSStyleSheet.prototype.deleteRule=o,Object.entries(i).forEach(([a,s])=>{s.prototype.insertRule=c[a].insertRule,s.prototype.deleteRule=c[a].deleteRule})}}function vn({styleDeclarationCb:t,mirror:e},{win:n}){const r=n.CSSStyleDeclaration.prototype.setProperty;n.CSSStyleDeclaration.prototype.setProperty=function(i,c,a){var s,l;const d=e.getId((l=(s=this.parentRule)==null?void 0:s.parentStyleSheet)==null?void 0:l.ownerNode);return d!==-1&&t({id:d,set:{property:i,value:c,priority:a},index:kt(this.parentRule)}),r.apply(this,arguments)};const o=n.CSSStyleDeclaration.prototype.removeProperty;return n.CSSStyleDeclaration.prototype.removeProperty=function(i){var c,a;const s=e.getId((a=(c=this.parentRule)==null?void 0:c.parentStyleSheet)==null?void 0:a.ownerNode);return s!==-1&&t({id:s,remove:{property:i},index:kt(this.parentRule)}),o.apply(this,arguments)},()=>{n.CSSStyleDeclaration.prototype.setProperty=r,n.CSSStyleDeclaration.prototype.removeProperty=o}}function gn({mediaInteractionCb:t,blockClass:e,mirror:n,sampling:r}){const o=c=>ht(a=>{const s=ft(a);if(!s||U(s,e,!0))return;const{currentTime:l,volume:d,muted:p}=s;t({type:c,id:n.getId(s),currentTime:l,volume:d,muted:p})},r.media||500),i=[j("play",o(mt.Play)),j("pause",o(mt.Pause)),j("seeked",o(mt.Seeked)),j("volumechange",o(mt.VolumeChange))];return()=>{i.forEach(c=>c())}}function bn({fontCb:t,doc:e}){const n=e.defaultView;if(!n)return()=>{};const r=[],o=new WeakMap,i=n.FontFace;n.FontFace=function(a,s,l){const d=new i(a,s,l);return o.set(d,{family:a,buffer:typeof s!="string",descriptors:l,fontSource:typeof s=="string"?s:JSON.stringify(Array.from(new Uint8Array(s)))}),d};const c=st(e.fonts,"add",function(a){return function(s){return setTimeout(()=>{const l=o.get(s);l&&(t(l),o.delete(s))},0),a.apply(this,[s])}});return r.push(()=>{n.FontFace=i}),r.push(c),()=>{r.forEach(a=>a())}}function Sn(t,e){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:o,scrollCb:i,viewportResizeCb:c,inputCb:a,mediaInteractionCb:s,styleSheetRuleCb:l,styleDeclarationCb:d,canvasMutationCb:p,fontCb:m}=t;t.mutationCb=(...u)=>{e.mutation&&e.mutation(...u),n(...u)},t.mousemoveCb=(...u)=>{e.mousemove&&e.mousemove(...u),r(...u)},t.mouseInteractionCb=(...u)=>{e.mouseInteraction&&e.mouseInteraction(...u),o(...u)},t.scrollCb=(...u)=>{e.scroll&&e.scroll(...u),i(...u)},t.viewportResizeCb=(...u)=>{e.viewportResize&&e.viewportResize(...u),c(...u)},t.inputCb=(...u)=>{e.input&&e.input(...u),a(...u)},t.mediaInteractionCb=(...u)=>{e.mediaInteaction&&e.mediaInteaction(...u),s(...u)},t.styleSheetRuleCb=(...u)=>{e.styleSheetRule&&e.styleSheetRule(...u),l(...u)},t.styleDeclarationCb=(...u)=>{e.styleDeclaration&&e.styleDeclaration(...u),d(...u)},t.canvasMutationCb=(...u)=>{e.canvasMutation&&e.canvasMutation(...u),p(...u)},t.fontCb=(...u)=>{e.font&&e.font(...u),m(...u)}}function Cn(t,e={}){const n=t.doc.defaultView;if(!n)return()=>{};Sn(t,e);const r=ae(t,t.doc),o=dn(t),i=pn(t),c=se(t),a=hn(t),s=fn(t),l=gn(t),d=yn(t,{win:n}),p=vn(t,{win:n}),m=t.collectFonts?bn(t):()=>{},u=[];for(const h of t.plugins)u.push(h.observer(h.callback,n,h.options));return()=>{et.forEach(h=>h.reset()),r.disconnect(),o(),i(),c(),a(),s(),l(),d(),p(),m(),u.forEach(h=>h())}}class kn{constructor(e){this.iframes=new WeakMap,this.mutationCb=e.mutationCb}addIframe(e){this.iframes.set(e,!0)}addLoadListener(e){this.loadListener=e}attachIframe(e,n,r){var o;this.mutationCb({adds:[{parentId:r.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(o=this.loadListener)==null||o.call(this,e)}}var In=Object.defineProperty,wn=Object.defineProperties,Mn=Object.getOwnPropertyDescriptors,ce=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,On=Object.prototype.propertyIsEnumerable,ue=(t,e,n)=>e in t?In(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,de=(t,e)=>{for(var n in e||(e={}))Tn.call(e,n)&&ue(t,n,e[n]);if(ce)for(var n of ce(e))On.call(e,n)&&ue(t,n,e[n]);return t},pe=(t,e)=>wn(t,Mn(e));class Ln{constructor(e){this.restorePatches=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror;const n=this;this.restorePatches.push(st(HTMLElement.prototype,"attachShadow",function(r){return function(){const o=r.apply(this,arguments);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,this.ownerDocument),o}}))}addShadowRoot(e,n){ae(pe(de({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e),se(pe(de({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))}observeAttachShadow(e){if(e.contentWindow){const n=this;this.restorePatches.push(st(e.contentWindow.HTMLElement.prototype,"attachShadow",function(r){return function(){const o=r.apply(this,arguments);return this.shadowRoot&&n.addShadowRoot(this.shadowRoot,e.contentDocument),o}}))}}reset(){this.restorePatches.forEach(e=>e())}}for(var lt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",xn=typeof Uint8Array>"u"?[]:new Uint8Array(256),It=0;It<lt.length;It++)xn[lt.charCodeAt(It)]=It;var Nn=function(t){var e=new Uint8Array(t),n,r=e.length,o="";for(n=0;n<r;n+=3)o+=lt[e[n]>>2],o+=lt[(e[n]&3)<<4|e[n+1]>>4],o+=lt[(e[n+1]&15)<<2|e[n+2]>>6],o+=lt[e[n+2]&63];return r%3===2?o=o.substring(0,o.length-1)+"=":r%3===1&&(o=o.substring(0,o.length-2)+"=="),o};const he=new Map;function En(t,e){let n=he.get(t);return n||(n=new Map,he.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}const me=(t,e,n)=>{if(!t||!(ye(t,e)||typeof t=="object"))return;const r=t.constructor.name,o=En(n,r);let i=o.indexOf(t);return i===-1&&(i=o.length,o.push(t)),i};function wt(t,e,n){if(t instanceof Array)return t.map(r=>wt(r,e,n));if(t===null)return t;if(t instanceof Float32Array||t instanceof Float64Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Uint8Array||t instanceof Uint16Array||t instanceof Int16Array||t instanceof Int8Array||t instanceof Uint8ClampedArray)return{rr_type:t.constructor.name,args:[Object.values(t)]};if(t instanceof ArrayBuffer){const r=t.constructor.name,o=Nn(t);return{rr_type:r,base64:o}}else{if(t instanceof DataView)return{rr_type:t.constructor.name,args:[wt(t.buffer,e,n),t.byteOffset,t.byteLength]};if(t instanceof HTMLImageElement){const r=t.constructor.name,{src:o}=t;return{rr_type:r,src:o}}else if(t instanceof HTMLCanvasElement){const r="HTMLImageElement",o=t.toDataURL();return{rr_type:r,src:o}}else{if(t instanceof ImageData)return{rr_type:t.constructor.name,args:[wt(t.data,e,n),t.width,t.height]};if(ye(t,e)||typeof t=="object"){const r=t.constructor.name,o=me(t,e,n);return{rr_type:r,index:o}}}}return t}const fe=(t,e,n)=>[...t].map(r=>wt(r,e,n)),ye=(t,e)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(r=>typeof e[r]=="function");return Boolean(n.find(r=>t instanceof e[r]))};function Rn(t,e,n,r){const o=[],i=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype);for(const c of i)try{if(typeof e.CanvasRenderingContext2D.prototype[c]!="function")continue;const a=st(e.CanvasRenderingContext2D.prototype,c,function(s){return function(...l){return U(this.canvas,n,!0)||setTimeout(()=>{const d=fe([...l],e,this);t(this.canvas,{type:it["2D"],property:c,args:d})},0),s.apply(this,l)}});o.push(a)}catch{const s=Ct(e.CanvasRenderingContext2D.prototype,c,{set(l){t(this.canvas,{type:it["2D"],property:c,args:[l],setter:!0})}});o.push(s)}return()=>{o.forEach(c=>c())}}function ve(t,e){const n=[];try{const r=st(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(i,...c){return U(this,e,!0)||"__context"in this||(this.__context=i),o.apply(this,[i,...c])}});n.push(r)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{n.forEach(r=>r())}}function ge(t,e,n,r,o,i){const c=[],a=Object.getOwnPropertyNames(t);for(const s of a)try{if(typeof t[s]!="function")continue;const l=st(t,s,function(d){return function(...p){const m=d.apply(this,p);if(me(m,i,t),!U(this.canvas,r,!0)){const u=fe([...p],i,t),h={type:e,property:s,args:u};n(this.canvas,h)}return m}});c.push(l)}catch{const d=Ct(t,s,{set(p){n(this.canvas,{type:e,property:s,args:[p],setter:!0})}});c.push(d)}return c}function Dn(t,e,n,r){const o=[];return o.push(...ge(e.WebGLRenderingContext.prototype,it.WebGL,t,n,r,e)),typeof e.WebGL2RenderingContext<"u"&&o.push(...ge(e.WebGL2RenderingContext.prototype,it.WebGL2,t,n,r,e)),()=>{o.forEach(i=>i())}}function Fn(t,e){var n=atob(t);if(e){for(var r=new Uint8Array(n.length),o=0,i=n.length;o<i;++o)r[o]=n.charCodeAt(o);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}function Pn(t,e,n){var r=e===void 0?null:e,o=n===void 0?!1:n,i=Fn(t,o),c=i.indexOf(`
|
|
4
|
+
`,10)+1,a=i.substring(c)+(r?"//# sourceMappingURL="+r:""),s=new Blob([a],{type:"application/javascript"});return URL.createObjectURL(s)}function An(t,e,n){var r;return function(i){return r=r||Pn(t,e,n),new Worker(r,i)}}var _n=An("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24oKXsidXNlIHN0cmljdCI7Zm9yKHZhciByPSJBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWmFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6MDEyMzQ1Njc4OSsvIixsPXR5cGVvZiBVaW50OEFycmF5PiJ1Ij9bXTpuZXcgVWludDhBcnJheSgyNTYpLGY9MDtmPHIubGVuZ3RoO2YrKylsW3IuY2hhckNvZGVBdChmKV09Zjt2YXIgZD1mdW5jdGlvbihzKXt2YXIgZT1uZXcgVWludDhBcnJheShzKSxuLGE9ZS5sZW5ndGgsdD0iIjtmb3Iobj0wO248YTtuKz0zKXQrPXJbZVtuXT4+Ml0sdCs9clsoZVtuXSYzKTw8NHxlW24rMV0+PjRdLHQrPXJbKGVbbisxXSYxNSk8PDJ8ZVtuKzJdPj42XSx0Kz1yW2VbbisyXSY2M107cmV0dXJuIGElMz09PTI/dD10LnN1YnN0cmluZygwLHQubGVuZ3RoLTEpKyI9IjphJTM9PT0xJiYodD10LnN1YnN0cmluZygwLHQubGVuZ3RoLTIpKyI9PSIpLHR9O2NvbnN0IGM9bmV3IE1hcCx1PW5ldyBNYXA7YXN5bmMgZnVuY3Rpb24gcChzLGUpe2NvbnN0IG49YCR7c30tJHtlfWA7aWYodS5oYXMobikpcmV0dXJuIHUuZ2V0KG4pO2NvbnN0IGE9bmV3IE9mZnNjcmVlbkNhbnZhcyhzLGUpO2EuZ2V0Q29udGV4dCgiMmQiKTtjb25zdCB0PWF3YWl0KGF3YWl0IGEuY29udmVydFRvQmxvYigpKS5hcnJheUJ1ZmZlcigpLGc9ZCh0KTtyZXR1cm4gdS5zZXQobixnKSxnfWNvbnN0IGk9c2VsZjtpLm9ubWVzc2FnZT1hc3luYyBmdW5jdGlvbihzKXtpZighKCJPZmZzY3JlZW5DYW52YXMiaW4gZ2xvYmFsVGhpcykpcmV0dXJuIGkucG9zdE1lc3NhZ2Uoe2lkOnMuZGF0YS5pZH0pO2NvbnN0e2lkOmUsYml0bWFwOm4sd2lkdGg6YSxoZWlnaHQ6dH09cy5kYXRhLGc9cChhLHQpLGg9bmV3IE9mZnNjcmVlbkNhbnZhcyhhLHQpO2guZ2V0Q29udGV4dCgiMmQiKS5kcmF3SW1hZ2UobiwwLDApLG4uY2xvc2UoKTtjb25zdCB3PWF3YWl0IGguY29udmVydFRvQmxvYigpLHk9dy50eXBlLGI9YXdhaXQgdy5hcnJheUJ1ZmZlcigpLG89ZChiKTtpZighYy5oYXMoZSkmJmF3YWl0IGc9PT1vKXJldHVybiBjLnNldChlLG8pLGkucG9zdE1lc3NhZ2Uoe2lkOmV9KTtpZihjLmdldChlKT09PW8pcmV0dXJuIGkucG9zdE1lc3NhZ2Uoe2lkOmV9KTtpLnBvc3RNZXNzYWdlKHtpZDplLHR5cGU6eSxiYXNlNjQ6byx3aWR0aDphLGhlaWdodDp0fSksYy5zZXQoZSxvKX19KSgpOwoK",null,!1),be=Object.getOwnPropertySymbols,Wn=Object.prototype.hasOwnProperty,Gn=Object.prototype.propertyIsEnumerable,zn=(t,e)=>{var n={};for(var r in t)Wn.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&be)for(var r of be(t))e.indexOf(r)<0&&Gn.call(t,r)&&(n[r]=t[r]);return n},Vn=(t,e,n)=>new Promise((r,o)=>{var i=s=>{try{a(n.next(s))}catch(l){o(l)}},c=s=>{try{a(n.throw(s))}catch(l){o(l)}},a=s=>s.done?r(s.value):Promise.resolve(s.value).then(i,c);a((n=n.apply(t,e)).next())});class jn{constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=function(c,a){(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(c)||this.pendingCanvasMutations.set(c,[]),this.pendingCanvasMutations.get(c).push(a)};const{sampling:n="all",win:r,blockClass:o,recordCanvas:i}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,i&&n==="all"&&this.initCanvasMutationObserver(r,o),i&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,o)}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(e,n,r){const o=ve(n,r),i=new Map,c=new _n;c.onmessage=p=>{const{id:m}=p.data;if(i.set(m,!1),!("base64"in p.data))return;const{base64:u,type:h,width:y,height:S}=p.data;this.mutationCb({id:m,type:it["2D"],commands:[{property:"clearRect",args:[0,0,y,S]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:u}],type:h}]},0,0]}]})};const a=1e3/e;let s=0,l;const d=p=>{if(s&&p-s<a){l=requestAnimationFrame(d);return}s=p,n.document.querySelectorAll(`canvas:not(.${r} *)`).forEach(m=>Vn(this,null,function*(){var u;const h=this.mirror.getId(m);if(i.get(h))return;if(i.set(h,!0),["webgl","webgl2"].includes(m.__context)){const S=m.getContext(m.__context);((u=S?.getContextAttributes())==null?void 0:u.preserveDrawingBuffer)===!1&&S?.clear(S.COLOR_BUFFER_BIT)}const y=yield createImageBitmap(m);c.postMessage({id:h,bitmap:y,width:m.width,height:m.height},[y])})),l=requestAnimationFrame(d)};l=requestAnimationFrame(d),this.resetObservers=()=>{o(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const r=ve(e,n),o=Rn(this.processMutation.bind(this),e,n,this.mirror),i=Dn(this.processMutation.bind(this),e,n,this.mirror);this.resetObservers=()=>{r(),o(),i()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const e=n=>{this.rafStamps.latestId=n,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(e);if(!r||n===-1)return;const o=r.map(c=>zn(c,["type"])),{type:i}=r[0];this.mutationCb({id:n,type:i,commands:o}),this.pendingCanvasMutations.delete(e)}}class Zn{constructor(e){this.trackedStylesheets=new WeakSet,this.mutationCb=e.mutationCb}addStylesheet(e){this.trackedStylesheets.has(e)||(this.trackedStylesheets.add(e),this.trackStylesheet(e))}trackStylesheet(e){}attachStylesheet(e,n,r){this.mutationCb({adds:[{parentId:r.getId(e),nextId:null,node:n}],removes:[],texts:[],attributes:[]}),this.addStylesheet(e)}}var Un=Object.defineProperty,Yn=Object.defineProperties,Hn=Object.getOwnPropertyDescriptors,Se=Object.getOwnPropertySymbols,Xn=Object.prototype.hasOwnProperty,Bn=Object.prototype.propertyIsEnumerable,Ce=(t,e,n)=>e in t?Un(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,B=(t,e)=>{for(var n in e||(e={}))Xn.call(e,n)&&Ce(t,n,e[n]);if(Se)for(var n of Se(e))Bn.call(e,n)&&Ce(t,n,e[n]);return t},Kn=(t,e)=>Yn(t,Hn(e));function N(t){return Kn(B({},t),{timestamp:Date.now()})}let L,yt;const q=Me();function vt(t={}){const{emit:e,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:o="highlight-block",blockSelector:i=null,ignoreClass:c="highlight-ignore",maskTextClass:a="highlight-mask",maskTextSelector:s=null,inlineStylesheet:l=!0,maskAllInputs:d,maskInputOptions:p,slimDOMOptions:m,maskInputFn:u,maskTextFn:h,hooks:y,packFn:S,sampling:I={},mousemoveWait:w,recordCanvas:v=!1,userTriggeredOnInput:f=!1,collectFonts:O=!1,inlineImages:W=!1,plugins:F,keepIframeSrcFn:E=()=>!1,enableStrictPrivacy:P=!1}=t;if(!e)throw new Error("emit function is required");w!==void 0&&I.mousemove===void 0&&(I.mousemove=w),q.reset();const Z=d===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:p!==void 0?p:{password:!0},G=m===!0||m==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:m==="all",headMetaDescKeywords:m==="all"}:m||{};tn();let K,Y=0;const R=g=>{for(const b of F||[])b.eventProcessor&&(g=b.eventProcessor(g));return S&&(g=S(g)),g};L=(g,b)=>{var X;if(((X=et[0])==null?void 0:X.isFrozen())&&g.type!==M.FullSnapshot&&!(g.type===M.IncrementalSnapshot&&g.data.source===D.Mutation)&&et.forEach(_=>_.unfreeze()),e(R(g),b),g.type===M.FullSnapshot)K=g,Y=0;else if(g.type===M.IncrementalSnapshot){if(g.data.source===D.Mutation&&g.data.isAttachIframe)return;Y++;const _=r&&Y>=r,Q=n&&g.timestamp-K.timestamp>n;(_||Q)&&yt(!0)}};const z=g=>{L(N({type:M.IncrementalSnapshot,data:B({source:D.Mutation},g)}))},$=g=>L(N({type:M.IncrementalSnapshot,data:B({source:D.Scroll},g)})),tt=g=>L(N({type:M.IncrementalSnapshot,data:B({source:D.CanvasMutation},g)})),A=new kn({mutationCb:z}),J=new Zn({mutationCb:z}),V=new jn({recordCanvas:v,mutationCb:tt,win:window,blockClass:o,mirror:q,sampling:I.canvas}),H=new Ln({mutationCb:z,scrollCb:$,bypassOptions:{blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:l,maskInputOptions:Z,maskTextFn:h,maskInputFn:u,recordCanvas:v,inlineImages:W,sampling:I,slimDOMOptions:G,iframeManager:A,stylesheetManager:J,canvasManager:V,enableStrictPrivacy:P},mirror:q});yt=(g=!1)=>{var b,X,_,Q;L(N({type:M.Meta,data:{href:window.location.href,width:zt(),height:Gt()}}),g),et.forEach(T=>T.lock());const C=Je(document,{mirror:q,blockClass:o,blockSelector:i,maskTextClass:a,maskTextSelector:s,inlineStylesheet:l,maskAllInputs:Z,maskTextFn:h,slimDOM:G,recordCanvas:v,inlineImages:W,enableStrictPrivacy:P,onSerialize:T=>{Zt(T,q)&&A.addIframe(T),Ut(T,q)&&J.addStylesheet(T),Yt(T)&&H.addShadowRoot(T.shadowRoot,document)},onIframeLoad:(T,nt)=>{A.attachIframe(T,nt,q),H.observeAttachShadow(T)},onStylesheetLoad:(T,nt)=>{J.attachStylesheet(T,nt,q)},keepIframeSrcFn:E});if(!C)return console.warn("Failed to snapshot the document");L(N({type:M.FullSnapshot,data:{node:C,initialOffset:{left:window.pageXOffset!==void 0?window.pageXOffset:document?.documentElement.scrollLeft||((X=(b=document?.body)==null?void 0:b.parentElement)==null?void 0:X.scrollLeft)||document?.body.scrollLeft||0,top:window.pageYOffset!==void 0?window.pageYOffset:document?.documentElement.scrollTop||((Q=(_=document?.body)==null?void 0:_.parentElement)==null?void 0:Q.scrollTop)||document?.body.scrollTop||0}}})),et.forEach(T=>T.unlock())};try{const g=[];g.push(j("DOMContentLoaded",()=>{L(N({type:M.DomContentLoaded,data:{}}))}));const b=_=>{var Q;return Cn({mutationCb:z,mousemoveCb:(C,T)=>L(N({type:M.IncrementalSnapshot,data:{source:T,positions:C}})),mouseInteractionCb:C=>L(N({type:M.IncrementalSnapshot,data:B({source:D.MouseInteraction},C)})),scrollCb:$,viewportResizeCb:C=>L(N({type:M.IncrementalSnapshot,data:B({source:D.ViewportResize},C)})),inputCb:C=>L(N({type:M.IncrementalSnapshot,data:B({source:D.Input},C)})),mediaInteractionCb:C=>L(N({type:M.IncrementalSnapshot,data:B({source:D.MediaInteraction},C)})),styleSheetRuleCb:C=>L(N({type:M.IncrementalSnapshot,data:B({source:D.StyleSheetRule},C)})),styleDeclarationCb:C=>L(N({type:M.IncrementalSnapshot,data:B({source:D.StyleDeclaration},C)})),canvasMutationCb:tt,fontCb:C=>L(N({type:M.IncrementalSnapshot,data:B({source:D.Font},C)})),blockClass:o,ignoreClass:c,maskTextClass:a,maskTextSelector:s,maskInputOptions:Z,inlineStylesheet:l,sampling:I,recordCanvas:v,inlineImages:W,userTriggeredOnInput:f,collectFonts:O,doc:_,maskInputFn:u,maskTextFn:h,blockSelector:i,slimDOMOptions:G,mirror:q,iframeManager:A,stylesheetManager:J,shadowDomManager:H,canvasManager:V,enableStrictPrivacy:P,plugins:((Q=F?.filter(C=>C.observer))==null?void 0:Q.map(C=>({observer:C.observer,options:C.options,callback:T=>L(N({type:M.Plugin,data:{plugin:C.name,payload:T}}))})))||[]},y)};A.addLoadListener(_=>{g.push(b(_.contentDocument))});const X=()=>{yt(),g.push(b(document))};return document.readyState==="interactive"||document.readyState==="complete"?X():g.push(j("load",()=>{L(N({type:M.Load,data:{}})),X()},window)),()=>{g.forEach(_=>_())}}catch(g){console.warn(g)}}return vt.addCustomEvent=(t,e)=>{!L||L(N({type:M.Custom,data:{tag:t,payload:e}}))},vt.freezePage=()=>{et.forEach(t=>t.freeze())},vt.takeFullSnapshot=t=>{if(!yt)throw new Error("please take full snapshot after start recording");yt(t)},vt.mirror=q,vt}();
|