@posthog/rrweb 0.0.37 → 0.0.39

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/rrweb.js CHANGED
@@ -14,20 +14,20 @@ var NodeType$1$1 = /* @__PURE__ */ ((NodeType2) => {
14
14
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
15
15
  return NodeType2;
16
16
  })(NodeType$1$1 || {});
17
- const testableAccessors$1 = {
17
+ const testableAccessors$2 = {
18
18
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
19
19
  ShadowRoot: ["host", "styleSheets"],
20
20
  Element: ["shadowRoot", "querySelector", "querySelectorAll"],
21
21
  MutationObserver: []
22
22
  };
23
- const testableMethods$1 = {
23
+ const testableMethods$2 = {
24
24
  Node: ["contains", "getRootNode"],
25
25
  ShadowRoot: ["getSelection"],
26
26
  Element: [],
27
27
  MutationObserver: ["constructor"]
28
28
  };
29
- const untaintedBasePrototype$1 = {};
30
- function angularZoneUnpatchedAlternative$1(key) {
29
+ const untaintedBasePrototype$2 = {};
30
+ function angularZoneUnpatchedAlternative$2(key) {
31
31
  var _a2, _b;
32
32
  const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
33
33
  if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
@@ -36,12 +36,12 @@ function angularZoneUnpatchedAlternative$1(key) {
36
36
  return void 0;
37
37
  }
38
38
  }
39
- function getUntaintedPrototype$1(key) {
40
- if (untaintedBasePrototype$1[key])
41
- return untaintedBasePrototype$1[key];
42
- const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
39
+ function getUntaintedPrototype$2(key) {
40
+ if (untaintedBasePrototype$2[key])
41
+ return untaintedBasePrototype$2[key];
42
+ const candidate = angularZoneUnpatchedAlternative$2(key) || globalThis[key];
43
43
  const defaultPrototype = candidate.prototype;
44
- const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
44
+ const accessorNames = key in testableAccessors$2 ? testableAccessors$2[key] : void 0;
45
45
  const isUntaintedAccessors = Boolean(
46
46
  accessorNames && // @ts-expect-error 2345
47
47
  accessorNames.every(
@@ -53,7 +53,7 @@ function getUntaintedPrototype$1(key) {
53
53
  }
54
54
  )
55
55
  );
56
- const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
56
+ const methodNames = key in testableMethods$2 ? testableMethods$2[key] : void 0;
57
57
  const isUntaintedMethods = Boolean(
58
58
  methodNames && methodNames.every(
59
59
  // @ts-expect-error 2345
@@ -64,7 +64,7 @@ function getUntaintedPrototype$1(key) {
64
64
  )
65
65
  );
66
66
  if (isUntaintedAccessors && isUntaintedMethods) {
67
- untaintedBasePrototype$1[key] = candidate.prototype;
67
+ untaintedBasePrototype$2[key] = candidate.prototype;
68
68
  return candidate.prototype;
69
69
  }
70
70
  try {
@@ -75,80 +75,80 @@ function getUntaintedPrototype$1(key) {
75
75
  const untaintedObject = win[key].prototype;
76
76
  document.body.removeChild(iframeEl);
77
77
  if (!untaintedObject) return defaultPrototype;
78
- return untaintedBasePrototype$1[key] = untaintedObject;
78
+ return untaintedBasePrototype$2[key] = untaintedObject;
79
79
  } catch {
80
80
  return defaultPrototype;
81
81
  }
82
82
  }
83
- const untaintedAccessorCache$1 = {};
84
- function getUntaintedAccessor$1(key, instance, accessor) {
83
+ const untaintedAccessorCache$2 = {};
84
+ function getUntaintedAccessor$2(key, instance, accessor) {
85
85
  var _a2;
86
86
  const cacheKey = `${key}.${String(accessor)}`;
87
- if (untaintedAccessorCache$1[cacheKey])
88
- return untaintedAccessorCache$1[cacheKey].call(
87
+ if (untaintedAccessorCache$2[cacheKey])
88
+ return untaintedAccessorCache$2[cacheKey].call(
89
89
  instance
90
90
  );
91
- const untaintedPrototype = getUntaintedPrototype$1(key);
91
+ const untaintedPrototype = getUntaintedPrototype$2(key);
92
92
  const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
93
93
  untaintedPrototype,
94
94
  accessor
95
95
  )) == null ? void 0 : _a2.get;
96
96
  if (!untaintedAccessor) return instance[accessor];
97
- untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
97
+ untaintedAccessorCache$2[cacheKey] = untaintedAccessor;
98
98
  return untaintedAccessor.call(instance);
99
99
  }
100
- const untaintedMethodCache$1 = {};
101
- function getUntaintedMethod$1(key, instance, method) {
100
+ const untaintedMethodCache$2 = {};
101
+ function getUntaintedMethod$2(key, instance, method) {
102
102
  const cacheKey = `${key}.${String(method)}`;
103
- if (untaintedMethodCache$1[cacheKey])
104
- return untaintedMethodCache$1[cacheKey].bind(
103
+ if (untaintedMethodCache$2[cacheKey])
104
+ return untaintedMethodCache$2[cacheKey].bind(
105
105
  instance
106
106
  );
107
- const untaintedPrototype = getUntaintedPrototype$1(key);
107
+ const untaintedPrototype = getUntaintedPrototype$2(key);
108
108
  const untaintedMethod = untaintedPrototype[method];
109
109
  if (typeof untaintedMethod !== "function") return instance[method];
110
- untaintedMethodCache$1[cacheKey] = untaintedMethod;
110
+ untaintedMethodCache$2[cacheKey] = untaintedMethod;
111
111
  return untaintedMethod.bind(instance);
112
112
  }
113
- function childNodes$1(n2) {
114
- return getUntaintedAccessor$1("Node", n2, "childNodes");
113
+ function childNodes$2(n2) {
114
+ return getUntaintedAccessor$2("Node", n2, "childNodes");
115
115
  }
116
- function parentNode$1(n2) {
117
- return getUntaintedAccessor$1("Node", n2, "parentNode");
116
+ function parentNode$2(n2) {
117
+ return getUntaintedAccessor$2("Node", n2, "parentNode");
118
118
  }
119
- function parentElement$1(n2) {
120
- return getUntaintedAccessor$1("Node", n2, "parentElement");
119
+ function parentElement$2(n2) {
120
+ return getUntaintedAccessor$2("Node", n2, "parentElement");
121
121
  }
122
- function textContent$1(n2) {
123
- return getUntaintedAccessor$1("Node", n2, "textContent");
122
+ function textContent$2(n2) {
123
+ return getUntaintedAccessor$2("Node", n2, "textContent");
124
124
  }
125
- function contains$1(n2, other) {
126
- return getUntaintedMethod$1("Node", n2, "contains")(other);
125
+ function contains$2(n2, other) {
126
+ return getUntaintedMethod$2("Node", n2, "contains")(other);
127
127
  }
128
- function getRootNode$1(n2) {
129
- return getUntaintedMethod$1("Node", n2, "getRootNode")();
128
+ function getRootNode$2(n2) {
129
+ return getUntaintedMethod$2("Node", n2, "getRootNode")();
130
130
  }
131
- function host$1(n2) {
131
+ function host$2(n2) {
132
132
  if (!n2 || !("host" in n2)) return null;
133
- return getUntaintedAccessor$1("ShadowRoot", n2, "host");
133
+ return getUntaintedAccessor$2("ShadowRoot", n2, "host");
134
134
  }
135
- function styleSheets$1(n2) {
135
+ function styleSheets$2(n2) {
136
136
  return n2.styleSheets;
137
137
  }
138
- function shadowRoot$1(n2) {
138
+ function shadowRoot$2(n2) {
139
139
  if (!n2 || !("shadowRoot" in n2)) return null;
140
- return getUntaintedAccessor$1("Element", n2, "shadowRoot");
140
+ return getUntaintedAccessor$2("Element", n2, "shadowRoot");
141
141
  }
142
- function querySelector$1(n2, selectors) {
143
- return getUntaintedAccessor$1("Element", n2, "querySelector")(selectors);
142
+ function querySelector$2(n2, selectors) {
143
+ return getUntaintedAccessor$2("Element", n2, "querySelector")(selectors);
144
144
  }
145
- function querySelectorAll$1(n2, selectors) {
146
- return getUntaintedAccessor$1("Element", n2, "querySelectorAll")(selectors);
145
+ function querySelectorAll$2(n2, selectors) {
146
+ return getUntaintedAccessor$2("Element", n2, "querySelectorAll")(selectors);
147
147
  }
148
- function mutationObserverCtor$1() {
149
- return getUntaintedPrototype$1("MutationObserver").constructor;
148
+ function mutationObserverCtor$2() {
149
+ return getUntaintedPrototype$2("MutationObserver").constructor;
150
150
  }
151
- function patch$1(source, name, replacement) {
151
+ function patch$2(source, name, replacement) {
152
152
  try {
153
153
  if (!(name in source)) {
154
154
  return () => {
@@ -174,32 +174,32 @@ function patch$1(source, name, replacement) {
174
174
  };
175
175
  }
176
176
  }
177
- const index$1 = {
178
- childNodes: childNodes$1,
179
- parentNode: parentNode$1,
180
- parentElement: parentElement$1,
181
- textContent: textContent$1,
182
- contains: contains$1,
183
- getRootNode: getRootNode$1,
184
- host: host$1,
185
- styleSheets: styleSheets$1,
186
- shadowRoot: shadowRoot$1,
187
- querySelector: querySelector$1,
188
- querySelectorAll: querySelectorAll$1,
189
- mutationObserver: mutationObserverCtor$1,
190
- patch: patch$1
177
+ const index$2 = {
178
+ childNodes: childNodes$2,
179
+ parentNode: parentNode$2,
180
+ parentElement: parentElement$2,
181
+ textContent: textContent$2,
182
+ contains: contains$2,
183
+ getRootNode: getRootNode$2,
184
+ host: host$2,
185
+ styleSheets: styleSheets$2,
186
+ shadowRoot: shadowRoot$2,
187
+ querySelector: querySelector$2,
188
+ querySelectorAll: querySelectorAll$2,
189
+ mutationObserver: mutationObserverCtor$2,
190
+ patch: patch$2
191
191
  };
192
- function isElement(n2) {
192
+ function isElement$1(n2) {
193
193
  return n2.nodeType === n2.ELEMENT_NODE;
194
194
  }
195
195
  function isShadowRoot(n2) {
196
196
  const hostEl = (
197
197
  // anchor and textarea elements also have a `host` property
198
198
  // but only shadow roots have a `mode` property
199
- n2 && "host" in n2 && "mode" in n2 && index$1.host(n2) || null
199
+ n2 && "host" in n2 && "mode" in n2 && index$2.host(n2) || null
200
200
  );
201
201
  return Boolean(
202
- hostEl && "shadowRoot" in hostEl && index$1.shadowRoot(hostEl) === n2
202
+ hostEl && "shadowRoot" in hostEl && index$2.shadowRoot(hostEl) === n2
203
203
  );
204
204
  }
205
205
  function isNativeShadowDom(shadowRoot2) {
@@ -320,6 +320,17 @@ class Mirror {
320
320
  (childNode) => this.removeNodeFromMap(childNode)
321
321
  );
322
322
  }
323
+ if (isElement$1(n2)) {
324
+ const shadowRootEl = index$2.shadowRoot(n2);
325
+ if (shadowRootEl) {
326
+ this.removeNodeFromMap(shadowRootEl);
327
+ }
328
+ if (n2.nodeName === "IFRAME" && n2.contentDocument) {
329
+ this.removeNodeFromMap(
330
+ n2.contentDocument
331
+ );
332
+ }
333
+ }
323
334
  }
324
335
  has(id) {
325
336
  return this.idNodeMap.has(id);
@@ -667,7 +678,7 @@ function classMatchesRegex(node2, regex, checkAncestors) {
667
678
  if (!node2) return false;
668
679
  if (node2.nodeType !== node2.ELEMENT_NODE) {
669
680
  if (!checkAncestors) return false;
670
- return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);
681
+ return classMatchesRegex(index$2.parentNode(node2), regex, checkAncestors);
671
682
  }
672
683
  for (let eIndex = node2.classList.length; eIndex--; ) {
673
684
  const className = node2.classList[eIndex];
@@ -676,19 +687,19 @@ function classMatchesRegex(node2, regex, checkAncestors) {
676
687
  }
677
688
  }
678
689
  if (!checkAncestors) return false;
679
- return classMatchesRegex(index$1.parentNode(node2), regex, checkAncestors);
690
+ return classMatchesRegex(index$2.parentNode(node2), regex, checkAncestors);
680
691
  }
681
692
  function needMaskingText(node2, maskTextClass, maskTextSelector, checkAncestors) {
682
693
  let el;
683
- if (isElement(node2)) {
694
+ if (isElement$1(node2)) {
684
695
  el = node2;
685
- if (!index$1.childNodes(el).length) {
696
+ if (!index$2.childNodes(el).length) {
686
697
  return false;
687
698
  }
688
- } else if (index$1.parentElement(node2) === null) {
699
+ } else if (index$2.parentElement(node2) === null) {
689
700
  return false;
690
701
  } else {
691
- el = index$1.parentElement(node2);
702
+ el = index$2.parentElement(node2);
692
703
  }
693
704
  try {
694
705
  if (typeof maskTextClass === "string") {
@@ -837,7 +848,7 @@ function serializeNode(n2, options) {
837
848
  case n2.COMMENT_NODE:
838
849
  return {
839
850
  type: NodeType$1$1.Comment,
840
- textContent: index$1.textContent(n2) || "",
851
+ textContent: index$2.textContent(n2) || "",
841
852
  rootId
842
853
  };
843
854
  default:
@@ -852,9 +863,9 @@ function getRootId(doc, mirror2) {
852
863
  function serializeTextNode(n2, options) {
853
864
  var _a2;
854
865
  const { needsMask, maskTextFn, rootId } = options;
855
- const parent = index$1.parentNode(n2);
866
+ const parent = index$2.parentNode(n2);
856
867
  const parentTagName = parent && parent.tagName;
857
- let text = index$1.textContent(n2);
868
+ let text = index$2.textContent(n2);
858
869
  const isStyle = parentTagName === "STYLE" ? true : void 0;
859
870
  const isScript = parentTagName === "SCRIPT" ? true : void 0;
860
871
  if (isStyle && text) {
@@ -875,7 +886,7 @@ function serializeTextNode(n2, options) {
875
886
  text = "SCRIPT_PLACEHOLDER";
876
887
  }
877
888
  if (!isStyle && !isScript && text && needsMask) {
878
- text = maskTextFn ? maskTextFn(text, index$1.parentElement(n2)) : text.replace(/[\S]/g, "*");
889
+ text = maskTextFn ? maskTextFn(text, index$2.parentElement(n2)) : text.replace(/[\S]/g, "*");
879
890
  }
880
891
  return {
881
892
  type: NodeType$1$1.Text,
@@ -945,7 +956,7 @@ function serializeElementNode(n2, options) {
945
956
  }
946
957
  }
947
958
  if (tagName === "style" && n2.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
948
- !(n2.innerText || index$1.textContent(n2) || "").trim().length) {
959
+ !(n2.innerText || index$2.textContent(n2) || "").trim().length) {
949
960
  const cssText = stringifyStylesheet(
950
961
  n2.sheet
951
962
  );
@@ -1211,7 +1222,7 @@ function serializeNodeWithId(n2, options) {
1211
1222
  if (serializedNode.type === NodeType$1$1.Element) {
1212
1223
  recordChild = recordChild && !serializedNode.needBlock;
1213
1224
  delete serializedNode.needBlock;
1214
- const shadowRootEl = index$1.shadowRoot(n2);
1225
+ const shadowRootEl = index$2.shadowRoot(n2);
1215
1226
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
1216
1227
  serializedNode.isShadowHost = true;
1217
1228
  }
@@ -1246,7 +1257,7 @@ function serializeNodeWithId(n2, options) {
1246
1257
  };
1247
1258
  if (serializedNode.type === NodeType$1$1.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1248
1259
  else {
1249
- for (const childN of Array.from(index$1.childNodes(n2))) {
1260
+ for (const childN of Array.from(index$2.childNodes(n2))) {
1250
1261
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1251
1262
  if (serializedChildNode) {
1252
1263
  serializedNode.childNodes.push(serializedChildNode);
@@ -1254,8 +1265,8 @@ function serializeNodeWithId(n2, options) {
1254
1265
  }
1255
1266
  }
1256
1267
  let shadowRootEl = null;
1257
- if (isElement(n2) && (shadowRootEl = index$1.shadowRoot(n2))) {
1258
- for (const childN of Array.from(index$1.childNodes(shadowRootEl))) {
1268
+ if (isElement$1(n2) && (shadowRootEl = index$2.shadowRoot(n2))) {
1269
+ for (const childN of Array.from(index$2.childNodes(shadowRootEl))) {
1259
1270
  const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1260
1271
  if (serializedChildNode) {
1261
1272
  isNativeShadowDom(shadowRootEl) && (serializedChildNode.isShadow = true);
@@ -1264,7 +1275,7 @@ function serializeNodeWithId(n2, options) {
1264
1275
  }
1265
1276
  }
1266
1277
  }
1267
- const parent = index$1.parentNode(n2);
1278
+ const parent = index$2.parentNode(n2);
1268
1279
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
1269
1280
  serializedNode.isShadow = true;
1270
1281
  }
@@ -5716,7 +5727,7 @@ function buildNodeWithSN(n2, options) {
5716
5727
  console.warn("Failed to rebuild", childN);
5717
5728
  continue;
5718
5729
  }
5719
- if (childN.isShadow && isElement(node2) && node2.shadowRoot) {
5730
+ if (childN.isShadow && isElement$1(node2) && node2.shadowRoot) {
5720
5731
  node2.shadowRoot.appendChild(childNode);
5721
5732
  } else if (n2.type === NodeType$1$1.Document && childN.type == NodeType$1$1.Element) {
5722
5733
  const htmlElement = childNode;
@@ -5807,6 +5818,184 @@ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "
5807
5818
  var __defProp22 = Object.defineProperty;
5808
5819
  var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5809
5820
  var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
5821
+ const testableAccessors$1 = {
5822
+ Node: ["childNodes", "parentNode", "parentElement", "textContent"],
5823
+ ShadowRoot: ["host", "styleSheets"],
5824
+ Element: ["shadowRoot", "querySelector", "querySelectorAll"],
5825
+ MutationObserver: []
5826
+ };
5827
+ const testableMethods$1 = {
5828
+ Node: ["contains", "getRootNode"],
5829
+ ShadowRoot: ["getSelection"],
5830
+ Element: [],
5831
+ MutationObserver: ["constructor"]
5832
+ };
5833
+ const untaintedBasePrototype$1 = {};
5834
+ function angularZoneUnpatchedAlternative$1(key) {
5835
+ var _a2, _b;
5836
+ const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
5837
+ if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
5838
+ return globalThis[angularUnpatchedVersionSymbol];
5839
+ } else {
5840
+ return void 0;
5841
+ }
5842
+ }
5843
+ function getUntaintedPrototype$1(key) {
5844
+ if (untaintedBasePrototype$1[key])
5845
+ return untaintedBasePrototype$1[key];
5846
+ const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
5847
+ const defaultPrototype = candidate.prototype;
5848
+ const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
5849
+ const isUntaintedAccessors = Boolean(
5850
+ accessorNames && // @ts-expect-error 2345
5851
+ accessorNames.every(
5852
+ (accessor) => {
5853
+ var _a2, _b;
5854
+ return Boolean(
5855
+ (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes("[native code]")
5856
+ );
5857
+ }
5858
+ )
5859
+ );
5860
+ const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
5861
+ const isUntaintedMethods = Boolean(
5862
+ methodNames && methodNames.every(
5863
+ // @ts-expect-error 2345
5864
+ (method) => {
5865
+ var _a2;
5866
+ return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));
5867
+ }
5868
+ )
5869
+ );
5870
+ if (isUntaintedAccessors && isUntaintedMethods) {
5871
+ untaintedBasePrototype$1[key] = candidate.prototype;
5872
+ return candidate.prototype;
5873
+ }
5874
+ try {
5875
+ const iframeEl = document.createElement("iframe");
5876
+ document.body.appendChild(iframeEl);
5877
+ const win = iframeEl.contentWindow;
5878
+ if (!win) return candidate.prototype;
5879
+ const untaintedObject = win[key].prototype;
5880
+ document.body.removeChild(iframeEl);
5881
+ if (!untaintedObject) return defaultPrototype;
5882
+ return untaintedBasePrototype$1[key] = untaintedObject;
5883
+ } catch {
5884
+ return defaultPrototype;
5885
+ }
5886
+ }
5887
+ const untaintedAccessorCache$1 = {};
5888
+ function getUntaintedAccessor$1(key, instance, accessor) {
5889
+ var _a2;
5890
+ const cacheKey = `${key}.${String(accessor)}`;
5891
+ if (untaintedAccessorCache$1[cacheKey])
5892
+ return untaintedAccessorCache$1[cacheKey].call(
5893
+ instance
5894
+ );
5895
+ const untaintedPrototype = getUntaintedPrototype$1(key);
5896
+ const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
5897
+ untaintedPrototype,
5898
+ accessor
5899
+ )) == null ? void 0 : _a2.get;
5900
+ if (!untaintedAccessor) return instance[accessor];
5901
+ untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
5902
+ return untaintedAccessor.call(instance);
5903
+ }
5904
+ const untaintedMethodCache$1 = {};
5905
+ function getUntaintedMethod$1(key, instance, method) {
5906
+ const cacheKey = `${key}.${String(method)}`;
5907
+ if (untaintedMethodCache$1[cacheKey])
5908
+ return untaintedMethodCache$1[cacheKey].bind(
5909
+ instance
5910
+ );
5911
+ const untaintedPrototype = getUntaintedPrototype$1(key);
5912
+ const untaintedMethod = untaintedPrototype[method];
5913
+ if (typeof untaintedMethod !== "function") return instance[method];
5914
+ untaintedMethodCache$1[cacheKey] = untaintedMethod;
5915
+ return untaintedMethod.bind(instance);
5916
+ }
5917
+ function childNodes$1(n2) {
5918
+ return getUntaintedAccessor$1("Node", n2, "childNodes");
5919
+ }
5920
+ function parentNode$1(n2) {
5921
+ return getUntaintedAccessor$1("Node", n2, "parentNode");
5922
+ }
5923
+ function parentElement$1(n2) {
5924
+ return getUntaintedAccessor$1("Node", n2, "parentElement");
5925
+ }
5926
+ function textContent$1(n2) {
5927
+ return getUntaintedAccessor$1("Node", n2, "textContent");
5928
+ }
5929
+ function contains$1(n2, other) {
5930
+ return getUntaintedMethod$1("Node", n2, "contains")(other);
5931
+ }
5932
+ function getRootNode$1(n2) {
5933
+ return getUntaintedMethod$1("Node", n2, "getRootNode")();
5934
+ }
5935
+ function host$1(n2) {
5936
+ if (!n2 || !("host" in n2)) return null;
5937
+ return getUntaintedAccessor$1("ShadowRoot", n2, "host");
5938
+ }
5939
+ function styleSheets$1(n2) {
5940
+ return n2.styleSheets;
5941
+ }
5942
+ function shadowRoot$1(n2) {
5943
+ if (!n2 || !("shadowRoot" in n2)) return null;
5944
+ return getUntaintedAccessor$1("Element", n2, "shadowRoot");
5945
+ }
5946
+ function querySelector$1(n2, selectors) {
5947
+ return getUntaintedAccessor$1("Element", n2, "querySelector")(selectors);
5948
+ }
5949
+ function querySelectorAll$1(n2, selectors) {
5950
+ return getUntaintedAccessor$1("Element", n2, "querySelectorAll")(selectors);
5951
+ }
5952
+ function mutationObserverCtor$1() {
5953
+ return getUntaintedPrototype$1("MutationObserver").constructor;
5954
+ }
5955
+ function patch$1(source, name, replacement) {
5956
+ try {
5957
+ if (!(name in source)) {
5958
+ return () => {
5959
+ };
5960
+ }
5961
+ const original = source[name];
5962
+ const wrapped = replacement(original);
5963
+ if (typeof wrapped === "function") {
5964
+ wrapped.prototype = wrapped.prototype || {};
5965
+ Object.defineProperties(wrapped, {
5966
+ __rrweb_original__: {
5967
+ enumerable: false,
5968
+ value: original
5969
+ }
5970
+ });
5971
+ }
5972
+ source[name] = wrapped;
5973
+ return () => {
5974
+ source[name] = original;
5975
+ };
5976
+ } catch {
5977
+ return () => {
5978
+ };
5979
+ }
5980
+ }
5981
+ const index$1 = {
5982
+ childNodes: childNodes$1,
5983
+ parentNode: parentNode$1,
5984
+ parentElement: parentElement$1,
5985
+ textContent: textContent$1,
5986
+ contains: contains$1,
5987
+ getRootNode: getRootNode$1,
5988
+ host: host$1,
5989
+ styleSheets: styleSheets$1,
5990
+ shadowRoot: shadowRoot$1,
5991
+ querySelector: querySelector$1,
5992
+ querySelectorAll: querySelectorAll$1,
5993
+ mutationObserver: mutationObserverCtor$1,
5994
+ patch: patch$1
5995
+ };
5996
+ function isElement(n2) {
5997
+ return n2.nodeType === n2.ELEMENT_NODE;
5998
+ }
5810
5999
  let Mirror$1 = class Mirror2 {
5811
6000
  constructor() {
5812
6001
  __publicField22(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -5837,6 +6026,17 @@ let Mirror$1 = class Mirror2 {
5837
6026
  (childNode) => this.removeNodeFromMap(childNode)
5838
6027
  );
5839
6028
  }
6029
+ if (isElement(n2)) {
6030
+ const shadowRootEl = index$1.shadowRoot(n2);
6031
+ if (shadowRootEl) {
6032
+ this.removeNodeFromMap(shadowRootEl);
6033
+ }
6034
+ if (n2.nodeName === "IFRAME" && n2.contentDocument) {
6035
+ this.removeNodeFromMap(
6036
+ n2.contentDocument
6037
+ );
6038
+ }
6039
+ }
5840
6040
  }
5841
6041
  has(id) {
5842
6042
  return this.idNodeMap.has(id);
@@ -16746,6 +16946,8 @@ class Replayer {
16746
16946
  (_b = this.speedServiceSubscription) == null ? void 0 : _b.unsubscribe();
16747
16947
  this.serviceSubscription = void 0;
16748
16948
  this.speedServiceSubscription = void 0;
16949
+ this.service.stop();
16950
+ this.speedService.stop();
16749
16951
  this.timeouts.forEach((timeout) => clearTimeout(timeout));
16750
16952
  this.timeouts.clear();
16751
16953
  this.styleSheetLoadListeners.forEach((handler, element) => {