@coralogix/browser 2.5.0 → 2.7.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.
@@ -13,7 +13,105 @@ import '@opentelemetry/api';
13
13
  import '@opentelemetry/propagator-b3';
14
14
  import '@opentelemetry/propagator-aws-xray';
15
15
 
16
- var EventType = /* @__PURE__ */ ((EventType2) => {
16
+ function _arrayLikeToArray(r, a) {
17
+ (null == a || a > r.length) && (a = r.length);
18
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
19
+ return n;
20
+ }
21
+ function _classCallCheck(a, n) {
22
+ if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
23
+ }
24
+ function _defineProperties(e, r) {
25
+ for (var t = 0; t < r.length; t++) {
26
+ var o = r[t];
27
+ o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o);
28
+ }
29
+ }
30
+ function _createClass(e, r, t) {
31
+ return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
32
+ writable: false
33
+ }), e;
34
+ }
35
+ function _createForOfIteratorHelper(r, e) {
36
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
37
+ if (!t) {
38
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
39
+ t && (r = t);
40
+ var n = 0,
41
+ F = function () {};
42
+ return {
43
+ s: F,
44
+ n: function () {
45
+ return n >= r.length ? {
46
+ done: true
47
+ } : {
48
+ done: false,
49
+ value: r[n++]
50
+ };
51
+ },
52
+ e: function (r) {
53
+ throw r;
54
+ },
55
+ f: F
56
+ };
57
+ }
58
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
59
+ }
60
+ var o,
61
+ a = true,
62
+ u = false;
63
+ return {
64
+ s: function () {
65
+ t = t.call(r);
66
+ },
67
+ n: function () {
68
+ var r = t.next();
69
+ return a = r.done, r;
70
+ },
71
+ e: function (r) {
72
+ u = true, o = r;
73
+ },
74
+ f: function () {
75
+ try {
76
+ a || null == t.return || t.return();
77
+ } finally {
78
+ if (u) throw o;
79
+ }
80
+ }
81
+ };
82
+ }
83
+ function _toPrimitive(t, r) {
84
+ if ("object" != typeof t || !t) return t;
85
+ var e = t[Symbol.toPrimitive];
86
+ if (void 0 !== e) {
87
+ var i = e.call(t, r);
88
+ if ("object" != typeof i) return i;
89
+ throw new TypeError("@@toPrimitive must return a primitive value.");
90
+ }
91
+ return (String )(t);
92
+ }
93
+ function _toPropertyKey(t) {
94
+ var i = _toPrimitive(t, "string");
95
+ return "symbol" == typeof i ? i : i + "";
96
+ }
97
+ function _typeof(o) {
98
+ "@babel/helpers - typeof";
99
+
100
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
101
+ return typeof o;
102
+ } : function (o) {
103
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
104
+ }, _typeof(o);
105
+ }
106
+ function _unsupportedIterableToArray(r, a) {
107
+ if (r) {
108
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
109
+ var t = {}.toString.call(r).slice(8, -1);
110
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
111
+ }
112
+ }
113
+
114
+ var EventType = /* @__PURE__ */function (EventType2) {
17
115
  EventType2[EventType2["DomContentLoaded"] = 0] = "DomContentLoaded";
18
116
  EventType2[EventType2["Load"] = 1] = "Load";
19
117
  EventType2[EventType2["FullSnapshot"] = 2] = "FullSnapshot";
@@ -22,15 +120,22 @@ var EventType = /* @__PURE__ */ ((EventType2) => {
22
120
  EventType2[EventType2["Custom"] = 5] = "Custom";
23
121
  EventType2[EventType2["Plugin"] = 6] = "Plugin";
24
122
  return EventType2;
25
- })(EventType || {});
123
+ }(EventType || {});
26
124
 
27
125
  var __defProp = Object.defineProperty;
28
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
29
- var __publicField = (obj, key, value) => {
30
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
126
+ var __defNormalProp = function __defNormalProp(obj, key, value) {
127
+ return key in obj ? __defProp(obj, key, {
128
+ enumerable: true,
129
+ configurable: true,
130
+ writable: true,
131
+ value: value
132
+ }) : obj[key] = value;
133
+ };
134
+ var __publicField = function __publicField(obj, key, value) {
135
+ __defNormalProp(obj, _typeof(key) !== "symbol" ? key + "" : key, value);
31
136
  return value;
32
137
  };
33
- var NodeType = /* @__PURE__ */ ((NodeType2) => {
138
+ var NodeType = /* @__PURE__ */function (NodeType2) {
34
139
  NodeType2[NodeType2["Document"] = 0] = "Document";
35
140
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
36
141
  NodeType2[NodeType2["Element"] = 2] = "Element";
@@ -38,12 +143,12 @@ var NodeType = /* @__PURE__ */ ((NodeType2) => {
38
143
  NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
39
144
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
40
145
  return NodeType2;
41
- })(NodeType || {});
146
+ }(NodeType || {});
42
147
  function isElement(n) {
43
148
  return n.nodeType === n.ELEMENT_NODE;
44
149
  }
45
150
  function isShadowRoot(n) {
46
- const host = n == null ? void 0 : n.host;
151
+ var host = n == null ? void 0 : n.host;
47
152
  return Boolean((host == null ? void 0 : host.shadowRoot) === n);
48
153
  }
49
154
  function isNativeShadowDom(shadowRoot) {
@@ -51,25 +156,21 @@ function isNativeShadowDom(shadowRoot) {
51
156
  }
52
157
  function fixBrowserCompatibilityIssuesInCSS(cssText) {
53
158
  if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
54
- cssText = cssText.replace(
55
- /\sbackground-clip:\s*text;/g,
56
- " -webkit-background-clip: text; background-clip: text;"
57
- );
159
+ cssText = cssText.replace(/\sbackground-clip:\s*text;/g, " -webkit-background-clip: text; background-clip: text;");
58
160
  }
59
161
  return cssText;
60
162
  }
61
163
  function escapeImportStatement(rule) {
62
- const { cssText } = rule;
63
- if (cssText.split('"').length < 3)
64
- return cssText;
65
- const statement = ["@import", `url(${JSON.stringify(rule.href)})`];
164
+ var cssText = rule.cssText;
165
+ if (cssText.split('"').length < 3) return cssText;
166
+ var statement = ["@import", "url(".concat(JSON.stringify(rule.href), ")")];
66
167
  if (rule.layerName === "") {
67
- statement.push(`layer`);
168
+ statement.push("layer");
68
169
  } else if (rule.layerName) {
69
- statement.push(`layer(${rule.layerName})`);
170
+ statement.push("layer(".concat(rule.layerName, ")"));
70
171
  }
71
172
  if (rule.supportsText) {
72
- statement.push(`supports(${rule.supportsText})`);
173
+ statement.push("supports(".concat(rule.supportsText, ")"));
73
174
  }
74
175
  if (rule.media.length) {
75
176
  statement.push(rule.media.mediaText);
@@ -78,31 +179,30 @@ function escapeImportStatement(rule) {
78
179
  }
79
180
  function stringifyStylesheet(s) {
80
181
  try {
81
- const rules = s.rules || s.cssRules;
82
- return rules ? fixBrowserCompatibilityIssuesInCSS(
83
- Array.from(rules, stringifyRule).join("")
84
- ) : null;
182
+ var rules = s.rules || s.cssRules;
183
+ return rules ? fixBrowserCompatibilityIssuesInCSS(Array.from(rules, stringifyRule).join("")) : null;
85
184
  } catch (error) {
86
185
  return null;
87
186
  }
88
187
  }
89
188
  function stringifyRule(rule) {
90
- let importStringified;
189
+ var importStringified;
91
190
  if (isCSSImportRule(rule)) {
92
191
  try {
93
- importStringified = // for same-origin stylesheets,
192
+ importStringified =
193
+ // for same-origin stylesheets,
94
194
  // we can access the imported stylesheet rules directly
95
- stringifyStylesheet(rule.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
195
+ stringifyStylesheet(rule.styleSheet) ||
196
+ // work around browser issues with the raw string `@import url(...)` statement
96
197
  escapeImportStatement(rule);
97
- } catch (error) {
98
- }
198
+ } catch (error) {}
99
199
  } else if (isCSSStyleRule(rule) && rule.selectorText.includes(":")) {
100
200
  return fixSafariColons(rule.cssText);
101
201
  }
102
202
  return importStringified || rule.cssText;
103
203
  }
104
204
  function fixSafariColons(cssStringified) {
105
- const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
205
+ var regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
106
206
  return cssStringified.replace(regex, "$1\\$2");
107
207
  }
108
208
  function isCSSImportRule(rule) {
@@ -111,73 +211,93 @@ function isCSSImportRule(rule) {
111
211
  function isCSSStyleRule(rule) {
112
212
  return "selectorText" in rule;
113
213
  }
114
- class Mirror {
115
- constructor() {
116
- __publicField(this, "idNodeMap", /* @__PURE__ */ new Map());
117
- __publicField(this, "nodeMetaMap", /* @__PURE__ */ new WeakMap());
118
- }
119
- getId(n) {
120
- var _a;
121
- if (!n)
122
- return -1;
123
- const id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;
124
- return id ?? -1;
125
- }
126
- getNode(id) {
127
- return this.idNodeMap.get(id) || null;
128
- }
129
- getIds() {
130
- return Array.from(this.idNodeMap.keys());
131
- }
132
- getMeta(n) {
133
- return this.nodeMetaMap.get(n) || null;
134
- }
135
- // removes the node from idNodeMap
136
- // doesn't remove the node from nodeMetaMap
137
- removeNodeFromMap(n) {
138
- const id = this.getId(n);
139
- this.idNodeMap.delete(id);
140
- if (n.childNodes) {
141
- n.childNodes.forEach(
142
- (childNode) => this.removeNodeFromMap(childNode)
143
- );
214
+ var Mirror = /*#__PURE__*/function () {
215
+ function Mirror() {
216
+ _classCallCheck(this, Mirror);
217
+ __publicField(this, "idNodeMap", /* @__PURE__ */new Map());
218
+ __publicField(this, "nodeMetaMap", /* @__PURE__ */new WeakMap());
219
+ }
220
+ return _createClass(Mirror, [{
221
+ key: "getId",
222
+ value: function getId(n) {
223
+ var _a;
224
+ if (!n) return -1;
225
+ var id = (_a = this.getMeta(n)) == null ? void 0 : _a.id;
226
+ return id !== null && id !== void 0 ? id : -1;
144
227
  }
145
- }
146
- has(id) {
147
- return this.idNodeMap.has(id);
148
- }
149
- hasNode(node) {
150
- return this.nodeMetaMap.has(node);
151
- }
152
- add(n, meta) {
153
- const id = meta.id;
154
- this.idNodeMap.set(id, n);
155
- this.nodeMetaMap.set(n, meta);
156
- }
157
- replace(id, n) {
158
- const oldNode = this.getNode(id);
159
- if (oldNode) {
160
- const meta = this.nodeMetaMap.get(oldNode);
161
- if (meta)
162
- this.nodeMetaMap.set(n, meta);
228
+ }, {
229
+ key: "getNode",
230
+ value: function getNode(id) {
231
+ return this.idNodeMap.get(id) || null;
163
232
  }
164
- this.idNodeMap.set(id, n);
165
- }
166
- reset() {
167
- this.idNodeMap = /* @__PURE__ */ new Map();
168
- this.nodeMetaMap = /* @__PURE__ */ new WeakMap();
169
- }
170
- }
171
- function maskInputValue({
172
- element,
173
- maskInputOptions,
174
- tagName,
175
- type,
176
- value,
177
- maskInputFn
178
- }) {
179
- let text = value || "";
180
- const actualType = type && toLowerCase(type);
233
+ }, {
234
+ key: "getIds",
235
+ value: function getIds() {
236
+ return Array.from(this.idNodeMap.keys());
237
+ }
238
+ }, {
239
+ key: "getMeta",
240
+ value: function getMeta(n) {
241
+ return this.nodeMetaMap.get(n) || null;
242
+ }
243
+ // removes the node from idNodeMap
244
+ // doesn't remove the node from nodeMetaMap
245
+ }, {
246
+ key: "removeNodeFromMap",
247
+ value: function removeNodeFromMap(n) {
248
+ var _this = this;
249
+ var id = this.getId(n);
250
+ this.idNodeMap.delete(id);
251
+ if (n.childNodes) {
252
+ n.childNodes.forEach(function (childNode) {
253
+ return _this.removeNodeFromMap(childNode);
254
+ });
255
+ }
256
+ }
257
+ }, {
258
+ key: "has",
259
+ value: function has(id) {
260
+ return this.idNodeMap.has(id);
261
+ }
262
+ }, {
263
+ key: "hasNode",
264
+ value: function hasNode(node) {
265
+ return this.nodeMetaMap.has(node);
266
+ }
267
+ }, {
268
+ key: "add",
269
+ value: function add(n, meta) {
270
+ var id = meta.id;
271
+ this.idNodeMap.set(id, n);
272
+ this.nodeMetaMap.set(n, meta);
273
+ }
274
+ }, {
275
+ key: "replace",
276
+ value: function replace(id, n) {
277
+ var oldNode = this.getNode(id);
278
+ if (oldNode) {
279
+ var meta = this.nodeMetaMap.get(oldNode);
280
+ if (meta) this.nodeMetaMap.set(n, meta);
281
+ }
282
+ this.idNodeMap.set(id, n);
283
+ }
284
+ }, {
285
+ key: "reset",
286
+ value: function reset() {
287
+ this.idNodeMap = /* @__PURE__ */new Map();
288
+ this.nodeMetaMap = /* @__PURE__ */new WeakMap();
289
+ }
290
+ }]);
291
+ }();
292
+ function maskInputValue(_ref) {
293
+ var element = _ref.element,
294
+ maskInputOptions = _ref.maskInputOptions,
295
+ tagName = _ref.tagName,
296
+ type = _ref.type,
297
+ value = _ref.value,
298
+ maskInputFn = _ref.maskInputFn;
299
+ var text = value || "";
300
+ var actualType = type && toLowerCase(type);
181
301
  if (maskInputOptions[tagName.toLowerCase()] || actualType && maskInputOptions[actualType]) {
182
302
  if (maskInputFn) {
183
303
  text = maskInputFn(text, element);
@@ -190,53 +310,46 @@ function maskInputValue({
190
310
  function toLowerCase(str) {
191
311
  return str.toLowerCase();
192
312
  }
193
- const ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
313
+ var ORIGINAL_ATTRIBUTE_NAME = "__rrweb_original__";
194
314
  function is2DCanvasBlank(canvas) {
195
- const ctx = canvas.getContext("2d");
196
- if (!ctx)
197
- return true;
198
- const chunkSize = 50;
199
- for (let x = 0; x < canvas.width; x += chunkSize) {
200
- for (let y = 0; y < canvas.height; y += chunkSize) {
201
- const getImageData = ctx.getImageData;
202
- const originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
203
- const pixelBuffer = new Uint32Array(
204
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
205
- originalGetImageData.call(
206
- ctx,
207
- x,
208
- y,
209
- Math.min(chunkSize, canvas.width - x),
210
- Math.min(chunkSize, canvas.height - y)
211
- ).data.buffer
212
- );
213
- if (pixelBuffer.some((pixel) => pixel !== 0))
214
- return false;
315
+ var ctx = canvas.getContext("2d");
316
+ if (!ctx) return true;
317
+ var chunkSize = 50;
318
+ for (var x = 0; x < canvas.width; x += chunkSize) {
319
+ for (var y = 0; y < canvas.height; y += chunkSize) {
320
+ var getImageData = ctx.getImageData;
321
+ var originalGetImageData = ORIGINAL_ATTRIBUTE_NAME in getImageData ? getImageData[ORIGINAL_ATTRIBUTE_NAME] : getImageData;
322
+ var pixelBuffer = new Uint32Array(
323
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
324
+ originalGetImageData.call(ctx, x, y, Math.min(chunkSize, canvas.width - x), Math.min(chunkSize, canvas.height - y)).data.buffer);
325
+ if (pixelBuffer.some(function (pixel) {
326
+ return pixel !== 0;
327
+ })) return false;
215
328
  }
216
329
  }
217
330
  return true;
218
331
  }
219
332
  function getInputType(element) {
220
- const type = element.type;
221
- return element.hasAttribute("data-rr-is-password") ? "password" : type ? (
222
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
223
- toLowerCase(type)
224
- ) : null;
333
+ var type = element.type;
334
+ return element.hasAttribute("data-rr-is-password") ? "password" : type ?
335
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
336
+ toLowerCase(type) : null;
225
337
  }
226
338
  function extractFileExtension(path, baseURL) {
227
- let url;
339
+ var _ref2;
340
+ var url;
228
341
  try {
229
- url = new URL(path, baseURL ?? window.location.href);
342
+ url = new URL(path, baseURL !== null && baseURL !== void 0 ? baseURL : window.location.href);
230
343
  } catch (err) {
231
344
  return null;
232
345
  }
233
- const regex = /\.([0-9a-z]+)(?:$)/i;
234
- const match = url.pathname.match(regex);
235
- return (match == null ? void 0 : match[1]) ?? null;
346
+ var regex = /\.([0-9a-z]+)(?:$)/i;
347
+ var match = url.pathname.match(regex);
348
+ return (_ref2 = match == null ? void 0 : match[1]) !== null && _ref2 !== void 0 ? _ref2 : null;
236
349
  }
237
- let _id = 1;
238
- const tagNameRegex = new RegExp("[^a-z0-9-_:]");
239
- const IGNORED_NODE = -2;
350
+ var _id = 1;
351
+ var tagNameRegex = new RegExp("[^a-z0-9-_:]");
352
+ var IGNORED_NODE = -2;
240
353
  function genId() {
241
354
  return _id++;
242
355
  }
@@ -244,14 +357,14 @@ function getValidTagName(element) {
244
357
  if (element instanceof HTMLFormElement) {
245
358
  return "form";
246
359
  }
247
- const processedTagName = toLowerCase(element.tagName);
360
+ var processedTagName = toLowerCase(element.tagName);
248
361
  if (tagNameRegex.test(processedTagName)) {
249
362
  return "div";
250
363
  }
251
364
  return processedTagName;
252
365
  }
253
366
  function extractOrigin(url) {
254
- let origin = "";
367
+ var origin = "";
255
368
  if (url.indexOf("//") > -1) {
256
369
  origin = url.split("/").slice(0, 3).join("/");
257
370
  } else {
@@ -260,34 +373,36 @@ function extractOrigin(url) {
260
373
  origin = origin.split("?")[0];
261
374
  return origin;
262
375
  }
263
- let canvasService;
264
- let canvasCtx;
265
- const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
266
- const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
267
- const URL_WWW_MATCH = /^www\..*/i;
268
- const DATA_URI = /^(data:)([^,]*),(.*)/i;
376
+ var canvasService;
377
+ var canvasCtx;
378
+ var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
379
+ var URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
380
+ var URL_WWW_MATCH = /^www\..*/i;
381
+ var DATA_URI = /^(data:)([^,]*),(.*)/i;
269
382
  function absoluteToStylesheet(cssText, href) {
270
- return (cssText || "").replace(
271
- URL_IN_CSS_REF,
272
- (origin, quote1, path1, quote2, path2, path3) => {
273
- const filePath = path1 || path2 || path3;
274
- const maybeQuote = quote1 || quote2 || "";
275
- if (!filePath) {
276
- return origin;
277
- }
278
- if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
279
- return `url(${maybeQuote}${filePath}${maybeQuote})`;
280
- }
281
- if (DATA_URI.test(filePath)) {
282
- return `url(${maybeQuote}${filePath}${maybeQuote})`;
283
- }
284
- if (filePath[0] === "/") {
285
- return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;
286
- }
287
- const stack = href.split("/");
288
- const parts = filePath.split("/");
289
- stack.pop();
290
- for (const part of parts) {
383
+ return (cssText || "").replace(URL_IN_CSS_REF, function (origin, quote1, path1, quote2, path2, path3) {
384
+ var filePath = path1 || path2 || path3;
385
+ var maybeQuote = quote1 || quote2 || "";
386
+ if (!filePath) {
387
+ return origin;
388
+ }
389
+ if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
390
+ return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
391
+ }
392
+ if (DATA_URI.test(filePath)) {
393
+ return "url(".concat(maybeQuote).concat(filePath).concat(maybeQuote, ")");
394
+ }
395
+ if (filePath[0] === "/") {
396
+ return "url(".concat(maybeQuote).concat(extractOrigin(href) + filePath).concat(maybeQuote, ")");
397
+ }
398
+ var stack = href.split("/");
399
+ var parts = filePath.split("/");
400
+ stack.pop();
401
+ var _iterator = _createForOfIteratorHelper(parts),
402
+ _step;
403
+ try {
404
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
405
+ var part = _step.value;
291
406
  if (part === ".") {
292
407
  continue;
293
408
  } else if (part === "..") {
@@ -296,20 +411,24 @@ function absoluteToStylesheet(cssText, href) {
296
411
  stack.push(part);
297
412
  }
298
413
  }
299
- return `url(${maybeQuote}${stack.join("/")}${maybeQuote})`;
414
+ } catch (err) {
415
+ _iterator.e(err);
416
+ } finally {
417
+ _iterator.f();
300
418
  }
301
- );
419
+ return "url(".concat(maybeQuote).concat(stack.join("/")).concat(maybeQuote, ")");
420
+ });
302
421
  }
303
- const SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
304
- const SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
422
+ var SRCSET_NOT_SPACES = /^[^ \t\n\r\u000c]+/;
423
+ var SRCSET_COMMAS_OR_SPACES = /^[, \t\n\r\u000c]+/;
305
424
  function getAbsoluteSrcsetString(doc, attributeValue) {
306
425
  if (attributeValue.trim() === "") {
307
426
  return attributeValue;
308
427
  }
309
- let pos = 0;
428
+ var pos = 0;
310
429
  function collectCharacters(regEx) {
311
- let chars;
312
- const match = regEx.exec(attributeValue.substring(pos));
430
+ var chars;
431
+ var match = regEx.exec(attributeValue.substring(pos));
313
432
  if (match) {
314
433
  chars = match[0];
315
434
  pos += chars.length;
@@ -317,22 +436,22 @@ function getAbsoluteSrcsetString(doc, attributeValue) {
317
436
  }
318
437
  return "";
319
438
  }
320
- const output = [];
439
+ var output = [];
321
440
  while (true) {
322
441
  collectCharacters(SRCSET_COMMAS_OR_SPACES);
323
442
  if (pos >= attributeValue.length) {
324
443
  break;
325
444
  }
326
- let url = collectCharacters(SRCSET_NOT_SPACES);
445
+ var url = collectCharacters(SRCSET_NOT_SPACES);
327
446
  if (url.slice(-1) === ",") {
328
447
  url = absoluteToDoc(doc, url.substring(0, url.length - 1));
329
448
  output.push(url);
330
449
  } else {
331
- let descriptorsStr = "";
450
+ var descriptorsStr = "";
332
451
  url = absoluteToDoc(doc, url);
333
- let inParens = false;
452
+ var inParens = false;
334
453
  while (true) {
335
- const c = attributeValue.charAt(pos);
454
+ var c = attributeValue.charAt(pos);
336
455
  if (c === "") {
337
456
  output.push((url + descriptorsStr).trim());
338
457
  break;
@@ -356,7 +475,7 @@ function getAbsoluteSrcsetString(doc, attributeValue) {
356
475
  }
357
476
  return output.join(", ");
358
477
  }
359
- const cachedDocument = /* @__PURE__ */ new WeakMap();
478
+ var cachedDocument = /* @__PURE__ */new WeakMap();
360
479
  function absoluteToDoc(doc, attributeValue) {
361
480
  if (!attributeValue || attributeValue.trim() === "") {
362
481
  return attributeValue;
@@ -367,7 +486,7 @@ function isSVGElement(el) {
367
486
  return Boolean(el.tagName === "svg" || el.ownerSVGElement);
368
487
  }
369
488
  function getHref(doc, customHref) {
370
- let a = cachedDocument.get(doc);
489
+ var a = cachedDocument.get(doc);
371
490
  if (!a) {
372
491
  a = doc.createElement("a");
373
492
  cachedDocument.set(doc, a);
@@ -409,8 +528,8 @@ function _isBlockedElement(element, blockClass, blockSelector) {
409
528
  return true;
410
529
  }
411
530
  } else {
412
- for (let eIndex = element.classList.length; eIndex--; ) {
413
- const className = element.classList[eIndex];
531
+ for (var eIndex = element.classList.length; eIndex--;) {
532
+ var className = element.classList[eIndex];
414
533
  if (blockClass.test(className)) {
415
534
  return true;
416
535
  }
@@ -419,85 +538,74 @@ function _isBlockedElement(element, blockClass, blockSelector) {
419
538
  if (blockSelector) {
420
539
  return element.matches(blockSelector);
421
540
  }
422
- } catch (e) {
423
- }
541
+ } catch (e) {}
424
542
  return false;
425
543
  }
426
544
  function classMatchesRegex(node, regex, checkAncestors) {
427
- if (!node)
428
- return false;
545
+ if (!node) return false;
429
546
  if (node.nodeType !== node.ELEMENT_NODE) {
430
- if (!checkAncestors)
431
- return false;
547
+ if (!checkAncestors) return false;
432
548
  return classMatchesRegex(node.parentNode, regex, checkAncestors);
433
549
  }
434
- for (let eIndex = node.classList.length; eIndex--; ) {
435
- const className = node.classList[eIndex];
550
+ for (var eIndex = node.classList.length; eIndex--;) {
551
+ var className = node.classList[eIndex];
436
552
  if (regex.test(className)) {
437
553
  return true;
438
554
  }
439
555
  }
440
- if (!checkAncestors)
441
- return false;
556
+ if (!checkAncestors) return false;
442
557
  return classMatchesRegex(node.parentNode, regex, checkAncestors);
443
558
  }
444
559
  function needMaskingText(node, maskTextClass, maskTextSelector, checkAncestors) {
445
560
  try {
446
- const el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
447
- if (el === null)
448
- return false;
561
+ var el = node.nodeType === node.ELEMENT_NODE ? node : node.parentElement;
562
+ if (el === null) return false;
449
563
  if (typeof maskTextClass === "string") {
450
564
  if (checkAncestors) {
451
- if (el.closest(`.${maskTextClass}`))
452
- return true;
565
+ if (el.closest(".".concat(maskTextClass))) return true;
453
566
  } else {
454
- if (el.classList.contains(maskTextClass))
455
- return true;
567
+ if (el.classList.contains(maskTextClass)) return true;
456
568
  }
457
569
  } else {
458
- if (classMatchesRegex(el, maskTextClass, checkAncestors))
459
- return true;
570
+ if (classMatchesRegex(el, maskTextClass, checkAncestors)) return true;
460
571
  }
461
572
  if (maskTextSelector) {
462
573
  if (checkAncestors) {
463
- if (el.closest(maskTextSelector))
464
- return true;
574
+ if (el.closest(maskTextSelector)) return true;
465
575
  } else {
466
- if (el.matches(maskTextSelector))
467
- return true;
576
+ if (el.matches(maskTextSelector)) return true;
468
577
  }
469
578
  }
470
- } catch (e) {
471
- }
579
+ } catch (e) {}
472
580
  return false;
473
581
  }
474
582
  function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
475
- const win = iframeEl.contentWindow;
583
+ var win = iframeEl.contentWindow;
476
584
  if (!win) {
477
585
  return;
478
586
  }
479
- let fired = false;
480
- let readyState;
587
+ var fired = false;
588
+ var readyState;
481
589
  try {
482
590
  readyState = win.document.readyState;
483
591
  } catch (error) {
484
592
  return;
485
593
  }
486
594
  if (readyState !== "complete") {
487
- const timer = setTimeout(() => {
595
+ var timer = setTimeout(function () {
488
596
  if (!fired) {
489
597
  listener();
490
598
  fired = true;
491
599
  }
492
600
  }, iframeLoadTimeout);
493
- iframeEl.addEventListener("load", () => {
601
+ iframeEl.addEventListener("load", function () {
494
602
  clearTimeout(timer);
495
603
  fired = true;
496
604
  listener();
497
605
  });
498
606
  return;
499
607
  }
500
- const blankUrl = "about:blank";
608
+ var blankUrl = "about:blank";
501
609
  if (win.location.href !== blankUrl || iframeEl.src === blankUrl || iframeEl.src === "") {
502
610
  setTimeout(listener, 0);
503
611
  return iframeEl.addEventListener("load", listener);
@@ -505,45 +613,45 @@ function onceIframeLoaded(iframeEl, listener, iframeLoadTimeout) {
505
613
  iframeEl.addEventListener("load", listener);
506
614
  }
507
615
  function onceStylesheetLoaded(link, listener, styleSheetLoadTimeout) {
508
- let fired = false;
509
- let styleSheetLoaded;
616
+ var fired = false;
617
+ var styleSheetLoaded;
510
618
  try {
511
619
  styleSheetLoaded = link.sheet;
512
620
  } catch (error) {
513
621
  return;
514
622
  }
515
- if (styleSheetLoaded)
516
- return;
517
- const timer = setTimeout(() => {
623
+ if (styleSheetLoaded) return;
624
+ var timer = setTimeout(function () {
518
625
  if (!fired) {
519
626
  listener();
520
627
  fired = true;
521
628
  }
522
629
  }, styleSheetLoadTimeout);
523
- link.addEventListener("load", () => {
630
+ link.addEventListener("load", function () {
524
631
  clearTimeout(timer);
525
632
  fired = true;
526
633
  listener();
527
634
  });
528
635
  }
529
636
  function serializeNode(n, options) {
530
- const {
531
- doc,
532
- mirror,
533
- blockClass,
534
- blockSelector,
535
- needsMask,
536
- inlineStylesheet,
537
- maskInputOptions = {},
538
- maskTextFn,
539
- maskInputFn,
540
- dataURLOptions = {},
541
- inlineImages,
542
- recordCanvas,
543
- keepIframeSrcFn,
544
- newlyAddedElement = false
545
- } = options;
546
- const rootId = getRootId(doc, mirror);
637
+ var doc = options.doc,
638
+ mirror = options.mirror,
639
+ blockClass = options.blockClass,
640
+ blockSelector = options.blockSelector,
641
+ needsMask = options.needsMask,
642
+ inlineStylesheet = options.inlineStylesheet,
643
+ _options$maskInputOpt = options.maskInputOptions,
644
+ maskInputOptions = _options$maskInputOpt === void 0 ? {} : _options$maskInputOpt,
645
+ maskTextFn = options.maskTextFn,
646
+ maskInputFn = options.maskInputFn,
647
+ _options$dataURLOptio = options.dataURLOptions,
648
+ dataURLOptions = _options$dataURLOptio === void 0 ? {} : _options$dataURLOptio,
649
+ inlineImages = options.inlineImages,
650
+ recordCanvas = options.recordCanvas,
651
+ keepIframeSrcFn = options.keepIframeSrcFn,
652
+ _options$newlyAddedEl = options.newlyAddedElement,
653
+ newlyAddedElement = _options$newlyAddedEl === void 0 ? false : _options$newlyAddedEl;
654
+ var rootId = getRootId(doc, mirror);
547
655
  switch (n.nodeType) {
548
656
  case n.DOCUMENT_NODE:
549
657
  if (n.compatMode !== "CSS1Compat") {
@@ -565,72 +673,67 @@ function serializeNode(n, options) {
565
673
  name: n.name,
566
674
  publicId: n.publicId,
567
675
  systemId: n.systemId,
568
- rootId
676
+ rootId: rootId
569
677
  };
570
678
  case n.ELEMENT_NODE:
571
679
  return serializeElementNode(n, {
572
- doc,
573
- blockClass,
574
- blockSelector,
575
- inlineStylesheet,
576
- maskInputOptions,
577
- maskInputFn,
578
- dataURLOptions,
579
- inlineImages,
580
- recordCanvas,
581
- keepIframeSrcFn,
582
- newlyAddedElement,
583
- rootId
680
+ doc: doc,
681
+ blockClass: blockClass,
682
+ blockSelector: blockSelector,
683
+ inlineStylesheet: inlineStylesheet,
684
+ maskInputOptions: maskInputOptions,
685
+ maskInputFn: maskInputFn,
686
+ dataURLOptions: dataURLOptions,
687
+ inlineImages: inlineImages,
688
+ recordCanvas: recordCanvas,
689
+ keepIframeSrcFn: keepIframeSrcFn,
690
+ newlyAddedElement: newlyAddedElement,
691
+ rootId: rootId
584
692
  });
585
693
  case n.TEXT_NODE:
586
694
  return serializeTextNode(n, {
587
- doc,
588
- needsMask,
589
- maskTextFn,
590
- rootId
695
+ doc: doc,
696
+ needsMask: needsMask,
697
+ maskTextFn: maskTextFn,
698
+ rootId: rootId
591
699
  });
592
700
  case n.CDATA_SECTION_NODE:
593
701
  return {
594
702
  type: NodeType.CDATA,
595
703
  textContent: "",
596
- rootId
704
+ rootId: rootId
597
705
  };
598
706
  case n.COMMENT_NODE:
599
707
  return {
600
708
  type: NodeType.Comment,
601
709
  textContent: n.textContent || "",
602
- rootId
710
+ rootId: rootId
603
711
  };
604
712
  default:
605
713
  return false;
606
714
  }
607
715
  }
608
716
  function getRootId(doc, mirror) {
609
- if (!mirror.hasNode(doc))
610
- return void 0;
611
- const docId = mirror.getId(doc);
717
+ if (!mirror.hasNode(doc)) return void 0;
718
+ var docId = mirror.getId(doc);
612
719
  return docId === 1 ? void 0 : docId;
613
720
  }
614
721
  function serializeTextNode(n, options) {
615
722
  var _a;
616
- const { needsMask, maskTextFn, rootId } = options;
617
- const parentTagName = n.parentNode && n.parentNode.tagName;
618
- let textContent = n.textContent;
619
- const isStyle = parentTagName === "STYLE" ? true : void 0;
620
- const isScript = parentTagName === "SCRIPT" ? true : void 0;
723
+ var needsMask = options.needsMask,
724
+ maskTextFn = options.maskTextFn,
725
+ rootId = options.rootId;
726
+ var parentTagName = n.parentNode && n.parentNode.tagName;
727
+ var textContent = n.textContent;
728
+ var isStyle = parentTagName === "STYLE" ? true : void 0;
729
+ var isScript = parentTagName === "SCRIPT" ? true : void 0;
621
730
  if (isStyle && textContent) {
622
731
  try {
623
- if (n.nextSibling || n.previousSibling) {
624
- } else if ((_a = n.parentNode.sheet) == null ? void 0 : _a.cssRules) {
625
- textContent = stringifyStylesheet(
626
- n.parentNode.sheet
627
- );
732
+ if (n.nextSibling || n.previousSibling) {} else if ((_a = n.parentNode.sheet) == null ? void 0 : _a.cssRules) {
733
+ textContent = stringifyStylesheet(n.parentNode.sheet);
628
734
  }
629
735
  } catch (err) {
630
- console.warn(
631
- `Cannot get CSS styles from text's parentNode. Error: ${err}`,
632
- n
633
- );
736
+ console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(err), n);
634
737
  }
635
738
  textContent = absoluteToStylesheet(textContent, getHref(options.doc));
636
739
  }
@@ -643,45 +746,41 @@ function serializeTextNode(n, options) {
643
746
  return {
644
747
  type: NodeType.Text,
645
748
  textContent: textContent || "",
646
- isStyle,
647
- rootId
749
+ isStyle: isStyle,
750
+ rootId: rootId
648
751
  };
649
752
  }
650
753
  function serializeElementNode(n, options) {
651
- const {
652
- doc,
653
- blockClass,
654
- blockSelector,
655
- inlineStylesheet,
656
- maskInputOptions = {},
657
- maskInputFn,
658
- dataURLOptions = {},
659
- inlineImages,
660
- recordCanvas,
661
- keepIframeSrcFn,
662
- newlyAddedElement = false,
663
- rootId
664
- } = options;
665
- const needBlock = _isBlockedElement(n, blockClass, blockSelector);
666
- const tagName = getValidTagName(n);
667
- let attributes2 = {};
668
- const len = n.attributes.length;
669
- for (let i = 0; i < len; i++) {
670
- const attr = n.attributes[i];
754
+ var doc = options.doc,
755
+ blockClass = options.blockClass,
756
+ blockSelector = options.blockSelector,
757
+ inlineStylesheet = options.inlineStylesheet,
758
+ _options$maskInputOpt2 = options.maskInputOptions,
759
+ maskInputOptions = _options$maskInputOpt2 === void 0 ? {} : _options$maskInputOpt2,
760
+ maskInputFn = options.maskInputFn,
761
+ _options$dataURLOptio2 = options.dataURLOptions,
762
+ dataURLOptions = _options$dataURLOptio2 === void 0 ? {} : _options$dataURLOptio2,
763
+ inlineImages = options.inlineImages,
764
+ recordCanvas = options.recordCanvas,
765
+ keepIframeSrcFn = options.keepIframeSrcFn,
766
+ _options$newlyAddedEl2 = options.newlyAddedElement,
767
+ newlyAddedElement = _options$newlyAddedEl2 === void 0 ? false : _options$newlyAddedEl2,
768
+ rootId = options.rootId;
769
+ var needBlock = _isBlockedElement(n, blockClass, blockSelector);
770
+ var tagName = getValidTagName(n);
771
+ var attributes2 = {};
772
+ var len = n.attributes.length;
773
+ for (var i = 0; i < len; i++) {
774
+ var attr = n.attributes[i];
671
775
  if (!ignoreAttribute(tagName, attr.name, attr.value)) {
672
- attributes2[attr.name] = transformAttribute(
673
- doc,
674
- tagName,
675
- toLowerCase(attr.name),
676
- attr.value
677
- );
776
+ attributes2[attr.name] = transformAttribute(doc, tagName, toLowerCase(attr.name), attr.value);
678
777
  }
679
778
  }
680
779
  if (tagName === "link" && inlineStylesheet) {
681
- const stylesheet = Array.from(doc.styleSheets).find((s) => {
780
+ var stylesheet = Array.from(doc.styleSheets).find(function (s) {
682
781
  return s.href === n.href;
683
782
  });
684
- let cssText = null;
783
+ var cssText = null;
685
784
  if (stylesheet) {
686
785
  cssText = stringifyStylesheet(stylesheet);
687
786
  }
@@ -691,26 +790,25 @@ function serializeElementNode(n, options) {
691
790
  attributes2._cssText = absoluteToStylesheet(cssText, stylesheet.href);
692
791
  }
693
792
  }
694
- if (tagName === "style" && n.sheet && // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
793
+ if (tagName === "style" && n.sheet &&
794
+ // TODO: Currently we only try to get dynamic stylesheet when it is an empty style element
695
795
  !(n.innerText || n.textContent || "").trim().length) {
696
- const cssText = stringifyStylesheet(
697
- n.sheet
698
- );
699
- if (cssText) {
700
- attributes2._cssText = absoluteToStylesheet(cssText, getHref(doc));
796
+ var _cssText = stringifyStylesheet(n.sheet);
797
+ if (_cssText) {
798
+ attributes2._cssText = absoluteToStylesheet(_cssText, getHref(doc));
701
799
  }
702
800
  }
703
801
  if (tagName === "input" || tagName === "textarea" || tagName === "select") {
704
- const value = n.value;
705
- const checked = n.checked;
802
+ var value = n.value;
803
+ var checked = n.checked;
706
804
  if (attributes2.type !== "radio" && attributes2.type !== "checkbox" && attributes2.type !== "submit" && attributes2.type !== "button" && value) {
707
805
  attributes2.value = maskInputValue({
708
806
  element: n,
709
807
  type: getInputType(n),
710
- tagName,
711
- value,
712
- maskInputOptions,
713
- maskInputFn
808
+ tagName: tagName,
809
+ value: value,
810
+ maskInputOptions: maskInputOptions,
811
+ maskInputFn: maskInputFn
714
812
  });
715
813
  } else if (checked) {
716
814
  attributes2.checked = checked;
@@ -726,23 +824,14 @@ function serializeElementNode(n, options) {
726
824
  if (tagName === "canvas" && recordCanvas) {
727
825
  if (n.__context === "2d") {
728
826
  if (!is2DCanvasBlank(n)) {
729
- attributes2.rr_dataURL = n.toDataURL(
730
- dataURLOptions.type,
731
- dataURLOptions.quality
732
- );
827
+ attributes2.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
733
828
  }
734
829
  } else if (!("__context" in n)) {
735
- const canvasDataURL = n.toDataURL(
736
- dataURLOptions.type,
737
- dataURLOptions.quality
738
- );
739
- const blankCanvas = doc.createElement("canvas");
830
+ var canvasDataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
831
+ var blankCanvas = doc.createElement("canvas");
740
832
  blankCanvas.width = n.width;
741
833
  blankCanvas.height = n.height;
742
- const blankCanvasDataURL = blankCanvas.toDataURL(
743
- dataURLOptions.type,
744
- dataURLOptions.quality
745
- );
834
+ var blankCanvasDataURL = blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality);
746
835
  if (canvasDataURL !== blankCanvasDataURL) {
747
836
  attributes2.rr_dataURL = canvasDataURL;
748
837
  }
@@ -753,44 +842,33 @@ function serializeElementNode(n, options) {
753
842
  canvasService = doc.createElement("canvas");
754
843
  canvasCtx = canvasService.getContext("2d");
755
844
  }
756
- const image = n;
757
- const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
758
- const priorCrossOrigin = image.crossOrigin;
759
- const recordInlineImage = () => {
760
- image.removeEventListener("load", recordInlineImage);
845
+ var image = n;
846
+ var imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
847
+ var priorCrossOrigin = image.crossOrigin;
848
+ var _recordInlineImage = function recordInlineImage() {
849
+ image.removeEventListener("load", _recordInlineImage);
761
850
  try {
762
851
  canvasService.width = image.naturalWidth;
763
852
  canvasService.height = image.naturalHeight;
764
853
  canvasCtx.drawImage(image, 0, 0);
765
- attributes2.rr_dataURL = canvasService.toDataURL(
766
- dataURLOptions.type,
767
- dataURLOptions.quality
768
- );
854
+ attributes2.rr_dataURL = canvasService.toDataURL(dataURLOptions.type, dataURLOptions.quality);
769
855
  } catch (err) {
770
856
  if (image.crossOrigin !== "anonymous") {
771
857
  image.crossOrigin = "anonymous";
772
- if (image.complete && image.naturalWidth !== 0)
773
- recordInlineImage();
774
- else
775
- image.addEventListener("load", recordInlineImage);
858
+ if (image.complete && image.naturalWidth !== 0) _recordInlineImage();else image.addEventListener("load", _recordInlineImage);
776
859
  return;
777
860
  } else {
778
- console.warn(
779
- `Cannot inline img src=${imageSrc}! Error: ${err}`
780
- );
861
+ console.warn("Cannot inline img src=".concat(imageSrc, "! Error: ").concat(err));
781
862
  }
782
863
  }
783
864
  if (image.crossOrigin === "anonymous") {
784
865
  priorCrossOrigin ? attributes2.crossOrigin = priorCrossOrigin : image.removeAttribute("crossorigin");
785
866
  }
786
867
  };
787
- if (image.complete && image.naturalWidth !== 0)
788
- recordInlineImage();
789
- else
790
- image.addEventListener("load", recordInlineImage);
868
+ if (image.complete && image.naturalWidth !== 0) _recordInlineImage();else image.addEventListener("load", _recordInlineImage);
791
869
  }
792
870
  if (tagName === "audio" || tagName === "video") {
793
- const mediaAttributes = attributes2;
871
+ var mediaAttributes = attributes2;
794
872
  mediaAttributes.rr_mediaState = n.paused ? "paused" : "played";
795
873
  mediaAttributes.rr_mediaCurrentTime = n.currentTime;
796
874
  mediaAttributes.rr_mediaPlaybackRate = n.playbackRate;
@@ -807,11 +885,13 @@ function serializeElementNode(n, options) {
807
885
  }
808
886
  }
809
887
  if (needBlock) {
810
- const { width, height } = n.getBoundingClientRect();
888
+ var _n$getBoundingClientR = n.getBoundingClientRect(),
889
+ width = _n$getBoundingClientR.width,
890
+ height = _n$getBoundingClientR.height;
811
891
  attributes2 = {
812
892
  class: attributes2.class,
813
- rr_width: `${width}px`,
814
- rr_height: `${height}px`
893
+ rr_width: "".concat(width, "px"),
894
+ rr_height: "".concat(height, "px")
815
895
  };
816
896
  }
817
897
  if (tagName === "iframe" && !keepIframeSrcFn(attributes2.src)) {
@@ -820,20 +900,18 @@ function serializeElementNode(n, options) {
820
900
  }
821
901
  delete attributes2.src;
822
902
  }
823
- let isCustomElement;
903
+ var isCustomElement;
824
904
  try {
825
- if (customElements.get(tagName))
826
- isCustomElement = true;
827
- } catch (e) {
828
- }
905
+ if (customElements.get(tagName)) isCustomElement = true;
906
+ } catch (e) {}
829
907
  return {
830
908
  type: NodeType.Element,
831
- tagName,
909
+ tagName: tagName,
832
910
  attributes: attributes2,
833
911
  childNodes: [],
834
912
  isSVG: isSVGElement(n) || void 0,
835
- needBlock,
836
- rootId,
913
+ needBlock: needBlock,
914
+ rootId: rootId,
837
915
  isCustom: isCustomElement
838
916
  };
839
917
  }
@@ -848,19 +926,21 @@ function slimDOMExcluded(sn, slimDOMOptions) {
848
926
  if (slimDOMOptions.comment && sn.type === NodeType.Comment) {
849
927
  return true;
850
928
  } else if (sn.type === NodeType.Element) {
851
- if (slimDOMOptions.script && // script tag
852
- (sn.tagName === "script" || // (module)preload link
853
- sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" || // prefetch link
929
+ if (slimDOMOptions.script && (
930
+ // script tag
931
+ sn.tagName === "script" ||
932
+ // (module)preload link
933
+ sn.tagName === "link" && (sn.attributes.rel === "preload" || sn.attributes.rel === "modulepreload") && sn.attributes.as === "script" ||
934
+ // prefetch link
854
935
  sn.tagName === "link" && sn.attributes.rel === "prefetch" && typeof sn.attributes.href === "string" && extractFileExtension(sn.attributes.href) === "js")) {
855
936
  return true;
856
- } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(
857
- /^msapplication-tile(image|color)$/
858
- ) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
937
+ } else if (slimDOMOptions.headFavicon && (sn.tagName === "link" && sn.attributes.rel === "shortcut icon" || sn.tagName === "meta" && (lowerIfExists(sn.attributes.name).match(/^msapplication-tile(image|color)$/) || lowerIfExists(sn.attributes.name) === "application-name" || lowerIfExists(sn.attributes.rel) === "icon" || lowerIfExists(sn.attributes.rel) === "apple-touch-icon" || lowerIfExists(sn.attributes.rel) === "shortcut icon"))) {
859
938
  return true;
860
939
  } else if (sn.tagName === "meta") {
861
940
  if (slimDOMOptions.headMetaDescKeywords && lowerIfExists(sn.attributes.name).match(/^description|keywords$/)) {
862
941
  return true;
863
- } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) || // og = opengraph (facebook)
942
+ } else if (slimDOMOptions.headMetaSocial && (lowerIfExists(sn.attributes.property).match(/^(og|twitter|fb):/) ||
943
+ // og = opengraph (facebook)
864
944
  lowerIfExists(sn.attributes.name).match(/^(og|twitter):/) || lowerIfExists(sn.attributes.name) === "pinterest")) {
865
945
  return true;
866
946
  } else if (slimDOMOptions.headMetaRobots && (lowerIfExists(sn.attributes.name) === "robots" || lowerIfExists(sn.attributes.name) === "googlebot" || lowerIfExists(sn.attributes.name) === "bingbot")) {
@@ -877,62 +957,68 @@ function slimDOMExcluded(sn, slimDOMOptions) {
877
957
  return false;
878
958
  }
879
959
  function serializeNodeWithId(n, options) {
880
- const {
881
- doc,
882
- mirror,
883
- blockClass,
884
- blockSelector,
885
- maskTextClass,
886
- maskTextSelector,
887
- skipChild = false,
888
- inlineStylesheet = true,
889
- maskInputOptions = {},
890
- maskTextFn,
891
- maskInputFn,
892
- slimDOMOptions,
893
- dataURLOptions = {},
894
- inlineImages = false,
895
- recordCanvas = false,
896
- onSerialize,
897
- onIframeLoad,
898
- iframeLoadTimeout = 5e3,
899
- onStylesheetLoad,
900
- stylesheetLoadTimeout = 5e3,
901
- keepIframeSrcFn = () => false,
902
- newlyAddedElement = false
903
- } = options;
904
- let { needsMask } = options;
905
- let { preserveWhiteSpace = true } = options;
960
+ var doc = options.doc,
961
+ mirror = options.mirror,
962
+ blockClass = options.blockClass,
963
+ blockSelector = options.blockSelector,
964
+ maskTextClass = options.maskTextClass,
965
+ maskTextSelector = options.maskTextSelector,
966
+ _options$skipChild = options.skipChild,
967
+ skipChild = _options$skipChild === void 0 ? false : _options$skipChild,
968
+ _options$inlineStyles = options.inlineStylesheet,
969
+ inlineStylesheet = _options$inlineStyles === void 0 ? true : _options$inlineStyles,
970
+ _options$maskInputOpt3 = options.maskInputOptions,
971
+ maskInputOptions = _options$maskInputOpt3 === void 0 ? {} : _options$maskInputOpt3,
972
+ maskTextFn = options.maskTextFn,
973
+ maskInputFn = options.maskInputFn,
974
+ slimDOMOptions = options.slimDOMOptions,
975
+ _options$dataURLOptio3 = options.dataURLOptions,
976
+ dataURLOptions = _options$dataURLOptio3 === void 0 ? {} : _options$dataURLOptio3,
977
+ _options$inlineImages = options.inlineImages,
978
+ inlineImages = _options$inlineImages === void 0 ? false : _options$inlineImages,
979
+ _options$recordCanvas = options.recordCanvas,
980
+ recordCanvas = _options$recordCanvas === void 0 ? false : _options$recordCanvas,
981
+ onSerialize = options.onSerialize,
982
+ onIframeLoad = options.onIframeLoad,
983
+ _options$iframeLoadTi = options.iframeLoadTimeout,
984
+ iframeLoadTimeout = _options$iframeLoadTi === void 0 ? 5e3 : _options$iframeLoadTi,
985
+ onStylesheetLoad = options.onStylesheetLoad,
986
+ _options$stylesheetLo = options.stylesheetLoadTimeout,
987
+ stylesheetLoadTimeout = _options$stylesheetLo === void 0 ? 5e3 : _options$stylesheetLo,
988
+ _options$keepIframeSr = options.keepIframeSrcFn,
989
+ keepIframeSrcFn = _options$keepIframeSr === void 0 ? function () {
990
+ return false;
991
+ } : _options$keepIframeSr,
992
+ _options$newlyAddedEl3 = options.newlyAddedElement,
993
+ newlyAddedElement = _options$newlyAddedEl3 === void 0 ? false : _options$newlyAddedEl3;
994
+ var needsMask = options.needsMask;
995
+ var _options$preserveWhit = options.preserveWhiteSpace,
996
+ preserveWhiteSpace = _options$preserveWhit === void 0 ? true : _options$preserveWhit;
906
997
  if (!needsMask && n.childNodes) {
907
- const checkAncestors = needsMask === void 0;
908
- needsMask = needMaskingText(
909
- n,
910
- maskTextClass,
911
- maskTextSelector,
912
- checkAncestors
913
- );
914
- }
915
- const _serializedNode = serializeNode(n, {
916
- doc,
917
- mirror,
918
- blockClass,
919
- blockSelector,
920
- needsMask,
921
- inlineStylesheet,
922
- maskInputOptions,
923
- maskTextFn,
924
- maskInputFn,
925
- dataURLOptions,
926
- inlineImages,
927
- recordCanvas,
928
- keepIframeSrcFn,
929
- newlyAddedElement
998
+ var checkAncestors = needsMask === void 0;
999
+ needsMask = needMaskingText(n, maskTextClass, maskTextSelector, checkAncestors);
1000
+ }
1001
+ var _serializedNode = serializeNode(n, {
1002
+ doc: doc,
1003
+ mirror: mirror,
1004
+ blockClass: blockClass,
1005
+ blockSelector: blockSelector,
1006
+ needsMask: needsMask,
1007
+ inlineStylesheet: inlineStylesheet,
1008
+ maskInputOptions: maskInputOptions,
1009
+ maskTextFn: maskTextFn,
1010
+ maskInputFn: maskInputFn,
1011
+ dataURLOptions: dataURLOptions,
1012
+ inlineImages: inlineImages,
1013
+ recordCanvas: recordCanvas,
1014
+ keepIframeSrcFn: keepIframeSrcFn,
1015
+ newlyAddedElement: newlyAddedElement
930
1016
  });
931
1017
  if (!_serializedNode) {
932
1018
  console.warn(n, "not serialized");
933
1019
  return null;
934
1020
  }
935
- let id;
1021
+ var id;
936
1022
  if (mirror.hasNode(n)) {
937
1023
  id = mirror.getId(n);
938
1024
  } else if (slimDOMExcluded(_serializedNode, slimDOMOptions) || !preserveWhiteSpace && _serializedNode.type === NodeType.Text && !_serializedNode.isStyle && !_serializedNode.textContent.replace(/^\s+|\s+$/gm, "").length) {
@@ -940,7 +1026,9 @@ function serializeNodeWithId(n, options) {
940
1026
  } else {
941
1027
  id = genId();
942
1028
  }
943
- const serializedNode2 = Object.assign(_serializedNode, { id });
1029
+ var serializedNode2 = Object.assign(_serializedNode, {
1030
+ id: id
1031
+ });
944
1032
  mirror.add(n, serializedNode2);
945
1033
  if (id === IGNORED_NODE) {
946
1034
  return null;
@@ -948,59 +1036,58 @@ function serializeNodeWithId(n, options) {
948
1036
  if (onSerialize) {
949
1037
  onSerialize(n);
950
1038
  }
951
- let recordChild = !skipChild;
1039
+ var recordChild = !skipChild;
952
1040
  if (serializedNode2.type === NodeType.Element) {
953
1041
  recordChild = recordChild && !serializedNode2.needBlock;
954
1042
  delete serializedNode2.needBlock;
955
- const shadowRoot = n.shadowRoot;
956
- if (shadowRoot && isNativeShadowDom(shadowRoot))
957
- serializedNode2.isShadowHost = true;
1043
+ var shadowRoot = n.shadowRoot;
1044
+ if (shadowRoot && isNativeShadowDom(shadowRoot)) serializedNode2.isShadowHost = true;
958
1045
  }
959
1046
  if ((serializedNode2.type === NodeType.Document || serializedNode2.type === NodeType.Element) && recordChild) {
960
1047
  if (slimDOMOptions.headWhitespace && serializedNode2.type === NodeType.Element && serializedNode2.tagName === "head") {
961
1048
  preserveWhiteSpace = false;
962
1049
  }
963
- const bypassOptions = {
964
- doc,
965
- mirror,
966
- blockClass,
967
- blockSelector,
968
- needsMask,
969
- maskTextClass,
970
- maskTextSelector,
971
- skipChild,
972
- inlineStylesheet,
973
- maskInputOptions,
974
- maskTextFn,
975
- maskInputFn,
976
- slimDOMOptions,
977
- dataURLOptions,
978
- inlineImages,
979
- recordCanvas,
980
- preserveWhiteSpace,
981
- onSerialize,
982
- onIframeLoad,
983
- iframeLoadTimeout,
984
- onStylesheetLoad,
985
- stylesheetLoadTimeout,
986
- keepIframeSrcFn
1050
+ var bypassOptions = {
1051
+ doc: doc,
1052
+ mirror: mirror,
1053
+ blockClass: blockClass,
1054
+ blockSelector: blockSelector,
1055
+ needsMask: needsMask,
1056
+ maskTextClass: maskTextClass,
1057
+ maskTextSelector: maskTextSelector,
1058
+ skipChild: skipChild,
1059
+ inlineStylesheet: inlineStylesheet,
1060
+ maskInputOptions: maskInputOptions,
1061
+ maskTextFn: maskTextFn,
1062
+ maskInputFn: maskInputFn,
1063
+ slimDOMOptions: slimDOMOptions,
1064
+ dataURLOptions: dataURLOptions,
1065
+ inlineImages: inlineImages,
1066
+ recordCanvas: recordCanvas,
1067
+ preserveWhiteSpace: preserveWhiteSpace,
1068
+ onSerialize: onSerialize,
1069
+ onIframeLoad: onIframeLoad,
1070
+ iframeLoadTimeout: iframeLoadTimeout,
1071
+ onStylesheetLoad: onStylesheetLoad,
1072
+ stylesheetLoadTimeout: stylesheetLoadTimeout,
1073
+ keepIframeSrcFn: keepIframeSrcFn
987
1074
  };
988
- if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "textarea" && serializedNode2.attributes.value !== void 0)
989
- ;
990
- else {
991
- for (const childN of Array.from(n.childNodes)) {
992
- const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1075
+ if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "textarea" && serializedNode2.attributes.value !== void 0) ;else {
1076
+ for (var _i = 0, _Array$from = Array.from(n.childNodes); _i < _Array$from.length; _i++) {
1077
+ var childN = _Array$from[_i];
1078
+ var serializedChildNode = serializeNodeWithId(childN, bypassOptions);
993
1079
  if (serializedChildNode) {
994
1080
  serializedNode2.childNodes.push(serializedChildNode);
995
1081
  }
996
1082
  }
997
1083
  }
998
1084
  if (isElement(n) && n.shadowRoot) {
999
- for (const childN of Array.from(n.shadowRoot.childNodes)) {
1000
- const serializedChildNode = serializeNodeWithId(childN, bypassOptions);
1001
- if (serializedChildNode) {
1002
- isNativeShadowDom(n.shadowRoot) && (serializedChildNode.isShadow = true);
1003
- serializedNode2.childNodes.push(serializedChildNode);
1085
+ for (var _i2 = 0, _Array$from2 = Array.from(n.shadowRoot.childNodes); _i2 < _Array$from2.length; _i2++) {
1086
+ var _childN = _Array$from2[_i2];
1087
+ var _serializedChildNode = serializeNodeWithId(_childN, bypassOptions);
1088
+ if (_serializedChildNode) {
1089
+ isNativeShadowDom(n.shadowRoot) && (_serializedChildNode.isShadow = true);
1090
+ serializedNode2.childNodes.push(_serializedChildNode);
1004
1091
  }
1005
1092
  }
1006
1093
  }
@@ -1009,114 +1096,112 @@ function serializeNodeWithId(n, options) {
1009
1096
  serializedNode2.isShadow = true;
1010
1097
  }
1011
1098
  if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "iframe") {
1012
- onceIframeLoaded(
1013
- n,
1014
- () => {
1015
- const iframeDoc = n.contentDocument;
1016
- if (iframeDoc && onIframeLoad) {
1017
- const serializedIframeNode = serializeNodeWithId(iframeDoc, {
1018
- doc: iframeDoc,
1019
- mirror,
1020
- blockClass,
1021
- blockSelector,
1022
- needsMask,
1023
- maskTextClass,
1024
- maskTextSelector,
1025
- skipChild: false,
1026
- inlineStylesheet,
1027
- maskInputOptions,
1028
- maskTextFn,
1029
- maskInputFn,
1030
- slimDOMOptions,
1031
- dataURLOptions,
1032
- inlineImages,
1033
- recordCanvas,
1034
- preserveWhiteSpace,
1035
- onSerialize,
1036
- onIframeLoad,
1037
- iframeLoadTimeout,
1038
- onStylesheetLoad,
1039
- stylesheetLoadTimeout,
1040
- keepIframeSrcFn
1041
- });
1042
- if (serializedIframeNode) {
1043
- onIframeLoad(
1044
- n,
1045
- serializedIframeNode
1046
- );
1047
- }
1099
+ onceIframeLoaded(n, function () {
1100
+ var iframeDoc = n.contentDocument;
1101
+ if (iframeDoc && onIframeLoad) {
1102
+ var serializedIframeNode = serializeNodeWithId(iframeDoc, {
1103
+ doc: iframeDoc,
1104
+ mirror: mirror,
1105
+ blockClass: blockClass,
1106
+ blockSelector: blockSelector,
1107
+ needsMask: needsMask,
1108
+ maskTextClass: maskTextClass,
1109
+ maskTextSelector: maskTextSelector,
1110
+ skipChild: false,
1111
+ inlineStylesheet: inlineStylesheet,
1112
+ maskInputOptions: maskInputOptions,
1113
+ maskTextFn: maskTextFn,
1114
+ maskInputFn: maskInputFn,
1115
+ slimDOMOptions: slimDOMOptions,
1116
+ dataURLOptions: dataURLOptions,
1117
+ inlineImages: inlineImages,
1118
+ recordCanvas: recordCanvas,
1119
+ preserveWhiteSpace: preserveWhiteSpace,
1120
+ onSerialize: onSerialize,
1121
+ onIframeLoad: onIframeLoad,
1122
+ iframeLoadTimeout: iframeLoadTimeout,
1123
+ onStylesheetLoad: onStylesheetLoad,
1124
+ stylesheetLoadTimeout: stylesheetLoadTimeout,
1125
+ keepIframeSrcFn: keepIframeSrcFn
1126
+ });
1127
+ if (serializedIframeNode) {
1128
+ onIframeLoad(n, serializedIframeNode);
1048
1129
  }
1049
- },
1050
- iframeLoadTimeout
1051
- );
1130
+ }
1131
+ }, iframeLoadTimeout);
1052
1132
  }
1053
1133
  if (serializedNode2.type === NodeType.Element && serializedNode2.tagName === "link" && typeof serializedNode2.attributes.rel === "string" && (serializedNode2.attributes.rel === "stylesheet" || serializedNode2.attributes.rel === "preload" && typeof serializedNode2.attributes.href === "string" && extractFileExtension(serializedNode2.attributes.href) === "css")) {
1054
- onceStylesheetLoaded(
1055
- n,
1056
- () => {
1057
- if (onStylesheetLoad) {
1058
- const serializedLinkNode = serializeNodeWithId(n, {
1059
- doc,
1060
- mirror,
1061
- blockClass,
1062
- blockSelector,
1063
- needsMask,
1064
- maskTextClass,
1065
- maskTextSelector,
1066
- skipChild: false,
1067
- inlineStylesheet,
1068
- maskInputOptions,
1069
- maskTextFn,
1070
- maskInputFn,
1071
- slimDOMOptions,
1072
- dataURLOptions,
1073
- inlineImages,
1074
- recordCanvas,
1075
- preserveWhiteSpace,
1076
- onSerialize,
1077
- onIframeLoad,
1078
- iframeLoadTimeout,
1079
- onStylesheetLoad,
1080
- stylesheetLoadTimeout,
1081
- keepIframeSrcFn
1082
- });
1083
- if (serializedLinkNode) {
1084
- onStylesheetLoad(
1085
- n,
1086
- serializedLinkNode
1087
- );
1088
- }
1134
+ onceStylesheetLoaded(n, function () {
1135
+ if (onStylesheetLoad) {
1136
+ var serializedLinkNode = serializeNodeWithId(n, {
1137
+ doc: doc,
1138
+ mirror: mirror,
1139
+ blockClass: blockClass,
1140
+ blockSelector: blockSelector,
1141
+ needsMask: needsMask,
1142
+ maskTextClass: maskTextClass,
1143
+ maskTextSelector: maskTextSelector,
1144
+ skipChild: false,
1145
+ inlineStylesheet: inlineStylesheet,
1146
+ maskInputOptions: maskInputOptions,
1147
+ maskTextFn: maskTextFn,
1148
+ maskInputFn: maskInputFn,
1149
+ slimDOMOptions: slimDOMOptions,
1150
+ dataURLOptions: dataURLOptions,
1151
+ inlineImages: inlineImages,
1152
+ recordCanvas: recordCanvas,
1153
+ preserveWhiteSpace: preserveWhiteSpace,
1154
+ onSerialize: onSerialize,
1155
+ onIframeLoad: onIframeLoad,
1156
+ iframeLoadTimeout: iframeLoadTimeout,
1157
+ onStylesheetLoad: onStylesheetLoad,
1158
+ stylesheetLoadTimeout: stylesheetLoadTimeout,
1159
+ keepIframeSrcFn: keepIframeSrcFn
1160
+ });
1161
+ if (serializedLinkNode) {
1162
+ onStylesheetLoad(n, serializedLinkNode);
1089
1163
  }
1090
- },
1091
- stylesheetLoadTimeout
1092
- );
1164
+ }
1165
+ }, stylesheetLoadTimeout);
1093
1166
  }
1094
1167
  return serializedNode2;
1095
1168
  }
1096
1169
  function snapshot(n, options) {
1097
- const {
1098
- mirror = new Mirror(),
1099
- blockClass = "rr-block",
1100
- blockSelector = null,
1101
- maskTextClass = "rr-mask",
1102
- maskTextSelector = null,
1103
- inlineStylesheet = true,
1104
- inlineImages = false,
1105
- recordCanvas = false,
1106
- maskAllInputs = false,
1107
- maskTextFn,
1108
- maskInputFn,
1109
- slimDOM = false,
1110
- dataURLOptions,
1111
- preserveWhiteSpace,
1112
- onSerialize,
1113
- onIframeLoad,
1114
- iframeLoadTimeout,
1115
- onStylesheetLoad,
1116
- stylesheetLoadTimeout,
1117
- keepIframeSrcFn = () => false
1118
- } = options || {};
1119
- const maskInputOptions = maskAllInputs === true ? {
1170
+ var _ref3 = options || {},
1171
+ _ref3$mirror = _ref3.mirror,
1172
+ mirror = _ref3$mirror === void 0 ? new Mirror() : _ref3$mirror,
1173
+ _ref3$blockClass = _ref3.blockClass,
1174
+ blockClass = _ref3$blockClass === void 0 ? "rr-block" : _ref3$blockClass,
1175
+ _ref3$blockSelector = _ref3.blockSelector,
1176
+ blockSelector = _ref3$blockSelector === void 0 ? null : _ref3$blockSelector,
1177
+ _ref3$maskTextClass = _ref3.maskTextClass,
1178
+ maskTextClass = _ref3$maskTextClass === void 0 ? "rr-mask" : _ref3$maskTextClass,
1179
+ _ref3$maskTextSelecto = _ref3.maskTextSelector,
1180
+ maskTextSelector = _ref3$maskTextSelecto === void 0 ? null : _ref3$maskTextSelecto,
1181
+ _ref3$inlineStyleshee = _ref3.inlineStylesheet,
1182
+ inlineStylesheet = _ref3$inlineStyleshee === void 0 ? true : _ref3$inlineStyleshee,
1183
+ _ref3$inlineImages = _ref3.inlineImages,
1184
+ inlineImages = _ref3$inlineImages === void 0 ? false : _ref3$inlineImages,
1185
+ _ref3$recordCanvas = _ref3.recordCanvas,
1186
+ recordCanvas = _ref3$recordCanvas === void 0 ? false : _ref3$recordCanvas,
1187
+ _ref3$maskAllInputs = _ref3.maskAllInputs,
1188
+ maskAllInputs = _ref3$maskAllInputs === void 0 ? false : _ref3$maskAllInputs,
1189
+ maskTextFn = _ref3.maskTextFn,
1190
+ maskInputFn = _ref3.maskInputFn,
1191
+ _ref3$slimDOM = _ref3.slimDOM,
1192
+ slimDOM = _ref3$slimDOM === void 0 ? false : _ref3$slimDOM,
1193
+ dataURLOptions = _ref3.dataURLOptions,
1194
+ preserveWhiteSpace = _ref3.preserveWhiteSpace,
1195
+ onSerialize = _ref3.onSerialize,
1196
+ onIframeLoad = _ref3.onIframeLoad,
1197
+ iframeLoadTimeout = _ref3.iframeLoadTimeout,
1198
+ onStylesheetLoad = _ref3.onStylesheetLoad,
1199
+ stylesheetLoadTimeout = _ref3.stylesheetLoadTimeout,
1200
+ _ref3$keepIframeSrcFn = _ref3.keepIframeSrcFn,
1201
+ keepIframeSrcFn = _ref3$keepIframeSrcFn === void 0 ? function () {
1202
+ return false;
1203
+ } : _ref3$keepIframeSrcFn;
1204
+ var maskInputOptions = maskAllInputs === true ? {
1120
1205
  color: true,
1121
1206
  date: true,
1122
1207
  "datetime-local": true,
@@ -1136,45 +1221,44 @@ function snapshot(n, options) {
1136
1221
  } : maskAllInputs === false ? {
1137
1222
  password: true
1138
1223
  } : maskAllInputs;
1139
- const slimDOMOptions = slimDOM === true || slimDOM === "all" ? (
1140
- // if true: set of sensible options that should not throw away any information
1141
- {
1142
- script: true,
1143
- comment: true,
1144
- headFavicon: true,
1145
- headWhitespace: true,
1146
- headMetaDescKeywords: slimDOM === "all",
1147
- // destructive
1148
- headMetaSocial: true,
1149
- headMetaRobots: true,
1150
- headMetaHttpEquiv: true,
1151
- headMetaAuthorship: true,
1152
- headMetaVerification: true
1153
- }
1154
- ) : slimDOM === false ? {} : slimDOM;
1224
+ var slimDOMOptions = slimDOM === true || slimDOM === "all" ?
1225
+ // if true: set of sensible options that should not throw away any information
1226
+ {
1227
+ script: true,
1228
+ comment: true,
1229
+ headFavicon: true,
1230
+ headWhitespace: true,
1231
+ headMetaDescKeywords: slimDOM === "all",
1232
+ // destructive
1233
+ headMetaSocial: true,
1234
+ headMetaRobots: true,
1235
+ headMetaHttpEquiv: true,
1236
+ headMetaAuthorship: true,
1237
+ headMetaVerification: true
1238
+ } : slimDOM === false ? {} : slimDOM;
1155
1239
  return serializeNodeWithId(n, {
1156
1240
  doc: n,
1157
- mirror,
1158
- blockClass,
1159
- blockSelector,
1160
- maskTextClass,
1161
- maskTextSelector,
1241
+ mirror: mirror,
1242
+ blockClass: blockClass,
1243
+ blockSelector: blockSelector,
1244
+ maskTextClass: maskTextClass,
1245
+ maskTextSelector: maskTextSelector,
1162
1246
  skipChild: false,
1163
- inlineStylesheet,
1164
- maskInputOptions,
1165
- maskTextFn,
1166
- maskInputFn,
1167
- slimDOMOptions,
1168
- dataURLOptions,
1169
- inlineImages,
1170
- recordCanvas,
1171
- preserveWhiteSpace,
1172
- onSerialize,
1173
- onIframeLoad,
1174
- iframeLoadTimeout,
1175
- onStylesheetLoad,
1176
- stylesheetLoadTimeout,
1177
- keepIframeSrcFn,
1247
+ inlineStylesheet: inlineStylesheet,
1248
+ maskInputOptions: maskInputOptions,
1249
+ maskTextFn: maskTextFn,
1250
+ maskInputFn: maskInputFn,
1251
+ slimDOMOptions: slimDOMOptions,
1252
+ dataURLOptions: dataURLOptions,
1253
+ inlineImages: inlineImages,
1254
+ recordCanvas: recordCanvas,
1255
+ preserveWhiteSpace: preserveWhiteSpace,
1256
+ onSerialize: onSerialize,
1257
+ onIframeLoad: onIframeLoad,
1258
+ iframeLoadTimeout: iframeLoadTimeout,
1259
+ onStylesheetLoad: onStylesheetLoad,
1260
+ stylesheetLoadTimeout: stylesheetLoadTimeout,
1261
+ keepIframeSrcFn: keepIframeSrcFn,
1178
1262
  newlyAddedElement: false
1179
1263
  });
1180
1264
  }