@highlight-run/rrweb 2.0.10 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/plugins/console-record.js +5 -5
- package/dist/plugins/console-record.min.js +5 -5
- package/dist/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.js +3 -3
- package/dist/plugins/console-replay.min.js +3 -3
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/record/rrweb-record-pack.js +2 -2
- package/dist/record/rrweb-record-pack.min.js +2 -2
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +3 -3
- package/dist/record/rrweb-record.min.js +3 -3
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.js +3 -4
- package/dist/replay/rrweb-replay-unpack.min.js +3 -4
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.js +3 -4
- package/dist/replay/rrweb-replay.min.js +3 -4
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.js +24 -25
- package/dist/rrweb-all.min.js +24 -25
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.js +14 -15
- package/dist/rrweb.min.js +14 -15
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/packages/rrdom/es/virtual-dom.js +14 -76
- package/es/rrweb/packages/rrweb/src/index.js +1 -1
- package/es/rrweb/packages/rrweb/src/record/index.js +1 -1
- package/es/rrweb/packages/rrweb/src/record/mutation.js +1 -1
- package/es/rrweb/packages/rrweb/src/record/observer.js +1 -1
- package/es/rrweb/packages/rrweb/src/replay/index.js +1 -1
- package/es/rrweb/packages/rrweb/src/utils.js +1 -1
- package/lib/plugins/console-record.js +1 -9
- package/lib/plugins/console-replay.js +1 -9
- package/lib/record/rrweb-record-pack.js +3 -9
- package/lib/record/rrweb-record.js +17 -1063
- package/lib/replay/rrweb-replay-unpack.js +59 -1011
- package/lib/replay/rrweb-replay.js +59 -1011
- package/lib/rrweb-all.js +100 -2032
- package/lib/rrweb.js +100 -2032
- package/package.json +2 -2
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +0 -1871
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var rrwebSnapshot = require('@highlight-run/rrweb-snapshot');
|
|
6
|
+
|
|
5
7
|
/*! *****************************************************************************
|
|
6
8
|
Copyright (c) Microsoft Corporation.
|
|
7
9
|
|
|
@@ -27,960 +29,6 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
|
|
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
|
-
|
|
984
32
|
function parseCSSText(cssText) {
|
|
985
33
|
const res = {};
|
|
986
34
|
const listDelimiter = /;(?![^(]*\))/g;
|
|
@@ -1071,21 +119,21 @@ function BaseRRDocumentImpl(RRNodeClass) {
|
|
|
1071
119
|
this.nodeType = NodeType.DOCUMENT_NODE;
|
|
1072
120
|
this.nodeName = '#document';
|
|
1073
121
|
this.compatMode = 'CSS1Compat';
|
|
1074
|
-
this.RRNodeType = NodeType
|
|
122
|
+
this.RRNodeType = rrwebSnapshot.NodeType.Document;
|
|
1075
123
|
this.textContent = null;
|
|
1076
124
|
}
|
|
1077
125
|
get documentElement() {
|
|
1078
|
-
return (this.childNodes.find((node) => node.RRNodeType === NodeType
|
|
126
|
+
return (this.childNodes.find((node) => node.RRNodeType === rrwebSnapshot.NodeType.Element &&
|
|
1079
127
|
node.tagName === 'HTML') || null);
|
|
1080
128
|
}
|
|
1081
129
|
get body() {
|
|
1082
130
|
var _a;
|
|
1083
|
-
return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === NodeType
|
|
131
|
+
return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === rrwebSnapshot.NodeType.Element &&
|
|
1084
132
|
node.tagName === 'BODY')) || null);
|
|
1085
133
|
}
|
|
1086
134
|
get head() {
|
|
1087
135
|
var _a;
|
|
1088
|
-
return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === NodeType
|
|
136
|
+
return (((_a = this.documentElement) === null || _a === void 0 ? void 0 : _a.childNodes.find((node) => node.RRNodeType === rrwebSnapshot.NodeType.Element &&
|
|
1089
137
|
node.tagName === 'HEAD')) || null);
|
|
1090
138
|
}
|
|
1091
139
|
get implementation() {
|
|
@@ -1096,10 +144,10 @@ function BaseRRDocumentImpl(RRNodeClass) {
|
|
|
1096
144
|
}
|
|
1097
145
|
appendChild(childNode) {
|
|
1098
146
|
const nodeType = childNode.RRNodeType;
|
|
1099
|
-
if (nodeType === NodeType
|
|
1100
|
-
nodeType === NodeType
|
|
147
|
+
if (nodeType === rrwebSnapshot.NodeType.Element ||
|
|
148
|
+
nodeType === rrwebSnapshot.NodeType.DocumentType) {
|
|
1101
149
|
if (this.childNodes.some((s) => s.RRNodeType === nodeType)) {
|
|
1102
|
-
throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === NodeType
|
|
150
|
+
throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${nodeType === rrwebSnapshot.NodeType.Element ? 'RRElement' : 'RRDoctype'} on RRDocument allowed.`);
|
|
1103
151
|
}
|
|
1104
152
|
}
|
|
1105
153
|
childNode.parentElement = null;
|
|
@@ -1109,10 +157,10 @@ function BaseRRDocumentImpl(RRNodeClass) {
|
|
|
1109
157
|
}
|
|
1110
158
|
insertBefore(newChild, refChild) {
|
|
1111
159
|
const nodeType = newChild.RRNodeType;
|
|
1112
|
-
if (nodeType === NodeType
|
|
1113
|
-
nodeType === NodeType
|
|
160
|
+
if (nodeType === rrwebSnapshot.NodeType.Element ||
|
|
161
|
+
nodeType === rrwebSnapshot.NodeType.DocumentType) {
|
|
1114
162
|
if (this.childNodes.some((s) => s.RRNodeType === nodeType)) {
|
|
1115
|
-
throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === NodeType
|
|
163
|
+
throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${nodeType === rrwebSnapshot.NodeType.Element ? 'RRElement' : 'RRDoctype'} on RRDocument allowed.`);
|
|
1116
164
|
}
|
|
1117
165
|
}
|
|
1118
166
|
if (refChild === null)
|
|
@@ -1194,7 +242,7 @@ function BaseRRDocumentTypeImpl(RRNodeClass) {
|
|
|
1194
242
|
constructor(qualifiedName, publicId, systemId) {
|
|
1195
243
|
super();
|
|
1196
244
|
this.nodeType = NodeType.DOCUMENT_TYPE_NODE;
|
|
1197
|
-
this.RRNodeType = NodeType
|
|
245
|
+
this.RRNodeType = rrwebSnapshot.NodeType.DocumentType;
|
|
1198
246
|
this.textContent = null;
|
|
1199
247
|
this.name = qualifiedName;
|
|
1200
248
|
this.publicId = publicId;
|
|
@@ -1211,7 +259,7 @@ function BaseRRElementImpl(RRNodeClass) {
|
|
|
1211
259
|
constructor(tagName) {
|
|
1212
260
|
super();
|
|
1213
261
|
this.nodeType = NodeType.ELEMENT_NODE;
|
|
1214
|
-
this.RRNodeType = NodeType
|
|
262
|
+
this.RRNodeType = rrwebSnapshot.NodeType.Element;
|
|
1215
263
|
this.attributes = {};
|
|
1216
264
|
this.shadowRoot = null;
|
|
1217
265
|
this.tagName = tagName.toUpperCase();
|
|
@@ -1338,7 +386,7 @@ function BaseRRTextImpl(RRNodeClass) {
|
|
|
1338
386
|
super();
|
|
1339
387
|
this.nodeType = NodeType.TEXT_NODE;
|
|
1340
388
|
this.nodeName = '#text';
|
|
1341
|
-
this.RRNodeType = NodeType
|
|
389
|
+
this.RRNodeType = rrwebSnapshot.NodeType.Text;
|
|
1342
390
|
this.data = data;
|
|
1343
391
|
}
|
|
1344
392
|
get textContent() {
|
|
@@ -1358,7 +406,7 @@ function BaseRRCommentImpl(RRNodeClass) {
|
|
|
1358
406
|
super();
|
|
1359
407
|
this.nodeType = NodeType.COMMENT_NODE;
|
|
1360
408
|
this.nodeName = '#comment';
|
|
1361
|
-
this.RRNodeType = NodeType
|
|
409
|
+
this.RRNodeType = rrwebSnapshot.NodeType.Comment;
|
|
1362
410
|
this.data = data;
|
|
1363
411
|
}
|
|
1364
412
|
get textContent() {
|
|
@@ -1378,7 +426,7 @@ function BaseRRCDATASectionImpl(RRNodeClass) {
|
|
|
1378
426
|
super();
|
|
1379
427
|
this.nodeName = '#cdata-section';
|
|
1380
428
|
this.nodeType = NodeType.CDATA_SECTION_NODE;
|
|
1381
|
-
this.RRNodeType = NodeType
|
|
429
|
+
this.RRNodeType = rrwebSnapshot.NodeType.CDATA;
|
|
1382
430
|
this.data = data;
|
|
1383
431
|
}
|
|
1384
432
|
get textContent() {
|
|
@@ -1448,12 +496,12 @@ function diff(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
1448
496
|
}
|
|
1449
497
|
let inputDataToApply = null, scrollDataToApply = null;
|
|
1450
498
|
switch (newTree.RRNodeType) {
|
|
1451
|
-
case NodeType
|
|
499
|
+
case rrwebSnapshot.NodeType.Document: {
|
|
1452
500
|
const newRRDocument = newTree;
|
|
1453
501
|
scrollDataToApply = newRRDocument.scrollData;
|
|
1454
502
|
break;
|
|
1455
503
|
}
|
|
1456
|
-
case NodeType
|
|
504
|
+
case rrwebSnapshot.NodeType.Element: {
|
|
1457
505
|
const oldElement = oldTree;
|
|
1458
506
|
const newRRElement = newTree;
|
|
1459
507
|
diffProps(oldElement, newRRElement, rrnodeMirror);
|
|
@@ -1493,9 +541,9 @@ function diff(oldTree, newTree, replayer, rrnodeMirror) {
|
|
|
1493
541
|
}
|
|
1494
542
|
break;
|
|
1495
543
|
}
|
|
1496
|
-
case NodeType
|
|
1497
|
-
case NodeType
|
|
1498
|
-
case NodeType
|
|
544
|
+
case rrwebSnapshot.NodeType.Text:
|
|
545
|
+
case rrwebSnapshot.NodeType.Comment:
|
|
546
|
+
case rrwebSnapshot.NodeType.CDATA:
|
|
1499
547
|
if (oldTree.textContent !==
|
|
1500
548
|
newTree.data)
|
|
1501
549
|
oldTree.textContent = newTree.data;
|
|
@@ -1543,7 +591,7 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
|
|
|
1543
591
|
newTree.scrollTop && (oldTree.scrollTop = newTree.scrollTop);
|
|
1544
592
|
}
|
|
1545
593
|
function diffChildren(oldChildren, newChildren, parentNode, replayer, rrnodeMirror) {
|
|
1546
|
-
var _a
|
|
594
|
+
var _a;
|
|
1547
595
|
let oldStartIndex = 0, oldEndIndex = oldChildren.length - 1, newStartIndex = 0, newEndIndex = newChildren.length - 1;
|
|
1548
596
|
let oldStartNode = oldChildren[oldStartIndex], oldEndNode = oldChildren[oldEndIndex], newStartNode = newChildren[newStartIndex], newEndNode = newChildren[newEndIndex];
|
|
1549
597
|
let oldIdToIndex = undefined, indexInOld;
|
|
@@ -1567,24 +615,24 @@ function diffChildren(oldChildren, newChildren, parentNode, replayer, rrnodeMirr
|
|
|
1567
615
|
else if (replayer.mirror.getId(oldStartNode) === rrnodeMirror.getId(newEndNode)) {
|
|
1568
616
|
try {
|
|
1569
617
|
parentNode.insertBefore(oldStartNode, oldEndNode.nextSibling);
|
|
1570
|
-
}
|
|
1571
|
-
catch (e) {
|
|
1572
|
-
console.error(e, parentNode, oldStartNode, oldEndNode);
|
|
1573
618
|
diff(oldStartNode, newEndNode, replayer, rrnodeMirror);
|
|
1574
619
|
oldStartNode = oldChildren[++oldStartIndex];
|
|
1575
620
|
newEndNode = newChildren[--newEndIndex];
|
|
1576
621
|
}
|
|
622
|
+
catch (e) {
|
|
623
|
+
console.error(e, parentNode, oldStartNode, oldEndNode);
|
|
624
|
+
}
|
|
1577
625
|
}
|
|
1578
626
|
else if (replayer.mirror.getId(oldEndNode) === rrnodeMirror.getId(newStartNode)) {
|
|
1579
627
|
try {
|
|
1580
628
|
parentNode.insertBefore(oldEndNode, oldStartNode);
|
|
1581
|
-
}
|
|
1582
|
-
catch (e) {
|
|
1583
|
-
console.error(e, parentNode, oldEndNode, oldStartNode);
|
|
1584
629
|
diff(oldEndNode, newStartNode, replayer, rrnodeMirror);
|
|
1585
630
|
oldEndNode = oldChildren[--oldEndIndex];
|
|
1586
631
|
newStartNode = newChildren[++newStartIndex];
|
|
1587
632
|
}
|
|
633
|
+
catch (e) {
|
|
634
|
+
console.error(e, parentNode, oldEndNode, oldStartNode);
|
|
635
|
+
}
|
|
1588
636
|
}
|
|
1589
637
|
else {
|
|
1590
638
|
if (!oldIdToIndex) {
|
|
@@ -1600,17 +648,17 @@ function diffChildren(oldChildren, newChildren, parentNode, replayer, rrnodeMirr
|
|
|
1600
648
|
const nodeToMove = oldChildren[indexInOld];
|
|
1601
649
|
try {
|
|
1602
650
|
parentNode.insertBefore(nodeToMove, oldStartNode);
|
|
651
|
+
diff(nodeToMove, newStartNode, replayer, rrnodeMirror);
|
|
652
|
+
oldChildren[indexInOld] = undefined;
|
|
1603
653
|
}
|
|
1604
654
|
catch (e) {
|
|
1605
655
|
console.error(e, parentNode, nodeToMove, oldStartNode);
|
|
1606
|
-
diff(nodeToMove, newStartNode, replayer, rrnodeMirror);
|
|
1607
|
-
oldChildren[indexInOld] = undefined;
|
|
1608
656
|
}
|
|
1609
657
|
}
|
|
1610
658
|
else {
|
|
1611
659
|
const newNode = createOrGetNode(newStartNode, replayer.mirror, rrnodeMirror);
|
|
1612
|
-
if (
|
|
1613
|
-
((
|
|
660
|
+
if (parentNode.nodeName === '#document' &&
|
|
661
|
+
((_a = replayer.mirror.getMeta(newNode)) === null || _a === void 0 ? void 0 : _a.type) === rrwebSnapshot.NodeType.Element &&
|
|
1614
662
|
parentNode.documentElement) {
|
|
1615
663
|
parentNode.removeChild(parentNode.documentElement);
|
|
1616
664
|
oldChildren[oldStartIndex] = undefined;
|
|
@@ -1618,10 +666,10 @@ function diffChildren(oldChildren, newChildren, parentNode, replayer, rrnodeMirr
|
|
|
1618
666
|
}
|
|
1619
667
|
try {
|
|
1620
668
|
parentNode.insertBefore(newNode, oldStartNode || null);
|
|
669
|
+
diff(newNode, newStartNode, replayer, rrnodeMirror);
|
|
1621
670
|
}
|
|
1622
671
|
catch (e) {
|
|
1623
672
|
console.error(e, parentNode, newNode, oldStartNode || null);
|
|
1624
|
-
diff(newNode, newStartNode, replayer, rrnodeMirror);
|
|
1625
673
|
}
|
|
1626
674
|
}
|
|
1627
675
|
newStartNode = newChildren[++newStartIndex];
|
|
@@ -1639,10 +687,10 @@ function diffChildren(oldChildren, newChildren, parentNode, replayer, rrnodeMirr
|
|
|
1639
687
|
const newNode = createOrGetNode(newChildren[newStartIndex], replayer.mirror, rrnodeMirror);
|
|
1640
688
|
try {
|
|
1641
689
|
parentNode.insertBefore(newNode, referenceNode);
|
|
690
|
+
diff(newNode, newChildren[newStartIndex], replayer, rrnodeMirror);
|
|
1642
691
|
}
|
|
1643
692
|
catch (e) {
|
|
1644
693
|
console.error(e, parentNode, newNode, referenceNode);
|
|
1645
|
-
diff(newNode, newChildren[newStartIndex], replayer, rrnodeMirror);
|
|
1646
694
|
}
|
|
1647
695
|
}
|
|
1648
696
|
}
|
|
@@ -1662,13 +710,13 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
|
1662
710
|
if (node !== null)
|
|
1663
711
|
return node;
|
|
1664
712
|
switch (rrNode.RRNodeType) {
|
|
1665
|
-
case NodeType
|
|
713
|
+
case rrwebSnapshot.NodeType.Document:
|
|
1666
714
|
node = new Document();
|
|
1667
715
|
break;
|
|
1668
|
-
case NodeType
|
|
716
|
+
case rrwebSnapshot.NodeType.DocumentType:
|
|
1669
717
|
node = document.implementation.createDocumentType(rrNode.name, rrNode.publicId, rrNode.systemId);
|
|
1670
718
|
break;
|
|
1671
|
-
case NodeType
|
|
719
|
+
case rrwebSnapshot.NodeType.Element: {
|
|
1672
720
|
rrNode.tagName.toLowerCase();
|
|
1673
721
|
if (sn && 'isSVG' in sn && (sn === null || sn === void 0 ? void 0 : sn.isSVG)) {
|
|
1674
722
|
node = document.createElementNS(NAMESPACES['svg'], rrNode.tagName.toLowerCase());
|
|
@@ -1677,13 +725,13 @@ function createOrGetNode(rrNode, domMirror, rrnodeMirror) {
|
|
|
1677
725
|
node = document.createElement(rrNode.tagName);
|
|
1678
726
|
break;
|
|
1679
727
|
}
|
|
1680
|
-
case NodeType
|
|
728
|
+
case rrwebSnapshot.NodeType.Text:
|
|
1681
729
|
node = document.createTextNode(rrNode.data);
|
|
1682
730
|
break;
|
|
1683
|
-
case NodeType
|
|
731
|
+
case rrwebSnapshot.NodeType.Comment:
|
|
1684
732
|
node = document.createComment(rrNode.data);
|
|
1685
733
|
break;
|
|
1686
|
-
case NodeType
|
|
734
|
+
case rrwebSnapshot.NodeType.CDATA:
|
|
1687
735
|
node = document.createCDATASection(rrNode.data);
|
|
1688
736
|
break;
|
|
1689
737
|
}
|
|
@@ -1916,7 +964,7 @@ function buildFromNode(node, rrdom, domMirror, parentRRNode) {
|
|
|
1916
964
|
}
|
|
1917
965
|
return rrNode;
|
|
1918
966
|
}
|
|
1919
|
-
function buildFromDom(dom, domMirror = createMirror
|
|
967
|
+
function buildFromDom(dom, domMirror = rrwebSnapshot.createMirror(), rrdom = new RRDocument()) {
|
|
1920
968
|
function walk(node, parentRRNode) {
|
|
1921
969
|
const rrNode = buildFromNode(node, rrdom, domMirror, parentRRNode);
|
|
1922
970
|
if (rrNode === null)
|
|
@@ -1994,13 +1042,13 @@ class Mirror {
|
|
|
1994
1042
|
}
|
|
1995
1043
|
function getDefaultSN(node, id) {
|
|
1996
1044
|
switch (node.RRNodeType) {
|
|
1997
|
-
case NodeType
|
|
1045
|
+
case rrwebSnapshot.NodeType.Document:
|
|
1998
1046
|
return {
|
|
1999
1047
|
id,
|
|
2000
1048
|
type: node.RRNodeType,
|
|
2001
1049
|
childNodes: [],
|
|
2002
1050
|
};
|
|
2003
|
-
case NodeType
|
|
1051
|
+
case rrwebSnapshot.NodeType.DocumentType:
|
|
2004
1052
|
const doctype = node;
|
|
2005
1053
|
return {
|
|
2006
1054
|
id,
|
|
@@ -2009,7 +1057,7 @@ function getDefaultSN(node, id) {
|
|
|
2009
1057
|
publicId: doctype.publicId,
|
|
2010
1058
|
systemId: doctype.systemId,
|
|
2011
1059
|
};
|
|
2012
|
-
case NodeType
|
|
1060
|
+
case rrwebSnapshot.NodeType.Element:
|
|
2013
1061
|
return {
|
|
2014
1062
|
id,
|
|
2015
1063
|
type: node.RRNodeType,
|
|
@@ -2017,19 +1065,19 @@ function getDefaultSN(node, id) {
|
|
|
2017
1065
|
attributes: {},
|
|
2018
1066
|
childNodes: [],
|
|
2019
1067
|
};
|
|
2020
|
-
case NodeType
|
|
1068
|
+
case rrwebSnapshot.NodeType.Text:
|
|
2021
1069
|
return {
|
|
2022
1070
|
id,
|
|
2023
1071
|
type: node.RRNodeType,
|
|
2024
1072
|
textContent: node.textContent || '',
|
|
2025
1073
|
};
|
|
2026
|
-
case NodeType
|
|
1074
|
+
case rrwebSnapshot.NodeType.Comment:
|
|
2027
1075
|
return {
|
|
2028
1076
|
id,
|
|
2029
1077
|
type: node.RRNodeType,
|
|
2030
1078
|
textContent: node.textContent || '',
|
|
2031
1079
|
};
|
|
2032
|
-
case NodeType
|
|
1080
|
+
case rrwebSnapshot.NodeType.CDATA:
|
|
2033
1081
|
return {
|
|
2034
1082
|
id,
|
|
2035
1083
|
type: node.RRNodeType,
|
|
@@ -3182,10 +2230,10 @@ class Replayer {
|
|
|
3182
2230
|
this.emitter = mitt();
|
|
3183
2231
|
this.activityIntervals = [];
|
|
3184
2232
|
this.legacy_missingNodeRetryMap = {};
|
|
3185
|
-
this.cache = createCache();
|
|
2233
|
+
this.cache = rrwebSnapshot.createCache();
|
|
3186
2234
|
this.imageMap = new Map();
|
|
3187
2235
|
this.canvasEventMap = new Map();
|
|
3188
|
-
this.mirror = createMirror
|
|
2236
|
+
this.mirror = rrwebSnapshot.createMirror();
|
|
3189
2237
|
this.firstFullSnapshot = null;
|
|
3190
2238
|
this.newDocumentQueue = [];
|
|
3191
2239
|
this.mousePos = null;
|
|
@@ -3527,7 +2575,7 @@ class Replayer {
|
|
|
3527
2575
|
this.iframe.style.pointerEvents = 'none';
|
|
3528
2576
|
}
|
|
3529
2577
|
resetCache() {
|
|
3530
|
-
this.cache = createCache();
|
|
2578
|
+
this.cache = rrwebSnapshot.createCache();
|
|
3531
2579
|
}
|
|
3532
2580
|
setupDom() {
|
|
3533
2581
|
this.wrapper = document.createElement('div');
|
|
@@ -3729,7 +2777,7 @@ class Replayer {
|
|
|
3729
2777
|
}
|
|
3730
2778
|
this.legacy_missingNodeRetryMap = {};
|
|
3731
2779
|
const collected = [];
|
|
3732
|
-
rebuild(event.data.node, {
|
|
2780
|
+
rrwebSnapshot.rebuild(event.data.node, {
|
|
3733
2781
|
doc: this.iframe.contentDocument,
|
|
3734
2782
|
afterAppend: (builtNode) => {
|
|
3735
2783
|
this.collectIframeAndAttachDocument(collected, builtNode);
|
|
@@ -3786,7 +2834,7 @@ class Replayer {
|
|
|
3786
2834
|
? this.virtualDom.mirror
|
|
3787
2835
|
: this.mirror;
|
|
3788
2836
|
const collected = [];
|
|
3789
|
-
buildNodeWithSN(mutation.node, {
|
|
2837
|
+
rrwebSnapshot.buildNodeWithSN(mutation.node, {
|
|
3790
2838
|
doc: iframeEl.contentDocument,
|
|
3791
2839
|
mirror: mirror,
|
|
3792
2840
|
hackCss: true,
|
|
@@ -3794,7 +2842,7 @@ class Replayer {
|
|
|
3794
2842
|
afterAppend: (builtNode) => {
|
|
3795
2843
|
this.collectIframeAndAttachDocument(collected, builtNode);
|
|
3796
2844
|
const sn = mirror.getMeta(builtNode);
|
|
3797
|
-
if ((sn === null || sn === void 0 ? void 0 : sn.type) === NodeType
|
|
2845
|
+
if ((sn === null || sn === void 0 ? void 0 : sn.type) === rrwebSnapshot.NodeType.Element &&
|
|
3798
2846
|
(sn === null || sn === void 0 ? void 0 : sn.tagName.toUpperCase()) === 'HTML') {
|
|
3799
2847
|
const { documentElement, head } = iframeEl.contentDocument;
|
|
3800
2848
|
this.insertStyleRules(documentElement, head);
|
|
@@ -4348,7 +3396,7 @@ class Replayer {
|
|
|
4348
3396
|
}
|
|
4349
3397
|
let parent = mirror.getNode(mutation.parentId);
|
|
4350
3398
|
if (!parent) {
|
|
4351
|
-
if (mutation.node.type === NodeType
|
|
3399
|
+
if (mutation.node.type === rrwebSnapshot.NodeType.Document) {
|
|
4352
3400
|
return this.newDocumentQueue.push(mutation);
|
|
4353
3401
|
}
|
|
4354
3402
|
return queue.push(mutation);
|
|
@@ -4384,7 +3432,7 @@ class Replayer {
|
|
|
4384
3432
|
this.attachDocumentToIframe(mutation, parent);
|
|
4385
3433
|
return;
|
|
4386
3434
|
}
|
|
4387
|
-
const target = buildNodeWithSN(mutation.node, {
|
|
3435
|
+
const target = rrwebSnapshot.buildNodeWithSN(mutation.node, {
|
|
4388
3436
|
doc: targetDoc,
|
|
4389
3437
|
mirror: mirror,
|
|
4390
3438
|
skipChild: true,
|
|
@@ -4400,9 +3448,9 @@ class Replayer {
|
|
|
4400
3448
|
}
|
|
4401
3449
|
const parentSn = mirror.getMeta(parent);
|
|
4402
3450
|
if (parentSn &&
|
|
4403
|
-
parentSn.type === NodeType
|
|
3451
|
+
parentSn.type === rrwebSnapshot.NodeType.Element &&
|
|
4404
3452
|
parentSn.tagName === 'textarea' &&
|
|
4405
|
-
mutation.node.type === NodeType
|
|
3453
|
+
mutation.node.type === rrwebSnapshot.NodeType.Text) {
|
|
4406
3454
|
const childNodeArray = Array.isArray(parent.childNodes)
|
|
4407
3455
|
? parent.childNodes
|
|
4408
3456
|
: Array.from(parent.childNodes);
|
|
@@ -4545,7 +3593,7 @@ class Replayer {
|
|
|
4545
3593
|
behavior: isSync ? 'auto' : 'smooth',
|
|
4546
3594
|
});
|
|
4547
3595
|
}
|
|
4548
|
-
else if ((sn === null || sn === void 0 ? void 0 : sn.type) === NodeType
|
|
3596
|
+
else if ((sn === null || sn === void 0 ? void 0 : sn.type) === rrwebSnapshot.NodeType.Document) {
|
|
4549
3597
|
target.defaultView.scrollTo({
|
|
4550
3598
|
top: d.y,
|
|
4551
3599
|
left: d.x,
|