@appsurify-testmap/rrweb 2.0.0-alpha.41 → 2.1.0-alpha.2

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.cjs CHANGED
@@ -144,6 +144,32 @@ function querySelectorAll$1(n2, selectors) {
144
144
  function mutationObserverCtor$1() {
145
145
  return getUntaintedPrototype$1("MutationObserver").constructor;
146
146
  }
147
+ function patch$1(source, name, replacement) {
148
+ try {
149
+ if (!(name in source)) {
150
+ return () => {
151
+ };
152
+ }
153
+ const original = source[name];
154
+ const wrapped = replacement(original);
155
+ if (typeof wrapped === "function") {
156
+ wrapped.prototype = wrapped.prototype || {};
157
+ Object.defineProperties(wrapped, {
158
+ __rrweb_original__: {
159
+ enumerable: false,
160
+ value: original
161
+ }
162
+ });
163
+ }
164
+ source[name] = wrapped;
165
+ return () => {
166
+ source[name] = original;
167
+ };
168
+ } catch {
169
+ return () => {
170
+ };
171
+ }
172
+ }
147
173
  const index$1 = {
148
174
  childNodes: childNodes$1,
149
175
  parentNode: parentNode$1,
@@ -156,8 +182,12 @@ const index$1 = {
156
182
  shadowRoot: shadowRoot$1,
157
183
  querySelector: querySelector$1,
158
184
  querySelectorAll: querySelectorAll$1,
159
- mutationObserver: mutationObserverCtor$1
185
+ mutationObserver: mutationObserverCtor$1,
186
+ patch: patch$1
160
187
  };
188
+ function isElement(n2) {
189
+ return n2.nodeType === n2.ELEMENT_NODE;
190
+ }
161
191
  function isShadowRoot(n2) {
162
192
  const hostEl = (
163
193
  // anchor and textarea elements also have a `host` property
@@ -434,19 +464,27 @@ function absolutifyURLs(cssText, href) {
434
464
  }
435
465
  );
436
466
  }
437
- function normalizeCssString(cssText) {
438
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
467
+ function normalizeCssString(cssText, _testNoPxNorm = false) {
468
+ if (_testNoPxNorm) {
469
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
470
+ } else {
471
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
472
+ }
439
473
  }
440
- function splitCssText(cssText, style) {
474
+ function splitCssText(cssText, style, _testNoPxNorm = false) {
441
475
  const childNodes2 = Array.from(style.childNodes);
442
476
  const splits = [];
443
- let iterLimit = 0;
477
+ let iterCount = 0;
444
478
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
445
- let cssTextNorm = normalizeCssString(cssText);
479
+ let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
446
480
  const normFactor = cssTextNorm.length / cssText.length;
447
481
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
448
482
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
449
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
483
+ const textContentNorm = normalizeCssString(
484
+ childNodes2[i2].textContent,
485
+ _testNoPxNorm
486
+ );
487
+ const jLimit = 100;
450
488
  let j = 3;
451
489
  for (; j < textContentNorm.length; j++) {
452
490
  if (
@@ -459,23 +497,49 @@ function splitCssText(cssText, style) {
459
497
  break;
460
498
  }
461
499
  for (; j < textContentNorm.length; j++) {
462
- const bit = textContentNorm.substring(0, j);
463
- const bits = cssTextNorm.split(bit);
500
+ let startSubstring = textContentNorm.substring(0, j);
501
+ let cssNormSplits = cssTextNorm.split(startSubstring);
464
502
  let splitNorm = -1;
465
- if (bits.length === 2) {
466
- splitNorm = cssTextNorm.indexOf(bit);
467
- } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
468
- splitNorm = cssTextNorm.indexOf(bit, 1);
503
+ if (cssNormSplits.length === 2) {
504
+ splitNorm = cssNormSplits[0].length;
505
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
506
+ splitNorm = cssTextNorm.indexOf(startSubstring, 1);
507
+ } else if (cssNormSplits.length === 1) {
508
+ startSubstring = startSubstring.substring(
509
+ 0,
510
+ startSubstring.length - 1
511
+ );
512
+ cssNormSplits = cssTextNorm.split(startSubstring);
513
+ if (cssNormSplits.length <= 1) {
514
+ splits.push(cssText);
515
+ return splits;
516
+ }
517
+ j = jLimit + 1;
518
+ } else if (j === textContentNorm.length - 1) {
519
+ splitNorm = cssTextNorm.indexOf(startSubstring);
520
+ }
521
+ if (cssNormSplits.length >= 2 && j > jLimit) {
522
+ const prevTextContent = childNodes2[i2 - 1].textContent;
523
+ if (prevTextContent && typeof prevTextContent === "string") {
524
+ const prevMinLength = normalizeCssString(prevTextContent).length;
525
+ splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
526
+ }
527
+ if (splitNorm === -1) {
528
+ splitNorm = cssNormSplits[0].length;
529
+ }
469
530
  }
470
531
  if (splitNorm !== -1) {
471
532
  let k = Math.floor(splitNorm / normFactor);
472
533
  for (; k > 0 && k < cssText.length; ) {
473
- iterLimit += 1;
474
- if (iterLimit > 50 * childNodes2.length) {
534
+ iterCount += 1;
535
+ if (iterCount > 50 * childNodes2.length) {
475
536
  splits.push(cssText);
476
537
  return splits;
477
538
  }
478
- const normPart = normalizeCssString(cssText.substring(0, k));
539
+ const normPart = normalizeCssString(
540
+ cssText.substring(0, k),
541
+ _testNoPxNorm
542
+ );
479
543
  if (normPart.length === splitNorm) {
480
544
  splits.push(cssText.substring(0, k));
481
545
  cssText = cssText.substring(k);
@@ -571,9 +635,6 @@ function getXPath(node2) {
571
635
  }
572
636
  return "";
573
637
  }
574
- function isElement(n2) {
575
- return n2.nodeType === n2.ELEMENT_NODE;
576
- }
577
638
  function isTextVisible(n2) {
578
639
  var _a2;
579
640
  const parent = index$1.parentNode(n2);
@@ -594,10 +655,10 @@ function isElementVisible(n2) {
594
655
  const style = win ? win.getComputedStyle(n2) : null;
595
656
  const isStyleVisible = style != null && style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
596
657
  const rect = n2.getBoundingClientRect();
597
- const result2 = isStyleVisible && isRectVisible(rect, win);
658
+ const result2 = isStyleVisible && isRectVisible(rect);
598
659
  return result2;
599
660
  }
600
- function isRectVisible(rect, win) {
661
+ function isRectVisible(rect, win = window) {
601
662
  var _a2, _b, _c, _d;
602
663
  const height = (win == null ? void 0 : win.innerHeight) ?? ((_b = (_a2 = win == null ? void 0 : win.document) == null ? void 0 : _a2.documentElement) == null ? void 0 : _b.clientHeight) ?? 0;
603
664
  const width = (win == null ? void 0 : win.innerWidth) ?? ((_d = (_c = win == null ? void 0 : win.document) == null ? void 0 : _c.documentElement) == null ? void 0 : _d.clientWidth) ?? 0;
@@ -641,7 +702,7 @@ const interactiveTags = [
641
702
  "video",
642
703
  "audio"
643
704
  ];
644
- const inlineEventAttributes = [
705
+ const inlineEventAttributes$1 = [
645
706
  "onclick",
646
707
  "ondblclick",
647
708
  "onmousedown",
@@ -666,27 +727,20 @@ const inlineEventAttributes = [
666
727
  "ontouchcancel"
667
728
  ];
668
729
  const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
669
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
670
- const originalAddEventListener = EventTarget.prototype.addEventListener;
671
- EventTarget.prototype.addEventListener = function(type, listener, options) {
672
- originalAddEventListener.call(this, type, listener, options);
673
- if (this instanceof Element) {
674
- const eventType = type.toLowerCase();
675
- if (interactiveEvents$1.includes(eventType)) {
676
- interactiveElementsRegistry$1.add(this);
677
- }
730
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
731
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
732
+ originalAddEventListener$1.call(this, type, listener, options);
733
+ if (this instanceof Element) {
734
+ const eventType = type.toLowerCase();
735
+ if (interactiveEvents$1.includes(eventType)) {
736
+ interactiveElementsRegistry$1.add(this);
678
737
  }
679
- };
680
- }
681
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
682
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
683
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
684
- originalRemoveEventListener.call(this, type, listener, options);
685
- if (this instanceof Element) {
686
- type.toLowerCase();
687
- }
688
- };
689
- }
738
+ }
739
+ };
740
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
741
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
742
+ originalRemoveEventListener$1.call(this, type, listener, options);
743
+ };
690
744
  function hasEventListeners(n2) {
691
745
  return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
692
746
  }
@@ -706,33 +760,20 @@ function isElementInteractive(n2) {
706
760
  }
707
761
  return false;
708
762
  }
709
- function inspectInlineEventHandlers(doc) {
710
- if (!doc || typeof doc.querySelectorAll !== "function") return;
711
- const allElements = doc.querySelectorAll("*");
763
+ function inspectInlineEventHandlers$1() {
764
+ const allElements = document.querySelectorAll("*");
712
765
  allElements.forEach((el) => {
713
- inlineEventAttributes.forEach((attr) => {
766
+ inlineEventAttributes$1.forEach((attr) => {
714
767
  if (el.hasAttribute(attr)) {
715
768
  interactiveElementsRegistry$1.add(el);
716
769
  }
717
770
  });
718
771
  });
719
772
  }
720
- function scheduleInlineEventInspection(doc) {
721
- if (!doc || typeof doc.addEventListener !== "function" || typeof doc.querySelectorAll !== "function") {
722
- return;
723
- }
724
- try {
725
- if (doc.readyState === "complete" || doc.readyState === "interactive") {
726
- inspectInlineEventHandlers(doc);
727
- } else {
728
- doc.addEventListener("DOMContentLoaded", () => inspectInlineEventHandlers(doc), {
729
- once: true,
730
- capture: false
731
- });
732
- }
733
- } catch (e2) {
734
- console.warn("[inlineEventInspection] Failed to inspect document:", e2);
735
- }
773
+ if (document.readyState === "complete" || document.readyState === "interactive") {
774
+ inspectInlineEventHandlers$1();
775
+ } else {
776
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
736
777
  }
737
778
  let _id = 1;
738
779
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -1026,6 +1067,7 @@ function serializeNode(n2, options) {
1026
1067
  childNodes: [],
1027
1068
  xPath,
1028
1069
  compatMode: n2.compatMode
1070
+ // probably "BackCompat"
1029
1071
  };
1030
1072
  } else {
1031
1073
  return {
@@ -1320,7 +1362,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1320
1362
  } else if (sn.type === NodeType$3.Element) {
1321
1363
  if (slimDOMOptions.script && // script tag
1322
1364
  (sn.tagName === "script" || // (module)preload link
1323
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
1365
+ sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
1324
1366
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
1325
1367
  return true;
1326
1368
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
@@ -1582,7 +1624,7 @@ function snapshot(n2, options) {
1582
1624
  blockSelector = null,
1583
1625
  maskTextClass = "rr-mask",
1584
1626
  maskTextSelector = null,
1585
- ignoreAttribute = "rr-ignore-attr",
1627
+ ignoreAttribute = "rr-ignore",
1586
1628
  inlineStylesheet = true,
1587
1629
  inlineImages = false,
1588
1630
  recordCanvas = false,
@@ -1599,7 +1641,6 @@ function snapshot(n2, options) {
1599
1641
  stylesheetLoadTimeout,
1600
1642
  keepIframeSrcFn = () => false
1601
1643
  } = options || {};
1602
- scheduleInlineEventInspection(n2);
1603
1644
  const maskInputOptions = maskAllInputs === true ? {
1604
1645
  color: true,
1605
1646
  date: true,
@@ -5296,11 +5337,16 @@ function getTagName(n2) {
5296
5337
  function adaptCssForReplay(cssText, cache) {
5297
5338
  const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
5298
5339
  if (cachedStyle) return cachedStyle;
5299
- const ast = postcss$1$1([
5300
- mediaSelectorPlugin,
5301
- pseudoClassPlugin
5302
- ]).process(cssText);
5303
- const result2 = ast.css;
5340
+ let result2 = cssText;
5341
+ try {
5342
+ const ast = postcss$1$1([
5343
+ mediaSelectorPlugin,
5344
+ pseudoClassPlugin
5345
+ ]).process(cssText);
5346
+ result2 = ast.css;
5347
+ } catch (error) {
5348
+ console.warn("Failed to adapt css for replay", error);
5349
+ }
5304
5350
  cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
5305
5351
  return result2;
5306
5352
  }
@@ -5321,11 +5367,39 @@ function applyCssSplits(n2, cssText, hackCss, cache) {
5321
5367
  while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {
5322
5368
  cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(""));
5323
5369
  }
5370
+ let adaptedCss = "";
5371
+ if (hackCss) {
5372
+ adaptedCss = adaptCssForReplay(cssTextSplits.join(""), cache);
5373
+ }
5374
+ let startIndex = 0;
5324
5375
  for (let i2 = 0; i2 < childTextNodes.length; i2++) {
5376
+ if (i2 === cssTextSplits.length) {
5377
+ break;
5378
+ }
5325
5379
  const childTextNode = childTextNodes[i2];
5326
- const cssTextSection = cssTextSplits[i2];
5327
- if (childTextNode && cssTextSection) {
5328
- childTextNode.textContent = hackCss ? adaptCssForReplay(cssTextSection, cache) : cssTextSection;
5380
+ if (!hackCss) {
5381
+ childTextNode.textContent = cssTextSplits[i2];
5382
+ } else if (i2 < cssTextSplits.length - 1) {
5383
+ let endIndex = startIndex;
5384
+ let endSearch = cssTextSplits[i2 + 1].length;
5385
+ endSearch = Math.min(endSearch, 30);
5386
+ let found = false;
5387
+ for (; endSearch > 2; endSearch--) {
5388
+ const searchBit = cssTextSplits[i2 + 1].substring(0, endSearch);
5389
+ const searchIndex = adaptedCss.substring(startIndex).indexOf(searchBit);
5390
+ found = searchIndex !== -1;
5391
+ if (found) {
5392
+ endIndex += searchIndex;
5393
+ break;
5394
+ }
5395
+ }
5396
+ if (!found) {
5397
+ endIndex += cssTextSplits[i2].length;
5398
+ }
5399
+ childTextNode.textContent = adaptedCss.substring(startIndex, endIndex);
5400
+ startIndex = endIndex;
5401
+ } else {
5402
+ childTextNode.textContent = adaptedCss.substring(startIndex);
5329
5403
  }
5330
5404
  }
5331
5405
  }
@@ -5409,8 +5483,8 @@ function buildNode(n2, options) {
5409
5483
  } else if (tagName === "meta" && n2.attributes["http-equiv"] === "Content-Security-Policy" && name === "content") {
5410
5484
  node2.setAttribute("csp-content", value.toString());
5411
5485
  continue;
5412
- } else if (tagName === "link" && (n2.attributes.rel === "preload" || n2.attributes.rel === "modulepreload") && n2.attributes.as === "script") {
5413
- } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && n2.attributes.href.endsWith(".js")) {
5486
+ } else if (tagName === "link" && (n2.attributes.rel === "preload" && n2.attributes.as === "script" || n2.attributes.rel === "modulepreload")) {
5487
+ } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && extractFileExtension(n2.attributes.href) === "js") {
5414
5488
  } else if (tagName === "img" && n2.attributes.srcset && n2.attributes.rr_dataURL) {
5415
5489
  node2.setAttribute(
5416
5490
  "rrweb-original-srcset",
@@ -5719,27 +5793,59 @@ const interactiveEvents = [
5719
5793
  "touchend",
5720
5794
  "touchcancel"
5721
5795
  ];
5796
+ const inlineEventAttributes = [
5797
+ "onclick",
5798
+ "ondblclick",
5799
+ "onmousedown",
5800
+ "onmouseup",
5801
+ "onmouseover",
5802
+ "onmouseout",
5803
+ "onmousemove",
5804
+ "onfocus",
5805
+ "onblur",
5806
+ "onkeydown",
5807
+ "onkeypress",
5808
+ "onkeyup",
5809
+ "onchange",
5810
+ "oninput",
5811
+ "onsubmit",
5812
+ "onreset",
5813
+ "onselect",
5814
+ "oncontextmenu",
5815
+ "ontouchstart",
5816
+ "ontouchmove",
5817
+ "ontouchend",
5818
+ "ontouchcancel"
5819
+ ];
5722
5820
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5723
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5724
- const originalAddEventListener = EventTarget.prototype.addEventListener;
5725
- EventTarget.prototype.addEventListener = function(type, listener, options) {
5726
- originalAddEventListener.call(this, type, listener, options);
5727
- if (this instanceof Element) {
5728
- const eventType = type.toLowerCase();
5729
- if (interactiveEvents.includes(eventType)) {
5730
- interactiveElementsRegistry.add(this);
5731
- }
5821
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5822
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5823
+ originalAddEventListener.call(this, type, listener, options);
5824
+ if (this instanceof Element) {
5825
+ const eventType = type.toLowerCase();
5826
+ if (interactiveEvents.includes(eventType)) {
5827
+ interactiveElementsRegistry.add(this);
5732
5828
  }
5733
- };
5829
+ }
5830
+ };
5831
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5832
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5833
+ originalRemoveEventListener.call(this, type, listener, options);
5834
+ };
5835
+ function inspectInlineEventHandlers() {
5836
+ const allElements = document.querySelectorAll("*");
5837
+ allElements.forEach((el) => {
5838
+ inlineEventAttributes.forEach((attr) => {
5839
+ if (el.hasAttribute(attr)) {
5840
+ interactiveElementsRegistry.add(el);
5841
+ }
5842
+ });
5843
+ });
5734
5844
  }
5735
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5736
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5737
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
5738
- originalRemoveEventListener.call(this, type, listener, options);
5739
- if (this instanceof Element) {
5740
- type.toLowerCase();
5741
- }
5742
- };
5845
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5846
+ inspectInlineEventHandlers();
5847
+ } else {
5848
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5743
5849
  }
5744
5850
  function getDefaultExportFromCjs(x2) {
5745
5851
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -10691,6 +10797,32 @@ function querySelectorAll(n2, selectors) {
10691
10797
  function mutationObserverCtor() {
10692
10798
  return getUntaintedPrototype("MutationObserver").constructor;
10693
10799
  }
10800
+ function patch(source, name, replacement) {
10801
+ try {
10802
+ if (!(name in source)) {
10803
+ return () => {
10804
+ };
10805
+ }
10806
+ const original = source[name];
10807
+ const wrapped = replacement(original);
10808
+ if (typeof wrapped === "function") {
10809
+ wrapped.prototype = wrapped.prototype || {};
10810
+ Object.defineProperties(wrapped, {
10811
+ __rrweb_original__: {
10812
+ enumerable: false,
10813
+ value: original
10814
+ }
10815
+ });
10816
+ }
10817
+ source[name] = wrapped;
10818
+ return () => {
10819
+ source[name] = original;
10820
+ };
10821
+ } catch {
10822
+ return () => {
10823
+ };
10824
+ }
10825
+ }
10694
10826
  const index = {
10695
10827
  childNodes,
10696
10828
  parentNode,
@@ -10703,7 +10835,8 @@ const index = {
10703
10835
  shadowRoot,
10704
10836
  querySelector,
10705
10837
  querySelectorAll,
10706
- mutationObserver: mutationObserverCtor
10838
+ mutationObserver: mutationObserverCtor,
10839
+ patch
10707
10840
  };
10708
10841
  function on(type, fn, target = document) {
10709
10842
  const options = { capture: true, passive: true };
@@ -10786,32 +10919,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
10786
10919
  );
10787
10920
  return () => hookSetter(target, key, original || {}, true);
10788
10921
  }
10789
- function patch(source, name, replacement) {
10790
- try {
10791
- if (!(name in source)) {
10792
- return () => {
10793
- };
10794
- }
10795
- const original = source[name];
10796
- const wrapped = replacement(original);
10797
- if (typeof wrapped === "function") {
10798
- wrapped.prototype = wrapped.prototype || {};
10799
- Object.defineProperties(wrapped, {
10800
- __rrweb_original__: {
10801
- enumerable: false,
10802
- value: original
10803
- }
10804
- });
10805
- }
10806
- source[name] = wrapped;
10807
- return () => {
10808
- source[name] = original;
10809
- };
10810
- } catch {
10811
- return () => {
10812
- };
10813
- }
10814
- }
10815
10922
  let nowTimestamp = Date.now;
10816
10923
  if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
10817
10924
  nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
@@ -11099,7 +11206,6 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
11099
11206
  return nowTimestamp;
11100
11207
  },
11101
11208
  on,
11102
- patch,
11103
11209
  polyfill: polyfill$1,
11104
11210
  queueToResolveTrees,
11105
11211
  shadowHostInDom,
@@ -11141,13 +11247,14 @@ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
11141
11247
  MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
11142
11248
  MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
11143
11249
  MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
11144
- MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
11145
- MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
11146
- MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
11147
- MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
11148
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
11149
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
11150
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
11250
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
11251
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
11252
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
11253
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
11254
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
11255
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
11256
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
11257
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
11151
11258
  return MouseInteractions2;
11152
11259
  })(MouseInteractions || {});
11153
11260
  var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
@@ -11544,10 +11651,18 @@ class MutationBuffer {
11544
11651
  this.attributes.push(item);
11545
11652
  this.attributeMap.set(textarea, item);
11546
11653
  }
11547
- item.attributes.value = Array.from(
11654
+ const value = Array.from(
11548
11655
  index.childNodes(textarea),
11549
11656
  (cn) => index.textContent(cn) || ""
11550
11657
  ).join("");
11658
+ item.attributes.value = maskInputValue({
11659
+ element: textarea,
11660
+ maskInputOptions: this.maskInputOptions,
11661
+ tagName: textarea.tagName,
11662
+ type: getInputType(textarea),
11663
+ value,
11664
+ maskInputFn: this.maskInputFn
11665
+ });
11551
11666
  });
11552
11667
  __publicField(this, "processMutation", (m) => {
11553
11668
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -13971,7 +14086,6 @@ try {
13971
14086
  }
13972
14087
  const mirror = createMirror$2();
13973
14088
  function record(options = {}) {
13974
- var _a2;
13975
14089
  const {
13976
14090
  emit,
13977
14091
  checkoutEveryNms,
@@ -13981,7 +14095,7 @@ function record(options = {}) {
13981
14095
  blockSelector = null,
13982
14096
  ignoreClass = "rr-ignore",
13983
14097
  ignoreSelector = null,
13984
- ignoreAttribute = "rr-ignore-attribute",
14098
+ ignoreAttribute = "rr-ignore",
13985
14099
  maskTextClass = "rr-mask",
13986
14100
  maskTextSelector = null,
13987
14101
  inlineStylesheet = true,
@@ -14007,24 +14121,12 @@ function record(options = {}) {
14007
14121
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
14008
14122
  errorHandler: errorHandler2
14009
14123
  } = options;
14010
- const win = options.customWindow || window;
14011
- const doc = options.customDocument || document;
14012
- try {
14013
- if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14014
- const cleanFrame = doc.createElement("iframe");
14015
- doc.body.appendChild(cleanFrame);
14016
- Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
14017
- doc.body.removeChild(cleanFrame);
14018
- }
14019
- } catch (err) {
14020
- console.debug("Unable to override Array.from", err);
14021
- }
14022
14124
  registerErrorHandler(errorHandler2);
14023
- const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14125
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14024
14126
  let passEmitsToParent = false;
14025
14127
  if (!inEmittingFrame) {
14026
14128
  try {
14027
- if (win.parent.document) {
14129
+ if (window.parent.document) {
14028
14130
  passEmitsToParent = false;
14029
14131
  }
14030
14132
  } catch (e2) {
@@ -14091,10 +14193,10 @@ function record(options = {}) {
14091
14193
  return e2;
14092
14194
  };
14093
14195
  wrappedEmit = (r2, isCheckout) => {
14094
- var _a3;
14196
+ var _a2;
14095
14197
  const e2 = r2;
14096
14198
  e2.timestamp = nowTimestamp();
14097
- if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14199
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14098
14200
  mutationBuffers.forEach((buf) => buf.unfreeze());
14099
14201
  }
14100
14202
  if (inEmittingFrame) {
@@ -14103,10 +14205,10 @@ function record(options = {}) {
14103
14205
  const message = {
14104
14206
  type: "rrweb",
14105
14207
  event: eventProcessor(e2),
14106
- origin: win.location.origin,
14208
+ origin: window.location.origin,
14107
14209
  isCheckout
14108
14210
  };
14109
- win.parent.postMessage(message, "*");
14211
+ window.parent.postMessage(message, "*");
14110
14212
  }
14111
14213
  if (e2.type === EventType.FullSnapshot) {
14112
14214
  lastFullSnapshotEvent = e2;
@@ -14177,7 +14279,7 @@ function record(options = {}) {
14177
14279
  canvasManager = new CanvasManager({
14178
14280
  recordCanvas,
14179
14281
  mutationCb: wrappedCanvasMutationEmit,
14180
- win,
14282
+ win: window,
14181
14283
  blockClass,
14182
14284
  blockSelector,
14183
14285
  mirror,
@@ -14218,9 +14320,9 @@ function record(options = {}) {
14218
14320
  {
14219
14321
  type: EventType.Meta,
14220
14322
  data: {
14221
- href: win.location.href,
14222
- width: getWindowWidth(win),
14223
- height: getWindowHeight(win)
14323
+ href: window.location.href,
14324
+ width: getWindowWidth(),
14325
+ height: getWindowHeight()
14224
14326
  }
14225
14327
  },
14226
14328
  isCheckout
@@ -14228,12 +14330,13 @@ function record(options = {}) {
14228
14330
  stylesheetManager.reset();
14229
14331
  shadowDomManager.init();
14230
14332
  mutationBuffers.forEach((buf) => buf.lock());
14231
- const node2 = snapshot(doc, {
14333
+ const node2 = snapshot(document, {
14232
14334
  mirror,
14233
14335
  blockClass,
14234
14336
  blockSelector,
14235
14337
  maskTextClass,
14236
14338
  maskTextSelector,
14339
+ ignoreAttribute,
14237
14340
  inlineStylesheet,
14238
14341
  maskAllInputs: maskInputOptions,
14239
14342
  maskTextFn,
@@ -14250,7 +14353,7 @@ function record(options = {}) {
14250
14353
  stylesheetManager.trackLinkElement(n2);
14251
14354
  }
14252
14355
  if (hasShadowRoot(n2)) {
14253
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), doc);
14356
+ shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
14254
14357
  }
14255
14358
  },
14256
14359
  onIframeLoad: (iframe, childSn) => {
@@ -14270,22 +14373,22 @@ function record(options = {}) {
14270
14373
  type: EventType.FullSnapshot,
14271
14374
  data: {
14272
14375
  node: node2,
14273
- initialOffset: getWindowScroll(win)
14376
+ initialOffset: getWindowScroll(window)
14274
14377
  }
14275
14378
  },
14276
14379
  isCheckout
14277
14380
  );
14278
14381
  mutationBuffers.forEach((buf) => buf.unlock());
14279
- if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14382
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14280
14383
  stylesheetManager.adoptStyleSheets(
14281
- doc.adoptedStyleSheets,
14282
- mirror.getId(doc)
14384
+ document.adoptedStyleSheets,
14385
+ mirror.getId(document)
14283
14386
  );
14284
14387
  };
14285
14388
  try {
14286
14389
  const handlers = [];
14287
- const observe = (doc2) => {
14288
- var _a3;
14390
+ const observe = (doc) => {
14391
+ var _a2;
14289
14392
  return callbackWrapper(initObservers)(
14290
14393
  {
14291
14394
  mutationCb: wrappedMutationEmit,
@@ -14388,7 +14491,7 @@ function record(options = {}) {
14388
14491
  inlineImages,
14389
14492
  userTriggeredOnInput,
14390
14493
  collectFonts,
14391
- doc: doc2,
14494
+ doc,
14392
14495
  maskInputFn,
14393
14496
  maskTextFn,
14394
14497
  keepIframeSrcFn,
@@ -14402,7 +14505,7 @@ function record(options = {}) {
14402
14505
  processedNodeManager,
14403
14506
  canvasManager,
14404
14507
  ignoreCSSAttributes,
14405
- plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14508
+ plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14406
14509
  observer: p.observer,
14407
14510
  options: p.options,
14408
14511
  callback: (payload) => wrappedEmit({
@@ -14426,10 +14529,10 @@ function record(options = {}) {
14426
14529
  });
14427
14530
  const init = () => {
14428
14531
  takeFullSnapshot$1();
14429
- handlers.push(observe(doc));
14532
+ handlers.push(observe(document));
14430
14533
  recording = true;
14431
14534
  };
14432
- if (doc.readyState === "interactive" || doc.readyState === "complete") {
14535
+ if (document.readyState === "interactive" || document.readyState === "complete") {
14433
14536
  init();
14434
14537
  } else {
14435
14538
  handlers.push(
@@ -14451,7 +14554,7 @@ function record(options = {}) {
14451
14554
  });
14452
14555
  if (recordAfter === "load") init();
14453
14556
  },
14454
- win
14557
+ window
14455
14558
  )
14456
14559
  );
14457
14560
  }