@sentry/replay 7.92.0 → 7.93.0

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/cjs/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ var {
2
+ _nullishCoalesce,
3
+ _optionalChain
4
+ } = require('@sentry/utils');
5
+
1
6
  Object.defineProperty(exports, '__esModule', { value: true });
2
7
 
3
8
  const core = require('@sentry/core');
@@ -84,7 +89,7 @@ const CANVAS_QUALITY = {
84
89
  },
85
90
  };
86
91
 
87
- var NodeType$1;
92
+ function _nullishCoalesce$1(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var NodeType$1;
88
93
  (function (NodeType) {
89
94
  NodeType[NodeType["Document"] = 0] = "Document";
90
95
  NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
@@ -98,8 +103,8 @@ function isElement$1(n) {
98
103
  return n.nodeType === n.ELEMENT_NODE;
99
104
  }
100
105
  function isShadowRoot(n) {
101
- const host = n === null || n === void 0 ? void 0 : n.host;
102
- return Boolean((host === null || host === void 0 ? void 0 : host.shadowRoot) === n);
106
+ const host = _optionalChain$5([n, 'optionalAccess', _ => _.host]);
107
+ return Boolean(_optionalChain$5([host, 'optionalAccess', _2 => _2.shadowRoot]) === n);
103
108
  }
104
109
  function isNativeShadowDom(shadowRoot) {
105
110
  return Object.prototype.toString.call(shadowRoot) === '[object ShadowRoot]';
@@ -173,11 +178,10 @@ class Mirror {
173
178
  this.nodeMetaMap = new WeakMap();
174
179
  }
175
180
  getId(n) {
176
- var _a;
177
181
  if (!n)
178
182
  return -1;
179
- const id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
180
- return id !== null && id !== void 0 ? id : -1;
183
+ const id = _optionalChain$5([this, 'access', _3 => _3.getMeta, 'call', _4 => _4(n), 'optionalAccess', _5 => _5.id]);
184
+ return _nullishCoalesce$1(id, () => ( -1));
181
185
  }
182
186
  getNode(id) {
183
187
  return this.idNodeMap.get(id) || null;
@@ -699,7 +703,6 @@ function getRootId(doc, mirror) {
699
703
  return docId === 1 ? undefined : docId;
700
704
  }
701
705
  function serializeTextNode(n, options) {
702
- var _a;
703
706
  const { maskAllText, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, maskTextFn, maskInputOptions, maskInputFn, rootId, } = options;
704
707
  const parentTagName = n.parentNode && n.parentNode.tagName;
705
708
  let textContent = n.textContent;
@@ -710,7 +713,7 @@ function serializeTextNode(n, options) {
710
713
  try {
711
714
  if (n.nextSibling || n.previousSibling) {
712
715
  }
713
- else if ((_a = n.parentNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) {
716
+ else if (_optionalChain$5([n, 'access', _6 => _6.parentNode, 'access', _7 => _7.sheet, 'optionalAccess', _8 => _8.cssRules])) {
714
717
  textContent = stringifyStylesheet(n.parentNode.sheet);
715
718
  }
716
719
  }
@@ -1263,6 +1266,7 @@ function snapshot(n, options) {
1263
1266
  });
1264
1267
  }
1265
1268
 
1269
+ function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1266
1270
  function on(type, fn, target = document) {
1267
1271
  const options = { capture: true, passive: true };
1268
1272
  target.addEventListener(type, fn, options);
@@ -1369,7 +1373,7 @@ function patch(source, name, replacement) {
1369
1373
  source[name] = original;
1370
1374
  };
1371
1375
  }
1372
- catch (_a) {
1376
+ catch (e2) {
1373
1377
  return () => {
1374
1378
  };
1375
1379
  }
@@ -1379,24 +1383,23 @@ if (!(/[1-9][0-9]{12}/.test(Date.now().toString()))) {
1379
1383
  nowTimestamp = () => new Date().getTime();
1380
1384
  }
1381
1385
  function getWindowScroll(win) {
1382
- var _a, _b, _c, _d, _e, _f;
1383
1386
  const doc = win.document;
1384
1387
  return {
1385
1388
  left: doc.scrollingElement
1386
1389
  ? doc.scrollingElement.scrollLeft
1387
1390
  : win.pageXOffset !== undefined
1388
1391
  ? win.pageXOffset
1389
- : (doc === null || doc === void 0 ? void 0 : doc.documentElement.scrollLeft) ||
1390
- ((_b = (_a = doc === null || doc === void 0 ? void 0 : doc.body) === null || _a === void 0 ? void 0 : _a.parentElement) === null || _b === void 0 ? void 0 : _b.scrollLeft) ||
1391
- ((_c = doc === null || doc === void 0 ? void 0 : doc.body) === null || _c === void 0 ? void 0 : _c.scrollLeft) ||
1392
+ : _optionalChain$4([doc, 'optionalAccess', _ => _.documentElement, 'access', _2 => _2.scrollLeft]) ||
1393
+ _optionalChain$4([doc, 'optionalAccess', _3 => _3.body, 'optionalAccess', _4 => _4.parentElement, 'optionalAccess', _5 => _5.scrollLeft]) ||
1394
+ _optionalChain$4([doc, 'optionalAccess', _6 => _6.body, 'optionalAccess', _7 => _7.scrollLeft]) ||
1392
1395
  0,
1393
1396
  top: doc.scrollingElement
1394
1397
  ? doc.scrollingElement.scrollTop
1395
1398
  : win.pageYOffset !== undefined
1396
1399
  ? win.pageYOffset
1397
- : (doc === null || doc === void 0 ? void 0 : doc.documentElement.scrollTop) ||
1398
- ((_e = (_d = doc === null || doc === void 0 ? void 0 : doc.body) === null || _d === void 0 ? void 0 : _d.parentElement) === null || _e === void 0 ? void 0 : _e.scrollTop) ||
1399
- ((_f = doc === null || doc === void 0 ? void 0 : doc.body) === null || _f === void 0 ? void 0 : _f.scrollTop) ||
1400
+ : _optionalChain$4([doc, 'optionalAccess', _8 => _8.documentElement, 'access', _9 => _9.scrollTop]) ||
1401
+ _optionalChain$4([doc, 'optionalAccess', _10 => _10.body, 'optionalAccess', _11 => _11.parentElement, 'optionalAccess', _12 => _12.scrollTop]) ||
1402
+ _optionalChain$4([doc, 'optionalAccess', _13 => _13.body, 'optionalAccess', _14 => _14.scrollTop]) ||
1400
1403
  0,
1401
1404
  };
1402
1405
  }
@@ -1498,7 +1501,7 @@ function isSerializedStylesheet(n, mirror) {
1498
1501
  mirror.getMeta(n));
1499
1502
  }
1500
1503
  function hasShadowRoot(n) {
1501
- return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
1504
+ return Boolean(_optionalChain$4([n, 'optionalAccess', _18 => _18.shadowRoot]));
1502
1505
  }
1503
1506
  class StyleSheetMirror {
1504
1507
  constructor() {
@@ -1507,8 +1510,7 @@ class StyleSheetMirror {
1507
1510
  this.idStyleMap = new Map();
1508
1511
  }
1509
1512
  getId(stylesheet) {
1510
- var _a;
1511
- return (_a = this.styleIDMap.get(stylesheet)) !== null && _a !== void 0 ? _a : -1;
1513
+ return _nullishCoalesce(this.styleIDMap.get(stylesheet), () => ( -1));
1512
1514
  }
1513
1515
  has(stylesheet) {
1514
1516
  return this.styleIDMap.has(stylesheet);
@@ -1539,9 +1541,8 @@ class StyleSheetMirror {
1539
1541
  }
1540
1542
  }
1541
1543
  function getShadowHost(n) {
1542
- var _a, _b;
1543
1544
  let shadowHost = null;
1544
- if (((_b = (_a = n.getRootNode) === null || _a === void 0 ? void 0 : _a.call(n)) === null || _b === void 0 ? void 0 : _b.nodeType) === Node.DOCUMENT_FRAGMENT_NODE &&
1545
+ if (_optionalChain$4([n, 'access', _19 => _19.getRootNode, 'optionalCall', _20 => _20(), 'optionalAccess', _21 => _21.nodeType]) === Node.DOCUMENT_FRAGMENT_NODE &&
1545
1546
  n.getRootNode().host)
1546
1547
  shadowHost = n.getRootNode().host;
1547
1548
  return shadowHost;
@@ -1566,6 +1567,34 @@ function inDom(n) {
1566
1567
  return false;
1567
1568
  return doc.contains(n) || shadowHostInDom(n);
1568
1569
  }
1570
+ let cachedRequestAnimationFrameImplementation;
1571
+ function getRequestAnimationFrameImplementation() {
1572
+ if (cachedRequestAnimationFrameImplementation) {
1573
+ return cachedRequestAnimationFrameImplementation;
1574
+ }
1575
+ const document = window.document;
1576
+ let requestAnimationFrameImplementation = window.requestAnimationFrame;
1577
+ if (document && typeof document.createElement === 'function') {
1578
+ try {
1579
+ const sandbox = document.createElement('iframe');
1580
+ sandbox.hidden = true;
1581
+ document.head.appendChild(sandbox);
1582
+ const contentWindow = sandbox.contentWindow;
1583
+ if (contentWindow && contentWindow.requestAnimationFrame) {
1584
+ requestAnimationFrameImplementation =
1585
+ contentWindow.requestAnimationFrame;
1586
+ }
1587
+ document.head.removeChild(sandbox);
1588
+ }
1589
+ catch (e) {
1590
+ }
1591
+ }
1592
+ return (cachedRequestAnimationFrameImplementation =
1593
+ requestAnimationFrameImplementation.bind(window));
1594
+ }
1595
+ function onRequestAnimationFrame(...rest) {
1596
+ return getRequestAnimationFrameImplementation()(...rest);
1597
+ }
1569
1598
 
1570
1599
  var EventType = /* @__PURE__ */ ((EventType2) => {
1571
1600
  EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
@@ -1618,6 +1647,7 @@ var PointerTypes = /* @__PURE__ */ ((PointerTypes2) => {
1618
1647
  return PointerTypes2;
1619
1648
  })(PointerTypes || {});
1620
1649
 
1650
+ function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1621
1651
  function isNodeInLinkedList(n) {
1622
1652
  return '__ln' in n;
1623
1653
  }
@@ -1633,7 +1663,7 @@ class DoubleLinkedList {
1633
1663
  }
1634
1664
  let current = this.head;
1635
1665
  for (let index = 0; index < position; index++) {
1636
- current = (current === null || current === void 0 ? void 0 : current.next) || null;
1666
+ current = _optionalChain$3([current, 'optionalAccess', _ => _.next]) || null;
1637
1667
  }
1638
1668
  return current;
1639
1669
  }
@@ -2220,6 +2250,7 @@ const callbackWrapper = (cb) => {
2220
2250
  return rrwebWrapped;
2221
2251
  };
2222
2252
 
2253
+ function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2223
2254
  const mutationBuffers = [];
2224
2255
  function getEventTarget(event) {
2225
2256
  try {
@@ -2233,18 +2264,17 @@ function getEventTarget(event) {
2233
2264
  return event.path[0];
2234
2265
  }
2235
2266
  }
2236
- catch (_a) {
2267
+ catch (e2) {
2237
2268
  }
2238
2269
  return event && event.target;
2239
2270
  }
2240
2271
  function initMutationObserver(options, rootEl) {
2241
- var _a, _b;
2242
2272
  const mutationBuffer = new MutationBuffer();
2243
2273
  mutationBuffers.push(mutationBuffer);
2244
2274
  mutationBuffer.init(options);
2245
2275
  let mutationObserverCtor = window.MutationObserver ||
2246
2276
  window.__rrMutationObserver;
2247
- const angularZoneSymbol = (_b = (_a = window === null || window === void 0 ? void 0 : window.Zone) === null || _a === void 0 ? void 0 : _a.__symbol__) === null || _b === void 0 ? void 0 : _b.call(_a, 'MutationObserver');
2277
+ const angularZoneSymbol = _optionalChain$2([window, 'optionalAccess', _ => _.Zone, 'optionalAccess', _2 => _2.__symbol__, 'optionalCall', _3 => _3('MutationObserver')]);
2248
2278
  if (angularZoneSymbol &&
2249
2279
  window[angularZoneSymbol]) {
2250
2280
  mutationObserverCtor = window[angularZoneSymbol];
@@ -2379,7 +2409,13 @@ function initMouseInteractionObserver({ mouseInteractionCb, doc, mirror, blockCl
2379
2409
  }
2380
2410
  const id = mirror.getId(target);
2381
2411
  const { clientX, clientY } = e;
2382
- callbackWrapper(mouseInteractionCb)(Object.assign({ type: MouseInteractions[thisEventKey], id, x: clientX, y: clientY }, (pointerType !== null && { pointerType })));
2412
+ callbackWrapper(mouseInteractionCb)({
2413
+ type: MouseInteractions[thisEventKey],
2414
+ id,
2415
+ x: clientX,
2416
+ y: clientY,
2417
+ ...(pointerType !== null && { pointerType }),
2418
+ });
2383
2419
  };
2384
2420
  };
2385
2421
  Object.keys(MouseInteractions)
@@ -2516,7 +2552,10 @@ function initInputObserver({ inputCb, doc, mirror, blockClass, blockSelector, un
2516
2552
  lastInputValue.isChecked !== v.isChecked) {
2517
2553
  lastInputValueMap.set(target, v);
2518
2554
  const id = mirror.getId(target);
2519
- callbackWrapper(inputCb)(Object.assign(Object.assign({}, v), { id }));
2555
+ callbackWrapper(inputCb)({
2556
+ ...v,
2557
+ id,
2558
+ });
2520
2559
  }
2521
2560
  }
2522
2561
  const events = sampling.input === 'last' ? ['change'] : ['input', 'change'];
@@ -2730,17 +2769,16 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror, stylesheetManager },
2730
2769
  });
2731
2770
  }
2732
2771
  function initAdoptedStyleSheetObserver({ mirror, stylesheetManager, }, host) {
2733
- var _a, _b, _c;
2734
2772
  let hostId = null;
2735
2773
  if (host.nodeName === '#document')
2736
2774
  hostId = mirror.getId(host);
2737
2775
  else
2738
2776
  hostId = mirror.getId(host.host);
2739
2777
  const patchTarget = host.nodeName === '#document'
2740
- ? (_a = host.defaultView) === null || _a === void 0 ? void 0 : _a.Document
2741
- : (_c = (_b = host.ownerDocument) === null || _b === void 0 ? void 0 : _b.defaultView) === null || _c === void 0 ? void 0 : _c.ShadowRoot;
2742
- const originalPropertyDescriptor = (patchTarget === null || patchTarget === void 0 ? void 0 : patchTarget.prototype)
2743
- ? Object.getOwnPropertyDescriptor(patchTarget === null || patchTarget === void 0 ? void 0 : patchTarget.prototype, 'adoptedStyleSheets')
2778
+ ? _optionalChain$2([host, 'access', _4 => _4.defaultView, 'optionalAccess', _5 => _5.Document])
2779
+ : _optionalChain$2([host, 'access', _6 => _6.ownerDocument, 'optionalAccess', _7 => _7.defaultView, 'optionalAccess', _8 => _8.ShadowRoot]);
2780
+ const originalPropertyDescriptor = _optionalChain$2([patchTarget, 'optionalAccess', _9 => _9.prototype])
2781
+ ? Object.getOwnPropertyDescriptor(_optionalChain$2([patchTarget, 'optionalAccess', _10 => _10.prototype]), 'adoptedStyleSheets')
2744
2782
  : undefined;
2745
2783
  if (hostId === null ||
2746
2784
  hostId === -1 ||
@@ -2752,12 +2790,10 @@ function initAdoptedStyleSheetObserver({ mirror, stylesheetManager, }, host) {
2752
2790
  configurable: originalPropertyDescriptor.configurable,
2753
2791
  enumerable: originalPropertyDescriptor.enumerable,
2754
2792
  get() {
2755
- var _a;
2756
- return (_a = originalPropertyDescriptor.get) === null || _a === void 0 ? void 0 : _a.call(this);
2793
+ return _optionalChain$2([originalPropertyDescriptor, 'access', _11 => _11.get, 'optionalAccess', _12 => _12.call, 'call', _13 => _13(this)]);
2757
2794
  },
2758
2795
  set(sheets) {
2759
- var _a;
2760
- const result = (_a = originalPropertyDescriptor.set) === null || _a === void 0 ? void 0 : _a.call(this, sheets);
2796
+ const result = _optionalChain$2([originalPropertyDescriptor, 'access', _14 => _14.set, 'optionalAccess', _15 => _15.call, 'call', _16 => _16(this, sheets)]);
2761
2797
  if (hostId !== null && hostId !== -1) {
2762
2798
  try {
2763
2799
  stylesheetManager.adoptStyleSheets(sheets, hostId);
@@ -2781,12 +2817,11 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror, ignoreCSSAtt
2781
2817
  const setProperty = win.CSSStyleDeclaration.prototype.setProperty;
2782
2818
  win.CSSStyleDeclaration.prototype.setProperty = new Proxy(setProperty, {
2783
2819
  apply: callbackWrapper((target, thisArg, argumentsList) => {
2784
- var _a;
2785
2820
  const [property, value, priority] = argumentsList;
2786
2821
  if (ignoreCSSAttributes.has(property)) {
2787
2822
  return setProperty.apply(thisArg, [property, value, priority]);
2788
2823
  }
2789
- const { id, styleId } = getIdAndStyleId((_a = thisArg.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror, stylesheetManager.styleMirror);
2824
+ const { id, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, 'access', _17 => _17.parentRule, 'optionalAccess', _18 => _18.parentStyleSheet]), mirror, stylesheetManager.styleMirror);
2790
2825
  if ((id && id !== -1) || (styleId && styleId !== -1)) {
2791
2826
  styleDeclarationCb({
2792
2827
  id,
@@ -2805,12 +2840,11 @@ function initStyleDeclarationObserver({ styleDeclarationCb, mirror, ignoreCSSAtt
2805
2840
  const removeProperty = win.CSSStyleDeclaration.prototype.removeProperty;
2806
2841
  win.CSSStyleDeclaration.prototype.removeProperty = new Proxy(removeProperty, {
2807
2842
  apply: callbackWrapper((target, thisArg, argumentsList) => {
2808
- var _a;
2809
2843
  const [property] = argumentsList;
2810
2844
  if (ignoreCSSAttributes.has(property)) {
2811
2845
  return removeProperty.apply(thisArg, [property]);
2812
2846
  }
2813
- const { id, styleId } = getIdAndStyleId((_a = thisArg.parentRule) === null || _a === void 0 ? void 0 : _a.parentStyleSheet, mirror, stylesheetManager.styleMirror);
2847
+ const { id, styleId } = getIdAndStyleId(_optionalChain$2([thisArg, 'access', _19 => _19.parentRule, 'optionalAccess', _20 => _20.parentStyleSheet]), mirror, stylesheetManager.styleMirror);
2814
2848
  if ((id && id !== -1) || (styleId && styleId !== -1)) {
2815
2849
  styleDeclarationCb({
2816
2850
  id,
@@ -2903,7 +2937,7 @@ function initSelectionObserver(param) {
2903
2937
  let collapsed = true;
2904
2938
  const updateSelection = callbackWrapper(() => {
2905
2939
  const selection = doc.getSelection();
2906
- if (!selection || (collapsed && (selection === null || selection === void 0 ? void 0 : selection.isCollapsed)))
2940
+ if (!selection || (collapsed && _optionalChain$2([selection, 'optionalAccess', _21 => _21.isCollapsed])))
2907
2941
  return;
2908
2942
  collapsed = selection.isCollapsed || false;
2909
2943
  const ranges = [];
@@ -3069,6 +3103,7 @@ class CrossOriginIframeMirror {
3069
3103
  }
3070
3104
  }
3071
3105
 
3106
+ function _optionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3072
3107
  class IframeManagerNoop {
3073
3108
  constructor() {
3074
3109
  this.crossOriginIframeMirror = new CrossOriginIframeMirror(genId);
@@ -3106,7 +3141,6 @@ class IframeManager {
3106
3141
  this.loadListener = cb;
3107
3142
  }
3108
3143
  attachIframe(iframeEl, childSn) {
3109
- var _a;
3110
3144
  this.mutationCb({
3111
3145
  adds: [
3112
3146
  {
@@ -3120,7 +3154,7 @@ class IframeManager {
3120
3154
  attributes: [],
3121
3155
  isAttachIframe: true,
3122
3156
  });
3123
- (_a = this.loadListener) === null || _a === void 0 ? void 0 : _a.call(this, iframeEl);
3157
+ _optionalChain$1([this, 'access', _ => _.loadListener, 'optionalCall', _2 => _2(iframeEl)]);
3124
3158
  if (iframeEl.contentDocument &&
3125
3159
  iframeEl.contentDocument.adoptedStyleSheets &&
3126
3160
  iframeEl.contentDocument.adoptedStyleSheets.length > 0)
@@ -3142,7 +3176,6 @@ class IframeManager {
3142
3176
  this.wrappedEmit(transformedEvent, crossOriginMessageEvent.data.isCheckout);
3143
3177
  }
3144
3178
  transformCrossOriginEvent(iframeEl, e) {
3145
- var _a;
3146
3179
  switch (e.type) {
3147
3180
  case EventType.FullSnapshot: {
3148
3181
  this.crossOriginIframeMirror.reset(iframeEl);
@@ -3243,9 +3276,9 @@ class IframeManager {
3243
3276
  case IncrementalSource.AdoptedStyleSheet: {
3244
3277
  this.replaceIds(e.data, iframeEl, ['id']);
3245
3278
  this.replaceStyleIds(e.data, iframeEl, ['styleIds']);
3246
- (_a = e.data.styles) === null || _a === void 0 ? void 0 : _a.forEach((style) => {
3279
+ _optionalChain$1([e, 'access', _3 => _3.data, 'access', _4 => _4.styles, 'optionalAccess', _5 => _5.forEach, 'call', _6 => _6((style) => {
3247
3280
  this.replaceStyleIds(style, iframeEl, ['styleId']);
3248
- });
3281
+ })]);
3249
3282
  return e;
3250
3283
  }
3251
3284
  }
@@ -3321,9 +3354,20 @@ class ShadowDomManager {
3321
3354
  if (this.shadowDoms.has(shadowRoot))
3322
3355
  return;
3323
3356
  this.shadowDoms.add(shadowRoot);
3324
- const observer = initMutationObserver(Object.assign(Object.assign({}, this.bypassOptions), { doc, mutationCb: this.mutationCb, mirror: this.mirror, shadowDomManager: this }), shadowRoot);
3357
+ const observer = initMutationObserver({
3358
+ ...this.bypassOptions,
3359
+ doc,
3360
+ mutationCb: this.mutationCb,
3361
+ mirror: this.mirror,
3362
+ shadowDomManager: this,
3363
+ }, shadowRoot);
3325
3364
  this.restoreHandlers.push(() => observer.disconnect());
3326
- this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({}, this.bypassOptions), { scrollCb: this.scrollCb, doc: shadowRoot, mirror: this.mirror })));
3365
+ this.restoreHandlers.push(initScrollObserver({
3366
+ ...this.bypassOptions,
3367
+ scrollCb: this.scrollCb,
3368
+ doc: shadowRoot,
3369
+ mirror: this.mirror,
3370
+ }));
3327
3371
  setTimeout(() => {
3328
3372
  if (shadowRoot.adoptedStyleSheets &&
3329
3373
  shadowRoot.adoptedStyleSheets.length > 0)
@@ -3448,7 +3492,7 @@ class ProcessedNodeManager {
3448
3492
  this.periodicallyClear();
3449
3493
  }
3450
3494
  periodicallyClear() {
3451
- requestAnimationFrame(() => {
3495
+ onRequestAnimationFrame(() => {
3452
3496
  this.clear();
3453
3497
  if (this.loop)
3454
3498
  this.periodicallyClear();
@@ -3558,15 +3602,14 @@ function record(options = {}) {
3558
3602
  return e;
3559
3603
  };
3560
3604
  const wrappedEmit = (e, isCheckout) => {
3561
- var _a;
3562
- if (((_a = mutationBuffers[0]) === null || _a === void 0 ? void 0 : _a.isFrozen()) &&
3605
+ if (_optionalChain([mutationBuffers, 'access', _ => _[0], 'optionalAccess', _2 => _2.isFrozen, 'call', _3 => _3()]) &&
3563
3606
  e.type !== EventType.FullSnapshot &&
3564
3607
  !(e.type === EventType.IncrementalSnapshot &&
3565
3608
  e.data.source === IncrementalSource.Mutation)) {
3566
3609
  mutationBuffers.forEach((buf) => buf.unfreeze());
3567
3610
  }
3568
3611
  if (inEmittingFrame) {
3569
- emit === null || emit === void 0 ? void 0 : emit(eventProcessor(e), isCheckout);
3612
+ _optionalChain([emit, 'optionalCall', _4 => _4(eventProcessor(e), isCheckout)]);
3570
3613
  }
3571
3614
  else if (passEmitsToParent) {
3572
3615
  const message = {
@@ -3599,20 +3642,32 @@ function record(options = {}) {
3599
3642
  const wrappedMutationEmit = (m) => {
3600
3643
  wrappedEmit(wrapEvent({
3601
3644
  type: EventType.IncrementalSnapshot,
3602
- data: Object.assign({ source: IncrementalSource.Mutation }, m),
3645
+ data: {
3646
+ source: IncrementalSource.Mutation,
3647
+ ...m,
3648
+ },
3603
3649
  }));
3604
3650
  };
3605
3651
  const wrappedScrollEmit = (p) => wrappedEmit(wrapEvent({
3606
3652
  type: EventType.IncrementalSnapshot,
3607
- data: Object.assign({ source: IncrementalSource.Scroll }, p),
3653
+ data: {
3654
+ source: IncrementalSource.Scroll,
3655
+ ...p,
3656
+ },
3608
3657
  }));
3609
3658
  const wrappedCanvasMutationEmit = (p) => wrappedEmit(wrapEvent({
3610
3659
  type: EventType.IncrementalSnapshot,
3611
- data: Object.assign({ source: IncrementalSource.CanvasMutation }, p),
3660
+ data: {
3661
+ source: IncrementalSource.CanvasMutation,
3662
+ ...p,
3663
+ },
3612
3664
  }));
3613
3665
  const wrappedAdoptedStyleSheetEmit = (a) => wrappedEmit(wrapEvent({
3614
3666
  type: EventType.IncrementalSnapshot,
3615
- data: Object.assign({ source: IncrementalSource.AdoptedStyleSheet }, a),
3667
+ data: {
3668
+ source: IncrementalSource.AdoptedStyleSheet,
3669
+ ...a,
3670
+ },
3616
3671
  }));
3617
3672
  const stylesheetManager = new StylesheetManager({
3618
3673
  mutationCb: wrappedMutationEmit,
@@ -3747,7 +3802,6 @@ function record(options = {}) {
3747
3802
  try {
3748
3803
  const handlers = [];
3749
3804
  const observe = (doc) => {
3750
- var _a;
3751
3805
  return callbackWrapper(initObservers)({
3752
3806
  onMutation,
3753
3807
  mutationCb: wrappedMutationEmit,
@@ -3760,44 +3814,71 @@ function record(options = {}) {
3760
3814
  })),
3761
3815
  mouseInteractionCb: (d) => wrappedEmit(wrapEvent({
3762
3816
  type: EventType.IncrementalSnapshot,
3763
- data: Object.assign({ source: IncrementalSource.MouseInteraction }, d),
3817
+ data: {
3818
+ source: IncrementalSource.MouseInteraction,
3819
+ ...d,
3820
+ },
3764
3821
  })),
3765
3822
  scrollCb: wrappedScrollEmit,
3766
3823
  viewportResizeCb: (d) => wrappedEmit(wrapEvent({
3767
3824
  type: EventType.IncrementalSnapshot,
3768
- data: Object.assign({ source: IncrementalSource.ViewportResize }, d),
3825
+ data: {
3826
+ source: IncrementalSource.ViewportResize,
3827
+ ...d,
3828
+ },
3769
3829
  })),
3770
3830
  inputCb: (v) => wrappedEmit(wrapEvent({
3771
3831
  type: EventType.IncrementalSnapshot,
3772
- data: Object.assign({ source: IncrementalSource.Input }, v),
3832
+ data: {
3833
+ source: IncrementalSource.Input,
3834
+ ...v,
3835
+ },
3773
3836
  })),
3774
3837
  mediaInteractionCb: (p) => wrappedEmit(wrapEvent({
3775
3838
  type: EventType.IncrementalSnapshot,
3776
- data: Object.assign({ source: IncrementalSource.MediaInteraction }, p),
3839
+ data: {
3840
+ source: IncrementalSource.MediaInteraction,
3841
+ ...p,
3842
+ },
3777
3843
  })),
3778
3844
  styleSheetRuleCb: (r) => wrappedEmit(wrapEvent({
3779
3845
  type: EventType.IncrementalSnapshot,
3780
- data: Object.assign({ source: IncrementalSource.StyleSheetRule }, r),
3846
+ data: {
3847
+ source: IncrementalSource.StyleSheetRule,
3848
+ ...r,
3849
+ },
3781
3850
  })),
3782
3851
  styleDeclarationCb: (r) => wrappedEmit(wrapEvent({
3783
3852
  type: EventType.IncrementalSnapshot,
3784
- data: Object.assign({ source: IncrementalSource.StyleDeclaration }, r),
3853
+ data: {
3854
+ source: IncrementalSource.StyleDeclaration,
3855
+ ...r,
3856
+ },
3785
3857
  })),
3786
3858
  canvasMutationCb: wrappedCanvasMutationEmit,
3787
3859
  fontCb: (p) => wrappedEmit(wrapEvent({
3788
3860
  type: EventType.IncrementalSnapshot,
3789
- data: Object.assign({ source: IncrementalSource.Font }, p),
3861
+ data: {
3862
+ source: IncrementalSource.Font,
3863
+ ...p,
3864
+ },
3790
3865
  })),
3791
3866
  selectionCb: (p) => {
3792
3867
  wrappedEmit(wrapEvent({
3793
3868
  type: EventType.IncrementalSnapshot,
3794
- data: Object.assign({ source: IncrementalSource.Selection }, p),
3869
+ data: {
3870
+ source: IncrementalSource.Selection,
3871
+ ...p,
3872
+ },
3795
3873
  }));
3796
3874
  },
3797
3875
  customElementCb: (c) => {
3798
3876
  wrappedEmit(wrapEvent({
3799
3877
  type: EventType.IncrementalSnapshot,
3800
- data: Object.assign({ source: IncrementalSource.CustomElement }, c),
3878
+ data: {
3879
+ source: IncrementalSource.CustomElement,
3880
+ ...c,
3881
+ },
3801
3882
  }));
3802
3883
  },
3803
3884
  blockClass,
@@ -3831,7 +3912,9 @@ function record(options = {}) {
3831
3912
  processedNodeManager,
3832
3913
  canvasManager,
3833
3914
  ignoreCSSAttributes,
3834
- plugins: ((_a = plugins === null || plugins === void 0 ? void 0 : plugins.filter((p) => p.observer)) === null || _a === void 0 ? void 0 : _a.map((p) => ({
3915
+ plugins: _optionalChain([plugins
3916
+ , 'optionalAccess', _5 => _5.filter, 'call', _6 => _6((p) => p.observer)
3917
+ , 'optionalAccess', _7 => _7.map, 'call', _8 => _8((p) => ({
3835
3918
  observer: p.observer,
3836
3919
  options: p.options,
3837
3920
  callback: (payload) => wrappedEmit(wrapEvent({
@@ -3841,7 +3924,7 @@ function record(options = {}) {
3841
3924
  payload,
3842
3925
  },
3843
3926
  })),
3844
- }))) || [],
3927
+ }))]) || [],
3845
3928
  }, {});
3846
3929
  };
3847
3930
  iframeManager.addLoadListener((iframeEl) => {
@@ -3905,10 +3988,18 @@ record.mirror = mirror;
3905
3988
  record.takeFullSnapshot = takeFullSnapshot;
3906
3989
  function _getCanvasManager(getCanvasManagerFn, options) {
3907
3990
  return getCanvasManagerFn
3908
- ? getCanvasManagerFn(Object.assign(Object.assign({}, options), { mirror, win: window, mutationCb: (p) => wrappedEmit(wrapEvent({
3991
+ ? getCanvasManagerFn({
3992
+ ...options,
3993
+ mirror,
3994
+ win: window,
3995
+ mutationCb: (p) => wrappedEmit(wrapEvent({
3909
3996
  type: EventType.IncrementalSnapshot,
3910
- data: Object.assign({ source: IncrementalSource.CanvasMutation }, p),
3911
- })) }))
3997
+ data: {
3998
+ source: IncrementalSource.CanvasMutation,
3999
+ ...p,
4000
+ },
4001
+ })),
4002
+ })
3912
4003
  : new CanvasManagerNoop();
3913
4004
  }
3914
4005
 
@@ -8369,12 +8460,16 @@ class ReplayContainer {
8369
8460
  * This is only available if performance is enabled, and if an instrumented router is used.
8370
8461
  */
8371
8462
  getCurrentRoute() {
8463
+ // eslint-disable-next-line deprecation/deprecation
8372
8464
  const lastTransaction = this.lastTransaction || core.getCurrentScope().getTransaction();
8373
- if (!lastTransaction || !['route', 'custom'].includes(lastTransaction.metadata.source)) {
8465
+
8466
+ const attributes = (lastTransaction && core.spanToJSON(lastTransaction).data) || {};
8467
+ const source = attributes[core.SEMANTIC_ATTRIBUTE_SENTRY_SOURCE];
8468
+ if (!lastTransaction || !source || !['route', 'custom'].includes(source)) {
8374
8469
  return undefined;
8375
8470
  }
8376
8471
 
8377
- return lastTransaction.name;
8472
+ return core.spanToJSON(lastTransaction).description;
8378
8473
  }
8379
8474
 
8380
8475
  /**
@@ -9359,7 +9454,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
9359
9454
  recordingOptions: this._recordingOptions,
9360
9455
  });
9361
9456
  }
9362
- } Replay.__initStatic();
9457
+ }Replay.__initStatic();
9363
9458
 
9364
9459
  /** Parse Replay-related options from SDK options */
9365
9460
  function loadReplayOptionsFromClient(initialOptions) {