@screeb/rrweb 1.0.6 → 1.0.8

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.d.cts CHANGED
@@ -2,7 +2,7 @@ import { actionWithDelay } from '@rrweb/types';
2
2
  import { addedNodeMutation } from '@rrweb/types';
3
3
  import { blockClass } from '@rrweb/types';
4
4
  import { canvasMutationData } from '@rrweb/types';
5
- import { DataURLOptions } from 'rrweb-snapshot';
5
+ import { DataURLOptions } from '@rrweb/types';
6
6
  import { DeprecatedMirror } from '@rrweb/types';
7
7
  import { DocumentDimension } from '@rrweb/types';
8
8
  import { Emitter } from '@rrweb/types';
@@ -11,7 +11,7 @@ import { eventWithTime } from '@rrweb/types';
11
11
  import { Handler } from '@rrweb/types';
12
12
  import { hookResetter } from '@rrweb/types';
13
13
  import { hooksParam } from '@rrweb/types';
14
- import { IMirror } from 'rrweb-snapshot';
14
+ import { IMirror } from '@rrweb/types';
15
15
  import { IncrementalSource } from '@rrweb/types';
16
16
  import { IWindow } from '@rrweb/types';
17
17
  import { KeepIframeSrcFn } from '@rrweb/types';
package/dist/rrweb.d.ts CHANGED
@@ -2,7 +2,7 @@ import { actionWithDelay } from '@rrweb/types';
2
2
  import { addedNodeMutation } from '@rrweb/types';
3
3
  import { blockClass } from '@rrweb/types';
4
4
  import { canvasMutationData } from '@rrweb/types';
5
- import { DataURLOptions } from 'rrweb-snapshot';
5
+ import { DataURLOptions } from '@rrweb/types';
6
6
  import { DeprecatedMirror } from '@rrweb/types';
7
7
  import { DocumentDimension } from '@rrweb/types';
8
8
  import { Emitter } from '@rrweb/types';
@@ -11,7 +11,7 @@ import { eventWithTime } from '@rrweb/types';
11
11
  import { Handler } from '@rrweb/types';
12
12
  import { hookResetter } from '@rrweb/types';
13
13
  import { hooksParam } from '@rrweb/types';
14
- import { IMirror } from 'rrweb-snapshot';
14
+ import { IMirror } from '@rrweb/types';
15
15
  import { IncrementalSource } from '@rrweb/types';
16
16
  import { IWindow } from '@rrweb/types';
17
17
  import { KeepIframeSrcFn } from '@rrweb/types';
package/dist/rrweb.js CHANGED
@@ -5,7 +5,7 @@ var _a;
5
5
  var __defProp$1 = Object.defineProperty;
6
6
  var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
7
7
  var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
8
- var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
8
+ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
9
9
  NodeType2[NodeType2["Document"] = 0] = "Document";
10
10
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
11
11
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -13,7 +13,7 @@ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
13
13
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
14
14
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
15
15
  return NodeType2;
16
- })(NodeType$2 || {});
16
+ })(NodeType$3 || {});
17
17
  const testableAccessors$1 = {
18
18
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
19
19
  ShadowRoot: ["host", "styleSheets"],
@@ -27,6 +27,9 @@ const testableMethods$1 = {
27
27
  MutationObserver: ["constructor"]
28
28
  };
29
29
  const untaintedBasePrototype$1 = {};
30
+ const isAngularZonePresent$1 = () => {
31
+ return !!globalThis.Zone;
32
+ };
30
33
  function getUntaintedPrototype$1(key) {
31
34
  if (untaintedBasePrototype$1[key])
32
35
  return untaintedBasePrototype$1[key];
@@ -54,7 +57,7 @@ function getUntaintedPrototype$1(key) {
54
57
  }
55
58
  )
56
59
  );
57
- if (isUntaintedAccessors && isUntaintedMethods) {
60
+ if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent$1()) {
58
61
  untaintedBasePrototype$1[key] = defaultObj.prototype;
59
62
  return defaultObj.prototype;
60
63
  }
@@ -356,13 +359,13 @@ function is2DCanvasBlank(canvas) {
356
359
  }
357
360
  function isNodeMetaEqual(a2, b) {
358
361
  if (!a2 || !b || a2.type !== b.type) return false;
359
- if (a2.type === NodeType$2.Document)
362
+ if (a2.type === NodeType$3.Document)
360
363
  return a2.compatMode === b.compatMode;
361
- else if (a2.type === NodeType$2.DocumentType)
364
+ else if (a2.type === NodeType$3.DocumentType)
362
365
  return a2.name === b.name && a2.publicId === b.publicId && a2.systemId === b.systemId;
363
- else if (a2.type === NodeType$2.Comment || a2.type === NodeType$2.Text || a2.type === NodeType$2.CDATA)
366
+ else if (a2.type === NodeType$3.Comment || a2.type === NodeType$3.Text || a2.type === NodeType$3.CDATA)
364
367
  return a2.textContent === b.textContent;
365
- else if (a2.type === NodeType$2.Element)
368
+ else if (a2.type === NodeType$3.Element)
366
369
  return a2.tagName === b.tagName && JSON.stringify(a2.attributes) === JSON.stringify(b.attributes) && a2.isSVG === b.isSVG && a2.needBlock === b.needBlock;
367
370
  return false;
368
371
  }
@@ -438,20 +441,57 @@ function normalizeCssString(cssText) {
438
441
  function splitCssText(cssText, style) {
439
442
  const childNodes2 = Array.from(style.childNodes);
440
443
  const splits = [];
444
+ let iterLimit = 0;
441
445
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
442
- const cssTextNorm = normalizeCssString(cssText);
446
+ let cssTextNorm = normalizeCssString(cssText);
447
+ const normFactor = cssTextNorm.length / cssText.length;
443
448
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
444
449
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
445
450
  const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
446
- for (let j = 3; j < textContentNorm.length; j++) {
451
+ let j = 3;
452
+ for (; j < textContentNorm.length; j++) {
453
+ if (
454
+ // keep consuming css identifiers (to get a decent chunk more quickly)
455
+ textContentNorm[j].match(/[a-zA-Z0-9]/) || // substring needs to be unique to this section
456
+ textContentNorm.indexOf(textContentNorm.substring(0, j), 1) !== -1
457
+ ) {
458
+ continue;
459
+ }
460
+ break;
461
+ }
462
+ for (; j < textContentNorm.length; j++) {
447
463
  const bit = textContentNorm.substring(0, j);
448
- if (cssTextNorm.split(bit).length === 2) {
449
- const splitNorm = cssTextNorm.indexOf(bit);
450
- for (let k = splitNorm; k < cssText.length; k++) {
451
- if (normalizeCssString(cssText.substring(0, k)).length === splitNorm) {
464
+ const bits = cssTextNorm.split(bit);
465
+ let splitNorm = -1;
466
+ if (bits.length === 2) {
467
+ splitNorm = cssTextNorm.indexOf(bit);
468
+ } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
469
+ splitNorm = cssTextNorm.indexOf(bit, 1);
470
+ }
471
+ if (splitNorm !== -1) {
472
+ let k = Math.floor(splitNorm / normFactor);
473
+ for (; k > 0 && k < cssText.length; ) {
474
+ iterLimit += 1;
475
+ if (iterLimit > 50 * childNodes2.length) {
476
+ splits.push(cssText);
477
+ return splits;
478
+ }
479
+ const normPart = normalizeCssString(cssText.substring(0, k));
480
+ if (normPart.length === splitNorm) {
452
481
  splits.push(cssText.substring(0, k));
453
482
  cssText = cssText.substring(k);
483
+ cssTextNorm = cssTextNorm.substring(splitNorm);
454
484
  break;
485
+ } else if (normPart.length < splitNorm) {
486
+ k += Math.max(
487
+ 1,
488
+ Math.floor((splitNorm - normPart.length) / normFactor)
489
+ );
490
+ } else {
491
+ k -= Math.max(
492
+ 1,
493
+ Math.floor((normPart.length - splitNorm) * normFactor)
494
+ );
455
495
  }
456
496
  }
457
497
  break;
@@ -747,20 +787,20 @@ function serializeNode(n2, options) {
747
787
  case n2.DOCUMENT_NODE:
748
788
  if (n2.compatMode !== "CSS1Compat") {
749
789
  return {
750
- type: NodeType$2.Document,
790
+ type: NodeType$3.Document,
751
791
  childNodes: [],
752
792
  compatMode: n2.compatMode
753
793
  // probably "BackCompat"
754
794
  };
755
795
  } else {
756
796
  return {
757
- type: NodeType$2.Document,
797
+ type: NodeType$3.Document,
758
798
  childNodes: []
759
799
  };
760
800
  }
761
801
  case n2.DOCUMENT_TYPE_NODE:
762
802
  return {
763
- type: NodeType$2.DocumentType,
803
+ type: NodeType$3.DocumentType,
764
804
  name: n2.name,
765
805
  publicId: n2.publicId,
766
806
  systemId: n2.systemId,
@@ -791,13 +831,13 @@ function serializeNode(n2, options) {
791
831
  });
792
832
  case n2.CDATA_SECTION_NODE:
793
833
  return {
794
- type: NodeType$2.CDATA,
834
+ type: NodeType$3.CDATA,
795
835
  textContent: "",
796
836
  rootId
797
837
  };
798
838
  case n2.COMMENT_NODE:
799
839
  return {
800
- type: NodeType$2.Comment,
840
+ type: NodeType$3.Comment,
801
841
  textContent: index$1.textContent(n2) || "",
802
842
  rootId
803
843
  };
@@ -829,7 +869,7 @@ function serializeTextNode(n2, options) {
829
869
  textContent2 = maskTextFn ? maskTextFn(textContent2, index$1.parentElement(n2)) : textContent2.replace(/[\S]/g, "*");
830
870
  }
831
871
  return {
832
- type: NodeType$2.Text,
872
+ type: NodeType$3.Text,
833
873
  textContent: textContent2 || "",
834
874
  rootId
835
875
  };
@@ -1015,7 +1055,7 @@ function serializeElementNode(n2, options) {
1015
1055
  } catch (e2) {
1016
1056
  }
1017
1057
  return {
1018
- type: NodeType$2.Element,
1058
+ type: NodeType$3.Element,
1019
1059
  tagName,
1020
1060
  attributes,
1021
1061
  childNodes: [],
@@ -1033,9 +1073,9 @@ function lowerIfExists(maybeAttr) {
1033
1073
  }
1034
1074
  }
1035
1075
  function slimDOMExcluded(sn, slimDOMOptions) {
1036
- if (slimDOMOptions.comment && sn.type === NodeType$2.Comment) {
1076
+ if (slimDOMOptions.comment && sn.type === NodeType$3.Comment) {
1037
1077
  return true;
1038
- } else if (sn.type === NodeType$2.Element) {
1078
+ } else if (sn.type === NodeType$3.Element) {
1039
1079
  if (slimDOMOptions.script && // script tag
1040
1080
  (sn.tagName === "script" || // (module)preload link
1041
1081
  sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
@@ -1125,7 +1165,7 @@ function serializeNodeWithId(n2, options) {
1125
1165
  let id;
1126
1166
  if (mirror2.hasNode(n2)) {
1127
1167
  id = mirror2.getId(n2);
1128
- } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$2.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1168
+ } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType$3.Text && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
1129
1169
  id = IGNORED_NODE;
1130
1170
  } else {
1131
1171
  id = genId();
@@ -1139,15 +1179,15 @@ function serializeNodeWithId(n2, options) {
1139
1179
  onSerialize(n2);
1140
1180
  }
1141
1181
  let recordChild = !skipChild;
1142
- if (serializedNode.type === NodeType$2.Element) {
1182
+ if (serializedNode.type === NodeType$3.Element) {
1143
1183
  recordChild = recordChild && !serializedNode.needBlock;
1144
1184
  delete serializedNode.needBlock;
1145
1185
  const shadowRootEl = index$1.shadowRoot(n2);
1146
1186
  if (shadowRootEl && isNativeShadowDom(shadowRootEl))
1147
1187
  serializedNode.isShadowHost = true;
1148
1188
  }
1149
- if ((serializedNode.type === NodeType$2.Document || serializedNode.type === NodeType$2.Element) && recordChild) {
1150
- if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$2.Element && serializedNode.tagName === "head") {
1189
+ if ((serializedNode.type === NodeType$3.Document || serializedNode.type === NodeType$3.Element) && recordChild) {
1190
+ if (slimDOMOptions.headWhitespace && serializedNode.type === NodeType$3.Element && serializedNode.tagName === "head") {
1151
1191
  preserveWhiteSpace = false;
1152
1192
  }
1153
1193
  const bypassOptions = {
@@ -1176,9 +1216,9 @@ function serializeNodeWithId(n2, options) {
1176
1216
  keepIframeSrcFn,
1177
1217
  cssCaptured: false
1178
1218
  };
1179
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1219
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "textarea" && serializedNode.attributes.value !== void 0) ;
1180
1220
  else {
1181
- if (serializedNode.type === NodeType$2.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
1221
+ if (serializedNode.type === NodeType$3.Element && serializedNode.attributes._cssText !== void 0 && typeof serializedNode.attributes._cssText === "string") {
1182
1222
  bypassOptions.cssCaptured = true;
1183
1223
  }
1184
1224
  for (const childN of Array.from(index$1.childNodes(n2))) {
@@ -1203,7 +1243,7 @@ function serializeNodeWithId(n2, options) {
1203
1243
  if (parent && isShadowRoot(parent) && isNativeShadowDom(parent)) {
1204
1244
  serializedNode.isShadow = true;
1205
1245
  }
1206
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "iframe") {
1246
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "iframe") {
1207
1247
  onceIframeLoaded(
1208
1248
  n2,
1209
1249
  () => {
@@ -1245,7 +1285,7 @@ function serializeNodeWithId(n2, options) {
1245
1285
  iframeLoadTimeout
1246
1286
  );
1247
1287
  }
1248
- if (serializedNode.type === NodeType$2.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
1288
+ if (serializedNode.type === NodeType$3.Element && serializedNode.tagName === "link" && typeof serializedNode.attributes.rel === "string" && (serializedNode.attributes.rel === "stylesheet" || serializedNode.attributes.rel === "preload" && typeof serializedNode.attributes.href === "string" && extractFileExtension(serializedNode.attributes.href) === "css")) {
1249
1289
  onceStylesheetLoaded(
1250
1290
  n2,
1251
1291
  () => {
@@ -5023,7 +5063,7 @@ function createCache() {
5023
5063
  function applyCssSplits(n2, cssText, hackCss, cache) {
5024
5064
  const childTextNodes = [];
5025
5065
  for (const scn of n2.childNodes) {
5026
- if (scn.type === NodeType$2.Text) {
5066
+ if (scn.type === NodeType$3.Text) {
5027
5067
  childTextNodes.push(scn);
5028
5068
  }
5029
5069
  }
@@ -5054,15 +5094,15 @@ function buildNode(n2, options) {
5054
5094
  var _a2;
5055
5095
  const { doc, hackCss, cache } = options;
5056
5096
  switch (n2.type) {
5057
- case NodeType$2.Document:
5097
+ case NodeType$3.Document:
5058
5098
  return doc.implementation.createDocument(null, "", null);
5059
- case NodeType$2.DocumentType:
5099
+ case NodeType$3.DocumentType:
5060
5100
  return doc.implementation.createDocumentType(
5061
5101
  n2.name || "html",
5062
5102
  n2.publicId,
5063
5103
  n2.systemId
5064
5104
  );
5065
- case NodeType$2.Element: {
5105
+ case NodeType$3.Element: {
5066
5106
  const tagName = getTagName(n2);
5067
5107
  let node2;
5068
5108
  if (n2.isSVG) {
@@ -5196,14 +5236,14 @@ function buildNode(n2, options) {
5196
5236
  }
5197
5237
  return node2;
5198
5238
  }
5199
- case NodeType$2.Text:
5239
+ case NodeType$3.Text:
5200
5240
  if (n2.isStyle && hackCss) {
5201
5241
  return doc.createTextNode(adaptCssForReplay(n2.textContent, cache));
5202
5242
  }
5203
5243
  return doc.createTextNode(n2.textContent);
5204
- case NodeType$2.CDATA:
5244
+ case NodeType$3.CDATA:
5205
5245
  return doc.createCDATASection(n2.textContent);
5206
- case NodeType$2.Comment:
5246
+ case NodeType$3.Comment:
5207
5247
  return doc.createComment(n2.textContent);
5208
5248
  default:
5209
5249
  return null;
@@ -5230,11 +5270,11 @@ function buildNodeWithSN(n2, options) {
5230
5270
  if (n2.rootId && mirror2.getNode(n2.rootId) !== doc) {
5231
5271
  mirror2.replace(n2.rootId, doc);
5232
5272
  }
5233
- if (n2.type === NodeType$2.Document) {
5273
+ if (n2.type === NodeType$3.Document) {
5234
5274
  doc.close();
5235
5275
  doc.open();
5236
- if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$2.DocumentType) {
5237
- if (n2.childNodes[0].type === NodeType$2.Element && "xmlns" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === "http://www.w3.org/1999/xhtml") {
5276
+ if (n2.compatMode === "BackCompat" && n2.childNodes && n2.childNodes[0].type !== NodeType$3.DocumentType) {
5277
+ if (n2.childNodes[0].type === NodeType$3.Element && "xmlns" in n2.childNodes[0].attributes && n2.childNodes[0].attributes.xmlns === "http://www.w3.org/1999/xhtml") {
5238
5278
  doc.write(
5239
5279
  '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'
5240
5280
  );
@@ -5247,7 +5287,7 @@ function buildNodeWithSN(n2, options) {
5247
5287
  node2 = doc;
5248
5288
  }
5249
5289
  mirror2.add(node2, n2);
5250
- if ((n2.type === NodeType$2.Document || n2.type === NodeType$2.Element) && !skipChild) {
5290
+ if ((n2.type === NodeType$3.Document || n2.type === NodeType$3.Element) && !skipChild) {
5251
5291
  for (const childN of n2.childNodes) {
5252
5292
  const childNode = buildNodeWithSN(childN, {
5253
5293
  doc,
@@ -5263,7 +5303,7 @@ function buildNodeWithSN(n2, options) {
5263
5303
  }
5264
5304
  if (childN.isShadow && isElement(node2) && node2.shadowRoot) {
5265
5305
  node2.shadowRoot.appendChild(childNode);
5266
- } else if (n2.type === NodeType$2.Document && childN.type == NodeType$2.Element) {
5306
+ } else if (n2.type === NodeType$3.Document && childN.type == NodeType$3.Element) {
5267
5307
  const htmlElement = childNode;
5268
5308
  let body = null;
5269
5309
  htmlElement.childNodes.forEach((child) => {
@@ -5298,7 +5338,7 @@ function visit(mirror2, onVisit) {
5298
5338
  }
5299
5339
  function handleScroll(node2, mirror2) {
5300
5340
  const n2 = mirror2.getMeta(node2);
5301
- if ((n2 == null ? void 0 : n2.type) !== NodeType$2.Element) {
5341
+ if ((n2 == null ? void 0 : n2.type) !== NodeType$3.Element) {
5302
5342
  return;
5303
5343
  }
5304
5344
  const el = node2;
@@ -5346,15 +5386,6 @@ var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "
5346
5386
  var __defProp22 = Object.defineProperty;
5347
5387
  var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5348
5388
  var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
5349
- var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
5350
- NodeType2[NodeType2["Document"] = 0] = "Document";
5351
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
5352
- NodeType2[NodeType2["Element"] = 2] = "Element";
5353
- NodeType2[NodeType2["Text"] = 3] = "Text";
5354
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
5355
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
5356
- return NodeType2;
5357
- })(NodeType$1 || {});
5358
5389
  let Mirror$1 = class Mirror2 {
5359
5390
  constructor() {
5360
5391
  __publicField22(this, "idNodeMap", /* @__PURE__ */ new Map());
@@ -8962,6 +8993,15 @@ postcss$1.Input;
8962
8993
  postcss$1.Rule;
8963
8994
  postcss$1.Root;
8964
8995
  postcss$1.Node;
8996
+ var NodeType$1 = /* @__PURE__ */ ((NodeType2) => {
8997
+ NodeType2[NodeType2["Document"] = 0] = "Document";
8998
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
8999
+ NodeType2[NodeType2["Element"] = 2] = "Element";
9000
+ NodeType2[NodeType2["Text"] = 3] = "Text";
9001
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
9002
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
9003
+ return NodeType2;
9004
+ })(NodeType$1 || {});
8965
9005
  function parseCSSText(cssText) {
8966
9006
  const res = {};
8967
9007
  const listDelimiter = /;(?![^(]*\))/g;
@@ -9471,7 +9511,7 @@ function removeChild(parent, child) {
9471
9511
  child.parentNode = null;
9472
9512
  return child;
9473
9513
  }
9474
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
9514
+ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
9475
9515
  NodeType2[NodeType2["PLACEHOLDER"] = 0] = "PLACEHOLDER";
9476
9516
  NodeType2[NodeType2["ELEMENT_NODE"] = 1] = "ELEMENT_NODE";
9477
9517
  NodeType2[NodeType2["ATTRIBUTE_NODE"] = 2] = "ATTRIBUTE_NODE";
@@ -9485,7 +9525,7 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
9485
9525
  NodeType2[NodeType2["DOCUMENT_TYPE_NODE"] = 10] = "DOCUMENT_TYPE_NODE";
9486
9526
  NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
9487
9527
  return NodeType2;
9488
- })(NodeType || {});
9528
+ })(NodeType$2 || {});
9489
9529
  const NAMESPACES = {
9490
9530
  svg: "http://www.w3.org/2000/svg",
9491
9531
  "xlink:href": "http://www.w3.org/1999/xlink",
@@ -10044,7 +10084,7 @@ function getValidTagName(element) {
10044
10084
  function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10045
10085
  let rrNode;
10046
10086
  switch (node2.nodeType) {
10047
- case NodeType.DOCUMENT_NODE:
10087
+ case NodeType$2.DOCUMENT_NODE:
10048
10088
  if (parentRRNode && parentRRNode.nodeName === "IFRAME")
10049
10089
  rrNode = parentRRNode.contentDocument;
10050
10090
  else {
@@ -10052,7 +10092,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10052
10092
  rrNode.compatMode = node2.compatMode;
10053
10093
  }
10054
10094
  break;
10055
- case NodeType.DOCUMENT_TYPE_NODE: {
10095
+ case NodeType$2.DOCUMENT_TYPE_NODE: {
10056
10096
  const documentType = node2;
10057
10097
  rrNode = rrdom.createDocumentType(
10058
10098
  documentType.name,
@@ -10061,7 +10101,7 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10061
10101
  );
10062
10102
  break;
10063
10103
  }
10064
- case NodeType.ELEMENT_NODE: {
10104
+ case NodeType$2.ELEMENT_NODE: {
10065
10105
  const elementNode = node2;
10066
10106
  const tagName = getValidTagName(elementNode);
10067
10107
  rrNode = rrdom.createElement(tagName);
@@ -10073,16 +10113,16 @@ function buildFromNode(node2, rrdom, domMirror, parentRRNode) {
10073
10113
  elementNode.scrollTop && (rrElement.scrollTop = elementNode.scrollTop);
10074
10114
  break;
10075
10115
  }
10076
- case NodeType.TEXT_NODE:
10116
+ case NodeType$2.TEXT_NODE:
10077
10117
  rrNode = rrdom.createTextNode(node2.textContent || "");
10078
10118
  break;
10079
- case NodeType.CDATA_SECTION_NODE:
10119
+ case NodeType$2.CDATA_SECTION_NODE:
10080
10120
  rrNode = rrdom.createCDATASection(node2.data);
10081
10121
  break;
10082
- case NodeType.COMMENT_NODE:
10122
+ case NodeType$2.COMMENT_NODE:
10083
10123
  rrNode = rrdom.createComment(node2.textContent || "");
10084
10124
  break;
10085
- case NodeType.DOCUMENT_FRAGMENT_NODE:
10125
+ case NodeType$2.DOCUMENT_FRAGMENT_NODE:
10086
10126
  rrNode = parentRRNode.attachShadow({ mode: "open" });
10087
10127
  break;
10088
10128
  default:
@@ -10105,7 +10145,7 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
10105
10145
  if (
10106
10146
  // if the parentRRNode isn't a RRIFrameElement
10107
10147
  (parentRRNode == null ? void 0 : parentRRNode.nodeName) !== "IFRAME" && // if node isn't a shadow root
10108
- node2.nodeType !== NodeType.DOCUMENT_FRAGMENT_NODE
10148
+ node2.nodeType !== NodeType$2.DOCUMENT_FRAGMENT_NODE
10109
10149
  ) {
10110
10150
  parentRRNode == null ? void 0 : parentRRNode.appendChild(rrNode);
10111
10151
  rrNode.parentNode = parentRRNode;
@@ -10114,8 +10154,8 @@ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument(
10114
10154
  if (node2.nodeName === "IFRAME") {
10115
10155
  const iframeDoc = node2.contentDocument;
10116
10156
  iframeDoc && walk2(iframeDoc, rrNode);
10117
- } else if (node2.nodeType === NodeType.DOCUMENT_NODE || node2.nodeType === NodeType.ELEMENT_NODE || node2.nodeType === NodeType.DOCUMENT_FRAGMENT_NODE) {
10118
- if (node2.nodeType === NodeType.ELEMENT_NODE && node2.shadowRoot)
10157
+ } else if (node2.nodeType === NodeType$2.DOCUMENT_NODE || node2.nodeType === NodeType$2.ELEMENT_NODE || node2.nodeType === NodeType$2.DOCUMENT_FRAGMENT_NODE) {
10158
+ if (node2.nodeType === NodeType$2.ELEMENT_NODE && node2.shadowRoot)
10119
10159
  walk2(node2.shadowRoot, rrNode);
10120
10160
  node2.childNodes.forEach((childNode) => walk2(childNode, rrNode));
10121
10161
  }
@@ -10239,6 +10279,9 @@ const testableMethods = {
10239
10279
  MutationObserver: ["constructor"]
10240
10280
  };
10241
10281
  const untaintedBasePrototype = {};
10282
+ const isAngularZonePresent = () => {
10283
+ return !!globalThis.Zone;
10284
+ };
10242
10285
  function getUntaintedPrototype(key) {
10243
10286
  if (untaintedBasePrototype[key])
10244
10287
  return untaintedBasePrototype[key];
@@ -10266,7 +10309,7 @@ function getUntaintedPrototype(key) {
10266
10309
  }
10267
10310
  )
10268
10311
  );
10269
- if (isUntaintedAccessors && isUntaintedMethods) {
10312
+ if (isUntaintedAccessors && isUntaintedMethods && !isAngularZonePresent()) {
10270
10313
  untaintedBasePrototype[key] = defaultObj.prototype;
10271
10314
  return defaultObj.prototype;
10272
10315
  }
@@ -10848,6 +10891,15 @@ var ReplayerEvents = /* @__PURE__ */ ((ReplayerEvents2) => {
10848
10891
  ReplayerEvents2["Destroy"] = "destroy";
10849
10892
  return ReplayerEvents2;
10850
10893
  })(ReplayerEvents || {});
10894
+ var NodeType = /* @__PURE__ */ ((NodeType2) => {
10895
+ NodeType2[NodeType2["Document"] = 0] = "Document";
10896
+ NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
10897
+ NodeType2[NodeType2["Element"] = 2] = "Element";
10898
+ NodeType2[NodeType2["Text"] = 3] = "Text";
10899
+ NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
10900
+ NodeType2[NodeType2["Comment"] = 5] = "Comment";
10901
+ return NodeType2;
10902
+ })(NodeType || {});
10851
10903
  function isNodeInLinkedList(n2) {
10852
10904
  return "__ln" in n2;
10853
10905
  }
@@ -12784,7 +12836,7 @@ class IframeManager {
12784
12836
  }
12785
12837
  }
12786
12838
  patchRootIdOnNode(node2, rootId) {
12787
- if (node2.type !== NodeType$2.Document && !node2.rootId) node2.rootId = rootId;
12839
+ if (node2.type !== NodeType.Document && !node2.rootId) node2.rootId = rootId;
12788
12840
  if ("childNodes" in node2) {
12789
12841
  node2.childNodes.forEach((child) => {
12790
12842
  this.patchRootIdOnNode(child, rootId);
@@ -15871,7 +15923,7 @@ class Replayer {
15871
15923
  collectedDialogs.add(builtNode);
15872
15924
  this.collectIframeAndAttachDocument(collectedIframes, builtNode);
15873
15925
  const sn = mirror2.getMeta(builtNode);
15874
- if ((sn == null ? void 0 : sn.type) === NodeType$2.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
15926
+ if ((sn == null ? void 0 : sn.type) === NodeType.Element && (sn == null ? void 0 : sn.tagName.toUpperCase()) === "HTML") {
15875
15927
  const { documentElement, head } = iframeEl.contentDocument;
15876
15928
  this.insertStyleRules(
15877
15929
  documentElement,
@@ -16347,7 +16399,7 @@ class Replayer {
16347
16399
  mutation.parentId
16348
16400
  );
16349
16401
  if (!parent) {
16350
- if (mutation.node.type === NodeType$2.Document) {
16402
+ if (mutation.node.type === NodeType.Document) {
16351
16403
  return this.newDocumentQueue.push(mutation);
16352
16404
  }
16353
16405
  return queue.push(mutation);
@@ -16409,7 +16461,7 @@ class Replayer {
16409
16461
  return;
16410
16462
  }
16411
16463
  const parentSn = mirror2.getMeta(parent);
16412
- if (parentSn && parentSn.type === NodeType$2.Element && mutation.node.type === NodeType$2.Text) {
16464
+ if (parentSn && parentSn.type === NodeType.Element && mutation.node.type === NodeType.Text) {
16413
16465
  const prospectiveSiblings = Array.isArray(parent.childNodes) ? parent.childNodes : Array.from(parent.childNodes);
16414
16466
  if (parentSn.tagName === "textarea") {
16415
16467
  for (const c2 of prospectiveSiblings) {
@@ -16425,9 +16477,9 @@ class Replayer {
16425
16477
  }
16426
16478
  }
16427
16479
  }
16428
- } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType$2.Document) {
16480
+ } else if ((parentSn == null ? void 0 : parentSn.type) === NodeType.Document) {
16429
16481
  const parentDoc = parent;
16430
- if (mutation.node.type === NodeType$2.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
16482
+ if (mutation.node.type === NodeType.DocumentType && ((_a2 = parentDoc.childNodes[0]) == null ? void 0 : _a2.nodeType) === Node.DOCUMENT_TYPE_NODE)
16431
16483
  parentDoc.removeChild(parentDoc.childNodes[0]);
16432
16484
  if (target.nodeName === "HTML" && parentDoc.documentElement)
16433
16485
  parentDoc.removeChild(
@@ -16633,7 +16685,7 @@ class Replayer {
16633
16685
  left: d.x,
16634
16686
  behavior: isSync ? "auto" : "smooth"
16635
16687
  });
16636
- } else if ((sn == null ? void 0 : sn.type) === NodeType$2.Document) {
16688
+ } else if ((sn == null ? void 0 : sn.type) === NodeType.Document) {
16637
16689
  (_b = target.defaultView) == null ? void 0 : _b.scrollTo({
16638
16690
  top: d.y,
16639
16691
  left: d.x,