@posthog/rrweb-snapshot 0.0.53 → 0.0.54
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/css.d.cts +5 -0
- package/dist/css.d.ts +5 -0
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/rebuild.d.cts +23 -0
- package/dist/rebuild.d.ts +23 -0
- package/dist/record.cjs +1013 -14
- package/dist/record.cjs.map +1 -1
- package/dist/record.d.cts +5 -273
- package/dist/record.d.ts +5 -273
- package/dist/record.js +1029 -29
- package/dist/record.js.map +1 -1
- package/dist/record.umd.cjs +967 -985
- package/dist/record.umd.cjs.map +3 -3
- package/dist/record.umd.min.cjs +1 -1
- package/dist/record.umd.min.cjs.map +4 -4
- package/dist/replay.cjs +1 -1
- package/dist/replay.d.cts +5 -219
- package/dist/replay.d.ts +5 -219
- package/dist/replay.js +2 -2
- package/dist/replay.umd.cjs +13 -10
- package/dist/replay.umd.cjs.map +2 -2
- package/dist/replay.umd.min.cjs +19 -19
- package/dist/replay.umd.min.cjs.map +2 -2
- package/dist/rrweb-snapshot.cjs +2 -2
- package/dist/rrweb-snapshot.d.cts +1 -299
- package/dist/rrweb-snapshot.d.ts +1 -299
- package/dist/rrweb-snapshot.js +26 -26
- package/dist/rrweb-snapshot.umd.cjs +41 -16
- package/dist/rrweb-snapshot.umd.cjs.map +2 -2
- package/dist/rrweb-snapshot.umd.min.cjs +11 -11
- package/dist/rrweb-snapshot.umd.min.cjs.map +2 -2
- package/dist/snapshot.d.cts +71 -0
- package/dist/snapshot.d.ts +71 -0
- package/dist/{types-B7TTv7Jc.cjs → types-BjupQhwp.cjs} +10 -7
- package/dist/types-BjupQhwp.cjs.map +1 -0
- package/dist/{types-B7TTv7Jc.umd.cjs → types-BjupQhwp.umd.cjs} +11 -8
- package/dist/types-BjupQhwp.umd.cjs.map +7 -0
- package/dist/types-BjupQhwp.umd.min.cjs +20 -0
- package/dist/types-BjupQhwp.umd.min.cjs.map +7 -0
- package/dist/{types-OLXvwyjP.js → types-D1TQIdgp.js} +10 -7
- package/dist/types-D1TQIdgp.js.map +1 -0
- package/dist/types.d.cts +103 -0
- package/dist/types.d.ts +103 -0
- package/dist/utils.d.cts +51 -0
- package/dist/utils.d.ts +51 -0
- package/package.json +3 -3
- package/dist/record-BUfdSR_C.cjs +0 -1015
- package/dist/record-BUfdSR_C.cjs.map +0 -1
- package/dist/record-BUfdSR_C.umd.cjs +0 -1590
- package/dist/record-BUfdSR_C.umd.cjs.map +0 -7
- package/dist/record-BUfdSR_C.umd.min.cjs +0 -20
- package/dist/record-BUfdSR_C.umd.min.cjs.map +0 -7
- package/dist/record-CbT7EKn4.js +0 -1016
- package/dist/record-CbT7EKn4.js.map +0 -1
- package/dist/types-B7TTv7Jc.cjs.map +0 -1
- package/dist/types-B7TTv7Jc.umd.cjs.map +0 -7
- package/dist/types-B7TTv7Jc.umd.min.cjs +0 -20
- package/dist/types-B7TTv7Jc.umd.min.cjs.map +0 -7
- package/dist/types-OLXvwyjP.js.map +0 -1
package/dist/record.umd.cjs
CHANGED
|
@@ -5,9 +5,9 @@ var __commonJS = (cb, mod) => function __require() {
|
|
|
5
5
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
// dist/types-
|
|
9
|
-
var
|
|
10
|
-
"dist/types-
|
|
8
|
+
// dist/types-BjupQhwp.cjs
|
|
9
|
+
var require_types_BjupQhwp = __commonJS({
|
|
10
|
+
"dist/types-BjupQhwp.cjs"(exports2) {
|
|
11
11
|
"use strict";
|
|
12
12
|
var __defProp = Object.defineProperty;
|
|
13
13
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -24,13 +24,13 @@ var require_types_B7TTv7Jc = __commonJS({
|
|
|
24
24
|
var testableAccessors = {
|
|
25
25
|
Node: ["childNodes", "parentNode", "parentElement", "textContent"],
|
|
26
26
|
ShadowRoot: ["host", "styleSheets"],
|
|
27
|
-
Element: ["shadowRoot"
|
|
27
|
+
Element: ["shadowRoot"],
|
|
28
28
|
MutationObserver: []
|
|
29
29
|
};
|
|
30
30
|
var testableMethods = {
|
|
31
31
|
Node: ["contains", "getRootNode"],
|
|
32
32
|
ShadowRoot: ["getSelection"],
|
|
33
|
-
Element: [],
|
|
33
|
+
Element: ["querySelector", "querySelectorAll"],
|
|
34
34
|
MutationObserver: ["constructor"]
|
|
35
35
|
};
|
|
36
36
|
var untaintedBasePrototype = {};
|
|
@@ -74,17 +74,20 @@ var require_types_B7TTv7Jc = __commonJS({
|
|
|
74
74
|
untaintedBasePrototype[key] = candidate.prototype;
|
|
75
75
|
return candidate.prototype;
|
|
76
76
|
}
|
|
77
|
+
const iframeEl = document.createElement("iframe");
|
|
77
78
|
try {
|
|
78
|
-
const iframeEl = document.createElement("iframe");
|
|
79
79
|
document.body.appendChild(iframeEl);
|
|
80
80
|
const win = iframeEl.contentWindow;
|
|
81
81
|
if (!win) return candidate.prototype;
|
|
82
82
|
const untaintedObject = win[key].prototype;
|
|
83
|
-
document.body.removeChild(iframeEl);
|
|
84
83
|
if (!untaintedObject) return defaultPrototype;
|
|
85
84
|
return untaintedBasePrototype[key] = untaintedObject;
|
|
86
85
|
} catch (e) {
|
|
87
86
|
return defaultPrototype;
|
|
87
|
+
} finally {
|
|
88
|
+
if (iframeEl.parentNode) {
|
|
89
|
+
document.body.removeChild(iframeEl);
|
|
90
|
+
}
|
|
88
91
|
}
|
|
89
92
|
}
|
|
90
93
|
var untaintedAccessorCache = {};
|
|
@@ -147,10 +150,10 @@ var require_types_B7TTv7Jc = __commonJS({
|
|
|
147
150
|
return getUntaintedAccessor("Element", n, "shadowRoot");
|
|
148
151
|
}
|
|
149
152
|
function querySelector(n, selectors) {
|
|
150
|
-
return
|
|
153
|
+
return getUntaintedMethod("Element", n, "querySelector")(selectors);
|
|
151
154
|
}
|
|
152
155
|
function querySelectorAll(n, selectors) {
|
|
153
|
-
return
|
|
156
|
+
return getUntaintedMethod("Element", n, "querySelectorAll")(selectors);
|
|
154
157
|
}
|
|
155
158
|
function mutationObserverCtor() {
|
|
156
159
|
return getUntaintedPrototype("MutationObserver").constructor;
|
|
@@ -556,1042 +559,1007 @@ var require_types_B7TTv7Jc = __commonJS({
|
|
|
556
559
|
}
|
|
557
560
|
});
|
|
558
561
|
|
|
559
|
-
// dist/record
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
562
|
+
// dist/record.cjs
|
|
563
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
564
|
+
var types = require_types_BjupQhwp();
|
|
565
|
+
var _id = 1;
|
|
566
|
+
var tagNameRegex = new RegExp("[^a-z0-9-_:]");
|
|
567
|
+
var IGNORED_NODE = -2;
|
|
568
|
+
function genId() {
|
|
569
|
+
return _id++;
|
|
570
|
+
}
|
|
571
|
+
function getValidTagName(element) {
|
|
572
|
+
if (element instanceof HTMLFormElement) {
|
|
573
|
+
return "form";
|
|
574
|
+
}
|
|
575
|
+
const processedTagName = types.toLowerCase(element.tagName);
|
|
576
|
+
if (tagNameRegex.test(processedTagName)) {
|
|
577
|
+
return "div";
|
|
578
|
+
}
|
|
579
|
+
return processedTagName;
|
|
580
|
+
}
|
|
581
|
+
var canvasService;
|
|
582
|
+
var canvasCtx;
|
|
583
|
+
var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
|
|
584
|
+
var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
|
|
585
|
+
function getAbsoluteSrcsetString(doc, attributeValue) {
|
|
586
|
+
if (attributeValue.trim() === "") {
|
|
587
|
+
return attributeValue;
|
|
588
|
+
}
|
|
589
|
+
let pos = 0;
|
|
590
|
+
function collectCharacters(regEx) {
|
|
591
|
+
let chars;
|
|
592
|
+
const match = regEx.exec(attributeValue.substring(pos));
|
|
593
|
+
if (match) {
|
|
594
|
+
chars = match[0];
|
|
595
|
+
pos += chars.length;
|
|
596
|
+
return chars;
|
|
597
|
+
}
|
|
598
|
+
return "";
|
|
599
|
+
}
|
|
600
|
+
const output = [];
|
|
601
|
+
while (true) {
|
|
602
|
+
collectCharacters(SRCSET_COMMAS_OR_SPACES);
|
|
603
|
+
if (pos >= attributeValue.length) {
|
|
604
|
+
break;
|
|
605
|
+
}
|
|
606
|
+
let url = collectCharacters(SRCSET_NOT_SPACES);
|
|
607
|
+
if (url.slice(-1) === ",") {
|
|
608
|
+
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
609
|
+
output.push(url);
|
|
610
|
+
} else {
|
|
611
|
+
let descriptorsStr = "";
|
|
612
|
+
url = absoluteToDoc(doc, url);
|
|
613
|
+
let inParens = false;
|
|
600
614
|
while (true) {
|
|
601
|
-
|
|
602
|
-
if (
|
|
615
|
+
const c = attributeValue.charAt(pos);
|
|
616
|
+
if (c === "") {
|
|
617
|
+
output.push((url + descriptorsStr).trim());
|
|
603
618
|
break;
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
if (url.slice(-1) === ",") {
|
|
607
|
-
url = absoluteToDoc(doc, url.substring(0, url.length - 1));
|
|
608
|
-
output.push(url);
|
|
609
|
-
} else {
|
|
610
|
-
let descriptorsStr = "";
|
|
611
|
-
url = absoluteToDoc(doc, url);
|
|
612
|
-
let inParens = false;
|
|
613
|
-
while (true) {
|
|
614
|
-
const c = attributeValue.charAt(pos);
|
|
615
|
-
if (c === "") {
|
|
616
|
-
output.push((url + descriptorsStr).trim());
|
|
617
|
-
break;
|
|
618
|
-
} else if (!inParens) {
|
|
619
|
-
if (c === ",") {
|
|
620
|
-
pos += 1;
|
|
621
|
-
output.push((url + descriptorsStr).trim());
|
|
622
|
-
break;
|
|
623
|
-
} else if (c === "(") {
|
|
624
|
-
inParens = true;
|
|
625
|
-
}
|
|
626
|
-
} else {
|
|
627
|
-
if (c === ")") {
|
|
628
|
-
inParens = false;
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
descriptorsStr += c;
|
|
619
|
+
} else if (!inParens) {
|
|
620
|
+
if (c === ",") {
|
|
632
621
|
pos += 1;
|
|
622
|
+
output.push((url + descriptorsStr).trim());
|
|
623
|
+
break;
|
|
624
|
+
} else if (c === "(") {
|
|
625
|
+
inParens = true;
|
|
626
|
+
}
|
|
627
|
+
} else {
|
|
628
|
+
if (c === ")") {
|
|
629
|
+
inParens = false;
|
|
633
630
|
}
|
|
634
631
|
}
|
|
632
|
+
descriptorsStr += c;
|
|
633
|
+
pos += 1;
|
|
635
634
|
}
|
|
636
|
-
return output.join(", ");
|
|
637
|
-
}
|
|
638
|
-
var cachedDocument = /* @__PURE__ */ new WeakMap();
|
|
639
|
-
function absoluteToDoc(doc, attributeValue) {
|
|
640
|
-
if (!attributeValue || attributeValue.trim() === "") {
|
|
641
|
-
return attributeValue;
|
|
642
|
-
}
|
|
643
|
-
return getHref(doc, attributeValue);
|
|
644
|
-
}
|
|
645
|
-
function isSVGElement(el) {
|
|
646
|
-
return Boolean(el.tagName === "svg" || el.ownerSVGElement);
|
|
647
635
|
}
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
636
|
+
}
|
|
637
|
+
return output.join(", ");
|
|
638
|
+
}
|
|
639
|
+
var cachedDocument = /* @__PURE__ */ new WeakMap();
|
|
640
|
+
function absoluteToDoc(doc, attributeValue) {
|
|
641
|
+
if (!attributeValue || attributeValue.trim() === "") {
|
|
642
|
+
return attributeValue;
|
|
643
|
+
}
|
|
644
|
+
return getHref(doc, attributeValue);
|
|
645
|
+
}
|
|
646
|
+
function isSVGElement(el) {
|
|
647
|
+
return Boolean(el.tagName === "svg" || el.ownerSVGElement);
|
|
648
|
+
}
|
|
649
|
+
function getHref(doc, customHref) {
|
|
650
|
+
let a = cachedDocument.get(doc);
|
|
651
|
+
if (!a) {
|
|
652
|
+
a = doc.createElement("a");
|
|
653
|
+
cachedDocument.set(doc, a);
|
|
654
|
+
}
|
|
655
|
+
if (!customHref) {
|
|
656
|
+
customHref = "";
|
|
657
|
+
} else if (customHref.startsWith("blob:") || customHref.startsWith("data:")) {
|
|
658
|
+
return customHref;
|
|
659
|
+
}
|
|
660
|
+
a.setAttribute("href", customHref);
|
|
661
|
+
return a.href;
|
|
662
|
+
}
|
|
663
|
+
function transformAttribute(doc, tagName, name, value, element, dataURLOptions) {
|
|
664
|
+
if (!value) {
|
|
665
|
+
return value;
|
|
666
|
+
}
|
|
667
|
+
if (name === "src" || name === "href" && !(tagName === "use" && value[0] === "#")) {
|
|
668
|
+
const transformedValue = absoluteToDoc(doc, value);
|
|
669
|
+
if (tagName === "img" && transformedValue.startsWith("data:") && element) {
|
|
670
|
+
const img = element;
|
|
671
|
+
let processedDataURL = transformedValue;
|
|
672
|
+
if ((dataURLOptions == null ? void 0 : dataURLOptions.type) || (dataURLOptions == null ? void 0 : dataURLOptions.quality) !== void 0) {
|
|
673
|
+
processedDataURL = types.recompressBase64Image(
|
|
674
|
+
img,
|
|
675
|
+
transformedValue,
|
|
676
|
+
dataURLOptions.type,
|
|
677
|
+
dataURLOptions.quality
|
|
678
|
+
);
|
|
653
679
|
}
|
|
654
|
-
if (
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
680
|
+
if (dataURLOptions == null ? void 0 : dataURLOptions.maxBase64ImageLength) {
|
|
681
|
+
processedDataURL = types.checkDataURLSize(
|
|
682
|
+
processedDataURL,
|
|
683
|
+
dataURLOptions.maxBase64ImageLength
|
|
684
|
+
);
|
|
658
685
|
}
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
686
|
+
return processedDataURL;
|
|
687
|
+
}
|
|
688
|
+
return transformedValue;
|
|
689
|
+
} else if (name === "xlink:href" && value[0] !== "#") {
|
|
690
|
+
return absoluteToDoc(doc, value);
|
|
691
|
+
} else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {
|
|
692
|
+
return absoluteToDoc(doc, value);
|
|
693
|
+
} else if (name === "srcset") {
|
|
694
|
+
return getAbsoluteSrcsetString(doc, value);
|
|
695
|
+
} else if (name === "style") {
|
|
696
|
+
return types.absolutifyURLs(value, getHref(doc));
|
|
697
|
+
} else if (tagName === "object" && name === "data") {
|
|
698
|
+
return absoluteToDoc(doc, value);
|
|
699
|
+
}
|
|
700
|
+
return value;
|
|
701
|
+
}
|
|
702
|
+
function ignoreAttribute(tagName, name, _value) {
|
|
703
|
+
return (tagName === "video" || tagName === "audio") && name === "autoplay";
|
|
704
|
+
}
|
|
705
|
+
function _isBlockedElement(element, blockClass, blockSelector) {
|
|
706
|
+
try {
|
|
707
|
+
if (typeof blockClass === "string") {
|
|
708
|
+
if (element.classList.contains(blockClass)) {
|
|
709
|
+
return true;
|
|
665
710
|
}
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
if ((dataURLOptions == null ? void 0 : dataURLOptions.type) || (dataURLOptions == null ? void 0 : dataURLOptions.quality) !== void 0) {
|
|
672
|
-
processedDataURL = types2.recompressBase64Image(
|
|
673
|
-
img,
|
|
674
|
-
transformedValue,
|
|
675
|
-
dataURLOptions.type,
|
|
676
|
-
dataURLOptions.quality
|
|
677
|
-
);
|
|
678
|
-
}
|
|
679
|
-
if (dataURLOptions == null ? void 0 : dataURLOptions.maxBase64ImageLength) {
|
|
680
|
-
processedDataURL = types2.checkDataURLSize(
|
|
681
|
-
processedDataURL,
|
|
682
|
-
dataURLOptions.maxBase64ImageLength
|
|
683
|
-
);
|
|
684
|
-
}
|
|
685
|
-
return processedDataURL;
|
|
711
|
+
} else {
|
|
712
|
+
for (let eIndex = element.classList.length; eIndex--; ) {
|
|
713
|
+
const className = element.classList[eIndex];
|
|
714
|
+
if (blockClass.test(className)) {
|
|
715
|
+
return true;
|
|
686
716
|
}
|
|
687
|
-
return transformedValue;
|
|
688
|
-
} else if (name === "xlink:href" && value[0] !== "#") {
|
|
689
|
-
return absoluteToDoc(doc, value);
|
|
690
|
-
} else if (name === "background" && (tagName === "table" || tagName === "td" || tagName === "th")) {
|
|
691
|
-
return absoluteToDoc(doc, value);
|
|
692
|
-
} else if (name === "srcset") {
|
|
693
|
-
return getAbsoluteSrcsetString(doc, value);
|
|
694
|
-
} else if (name === "style") {
|
|
695
|
-
return types2.absolutifyURLs(value, getHref(doc));
|
|
696
|
-
} else if (tagName === "object" && name === "data") {
|
|
697
|
-
return absoluteToDoc(doc, value);
|
|
698
717
|
}
|
|
699
|
-
return value;
|
|
700
718
|
}
|
|
701
|
-
|
|
702
|
-
return (
|
|
719
|
+
if (blockSelector) {
|
|
720
|
+
return element.matches(blockSelector);
|
|
703
721
|
}
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
722
|
+
} catch (e) {
|
|
723
|
+
}
|
|
724
|
+
return false;
|
|
725
|
+
}
|
|
726
|
+
function classMatchesRegex(node, regex, checkAncestors) {
|
|
727
|
+
if (!node) return false;
|
|
728
|
+
if (node.nodeType !== node.ELEMENT_NODE) {
|
|
729
|
+
if (!checkAncestors) return false;
|
|
730
|
+
return classMatchesRegex(types.index.parentNode(node), regex, checkAncestors);
|
|
731
|
+
}
|
|
732
|
+
for (let eIndex = node.classList.length; eIndex--; ) {
|
|
733
|
+
const className = node.classList[eIndex];
|
|
734
|
+
if (regex.test(className)) {
|
|
735
|
+
return true;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
if (!checkAncestors) return false;
|
|
739
|
+
return classMatchesRegex(types.index.parentNode(node), regex, checkAncestors);
|
|
740
|
+
}
|
|
741
|
+
function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
|
|
742
|
+
let el;
|
|
743
|
+
if (types.isElement(node)) {
|
|
744
|
+
el = node;
|
|
745
|
+
if (!types.index.childNodes(el).length) {
|
|
723
746
|
return false;
|
|
724
747
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
if (
|
|
734
|
-
return true;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
if (!checkAncestors) return false;
|
|
738
|
-
return classMatchesRegex(types2.index.parentNode(node), regex, checkAncestors);
|
|
739
|
-
}
|
|
740
|
-
function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
|
|
741
|
-
let el;
|
|
742
|
-
if (types2.isElement(node)) {
|
|
743
|
-
el = node;
|
|
744
|
-
if (!types2.index.childNodes(el).length) {
|
|
745
|
-
return false;
|
|
746
|
-
}
|
|
747
|
-
} else if (types2.index.parentElement(node) === null) {
|
|
748
|
-
return false;
|
|
748
|
+
} else if (types.index.parentElement(node) === null) {
|
|
749
|
+
return false;
|
|
750
|
+
} else {
|
|
751
|
+
el = types.index.parentElement(node);
|
|
752
|
+
}
|
|
753
|
+
try {
|
|
754
|
+
if (typeof maskTextClass === "string") {
|
|
755
|
+
if (checkAncestors) {
|
|
756
|
+
if (el.closest(`.${maskTextClass}`)) return true;
|
|
749
757
|
} else {
|
|
750
|
-
el
|
|
751
|
-
}
|
|
752
|
-
try {
|
|
753
|
-
if (typeof maskTextClass === "string") {
|
|
754
|
-
if (checkAncestors) {
|
|
755
|
-
if (el.closest(`.${maskTextClass}`)) return true;
|
|
756
|
-
} else {
|
|
757
|
-
if (el.classList.contains(maskTextClass)) return true;
|
|
758
|
-
}
|
|
759
|
-
} else {
|
|
760
|
-
if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;
|
|
761
|
-
}
|
|
762
|
-
if (maskTextSelector) {
|
|
763
|
-
if (checkAncestors) {
|
|
764
|
-
if (el.closest(maskTextSelector)) return true;
|
|
765
|
-
} else {
|
|
766
|
-
if (el.matches(maskTextSelector)) return true;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
} catch (e) {
|
|
758
|
+
if (el.classList.contains(maskTextClass)) return true;
|
|
770
759
|
}
|
|
771
|
-
|
|
760
|
+
} else {
|
|
761
|
+
if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;
|
|
772
762
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
let fired = false;
|
|
779
|
-
let readyState;
|
|
780
|
-
try {
|
|
781
|
-
readyState = win.document.readyState;
|
|
782
|
-
} catch (error) {
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
if (readyState !== "complete") {
|
|
786
|
-
const timer = setTimeout(() => {
|
|
787
|
-
if (!fired) {
|
|
788
|
-
listener();
|
|
789
|
-
fired = true;
|
|
790
|
-
}
|
|
791
|
-
}, iframeLoadTimeout);
|
|
792
|
-
iframeEl.addEventListener("load", () => {
|
|
793
|
-
clearTimeout(timer);
|
|
794
|
-
fired = true;
|
|
795
|
-
listener();
|
|
796
|
-
});
|
|
797
|
-
return;
|
|
798
|
-
}
|
|
799
|
-
const blankUrl = "about:blank";
|
|
800
|
-
if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
801
|
-
setTimeout(listener, 0);
|
|
802
|
-
return iframeEl.addEventListener("load", listener);
|
|
763
|
+
if (maskTextSelector) {
|
|
764
|
+
if (checkAncestors) {
|
|
765
|
+
if (el.closest(maskTextSelector)) return true;
|
|
766
|
+
} else {
|
|
767
|
+
if (el.matches(maskTextSelector)) return true;
|
|
803
768
|
}
|
|
804
|
-
iframeEl.addEventListener("load", listener);
|
|
805
769
|
}
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
770
|
+
} catch (e) {
|
|
771
|
+
}
|
|
772
|
+
return false;
|
|
773
|
+
}
|
|
774
|
+
function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
|
|
775
|
+
const win = iframeEl.contentWindow;
|
|
776
|
+
if (!win) {
|
|
777
|
+
return;
|
|
778
|
+
}
|
|
779
|
+
let fired = false;
|
|
780
|
+
let readyState;
|
|
781
|
+
try {
|
|
782
|
+
readyState = win.document.readyState;
|
|
783
|
+
} catch (error) {
|
|
784
|
+
return;
|
|
785
|
+
}
|
|
786
|
+
if (readyState !== "complete") {
|
|
787
|
+
const timer = setTimeout(() => {
|
|
788
|
+
if (!fired) {
|
|
824
789
|
listener();
|
|
825
|
-
|
|
826
|
-
}
|
|
827
|
-
function serializeNode(n, options) {
|
|
828
|
-
const {
|
|
829
|
-
doc,
|
|
830
|
-
mirror,
|
|
831
|
-
blockClass,
|
|
832
|
-
blockSelector,
|
|
833
|
-
needsMask,
|
|
834
|
-
inlineStylesheet,
|
|
835
|
-
maskInputOptions = {},
|
|
836
|
-
maskTextFn,
|
|
837
|
-
maskInputFn,
|
|
838
|
-
dataURLOptions = {},
|
|
839
|
-
inlineImages,
|
|
840
|
-
recordCanvas,
|
|
841
|
-
keepIframeSrcFn,
|
|
842
|
-
newlyAddedElement = false
|
|
843
|
-
} = options;
|
|
844
|
-
const rootId = getRootId(doc, mirror);
|
|
845
|
-
switch (n.nodeType) {
|
|
846
|
-
case n.DOCUMENT_NODE:
|
|
847
|
-
if (n.compatMode !== "CSS1Compat") {
|
|
848
|
-
return {
|
|
849
|
-
type: types2.NodeType$1.Document,
|
|
850
|
-
childNodes: [],
|
|
851
|
-
compatMode: n.compatMode
|
|
852
|
-
// probably "BackCompat"
|
|
853
|
-
};
|
|
854
|
-
} else {
|
|
855
|
-
return {
|
|
856
|
-
type: types2.NodeType$1.Document,
|
|
857
|
-
childNodes: []
|
|
858
|
-
};
|
|
859
|
-
}
|
|
860
|
-
case n.DOCUMENT_TYPE_NODE:
|
|
861
|
-
return {
|
|
862
|
-
type: types2.NodeType$1.DocumentType,
|
|
863
|
-
name: n.name,
|
|
864
|
-
publicId: n.publicId,
|
|
865
|
-
systemId: n.systemId,
|
|
866
|
-
rootId
|
|
867
|
-
};
|
|
868
|
-
case n.ELEMENT_NODE:
|
|
869
|
-
return serializeElementNode(n, {
|
|
870
|
-
doc,
|
|
871
|
-
blockClass,
|
|
872
|
-
blockSelector,
|
|
873
|
-
inlineStylesheet,
|
|
874
|
-
maskInputOptions,
|
|
875
|
-
maskInputFn,
|
|
876
|
-
dataURLOptions,
|
|
877
|
-
inlineImages,
|
|
878
|
-
recordCanvas,
|
|
879
|
-
keepIframeSrcFn,
|
|
880
|
-
newlyAddedElement,
|
|
881
|
-
rootId
|
|
882
|
-
});
|
|
883
|
-
case n.TEXT_NODE:
|
|
884
|
-
return serializeTextNode(n, {
|
|
885
|
-
doc,
|
|
886
|
-
needsMask,
|
|
887
|
-
maskTextFn,
|
|
888
|
-
rootId
|
|
889
|
-
});
|
|
890
|
-
case n.CDATA_SECTION_NODE:
|
|
891
|
-
return {
|
|
892
|
-
type: types2.NodeType$1.CDATA,
|
|
893
|
-
textContent: "",
|
|
894
|
-
rootId
|
|
895
|
-
};
|
|
896
|
-
case n.COMMENT_NODE:
|
|
897
|
-
return {
|
|
898
|
-
type: types2.NodeType$1.Comment,
|
|
899
|
-
textContent: types2.index.textContent(n) || "",
|
|
900
|
-
rootId
|
|
901
|
-
};
|
|
902
|
-
default:
|
|
903
|
-
return false;
|
|
904
|
-
}
|
|
905
|
-
}
|
|
906
|
-
function getRootId(doc, mirror) {
|
|
907
|
-
if (!mirror.hasNode(doc)) return void 0;
|
|
908
|
-
const docId = mirror.getId(doc);
|
|
909
|
-
return docId === 1 ? void 0 : docId;
|
|
910
|
-
}
|
|
911
|
-
function serializeTextNode(n, options) {
|
|
912
|
-
var _a;
|
|
913
|
-
const { needsMask, maskTextFn, rootId } = options;
|
|
914
|
-
const parent = types2.index.parentNode(n);
|
|
915
|
-
const parentTagName = parent && parent.tagName;
|
|
916
|
-
let text = types2.index.textContent(n);
|
|
917
|
-
const isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
918
|
-
const isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
919
|
-
if (isStyle && text) {
|
|
920
|
-
try {
|
|
921
|
-
if (n.nextSibling || n.previousSibling) {
|
|
922
|
-
} else if ((_a = parent.sheet) == null ? void 0 : _a.cssRules) {
|
|
923
|
-
text = types2.stringifyStylesheet(parent.sheet);
|
|
924
|
-
}
|
|
925
|
-
} catch (err) {
|
|
926
|
-
console.warn(
|
|
927
|
-
`Cannot get CSS styles from text's parentNode. Error: ${err}`,
|
|
928
|
-
n
|
|
929
|
-
);
|
|
930
|
-
}
|
|
931
|
-
text = types2.absolutifyURLs(text, getHref(options.doc));
|
|
932
|
-
}
|
|
933
|
-
if (isScript) {
|
|
934
|
-
text = "SCRIPT_PLACEHOLDER";
|
|
790
|
+
fired = true;
|
|
935
791
|
}
|
|
936
|
-
|
|
937
|
-
|
|
792
|
+
}, iframeLoadTimeout);
|
|
793
|
+
iframeEl.addEventListener("load", () => {
|
|
794
|
+
clearTimeout(timer);
|
|
795
|
+
fired = true;
|
|
796
|
+
listener();
|
|
797
|
+
});
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
const blankUrl = "about:blank";
|
|
801
|
+
if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
|
|
802
|
+
setTimeout(listener, 0);
|
|
803
|
+
return iframeEl.addEventListener("load", listener);
|
|
804
|
+
}
|
|
805
|
+
iframeEl.addEventListener("load", listener);
|
|
806
|
+
}
|
|
807
|
+
function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
|
|
808
|
+
let fired = false;
|
|
809
|
+
let styleSheetLoaded;
|
|
810
|
+
try {
|
|
811
|
+
styleSheetLoaded = link.sheet;
|
|
812
|
+
} catch (error) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (styleSheetLoaded) return;
|
|
816
|
+
const timer = setTimeout(() => {
|
|
817
|
+
if (!fired) {
|
|
818
|
+
listener();
|
|
819
|
+
fired = true;
|
|
820
|
+
}
|
|
821
|
+
}, styleSheetLoadTimeout);
|
|
822
|
+
link.addEventListener("load", () => {
|
|
823
|
+
clearTimeout(timer);
|
|
824
|
+
fired = true;
|
|
825
|
+
listener();
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
function serializeNode(n, options) {
|
|
829
|
+
const {
|
|
830
|
+
doc,
|
|
831
|
+
mirror,
|
|
832
|
+
blockClass,
|
|
833
|
+
blockSelector,
|
|
834
|
+
needsMask,
|
|
835
|
+
inlineStylesheet,
|
|
836
|
+
maskInputOptions = {},
|
|
837
|
+
maskTextFn,
|
|
838
|
+
maskInputFn,
|
|
839
|
+
dataURLOptions = {},
|
|
840
|
+
inlineImages,
|
|
841
|
+
recordCanvas,
|
|
842
|
+
keepIframeSrcFn,
|
|
843
|
+
newlyAddedElement = false
|
|
844
|
+
} = options;
|
|
845
|
+
const rootId = getRootId(doc, mirror);
|
|
846
|
+
switch (n.nodeType) {
|
|
847
|
+
case n.DOCUMENT_NODE:
|
|
848
|
+
if (n.compatMode !== "CSS1Compat") {
|
|
849
|
+
return {
|
|
850
|
+
type: types.NodeType$1.Document,
|
|
851
|
+
childNodes: [],
|
|
852
|
+
compatMode: n.compatMode
|
|
853
|
+
// probably "BackCompat"
|
|
854
|
+
};
|
|
855
|
+
} else {
|
|
856
|
+
return {
|
|
857
|
+
type: types.NodeType$1.Document,
|
|
858
|
+
childNodes: []
|
|
859
|
+
};
|
|
938
860
|
}
|
|
861
|
+
case n.DOCUMENT_TYPE_NODE:
|
|
939
862
|
return {
|
|
940
|
-
type:
|
|
941
|
-
|
|
942
|
-
|
|
863
|
+
type: types.NodeType$1.DocumentType,
|
|
864
|
+
name: n.name,
|
|
865
|
+
publicId: n.publicId,
|
|
866
|
+
systemId: n.systemId,
|
|
943
867
|
rootId
|
|
944
868
|
};
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
return Array.from(doc.styleSheets).find((s) => s.href === href);
|
|
948
|
-
}
|
|
949
|
-
function hrefFrom(n) {
|
|
950
|
-
return n.href;
|
|
951
|
-
}
|
|
952
|
-
function serializeElementNode(n, options) {
|
|
953
|
-
var _a, _b;
|
|
954
|
-
const {
|
|
869
|
+
case n.ELEMENT_NODE:
|
|
870
|
+
return serializeElementNode(n, {
|
|
955
871
|
doc,
|
|
956
872
|
blockClass,
|
|
957
873
|
blockSelector,
|
|
958
874
|
inlineStylesheet,
|
|
959
|
-
maskInputOptions
|
|
875
|
+
maskInputOptions,
|
|
960
876
|
maskInputFn,
|
|
961
|
-
dataURLOptions
|
|
877
|
+
dataURLOptions,
|
|
962
878
|
inlineImages,
|
|
963
879
|
recordCanvas,
|
|
964
880
|
keepIframeSrcFn,
|
|
965
|
-
newlyAddedElement
|
|
881
|
+
newlyAddedElement,
|
|
966
882
|
rootId
|
|
967
|
-
}
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
883
|
+
});
|
|
884
|
+
case n.TEXT_NODE:
|
|
885
|
+
return serializeTextNode(n, {
|
|
886
|
+
doc,
|
|
887
|
+
needsMask,
|
|
888
|
+
maskTextFn,
|
|
889
|
+
rootId
|
|
890
|
+
});
|
|
891
|
+
case n.CDATA_SECTION_NODE:
|
|
892
|
+
return {
|
|
893
|
+
type: types.NodeType$1.CDATA,
|
|
894
|
+
textContent: "",
|
|
895
|
+
rootId
|
|
896
|
+
};
|
|
897
|
+
case n.COMMENT_NODE:
|
|
898
|
+
return {
|
|
899
|
+
type: types.NodeType$1.Comment,
|
|
900
|
+
textContent: types.index.textContent(n) || "",
|
|
901
|
+
rootId
|
|
902
|
+
};
|
|
903
|
+
default:
|
|
904
|
+
return false;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
function getRootId(doc, mirror) {
|
|
908
|
+
if (!mirror.hasNode(doc)) return void 0;
|
|
909
|
+
const docId = mirror.getId(doc);
|
|
910
|
+
return docId === 1 ? void 0 : docId;
|
|
911
|
+
}
|
|
912
|
+
function serializeTextNode(n, options) {
|
|
913
|
+
var _a;
|
|
914
|
+
const { needsMask, maskTextFn, rootId } = options;
|
|
915
|
+
const parent = types.index.parentNode(n);
|
|
916
|
+
const parentTagName = parent && parent.tagName;
|
|
917
|
+
let text = types.index.textContent(n);
|
|
918
|
+
const isStyle = parentTagName === "STYLE" ? true : void 0;
|
|
919
|
+
const isScript = parentTagName === "SCRIPT" ? true : void 0;
|
|
920
|
+
if (isStyle && text) {
|
|
921
|
+
try {
|
|
922
|
+
if (n.nextSibling || n.previousSibling) {
|
|
923
|
+
} else if ((_a = parent.sheet) == null ? void 0 : _a.cssRules) {
|
|
924
|
+
text = types.stringifyStylesheet(parent.sheet);
|
|
925
|
+
}
|
|
926
|
+
} catch (err) {
|
|
927
|
+
console.warn(
|
|
928
|
+
`Cannot get CSS styles from text's parentNode. Error: ${err}`,
|
|
929
|
+
n
|
|
930
|
+
);
|
|
931
|
+
}
|
|
932
|
+
text = types.absolutifyURLs(text, getHref(options.doc));
|
|
933
|
+
}
|
|
934
|
+
if (isScript) {
|
|
935
|
+
text = "SCRIPT_PLACEHOLDER";
|
|
936
|
+
}
|
|
937
|
+
if (!isStyle && !isScript && text && needsMask) {
|
|
938
|
+
text = maskTextFn ? maskTextFn(text, types.index.parentElement(n)) : text.replace(/[\S]/g, "*");
|
|
939
|
+
}
|
|
940
|
+
return {
|
|
941
|
+
type: types.NodeType$1.Text,
|
|
942
|
+
textContent: text || "",
|
|
943
|
+
isStyle,
|
|
944
|
+
rootId
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
function findStylesheet(doc, href) {
|
|
948
|
+
return Array.from(doc.styleSheets).find((s) => s.href === href);
|
|
949
|
+
}
|
|
950
|
+
function hrefFrom(n) {
|
|
951
|
+
return n.href;
|
|
952
|
+
}
|
|
953
|
+
function serializeElementNode(n, options) {
|
|
954
|
+
var _a, _b;
|
|
955
|
+
const {
|
|
956
|
+
doc,
|
|
957
|
+
blockClass,
|
|
958
|
+
blockSelector,
|
|
959
|
+
inlineStylesheet,
|
|
960
|
+
maskInputOptions = {},
|
|
961
|
+
maskInputFn,
|
|
962
|
+
dataURLOptions = {},
|
|
963
|
+
inlineImages,
|
|
964
|
+
recordCanvas,
|
|
965
|
+
keepIframeSrcFn,
|
|
966
|
+
newlyAddedElement = false,
|
|
967
|
+
rootId
|
|
968
|
+
} = options;
|
|
969
|
+
const needBlock = _isBlockedElement(n, blockClass, blockSelector);
|
|
970
|
+
const tagName = getValidTagName(n);
|
|
971
|
+
let attributes = {};
|
|
972
|
+
const len = n.attributes.length;
|
|
973
|
+
for (let i = 0; i < len; i++) {
|
|
974
|
+
const attr = n.attributes[i];
|
|
975
|
+
if (!ignoreAttribute(tagName, attr.name, attr.value)) {
|
|
976
|
+
attributes[attr.name] = transformAttribute(
|
|
977
|
+
doc,
|
|
978
|
+
tagName,
|
|
979
|
+
types.toLowerCase(attr.name),
|
|
980
|
+
attr.value,
|
|
981
|
+
n,
|
|
982
|
+
dataURLOptions
|
|
983
|
+
);
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
if (tagName === "link" && inlineStylesheet) {
|
|
987
|
+
const href = hrefFrom(n);
|
|
988
|
+
if (href) {
|
|
989
|
+
let stylesheet = findStylesheet(doc, href);
|
|
990
|
+
if (!stylesheet && href.includes(".css")) {
|
|
991
|
+
const rootDomain = window.location.origin;
|
|
992
|
+
const stylesheetPath = href.replace(window.location.href, "");
|
|
993
|
+
const potentialStylesheetHref = rootDomain + "/" + stylesheetPath;
|
|
994
|
+
stylesheet = findStylesheet(doc, potentialStylesheetHref);
|
|
995
|
+
}
|
|
996
|
+
let cssText = null;
|
|
997
|
+
if (stylesheet) {
|
|
998
|
+
cssText = types.stringifyStylesheet(stylesheet);
|
|
999
|
+
}
|
|
1000
|
+
if (cssText) {
|
|
1001
|
+
delete attributes.rel;
|
|
1002
|
+
delete attributes.href;
|
|
1003
|
+
attributes._cssText = cssText;
|
|
1005
1004
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
if (tagName === "style" && n.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
|
|
1008
|
+
!(n.innerText || types.index.textContent(n) || "").trim().length) {
|
|
1009
|
+
const cssText = types.stringifyStylesheet(
|
|
1010
|
+
n.sheet
|
|
1011
|
+
);
|
|
1012
|
+
if (cssText) {
|
|
1013
|
+
attributes._cssText = cssText;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
if (tagName === "input" || tagName === "textarea" || tagName === "select") {
|
|
1017
|
+
const value = n.value;
|
|
1018
|
+
const checked = n.checked;
|
|
1019
|
+
if (attributes.type !== "radio" && attributes.type !== "checkbox" && attributes.type !== "submit" && attributes.type !== "button" && value) {
|
|
1020
|
+
attributes.value = types.maskInputValue({
|
|
1021
|
+
element: n,
|
|
1022
|
+
type: types.getInputType(n),
|
|
1023
|
+
tagName,
|
|
1024
|
+
value,
|
|
1025
|
+
maskInputOptions,
|
|
1026
|
+
maskInputFn
|
|
1027
|
+
});
|
|
1028
|
+
} else if (checked) {
|
|
1029
|
+
attributes.checked = checked;
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
if (tagName === "option") {
|
|
1033
|
+
if (n.selected && !maskInputOptions["select"]) {
|
|
1034
|
+
attributes.selected = true;
|
|
1035
|
+
} else {
|
|
1036
|
+
delete attributes.selected;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
if (tagName === "dialog" && n.open) {
|
|
1040
|
+
try {
|
|
1041
|
+
attributes.rr_open_mode = n.matches("dialog:modal") ? "modal" : "non-modal";
|
|
1042
|
+
} catch (e) {
|
|
1043
|
+
attributes.rr_open_mode = "modal";
|
|
1044
|
+
attributes.ph_rr_could_not_detect_modal = true;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if (tagName === "canvas" && recordCanvas) {
|
|
1048
|
+
if (n.__context === "2d") {
|
|
1049
|
+
if (!types.is2DCanvasBlank(n)) {
|
|
1050
|
+
attributes.rr_dataURL = n.toDataURL(
|
|
1051
|
+
dataURLOptions.type,
|
|
1052
|
+
dataURLOptions.quality
|
|
1010
1053
|
);
|
|
1011
|
-
if (cssText) {
|
|
1012
|
-
attributes._cssText = cssText;
|
|
1013
|
-
}
|
|
1014
1054
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
}
|
|
1055
|
+
} else if (!("__context" in n)) {
|
|
1056
|
+
const canvasDataURL = n.toDataURL(
|
|
1057
|
+
dataURLOptions.type,
|
|
1058
|
+
dataURLOptions.quality
|
|
1059
|
+
);
|
|
1060
|
+
const blankCanvas = doc.createElement("canvas");
|
|
1061
|
+
blankCanvas.width = n.width;
|
|
1062
|
+
blankCanvas.height = n.height;
|
|
1063
|
+
const blankCanvasDataURL = blankCanvas.toDataURL(
|
|
1064
|
+
dataURLOptions.type,
|
|
1065
|
+
dataURLOptions.quality
|
|
1066
|
+
);
|
|
1067
|
+
if (canvasDataURL !== blankCanvasDataURL) {
|
|
1068
|
+
attributes.rr_dataURL = canvasDataURL;
|
|
1030
1069
|
}
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
if (tagName === "img" && inlineImages) {
|
|
1073
|
+
if (!canvasService) {
|
|
1074
|
+
canvasService = doc.createElement("canvas");
|
|
1075
|
+
canvasCtx = canvasService.getContext("2d");
|
|
1076
|
+
}
|
|
1077
|
+
const image = n;
|
|
1078
|
+
const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
|
|
1079
|
+
const priorCrossOrigin = image.crossOrigin;
|
|
1080
|
+
const recordInlineImage = () => {
|
|
1081
|
+
image.removeEventListener("load", recordInlineImage);
|
|
1082
|
+
try {
|
|
1083
|
+
canvasService.width = image.naturalWidth;
|
|
1084
|
+
canvasService.height = image.naturalHeight;
|
|
1085
|
+
canvasCtx.drawImage(image, 0, 0);
|
|
1086
|
+
attributes.rr_dataURL = canvasService.toDataURL(
|
|
1087
|
+
dataURLOptions.type,
|
|
1088
|
+
dataURLOptions.quality
|
|
1089
|
+
);
|
|
1090
|
+
} catch (err) {
|
|
1091
|
+
if (image.crossOrigin !== "anonymous") {
|
|
1092
|
+
image.crossOrigin = "anonymous";
|
|
1093
|
+
if (image.complete && image.naturalWidth !== 0)
|
|
1094
|
+
recordInlineImage();
|
|
1095
|
+
else image.addEventListener("load", recordInlineImage);
|
|
1096
|
+
return;
|
|
1034
1097
|
} else {
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
}
|
|
1038
|
-
if (tagName === "dialog" && n.open) {
|
|
1039
|
-
try {
|
|
1040
|
-
attributes.rr_open_mode = n.matches("dialog:modal") ? "modal" : "non-modal";
|
|
1041
|
-
} catch (e) {
|
|
1042
|
-
attributes.rr_open_mode = "modal";
|
|
1043
|
-
attributes.ph_rr_could_not_detect_modal = true;
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
if (tagName === "canvas" && recordCanvas) {
|
|
1047
|
-
if (n.__context === "2d") {
|
|
1048
|
-
if (!types2.is2DCanvasBlank(n)) {
|
|
1049
|
-
attributes.rr_dataURL = n.toDataURL(
|
|
1050
|
-
dataURLOptions.type,
|
|
1051
|
-
dataURLOptions.quality
|
|
1052
|
-
);
|
|
1053
|
-
}
|
|
1054
|
-
} else if (!("__context" in n)) {
|
|
1055
|
-
const canvasDataURL = n.toDataURL(
|
|
1056
|
-
dataURLOptions.type,
|
|
1057
|
-
dataURLOptions.quality
|
|
1058
|
-
);
|
|
1059
|
-
const blankCanvas = doc.createElement("canvas");
|
|
1060
|
-
blankCanvas.width = n.width;
|
|
1061
|
-
blankCanvas.height = n.height;
|
|
1062
|
-
const blankCanvasDataURL = blankCanvas.toDataURL(
|
|
1063
|
-
dataURLOptions.type,
|
|
1064
|
-
dataURLOptions.quality
|
|
1098
|
+
console.warn(
|
|
1099
|
+
`Cannot inline img src=${imageSrc}! Error: ${err}`
|
|
1065
1100
|
);
|
|
1066
|
-
if (canvasDataURL !== blankCanvasDataURL) {
|
|
1067
|
-
attributes.rr_dataURL = canvasDataURL;
|
|
1068
|
-
}
|
|
1069
1101
|
}
|
|
1070
1102
|
}
|
|
1071
|
-
if (
|
|
1072
|
-
|
|
1073
|
-
canvasService = doc.createElement("canvas");
|
|
1074
|
-
canvasCtx = canvasService.getContext("2d");
|
|
1075
|
-
}
|
|
1076
|
-
const image = n;
|
|
1077
|
-
const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
|
|
1078
|
-
const priorCrossOrigin = image.crossOrigin;
|
|
1079
|
-
const recordInlineImage = () => {
|
|
1080
|
-
image.removeEventListener("load", recordInlineImage);
|
|
1081
|
-
try {
|
|
1082
|
-
canvasService.width = image.naturalWidth;
|
|
1083
|
-
canvasService.height = image.naturalHeight;
|
|
1084
|
-
canvasCtx.drawImage(image, 0, 0);
|
|
1085
|
-
attributes.rr_dataURL = canvasService.toDataURL(
|
|
1086
|
-
dataURLOptions.type,
|
|
1087
|
-
dataURLOptions.quality
|
|
1088
|
-
);
|
|
1089
|
-
} catch (err) {
|
|
1090
|
-
if (image.crossOrigin !== "anonymous") {
|
|
1091
|
-
image.crossOrigin = "anonymous";
|
|
1092
|
-
if (image.complete && image.naturalWidth !== 0)
|
|
1093
|
-
recordInlineImage();
|
|
1094
|
-
else image.addEventListener("load", recordInlineImage);
|
|
1095
|
-
return;
|
|
1096
|
-
} else {
|
|
1097
|
-
console.warn(
|
|
1098
|
-
`Cannot inline img src=${imageSrc}! Error: ${err}`
|
|
1099
|
-
);
|
|
1100
|
-
}
|
|
1101
|
-
}
|
|
1102
|
-
if (image.crossOrigin === "anonymous") {
|
|
1103
|
-
priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");
|
|
1104
|
-
}
|
|
1105
|
-
};
|
|
1106
|
-
if (image.complete && image.naturalWidth !== 0) recordInlineImage();
|
|
1107
|
-
else image.addEventListener("load", recordInlineImage);
|
|
1108
|
-
}
|
|
1109
|
-
if (tagName === "audio" || tagName === "video") {
|
|
1110
|
-
const mediaAttributes = attributes;
|
|
1111
|
-
mediaAttributes.rr_mediaState = n.paused ? "paused" : "played";
|
|
1112
|
-
mediaAttributes.rr_mediaCurrentTime = n.currentTime;
|
|
1113
|
-
mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;
|
|
1114
|
-
mediaAttributes.rr_mediaMuted = n.muted;
|
|
1115
|
-
mediaAttributes.rr_mediaLoop = n.loop;
|
|
1116
|
-
mediaAttributes.rr_mediaVolume = n.volume;
|
|
1117
|
-
}
|
|
1118
|
-
if (!newlyAddedElement) {
|
|
1119
|
-
if (n.scrollLeft) {
|
|
1120
|
-
attributes.rr_scrollLeft = n.scrollLeft;
|
|
1121
|
-
}
|
|
1122
|
-
if (n.scrollTop) {
|
|
1123
|
-
attributes.rr_scrollTop = n.scrollTop;
|
|
1124
|
-
}
|
|
1103
|
+
if (image.crossOrigin === "anonymous") {
|
|
1104
|
+
priorCrossOrigin ? attributes.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");
|
|
1125
1105
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
let isCustomElement;
|
|
1143
|
-
try {
|
|
1144
|
-
if (customElements.get(tagName)) isCustomElement = true;
|
|
1145
|
-
} catch (e) {
|
|
1146
|
-
}
|
|
1147
|
-
return {
|
|
1148
|
-
type: types2.NodeType$1.Element,
|
|
1149
|
-
tagName,
|
|
1150
|
-
attributes,
|
|
1151
|
-
childNodes: [],
|
|
1152
|
-
isSVG: isSVGElement(n) || void 0,
|
|
1153
|
-
needBlock,
|
|
1154
|
-
rootId,
|
|
1155
|
-
isCustom: isCustomElement
|
|
1156
|
-
};
|
|
1106
|
+
};
|
|
1107
|
+
if (image.complete && image.naturalWidth !== 0) recordInlineImage();
|
|
1108
|
+
else image.addEventListener("load", recordInlineImage);
|
|
1109
|
+
}
|
|
1110
|
+
if (tagName === "audio" || tagName === "video") {
|
|
1111
|
+
const mediaAttributes = attributes;
|
|
1112
|
+
mediaAttributes.rr_mediaState = n.paused ? "paused" : "played";
|
|
1113
|
+
mediaAttributes.rr_mediaCurrentTime = n.currentTime;
|
|
1114
|
+
mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;
|
|
1115
|
+
mediaAttributes.rr_mediaMuted = n.muted;
|
|
1116
|
+
mediaAttributes.rr_mediaLoop = n.loop;
|
|
1117
|
+
mediaAttributes.rr_mediaVolume = n.volume;
|
|
1118
|
+
}
|
|
1119
|
+
if (!newlyAddedElement) {
|
|
1120
|
+
if (n.scrollLeft) {
|
|
1121
|
+
attributes.rr_scrollLeft = n.scrollLeft;
|
|
1157
1122
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
return "";
|
|
1161
|
-
} else {
|
|
1162
|
-
return maybeAttr.toLowerCase();
|
|
1163
|
-
}
|
|
1123
|
+
if (n.scrollTop) {
|
|
1124
|
+
attributes.rr_scrollTop = n.scrollTop;
|
|
1164
1125
|
}
|
|
1165
|
-
|
|
1166
|
-
|
|
1126
|
+
}
|
|
1127
|
+
if (needBlock) {
|
|
1128
|
+
const { width, height, left, top } = n.getBoundingClientRect();
|
|
1129
|
+
attributes = {
|
|
1130
|
+
class: attributes.class,
|
|
1131
|
+
rr_width: `${width}px`,
|
|
1132
|
+
rr_height: `${height}px`,
|
|
1133
|
+
rr_left: `${Math.floor(left + (((_a = doc.defaultView) == null ? void 0 : _a.scrollX) || 0))}px`,
|
|
1134
|
+
rr_top: `${Math.floor(top + (((_b = doc.defaultView) == null ? void 0 : _b.scrollY) || 0))}px`
|
|
1135
|
+
};
|
|
1136
|
+
}
|
|
1137
|
+
if (tagName === "iframe" && !keepIframeSrcFn(attributes.src)) {
|
|
1138
|
+
if (!n.contentDocument) {
|
|
1139
|
+
attributes.rr_src = attributes.src;
|
|
1140
|
+
}
|
|
1141
|
+
delete attributes.src;
|
|
1142
|
+
}
|
|
1143
|
+
let isCustomElement;
|
|
1144
|
+
try {
|
|
1145
|
+
if (customElements.get(tagName)) isCustomElement = true;
|
|
1146
|
+
} catch (e) {
|
|
1147
|
+
}
|
|
1148
|
+
return {
|
|
1149
|
+
type: types.NodeType$1.Element,
|
|
1150
|
+
tagName,
|
|
1151
|
+
attributes,
|
|
1152
|
+
childNodes: [],
|
|
1153
|
+
isSVG: isSVGElement(n) || void 0,
|
|
1154
|
+
needBlock,
|
|
1155
|
+
rootId,
|
|
1156
|
+
isCustom: isCustomElement
|
|
1157
|
+
};
|
|
1158
|
+
}
|
|
1159
|
+
function lowerIfExists(maybeAttr) {
|
|
1160
|
+
if (maybeAttr === void 0 || maybeAttr === null) {
|
|
1161
|
+
return "";
|
|
1162
|
+
} else {
|
|
1163
|
+
return maybeAttr.toLowerCase();
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
function slimDOMExcluded(sn, slimDOMOptions) {
|
|
1167
|
+
if (slimDOMOptions.comment && sn.type === types.NodeType$1.Comment) {
|
|
1168
|
+
return true;
|
|
1169
|
+
} else if (sn.type === types.NodeType$1.Element) {
|
|
1170
|
+
if (slimDOMOptions.script && // script tag
|
|
1171
|
+
(sn.tagName === "script" || // (module)preload link
|
|
1172
|
+
sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
|
|
1173
|
+
sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && types.extractFileExtension(sn.attributes.href) === "js")) {
|
|
1174
|
+
return true;
|
|
1175
|
+
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
|
|
1176
|
+
/^msapplication-tile(image|color)$/
|
|
1177
|
+
) || lowerIfExists(sn.attributes.name) === "application-name" || ["icon", "apple-touch-icon", "shortcut icon"].includes(
|
|
1178
|
+
lowerIfExists(sn.attributes.rel)
|
|
1179
|
+
)))) {
|
|
1180
|
+
return true;
|
|
1181
|
+
} else if (sn.tagName === "meta") {
|
|
1182
|
+
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
1183
|
+
return true;
|
|
1184
|
+
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)
|
|
1185
|
+
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
1186
|
+
return true;
|
|
1187
|
+
} else if (slimDOMOptions.headMetaRobots && ["robots", "googlebot", "bingbot"].includes(
|
|
1188
|
+
lowerIfExists(sn.attributes.name)
|
|
1189
|
+
)) {
|
|
1190
|
+
return true;
|
|
1191
|
+
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
1192
|
+
return true;
|
|
1193
|
+
} else if (slimDOMOptions.headMetaAuthorship && (["author", "generator", "framework", "publisher", "progid"].includes(
|
|
1194
|
+
lowerIfExists(sn.attributes.name)
|
|
1195
|
+
) || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
1196
|
+
return true;
|
|
1197
|
+
} else if (slimDOMOptions.headMetaVerification && [
|
|
1198
|
+
"google-site-verification",
|
|
1199
|
+
"yandex-verification",
|
|
1200
|
+
"csrf-token",
|
|
1201
|
+
"p:domain_verify",
|
|
1202
|
+
"verify-v1",
|
|
1203
|
+
"verification",
|
|
1204
|
+
"shopify-checkout-api-token"
|
|
1205
|
+
].includes(lowerIfExists(sn.attributes.name))) {
|
|
1167
1206
|
return true;
|
|
1168
|
-
} else if (sn.type === types2.NodeType$1.Element) {
|
|
1169
|
-
if (slimDOMOptions.script && // script tag
|
|
1170
|
-
(sn.tagName === "script" || // (module)preload link
|
|
1171
|
-
sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
|
|
1172
|
-
sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && types2.extractFileExtension(sn.attributes.href) === "js")) {
|
|
1173
|
-
return true;
|
|
1174
|
-
} else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
|
|
1175
|
-
/^msapplication-tile(image|color)$/
|
|
1176
|
-
) || lowerIfExists(sn.attributes.name) === "application-name" || ["icon", "apple-touch-icon", "shortcut icon"].includes(
|
|
1177
|
-
lowerIfExists(sn.attributes.rel)
|
|
1178
|
-
)))) {
|
|
1179
|
-
return true;
|
|
1180
|
-
} else if (sn.tagName === "meta") {
|
|
1181
|
-
if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
|
|
1182
|
-
return true;
|
|
1183
|
-
} else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)
|
|
1184
|
-
lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
|
|
1185
|
-
return true;
|
|
1186
|
-
} else if (slimDOMOptions.headMetaRobots && ["robots", "googlebot", "bingbot"].includes(
|
|
1187
|
-
lowerIfExists(sn.attributes.name)
|
|
1188
|
-
)) {
|
|
1189
|
-
return true;
|
|
1190
|
-
} else if (slimDOMOptions.headMetaHttpEquiv && sn.attributes["http-equiv"] !== void 0) {
|
|
1191
|
-
return true;
|
|
1192
|
-
} else if (slimDOMOptions.headMetaAuthorship && (["author", "generator", "framework", "publisher", "progid"].includes(
|
|
1193
|
-
lowerIfExists(sn.attributes.name)
|
|
1194
|
-
) || lowerIfExists(sn.attributes.property).match(/^article:/) || lowerIfExists(sn.attributes.property).match(/^product:/))) {
|
|
1195
|
-
return true;
|
|
1196
|
-
} else if (slimDOMOptions.headMetaVerification && [
|
|
1197
|
-
"google-site-verification",
|
|
1198
|
-
"yandex-verification",
|
|
1199
|
-
"csrf-token",
|
|
1200
|
-
"p:domain_verify",
|
|
1201
|
-
"verify-v1",
|
|
1202
|
-
"verification",
|
|
1203
|
-
"shopify-checkout-api-token"
|
|
1204
|
-
].includes(lowerIfExists(sn.attributes.name))) {
|
|
1205
|
-
return true;
|
|
1206
|
-
}
|
|
1207
|
-
}
|
|
1208
1207
|
}
|
|
1209
|
-
return false;
|
|
1210
|
-
}
|
|
1211
|
-
var DEFAULT_MAX_DEPTH = 50;
|
|
1212
|
-
var _maxDepthWarned = false;
|
|
1213
|
-
var _maxDepthReached = false;
|
|
1214
|
-
function wasMaxDepthReached() {
|
|
1215
|
-
return _maxDepthReached;
|
|
1216
1208
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1209
|
+
}
|
|
1210
|
+
return false;
|
|
1211
|
+
}
|
|
1212
|
+
var DEFAULT_MAX_DEPTH = 50;
|
|
1213
|
+
var _maxDepthWarned = false;
|
|
1214
|
+
var _maxDepthReached = false;
|
|
1215
|
+
function wasMaxDepthReached() {
|
|
1216
|
+
return _maxDepthReached;
|
|
1217
|
+
}
|
|
1218
|
+
function resetMaxDepthState() {
|
|
1219
|
+
_maxDepthReached = false;
|
|
1220
|
+
_maxDepthWarned = false;
|
|
1221
|
+
}
|
|
1222
|
+
function serializeNodeWithId(n, options) {
|
|
1223
|
+
const {
|
|
1224
|
+
doc,
|
|
1225
|
+
mirror,
|
|
1226
|
+
blockClass,
|
|
1227
|
+
blockSelector,
|
|
1228
|
+
maskTextClass,
|
|
1229
|
+
maskTextSelector,
|
|
1230
|
+
skipChild = false,
|
|
1231
|
+
inlineStylesheet = true,
|
|
1232
|
+
maskInputOptions = {},
|
|
1233
|
+
maskTextFn,
|
|
1234
|
+
maskInputFn,
|
|
1235
|
+
slimDOMOptions,
|
|
1236
|
+
dataURLOptions = {},
|
|
1237
|
+
inlineImages = false,
|
|
1238
|
+
recordCanvas = false,
|
|
1239
|
+
onSerialize,
|
|
1240
|
+
onIframeLoad,
|
|
1241
|
+
iframeLoadTimeout = 5e3,
|
|
1242
|
+
onStylesheetLoad,
|
|
1243
|
+
stylesheetLoadTimeout = 5e3,
|
|
1244
|
+
keepIframeSrcFn = () => false,
|
|
1245
|
+
newlyAddedElement = false,
|
|
1246
|
+
depth = 0,
|
|
1247
|
+
maxDepth = DEFAULT_MAX_DEPTH
|
|
1248
|
+
} = options;
|
|
1249
|
+
let { needsMask } = options;
|
|
1250
|
+
let { preserveWhiteSpace = true } = options;
|
|
1251
|
+
if (depth >= maxDepth) {
|
|
1252
|
+
_maxDepthReached = true;
|
|
1253
|
+
if (!_maxDepthWarned) {
|
|
1254
|
+
_maxDepthWarned = true;
|
|
1255
|
+
console.warn(
|
|
1256
|
+
`[rrweb-snapshot] DOM tree depth exceeded max depth of ${maxDepth}. Children beyond this depth will not be recorded. This may indicate deeply nested DOM structures.`
|
|
1257
|
+
);
|
|
1220
1258
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1259
|
+
return null;
|
|
1260
|
+
}
|
|
1261
|
+
if (!needsMask) {
|
|
1262
|
+
const checkAncestors = needsMask === void 0;
|
|
1263
|
+
needsMask = needMaskingText(
|
|
1264
|
+
n,
|
|
1265
|
+
maskTextClass,
|
|
1266
|
+
maskTextSelector,
|
|
1267
|
+
checkAncestors
|
|
1268
|
+
);
|
|
1269
|
+
}
|
|
1270
|
+
const _serializedNode = serializeNode(n, {
|
|
1271
|
+
doc,
|
|
1272
|
+
mirror,
|
|
1273
|
+
blockClass,
|
|
1274
|
+
blockSelector,
|
|
1275
|
+
needsMask,
|
|
1276
|
+
inlineStylesheet,
|
|
1277
|
+
maskInputOptions,
|
|
1278
|
+
maskTextFn,
|
|
1279
|
+
maskInputFn,
|
|
1280
|
+
dataURLOptions,
|
|
1281
|
+
inlineImages,
|
|
1282
|
+
recordCanvas,
|
|
1283
|
+
keepIframeSrcFn,
|
|
1284
|
+
newlyAddedElement
|
|
1285
|
+
});
|
|
1286
|
+
if (!_serializedNode) {
|
|
1287
|
+
console.warn(n, "not serialized");
|
|
1288
|
+
return null;
|
|
1289
|
+
}
|
|
1290
|
+
let id;
|
|
1291
|
+
if (mirror.hasNode(n)) {
|
|
1292
|
+
id = mirror.getId(n);
|
|
1293
|
+
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === types.NodeType$1.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
1294
|
+
id = IGNORED_NODE;
|
|
1295
|
+
} else {
|
|
1296
|
+
id = genId();
|
|
1297
|
+
}
|
|
1298
|
+
const serializedNode = Object.assign(_serializedNode, { id });
|
|
1299
|
+
mirror.add(n, serializedNode);
|
|
1300
|
+
if (id === IGNORED_NODE) {
|
|
1301
|
+
return null;
|
|
1302
|
+
}
|
|
1303
|
+
if (onSerialize) {
|
|
1304
|
+
onSerialize(n);
|
|
1305
|
+
}
|
|
1306
|
+
let recordChild = !skipChild;
|
|
1307
|
+
if (serializedNode.type === types.NodeType$1.Element) {
|
|
1308
|
+
recordChild = recordChild && !serializedNode.needBlock;
|
|
1309
|
+
delete serializedNode.needBlock;
|
|
1310
|
+
const shadowRootEl = types.index.shadowRoot(n);
|
|
1311
|
+
if (shadowRootEl && types.isNativeShadowDom(shadowRootEl))
|
|
1312
|
+
serializedNode.isShadowHost = true;
|
|
1313
|
+
}
|
|
1314
|
+
if ((serializedNode.type === types.NodeType$1.Document || serializedNode.type === types.NodeType$1.Element) && recordChild) {
|
|
1315
|
+
if (slimDOMOptions.headWhitespace && serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "head") {
|
|
1316
|
+
preserveWhiteSpace = false;
|
|
1317
|
+
}
|
|
1318
|
+
const bypassOptions = {
|
|
1319
|
+
doc,
|
|
1320
|
+
mirror,
|
|
1321
|
+
blockClass,
|
|
1322
|
+
blockSelector,
|
|
1323
|
+
needsMask,
|
|
1324
|
+
maskTextClass,
|
|
1325
|
+
maskTextSelector,
|
|
1326
|
+
skipChild,
|
|
1327
|
+
inlineStylesheet,
|
|
1328
|
+
maskInputOptions,
|
|
1329
|
+
maskTextFn,
|
|
1330
|
+
maskInputFn,
|
|
1331
|
+
slimDOMOptions,
|
|
1332
|
+
dataURLOptions,
|
|
1333
|
+
inlineImages,
|
|
1334
|
+
recordCanvas,
|
|
1335
|
+
preserveWhiteSpace,
|
|
1336
|
+
onSerialize,
|
|
1337
|
+
onIframeLoad,
|
|
1338
|
+
iframeLoadTimeout,
|
|
1339
|
+
onStylesheetLoad,
|
|
1340
|
+
stylesheetLoadTimeout,
|
|
1341
|
+
keepIframeSrcFn,
|
|
1342
|
+
depth: depth + 1,
|
|
1343
|
+
maxDepth
|
|
1344
|
+
};
|
|
1345
|
+
if (serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
|
|
1346
|
+
else {
|
|
1347
|
+
for (const childN of Array.from(types.index.childNodes(n))) {
|
|
1348
|
+
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
1349
|
+
if (serializedChildNode) {
|
|
1350
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
1257
1351
|
}
|
|
1258
|
-
return null;
|
|
1259
|
-
}
|
|
1260
|
-
if (!needsMask) {
|
|
1261
|
-
const checkAncestors = needsMask === void 0;
|
|
1262
|
-
needsMask = needMaskingText(
|
|
1263
|
-
n,
|
|
1264
|
-
maskTextClass,
|
|
1265
|
-
maskTextSelector,
|
|
1266
|
-
checkAncestors
|
|
1267
|
-
);
|
|
1268
1352
|
}
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
maskTextFn,
|
|
1278
|
-
maskInputFn,
|
|
1279
|
-
dataURLOptions,
|
|
1280
|
-
inlineImages,
|
|
1281
|
-
recordCanvas,
|
|
1282
|
-
keepIframeSrcFn,
|
|
1283
|
-
newlyAddedElement
|
|
1284
|
-
});
|
|
1285
|
-
if (!_serializedNode) {
|
|
1286
|
-
console.warn(n, "not serialized");
|
|
1287
|
-
return null;
|
|
1288
|
-
}
|
|
1289
|
-
let id;
|
|
1290
|
-
if (mirror.hasNode(n)) {
|
|
1291
|
-
id = mirror.getId(n);
|
|
1292
|
-
} else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === types2.NodeType$1.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
|
|
1293
|
-
id = IGNORED_NODE;
|
|
1294
|
-
} else {
|
|
1295
|
-
id = genId();
|
|
1296
|
-
}
|
|
1297
|
-
const serializedNode = Object.assign(_serializedNode, { id });
|
|
1298
|
-
mirror.add(n, serializedNode);
|
|
1299
|
-
if (id === IGNORED_NODE) {
|
|
1300
|
-
return null;
|
|
1301
|
-
}
|
|
1302
|
-
if (onSerialize) {
|
|
1303
|
-
onSerialize(n);
|
|
1304
|
-
}
|
|
1305
|
-
let recordChild = !skipChild;
|
|
1306
|
-
if (serializedNode.type === types2.NodeType$1.Element) {
|
|
1307
|
-
recordChild = recordChild && !serializedNode.needBlock;
|
|
1308
|
-
delete serializedNode.needBlock;
|
|
1309
|
-
const shadowRootEl = types2.index.shadowRoot(n);
|
|
1310
|
-
if (shadowRootEl && types2.isNativeShadowDom(shadowRootEl))
|
|
1311
|
-
serializedNode.isShadowHost = true;
|
|
1312
|
-
}
|
|
1313
|
-
if ((serializedNode.type === types2.NodeType$1.Document || serializedNode.type === types2.NodeType$1.Element) && recordChild) {
|
|
1314
|
-
if (slimDOMOptions.headWhitespace && serializedNode.type === types2.NodeType$1.Element && serializedNode.tagName === "head") {
|
|
1315
|
-
preserveWhiteSpace = false;
|
|
1353
|
+
}
|
|
1354
|
+
let shadowRootEl = null;
|
|
1355
|
+
if (types.isElement(n) && (shadowRootEl = types.index.shadowRoot(n))) {
|
|
1356
|
+
for (const childN of Array.from(types.index.childNodes(shadowRootEl))) {
|
|
1357
|
+
const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
|
|
1358
|
+
if (serializedChildNode) {
|
|
1359
|
+
types.isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);
|
|
1360
|
+
serializedNode.childNodes.push(serializedChildNode);
|
|
1316
1361
|
}
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
const parent = types.index.parentNode(n);
|
|
1366
|
+
if (parent && types.isShadowRoot(parent) && types.isNativeShadowDom(parent)) {
|
|
1367
|
+
serializedNode.isShadow = true;
|
|
1368
|
+
}
|
|
1369
|
+
if (serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "iframe") {
|
|
1370
|
+
onceIframeLoaded(
|
|
1371
|
+
n,
|
|
1372
|
+
() => {
|
|
1373
|
+
const iframeDoc = n.contentDocument;
|
|
1374
|
+
if (iframeDoc && onIframeLoad) {
|
|
1375
|
+
const serializedIframeNode = serializeNodeWithId(iframeDoc, {
|
|
1376
|
+
doc: iframeDoc,
|
|
1377
|
+
mirror,
|
|
1378
|
+
blockClass,
|
|
1379
|
+
blockSelector,
|
|
1380
|
+
needsMask,
|
|
1381
|
+
maskTextClass,
|
|
1382
|
+
maskTextSelector,
|
|
1383
|
+
skipChild: false,
|
|
1384
|
+
inlineStylesheet,
|
|
1385
|
+
maskInputOptions,
|
|
1386
|
+
maskTextFn,
|
|
1387
|
+
maskInputFn,
|
|
1388
|
+
slimDOMOptions,
|
|
1389
|
+
dataURLOptions,
|
|
1390
|
+
inlineImages,
|
|
1391
|
+
recordCanvas,
|
|
1392
|
+
preserveWhiteSpace,
|
|
1393
|
+
onSerialize,
|
|
1394
|
+
onIframeLoad,
|
|
1395
|
+
iframeLoadTimeout,
|
|
1396
|
+
onStylesheetLoad,
|
|
1397
|
+
stylesheetLoadTimeout,
|
|
1398
|
+
keepIframeSrcFn,
|
|
1399
|
+
depth: depth + 1,
|
|
1400
|
+
maxDepth
|
|
1401
|
+
});
|
|
1402
|
+
if (serializedIframeNode) {
|
|
1403
|
+
onIframeLoad(
|
|
1404
|
+
n,
|
|
1405
|
+
serializedIframeNode
|
|
1406
|
+
);
|
|
1351
1407
|
}
|
|
1352
1408
|
}
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1409
|
+
},
|
|
1410
|
+
iframeLoadTimeout
|
|
1411
|
+
);
|
|
1412
|
+
}
|
|
1413
|
+
if (serializedNode.type === types.NodeType$1.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && types.extractFileExtension(serializedNode.attributes.href) === "css")) {
|
|
1414
|
+
onceStylesheetLoaded(
|
|
1415
|
+
n,
|
|
1416
|
+
() => {
|
|
1417
|
+
if (onStylesheetLoad) {
|
|
1418
|
+
const serializedLinkNode = serializeNodeWithId(n, {
|
|
1419
|
+
doc,
|
|
1420
|
+
mirror,
|
|
1421
|
+
blockClass,
|
|
1422
|
+
blockSelector,
|
|
1423
|
+
needsMask,
|
|
1424
|
+
maskTextClass,
|
|
1425
|
+
maskTextSelector,
|
|
1426
|
+
skipChild: false,
|
|
1427
|
+
inlineStylesheet,
|
|
1428
|
+
maskInputOptions,
|
|
1429
|
+
maskTextFn,
|
|
1430
|
+
maskInputFn,
|
|
1431
|
+
slimDOMOptions,
|
|
1432
|
+
dataURLOptions,
|
|
1433
|
+
inlineImages,
|
|
1434
|
+
recordCanvas,
|
|
1435
|
+
preserveWhiteSpace,
|
|
1436
|
+
onSerialize,
|
|
1437
|
+
onIframeLoad,
|
|
1438
|
+
iframeLoadTimeout,
|
|
1439
|
+
onStylesheetLoad,
|
|
1440
|
+
stylesheetLoadTimeout,
|
|
1441
|
+
keepIframeSrcFn,
|
|
1442
|
+
depth,
|
|
1443
|
+
maxDepth
|
|
1444
|
+
});
|
|
1445
|
+
if (serializedLinkNode) {
|
|
1446
|
+
onStylesheetLoad(
|
|
1447
|
+
n,
|
|
1448
|
+
serializedLinkNode
|
|
1449
|
+
);
|
|
1361
1450
|
}
|
|
1362
1451
|
}
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
headMetaVerification: true,
|
|
1468
|
-
headMetaAuthorship: slimDOM === "all",
|
|
1469
|
-
headMetaDescKeywords: slimDOM === "all",
|
|
1470
|
-
headTitleMutations: slimDOM === "all"
|
|
1471
|
-
};
|
|
1472
|
-
}
|
|
1473
|
-
if (slimDOM === false) {
|
|
1474
|
-
return {};
|
|
1475
|
-
}
|
|
1476
|
-
return slimDOM;
|
|
1477
|
-
}
|
|
1478
|
-
function snapshot(n, options) {
|
|
1479
|
-
const {
|
|
1480
|
-
mirror = new types2.Mirror(),
|
|
1481
|
-
blockClass = "rr-block",
|
|
1482
|
-
blockSelector = null,
|
|
1483
|
-
maskTextClass = "rr-mask",
|
|
1484
|
-
maskTextSelector = null,
|
|
1485
|
-
inlineStylesheet = true,
|
|
1486
|
-
inlineImages = false,
|
|
1487
|
-
recordCanvas = false,
|
|
1488
|
-
maskAllInputs = false,
|
|
1489
|
-
maskTextFn,
|
|
1490
|
-
maskInputFn,
|
|
1491
|
-
slimDOM = false,
|
|
1492
|
-
dataURLOptions,
|
|
1493
|
-
preserveWhiteSpace,
|
|
1494
|
-
onSerialize,
|
|
1495
|
-
onIframeLoad,
|
|
1496
|
-
iframeLoadTimeout,
|
|
1497
|
-
onStylesheetLoad,
|
|
1498
|
-
stylesheetLoadTimeout,
|
|
1499
|
-
keepIframeSrcFn = () => false,
|
|
1500
|
-
maxDepth
|
|
1501
|
-
} = options || {};
|
|
1502
|
-
const maskInputOptions = maskAllInputs === true ? {
|
|
1503
|
-
color: true,
|
|
1504
|
-
date: true,
|
|
1505
|
-
"datetime-local": true,
|
|
1506
|
-
email: true,
|
|
1507
|
-
month: true,
|
|
1508
|
-
number: true,
|
|
1509
|
-
range: true,
|
|
1510
|
-
search: true,
|
|
1511
|
-
tel: true,
|
|
1512
|
-
text: true,
|
|
1513
|
-
time: true,
|
|
1514
|
-
url: true,
|
|
1515
|
-
week: true,
|
|
1516
|
-
textarea: true,
|
|
1517
|
-
select: true,
|
|
1518
|
-
password: true
|
|
1519
|
-
} : maskAllInputs === false ? {
|
|
1520
|
-
password: true
|
|
1521
|
-
} : maskAllInputs;
|
|
1522
|
-
const slimDOMOptions = slimDOMDefaults(slimDOM);
|
|
1523
|
-
return serializeNodeWithId(n, {
|
|
1524
|
-
doc: n,
|
|
1525
|
-
mirror,
|
|
1526
|
-
blockClass,
|
|
1527
|
-
blockSelector,
|
|
1528
|
-
maskTextClass,
|
|
1529
|
-
maskTextSelector,
|
|
1530
|
-
skipChild: false,
|
|
1531
|
-
inlineStylesheet,
|
|
1532
|
-
maskInputOptions,
|
|
1533
|
-
maskTextFn,
|
|
1534
|
-
maskInputFn,
|
|
1535
|
-
slimDOMOptions,
|
|
1536
|
-
dataURLOptions,
|
|
1537
|
-
inlineImages,
|
|
1538
|
-
recordCanvas,
|
|
1539
|
-
preserveWhiteSpace,
|
|
1540
|
-
onSerialize,
|
|
1541
|
-
onIframeLoad,
|
|
1542
|
-
iframeLoadTimeout,
|
|
1543
|
-
onStylesheetLoad,
|
|
1544
|
-
stylesheetLoadTimeout,
|
|
1545
|
-
keepIframeSrcFn,
|
|
1546
|
-
newlyAddedElement: false,
|
|
1547
|
-
maxDepth
|
|
1548
|
-
});
|
|
1452
|
+
},
|
|
1453
|
+
stylesheetLoadTimeout
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
return serializedNode;
|
|
1457
|
+
}
|
|
1458
|
+
function slimDOMDefaults(slimDOM) {
|
|
1459
|
+
if (slimDOM === true || slimDOM === "all") {
|
|
1460
|
+
return {
|
|
1461
|
+
script: true,
|
|
1462
|
+
comment: true,
|
|
1463
|
+
headFavicon: true,
|
|
1464
|
+
headWhitespace: true,
|
|
1465
|
+
headMetaSocial: true,
|
|
1466
|
+
headMetaRobots: true,
|
|
1467
|
+
headMetaHttpEquiv: true,
|
|
1468
|
+
headMetaVerification: true,
|
|
1469
|
+
headMetaAuthorship: slimDOM === "all",
|
|
1470
|
+
headMetaDescKeywords: slimDOM === "all",
|
|
1471
|
+
headTitleMutations: slimDOM === "all"
|
|
1472
|
+
};
|
|
1473
|
+
}
|
|
1474
|
+
if (slimDOM === false) {
|
|
1475
|
+
return {};
|
|
1476
|
+
}
|
|
1477
|
+
return slimDOM;
|
|
1478
|
+
}
|
|
1479
|
+
function snapshot(n, options) {
|
|
1480
|
+
const {
|
|
1481
|
+
mirror = new types.Mirror(),
|
|
1482
|
+
blockClass = "rr-block",
|
|
1483
|
+
blockSelector = null,
|
|
1484
|
+
maskTextClass = "rr-mask",
|
|
1485
|
+
maskTextSelector = null,
|
|
1486
|
+
inlineStylesheet = true,
|
|
1487
|
+
inlineImages = false,
|
|
1488
|
+
recordCanvas = false,
|
|
1489
|
+
maskAllInputs = false,
|
|
1490
|
+
maskTextFn,
|
|
1491
|
+
maskInputFn,
|
|
1492
|
+
slimDOM = false,
|
|
1493
|
+
dataURLOptions,
|
|
1494
|
+
preserveWhiteSpace,
|
|
1495
|
+
onSerialize,
|
|
1496
|
+
onIframeLoad,
|
|
1497
|
+
iframeLoadTimeout,
|
|
1498
|
+
onStylesheetLoad,
|
|
1499
|
+
stylesheetLoadTimeout,
|
|
1500
|
+
keepIframeSrcFn = () => false,
|
|
1501
|
+
maxDepth
|
|
1502
|
+
} = options || {};
|
|
1503
|
+
const maskInputOptions = maskAllInputs === true ? {
|
|
1504
|
+
color: true,
|
|
1505
|
+
date: true,
|
|
1506
|
+
"datetime-local": true,
|
|
1507
|
+
email: true,
|
|
1508
|
+
month: true,
|
|
1509
|
+
number: true,
|
|
1510
|
+
range: true,
|
|
1511
|
+
search: true,
|
|
1512
|
+
tel: true,
|
|
1513
|
+
text: true,
|
|
1514
|
+
time: true,
|
|
1515
|
+
url: true,
|
|
1516
|
+
week: true,
|
|
1517
|
+
textarea: true,
|
|
1518
|
+
select: true,
|
|
1519
|
+
password: true
|
|
1520
|
+
} : maskAllInputs === false ? {
|
|
1521
|
+
password: true
|
|
1522
|
+
} : maskAllInputs;
|
|
1523
|
+
const slimDOMOptions = slimDOMDefaults(slimDOM);
|
|
1524
|
+
return serializeNodeWithId(n, {
|
|
1525
|
+
doc: n,
|
|
1526
|
+
mirror,
|
|
1527
|
+
blockClass,
|
|
1528
|
+
blockSelector,
|
|
1529
|
+
maskTextClass,
|
|
1530
|
+
maskTextSelector,
|
|
1531
|
+
skipChild: false,
|
|
1532
|
+
inlineStylesheet,
|
|
1533
|
+
maskInputOptions,
|
|
1534
|
+
maskTextFn,
|
|
1535
|
+
maskInputFn,
|
|
1536
|
+
slimDOMOptions,
|
|
1537
|
+
dataURLOptions,
|
|
1538
|
+
inlineImages,
|
|
1539
|
+
recordCanvas,
|
|
1540
|
+
preserveWhiteSpace,
|
|
1541
|
+
onSerialize,
|
|
1542
|
+
onIframeLoad,
|
|
1543
|
+
iframeLoadTimeout,
|
|
1544
|
+
onStylesheetLoad,
|
|
1545
|
+
stylesheetLoadTimeout,
|
|
1546
|
+
keepIframeSrcFn,
|
|
1547
|
+
newlyAddedElement: false,
|
|
1548
|
+
maxDepth
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
function visitSnapshot(node, onVisit) {
|
|
1552
|
+
function walk(current) {
|
|
1553
|
+
onVisit(current);
|
|
1554
|
+
if (current.type === types.NodeType$1.Document || current.type === types.NodeType$1.Element) {
|
|
1555
|
+
current.childNodes.forEach(walk);
|
|
1549
1556
|
}
|
|
1550
|
-
function visitSnapshot(node, onVisit) {
|
|
1551
|
-
function walk(current) {
|
|
1552
|
-
onVisit(current);
|
|
1553
|
-
if (current.type === types2.NodeType$1.Document || current.type === types2.NodeType$1.Element) {
|
|
1554
|
-
current.childNodes.forEach(walk);
|
|
1555
|
-
}
|
|
1556
|
-
}
|
|
1557
|
-
walk(node);
|
|
1558
|
-
}
|
|
1559
|
-
function cleanupSnapshot() {
|
|
1560
|
-
_id = 1;
|
|
1561
|
-
}
|
|
1562
|
-
exports2.DEFAULT_MAX_DEPTH = DEFAULT_MAX_DEPTH;
|
|
1563
|
-
exports2.IGNORED_NODE = IGNORED_NODE;
|
|
1564
|
-
exports2.classMatchesRegex = classMatchesRegex;
|
|
1565
|
-
exports2.cleanupSnapshot = cleanupSnapshot;
|
|
1566
|
-
exports2.genId = genId;
|
|
1567
|
-
exports2.ignoreAttribute = ignoreAttribute;
|
|
1568
|
-
exports2.needMaskingText = needMaskingText;
|
|
1569
|
-
exports2.resetMaxDepthState = resetMaxDepthState;
|
|
1570
|
-
exports2.serializeNodeWithId = serializeNodeWithId;
|
|
1571
|
-
exports2.slimDOMDefaults = slimDOMDefaults;
|
|
1572
|
-
exports2.snapshot = snapshot;
|
|
1573
|
-
exports2.transformAttribute = transformAttribute;
|
|
1574
|
-
exports2.visitSnapshot = visitSnapshot;
|
|
1575
|
-
exports2.wasMaxDepthReached = wasMaxDepthReached;
|
|
1576
1557
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
var types = require_types_B7TTv7Jc();
|
|
1583
|
-
exports.DEFAULT_MAX_DEPTH = record.DEFAULT_MAX_DEPTH;
|
|
1584
|
-
exports.IGNORED_NODE = record.IGNORED_NODE;
|
|
1585
|
-
exports.classMatchesRegex = record.classMatchesRegex;
|
|
1586
|
-
exports.cleanupSnapshot = record.cleanupSnapshot;
|
|
1587
|
-
exports.genId = record.genId;
|
|
1588
|
-
exports.ignoreAttribute = record.ignoreAttribute;
|
|
1589
|
-
exports.needMaskingText = record.needMaskingText;
|
|
1590
|
-
exports.serializeNodeWithId = record.serializeNodeWithId;
|
|
1591
|
-
exports.snapshot = record.snapshot;
|
|
1592
|
-
exports.transformAttribute = record.transformAttribute;
|
|
1593
|
-
exports.visitSnapshot = record.visitSnapshot;
|
|
1594
|
-
exports.wasMaxDepthReached = record.wasMaxDepthReached;
|
|
1558
|
+
walk(node);
|
|
1559
|
+
}
|
|
1560
|
+
function cleanupSnapshot() {
|
|
1561
|
+
_id = 1;
|
|
1562
|
+
}
|
|
1595
1563
|
exports.Mirror = types.Mirror;
|
|
1596
1564
|
exports.NodeType = types.NodeType;
|
|
1597
1565
|
exports.absolutifyURLs = types.absolutifyURLs;
|
|
@@ -1613,6 +1581,20 @@ exports.recompressBase64Image = types.recompressBase64Image;
|
|
|
1613
1581
|
exports.stringifyRule = types.stringifyRule;
|
|
1614
1582
|
exports.stringifyStylesheet = types.stringifyStylesheet;
|
|
1615
1583
|
exports.toLowerCase = types.toLowerCase;
|
|
1584
|
+
exports.DEFAULT_MAX_DEPTH = DEFAULT_MAX_DEPTH;
|
|
1585
|
+
exports.IGNORED_NODE = IGNORED_NODE;
|
|
1586
|
+
exports.classMatchesRegex = classMatchesRegex;
|
|
1587
|
+
exports.cleanupSnapshot = cleanupSnapshot;
|
|
1588
|
+
exports.genId = genId;
|
|
1589
|
+
exports.ignoreAttribute = ignoreAttribute;
|
|
1590
|
+
exports.needMaskingText = needMaskingText;
|
|
1591
|
+
exports.resetMaxDepthState = resetMaxDepthState;
|
|
1592
|
+
exports.serializeNodeWithId = serializeNodeWithId;
|
|
1593
|
+
exports.slimDOMDefaults = slimDOMDefaults;
|
|
1594
|
+
exports.snapshot = snapshot;
|
|
1595
|
+
exports.transformAttribute = transformAttribute;
|
|
1596
|
+
exports.visitSnapshot = visitSnapshot;
|
|
1597
|
+
exports.wasMaxDepthReached = wasMaxDepthReached;
|
|
1616
1598
|
;if (typeof module.exports == "object" && typeof exports == "object") {
|
|
1617
1599
|
var __cp = (to, from, except, desc) => {
|
|
1618
1600
|
if ((from && typeof from === "object") || typeof from === "function") {
|