@appsurify-testmap/rrweb 2.0.0-alpha.32 → 2.0.0-alpha.35

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
@@ -13963,6 +13963,7 @@ try {
13963
13963
  }
13964
13964
  const mirror = createMirror$2();
13965
13965
  function record(options = {}) {
13966
+ var _a2;
13966
13967
  const {
13967
13968
  emit,
13968
13969
  checkoutEveryNms,
@@ -13997,12 +13998,24 @@ function record(options = {}) {
13997
13998
  ignoreCSSAttributes = /* @__PURE__ */ new Set([]),
13998
13999
  errorHandler: errorHandler2
13999
14000
  } = options;
14001
+ const win = options.customWindow || window;
14002
+ const doc = options.customDocument || document;
14003
+ try {
14004
+ if (Array.from([1], (x2) => x2 * 2)[0] !== 2) {
14005
+ const cleanFrame = doc.createElement("iframe");
14006
+ doc.body.appendChild(cleanFrame);
14007
+ Array.from = ((_a2 = cleanFrame.contentWindow) == null ? void 0 : _a2.Array.from) || Array.from;
14008
+ doc.body.removeChild(cleanFrame);
14009
+ }
14010
+ } catch (err) {
14011
+ console.debug("Unable to override Array.from", err);
14012
+ }
14000
14013
  registerErrorHandler(errorHandler2);
14001
- const inEmittingFrame = recordCrossOriginIframes ? window.parent === window : true;
14014
+ const inEmittingFrame = recordCrossOriginIframes ? win.parent === win : true;
14002
14015
  let passEmitsToParent = false;
14003
14016
  if (!inEmittingFrame) {
14004
14017
  try {
14005
- if (window.parent.document) {
14018
+ if (win.parent.document) {
14006
14019
  passEmitsToParent = false;
14007
14020
  }
14008
14021
  } catch (e2) {
@@ -14069,10 +14082,10 @@ function record(options = {}) {
14069
14082
  return e2;
14070
14083
  };
14071
14084
  wrappedEmit = (r2, isCheckout) => {
14072
- var _a2;
14085
+ var _a3;
14073
14086
  const e2 = r2;
14074
14087
  e2.timestamp = nowTimestamp();
14075
- if (((_a2 = mutationBuffers[0]) == null ? void 0 : _a2.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14088
+ if (((_a3 = mutationBuffers[0]) == null ? void 0 : _a3.isFrozen()) && e2.type !== EventType.FullSnapshot && !(e2.type === EventType.IncrementalSnapshot && e2.data.source === IncrementalSource.Mutation)) {
14076
14089
  mutationBuffers.forEach((buf) => buf.unfreeze());
14077
14090
  }
14078
14091
  if (inEmittingFrame) {
@@ -14081,10 +14094,10 @@ function record(options = {}) {
14081
14094
  const message = {
14082
14095
  type: "rrweb",
14083
14096
  event: eventProcessor(e2),
14084
- origin: window.location.origin,
14097
+ origin: win.location.origin,
14085
14098
  isCheckout
14086
14099
  };
14087
- window.parent.postMessage(message, "*");
14100
+ win.parent.postMessage(message, "*");
14088
14101
  }
14089
14102
  if (e2.type === EventType.FullSnapshot) {
14090
14103
  lastFullSnapshotEvent = e2;
@@ -14195,7 +14208,7 @@ function record(options = {}) {
14195
14208
  {
14196
14209
  type: EventType.Meta,
14197
14210
  data: {
14198
- href: window.location.href,
14211
+ href: win.location.href,
14199
14212
  width: getWindowWidth(),
14200
14213
  height: getWindowHeight()
14201
14214
  }
@@ -14253,16 +14266,16 @@ function record(options = {}) {
14253
14266
  isCheckout
14254
14267
  );
14255
14268
  mutationBuffers.forEach((buf) => buf.unlock());
14256
- if (document.adoptedStyleSheets && document.adoptedStyleSheets.length > 0)
14269
+ if (doc.adoptedStyleSheets && doc.adoptedStyleSheets.length > 0)
14257
14270
  stylesheetManager.adoptStyleSheets(
14258
- document.adoptedStyleSheets,
14259
- mirror.getId(document)
14271
+ doc.adoptedStyleSheets,
14272
+ mirror.getId(doc)
14260
14273
  );
14261
14274
  };
14262
14275
  try {
14263
14276
  const handlers = [];
14264
- const observe = (doc) => {
14265
- var _a2;
14277
+ const observe = (doc2) => {
14278
+ var _a3;
14266
14279
  return callbackWrapper(initObservers)(
14267
14280
  {
14268
14281
  mutationCb: wrappedMutationEmit,
@@ -14364,7 +14377,7 @@ function record(options = {}) {
14364
14377
  inlineImages,
14365
14378
  userTriggeredOnInput,
14366
14379
  collectFonts,
14367
- doc,
14380
+ doc: doc2,
14368
14381
  maskInputFn,
14369
14382
  maskTextFn,
14370
14383
  keepIframeSrcFn,
@@ -14378,7 +14391,7 @@ function record(options = {}) {
14378
14391
  processedNodeManager,
14379
14392
  canvasManager,
14380
14393
  ignoreCSSAttributes,
14381
- plugins: ((_a2 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a2.map((p) => ({
14394
+ plugins: ((_a3 = plugins == null ? void 0 : plugins.filter((p) => p.observer)) == null ? void 0 : _a3.map((p) => ({
14382
14395
  observer: p.observer,
14383
14396
  options: p.options,
14384
14397
  callback: (payload) => wrappedEmit({
@@ -14405,7 +14418,7 @@ function record(options = {}) {
14405
14418
  handlers.push(observe(document));
14406
14419
  recording = true;
14407
14420
  };
14408
- if (document.readyState === "interactive" || document.readyState === "complete") {
14421
+ if (doc.readyState === "interactive" || doc.readyState === "complete") {
14409
14422
  init();
14410
14423
  } else {
14411
14424
  handlers.push(