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

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.
@@ -188,6 +188,32 @@ function querySelectorAll$1(n2, selectors) {
188
188
  function mutationObserverCtor$1() {
189
189
  return getUntaintedPrototype$1("MutationObserver").constructor;
190
190
  }
191
+ function patch$1(source, name, replacement) {
192
+ try {
193
+ if (!(name in source)) {
194
+ return () => {
195
+ };
196
+ }
197
+ const original = source[name];
198
+ const wrapped = replacement(original);
199
+ if (typeof wrapped === "function") {
200
+ wrapped.prototype = wrapped.prototype || {};
201
+ Object.defineProperties(wrapped, {
202
+ __rrweb_original__: {
203
+ enumerable: false,
204
+ value: original
205
+ }
206
+ });
207
+ }
208
+ source[name] = wrapped;
209
+ return () => {
210
+ source[name] = original;
211
+ };
212
+ } catch (e2) {
213
+ return () => {
214
+ };
215
+ }
216
+ }
191
217
  const index$1 = {
192
218
  childNodes: childNodes$1,
193
219
  parentNode: parentNode$1,
@@ -200,8 +226,12 @@ const index$1 = {
200
226
  shadowRoot: shadowRoot$1,
201
227
  querySelector: querySelector$1,
202
228
  querySelectorAll: querySelectorAll$1,
203
- mutationObserver: mutationObserverCtor$1
229
+ mutationObserver: mutationObserverCtor$1,
230
+ patch: patch$1
204
231
  };
232
+ function isElement(n2) {
233
+ return n2.nodeType === n2.ELEMENT_NODE;
234
+ }
205
235
  function isShadowRoot(n2) {
206
236
  const hostEl = (
207
237
  // anchor and textarea elements also have a `host` property
@@ -479,19 +509,27 @@ function absolutifyURLs(cssText, href) {
479
509
  }
480
510
  );
481
511
  }
482
- function normalizeCssString(cssText) {
483
- return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
512
+ function normalizeCssString(cssText, _testNoPxNorm = false) {
513
+ if (_testNoPxNorm) {
514
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "");
515
+ } else {
516
+ return cssText.replace(/(\/\*[^*]*\*\/)|[\s;]/g, "").replace(/0px/g, "0");
517
+ }
484
518
  }
485
- function splitCssText(cssText, style) {
519
+ function splitCssText(cssText, style, _testNoPxNorm = false) {
486
520
  const childNodes2 = Array.from(style.childNodes);
487
521
  const splits = [];
488
- let iterLimit = 0;
522
+ let iterCount = 0;
489
523
  if (childNodes2.length > 1 && cssText && typeof cssText === "string") {
490
- let cssTextNorm = normalizeCssString(cssText);
524
+ let cssTextNorm = normalizeCssString(cssText, _testNoPxNorm);
491
525
  const normFactor = cssTextNorm.length / cssText.length;
492
526
  for (let i2 = 1; i2 < childNodes2.length; i2++) {
493
527
  if (childNodes2[i2].textContent && typeof childNodes2[i2].textContent === "string") {
494
- const textContentNorm = normalizeCssString(childNodes2[i2].textContent);
528
+ const textContentNorm = normalizeCssString(
529
+ childNodes2[i2].textContent,
530
+ _testNoPxNorm
531
+ );
532
+ const jLimit = 100;
495
533
  let j = 3;
496
534
  for (; j < textContentNorm.length; j++) {
497
535
  if (
@@ -504,23 +542,49 @@ function splitCssText(cssText, style) {
504
542
  break;
505
543
  }
506
544
  for (; j < textContentNorm.length; j++) {
507
- const bit = textContentNorm.substring(0, j);
508
- const bits = cssTextNorm.split(bit);
545
+ let startSubstring = textContentNorm.substring(0, j);
546
+ let cssNormSplits = cssTextNorm.split(startSubstring);
509
547
  let splitNorm = -1;
510
- if (bits.length === 2) {
511
- splitNorm = cssTextNorm.indexOf(bit);
512
- } else if (bits.length > 2 && bits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
513
- splitNorm = cssTextNorm.indexOf(bit, 1);
548
+ if (cssNormSplits.length === 2) {
549
+ splitNorm = cssNormSplits[0].length;
550
+ } else if (cssNormSplits.length > 2 && cssNormSplits[0] === "" && childNodes2[i2 - 1].textContent !== "") {
551
+ splitNorm = cssTextNorm.indexOf(startSubstring, 1);
552
+ } else if (cssNormSplits.length === 1) {
553
+ startSubstring = startSubstring.substring(
554
+ 0,
555
+ startSubstring.length - 1
556
+ );
557
+ cssNormSplits = cssTextNorm.split(startSubstring);
558
+ if (cssNormSplits.length <= 1) {
559
+ splits.push(cssText);
560
+ return splits;
561
+ }
562
+ j = jLimit + 1;
563
+ } else if (j === textContentNorm.length - 1) {
564
+ splitNorm = cssTextNorm.indexOf(startSubstring);
565
+ }
566
+ if (cssNormSplits.length >= 2 && j > jLimit) {
567
+ const prevTextContent = childNodes2[i2 - 1].textContent;
568
+ if (prevTextContent && typeof prevTextContent === "string") {
569
+ const prevMinLength = normalizeCssString(prevTextContent).length;
570
+ splitNorm = cssTextNorm.indexOf(startSubstring, prevMinLength);
571
+ }
572
+ if (splitNorm === -1) {
573
+ splitNorm = cssNormSplits[0].length;
574
+ }
514
575
  }
515
576
  if (splitNorm !== -1) {
516
577
  let k = Math.floor(splitNorm / normFactor);
517
578
  for (; k > 0 && k < cssText.length; ) {
518
- iterLimit += 1;
519
- if (iterLimit > 50 * childNodes2.length) {
579
+ iterCount += 1;
580
+ if (iterCount > 50 * childNodes2.length) {
520
581
  splits.push(cssText);
521
582
  return splits;
522
583
  }
523
- const normPart = normalizeCssString(cssText.substring(0, k));
584
+ const normPart = normalizeCssString(
585
+ cssText.substring(0, k),
586
+ _testNoPxNorm
587
+ );
524
588
  if (normPart.length === splitNorm) {
525
589
  splits.push(cssText.substring(0, k));
526
590
  cssText = cssText.substring(k);
@@ -616,9 +680,6 @@ function getXPath(node2) {
616
680
  }
617
681
  return "";
618
682
  }
619
- function isElement(n2) {
620
- return n2.nodeType === n2.ELEMENT_NODE;
621
- }
622
683
  function isTextVisible(n2) {
623
684
  var _a2;
624
685
  const parent = index$1.parentNode(n2);
@@ -640,10 +701,10 @@ function isElementVisible(n2) {
640
701
  const style = win ? win.getComputedStyle(n2) : null;
641
702
  const isStyleVisible = style != null && style.display !== "none" && style.visibility !== "hidden" && parseFloat(style.opacity) !== 0;
642
703
  const rect = n2.getBoundingClientRect();
643
- const result2 = isStyleVisible && isRectVisible(rect, win);
704
+ const result2 = isStyleVisible && isRectVisible(rect);
644
705
  return result2;
645
706
  }
646
- function isRectVisible(rect, win) {
707
+ function isRectVisible(rect, win = window) {
647
708
  var _a3, _b2, _c2, _d2;
648
709
  var _a2, _b, _c, _d;
649
710
  const height = (_b2 = (_a3 = win == null ? void 0 : win.innerHeight) != null ? _a3 : (_b = (_a2 = win == null ? void 0 : win.document) == null ? void 0 : _a2.documentElement) == null ? void 0 : _b.clientHeight) != null ? _b2 : 0;
@@ -688,7 +749,7 @@ const interactiveTags = [
688
749
  "video",
689
750
  "audio"
690
751
  ];
691
- const inlineEventAttributes = [
752
+ const inlineEventAttributes$1 = [
692
753
  "onclick",
693
754
  "ondblclick",
694
755
  "onmousedown",
@@ -713,27 +774,20 @@ const inlineEventAttributes = [
713
774
  "ontouchcancel"
714
775
  ];
715
776
  const interactiveElementsRegistry$1 = /* @__PURE__ */ new WeakSet();
716
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
717
- const originalAddEventListener = EventTarget.prototype.addEventListener;
718
- EventTarget.prototype.addEventListener = function(type, listener, options) {
719
- originalAddEventListener.call(this, type, listener, options);
720
- if (this instanceof Element) {
721
- const eventType = type.toLowerCase();
722
- if (interactiveEvents$1.includes(eventType)) {
723
- interactiveElementsRegistry$1.add(this);
724
- }
777
+ const originalAddEventListener$1 = EventTarget.prototype.addEventListener;
778
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
779
+ originalAddEventListener$1.call(this, type, listener, options);
780
+ if (this instanceof Element) {
781
+ const eventType = type.toLowerCase();
782
+ if (interactiveEvents$1.includes(eventType)) {
783
+ interactiveElementsRegistry$1.add(this);
725
784
  }
726
- };
727
- }
728
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
729
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
730
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
731
- originalRemoveEventListener.call(this, type, listener, options);
732
- if (this instanceof Element) {
733
- type.toLowerCase();
734
- }
735
- };
736
- }
785
+ }
786
+ };
787
+ const originalRemoveEventListener$1 = EventTarget.prototype.removeEventListener;
788
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
789
+ originalRemoveEventListener$1.call(this, type, listener, options);
790
+ };
737
791
  function hasEventListeners(n2) {
738
792
  return n2 instanceof Element && interactiveElementsRegistry$1.has(n2);
739
793
  }
@@ -753,33 +807,20 @@ function isElementInteractive(n2) {
753
807
  }
754
808
  return false;
755
809
  }
756
- function inspectInlineEventHandlers(doc) {
757
- if (!doc || typeof doc.querySelectorAll !== "function") return;
758
- const allElements = doc.querySelectorAll("*");
810
+ function inspectInlineEventHandlers$1() {
811
+ const allElements = document.querySelectorAll("*");
759
812
  allElements.forEach((el) => {
760
- inlineEventAttributes.forEach((attr) => {
813
+ inlineEventAttributes$1.forEach((attr) => {
761
814
  if (el.hasAttribute(attr)) {
762
815
  interactiveElementsRegistry$1.add(el);
763
816
  }
764
817
  });
765
818
  });
766
819
  }
767
- function scheduleInlineEventInspection(doc) {
768
- if (!doc || typeof doc.addEventListener !== "function" || typeof doc.querySelectorAll !== "function") {
769
- return;
770
- }
771
- try {
772
- if (doc.readyState === "complete" || doc.readyState === "interactive") {
773
- inspectInlineEventHandlers(doc);
774
- } else {
775
- doc.addEventListener("DOMContentLoaded", () => inspectInlineEventHandlers(doc), {
776
- once: true,
777
- capture: false
778
- });
779
- }
780
- } catch (e2) {
781
- console.warn("[inlineEventInspection] Failed to inspect document:", e2);
782
- }
820
+ if (document.readyState === "complete" || document.readyState === "interactive") {
821
+ inspectInlineEventHandlers$1();
822
+ } else {
823
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers$1);
783
824
  }
784
825
  let _id = 1;
785
826
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
@@ -1073,6 +1114,7 @@ function serializeNode(n2, options) {
1073
1114
  childNodes: [],
1074
1115
  xPath,
1075
1116
  compatMode: n2.compatMode
1117
+ // probably "BackCompat"
1076
1118
  };
1077
1119
  } else {
1078
1120
  return {
@@ -1367,7 +1409,7 @@ function slimDOMExcluded(sn, slimDOMOptions) {
1367
1409
  } else if (sn.type === NodeType$3.Element) {
1368
1410
  if (slimDOMOptions.script && // script tag
1369
1411
  (sn.tagName === "script" || // (module)preload link
1370
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
1412
+ sn.tagName === "link" && (sn.attributes.rel === "preload" && sn.attributes.as === "script" || sn.attributes.rel === "modulepreload") || // prefetch link
1371
1413
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
1372
1414
  return true;
1373
1415
  } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
@@ -1629,7 +1671,7 @@ function snapshot(n2, options) {
1629
1671
  blockSelector = null,
1630
1672
  maskTextClass = "rr-mask",
1631
1673
  maskTextSelector = null,
1632
- ignoreAttribute = "rr-ignore-attr",
1674
+ ignoreAttribute = "rr-ignore",
1633
1675
  inlineStylesheet = true,
1634
1676
  inlineImages = false,
1635
1677
  recordCanvas = false,
@@ -1646,7 +1688,7 @@ function snapshot(n2, options) {
1646
1688
  stylesheetLoadTimeout,
1647
1689
  keepIframeSrcFn = () => false
1648
1690
  } = options || {};
1649
- scheduleInlineEventInspection(n2);
1691
+ console.debug(`${Date.now()} [rrweb-snapshot] snapshot:options:`, options);
1650
1692
  const maskInputOptions = maskAllInputs === true ? {
1651
1693
  color: true,
1652
1694
  date: true,
@@ -5347,11 +5389,16 @@ function getTagName(n2) {
5347
5389
  function adaptCssForReplay(cssText, cache) {
5348
5390
  const cachedStyle = cache == null ? void 0 : cache.stylesWithHoverClass.get(cssText);
5349
5391
  if (cachedStyle) return cachedStyle;
5350
- const ast = postcss$1$1([
5351
- mediaSelectorPlugin,
5352
- pseudoClassPlugin
5353
- ]).process(cssText);
5354
- const result2 = ast.css;
5392
+ let result2 = cssText;
5393
+ try {
5394
+ const ast = postcss$1$1([
5395
+ mediaSelectorPlugin,
5396
+ pseudoClassPlugin
5397
+ ]).process(cssText);
5398
+ result2 = ast.css;
5399
+ } catch (error) {
5400
+ console.warn("Failed to adapt css for replay", error);
5401
+ }
5355
5402
  cache == null ? void 0 : cache.stylesWithHoverClass.set(cssText, result2);
5356
5403
  return result2;
5357
5404
  }
@@ -5372,11 +5419,39 @@ function applyCssSplits(n2, cssText, hackCss, cache) {
5372
5419
  while (cssTextSplits.length > 1 && cssTextSplits.length > childTextNodes.length) {
5373
5420
  cssTextSplits.splice(-2, 2, cssTextSplits.slice(-2).join(""));
5374
5421
  }
5422
+ let adaptedCss = "";
5423
+ if (hackCss) {
5424
+ adaptedCss = adaptCssForReplay(cssTextSplits.join(""), cache);
5425
+ }
5426
+ let startIndex = 0;
5375
5427
  for (let i2 = 0; i2 < childTextNodes.length; i2++) {
5428
+ if (i2 === cssTextSplits.length) {
5429
+ break;
5430
+ }
5376
5431
  const childTextNode = childTextNodes[i2];
5377
- const cssTextSection = cssTextSplits[i2];
5378
- if (childTextNode && cssTextSection) {
5379
- childTextNode.textContent = hackCss ? adaptCssForReplay(cssTextSection, cache) : cssTextSection;
5432
+ if (!hackCss) {
5433
+ childTextNode.textContent = cssTextSplits[i2];
5434
+ } else if (i2 < cssTextSplits.length - 1) {
5435
+ let endIndex = startIndex;
5436
+ let endSearch = cssTextSplits[i2 + 1].length;
5437
+ endSearch = Math.min(endSearch, 30);
5438
+ let found = false;
5439
+ for (; endSearch > 2; endSearch--) {
5440
+ const searchBit = cssTextSplits[i2 + 1].substring(0, endSearch);
5441
+ const searchIndex = adaptedCss.substring(startIndex).indexOf(searchBit);
5442
+ found = searchIndex !== -1;
5443
+ if (found) {
5444
+ endIndex += searchIndex;
5445
+ break;
5446
+ }
5447
+ }
5448
+ if (!found) {
5449
+ endIndex += cssTextSplits[i2].length;
5450
+ }
5451
+ childTextNode.textContent = adaptedCss.substring(startIndex, endIndex);
5452
+ startIndex = endIndex;
5453
+ } else {
5454
+ childTextNode.textContent = adaptedCss.substring(startIndex);
5380
5455
  }
5381
5456
  }
5382
5457
  }
@@ -5460,8 +5535,8 @@ function buildNode(n2, options) {
5460
5535
  } else if (tagName === "meta" && n2.attributes["http-equiv"] === "Content-Security-Policy" && name === "content") {
5461
5536
  node2.setAttribute("csp-content", value.toString());
5462
5537
  continue;
5463
- } else if (tagName === "link" && (n2.attributes.rel === "preload" || n2.attributes.rel === "modulepreload") && n2.attributes.as === "script") {
5464
- } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && n2.attributes.href.endsWith(".js")) {
5538
+ } else if (tagName === "link" && (n2.attributes.rel === "preload" && n2.attributes.as === "script" || n2.attributes.rel === "modulepreload")) {
5539
+ } else if (tagName === "link" && n2.attributes.rel === "prefetch" && typeof n2.attributes.href === "string" && extractFileExtension(n2.attributes.href) === "js") {
5465
5540
  } else if (tagName === "img" && n2.attributes.srcset && n2.attributes.rr_dataURL) {
5466
5541
  node2.setAttribute(
5467
5542
  "rrweb-original-srcset",
@@ -5770,27 +5845,59 @@ const interactiveEvents = [
5770
5845
  "touchend",
5771
5846
  "touchcancel"
5772
5847
  ];
5848
+ const inlineEventAttributes = [
5849
+ "onclick",
5850
+ "ondblclick",
5851
+ "onmousedown",
5852
+ "onmouseup",
5853
+ "onmouseover",
5854
+ "onmouseout",
5855
+ "onmousemove",
5856
+ "onfocus",
5857
+ "onblur",
5858
+ "onkeydown",
5859
+ "onkeypress",
5860
+ "onkeyup",
5861
+ "onchange",
5862
+ "oninput",
5863
+ "onsubmit",
5864
+ "onreset",
5865
+ "onselect",
5866
+ "oncontextmenu",
5867
+ "ontouchstart",
5868
+ "ontouchmove",
5869
+ "ontouchend",
5870
+ "ontouchcancel"
5871
+ ];
5773
5872
  const interactiveElementsRegistry = /* @__PURE__ */ new WeakSet();
5774
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5775
- const originalAddEventListener = EventTarget.prototype.addEventListener;
5776
- EventTarget.prototype.addEventListener = function(type, listener, options) {
5777
- originalAddEventListener.call(this, type, listener, options);
5778
- if (this instanceof Element) {
5779
- const eventType = type.toLowerCase();
5780
- if (interactiveEvents.includes(eventType)) {
5781
- interactiveElementsRegistry.add(this);
5782
- }
5873
+ const originalAddEventListener = EventTarget.prototype.addEventListener;
5874
+ EventTarget.prototype.addEventListener = function(type, listener, options) {
5875
+ originalAddEventListener.call(this, type, listener, options);
5876
+ if (this instanceof Element) {
5877
+ const eventType = type.toLowerCase();
5878
+ if (interactiveEvents.includes(eventType)) {
5879
+ interactiveElementsRegistry.add(this);
5783
5880
  }
5784
- };
5881
+ }
5882
+ };
5883
+ const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5884
+ EventTarget.prototype.removeEventListener = function(type, listener, options) {
5885
+ originalRemoveEventListener.call(this, type, listener, options);
5886
+ };
5887
+ function inspectInlineEventHandlers() {
5888
+ const allElements = document.querySelectorAll("*");
5889
+ allElements.forEach((el) => {
5890
+ inlineEventAttributes.forEach((attr) => {
5891
+ if (el.hasAttribute(attr)) {
5892
+ interactiveElementsRegistry.add(el);
5893
+ }
5894
+ });
5895
+ });
5785
5896
  }
5786
- if (typeof Element !== "undefined" && typeof EventTarget !== "undefined") {
5787
- const originalRemoveEventListener = EventTarget.prototype.removeEventListener;
5788
- EventTarget.prototype.removeEventListener = function(type, listener, options) {
5789
- originalRemoveEventListener.call(this, type, listener, options);
5790
- if (this instanceof Element) {
5791
- type.toLowerCase();
5792
- }
5793
- };
5897
+ if (document.readyState === "complete" || document.readyState === "interactive") {
5898
+ inspectInlineEventHandlers();
5899
+ } else {
5900
+ document.addEventListener("DOMContentLoaded", inspectInlineEventHandlers);
5794
5901
  }
5795
5902
  function getDefaultExportFromCjs(x2) {
5796
5903
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -10746,6 +10853,32 @@ function querySelectorAll(n2, selectors) {
10746
10853
  function mutationObserverCtor() {
10747
10854
  return getUntaintedPrototype("MutationObserver").constructor;
10748
10855
  }
10856
+ function patch(source, name, replacement) {
10857
+ try {
10858
+ if (!(name in source)) {
10859
+ return () => {
10860
+ };
10861
+ }
10862
+ const original = source[name];
10863
+ const wrapped = replacement(original);
10864
+ if (typeof wrapped === "function") {
10865
+ wrapped.prototype = wrapped.prototype || {};
10866
+ Object.defineProperties(wrapped, {
10867
+ __rrweb_original__: {
10868
+ enumerable: false,
10869
+ value: original
10870
+ }
10871
+ });
10872
+ }
10873
+ source[name] = wrapped;
10874
+ return () => {
10875
+ source[name] = original;
10876
+ };
10877
+ } catch (e2) {
10878
+ return () => {
10879
+ };
10880
+ }
10881
+ }
10749
10882
  const index = {
10750
10883
  childNodes,
10751
10884
  parentNode,
@@ -10758,7 +10891,8 @@ const index = {
10758
10891
  shadowRoot,
10759
10892
  querySelector,
10760
10893
  querySelectorAll,
10761
- mutationObserver: mutationObserverCtor
10894
+ mutationObserver: mutationObserverCtor,
10895
+ patch
10762
10896
  };
10763
10897
  function on(type, fn, target = document) {
10764
10898
  const options = { capture: true, passive: true };
@@ -10841,32 +10975,6 @@ function hookSetter(target, key, d, isRevoked, win = window) {
10841
10975
  );
10842
10976
  return () => hookSetter(target, key, original || {}, true);
10843
10977
  }
10844
- function patch(source, name, replacement) {
10845
- try {
10846
- if (!(name in source)) {
10847
- return () => {
10848
- };
10849
- }
10850
- const original = source[name];
10851
- const wrapped = replacement(original);
10852
- if (typeof wrapped === "function") {
10853
- wrapped.prototype = wrapped.prototype || {};
10854
- Object.defineProperties(wrapped, {
10855
- __rrweb_original__: {
10856
- enumerable: false,
10857
- value: original
10858
- }
10859
- });
10860
- }
10861
- source[name] = wrapped;
10862
- return () => {
10863
- source[name] = original;
10864
- };
10865
- } catch (e2) {
10866
- return () => {
10867
- };
10868
- }
10869
- }
10870
10978
  let nowTimestamp = Date.now;
10871
10979
  if (!/* @__PURE__ */ /[1-9][0-9]{12}/.test(Date.now().toString())) {
10872
10980
  nowTimestamp = () => (/* @__PURE__ */ new Date()).getTime();
@@ -11155,7 +11263,6 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
11155
11263
  return nowTimestamp;
11156
11264
  },
11157
11265
  on,
11158
- patch,
11159
11266
  polyfill: polyfill$1,
11160
11267
  queueToResolveTrees,
11161
11268
  shadowHostInDom,
@@ -11197,13 +11304,14 @@ var MouseInteractions = /* @__PURE__ */ ((MouseInteractions2) => {
11197
11304
  MouseInteractions2[MouseInteractions2["MouseUp"] = 0] = "MouseUp";
11198
11305
  MouseInteractions2[MouseInteractions2["MouseDown"] = 1] = "MouseDown";
11199
11306
  MouseInteractions2[MouseInteractions2["Click"] = 2] = "Click";
11200
- MouseInteractions2[MouseInteractions2["DblClick"] = 3] = "DblClick";
11201
- MouseInteractions2[MouseInteractions2["Focus"] = 4] = "Focus";
11202
- MouseInteractions2[MouseInteractions2["Blur"] = 5] = "Blur";
11203
- MouseInteractions2[MouseInteractions2["TouchStart"] = 6] = "TouchStart";
11204
- MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 7] = "TouchMove_Departed";
11205
- MouseInteractions2[MouseInteractions2["TouchEnd"] = 8] = "TouchEnd";
11206
- MouseInteractions2[MouseInteractions2["TouchCancel"] = 9] = "TouchCancel";
11307
+ MouseInteractions2[MouseInteractions2["ContextMenu"] = 3] = "ContextMenu";
11308
+ MouseInteractions2[MouseInteractions2["DblClick"] = 4] = "DblClick";
11309
+ MouseInteractions2[MouseInteractions2["Focus"] = 5] = "Focus";
11310
+ MouseInteractions2[MouseInteractions2["Blur"] = 6] = "Blur";
11311
+ MouseInteractions2[MouseInteractions2["TouchStart"] = 7] = "TouchStart";
11312
+ MouseInteractions2[MouseInteractions2["TouchMove_Departed"] = 8] = "TouchMove_Departed";
11313
+ MouseInteractions2[MouseInteractions2["TouchEnd"] = 9] = "TouchEnd";
11314
+ MouseInteractions2[MouseInteractions2["TouchCancel"] = 10] = "TouchCancel";
11207
11315
  return MouseInteractions2;
11208
11316
  })(MouseInteractions || {});
11209
11317
  var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
@@ -11583,10 +11691,18 @@ class MutationBuffer {
11583
11691
  this.attributes.push(item);
11584
11692
  this.attributeMap.set(textarea, item);
11585
11693
  }
11586
- item.attributes.value = Array.from(
11694
+ const value = Array.from(
11587
11695
  index.childNodes(textarea),
11588
11696
  (cn) => index.textContent(cn) || ""
11589
11697
  ).join("");
11698
+ item.attributes.value = maskInputValue({
11699
+ element: textarea,
11700
+ maskInputOptions: this.maskInputOptions,
11701
+ tagName: textarea.tagName,
11702
+ type: getInputType(textarea),
11703
+ value,
11704
+ maskInputFn: this.maskInputFn
11705
+ });
11590
11706
  });
11591
11707
  __publicField(this, "processMutation", (m) => {
11592
11708
  if (isIgnored(m.target, this.mirror, this.slimDOMOptions)) {
@@ -14003,7 +14119,6 @@ try {
14003
14119
  }
14004
14120
  const mirror = createMirror$2();
14005
14121
  function record(options = {}) {
14006
- var _a2;
14007
14122
  const {
14008
14123
  emit,
14009
14124
  checkoutEveryNms,
@@ -14013,7 +14128,7 @@ function record(options = {}) {
14013
14128
  blockSelector = null,
14014
14129
  ignoreClass = "rr-ignore",
14015
14130
  ignoreSelector = null,
14016
- ignoreAttribute = "rr-ignore-attribute",
14131
+ ignoreAttribute = "rr-ignore",
14017
14132
  maskTextClass = "rr-mask",
14018
14133
  maskTextSelector = null,
14019
14134
  inlineStylesheet = true,
@@ -14039,24 +14154,13 @@ function record(options = {}) {
14039
14154
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
14040
14155
  errorHandler: errorHandler2
14041
14156
  } = options;
14042
- const win = options.customWindow || window;
14043
- const doc = options.customDocument || document;
14044
- try {
14045
- if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14046
- const cleanFrame = doc.createElement("iframe");
14047
- doc.body.appendChild(cleanFrame);
14048
- Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
14049
- doc.body.removeChild(cleanFrame);
14050
- }
14051
- } catch (err) {
14052
- console.debug("Unable to override Array.from", err);
14053
- }
14157
+ console.debug(`${Date.now()} [rrweb] record:options:`, options);
14054
14158
  registerErrorHandler(errorHandler2);
14055
- const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14159
+ const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14056
14160
  let passEmitsToParent = false;
14057
14161
  if (!inEmittingFrame) {
14058
14162
  try {
14059
- if (win.parent.document) {
14163
+ if (window.parent.document) {
14060
14164
  passEmitsToParent = false;
14061
14165
  }
14062
14166
  } catch (e2) {
@@ -14123,10 +14227,10 @@ function record(options = {}) {
14123
14227
  return e2;
14124
14228
  };
14125
14229
  wrappedEmit = (r2, isCheckout) => {
14126
- var _a3;
14230
+ var _a2;
14127
14231
  const e2 = r2;
14128
14232
  e2.timestamp = nowTimestamp();
14129
- if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14233
+ if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14130
14234
  mutationBuffers.forEach((buf) => buf.unfreeze());
14131
14235
  }
14132
14236
  if (inEmittingFrame) {
@@ -14135,10 +14239,10 @@ function record(options = {}) {
14135
14239
  const message = {
14136
14240
  type: "rrweb",
14137
14241
  event: eventProcessor(e2),
14138
- origin: win.location.origin,
14242
+ origin: window.location.origin,
14139
14243
  isCheckout
14140
14244
  };
14141
- win.parent.postMessage(message, "*");
14245
+ window.parent.postMessage(message, "*");
14142
14246
  }
14143
14247
  if (e2.type === EventType.FullSnapshot) {
14144
14248
  lastFullSnapshotEvent = e2;
@@ -14205,7 +14309,7 @@ function record(options = {}) {
14205
14309
  canvasManager = new CanvasManager({
14206
14310
  recordCanvas,
14207
14311
  mutationCb: wrappedCanvasMutationEmit,
14208
- win,
14312
+ win: window,
14209
14313
  blockClass,
14210
14314
  blockSelector,
14211
14315
  mirror,
@@ -14246,9 +14350,9 @@ function record(options = {}) {
14246
14350
  {
14247
14351
  type: EventType.Meta,
14248
14352
  data: {
14249
- href: win.location.href,
14250
- width: getWindowWidth(win),
14251
- height: getWindowHeight(win)
14353
+ href: window.location.href,
14354
+ width: getWindowWidth(),
14355
+ height: getWindowHeight()
14252
14356
  }
14253
14357
  },
14254
14358
  isCheckout
@@ -14256,12 +14360,13 @@ function record(options = {}) {
14256
14360
  stylesheetManager.reset();
14257
14361
  shadowDomManager.init();
14258
14362
  mutationBuffers.forEach((buf) => buf.lock());
14259
- const node2 = snapshot(doc, {
14363
+ const node2 = snapshot(document, {
14260
14364
  mirror,
14261
14365
  blockClass,
14262
14366
  blockSelector,
14263
14367
  maskTextClass,
14264
14368
  maskTextSelector,
14369
+ ignoreAttribute,
14265
14370
  inlineStylesheet,
14266
14371
  maskAllInputs: maskInputOptions,
14267
14372
  maskTextFn,
@@ -14278,7 +14383,7 @@ function record(options = {}) {
14278
14383
  stylesheetManager.trackLinkElement(n2);
14279
14384
  }
14280
14385
  if (hasShadowRoot(n2)) {
14281
- shadowDomManager.addShadowRoot(index.shadowRoot(n2), doc);
14386
+ shadowDomManager.addShadowRoot(index.shadowRoot(n2), document);
14282
14387
  }
14283
14388
  },
14284
14389
  onIframeLoad: (iframe, childSn) => {
@@ -14298,22 +14403,22 @@ function record(options = {}) {
14298
14403
  type: EventType.FullSnapshot,
14299
14404
  data: {
14300
14405
  node: node2,
14301
- initialOffset: getWindowScroll(win)
14406
+ initialOffset: getWindowScroll(window)
14302
14407
  }
14303
14408
  },
14304
14409
  isCheckout
14305
14410
  );
14306
14411
  mutationBuffers.forEach((buf) => buf.unlock());
14307
- if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14412
+ if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14308
14413
  stylesheetManager.adoptStyleSheets(
14309
- doc.adoptedStyleSheets,
14310
- mirror.getId(doc)
14414
+ document.adoptedStyleSheets,
14415
+ mirror.getId(document)
14311
14416
  );
14312
14417
  };
14313
14418
  try {
14314
14419
  const handlers = [];
14315
- const observe = (doc2) => {
14316
- var _a3;
14420
+ const observe = (doc) => {
14421
+ var _a2;
14317
14422
  return callbackWrapper(initObservers)(
14318
14423
  {
14319
14424
  mutationCb: wrappedMutationEmit,
@@ -14406,7 +14511,7 @@ function record(options = {}) {
14406
14511
  inlineImages,
14407
14512
  userTriggeredOnInput,
14408
14513
  collectFonts,
14409
- doc: doc2,
14514
+ doc,
14410
14515
  maskInputFn,
14411
14516
  maskTextFn,
14412
14517
  keepIframeSrcFn,
@@ -14420,7 +14525,7 @@ function record(options = {}) {
14420
14525
  processedNodeManager,
14421
14526
  canvasManager,
14422
14527
  ignoreCSSAttributes,
14423
- plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14528
+ plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14424
14529
  observer: p.observer,
14425
14530
  options: p.options,
14426
14531
  callback: (payload) => wrappedEmit({
@@ -14444,10 +14549,10 @@ function record(options = {}) {
14444
14549
  });
14445
14550
  const init = () => {
14446
14551
  takeFullSnapshot$1();
14447
- handlers.push(observe(doc));
14552
+ handlers.push(observe(document));
14448
14553
  recording = true;
14449
14554
  };
14450
- if (doc.readyState === "interactive" || doc.readyState === "complete") {
14555
+ if (document.readyState === "interactive" || document.readyState === "complete") {
14451
14556
  init();
14452
14557
  } else {
14453
14558
  handlers.push(
@@ -14469,7 +14574,7 @@ function record(options = {}) {
14469
14574
  });
14470
14575
  if (recordAfter === "load") init();
14471
14576
  },
14472
- win
14577
+ window
14473
14578
  )
14474
14579
  );
14475
14580
  }