@highlight-run/rrweb 2.0.11 → 2.0.12

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 (41) hide show
  1. package/dist/plugins/console-record.js +5 -5
  2. package/dist/plugins/console-record.min.js +5 -5
  3. package/dist/plugins/console-record.min.js.map +1 -1
  4. package/dist/plugins/console-replay.js +3 -3
  5. package/dist/plugins/console-replay.min.js +3 -3
  6. package/dist/plugins/console-replay.min.js.map +1 -1
  7. package/dist/record/rrweb-record-pack.js +2 -2
  8. package/dist/record/rrweb-record-pack.min.js +2 -2
  9. package/dist/record/rrweb-record-pack.min.js.map +1 -1
  10. package/dist/record/rrweb-record.js +3 -3
  11. package/dist/record/rrweb-record.min.js +3 -3
  12. package/dist/record/rrweb-record.min.js.map +1 -1
  13. package/dist/replay/rrweb-replay-unpack.js +4 -3
  14. package/dist/replay/rrweb-replay-unpack.min.js +4 -3
  15. package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
  16. package/dist/replay/rrweb-replay.js +4 -3
  17. package/dist/replay/rrweb-replay.min.js +4 -3
  18. package/dist/replay/rrweb-replay.min.js.map +1 -1
  19. package/dist/rrweb-all.js +25 -24
  20. package/dist/rrweb-all.min.js +25 -24
  21. package/dist/rrweb-all.min.js.map +1 -1
  22. package/dist/rrweb.js +15 -14
  23. package/dist/rrweb.min.js +15 -14
  24. package/dist/rrweb.min.js.map +1 -1
  25. package/es/rrweb/packages/rrdom/es/virtual-dom.js +63 -1
  26. package/es/rrweb/packages/rrweb/src/index.js +1 -1
  27. package/es/rrweb/packages/rrweb/src/record/index.js +1 -1
  28. package/es/rrweb/packages/rrweb/src/record/mutation.js +1 -1
  29. package/es/rrweb/packages/rrweb/src/record/observer.js +1 -1
  30. package/es/rrweb/packages/rrweb/src/replay/index.js +1 -1
  31. package/es/rrweb/packages/rrweb/src/utils.js +1 -1
  32. package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +1871 -0
  33. package/lib/plugins/console-record.js +9 -1
  34. package/lib/plugins/console-replay.js +9 -1
  35. package/lib/record/rrweb-record-pack.js +9 -3
  36. package/lib/record/rrweb-record.js +1063 -17
  37. package/lib/replay/rrweb-replay-unpack.js +999 -47
  38. package/lib/replay/rrweb-replay.js +999 -47
  39. package/lib/rrweb-all.js +2020 -88
  40. package/lib/rrweb.js +2020 -88
  41. package/package.json +3 -3
@@ -2,8 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var rrwebSnapshot = require('@highlight-run/rrweb-snapshot');
6
-
7
5
  /*! *****************************************************************************
8
6
  Copyright (c) Microsoft Corporation.
9
7
 
@@ -29,6 +27,960 @@ function __awaiter(thisArg, _arguments, P, generator) {
29
27
  });
30
28
  }
31
29
 
30
+ var NodeType$2;
31
+ (function (NodeType) {
32
+ NodeType[NodeType["Document"] = 0] = "Document";
33
+ NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
34
+ NodeType[NodeType["Element"] = 2] = "Element";
35
+ NodeType[NodeType["Text"] = 3] = "Text";
36
+ NodeType[NodeType["CDATA"] = 4] = "CDATA";
37
+ NodeType[NodeType["Comment"] = 5] = "Comment";
38
+ })(NodeType$2 || (NodeType$2 = {}));
39
+
40
+ function isElement(n) {
41
+ return n.nodeType === n.ELEMENT_NODE;
42
+ }
43
+ var Mirror$2 = (function () {
44
+ function Mirror() {
45
+ this.idNodeMap = new Map();
46
+ this.nodeMetaMap = new WeakMap();
47
+ }
48
+ Mirror.prototype.getId = function (n) {
49
+ var _a;
50
+ if (!n)
51
+ return -1;
52
+ var id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
53
+ return id !== null && id !== void 0 ? id : -1;
54
+ };
55
+ Mirror.prototype.getNode = function (id) {
56
+ return this.idNodeMap.get(id) || null;
57
+ };
58
+ Mirror.prototype.getIds = function () {
59
+ return Array.from(this.idNodeMap.keys());
60
+ };
61
+ Mirror.prototype.getMeta = function (n) {
62
+ return this.nodeMetaMap.get(n) || null;
63
+ };
64
+ Mirror.prototype.removeNodeFromMap = function (n) {
65
+ var _this = this;
66
+ var id = this.getId(n);
67
+ this.idNodeMap["delete"](id);
68
+ if (n.childNodes) {
69
+ n.childNodes.forEach(function (childNode) {
70
+ return _this.removeNodeFromMap(childNode);
71
+ });
72
+ }
73
+ };
74
+ Mirror.prototype.has = function (id) {
75
+ return this.idNodeMap.has(id);
76
+ };
77
+ Mirror.prototype.hasNode = function (node) {
78
+ return this.nodeMetaMap.has(node);
79
+ };
80
+ Mirror.prototype.add = function (n, meta) {
81
+ var id = meta.id;
82
+ this.idNodeMap.set(id, n);
83
+ this.nodeMetaMap.set(n, meta);
84
+ };
85
+ Mirror.prototype.replace = function (id, n) {
86
+ this.idNodeMap.set(id, n);
87
+ };
88
+ Mirror.prototype.reset = function () {
89
+ this.idNodeMap = new Map();
90
+ this.nodeMetaMap = new WeakMap();
91
+ };
92
+ return Mirror;
93
+ }());
94
+ function createMirror$2() {
95
+ return new Mirror$2();
96
+ }
97
+
98
+ var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
99
+ function parse(css, options) {
100
+ if (options === void 0) { options = {}; }
101
+ var lineno = 1;
102
+ var column = 1;
103
+ function updatePosition(str) {
104
+ var lines = str.match(/\n/g);
105
+ if (lines) {
106
+ lineno += lines.length;
107
+ }
108
+ var i = str.lastIndexOf('\n');
109
+ column = i === -1 ? column + str.length : str.length - i;
110
+ }
111
+ function position() {
112
+ var start = { line: lineno, column: column };
113
+ return function (node) {
114
+ node.position = new Position(start);
115
+ whitespace();
116
+ return node;
117
+ };
118
+ }
119
+ var Position = (function () {
120
+ function Position(start) {
121
+ this.start = start;
122
+ this.end = { line: lineno, column: column };
123
+ this.source = options.source;
124
+ }
125
+ return Position;
126
+ }());
127
+ Position.prototype.content = css;
128
+ var errorsList = [];
129
+ function error(msg) {
130
+ var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);
131
+ err.reason = msg;
132
+ err.filename = options.source;
133
+ err.line = lineno;
134
+ err.column = column;
135
+ err.source = css;
136
+ if (options.silent) {
137
+ errorsList.push(err);
138
+ }
139
+ else {
140
+ throw err;
141
+ }
142
+ }
143
+ function stylesheet() {
144
+ var rulesList = rules();
145
+ return {
146
+ type: 'stylesheet',
147
+ stylesheet: {
148
+ source: options.source,
149
+ rules: rulesList,
150
+ parsingErrors: errorsList
151
+ }
152
+ };
153
+ }
154
+ function open() {
155
+ return match(/^{\s*/);
156
+ }
157
+ function close() {
158
+ return match(/^}/);
159
+ }
160
+ function rules() {
161
+ var node;
162
+ var rules = [];
163
+ whitespace();
164
+ comments(rules);
165
+ while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {
166
+ if (node !== false) {
167
+ rules.push(node);
168
+ comments(rules);
169
+ }
170
+ }
171
+ return rules;
172
+ }
173
+ function match(re) {
174
+ var m = re.exec(css);
175
+ if (!m) {
176
+ return;
177
+ }
178
+ var str = m[0];
179
+ updatePosition(str);
180
+ css = css.slice(str.length);
181
+ return m;
182
+ }
183
+ function whitespace() {
184
+ match(/^\s*/);
185
+ }
186
+ function comments(rules) {
187
+ if (rules === void 0) { rules = []; }
188
+ var c;
189
+ while ((c = comment())) {
190
+ if (c !== false) {
191
+ rules.push(c);
192
+ }
193
+ c = comment();
194
+ }
195
+ return rules;
196
+ }
197
+ function comment() {
198
+ var pos = position();
199
+ if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) {
200
+ return;
201
+ }
202
+ var i = 2;
203
+ while ('' !== css.charAt(i) &&
204
+ ('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) {
205
+ ++i;
206
+ }
207
+ i += 2;
208
+ if ('' === css.charAt(i - 1)) {
209
+ return error('End of comment missing');
210
+ }
211
+ var str = css.slice(2, i - 2);
212
+ column += 2;
213
+ updatePosition(str);
214
+ css = css.slice(i);
215
+ column += 2;
216
+ return pos({
217
+ type: 'comment',
218
+ comment: str
219
+ });
220
+ }
221
+ function selector() {
222
+ var m = match(/^([^{]+)/);
223
+ if (!m) {
224
+ return;
225
+ }
226
+ return trim(m[0])
227
+ .replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '')
228
+ .replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) {
229
+ return m.replace(/,/g, '\u200C');
230
+ })
231
+ .split(/\s*(?![^(]*\)),\s*/)
232
+ .map(function (s) {
233
+ return s.replace(/\u200C/g, ',');
234
+ });
235
+ }
236
+ function declaration() {
237
+ var pos = position();
238
+ var propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
239
+ if (!propMatch) {
240
+ return;
241
+ }
242
+ var prop = trim(propMatch[0]);
243
+ if (!match(/^:\s*/)) {
244
+ return error("property missing ':'");
245
+ }
246
+ var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
247
+ var ret = pos({
248
+ type: 'declaration',
249
+ property: prop.replace(commentre, ''),
250
+ value: val ? trim(val[0]).replace(commentre, '') : ''
251
+ });
252
+ match(/^[;\s]*/);
253
+ return ret;
254
+ }
255
+ function declarations() {
256
+ var decls = [];
257
+ if (!open()) {
258
+ return error("missing '{'");
259
+ }
260
+ comments(decls);
261
+ var decl;
262
+ while ((decl = declaration())) {
263
+ if (decl !== false) {
264
+ decls.push(decl);
265
+ comments(decls);
266
+ }
267
+ decl = declaration();
268
+ }
269
+ if (!close()) {
270
+ return error("missing '}'");
271
+ }
272
+ return decls;
273
+ }
274
+ function keyframe() {
275
+ var m;
276
+ var vals = [];
277
+ var pos = position();
278
+ while ((m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/))) {
279
+ vals.push(m[1]);
280
+ match(/^,\s*/);
281
+ }
282
+ if (!vals.length) {
283
+ return;
284
+ }
285
+ return pos({
286
+ type: 'keyframe',
287
+ values: vals,
288
+ declarations: declarations()
289
+ });
290
+ }
291
+ function atkeyframes() {
292
+ var pos = position();
293
+ var m = match(/^@([-\w]+)?keyframes\s*/);
294
+ if (!m) {
295
+ return;
296
+ }
297
+ var vendor = m[1];
298
+ m = match(/^([-\w]+)\s*/);
299
+ if (!m) {
300
+ return error('@keyframes missing name');
301
+ }
302
+ var name = m[1];
303
+ if (!open()) {
304
+ return error("@keyframes missing '{'");
305
+ }
306
+ var frame;
307
+ var frames = comments();
308
+ while ((frame = keyframe())) {
309
+ frames.push(frame);
310
+ frames = frames.concat(comments());
311
+ }
312
+ if (!close()) {
313
+ return error("@keyframes missing '}'");
314
+ }
315
+ return pos({
316
+ type: 'keyframes',
317
+ name: name,
318
+ vendor: vendor,
319
+ keyframes: frames
320
+ });
321
+ }
322
+ function atsupports() {
323
+ var pos = position();
324
+ var m = match(/^@supports *([^{]+)/);
325
+ if (!m) {
326
+ return;
327
+ }
328
+ var supports = trim(m[1]);
329
+ if (!open()) {
330
+ return error("@supports missing '{'");
331
+ }
332
+ var style = comments().concat(rules());
333
+ if (!close()) {
334
+ return error("@supports missing '}'");
335
+ }
336
+ return pos({
337
+ type: 'supports',
338
+ supports: supports,
339
+ rules: style
340
+ });
341
+ }
342
+ function athost() {
343
+ var pos = position();
344
+ var m = match(/^@host\s*/);
345
+ if (!m) {
346
+ return;
347
+ }
348
+ if (!open()) {
349
+ return error("@host missing '{'");
350
+ }
351
+ var style = comments().concat(rules());
352
+ if (!close()) {
353
+ return error("@host missing '}'");
354
+ }
355
+ return pos({
356
+ type: 'host',
357
+ rules: style
358
+ });
359
+ }
360
+ function atmedia() {
361
+ var pos = position();
362
+ var m = match(/^@media *([^{]+)/);
363
+ if (!m) {
364
+ return;
365
+ }
366
+ var media = trim(m[1]);
367
+ if (!open()) {
368
+ return error("@media missing '{'");
369
+ }
370
+ var style = comments().concat(rules());
371
+ if (!close()) {
372
+ return error("@media missing '}'");
373
+ }
374
+ return pos({
375
+ type: 'media',
376
+ media: media,
377
+ rules: style
378
+ });
379
+ }
380
+ function atcustommedia() {
381
+ var pos = position();
382
+ var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
383
+ if (!m) {
384
+ return;
385
+ }
386
+ return pos({
387
+ type: 'custom-media',
388
+ name: trim(m[1]),
389
+ media: trim(m[2])
390
+ });
391
+ }
392
+ function atpage() {
393
+ var pos = position();
394
+ var m = match(/^@page */);
395
+ if (!m) {
396
+ return;
397
+ }
398
+ var sel = selector() || [];
399
+ if (!open()) {
400
+ return error("@page missing '{'");
401
+ }
402
+ var decls = comments();
403
+ var decl;
404
+ while ((decl = declaration())) {
405
+ decls.push(decl);
406
+ decls = decls.concat(comments());
407
+ }
408
+ if (!close()) {
409
+ return error("@page missing '}'");
410
+ }
411
+ return pos({
412
+ type: 'page',
413
+ selectors: sel,
414
+ declarations: decls
415
+ });
416
+ }
417
+ function atdocument() {
418
+ var pos = position();
419
+ var m = match(/^@([-\w]+)?document *([^{]+)/);
420
+ if (!m) {
421
+ return;
422
+ }
423
+ var vendor = trim(m[1]);
424
+ var doc = trim(m[2]);
425
+ if (!open()) {
426
+ return error("@document missing '{'");
427
+ }
428
+ var style = comments().concat(rules());
429
+ if (!close()) {
430
+ return error("@document missing '}'");
431
+ }
432
+ return pos({
433
+ type: 'document',
434
+ document: doc,
435
+ vendor: vendor,
436
+ rules: style
437
+ });
438
+ }
439
+ function atfontface() {
440
+ var pos = position();
441
+ var m = match(/^@font-face\s*/);
442
+ if (!m) {
443
+ return;
444
+ }
445
+ if (!open()) {
446
+ return error("@font-face missing '{'");
447
+ }
448
+ var decls = comments();
449
+ var decl;
450
+ while ((decl = declaration())) {
451
+ decls.push(decl);
452
+ decls = decls.concat(comments());
453
+ }
454
+ if (!close()) {
455
+ return error("@font-face missing '}'");
456
+ }
457
+ return pos({
458
+ type: 'font-face',
459
+ declarations: decls
460
+ });
461
+ }
462
+ var atimport = _compileAtrule('import');
463
+ var atcharset = _compileAtrule('charset');
464
+ var atnamespace = _compileAtrule('namespace');
465
+ function _compileAtrule(name) {
466
+ var re = new RegExp('^@' + name + '\\s*([^;]+);');
467
+ return function () {
468
+ var pos = position();
469
+ var m = match(re);
470
+ if (!m) {
471
+ return;
472
+ }
473
+ var ret = { type: name };
474
+ ret[name] = m[1].trim();
475
+ return pos(ret);
476
+ };
477
+ }
478
+ function atrule() {
479
+ if (css[0] !== '@') {
480
+ return;
481
+ }
482
+ return (atkeyframes() ||
483
+ atmedia() ||
484
+ atcustommedia() ||
485
+ atsupports() ||
486
+ atimport() ||
487
+ atcharset() ||
488
+ atnamespace() ||
489
+ atdocument() ||
490
+ atpage() ||
491
+ athost() ||
492
+ atfontface());
493
+ }
494
+ function rule() {
495
+ var pos = position();
496
+ var sel = selector();
497
+ if (!sel) {
498
+ return error('selector missing');
499
+ }
500
+ comments();
501
+ return pos({
502
+ type: 'rule',
503
+ selectors: sel,
504
+ declarations: declarations()
505
+ });
506
+ }
507
+ return addParent(stylesheet());
508
+ }
509
+ function trim(str) {
510
+ return str ? str.replace(/^\s+|\s+$/g, '') : '';
511
+ }
512
+ function addParent(obj, parent) {
513
+ var isNode = obj && typeof obj.type === 'string';
514
+ var childParent = isNode ? obj : parent;
515
+ for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {
516
+ var k = _a[_i];
517
+ var value = obj[k];
518
+ if (Array.isArray(value)) {
519
+ value.forEach(function (v) {
520
+ addParent(v, childParent);
521
+ });
522
+ }
523
+ else if (value && typeof value === 'object') {
524
+ addParent(value, childParent);
525
+ }
526
+ }
527
+ if (isNode) {
528
+ Object.defineProperty(obj, 'parent', {
529
+ configurable: true,
530
+ writable: true,
531
+ enumerable: false,
532
+ value: parent || null
533
+ });
534
+ }
535
+ return obj;
536
+ }
537
+
538
+ var tagMap = {
539
+ script: 'noscript',
540
+ altglyph: 'altGlyph',
541
+ altglyphdef: 'altGlyphDef',
542
+ altglyphitem: 'altGlyphItem',
543
+ animatecolor: 'animateColor',
544
+ animatemotion: 'animateMotion',
545
+ animatetransform: 'animateTransform',
546
+ clippath: 'clipPath',
547
+ feblend: 'feBlend',
548
+ fecolormatrix: 'feColorMatrix',
549
+ fecomponenttransfer: 'feComponentTransfer',
550
+ fecomposite: 'feComposite',
551
+ feconvolvematrix: 'feConvolveMatrix',
552
+ fediffuselighting: 'feDiffuseLighting',
553
+ fedisplacementmap: 'feDisplacementMap',
554
+ fedistantlight: 'feDistantLight',
555
+ fedropshadow: 'feDropShadow',
556
+ feflood: 'feFlood',
557
+ fefunca: 'feFuncA',
558
+ fefuncb: 'feFuncB',
559
+ fefuncg: 'feFuncG',
560
+ fefuncr: 'feFuncR',
561
+ fegaussianblur: 'feGaussianBlur',
562
+ feimage: 'feImage',
563
+ femerge: 'feMerge',
564
+ femergenode: 'feMergeNode',
565
+ femorphology: 'feMorphology',
566
+ feoffset: 'feOffset',
567
+ fepointlight: 'fePointLight',
568
+ fespecularlighting: 'feSpecularLighting',
569
+ fespotlight: 'feSpotLight',
570
+ fetile: 'feTile',
571
+ feturbulence: 'feTurbulence',
572
+ foreignobject: 'foreignObject',
573
+ glyphref: 'glyphRef',
574
+ lineargradient: 'linearGradient',
575
+ radialgradient: 'radialGradient'
576
+ };
577
+ function getTagName(n) {
578
+ var tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName;
579
+ if (tagName === 'link' && n.attributes._cssText) {
580
+ tagName = 'style';
581
+ }
582
+ return tagName;
583
+ }
584
+ function escapeRegExp(str) {
585
+ return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
586
+ }
587
+ var HOVER_SELECTOR = /([^\\]):hover/;
588
+ var HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g');
589
+ function addHoverClass(cssText, cache) {
590
+ var _a;
591
+ if (!((_a = window === null || window === void 0 ? void 0 : window.HIG_CONFIGURATION) === null || _a === void 0 ? void 0 : _a.enableOnHoverClass)) {
592
+ return cssText;
593
+ }
594
+ var cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText);
595
+ if (cachedStyle)
596
+ return cachedStyle;
597
+ var ast = parse(cssText, {
598
+ silent: true
599
+ });
600
+ if (!ast.stylesheet) {
601
+ return cssText;
602
+ }
603
+ var selectors = [];
604
+ ast.stylesheet.rules.forEach(function (rule) {
605
+ if ('selectors' in rule) {
606
+ (rule.selectors || []).forEach(function (selector) {
607
+ if (HOVER_SELECTOR.test(selector)) {
608
+ selectors.push(selector);
609
+ }
610
+ });
611
+ }
612
+ });
613
+ if (selectors.length === 0) {
614
+ return cssText;
615
+ }
616
+ var selectorMatcher = new RegExp(selectors
617
+ .filter(function (selector, index) { return selectors.indexOf(selector) === index; })
618
+ .sort(function (a, b) { return b.length - a.length; })
619
+ .map(function (selector) {
620
+ return escapeRegExp(selector);
621
+ })
622
+ .join('|'), 'g');
623
+ var result = cssText.replace(selectorMatcher, function (selector) {
624
+ var newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, '$1.\\:hover');
625
+ return selector + ", " + newSelector;
626
+ });
627
+ cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.set(cssText, result);
628
+ return result;
629
+ }
630
+ function createCache() {
631
+ var stylesWithHoverClass = new Map();
632
+ return {
633
+ stylesWithHoverClass: stylesWithHoverClass
634
+ };
635
+ }
636
+ function buildNode(n, options) {
637
+ var doc = options.doc, hackCss = options.hackCss, cache = options.cache;
638
+ switch (n.type) {
639
+ case NodeType$2.Document:
640
+ return doc.implementation.createDocument(null, '', null);
641
+ case NodeType$2.DocumentType:
642
+ return doc.implementation.createDocumentType(n.name || 'html', n.publicId, n.systemId);
643
+ case NodeType$2.Element:
644
+ var tagName = getTagName(n);
645
+ var node_1;
646
+ if (n.isSVG) {
647
+ node_1 = doc.createElementNS('http://www.w3.org/2000/svg', tagName);
648
+ }
649
+ else {
650
+ node_1 = doc.createElement(tagName);
651
+ }
652
+ var _loop_1 = function (name_1) {
653
+ if (!n.attributes.hasOwnProperty(name_1)) {
654
+ return "continue";
655
+ }
656
+ var value = n.attributes[name_1];
657
+ if (tagName === 'option' && name_1 === 'selected' && value === false) {
658
+ return "continue";
659
+ }
660
+ value =
661
+ typeof value === 'boolean' || typeof value === 'number' ? '' : value;
662
+ if (!name_1.startsWith('rr_')) {
663
+ var isTextarea = tagName === 'textarea' && name_1 === 'value';
664
+ var isRemoteOrDynamicCss = tagName === 'style' && name_1 === '_cssText';
665
+ if (isRemoteOrDynamicCss && hackCss) {
666
+ value = addHoverClass(value, cache);
667
+ if (typeof value === 'string') {
668
+ var regex = /url\(\"https:\/\/\S*(.eot|.woff2|.ttf|.woff)\S*\"\)/gm;
669
+ var m = void 0;
670
+ var fontUrls_1 = [];
671
+ var PROXY_URL_1 = 'https://replay-cors-proxy.highlightrun.workers.dev';
672
+ while ((m = regex.exec(value)) !== null) {
673
+ if (m.index === regex.lastIndex) {
674
+ regex.lastIndex++;
675
+ }
676
+ m.forEach(function (match, groupIndex) {
677
+ if (groupIndex === 0) {
678
+ var url = match.slice(5, match.length - 2);
679
+ fontUrls_1.push({
680
+ originalUrl: url,
681
+ proxyUrl: url.replace(url, PROXY_URL_1 + "?url=" + url)
682
+ });
683
+ }
684
+ });
685
+ }
686
+ fontUrls_1.forEach(function (urlPair) {
687
+ value = value.replace(urlPair.originalUrl, urlPair.proxyUrl);
688
+ });
689
+ }
690
+ }
691
+ if (isTextarea || isRemoteOrDynamicCss) {
692
+ var child = doc.createTextNode(value);
693
+ for (var _i = 0, _a = Array.from(node_1.childNodes); _i < _a.length; _i++) {
694
+ var c = _a[_i];
695
+ if (c.nodeType === node_1.TEXT_NODE) {
696
+ node_1.removeChild(c);
697
+ }
698
+ }
699
+ node_1.appendChild(child);
700
+ return "continue";
701
+ }
702
+ try {
703
+ if (n.isSVG && name_1 === 'xlink:href') {
704
+ node_1.setAttributeNS('http://www.w3.org/1999/xlink', name_1, value);
705
+ }
706
+ else if (name_1 === 'onload' ||
707
+ name_1 === 'onclick' ||
708
+ name_1.substring(0, 7) === 'onmouse') {
709
+ node_1.setAttribute('_' + name_1, value);
710
+ }
711
+ else if (tagName === 'meta' &&
712
+ n.attributes['http-equiv'] === 'Content-Security-Policy' &&
713
+ name_1 === 'content') {
714
+ node_1.setAttribute('csp-content', value);
715
+ return "continue";
716
+ }
717
+ else if (tagName === 'link' &&
718
+ n.attributes.rel === 'preload' &&
719
+ n.attributes.as === 'script') {
720
+ }
721
+ else if (tagName === 'link' &&
722
+ n.attributes.rel === 'prefetch' &&
723
+ typeof n.attributes.href === 'string' &&
724
+ n.attributes.href.endsWith('.js')) {
725
+ }
726
+ else if (tagName === 'img' &&
727
+ n.attributes.srcset &&
728
+ n.attributes.rr_dataURL) {
729
+ node_1.setAttribute('rrweb-original-srcset', n.attributes.srcset);
730
+ }
731
+ else {
732
+ node_1.setAttribute(name_1, value);
733
+ }
734
+ }
735
+ catch (error) {
736
+ }
737
+ }
738
+ else {
739
+ if (tagName === 'canvas' && name_1 === 'rr_dataURL') {
740
+ var image_1 = document.createElement('img');
741
+ image_1.src = value;
742
+ image_1.onload = function () {
743
+ var ctx = node_1.getContext('2d');
744
+ if (ctx) {
745
+ ctx.drawImage(image_1, 0, 0, image_1.width, image_1.height);
746
+ }
747
+ };
748
+ }
749
+ else if (tagName === 'img' && name_1 === 'rr_dataURL') {
750
+ var image = node_1;
751
+ if (!image.currentSrc.startsWith('data:')) {
752
+ image.setAttribute('rrweb-original-src', n.attributes.src);
753
+ image.src = value;
754
+ image.setAttribute('rrweb-inline-src', value);
755
+ }
756
+ }
757
+ if (name_1 === 'rr_width') {
758
+ node_1.style.width = value;
759
+ }
760
+ else if (name_1 === 'rr_height') {
761
+ node_1.style.height = value;
762
+ }
763
+ else if (name_1 === 'rr_mediaCurrentTime') {
764
+ node_1.currentTime = n.attributes
765
+ .rr_mediaCurrentTime;
766
+ }
767
+ else if (name_1 === 'rr_mediaState') {
768
+ switch (value) {
769
+ case 'played':
770
+ node_1
771
+ .play()["catch"](function (e) { return console.warn('media playback error', e); });
772
+ break;
773
+ case 'paused':
774
+ node_1.pause();
775
+ break;
776
+ }
777
+ }
778
+ }
779
+ };
780
+ for (var name_1 in n.attributes) {
781
+ _loop_1(name_1);
782
+ }
783
+ if (tagName === 'img') {
784
+ var image = node_1;
785
+ if (!image.currentSrc.startsWith('data:')) {
786
+ var inlineSrc = image.getAttribute('rrweb-inline-src');
787
+ if (inlineSrc === null || inlineSrc === void 0 ? void 0 : inlineSrc.startsWith('data:')) {
788
+ image.src = inlineSrc;
789
+ }
790
+ }
791
+ }
792
+ if (n.isShadowHost) {
793
+ if (!node_1.shadowRoot) {
794
+ node_1.attachShadow({ mode: 'open' });
795
+ }
796
+ else {
797
+ while (node_1.shadowRoot.firstChild) {
798
+ node_1.shadowRoot.removeChild(node_1.shadowRoot.firstChild);
799
+ }
800
+ }
801
+ }
802
+ return node_1;
803
+ case NodeType$2.Text:
804
+ return doc.createTextNode(n.isStyle && hackCss
805
+ ? addHoverClass(n.textContent, cache)
806
+ : n.textContent);
807
+ case NodeType$2.CDATA:
808
+ return doc.createCDATASection(n.textContent);
809
+ case NodeType$2.Comment:
810
+ return doc.createComment(n.textContent);
811
+ default:
812
+ return null;
813
+ }
814
+ }
815
+ function buildNodeWithSN(n, options) {
816
+ var doc = options.doc, mirror = options.mirror, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.hackCss, hackCss = _b === void 0 ? true : _b, afterAppend = options.afterAppend, cache = options.cache;
817
+ var node = buildNode(n, { doc: doc, hackCss: hackCss, cache: cache });
818
+ if (!node) {
819
+ return null;
820
+ }
821
+ if (n.rootId) {
822
+ console.assert(mirror.getNode(n.rootId) === doc, 'Target document should have the same root id.');
823
+ }
824
+ if (n.type === NodeType$2.Document) {
825
+ doc.close();
826
+ doc.open();
827
+ if (n.compatMode === 'BackCompat' &&
828
+ n.childNodes &&
829
+ n.childNodes[0].type !== NodeType$2.DocumentType) {
830
+ if (n.childNodes[0].type === NodeType$2.Element &&
831
+ 'xmlns' in n.childNodes[0].attributes &&
832
+ n.childNodes[0].attributes.xmlns === 'http://www.w3.org/1999/xhtml') {
833
+ doc.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">');
834
+ }
835
+ else {
836
+ doc.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">');
837
+ }
838
+ }
839
+ node = doc;
840
+ }
841
+ mirror.add(node, n);
842
+ if ((n.type === NodeType$2.Document || n.type === NodeType$2.Element) &&
843
+ !skipChild) {
844
+ for (var _i = 0, _c = n.childNodes; _i < _c.length; _i++) {
845
+ var childN = _c[_i];
846
+ var childNode = buildNodeWithSN(childN, {
847
+ doc: doc,
848
+ mirror: mirror,
849
+ skipChild: false,
850
+ hackCss: hackCss,
851
+ afterAppend: afterAppend,
852
+ cache: cache
853
+ });
854
+ if (!childNode) {
855
+ console.warn('Failed to rebuild', childN);
856
+ continue;
857
+ }
858
+ if (childN.isShadow && isElement(node) && node.shadowRoot) {
859
+ node.shadowRoot.appendChild(childNode);
860
+ }
861
+ else {
862
+ node.appendChild(childNode);
863
+ }
864
+ if (afterAppend) {
865
+ afterAppend(childNode);
866
+ }
867
+ }
868
+ }
869
+ return node;
870
+ }
871
+ function visit(mirror, onVisit) {
872
+ function walk(node) {
873
+ onVisit(node);
874
+ }
875
+ for (var _i = 0, _a = mirror.getIds(); _i < _a.length; _i++) {
876
+ var id = _a[_i];
877
+ if (mirror.has(id)) {
878
+ walk(mirror.getNode(id));
879
+ }
880
+ }
881
+ }
882
+ function handleScroll(node, mirror) {
883
+ var n = mirror.getMeta(node);
884
+ if ((n === null || n === void 0 ? void 0 : n.type) !== NodeType$2.Element) {
885
+ return;
886
+ }
887
+ var el = node;
888
+ for (var name_2 in n.attributes) {
889
+ if (!(n.attributes.hasOwnProperty(name_2) && name_2.startsWith('rr_'))) {
890
+ continue;
891
+ }
892
+ var value = n.attributes[name_2];
893
+ if (name_2 === 'rr_scrollLeft') {
894
+ el.scrollLeft = value;
895
+ }
896
+ if (name_2 === 'rr_scrollTop') {
897
+ el.scrollTop = value;
898
+ }
899
+ }
900
+ }
901
+ function rebuild(n, options) {
902
+ var doc = options.doc, onVisit = options.onVisit, _a = options.hackCss, hackCss = _a === void 0 ? true : _a, afterAppend = options.afterAppend, cache = options.cache, _b = options.mirror, mirror = _b === void 0 ? new Mirror$2() : _b;
903
+ var node = buildNodeWithSN(n, {
904
+ doc: doc,
905
+ mirror: mirror,
906
+ skipChild: false,
907
+ hackCss: hackCss,
908
+ afterAppend: afterAppend,
909
+ cache: cache
910
+ });
911
+ visit(mirror, function (visitedNode) {
912
+ if (onVisit) {
913
+ onVisit(visitedNode);
914
+ }
915
+ handleScroll(visitedNode, mirror);
916
+ });
917
+ return node;
918
+ }
919
+
920
+ var NodeType$1;
921
+ (function (NodeType) {
922
+ NodeType[NodeType["Document"] = 0] = "Document";
923
+ NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
924
+ NodeType[NodeType["Element"] = 2] = "Element";
925
+ NodeType[NodeType["Text"] = 3] = "Text";
926
+ NodeType[NodeType["CDATA"] = 4] = "CDATA";
927
+ NodeType[NodeType["Comment"] = 5] = "Comment";
928
+ })(NodeType$1 || (NodeType$1 = {}));
929
+ var Mirror$1 = (function () {
930
+ function Mirror() {
931
+ this.idNodeMap = new Map();
932
+ this.nodeMetaMap = new WeakMap();
933
+ }
934
+ Mirror.prototype.getId = function (n) {
935
+ var _a;
936
+ if (!n)
937
+ return -1;
938
+ var id = (_a = this.getMeta(n)) === null || _a === void 0 ? void 0 : _a.id;
939
+ return id !== null && id !== void 0 ? id : -1;
940
+ };
941
+ Mirror.prototype.getNode = function (id) {
942
+ return this.idNodeMap.get(id) || null;
943
+ };
944
+ Mirror.prototype.getIds = function () {
945
+ return Array.from(this.idNodeMap.keys());
946
+ };
947
+ Mirror.prototype.getMeta = function (n) {
948
+ return this.nodeMetaMap.get(n) || null;
949
+ };
950
+ Mirror.prototype.removeNodeFromMap = function (n) {
951
+ var _this = this;
952
+ var id = this.getId(n);
953
+ this.idNodeMap["delete"](id);
954
+ if (n.childNodes) {
955
+ n.childNodes.forEach(function (childNode) {
956
+ return _this.removeNodeFromMap(childNode);
957
+ });
958
+ }
959
+ };
960
+ Mirror.prototype.has = function (id) {
961
+ return this.idNodeMap.has(id);
962
+ };
963
+ Mirror.prototype.hasNode = function (node) {
964
+ return this.nodeMetaMap.has(node);
965
+ };
966
+ Mirror.prototype.add = function (n, meta) {
967
+ var id = meta.id;
968
+ this.idNodeMap.set(id, n);
969
+ this.nodeMetaMap.set(n, meta);
970
+ };
971
+ Mirror.prototype.replace = function (id, n) {
972
+ this.idNodeMap.set(id, n);
973
+ };
974
+ Mirror.prototype.reset = function () {
975
+ this.idNodeMap = new Map();
976
+ this.nodeMetaMap = new WeakMap();
977
+ };
978
+ return Mirror;
979
+ }());
980
+ function createMirror$1() {
981
+ return new Mirror$1();
982
+ }
983
+
32
984
  function parseCSSText(cssText) {
33
985
  const res = {};
34
986
  const listDelimiter = /;(?![^(]*\))/g;
@@ -119,21 +1071,21 @@ function BaseRRDocumentImpl(RRNodeClass) {
119
1071
  this.nodeType = NodeType.DOCUMENT_NODE;
120
1072
  this.nodeName = '#document';
121
1073
  this.compatMode = 'CSS1Compat';
122
- this.RRNodeType = rrwebSnapshot.NodeType.Document;
1074
+ this.RRNodeType = NodeType$1.Document;
123
1075
  this.textContent = null;
124
1076
  }
125
1077
  get documentElement() {
126
- return (this.childNodes.find((node) => node.RRNodeType === rrwebSnapshot.NodeType.Element &&
1078
+ return (this.childNodes.find((node) => node.RRNodeType === NodeType$1.Element &&
127
1079
  node.tagName === 'HTML') || null);
128
1080
  }
129
1081
  get body() {
130
1082
  var _a;
131
- return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === rrwebSnapshot.NodeType.Element &&
1083
+ return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === NodeType$1.Element &&
132
1084
  node.tagName === 'BODY')) || null);
133
1085
  }
134
1086
  get head() {
135
1087
  var _a;
136
- return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === rrwebSnapshot.NodeType.Element &&
1088
+ return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === NodeType$1.Element &&
137
1089
  node.tagName === 'HEAD')) || null);
138
1090
  }
139
1091
  get implementation() {
@@ -144,10 +1096,10 @@ function BaseRRDocumentImpl(RRNodeClass) {
144
1096
  }
145
1097
  appendChild(childNode) {
146
1098
  const nodeType = childNode.RRNodeType;
147
- if (nodeType === rrwebSnapshot.NodeType.Element ||
148
- nodeType === rrwebSnapshot.NodeType.DocumentType) {
1099
+ if (nodeType === NodeType$1.Element ||
1100
+ nodeType === NodeType$1.DocumentType) {
149
1101
  if (this.childNodes.some((s) => s.RRNodeType === nodeType)) {
150
- throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === rrwebSnapshot.NodeType.Element ? 'RRElement' : 'RRDoctype'} on RRDocument allowed.`);
1102
+ throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? 'RRElement' : 'RRDoctype'} on RRDocument allowed.`);
151
1103
  }
152
1104
  }
153
1105
  childNode.parentElement = null;
@@ -157,10 +1109,10 @@ function BaseRRDocumentImpl(RRNodeClass) {
157
1109
  }
158
1110
  insertBefore(newChild, refChild) {
159
1111
  const nodeType = newChild.RRNodeType;
160
- if (nodeType === rrwebSnapshot.NodeType.Element ||
161
- nodeType === rrwebSnapshot.NodeType.DocumentType) {
1112
+ if (nodeType === NodeType$1.Element ||
1113
+ nodeType === NodeType$1.DocumentType) {
162
1114
  if (this.childNodes.some((s) => s.RRNodeType === nodeType)) {
163
- throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === rrwebSnapshot.NodeType.Element ? 'RRElement' : 'RRDoctype'} on RRDocument allowed.`);
1115
+ throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === NodeType$1.Element ? 'RRElement' : 'RRDoctype'} on RRDocument allowed.`);
164
1116
  }
165
1117
  }
166
1118
  if (refChild === null)
@@ -242,7 +1194,7 @@ function BaseRRDocumentTypeImpl(RRNodeClass) {
242
1194
  constructor(qualifiedName, publicId, systemId) {
243
1195
  super();
244
1196
  this.nodeType = NodeType.DOCUMENT_TYPE_NODE;
245
- this.RRNodeType = rrwebSnapshot.NodeType.DocumentType;
1197
+ this.RRNodeType = NodeType$1.DocumentType;
246
1198
  this.textContent = null;
247
1199
  this.name = qualifiedName;
248
1200
  this.publicId = publicId;
@@ -259,7 +1211,7 @@ function BaseRRElementImpl(RRNodeClass) {
259
1211
  constructor(tagName) {
260
1212
  super();
261
1213
  this.nodeType = NodeType.ELEMENT_NODE;
262
- this.RRNodeType = rrwebSnapshot.NodeType.Element;
1214
+ this.RRNodeType = NodeType$1.Element;
263
1215
  this.attributes = {};
264
1216
  this.shadowRoot = null;
265
1217
  this.tagName = tagName.toUpperCase();
@@ -386,7 +1338,7 @@ function BaseRRTextImpl(RRNodeClass) {
386
1338
  super();
387
1339
  this.nodeType = NodeType.TEXT_NODE;
388
1340
  this.nodeName = '#text';
389
- this.RRNodeType = rrwebSnapshot.NodeType.Text;
1341
+ this.RRNodeType = NodeType$1.Text;
390
1342
  this.data = data;
391
1343
  }
392
1344
  get textContent() {
@@ -406,7 +1358,7 @@ function BaseRRCommentImpl(RRNodeClass) {
406
1358
  super();
407
1359
  this.nodeType = NodeType.COMMENT_NODE;
408
1360
  this.nodeName = '#comment';
409
- this.RRNodeType = rrwebSnapshot.NodeType.Comment;
1361
+ this.RRNodeType = NodeType$1.Comment;
410
1362
  this.data = data;
411
1363
  }
412
1364
  get textContent() {
@@ -426,7 +1378,7 @@ function BaseRRCDATASectionImpl(RRNodeClass) {
426
1378
  super();
427
1379
  this.nodeName = '#cdata-section';
428
1380
  this.nodeType = NodeType.CDATA_SECTION_NODE;
429
- this.RRNodeType = rrwebSnapshot.NodeType.CDATA;
1381
+ this.RRNodeType = NodeType$1.CDATA;
430
1382
  this.data = data;
431
1383
  }
432
1384
  get textContent() {
@@ -496,12 +1448,12 @@ function diff(oldTree, newTree, replayer, rrnodeMirror) {
496
1448
  }
497
1449
  let inputDataToApply = null, scrollDataToApply = null;
498
1450
  switch (newTree.RRNodeType) {
499
- case rrwebSnapshot.NodeType.Document: {
1451
+ case NodeType$1.Document: {
500
1452
  const newRRDocument = newTree;
501
1453
  scrollDataToApply = newRRDocument.scrollData;
502
1454
  break;
503
1455
  }
504
- case rrwebSnapshot.NodeType.Element: {
1456
+ case NodeType$1.Element: {
505
1457
  const oldElement = oldTree;
506
1458
  const newRRElement = newTree;
507
1459
  diffProps(oldElement, newRRElement, rrnodeMirror);
@@ -541,9 +1493,9 @@ function diff(oldTree, newTree, replayer, rrnodeMirror) {
541
1493
  }
542
1494
  break;
543
1495
  }
544
- case rrwebSnapshot.NodeType.Text:
545
- case rrwebSnapshot.NodeType.Comment:
546
- case rrwebSnapshot.NodeType.CDATA:
1496
+ case NodeType$1.Text:
1497
+ case NodeType$1.Comment:
1498
+ case NodeType$1.CDATA:
547
1499
  if (oldTree.textContent !==
548
1500
  newTree.data)
549
1501
  oldTree.textContent = newTree.data;
@@ -658,7 +1610,7 @@ function diffChildren(oldChildren, newChildren, parentNode, replayer, rrnodeMirr
658
1610
  else {
659
1611
  const newNode = createOrGetNode(newStartNode, replayer.mirror, rrnodeMirror);
660
1612
  if (parentNode.nodeName === '#document' &&
661
- ((_a = replayer.mirror.getMeta(newNode)) === null || _a === void 0 ? void 0 : _a.type) === rrwebSnapshot.NodeType.Element &&
1613
+ ((_a = replayer.mirror.getMeta(newNode)) === null || _a === void 0 ? void 0 : _a.type) === NodeType$1.Element &&
662
1614
  parentNode.documentElement) {
663
1615
  parentNode.removeChild(parentNode.documentElement);
664
1616
  oldChildren[oldStartIndex] = undefined;
@@ -710,13 +1662,13 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
710
1662
  if (node !== null)
711
1663
  return node;
712
1664
  switch (rrNode.RRNodeType) {
713
- case rrwebSnapshot.NodeType.Document:
1665
+ case NodeType$1.Document:
714
1666
  node = new Document();
715
1667
  break;
716
- case rrwebSnapshot.NodeType.DocumentType:
1668
+ case NodeType$1.DocumentType:
717
1669
  node = document.implementation.createDocumentType(rrNode.name, rrNode.publicId, rrNode.systemId);
718
1670
  break;
719
- case rrwebSnapshot.NodeType.Element: {
1671
+ case NodeType$1.Element: {
720
1672
  rrNode.tagName.toLowerCase();
721
1673
  if (sn && 'isSVG' in sn && (sn === null || sn === void 0 ? void 0 : sn.isSVG)) {
722
1674
  node = document.createElementNS(NAMESPACES['svg'], rrNode.tagName.toLowerCase());
@@ -725,13 +1677,13 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
725
1677
  node = document.createElement(rrNode.tagName);
726
1678
  break;
727
1679
  }
728
- case rrwebSnapshot.NodeType.Text:
1680
+ case NodeType$1.Text:
729
1681
  node = document.createTextNode(rrNode.data);
730
1682
  break;
731
- case rrwebSnapshot.NodeType.Comment:
1683
+ case NodeType$1.Comment:
732
1684
  node = document.createComment(rrNode.data);
733
1685
  break;
734
- case rrwebSnapshot.NodeType.CDATA:
1686
+ case NodeType$1.CDATA:
735
1687
  node = document.createCDATASection(rrNode.data);
736
1688
  break;
737
1689
  }
@@ -964,7 +1916,7 @@ function buildFromNode(node, rrdom, domMirror, parentRRNode) {
964
1916
  }
965
1917
  return rrNode;
966
1918
  }
967
- function buildFromDom(dom, domMirror = rrwebSnapshot.createMirror(), rrdom = new RRDocument()) {
1919
+ function buildFromDom(dom, domMirror = createMirror$1(), rrdom = new RRDocument()) {
968
1920
  function walk(node, parentRRNode) {
969
1921
  const rrNode = buildFromNode(node, rrdom, domMirror, parentRRNode);
970
1922
  if (rrNode === null)
@@ -1042,13 +1994,13 @@ class Mirror {
1042
1994
  }
1043
1995
  function getDefaultSN(node, id) {
1044
1996
  switch (node.RRNodeType) {
1045
- case rrwebSnapshot.NodeType.Document:
1997
+ case NodeType$1.Document:
1046
1998
  return {
1047
1999
  id,
1048
2000
  type: node.RRNodeType,
1049
2001
  childNodes: [],
1050
2002
  };
1051
- case rrwebSnapshot.NodeType.DocumentType:
2003
+ case NodeType$1.DocumentType:
1052
2004
  const doctype = node;
1053
2005
  return {
1054
2006
  id,
@@ -1057,7 +2009,7 @@ function getDefaultSN(node, id) {
1057
2009
  publicId: doctype.publicId,
1058
2010
  systemId: doctype.systemId,
1059
2011
  };
1060
- case rrwebSnapshot.NodeType.Element:
2012
+ case NodeType$1.Element:
1061
2013
  return {
1062
2014
  id,
1063
2015
  type: node.RRNodeType,
@@ -1065,19 +2017,19 @@ function getDefaultSN(node, id) {
1065
2017
  attributes: {},
1066
2018
  childNodes: [],
1067
2019
  };
1068
- case rrwebSnapshot.NodeType.Text:
2020
+ case NodeType$1.Text:
1069
2021
  return {
1070
2022
  id,
1071
2023
  type: node.RRNodeType,
1072
2024
  textContent: node.textContent || '',
1073
2025
  };
1074
- case rrwebSnapshot.NodeType.Comment:
2026
+ case NodeType$1.Comment:
1075
2027
  return {
1076
2028
  id,
1077
2029
  type: node.RRNodeType,
1078
2030
  textContent: node.textContent || '',
1079
2031
  };
1080
- case rrwebSnapshot.NodeType.CDATA:
2032
+ case NodeType$1.CDATA:
1081
2033
  return {
1082
2034
  id,
1083
2035
  type: node.RRNodeType,
@@ -2230,10 +3182,10 @@ class Replayer {
2230
3182
  this.emitter = mitt();
2231
3183
  this.activityIntervals = [];
2232
3184
  this.legacy_missingNodeRetryMap = {};
2233
- this.cache = rrwebSnapshot.createCache();
3185
+ this.cache = createCache();
2234
3186
  this.imageMap = new Map();
2235
3187
  this.canvasEventMap = new Map();
2236
- this.mirror = rrwebSnapshot.createMirror();
3188
+ this.mirror = createMirror$2();
2237
3189
  this.firstFullSnapshot = null;
2238
3190
  this.newDocumentQueue = [];
2239
3191
  this.mousePos = null;
@@ -2575,7 +3527,7 @@ class Replayer {
2575
3527
  this.iframe.style.pointerEvents = 'none';
2576
3528
  }
2577
3529
  resetCache() {
2578
- this.cache = rrwebSnapshot.createCache();
3530
+ this.cache = createCache();
2579
3531
  }
2580
3532
  setupDom() {
2581
3533
  this.wrapper = document.createElement('div');
@@ -2777,7 +3729,7 @@ class Replayer {
2777
3729
  }
2778
3730
  this.legacy_missingNodeRetryMap = {};
2779
3731
  const collected = [];
2780
- rrwebSnapshot.rebuild(event.data.node, {
3732
+ rebuild(event.data.node, {
2781
3733
  doc: this.iframe.contentDocument,
2782
3734
  afterAppend: (builtNode) => {
2783
3735
  this.collectIframeAndAttachDocument(collected, builtNode);
@@ -2834,7 +3786,7 @@ class Replayer {
2834
3786
  ? this.virtualDom.mirror
2835
3787
  : this.mirror;
2836
3788
  const collected = [];
2837
- rrwebSnapshot.buildNodeWithSN(mutation.node, {
3789
+ buildNodeWithSN(mutation.node, {
2838
3790
  doc: iframeEl.contentDocument,
2839
3791
  mirror: mirror,
2840
3792
  hackCss: true,
@@ -2842,7 +3794,7 @@ class Replayer {
2842
3794
  afterAppend: (builtNode) => {
2843
3795
  this.collectIframeAndAttachDocument(collected, builtNode);
2844
3796
  const sn = mirror.getMeta(builtNode);
2845
- if ((sn === null || sn === void 0 ? void 0 : sn.type) === rrwebSnapshot.NodeType.Element &&
3797
+ if ((sn === null || sn === void 0 ? void 0 : sn.type) === NodeType$2.Element &&
2846
3798
  (sn === null || sn === void 0 ? void 0 : sn.tagName.toUpperCase()) === 'HTML') {
2847
3799
  const { documentElement, head } = iframeEl.contentDocument;
2848
3800
  this.insertStyleRules(documentElement, head);
@@ -3396,7 +4348,7 @@ class Replayer {
3396
4348
  }
3397
4349
  let parent = mirror.getNode(mutation.parentId);
3398
4350
  if (!parent) {
3399
- if (mutation.node.type === rrwebSnapshot.NodeType.Document) {
4351
+ if (mutation.node.type === NodeType$2.Document) {
3400
4352
  return this.newDocumentQueue.push(mutation);
3401
4353
  }
3402
4354
  return queue.push(mutation);
@@ -3432,7 +4384,7 @@ class Replayer {
3432
4384
  this.attachDocumentToIframe(mutation, parent);
3433
4385
  return;
3434
4386
  }
3435
- const target = rrwebSnapshot.buildNodeWithSN(mutation.node, {
4387
+ const target = buildNodeWithSN(mutation.node, {
3436
4388
  doc: targetDoc,
3437
4389
  mirror: mirror,
3438
4390
  skipChild: true,
@@ -3448,9 +4400,9 @@ class Replayer {
3448
4400
  }
3449
4401
  const parentSn = mirror.getMeta(parent);
3450
4402
  if (parentSn &&
3451
- parentSn.type === rrwebSnapshot.NodeType.Element &&
4403
+ parentSn.type === NodeType$2.Element &&
3452
4404
  parentSn.tagName === 'textarea' &&
3453
- mutation.node.type === rrwebSnapshot.NodeType.Text) {
4405
+ mutation.node.type === NodeType$2.Text) {
3454
4406
  const childNodeArray = Array.isArray(parent.childNodes)
3455
4407
  ? parent.childNodes
3456
4408
  : Array.from(parent.childNodes);
@@ -3593,7 +4545,7 @@ class Replayer {
3593
4545
  behavior: isSync ? 'auto' : 'smooth',
3594
4546
  });
3595
4547
  }
3596
- else if ((sn === null || sn === void 0 ? void 0 : sn.type) === rrwebSnapshot.NodeType.Document) {
4548
+ else if ((sn === null || sn === void 0 ? void 0 : sn.type) === NodeType$2.Document) {
3597
4549
  target.defaultView.scrollTo({
3598
4550
  top: d.y,
3599
4551
  left: d.x,