@glimt/record 0.0.31 → 0.0.33
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/record.cjs +2424 -2408
- package/dist/record.cjs.map +1 -1
- package/dist/record.js +2424 -2408
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +2303 -2287
- package/dist/record.umd.cjs.map +3 -3
- package/dist/record.umd.min.cjs +24 -24
- package/dist/record.umd.min.cjs.map +3 -3
- package/package.json +1 -1
package/dist/record.umd.cjs
CHANGED
|
@@ -36,9 +36,70 @@ var __defProp2 = Object.defineProperty;
|
|
|
36
36
|
var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
37
37
|
var __publicField = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
38
|
var _a;
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
var EventType = /* @__PURE__ */ ((EventType2) => {
|
|
40
|
+
EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
41
|
+
EventType2[EventType2["Load"] = 1] = "Load";
|
|
42
|
+
EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
|
|
43
|
+
EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
44
|
+
EventType2[EventType2["Meta"] = 4] = "Meta";
|
|
45
|
+
EventType2[EventType2["Custom"] = 5] = "Custom";
|
|
46
|
+
EventType2[EventType2["Plugin"] = 6] = "Plugin";
|
|
47
|
+
return EventType2;
|
|
48
|
+
})(EventType || {});
|
|
49
|
+
var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
|
|
50
|
+
IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
|
|
51
|
+
IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
|
|
52
|
+
IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
|
|
53
|
+
IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
|
|
54
|
+
IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
|
|
55
|
+
IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
|
|
56
|
+
IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
|
|
57
|
+
IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
|
|
58
|
+
IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
59
|
+
IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
|
|
60
|
+
IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
|
|
61
|
+
IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
|
|
62
|
+
IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
|
|
63
|
+
IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
64
|
+
IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
|
|
65
|
+
IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
66
|
+
IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
|
|
67
|
+
return IncrementalSource2;
|
|
68
|
+
})(IncrementalSource || {});
|
|
69
|
+
var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
|
|
70
|
+
MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
|
|
71
|
+
MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
|
|
72
|
+
MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
|
|
73
|
+
MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
|
|
74
|
+
MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
|
|
75
|
+
MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
|
|
76
|
+
MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
|
|
77
|
+
MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
|
|
78
|
+
MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
79
|
+
MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
|
|
80
|
+
MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
|
|
81
|
+
return MouseInteractions2;
|
|
82
|
+
})(MouseInteractions || {});
|
|
83
|
+
var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
|
|
84
|
+
PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse";
|
|
85
|
+
PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen";
|
|
86
|
+
PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";
|
|
87
|
+
return PointerTypes2;
|
|
88
|
+
})(PointerTypes || {});
|
|
89
|
+
var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
|
|
90
|
+
CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
|
|
91
|
+
CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
|
|
92
|
+
CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
|
|
93
|
+
return CanvasContext2;
|
|
94
|
+
})(CanvasContext || {});
|
|
95
|
+
var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
|
|
96
|
+
MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";
|
|
97
|
+
MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";
|
|
98
|
+
MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";
|
|
99
|
+
MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";
|
|
100
|
+
MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
|
|
101
|
+
return MediaInteractions2;
|
|
102
|
+
})(MediaInteractions || {});
|
|
42
103
|
var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
|
|
43
104
|
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
44
105
|
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
@@ -217,6 +278,187 @@ const index$1 = {
|
|
|
217
278
|
mutationObserver: mutationObserverCtor$1,
|
|
218
279
|
patch: patch$1
|
|
219
280
|
};
|
|
281
|
+
var __defProp$1 = Object.defineProperty;
|
|
282
|
+
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
283
|
+
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
284
|
+
var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
|
|
285
|
+
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
286
|
+
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
287
|
+
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
288
|
+
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
289
|
+
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
290
|
+
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
291
|
+
return NodeType2;
|
|
292
|
+
})(NodeType$2 || {});
|
|
293
|
+
const testableAccessors = {
|
|
294
|
+
Node: ["childNodes", "parentNode", "parentElement", "textContent"],
|
|
295
|
+
ShadowRoot: ["host", "styleSheets"],
|
|
296
|
+
Element: ["shadowRoot", "querySelector", "querySelectorAll"],
|
|
297
|
+
MutationObserver: []
|
|
298
|
+
};
|
|
299
|
+
const testableMethods = {
|
|
300
|
+
Node: ["contains", "getRootNode"],
|
|
301
|
+
ShadowRoot: ["getSelection"],
|
|
302
|
+
Element: [],
|
|
303
|
+
MutationObserver: ["constructor"]
|
|
304
|
+
};
|
|
305
|
+
const untaintedBasePrototype = {};
|
|
306
|
+
const isAngularZonePresent = () => {
|
|
307
|
+
return !!globalThis.Zone;
|
|
308
|
+
};
|
|
309
|
+
function getUntaintedPrototype(key) {
|
|
310
|
+
if (untaintedBasePrototype[key])
|
|
311
|
+
return untaintedBasePrototype[key];
|
|
312
|
+
const defaultObj = globalThis[key];
|
|
313
|
+
const defaultPrototype = defaultObj.prototype;
|
|
314
|
+
const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;
|
|
315
|
+
const isUntaintedAccessors = Boolean(
|
|
316
|
+
accessorNames && // @ts-expect-error 2345
|
|
317
|
+
accessorNames.every(
|
|
318
|
+
(accessor) => {
|
|
319
|
+
var _a2, _b2;
|
|
320
|
+
return Boolean(
|
|
321
|
+
(_b2 = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b2.toString().includes("[native code]")
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
);
|
|
326
|
+
const methodNames = key in testableMethods ? testableMethods[key] : void 0;
|
|
327
|
+
const isUntaintedMethods = Boolean(
|
|
328
|
+
methodNames && methodNames.every(
|
|
329
|
+
// @ts-expect-error 2345
|
|
330
|
+
(method) => {
|
|
331
|
+
var _a2;
|
|
332
|
+
return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));
|
|
333
|
+
}
|
|
334
|
+
)
|
|
335
|
+
);
|
|
336
|
+
if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
|
|
337
|
+
untaintedBasePrototype[key] = defaultObj.prototype;
|
|
338
|
+
return defaultObj.prototype;
|
|
339
|
+
}
|
|
340
|
+
try {
|
|
341
|
+
const iframeEl = document.createElement("iframe");
|
|
342
|
+
document.body.appendChild(iframeEl);
|
|
343
|
+
const win = iframeEl.contentWindow;
|
|
344
|
+
if (!win) return defaultObj.prototype;
|
|
345
|
+
const untaintedObject = win[key].prototype;
|
|
346
|
+
document.body.removeChild(iframeEl);
|
|
347
|
+
if (!untaintedObject) return defaultPrototype;
|
|
348
|
+
return untaintedBasePrototype[key] = untaintedObject;
|
|
349
|
+
} catch (e) {
|
|
350
|
+
return defaultPrototype;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const untaintedAccessorCache = {};
|
|
354
|
+
function getUntaintedAccessor(key, instance, accessor) {
|
|
355
|
+
var _a2;
|
|
356
|
+
const cacheKey = `${key}.${String(accessor)}`;
|
|
357
|
+
if (untaintedAccessorCache[cacheKey])
|
|
358
|
+
return untaintedAccessorCache[cacheKey].call(
|
|
359
|
+
instance
|
|
360
|
+
);
|
|
361
|
+
const untaintedPrototype = getUntaintedPrototype(key);
|
|
362
|
+
const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
|
|
363
|
+
untaintedPrototype,
|
|
364
|
+
accessor
|
|
365
|
+
)) == null ? void 0 : _a2.get;
|
|
366
|
+
if (!untaintedAccessor) return instance[accessor];
|
|
367
|
+
untaintedAccessorCache[cacheKey] = untaintedAccessor;
|
|
368
|
+
return untaintedAccessor.call(instance);
|
|
369
|
+
}
|
|
370
|
+
const untaintedMethodCache = {};
|
|
371
|
+
function getUntaintedMethod(key, instance, method) {
|
|
372
|
+
const cacheKey = `${key}.${String(method)}`;
|
|
373
|
+
if (untaintedMethodCache[cacheKey])
|
|
374
|
+
return untaintedMethodCache[cacheKey].bind(
|
|
375
|
+
instance
|
|
376
|
+
);
|
|
377
|
+
const untaintedPrototype = getUntaintedPrototype(key);
|
|
378
|
+
const untaintedMethod = untaintedPrototype[method];
|
|
379
|
+
if (typeof untaintedMethod !== "function") return instance[method];
|
|
380
|
+
untaintedMethodCache[cacheKey] = untaintedMethod;
|
|
381
|
+
return untaintedMethod.bind(instance);
|
|
382
|
+
}
|
|
383
|
+
function childNodes(n2) {
|
|
384
|
+
return getUntaintedAccessor("Node", n2, "childNodes");
|
|
385
|
+
}
|
|
386
|
+
function parentNode(n2) {
|
|
387
|
+
return getUntaintedAccessor("Node", n2, "parentNode");
|
|
388
|
+
}
|
|
389
|
+
function parentElement(n2) {
|
|
390
|
+
return getUntaintedAccessor("Node", n2, "parentElement");
|
|
391
|
+
}
|
|
392
|
+
function textContent(n2) {
|
|
393
|
+
return getUntaintedAccessor("Node", n2, "textContent");
|
|
394
|
+
}
|
|
395
|
+
function contains(n2, other) {
|
|
396
|
+
return getUntaintedMethod("Node", n2, "contains")(other);
|
|
397
|
+
}
|
|
398
|
+
function getRootNode(n2) {
|
|
399
|
+
return getUntaintedMethod("Node", n2, "getRootNode")();
|
|
400
|
+
}
|
|
401
|
+
function host(n2) {
|
|
402
|
+
if (!n2 || !("host" in n2)) return null;
|
|
403
|
+
return getUntaintedAccessor("ShadowRoot", n2, "host");
|
|
404
|
+
}
|
|
405
|
+
function styleSheets(n2) {
|
|
406
|
+
return n2.styleSheets;
|
|
407
|
+
}
|
|
408
|
+
function shadowRoot(n2) {
|
|
409
|
+
if (!n2 || !("shadowRoot" in n2)) return null;
|
|
410
|
+
return getUntaintedAccessor("Element", n2, "shadowRoot");
|
|
411
|
+
}
|
|
412
|
+
function querySelector(n2, selectors) {
|
|
413
|
+
return getUntaintedAccessor("Element", n2, "querySelector")(selectors);
|
|
414
|
+
}
|
|
415
|
+
function querySelectorAll(n2, selectors) {
|
|
416
|
+
return getUntaintedAccessor("Element", n2, "querySelectorAll")(selectors);
|
|
417
|
+
}
|
|
418
|
+
function mutationObserverCtor() {
|
|
419
|
+
return getUntaintedPrototype("MutationObserver").constructor;
|
|
420
|
+
}
|
|
421
|
+
function patch(source, name, replacement) {
|
|
422
|
+
try {
|
|
423
|
+
if (!(name in source)) {
|
|
424
|
+
return () => {
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
const original = source[name];
|
|
428
|
+
const wrapped = replacement(original);
|
|
429
|
+
if (typeof wrapped === "function") {
|
|
430
|
+
wrapped.prototype = wrapped.prototype || {};
|
|
431
|
+
Object.defineProperties(wrapped, {
|
|
432
|
+
__rrweb_original__: {
|
|
433
|
+
enumerable: false,
|
|
434
|
+
value: original
|
|
435
|
+
}
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
source[name] = wrapped;
|
|
439
|
+
return () => {
|
|
440
|
+
source[name] = original;
|
|
441
|
+
};
|
|
442
|
+
} catch (e) {
|
|
443
|
+
return () => {
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
const index = {
|
|
448
|
+
childNodes,
|
|
449
|
+
parentNode,
|
|
450
|
+
parentElement,
|
|
451
|
+
textContent,
|
|
452
|
+
contains,
|
|
453
|
+
getRootNode,
|
|
454
|
+
host,
|
|
455
|
+
styleSheets,
|
|
456
|
+
shadowRoot,
|
|
457
|
+
querySelector,
|
|
458
|
+
querySelectorAll,
|
|
459
|
+
mutationObserver: mutationObserverCtor,
|
|
460
|
+
patch
|
|
461
|
+
};
|
|
220
462
|
function isElement(n2) {
|
|
221
463
|
return n2.nodeType === n2.ELEMENT_NODE;
|
|
222
464
|
}
|
|
@@ -224,10 +466,10 @@ function isShadowRoot(n2) {
|
|
|
224
466
|
const hostEl = (
|
|
225
467
|
// anchor and textarea elements also have a `host` property
|
|
226
468
|
// but only shadow roots have a `mode` property
|
|
227
|
-
n2 && "host" in n2 && "mode" in n2 && index
|
|
469
|
+
n2 && "host" in n2 && "mode" in n2 && index.host(n2) || null
|
|
228
470
|
);
|
|
229
471
|
return Boolean(
|
|
230
|
-
hostEl && "shadowRoot" in hostEl && index
|
|
472
|
+
hostEl && "shadowRoot" in hostEl && index.shadowRoot(hostEl) === n2
|
|
231
473
|
);
|
|
232
474
|
}
|
|
233
475
|
function isNativeShadowDom(shadowRoot2) {
|
|
@@ -747,7 +989,7 @@ function classMatchesRegex(node2, regex, checkAncestors) {
|
|
|
747
989
|
if (!node2) return false;
|
|
748
990
|
if (node2.nodeType !== node2.ELEMENT_NODE) {
|
|
749
991
|
if (!checkAncestors) return false;
|
|
750
|
-
return classMatchesRegex(index
|
|
992
|
+
return classMatchesRegex(index.parentNode(node2), regex, checkAncestors);
|
|
751
993
|
}
|
|
752
994
|
for (let eIndex = node2.classList.length; eIndex--; ) {
|
|
753
995
|
const className = node2.classList[eIndex];
|
|
@@ -756,19 +998,19 @@ function classMatchesRegex(node2, regex, checkAncestors) {
|
|
|
756
998
|
}
|
|
757
999
|
}
|
|
758
1000
|
if (!checkAncestors) return false;
|
|
759
|
-
return classMatchesRegex(index
|
|
1001
|
+
return classMatchesRegex(index.parentNode(node2), regex, checkAncestors);
|
|
760
1002
|
}
|
|
761
1003
|
function needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {
|
|
762
1004
|
let el;
|
|
763
1005
|
if (isElement(node2)) {
|
|
764
1006
|
el = node2;
|
|
765
|
-
if (!index
|
|
1007
|
+
if (!index.childNodes(el).length) {
|
|
766
1008
|
return false;
|
|
767
1009
|
}
|
|
768
|
-
} else if (index
|
|
1010
|
+
} else if (index.parentElement(node2) === null) {
|
|
769
1011
|
return false;
|
|
770
1012
|
} else {
|
|
771
|
-
el = index
|
|
1013
|
+
el = index.parentElement(node2);
|
|
772
1014
|
}
|
|
773
1015
|
try {
|
|
774
1016
|
if (typeof maskTextClass === "string") {
|
|
@@ -868,20 +1110,20 @@ function serializeNode(n2, options) {
|
|
|
868
1110
|
case n2.DOCUMENT_NODE:
|
|
869
1111
|
if (n2.compatMode !== "CSS1Compat") {
|
|
870
1112
|
return {
|
|
871
|
-
type: NodeType$
|
|
1113
|
+
type: NodeType$2.Document,
|
|
872
1114
|
childNodes: [],
|
|
873
1115
|
compatMode: n2.compatMode
|
|
874
1116
|
// probably "BackCompat"
|
|
875
1117
|
};
|
|
876
1118
|
} else {
|
|
877
1119
|
return {
|
|
878
|
-
type: NodeType$
|
|
1120
|
+
type: NodeType$2.Document,
|
|
879
1121
|
childNodes: []
|
|
880
1122
|
};
|
|
881
1123
|
}
|
|
882
1124
|
case n2.DOCUMENT_TYPE_NODE:
|
|
883
1125
|
return {
|
|
884
|
-
type: NodeType$
|
|
1126
|
+
type: NodeType$2.DocumentType,
|
|
885
1127
|
name: n2.name,
|
|
886
1128
|
publicId: n2.publicId,
|
|
887
1129
|
systemId: n2.systemId,
|
|
@@ -912,14 +1154,14 @@ function serializeNode(n2, options) {
|
|
|
912
1154
|
});
|
|
913
1155
|
case n2.CDATA_SECTION_NODE:
|
|
914
1156
|
return {
|
|
915
|
-
type: NodeType$
|
|
1157
|
+
type: NodeType$2.CDATA,
|
|
916
1158
|
textContent: "",
|
|
917
1159
|
rootId
|
|
918
1160
|
};
|
|
919
1161
|
case n2.COMMENT_NODE:
|
|
920
1162
|
return {
|
|
921
|
-
type: NodeType$
|
|
922
|
-
textContent: index
|
|
1163
|
+
type: NodeType$2.Comment,
|
|
1164
|
+
textContent: index.textContent(n2) || "",
|
|
923
1165
|
rootId
|
|
924
1166
|
};
|
|
925
1167
|
default:
|
|
@@ -940,7 +1182,7 @@ const runIdleCallback = (cb) => {
|
|
|
940
1182
|
};
|
|
941
1183
|
function serializeTextNode(n2, options) {
|
|
942
1184
|
const { needsMask, maskTextFn, rootId, cssCaptured } = options;
|
|
943
|
-
const parent = index
|
|
1185
|
+
const parent = index.parentNode(n2);
|
|
944
1186
|
const parentTagName = parent && parent.tagName;
|
|
945
1187
|
let textContent2 = "";
|
|
946
1188
|
const isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
@@ -948,16 +1190,16 @@ function serializeTextNode(n2, options) {
|
|
|
948
1190
|
if (isScript) {
|
|
949
1191
|
textContent2 = "SCRIPT_PLACEHOLDER";
|
|
950
1192
|
} else if (!cssCaptured) {
|
|
951
|
-
textContent2 = index
|
|
1193
|
+
textContent2 = index.textContent(n2);
|
|
952
1194
|
if (isStyle && textContent2) {
|
|
953
1195
|
textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
|
|
954
1196
|
}
|
|
955
1197
|
}
|
|
956
1198
|
if (!isStyle && !isScript && textContent2 && needsMask) {
|
|
957
|
-
textContent2 = maskTextFn ? maskTextFn(textContent2, index
|
|
1199
|
+
textContent2 = maskTextFn ? maskTextFn(textContent2, index.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
|
|
958
1200
|
}
|
|
959
1201
|
return {
|
|
960
|
-
type: NodeType$
|
|
1202
|
+
type: NodeType$2.Text,
|
|
961
1203
|
textContent: textContent2 || "",
|
|
962
1204
|
rootId
|
|
963
1205
|
};
|
|
@@ -1176,7 +1418,7 @@ function serializeElementNode(n2, options) {
|
|
|
1176
1418
|
}
|
|
1177
1419
|
window.serialization_perf_map[tagName].avg = window.serialization_perf_map[tagName].times.reduce((a2, b) => a2 + b, 0) / window.serialization_perf_map[tagName].times.length;
|
|
1178
1420
|
return {
|
|
1179
|
-
type: NodeType$
|
|
1421
|
+
type: NodeType$2.Element,
|
|
1180
1422
|
tagName,
|
|
1181
1423
|
attributes,
|
|
1182
1424
|
childNodes: [],
|
|
@@ -1194,9 +1436,9 @@ function lowerIfExists(maybeAttr) {
|
|
|
1194
1436
|
}
|
|
1195
1437
|
}
|
|
1196
1438
|
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
1197
|
-
if (slimDOMOptions.comment && sn.type === NodeType$
|
|
1439
|
+
if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {
|
|
1198
1440
|
return true;
|
|
1199
|
-
} else if (sn.type === NodeType$
|
|
1441
|
+
} else if (sn.type === NodeType$2.Element) {
|
|
1200
1442
|
if (slimDOMOptions.script && // script tag
|
|
1201
1443
|
(sn.tagName === "script" || // (module)preload link
|
|
1202
1444
|
sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
|
|
@@ -1286,7 +1528,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
1286
1528
|
let id;
|
|
1287
1529
|
if (mirror2.hasNode(n2)) {
|
|
1288
1530
|
id = mirror2.getId(n2);
|
|
1289
|
-
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$
|
|
1531
|
+
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
1290
1532
|
id = IGNORED_NODE;
|
|
1291
1533
|
} else {
|
|
1292
1534
|
id = genId();
|
|
@@ -1300,15 +1542,15 @@ function serializeNodeWithId(n2, options) {
|
|
|
1300
1542
|
onSerialize(n2);
|
|
1301
1543
|
}
|
|
1302
1544
|
let recordChild = !skipChild;
|
|
1303
|
-
if (serializedNode.type === NodeType$
|
|
1545
|
+
if (serializedNode.type === NodeType$2.Element) {
|
|
1304
1546
|
recordChild = recordChild && !serializedNode.needBlock;
|
|
1305
1547
|
delete serializedNode.needBlock;
|
|
1306
|
-
const shadowRootEl = index
|
|
1548
|
+
const shadowRootEl = index.shadowRoot(n2);
|
|
1307
1549
|
if (shadowRootEl && isNativeShadowDom(shadowRootEl))
|
|
1308
1550
|
serializedNode.isShadowHost = true;
|
|
1309
1551
|
}
|
|
1310
|
-
if ((serializedNode.type === NodeType$
|
|
1311
|
-
if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$
|
|
1552
|
+
if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {
|
|
1553
|
+
if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === "head") {
|
|
1312
1554
|
preserveWhiteSpace = false;
|
|
1313
1555
|
}
|
|
1314
1556
|
const bypassOptions = {
|
|
@@ -1337,12 +1579,12 @@ function serializeNodeWithId(n2, options) {
|
|
|
1337
1579
|
keepIframeSrcFn,
|
|
1338
1580
|
cssCaptured: false
|
|
1339
1581
|
};
|
|
1340
|
-
if (serializedNode.type === NodeType$
|
|
1582
|
+
if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1341
1583
|
else {
|
|
1342
|
-
if (serializedNode.type === NodeType$
|
|
1584
|
+
if (serializedNode.type === NodeType$2.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
|
|
1343
1585
|
bypassOptions.cssCaptured = true;
|
|
1344
1586
|
}
|
|
1345
|
-
for (const childN of Array.from(index
|
|
1587
|
+
for (const childN of Array.from(index.childNodes(n2))) {
|
|
1346
1588
|
const serializedChildNode = serializeNodeWithId(
|
|
1347
1589
|
childN,
|
|
1348
1590
|
bypassOptions
|
|
@@ -1353,8 +1595,8 @@ function serializeNodeWithId(n2, options) {
|
|
|
1353
1595
|
}
|
|
1354
1596
|
}
|
|
1355
1597
|
let shadowRootEl = null;
|
|
1356
|
-
if (isElement(n2) && (shadowRootEl = index
|
|
1357
|
-
const childNodes2 = index
|
|
1598
|
+
if (isElement(n2) && (shadowRootEl = index.shadowRoot(n2))) {
|
|
1599
|
+
const childNodes2 = index.childNodes(shadowRootEl);
|
|
1358
1600
|
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
1359
1601
|
const childN = childNodes2[i2];
|
|
1360
1602
|
const serializedChildNode = serializeNodeWithId(
|
|
@@ -1368,11 +1610,11 @@ function serializeNodeWithId(n2, options) {
|
|
|
1368
1610
|
}
|
|
1369
1611
|
}
|
|
1370
1612
|
}
|
|
1371
|
-
const parent = index
|
|
1613
|
+
const parent = index.parentNode(n2);
|
|
1372
1614
|
if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
|
|
1373
1615
|
serializedNode.isShadow = true;
|
|
1374
1616
|
}
|
|
1375
|
-
if (serializedNode.type === NodeType$
|
|
1617
|
+
if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "iframe") {
|
|
1376
1618
|
onceIframeLoaded(
|
|
1377
1619
|
n2,
|
|
1378
1620
|
() => {
|
|
@@ -1414,7 +1656,7 @@ function serializeNodeWithId(n2, options) {
|
|
|
1414
1656
|
iframeLoadTimeout
|
|
1415
1657
|
);
|
|
1416
1658
|
}
|
|
1417
|
-
if (serializedNode.type === NodeType$
|
|
1659
|
+
if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
|
|
1418
1660
|
onceStylesheetLoaded(
|
|
1419
1661
|
n2,
|
|
1420
1662
|
() => {
|
|
@@ -8862,175 +9104,6 @@ class BaseRRNode {
|
|
|
8862
9104
|
return "RRNode";
|
|
8863
9105
|
}
|
|
8864
9106
|
}
|
|
8865
|
-
const testableAccessors = {
|
|
8866
|
-
Node: ["childNodes", "parentNode", "parentElement", "textContent"],
|
|
8867
|
-
ShadowRoot: ["host", "styleSheets"],
|
|
8868
|
-
Element: ["shadowRoot", "querySelector", "querySelectorAll"],
|
|
8869
|
-
MutationObserver: []
|
|
8870
|
-
};
|
|
8871
|
-
const testableMethods = {
|
|
8872
|
-
Node: ["contains", "getRootNode"],
|
|
8873
|
-
ShadowRoot: ["getSelection"],
|
|
8874
|
-
Element: [],
|
|
8875
|
-
MutationObserver: ["constructor"]
|
|
8876
|
-
};
|
|
8877
|
-
const untaintedBasePrototype = {};
|
|
8878
|
-
const isAngularZonePresent = () => {
|
|
8879
|
-
return !!globalThis.Zone;
|
|
8880
|
-
};
|
|
8881
|
-
function getUntaintedPrototype(key) {
|
|
8882
|
-
if (untaintedBasePrototype[key])
|
|
8883
|
-
return untaintedBasePrototype[key];
|
|
8884
|
-
const defaultObj = globalThis[key];
|
|
8885
|
-
const defaultPrototype = defaultObj.prototype;
|
|
8886
|
-
const accessorNames = key in testableAccessors ? testableAccessors[key] : void 0;
|
|
8887
|
-
const isUntaintedAccessors = Boolean(
|
|
8888
|
-
accessorNames && // @ts-expect-error 2345
|
|
8889
|
-
accessorNames.every(
|
|
8890
|
-
(accessor) => {
|
|
8891
|
-
var _a2, _b2;
|
|
8892
|
-
return Boolean(
|
|
8893
|
-
(_b2 = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b2.toString().includes("[native code]")
|
|
8894
|
-
);
|
|
8895
|
-
}
|
|
8896
|
-
)
|
|
8897
|
-
);
|
|
8898
|
-
const methodNames = key in testableMethods ? testableMethods[key] : void 0;
|
|
8899
|
-
const isUntaintedMethods = Boolean(
|
|
8900
|
-
methodNames && methodNames.every(
|
|
8901
|
-
// @ts-expect-error 2345
|
|
8902
|
-
(method) => {
|
|
8903
|
-
var _a2;
|
|
8904
|
-
return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));
|
|
8905
|
-
}
|
|
8906
|
-
)
|
|
8907
|
-
);
|
|
8908
|
-
if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
|
|
8909
|
-
untaintedBasePrototype[key] = defaultObj.prototype;
|
|
8910
|
-
return defaultObj.prototype;
|
|
8911
|
-
}
|
|
8912
|
-
try {
|
|
8913
|
-
const iframeEl = document.createElement("iframe");
|
|
8914
|
-
document.body.appendChild(iframeEl);
|
|
8915
|
-
const win = iframeEl.contentWindow;
|
|
8916
|
-
if (!win) return defaultObj.prototype;
|
|
8917
|
-
const untaintedObject = win[key].prototype;
|
|
8918
|
-
document.body.removeChild(iframeEl);
|
|
8919
|
-
if (!untaintedObject) return defaultPrototype;
|
|
8920
|
-
return untaintedBasePrototype[key] = untaintedObject;
|
|
8921
|
-
} catch (e) {
|
|
8922
|
-
return defaultPrototype;
|
|
8923
|
-
}
|
|
8924
|
-
}
|
|
8925
|
-
const untaintedAccessorCache = {};
|
|
8926
|
-
function getUntaintedAccessor(key, instance, accessor) {
|
|
8927
|
-
var _a2;
|
|
8928
|
-
const cacheKey = `${key}.${String(accessor)}`;
|
|
8929
|
-
if (untaintedAccessorCache[cacheKey])
|
|
8930
|
-
return untaintedAccessorCache[cacheKey].call(
|
|
8931
|
-
instance
|
|
8932
|
-
);
|
|
8933
|
-
const untaintedPrototype = getUntaintedPrototype(key);
|
|
8934
|
-
const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
|
|
8935
|
-
untaintedPrototype,
|
|
8936
|
-
accessor
|
|
8937
|
-
)) == null ? void 0 : _a2.get;
|
|
8938
|
-
if (!untaintedAccessor) return instance[accessor];
|
|
8939
|
-
untaintedAccessorCache[cacheKey] = untaintedAccessor;
|
|
8940
|
-
return untaintedAccessor.call(instance);
|
|
8941
|
-
}
|
|
8942
|
-
const untaintedMethodCache = {};
|
|
8943
|
-
function getUntaintedMethod(key, instance, method) {
|
|
8944
|
-
const cacheKey = `${key}.${String(method)}`;
|
|
8945
|
-
if (untaintedMethodCache[cacheKey])
|
|
8946
|
-
return untaintedMethodCache[cacheKey].bind(
|
|
8947
|
-
instance
|
|
8948
|
-
);
|
|
8949
|
-
const untaintedPrototype = getUntaintedPrototype(key);
|
|
8950
|
-
const untaintedMethod = untaintedPrototype[method];
|
|
8951
|
-
if (typeof untaintedMethod !== "function") return instance[method];
|
|
8952
|
-
untaintedMethodCache[cacheKey] = untaintedMethod;
|
|
8953
|
-
return untaintedMethod.bind(instance);
|
|
8954
|
-
}
|
|
8955
|
-
function childNodes(n2) {
|
|
8956
|
-
return getUntaintedAccessor("Node", n2, "childNodes");
|
|
8957
|
-
}
|
|
8958
|
-
function parentNode(n2) {
|
|
8959
|
-
return getUntaintedAccessor("Node", n2, "parentNode");
|
|
8960
|
-
}
|
|
8961
|
-
function parentElement(n2) {
|
|
8962
|
-
return getUntaintedAccessor("Node", n2, "parentElement");
|
|
8963
|
-
}
|
|
8964
|
-
function textContent(n2) {
|
|
8965
|
-
return getUntaintedAccessor("Node", n2, "textContent");
|
|
8966
|
-
}
|
|
8967
|
-
function contains(n2, other) {
|
|
8968
|
-
return getUntaintedMethod("Node", n2, "contains")(other);
|
|
8969
|
-
}
|
|
8970
|
-
function getRootNode(n2) {
|
|
8971
|
-
return getUntaintedMethod("Node", n2, "getRootNode")();
|
|
8972
|
-
}
|
|
8973
|
-
function host(n2) {
|
|
8974
|
-
if (!n2 || !("host" in n2)) return null;
|
|
8975
|
-
return getUntaintedAccessor("ShadowRoot", n2, "host");
|
|
8976
|
-
}
|
|
8977
|
-
function styleSheets(n2) {
|
|
8978
|
-
return n2.styleSheets;
|
|
8979
|
-
}
|
|
8980
|
-
function shadowRoot(n2) {
|
|
8981
|
-
if (!n2 || !("shadowRoot" in n2)) return null;
|
|
8982
|
-
return getUntaintedAccessor("Element", n2, "shadowRoot");
|
|
8983
|
-
}
|
|
8984
|
-
function querySelector(n2, selectors) {
|
|
8985
|
-
return getUntaintedAccessor("Element", n2, "querySelector")(selectors);
|
|
8986
|
-
}
|
|
8987
|
-
function querySelectorAll(n2, selectors) {
|
|
8988
|
-
return getUntaintedAccessor("Element", n2, "querySelectorAll")(selectors);
|
|
8989
|
-
}
|
|
8990
|
-
function mutationObserverCtor() {
|
|
8991
|
-
return getUntaintedPrototype("MutationObserver").constructor;
|
|
8992
|
-
}
|
|
8993
|
-
function patch(source, name, replacement) {
|
|
8994
|
-
try {
|
|
8995
|
-
if (!(name in source)) {
|
|
8996
|
-
return () => {
|
|
8997
|
-
};
|
|
8998
|
-
}
|
|
8999
|
-
const original = source[name];
|
|
9000
|
-
const wrapped = replacement(original);
|
|
9001
|
-
if (typeof wrapped === "function") {
|
|
9002
|
-
wrapped.prototype = wrapped.prototype || {};
|
|
9003
|
-
Object.defineProperties(wrapped, {
|
|
9004
|
-
__rrweb_original__: {
|
|
9005
|
-
enumerable: false,
|
|
9006
|
-
value: original
|
|
9007
|
-
}
|
|
9008
|
-
});
|
|
9009
|
-
}
|
|
9010
|
-
source[name] = wrapped;
|
|
9011
|
-
return () => {
|
|
9012
|
-
source[name] = original;
|
|
9013
|
-
};
|
|
9014
|
-
} catch (e) {
|
|
9015
|
-
return () => {
|
|
9016
|
-
};
|
|
9017
|
-
}
|
|
9018
|
-
}
|
|
9019
|
-
const index = {
|
|
9020
|
-
childNodes,
|
|
9021
|
-
parentNode,
|
|
9022
|
-
parentElement,
|
|
9023
|
-
textContent,
|
|
9024
|
-
contains,
|
|
9025
|
-
getRootNode,
|
|
9026
|
-
host,
|
|
9027
|
-
styleSheets,
|
|
9028
|
-
shadowRoot,
|
|
9029
|
-
querySelector,
|
|
9030
|
-
querySelectorAll,
|
|
9031
|
-
mutationObserver: mutationObserverCtor,
|
|
9032
|
-
patch
|
|
9033
|
-
};
|
|
9034
9107
|
function on(type, fn, target = document) {
|
|
9035
9108
|
const options = { capture: true, passive: true };
|
|
9036
9109
|
target.addEventListener(type, fn, options);
|
|
@@ -9120,8 +9193,8 @@ function getWindowScroll(win) {
|
|
|
9120
9193
|
var _a2, _b2, _c, _d;
|
|
9121
9194
|
const doc = win.document;
|
|
9122
9195
|
return {
|
|
9123
|
-
left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc.documentElement.scrollLeft || (doc == null ? void 0 : doc.body) && ((_a2 = index.parentElement(doc.body)) == null ? void 0 : _a2.scrollLeft) || ((_b2 = doc == null ? void 0 : doc.body) == null ? void 0 : _b2.scrollLeft) || 0,
|
|
9124
|
-
top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : (doc == null ? void 0 : doc.documentElement.scrollTop) || (doc == null ? void 0 : doc.body) && ((_c = index.parentElement(doc.body)) == null ? void 0 : _c.scrollTop) || ((_d = doc == null ? void 0 : doc.body) == null ? void 0 : _d.scrollTop) || 0
|
|
9196
|
+
left: doc.scrollingElement ? doc.scrollingElement.scrollLeft : win.pageXOffset !== void 0 ? win.pageXOffset : doc.documentElement.scrollLeft || (doc == null ? void 0 : doc.body) && ((_a2 = index$1.parentElement(doc.body)) == null ? void 0 : _a2.scrollLeft) || ((_b2 = doc == null ? void 0 : doc.body) == null ? void 0 : _b2.scrollLeft) || 0,
|
|
9197
|
+
top: doc.scrollingElement ? doc.scrollingElement.scrollTop : win.pageYOffset !== void 0 ? win.pageYOffset : (doc == null ? void 0 : doc.documentElement.scrollTop) || (doc == null ? void 0 : doc.body) && ((_c = index$1.parentElement(doc.body)) == null ? void 0 : _c.scrollTop) || ((_d = doc == null ? void 0 : doc.body) == null ? void 0 : _d.scrollTop) || 0
|
|
9125
9198
|
};
|
|
9126
9199
|
}
|
|
9127
9200
|
function getWindowHeight() {
|
|
@@ -9134,7 +9207,7 @@ function closestElementOfNode(node2) {
|
|
|
9134
9207
|
if (!node2) {
|
|
9135
9208
|
return null;
|
|
9136
9209
|
}
|
|
9137
|
-
const el = node2.nodeType === node2.ELEMENT_NODE ? node2 : index.parentElement(node2);
|
|
9210
|
+
const el = node2.nodeType === node2.ELEMENT_NODE ? node2 : index$1.parentElement(node2);
|
|
9138
9211
|
return el;
|
|
9139
9212
|
}
|
|
9140
9213
|
function isBlocked(node2, blockClass, blockSelector, checkAncestors) {
|
|
@@ -9177,7 +9250,7 @@ function isAncestorRemoved(target, mirror2) {
|
|
|
9177
9250
|
if (!mirror2.has(id)) {
|
|
9178
9251
|
return true;
|
|
9179
9252
|
}
|
|
9180
|
-
const parent = index.parentNode(target);
|
|
9253
|
+
const parent = index$1.parentNode(target);
|
|
9181
9254
|
if (parent && parent.nodeType === target.DOCUMENT_NODE) {
|
|
9182
9255
|
return false;
|
|
9183
9256
|
}
|
|
@@ -9210,7 +9283,7 @@ function hasShadowRoot(n2) {
|
|
|
9210
9283
|
if (n2 instanceof BaseRRNode && "shadowRoot" in n2) {
|
|
9211
9284
|
return Boolean(n2.shadowRoot);
|
|
9212
9285
|
}
|
|
9213
|
-
return Boolean(index.shadowRoot(n2));
|
|
9286
|
+
return Boolean(index$1.shadowRoot(n2));
|
|
9214
9287
|
}
|
|
9215
9288
|
class StyleSheetMirror {
|
|
9216
9289
|
constructor() {
|
|
@@ -9253,8 +9326,8 @@ class StyleSheetMirror {
|
|
|
9253
9326
|
function getShadowHost(n2) {
|
|
9254
9327
|
var _a2;
|
|
9255
9328
|
let shadowHost = null;
|
|
9256
|
-
if ("getRootNode" in n2 && ((_a2 = index.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index.host(index.getRootNode(n2)))
|
|
9257
|
-
shadowHost = index.host(index.getRootNode(n2));
|
|
9329
|
+
if ("getRootNode" in n2 && ((_a2 = index$1.getRootNode(n2)) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_FRAGMENT_NODE && index$1.host(index$1.getRootNode(n2)))
|
|
9330
|
+
shadowHost = index$1.host(index$1.getRootNode(n2));
|
|
9258
9331
|
return shadowHost;
|
|
9259
9332
|
}
|
|
9260
9333
|
function getRootShadowHost(n2) {
|
|
@@ -9268,632 +9341,894 @@ function shadowHostInDom(n2) {
|
|
|
9268
9341
|
const doc = n2.ownerDocument;
|
|
9269
9342
|
if (!doc) return false;
|
|
9270
9343
|
const shadowHost = getRootShadowHost(n2);
|
|
9271
|
-
return index.contains(doc, shadowHost);
|
|
9344
|
+
return index$1.contains(doc, shadowHost);
|
|
9272
9345
|
}
|
|
9273
9346
|
function inDom(n2) {
|
|
9274
9347
|
const doc = n2.ownerDocument;
|
|
9275
9348
|
if (!doc) return false;
|
|
9276
|
-
return index.contains(doc, n2) || shadowHostInDom(n2);
|
|
9349
|
+
return index$1.contains(doc, n2) || shadowHostInDom(n2);
|
|
9277
9350
|
}
|
|
9278
|
-
|
|
9279
|
-
|
|
9280
|
-
|
|
9281
|
-
EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
|
|
9282
|
-
EventType2[EventType2["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
9283
|
-
EventType2[EventType2["Meta"] = 4] = "Meta";
|
|
9284
|
-
EventType2[EventType2["Custom"] = 5] = "Custom";
|
|
9285
|
-
EventType2[EventType2["Plugin"] = 6] = "Plugin";
|
|
9286
|
-
return EventType2;
|
|
9287
|
-
})(EventType || {});
|
|
9288
|
-
var IncrementalSource = /* @__PURE__ */ ((IncrementalSource2) => {
|
|
9289
|
-
IncrementalSource2[IncrementalSource2["Mutation"] = 0] = "Mutation";
|
|
9290
|
-
IncrementalSource2[IncrementalSource2["MouseMove"] = 1] = "MouseMove";
|
|
9291
|
-
IncrementalSource2[IncrementalSource2["MouseInteraction"] = 2] = "MouseInteraction";
|
|
9292
|
-
IncrementalSource2[IncrementalSource2["Scroll"] = 3] = "Scroll";
|
|
9293
|
-
IncrementalSource2[IncrementalSource2["ViewportResize"] = 4] = "ViewportResize";
|
|
9294
|
-
IncrementalSource2[IncrementalSource2["Input"] = 5] = "Input";
|
|
9295
|
-
IncrementalSource2[IncrementalSource2["TouchMove"] = 6] = "TouchMove";
|
|
9296
|
-
IncrementalSource2[IncrementalSource2["MediaInteraction"] = 7] = "MediaInteraction";
|
|
9297
|
-
IncrementalSource2[IncrementalSource2["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
9298
|
-
IncrementalSource2[IncrementalSource2["CanvasMutation"] = 9] = "CanvasMutation";
|
|
9299
|
-
IncrementalSource2[IncrementalSource2["Font"] = 10] = "Font";
|
|
9300
|
-
IncrementalSource2[IncrementalSource2["Log"] = 11] = "Log";
|
|
9301
|
-
IncrementalSource2[IncrementalSource2["Drag"] = 12] = "Drag";
|
|
9302
|
-
IncrementalSource2[IncrementalSource2["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
9303
|
-
IncrementalSource2[IncrementalSource2["Selection"] = 14] = "Selection";
|
|
9304
|
-
IncrementalSource2[IncrementalSource2["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
|
|
9305
|
-
IncrementalSource2[IncrementalSource2["CustomElement"] = 16] = "CustomElement";
|
|
9306
|
-
return IncrementalSource2;
|
|
9307
|
-
})(IncrementalSource || {});
|
|
9308
|
-
var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
|
|
9309
|
-
MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
|
|
9310
|
-
MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
|
|
9311
|
-
MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
|
|
9312
|
-
MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
|
|
9313
|
-
MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
|
|
9314
|
-
MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
|
|
9315
|
-
MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
|
|
9316
|
-
MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
|
|
9317
|
-
MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
9318
|
-
MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
|
|
9319
|
-
MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
|
|
9320
|
-
return MouseInteractions2;
|
|
9321
|
-
})(MouseInteractions || {});
|
|
9322
|
-
var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
|
|
9323
|
-
PointerTypes2[PointerTypes2["Mouse"] = 0] = "Mouse";
|
|
9324
|
-
PointerTypes2[PointerTypes2["Pen"] = 1] = "Pen";
|
|
9325
|
-
PointerTypes2[PointerTypes2["Touch"] = 2] = "Touch";
|
|
9326
|
-
return PointerTypes2;
|
|
9327
|
-
})(PointerTypes || {});
|
|
9328
|
-
var CanvasContext = /* @__PURE__ */ ((CanvasContext2) => {
|
|
9329
|
-
CanvasContext2[CanvasContext2["2D"] = 0] = "2D";
|
|
9330
|
-
CanvasContext2[CanvasContext2["WebGL"] = 1] = "WebGL";
|
|
9331
|
-
CanvasContext2[CanvasContext2["WebGL2"] = 2] = "WebGL2";
|
|
9332
|
-
return CanvasContext2;
|
|
9333
|
-
})(CanvasContext || {});
|
|
9334
|
-
var MediaInteractions = /* @__PURE__ */ ((MediaInteractions2) => {
|
|
9335
|
-
MediaInteractions2[MediaInteractions2["Play"] = 0] = "Play";
|
|
9336
|
-
MediaInteractions2[MediaInteractions2["Pause"] = 1] = "Pause";
|
|
9337
|
-
MediaInteractions2[MediaInteractions2["Seeked"] = 2] = "Seeked";
|
|
9338
|
-
MediaInteractions2[MediaInteractions2["VolumeChange"] = 3] = "VolumeChange";
|
|
9339
|
-
MediaInteractions2[MediaInteractions2["RateChange"] = 4] = "RateChange";
|
|
9340
|
-
return MediaInteractions2;
|
|
9341
|
-
})(MediaInteractions || {});
|
|
9342
|
-
var NodeType = /* @__PURE__ */ ((NodeType2) => {
|
|
9343
|
-
NodeType2[NodeType2["Document"] = 0] = "Document";
|
|
9344
|
-
NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
|
|
9345
|
-
NodeType2[NodeType2["Element"] = 2] = "Element";
|
|
9346
|
-
NodeType2[NodeType2["Text"] = 3] = "Text";
|
|
9347
|
-
NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
|
|
9348
|
-
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
9349
|
-
return NodeType2;
|
|
9350
|
-
})(NodeType || {});
|
|
9351
|
-
class StormSnapshotManager {
|
|
9352
|
-
constructor() {
|
|
9353
|
-
__publicField(this, "fullSnapshotTaker", null);
|
|
9354
|
-
__publicField(this, "lastFullSnapshot", -1);
|
|
9355
|
-
__publicField(this, "intervalBetweenSnapshots", 150);
|
|
9356
|
-
}
|
|
9357
|
-
bindFullSnapshotTaker(takeFullSnapshot2) {
|
|
9358
|
-
this.fullSnapshotTaker = takeFullSnapshot2;
|
|
9359
|
-
}
|
|
9360
|
-
requestFullSnapshot(bufferId) {
|
|
9361
|
-
if (!this.fullSnapshotTaker) {
|
|
9362
|
-
console.log(
|
|
9363
|
-
"requestFullSnapshot: no full snapshot taker",
|
|
9364
|
-
"bufferId:",
|
|
9365
|
-
bufferId
|
|
9366
|
-
);
|
|
9367
|
-
return;
|
|
9368
|
-
}
|
|
9369
|
-
if (Date.now() - this.lastFullSnapshot < this.intervalBetweenSnapshots) {
|
|
9370
|
-
console.log("requestFullSnapshot: too soon", "bufferId:", bufferId);
|
|
9371
|
-
return;
|
|
9372
|
-
}
|
|
9373
|
-
console.log("taking full snapshot", "bufferId:", bufferId);
|
|
9374
|
-
this.fullSnapshotTaker();
|
|
9375
|
-
this.lastFullSnapshot = Date.now();
|
|
9376
|
-
}
|
|
9351
|
+
let errorHandler;
|
|
9352
|
+
function registerErrorHandler(handler) {
|
|
9353
|
+
errorHandler = handler;
|
|
9377
9354
|
}
|
|
9378
|
-
|
|
9379
|
-
|
|
9380
|
-
return "__ln" in n2;
|
|
9355
|
+
function unregisterErrorHandler() {
|
|
9356
|
+
errorHandler = void 0;
|
|
9381
9357
|
}
|
|
9382
|
-
|
|
9383
|
-
|
|
9384
|
-
|
|
9385
|
-
__publicField(this, "head", null);
|
|
9386
|
-
__publicField(this, "tail", null);
|
|
9387
|
-
}
|
|
9388
|
-
get(position) {
|
|
9389
|
-
if (position >= this.length) {
|
|
9390
|
-
throw new Error("Position outside of list range");
|
|
9391
|
-
}
|
|
9392
|
-
let current = this.head;
|
|
9393
|
-
for (let index2 = 0; index2 < position; index2++) {
|
|
9394
|
-
current = (current == null ? void 0 : current.next) || null;
|
|
9395
|
-
}
|
|
9396
|
-
return current;
|
|
9358
|
+
const callbackWrapper = (cb) => {
|
|
9359
|
+
if (!errorHandler) {
|
|
9360
|
+
return cb;
|
|
9397
9361
|
}
|
|
9398
|
-
|
|
9399
|
-
|
|
9400
|
-
|
|
9401
|
-
|
|
9402
|
-
|
|
9403
|
-
|
|
9404
|
-
n2.__ln = node2;
|
|
9405
|
-
if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {
|
|
9406
|
-
const current = n2.previousSibling.__ln.next;
|
|
9407
|
-
node2.next = current;
|
|
9408
|
-
node2.previous = n2.previousSibling.__ln;
|
|
9409
|
-
n2.previousSibling.__ln.next = node2;
|
|
9410
|
-
if (current) {
|
|
9411
|
-
current.previous = node2;
|
|
9412
|
-
}
|
|
9413
|
-
} else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {
|
|
9414
|
-
const current = n2.nextSibling.__ln.previous;
|
|
9415
|
-
node2.previous = current;
|
|
9416
|
-
node2.next = n2.nextSibling.__ln;
|
|
9417
|
-
n2.nextSibling.__ln.previous = node2;
|
|
9418
|
-
if (current) {
|
|
9419
|
-
current.next = node2;
|
|
9420
|
-
}
|
|
9421
|
-
} else {
|
|
9422
|
-
if (this.head) {
|
|
9423
|
-
this.head.previous = node2;
|
|
9362
|
+
const rrwebWrapped = (...rest) => {
|
|
9363
|
+
try {
|
|
9364
|
+
return cb(...rest);
|
|
9365
|
+
} catch (error) {
|
|
9366
|
+
if (errorHandler && errorHandler(error) === true) {
|
|
9367
|
+
return;
|
|
9424
9368
|
}
|
|
9425
|
-
|
|
9426
|
-
this.head = node2;
|
|
9369
|
+
throw error;
|
|
9427
9370
|
}
|
|
9428
|
-
|
|
9429
|
-
|
|
9371
|
+
};
|
|
9372
|
+
return rrwebWrapped;
|
|
9373
|
+
};
|
|
9374
|
+
class CrossOriginIframeMirror {
|
|
9375
|
+
constructor(generateIdFn) {
|
|
9376
|
+
__publicField(this, "iframeIdToRemoteIdMap", /* @__PURE__ */ new WeakMap());
|
|
9377
|
+
__publicField(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
9378
|
+
this.generateIdFn = generateIdFn;
|
|
9379
|
+
}
|
|
9380
|
+
getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {
|
|
9381
|
+
const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);
|
|
9382
|
+
const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);
|
|
9383
|
+
let id = idToRemoteIdMap.get(remoteId);
|
|
9384
|
+
if (!id) {
|
|
9385
|
+
id = this.generateIdFn();
|
|
9386
|
+
idToRemoteIdMap.set(remoteId, id);
|
|
9387
|
+
remoteIdToIdMap.set(id, remoteId);
|
|
9430
9388
|
}
|
|
9431
|
-
|
|
9389
|
+
return id;
|
|
9432
9390
|
}
|
|
9433
|
-
|
|
9434
|
-
const
|
|
9435
|
-
|
|
9391
|
+
getIds(iframe, remoteId) {
|
|
9392
|
+
const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);
|
|
9393
|
+
const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
|
|
9394
|
+
return remoteId.map(
|
|
9395
|
+
(id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap)
|
|
9396
|
+
);
|
|
9397
|
+
}
|
|
9398
|
+
getRemoteId(iframe, id, map) {
|
|
9399
|
+
const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);
|
|
9400
|
+
if (typeof id !== "number") return id;
|
|
9401
|
+
const remoteId = remoteIdToIdMap.get(id);
|
|
9402
|
+
if (!remoteId) return -1;
|
|
9403
|
+
return remoteId;
|
|
9404
|
+
}
|
|
9405
|
+
getRemoteIds(iframe, ids) {
|
|
9406
|
+
const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
|
|
9407
|
+
return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));
|
|
9408
|
+
}
|
|
9409
|
+
reset(iframe) {
|
|
9410
|
+
if (!iframe) {
|
|
9411
|
+
this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();
|
|
9412
|
+
this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();
|
|
9436
9413
|
return;
|
|
9437
9414
|
}
|
|
9438
|
-
|
|
9439
|
-
|
|
9440
|
-
|
|
9441
|
-
|
|
9442
|
-
|
|
9443
|
-
|
|
9444
|
-
|
|
9445
|
-
|
|
9446
|
-
current.previous.next = current.next;
|
|
9447
|
-
if (current.next) {
|
|
9448
|
-
current.next.previous = current.previous;
|
|
9449
|
-
} else {
|
|
9450
|
-
this.tail = current.previous;
|
|
9451
|
-
}
|
|
9452
|
-
}
|
|
9453
|
-
if (n2.__ln) {
|
|
9454
|
-
delete n2.__ln;
|
|
9415
|
+
this.iframeIdToRemoteIdMap.delete(iframe);
|
|
9416
|
+
this.iframeRemoteIdToIdMap.delete(iframe);
|
|
9417
|
+
}
|
|
9418
|
+
getIdToRemoteIdMap(iframe) {
|
|
9419
|
+
let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);
|
|
9420
|
+
if (!idToRemoteIdMap) {
|
|
9421
|
+
idToRemoteIdMap = /* @__PURE__ */ new Map();
|
|
9422
|
+
this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);
|
|
9455
9423
|
}
|
|
9456
|
-
|
|
9424
|
+
return idToRemoteIdMap;
|
|
9457
9425
|
}
|
|
9458
|
-
|
|
9459
|
-
|
|
9460
|
-
|
|
9461
|
-
|
|
9462
|
-
|
|
9463
|
-
|
|
9464
|
-
|
|
9465
|
-
result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
9426
|
+
getRemoteIdToIdMap(iframe) {
|
|
9427
|
+
let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);
|
|
9428
|
+
if (!remoteIdToIdMap) {
|
|
9429
|
+
remoteIdToIdMap = /* @__PURE__ */ new Map();
|
|
9430
|
+
this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);
|
|
9431
|
+
}
|
|
9432
|
+
return remoteIdToIdMap;
|
|
9466
9433
|
}
|
|
9467
|
-
return result2;
|
|
9468
9434
|
}
|
|
9469
|
-
class
|
|
9470
|
-
constructor() {
|
|
9471
|
-
__publicField(this, "
|
|
9472
|
-
__publicField(this, "
|
|
9473
|
-
__publicField(this, "
|
|
9474
|
-
__publicField(this, "
|
|
9475
|
-
__publicField(this, "
|
|
9476
|
-
__publicField(this, "removes", []);
|
|
9477
|
-
__publicField(this, "mapRemoves", []);
|
|
9478
|
-
__publicField(this, "movedMap", {});
|
|
9479
|
-
__publicField(this, "addedSet", /* @__PURE__ */ new Set());
|
|
9480
|
-
__publicField(this, "movedSet", /* @__PURE__ */ new Set());
|
|
9481
|
-
__publicField(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
9482
|
-
__publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
9483
|
-
__publicField(this, "mutationCb");
|
|
9484
|
-
__publicField(this, "blockClass");
|
|
9485
|
-
__publicField(this, "blockSelector");
|
|
9486
|
-
__publicField(this, "maskTextClass");
|
|
9487
|
-
__publicField(this, "maskTextSelector");
|
|
9488
|
-
__publicField(this, "inlineStylesheet");
|
|
9489
|
-
__publicField(this, "maskInputOptions");
|
|
9490
|
-
__publicField(this, "maskTextFn");
|
|
9491
|
-
__publicField(this, "maskInputFn");
|
|
9492
|
-
__publicField(this, "keepIframeSrcFn");
|
|
9493
|
-
__publicField(this, "recordCanvas");
|
|
9494
|
-
__publicField(this, "inlineImages");
|
|
9495
|
-
__publicField(this, "slimDOMOptions");
|
|
9496
|
-
__publicField(this, "dataURLOptions");
|
|
9497
|
-
__publicField(this, "doc");
|
|
9435
|
+
class IframeManager {
|
|
9436
|
+
constructor(options) {
|
|
9437
|
+
__publicField(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
9438
|
+
__publicField(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
9439
|
+
__publicField(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
9440
|
+
__publicField(this, "crossOriginIframeStyleMirror");
|
|
9441
|
+
__publicField(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
9498
9442
|
__publicField(this, "mirror");
|
|
9499
|
-
__publicField(this, "
|
|
9443
|
+
__publicField(this, "mutationCb");
|
|
9444
|
+
__publicField(this, "wrappedEmit");
|
|
9445
|
+
__publicField(this, "loadListener");
|
|
9500
9446
|
__publicField(this, "stylesheetManager");
|
|
9501
|
-
__publicField(this, "
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
|
|
9509
|
-
|
|
9510
|
-
|
|
9511
|
-
|
|
9447
|
+
__publicField(this, "recordCrossOriginIframes");
|
|
9448
|
+
this.mutationCb = options.mutationCb;
|
|
9449
|
+
this.wrappedEmit = options.wrappedEmit;
|
|
9450
|
+
this.stylesheetManager = options.stylesheetManager;
|
|
9451
|
+
this.recordCrossOriginIframes = options.recordCrossOriginIframes;
|
|
9452
|
+
this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(
|
|
9453
|
+
this.stylesheetManager.styleMirror.generateId.bind(
|
|
9454
|
+
this.stylesheetManager.styleMirror
|
|
9455
|
+
)
|
|
9456
|
+
);
|
|
9457
|
+
this.mirror = options.mirror;
|
|
9458
|
+
if (this.recordCrossOriginIframes) {
|
|
9459
|
+
window.addEventListener("message", this.handleMessage.bind(this));
|
|
9460
|
+
}
|
|
9461
|
+
}
|
|
9462
|
+
addIframe(iframeEl) {
|
|
9463
|
+
this.iframes.set(iframeEl, true);
|
|
9464
|
+
if (iframeEl.contentWindow)
|
|
9465
|
+
this.crossOriginIframeMap.set(iframeEl.contentWindow, iframeEl);
|
|
9466
|
+
}
|
|
9467
|
+
addLoadListener(cb) {
|
|
9468
|
+
this.loadListener = cb;
|
|
9469
|
+
}
|
|
9470
|
+
attachIframe(iframeEl, childSn) {
|
|
9471
|
+
var _a2, _b2;
|
|
9472
|
+
this.mutationCb({
|
|
9473
|
+
adds: [
|
|
9474
|
+
{
|
|
9475
|
+
parentId: this.mirror.getId(iframeEl),
|
|
9476
|
+
nextId: null,
|
|
9477
|
+
node: childSn
|
|
9478
|
+
}
|
|
9479
|
+
],
|
|
9480
|
+
removes: [],
|
|
9481
|
+
texts: [],
|
|
9482
|
+
attributes: [],
|
|
9483
|
+
isAttachIframe: true
|
|
9512
9484
|
});
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
"detected probable mutation storm start",
|
|
9518
|
-
"buffer id:",
|
|
9519
|
-
this.bufId
|
|
9520
|
-
);
|
|
9521
|
-
this.stormInfo = {
|
|
9522
|
-
startedAt: time,
|
|
9523
|
-
totalMutations: 0,
|
|
9524
|
-
timeout: setTimeout(this.handleStormFinish, this.stormSettings.timeout),
|
|
9525
|
-
stormExceededLimit: false
|
|
9526
|
-
};
|
|
9527
|
-
}
|
|
9528
|
-
this.stormInfo.totalMutations += muts.length;
|
|
9529
|
-
console.log(
|
|
9530
|
-
"current storm mutations",
|
|
9531
|
-
this.stormInfo.totalMutations,
|
|
9532
|
-
"buffer id:",
|
|
9533
|
-
this.bufId
|
|
9534
|
-
);
|
|
9535
|
-
if (this.stormInfo.totalMutations >= this.stormSettings.mutationLimit) {
|
|
9536
|
-
this.stormInfo.stormExceededLimit = true;
|
|
9537
|
-
this.stormBatches = [];
|
|
9538
|
-
} else {
|
|
9539
|
-
this.stormBatches.push({
|
|
9540
|
-
ts: time,
|
|
9541
|
-
mutations: muts
|
|
9542
|
-
});
|
|
9543
|
-
}
|
|
9544
|
-
if (muts.length < this.stormSettings.batchSize) {
|
|
9545
|
-
clearTimeout(this.stormInfo.timeout);
|
|
9546
|
-
this.handleStormFinish();
|
|
9547
|
-
}
|
|
9548
|
-
});
|
|
9549
|
-
__publicField(this, "handleStormFinish", () => {
|
|
9550
|
-
if (!this.stormInfo) return;
|
|
9551
|
-
const { stormExceededLimit } = this.stormInfo;
|
|
9552
|
-
console.log(
|
|
9553
|
-
"mutation storm finished",
|
|
9554
|
-
"totalMutations:",
|
|
9555
|
-
this.stormInfo.totalMutations,
|
|
9556
|
-
"stormExceededLimit:",
|
|
9557
|
-
stormExceededLimit,
|
|
9558
|
-
"storm duration:",
|
|
9559
|
-
Date.now() - this.stormInfo.startedAt,
|
|
9560
|
-
"ms",
|
|
9561
|
-
"buffer id:",
|
|
9562
|
-
this.bufId
|
|
9485
|
+
if (this.recordCrossOriginIframes)
|
|
9486
|
+
(_a2 = iframeEl.contentWindow) == null ? void 0 : _a2.addEventListener(
|
|
9487
|
+
"message",
|
|
9488
|
+
this.handleMessage.bind(this)
|
|
9563
9489
|
);
|
|
9564
|
-
|
|
9565
|
-
|
|
9566
|
-
|
|
9567
|
-
|
|
9568
|
-
|
|
9569
|
-
|
|
9570
|
-
|
|
9571
|
-
|
|
9572
|
-
|
|
9573
|
-
|
|
9574
|
-
|
|
9575
|
-
|
|
9490
|
+
(_b2 = this.loadListener) == null ? void 0 : _b2.call(this, iframeEl);
|
|
9491
|
+
if (iframeEl.contentDocument && iframeEl.contentDocument.adoptedStyleSheets && iframeEl.contentDocument.adoptedStyleSheets.length > 0)
|
|
9492
|
+
this.stylesheetManager.adoptStyleSheets(
|
|
9493
|
+
iframeEl.contentDocument.adoptedStyleSheets,
|
|
9494
|
+
this.mirror.getId(iframeEl.contentDocument)
|
|
9495
|
+
);
|
|
9496
|
+
}
|
|
9497
|
+
handleMessage(message) {
|
|
9498
|
+
const crossOriginMessageEvent = message;
|
|
9499
|
+
if (crossOriginMessageEvent.data.type !== "rrweb" || // To filter out the rrweb messages which are forwarded by some sites.
|
|
9500
|
+
crossOriginMessageEvent.origin !== crossOriginMessageEvent.data.origin)
|
|
9501
|
+
return;
|
|
9502
|
+
const iframeSourceWindow = message.source;
|
|
9503
|
+
if (!iframeSourceWindow) return;
|
|
9504
|
+
const iframeEl = this.crossOriginIframeMap.get(message.source);
|
|
9505
|
+
if (!iframeEl) return;
|
|
9506
|
+
const transformedEvent = this.transformCrossOriginEvent(
|
|
9507
|
+
iframeEl,
|
|
9508
|
+
crossOriginMessageEvent.data.event
|
|
9509
|
+
);
|
|
9510
|
+
if (transformedEvent)
|
|
9511
|
+
this.wrappedEmit(
|
|
9512
|
+
transformedEvent,
|
|
9513
|
+
crossOriginMessageEvent.data.isCheckout
|
|
9514
|
+
);
|
|
9515
|
+
}
|
|
9516
|
+
transformCrossOriginEvent(iframeEl, e2) {
|
|
9517
|
+
var _a2;
|
|
9518
|
+
switch (e2.type) {
|
|
9519
|
+
case EventType.FullSnapshot: {
|
|
9520
|
+
this.crossOriginIframeMirror.reset(iframeEl);
|
|
9521
|
+
this.crossOriginIframeStyleMirror.reset(iframeEl);
|
|
9522
|
+
this.replaceIdOnNode(e2.data.node, iframeEl);
|
|
9523
|
+
const rootId = e2.data.node.id;
|
|
9524
|
+
this.crossOriginIframeRootIdMap.set(iframeEl, rootId);
|
|
9525
|
+
this.patchRootIdOnNode(e2.data.node, rootId);
|
|
9526
|
+
return {
|
|
9527
|
+
timestamp: e2.timestamp,
|
|
9528
|
+
type: EventType.IncrementalSnapshot,
|
|
9529
|
+
data: {
|
|
9530
|
+
source: IncrementalSource.Mutation,
|
|
9531
|
+
adds: [
|
|
9532
|
+
{
|
|
9533
|
+
parentId: this.mirror.getId(iframeEl),
|
|
9534
|
+
nextId: null,
|
|
9535
|
+
node: e2.data.node
|
|
9536
|
+
}
|
|
9537
|
+
],
|
|
9538
|
+
removes: [],
|
|
9539
|
+
texts: [],
|
|
9540
|
+
attributes: [],
|
|
9541
|
+
isAttachIframe: true
|
|
9542
|
+
}
|
|
9543
|
+
};
|
|
9576
9544
|
}
|
|
9577
|
-
|
|
9578
|
-
|
|
9579
|
-
|
|
9580
|
-
|
|
9581
|
-
return;
|
|
9545
|
+
case EventType.Meta:
|
|
9546
|
+
case EventType.Load:
|
|
9547
|
+
case EventType.DomContentLoaded: {
|
|
9548
|
+
return false;
|
|
9582
9549
|
}
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
this.processMutation(mut);
|
|
9550
|
+
case EventType.Plugin: {
|
|
9551
|
+
return e2;
|
|
9586
9552
|
}
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
"buffer id:",
|
|
9595
|
-
this.bufId
|
|
9596
|
-
);
|
|
9597
|
-
this.emit();
|
|
9598
|
-
});
|
|
9599
|
-
__publicField(this, "processMutations", (mutations) => {
|
|
9600
|
-
this.processInternalMutations(mutations);
|
|
9601
|
-
});
|
|
9602
|
-
__publicField(this, "emit", () => {
|
|
9603
|
-
if (this.frozen || this.locked) {
|
|
9604
|
-
return;
|
|
9553
|
+
case EventType.Custom: {
|
|
9554
|
+
this.replaceIds(
|
|
9555
|
+
e2.data.payload,
|
|
9556
|
+
iframeEl,
|
|
9557
|
+
["id", "parentId", "previousId", "nextId"]
|
|
9558
|
+
);
|
|
9559
|
+
return e2;
|
|
9605
9560
|
}
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9561
|
+
case EventType.IncrementalSnapshot: {
|
|
9562
|
+
switch (e2.data.source) {
|
|
9563
|
+
case IncrementalSource.Mutation: {
|
|
9564
|
+
e2.data.adds.forEach((n2) => {
|
|
9565
|
+
this.replaceIds(n2, iframeEl, [
|
|
9566
|
+
"parentId",
|
|
9567
|
+
"nextId",
|
|
9568
|
+
"previousId"
|
|
9569
|
+
]);
|
|
9570
|
+
this.replaceIdOnNode(n2.node, iframeEl);
|
|
9571
|
+
const rootId = this.crossOriginIframeRootIdMap.get(iframeEl);
|
|
9572
|
+
rootId && this.patchRootIdOnNode(n2.node, rootId);
|
|
9573
|
+
});
|
|
9574
|
+
e2.data.removes.forEach((n2) => {
|
|
9575
|
+
this.replaceIds(n2, iframeEl, ["parentId", "id"]);
|
|
9576
|
+
});
|
|
9577
|
+
e2.data.attributes.forEach((n2) => {
|
|
9578
|
+
this.replaceIds(n2, iframeEl, ["id"]);
|
|
9579
|
+
});
|
|
9580
|
+
e2.data.texts.forEach((n2) => {
|
|
9581
|
+
this.replaceIds(n2, iframeEl, ["id"]);
|
|
9582
|
+
});
|
|
9583
|
+
return e2;
|
|
9584
|
+
}
|
|
9585
|
+
case IncrementalSource.Drag:
|
|
9586
|
+
case IncrementalSource.TouchMove:
|
|
9587
|
+
case IncrementalSource.MouseMove: {
|
|
9588
|
+
e2.data.positions.forEach((p) => {
|
|
9589
|
+
this.replaceIds(p, iframeEl, ["id"]);
|
|
9590
|
+
});
|
|
9591
|
+
return e2;
|
|
9592
|
+
}
|
|
9593
|
+
case IncrementalSource.ViewportResize: {
|
|
9594
|
+
return false;
|
|
9595
|
+
}
|
|
9596
|
+
case IncrementalSource.MediaInteraction:
|
|
9597
|
+
case IncrementalSource.MouseInteraction:
|
|
9598
|
+
case IncrementalSource.Scroll:
|
|
9599
|
+
case IncrementalSource.CanvasMutation:
|
|
9600
|
+
case IncrementalSource.Input: {
|
|
9601
|
+
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
9602
|
+
return e2;
|
|
9603
|
+
}
|
|
9604
|
+
case IncrementalSource.StyleSheetRule:
|
|
9605
|
+
case IncrementalSource.StyleDeclaration: {
|
|
9606
|
+
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
9607
|
+
this.replaceStyleIds(e2.data, iframeEl, ["styleId"]);
|
|
9608
|
+
return e2;
|
|
9609
|
+
}
|
|
9610
|
+
case IncrementalSource.Font: {
|
|
9611
|
+
return e2;
|
|
9612
|
+
}
|
|
9613
|
+
case IncrementalSource.Selection: {
|
|
9614
|
+
e2.data.ranges.forEach((range) => {
|
|
9615
|
+
this.replaceIds(range, iframeEl, ["start", "end"]);
|
|
9616
|
+
});
|
|
9617
|
+
return e2;
|
|
9618
|
+
}
|
|
9619
|
+
case IncrementalSource.AdoptedStyleSheet: {
|
|
9620
|
+
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
9621
|
+
this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]);
|
|
9622
|
+
(_a2 = e2.data.styles) == null ? void 0 : _a2.forEach((style) => {
|
|
9623
|
+
this.replaceStyleIds(style, iframeEl, ["styleId"]);
|
|
9624
|
+
});
|
|
9625
|
+
return e2;
|
|
9630
9626
|
}
|
|
9631
9627
|
}
|
|
9632
|
-
const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);
|
|
9633
|
-
const nextId = getNextId(n2);
|
|
9634
|
-
if (parentId === -1 || nextId === -1) {
|
|
9635
|
-
return addList.addNode(n2);
|
|
9636
|
-
}
|
|
9637
|
-
const sn = serializeNodeWithId(n2, {
|
|
9638
|
-
doc: this.doc,
|
|
9639
|
-
mirror: this.mirror,
|
|
9640
|
-
blockClass: this.blockClass,
|
|
9641
|
-
blockSelector: this.blockSelector,
|
|
9642
|
-
maskTextClass: this.maskTextClass,
|
|
9643
|
-
maskTextSelector: this.maskTextSelector,
|
|
9644
|
-
skipChild: true,
|
|
9645
|
-
newlyAddedElement: true,
|
|
9646
|
-
inlineStylesheet: this.inlineStylesheet,
|
|
9647
|
-
maskInputOptions: this.maskInputOptions,
|
|
9648
|
-
maskTextFn: this.maskTextFn,
|
|
9649
|
-
maskInputFn: this.maskInputFn,
|
|
9650
|
-
slimDOMOptions: this.slimDOMOptions,
|
|
9651
|
-
dataURLOptions: this.dataURLOptions,
|
|
9652
|
-
recordCanvas: this.recordCanvas,
|
|
9653
|
-
inlineImages: this.inlineImages,
|
|
9654
|
-
onSerialize: (currentN) => {
|
|
9655
|
-
if (isSerializedIframe(currentN, this.mirror)) {
|
|
9656
|
-
this.iframeManager.addIframe(currentN);
|
|
9657
|
-
}
|
|
9658
|
-
if (isSerializedStylesheet(currentN, this.mirror)) {
|
|
9659
|
-
this.stylesheetManager.trackLinkElement(
|
|
9660
|
-
currentN
|
|
9661
|
-
);
|
|
9662
|
-
}
|
|
9663
|
-
if (hasShadowRoot(n2)) {
|
|
9664
|
-
this.shadowDomManager.addShadowRoot(index.shadowRoot(n2), this.doc);
|
|
9665
|
-
}
|
|
9666
|
-
},
|
|
9667
|
-
onIframeLoad: (iframe, childSn) => {
|
|
9668
|
-
this.iframeManager.attachIframe(iframe, childSn);
|
|
9669
|
-
this.shadowDomManager.observeAttachShadow(iframe);
|
|
9670
|
-
},
|
|
9671
|
-
onStylesheetLoad: (link, childSn) => {
|
|
9672
|
-
this.stylesheetManager.attachLinkElement(link, childSn);
|
|
9673
|
-
},
|
|
9674
|
-
cssCaptured
|
|
9675
|
-
});
|
|
9676
|
-
if (sn) {
|
|
9677
|
-
adds.push({
|
|
9678
|
-
parentId,
|
|
9679
|
-
nextId,
|
|
9680
|
-
node: sn
|
|
9681
|
-
});
|
|
9682
|
-
addedIds.add(sn.id);
|
|
9683
|
-
}
|
|
9684
|
-
};
|
|
9685
|
-
while (this.mapRemoves.length) {
|
|
9686
|
-
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
9687
9628
|
}
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9629
|
+
}
|
|
9630
|
+
return false;
|
|
9631
|
+
}
|
|
9632
|
+
replace(iframeMirror, obj, iframeEl, keys) {
|
|
9633
|
+
for (const key of keys) {
|
|
9634
|
+
if (!Array.isArray(obj[key]) && typeof obj[key] !== "number") continue;
|
|
9635
|
+
if (Array.isArray(obj[key])) {
|
|
9636
|
+
obj[key] = iframeMirror.getIds(
|
|
9637
|
+
iframeEl,
|
|
9638
|
+
obj[key]
|
|
9639
|
+
);
|
|
9640
|
+
} else {
|
|
9641
|
+
obj[key] = iframeMirror.getId(iframeEl, obj[key]);
|
|
9693
9642
|
}
|
|
9694
|
-
|
|
9695
|
-
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
|
|
9699
|
-
|
|
9700
|
-
|
|
9701
|
-
|
|
9643
|
+
}
|
|
9644
|
+
return obj;
|
|
9645
|
+
}
|
|
9646
|
+
replaceIds(obj, iframeEl, keys) {
|
|
9647
|
+
return this.replace(this.crossOriginIframeMirror, obj, iframeEl, keys);
|
|
9648
|
+
}
|
|
9649
|
+
replaceStyleIds(obj, iframeEl, keys) {
|
|
9650
|
+
return this.replace(this.crossOriginIframeStyleMirror, obj, iframeEl, keys);
|
|
9651
|
+
}
|
|
9652
|
+
replaceIdOnNode(node2, iframeEl) {
|
|
9653
|
+
this.replaceIds(node2, iframeEl, ["id", "rootId"]);
|
|
9654
|
+
if ("childNodes" in node2) {
|
|
9655
|
+
node2.childNodes.forEach((child) => {
|
|
9656
|
+
this.replaceIdOnNode(child, iframeEl);
|
|
9657
|
+
});
|
|
9658
|
+
}
|
|
9659
|
+
}
|
|
9660
|
+
patchRootIdOnNode(node2, rootId) {
|
|
9661
|
+
if (node2.type !== NodeType$3.Document && !node2.rootId) node2.rootId = rootId;
|
|
9662
|
+
if ("childNodes" in node2) {
|
|
9663
|
+
node2.childNodes.forEach((child) => {
|
|
9664
|
+
this.patchRootIdOnNode(child, rootId);
|
|
9665
|
+
});
|
|
9666
|
+
}
|
|
9667
|
+
}
|
|
9668
|
+
}
|
|
9669
|
+
function makeid$1(length = 8) {
|
|
9670
|
+
var result2 = "";
|
|
9671
|
+
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
9672
|
+
var charactersLength = characters.length;
|
|
9673
|
+
for (var i2 = 0; i2 < length; i2++) {
|
|
9674
|
+
result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
9675
|
+
}
|
|
9676
|
+
return result2;
|
|
9677
|
+
}
|
|
9678
|
+
const _StormSnapshotManager = class _StormSnapshotManager2 {
|
|
9679
|
+
constructor() {
|
|
9680
|
+
__publicField(this, "id", makeid$1());
|
|
9681
|
+
__publicField(this, "lastFullSnapshot", -1);
|
|
9682
|
+
__publicField(this, "intervalBetweenSnapshots", 150);
|
|
9683
|
+
if (_StormSnapshotManager2.instance) {
|
|
9684
|
+
return _StormSnapshotManager2.instance;
|
|
9685
|
+
}
|
|
9686
|
+
_StormSnapshotManager2.instance = this;
|
|
9687
|
+
}
|
|
9688
|
+
requestFullSnapshot(bufferId) {
|
|
9689
|
+
if (!takeFullSnapshot) return;
|
|
9690
|
+
if (Date.now() - this.lastFullSnapshot < this.intervalBetweenSnapshots) {
|
|
9691
|
+
console.log(
|
|
9692
|
+
"requestFullSnapshot: too soon",
|
|
9693
|
+
"storm snapshot mng id:",
|
|
9694
|
+
this.id,
|
|
9695
|
+
"bufferId:",
|
|
9696
|
+
bufferId
|
|
9697
|
+
);
|
|
9698
|
+
return;
|
|
9699
|
+
}
|
|
9700
|
+
console.log(
|
|
9701
|
+
"taking full snapshot",
|
|
9702
|
+
"storm snapshot mng id:",
|
|
9703
|
+
this.id,
|
|
9704
|
+
"bufferId:",
|
|
9705
|
+
bufferId
|
|
9706
|
+
);
|
|
9707
|
+
takeFullSnapshot();
|
|
9708
|
+
this.lastFullSnapshot = Date.now();
|
|
9709
|
+
}
|
|
9710
|
+
};
|
|
9711
|
+
__publicField(_StormSnapshotManager, "instance");
|
|
9712
|
+
let StormSnapshotManager = _StormSnapshotManager;
|
|
9713
|
+
const stormSnapshotManager = new StormSnapshotManager();
|
|
9714
|
+
function isNodeInLinkedList(n2) {
|
|
9715
|
+
return "__ln" in n2;
|
|
9716
|
+
}
|
|
9717
|
+
class DoubleLinkedList {
|
|
9718
|
+
constructor() {
|
|
9719
|
+
__publicField(this, "length", 0);
|
|
9720
|
+
__publicField(this, "head", null);
|
|
9721
|
+
__publicField(this, "tail", null);
|
|
9722
|
+
}
|
|
9723
|
+
get(position) {
|
|
9724
|
+
if (position >= this.length) {
|
|
9725
|
+
throw new Error("Position outside of list range");
|
|
9726
|
+
}
|
|
9727
|
+
let current = this.head;
|
|
9728
|
+
for (let index2 = 0; index2 < position; index2++) {
|
|
9729
|
+
current = (current == null ? void 0 : current.next) || null;
|
|
9730
|
+
}
|
|
9731
|
+
return current;
|
|
9732
|
+
}
|
|
9733
|
+
addNode(n2) {
|
|
9734
|
+
const node2 = {
|
|
9735
|
+
value: n2,
|
|
9736
|
+
previous: null,
|
|
9737
|
+
next: null
|
|
9738
|
+
};
|
|
9739
|
+
n2.__ln = node2;
|
|
9740
|
+
if (n2.previousSibling && isNodeInLinkedList(n2.previousSibling)) {
|
|
9741
|
+
const current = n2.previousSibling.__ln.next;
|
|
9742
|
+
node2.next = current;
|
|
9743
|
+
node2.previous = n2.previousSibling.__ln;
|
|
9744
|
+
n2.previousSibling.__ln.next = node2;
|
|
9745
|
+
if (current) {
|
|
9746
|
+
current.previous = node2;
|
|
9702
9747
|
}
|
|
9703
|
-
|
|
9704
|
-
|
|
9705
|
-
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
node2 = candidate;
|
|
9711
|
-
}
|
|
9712
|
-
}
|
|
9713
|
-
if (!node2) {
|
|
9714
|
-
let tailNode = addList.tail;
|
|
9715
|
-
while (tailNode) {
|
|
9716
|
-
const _node = tailNode;
|
|
9717
|
-
tailNode = tailNode.previous;
|
|
9718
|
-
if (_node) {
|
|
9719
|
-
const parentId = this.mirror.getId(index.parentNode(_node.value));
|
|
9720
|
-
const nextId = getNextId(_node.value);
|
|
9721
|
-
if (nextId === -1) continue;
|
|
9722
|
-
else if (parentId !== -1) {
|
|
9723
|
-
node2 = _node;
|
|
9724
|
-
break;
|
|
9725
|
-
} else {
|
|
9726
|
-
const unhandledNode = _node.value;
|
|
9727
|
-
const parent = index.parentNode(unhandledNode);
|
|
9728
|
-
if (parent && parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
9729
|
-
const shadowHost = index.host(parent);
|
|
9730
|
-
const parentId2 = this.mirror.getId(shadowHost);
|
|
9731
|
-
if (parentId2 !== -1) {
|
|
9732
|
-
node2 = _node;
|
|
9733
|
-
break;
|
|
9734
|
-
}
|
|
9735
|
-
}
|
|
9736
|
-
}
|
|
9737
|
-
}
|
|
9738
|
-
}
|
|
9739
|
-
}
|
|
9740
|
-
if (!node2) {
|
|
9741
|
-
while (addList.head) {
|
|
9742
|
-
addList.removeNode(addList.head.value);
|
|
9743
|
-
}
|
|
9744
|
-
break;
|
|
9745
|
-
}
|
|
9746
|
-
candidate = node2.previous;
|
|
9747
|
-
addList.removeNode(node2.value);
|
|
9748
|
-
pushAdd(node2.value);
|
|
9748
|
+
} else if (n2.nextSibling && isNodeInLinkedList(n2.nextSibling) && n2.nextSibling.__ln.previous) {
|
|
9749
|
+
const current = n2.nextSibling.__ln.previous;
|
|
9750
|
+
node2.previous = current;
|
|
9751
|
+
node2.next = n2.nextSibling.__ln;
|
|
9752
|
+
n2.nextSibling.__ln.previous = node2;
|
|
9753
|
+
if (current) {
|
|
9754
|
+
current.next = node2;
|
|
9749
9755
|
}
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
const parent = index.parentNode(n2);
|
|
9754
|
-
if (parent && parent.tagName === "TEXTAREA") {
|
|
9755
|
-
this.genTextAreaValueMutation(parent);
|
|
9756
|
-
}
|
|
9757
|
-
const id = this.mirror.getId(n2);
|
|
9758
|
-
if (!addedIds.has(id) && this.mirror.has(id)) {
|
|
9759
|
-
payloadTexts.push({
|
|
9760
|
-
id,
|
|
9761
|
-
value: text.value
|
|
9762
|
-
});
|
|
9763
|
-
}
|
|
9756
|
+
} else {
|
|
9757
|
+
if (this.head) {
|
|
9758
|
+
this.head.previous = node2;
|
|
9764
9759
|
}
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
|
|
9780
|
-
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9760
|
+
node2.next = this.head;
|
|
9761
|
+
this.head = node2;
|
|
9762
|
+
}
|
|
9763
|
+
if (node2.next === null) {
|
|
9764
|
+
this.tail = node2;
|
|
9765
|
+
}
|
|
9766
|
+
this.length++;
|
|
9767
|
+
}
|
|
9768
|
+
removeNode(n2) {
|
|
9769
|
+
const current = n2.__ln;
|
|
9770
|
+
if (!this.head) {
|
|
9771
|
+
return;
|
|
9772
|
+
}
|
|
9773
|
+
if (!current.previous) {
|
|
9774
|
+
this.head = current.next;
|
|
9775
|
+
if (this.head) {
|
|
9776
|
+
this.head.previous = null;
|
|
9777
|
+
} else {
|
|
9778
|
+
this.tail = null;
|
|
9784
9779
|
}
|
|
9785
|
-
|
|
9786
|
-
|
|
9787
|
-
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
// const n = text.node;
|
|
9792
|
-
// const parent = dom.parentNode(n);
|
|
9793
|
-
// if (parent && (parent as Element).tagName === 'TEXTAREA') {
|
|
9794
|
-
// // the node is being ignored as it isn't in the mirror, so shift mutation to attributes on parent textarea
|
|
9795
|
-
// this.genTextAreaValueMutation(parent as HTMLTextAreaElement);
|
|
9796
|
-
// }
|
|
9797
|
-
// return {
|
|
9798
|
-
// id: this.mirror.getId(n),
|
|
9799
|
-
// value: text.value,
|
|
9800
|
-
// };
|
|
9801
|
-
// })
|
|
9802
|
-
// // no need to include them on added elements, as they have just been serialized with up to date attribubtes
|
|
9803
|
-
// .filter((text) => !addedIds.has(text.id))
|
|
9804
|
-
// // text mutation's id was not in the mirror map means the target node has been removed
|
|
9805
|
-
// .filter((text) => this.mirror.has(text.id)),
|
|
9806
|
-
//original implementation instead of "payloadAttributes"
|
|
9807
|
-
// this.attributes
|
|
9808
|
-
// .map((attribute) => {
|
|
9809
|
-
// const { attributes } = attribute;
|
|
9810
|
-
// if (typeof attributes.style === 'string') {
|
|
9811
|
-
// const diffAsStr = JSON.stringify(attribute.styleDiff);
|
|
9812
|
-
// const unchangedAsStr = JSON.stringify(attribute._unchangedStyles);
|
|
9813
|
-
// // check if the style diff is actually shorter than the regular string based mutation
|
|
9814
|
-
// // (which was the whole point of #464 'compact style mutation').
|
|
9815
|
-
// if (diffAsStr.length < attributes.style.length) {
|
|
9816
|
-
// // also: CSSOM fails badly when var() is present on shorthand properties, so only proceed with
|
|
9817
|
-
// // the compact style mutation if these have all been accounted for
|
|
9818
|
-
// if (
|
|
9819
|
-
// (diffAsStr + unchangedAsStr).split('var(').length ===
|
|
9820
|
-
// attributes.style.split('var(').length
|
|
9821
|
-
// ) {
|
|
9822
|
-
// attributes.style = attribute.styleDiff;
|
|
9823
|
-
// }
|
|
9824
|
-
// }
|
|
9825
|
-
// }
|
|
9826
|
-
// return {
|
|
9827
|
-
// id: this.mirror.getId(attribute.node),
|
|
9828
|
-
// attributes: attributes,
|
|
9829
|
-
// };
|
|
9830
|
-
// })
|
|
9831
|
-
// // no need to include them on added elements, as they have just been serialized with up to date attribubtes
|
|
9832
|
-
// .filter((attribute) => !addedIds.has(attribute.id))
|
|
9833
|
-
// // attribute mutation's id was not in the mirror map means the target node has been removed
|
|
9834
|
-
// .filter((attribute) => this.mirror.has(attribute.id)),
|
|
9835
|
-
removes: this.removes,
|
|
9836
|
-
adds
|
|
9837
|
-
};
|
|
9838
|
-
if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {
|
|
9839
|
-
return;
|
|
9780
|
+
} else {
|
|
9781
|
+
current.previous.next = current.next;
|
|
9782
|
+
if (current.next) {
|
|
9783
|
+
current.next.previous = current.previous;
|
|
9784
|
+
} else {
|
|
9785
|
+
this.tail = current.previous;
|
|
9840
9786
|
}
|
|
9841
|
-
|
|
9842
|
-
|
|
9843
|
-
|
|
9844
|
-
|
|
9845
|
-
|
|
9846
|
-
|
|
9847
|
-
|
|
9848
|
-
|
|
9849
|
-
|
|
9850
|
-
|
|
9787
|
+
}
|
|
9788
|
+
if (n2.__ln) {
|
|
9789
|
+
delete n2.__ln;
|
|
9790
|
+
}
|
|
9791
|
+
this.length--;
|
|
9792
|
+
}
|
|
9793
|
+
}
|
|
9794
|
+
const moveKey = (id, parentId) => `${id}@${parentId}`;
|
|
9795
|
+
function makeid(length = 8) {
|
|
9796
|
+
var result2 = "";
|
|
9797
|
+
var characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
9798
|
+
var charactersLength = characters.length;
|
|
9799
|
+
for (var i2 = 0; i2 < length; i2++) {
|
|
9800
|
+
result2 += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
9801
|
+
}
|
|
9802
|
+
return result2;
|
|
9803
|
+
}
|
|
9804
|
+
class MutationBuffer {
|
|
9805
|
+
constructor() {
|
|
9806
|
+
__publicField(this, "frozen", false);
|
|
9807
|
+
__publicField(this, "locked", false);
|
|
9808
|
+
__publicField(this, "texts", []);
|
|
9809
|
+
__publicField(this, "attributes", []);
|
|
9810
|
+
__publicField(this, "attributeMap", /* @__PURE__ */ new WeakMap());
|
|
9811
|
+
__publicField(this, "removes", []);
|
|
9812
|
+
__publicField(this, "mapRemoves", []);
|
|
9813
|
+
__publicField(this, "movedMap", {});
|
|
9814
|
+
__publicField(this, "addedSet", /* @__PURE__ */ new Set());
|
|
9815
|
+
__publicField(this, "movedSet", /* @__PURE__ */ new Set());
|
|
9816
|
+
__publicField(this, "droppedSet", /* @__PURE__ */ new Set());
|
|
9817
|
+
__publicField(this, "removesSubTreeCache", /* @__PURE__ */ new Set());
|
|
9818
|
+
__publicField(this, "mutationCb");
|
|
9819
|
+
__publicField(this, "blockClass");
|
|
9820
|
+
__publicField(this, "blockSelector");
|
|
9821
|
+
__publicField(this, "maskTextClass");
|
|
9822
|
+
__publicField(this, "maskTextSelector");
|
|
9823
|
+
__publicField(this, "inlineStylesheet");
|
|
9824
|
+
__publicField(this, "maskInputOptions");
|
|
9825
|
+
__publicField(this, "maskTextFn");
|
|
9826
|
+
__publicField(this, "maskInputFn");
|
|
9827
|
+
__publicField(this, "keepIframeSrcFn");
|
|
9828
|
+
__publicField(this, "recordCanvas");
|
|
9829
|
+
__publicField(this, "inlineImages");
|
|
9830
|
+
__publicField(this, "slimDOMOptions");
|
|
9831
|
+
__publicField(this, "dataURLOptions");
|
|
9832
|
+
__publicField(this, "doc");
|
|
9833
|
+
__publicField(this, "mirror");
|
|
9834
|
+
__publicField(this, "iframeManager");
|
|
9835
|
+
__publicField(this, "stylesheetManager");
|
|
9836
|
+
__publicField(this, "shadowDomManager");
|
|
9837
|
+
__publicField(this, "canvasManager");
|
|
9838
|
+
__publicField(this, "processedNodeManager");
|
|
9839
|
+
__publicField(this, "unattachedDoc");
|
|
9840
|
+
__publicField(this, "bufId", makeid());
|
|
9841
|
+
__publicField(this, "stormBatches", []);
|
|
9842
|
+
__publicField(this, "stormInfo");
|
|
9843
|
+
__publicField(this, "stormSettings", {
|
|
9844
|
+
batchSize: 300,
|
|
9845
|
+
timeout: 50,
|
|
9846
|
+
mutationLimit: 1500
|
|
9851
9847
|
});
|
|
9852
|
-
__publicField(this, "
|
|
9853
|
-
|
|
9854
|
-
if (
|
|
9855
|
-
|
|
9856
|
-
|
|
9857
|
-
|
|
9858
|
-
|
|
9859
|
-
|
|
9848
|
+
__publicField(this, "handleStormMutations", (muts) => {
|
|
9849
|
+
const time = Date.now();
|
|
9850
|
+
if (this.stormInfo == null) {
|
|
9851
|
+
console.log(
|
|
9852
|
+
"detected probable mutation storm start",
|
|
9853
|
+
"buffer id:",
|
|
9854
|
+
this.bufId
|
|
9855
|
+
);
|
|
9856
|
+
this.stormInfo = {
|
|
9857
|
+
startedAt: time,
|
|
9858
|
+
totalMutations: 0,
|
|
9859
|
+
timeout: setTimeout(this.handleStormFinish, this.stormSettings.timeout),
|
|
9860
|
+
stormExceededLimit: false
|
|
9860
9861
|
};
|
|
9861
|
-
this.attributes.push(item);
|
|
9862
|
-
this.attributeMap.set(textarea, item);
|
|
9863
9862
|
}
|
|
9864
|
-
|
|
9865
|
-
|
|
9866
|
-
|
|
9867
|
-
|
|
9868
|
-
|
|
9869
|
-
|
|
9870
|
-
|
|
9871
|
-
|
|
9872
|
-
|
|
9873
|
-
|
|
9874
|
-
|
|
9875
|
-
|
|
9863
|
+
this.stormInfo.totalMutations += muts.length;
|
|
9864
|
+
console.log(
|
|
9865
|
+
"current storm mutations",
|
|
9866
|
+
this.stormInfo.totalMutations,
|
|
9867
|
+
"buffer id:",
|
|
9868
|
+
this.bufId
|
|
9869
|
+
);
|
|
9870
|
+
if (this.stormInfo.totalMutations >= this.stormSettings.mutationLimit) {
|
|
9871
|
+
this.stormInfo.stormExceededLimit = true;
|
|
9872
|
+
this.stormBatches = [];
|
|
9873
|
+
} else {
|
|
9874
|
+
this.stormBatches.push({
|
|
9875
|
+
ts: time,
|
|
9876
|
+
mutations: muts
|
|
9877
|
+
});
|
|
9878
|
+
}
|
|
9879
|
+
if (muts.length < this.stormSettings.batchSize) {
|
|
9880
|
+
clearTimeout(this.stormInfo.timeout);
|
|
9881
|
+
this.handleStormFinish();
|
|
9882
|
+
}
|
|
9876
9883
|
});
|
|
9877
|
-
__publicField(this, "
|
|
9878
|
-
if (
|
|
9884
|
+
__publicField(this, "handleStormFinish", () => {
|
|
9885
|
+
if (!this.stormInfo) return;
|
|
9886
|
+
const { stormExceededLimit } = this.stormInfo;
|
|
9887
|
+
console.log(
|
|
9888
|
+
"mutation storm finished",
|
|
9889
|
+
"totalMutations:",
|
|
9890
|
+
this.stormInfo.totalMutations,
|
|
9891
|
+
"stormExceededLimit:",
|
|
9892
|
+
stormExceededLimit,
|
|
9893
|
+
"storm duration:",
|
|
9894
|
+
Date.now() - this.stormInfo.startedAt,
|
|
9895
|
+
"ms",
|
|
9896
|
+
"buffer id:",
|
|
9897
|
+
this.bufId
|
|
9898
|
+
);
|
|
9899
|
+
clearTimeout(this.stormInfo.timeout);
|
|
9900
|
+
this.stormInfo = null;
|
|
9901
|
+
if (!stormExceededLimit) {
|
|
9902
|
+
let muts = [];
|
|
9903
|
+
for (const batch of this.stormBatches) {
|
|
9904
|
+
muts.push(...batch.mutations);
|
|
9905
|
+
}
|
|
9906
|
+
this.stormBatches = [];
|
|
9907
|
+
this.processInternalMutations(muts, true);
|
|
9908
|
+
} else {
|
|
9909
|
+
this.stormBatches = [];
|
|
9910
|
+
stormSnapshotManager.requestFullSnapshot(this.bufId);
|
|
9911
|
+
}
|
|
9912
|
+
});
|
|
9913
|
+
__publicField(this, "processInternalMutations", (muts, overrideStorm = false) => {
|
|
9914
|
+
if (!overrideStorm && (this.stormInfo != null || muts.length >= this.stormSettings.batchSize)) {
|
|
9915
|
+
this.handleStormMutations(muts);
|
|
9879
9916
|
return;
|
|
9880
9917
|
}
|
|
9881
|
-
|
|
9882
|
-
|
|
9883
|
-
|
|
9884
|
-
|
|
9885
|
-
|
|
9886
|
-
|
|
9887
|
-
|
|
9888
|
-
|
|
9889
|
-
|
|
9890
|
-
|
|
9891
|
-
|
|
9892
|
-
|
|
9893
|
-
|
|
9894
|
-
|
|
9918
|
+
const start = performance.now();
|
|
9919
|
+
for (const mut of muts) {
|
|
9920
|
+
this.processMutation(mut);
|
|
9921
|
+
}
|
|
9922
|
+
console.log(
|
|
9923
|
+
muts.length,
|
|
9924
|
+
"mutations processed in",
|
|
9925
|
+
performance.now() - start,
|
|
9926
|
+
"ms",
|
|
9927
|
+
"overrideStorm",
|
|
9928
|
+
overrideStorm,
|
|
9929
|
+
"buffer id:",
|
|
9930
|
+
this.bufId
|
|
9931
|
+
);
|
|
9932
|
+
this.emit();
|
|
9933
|
+
});
|
|
9934
|
+
__publicField(this, "processMutations", (mutations) => {
|
|
9935
|
+
this.processInternalMutations(mutations);
|
|
9936
|
+
});
|
|
9937
|
+
__publicField(this, "emit", () => {
|
|
9938
|
+
if (this.frozen || this.locked) {
|
|
9939
|
+
return;
|
|
9940
|
+
}
|
|
9941
|
+
const adds = [];
|
|
9942
|
+
const addedIds = /* @__PURE__ */ new Set();
|
|
9943
|
+
const addList = new DoubleLinkedList();
|
|
9944
|
+
const getNextId = (n2) => {
|
|
9945
|
+
let ns = n2;
|
|
9946
|
+
let nextId = IGNORED_NODE;
|
|
9947
|
+
while (nextId === IGNORED_NODE) {
|
|
9948
|
+
ns = ns && ns.nextSibling;
|
|
9949
|
+
nextId = ns && this.mirror.getId(ns);
|
|
9950
|
+
}
|
|
9951
|
+
return nextId;
|
|
9952
|
+
};
|
|
9953
|
+
const pushAdd = (n2) => {
|
|
9954
|
+
const parent = index$1.parentNode(n2);
|
|
9955
|
+
if (!parent || !inDom(n2)) {
|
|
9956
|
+
return;
|
|
9957
|
+
}
|
|
9958
|
+
let cssCaptured = false;
|
|
9959
|
+
if (n2.nodeType === Node.TEXT_NODE) {
|
|
9960
|
+
const parentTag = parent.tagName;
|
|
9961
|
+
if (parentTag === "TEXTAREA") {
|
|
9962
|
+
return;
|
|
9963
|
+
} else if (parentTag === "STYLE" && this.addedSet.has(parent)) {
|
|
9964
|
+
cssCaptured = true;
|
|
9895
9965
|
}
|
|
9896
|
-
|
|
9966
|
+
}
|
|
9967
|
+
const parentId = isShadowRoot(parent) ? this.mirror.getId(getShadowHost(n2)) : this.mirror.getId(parent);
|
|
9968
|
+
const nextId = getNextId(n2);
|
|
9969
|
+
if (parentId === -1 || nextId === -1) {
|
|
9970
|
+
return addList.addNode(n2);
|
|
9971
|
+
}
|
|
9972
|
+
const sn = serializeNodeWithId(n2, {
|
|
9973
|
+
doc: this.doc,
|
|
9974
|
+
mirror: this.mirror,
|
|
9975
|
+
blockClass: this.blockClass,
|
|
9976
|
+
blockSelector: this.blockSelector,
|
|
9977
|
+
maskTextClass: this.maskTextClass,
|
|
9978
|
+
maskTextSelector: this.maskTextSelector,
|
|
9979
|
+
skipChild: true,
|
|
9980
|
+
newlyAddedElement: true,
|
|
9981
|
+
inlineStylesheet: this.inlineStylesheet,
|
|
9982
|
+
maskInputOptions: this.maskInputOptions,
|
|
9983
|
+
maskTextFn: this.maskTextFn,
|
|
9984
|
+
maskInputFn: this.maskInputFn,
|
|
9985
|
+
slimDOMOptions: this.slimDOMOptions,
|
|
9986
|
+
dataURLOptions: this.dataURLOptions,
|
|
9987
|
+
recordCanvas: this.recordCanvas,
|
|
9988
|
+
inlineImages: this.inlineImages,
|
|
9989
|
+
onSerialize: (currentN) => {
|
|
9990
|
+
if (isSerializedIframe(currentN, this.mirror)) {
|
|
9991
|
+
this.iframeManager.addIframe(currentN);
|
|
9992
|
+
}
|
|
9993
|
+
if (isSerializedStylesheet(currentN, this.mirror)) {
|
|
9994
|
+
this.stylesheetManager.trackLinkElement(
|
|
9995
|
+
currentN
|
|
9996
|
+
);
|
|
9997
|
+
}
|
|
9998
|
+
if (hasShadowRoot(n2)) {
|
|
9999
|
+
this.shadowDomManager.addShadowRoot(index$1.shadowRoot(n2), this.doc);
|
|
10000
|
+
}
|
|
10001
|
+
},
|
|
10002
|
+
onIframeLoad: (iframe, childSn) => {
|
|
10003
|
+
this.iframeManager.attachIframe(iframe, childSn);
|
|
10004
|
+
this.shadowDomManager.observeAttachShadow(iframe);
|
|
10005
|
+
},
|
|
10006
|
+
onStylesheetLoad: (link, childSn) => {
|
|
10007
|
+
this.stylesheetManager.attachLinkElement(link, childSn);
|
|
10008
|
+
},
|
|
10009
|
+
cssCaptured
|
|
10010
|
+
});
|
|
10011
|
+
if (sn) {
|
|
10012
|
+
adds.push({
|
|
10013
|
+
parentId,
|
|
10014
|
+
nextId,
|
|
10015
|
+
node: sn
|
|
10016
|
+
});
|
|
10017
|
+
addedIds.add(sn.id);
|
|
10018
|
+
}
|
|
10019
|
+
};
|
|
10020
|
+
while (this.mapRemoves.length) {
|
|
10021
|
+
this.mirror.removeNodeFromMap(this.mapRemoves.shift());
|
|
10022
|
+
}
|
|
10023
|
+
for (const n2 of this.movedSet) {
|
|
10024
|
+
if (isParentRemoved(this.removesSubTreeCache, n2, this.mirror) && !this.movedSet.has(index$1.parentNode(n2))) {
|
|
10025
|
+
continue;
|
|
10026
|
+
}
|
|
10027
|
+
pushAdd(n2);
|
|
10028
|
+
}
|
|
10029
|
+
for (const n2 of this.addedSet) {
|
|
10030
|
+
if (!isAncestorInSet(this.droppedSet, n2) && !isParentRemoved(this.removesSubTreeCache, n2, this.mirror)) {
|
|
10031
|
+
pushAdd(n2);
|
|
10032
|
+
} else if (isAncestorInSet(this.movedSet, n2)) {
|
|
10033
|
+
pushAdd(n2);
|
|
10034
|
+
} else {
|
|
10035
|
+
this.droppedSet.add(n2);
|
|
10036
|
+
}
|
|
10037
|
+
}
|
|
10038
|
+
let candidate = null;
|
|
10039
|
+
while (addList.length) {
|
|
10040
|
+
let node2 = null;
|
|
10041
|
+
if (candidate) {
|
|
10042
|
+
const parentId = this.mirror.getId(index$1.parentNode(candidate.value));
|
|
10043
|
+
const nextId = getNextId(candidate.value);
|
|
10044
|
+
if (parentId !== -1 && nextId !== -1) {
|
|
10045
|
+
node2 = candidate;
|
|
10046
|
+
}
|
|
10047
|
+
}
|
|
10048
|
+
if (!node2) {
|
|
10049
|
+
let tailNode = addList.tail;
|
|
10050
|
+
while (tailNode) {
|
|
10051
|
+
const _node = tailNode;
|
|
10052
|
+
tailNode = tailNode.previous;
|
|
10053
|
+
if (_node) {
|
|
10054
|
+
const parentId = this.mirror.getId(index$1.parentNode(_node.value));
|
|
10055
|
+
const nextId = getNextId(_node.value);
|
|
10056
|
+
if (nextId === -1) continue;
|
|
10057
|
+
else if (parentId !== -1) {
|
|
10058
|
+
node2 = _node;
|
|
10059
|
+
break;
|
|
10060
|
+
} else {
|
|
10061
|
+
const unhandledNode = _node.value;
|
|
10062
|
+
const parent = index$1.parentNode(unhandledNode);
|
|
10063
|
+
if (parent && parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
10064
|
+
const shadowHost = index$1.host(parent);
|
|
10065
|
+
const parentId2 = this.mirror.getId(shadowHost);
|
|
10066
|
+
if (parentId2 !== -1) {
|
|
10067
|
+
node2 = _node;
|
|
10068
|
+
break;
|
|
10069
|
+
}
|
|
10070
|
+
}
|
|
10071
|
+
}
|
|
10072
|
+
}
|
|
10073
|
+
}
|
|
10074
|
+
}
|
|
10075
|
+
if (!node2) {
|
|
10076
|
+
while (addList.head) {
|
|
10077
|
+
addList.removeNode(addList.head.value);
|
|
10078
|
+
}
|
|
10079
|
+
break;
|
|
10080
|
+
}
|
|
10081
|
+
candidate = node2.previous;
|
|
10082
|
+
addList.removeNode(node2.value);
|
|
10083
|
+
pushAdd(node2.value);
|
|
10084
|
+
}
|
|
10085
|
+
const payloadTexts = [];
|
|
10086
|
+
for (const text of this.texts) {
|
|
10087
|
+
const n2 = text.node;
|
|
10088
|
+
const parent = index$1.parentNode(n2);
|
|
10089
|
+
if (parent && parent.tagName === "TEXTAREA") {
|
|
10090
|
+
this.genTextAreaValueMutation(parent);
|
|
10091
|
+
}
|
|
10092
|
+
const id = this.mirror.getId(n2);
|
|
10093
|
+
if (!addedIds.has(id) && this.mirror.has(id)) {
|
|
10094
|
+
payloadTexts.push({
|
|
10095
|
+
id,
|
|
10096
|
+
value: text.value
|
|
10097
|
+
});
|
|
10098
|
+
}
|
|
10099
|
+
}
|
|
10100
|
+
const payloadAttributes = [];
|
|
10101
|
+
for (const attribute of this.attributes) {
|
|
10102
|
+
const { attributes } = attribute;
|
|
10103
|
+
if (typeof attributes.style === "string") {
|
|
10104
|
+
const diffAsStr = JSON.stringify(attribute.styleDiff);
|
|
10105
|
+
const unchangedAsStr = JSON.stringify(attribute._unchangedStyles);
|
|
10106
|
+
if (diffAsStr.length < attributes.style.length) {
|
|
10107
|
+
if ((diffAsStr + unchangedAsStr).split("var(").length === attributes.style.split("var(").length) {
|
|
10108
|
+
attributes.style = attribute.styleDiff;
|
|
10109
|
+
}
|
|
10110
|
+
}
|
|
10111
|
+
}
|
|
10112
|
+
const id = this.mirror.getId(attribute.node);
|
|
10113
|
+
if (!addedIds.has(id) && this.mirror.has(id)) {
|
|
10114
|
+
payloadAttributes.push({
|
|
10115
|
+
id,
|
|
10116
|
+
attributes
|
|
10117
|
+
});
|
|
10118
|
+
}
|
|
10119
|
+
}
|
|
10120
|
+
const payload = {
|
|
10121
|
+
texts: payloadTexts,
|
|
10122
|
+
attributes: payloadAttributes,
|
|
10123
|
+
//original implementation instead of "payloadTexts"
|
|
10124
|
+
// this.texts
|
|
10125
|
+
// .map((text) => {
|
|
10126
|
+
// const n = text.node;
|
|
10127
|
+
// const parent = dom.parentNode(n);
|
|
10128
|
+
// if (parent && (parent as Element).tagName === 'TEXTAREA') {
|
|
10129
|
+
// // the node is being ignored as it isn't in the mirror, so shift mutation to attributes on parent textarea
|
|
10130
|
+
// this.genTextAreaValueMutation(parent as HTMLTextAreaElement);
|
|
10131
|
+
// }
|
|
10132
|
+
// return {
|
|
10133
|
+
// id: this.mirror.getId(n),
|
|
10134
|
+
// value: text.value,
|
|
10135
|
+
// };
|
|
10136
|
+
// })
|
|
10137
|
+
// // no need to include them on added elements, as they have just been serialized with up to date attribubtes
|
|
10138
|
+
// .filter((text) => !addedIds.has(text.id))
|
|
10139
|
+
// // text mutation's id was not in the mirror map means the target node has been removed
|
|
10140
|
+
// .filter((text) => this.mirror.has(text.id)),
|
|
10141
|
+
//original implementation instead of "payloadAttributes"
|
|
10142
|
+
// this.attributes
|
|
10143
|
+
// .map((attribute) => {
|
|
10144
|
+
// const { attributes } = attribute;
|
|
10145
|
+
// if (typeof attributes.style === 'string') {
|
|
10146
|
+
// const diffAsStr = JSON.stringify(attribute.styleDiff);
|
|
10147
|
+
// const unchangedAsStr = JSON.stringify(attribute._unchangedStyles);
|
|
10148
|
+
// // check if the style diff is actually shorter than the regular string based mutation
|
|
10149
|
+
// // (which was the whole point of #464 'compact style mutation').
|
|
10150
|
+
// if (diffAsStr.length < attributes.style.length) {
|
|
10151
|
+
// // also: CSSOM fails badly when var() is present on shorthand properties, so only proceed with
|
|
10152
|
+
// // the compact style mutation if these have all been accounted for
|
|
10153
|
+
// if (
|
|
10154
|
+
// (diffAsStr + unchangedAsStr).split('var(').length ===
|
|
10155
|
+
// attributes.style.split('var(').length
|
|
10156
|
+
// ) {
|
|
10157
|
+
// attributes.style = attribute.styleDiff;
|
|
10158
|
+
// }
|
|
10159
|
+
// }
|
|
10160
|
+
// }
|
|
10161
|
+
// return {
|
|
10162
|
+
// id: this.mirror.getId(attribute.node),
|
|
10163
|
+
// attributes: attributes,
|
|
10164
|
+
// };
|
|
10165
|
+
// })
|
|
10166
|
+
// // no need to include them on added elements, as they have just been serialized with up to date attribubtes
|
|
10167
|
+
// .filter((attribute) => !addedIds.has(attribute.id))
|
|
10168
|
+
// // attribute mutation's id was not in the mirror map means the target node has been removed
|
|
10169
|
+
// .filter((attribute) => this.mirror.has(attribute.id)),
|
|
10170
|
+
removes: this.removes,
|
|
10171
|
+
adds
|
|
10172
|
+
};
|
|
10173
|
+
if (!payload.texts.length && !payload.attributes.length && !payload.removes.length && !payload.adds.length) {
|
|
10174
|
+
return;
|
|
10175
|
+
}
|
|
10176
|
+
this.texts = [];
|
|
10177
|
+
this.attributes = [];
|
|
10178
|
+
this.attributeMap = /* @__PURE__ */ new WeakMap();
|
|
10179
|
+
this.removes = [];
|
|
10180
|
+
this.addedSet = /* @__PURE__ */ new Set();
|
|
10181
|
+
this.movedSet = /* @__PURE__ */ new Set();
|
|
10182
|
+
this.droppedSet = /* @__PURE__ */ new Set();
|
|
10183
|
+
this.removesSubTreeCache = /* @__PURE__ */ new Set();
|
|
10184
|
+
this.movedMap = {};
|
|
10185
|
+
this.mutationCb(payload);
|
|
10186
|
+
});
|
|
10187
|
+
__publicField(this, "genTextAreaValueMutation", (textarea) => {
|
|
10188
|
+
let item = this.attributeMap.get(textarea);
|
|
10189
|
+
if (!item) {
|
|
10190
|
+
item = {
|
|
10191
|
+
node: textarea,
|
|
10192
|
+
attributes: {},
|
|
10193
|
+
styleDiff: {},
|
|
10194
|
+
_unchangedStyles: {}
|
|
10195
|
+
};
|
|
10196
|
+
this.attributes.push(item);
|
|
10197
|
+
this.attributeMap.set(textarea, item);
|
|
10198
|
+
}
|
|
10199
|
+
const value = Array.from(
|
|
10200
|
+
index$1.childNodes(textarea),
|
|
10201
|
+
(cn) => index$1.textContent(cn) || ""
|
|
10202
|
+
).join("");
|
|
10203
|
+
item.attributes.value = maskInputValue({
|
|
10204
|
+
element: textarea,
|
|
10205
|
+
maskInputOptions: this.maskInputOptions,
|
|
10206
|
+
tagName: textarea.tagName,
|
|
10207
|
+
type: getInputType(textarea),
|
|
10208
|
+
value,
|
|
10209
|
+
maskInputFn: this.maskInputFn
|
|
10210
|
+
});
|
|
10211
|
+
});
|
|
10212
|
+
__publicField(this, "processMutation", (m) => {
|
|
10213
|
+
if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
|
|
10214
|
+
return;
|
|
10215
|
+
}
|
|
10216
|
+
switch (m.type) {
|
|
10217
|
+
case "characterData": {
|
|
10218
|
+
const value = index$1.textContent(m.target);
|
|
10219
|
+
if (!isBlocked(m.target, this.blockClass, this.blockSelector, false) && value !== m.oldValue) {
|
|
10220
|
+
this.texts.push({
|
|
10221
|
+
value: needMaskingText(
|
|
10222
|
+
m.target,
|
|
10223
|
+
this.maskTextClass,
|
|
10224
|
+
this.maskTextSelector,
|
|
10225
|
+
true
|
|
10226
|
+
// checkAncestors
|
|
10227
|
+
) && value ? this.maskTextFn ? this.maskTextFn(value, closestElementOfNode(m.target)) : value.replace(/[\S]/g, "*") : value,
|
|
10228
|
+
node: m.target
|
|
10229
|
+
});
|
|
10230
|
+
}
|
|
10231
|
+
break;
|
|
9897
10232
|
}
|
|
9898
10233
|
case "attributes": {
|
|
9899
10234
|
const target = m.target;
|
|
@@ -9991,7 +10326,7 @@ class MutationBuffer {
|
|
|
9991
10326
|
for (let i2 = 0; i2 < m.addedNodes.length; i2++) {
|
|
9992
10327
|
this.genAdds(m.addedNodes[i2], m.target);
|
|
9993
10328
|
}
|
|
9994
|
-
const parentId = isShadowRoot(m.target) ? this.mirror.getId(index.host(m.target)) : this.mirror.getId(m.target);
|
|
10329
|
+
const parentId = isShadowRoot(m.target) ? this.mirror.getId(index$1.host(m.target)) : this.mirror.getId(m.target);
|
|
9995
10330
|
if (isBlocked(m.target, this.blockClass, this.blockSelector, false))
|
|
9996
10331
|
return;
|
|
9997
10332
|
const addedSetHas = this.addedSet.has(m.target);
|
|
@@ -10033,1555 +10368,1137 @@ class MutationBuffer {
|
|
|
10033
10368
|
}
|
|
10034
10369
|
this.movedSet.add(n2);
|
|
10035
10370
|
let targetId = null;
|
|
10036
|
-
if (target && this.mirror.hasNode(target)) {
|
|
10037
|
-
targetId = this.mirror.getId(target);
|
|
10038
|
-
}
|
|
10039
|
-
if (targetId && targetId !== -1) {
|
|
10040
|
-
this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true;
|
|
10041
|
-
}
|
|
10042
|
-
} else {
|
|
10043
|
-
this.addedSet.add(n2);
|
|
10044
|
-
this.droppedSet.delete(n2);
|
|
10045
|
-
}
|
|
10046
|
-
if (!isBlocked(n2, this.blockClass, this.blockSelector, false)) {
|
|
10047
|
-
const childNodes2 = index.childNodes(n2);
|
|
10048
|
-
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
10049
|
-
this.genAdds(childNodes2[i2]);
|
|
10050
|
-
}
|
|
10051
|
-
if (hasShadowRoot(n2)) {
|
|
10052
|
-
const shadowRootChildNodes = index.childNodes(index.shadowRoot(n2));
|
|
10053
|
-
for (let i2 = 0; i2 < shadowRootChildNodes.length; i2++) {
|
|
10054
|
-
const childN = shadowRootChildNodes[i2];
|
|
10055
|
-
this.processedNodeManager.add(childN, this);
|
|
10056
|
-
this.genAdds(childN, n2);
|
|
10057
|
-
}
|
|
10058
|
-
}
|
|
10059
|
-
}
|
|
10060
|
-
});
|
|
10061
|
-
}
|
|
10062
|
-
init(options) {
|
|
10063
|
-
[
|
|
10064
|
-
"mutationCb",
|
|
10065
|
-
"blockClass",
|
|
10066
|
-
"blockSelector",
|
|
10067
|
-
"maskTextClass",
|
|
10068
|
-
"maskTextSelector",
|
|
10069
|
-
"inlineStylesheet",
|
|
10070
|
-
"maskInputOptions",
|
|
10071
|
-
"maskTextFn",
|
|
10072
|
-
"maskInputFn",
|
|
10073
|
-
"keepIframeSrcFn",
|
|
10074
|
-
"recordCanvas",
|
|
10075
|
-
"inlineImages",
|
|
10076
|
-
"slimDOMOptions",
|
|
10077
|
-
"dataURLOptions",
|
|
10078
|
-
"doc",
|
|
10079
|
-
"mirror",
|
|
10080
|
-
"iframeManager",
|
|
10081
|
-
"stylesheetManager",
|
|
10082
|
-
"shadowDomManager",
|
|
10083
|
-
"canvasManager",
|
|
10084
|
-
"processedNodeManager"
|
|
10085
|
-
].forEach((key) => {
|
|
10086
|
-
this[key] = options[key];
|
|
10087
|
-
});
|
|
10088
|
-
}
|
|
10089
|
-
freeze() {
|
|
10090
|
-
this.frozen = true;
|
|
10091
|
-
this.canvasManager.freeze();
|
|
10092
|
-
}
|
|
10093
|
-
unfreeze() {
|
|
10094
|
-
this.frozen = false;
|
|
10095
|
-
this.canvasManager.unfreeze();
|
|
10096
|
-
this.emit();
|
|
10097
|
-
}
|
|
10098
|
-
isFrozen() {
|
|
10099
|
-
return this.frozen;
|
|
10100
|
-
}
|
|
10101
|
-
lock() {
|
|
10102
|
-
this.locked = true;
|
|
10103
|
-
this.canvasManager.lock();
|
|
10104
|
-
}
|
|
10105
|
-
unlock() {
|
|
10106
|
-
this.locked = false;
|
|
10107
|
-
this.canvasManager.unlock();
|
|
10108
|
-
this.emit();
|
|
10109
|
-
}
|
|
10110
|
-
reset() {
|
|
10111
|
-
this.shadowDomManager.reset();
|
|
10112
|
-
this.canvasManager.reset();
|
|
10113
|
-
}
|
|
10114
|
-
}
|
|
10115
|
-
function deepDelete(addsSet, n2) {
|
|
10116
|
-
addsSet.delete(n2);
|
|
10117
|
-
const childNodes2 = index.childNodes(n2);
|
|
10118
|
-
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
10119
|
-
deepDelete(addsSet, childNodes2[i2]);
|
|
10120
|
-
}
|
|
10121
|
-
}
|
|
10122
|
-
function processRemoves(n2, cache) {
|
|
10123
|
-
const queue = [n2];
|
|
10124
|
-
while (queue.length) {
|
|
10125
|
-
const next = queue.pop();
|
|
10126
|
-
if (cache.has(next)) continue;
|
|
10127
|
-
cache.add(next);
|
|
10128
|
-
const childNodes2 = index.childNodes(next);
|
|
10129
|
-
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
10130
|
-
queue.push(childNodes2[i2]);
|
|
10131
|
-
}
|
|
10132
|
-
}
|
|
10133
|
-
return;
|
|
10134
|
-
}
|
|
10135
|
-
function isParentRemoved(removes, n2, mirror2) {
|
|
10136
|
-
if (removes.size === 0) return false;
|
|
10137
|
-
return _isParentRemoved(removes, n2);
|
|
10138
|
-
}
|
|
10139
|
-
function _isParentRemoved(removes, n2, _mirror2) {
|
|
10140
|
-
const node2 = index.parentNode(n2);
|
|
10141
|
-
if (!node2) return false;
|
|
10142
|
-
return removes.has(node2);
|
|
10143
|
-
}
|
|
10144
|
-
function isAncestorInSet(set, n2) {
|
|
10145
|
-
if (set.size === 0) return false;
|
|
10146
|
-
return _isAncestorInSet(set, n2);
|
|
10147
|
-
}
|
|
10148
|
-
function _isAncestorInSet(set, n2) {
|
|
10149
|
-
const parent = index.parentNode(n2);
|
|
10150
|
-
if (!parent) {
|
|
10151
|
-
return false;
|
|
10152
|
-
}
|
|
10153
|
-
if (set.has(parent)) {
|
|
10154
|
-
return true;
|
|
10155
|
-
}
|
|
10156
|
-
return _isAncestorInSet(set, parent);
|
|
10157
|
-
}
|
|
10158
|
-
let errorHandler;
|
|
10159
|
-
function registerErrorHandler(handler) {
|
|
10160
|
-
errorHandler = handler;
|
|
10161
|
-
}
|
|
10162
|
-
function unregisterErrorHandler() {
|
|
10163
|
-
errorHandler = void 0;
|
|
10164
|
-
}
|
|
10165
|
-
const callbackWrapper = (cb) => {
|
|
10166
|
-
if (!errorHandler) {
|
|
10167
|
-
return cb;
|
|
10168
|
-
}
|
|
10169
|
-
const rrwebWrapped = (...rest) => {
|
|
10170
|
-
try {
|
|
10171
|
-
return cb(...rest);
|
|
10172
|
-
} catch (error) {
|
|
10173
|
-
if (errorHandler && errorHandler(error) === true) {
|
|
10174
|
-
return;
|
|
10175
|
-
}
|
|
10176
|
-
throw error;
|
|
10177
|
-
}
|
|
10178
|
-
};
|
|
10179
|
-
return rrwebWrapped;
|
|
10180
|
-
};
|
|
10181
|
-
const mutationBuffers = [];
|
|
10182
|
-
function getEventTarget(event) {
|
|
10183
|
-
try {
|
|
10184
|
-
if ("composedPath" in event) {
|
|
10185
|
-
const path = event.composedPath();
|
|
10186
|
-
if (path.length) {
|
|
10187
|
-
return path[0];
|
|
10188
|
-
}
|
|
10189
|
-
} else if ("path" in event && event.path.length) {
|
|
10190
|
-
return event.path[0];
|
|
10191
|
-
}
|
|
10192
|
-
} catch (e) {
|
|
10193
|
-
}
|
|
10194
|
-
return event && event.target;
|
|
10195
|
-
}
|
|
10196
|
-
function initMutationObserver(options, rootEl) {
|
|
10197
|
-
const mutationBuffer = new MutationBuffer();
|
|
10198
|
-
mutationBuffers.push(mutationBuffer);
|
|
10199
|
-
mutationBuffer.init(options);
|
|
10200
|
-
const observer = new (mutationObserverCtor())(
|
|
10201
|
-
callbackWrapper(mutationBuffer.processMutations.bind(mutationBuffer))
|
|
10202
|
-
);
|
|
10203
|
-
observer.observe(rootEl, {
|
|
10204
|
-
attributes: true,
|
|
10205
|
-
attributeOldValue: true,
|
|
10206
|
-
characterData: true,
|
|
10207
|
-
characterDataOldValue: true,
|
|
10208
|
-
childList: true,
|
|
10209
|
-
subtree: true
|
|
10210
|
-
});
|
|
10211
|
-
return observer;
|
|
10212
|
-
}
|
|
10213
|
-
function initMoveObserver({
|
|
10214
|
-
mousemoveCb,
|
|
10215
|
-
sampling,
|
|
10216
|
-
doc,
|
|
10217
|
-
mirror: mirror2
|
|
10218
|
-
}) {
|
|
10219
|
-
if (sampling.mousemove === false) {
|
|
10220
|
-
return () => {
|
|
10221
|
-
};
|
|
10222
|
-
}
|
|
10223
|
-
const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50;
|
|
10224
|
-
const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500;
|
|
10225
|
-
let positions = [];
|
|
10226
|
-
let timeBaseline;
|
|
10227
|
-
const wrappedCb = throttle(
|
|
10228
|
-
callbackWrapper(
|
|
10229
|
-
(source) => {
|
|
10230
|
-
const totalOffset = Date.now() - timeBaseline;
|
|
10231
|
-
mousemoveCb(
|
|
10232
|
-
positions.map((p) => {
|
|
10233
|
-
p.timeOffset -= totalOffset;
|
|
10234
|
-
return p;
|
|
10235
|
-
}),
|
|
10236
|
-
source
|
|
10237
|
-
);
|
|
10238
|
-
positions = [];
|
|
10239
|
-
timeBaseline = null;
|
|
10240
|
-
}
|
|
10241
|
-
),
|
|
10242
|
-
callbackThreshold
|
|
10243
|
-
);
|
|
10244
|
-
const updatePosition = callbackWrapper(
|
|
10245
|
-
throttle(
|
|
10246
|
-
callbackWrapper((evt) => {
|
|
10247
|
-
const target = getEventTarget(evt);
|
|
10248
|
-
const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt;
|
|
10249
|
-
if (!timeBaseline) {
|
|
10250
|
-
timeBaseline = nowTimestamp();
|
|
10251
|
-
}
|
|
10252
|
-
positions.push({
|
|
10253
|
-
x: clientX,
|
|
10254
|
-
y: clientY,
|
|
10255
|
-
id: mirror2.getId(target),
|
|
10256
|
-
timeOffset: nowTimestamp() - timeBaseline
|
|
10257
|
-
});
|
|
10258
|
-
wrappedCb(
|
|
10259
|
-
typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove
|
|
10260
|
-
);
|
|
10261
|
-
}),
|
|
10262
|
-
threshold,
|
|
10263
|
-
{
|
|
10264
|
-
trailing: false
|
|
10265
|
-
}
|
|
10266
|
-
)
|
|
10267
|
-
);
|
|
10268
|
-
const handlers = [
|
|
10269
|
-
on("mousemove", updatePosition, doc),
|
|
10270
|
-
on("touchmove", updatePosition, doc),
|
|
10271
|
-
on("drag", updatePosition, doc)
|
|
10272
|
-
];
|
|
10273
|
-
return callbackWrapper(() => {
|
|
10274
|
-
handlers.forEach((h) => h());
|
|
10275
|
-
});
|
|
10276
|
-
}
|
|
10277
|
-
function initMouseInteractionObserver({
|
|
10278
|
-
mouseInteractionCb,
|
|
10279
|
-
doc,
|
|
10280
|
-
mirror: mirror2,
|
|
10281
|
-
blockClass,
|
|
10282
|
-
blockSelector,
|
|
10283
|
-
sampling
|
|
10284
|
-
}) {
|
|
10285
|
-
if (sampling.mouseInteraction === false) {
|
|
10286
|
-
return () => {
|
|
10287
|
-
};
|
|
10288
|
-
}
|
|
10289
|
-
const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;
|
|
10290
|
-
const handlers = [];
|
|
10291
|
-
let currentPointerType = null;
|
|
10292
|
-
const getHandler = (eventKey) => {
|
|
10293
|
-
return (event) => {
|
|
10294
|
-
const target = getEventTarget(event);
|
|
10295
|
-
if (isBlocked(target, blockClass, blockSelector, true)) {
|
|
10296
|
-
return;
|
|
10297
|
-
}
|
|
10298
|
-
let pointerType = null;
|
|
10299
|
-
let thisEventKey = eventKey;
|
|
10300
|
-
if ("pointerType" in event) {
|
|
10301
|
-
switch (event.pointerType) {
|
|
10302
|
-
case "mouse":
|
|
10303
|
-
pointerType = PointerTypes.Mouse;
|
|
10304
|
-
break;
|
|
10305
|
-
case "touch":
|
|
10306
|
-
pointerType = PointerTypes.Touch;
|
|
10307
|
-
break;
|
|
10308
|
-
case "pen":
|
|
10309
|
-
pointerType = PointerTypes.Pen;
|
|
10310
|
-
break;
|
|
10311
|
-
}
|
|
10312
|
-
if (pointerType === PointerTypes.Touch) {
|
|
10313
|
-
if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) {
|
|
10314
|
-
thisEventKey = "TouchStart";
|
|
10315
|
-
} else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) {
|
|
10316
|
-
thisEventKey = "TouchEnd";
|
|
10317
|
-
}
|
|
10318
|
-
} else if (pointerType === PointerTypes.Pen) ;
|
|
10319
|
-
} else if (legacy_isTouchEvent(event)) {
|
|
10320
|
-
pointerType = PointerTypes.Touch;
|
|
10321
|
-
}
|
|
10322
|
-
if (pointerType !== null) {
|
|
10323
|
-
currentPointerType = pointerType;
|
|
10324
|
-
if (thisEventKey.startsWith("Touch") && pointerType === PointerTypes.Touch || thisEventKey.startsWith("Mouse") && pointerType === PointerTypes.Mouse) {
|
|
10325
|
-
pointerType = null;
|
|
10326
|
-
}
|
|
10327
|
-
} else if (MouseInteractions[eventKey] === MouseInteractions.Click) {
|
|
10328
|
-
pointerType = currentPointerType;
|
|
10329
|
-
currentPointerType = null;
|
|
10330
|
-
}
|
|
10331
|
-
const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;
|
|
10332
|
-
if (!e2) {
|
|
10333
|
-
return;
|
|
10334
|
-
}
|
|
10335
|
-
const id = mirror2.getId(target);
|
|
10336
|
-
const { clientX, clientY } = e2;
|
|
10337
|
-
callbackWrapper(mouseInteractionCb)(__spreadValues({
|
|
10338
|
-
type: MouseInteractions[thisEventKey],
|
|
10339
|
-
id,
|
|
10340
|
-
x: clientX,
|
|
10341
|
-
y: clientY
|
|
10342
|
-
}, pointerType !== null && { pointerType }));
|
|
10343
|
-
};
|
|
10344
|
-
};
|
|
10345
|
-
Object.keys(MouseInteractions).filter(
|
|
10346
|
-
(key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false
|
|
10347
|
-
).forEach((eventKey) => {
|
|
10348
|
-
let eventName = toLowerCase(eventKey);
|
|
10349
|
-
const handler = getHandler(eventKey);
|
|
10350
|
-
if (window.PointerEvent) {
|
|
10351
|
-
switch (MouseInteractions[eventKey]) {
|
|
10352
|
-
case MouseInteractions.MouseDown:
|
|
10353
|
-
case MouseInteractions.MouseUp:
|
|
10354
|
-
eventName = eventName.replace(
|
|
10355
|
-
"mouse",
|
|
10356
|
-
"pointer"
|
|
10357
|
-
);
|
|
10358
|
-
break;
|
|
10359
|
-
case MouseInteractions.TouchStart:
|
|
10360
|
-
case MouseInteractions.TouchEnd:
|
|
10361
|
-
return;
|
|
10362
|
-
}
|
|
10363
|
-
}
|
|
10364
|
-
handlers.push(on(eventName, handler, doc));
|
|
10365
|
-
});
|
|
10366
|
-
return callbackWrapper(() => {
|
|
10367
|
-
handlers.forEach((h) => h());
|
|
10368
|
-
});
|
|
10369
|
-
}
|
|
10370
|
-
function initScrollObserver({
|
|
10371
|
-
scrollCb,
|
|
10372
|
-
doc,
|
|
10373
|
-
mirror: mirror2,
|
|
10374
|
-
blockClass,
|
|
10375
|
-
blockSelector,
|
|
10376
|
-
sampling
|
|
10377
|
-
}) {
|
|
10378
|
-
const updatePosition = callbackWrapper(
|
|
10379
|
-
throttle(
|
|
10380
|
-
callbackWrapper((evt) => {
|
|
10381
|
-
const target = getEventTarget(evt);
|
|
10382
|
-
if (!target || isBlocked(target, blockClass, blockSelector, true)) {
|
|
10383
|
-
return;
|
|
10384
|
-
}
|
|
10385
|
-
const id = mirror2.getId(target);
|
|
10386
|
-
if (target === doc && doc.defaultView) {
|
|
10387
|
-
const scrollLeftTop = getWindowScroll(doc.defaultView);
|
|
10388
|
-
scrollCb({
|
|
10389
|
-
id,
|
|
10390
|
-
x: scrollLeftTop.left,
|
|
10391
|
-
y: scrollLeftTop.top
|
|
10392
|
-
});
|
|
10393
|
-
} else {
|
|
10394
|
-
scrollCb({
|
|
10395
|
-
id,
|
|
10396
|
-
x: target.scrollLeft,
|
|
10397
|
-
y: target.scrollTop
|
|
10398
|
-
});
|
|
10399
|
-
}
|
|
10400
|
-
}),
|
|
10401
|
-
sampling.scroll || 100
|
|
10402
|
-
)
|
|
10403
|
-
);
|
|
10404
|
-
return on("scroll", updatePosition, doc);
|
|
10405
|
-
}
|
|
10406
|
-
function initViewportResizeObserver({ viewportResizeCb }, { win }) {
|
|
10407
|
-
let lastH = -1;
|
|
10408
|
-
let lastW = -1;
|
|
10409
|
-
const updateDimension = callbackWrapper(
|
|
10410
|
-
throttle(
|
|
10411
|
-
callbackWrapper(() => {
|
|
10412
|
-
const height = getWindowHeight();
|
|
10413
|
-
const width = getWindowWidth();
|
|
10414
|
-
if (lastH !== height || lastW !== width) {
|
|
10415
|
-
viewportResizeCb({
|
|
10416
|
-
width: Number(width),
|
|
10417
|
-
height: Number(height)
|
|
10418
|
-
});
|
|
10419
|
-
lastH = height;
|
|
10420
|
-
lastW = width;
|
|
10421
|
-
}
|
|
10422
|
-
}),
|
|
10423
|
-
200
|
|
10424
|
-
)
|
|
10425
|
-
);
|
|
10426
|
-
return on("resize", updateDimension, win);
|
|
10427
|
-
}
|
|
10428
|
-
const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
|
|
10429
|
-
const lastInputValueMap = /* @__PURE__ */ new WeakMap();
|
|
10430
|
-
function initInputObserver({
|
|
10431
|
-
inputCb,
|
|
10432
|
-
doc,
|
|
10433
|
-
mirror: mirror2,
|
|
10434
|
-
blockClass,
|
|
10435
|
-
blockSelector,
|
|
10436
|
-
ignoreClass,
|
|
10437
|
-
ignoreSelector,
|
|
10438
|
-
maskInputOptions,
|
|
10439
|
-
maskInputFn,
|
|
10440
|
-
sampling,
|
|
10441
|
-
userTriggeredOnInput
|
|
10442
|
-
}) {
|
|
10443
|
-
function eventHandler(event) {
|
|
10444
|
-
let target = getEventTarget(event);
|
|
10445
|
-
const userTriggered = event.isTrusted;
|
|
10446
|
-
const tagName = target && target.tagName;
|
|
10447
|
-
if (target && tagName === "OPTION") {
|
|
10448
|
-
target = index.parentElement(target);
|
|
10449
|
-
}
|
|
10450
|
-
if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked(target, blockClass, blockSelector, true)) {
|
|
10451
|
-
return;
|
|
10452
|
-
}
|
|
10453
|
-
if (target.classList.contains(ignoreClass) || ignoreSelector && target.matches(ignoreSelector)) {
|
|
10454
|
-
return;
|
|
10455
|
-
}
|
|
10456
|
-
let text = target.value;
|
|
10457
|
-
let isChecked = false;
|
|
10458
|
-
const type = getInputType(target) || "";
|
|
10459
|
-
if (type === "radio" || type === "checkbox") {
|
|
10460
|
-
isChecked = target.checked;
|
|
10461
|
-
} else if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {
|
|
10462
|
-
text = maskInputValue({
|
|
10463
|
-
element: target,
|
|
10464
|
-
maskInputOptions,
|
|
10465
|
-
tagName,
|
|
10466
|
-
type,
|
|
10467
|
-
value: text,
|
|
10468
|
-
maskInputFn
|
|
10469
|
-
});
|
|
10470
|
-
}
|
|
10471
|
-
cbWithDedup(
|
|
10472
|
-
target,
|
|
10473
|
-
userTriggeredOnInput ? { text, isChecked, userTriggered } : { text, isChecked }
|
|
10474
|
-
);
|
|
10475
|
-
const name = target.name;
|
|
10476
|
-
if (type === "radio" && name && isChecked) {
|
|
10477
|
-
doc.querySelectorAll(`input[type="radio"][name="${name}"]`).forEach((el) => {
|
|
10478
|
-
if (el !== target) {
|
|
10479
|
-
const text2 = el.value;
|
|
10480
|
-
cbWithDedup(
|
|
10481
|
-
el,
|
|
10482
|
-
userTriggeredOnInput ? { text: text2, isChecked: !isChecked, userTriggered: false } : { text: text2, isChecked: !isChecked }
|
|
10483
|
-
);
|
|
10484
|
-
}
|
|
10485
|
-
});
|
|
10486
|
-
}
|
|
10487
|
-
}
|
|
10488
|
-
function cbWithDedup(target, v2) {
|
|
10489
|
-
const lastInputValue = lastInputValueMap.get(target);
|
|
10490
|
-
if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
|
|
10491
|
-
lastInputValueMap.set(target, v2);
|
|
10492
|
-
const id = mirror2.getId(target);
|
|
10493
|
-
callbackWrapper(inputCb)(__spreadProps(__spreadValues({}, v2), {
|
|
10494
|
-
id
|
|
10495
|
-
}));
|
|
10496
|
-
}
|
|
10497
|
-
}
|
|
10498
|
-
const events = sampling.input === "last" ? ["change"] : ["input", "change"];
|
|
10499
|
-
const handlers = events.map(
|
|
10500
|
-
(eventName) => on(eventName, callbackWrapper(eventHandler), doc)
|
|
10501
|
-
);
|
|
10502
|
-
const currentWindow = doc.defaultView;
|
|
10503
|
-
if (!currentWindow) {
|
|
10504
|
-
return () => {
|
|
10505
|
-
handlers.forEach((h) => h());
|
|
10506
|
-
};
|
|
10507
|
-
}
|
|
10508
|
-
const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(
|
|
10509
|
-
currentWindow.HTMLInputElement.prototype,
|
|
10510
|
-
"value"
|
|
10511
|
-
);
|
|
10512
|
-
const hookProperties = [
|
|
10513
|
-
[currentWindow.HTMLInputElement.prototype, "value"],
|
|
10514
|
-
[currentWindow.HTMLInputElement.prototype, "checked"],
|
|
10515
|
-
[currentWindow.HTMLSelectElement.prototype, "value"],
|
|
10516
|
-
[currentWindow.HTMLTextAreaElement.prototype, "value"],
|
|
10517
|
-
// Some UI library use selectedIndex to set select value
|
|
10518
|
-
[currentWindow.HTMLSelectElement.prototype, "selectedIndex"],
|
|
10519
|
-
[currentWindow.HTMLOptionElement.prototype, "selected"]
|
|
10520
|
-
];
|
|
10521
|
-
if (propertyDescriptor && propertyDescriptor.set) {
|
|
10522
|
-
handlers.push(
|
|
10523
|
-
...hookProperties.map(
|
|
10524
|
-
(p) => hookSetter(
|
|
10525
|
-
p[0],
|
|
10526
|
-
p[1],
|
|
10527
|
-
{
|
|
10528
|
-
set() {
|
|
10529
|
-
callbackWrapper(eventHandler)({
|
|
10530
|
-
target: this,
|
|
10531
|
-
isTrusted: false
|
|
10532
|
-
// userTriggered to false as this could well be programmatic
|
|
10533
|
-
});
|
|
10534
|
-
}
|
|
10535
|
-
},
|
|
10536
|
-
false,
|
|
10537
|
-
currentWindow
|
|
10538
|
-
)
|
|
10539
|
-
)
|
|
10540
|
-
);
|
|
10541
|
-
}
|
|
10542
|
-
return callbackWrapper(() => {
|
|
10543
|
-
handlers.forEach((h) => h());
|
|
10544
|
-
});
|
|
10545
|
-
}
|
|
10546
|
-
function getNestedCSSRulePositions(rule2) {
|
|
10547
|
-
const positions = [];
|
|
10548
|
-
function recurse(childRule, pos) {
|
|
10549
|
-
if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) {
|
|
10550
|
-
const rules2 = Array.from(
|
|
10551
|
-
childRule.parentRule.cssRules
|
|
10552
|
-
);
|
|
10553
|
-
const index2 = rules2.indexOf(childRule);
|
|
10554
|
-
pos.unshift(index2);
|
|
10555
|
-
} else if (childRule.parentStyleSheet) {
|
|
10556
|
-
const rules2 = Array.from(childRule.parentStyleSheet.cssRules);
|
|
10557
|
-
const index2 = rules2.indexOf(childRule);
|
|
10558
|
-
pos.unshift(index2);
|
|
10559
|
-
}
|
|
10560
|
-
return pos;
|
|
10561
|
-
}
|
|
10562
|
-
return recurse(rule2, positions);
|
|
10563
|
-
}
|
|
10564
|
-
function getIdAndStyleId(sheet, mirror2, styleMirror) {
|
|
10565
|
-
let id, styleId;
|
|
10566
|
-
if (!sheet) return {};
|
|
10567
|
-
if (sheet.ownerNode) id = mirror2.getId(sheet.ownerNode);
|
|
10568
|
-
else styleId = styleMirror.getId(sheet);
|
|
10569
|
-
return {
|
|
10570
|
-
styleId,
|
|
10571
|
-
id
|
|
10572
|
-
};
|
|
10573
|
-
}
|
|
10574
|
-
function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) {
|
|
10575
|
-
if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {
|
|
10576
|
-
return () => {
|
|
10577
|
-
};
|
|
10578
|
-
}
|
|
10579
|
-
const insertRule = win.CSSStyleSheet.prototype.insertRule;
|
|
10580
|
-
win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, {
|
|
10581
|
-
apply: callbackWrapper(
|
|
10582
|
-
(target, thisArg, argumentsList) => {
|
|
10583
|
-
const [rule2, index2] = argumentsList;
|
|
10584
|
-
const { id, styleId } = getIdAndStyleId(
|
|
10585
|
-
thisArg,
|
|
10586
|
-
mirror2,
|
|
10587
|
-
stylesheetManager.styleMirror
|
|
10588
|
-
);
|
|
10589
|
-
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10590
|
-
styleSheetRuleCb({
|
|
10591
|
-
id,
|
|
10592
|
-
styleId,
|
|
10593
|
-
adds: [{ rule: rule2, index: index2 }]
|
|
10594
|
-
});
|
|
10595
|
-
}
|
|
10596
|
-
return target.apply(thisArg, argumentsList);
|
|
10597
|
-
}
|
|
10598
|
-
)
|
|
10599
|
-
});
|
|
10600
|
-
win.CSSStyleSheet.prototype.addRule = function(selector, styleBlock, index2 = this.cssRules.length) {
|
|
10601
|
-
const rule2 = `${selector} { ${styleBlock} }`;
|
|
10602
|
-
return win.CSSStyleSheet.prototype.insertRule.apply(this, [rule2, index2]);
|
|
10603
|
-
};
|
|
10604
|
-
const deleteRule = win.CSSStyleSheet.prototype.deleteRule;
|
|
10605
|
-
win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, {
|
|
10606
|
-
apply: callbackWrapper(
|
|
10607
|
-
(target, thisArg, argumentsList) => {
|
|
10608
|
-
const [index2] = argumentsList;
|
|
10609
|
-
const { id, styleId } = getIdAndStyleId(
|
|
10610
|
-
thisArg,
|
|
10611
|
-
mirror2,
|
|
10612
|
-
stylesheetManager.styleMirror
|
|
10613
|
-
);
|
|
10614
|
-
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10615
|
-
styleSheetRuleCb({
|
|
10616
|
-
id,
|
|
10617
|
-
styleId,
|
|
10618
|
-
removes: [{ index: index2 }]
|
|
10619
|
-
});
|
|
10371
|
+
if (target && this.mirror.hasNode(target)) {
|
|
10372
|
+
targetId = this.mirror.getId(target);
|
|
10620
10373
|
}
|
|
10621
|
-
|
|
10374
|
+
if (targetId && targetId !== -1) {
|
|
10375
|
+
this.movedMap[moveKey(this.mirror.getId(n2), targetId)] = true;
|
|
10376
|
+
}
|
|
10377
|
+
} else {
|
|
10378
|
+
this.addedSet.add(n2);
|
|
10379
|
+
this.droppedSet.delete(n2);
|
|
10622
10380
|
}
|
|
10623
|
-
|
|
10624
|
-
|
|
10625
|
-
|
|
10626
|
-
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10630
|
-
|
|
10631
|
-
|
|
10632
|
-
|
|
10633
|
-
|
|
10634
|
-
const [text] = argumentsList;
|
|
10635
|
-
const { id, styleId } = getIdAndStyleId(
|
|
10636
|
-
thisArg,
|
|
10637
|
-
mirror2,
|
|
10638
|
-
stylesheetManager.styleMirror
|
|
10639
|
-
);
|
|
10640
|
-
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10641
|
-
styleSheetRuleCb({
|
|
10642
|
-
id,
|
|
10643
|
-
styleId,
|
|
10644
|
-
replace: text
|
|
10645
|
-
});
|
|
10381
|
+
if (!isBlocked(n2, this.blockClass, this.blockSelector, false)) {
|
|
10382
|
+
const childNodes2 = index$1.childNodes(n2);
|
|
10383
|
+
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
10384
|
+
this.genAdds(childNodes2[i2]);
|
|
10385
|
+
}
|
|
10386
|
+
if (hasShadowRoot(n2)) {
|
|
10387
|
+
const shadowRootChildNodes = index$1.childNodes(index$1.shadowRoot(n2));
|
|
10388
|
+
for (let i2 = 0; i2 < shadowRootChildNodes.length; i2++) {
|
|
10389
|
+
const childN = shadowRootChildNodes[i2];
|
|
10390
|
+
this.processedNodeManager.add(childN, this);
|
|
10391
|
+
this.genAdds(childN, n2);
|
|
10646
10392
|
}
|
|
10647
|
-
return target.apply(thisArg, argumentsList);
|
|
10648
10393
|
}
|
|
10649
|
-
|
|
10394
|
+
}
|
|
10650
10395
|
});
|
|
10651
10396
|
}
|
|
10652
|
-
|
|
10653
|
-
|
|
10654
|
-
|
|
10655
|
-
|
|
10656
|
-
|
|
10657
|
-
|
|
10658
|
-
|
|
10659
|
-
|
|
10660
|
-
|
|
10661
|
-
|
|
10662
|
-
|
|
10663
|
-
|
|
10664
|
-
|
|
10665
|
-
|
|
10666
|
-
|
|
10667
|
-
|
|
10668
|
-
|
|
10669
|
-
|
|
10670
|
-
|
|
10671
|
-
|
|
10672
|
-
|
|
10673
|
-
|
|
10397
|
+
init(options) {
|
|
10398
|
+
[
|
|
10399
|
+
"mutationCb",
|
|
10400
|
+
"blockClass",
|
|
10401
|
+
"blockSelector",
|
|
10402
|
+
"maskTextClass",
|
|
10403
|
+
"maskTextSelector",
|
|
10404
|
+
"inlineStylesheet",
|
|
10405
|
+
"maskInputOptions",
|
|
10406
|
+
"maskTextFn",
|
|
10407
|
+
"maskInputFn",
|
|
10408
|
+
"keepIframeSrcFn",
|
|
10409
|
+
"recordCanvas",
|
|
10410
|
+
"inlineImages",
|
|
10411
|
+
"slimDOMOptions",
|
|
10412
|
+
"dataURLOptions",
|
|
10413
|
+
"doc",
|
|
10414
|
+
"mirror",
|
|
10415
|
+
"iframeManager",
|
|
10416
|
+
"stylesheetManager",
|
|
10417
|
+
"shadowDomManager",
|
|
10418
|
+
"canvasManager",
|
|
10419
|
+
"processedNodeManager"
|
|
10420
|
+
].forEach((key) => {
|
|
10421
|
+
this[key] = options[key];
|
|
10674
10422
|
});
|
|
10675
10423
|
}
|
|
10676
|
-
|
|
10677
|
-
|
|
10678
|
-
|
|
10679
|
-
}
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
|
|
10424
|
+
freeze() {
|
|
10425
|
+
this.frozen = true;
|
|
10426
|
+
this.canvasManager.freeze();
|
|
10427
|
+
}
|
|
10428
|
+
unfreeze() {
|
|
10429
|
+
this.frozen = false;
|
|
10430
|
+
this.canvasManager.unfreeze();
|
|
10431
|
+
this.emit();
|
|
10432
|
+
}
|
|
10433
|
+
isFrozen() {
|
|
10434
|
+
return this.frozen;
|
|
10435
|
+
}
|
|
10436
|
+
lock() {
|
|
10437
|
+
this.locked = true;
|
|
10438
|
+
this.canvasManager.lock();
|
|
10439
|
+
}
|
|
10440
|
+
unlock() {
|
|
10441
|
+
this.locked = false;
|
|
10442
|
+
this.canvasManager.unlock();
|
|
10443
|
+
this.emit();
|
|
10444
|
+
}
|
|
10445
|
+
reset() {
|
|
10446
|
+
this.shadowDomManager.reset();
|
|
10447
|
+
this.canvasManager.reset();
|
|
10448
|
+
}
|
|
10449
|
+
}
|
|
10450
|
+
function deepDelete(addsSet, n2) {
|
|
10451
|
+
addsSet.delete(n2);
|
|
10452
|
+
const childNodes2 = index$1.childNodes(n2);
|
|
10453
|
+
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
10454
|
+
deepDelete(addsSet, childNodes2[i2]);
|
|
10455
|
+
}
|
|
10456
|
+
}
|
|
10457
|
+
function processRemoves(n2, cache) {
|
|
10458
|
+
const queue = [n2];
|
|
10459
|
+
while (queue.length) {
|
|
10460
|
+
const next = queue.pop();
|
|
10461
|
+
if (cache.has(next)) continue;
|
|
10462
|
+
cache.add(next);
|
|
10463
|
+
const childNodes2 = index$1.childNodes(next);
|
|
10464
|
+
for (let i2 = 0; i2 < childNodes2.length; i2++) {
|
|
10465
|
+
queue.push(childNodes2[i2]);
|
|
10688
10466
|
}
|
|
10689
10467
|
}
|
|
10690
|
-
|
|
10691
|
-
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
10692
|
-
unmodifiedFunctions[typeKey] = {
|
|
10693
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
10694
|
-
insertRule: type.prototype.insertRule,
|
|
10695
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
10696
|
-
deleteRule: type.prototype.deleteRule
|
|
10697
|
-
};
|
|
10698
|
-
type.prototype.insertRule = new Proxy(
|
|
10699
|
-
unmodifiedFunctions[typeKey].insertRule,
|
|
10700
|
-
{
|
|
10701
|
-
apply: callbackWrapper(
|
|
10702
|
-
(target, thisArg, argumentsList) => {
|
|
10703
|
-
const [rule2, index2] = argumentsList;
|
|
10704
|
-
const { id, styleId } = getIdAndStyleId(
|
|
10705
|
-
thisArg.parentStyleSheet,
|
|
10706
|
-
mirror2,
|
|
10707
|
-
stylesheetManager.styleMirror
|
|
10708
|
-
);
|
|
10709
|
-
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10710
|
-
styleSheetRuleCb({
|
|
10711
|
-
id,
|
|
10712
|
-
styleId,
|
|
10713
|
-
adds: [
|
|
10714
|
-
{
|
|
10715
|
-
rule: rule2,
|
|
10716
|
-
index: [
|
|
10717
|
-
...getNestedCSSRulePositions(thisArg),
|
|
10718
|
-
index2 || 0
|
|
10719
|
-
// defaults to 0
|
|
10720
|
-
]
|
|
10721
|
-
}
|
|
10722
|
-
]
|
|
10723
|
-
});
|
|
10724
|
-
}
|
|
10725
|
-
return target.apply(thisArg, argumentsList);
|
|
10726
|
-
}
|
|
10727
|
-
)
|
|
10728
|
-
}
|
|
10729
|
-
);
|
|
10730
|
-
type.prototype.deleteRule = new Proxy(
|
|
10731
|
-
unmodifiedFunctions[typeKey].deleteRule,
|
|
10732
|
-
{
|
|
10733
|
-
apply: callbackWrapper(
|
|
10734
|
-
(target, thisArg, argumentsList) => {
|
|
10735
|
-
const [index2] = argumentsList;
|
|
10736
|
-
const { id, styleId } = getIdAndStyleId(
|
|
10737
|
-
thisArg.parentStyleSheet,
|
|
10738
|
-
mirror2,
|
|
10739
|
-
stylesheetManager.styleMirror
|
|
10740
|
-
);
|
|
10741
|
-
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10742
|
-
styleSheetRuleCb({
|
|
10743
|
-
id,
|
|
10744
|
-
styleId,
|
|
10745
|
-
removes: [
|
|
10746
|
-
{ index: [...getNestedCSSRulePositions(thisArg), index2] }
|
|
10747
|
-
]
|
|
10748
|
-
});
|
|
10749
|
-
}
|
|
10750
|
-
return target.apply(thisArg, argumentsList);
|
|
10751
|
-
}
|
|
10752
|
-
)
|
|
10753
|
-
}
|
|
10754
|
-
);
|
|
10755
|
-
});
|
|
10756
|
-
return callbackWrapper(() => {
|
|
10757
|
-
win.CSSStyleSheet.prototype.insertRule = insertRule;
|
|
10758
|
-
win.CSSStyleSheet.prototype.deleteRule = deleteRule;
|
|
10759
|
-
replace && (win.CSSStyleSheet.prototype.replace = replace);
|
|
10760
|
-
replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);
|
|
10761
|
-
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
10762
|
-
type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;
|
|
10763
|
-
type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;
|
|
10764
|
-
});
|
|
10765
|
-
});
|
|
10468
|
+
return;
|
|
10766
10469
|
}
|
|
10767
|
-
function
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
}
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
if (
|
|
10774
|
-
|
|
10775
|
-
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
|
|
10784
|
-
|
|
10785
|
-
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
10790
|
-
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
}
|
|
10470
|
+
function isParentRemoved(removes, n2, mirror2) {
|
|
10471
|
+
if (removes.size === 0) return false;
|
|
10472
|
+
return _isParentRemoved(removes, n2);
|
|
10473
|
+
}
|
|
10474
|
+
function _isParentRemoved(removes, n2, _mirror2) {
|
|
10475
|
+
const node2 = index$1.parentNode(n2);
|
|
10476
|
+
if (!node2) return false;
|
|
10477
|
+
return removes.has(node2);
|
|
10478
|
+
}
|
|
10479
|
+
function isAncestorInSet(set, n2) {
|
|
10480
|
+
if (set.size === 0) return false;
|
|
10481
|
+
return _isAncestorInSet(set, n2);
|
|
10482
|
+
}
|
|
10483
|
+
function _isAncestorInSet(set, n2) {
|
|
10484
|
+
const parent = index$1.parentNode(n2);
|
|
10485
|
+
if (!parent) {
|
|
10486
|
+
return false;
|
|
10487
|
+
}
|
|
10488
|
+
if (set.has(parent)) {
|
|
10489
|
+
return true;
|
|
10490
|
+
}
|
|
10491
|
+
return _isAncestorInSet(set, parent);
|
|
10492
|
+
}
|
|
10493
|
+
const mutationBuffers = [];
|
|
10494
|
+
function getEventTarget(event) {
|
|
10495
|
+
try {
|
|
10496
|
+
if ("composedPath" in event) {
|
|
10497
|
+
const path = event.composedPath();
|
|
10498
|
+
if (path.length) {
|
|
10499
|
+
return path[0];
|
|
10798
10500
|
}
|
|
10799
|
-
|
|
10501
|
+
} else if ("path" in event && event.path.length) {
|
|
10502
|
+
return event.path[0];
|
|
10800
10503
|
}
|
|
10801
|
-
})
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
configurable: originalPropertyDescriptor.configurable,
|
|
10805
|
-
enumerable: originalPropertyDescriptor.enumerable,
|
|
10806
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
10807
|
-
get: originalPropertyDescriptor.get,
|
|
10808
|
-
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
10809
|
-
set: originalPropertyDescriptor.set
|
|
10810
|
-
});
|
|
10811
|
-
});
|
|
10504
|
+
} catch (e) {
|
|
10505
|
+
}
|
|
10506
|
+
return event && event.target;
|
|
10812
10507
|
}
|
|
10813
|
-
function
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
}
|
|
10828
|
-
const { id, styleId } = getIdAndStyleId(
|
|
10829
|
-
(_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,
|
|
10830
|
-
mirror2,
|
|
10831
|
-
stylesheetManager.styleMirror
|
|
10832
|
-
);
|
|
10833
|
-
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10834
|
-
styleDeclarationCb({
|
|
10835
|
-
id,
|
|
10836
|
-
styleId,
|
|
10837
|
-
set: {
|
|
10838
|
-
property,
|
|
10839
|
-
value,
|
|
10840
|
-
priority
|
|
10841
|
-
},
|
|
10842
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10843
|
-
index: getNestedCSSRulePositions(thisArg.parentRule)
|
|
10844
|
-
});
|
|
10845
|
-
}
|
|
10846
|
-
return target.apply(thisArg, argumentsList);
|
|
10847
|
-
}
|
|
10848
|
-
)
|
|
10849
|
-
});
|
|
10850
|
-
const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
|
|
10851
|
-
win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {
|
|
10852
|
-
apply: callbackWrapper(
|
|
10853
|
-
(target, thisArg, argumentsList) => {
|
|
10854
|
-
var _a2;
|
|
10855
|
-
const [property] = argumentsList;
|
|
10856
|
-
if (ignoreCSSAttributes.has(property)) {
|
|
10857
|
-
return removeProperty.apply(thisArg, [property]);
|
|
10858
|
-
}
|
|
10859
|
-
const { id, styleId } = getIdAndStyleId(
|
|
10860
|
-
(_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,
|
|
10861
|
-
mirror2,
|
|
10862
|
-
stylesheetManager.styleMirror
|
|
10863
|
-
);
|
|
10864
|
-
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10865
|
-
styleDeclarationCb({
|
|
10866
|
-
id,
|
|
10867
|
-
styleId,
|
|
10868
|
-
remove: {
|
|
10869
|
-
property
|
|
10870
|
-
},
|
|
10871
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
10872
|
-
index: getNestedCSSRulePositions(thisArg.parentRule)
|
|
10873
|
-
});
|
|
10874
|
-
}
|
|
10875
|
-
return target.apply(thisArg, argumentsList);
|
|
10876
|
-
}
|
|
10877
|
-
)
|
|
10878
|
-
});
|
|
10879
|
-
return callbackWrapper(() => {
|
|
10880
|
-
win.CSSStyleDeclaration.prototype.setProperty = setProperty;
|
|
10881
|
-
win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;
|
|
10508
|
+
function initMutationObserver(options, rootEl) {
|
|
10509
|
+
const mutationBuffer = new MutationBuffer();
|
|
10510
|
+
mutationBuffers.push(mutationBuffer);
|
|
10511
|
+
mutationBuffer.init(options);
|
|
10512
|
+
const observer = new (mutationObserverCtor$1())(
|
|
10513
|
+
callbackWrapper(mutationBuffer.processMutations.bind(mutationBuffer))
|
|
10514
|
+
);
|
|
10515
|
+
observer.observe(rootEl, {
|
|
10516
|
+
attributes: true,
|
|
10517
|
+
attributeOldValue: true,
|
|
10518
|
+
characterData: true,
|
|
10519
|
+
characterDataOldValue: true,
|
|
10520
|
+
childList: true,
|
|
10521
|
+
subtree: true
|
|
10882
10522
|
});
|
|
10523
|
+
return observer;
|
|
10883
10524
|
}
|
|
10884
|
-
function
|
|
10885
|
-
|
|
10886
|
-
blockClass,
|
|
10887
|
-
blockSelector,
|
|
10888
|
-
mirror: mirror2,
|
|
10525
|
+
function initMoveObserver({
|
|
10526
|
+
mousemoveCb,
|
|
10889
10527
|
sampling,
|
|
10890
|
-
doc
|
|
10528
|
+
doc,
|
|
10529
|
+
mirror: mirror2
|
|
10891
10530
|
}) {
|
|
10892
|
-
|
|
10893
|
-
(
|
|
10894
|
-
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10531
|
+
if (sampling.mousemove === false) {
|
|
10532
|
+
return () => {
|
|
10533
|
+
};
|
|
10534
|
+
}
|
|
10535
|
+
const threshold = typeof sampling.mousemove === "number" ? sampling.mousemove : 50;
|
|
10536
|
+
const callbackThreshold = typeof sampling.mousemoveCallback === "number" ? sampling.mousemoveCallback : 500;
|
|
10537
|
+
let positions = [];
|
|
10538
|
+
let timeBaseline;
|
|
10539
|
+
const wrappedCb = throttle(
|
|
10540
|
+
callbackWrapper(
|
|
10541
|
+
(source) => {
|
|
10542
|
+
const totalOffset = Date.now() - timeBaseline;
|
|
10543
|
+
mousemoveCb(
|
|
10544
|
+
positions.map((p) => {
|
|
10545
|
+
p.timeOffset -= totalOffset;
|
|
10546
|
+
return p;
|
|
10547
|
+
}),
|
|
10548
|
+
source
|
|
10549
|
+
);
|
|
10550
|
+
positions = [];
|
|
10551
|
+
timeBaseline = null;
|
|
10552
|
+
}
|
|
10553
|
+
),
|
|
10554
|
+
callbackThreshold
|
|
10555
|
+
);
|
|
10556
|
+
const updatePosition = callbackWrapper(
|
|
10557
|
+
throttle(
|
|
10558
|
+
callbackWrapper((evt) => {
|
|
10559
|
+
const target = getEventTarget(evt);
|
|
10560
|
+
const { clientX, clientY } = legacy_isTouchEvent(evt) ? evt.changedTouches[0] : evt;
|
|
10561
|
+
if (!timeBaseline) {
|
|
10562
|
+
timeBaseline = nowTimestamp();
|
|
10898
10563
|
}
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10564
|
+
positions.push({
|
|
10565
|
+
x: clientX,
|
|
10566
|
+
y: clientY,
|
|
10902
10567
|
id: mirror2.getId(target),
|
|
10903
|
-
|
|
10904
|
-
volume,
|
|
10905
|
-
muted,
|
|
10906
|
-
playbackRate,
|
|
10907
|
-
loop
|
|
10568
|
+
timeOffset: nowTimestamp() - timeBaseline
|
|
10908
10569
|
});
|
|
10570
|
+
wrappedCb(
|
|
10571
|
+
typeof DragEvent !== "undefined" && evt instanceof DragEvent ? IncrementalSource.Drag : evt instanceof MouseEvent ? IncrementalSource.MouseMove : IncrementalSource.TouchMove
|
|
10572
|
+
);
|
|
10909
10573
|
}),
|
|
10910
|
-
|
|
10574
|
+
threshold,
|
|
10575
|
+
{
|
|
10576
|
+
trailing: false
|
|
10577
|
+
}
|
|
10911
10578
|
)
|
|
10912
10579
|
);
|
|
10913
10580
|
const handlers = [
|
|
10914
|
-
on("
|
|
10915
|
-
on("
|
|
10916
|
-
on("
|
|
10917
|
-
on("volumechange", handler(MediaInteractions.VolumeChange), doc),
|
|
10918
|
-
on("ratechange", handler(MediaInteractions.RateChange), doc)
|
|
10581
|
+
on("mousemove", updatePosition, doc),
|
|
10582
|
+
on("touchmove", updatePosition, doc),
|
|
10583
|
+
on("drag", updatePosition, doc)
|
|
10919
10584
|
];
|
|
10920
10585
|
return callbackWrapper(() => {
|
|
10921
10586
|
handlers.forEach((h) => h());
|
|
10922
10587
|
});
|
|
10923
10588
|
}
|
|
10924
|
-
function
|
|
10925
|
-
|
|
10926
|
-
|
|
10589
|
+
function initMouseInteractionObserver({
|
|
10590
|
+
mouseInteractionCb,
|
|
10591
|
+
doc,
|
|
10592
|
+
mirror: mirror2,
|
|
10593
|
+
blockClass,
|
|
10594
|
+
blockSelector,
|
|
10595
|
+
sampling
|
|
10596
|
+
}) {
|
|
10597
|
+
if (sampling.mouseInteraction === false) {
|
|
10927
10598
|
return () => {
|
|
10928
10599
|
};
|
|
10929
|
-
}
|
|
10930
|
-
const
|
|
10931
|
-
const
|
|
10932
|
-
|
|
10933
|
-
|
|
10934
|
-
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
|
|
10938
|
-
|
|
10939
|
-
|
|
10940
|
-
|
|
10941
|
-
|
|
10600
|
+
}
|
|
10601
|
+
const disableMap = sampling.mouseInteraction === true || sampling.mouseInteraction === void 0 ? {} : sampling.mouseInteraction;
|
|
10602
|
+
const handlers = [];
|
|
10603
|
+
let currentPointerType = null;
|
|
10604
|
+
const getHandler = (eventKey) => {
|
|
10605
|
+
return (event) => {
|
|
10606
|
+
const target = getEventTarget(event);
|
|
10607
|
+
if (isBlocked(target, blockClass, blockSelector, true)) {
|
|
10608
|
+
return;
|
|
10609
|
+
}
|
|
10610
|
+
let pointerType = null;
|
|
10611
|
+
let thisEventKey = eventKey;
|
|
10612
|
+
if ("pointerType" in event) {
|
|
10613
|
+
switch (event.pointerType) {
|
|
10614
|
+
case "mouse":
|
|
10615
|
+
pointerType = PointerTypes.Mouse;
|
|
10616
|
+
break;
|
|
10617
|
+
case "touch":
|
|
10618
|
+
pointerType = PointerTypes.Touch;
|
|
10619
|
+
break;
|
|
10620
|
+
case "pen":
|
|
10621
|
+
pointerType = PointerTypes.Pen;
|
|
10622
|
+
break;
|
|
10623
|
+
}
|
|
10624
|
+
if (pointerType === PointerTypes.Touch) {
|
|
10625
|
+
if (MouseInteractions[eventKey] === MouseInteractions.MouseDown) {
|
|
10626
|
+
thisEventKey = "TouchStart";
|
|
10627
|
+
} else if (MouseInteractions[eventKey] === MouseInteractions.MouseUp) {
|
|
10628
|
+
thisEventKey = "TouchEnd";
|
|
10629
|
+
}
|
|
10630
|
+
} else if (pointerType === PointerTypes.Pen) ;
|
|
10631
|
+
} else if (legacy_isTouchEvent(event)) {
|
|
10632
|
+
pointerType = PointerTypes.Touch;
|
|
10633
|
+
}
|
|
10634
|
+
if (pointerType !== null) {
|
|
10635
|
+
currentPointerType = pointerType;
|
|
10636
|
+
if (thisEventKey.startsWith("Touch") && pointerType === PointerTypes.Touch || thisEventKey.startsWith("Mouse") && pointerType === PointerTypes.Mouse) {
|
|
10637
|
+
pointerType = null;
|
|
10638
|
+
}
|
|
10639
|
+
} else if (MouseInteractions[eventKey] === MouseInteractions.Click) {
|
|
10640
|
+
pointerType = currentPointerType;
|
|
10641
|
+
currentPointerType = null;
|
|
10642
|
+
}
|
|
10643
|
+
const e2 = legacy_isTouchEvent(event) ? event.changedTouches[0] : event;
|
|
10644
|
+
if (!e2) {
|
|
10645
|
+
return;
|
|
10646
|
+
}
|
|
10647
|
+
const id = mirror2.getId(target);
|
|
10648
|
+
const { clientX, clientY } = e2;
|
|
10649
|
+
callbackWrapper(mouseInteractionCb)(__spreadValues({
|
|
10650
|
+
type: MouseInteractions[thisEventKey],
|
|
10651
|
+
id,
|
|
10652
|
+
x: clientX,
|
|
10653
|
+
y: clientY
|
|
10654
|
+
}, pointerType !== null && { pointerType }));
|
|
10655
|
+
};
|
|
10942
10656
|
};
|
|
10943
|
-
|
|
10944
|
-
|
|
10945
|
-
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
|
|
10953
|
-
|
|
10954
|
-
|
|
10955
|
-
|
|
10956
|
-
|
|
10957
|
-
|
|
10958
|
-
|
|
10959
|
-
|
|
10657
|
+
Object.keys(MouseInteractions).filter(
|
|
10658
|
+
(key) => Number.isNaN(Number(key)) && !key.endsWith("_Departed") && disableMap[key] !== false
|
|
10659
|
+
).forEach((eventKey) => {
|
|
10660
|
+
let eventName = toLowerCase(eventKey);
|
|
10661
|
+
const handler = getHandler(eventKey);
|
|
10662
|
+
if (window.PointerEvent) {
|
|
10663
|
+
switch (MouseInteractions[eventKey]) {
|
|
10664
|
+
case MouseInteractions.MouseDown:
|
|
10665
|
+
case MouseInteractions.MouseUp:
|
|
10666
|
+
eventName = eventName.replace(
|
|
10667
|
+
"mouse",
|
|
10668
|
+
"pointer"
|
|
10669
|
+
);
|
|
10670
|
+
break;
|
|
10671
|
+
case MouseInteractions.TouchStart:
|
|
10672
|
+
case MouseInteractions.TouchEnd:
|
|
10673
|
+
return;
|
|
10674
|
+
}
|
|
10960
10675
|
}
|
|
10961
|
-
|
|
10962
|
-
handlers.push(() => {
|
|
10963
|
-
win.FontFace = originalFontFace;
|
|
10676
|
+
handlers.push(on(eventName, handler, doc));
|
|
10964
10677
|
});
|
|
10965
|
-
handlers.push(restoreHandler);
|
|
10966
10678
|
return callbackWrapper(() => {
|
|
10967
10679
|
handlers.forEach((h) => h());
|
|
10968
10680
|
});
|
|
10969
10681
|
}
|
|
10970
|
-
function
|
|
10971
|
-
|
|
10972
|
-
let collapsed = true;
|
|
10973
|
-
const updateSelection = callbackWrapper(() => {
|
|
10974
|
-
const selection = doc.getSelection();
|
|
10975
|
-
if (!selection || collapsed && (selection == null ? void 0 : selection.isCollapsed)) return;
|
|
10976
|
-
collapsed = selection.isCollapsed || false;
|
|
10977
|
-
const ranges = [];
|
|
10978
|
-
const count = selection.rangeCount || 0;
|
|
10979
|
-
for (let i2 = 0; i2 < count; i2++) {
|
|
10980
|
-
const range = selection.getRangeAt(i2);
|
|
10981
|
-
const { startContainer, startOffset, endContainer, endOffset } = range;
|
|
10982
|
-
const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);
|
|
10983
|
-
if (blocked) continue;
|
|
10984
|
-
ranges.push({
|
|
10985
|
-
start: mirror2.getId(startContainer),
|
|
10986
|
-
startOffset,
|
|
10987
|
-
end: mirror2.getId(endContainer),
|
|
10988
|
-
endOffset
|
|
10989
|
-
});
|
|
10990
|
-
}
|
|
10991
|
-
selectionCb({ ranges });
|
|
10992
|
-
});
|
|
10993
|
-
updateSelection();
|
|
10994
|
-
return on("selectionchange", updateSelection);
|
|
10995
|
-
}
|
|
10996
|
-
function initCustomElementObserver({
|
|
10682
|
+
function initScrollObserver({
|
|
10683
|
+
scrollCb,
|
|
10997
10684
|
doc,
|
|
10998
|
-
|
|
10685
|
+
mirror: mirror2,
|
|
10686
|
+
blockClass,
|
|
10687
|
+
blockSelector,
|
|
10688
|
+
sampling
|
|
10999
10689
|
}) {
|
|
11000
|
-
const
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
|
|
11005
|
-
|
|
11006
|
-
|
|
11007
|
-
|
|
11008
|
-
|
|
11009
|
-
|
|
11010
|
-
|
|
11011
|
-
|
|
11012
|
-
|
|
10690
|
+
const updatePosition = callbackWrapper(
|
|
10691
|
+
throttle(
|
|
10692
|
+
callbackWrapper((evt) => {
|
|
10693
|
+
const target = getEventTarget(evt);
|
|
10694
|
+
if (!target || isBlocked(target, blockClass, blockSelector, true)) {
|
|
10695
|
+
return;
|
|
10696
|
+
}
|
|
10697
|
+
const id = mirror2.getId(target);
|
|
10698
|
+
if (target === doc && doc.defaultView) {
|
|
10699
|
+
const scrollLeftTop = getWindowScroll(doc.defaultView);
|
|
10700
|
+
scrollCb({
|
|
10701
|
+
id,
|
|
10702
|
+
x: scrollLeftTop.left,
|
|
10703
|
+
y: scrollLeftTop.top
|
|
10704
|
+
});
|
|
10705
|
+
} else {
|
|
10706
|
+
scrollCb({
|
|
10707
|
+
id,
|
|
10708
|
+
x: target.scrollLeft,
|
|
10709
|
+
y: target.scrollTop
|
|
11013
10710
|
});
|
|
11014
|
-
} catch (e2) {
|
|
11015
|
-
console.warn(`Custom element callback failed for ${name}`);
|
|
11016
10711
|
}
|
|
11017
|
-
|
|
11018
|
-
|
|
11019
|
-
|
|
10712
|
+
}),
|
|
10713
|
+
sampling.scroll || 100
|
|
10714
|
+
)
|
|
11020
10715
|
);
|
|
11021
|
-
return
|
|
10716
|
+
return on("scroll", updatePosition, doc);
|
|
11022
10717
|
}
|
|
11023
|
-
function
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11032
|
-
|
|
11033
|
-
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
|
|
11045
|
-
|
|
11046
|
-
|
|
11047
|
-
|
|
11048
|
-
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
if (
|
|
11065
|
-
|
|
11066
|
-
}
|
|
11067
|
-
viewportResizeCb(...p);
|
|
11068
|
-
};
|
|
11069
|
-
o2.inputCb = (...p) => {
|
|
11070
|
-
if (hooks.input) {
|
|
11071
|
-
hooks.input(...p);
|
|
11072
|
-
}
|
|
11073
|
-
inputCb(...p);
|
|
11074
|
-
};
|
|
11075
|
-
o2.mediaInteractionCb = (...p) => {
|
|
11076
|
-
if (hooks.mediaInteaction) {
|
|
11077
|
-
hooks.mediaInteaction(...p);
|
|
11078
|
-
}
|
|
11079
|
-
mediaInteractionCb(...p);
|
|
11080
|
-
};
|
|
11081
|
-
o2.styleSheetRuleCb = (...p) => {
|
|
11082
|
-
if (hooks.styleSheetRule) {
|
|
11083
|
-
hooks.styleSheetRule(...p);
|
|
10718
|
+
function initViewportResizeObserver({ viewportResizeCb }, { win }) {
|
|
10719
|
+
let lastH = -1;
|
|
10720
|
+
let lastW = -1;
|
|
10721
|
+
const updateDimension = callbackWrapper(
|
|
10722
|
+
throttle(
|
|
10723
|
+
callbackWrapper(() => {
|
|
10724
|
+
const height = getWindowHeight();
|
|
10725
|
+
const width = getWindowWidth();
|
|
10726
|
+
if (lastH !== height || lastW !== width) {
|
|
10727
|
+
viewportResizeCb({
|
|
10728
|
+
width: Number(width),
|
|
10729
|
+
height: Number(height)
|
|
10730
|
+
});
|
|
10731
|
+
lastH = height;
|
|
10732
|
+
lastW = width;
|
|
10733
|
+
}
|
|
10734
|
+
}),
|
|
10735
|
+
200
|
|
10736
|
+
)
|
|
10737
|
+
);
|
|
10738
|
+
return on("resize", updateDimension, win);
|
|
10739
|
+
}
|
|
10740
|
+
const INPUT_TAGS = ["INPUT", "TEXTAREA", "SELECT"];
|
|
10741
|
+
const lastInputValueMap = /* @__PURE__ */ new WeakMap();
|
|
10742
|
+
function initInputObserver({
|
|
10743
|
+
inputCb,
|
|
10744
|
+
doc,
|
|
10745
|
+
mirror: mirror2,
|
|
10746
|
+
blockClass,
|
|
10747
|
+
blockSelector,
|
|
10748
|
+
ignoreClass,
|
|
10749
|
+
ignoreSelector,
|
|
10750
|
+
maskInputOptions,
|
|
10751
|
+
maskInputFn,
|
|
10752
|
+
sampling,
|
|
10753
|
+
userTriggeredOnInput
|
|
10754
|
+
}) {
|
|
10755
|
+
function eventHandler(event) {
|
|
10756
|
+
let target = getEventTarget(event);
|
|
10757
|
+
const userTriggered = event.isTrusted;
|
|
10758
|
+
const tagName = target && target.tagName;
|
|
10759
|
+
if (target && tagName === "OPTION") {
|
|
10760
|
+
target = index$1.parentElement(target);
|
|
11084
10761
|
}
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
o2.styleDeclarationCb = (...p) => {
|
|
11088
|
-
if (hooks.styleDeclaration) {
|
|
11089
|
-
hooks.styleDeclaration(...p);
|
|
10762
|
+
if (!target || !tagName || INPUT_TAGS.indexOf(tagName) < 0 || isBlocked(target, blockClass, blockSelector, true)) {
|
|
10763
|
+
return;
|
|
11090
10764
|
}
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
o2.canvasMutationCb = (...p) => {
|
|
11094
|
-
if (hooks.canvasMutation) {
|
|
11095
|
-
hooks.canvasMutation(...p);
|
|
10765
|
+
if (target.classList.contains(ignoreClass) || ignoreSelector && target.matches(ignoreSelector)) {
|
|
10766
|
+
return;
|
|
11096
10767
|
}
|
|
11097
|
-
|
|
11098
|
-
|
|
11099
|
-
|
|
11100
|
-
if (
|
|
11101
|
-
|
|
10768
|
+
let text = target.value;
|
|
10769
|
+
let isChecked = false;
|
|
10770
|
+
const type = getInputType(target) || "";
|
|
10771
|
+
if (type === "radio" || type === "checkbox") {
|
|
10772
|
+
isChecked = target.checked;
|
|
10773
|
+
} else if (maskInputOptions[tagName.toLowerCase()] || maskInputOptions[type]) {
|
|
10774
|
+
text = maskInputValue({
|
|
10775
|
+
element: target,
|
|
10776
|
+
maskInputOptions,
|
|
10777
|
+
tagName,
|
|
10778
|
+
type,
|
|
10779
|
+
value: text,
|
|
10780
|
+
maskInputFn
|
|
10781
|
+
});
|
|
11102
10782
|
}
|
|
11103
|
-
|
|
11104
|
-
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
10783
|
+
cbWithDedup(
|
|
10784
|
+
target,
|
|
10785
|
+
userTriggeredOnInput ? { text, isChecked, userTriggered } : { text, isChecked }
|
|
10786
|
+
);
|
|
10787
|
+
const name = target.name;
|
|
10788
|
+
if (type === "radio" && name && isChecked) {
|
|
10789
|
+
doc.querySelectorAll(`input[type="radio"][name="${name}"]`).forEach((el) => {
|
|
10790
|
+
if (el !== target) {
|
|
10791
|
+
const text2 = el.value;
|
|
10792
|
+
cbWithDedup(
|
|
10793
|
+
el,
|
|
10794
|
+
userTriggeredOnInput ? { text: text2, isChecked: !isChecked, userTriggered: false } : { text: text2, isChecked: !isChecked }
|
|
10795
|
+
);
|
|
10796
|
+
}
|
|
10797
|
+
});
|
|
11108
10798
|
}
|
|
11109
|
-
|
|
11110
|
-
|
|
11111
|
-
|
|
11112
|
-
if (
|
|
11113
|
-
|
|
10799
|
+
}
|
|
10800
|
+
function cbWithDedup(target, v2) {
|
|
10801
|
+
const lastInputValue = lastInputValueMap.get(target);
|
|
10802
|
+
if (!lastInputValue || lastInputValue.text !== v2.text || lastInputValue.isChecked !== v2.isChecked) {
|
|
10803
|
+
lastInputValueMap.set(target, v2);
|
|
10804
|
+
const id = mirror2.getId(target);
|
|
10805
|
+
callbackWrapper(inputCb)(__spreadProps(__spreadValues({}, v2), {
|
|
10806
|
+
id
|
|
10807
|
+
}));
|
|
11114
10808
|
}
|
|
11115
|
-
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
|
|
11119
|
-
|
|
10809
|
+
}
|
|
10810
|
+
const events = sampling.input === "last" ? ["change"] : ["input", "change"];
|
|
10811
|
+
const handlers = events.map(
|
|
10812
|
+
(eventName) => on(eventName, callbackWrapper(eventHandler), doc)
|
|
10813
|
+
);
|
|
10814
|
+
const currentWindow = doc.defaultView;
|
|
11120
10815
|
if (!currentWindow) {
|
|
11121
10816
|
return () => {
|
|
10817
|
+
handlers.forEach((h) => h());
|
|
11122
10818
|
};
|
|
11123
10819
|
}
|
|
11124
|
-
|
|
11125
|
-
|
|
11126
|
-
|
|
11127
|
-
|
|
11128
|
-
|
|
11129
|
-
|
|
11130
|
-
|
|
11131
|
-
|
|
11132
|
-
|
|
11133
|
-
|
|
11134
|
-
|
|
11135
|
-
|
|
11136
|
-
|
|
11137
|
-
|
|
11138
|
-
|
|
11139
|
-
|
|
11140
|
-
|
|
11141
|
-
|
|
11142
|
-
|
|
11143
|
-
|
|
11144
|
-
|
|
11145
|
-
|
|
11146
|
-
|
|
11147
|
-
|
|
11148
|
-
|
|
11149
|
-
|
|
11150
|
-
|
|
11151
|
-
|
|
11152
|
-
|
|
11153
|
-
|
|
11154
|
-
|
|
11155
|
-
|
|
11156
|
-
const customElementObserver = initCustomElementObserver(o2);
|
|
11157
|
-
const pluginHandlers = [];
|
|
11158
|
-
for (const plugin3 of o2.plugins) {
|
|
11159
|
-
pluginHandlers.push(
|
|
11160
|
-
plugin3.observer(plugin3.callback, currentWindow, plugin3.options)
|
|
10820
|
+
const propertyDescriptor = currentWindow.Object.getOwnPropertyDescriptor(
|
|
10821
|
+
currentWindow.HTMLInputElement.prototype,
|
|
10822
|
+
"value"
|
|
10823
|
+
);
|
|
10824
|
+
const hookProperties = [
|
|
10825
|
+
[currentWindow.HTMLInputElement.prototype, "value"],
|
|
10826
|
+
[currentWindow.HTMLInputElement.prototype, "checked"],
|
|
10827
|
+
[currentWindow.HTMLSelectElement.prototype, "value"],
|
|
10828
|
+
[currentWindow.HTMLTextAreaElement.prototype, "value"],
|
|
10829
|
+
// Some UI library use selectedIndex to set select value
|
|
10830
|
+
[currentWindow.HTMLSelectElement.prototype, "selectedIndex"],
|
|
10831
|
+
[currentWindow.HTMLOptionElement.prototype, "selected"]
|
|
10832
|
+
];
|
|
10833
|
+
if (propertyDescriptor && propertyDescriptor.set) {
|
|
10834
|
+
handlers.push(
|
|
10835
|
+
...hookProperties.map(
|
|
10836
|
+
(p) => hookSetter(
|
|
10837
|
+
p[0],
|
|
10838
|
+
p[1],
|
|
10839
|
+
{
|
|
10840
|
+
set() {
|
|
10841
|
+
callbackWrapper(eventHandler)({
|
|
10842
|
+
target: this,
|
|
10843
|
+
isTrusted: false
|
|
10844
|
+
// userTriggered to false as this could well be programmatic
|
|
10845
|
+
});
|
|
10846
|
+
}
|
|
10847
|
+
},
|
|
10848
|
+
false,
|
|
10849
|
+
currentWindow
|
|
10850
|
+
)
|
|
10851
|
+
)
|
|
11161
10852
|
);
|
|
11162
10853
|
}
|
|
11163
10854
|
return callbackWrapper(() => {
|
|
11164
|
-
|
|
11165
|
-
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
11166
|
-
mousemoveHandler();
|
|
11167
|
-
mouseInteractionHandler();
|
|
11168
|
-
scrollHandler();
|
|
11169
|
-
viewportResizeHandler();
|
|
11170
|
-
inputHandler();
|
|
11171
|
-
mediaInteractionHandler();
|
|
11172
|
-
styleSheetObserver();
|
|
11173
|
-
adoptedStyleSheetObserver();
|
|
11174
|
-
styleDeclarationObserver();
|
|
11175
|
-
fontObserver();
|
|
11176
|
-
selectionObserver();
|
|
11177
|
-
customElementObserver();
|
|
11178
|
-
pluginHandlers.forEach((h) => h());
|
|
10855
|
+
handlers.forEach((h) => h());
|
|
11179
10856
|
});
|
|
11180
10857
|
}
|
|
11181
|
-
function
|
|
11182
|
-
|
|
11183
|
-
|
|
11184
|
-
|
|
11185
|
-
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
-
|
|
11189
|
-
|
|
11190
|
-
}
|
|
11191
|
-
|
|
11192
|
-
|
|
11193
|
-
|
|
11194
|
-
__publicField(this, "iframeRemoteIdToIdMap", /* @__PURE__ */ new WeakMap());
|
|
11195
|
-
this.generateIdFn = generateIdFn;
|
|
11196
|
-
}
|
|
11197
|
-
getId(iframe, remoteId, idToRemoteMap, remoteToIdMap) {
|
|
11198
|
-
const idToRemoteIdMap = idToRemoteMap || this.getIdToRemoteIdMap(iframe);
|
|
11199
|
-
const remoteIdToIdMap = remoteToIdMap || this.getRemoteIdToIdMap(iframe);
|
|
11200
|
-
let id = idToRemoteIdMap.get(remoteId);
|
|
11201
|
-
if (!id) {
|
|
11202
|
-
id = this.generateIdFn();
|
|
11203
|
-
idToRemoteIdMap.set(remoteId, id);
|
|
11204
|
-
remoteIdToIdMap.set(id, remoteId);
|
|
11205
|
-
}
|
|
11206
|
-
return id;
|
|
11207
|
-
}
|
|
11208
|
-
getIds(iframe, remoteId) {
|
|
11209
|
-
const idToRemoteIdMap = this.getIdToRemoteIdMap(iframe);
|
|
11210
|
-
const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
|
|
11211
|
-
return remoteId.map(
|
|
11212
|
-
(id) => this.getId(iframe, id, idToRemoteIdMap, remoteIdToIdMap)
|
|
11213
|
-
);
|
|
11214
|
-
}
|
|
11215
|
-
getRemoteId(iframe, id, map) {
|
|
11216
|
-
const remoteIdToIdMap = map || this.getRemoteIdToIdMap(iframe);
|
|
11217
|
-
if (typeof id !== "number") return id;
|
|
11218
|
-
const remoteId = remoteIdToIdMap.get(id);
|
|
11219
|
-
if (!remoteId) return -1;
|
|
11220
|
-
return remoteId;
|
|
11221
|
-
}
|
|
11222
|
-
getRemoteIds(iframe, ids) {
|
|
11223
|
-
const remoteIdToIdMap = this.getRemoteIdToIdMap(iframe);
|
|
11224
|
-
return ids.map((id) => this.getRemoteId(iframe, id, remoteIdToIdMap));
|
|
11225
|
-
}
|
|
11226
|
-
reset(iframe) {
|
|
11227
|
-
if (!iframe) {
|
|
11228
|
-
this.iframeIdToRemoteIdMap = /* @__PURE__ */ new WeakMap();
|
|
11229
|
-
this.iframeRemoteIdToIdMap = /* @__PURE__ */ new WeakMap();
|
|
11230
|
-
return;
|
|
11231
|
-
}
|
|
11232
|
-
this.iframeIdToRemoteIdMap.delete(iframe);
|
|
11233
|
-
this.iframeRemoteIdToIdMap.delete(iframe);
|
|
11234
|
-
}
|
|
11235
|
-
getIdToRemoteIdMap(iframe) {
|
|
11236
|
-
let idToRemoteIdMap = this.iframeIdToRemoteIdMap.get(iframe);
|
|
11237
|
-
if (!idToRemoteIdMap) {
|
|
11238
|
-
idToRemoteIdMap = /* @__PURE__ */ new Map();
|
|
11239
|
-
this.iframeIdToRemoteIdMap.set(iframe, idToRemoteIdMap);
|
|
11240
|
-
}
|
|
11241
|
-
return idToRemoteIdMap;
|
|
11242
|
-
}
|
|
11243
|
-
getRemoteIdToIdMap(iframe) {
|
|
11244
|
-
let remoteIdToIdMap = this.iframeRemoteIdToIdMap.get(iframe);
|
|
11245
|
-
if (!remoteIdToIdMap) {
|
|
11246
|
-
remoteIdToIdMap = /* @__PURE__ */ new Map();
|
|
11247
|
-
this.iframeRemoteIdToIdMap.set(iframe, remoteIdToIdMap);
|
|
11248
|
-
}
|
|
11249
|
-
return remoteIdToIdMap;
|
|
11250
|
-
}
|
|
11251
|
-
}
|
|
11252
|
-
class IframeManager {
|
|
11253
|
-
constructor(options) {
|
|
11254
|
-
__publicField(this, "iframes", /* @__PURE__ */ new WeakMap());
|
|
11255
|
-
__publicField(this, "crossOriginIframeMap", /* @__PURE__ */ new WeakMap());
|
|
11256
|
-
__publicField(this, "crossOriginIframeMirror", new CrossOriginIframeMirror(genId));
|
|
11257
|
-
__publicField(this, "crossOriginIframeStyleMirror");
|
|
11258
|
-
__publicField(this, "crossOriginIframeRootIdMap", /* @__PURE__ */ new WeakMap());
|
|
11259
|
-
__publicField(this, "mirror");
|
|
11260
|
-
__publicField(this, "mutationCb");
|
|
11261
|
-
__publicField(this, "wrappedEmit");
|
|
11262
|
-
__publicField(this, "loadListener");
|
|
11263
|
-
__publicField(this, "stylesheetManager");
|
|
11264
|
-
__publicField(this, "recordCrossOriginIframes");
|
|
11265
|
-
this.mutationCb = options.mutationCb;
|
|
11266
|
-
this.wrappedEmit = options.wrappedEmit;
|
|
11267
|
-
this.stylesheetManager = options.stylesheetManager;
|
|
11268
|
-
this.recordCrossOriginIframes = options.recordCrossOriginIframes;
|
|
11269
|
-
this.crossOriginIframeStyleMirror = new CrossOriginIframeMirror(
|
|
11270
|
-
this.stylesheetManager.styleMirror.generateId.bind(
|
|
11271
|
-
this.stylesheetManager.styleMirror
|
|
11272
|
-
)
|
|
11273
|
-
);
|
|
11274
|
-
this.mirror = options.mirror;
|
|
11275
|
-
if (this.recordCrossOriginIframes) {
|
|
11276
|
-
window.addEventListener("message", this.handleMessage.bind(this));
|
|
10858
|
+
function getNestedCSSRulePositions(rule2) {
|
|
10859
|
+
const positions = [];
|
|
10860
|
+
function recurse(childRule, pos) {
|
|
10861
|
+
if (hasNestedCSSRule("CSSGroupingRule") && childRule.parentRule instanceof CSSGroupingRule || hasNestedCSSRule("CSSMediaRule") && childRule.parentRule instanceof CSSMediaRule || hasNestedCSSRule("CSSSupportsRule") && childRule.parentRule instanceof CSSSupportsRule || hasNestedCSSRule("CSSConditionRule") && childRule.parentRule instanceof CSSConditionRule) {
|
|
10862
|
+
const rules2 = Array.from(
|
|
10863
|
+
childRule.parentRule.cssRules
|
|
10864
|
+
);
|
|
10865
|
+
const index2 = rules2.indexOf(childRule);
|
|
10866
|
+
pos.unshift(index2);
|
|
10867
|
+
} else if (childRule.parentStyleSheet) {
|
|
10868
|
+
const rules2 = Array.from(childRule.parentStyleSheet.cssRules);
|
|
10869
|
+
const index2 = rules2.indexOf(childRule);
|
|
10870
|
+
pos.unshift(index2);
|
|
11277
10871
|
}
|
|
10872
|
+
return pos;
|
|
11278
10873
|
}
|
|
11279
|
-
|
|
11280
|
-
|
|
11281
|
-
|
|
11282
|
-
|
|
10874
|
+
return recurse(rule2, positions);
|
|
10875
|
+
}
|
|
10876
|
+
function getIdAndStyleId(sheet, mirror2, styleMirror) {
|
|
10877
|
+
let id, styleId;
|
|
10878
|
+
if (!sheet) return {};
|
|
10879
|
+
if (sheet.ownerNode) id = mirror2.getId(sheet.ownerNode);
|
|
10880
|
+
else styleId = styleMirror.getId(sheet);
|
|
10881
|
+
return {
|
|
10882
|
+
styleId,
|
|
10883
|
+
id
|
|
10884
|
+
};
|
|
10885
|
+
}
|
|
10886
|
+
function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetManager }, { win }) {
|
|
10887
|
+
if (!win.CSSStyleSheet || !win.CSSStyleSheet.prototype) {
|
|
10888
|
+
return () => {
|
|
10889
|
+
};
|
|
11283
10890
|
}
|
|
11284
|
-
|
|
11285
|
-
|
|
10891
|
+
const insertRule = win.CSSStyleSheet.prototype.insertRule;
|
|
10892
|
+
win.CSSStyleSheet.prototype.insertRule = new Proxy(insertRule, {
|
|
10893
|
+
apply: callbackWrapper(
|
|
10894
|
+
(target, thisArg, argumentsList) => {
|
|
10895
|
+
const [rule2, index2] = argumentsList;
|
|
10896
|
+
const { id, styleId } = getIdAndStyleId(
|
|
10897
|
+
thisArg,
|
|
10898
|
+
mirror2,
|
|
10899
|
+
stylesheetManager.styleMirror
|
|
10900
|
+
);
|
|
10901
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10902
|
+
styleSheetRuleCb({
|
|
10903
|
+
id,
|
|
10904
|
+
styleId,
|
|
10905
|
+
adds: [{ rule: rule2, index: index2 }]
|
|
10906
|
+
});
|
|
10907
|
+
}
|
|
10908
|
+
return target.apply(thisArg, argumentsList);
|
|
10909
|
+
}
|
|
10910
|
+
)
|
|
10911
|
+
});
|
|
10912
|
+
win.CSSStyleSheet.prototype.addRule = function(selector, styleBlock, index2 = this.cssRules.length) {
|
|
10913
|
+
const rule2 = `${selector} { ${styleBlock} }`;
|
|
10914
|
+
return win.CSSStyleSheet.prototype.insertRule.apply(this, [rule2, index2]);
|
|
10915
|
+
};
|
|
10916
|
+
const deleteRule = win.CSSStyleSheet.prototype.deleteRule;
|
|
10917
|
+
win.CSSStyleSheet.prototype.deleteRule = new Proxy(deleteRule, {
|
|
10918
|
+
apply: callbackWrapper(
|
|
10919
|
+
(target, thisArg, argumentsList) => {
|
|
10920
|
+
const [index2] = argumentsList;
|
|
10921
|
+
const { id, styleId } = getIdAndStyleId(
|
|
10922
|
+
thisArg,
|
|
10923
|
+
mirror2,
|
|
10924
|
+
stylesheetManager.styleMirror
|
|
10925
|
+
);
|
|
10926
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10927
|
+
styleSheetRuleCb({
|
|
10928
|
+
id,
|
|
10929
|
+
styleId,
|
|
10930
|
+
removes: [{ index: index2 }]
|
|
10931
|
+
});
|
|
10932
|
+
}
|
|
10933
|
+
return target.apply(thisArg, argumentsList);
|
|
10934
|
+
}
|
|
10935
|
+
)
|
|
10936
|
+
});
|
|
10937
|
+
win.CSSStyleSheet.prototype.removeRule = function(index2) {
|
|
10938
|
+
return win.CSSStyleSheet.prototype.deleteRule.apply(this, [index2]);
|
|
10939
|
+
};
|
|
10940
|
+
let replace;
|
|
10941
|
+
if (win.CSSStyleSheet.prototype.replace) {
|
|
10942
|
+
replace = win.CSSStyleSheet.prototype.replace;
|
|
10943
|
+
win.CSSStyleSheet.prototype.replace = new Proxy(replace, {
|
|
10944
|
+
apply: callbackWrapper(
|
|
10945
|
+
(target, thisArg, argumentsList) => {
|
|
10946
|
+
const [text] = argumentsList;
|
|
10947
|
+
const { id, styleId } = getIdAndStyleId(
|
|
10948
|
+
thisArg,
|
|
10949
|
+
mirror2,
|
|
10950
|
+
stylesheetManager.styleMirror
|
|
10951
|
+
);
|
|
10952
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10953
|
+
styleSheetRuleCb({
|
|
10954
|
+
id,
|
|
10955
|
+
styleId,
|
|
10956
|
+
replace: text
|
|
10957
|
+
});
|
|
10958
|
+
}
|
|
10959
|
+
return target.apply(thisArg, argumentsList);
|
|
10960
|
+
}
|
|
10961
|
+
)
|
|
10962
|
+
});
|
|
11286
10963
|
}
|
|
11287
|
-
|
|
11288
|
-
|
|
11289
|
-
|
|
11290
|
-
|
|
11291
|
-
|
|
11292
|
-
|
|
11293
|
-
|
|
11294
|
-
|
|
10964
|
+
let replaceSync;
|
|
10965
|
+
if (win.CSSStyleSheet.prototype.replaceSync) {
|
|
10966
|
+
replaceSync = win.CSSStyleSheet.prototype.replaceSync;
|
|
10967
|
+
win.CSSStyleSheet.prototype.replaceSync = new Proxy(replaceSync, {
|
|
10968
|
+
apply: callbackWrapper(
|
|
10969
|
+
(target, thisArg, argumentsList) => {
|
|
10970
|
+
const [text] = argumentsList;
|
|
10971
|
+
const { id, styleId } = getIdAndStyleId(
|
|
10972
|
+
thisArg,
|
|
10973
|
+
mirror2,
|
|
10974
|
+
stylesheetManager.styleMirror
|
|
10975
|
+
);
|
|
10976
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
10977
|
+
styleSheetRuleCb({
|
|
10978
|
+
id,
|
|
10979
|
+
styleId,
|
|
10980
|
+
replaceSync: text
|
|
10981
|
+
});
|
|
10982
|
+
}
|
|
10983
|
+
return target.apply(thisArg, argumentsList);
|
|
11295
10984
|
}
|
|
11296
|
-
|
|
11297
|
-
removes: [],
|
|
11298
|
-
texts: [],
|
|
11299
|
-
attributes: [],
|
|
11300
|
-
isAttachIframe: true
|
|
10985
|
+
)
|
|
11301
10986
|
});
|
|
11302
|
-
if (this.recordCrossOriginIframes)
|
|
11303
|
-
(_a2 = iframeEl.contentWindow) == null ? void 0 : _a2.addEventListener(
|
|
11304
|
-
"message",
|
|
11305
|
-
this.handleMessage.bind(this)
|
|
11306
|
-
);
|
|
11307
|
-
(_b2 = this.loadListener) == null ? void 0 : _b2.call(this, iframeEl);
|
|
11308
|
-
if (iframeEl.contentDocument && iframeEl.contentDocument.adoptedStyleSheets && iframeEl.contentDocument.adoptedStyleSheets.length > 0)
|
|
11309
|
-
this.stylesheetManager.adoptStyleSheets(
|
|
11310
|
-
iframeEl.contentDocument.adoptedStyleSheets,
|
|
11311
|
-
this.mirror.getId(iframeEl.contentDocument)
|
|
11312
|
-
);
|
|
11313
10987
|
}
|
|
11314
|
-
|
|
11315
|
-
|
|
11316
|
-
|
|
11317
|
-
|
|
11318
|
-
|
|
11319
|
-
|
|
11320
|
-
|
|
11321
|
-
|
|
11322
|
-
|
|
11323
|
-
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
if (transformedEvent)
|
|
11328
|
-
this.wrappedEmit(
|
|
11329
|
-
transformedEvent,
|
|
11330
|
-
crossOriginMessageEvent.data.isCheckout
|
|
11331
|
-
);
|
|
10988
|
+
const supportedNestedCSSRuleTypes = {};
|
|
10989
|
+
if (canMonkeyPatchNestedCSSRule("CSSGroupingRule")) {
|
|
10990
|
+
supportedNestedCSSRuleTypes.CSSGroupingRule = win.CSSGroupingRule;
|
|
10991
|
+
} else {
|
|
10992
|
+
if (canMonkeyPatchNestedCSSRule("CSSMediaRule")) {
|
|
10993
|
+
supportedNestedCSSRuleTypes.CSSMediaRule = win.CSSMediaRule;
|
|
10994
|
+
}
|
|
10995
|
+
if (canMonkeyPatchNestedCSSRule("CSSConditionRule")) {
|
|
10996
|
+
supportedNestedCSSRuleTypes.CSSConditionRule = win.CSSConditionRule;
|
|
10997
|
+
}
|
|
10998
|
+
if (canMonkeyPatchNestedCSSRule("CSSSupportsRule")) {
|
|
10999
|
+
supportedNestedCSSRuleTypes.CSSSupportsRule = win.CSSSupportsRule;
|
|
11000
|
+
}
|
|
11332
11001
|
}
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11339
|
-
|
|
11340
|
-
|
|
11341
|
-
|
|
11342
|
-
|
|
11343
|
-
|
|
11344
|
-
|
|
11345
|
-
|
|
11346
|
-
|
|
11347
|
-
|
|
11348
|
-
|
|
11349
|
-
|
|
11350
|
-
|
|
11351
|
-
|
|
11352
|
-
|
|
11353
|
-
|
|
11354
|
-
|
|
11355
|
-
|
|
11356
|
-
|
|
11357
|
-
|
|
11358
|
-
|
|
11002
|
+
const unmodifiedFunctions = {};
|
|
11003
|
+
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
11004
|
+
unmodifiedFunctions[typeKey] = {
|
|
11005
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
11006
|
+
insertRule: type.prototype.insertRule,
|
|
11007
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
11008
|
+
deleteRule: type.prototype.deleteRule
|
|
11009
|
+
};
|
|
11010
|
+
type.prototype.insertRule = new Proxy(
|
|
11011
|
+
unmodifiedFunctions[typeKey].insertRule,
|
|
11012
|
+
{
|
|
11013
|
+
apply: callbackWrapper(
|
|
11014
|
+
(target, thisArg, argumentsList) => {
|
|
11015
|
+
const [rule2, index2] = argumentsList;
|
|
11016
|
+
const { id, styleId } = getIdAndStyleId(
|
|
11017
|
+
thisArg.parentStyleSheet,
|
|
11018
|
+
mirror2,
|
|
11019
|
+
stylesheetManager.styleMirror
|
|
11020
|
+
);
|
|
11021
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
11022
|
+
styleSheetRuleCb({
|
|
11023
|
+
id,
|
|
11024
|
+
styleId,
|
|
11025
|
+
adds: [
|
|
11026
|
+
{
|
|
11027
|
+
rule: rule2,
|
|
11028
|
+
index: [
|
|
11029
|
+
...getNestedCSSRulePositions(thisArg),
|
|
11030
|
+
index2 || 0
|
|
11031
|
+
// defaults to 0
|
|
11032
|
+
]
|
|
11033
|
+
}
|
|
11034
|
+
]
|
|
11035
|
+
});
|
|
11036
|
+
}
|
|
11037
|
+
return target.apply(thisArg, argumentsList);
|
|
11038
|
+
}
|
|
11039
|
+
)
|
|
11040
|
+
}
|
|
11041
|
+
);
|
|
11042
|
+
type.prototype.deleteRule = new Proxy(
|
|
11043
|
+
unmodifiedFunctions[typeKey].deleteRule,
|
|
11044
|
+
{
|
|
11045
|
+
apply: callbackWrapper(
|
|
11046
|
+
(target, thisArg, argumentsList) => {
|
|
11047
|
+
const [index2] = argumentsList;
|
|
11048
|
+
const { id, styleId } = getIdAndStyleId(
|
|
11049
|
+
thisArg.parentStyleSheet,
|
|
11050
|
+
mirror2,
|
|
11051
|
+
stylesheetManager.styleMirror
|
|
11052
|
+
);
|
|
11053
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
11054
|
+
styleSheetRuleCb({
|
|
11055
|
+
id,
|
|
11056
|
+
styleId,
|
|
11057
|
+
removes: [
|
|
11058
|
+
{ index: [...getNestedCSSRulePositions(thisArg), index2] }
|
|
11059
|
+
]
|
|
11060
|
+
});
|
|
11061
|
+
}
|
|
11062
|
+
return target.apply(thisArg, argumentsList);
|
|
11359
11063
|
}
|
|
11360
|
-
|
|
11361
|
-
}
|
|
11362
|
-
case EventType.Meta:
|
|
11363
|
-
case EventType.Load:
|
|
11364
|
-
case EventType.DomContentLoaded: {
|
|
11365
|
-
return false;
|
|
11064
|
+
)
|
|
11366
11065
|
}
|
|
11367
|
-
|
|
11368
|
-
|
|
11066
|
+
);
|
|
11067
|
+
});
|
|
11068
|
+
return callbackWrapper(() => {
|
|
11069
|
+
win.CSSStyleSheet.prototype.insertRule = insertRule;
|
|
11070
|
+
win.CSSStyleSheet.prototype.deleteRule = deleteRule;
|
|
11071
|
+
replace && (win.CSSStyleSheet.prototype.replace = replace);
|
|
11072
|
+
replaceSync && (win.CSSStyleSheet.prototype.replaceSync = replaceSync);
|
|
11073
|
+
Object.entries(supportedNestedCSSRuleTypes).forEach(([typeKey, type]) => {
|
|
11074
|
+
type.prototype.insertRule = unmodifiedFunctions[typeKey].insertRule;
|
|
11075
|
+
type.prototype.deleteRule = unmodifiedFunctions[typeKey].deleteRule;
|
|
11076
|
+
});
|
|
11077
|
+
});
|
|
11078
|
+
}
|
|
11079
|
+
function initAdoptedStyleSheetObserver({
|
|
11080
|
+
mirror: mirror2,
|
|
11081
|
+
stylesheetManager
|
|
11082
|
+
}, host2) {
|
|
11083
|
+
var _a2, _b2, _c;
|
|
11084
|
+
let hostId = null;
|
|
11085
|
+
if (host2.nodeName === "#document") hostId = mirror2.getId(host2);
|
|
11086
|
+
else hostId = mirror2.getId(index$1.host(host2));
|
|
11087
|
+
const patchTarget = host2.nodeName === "#document" ? (_a2 = host2.defaultView) == null ? void 0 : _a2.Document : (_c = (_b2 = host2.ownerDocument) == null ? void 0 : _b2.defaultView) == null ? void 0 : _c.ShadowRoot;
|
|
11088
|
+
const originalPropertyDescriptor = (patchTarget == null ? void 0 : patchTarget.prototype) ? Object.getOwnPropertyDescriptor(
|
|
11089
|
+
patchTarget == null ? void 0 : patchTarget.prototype,
|
|
11090
|
+
"adoptedStyleSheets"
|
|
11091
|
+
) : void 0;
|
|
11092
|
+
if (hostId === null || hostId === -1 || !patchTarget || !originalPropertyDescriptor)
|
|
11093
|
+
return () => {
|
|
11094
|
+
};
|
|
11095
|
+
Object.defineProperty(host2, "adoptedStyleSheets", {
|
|
11096
|
+
configurable: originalPropertyDescriptor.configurable,
|
|
11097
|
+
enumerable: originalPropertyDescriptor.enumerable,
|
|
11098
|
+
get() {
|
|
11099
|
+
var _a3;
|
|
11100
|
+
return (_a3 = originalPropertyDescriptor.get) == null ? void 0 : _a3.call(this);
|
|
11101
|
+
},
|
|
11102
|
+
set(sheets) {
|
|
11103
|
+
var _a3;
|
|
11104
|
+
const result2 = (_a3 = originalPropertyDescriptor.set) == null ? void 0 : _a3.call(this, sheets);
|
|
11105
|
+
if (hostId !== null && hostId !== -1) {
|
|
11106
|
+
try {
|
|
11107
|
+
stylesheetManager.adoptStyleSheets(sheets, hostId);
|
|
11108
|
+
} catch (e2) {
|
|
11109
|
+
}
|
|
11369
11110
|
}
|
|
11370
|
-
|
|
11371
|
-
|
|
11372
|
-
|
|
11373
|
-
|
|
11374
|
-
|
|
11111
|
+
return result2;
|
|
11112
|
+
}
|
|
11113
|
+
});
|
|
11114
|
+
return callbackWrapper(() => {
|
|
11115
|
+
Object.defineProperty(host2, "adoptedStyleSheets", {
|
|
11116
|
+
configurable: originalPropertyDescriptor.configurable,
|
|
11117
|
+
enumerable: originalPropertyDescriptor.enumerable,
|
|
11118
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
11119
|
+
get: originalPropertyDescriptor.get,
|
|
11120
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
11121
|
+
set: originalPropertyDescriptor.set
|
|
11122
|
+
});
|
|
11123
|
+
});
|
|
11124
|
+
}
|
|
11125
|
+
function initStyleDeclarationObserver({
|
|
11126
|
+
styleDeclarationCb,
|
|
11127
|
+
mirror: mirror2,
|
|
11128
|
+
ignoreCSSAttributes,
|
|
11129
|
+
stylesheetManager
|
|
11130
|
+
}, { win }) {
|
|
11131
|
+
const setProperty = win.CSSStyleDeclaration.prototype.setProperty;
|
|
11132
|
+
win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {
|
|
11133
|
+
apply: callbackWrapper(
|
|
11134
|
+
(target, thisArg, argumentsList) => {
|
|
11135
|
+
var _a2;
|
|
11136
|
+
const [property, value, priority] = argumentsList;
|
|
11137
|
+
if (ignoreCSSAttributes.has(property)) {
|
|
11138
|
+
return setProperty.apply(thisArg, [property, value, priority]);
|
|
11139
|
+
}
|
|
11140
|
+
const { id, styleId } = getIdAndStyleId(
|
|
11141
|
+
(_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,
|
|
11142
|
+
mirror2,
|
|
11143
|
+
stylesheetManager.styleMirror
|
|
11375
11144
|
);
|
|
11376
|
-
|
|
11145
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
11146
|
+
styleDeclarationCb({
|
|
11147
|
+
id,
|
|
11148
|
+
styleId,
|
|
11149
|
+
set: {
|
|
11150
|
+
property,
|
|
11151
|
+
value,
|
|
11152
|
+
priority
|
|
11153
|
+
},
|
|
11154
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11155
|
+
index: getNestedCSSRulePositions(thisArg.parentRule)
|
|
11156
|
+
});
|
|
11157
|
+
}
|
|
11158
|
+
return target.apply(thisArg, argumentsList);
|
|
11377
11159
|
}
|
|
11378
|
-
|
|
11379
|
-
|
|
11380
|
-
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
|
|
11385
|
-
|
|
11386
|
-
|
|
11387
|
-
|
|
11388
|
-
|
|
11389
|
-
|
|
11390
|
-
|
|
11391
|
-
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
|
|
11395
|
-
|
|
11396
|
-
|
|
11397
|
-
|
|
11398
|
-
|
|
11399
|
-
|
|
11400
|
-
|
|
11401
|
-
|
|
11402
|
-
|
|
11403
|
-
|
|
11404
|
-
case IncrementalSource.MouseMove: {
|
|
11405
|
-
e2.data.positions.forEach((p) => {
|
|
11406
|
-
this.replaceIds(p, iframeEl, ["id"]);
|
|
11407
|
-
});
|
|
11408
|
-
return e2;
|
|
11409
|
-
}
|
|
11410
|
-
case IncrementalSource.ViewportResize: {
|
|
11411
|
-
return false;
|
|
11412
|
-
}
|
|
11413
|
-
case IncrementalSource.MediaInteraction:
|
|
11414
|
-
case IncrementalSource.MouseInteraction:
|
|
11415
|
-
case IncrementalSource.Scroll:
|
|
11416
|
-
case IncrementalSource.CanvasMutation:
|
|
11417
|
-
case IncrementalSource.Input: {
|
|
11418
|
-
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
11419
|
-
return e2;
|
|
11420
|
-
}
|
|
11421
|
-
case IncrementalSource.StyleSheetRule:
|
|
11422
|
-
case IncrementalSource.StyleDeclaration: {
|
|
11423
|
-
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
11424
|
-
this.replaceStyleIds(e2.data, iframeEl, ["styleId"]);
|
|
11425
|
-
return e2;
|
|
11426
|
-
}
|
|
11427
|
-
case IncrementalSource.Font: {
|
|
11428
|
-
return e2;
|
|
11429
|
-
}
|
|
11430
|
-
case IncrementalSource.Selection: {
|
|
11431
|
-
e2.data.ranges.forEach((range) => {
|
|
11432
|
-
this.replaceIds(range, iframeEl, ["start", "end"]);
|
|
11433
|
-
});
|
|
11434
|
-
return e2;
|
|
11435
|
-
}
|
|
11436
|
-
case IncrementalSource.AdoptedStyleSheet: {
|
|
11437
|
-
this.replaceIds(e2.data, iframeEl, ["id"]);
|
|
11438
|
-
this.replaceStyleIds(e2.data, iframeEl, ["styleIds"]);
|
|
11439
|
-
(_a2 = e2.data.styles) == null ? void 0 : _a2.forEach((style) => {
|
|
11440
|
-
this.replaceStyleIds(style, iframeEl, ["styleId"]);
|
|
11441
|
-
});
|
|
11442
|
-
return e2;
|
|
11443
|
-
}
|
|
11160
|
+
)
|
|
11161
|
+
});
|
|
11162
|
+
const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
|
|
11163
|
+
win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {
|
|
11164
|
+
apply: callbackWrapper(
|
|
11165
|
+
(target, thisArg, argumentsList) => {
|
|
11166
|
+
var _a2;
|
|
11167
|
+
const [property] = argumentsList;
|
|
11168
|
+
if (ignoreCSSAttributes.has(property)) {
|
|
11169
|
+
return removeProperty.apply(thisArg, [property]);
|
|
11170
|
+
}
|
|
11171
|
+
const { id, styleId } = getIdAndStyleId(
|
|
11172
|
+
(_a2 = thisArg.parentRule) == null ? void 0 : _a2.parentStyleSheet,
|
|
11173
|
+
mirror2,
|
|
11174
|
+
stylesheetManager.styleMirror
|
|
11175
|
+
);
|
|
11176
|
+
if (id && id !== -1 || styleId && styleId !== -1) {
|
|
11177
|
+
styleDeclarationCb({
|
|
11178
|
+
id,
|
|
11179
|
+
styleId,
|
|
11180
|
+
remove: {
|
|
11181
|
+
property
|
|
11182
|
+
},
|
|
11183
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
11184
|
+
index: getNestedCSSRulePositions(thisArg.parentRule)
|
|
11185
|
+
});
|
|
11444
11186
|
}
|
|
11187
|
+
return target.apply(thisArg, argumentsList);
|
|
11445
11188
|
}
|
|
11446
|
-
|
|
11447
|
-
|
|
11189
|
+
)
|
|
11190
|
+
});
|
|
11191
|
+
return callbackWrapper(() => {
|
|
11192
|
+
win.CSSStyleDeclaration.prototype.setProperty = setProperty;
|
|
11193
|
+
win.CSSStyleDeclaration.prototype.removeProperty = removeProperty;
|
|
11194
|
+
});
|
|
11195
|
+
}
|
|
11196
|
+
function initMediaInteractionObserver({
|
|
11197
|
+
mediaInteractionCb,
|
|
11198
|
+
blockClass,
|
|
11199
|
+
blockSelector,
|
|
11200
|
+
mirror: mirror2,
|
|
11201
|
+
sampling,
|
|
11202
|
+
doc
|
|
11203
|
+
}) {
|
|
11204
|
+
const handler = callbackWrapper(
|
|
11205
|
+
(type) => throttle(
|
|
11206
|
+
callbackWrapper((event) => {
|
|
11207
|
+
const target = getEventTarget(event);
|
|
11208
|
+
if (!target || isBlocked(target, blockClass, blockSelector, true)) {
|
|
11209
|
+
return;
|
|
11210
|
+
}
|
|
11211
|
+
const { currentTime, volume, muted, playbackRate, loop } = target;
|
|
11212
|
+
mediaInteractionCb({
|
|
11213
|
+
type,
|
|
11214
|
+
id: mirror2.getId(target),
|
|
11215
|
+
currentTime,
|
|
11216
|
+
volume,
|
|
11217
|
+
muted,
|
|
11218
|
+
playbackRate,
|
|
11219
|
+
loop
|
|
11220
|
+
});
|
|
11221
|
+
}),
|
|
11222
|
+
sampling.media || 500
|
|
11223
|
+
)
|
|
11224
|
+
);
|
|
11225
|
+
const handlers = [
|
|
11226
|
+
on("play", handler(MediaInteractions.Play), doc),
|
|
11227
|
+
on("pause", handler(MediaInteractions.Pause), doc),
|
|
11228
|
+
on("seeked", handler(MediaInteractions.Seeked), doc),
|
|
11229
|
+
on("volumechange", handler(MediaInteractions.VolumeChange), doc),
|
|
11230
|
+
on("ratechange", handler(MediaInteractions.RateChange), doc)
|
|
11231
|
+
];
|
|
11232
|
+
return callbackWrapper(() => {
|
|
11233
|
+
handlers.forEach((h) => h());
|
|
11234
|
+
});
|
|
11235
|
+
}
|
|
11236
|
+
function initFontObserver({ fontCb, doc }) {
|
|
11237
|
+
const win = doc.defaultView;
|
|
11238
|
+
if (!win) {
|
|
11239
|
+
return () => {
|
|
11240
|
+
};
|
|
11448
11241
|
}
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
|
|
11455
|
-
|
|
11242
|
+
const handlers = [];
|
|
11243
|
+
const fontMap = /* @__PURE__ */ new WeakMap();
|
|
11244
|
+
const originalFontFace = win.FontFace;
|
|
11245
|
+
win.FontFace = function FontFace2(family, source, descriptors) {
|
|
11246
|
+
const fontFace = new originalFontFace(family, source, descriptors);
|
|
11247
|
+
fontMap.set(fontFace, {
|
|
11248
|
+
family,
|
|
11249
|
+
buffer: typeof source !== "string",
|
|
11250
|
+
descriptors,
|
|
11251
|
+
fontSource: typeof source === "string" ? source : JSON.stringify(Array.from(new Uint8Array(source)))
|
|
11252
|
+
});
|
|
11253
|
+
return fontFace;
|
|
11254
|
+
};
|
|
11255
|
+
const restoreHandler = patch$1(
|
|
11256
|
+
doc.fonts,
|
|
11257
|
+
"add",
|
|
11258
|
+
function(original) {
|
|
11259
|
+
return function(fontFace) {
|
|
11260
|
+
setTimeout(
|
|
11261
|
+
callbackWrapper(() => {
|
|
11262
|
+
const p = fontMap.get(fontFace);
|
|
11263
|
+
if (p) {
|
|
11264
|
+
fontCb(p);
|
|
11265
|
+
fontMap.delete(fontFace);
|
|
11266
|
+
}
|
|
11267
|
+
}),
|
|
11268
|
+
0
|
|
11456
11269
|
);
|
|
11457
|
-
|
|
11458
|
-
|
|
11459
|
-
}
|
|
11270
|
+
return original.apply(this, [fontFace]);
|
|
11271
|
+
};
|
|
11460
11272
|
}
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
11464
|
-
|
|
11465
|
-
|
|
11466
|
-
|
|
11467
|
-
|
|
11468
|
-
}
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11273
|
+
);
|
|
11274
|
+
handlers.push(() => {
|
|
11275
|
+
win.FontFace = originalFontFace;
|
|
11276
|
+
});
|
|
11277
|
+
handlers.push(restoreHandler);
|
|
11278
|
+
return callbackWrapper(() => {
|
|
11279
|
+
handlers.forEach((h) => h());
|
|
11280
|
+
});
|
|
11281
|
+
}
|
|
11282
|
+
function initSelectionObserver(param) {
|
|
11283
|
+
const { doc, mirror: mirror2, blockClass, blockSelector, selectionCb } = param;
|
|
11284
|
+
let collapsed = true;
|
|
11285
|
+
const updateSelection = callbackWrapper(() => {
|
|
11286
|
+
const selection = doc.getSelection();
|
|
11287
|
+
if (!selection || collapsed && (selection == null ? void 0 : selection.isCollapsed)) return;
|
|
11288
|
+
collapsed = selection.isCollapsed || false;
|
|
11289
|
+
const ranges = [];
|
|
11290
|
+
const count = selection.rangeCount || 0;
|
|
11291
|
+
for (let i2 = 0; i2 < count; i2++) {
|
|
11292
|
+
const range = selection.getRangeAt(i2);
|
|
11293
|
+
const { startContainer, startOffset, endContainer, endOffset } = range;
|
|
11294
|
+
const blocked = isBlocked(startContainer, blockClass, blockSelector, true) || isBlocked(endContainer, blockClass, blockSelector, true);
|
|
11295
|
+
if (blocked) continue;
|
|
11296
|
+
ranges.push({
|
|
11297
|
+
start: mirror2.getId(startContainer),
|
|
11298
|
+
startOffset,
|
|
11299
|
+
end: mirror2.getId(endContainer),
|
|
11300
|
+
endOffset
|
|
11474
11301
|
});
|
|
11475
11302
|
}
|
|
11476
|
-
|
|
11477
|
-
|
|
11478
|
-
|
|
11479
|
-
|
|
11480
|
-
|
|
11481
|
-
|
|
11482
|
-
|
|
11303
|
+
selectionCb({ ranges });
|
|
11304
|
+
});
|
|
11305
|
+
updateSelection();
|
|
11306
|
+
return on("selectionchange", updateSelection);
|
|
11307
|
+
}
|
|
11308
|
+
function initCustomElementObserver({
|
|
11309
|
+
doc,
|
|
11310
|
+
customElementCb
|
|
11311
|
+
}) {
|
|
11312
|
+
const win = doc.defaultView;
|
|
11313
|
+
if (!win || !win.customElements) return () => {
|
|
11314
|
+
};
|
|
11315
|
+
const restoreHandler = patch$1(
|
|
11316
|
+
win.customElements,
|
|
11317
|
+
"define",
|
|
11318
|
+
function(original) {
|
|
11319
|
+
return function(name, constructor, options) {
|
|
11320
|
+
try {
|
|
11321
|
+
customElementCb({
|
|
11322
|
+
define: {
|
|
11323
|
+
name
|
|
11324
|
+
}
|
|
11325
|
+
});
|
|
11326
|
+
} catch (e2) {
|
|
11327
|
+
console.warn(`Custom element callback failed for ${name}`);
|
|
11328
|
+
}
|
|
11329
|
+
return original.apply(this, [name, constructor, options]);
|
|
11330
|
+
};
|
|
11483
11331
|
}
|
|
11484
|
-
|
|
11332
|
+
);
|
|
11333
|
+
return restoreHandler;
|
|
11485
11334
|
}
|
|
11486
|
-
|
|
11487
|
-
|
|
11488
|
-
|
|
11489
|
-
|
|
11490
|
-
|
|
11491
|
-
|
|
11492
|
-
|
|
11493
|
-
|
|
11494
|
-
|
|
11495
|
-
|
|
11496
|
-
|
|
11497
|
-
|
|
11498
|
-
|
|
11499
|
-
|
|
11500
|
-
|
|
11501
|
-
|
|
11502
|
-
|
|
11503
|
-
|
|
11504
|
-
|
|
11505
|
-
|
|
11506
|
-
|
|
11507
|
-
|
|
11508
|
-
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
|
|
11519
|
-
|
|
11520
|
-
|
|
11521
|
-
|
|
11522
|
-
|
|
11523
|
-
|
|
11524
|
-
|
|
11525
|
-
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
|
|
11529
|
-
|
|
11530
|
-
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
|
|
11535
|
-
|
|
11536
|
-
|
|
11537
|
-
|
|
11538
|
-
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
}
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
|
|
11552
|
-
|
|
11335
|
+
function mergeHooks(o2, hooks) {
|
|
11336
|
+
const {
|
|
11337
|
+
mutationCb,
|
|
11338
|
+
mousemoveCb,
|
|
11339
|
+
mouseInteractionCb,
|
|
11340
|
+
scrollCb,
|
|
11341
|
+
viewportResizeCb,
|
|
11342
|
+
inputCb,
|
|
11343
|
+
mediaInteractionCb,
|
|
11344
|
+
styleSheetRuleCb,
|
|
11345
|
+
styleDeclarationCb,
|
|
11346
|
+
canvasMutationCb,
|
|
11347
|
+
fontCb,
|
|
11348
|
+
selectionCb,
|
|
11349
|
+
customElementCb
|
|
11350
|
+
} = o2;
|
|
11351
|
+
o2.mutationCb = (...p) => {
|
|
11352
|
+
if (hooks.mutation) {
|
|
11353
|
+
hooks.mutation(...p);
|
|
11354
|
+
}
|
|
11355
|
+
mutationCb(...p);
|
|
11356
|
+
};
|
|
11357
|
+
o2.mousemoveCb = (...p) => {
|
|
11358
|
+
if (hooks.mousemove) {
|
|
11359
|
+
hooks.mousemove(...p);
|
|
11360
|
+
}
|
|
11361
|
+
mousemoveCb(...p);
|
|
11362
|
+
};
|
|
11363
|
+
o2.mouseInteractionCb = (...p) => {
|
|
11364
|
+
if (hooks.mouseInteraction) {
|
|
11365
|
+
hooks.mouseInteraction(...p);
|
|
11366
|
+
}
|
|
11367
|
+
mouseInteractionCb(...p);
|
|
11368
|
+
};
|
|
11369
|
+
o2.scrollCb = (...p) => {
|
|
11370
|
+
if (hooks.scroll) {
|
|
11371
|
+
hooks.scroll(...p);
|
|
11372
|
+
}
|
|
11373
|
+
scrollCb(...p);
|
|
11374
|
+
};
|
|
11375
|
+
o2.viewportResizeCb = (...p) => {
|
|
11376
|
+
if (hooks.viewportResize) {
|
|
11377
|
+
hooks.viewportResize(...p);
|
|
11378
|
+
}
|
|
11379
|
+
viewportResizeCb(...p);
|
|
11380
|
+
};
|
|
11381
|
+
o2.inputCb = (...p) => {
|
|
11382
|
+
if (hooks.input) {
|
|
11383
|
+
hooks.input(...p);
|
|
11384
|
+
}
|
|
11385
|
+
inputCb(...p);
|
|
11386
|
+
};
|
|
11387
|
+
o2.mediaInteractionCb = (...p) => {
|
|
11388
|
+
if (hooks.mediaInteaction) {
|
|
11389
|
+
hooks.mediaInteaction(...p);
|
|
11390
|
+
}
|
|
11391
|
+
mediaInteractionCb(...p);
|
|
11392
|
+
};
|
|
11393
|
+
o2.styleSheetRuleCb = (...p) => {
|
|
11394
|
+
if (hooks.styleSheetRule) {
|
|
11395
|
+
hooks.styleSheetRule(...p);
|
|
11396
|
+
}
|
|
11397
|
+
styleSheetRuleCb(...p);
|
|
11398
|
+
};
|
|
11399
|
+
o2.styleDeclarationCb = (...p) => {
|
|
11400
|
+
if (hooks.styleDeclaration) {
|
|
11401
|
+
hooks.styleDeclaration(...p);
|
|
11402
|
+
}
|
|
11403
|
+
styleDeclarationCb(...p);
|
|
11404
|
+
};
|
|
11405
|
+
o2.canvasMutationCb = (...p) => {
|
|
11406
|
+
if (hooks.canvasMutation) {
|
|
11407
|
+
hooks.canvasMutation(...p);
|
|
11408
|
+
}
|
|
11409
|
+
canvasMutationCb(...p);
|
|
11410
|
+
};
|
|
11411
|
+
o2.fontCb = (...p) => {
|
|
11412
|
+
if (hooks.font) {
|
|
11413
|
+
hooks.font(...p);
|
|
11414
|
+
}
|
|
11415
|
+
fontCb(...p);
|
|
11416
|
+
};
|
|
11417
|
+
o2.selectionCb = (...p) => {
|
|
11418
|
+
if (hooks.selection) {
|
|
11419
|
+
hooks.selection(...p);
|
|
11420
|
+
}
|
|
11421
|
+
selectionCb(...p);
|
|
11422
|
+
};
|
|
11423
|
+
o2.customElementCb = (...c2) => {
|
|
11424
|
+
if (hooks.customElement) {
|
|
11425
|
+
hooks.customElement(...c2);
|
|
11426
|
+
}
|
|
11427
|
+
customElementCb(...c2);
|
|
11428
|
+
};
|
|
11429
|
+
}
|
|
11430
|
+
function initObservers(o2, hooks = {}) {
|
|
11431
|
+
const currentWindow = o2.doc.defaultView;
|
|
11432
|
+
if (!currentWindow) {
|
|
11433
|
+
return () => {
|
|
11434
|
+
};
|
|
11553
11435
|
}
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11557
|
-
|
|
11558
|
-
const manager = this;
|
|
11559
|
-
this.restoreHandlers.push(
|
|
11560
|
-
patch(
|
|
11561
|
-
element.prototype,
|
|
11562
|
-
"attachShadow",
|
|
11563
|
-
function(original) {
|
|
11564
|
-
return function(option) {
|
|
11565
|
-
const sRoot = original.call(this, option);
|
|
11566
|
-
const shadowRootEl = index.shadowRoot(this);
|
|
11567
|
-
if (shadowRootEl && inDom(this))
|
|
11568
|
-
manager.addShadowRoot(shadowRootEl, doc);
|
|
11569
|
-
return sRoot;
|
|
11570
|
-
};
|
|
11571
|
-
}
|
|
11572
|
-
)
|
|
11573
|
-
);
|
|
11436
|
+
mergeHooks(o2, hooks);
|
|
11437
|
+
let mutationObserver;
|
|
11438
|
+
if (o2.recordDOM) {
|
|
11439
|
+
mutationObserver = initMutationObserver(o2, o2.doc);
|
|
11574
11440
|
}
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11441
|
+
const mousemoveHandler = initMoveObserver(o2);
|
|
11442
|
+
const mouseInteractionHandler = initMouseInteractionObserver(o2);
|
|
11443
|
+
const scrollHandler = initScrollObserver(o2);
|
|
11444
|
+
const viewportResizeHandler = initViewportResizeObserver(o2, {
|
|
11445
|
+
win: currentWindow
|
|
11446
|
+
});
|
|
11447
|
+
const inputHandler = initInputObserver(o2);
|
|
11448
|
+
const mediaInteractionHandler = initMediaInteractionObserver(o2);
|
|
11449
|
+
let styleSheetObserver = () => {
|
|
11450
|
+
};
|
|
11451
|
+
let adoptedStyleSheetObserver = () => {
|
|
11452
|
+
};
|
|
11453
|
+
let styleDeclarationObserver = () => {
|
|
11454
|
+
};
|
|
11455
|
+
let fontObserver = () => {
|
|
11456
|
+
};
|
|
11457
|
+
if (o2.recordDOM) {
|
|
11458
|
+
styleSheetObserver = initStyleSheetObserver(o2, { win: currentWindow });
|
|
11459
|
+
adoptedStyleSheetObserver = initAdoptedStyleSheetObserver(o2, o2.doc);
|
|
11460
|
+
styleDeclarationObserver = initStyleDeclarationObserver(o2, {
|
|
11461
|
+
win: currentWindow
|
|
11581
11462
|
});
|
|
11582
|
-
|
|
11583
|
-
|
|
11463
|
+
if (o2.collectFonts) {
|
|
11464
|
+
fontObserver = initFontObserver(o2);
|
|
11465
|
+
}
|
|
11584
11466
|
}
|
|
11467
|
+
const selectionObserver = initSelectionObserver(o2);
|
|
11468
|
+
const customElementObserver = initCustomElementObserver(o2);
|
|
11469
|
+
const pluginHandlers = [];
|
|
11470
|
+
for (const plugin3 of o2.plugins) {
|
|
11471
|
+
pluginHandlers.push(
|
|
11472
|
+
plugin3.observer(plugin3.callback, currentWindow, plugin3.options)
|
|
11473
|
+
);
|
|
11474
|
+
}
|
|
11475
|
+
return callbackWrapper(() => {
|
|
11476
|
+
mutationBuffers.forEach((b) => b.reset());
|
|
11477
|
+
mutationObserver == null ? void 0 : mutationObserver.disconnect();
|
|
11478
|
+
mousemoveHandler();
|
|
11479
|
+
mouseInteractionHandler();
|
|
11480
|
+
scrollHandler();
|
|
11481
|
+
viewportResizeHandler();
|
|
11482
|
+
inputHandler();
|
|
11483
|
+
mediaInteractionHandler();
|
|
11484
|
+
styleSheetObserver();
|
|
11485
|
+
adoptedStyleSheetObserver();
|
|
11486
|
+
styleDeclarationObserver();
|
|
11487
|
+
fontObserver();
|
|
11488
|
+
selectionObserver();
|
|
11489
|
+
customElementObserver();
|
|
11490
|
+
pluginHandlers.forEach((h) => h());
|
|
11491
|
+
});
|
|
11492
|
+
}
|
|
11493
|
+
function hasNestedCSSRule(prop) {
|
|
11494
|
+
return typeof window[prop] !== "undefined";
|
|
11495
|
+
}
|
|
11496
|
+
function canMonkeyPatchNestedCSSRule(prop) {
|
|
11497
|
+
return Boolean(
|
|
11498
|
+
typeof window[prop] !== "undefined" && // Note: Generally, this check _shouldn't_ be necessary
|
|
11499
|
+
// However, in some scenarios (e.g. jsdom) this can sometimes fail, so we check for it here
|
|
11500
|
+
window[prop].prototype && "insertRule" in window[prop].prototype && "deleteRule" in window[prop].prototype
|
|
11501
|
+
);
|
|
11585
11502
|
}
|
|
11586
11503
|
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
11587
11504
|
var lookup = typeof Uint8Array === "undefined" ? [] : new Uint8Array(256);
|
|
@@ -11727,7 +11644,7 @@ function initCanvas2DMutationObserver(cb, win, blockClass, blockSelector) {
|
|
|
11727
11644
|
if (typeof win.CanvasRenderingContext2D.prototype[prop] !== "function") {
|
|
11728
11645
|
continue;
|
|
11729
11646
|
}
|
|
11730
|
-
const restoreHandler = patch(
|
|
11647
|
+
const restoreHandler = patch$1(
|
|
11731
11648
|
win.CanvasRenderingContext2D.prototype,
|
|
11732
11649
|
prop,
|
|
11733
11650
|
function(original) {
|
|
@@ -11775,7 +11692,7 @@ function getNormalizedContextName(contextType) {
|
|
|
11775
11692
|
function initCanvasContextObserver(win, blockClass, blockSelector, setPreserveDrawingBufferToTrue) {
|
|
11776
11693
|
const handlers = [];
|
|
11777
11694
|
try {
|
|
11778
|
-
const restoreHandler = patch(
|
|
11695
|
+
const restoreHandler = patch$1(
|
|
11779
11696
|
win.HTMLCanvasElement.prototype,
|
|
11780
11697
|
"getContext",
|
|
11781
11698
|
function(original) {
|
|
@@ -11827,7 +11744,7 @@ function patchGLPrototype(prototype, type, cb, blockClass, blockSelector, win) {
|
|
|
11827
11744
|
if (typeof prototype[prop] !== "function") {
|
|
11828
11745
|
continue;
|
|
11829
11746
|
}
|
|
11830
|
-
const restoreHandler = patch(
|
|
11747
|
+
const restoreHandler = patch$1(
|
|
11831
11748
|
prototype,
|
|
11832
11749
|
prop,
|
|
11833
11750
|
function(original) {
|
|
@@ -12124,6 +12041,128 @@ class CanvasManager {
|
|
|
12124
12041
|
this.pendingCanvasMutations.delete(canvas);
|
|
12125
12042
|
}
|
|
12126
12043
|
}
|
|
12044
|
+
class ProcessedNodeManager {
|
|
12045
|
+
constructor() {
|
|
12046
|
+
__publicField(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
12047
|
+
__publicField(this, "active", false);
|
|
12048
|
+
}
|
|
12049
|
+
inOtherBuffer(node2, thisBuffer) {
|
|
12050
|
+
const buffers = this.nodeMap.get(node2);
|
|
12051
|
+
return buffers && Array.from(buffers).some((buffer) => buffer !== thisBuffer);
|
|
12052
|
+
}
|
|
12053
|
+
add(node2, buffer) {
|
|
12054
|
+
if (!this.active) {
|
|
12055
|
+
this.active = true;
|
|
12056
|
+
requestAnimationFrame(() => {
|
|
12057
|
+
this.nodeMap = /* @__PURE__ */ new WeakMap();
|
|
12058
|
+
this.active = false;
|
|
12059
|
+
});
|
|
12060
|
+
}
|
|
12061
|
+
this.nodeMap.set(node2, (this.nodeMap.get(node2) || /* @__PURE__ */ new Set()).add(buffer));
|
|
12062
|
+
}
|
|
12063
|
+
destroy() {
|
|
12064
|
+
}
|
|
12065
|
+
}
|
|
12066
|
+
class ShadowDomManager {
|
|
12067
|
+
constructor(options) {
|
|
12068
|
+
__publicField(this, "shadowDoms", /* @__PURE__ */ new WeakSet());
|
|
12069
|
+
__publicField(this, "mutationCb");
|
|
12070
|
+
__publicField(this, "scrollCb");
|
|
12071
|
+
__publicField(this, "bypassOptions");
|
|
12072
|
+
__publicField(this, "mirror");
|
|
12073
|
+
__publicField(this, "restoreHandlers", []);
|
|
12074
|
+
this.mutationCb = options.mutationCb;
|
|
12075
|
+
this.scrollCb = options.scrollCb;
|
|
12076
|
+
this.bypassOptions = options.bypassOptions;
|
|
12077
|
+
this.mirror = options.mirror;
|
|
12078
|
+
this.init();
|
|
12079
|
+
}
|
|
12080
|
+
init() {
|
|
12081
|
+
this.reset();
|
|
12082
|
+
this.patchAttachShadow(Element, document);
|
|
12083
|
+
}
|
|
12084
|
+
addShadowRoot(shadowRoot2, doc) {
|
|
12085
|
+
if (!isNativeShadowDom(shadowRoot2)) return;
|
|
12086
|
+
if (this.shadowDoms.has(shadowRoot2)) return;
|
|
12087
|
+
this.shadowDoms.add(shadowRoot2);
|
|
12088
|
+
const observer = initMutationObserver(
|
|
12089
|
+
__spreadProps(__spreadValues({}, this.bypassOptions), {
|
|
12090
|
+
doc,
|
|
12091
|
+
mutationCb: this.mutationCb,
|
|
12092
|
+
mirror: this.mirror,
|
|
12093
|
+
shadowDomManager: this
|
|
12094
|
+
}),
|
|
12095
|
+
shadowRoot2
|
|
12096
|
+
);
|
|
12097
|
+
this.restoreHandlers.push(() => observer.disconnect());
|
|
12098
|
+
this.restoreHandlers.push(
|
|
12099
|
+
initScrollObserver(__spreadProps(__spreadValues({}, this.bypassOptions), {
|
|
12100
|
+
scrollCb: this.scrollCb,
|
|
12101
|
+
// https://gist.github.com/praveenpuglia/0832da687ed5a5d7a0907046c9ef1813
|
|
12102
|
+
// scroll is not allowed to pass the boundary, so we need to listen the shadow document
|
|
12103
|
+
doc: shadowRoot2,
|
|
12104
|
+
mirror: this.mirror
|
|
12105
|
+
}))
|
|
12106
|
+
);
|
|
12107
|
+
setTimeout(() => {
|
|
12108
|
+
if (shadowRoot2.adoptedStyleSheets && shadowRoot2.adoptedStyleSheets.length > 0)
|
|
12109
|
+
this.bypassOptions.stylesheetManager.adoptStyleSheets(
|
|
12110
|
+
shadowRoot2.adoptedStyleSheets,
|
|
12111
|
+
this.mirror.getId(index$1.host(shadowRoot2))
|
|
12112
|
+
);
|
|
12113
|
+
this.restoreHandlers.push(
|
|
12114
|
+
initAdoptedStyleSheetObserver(
|
|
12115
|
+
{
|
|
12116
|
+
mirror: this.mirror,
|
|
12117
|
+
stylesheetManager: this.bypassOptions.stylesheetManager
|
|
12118
|
+
},
|
|
12119
|
+
shadowRoot2
|
|
12120
|
+
)
|
|
12121
|
+
);
|
|
12122
|
+
}, 0);
|
|
12123
|
+
}
|
|
12124
|
+
/**
|
|
12125
|
+
* Monkey patch 'attachShadow' of an IFrameElement to observe newly added shadow doms.
|
|
12126
|
+
*/
|
|
12127
|
+
observeAttachShadow(iframeElement) {
|
|
12128
|
+
if (!iframeElement.contentWindow || !iframeElement.contentDocument) return;
|
|
12129
|
+
this.patchAttachShadow(
|
|
12130
|
+
iframeElement.contentWindow.Element,
|
|
12131
|
+
iframeElement.contentDocument
|
|
12132
|
+
);
|
|
12133
|
+
}
|
|
12134
|
+
/**
|
|
12135
|
+
* Patch 'attachShadow' to observe newly added shadow doms.
|
|
12136
|
+
*/
|
|
12137
|
+
patchAttachShadow(element, doc) {
|
|
12138
|
+
const manager = this;
|
|
12139
|
+
this.restoreHandlers.push(
|
|
12140
|
+
patch$1(
|
|
12141
|
+
element.prototype,
|
|
12142
|
+
"attachShadow",
|
|
12143
|
+
function(original) {
|
|
12144
|
+
return function(option) {
|
|
12145
|
+
const sRoot = original.call(this, option);
|
|
12146
|
+
const shadowRootEl = index$1.shadowRoot(this);
|
|
12147
|
+
if (shadowRootEl && inDom(this))
|
|
12148
|
+
manager.addShadowRoot(shadowRootEl, doc);
|
|
12149
|
+
return sRoot;
|
|
12150
|
+
};
|
|
12151
|
+
}
|
|
12152
|
+
)
|
|
12153
|
+
);
|
|
12154
|
+
}
|
|
12155
|
+
reset() {
|
|
12156
|
+
this.restoreHandlers.forEach((handler) => {
|
|
12157
|
+
try {
|
|
12158
|
+
handler();
|
|
12159
|
+
} catch (e2) {
|
|
12160
|
+
}
|
|
12161
|
+
});
|
|
12162
|
+
this.restoreHandlers = [];
|
|
12163
|
+
this.shadowDoms = /* @__PURE__ */ new WeakSet();
|
|
12164
|
+
}
|
|
12165
|
+
}
|
|
12127
12166
|
class StylesheetManager {
|
|
12128
12167
|
constructor(options) {
|
|
12129
12168
|
__publicField(this, "trackedLinkElements", /* @__PURE__ */ new WeakSet());
|
|
@@ -12185,28 +12224,6 @@ class StylesheetManager {
|
|
|
12185
12224
|
trackStylesheetInLinkElement(_linkEl) {
|
|
12186
12225
|
}
|
|
12187
12226
|
}
|
|
12188
|
-
class ProcessedNodeManager {
|
|
12189
|
-
constructor() {
|
|
12190
|
-
__publicField(this, "nodeMap", /* @__PURE__ */ new WeakMap());
|
|
12191
|
-
__publicField(this, "active", false);
|
|
12192
|
-
}
|
|
12193
|
-
inOtherBuffer(node2, thisBuffer) {
|
|
12194
|
-
const buffers = this.nodeMap.get(node2);
|
|
12195
|
-
return buffers && Array.from(buffers).some((buffer) => buffer !== thisBuffer);
|
|
12196
|
-
}
|
|
12197
|
-
add(node2, buffer) {
|
|
12198
|
-
if (!this.active) {
|
|
12199
|
-
this.active = true;
|
|
12200
|
-
requestAnimationFrame(() => {
|
|
12201
|
-
this.nodeMap = /* @__PURE__ */ new WeakMap();
|
|
12202
|
-
this.active = false;
|
|
12203
|
-
});
|
|
12204
|
-
}
|
|
12205
|
-
this.nodeMap.set(node2, (this.nodeMap.get(node2) || /* @__PURE__ */ new Set()).add(buffer));
|
|
12206
|
-
}
|
|
12207
|
-
destroy() {
|
|
12208
|
-
}
|
|
12209
|
-
}
|
|
12210
12227
|
let wrappedEmit;
|
|
12211
12228
|
let takeFullSnapshot$1;
|
|
12212
12229
|
let canvasManager;
|
|
@@ -12482,7 +12499,7 @@ function record(options = {}) {
|
|
|
12482
12499
|
stylesheetManager.trackLinkElement(n2);
|
|
12483
12500
|
}
|
|
12484
12501
|
if (hasShadowRoot(n2)) {
|
|
12485
|
-
shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
|
|
12502
|
+
shadowDomManager.addShadowRoot(index$1.shadowRoot(n2), document);
|
|
12486
12503
|
}
|
|
12487
12504
|
},
|
|
12488
12505
|
onIframeLoad: (iframe, childSn) => {
|
|
@@ -12700,7 +12717,6 @@ record.takeFullSnapshot = (isCheckout) => {
|
|
|
12700
12717
|
}
|
|
12701
12718
|
takeFullSnapshot$1(isCheckout);
|
|
12702
12719
|
};
|
|
12703
|
-
stormSnapshotManager.bindFullSnapshotTaker(takeFullSnapshot$1);
|
|
12704
12720
|
record.mirror = mirror;
|
|
12705
12721
|
var n;
|
|
12706
12722
|
!function(t2) {
|