@highlight-run/rrweb 2.0.4 → 2.0.5

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.
Files changed (46) hide show
  1. package/dist/plugins/console-record.js +12 -454
  2. package/dist/plugins/console-record.min.js.map +1 -1
  3. package/dist/plugins/console-replay.js +4 -164
  4. package/dist/plugins/console-replay.min.js.map +1 -1
  5. package/dist/plugins/sequential-id-record.js +1 -30
  6. package/dist/plugins/sequential-id-replay.js +1 -33
  7. package/dist/record/rrweb-record-pack.js +3 -664
  8. package/dist/record/rrweb-record-pack.min.js.map +1 -1
  9. package/dist/record/rrweb-record.js +4 -3202
  10. package/dist/record/rrweb-record.min.js +3 -3
  11. package/dist/record/rrweb-record.min.js.map +1 -1
  12. package/dist/replay/rrweb-replay-unpack.css +1 -0
  13. package/dist/replay/rrweb-replay-unpack.js +5 -4914
  14. package/dist/replay/rrweb-replay-unpack.min.css +2 -0
  15. package/dist/replay/rrweb-replay-unpack.min.css.map +1 -0
  16. package/dist/replay/rrweb-replay-unpack.min.js +1 -1
  17. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
  18. package/dist/replay/rrweb-replay.css +1 -0
  19. package/dist/replay/rrweb-replay.js +5 -4506
  20. package/dist/replay/rrweb-replay.min.css +2 -0
  21. package/dist/replay/rrweb-replay.min.css.map +1 -0
  22. package/dist/replay/rrweb-replay.min.js +1 -1
  23. package/dist/replay/rrweb-replay.min.js.map +1 -1
  24. package/dist/rrweb-all.css +1 -0
  25. package/dist/rrweb-all.js +16 -8877
  26. package/dist/rrweb-all.min.css +2 -0
  27. package/dist/rrweb-all.min.css.map +1 -0
  28. package/dist/rrweb-all.min.js +1 -1
  29. package/dist/rrweb-all.min.js.map +1 -1
  30. package/dist/rrweb.css +1 -0
  31. package/dist/rrweb.js +6 -7546
  32. package/dist/rrweb.min.css +2 -0
  33. package/dist/rrweb.min.css.map +1 -0
  34. package/dist/rrweb.min.js +1 -1
  35. package/dist/rrweb.min.js.map +1 -1
  36. package/es/rrweb/all.css +1 -0
  37. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +1 -1
  38. package/lib/replay/rrweb-replay-unpack.css +1 -0
  39. package/lib/replay/rrweb-replay-unpack.js +1 -1
  40. package/lib/replay/rrweb-replay.css +1 -0
  41. package/lib/replay/rrweb-replay.js +1 -1
  42. package/lib/rrweb-all.css +1 -0
  43. package/lib/rrweb-all.js +1 -1
  44. package/lib/rrweb.css +1 -0
  45. package/lib/rrweb.js +1 -1
  46. package/package.json +4 -4
@@ -1,454 +1,12 @@
1
- var rrwebConsoleRecord = (function (exports) {
2
- 'use strict';
3
-
4
- var NodeType;
5
- (function(NodeType2) {
6
- NodeType2[NodeType2["Document"] = 0] = "Document";
7
- NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
8
- NodeType2[NodeType2["Element"] = 2] = "Element";
9
- NodeType2[NodeType2["Text"] = 3] = "Text";
10
- NodeType2[NodeType2["CDATA"] = 4] = "CDATA";
11
- NodeType2[NodeType2["Comment"] = 5] = "Comment";
12
- })(NodeType || (NodeType = {}));
13
-
14
- const DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";
15
- let _mirror = {
16
- map: {},
17
- getId() {
18
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
19
- return -1;
20
- },
21
- getNode() {
22
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
23
- return null;
24
- },
25
- removeNodeFromMap() {
26
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
27
- },
28
- has() {
29
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
30
- return false;
31
- },
32
- reset() {
33
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
34
- }
35
- };
36
- if (typeof window !== "undefined" && window.Proxy && window.Reflect) {
37
- _mirror = new Proxy(_mirror, {
38
- get(target, prop, receiver) {
39
- if (prop === "map") {
40
- console.error(DEPARTED_MIRROR_ACCESS_WARNING);
41
- }
42
- return Reflect.get(target, prop, receiver);
43
- }
44
- });
45
- }
46
- function patch(source, name, replacement) {
47
- try {
48
- if (!(name in source)) {
49
- return () => {
50
- };
51
- }
52
- const original = source[name];
53
- const wrapped = replacement(original);
54
- if (typeof wrapped === "function") {
55
- wrapped.prototype = wrapped.prototype || {};
56
- Object.defineProperties(wrapped, {
57
- __rrweb_original__: {
58
- enumerable: false,
59
- value: original
60
- }
61
- });
62
- }
63
- source[name] = wrapped;
64
- return () => {
65
- source[name] = original;
66
- };
67
- } catch (e) {
68
- return () => {
69
- };
70
- }
71
- }
72
-
73
- class StackFrame {
74
- constructor(obj) {
75
- this.fileName = obj.fileName || "";
76
- this.functionName = obj.functionName || "";
77
- this.lineNumber = obj.lineNumber;
78
- this.columnNumber = obj.columnNumber;
79
- }
80
- toString() {
81
- const lineNumber = this.lineNumber || "";
82
- const columnNumber = this.columnNumber || "";
83
- if (this.functionName) {
84
- return this.functionName + " (" + this.fileName + ":" + lineNumber + ":" + columnNumber + ")";
85
- }
86
- return this.fileName + ":" + lineNumber + ":" + columnNumber;
87
- }
88
- }
89
- const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
90
- const CHROME_IE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
91
- const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
92
- const ErrorStackParser = {
93
- parse: function(error) {
94
- if (!error) {
95
- return [];
96
- }
97
- if (typeof error.stacktrace !== "undefined" || typeof error["opera#sourceloc"] !== "undefined") {
98
- return this.parseOpera(error);
99
- } else if (error.stack && error.stack.match(CHROME_IE_STACK_REGEXP)) {
100
- return this.parseV8OrIE(error);
101
- } else if (error.stack) {
102
- return this.parseFFOrSafari(error);
103
- } else {
104
- throw new Error("Cannot parse given Error object");
105
- }
106
- },
107
- extractLocation: function(urlLike) {
108
- if (urlLike.indexOf(":") === -1) {
109
- return [urlLike];
110
- }
111
- const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/;
112
- const parts = regExp.exec(urlLike.replace(/[()]/g, ""));
113
- if (!parts)
114
- throw new Error(`Cannot parse given url: ${urlLike}`);
115
- return [parts[1], parts[2] || void 0, parts[3] || void 0];
116
- },
117
- parseV8OrIE: function(error) {
118
- const filtered = error.stack.split("\n").filter(function(line) {
119
- return !!line.match(CHROME_IE_STACK_REGEXP);
120
- }, this);
121
- return filtered.map(function(line) {
122
- if (line.indexOf("(eval ") > -1) {
123
- line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(\),.*$)/g, "");
124
- }
125
- let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(");
126
- const location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
127
- sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine;
128
- const tokens = sanitizedLine.split(/\s+/).slice(1);
129
- const locationParts = this.extractLocation(location ? location[1] : tokens.pop());
130
- const functionName = tokens.join(" ") || void 0;
131
- const fileName = ["eval", "<anonymous>"].indexOf(locationParts[0]) > -1 ? void 0 : locationParts[0];
132
- return new StackFrame({
133
- functionName,
134
- fileName,
135
- lineNumber: locationParts[1],
136
- columnNumber: locationParts[2]
137
- });
138
- }, this);
139
- },
140
- parseFFOrSafari: function(error) {
141
- const filtered = error.stack.split("\n").filter(function(line) {
142
- return !line.match(SAFARI_NATIVE_CODE_REGEXP);
143
- }, this);
144
- return filtered.map(function(line) {
145
- if (line.indexOf(" > eval") > -1) {
146
- line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1");
147
- }
148
- if (line.indexOf("@") === -1 && line.indexOf(":") === -1) {
149
- return new StackFrame({
150
- functionName: line
151
- });
152
- } else {
153
- const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
154
- const matches = line.match(functionNameRegex);
155
- const functionName = matches && matches[1] ? matches[1] : void 0;
156
- const locationParts = this.extractLocation(line.replace(functionNameRegex, ""));
157
- return new StackFrame({
158
- functionName,
159
- fileName: locationParts[0],
160
- lineNumber: locationParts[1],
161
- columnNumber: locationParts[2]
162
- });
163
- }
164
- }, this);
165
- },
166
- parseOpera: function(e) {
167
- if (!e.stacktrace || e.message.indexOf("\n") > -1 && e.message.split("\n").length > e.stacktrace.split("\n").length) {
168
- return this.parseOpera9(e);
169
- } else if (!e.stack) {
170
- return this.parseOpera10(e);
171
- } else {
172
- return this.parseOpera11(e);
173
- }
174
- },
175
- parseOpera9: function(e) {
176
- const lineRE = /Line (\d+).*script (?:in )?(\S+)/i;
177
- const lines = e.message.split("\n");
178
- const result = [];
179
- for (let i = 2, len = lines.length; i < len; i += 2) {
180
- const match = lineRE.exec(lines[i]);
181
- if (match) {
182
- result.push(new StackFrame({
183
- fileName: match[2],
184
- lineNumber: parseFloat(match[1])
185
- }));
186
- }
187
- }
188
- return result;
189
- },
190
- parseOpera10: function(e) {
191
- const lineRE = /Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i;
192
- const lines = e.stacktrace.split("\n");
193
- const result = [];
194
- for (let i = 0, len = lines.length; i < len; i += 2) {
195
- const match = lineRE.exec(lines[i]);
196
- if (match) {
197
- result.push(new StackFrame({
198
- functionName: match[3] || void 0,
199
- fileName: match[2],
200
- lineNumber: parseFloat(match[1])
201
- }));
202
- }
203
- }
204
- return result;
205
- },
206
- parseOpera11: function(error) {
207
- const filtered = error.stack.split("\n").filter(function(line) {
208
- return !!line.match(FIREFOX_SAFARI_STACK_REGEXP) && !line.match(/^Error created at/);
209
- }, this);
210
- return filtered.map(function(line) {
211
- const tokens = line.split("@");
212
- const locationParts = this.extractLocation(tokens.pop());
213
- const functionCall = tokens.shift() || "";
214
- const functionName = functionCall.replace(/<anonymous function(: (\w+))?>/, "$2").replace(/\([^)]*\)/g, "") || void 0;
215
- return new StackFrame({
216
- functionName,
217
- fileName: locationParts[0],
218
- lineNumber: locationParts[1],
219
- columnNumber: locationParts[2]
220
- });
221
- }, this);
222
- }
223
- };
224
-
225
- function pathToSelector(node) {
226
- if (!node || !node.outerHTML) {
227
- return "";
228
- }
229
- let path = "";
230
- while (node.parentElement) {
231
- let name = node.localName;
232
- if (!name) {
233
- break;
234
- }
235
- name = name.toLowerCase();
236
- const parent = node.parentElement;
237
- const domSiblings = [];
238
- if (parent.children && parent.children.length > 0) {
239
- for (let i = 0; i < parent.children.length; i++) {
240
- const sibling = parent.children[i];
241
- if (sibling.localName && sibling.localName.toLowerCase) {
242
- if (sibling.localName.toLowerCase() === name) {
243
- domSiblings.push(sibling);
244
- }
245
- }
246
- }
247
- }
248
- if (domSiblings.length > 1) {
249
- name += ":eq(" + domSiblings.indexOf(node) + ")";
250
- }
251
- path = name + (path ? ">" + path : "");
252
- node = parent;
253
- }
254
- return path;
255
- }
256
- function isObject(obj) {
257
- return Object.prototype.toString.call(obj) === "[object Object]";
258
- }
259
- function isObjTooDeep(obj, limit) {
260
- if (limit === 0) {
261
- return true;
262
- }
263
- const keys = Object.keys(obj);
264
- for (const key of keys) {
265
- if (isObject(obj[key]) && isObjTooDeep(obj[key], limit - 1)) {
266
- return true;
267
- }
268
- }
269
- return false;
270
- }
271
- function stringify(obj, stringifyOptions) {
272
- const options = {
273
- numOfKeysLimit: 50,
274
- depthOfLimit: 4
275
- };
276
- Object.assign(options, stringifyOptions);
277
- const stack = [];
278
- const keys = [];
279
- return JSON.stringify(obj, function(key, value) {
280
- if (stack.length > 0) {
281
- const thisPos = stack.indexOf(this);
282
- ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
283
- ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
284
- if (~stack.indexOf(value)) {
285
- if (stack[0] === value) {
286
- value = "[Circular ~]";
287
- } else {
288
- value = "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
289
- }
290
- }
291
- } else {
292
- stack.push(value);
293
- }
294
- if (value === null || value === void 0) {
295
- return value;
296
- }
297
- if (shouldIgnore(value)) {
298
- return toString(value);
299
- }
300
- if (value instanceof Event) {
301
- const eventResult = {};
302
- for (const eventKey in value) {
303
- const eventValue = value[eventKey];
304
- if (Array.isArray(eventValue)) {
305
- eventResult[eventKey] = pathToSelector(eventValue.length ? eventValue[0] : null);
306
- } else {
307
- eventResult[eventKey] = eventValue;
308
- }
309
- }
310
- return eventResult;
311
- } else if (value instanceof Node) {
312
- if (value instanceof HTMLElement) {
313
- return value ? value.outerHTML : "";
314
- }
315
- return value.nodeName;
316
- } else if (value instanceof Error) {
317
- return value.stack ? value.stack + "\nEnd of stack for Error object" : value.name + ": " + value.message;
318
- }
319
- return value;
320
- });
321
- function shouldIgnore(_obj) {
322
- if (isObject(_obj) && Object.keys(_obj).length > options.numOfKeysLimit) {
323
- return true;
324
- }
325
- if (typeof _obj === "function") {
326
- return true;
327
- }
328
- if (isObject(_obj) && isObjTooDeep(_obj, options.depthOfLimit)) {
329
- return true;
330
- }
331
- return false;
332
- }
333
- function toString(_obj) {
334
- let str = _obj.toString();
335
- if (options.stringLengthLimit && str.length > options.stringLengthLimit) {
336
- str = `${str.slice(0, options.stringLengthLimit)}...`;
337
- }
338
- return str;
339
- }
340
- }
341
-
342
- const defaultLogOptions = {
343
- level: [
344
- "assert",
345
- "clear",
346
- "count",
347
- "countReset",
348
- "debug",
349
- "dir",
350
- "dirxml",
351
- "error",
352
- "group",
353
- "groupCollapsed",
354
- "groupEnd",
355
- "info",
356
- "log",
357
- "table",
358
- "time",
359
- "timeEnd",
360
- "timeLog",
361
- "trace",
362
- "warn"
363
- ],
364
- lengthThreshold: 1e3,
365
- logger: "console"
366
- };
367
- function initLogObserver(cb, win, logOptions) {
368
- const loggerType = logOptions.logger;
369
- if (!loggerType) {
370
- return () => {
371
- };
372
- }
373
- let logger;
374
- if (typeof loggerType === "string") {
375
- logger = win[loggerType];
376
- } else {
377
- logger = loggerType;
378
- }
379
- let logCount = 0;
380
- const cancelHandlers = [];
381
- if (logOptions.level.includes("error")) {
382
- if (window) {
383
- const errorHandler = (event) => {
384
- const { message, error } = event;
385
- const trace = ErrorStackParser.parse(error).map((stackFrame) => stackFrame.toString());
386
- const payload = [stringify(message, logOptions.stringifyOptions)];
387
- cb({
388
- level: "error",
389
- trace,
390
- payload
391
- });
392
- };
393
- window.addEventListener("error", errorHandler);
394
- cancelHandlers.push(() => {
395
- if (window)
396
- window.removeEventListener("error", errorHandler);
397
- });
398
- }
399
- }
400
- for (const levelType of logOptions.level) {
401
- cancelHandlers.push(replace(logger, levelType));
402
- }
403
- return () => {
404
- cancelHandlers.forEach((h) => h());
405
- };
406
- function replace(_logger, level) {
407
- if (!_logger[level]) {
408
- return () => {
409
- };
410
- }
411
- return patch(_logger, level, (original) => {
412
- return (...args) => {
413
- original.apply(this, args);
414
- try {
415
- const trace = ErrorStackParser.parse(new Error()).map((stackFrame) => stackFrame.toString()).splice(1);
416
- const payload = args.map((s) => stringify(s, logOptions.stringifyOptions));
417
- logCount++;
418
- if (logCount < logOptions.lengthThreshold) {
419
- cb({
420
- level,
421
- trace,
422
- payload
423
- });
424
- } else if (logCount === logOptions.lengthThreshold) {
425
- cb({
426
- level: "warn",
427
- trace: [],
428
- payload: [
429
- stringify("The number of log records reached the threshold.")
430
- ]
431
- });
432
- }
433
- } catch (error) {
434
- original("rrweb logger error:", error, ...args);
435
- }
436
- };
437
- });
438
- }
439
- }
440
- const PLUGIN_NAME = "rrweb/console@1";
441
- const getRecordConsolePlugin = (options) => ({
442
- name: PLUGIN_NAME,
443
- observer: initLogObserver,
444
- options: options ? Object.assign({}, defaultLogOptions, options) : defaultLogOptions
445
- });
446
-
447
- exports.PLUGIN_NAME = PLUGIN_NAME;
448
- exports.getRecordConsolePlugin = getRecordConsolePlugin;
449
-
450
- Object.defineProperty(exports, '__esModule', { value: true });
451
-
452
- return exports;
453
-
454
- })({});
1
+ var rrwebConsoleRecord=function(g){"use strict";var O;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(O||(O={}));const p=`Please stop import mirror directly. Instead of that,\r
2
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
3
+ or you can use record.mirror to access the mirror instance during recording.`;let v={map:{},getId(){return console.error(p),-1},getNode(){return console.error(p),null},removeNodeFromMap(){console.error(p)},has(){return console.error(p),!1},reset(){console.error(p)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(v=new Proxy(v,{get(e,r,n){return r==="map"&&console.error(p),Reflect.get(e,r,n)}}));function C(e,r,n){try{if(!(r in e))return()=>{};const t=e[r],i=n(t);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:t}})),e[r]=i,()=>{e[r]=t}}catch{return()=>{}}}class m{constructor(r){this.fileName=r.fileName||"",this.functionName=r.functionName||"",this.lineNumber=r.lineNumber,this.columnNumber=r.columnNumber}toString(){const r=this.lineNumber||"",n=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+r+":"+n+")":this.fileName+":"+r+":"+n}}const S=/(^|@)\S+:\d+/,b=/^\s*at .*(\S+:\d+|\(native\))/m,j=/^(eval@)?(\[native code])?$/,L={parse:function(e){if(!e)return[];if(typeof e.stacktrace<"u"||typeof e["opera#sourceloc"]<"u")return this.parseOpera(e);if(e.stack&&e.stack.match(b))return this.parseV8OrIE(e);if(e.stack)return this.parseFFOrSafari(e);throw new Error("Cannot parse given Error object")},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];const r=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(e.replace(/[()]/g,""));if(!r)throw new Error(`Cannot parse given url: ${e}`);return[r[1],r[2]||void 0,r[3]||void 0]},parseV8OrIE:function(e){return e.stack.split(`
4
+ `).filter(function(r){return!!r.match(b)},this).map(function(r){r.indexOf("(eval ")>-1&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));let n=r.replace(/^\s+/,"").replace(/\(eval code/g,"(");const t=n.match(/ (\((.+):(\d+):(\d+)\)$)/);n=t?n.replace(t[0],""):n;const i=n.split(/\s+/).slice(1),c=this.extractLocation(t?t[1]:i.pop()),s=i.join(" ")||void 0,a=["eval","<anonymous>"].indexOf(c[0])>-1?void 0:c[0];return new m({functionName:s,fileName:a,lineNumber:c[1],columnNumber:c[2]})},this)},parseFFOrSafari:function(e){return e.stack.split(`
5
+ `).filter(function(r){return!r.match(j)},this).map(function(r){if(r.indexOf(" > eval")>-1&&(r=r.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),r.indexOf("@")===-1&&r.indexOf(":")===-1)return new m({functionName:r});{const n=/((.*".+"[^@]*)?[^@]*)(?:@)/,t=r.match(n),i=t&&t[1]?t[1]:void 0,c=this.extractLocation(r.replace(n,""));return new m({functionName:i,fileName:c[0],lineNumber:c[1],columnNumber:c[2]})}},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf(`
6
+ `)>-1&&e.message.split(`
7
+ `).length>e.stacktrace.split(`
8
+ `).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){const r=/Line (\d+).*script (?:in )?(\S+)/i,n=e.message.split(`
9
+ `),t=[];for(let i=2,c=n.length;i<c;i+=2){const s=r.exec(n[i]);s&&t.push(new m({fileName:s[2],lineNumber:parseFloat(s[1])}))}return t},parseOpera10:function(e){const r=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=e.stacktrace.split(`
10
+ `),t=[];for(let i=0,c=n.length;i<c;i+=2){const s=r.exec(n[i]);s&&t.push(new m({functionName:s[3]||void 0,fileName:s[2],lineNumber:parseFloat(s[1])}))}return t},parseOpera11:function(e){return e.stack.split(`
11
+ `).filter(function(r){return!!r.match(S)&&!r.match(/^Error created at/)},this).map(function(r){const n=r.split("@"),t=this.extractLocation(n.pop()),i=(n.shift()||"").replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new m({functionName:i,fileName:t[0],lineNumber:t[1],columnNumber:t[2]})},this)}};function T(e){if(!e||!e.outerHTML)return"";let r="";for(;e.parentElement;){let n=e.localName;if(!n)break;n=n.toLowerCase();const t=e.parentElement,i=[];if(t.children&&t.children.length>0)for(let c=0;c<t.children.length;c++){const s=t.children[c];s.localName&&s.localName.toLowerCase&&s.localName.toLowerCase()===n&&i.push(s)}i.length>1&&(n+=":eq("+i.indexOf(e)+")"),r=n+(r?">"+r:""),e=t}return r}function N(e){return Object.prototype.toString.call(e)==="[object Object]"}function E(e,r){if(r===0)return!0;const n=Object.keys(e);for(const t of n)if(N(e[t])&&E(e[t],r-1))return!0;return!1}function y(e,r){const n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,r);const t=[],i=[];return JSON.stringify(e,function(a,o){if(t.length>0){const l=t.indexOf(this);~l?t.splice(l+1):t.push(this),~l?i.splice(l,1/0,a):i.push(a),~t.indexOf(o)&&(t[0]===o?o="[Circular ~]":o="[Circular ~."+i.slice(0,t.indexOf(o)).join(".")+"]")}else t.push(o);if(o==null)return o;if(c(o))return s(o);if(o instanceof Event){const l={};for(const f in o){const u=o[f];Array.isArray(u)?l[f]=T(u.length?u[0]:null):l[f]=u}return l}else{if(o instanceof Node)return o instanceof HTMLElement?o?o.outerHTML:"":o.nodeName;if(o instanceof Error)return o.stack?o.stack+`
12
+ End of stack for Error object`:o.name+": "+o.message}return o});function c(a){return!!(N(a)&&Object.keys(a).length>n.numOfKeysLimit||typeof a=="function"||N(a)&&E(a,n.depthOfLimit))}function s(a){let o=a.toString();return n.stringLengthLimit&&o.length>n.stringLengthLimit&&(o=`${o.slice(0,n.stringLengthLimit)}...`),o}}const k={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function $(e,r,n){const t=n.logger;if(!t)return()=>{};let i;typeof t=="string"?i=r[t]:i=t;let c=0;const s=[];if(n.level.includes("error")&&window){const o=l=>{const{message:f,error:u}=l,d=L.parse(u).map(h=>h.toString()),w=[y(f,n.stringifyOptions)];e({level:"error",trace:d,payload:w})};window.addEventListener("error",o),s.push(()=>{window&&window.removeEventListener("error",o)})}for(const o of n.level)s.push(a(i,o));return()=>{s.forEach(o=>o())};function a(o,l){return o[l]?C(o,l,f=>(...u)=>{f.apply(this,u);try{const d=L.parse(new Error).map(h=>h.toString()).splice(1),w=u.map(h=>y(h,n.stringifyOptions));c++,c<n.lengthThreshold?e({level:l,trace:d,payload:w}):c===n.lengthThreshold&&e({level:"warn",trace:[],payload:[y("The number of log records reached the threshold.")]})}catch(d){f("rrweb logger error:",d,...u)}}):()=>{}}}const x="rrweb/console@1",P=e=>({name:x,observer:$,options:e?Object.assign({},k,e):k});return g.PLUGIN_NAME=x,g.getRecordConsolePlugin=P,Object.defineProperty(g,"__esModule",{value:!0}),g}({});