@highlight-run/rrweb 2.0.1 → 2.0.6
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 +12 -655
- package/dist/plugins/console-record.min.js +12 -15
- package/dist/plugins/console-record.min.js.map +1 -1
- package/dist/plugins/console-replay.js +4 -293
- package/dist/plugins/console-replay.min.js +4 -15
- package/dist/plugins/console-replay.min.js.map +1 -1
- package/dist/plugins/sequential-id-record.js +1 -33
- package/dist/plugins/sequential-id-record.min.js +1 -1
- package/dist/plugins/sequential-id-record.min.js.map +1 -1
- package/dist/plugins/sequential-id-replay.js +1 -37
- package/dist/plugins/sequential-id-replay.min.js +1 -1
- package/dist/plugins/sequential-id-replay.min.js.map +1 -1
- package/dist/record/rrweb-record-pack.js +3 -747
- package/dist/record/rrweb-record-pack.min.js +3 -15
- package/dist/record/rrweb-record-pack.min.js.map +1 -1
- package/dist/record/rrweb-record.js +4 -3318
- package/dist/record/rrweb-record.min.js +4 -15
- package/dist/record/rrweb-record.min.js.map +1 -1
- package/dist/replay/rrweb-replay-unpack.css +1 -0
- package/dist/replay/rrweb-replay-unpack.js +5 -4614
- package/dist/replay/rrweb-replay-unpack.min.js +5 -17
- package/dist/replay/rrweb-replay-unpack.min.js.map +1 -1
- package/dist/replay/rrweb-replay.css +1 -0
- package/dist/replay/rrweb-replay.js +5 -4204
- package/dist/replay/rrweb-replay.min.js +5 -17
- package/dist/replay/rrweb-replay.min.js.map +1 -1
- package/dist/rrweb-all.css +1 -0
- package/dist/rrweb-all.js +16 -8696
- package/dist/rrweb-all.min.js +16 -17
- package/dist/rrweb-all.min.js.map +1 -1
- package/dist/rrweb.css +1 -0
- package/dist/rrweb.js +6 -7282
- package/dist/rrweb.min.js +6 -17
- package/dist/rrweb.min.js.map +1 -1
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__createBase64WorkerFactory.js +12 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__auto__isNodeJS.js +7 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__browser__createBase64WorkerFactory.js +31 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__WorkerClass.js +11 -0
- package/es/rrweb/_virtual/_rollup-plugin-web-worker-loader__helper__node__createBase64WorkerFactory.js +18 -0
- package/es/rrweb/_virtual/image-bitmap-data-url-worker.js +6 -0
- package/es/rrweb/all.css +1 -0
- package/es/rrweb/ext/mitt/dist/mitt.es.js +1 -1
- package/es/rrweb/ext/tslib/tslib.es6.js +38 -0
- package/es/rrweb/packages/rrdom/es/virtual-dom.js +1099 -0
- package/es/rrweb/packages/rrweb/src/index.js +6 -4
- package/es/rrweb/packages/rrweb/src/packer/base.js +1 -1
- package/es/rrweb/packages/rrweb/src/packer/pack.js +4 -5
- package/es/rrweb/packages/rrweb/src/packer/unpack.js +24 -24
- package/es/rrweb/packages/rrweb/src/plugins/console/record/error-stack-parser.js +175 -176
- package/es/rrweb/packages/rrweb/src/plugins/console/record/index.js +109 -128
- package/es/rrweb/packages/rrweb/src/plugins/console/record/stringify.js +125 -138
- package/es/rrweb/packages/rrweb/src/plugins/console/replay/index.js +88 -105
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/record/index.js +19 -20
- package/es/rrweb/packages/rrweb/src/plugins/sequential-id/replay/index.js +25 -25
- package/es/rrweb/packages/rrweb/src/record/iframe-manager.js +29 -30
- package/es/rrweb/packages/rrweb/src/record/index.js +348 -373
- package/es/rrweb/packages/rrweb/src/record/mutation.js +487 -528
- package/es/rrweb/packages/rrweb/src/record/observer.js +584 -659
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/2d.js +44 -73
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas-manager.js +166 -87
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/canvas.js +21 -26
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/serialize-args.js +119 -112
- package/es/rrweb/packages/rrweb/src/record/observers/canvas/webgl.js +53 -72
- package/es/rrweb/packages/rrweb/src/record/shadow-dom-manager.js +38 -40
- package/es/rrweb/packages/rrweb/src/record/stylesheet-manager.js +31 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/2d.js +27 -23
- package/es/rrweb/packages/rrweb/src/replay/canvas/deserialize-args.js +67 -0
- package/es/rrweb/packages/rrweb/src/replay/canvas/index.js +37 -29
- package/es/rrweb/packages/rrweb/src/replay/canvas/webgl.js +58 -120
- package/es/rrweb/packages/rrweb/src/replay/index.js +1545 -1854
- package/es/rrweb/packages/rrweb/src/replay/machine.js +275 -315
- package/es/rrweb/packages/rrweb/src/replay/smoothscroll.js +216 -218
- package/es/rrweb/packages/rrweb/src/replay/styles/inject-style.js +7 -7
- package/es/rrweb/packages/rrweb/src/replay/timer.js +87 -91
- package/es/rrweb/packages/rrweb/src/types.js +72 -72
- package/es/rrweb/packages/rrweb/src/utils.js +312 -506
- package/es/rrweb/packages/rrweb-snapshot/es/rrweb-snapshot.js +190 -72
- package/lib/plugins/console-record.js +469 -627
- package/lib/plugins/console-replay.js +198 -268
- package/lib/plugins/sequential-id-record.js +19 -20
- package/lib/plugins/sequential-id-replay.js +25 -25
- package/lib/record/rrweb-record-pack.js +184 -139
- package/lib/record/rrweb-record.js +2467 -2425
- package/lib/replay/rrweb-replay-unpack.css +1 -0
- package/lib/replay/rrweb-replay-unpack.js +3798 -3344
- package/lib/replay/rrweb-replay.css +1 -0
- package/lib/replay/rrweb-replay.js +3743 -3289
- package/lib/rrweb-all.css +1 -0
- package/lib/rrweb-all.js +6721 -6249
- package/lib/rrweb.css +1 -0
- package/lib/rrweb.js +6151 -5632
- package/package.json +14 -13
- package/typings/packer/base.d.ts +1 -1
- package/typings/plugins/console/record/index.d.ts +1 -1
- package/typings/plugins/console/record/stringify.d.ts +1 -1
- package/typings/plugins/sequential-id/record/index.d.ts +1 -1
- package/typings/plugins/sequential-id/replay/index.d.ts +1 -1
- package/typings/record/iframe-manager.d.ts +3 -3
- package/typings/record/index.d.ts +1 -1
- package/typings/record/mutation.d.ts +2 -1
- package/typings/record/observers/canvas/2d.d.ts +2 -1
- package/typings/record/observers/canvas/canvas-manager.d.ts +5 -2
- package/typings/record/observers/canvas/canvas.d.ts +1 -1
- package/typings/record/observers/canvas/serialize-args.d.ts +5 -5
- package/typings/record/observers/canvas/webgl.d.ts +2 -1
- package/typings/record/shadow-dom-manager.d.ts +2 -1
- package/typings/record/stylesheet-manager.d.ts +12 -0
- package/typings/record/workers/image-bitmap-data-url-worker.d.ts +5 -0
- package/typings/replay/canvas/2d.d.ts +3 -3
- package/typings/replay/canvas/deserialize-args.d.ts +7 -0
- package/typings/replay/canvas/index.d.ts +4 -3
- package/typings/replay/canvas/webgl.d.ts +3 -5
- package/typings/replay/index.d.ts +7 -10
- package/typings/types.d.ts +45 -17
- package/typings/utils.d.ts +17 -44
- package/es/rrweb/packages/rrweb/ext/tslib/tslib.es6.js +0 -78
- package/es/rrweb/packages/rrweb/src/replay/virtual-styles.js +0 -121
- package/typings/replay/virtual-styles.d.ts +0 -43
|
@@ -1,1352 +1,5 @@
|
|
|
1
|
-
var rrwebReplay = (function (
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
/*! *****************************************************************************
|
|
5
|
-
Copyright (c) Microsoft Corporation.
|
|
6
|
-
|
|
7
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
8
|
-
purpose with or without fee is hereby granted.
|
|
9
|
-
|
|
10
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
11
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
12
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
13
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
14
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
15
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
16
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
17
|
-
***************************************************************************** */
|
|
18
|
-
|
|
19
|
-
var __assign = function() {
|
|
20
|
-
__assign = Object.assign || function __assign(t) {
|
|
21
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
22
|
-
s = arguments[i];
|
|
23
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
24
|
-
}
|
|
25
|
-
return t;
|
|
26
|
-
};
|
|
27
|
-
return __assign.apply(this, arguments);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
function __values(o) {
|
|
31
|
-
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
32
|
-
if (m) return m.call(o);
|
|
33
|
-
if (o && typeof o.length === "number") return {
|
|
34
|
-
next: function () {
|
|
35
|
-
if (o && i >= o.length) o = void 0;
|
|
36
|
-
return { value: o && o[i++], done: !o };
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function __read(o, n) {
|
|
43
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
44
|
-
if (!m) return o;
|
|
45
|
-
var i = m.call(o), r, ar = [], e;
|
|
46
|
-
try {
|
|
47
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
48
|
-
}
|
|
49
|
-
catch (error) { e = { error: error }; }
|
|
50
|
-
finally {
|
|
51
|
-
try {
|
|
52
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
53
|
-
}
|
|
54
|
-
finally { if (e) throw e.error; }
|
|
55
|
-
}
|
|
56
|
-
return ar;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function __spreadArray(to, from, pack) {
|
|
60
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
61
|
-
if (ar || !(i in from)) {
|
|
62
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
63
|
-
ar[i] = from[i];
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
var NodeType;
|
|
70
|
-
(function (NodeType) {
|
|
71
|
-
NodeType[NodeType["Document"] = 0] = "Document";
|
|
72
|
-
NodeType[NodeType["DocumentType"] = 1] = "DocumentType";
|
|
73
|
-
NodeType[NodeType["Element"] = 2] = "Element";
|
|
74
|
-
NodeType[NodeType["Text"] = 3] = "Text";
|
|
75
|
-
NodeType[NodeType["CDATA"] = 4] = "CDATA";
|
|
76
|
-
NodeType[NodeType["Comment"] = 5] = "Comment";
|
|
77
|
-
})(NodeType || (NodeType = {}));
|
|
78
|
-
|
|
79
|
-
function isElement(n) {
|
|
80
|
-
return n.nodeType === n.ELEMENT_NODE;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
var commentre = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;
|
|
84
|
-
function parse(css, options) {
|
|
85
|
-
if (options === void 0) { options = {}; }
|
|
86
|
-
var lineno = 1;
|
|
87
|
-
var column = 1;
|
|
88
|
-
function updatePosition(str) {
|
|
89
|
-
var lines = str.match(/\n/g);
|
|
90
|
-
if (lines) {
|
|
91
|
-
lineno += lines.length;
|
|
92
|
-
}
|
|
93
|
-
var i = str.lastIndexOf('\n');
|
|
94
|
-
column = i === -1 ? column + str.length : str.length - i;
|
|
95
|
-
}
|
|
96
|
-
function position() {
|
|
97
|
-
var start = { line: lineno, column: column };
|
|
98
|
-
return function (node) {
|
|
99
|
-
node.position = new Position(start);
|
|
100
|
-
whitespace();
|
|
101
|
-
return node;
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
var Position = (function () {
|
|
105
|
-
function Position(start) {
|
|
106
|
-
this.start = start;
|
|
107
|
-
this.end = { line: lineno, column: column };
|
|
108
|
-
this.source = options.source;
|
|
109
|
-
}
|
|
110
|
-
return Position;
|
|
111
|
-
}());
|
|
112
|
-
Position.prototype.content = css;
|
|
113
|
-
var errorsList = [];
|
|
114
|
-
function error(msg) {
|
|
115
|
-
var err = new Error(options.source + ':' + lineno + ':' + column + ': ' + msg);
|
|
116
|
-
err.reason = msg;
|
|
117
|
-
err.filename = options.source;
|
|
118
|
-
err.line = lineno;
|
|
119
|
-
err.column = column;
|
|
120
|
-
err.source = css;
|
|
121
|
-
if (options.silent) {
|
|
122
|
-
errorsList.push(err);
|
|
123
|
-
}
|
|
124
|
-
else {
|
|
125
|
-
throw err;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
function stylesheet() {
|
|
129
|
-
var rulesList = rules();
|
|
130
|
-
return {
|
|
131
|
-
type: 'stylesheet',
|
|
132
|
-
stylesheet: {
|
|
133
|
-
source: options.source,
|
|
134
|
-
rules: rulesList,
|
|
135
|
-
parsingErrors: errorsList
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
function open() {
|
|
140
|
-
return match(/^{\s*/);
|
|
141
|
-
}
|
|
142
|
-
function close() {
|
|
143
|
-
return match(/^}/);
|
|
144
|
-
}
|
|
145
|
-
function rules() {
|
|
146
|
-
var node;
|
|
147
|
-
var rules = [];
|
|
148
|
-
whitespace();
|
|
149
|
-
comments(rules);
|
|
150
|
-
while (css.length && css.charAt(0) !== '}' && (node = atrule() || rule())) {
|
|
151
|
-
if (node !== false) {
|
|
152
|
-
rules.push(node);
|
|
153
|
-
comments(rules);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return rules;
|
|
157
|
-
}
|
|
158
|
-
function match(re) {
|
|
159
|
-
var m = re.exec(css);
|
|
160
|
-
if (!m) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
var str = m[0];
|
|
164
|
-
updatePosition(str);
|
|
165
|
-
css = css.slice(str.length);
|
|
166
|
-
return m;
|
|
167
|
-
}
|
|
168
|
-
function whitespace() {
|
|
169
|
-
match(/^\s*/);
|
|
170
|
-
}
|
|
171
|
-
function comments(rules) {
|
|
172
|
-
if (rules === void 0) { rules = []; }
|
|
173
|
-
var c;
|
|
174
|
-
while ((c = comment())) {
|
|
175
|
-
if (c !== false) {
|
|
176
|
-
rules.push(c);
|
|
177
|
-
}
|
|
178
|
-
c = comment();
|
|
179
|
-
}
|
|
180
|
-
return rules;
|
|
181
|
-
}
|
|
182
|
-
function comment() {
|
|
183
|
-
var pos = position();
|
|
184
|
-
if ('/' !== css.charAt(0) || '*' !== css.charAt(1)) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
var i = 2;
|
|
188
|
-
while ('' !== css.charAt(i) &&
|
|
189
|
-
('*' !== css.charAt(i) || '/' !== css.charAt(i + 1))) {
|
|
190
|
-
++i;
|
|
191
|
-
}
|
|
192
|
-
i += 2;
|
|
193
|
-
if ('' === css.charAt(i - 1)) {
|
|
194
|
-
return error('End of comment missing');
|
|
195
|
-
}
|
|
196
|
-
var str = css.slice(2, i - 2);
|
|
197
|
-
column += 2;
|
|
198
|
-
updatePosition(str);
|
|
199
|
-
css = css.slice(i);
|
|
200
|
-
column += 2;
|
|
201
|
-
return pos({
|
|
202
|
-
type: 'comment',
|
|
203
|
-
comment: str
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
function selector() {
|
|
207
|
-
var m = match(/^([^{]+)/);
|
|
208
|
-
if (!m) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
return trim(m[0])
|
|
212
|
-
.replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g, '')
|
|
213
|
-
.replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g, function (m) {
|
|
214
|
-
return m.replace(/,/g, '\u200C');
|
|
215
|
-
})
|
|
216
|
-
.split(/\s*(?![^(]*\)),\s*/)
|
|
217
|
-
.map(function (s) {
|
|
218
|
-
return s.replace(/\u200C/g, ',');
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
function declaration() {
|
|
222
|
-
var pos = position();
|
|
223
|
-
var propMatch = match(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);
|
|
224
|
-
if (!propMatch) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
var prop = trim(propMatch[0]);
|
|
228
|
-
if (!match(/^:\s*/)) {
|
|
229
|
-
return error("property missing ':'");
|
|
230
|
-
}
|
|
231
|
-
var val = match(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/);
|
|
232
|
-
var ret = pos({
|
|
233
|
-
type: 'declaration',
|
|
234
|
-
property: prop.replace(commentre, ''),
|
|
235
|
-
value: val ? trim(val[0]).replace(commentre, '') : ''
|
|
236
|
-
});
|
|
237
|
-
match(/^[;\s]*/);
|
|
238
|
-
return ret;
|
|
239
|
-
}
|
|
240
|
-
function declarations() {
|
|
241
|
-
var decls = [];
|
|
242
|
-
if (!open()) {
|
|
243
|
-
return error("missing '{'");
|
|
244
|
-
}
|
|
245
|
-
comments(decls);
|
|
246
|
-
var decl;
|
|
247
|
-
while ((decl = declaration())) {
|
|
248
|
-
if (decl !== false) {
|
|
249
|
-
decls.push(decl);
|
|
250
|
-
comments(decls);
|
|
251
|
-
}
|
|
252
|
-
decl = declaration();
|
|
253
|
-
}
|
|
254
|
-
if (!close()) {
|
|
255
|
-
return error("missing '}'");
|
|
256
|
-
}
|
|
257
|
-
return decls;
|
|
258
|
-
}
|
|
259
|
-
function keyframe() {
|
|
260
|
-
var m;
|
|
261
|
-
var vals = [];
|
|
262
|
-
var pos = position();
|
|
263
|
-
while ((m = match(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/))) {
|
|
264
|
-
vals.push(m[1]);
|
|
265
|
-
match(/^,\s*/);
|
|
266
|
-
}
|
|
267
|
-
if (!vals.length) {
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
return pos({
|
|
271
|
-
type: 'keyframe',
|
|
272
|
-
values: vals,
|
|
273
|
-
declarations: declarations()
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
function atkeyframes() {
|
|
277
|
-
var pos = position();
|
|
278
|
-
var m = match(/^@([-\w]+)?keyframes\s*/);
|
|
279
|
-
if (!m) {
|
|
280
|
-
return;
|
|
281
|
-
}
|
|
282
|
-
var vendor = m[1];
|
|
283
|
-
m = match(/^([-\w]+)\s*/);
|
|
284
|
-
if (!m) {
|
|
285
|
-
return error('@keyframes missing name');
|
|
286
|
-
}
|
|
287
|
-
var name = m[1];
|
|
288
|
-
if (!open()) {
|
|
289
|
-
return error("@keyframes missing '{'");
|
|
290
|
-
}
|
|
291
|
-
var frame;
|
|
292
|
-
var frames = comments();
|
|
293
|
-
while ((frame = keyframe())) {
|
|
294
|
-
frames.push(frame);
|
|
295
|
-
frames = frames.concat(comments());
|
|
296
|
-
}
|
|
297
|
-
if (!close()) {
|
|
298
|
-
return error("@keyframes missing '}'");
|
|
299
|
-
}
|
|
300
|
-
return pos({
|
|
301
|
-
type: 'keyframes',
|
|
302
|
-
name: name,
|
|
303
|
-
vendor: vendor,
|
|
304
|
-
keyframes: frames
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
function atsupports() {
|
|
308
|
-
var pos = position();
|
|
309
|
-
var m = match(/^@supports *([^{]+)/);
|
|
310
|
-
if (!m) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
var supports = trim(m[1]);
|
|
314
|
-
if (!open()) {
|
|
315
|
-
return error("@supports missing '{'");
|
|
316
|
-
}
|
|
317
|
-
var style = comments().concat(rules());
|
|
318
|
-
if (!close()) {
|
|
319
|
-
return error("@supports missing '}'");
|
|
320
|
-
}
|
|
321
|
-
return pos({
|
|
322
|
-
type: 'supports',
|
|
323
|
-
supports: supports,
|
|
324
|
-
rules: style
|
|
325
|
-
});
|
|
326
|
-
}
|
|
327
|
-
function athost() {
|
|
328
|
-
var pos = position();
|
|
329
|
-
var m = match(/^@host\s*/);
|
|
330
|
-
if (!m) {
|
|
331
|
-
return;
|
|
332
|
-
}
|
|
333
|
-
if (!open()) {
|
|
334
|
-
return error("@host missing '{'");
|
|
335
|
-
}
|
|
336
|
-
var style = comments().concat(rules());
|
|
337
|
-
if (!close()) {
|
|
338
|
-
return error("@host missing '}'");
|
|
339
|
-
}
|
|
340
|
-
return pos({
|
|
341
|
-
type: 'host',
|
|
342
|
-
rules: style
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
function atmedia() {
|
|
346
|
-
var pos = position();
|
|
347
|
-
var m = match(/^@media *([^{]+)/);
|
|
348
|
-
if (!m) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
var media = trim(m[1]);
|
|
352
|
-
if (!open()) {
|
|
353
|
-
return error("@media missing '{'");
|
|
354
|
-
}
|
|
355
|
-
var style = comments().concat(rules());
|
|
356
|
-
if (!close()) {
|
|
357
|
-
return error("@media missing '}'");
|
|
358
|
-
}
|
|
359
|
-
return pos({
|
|
360
|
-
type: 'media',
|
|
361
|
-
media: media,
|
|
362
|
-
rules: style
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
function atcustommedia() {
|
|
366
|
-
var pos = position();
|
|
367
|
-
var m = match(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);
|
|
368
|
-
if (!m) {
|
|
369
|
-
return;
|
|
370
|
-
}
|
|
371
|
-
return pos({
|
|
372
|
-
type: 'custom-media',
|
|
373
|
-
name: trim(m[1]),
|
|
374
|
-
media: trim(m[2])
|
|
375
|
-
});
|
|
376
|
-
}
|
|
377
|
-
function atpage() {
|
|
378
|
-
var pos = position();
|
|
379
|
-
var m = match(/^@page */);
|
|
380
|
-
if (!m) {
|
|
381
|
-
return;
|
|
382
|
-
}
|
|
383
|
-
var sel = selector() || [];
|
|
384
|
-
if (!open()) {
|
|
385
|
-
return error("@page missing '{'");
|
|
386
|
-
}
|
|
387
|
-
var decls = comments();
|
|
388
|
-
var decl;
|
|
389
|
-
while ((decl = declaration())) {
|
|
390
|
-
decls.push(decl);
|
|
391
|
-
decls = decls.concat(comments());
|
|
392
|
-
}
|
|
393
|
-
if (!close()) {
|
|
394
|
-
return error("@page missing '}'");
|
|
395
|
-
}
|
|
396
|
-
return pos({
|
|
397
|
-
type: 'page',
|
|
398
|
-
selectors: sel,
|
|
399
|
-
declarations: decls
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
function atdocument() {
|
|
403
|
-
var pos = position();
|
|
404
|
-
var m = match(/^@([-\w]+)?document *([^{]+)/);
|
|
405
|
-
if (!m) {
|
|
406
|
-
return;
|
|
407
|
-
}
|
|
408
|
-
var vendor = trim(m[1]);
|
|
409
|
-
var doc = trim(m[2]);
|
|
410
|
-
if (!open()) {
|
|
411
|
-
return error("@document missing '{'");
|
|
412
|
-
}
|
|
413
|
-
var style = comments().concat(rules());
|
|
414
|
-
if (!close()) {
|
|
415
|
-
return error("@document missing '}'");
|
|
416
|
-
}
|
|
417
|
-
return pos({
|
|
418
|
-
type: 'document',
|
|
419
|
-
document: doc,
|
|
420
|
-
vendor: vendor,
|
|
421
|
-
rules: style
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
function atfontface() {
|
|
425
|
-
var pos = position();
|
|
426
|
-
var m = match(/^@font-face\s*/);
|
|
427
|
-
if (!m) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
if (!open()) {
|
|
431
|
-
return error("@font-face missing '{'");
|
|
432
|
-
}
|
|
433
|
-
var decls = comments();
|
|
434
|
-
var decl;
|
|
435
|
-
while ((decl = declaration())) {
|
|
436
|
-
decls.push(decl);
|
|
437
|
-
decls = decls.concat(comments());
|
|
438
|
-
}
|
|
439
|
-
if (!close()) {
|
|
440
|
-
return error("@font-face missing '}'");
|
|
441
|
-
}
|
|
442
|
-
return pos({
|
|
443
|
-
type: 'font-face',
|
|
444
|
-
declarations: decls
|
|
445
|
-
});
|
|
446
|
-
}
|
|
447
|
-
var atimport = _compileAtrule('import');
|
|
448
|
-
var atcharset = _compileAtrule('charset');
|
|
449
|
-
var atnamespace = _compileAtrule('namespace');
|
|
450
|
-
function _compileAtrule(name) {
|
|
451
|
-
var re = new RegExp('^@' + name + '\\s*([^;]+);');
|
|
452
|
-
return function () {
|
|
453
|
-
var pos = position();
|
|
454
|
-
var m = match(re);
|
|
455
|
-
if (!m) {
|
|
456
|
-
return;
|
|
457
|
-
}
|
|
458
|
-
var ret = { type: name };
|
|
459
|
-
ret[name] = m[1].trim();
|
|
460
|
-
return pos(ret);
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
function atrule() {
|
|
464
|
-
if (css[0] !== '@') {
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
return (atkeyframes() ||
|
|
468
|
-
atmedia() ||
|
|
469
|
-
atcustommedia() ||
|
|
470
|
-
atsupports() ||
|
|
471
|
-
atimport() ||
|
|
472
|
-
atcharset() ||
|
|
473
|
-
atnamespace() ||
|
|
474
|
-
atdocument() ||
|
|
475
|
-
atpage() ||
|
|
476
|
-
athost() ||
|
|
477
|
-
atfontface());
|
|
478
|
-
}
|
|
479
|
-
function rule() {
|
|
480
|
-
var pos = position();
|
|
481
|
-
var sel = selector();
|
|
482
|
-
if (!sel) {
|
|
483
|
-
return error('selector missing');
|
|
484
|
-
}
|
|
485
|
-
comments();
|
|
486
|
-
return pos({
|
|
487
|
-
type: 'rule',
|
|
488
|
-
selectors: sel,
|
|
489
|
-
declarations: declarations()
|
|
490
|
-
});
|
|
491
|
-
}
|
|
492
|
-
return addParent(stylesheet());
|
|
493
|
-
}
|
|
494
|
-
function trim(str) {
|
|
495
|
-
return str ? str.replace(/^\s+|\s+$/g, '') : '';
|
|
496
|
-
}
|
|
497
|
-
function addParent(obj, parent) {
|
|
498
|
-
var isNode = obj && typeof obj.type === 'string';
|
|
499
|
-
var childParent = isNode ? obj : parent;
|
|
500
|
-
for (var _i = 0, _a = Object.keys(obj); _i < _a.length; _i++) {
|
|
501
|
-
var k = _a[_i];
|
|
502
|
-
var value = obj[k];
|
|
503
|
-
if (Array.isArray(value)) {
|
|
504
|
-
value.forEach(function (v) {
|
|
505
|
-
addParent(v, childParent);
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
else if (value && typeof value === 'object') {
|
|
509
|
-
addParent(value, childParent);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
if (isNode) {
|
|
513
|
-
Object.defineProperty(obj, 'parent', {
|
|
514
|
-
configurable: true,
|
|
515
|
-
writable: true,
|
|
516
|
-
enumerable: false,
|
|
517
|
-
value: parent || null
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
return obj;
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
var tagMap = {
|
|
524
|
-
script: 'noscript',
|
|
525
|
-
altglyph: 'altGlyph',
|
|
526
|
-
altglyphdef: 'altGlyphDef',
|
|
527
|
-
altglyphitem: 'altGlyphItem',
|
|
528
|
-
animatecolor: 'animateColor',
|
|
529
|
-
animatemotion: 'animateMotion',
|
|
530
|
-
animatetransform: 'animateTransform',
|
|
531
|
-
clippath: 'clipPath',
|
|
532
|
-
feblend: 'feBlend',
|
|
533
|
-
fecolormatrix: 'feColorMatrix',
|
|
534
|
-
fecomponenttransfer: 'feComponentTransfer',
|
|
535
|
-
fecomposite: 'feComposite',
|
|
536
|
-
feconvolvematrix: 'feConvolveMatrix',
|
|
537
|
-
fediffuselighting: 'feDiffuseLighting',
|
|
538
|
-
fedisplacementmap: 'feDisplacementMap',
|
|
539
|
-
fedistantlight: 'feDistantLight',
|
|
540
|
-
fedropshadow: 'feDropShadow',
|
|
541
|
-
feflood: 'feFlood',
|
|
542
|
-
fefunca: 'feFuncA',
|
|
543
|
-
fefuncb: 'feFuncB',
|
|
544
|
-
fefuncg: 'feFuncG',
|
|
545
|
-
fefuncr: 'feFuncR',
|
|
546
|
-
fegaussianblur: 'feGaussianBlur',
|
|
547
|
-
feimage: 'feImage',
|
|
548
|
-
femerge: 'feMerge',
|
|
549
|
-
femergenode: 'feMergeNode',
|
|
550
|
-
femorphology: 'feMorphology',
|
|
551
|
-
feoffset: 'feOffset',
|
|
552
|
-
fepointlight: 'fePointLight',
|
|
553
|
-
fespecularlighting: 'feSpecularLighting',
|
|
554
|
-
fespotlight: 'feSpotLight',
|
|
555
|
-
fetile: 'feTile',
|
|
556
|
-
feturbulence: 'feTurbulence',
|
|
557
|
-
foreignobject: 'foreignObject',
|
|
558
|
-
glyphref: 'glyphRef',
|
|
559
|
-
lineargradient: 'linearGradient',
|
|
560
|
-
radialgradient: 'radialGradient'
|
|
561
|
-
};
|
|
562
|
-
function getTagName(n) {
|
|
563
|
-
var tagName = tagMap[n.tagName] ? tagMap[n.tagName] : n.tagName;
|
|
564
|
-
if (tagName === 'link' && n.attributes._cssText) {
|
|
565
|
-
tagName = 'style';
|
|
566
|
-
}
|
|
567
|
-
return tagName;
|
|
568
|
-
}
|
|
569
|
-
function escapeRegExp(str) {
|
|
570
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
571
|
-
}
|
|
572
|
-
var HOVER_SELECTOR = /([^\\]):hover/;
|
|
573
|
-
var HOVER_SELECTOR_GLOBAL = new RegExp(HOVER_SELECTOR.source, 'g');
|
|
574
|
-
function addHoverClass(cssText, cache) {
|
|
575
|
-
var _a;
|
|
576
|
-
if (!((_a = window.HIG_CONFIGURATION) === null || _a === void 0 ? void 0 : _a.enableOnHoverClass)) {
|
|
577
|
-
return cssText;
|
|
578
|
-
}
|
|
579
|
-
var cachedStyle = cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.get(cssText);
|
|
580
|
-
if (cachedStyle)
|
|
581
|
-
return cachedStyle;
|
|
582
|
-
var ast = parse(cssText, {
|
|
583
|
-
silent: true
|
|
584
|
-
});
|
|
585
|
-
if (!ast.stylesheet) {
|
|
586
|
-
return cssText;
|
|
587
|
-
}
|
|
588
|
-
var selectors = [];
|
|
589
|
-
ast.stylesheet.rules.forEach(function (rule) {
|
|
590
|
-
if ('selectors' in rule) {
|
|
591
|
-
(rule.selectors || []).forEach(function (selector) {
|
|
592
|
-
if (HOVER_SELECTOR.test(selector)) {
|
|
593
|
-
selectors.push(selector);
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
});
|
|
598
|
-
if (selectors.length === 0) {
|
|
599
|
-
return cssText;
|
|
600
|
-
}
|
|
601
|
-
var selectorMatcher = new RegExp(selectors
|
|
602
|
-
.filter(function (selector, index) { return selectors.indexOf(selector) === index; })
|
|
603
|
-
.sort(function (a, b) { return b.length - a.length; })
|
|
604
|
-
.map(function (selector) {
|
|
605
|
-
return escapeRegExp(selector);
|
|
606
|
-
})
|
|
607
|
-
.join('|'), 'g');
|
|
608
|
-
var result = cssText.replace(selectorMatcher, function (selector) {
|
|
609
|
-
var newSelector = selector.replace(HOVER_SELECTOR_GLOBAL, '$1.\\:hover');
|
|
610
|
-
return selector + ", " + newSelector;
|
|
611
|
-
});
|
|
612
|
-
cache === null || cache === void 0 ? void 0 : cache.stylesWithHoverClass.set(cssText, result);
|
|
613
|
-
return result;
|
|
614
|
-
}
|
|
615
|
-
function createCache() {
|
|
616
|
-
var stylesWithHoverClass = new Map();
|
|
617
|
-
return {
|
|
618
|
-
stylesWithHoverClass: stylesWithHoverClass
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
function buildNode(n, options) {
|
|
622
|
-
var doc = options.doc, hackCss = options.hackCss, cache = options.cache;
|
|
623
|
-
switch (n.type) {
|
|
624
|
-
case NodeType.Document:
|
|
625
|
-
return doc.implementation.createDocument(null, '', null);
|
|
626
|
-
case NodeType.DocumentType:
|
|
627
|
-
return doc.implementation.createDocumentType(n.name || 'html', n.publicId, n.systemId);
|
|
628
|
-
case NodeType.Element:
|
|
629
|
-
var tagName = getTagName(n);
|
|
630
|
-
var node_1;
|
|
631
|
-
if (n.isSVG) {
|
|
632
|
-
node_1 = doc.createElementNS('http://www.w3.org/2000/svg', tagName);
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
node_1 = doc.createElement(tagName);
|
|
636
|
-
}
|
|
637
|
-
var _loop_1 = function (name_1) {
|
|
638
|
-
if (!n.attributes.hasOwnProperty(name_1)) {
|
|
639
|
-
return "continue";
|
|
640
|
-
}
|
|
641
|
-
var value = n.attributes[name_1];
|
|
642
|
-
if (tagName === 'option' && name_1 === 'selected' && value === false) {
|
|
643
|
-
return "continue";
|
|
644
|
-
}
|
|
645
|
-
value =
|
|
646
|
-
typeof value === 'boolean' || typeof value === 'number' ? '' : value;
|
|
647
|
-
if (!name_1.startsWith('rr_')) {
|
|
648
|
-
var isTextarea = tagName === 'textarea' && name_1 === 'value';
|
|
649
|
-
var isRemoteOrDynamicCss = tagName === 'style' && name_1 === '_cssText';
|
|
650
|
-
if (isRemoteOrDynamicCss && hackCss) {
|
|
651
|
-
value = addHoverClass(value, cache);
|
|
652
|
-
if (typeof value === 'string') {
|
|
653
|
-
var regex = /url\(\"https:\/\/\S*(.eot|.woff2|.ttf|.woff)\S*\"\)/gm;
|
|
654
|
-
var m = void 0;
|
|
655
|
-
var fontUrls_1 = [];
|
|
656
|
-
var PROXY_URL_1 = 'https://replay-cors-proxy.highlightrun.workers.dev';
|
|
657
|
-
while ((m = regex.exec(value)) !== null) {
|
|
658
|
-
if (m.index === regex.lastIndex) {
|
|
659
|
-
regex.lastIndex++;
|
|
660
|
-
}
|
|
661
|
-
m.forEach(function (match, groupIndex) {
|
|
662
|
-
if (groupIndex === 0) {
|
|
663
|
-
var url = match.slice(5, match.length - 2);
|
|
664
|
-
fontUrls_1.push({
|
|
665
|
-
originalUrl: url,
|
|
666
|
-
proxyUrl: url.replace(url, PROXY_URL_1 + "?url=" + url)
|
|
667
|
-
});
|
|
668
|
-
}
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
fontUrls_1.forEach(function (urlPair) {
|
|
672
|
-
value = value.replace(urlPair.originalUrl, urlPair.proxyUrl);
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
if (isTextarea || isRemoteOrDynamicCss) {
|
|
677
|
-
var child = doc.createTextNode(value);
|
|
678
|
-
for (var _i = 0, _a = Array.from(node_1.childNodes); _i < _a.length; _i++) {
|
|
679
|
-
var c = _a[_i];
|
|
680
|
-
if (c.nodeType === node_1.TEXT_NODE) {
|
|
681
|
-
node_1.removeChild(c);
|
|
682
|
-
}
|
|
683
|
-
}
|
|
684
|
-
node_1.appendChild(child);
|
|
685
|
-
return "continue";
|
|
686
|
-
}
|
|
687
|
-
try {
|
|
688
|
-
if (n.isSVG && name_1 === 'xlink:href') {
|
|
689
|
-
node_1.setAttributeNS('http://www.w3.org/1999/xlink', name_1, value);
|
|
690
|
-
}
|
|
691
|
-
else if (name_1 === 'onload' ||
|
|
692
|
-
name_1 === 'onclick' ||
|
|
693
|
-
name_1.substring(0, 7) === 'onmouse') {
|
|
694
|
-
node_1.setAttribute('_' + name_1, value);
|
|
695
|
-
}
|
|
696
|
-
else if (tagName === 'meta' &&
|
|
697
|
-
n.attributes['http-equiv'] === 'Content-Security-Policy' &&
|
|
698
|
-
name_1 === 'content') {
|
|
699
|
-
node_1.setAttribute('csp-content', value);
|
|
700
|
-
return "continue";
|
|
701
|
-
}
|
|
702
|
-
else if (tagName === 'link' &&
|
|
703
|
-
n.attributes.rel === 'preload' &&
|
|
704
|
-
n.attributes.as === 'script') {
|
|
705
|
-
}
|
|
706
|
-
else if (tagName === 'link' &&
|
|
707
|
-
n.attributes.rel === 'prefetch' &&
|
|
708
|
-
typeof n.attributes.href === 'string' &&
|
|
709
|
-
n.attributes.href.endsWith('.js')) {
|
|
710
|
-
}
|
|
711
|
-
else if (tagName === 'img' &&
|
|
712
|
-
n.attributes.srcset &&
|
|
713
|
-
n.attributes.rr_dataURL) {
|
|
714
|
-
node_1.setAttribute('rrweb-original-srcset', n.attributes.srcset);
|
|
715
|
-
}
|
|
716
|
-
else {
|
|
717
|
-
node_1.setAttribute(name_1, value);
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
catch (error) {
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
else {
|
|
724
|
-
if (tagName === 'canvas' && name_1 === 'rr_dataURL') {
|
|
725
|
-
var image_1 = document.createElement('img');
|
|
726
|
-
image_1.src = value;
|
|
727
|
-
image_1.onload = function () {
|
|
728
|
-
var ctx = node_1.getContext('2d');
|
|
729
|
-
if (ctx) {
|
|
730
|
-
ctx.drawImage(image_1, 0, 0, image_1.width, image_1.height);
|
|
731
|
-
}
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
else if (tagName === 'img' && name_1 === 'rr_dataURL') {
|
|
735
|
-
var image = node_1;
|
|
736
|
-
if (!image.currentSrc.startsWith('data:')) {
|
|
737
|
-
image.setAttribute('rrweb-original-src', n.attributes.src);
|
|
738
|
-
image.src = value;
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
if (name_1 === 'rr_width') {
|
|
742
|
-
node_1.style.width = value;
|
|
743
|
-
}
|
|
744
|
-
else if (name_1 === 'rr_height') {
|
|
745
|
-
node_1.style.height = value;
|
|
746
|
-
}
|
|
747
|
-
else if (name_1 === 'rr_mediaCurrentTime') {
|
|
748
|
-
node_1.currentTime = n.attributes
|
|
749
|
-
.rr_mediaCurrentTime;
|
|
750
|
-
}
|
|
751
|
-
else if (name_1 === 'rr_mediaState') {
|
|
752
|
-
switch (value) {
|
|
753
|
-
case 'played':
|
|
754
|
-
node_1
|
|
755
|
-
.play()["catch"](function (e) { return console.warn('media playback error', e); });
|
|
756
|
-
break;
|
|
757
|
-
case 'paused':
|
|
758
|
-
node_1.pause();
|
|
759
|
-
break;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
};
|
|
764
|
-
for (var name_1 in n.attributes) {
|
|
765
|
-
_loop_1(name_1);
|
|
766
|
-
}
|
|
767
|
-
if (n.isShadowHost) {
|
|
768
|
-
if (!node_1.shadowRoot) {
|
|
769
|
-
node_1.attachShadow({ mode: 'open' });
|
|
770
|
-
}
|
|
771
|
-
else {
|
|
772
|
-
while (node_1.shadowRoot.firstChild) {
|
|
773
|
-
node_1.shadowRoot.removeChild(node_1.shadowRoot.firstChild);
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
return node_1;
|
|
778
|
-
case NodeType.Text:
|
|
779
|
-
return doc.createTextNode(n.isStyle && hackCss
|
|
780
|
-
? addHoverClass(n.textContent, cache)
|
|
781
|
-
: n.textContent);
|
|
782
|
-
case NodeType.CDATA:
|
|
783
|
-
return doc.createCDATASection(n.textContent);
|
|
784
|
-
case NodeType.Comment:
|
|
785
|
-
return doc.createComment(n.textContent);
|
|
786
|
-
default:
|
|
787
|
-
return null;
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
function buildNodeWithSN(n, options) {
|
|
791
|
-
var doc = options.doc, map = options.map, _a = options.skipChild, skipChild = _a === void 0 ? false : _a, _b = options.hackCss, hackCss = _b === void 0 ? true : _b, afterAppend = options.afterAppend, cache = options.cache;
|
|
792
|
-
var node = buildNode(n, { doc: doc, hackCss: hackCss, cache: cache });
|
|
793
|
-
if (!node) {
|
|
794
|
-
return null;
|
|
795
|
-
}
|
|
796
|
-
if (n.rootId) {
|
|
797
|
-
console.assert(map[n.rootId] === doc, 'Target document should has the same root id.');
|
|
798
|
-
}
|
|
799
|
-
if (n.type === NodeType.Document) {
|
|
800
|
-
doc.close();
|
|
801
|
-
doc.open();
|
|
802
|
-
if (n.compatMode === 'BackCompat' &&
|
|
803
|
-
n.childNodes &&
|
|
804
|
-
n.childNodes[0].type !== NodeType.DocumentType) {
|
|
805
|
-
if (n.childNodes[0].type === NodeType.Element &&
|
|
806
|
-
'xmlns' in n.childNodes[0].attributes &&
|
|
807
|
-
n.childNodes[0].attributes.xmlns === 'http://www.w3.org/1999/xhtml') {
|
|
808
|
-
doc.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">');
|
|
809
|
-
}
|
|
810
|
-
else {
|
|
811
|
-
doc.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">');
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
node = doc;
|
|
815
|
-
}
|
|
816
|
-
node.__sn = n;
|
|
817
|
-
map[n.id] = node;
|
|
818
|
-
if ((n.type === NodeType.Document || n.type === NodeType.Element) &&
|
|
819
|
-
!skipChild) {
|
|
820
|
-
for (var _i = 0, _c = n.childNodes; _i < _c.length; _i++) {
|
|
821
|
-
var childN = _c[_i];
|
|
822
|
-
var childNode = buildNodeWithSN(childN, {
|
|
823
|
-
doc: doc,
|
|
824
|
-
map: map,
|
|
825
|
-
skipChild: false,
|
|
826
|
-
hackCss: hackCss,
|
|
827
|
-
afterAppend: afterAppend,
|
|
828
|
-
cache: cache
|
|
829
|
-
});
|
|
830
|
-
if (!childNode) {
|
|
831
|
-
console.warn('Failed to rebuild', childN);
|
|
832
|
-
continue;
|
|
833
|
-
}
|
|
834
|
-
if (childN.isShadow && isElement(node) && node.shadowRoot) {
|
|
835
|
-
node.shadowRoot.appendChild(childNode);
|
|
836
|
-
}
|
|
837
|
-
else {
|
|
838
|
-
node.appendChild(childNode);
|
|
839
|
-
}
|
|
840
|
-
if (afterAppend) {
|
|
841
|
-
afterAppend(childNode);
|
|
842
|
-
}
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
return node;
|
|
846
|
-
}
|
|
847
|
-
function visit(idNodeMap, onVisit) {
|
|
848
|
-
function walk(node) {
|
|
849
|
-
onVisit(node);
|
|
850
|
-
}
|
|
851
|
-
for (var key in idNodeMap) {
|
|
852
|
-
if (idNodeMap[key]) {
|
|
853
|
-
walk(idNodeMap[key]);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
}
|
|
857
|
-
function handleScroll(node) {
|
|
858
|
-
var n = node.__sn;
|
|
859
|
-
if (n.type !== NodeType.Element) {
|
|
860
|
-
return;
|
|
861
|
-
}
|
|
862
|
-
var el = node;
|
|
863
|
-
for (var name_2 in n.attributes) {
|
|
864
|
-
if (!(n.attributes.hasOwnProperty(name_2) && name_2.startsWith('rr_'))) {
|
|
865
|
-
continue;
|
|
866
|
-
}
|
|
867
|
-
var value = n.attributes[name_2];
|
|
868
|
-
if (name_2 === 'rr_scrollLeft') {
|
|
869
|
-
el.scrollLeft = value;
|
|
870
|
-
}
|
|
871
|
-
if (name_2 === 'rr_scrollTop') {
|
|
872
|
-
el.scrollTop = value;
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
function rebuild(n, options) {
|
|
877
|
-
var doc = options.doc, onVisit = options.onVisit, _a = options.hackCss, hackCss = _a === void 0 ? true : _a, afterAppend = options.afterAppend, cache = options.cache;
|
|
878
|
-
var idNodeMap = {};
|
|
879
|
-
var node = buildNodeWithSN(n, {
|
|
880
|
-
doc: doc,
|
|
881
|
-
map: idNodeMap,
|
|
882
|
-
skipChild: false,
|
|
883
|
-
hackCss: hackCss,
|
|
884
|
-
afterAppend: afterAppend,
|
|
885
|
-
cache: cache
|
|
886
|
-
});
|
|
887
|
-
visit(idNodeMap, function (visitedNode) {
|
|
888
|
-
if (onVisit) {
|
|
889
|
-
onVisit(visitedNode);
|
|
890
|
-
}
|
|
891
|
-
handleScroll(visitedNode);
|
|
892
|
-
});
|
|
893
|
-
return [node, idNodeMap];
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
//
|
|
897
|
-
// An event handler can take an optional event argument
|
|
898
|
-
// and should not return a value
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
// An array of all currently registered event handlers for a type
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
// A map of event types and their corresponding event handlers.
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
/** Mitt: Tiny (~200b) functional event emitter / pubsub.
|
|
912
|
-
* @name mitt
|
|
913
|
-
* @returns {Mitt}
|
|
914
|
-
*/
|
|
915
|
-
function mitt$1(all ) {
|
|
916
|
-
all = all || Object.create(null);
|
|
917
|
-
|
|
918
|
-
return {
|
|
919
|
-
/**
|
|
920
|
-
* Register an event handler for the given type.
|
|
921
|
-
*
|
|
922
|
-
* @param {String} type Type of event to listen for, or `"*"` for all events
|
|
923
|
-
* @param {Function} handler Function to call in response to given event
|
|
924
|
-
* @memberOf mitt
|
|
925
|
-
*/
|
|
926
|
-
on: function on(type , handler ) {
|
|
927
|
-
(all[type] || (all[type] = [])).push(handler);
|
|
928
|
-
},
|
|
929
|
-
|
|
930
|
-
/**
|
|
931
|
-
* Remove an event handler for the given type.
|
|
932
|
-
*
|
|
933
|
-
* @param {String} type Type of event to unregister `handler` from, or `"*"`
|
|
934
|
-
* @param {Function} handler Handler function to remove
|
|
935
|
-
* @memberOf mitt
|
|
936
|
-
*/
|
|
937
|
-
off: function off(type , handler ) {
|
|
938
|
-
if (all[type]) {
|
|
939
|
-
all[type].splice(all[type].indexOf(handler) >>> 0, 1);
|
|
940
|
-
}
|
|
941
|
-
},
|
|
942
|
-
|
|
943
|
-
/**
|
|
944
|
-
* Invoke all handlers for the given type.
|
|
945
|
-
* If present, `"*"` handlers are invoked after type-matched handlers.
|
|
946
|
-
*
|
|
947
|
-
* @param {String} type The event type to invoke
|
|
948
|
-
* @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
|
|
949
|
-
* @memberOf mitt
|
|
950
|
-
*/
|
|
951
|
-
emit: function emit(type , evt ) {
|
|
952
|
-
(all[type] || []).slice().map(function (handler) { handler(evt); });
|
|
953
|
-
(all['*'] || []).slice().map(function (handler) { handler(type, evt); });
|
|
954
|
-
}
|
|
955
|
-
};
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
var mittProxy = /*#__PURE__*/Object.freeze({
|
|
959
|
-
__proto__: null,
|
|
960
|
-
'default': mitt$1
|
|
961
|
-
});
|
|
962
|
-
|
|
963
|
-
function polyfill$1(w, d) {
|
|
964
|
-
if (w === void 0) { w = window; }
|
|
965
|
-
if (d === void 0) { d = document; }
|
|
966
|
-
if ('scrollBehavior' in d.documentElement.style &&
|
|
967
|
-
w.__forceSmoothScrollPolyfill__ !== true) {
|
|
968
|
-
return;
|
|
969
|
-
}
|
|
970
|
-
var Element = w.HTMLElement || w.Element;
|
|
971
|
-
var SCROLL_TIME = 468;
|
|
972
|
-
var original = {
|
|
973
|
-
scroll: w.scroll || w.scrollTo,
|
|
974
|
-
scrollBy: w.scrollBy,
|
|
975
|
-
elementScroll: Element.prototype.scroll || scrollElement,
|
|
976
|
-
scrollIntoView: Element.prototype.scrollIntoView,
|
|
977
|
-
};
|
|
978
|
-
var now = w.performance && w.performance.now
|
|
979
|
-
? w.performance.now.bind(w.performance)
|
|
980
|
-
: Date.now;
|
|
981
|
-
function isMicrosoftBrowser(userAgent) {
|
|
982
|
-
var userAgentPatterns = ['MSIE ', 'Trident/', 'Edge/'];
|
|
983
|
-
return new RegExp(userAgentPatterns.join('|')).test(userAgent);
|
|
984
|
-
}
|
|
985
|
-
var ROUNDING_TOLERANCE = isMicrosoftBrowser(w.navigator.userAgent) ? 1 : 0;
|
|
986
|
-
function scrollElement(x, y) {
|
|
987
|
-
this.scrollLeft = x;
|
|
988
|
-
this.scrollTop = y;
|
|
989
|
-
}
|
|
990
|
-
function ease(k) {
|
|
991
|
-
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
992
|
-
}
|
|
993
|
-
function shouldBailOut(firstArg) {
|
|
994
|
-
if (firstArg === null ||
|
|
995
|
-
typeof firstArg !== 'object' ||
|
|
996
|
-
firstArg.behavior === undefined ||
|
|
997
|
-
firstArg.behavior === 'auto' ||
|
|
998
|
-
firstArg.behavior === 'instant') {
|
|
999
|
-
return true;
|
|
1000
|
-
}
|
|
1001
|
-
if (typeof firstArg === 'object' && firstArg.behavior === 'smooth') {
|
|
1002
|
-
return false;
|
|
1003
|
-
}
|
|
1004
|
-
throw new TypeError('behavior member of ScrollOptions ' +
|
|
1005
|
-
firstArg.behavior +
|
|
1006
|
-
' is not a valid value for enumeration ScrollBehavior.');
|
|
1007
|
-
}
|
|
1008
|
-
function hasScrollableSpace(el, axis) {
|
|
1009
|
-
if (axis === 'Y') {
|
|
1010
|
-
return el.clientHeight + ROUNDING_TOLERANCE < el.scrollHeight;
|
|
1011
|
-
}
|
|
1012
|
-
if (axis === 'X') {
|
|
1013
|
-
return el.clientWidth + ROUNDING_TOLERANCE < el.scrollWidth;
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
function canOverflow(el, axis) {
|
|
1017
|
-
var overflowValue = w.getComputedStyle(el, null)['overflow' + axis];
|
|
1018
|
-
return overflowValue === 'auto' || overflowValue === 'scroll';
|
|
1019
|
-
}
|
|
1020
|
-
function isScrollable(el) {
|
|
1021
|
-
var isScrollableY = hasScrollableSpace(el, 'Y') && canOverflow(el, 'Y');
|
|
1022
|
-
var isScrollableX = hasScrollableSpace(el, 'X') && canOverflow(el, 'X');
|
|
1023
|
-
return isScrollableY || isScrollableX;
|
|
1024
|
-
}
|
|
1025
|
-
function findScrollableParent(el) {
|
|
1026
|
-
while (el !== d.body && isScrollable(el) === false) {
|
|
1027
|
-
el = el.parentNode || el.host;
|
|
1028
|
-
}
|
|
1029
|
-
return el;
|
|
1030
|
-
}
|
|
1031
|
-
function step(context) {
|
|
1032
|
-
var time = now();
|
|
1033
|
-
var value;
|
|
1034
|
-
var currentX;
|
|
1035
|
-
var currentY;
|
|
1036
|
-
var elapsed = (time - context.startTime) / SCROLL_TIME;
|
|
1037
|
-
elapsed = elapsed > 1 ? 1 : elapsed;
|
|
1038
|
-
value = ease(elapsed);
|
|
1039
|
-
currentX = context.startX + (context.x - context.startX) * value;
|
|
1040
|
-
currentY = context.startY + (context.y - context.startY) * value;
|
|
1041
|
-
context.method.call(context.scrollable, currentX, currentY);
|
|
1042
|
-
if (currentX !== context.x || currentY !== context.y) {
|
|
1043
|
-
w.requestAnimationFrame(step.bind(w, context));
|
|
1044
|
-
}
|
|
1045
|
-
}
|
|
1046
|
-
function smoothScroll(el, x, y) {
|
|
1047
|
-
var scrollable;
|
|
1048
|
-
var startX;
|
|
1049
|
-
var startY;
|
|
1050
|
-
var method;
|
|
1051
|
-
var startTime = now();
|
|
1052
|
-
if (el === d.body) {
|
|
1053
|
-
scrollable = w;
|
|
1054
|
-
startX = w.scrollX || w.pageXOffset;
|
|
1055
|
-
startY = w.scrollY || w.pageYOffset;
|
|
1056
|
-
method = original.scroll;
|
|
1057
|
-
}
|
|
1058
|
-
else {
|
|
1059
|
-
scrollable = el;
|
|
1060
|
-
startX = el.scrollLeft;
|
|
1061
|
-
startY = el.scrollTop;
|
|
1062
|
-
method = scrollElement;
|
|
1063
|
-
}
|
|
1064
|
-
step({
|
|
1065
|
-
scrollable: scrollable,
|
|
1066
|
-
method: method,
|
|
1067
|
-
startTime: startTime,
|
|
1068
|
-
startX: startX,
|
|
1069
|
-
startY: startY,
|
|
1070
|
-
x: x,
|
|
1071
|
-
y: y,
|
|
1072
|
-
});
|
|
1073
|
-
}
|
|
1074
|
-
w.scroll = w.scrollTo = function () {
|
|
1075
|
-
if (arguments[0] === undefined) {
|
|
1076
|
-
return;
|
|
1077
|
-
}
|
|
1078
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
1079
|
-
original.scroll.call(w, arguments[0].left !== undefined
|
|
1080
|
-
? arguments[0].left
|
|
1081
|
-
: typeof arguments[0] !== 'object'
|
|
1082
|
-
? arguments[0]
|
|
1083
|
-
: w.scrollX || w.pageXOffset, arguments[0].top !== undefined
|
|
1084
|
-
? arguments[0].top
|
|
1085
|
-
: arguments[1] !== undefined
|
|
1086
|
-
? arguments[1]
|
|
1087
|
-
: w.scrollY || w.pageYOffset);
|
|
1088
|
-
return;
|
|
1089
|
-
}
|
|
1090
|
-
smoothScroll.call(w, d.body, arguments[0].left !== undefined
|
|
1091
|
-
? ~~arguments[0].left
|
|
1092
|
-
: w.scrollX || w.pageXOffset, arguments[0].top !== undefined
|
|
1093
|
-
? ~~arguments[0].top
|
|
1094
|
-
: w.scrollY || w.pageYOffset);
|
|
1095
|
-
};
|
|
1096
|
-
w.scrollBy = function () {
|
|
1097
|
-
if (arguments[0] === undefined) {
|
|
1098
|
-
return;
|
|
1099
|
-
}
|
|
1100
|
-
if (shouldBailOut(arguments[0])) {
|
|
1101
|
-
original.scrollBy.call(w, arguments[0].left !== undefined
|
|
1102
|
-
? arguments[0].left
|
|
1103
|
-
: typeof arguments[0] !== 'object'
|
|
1104
|
-
? arguments[0]
|
|
1105
|
-
: 0, arguments[0].top !== undefined
|
|
1106
|
-
? arguments[0].top
|
|
1107
|
-
: arguments[1] !== undefined
|
|
1108
|
-
? arguments[1]
|
|
1109
|
-
: 0);
|
|
1110
|
-
return;
|
|
1111
|
-
}
|
|
1112
|
-
smoothScroll.call(w, d.body, ~~arguments[0].left + (w.scrollX || w.pageXOffset), ~~arguments[0].top + (w.scrollY || w.pageYOffset));
|
|
1113
|
-
};
|
|
1114
|
-
Element.prototype.scroll = Element.prototype.scrollTo = function () {
|
|
1115
|
-
if (arguments[0] === undefined) {
|
|
1116
|
-
return;
|
|
1117
|
-
}
|
|
1118
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
1119
|
-
if (typeof arguments[0] === 'number' && arguments[1] === undefined) {
|
|
1120
|
-
throw new SyntaxError('Value could not be converted');
|
|
1121
|
-
}
|
|
1122
|
-
original.elementScroll.call(this, arguments[0].left !== undefined
|
|
1123
|
-
? ~~arguments[0].left
|
|
1124
|
-
: typeof arguments[0] !== 'object'
|
|
1125
|
-
? ~~arguments[0]
|
|
1126
|
-
: this.scrollLeft, arguments[0].top !== undefined
|
|
1127
|
-
? ~~arguments[0].top
|
|
1128
|
-
: arguments[1] !== undefined
|
|
1129
|
-
? ~~arguments[1]
|
|
1130
|
-
: this.scrollTop);
|
|
1131
|
-
return;
|
|
1132
|
-
}
|
|
1133
|
-
var left = arguments[0].left;
|
|
1134
|
-
var top = arguments[0].top;
|
|
1135
|
-
smoothScroll.call(this, this, typeof left === 'undefined' ? this.scrollLeft : ~~left, typeof top === 'undefined' ? this.scrollTop : ~~top);
|
|
1136
|
-
};
|
|
1137
|
-
Element.prototype.scrollBy = function () {
|
|
1138
|
-
if (arguments[0] === undefined) {
|
|
1139
|
-
return;
|
|
1140
|
-
}
|
|
1141
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
1142
|
-
original.elementScroll.call(this, arguments[0].left !== undefined
|
|
1143
|
-
? ~~arguments[0].left + this.scrollLeft
|
|
1144
|
-
: ~~arguments[0] + this.scrollLeft, arguments[0].top !== undefined
|
|
1145
|
-
? ~~arguments[0].top + this.scrollTop
|
|
1146
|
-
: ~~arguments[1] + this.scrollTop);
|
|
1147
|
-
return;
|
|
1148
|
-
}
|
|
1149
|
-
this.scroll({
|
|
1150
|
-
left: ~~arguments[0].left + this.scrollLeft,
|
|
1151
|
-
top: ~~arguments[0].top + this.scrollTop,
|
|
1152
|
-
behavior: arguments[0].behavior,
|
|
1153
|
-
});
|
|
1154
|
-
};
|
|
1155
|
-
Element.prototype.scrollIntoView = function () {
|
|
1156
|
-
if (shouldBailOut(arguments[0]) === true) {
|
|
1157
|
-
original.scrollIntoView.call(this, arguments[0] === undefined ? true : arguments[0]);
|
|
1158
|
-
return;
|
|
1159
|
-
}
|
|
1160
|
-
var scrollableParent = findScrollableParent(this);
|
|
1161
|
-
var parentRects = scrollableParent.getBoundingClientRect();
|
|
1162
|
-
var clientRects = this.getBoundingClientRect();
|
|
1163
|
-
if (scrollableParent !== d.body) {
|
|
1164
|
-
smoothScroll.call(this, scrollableParent, scrollableParent.scrollLeft + clientRects.left - parentRects.left, scrollableParent.scrollTop + clientRects.top - parentRects.top);
|
|
1165
|
-
if (w.getComputedStyle(scrollableParent).position !== 'fixed') {
|
|
1166
|
-
w.scrollBy({
|
|
1167
|
-
left: parentRects.left,
|
|
1168
|
-
top: parentRects.top,
|
|
1169
|
-
behavior: 'smooth',
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
else {
|
|
1174
|
-
w.scrollBy({
|
|
1175
|
-
left: clientRects.left,
|
|
1176
|
-
top: clientRects.top,
|
|
1177
|
-
behavior: 'smooth',
|
|
1178
|
-
});
|
|
1179
|
-
}
|
|
1180
|
-
};
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
var EventType;
|
|
1184
|
-
(function (EventType) {
|
|
1185
|
-
EventType[EventType["DomContentLoaded"] = 0] = "DomContentLoaded";
|
|
1186
|
-
EventType[EventType["Load"] = 1] = "Load";
|
|
1187
|
-
EventType[EventType["FullSnapshot"] = 2] = "FullSnapshot";
|
|
1188
|
-
EventType[EventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
|
|
1189
|
-
EventType[EventType["Meta"] = 4] = "Meta";
|
|
1190
|
-
EventType[EventType["Custom"] = 5] = "Custom";
|
|
1191
|
-
EventType[EventType["Plugin"] = 6] = "Plugin";
|
|
1192
|
-
})(EventType || (EventType = {}));
|
|
1193
|
-
var IncrementalSource;
|
|
1194
|
-
(function (IncrementalSource) {
|
|
1195
|
-
IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
|
|
1196
|
-
IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
|
|
1197
|
-
IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
|
|
1198
|
-
IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
|
|
1199
|
-
IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
|
|
1200
|
-
IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
|
|
1201
|
-
IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
|
|
1202
|
-
IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
|
|
1203
|
-
IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
|
|
1204
|
-
IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
|
|
1205
|
-
IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
|
|
1206
|
-
IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
|
|
1207
|
-
IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
|
|
1208
|
-
IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
|
|
1209
|
-
})(IncrementalSource || (IncrementalSource = {}));
|
|
1210
|
-
var MouseInteractions;
|
|
1211
|
-
(function (MouseInteractions) {
|
|
1212
|
-
MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
|
|
1213
|
-
MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
|
|
1214
|
-
MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
|
|
1215
|
-
MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
|
|
1216
|
-
MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
|
|
1217
|
-
MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
|
|
1218
|
-
MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
|
|
1219
|
-
MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
|
|
1220
|
-
MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
|
|
1221
|
-
MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
|
|
1222
|
-
MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
|
|
1223
|
-
})(MouseInteractions || (MouseInteractions = {}));
|
|
1224
|
-
var CanvasContext;
|
|
1225
|
-
(function (CanvasContext) {
|
|
1226
|
-
CanvasContext[CanvasContext["2D"] = 0] = "2D";
|
|
1227
|
-
CanvasContext[CanvasContext["WebGL"] = 1] = "WebGL";
|
|
1228
|
-
CanvasContext[CanvasContext["WebGL2"] = 2] = "WebGL2";
|
|
1229
|
-
})(CanvasContext || (CanvasContext = {}));
|
|
1230
|
-
var MediaInteractions;
|
|
1231
|
-
(function (MediaInteractions) {
|
|
1232
|
-
MediaInteractions[MediaInteractions["Play"] = 0] = "Play";
|
|
1233
|
-
MediaInteractions[MediaInteractions["Pause"] = 1] = "Pause";
|
|
1234
|
-
MediaInteractions[MediaInteractions["Seeked"] = 2] = "Seeked";
|
|
1235
|
-
MediaInteractions[MediaInteractions["VolumeChange"] = 3] = "VolumeChange";
|
|
1236
|
-
})(MediaInteractions || (MediaInteractions = {}));
|
|
1237
|
-
var ReplayerEvents;
|
|
1238
|
-
(function (ReplayerEvents) {
|
|
1239
|
-
ReplayerEvents["Start"] = "start";
|
|
1240
|
-
ReplayerEvents["Pause"] = "pause";
|
|
1241
|
-
ReplayerEvents["Resume"] = "resume";
|
|
1242
|
-
ReplayerEvents["Resize"] = "resize";
|
|
1243
|
-
ReplayerEvents["Finish"] = "finish";
|
|
1244
|
-
ReplayerEvents["FullsnapshotRebuilded"] = "fullsnapshot-rebuilded";
|
|
1245
|
-
ReplayerEvents["LoadStylesheetStart"] = "load-stylesheet-start";
|
|
1246
|
-
ReplayerEvents["LoadStylesheetEnd"] = "load-stylesheet-end";
|
|
1247
|
-
ReplayerEvents["SkipStart"] = "skip-start";
|
|
1248
|
-
ReplayerEvents["SkipEnd"] = "skip-end";
|
|
1249
|
-
ReplayerEvents["MouseInteraction"] = "mouse-interaction";
|
|
1250
|
-
ReplayerEvents["EventCast"] = "event-cast";
|
|
1251
|
-
ReplayerEvents["CustomEvent"] = "custom-event";
|
|
1252
|
-
ReplayerEvents["Flush"] = "flush";
|
|
1253
|
-
ReplayerEvents["StateChange"] = "state-change";
|
|
1254
|
-
ReplayerEvents["PlayBack"] = "play-back";
|
|
1255
|
-
})(ReplayerEvents || (ReplayerEvents = {}));
|
|
1256
|
-
|
|
1257
|
-
var Timer = (function () {
|
|
1258
|
-
function Timer(actions, speed) {
|
|
1259
|
-
if (actions === void 0) { actions = []; }
|
|
1260
|
-
this.timeOffset = 0;
|
|
1261
|
-
this.raf = null;
|
|
1262
|
-
this.actions = actions;
|
|
1263
|
-
this.speed = speed;
|
|
1264
|
-
}
|
|
1265
|
-
Timer.prototype.addAction = function (action) {
|
|
1266
|
-
var index = this.findActionIndex(action);
|
|
1267
|
-
this.actions.splice(index, 0, action);
|
|
1268
|
-
};
|
|
1269
|
-
Timer.prototype.addActions = function (actions) {
|
|
1270
|
-
this.actions = this.actions.concat(actions);
|
|
1271
|
-
};
|
|
1272
|
-
Timer.prototype.replaceActions = function (actions) {
|
|
1273
|
-
var _a;
|
|
1274
|
-
this.actions.length = 0;
|
|
1275
|
-
(_a = this.actions).splice.apply(_a, __spreadArray([0, 0], __read(actions), false));
|
|
1276
|
-
};
|
|
1277
|
-
Timer.prototype.start = function () {
|
|
1278
|
-
this.timeOffset = 0;
|
|
1279
|
-
var lastTimestamp = performance.now();
|
|
1280
|
-
var actions = this.actions;
|
|
1281
|
-
var self = this;
|
|
1282
|
-
function check() {
|
|
1283
|
-
var time = performance.now();
|
|
1284
|
-
self.timeOffset += (time - lastTimestamp) * self.speed;
|
|
1285
|
-
lastTimestamp = time;
|
|
1286
|
-
while (actions.length) {
|
|
1287
|
-
var action = actions[0];
|
|
1288
|
-
if (self.timeOffset >= action.delay) {
|
|
1289
|
-
actions.shift();
|
|
1290
|
-
action.doAction();
|
|
1291
|
-
}
|
|
1292
|
-
else {
|
|
1293
|
-
break;
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
if (actions.length > 0 || self.liveMode) {
|
|
1297
|
-
self.raf = requestAnimationFrame(check);
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
this.raf = requestAnimationFrame(check);
|
|
1301
|
-
};
|
|
1302
|
-
Timer.prototype.clear = function () {
|
|
1303
|
-
if (this.raf) {
|
|
1304
|
-
cancelAnimationFrame(this.raf);
|
|
1305
|
-
this.raf = null;
|
|
1306
|
-
}
|
|
1307
|
-
this.actions.length = 0;
|
|
1308
|
-
};
|
|
1309
|
-
Timer.prototype.setSpeed = function (speed) {
|
|
1310
|
-
this.speed = speed;
|
|
1311
|
-
};
|
|
1312
|
-
Timer.prototype.toggleLiveMode = function (mode) {
|
|
1313
|
-
this.liveMode = mode;
|
|
1314
|
-
};
|
|
1315
|
-
Timer.prototype.isActive = function () {
|
|
1316
|
-
return this.raf !== null;
|
|
1317
|
-
};
|
|
1318
|
-
Timer.prototype.findActionIndex = function (action) {
|
|
1319
|
-
var start = 0;
|
|
1320
|
-
var end = this.actions.length - 1;
|
|
1321
|
-
while (start <= end) {
|
|
1322
|
-
var mid = Math.floor((start + end) / 2);
|
|
1323
|
-
if (this.actions[mid].delay < action.delay) {
|
|
1324
|
-
start = mid + 1;
|
|
1325
|
-
}
|
|
1326
|
-
else if (this.actions[mid].delay > action.delay) {
|
|
1327
|
-
end = mid - 1;
|
|
1328
|
-
}
|
|
1329
|
-
else {
|
|
1330
|
-
return mid + 1;
|
|
1331
|
-
}
|
|
1332
|
-
}
|
|
1333
|
-
return start;
|
|
1334
|
-
};
|
|
1335
|
-
return Timer;
|
|
1336
|
-
}());
|
|
1337
|
-
function addDelay(event, baselineTime) {
|
|
1338
|
-
if (event.type === EventType.IncrementalSnapshot &&
|
|
1339
|
-
event.data.source === IncrementalSource.MouseMove) {
|
|
1340
|
-
var firstOffset = event.data.positions[0].timeOffset;
|
|
1341
|
-
var firstTimestamp = event.timestamp + firstOffset;
|
|
1342
|
-
event.delay = firstTimestamp - baselineTime;
|
|
1343
|
-
return firstTimestamp - baselineTime;
|
|
1344
|
-
}
|
|
1345
|
-
event.delay = event.timestamp - baselineTime;
|
|
1346
|
-
return event.delay;
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
/*! *****************************************************************************
|
|
1
|
+
var rrwebReplay=function(fe){"use strict";var L;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(L||(L={}));function $t(e){return e.nodeType===e.ELEMENT_NODE}var Be=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var r;if(!t)return-1;var n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(function(i){return r.removeNodeFromMap(i)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)},e.prototype.replace=function(t,r){this.idNodeMap.set(t,r)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Wt(){return new Be}var Ve=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g;function jt(e,t){t===void 0&&(t={});var r=1,n=1;function i(g){var p=g.match(/\n/g);p&&(r+=p.length);var b=g.lastIndexOf(`
|
|
2
|
+
`);n=b===-1?n+g.length:g.length-b}function s(){var g={line:r,column:n};return function(p){return p.position=new a(g),y(),p}}var a=function(){function g(p){this.start=p,this.end={line:r,column:n},this.source=t.source}return g}();a.prototype.content=e;var u=[];function c(g){var p=new Error(t.source+":"+r+":"+n+": "+g);if(p.reason=g,p.filename=t.source,p.line=r,p.column=n,p.source=e,t.silent)u.push(p);else throw p}function o(){var g=m();return{type:"stylesheet",stylesheet:{source:t.source,rules:g,parsingErrors:u}}}function l(){return f(/^{\s*/)}function d(){return f(/^}/)}function m(){var g,p=[];for(y(),v(p);e.length&&e.charAt(0)!=="}"&&(g=_()||te());)g!==!1&&(p.push(g),v(p));return p}function f(g){var p=g.exec(e);if(p){var b=p[0];return i(b),e=e.slice(b.length),p}}function y(){f(/^\s*/)}function v(g){g===void 0&&(g=[]);for(var p;p=E();)p!==!1&&g.push(p),p=E();return g}function E(){var g=s();if(!(e.charAt(0)!=="/"||e.charAt(1)!=="*")){for(var p=2;e.charAt(p)!==""&&(e.charAt(p)!=="*"||e.charAt(p+1)!=="/");)++p;if(p+=2,e.charAt(p-1)==="")return c("End of comment missing");var b=e.slice(2,p-2);return n+=2,i(b),e=e.slice(p),n+=2,g({type:"comment",comment:b})}}function h(){var g=f(/^([^{]+)/);if(g)return z(g[0]).replace(/\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*\/+/g,"").replace(/"(?:\\"|[^"])*"|'(?:\\'|[^'])*'/g,function(p){return p.replace(/,/g,"\u200C")}).split(/\s*(?![^(]*\)),\s*/).map(function(p){return p.replace(/\u200C/g,",")})}function T(){var g=s(),p=f(/^(\*?[-#\/\*\\\w]+(\[[0-9a-z_-]+\])?)\s*/);if(p){var b=z(p[0]);if(!f(/^:\s*/))return c("property missing ':'");var C=f(/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^\)]*?\)|[^};])+)/),P=g({type:"declaration",property:b.replace(Ve,""),value:C?z(C[0]).replace(Ve,""):""});return f(/^[;\s]*/),P}}function N(){var g=[];if(!l())return c("missing '{'");v(g);for(var p;p=T();)p!==!1&&(g.push(p),v(g)),p=T();return d()?g:c("missing '}'")}function R(){for(var g,p=[],b=s();g=f(/^((\d+\.\d+|\.\d+|\d+)%?|[a-z]+)\s*/);)p.push(g[1]),f(/^,\s*/);if(p.length)return b({type:"keyframe",values:p,declarations:N()})}function F(){var g=s(),p=f(/^@([-\w]+)?keyframes\s*/);if(p){var b=p[1];if(p=f(/^([-\w]+)\s*/),!p)return c("@keyframes missing name");var C=p[1];if(!l())return c("@keyframes missing '{'");for(var P,Z=v();P=R();)Z.push(P),Z=Z.concat(v());return d()?g({type:"keyframes",name:C,vendor:b,keyframes:Z}):c("@keyframes missing '}'")}}function O(){var g=s(),p=f(/^@supports *([^{]+)/);if(p){var b=z(p[1]);if(!l())return c("@supports missing '{'");var C=v().concat(m());return d()?g({type:"supports",supports:b,rules:C}):c("@supports missing '}'")}}function M(){var g=s(),p=f(/^@host\s*/);if(p){if(!l())return c("@host missing '{'");var b=v().concat(m());return d()?g({type:"host",rules:b}):c("@host missing '}'")}}function k(){var g=s(),p=f(/^@media *([^{]+)/);if(p){var b=z(p[1]);if(!l())return c("@media missing '{'");var C=v().concat(m());return d()?g({type:"media",media:b,rules:C}):c("@media missing '}'")}}function $(){var g=s(),p=f(/^@custom-media\s+(--[^\s]+)\s*([^{;]+);/);if(p)return g({type:"custom-media",name:z(p[1]),media:z(p[2])})}function me(){var g=s(),p=f(/^@page */);if(p){var b=h()||[];if(!l())return c("@page missing '{'");for(var C=v(),P;P=T();)C.push(P),C=C.concat(v());return d()?g({type:"page",selectors:b,declarations:C}):c("@page missing '}'")}}function pe(){var g=s(),p=f(/^@([-\w]+)?document *([^{]+)/);if(p){var b=z(p[1]),C=z(p[2]);if(!l())return c("@document missing '{'");var P=v().concat(m());return d()?g({type:"document",document:C,vendor:b,rules:P}):c("@document missing '}'")}}function J(){var g=s(),p=f(/^@font-face\s*/);if(p){if(!l())return c("@font-face missing '{'");for(var b=v(),C;C=T();)b.push(C),b=b.concat(v());return d()?g({type:"font-face",declarations:b}):c("@font-face missing '}'")}}var H=B("import"),K=B("charset"),se=B("namespace");function B(g){var p=new RegExp("^@"+g+"\\s*([^;]+);");return function(){var b=s(),C=f(p);if(C){var P={type:g};return P[g]=C[1].trim(),b(P)}}}function _(){if(e[0]==="@")return F()||k()||$()||O()||H()||K()||se()||pe()||me()||M()||J()}function te(){var g=s(),p=h();return p?(v(),g({type:"rule",selectors:p,declarations:N()})):c("selector missing")}return we(o())}function z(e){return e?e.replace(/^\s+|\s+$/g,""):""}function we(e,t){for(var r=e&&typeof e.type=="string",n=r?e:t,i=0,s=Object.keys(e);i<s.length;i++){var a=s[i],u=e[a];Array.isArray(u)?u.forEach(function(c){we(c,n)}):u&&typeof u=="object"&&we(u,n)}return r&&Object.defineProperty(e,"parent",{configurable:!0,writable:!0,enumerable:!1,value:t||null}),e}var $e={script:"noscript",altglyph:"altGlyph",altglyphdef:"altGlyphDef",altglyphitem:"altGlyphItem",animatecolor:"animateColor",animatemotion:"animateMotion",animatetransform:"animateTransform",clippath:"clipPath",feblend:"feBlend",fecolormatrix:"feColorMatrix",fecomponenttransfer:"feComponentTransfer",fecomposite:"feComposite",feconvolvematrix:"feConvolveMatrix",fediffuselighting:"feDiffuseLighting",fedisplacementmap:"feDisplacementMap",fedistantlight:"feDistantLight",fedropshadow:"feDropShadow",feflood:"feFlood",fefunca:"feFuncA",fefuncb:"feFuncB",fefuncg:"feFuncG",fefuncr:"feFuncR",fegaussianblur:"feGaussianBlur",feimage:"feImage",femerge:"feMerge",femergenode:"feMergeNode",femorphology:"feMorphology",feoffset:"feOffset",fepointlight:"fePointLight",fespecularlighting:"feSpecularLighting",fespotlight:"feSpotLight",fetile:"feTile",feturbulence:"feTurbulence",foreignobject:"foreignObject",glyphref:"glyphRef",lineargradient:"linearGradient",radialgradient:"radialGradient"};function Gt(e){var t=$e[e.tagName]?$e[e.tagName]:e.tagName;return t==="link"&&e.attributes._cssText&&(t="style"),t}function Ht(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var We=/([^\\]):hover/,Yt=new RegExp(We.source,"g");function je(e,t){var r;if(!(!((r=window?.HIG_CONFIGURATION)===null||r===void 0)&&r.enableOnHoverClass))return e;var n=t?.stylesWithHoverClass.get(e);if(n)return n;var i=jt(e,{silent:!0});if(!i.stylesheet)return e;var s=[];if(i.stylesheet.rules.forEach(function(c){"selectors"in c&&(c.selectors||[]).forEach(function(o){We.test(o)&&s.push(o)})}),s.length===0)return e;var a=new RegExp(s.filter(function(c,o){return s.indexOf(c)===o}).sort(function(c,o){return o.length-c.length}).map(function(c){return Ht(c)}).join("|"),"g"),u=e.replace(a,function(c){var o=c.replace(Yt,"$1.\\:hover");return c+", "+o});return t?.stylesWithHoverClass.set(e,u),u}function Ge(){var e=new Map;return{stylesWithHoverClass:e}}function zt(e,t){var r=t.doc,n=t.hackCss,i=t.cache;switch(e.type){case L.Document:return r.implementation.createDocument(null,"",null);case L.DocumentType:return r.implementation.createDocumentType(e.name||"html",e.publicId,e.systemId);case L.Element:var s=Gt(e),a;e.isSVG?a=r.createElementNS("http://www.w3.org/2000/svg",s):a=r.createElement(s);var u=function(o){if(!e.attributes.hasOwnProperty(o))return"continue";var l=e.attributes[o];if(s==="option"&&o==="selected"&&l===!1)return"continue";if(l=typeof l=="boolean"||typeof l=="number"?"":l,o.startsWith("rr_")){if(s==="canvas"&&o==="rr_dataURL"){var d=document.createElement("img");d.src=l,d.onload=function(){var M=a.getContext("2d");M&&M.drawImage(d,0,0,d.width,d.height)}}else if(s==="img"&&o==="rr_dataURL"){var m=a;m.currentSrc.startsWith("data:")||(m.setAttribute("rrweb-original-src",e.attributes.src),m.src=l)}if(o==="rr_width")a.style.width=l;else if(o==="rr_height")a.style.height=l;else if(o==="rr_mediaCurrentTime")a.currentTime=e.attributes.rr_mediaCurrentTime;else if(o==="rr_mediaState")switch(l){case"played":a.play().catch(function(M){return console.warn("media playback error",M)});break;case"paused":a.pause();break}}else{var f=s==="textarea"&&o==="value",y=s==="style"&&o==="_cssText";if(y&&n&&(l=je(l,i),typeof l=="string")){for(var v=/url\(\"https:\/\/\S*(.eot|.woff2|.ttf|.woff)\S*\"\)/gm,E=void 0,h=[],T="https://replay-cors-proxy.highlightrun.workers.dev";(E=v.exec(l))!==null;)E.index===v.lastIndex&&v.lastIndex++,E.forEach(function(M,k){if(k===0){var $=M.slice(5,M.length-2);h.push({originalUrl:$,proxyUrl:$.replace($,T+"?url="+$)})}});h.forEach(function(M){l=l.replace(M.originalUrl,M.proxyUrl)})}if(f||y){for(var N=r.createTextNode(l),R=0,F=Array.from(a.childNodes);R<F.length;R++){var O=F[R];O.nodeType===a.TEXT_NODE&&a.removeChild(O)}return a.appendChild(N),"continue"}try{if(e.isSVG&&o==="xlink:href")a.setAttributeNS("http://www.w3.org/1999/xlink",o,l);else if(o==="onload"||o==="onclick"||o.substring(0,7)==="onmouse")a.setAttribute("_"+o,l);else{if(s==="meta"&&e.attributes["http-equiv"]==="Content-Security-Policy"&&o==="content")return a.setAttribute("csp-content",l),"continue";s==="link"&&e.attributes.rel==="preload"&&e.attributes.as==="script"||s==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")||(s==="img"&&e.attributes.srcset&&e.attributes.rr_dataURL?a.setAttribute("rrweb-original-srcset",e.attributes.srcset):a.setAttribute(o,l))}}catch{}}};for(var c in e.attributes)u(c);if(e.isShadowHost)if(!a.shadowRoot)a.attachShadow({mode:"open"});else for(;a.shadowRoot.firstChild;)a.shadowRoot.removeChild(a.shadowRoot.firstChild);return a;case L.Text:return r.createTextNode(e.isStyle&&n?je(e.textContent,i):e.textContent);case L.CDATA:return r.createCDATASection(e.textContent);case L.Comment:return r.createComment(e.textContent);default:return null}}function ve(e,t){var r=t.doc,n=t.mirror,i=t.skipChild,s=i===void 0?!1:i,a=t.hackCss,u=a===void 0?!0:a,c=t.afterAppend,o=t.cache,l=zt(e,{doc:r,hackCss:u,cache:o});if(!l)return null;if(e.rootId&&console.assert(n.getNode(e.rootId)===r,"Target document should have the same root id."),e.type===L.Document&&(r.close(),r.open(),e.compatMode==="BackCompat"&&e.childNodes&&e.childNodes[0].type!==L.DocumentType&&(e.childNodes[0].type===L.Element&&"xmlns"in e.childNodes[0].attributes&&e.childNodes[0].attributes.xmlns==="http://www.w3.org/1999/xhtml"?r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'):r.write('<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">')),l=r),n.add(l,e),(e.type===L.Document||e.type===L.Element)&&!s)for(var d=0,m=e.childNodes;d<m.length;d++){var f=m[d],y=ve(f,{doc:r,mirror:n,skipChild:!1,hackCss:u,afterAppend:c,cache:o});if(!y){console.warn("Failed to rebuild",f);continue}f.isShadow&&$t(l)&&l.shadowRoot?l.shadowRoot.appendChild(y):l.appendChild(y),c&&c(y)}return l}function Xt(e,t){function r(a){t(a)}for(var n=0,i=e.getIds();n<i.length;n++){var s=i[n];e.has(s)&&r(e.getNode(s))}}function Qt(e,t){var r=t.getMeta(e);if(r?.type===L.Element){var n=e;for(var i in r.attributes)if(r.attributes.hasOwnProperty(i)&&i.startsWith("rr_")){var s=r.attributes[i];i==="rr_scrollLeft"&&(n.scrollLeft=s),i==="rr_scrollTop"&&(n.scrollTop=s)}}}function qt(e,t){var r=t.doc,n=t.onVisit,i=t.hackCss,s=i===void 0?!0:i,a=t.afterAppend,u=t.cache,c=t.mirror,o=c===void 0?new Be:c,l=ve(e,{doc:r,mirror:o,skipChild:!1,hackCss:s,afterAppend:a,cache:u});return Xt(o,function(d){n&&n(d),Qt(d,o)}),l}var w;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(w||(w={}));var Jt=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var r;if(!t)return-1;var n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var r=this,n=this.getId(t);this.idNodeMap.delete(n),t.childNodes&&t.childNodes.forEach(function(i){return r.removeNodeFromMap(i)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,r){var n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)},e.prototype.replace=function(t,r){this.idNodeMap.set(t,r)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function Kt(){return new Jt}function Zt(e){const t={},r=/;(?![^(]*\))/g,n=/:(.+)/,i=/\/\*.*?\*\//g;return e.replace(i,"").split(r).forEach(function(s){if(s){const a=s.split(n);a.length>1&&(t[be(a[0].trim())]=a[1].trim())}}),t}function He(e){const t=[];for(const r in e){const n=e[r];if(typeof n!="string")continue;const i=nr(r);t.push(`${i}: ${n};`)}return t.join(" ")}const er=/-([a-z])/g,tr=/^--[a-zA-Z0-9-]+$/,be=e=>tr.test(e)?e:e.replace(er,(t,r)=>r?r.toUpperCase():""),rr=/\B([A-Z])/g,nr=e=>e.replace(rr,"-$1").toLowerCase();class W{constructor(...t){this.childNodes=[],this.parentElement=null,this.parentNode=null,this.ELEMENT_NODE=A.ELEMENT_NODE,this.TEXT_NODE=A.TEXT_NODE}get firstChild(){return this.childNodes[0]||null}get lastChild(){return this.childNodes[this.childNodes.length-1]||null}get nextSibling(){const t=this.parentNode;if(!t)return null;const r=t.childNodes,n=r.indexOf(this);return r[n+1]||null}contains(t){if(t===this)return!0;for(const r of this.childNodes)if(r.contains(t))return!0;return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}}function ir(e){return class Vt extends e{constructor(){super(...arguments),this.nodeType=A.DOCUMENT_NODE,this.nodeName="#document",this.compatMode="CSS1Compat",this.RRNodeType=w.Document,this.textContent=null}get documentElement(){return this.childNodes.find(r=>r.RRNodeType===w.Element&&r.tagName==="HTML")||null}get body(){var r;return((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(n=>n.RRNodeType===w.Element&&n.tagName==="BODY"))||null}get head(){var r;return((r=this.documentElement)===null||r===void 0?void 0:r.childNodes.find(n=>n.RRNodeType===w.Element&&n.tagName==="HEAD"))||null}get implementation(){return this}get firstElementChild(){return this.documentElement}appendChild(r){const n=r.RRNodeType;if((n===w.Element||n===w.DocumentType)&&this.childNodes.some(i=>i.RRNodeType===n))throw new Error(`RRDomException: Failed to execute 'appendChild' on 'RRNode': Only one ${n===w.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);return r.parentElement=null,r.parentNode=this,this.childNodes.push(r),r}insertBefore(r,n){const i=r.RRNodeType;if((i===w.Element||i===w.DocumentType)&&this.childNodes.some(a=>a.RRNodeType===i))throw new Error(`RRDomException: Failed to execute 'insertBefore' on 'RRNode': Only one ${i===w.Element?"RRElement":"RRDoctype"} on RRDocument allowed.`);if(n===null)return this.appendChild(r);const s=this.childNodes.indexOf(n);if(s==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(s,0,r),r.parentElement=null,r.parentNode=this,r}removeChild(r){const n=this.childNodes.indexOf(r);if(n===-1)throw new Error("Failed to execute 'removeChild' on 'RRDocument': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(n,1),r.parentElement=null,r.parentNode=null,r}open(){this.childNodes=[]}close(){}write(r){let n;if(r==='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">'?n="-//W3C//DTD XHTML 1.0 Transitional//EN":r==='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">'&&(n="-//W3C//DTD HTML 4.0 Transitional//EN"),n){const i=this.createDocumentType("html",n,"");this.open(),this.appendChild(i)}}createDocument(r,n,i){return new Vt}createDocumentType(r,n,i){const s=new(Ye(W))(r,n,i);return s.ownerDocument=this,s}createElement(r){const n=new(ze(W))(r);return n.ownerDocument=this,n}createElementNS(r,n){return this.createElement(n)}createTextNode(r){const n=new(Xe(W))(r);return n.ownerDocument=this,n}createComment(r){const n=new(Qe(W))(r);return n.ownerDocument=this,n}createCDATASection(r){const n=new(qe(W))(r);return n.ownerDocument=this,n}toString(){return"RRDocument"}}}function Ye(e){return class extends e{constructor(t,r,n){super(),this.nodeType=A.DOCUMENT_TYPE_NODE,this.RRNodeType=w.DocumentType,this.textContent=null,this.name=t,this.publicId=r,this.systemId=n,this.nodeName=t}toString(){return"RRDocumentType"}}}function ze(e){return class extends e{constructor(t){super(),this.nodeType=A.ELEMENT_NODE,this.RRNodeType=w.Element,this.attributes={},this.shadowRoot=null,this.tagName=t.toUpperCase(),this.nodeName=t.toUpperCase()}get textContent(){let t="";return this.childNodes.forEach(r=>t+=r.textContent),t}set textContent(t){this.childNodes=[this.ownerDocument.createTextNode(t)]}get classList(){return new sr(this.attributes.class,t=>{this.attributes.class=t})}get id(){return this.attributes.id||""}get className(){return this.attributes.class||""}get style(){const t=this.attributes.style?Zt(this.attributes.style):{},r=/\B([A-Z])/g;return t.setProperty=(n,i,s)=>{if(r.test(n))return;const a=be(n);i?t[a]=i:delete t[a],s==="important"&&(t[a]+=" !important"),this.attributes.style=He(t)},t.removeProperty=n=>{if(r.test(n))return"";const i=be(n),s=t[i]||"";return delete t[i],this.attributes.style=He(t),s},t}getAttribute(t){return this.attributes[t]||null}setAttribute(t,r){this.attributes[t]=r}setAttributeNS(t,r,n){this.setAttribute(r,n)}removeAttribute(t){delete this.attributes[t]}appendChild(t){return this.childNodes.push(t),t.parentNode=this,t.parentElement=this,t}insertBefore(t,r){if(r===null)return this.appendChild(t);const n=this.childNodes.indexOf(r);if(n==-1)throw new Error("Failed to execute 'insertBefore' on 'RRNode': The RRNode before which the new node is to be inserted is not a child of this RRNode.");return this.childNodes.splice(n,0,t),t.parentElement=this,t.parentNode=this,t}removeChild(t){const r=this.childNodes.indexOf(t);if(r===-1)throw new Error("Failed to execute 'removeChild' on 'RRElement': The RRNode to be removed is not a child of this RRNode.");return this.childNodes.splice(r,1),t.parentElement=null,t.parentNode=null,t}attachShadow(t){const r=this.ownerDocument.createElement("SHADOWROOT");return this.shadowRoot=r,r}dispatchEvent(t){return!0}toString(){let t="";for(const r in this.attributes)t+=`${r}="${this.attributes[r]}" `;return`${this.tagName} ${t}`}}}function or(e){return class extends e{attachShadow(t){throw new Error("RRDomException: Failed to execute 'attachShadow' on 'RRElement': This RRElement does not support attachShadow")}play(){this.paused=!1}pause(){this.paused=!0}}}function Xe(e){return class extends e{constructor(t){super(),this.nodeType=A.TEXT_NODE,this.nodeName="#text",this.RRNodeType=w.Text,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRText text=${JSON.stringify(this.data)}`}}}function Qe(e){return class extends e{constructor(t){super(),this.nodeType=A.COMMENT_NODE,this.nodeName="#comment",this.RRNodeType=w.Comment,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRComment text=${JSON.stringify(this.data)}`}}}function qe(e){return class extends e{constructor(t){super(),this.nodeName="#cdata-section",this.nodeType=A.CDATA_SECTION_NODE,this.RRNodeType=w.CDATA,this.data=t}get textContent(){return this.data}set textContent(t){this.data=t}toString(){return`RRCDATASection data=${JSON.stringify(this.data)}`}}}class sr{constructor(t,r){if(this.classes=[],this.add=(...n)=>{for(const i of n){const s=String(i);this.classes.indexOf(s)>=0||this.classes.push(s)}this.onChange&&this.onChange(this.classes.join(" "))},this.remove=(...n)=>{this.classes=this.classes.filter(i=>n.indexOf(i)===-1),this.onChange&&this.onChange(this.classes.join(" "))},t){const n=t.trim().split(/\s+/);this.classes.push(...n)}this.onChange=r}}var A;(function(e){e[e.PLACEHOLDER=0]="PLACEHOLDER",e[e.ELEMENT_NODE=1]="ELEMENT_NODE",e[e.ATTRIBUTE_NODE=2]="ATTRIBUTE_NODE",e[e.TEXT_NODE=3]="TEXT_NODE",e[e.CDATA_SECTION_NODE=4]="CDATA_SECTION_NODE",e[e.ENTITY_REFERENCE_NODE=5]="ENTITY_REFERENCE_NODE",e[e.ENTITY_NODE=6]="ENTITY_NODE",e[e.PROCESSING_INSTRUCTION_NODE=7]="PROCESSING_INSTRUCTION_NODE",e[e.COMMENT_NODE=8]="COMMENT_NODE",e[e.DOCUMENT_NODE=9]="DOCUMENT_NODE",e[e.DOCUMENT_TYPE_NODE=10]="DOCUMENT_TYPE_NODE",e[e.DOCUMENT_FRAGMENT_NODE=11]="DOCUMENT_FRAGMENT_NODE"})(A||(A={}));const De={svg:"http://www.w3.org/2000/svg","xlink:href":"http://www.w3.org/1999/xlink",xmlns:"http://www.w3.org/2000/xmlns/"};function Y(e,t,r,n){const i=e.childNodes,s=t.childNodes;n=n||t.mirror||t.ownerDocument.mirror,(i.length>0||s.length>0)&&Je(Array.from(i),s,e,r,n);let a=null,u=null;switch(t.RRNodeType){case w.Document:{u=t.scrollData;break}case w.Element:{const c=e,o=t;switch(ar(c,o,n),u=o.scrollData,a=o.inputData,o.tagName){case"AUDIO":case"VIDEO":{const l=e,d=o;d.paused!==void 0&&(d.paused?l.pause():l.play()),d.muted!==void 0&&(l.muted=d.muted),d.volume!==void 0&&(l.volume=d.volume),d.currentTime!==void 0&&(l.currentTime=d.currentTime);break}case"CANVAS":t.canvasMutations.forEach(l=>r.applyCanvas(l.event,l.mutation,e));break;case"STYLE":cr(c,t.rules);break}if(o.shadowRoot){c.shadowRoot||c.attachShadow({mode:"open"});const l=c.shadowRoot.childNodes,d=o.shadowRoot.childNodes;(l.length>0||d.length>0)&&Je(Array.from(l),d,c.shadowRoot,r,n)}break}case w.Text:case w.Comment:case w.CDATA:e.textContent!==t.data&&(e.textContent=t.data);break}if(u&&r.applyScroll(u,!0),a&&r.applyInput(a),t.nodeName==="IFRAME"){const c=e.contentDocument,o=t;if(c){const l=n.getMeta(o.contentDocument);l&&r.mirror.add(c,Object.assign({},l)),Y(c,o.contentDocument,r,n)}}}function ar(e,t,r){const n=e.attributes,i=t.attributes;for(const s in i){const a=i[s],u=r.getMeta(t);if(u&&"isSVG"in u&&u.isSVG&&De[s])e.setAttributeNS(De[s],s,a);else if(t.tagName==="CANVAS"&&s==="rr_dataURL"){const c=document.createElement("img");c.src=a,c.onload=()=>{const o=e.getContext("2d");o&&o.drawImage(c,0,0,c.width,c.height)}}else e.setAttribute(s,a)}for(const{name:s}of Array.from(n))s in i||e.removeAttribute(s);t.scrollLeft&&(e.scrollLeft=t.scrollLeft),t.scrollTop&&(e.scrollTop=t.scrollTop)}function Je(e,t,r,n,i){var s,a;let u=0,c=e.length-1,o=0,l=t.length-1,d=e[u],m=e[c],f=t[o],y=t[l],v,E;for(;u<=c&&o<=l;)if(d===void 0)d=e[++u];else if(m===void 0)m=e[--c];else if(n.mirror.getId(d)===i.getId(f))Y(d,f,n,i),d=e[++u],f=t[++o];else if(n.mirror.getId(m)===i.getId(y))Y(m,y,n,i),m=e[--c],y=t[--l];else if(n.mirror.getId(d)===i.getId(y))r.insertBefore(d,m.nextSibling),Y(d,y,n,i),d=e[++u],y=t[--l];else if(n.mirror.getId(m)===i.getId(f))r.insertBefore(m,d),Y(m,f,n,i),m=e[--c],f=t[++o];else{if(!v){v={};for(let h=u;h<=c;h++){const T=e[h];T&&n.mirror.hasNode(T)&&(v[n.mirror.getId(T)]=h)}}if(E=v[i.getId(f)],E){const h=e[E];r.insertBefore(h,d),Y(h,f,n,i),e[E]=void 0}else{const h=Ce(f,n.mirror,i);((s=n.mirror.getMeta(r))===null||s===void 0?void 0:s.type)===w.Document&&((a=n.mirror.getMeta(h))===null||a===void 0?void 0:a.type)===w.Element&&r.documentElement&&(r.removeChild(r.documentElement),e[u]=void 0,d=void 0),r.insertBefore(h,d||null),Y(h,f,n,i)}f=t[++o]}if(u>c){const h=t[l+1];let T=null;for(h&&r.childNodes.forEach(N=>{n.mirror.getId(N)===i.getId(h)&&(T=N)});o<=l;++o){const N=Ce(t[o],n.mirror,i);r.insertBefore(N,T),Y(N,t[o],n,i)}}else if(o>l)for(;u<=c;u++){const h=e[u];h&&(r.removeChild(h),n.mirror.removeNodeFromMap(h))}}function Ce(e,t,r){let n=t.getNode(r.getId(e));const i=r.getMeta(e);if(n!==null)return n;switch(e.RRNodeType){case w.Document:n=new Document;break;case w.DocumentType:n=document.implementation.createDocumentType(e.name,e.publicId,e.systemId);break;case w.Element:{e.tagName.toLowerCase(),i&&"isSVG"in i&&i?.isSVG?n=document.createElementNS(De.svg,e.tagName.toLowerCase()):n=document.createElement(e.tagName);break}case w.Text:n=document.createTextNode(e.data);break;case w.Comment:n=document.createComment(e.data);break;case w.CDATA:n=document.createCDATASection(e.data);break}return i&&t.add(n,Object.assign({},i)),n}function ae(e,t){const r=e[t[0]];return t.length===1?r:ae(r.cssRules[t[1]].cssRules,t.slice(2))}var j;(function(e){e[e.Insert=0]="Insert",e[e.Remove=1]="Remove",e[e.Snapshot=2]="Snapshot",e[e.SetProperty=3]="SetProperty",e[e.RemoveProperty=4]="RemoveProperty"})(j||(j={}));function Ke(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function cr(e,t){const r=e.sheet;t.forEach(n=>{if(n.type===j.Insert)try{if(Array.isArray(n.index)){const{positions:i,index:s}=Ke(n.index);ae(r.cssRules,i).insertRule(n.cssText,s)}else r.insertRule(n.cssText,n.index)}catch{}else if(n.type===j.Remove)try{if(Array.isArray(n.index)){const{positions:i,index:s}=Ke(n.index);ae(r.cssRules,i).deleteRule(s||0)}else r.deleteRule(n.index)}catch{}else n.type===j.SetProperty?ae(r.cssRules,n.index).style.setProperty(n.property,n.value,n.priority):n.type===j.RemoveProperty&&ae(r.cssRules,n.index).style.removeProperty(n.property)})}class re extends ir(W){constructor(t){super(),this._unserializedId=-1,this.mirror=Tr(),this.scrollData=null,t&&(this.mirror=t)}get unserializedId(){return this._unserializedId--}createDocument(t,r,n){return new re}createDocumentType(t,r,n){const i=new lr(t,r,n);return i.ownerDocument=this,i}createElement(t){const r=t.toUpperCase();let n;switch(r){case"AUDIO":case"VIDEO":n=new ur(r);break;case"IFRAME":n=new mr(r,this.mirror);break;case"CANVAS":n=new dr(r);break;case"STYLE":n=new hr(r);break;default:n=new ce(r);break}return n.ownerDocument=this,n}createComment(t){const r=new fr(t);return r.ownerDocument=this,r}createCDATASection(t){const r=new vr(t);return r.ownerDocument=this,r}createTextNode(t){const r=new pr(t);return r.ownerDocument=this,r}destroyTree(){this.childNodes=[],this.mirror.reset()}open(){super.open(),this._unserializedId=-1}}const lr=Ye(W);class ce extends ze(W){constructor(){super(...arguments),this.inputData=null,this.scrollData=null}}class ur extends or(ce){}class dr extends ce{constructor(){super(...arguments),this.canvasMutations=[]}getContext(){return null}}class hr extends ce{constructor(){super(...arguments),this.rules=[]}}class mr extends ce{constructor(t,r){super(t),this.contentDocument=new re,this.contentDocument.mirror=r}}const pr=Xe(W),fr=Qe(W),vr=qe(W);function gr(e){return e instanceof HTMLFormElement?"FORM":e.tagName.toUpperCase()}function Ze(e,t,r,n){let i;switch(e.nodeType){case A.DOCUMENT_NODE:n&&n.nodeName==="IFRAME"?i=n.contentDocument:(i=t,i.compatMode=e.compatMode);break;case A.DOCUMENT_TYPE_NODE:const a=e;i=t.createDocumentType(a.name,a.publicId,a.systemId);break;case A.ELEMENT_NODE:const u=e,c=gr(u);i=t.createElement(c);const o=i;for(const{name:l,value:d}of Array.from(u.attributes))o.attributes[l]=d;u.scrollLeft&&(o.scrollLeft=u.scrollLeft),u.scrollTop&&(o.scrollTop=u.scrollTop);break;case A.TEXT_NODE:i=t.createTextNode(e.textContent||"");break;case A.CDATA_SECTION_NODE:i=t.createCDATASection(e.data);break;case A.COMMENT_NODE:i=t.createComment(e.textContent||"");break;case A.DOCUMENT_FRAGMENT_NODE:i=n.attachShadow({mode:"open"});break;default:return null}let s=r.getMeta(e);return t instanceof re&&(s||(s=et(i,t.unserializedId),r.add(e,s)),t.mirror.add(i,Object.assign({},s))),i}function yr(e,t=Kt(),r=new re){function n(i,s){const a=Ze(i,r,t,s);a!==null&&(s?.nodeName!=="IFRAME"&&i.nodeType!==A.DOCUMENT_FRAGMENT_NODE&&(s?.appendChild(a),a.parentNode=s,a.parentElement=s),i.nodeName==="IFRAME"?n(i.contentDocument,a):(i.nodeType===A.DOCUMENT_NODE||i.nodeType===A.ELEMENT_NODE||i.nodeType===A.DOCUMENT_FRAGMENT_NODE)&&(i.nodeType===A.ELEMENT_NODE&&i.shadowRoot&&n(i.shadowRoot,a),i.childNodes.forEach(u=>n(u,a))))}return n(e,null),r}function Tr(){return new Er}class Er{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(t){var r;if(!t)return-1;const n=(r=this.getMeta(t))===null||r===void 0?void 0:r.id;return n??-1}getNode(t){return this.idNodeMap.get(t)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(t){return this.nodeMetaMap.get(t)||null}removeNodeFromMap(t){const r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(n=>this.removeNodeFromMap(n))}has(t){return this.idNodeMap.has(t)}hasNode(t){return this.nodeMetaMap.has(t)}add(t,r){const n=r.id;this.idNodeMap.set(n,t),this.nodeMetaMap.set(t,r)}replace(t,r){this.idNodeMap.set(t,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function et(e,t){switch(e.RRNodeType){case w.Document:return{id:t,type:e.RRNodeType,childNodes:[]};case w.DocumentType:const r=e;return{id:t,type:e.RRNodeType,name:r.name,publicId:r.publicId,systemId:r.systemId};case w.Element:return{id:t,type:e.RRNodeType,tagName:e.tagName.toLowerCase(),attributes:{},childNodes:[]};case w.Text:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case w.Comment:return{id:t,type:e.RRNodeType,textContent:e.textContent||""};case w.CDATA:return{id:t,type:e.RRNodeType,textContent:""}}}function tt(e){return e=e||Object.create(null),{on:function(r,n){(e[r]||(e[r]=[])).push(n)},off:function(r,n){e[r]&&e[r].splice(e[r].indexOf(n)>>>0,1)},emit:function(r,n){(e[r]||[]).slice().map(function(i){i(n)}),(e["*"]||[]).slice().map(function(i){i(r,n)})}}}var Nr=Object.freeze({__proto__:null,default:tt});function wr(e=window,t=document){if("scrollBehavior"in t.documentElement.style&&e.__forceSmoothScrollPolyfill__!==!0)return;const r=e.HTMLElement||e.Element,n=468,i={scroll:e.scroll||e.scrollTo,scrollBy:e.scrollBy,elementScroll:r.prototype.scroll||c,scrollIntoView:r.prototype.scrollIntoView},s=e.performance&&e.performance.now?e.performance.now.bind(e.performance):Date.now;function a(h){const T=["MSIE ","Trident/","Edge/"];return new RegExp(T.join("|")).test(h)}const u=a(e.navigator.userAgent)?1:0;function c(h,T){this.scrollLeft=h,this.scrollTop=T}function o(h){return .5*(1-Math.cos(Math.PI*h))}function l(h){if(h===null||typeof h!="object"||h.behavior===void 0||h.behavior==="auto"||h.behavior==="instant")return!0;if(typeof h=="object"&&h.behavior==="smooth")return!1;throw new TypeError("behavior member of ScrollOptions "+h.behavior+" is not a valid value for enumeration ScrollBehavior.")}function d(h,T){if(T==="Y")return h.clientHeight+u<h.scrollHeight;if(T==="X")return h.clientWidth+u<h.scrollWidth}function m(h,T){const N=e.getComputedStyle(h,null)["overflow"+T];return N==="auto"||N==="scroll"}function f(h){const T=d(h,"Y")&&m(h,"Y"),N=d(h,"X")&&m(h,"X");return T||N}function y(h){for(;h!==t.body&&f(h)===!1;)h=h.parentNode||h.host;return h}function v(h){const T=s();let N,R,F,O=(T-h.startTime)/n;O=O>1?1:O,N=o(O),R=h.startX+(h.x-h.startX)*N,F=h.startY+(h.y-h.startY)*N,h.method.call(h.scrollable,R,F),(R!==h.x||F!==h.y)&&e.requestAnimationFrame(v.bind(e,h))}function E(h,T,N){let R,F,O,M;const k=s();h===t.body?(R=e,F=e.scrollX||e.pageXOffset,O=e.scrollY||e.pageYOffset,M=i.scroll):(R=h,F=h.scrollLeft,O=h.scrollTop,M=c),v({scrollable:R,method:M,startTime:k,startX:F,startY:O,x:T,y:N})}e.scroll=e.scrollTo=function(){if(arguments[0]!==void 0){if(l(arguments[0])===!0){i.scroll.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:e.scrollY||e.pageYOffset);return}E.call(e,t.body,arguments[0].left!==void 0?~~arguments[0].left:e.scrollX||e.pageXOffset,arguments[0].top!==void 0?~~arguments[0].top:e.scrollY||e.pageYOffset)}},e.scrollBy=function(){if(arguments[0]!==void 0){if(l(arguments[0])){i.scrollBy.call(e,arguments[0].left!==void 0?arguments[0].left:typeof arguments[0]!="object"?arguments[0]:0,arguments[0].top!==void 0?arguments[0].top:arguments[1]!==void 0?arguments[1]:0);return}E.call(e,t.body,~~arguments[0].left+(e.scrollX||e.pageXOffset),~~arguments[0].top+(e.scrollY||e.pageYOffset))}},r.prototype.scroll=r.prototype.scrollTo=function(){if(arguments[0]===void 0)return;if(l(arguments[0])===!0){if(typeof arguments[0]=="number"&&arguments[1]===void 0)throw new SyntaxError("Value could not be converted");i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left:typeof arguments[0]!="object"?~~arguments[0]:this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top:arguments[1]!==void 0?~~arguments[1]:this.scrollTop);return}const h=arguments[0].left,T=arguments[0].top;E.call(this,this,typeof h>"u"?this.scrollLeft:~~h,typeof T>"u"?this.scrollTop:~~T)},r.prototype.scrollBy=function(){if(arguments[0]!==void 0){if(l(arguments[0])===!0){i.elementScroll.call(this,arguments[0].left!==void 0?~~arguments[0].left+this.scrollLeft:~~arguments[0]+this.scrollLeft,arguments[0].top!==void 0?~~arguments[0].top+this.scrollTop:~~arguments[1]+this.scrollTop);return}this.scroll({left:~~arguments[0].left+this.scrollLeft,top:~~arguments[0].top+this.scrollTop,behavior:arguments[0].behavior})}},r.prototype.scrollIntoView=function(){if(l(arguments[0])===!0){i.scrollIntoView.call(this,arguments[0]===void 0?!0:arguments[0]);return}const h=y(this),T=h.getBoundingClientRect(),N=this.getBoundingClientRect();h!==t.body?(E.call(this,h,h.scrollLeft+N.left-T.left,h.scrollTop+N.top-T.top),e.getComputedStyle(h).position!=="fixed"&&e.scrollBy({left:T.left,top:T.top,behavior:"smooth"})):e.scrollBy({left:N.left,top:N.top,behavior:"smooth"})}}var S=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(S||{}),I=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e))(I||{}),U=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(U||{}),ge=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ge||{}),xe=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e))(xe||{}),D=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e))(D||{});class br{constructor(t=[],r){this.timeOffset=0,this.raf=null,this.actions=t,this.speed=r}addAction(t){const r=this.findActionIndex(t);this.actions.splice(r,0,t)}addActions(t){this.actions=this.actions.concat(t)}replaceActions(t){this.actions.length=0,this.actions.splice(0,0,...t)}start(){this.timeOffset=0;let t=performance.now();const{actions:r}=this,n=this;function i(){const s=performance.now();for(n.timeOffset+=(s-t)*n.speed,t=s;r.length;){const a=r[0];if(n.timeOffset>=a.delay)r.shift(),a.doAction();else break}(r.length>0||n.liveMode)&&(n.raf=requestAnimationFrame(i))}this.raf=requestAnimationFrame(i)}clear(){this.raf&&(cancelAnimationFrame(this.raf),this.raf=null),this.actions.length=0}setSpeed(t){this.speed=t}toggleLiveMode(t){this.liveMode=t}isActive(){return this.raf!==null}findActionIndex(t){let r=0,n=this.actions.length-1;for(;r<=n;){const i=Math.floor((r+n)/2);if(this.actions[i].delay<t.delay)r=i+1;else if(this.actions[i].delay>t.delay)n=i-1;else return i+1}return r}}function Me(e,t){if(e.type===S.IncrementalSnapshot&&e.data.source===I.MouseMove){const r=e.data.positions[0].timeOffset,n=e.timestamp+r;return e.delay=n-t,n-t}return e.delay=e.timestamp-t,e.delay}/*! *****************************************************************************
|
|
1350
3
|
Copyright (c) Microsoft Corporation.
|
|
1351
4
|
|
|
1352
5
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1359,3268 +12,6 @@ var rrwebReplay = (function (exports) {
|
|
|
1359
12
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1360
13
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1361
14
|
PERFORMANCE OF THIS SOFTWARE.
|
|
1362
|
-
***************************************************************************** */
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
function discardPriorSnapshots(events, baselineTime) {
|
|
1366
|
-
for (var idx = events.length - 1; idx >= 0; idx--) {
|
|
1367
|
-
var event_1 = events[idx];
|
|
1368
|
-
if (event_1.type === EventType.Meta) {
|
|
1369
|
-
if (event_1.timestamp <= baselineTime) {
|
|
1370
|
-
return events.slice(idx);
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
return events;
|
|
1375
|
-
}
|
|
1376
|
-
function createPlayerService(context, _a) {
|
|
1377
|
-
var getCastFn = _a.getCastFn, applyEventsSynchronously = _a.applyEventsSynchronously, emitter = _a.emitter;
|
|
1378
|
-
var playerMachine = s({
|
|
1379
|
-
id: 'player',
|
|
1380
|
-
context: context,
|
|
1381
|
-
initial: 'paused',
|
|
1382
|
-
states: {
|
|
1383
|
-
playing: {
|
|
1384
|
-
on: {
|
|
1385
|
-
PAUSE: {
|
|
1386
|
-
target: 'paused',
|
|
1387
|
-
actions: ['pause'],
|
|
1388
|
-
},
|
|
1389
|
-
CAST_EVENT: {
|
|
1390
|
-
target: 'playing',
|
|
1391
|
-
actions: 'castEvent',
|
|
1392
|
-
},
|
|
1393
|
-
END: {
|
|
1394
|
-
target: 'paused',
|
|
1395
|
-
actions: ['resetLastPlayedEvent', 'pause'],
|
|
1396
|
-
},
|
|
1397
|
-
ADD_EVENT: {
|
|
1398
|
-
target: 'playing',
|
|
1399
|
-
actions: ['addEvent'],
|
|
1400
|
-
},
|
|
1401
|
-
REPLACE_EVENTS: {
|
|
1402
|
-
target: 'playing',
|
|
1403
|
-
actions: ['replaceEvents'],
|
|
1404
|
-
},
|
|
1405
|
-
},
|
|
1406
|
-
},
|
|
1407
|
-
paused: {
|
|
1408
|
-
on: {
|
|
1409
|
-
PLAY: {
|
|
1410
|
-
target: 'playing',
|
|
1411
|
-
actions: ['recordTimeOffset', 'play'],
|
|
1412
|
-
},
|
|
1413
|
-
CAST_EVENT: {
|
|
1414
|
-
target: 'paused',
|
|
1415
|
-
actions: 'castEvent',
|
|
1416
|
-
},
|
|
1417
|
-
TO_LIVE: {
|
|
1418
|
-
target: 'live',
|
|
1419
|
-
actions: ['startLive'],
|
|
1420
|
-
},
|
|
1421
|
-
ADD_EVENT: {
|
|
1422
|
-
target: 'paused',
|
|
1423
|
-
actions: ['addEvent'],
|
|
1424
|
-
},
|
|
1425
|
-
REPLACE_EVENTS: {
|
|
1426
|
-
target: 'paused',
|
|
1427
|
-
actions: ['replaceEvents'],
|
|
1428
|
-
},
|
|
1429
|
-
},
|
|
1430
|
-
},
|
|
1431
|
-
live: {
|
|
1432
|
-
on: {
|
|
1433
|
-
ADD_EVENT: {
|
|
1434
|
-
target: 'live',
|
|
1435
|
-
actions: ['addEvent'],
|
|
1436
|
-
},
|
|
1437
|
-
CAST_EVENT: {
|
|
1438
|
-
target: 'live',
|
|
1439
|
-
actions: ['castEvent'],
|
|
1440
|
-
},
|
|
1441
|
-
},
|
|
1442
|
-
},
|
|
1443
|
-
},
|
|
1444
|
-
}, {
|
|
1445
|
-
actions: {
|
|
1446
|
-
castEvent: o({
|
|
1447
|
-
lastPlayedEvent: function (ctx, event) {
|
|
1448
|
-
if (event.type === 'CAST_EVENT') {
|
|
1449
|
-
return event.payload.event;
|
|
1450
|
-
}
|
|
1451
|
-
return ctx.lastPlayedEvent;
|
|
1452
|
-
},
|
|
1453
|
-
}),
|
|
1454
|
-
recordTimeOffset: o(function (ctx, event) {
|
|
1455
|
-
var timeOffset = ctx.timeOffset;
|
|
1456
|
-
if ('payload' in event && 'timeOffset' in event.payload) {
|
|
1457
|
-
timeOffset = event.payload.timeOffset;
|
|
1458
|
-
}
|
|
1459
|
-
return __assign(__assign({}, ctx), { timeOffset: timeOffset, baselineTime: ctx.events[0].timestamp + timeOffset });
|
|
1460
|
-
}),
|
|
1461
|
-
play: function (ctx) {
|
|
1462
|
-
var e_1, _a, e_2, _b;
|
|
1463
|
-
var _c;
|
|
1464
|
-
var timer = ctx.timer, events = ctx.events, baselineTime = ctx.baselineTime, lastPlayedEvent = ctx.lastPlayedEvent;
|
|
1465
|
-
timer.clear();
|
|
1466
|
-
try {
|
|
1467
|
-
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
1468
|
-
var event_2 = events_1_1.value;
|
|
1469
|
-
addDelay(event_2, baselineTime);
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1473
|
-
finally {
|
|
1474
|
-
try {
|
|
1475
|
-
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
|
|
1476
|
-
}
|
|
1477
|
-
finally { if (e_1) throw e_1.error; }
|
|
1478
|
-
}
|
|
1479
|
-
var neededEvents = discardPriorSnapshots(events, baselineTime);
|
|
1480
|
-
var lastPlayedTimestamp = lastPlayedEvent === null || lastPlayedEvent === void 0 ? void 0 : lastPlayedEvent.timestamp;
|
|
1481
|
-
if ((lastPlayedEvent === null || lastPlayedEvent === void 0 ? void 0 : lastPlayedEvent.type) === EventType.IncrementalSnapshot &&
|
|
1482
|
-
lastPlayedEvent.data.source === IncrementalSource.MouseMove) {
|
|
1483
|
-
lastPlayedTimestamp =
|
|
1484
|
-
lastPlayedEvent.timestamp +
|
|
1485
|
-
((_c = lastPlayedEvent.data.positions[0]) === null || _c === void 0 ? void 0 : _c.timeOffset);
|
|
1486
|
-
}
|
|
1487
|
-
if (baselineTime < (lastPlayedTimestamp || 0)) {
|
|
1488
|
-
emitter.emit(ReplayerEvents.PlayBack);
|
|
1489
|
-
}
|
|
1490
|
-
var syncEvents = new Array();
|
|
1491
|
-
var actions = new Array();
|
|
1492
|
-
var _loop_1 = function (event_3) {
|
|
1493
|
-
if (lastPlayedTimestamp &&
|
|
1494
|
-
lastPlayedTimestamp < baselineTime &&
|
|
1495
|
-
(event_3.timestamp <= lastPlayedTimestamp ||
|
|
1496
|
-
event_3 === lastPlayedEvent)) {
|
|
1497
|
-
return "continue";
|
|
1498
|
-
}
|
|
1499
|
-
if (event_3.timestamp < baselineTime) {
|
|
1500
|
-
syncEvents.push(event_3);
|
|
1501
|
-
}
|
|
1502
|
-
else {
|
|
1503
|
-
var castFn_1 = getCastFn(event_3, false);
|
|
1504
|
-
actions.push({
|
|
1505
|
-
doAction: function () {
|
|
1506
|
-
castFn_1();
|
|
1507
|
-
},
|
|
1508
|
-
delay: event_3.delay,
|
|
1509
|
-
});
|
|
1510
|
-
}
|
|
1511
|
-
};
|
|
1512
|
-
try {
|
|
1513
|
-
for (var neededEvents_1 = __values(neededEvents), neededEvents_1_1 = neededEvents_1.next(); !neededEvents_1_1.done; neededEvents_1_1 = neededEvents_1.next()) {
|
|
1514
|
-
var event_3 = neededEvents_1_1.value;
|
|
1515
|
-
_loop_1(event_3);
|
|
1516
|
-
}
|
|
1517
|
-
}
|
|
1518
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1519
|
-
finally {
|
|
1520
|
-
try {
|
|
1521
|
-
if (neededEvents_1_1 && !neededEvents_1_1.done && (_b = neededEvents_1.return)) _b.call(neededEvents_1);
|
|
1522
|
-
}
|
|
1523
|
-
finally { if (e_2) throw e_2.error; }
|
|
1524
|
-
}
|
|
1525
|
-
applyEventsSynchronously(syncEvents);
|
|
1526
|
-
emitter.emit(ReplayerEvents.Flush);
|
|
1527
|
-
timer.addActions(actions);
|
|
1528
|
-
timer.start();
|
|
1529
|
-
},
|
|
1530
|
-
pause: function (ctx) {
|
|
1531
|
-
ctx.timer.clear();
|
|
1532
|
-
},
|
|
1533
|
-
resetLastPlayedEvent: o(function (ctx) {
|
|
1534
|
-
return __assign(__assign({}, ctx), { lastPlayedEvent: null });
|
|
1535
|
-
}),
|
|
1536
|
-
startLive: o({
|
|
1537
|
-
baselineTime: function (ctx, event) {
|
|
1538
|
-
ctx.timer.toggleLiveMode(true);
|
|
1539
|
-
ctx.timer.start();
|
|
1540
|
-
if (event.type === 'TO_LIVE' && event.payload.baselineTime) {
|
|
1541
|
-
return event.payload.baselineTime;
|
|
1542
|
-
}
|
|
1543
|
-
return Date.now();
|
|
1544
|
-
},
|
|
1545
|
-
}),
|
|
1546
|
-
replaceEvents: o(function (ctx, machineEvent) {
|
|
1547
|
-
var e_3, _a;
|
|
1548
|
-
var curEvents = ctx.events, timer = ctx.timer, baselineTime = ctx.baselineTime;
|
|
1549
|
-
if (machineEvent.type === 'REPLACE_EVENTS') {
|
|
1550
|
-
var newEvents = machineEvent.payload.events;
|
|
1551
|
-
curEvents.length = 0;
|
|
1552
|
-
var actions = [];
|
|
1553
|
-
var _loop_2 = function (event_4) {
|
|
1554
|
-
addDelay(event_4, baselineTime);
|
|
1555
|
-
curEvents.push(event_4);
|
|
1556
|
-
if (event_4.timestamp >= timer.timeOffset + baselineTime) {
|
|
1557
|
-
var castFn_2 = getCastFn(event_4, false);
|
|
1558
|
-
actions.push({
|
|
1559
|
-
doAction: function () {
|
|
1560
|
-
castFn_2();
|
|
1561
|
-
},
|
|
1562
|
-
delay: event_4.delay,
|
|
1563
|
-
});
|
|
1564
|
-
}
|
|
1565
|
-
};
|
|
1566
|
-
try {
|
|
1567
|
-
for (var newEvents_1 = __values(newEvents), newEvents_1_1 = newEvents_1.next(); !newEvents_1_1.done; newEvents_1_1 = newEvents_1.next()) {
|
|
1568
|
-
var event_4 = newEvents_1_1.value;
|
|
1569
|
-
_loop_2(event_4);
|
|
1570
|
-
}
|
|
1571
|
-
}
|
|
1572
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1573
|
-
finally {
|
|
1574
|
-
try {
|
|
1575
|
-
if (newEvents_1_1 && !newEvents_1_1.done && (_a = newEvents_1.return)) _a.call(newEvents_1);
|
|
1576
|
-
}
|
|
1577
|
-
finally { if (e_3) throw e_3.error; }
|
|
1578
|
-
}
|
|
1579
|
-
if (timer.isActive()) {
|
|
1580
|
-
timer.replaceActions(actions);
|
|
1581
|
-
}
|
|
1582
|
-
}
|
|
1583
|
-
return __assign(__assign({}, ctx), { events: curEvents });
|
|
1584
|
-
}),
|
|
1585
|
-
addEvent: o(function (ctx, machineEvent) {
|
|
1586
|
-
var baselineTime = ctx.baselineTime, timer = ctx.timer, events = ctx.events;
|
|
1587
|
-
if (machineEvent.type === 'ADD_EVENT') {
|
|
1588
|
-
var event_5 = machineEvent.payload.event;
|
|
1589
|
-
addDelay(event_5, baselineTime);
|
|
1590
|
-
var end = events.length - 1;
|
|
1591
|
-
if (!events[end] || events[end].timestamp <= event_5.timestamp) {
|
|
1592
|
-
events.push(event_5);
|
|
1593
|
-
}
|
|
1594
|
-
else {
|
|
1595
|
-
var insertionIndex = -1;
|
|
1596
|
-
var start = 0;
|
|
1597
|
-
while (start <= end) {
|
|
1598
|
-
var mid = Math.floor((start + end) / 2);
|
|
1599
|
-
if (events[mid].timestamp <= event_5.timestamp) {
|
|
1600
|
-
start = mid + 1;
|
|
1601
|
-
}
|
|
1602
|
-
else {
|
|
1603
|
-
end = mid - 1;
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
if (insertionIndex === -1) {
|
|
1607
|
-
insertionIndex = start;
|
|
1608
|
-
}
|
|
1609
|
-
events.splice(insertionIndex, 0, event_5);
|
|
1610
|
-
}
|
|
1611
|
-
var isSync = event_5.timestamp < baselineTime;
|
|
1612
|
-
var castFn_3 = getCastFn(event_5, isSync);
|
|
1613
|
-
if (isSync) {
|
|
1614
|
-
castFn_3();
|
|
1615
|
-
}
|
|
1616
|
-
else if (timer.isActive()) {
|
|
1617
|
-
timer.addAction({
|
|
1618
|
-
doAction: function () {
|
|
1619
|
-
castFn_3();
|
|
1620
|
-
},
|
|
1621
|
-
delay: event_5.delay,
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
}
|
|
1625
|
-
return __assign(__assign({}, ctx), { events: events });
|
|
1626
|
-
}),
|
|
1627
|
-
},
|
|
1628
|
-
});
|
|
1629
|
-
return v(playerMachine);
|
|
1630
|
-
}
|
|
1631
|
-
function createSpeedService(context) {
|
|
1632
|
-
var speedMachine = s({
|
|
1633
|
-
id: 'speed',
|
|
1634
|
-
context: context,
|
|
1635
|
-
initial: 'normal',
|
|
1636
|
-
states: {
|
|
1637
|
-
normal: {
|
|
1638
|
-
on: {
|
|
1639
|
-
FAST_FORWARD: {
|
|
1640
|
-
target: 'skipping',
|
|
1641
|
-
actions: ['recordSpeed', 'setSpeed'],
|
|
1642
|
-
},
|
|
1643
|
-
SET_SPEED: {
|
|
1644
|
-
target: 'normal',
|
|
1645
|
-
actions: ['setSpeed'],
|
|
1646
|
-
},
|
|
1647
|
-
},
|
|
1648
|
-
},
|
|
1649
|
-
skipping: {
|
|
1650
|
-
on: {
|
|
1651
|
-
BACK_TO_NORMAL: {
|
|
1652
|
-
target: 'normal',
|
|
1653
|
-
actions: ['restoreSpeed'],
|
|
1654
|
-
},
|
|
1655
|
-
SET_SPEED: {
|
|
1656
|
-
target: 'normal',
|
|
1657
|
-
actions: ['setSpeed'],
|
|
1658
|
-
},
|
|
1659
|
-
},
|
|
1660
|
-
},
|
|
1661
|
-
},
|
|
1662
|
-
}, {
|
|
1663
|
-
actions: {
|
|
1664
|
-
setSpeed: function (ctx, event) {
|
|
1665
|
-
if ('payload' in event) {
|
|
1666
|
-
ctx.timer.setSpeed(event.payload.speed);
|
|
1667
|
-
}
|
|
1668
|
-
},
|
|
1669
|
-
recordSpeed: o({
|
|
1670
|
-
normalSpeed: function (ctx) { return ctx.timer.speed; },
|
|
1671
|
-
}),
|
|
1672
|
-
restoreSpeed: function (ctx) {
|
|
1673
|
-
ctx.timer.setSpeed(ctx.normalSpeed);
|
|
1674
|
-
},
|
|
1675
|
-
},
|
|
1676
|
-
});
|
|
1677
|
-
return v(speedMachine);
|
|
1678
|
-
}
|
|
1679
|
-
|
|
1680
|
-
function createMirror() {
|
|
1681
|
-
return {
|
|
1682
|
-
map: {},
|
|
1683
|
-
getId: function (n) {
|
|
1684
|
-
if (!n || !n.__sn) {
|
|
1685
|
-
return -1;
|
|
1686
|
-
}
|
|
1687
|
-
return n.__sn.id;
|
|
1688
|
-
},
|
|
1689
|
-
getNode: function (id) {
|
|
1690
|
-
return this.map[id] || null;
|
|
1691
|
-
},
|
|
1692
|
-
removeNodeFromMap: function (n) {
|
|
1693
|
-
var _this = this;
|
|
1694
|
-
var id = n.__sn && n.__sn.id;
|
|
1695
|
-
delete this.map[id];
|
|
1696
|
-
if (n.childNodes) {
|
|
1697
|
-
n.childNodes.forEach(function (child) {
|
|
1698
|
-
return _this.removeNodeFromMap(child);
|
|
1699
|
-
});
|
|
1700
|
-
}
|
|
1701
|
-
},
|
|
1702
|
-
has: function (id) {
|
|
1703
|
-
return this.map.hasOwnProperty(id);
|
|
1704
|
-
},
|
|
1705
|
-
reset: function () {
|
|
1706
|
-
this.map = {};
|
|
1707
|
-
},
|
|
1708
|
-
};
|
|
1709
|
-
}
|
|
1710
|
-
var DEPARTED_MIRROR_ACCESS_WARNING = 'Please stop import mirror directly. Instead of that,' +
|
|
1711
|
-
'\r\n' +
|
|
1712
|
-
'now you can use replayer.getMirror() to access the mirror instance of a replayer,' +
|
|
1713
|
-
'\r\n' +
|
|
1714
|
-
'or you can use record.mirror to access the mirror instance during recording.';
|
|
1715
|
-
var _mirror = {
|
|
1716
|
-
map: {},
|
|
1717
|
-
getId: function () {
|
|
1718
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1719
|
-
return -1;
|
|
1720
|
-
},
|
|
1721
|
-
getNode: function () {
|
|
1722
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1723
|
-
return null;
|
|
1724
|
-
},
|
|
1725
|
-
removeNodeFromMap: function () {
|
|
1726
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1727
|
-
},
|
|
1728
|
-
has: function () {
|
|
1729
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1730
|
-
return false;
|
|
1731
|
-
},
|
|
1732
|
-
reset: function () {
|
|
1733
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1734
|
-
},
|
|
1735
|
-
};
|
|
1736
|
-
if (typeof window !== 'undefined' && window.Proxy && window.Reflect) {
|
|
1737
|
-
_mirror = new Proxy(_mirror, {
|
|
1738
|
-
get: function (target, prop, receiver) {
|
|
1739
|
-
if (prop === 'map') {
|
|
1740
|
-
console.error(DEPARTED_MIRROR_ACCESS_WARNING);
|
|
1741
|
-
}
|
|
1742
|
-
return Reflect.get(target, prop, receiver);
|
|
1743
|
-
},
|
|
1744
|
-
});
|
|
1745
|
-
}
|
|
1746
|
-
function polyfill(win) {
|
|
1747
|
-
if (win === void 0) { win = window; }
|
|
1748
|
-
if ('NodeList' in win && !win.NodeList.prototype.forEach) {
|
|
1749
|
-
win.NodeList.prototype.forEach = Array.prototype
|
|
1750
|
-
.forEach;
|
|
1751
|
-
}
|
|
1752
|
-
if ('DOMTokenList' in win && !win.DOMTokenList.prototype.forEach) {
|
|
1753
|
-
win.DOMTokenList.prototype.forEach = Array.prototype
|
|
1754
|
-
.forEach;
|
|
1755
|
-
}
|
|
1756
|
-
if (!Node.prototype.contains) {
|
|
1757
|
-
Node.prototype.contains = function contains(node) {
|
|
1758
|
-
if (!(0 in arguments)) {
|
|
1759
|
-
throw new TypeError('1 argument is required');
|
|
1760
|
-
}
|
|
1761
|
-
do {
|
|
1762
|
-
if (this === node) {
|
|
1763
|
-
return true;
|
|
1764
|
-
}
|
|
1765
|
-
} while ((node = node && node.parentNode));
|
|
1766
|
-
return false;
|
|
1767
|
-
};
|
|
1768
|
-
}
|
|
1769
|
-
}
|
|
1770
|
-
var TreeIndex = (function () {
|
|
1771
|
-
function TreeIndex() {
|
|
1772
|
-
this.reset();
|
|
1773
|
-
}
|
|
1774
|
-
TreeIndex.prototype.add = function (mutation) {
|
|
1775
|
-
var parentTreeNode = this.indexes.get(mutation.parentId);
|
|
1776
|
-
var treeNode = {
|
|
1777
|
-
id: mutation.node.id,
|
|
1778
|
-
mutation: mutation,
|
|
1779
|
-
children: [],
|
|
1780
|
-
texts: [],
|
|
1781
|
-
attributes: [],
|
|
1782
|
-
};
|
|
1783
|
-
if (!parentTreeNode) {
|
|
1784
|
-
this.tree[treeNode.id] = treeNode;
|
|
1785
|
-
}
|
|
1786
|
-
else {
|
|
1787
|
-
treeNode.parent = parentTreeNode;
|
|
1788
|
-
parentTreeNode.children[treeNode.id] = treeNode;
|
|
1789
|
-
}
|
|
1790
|
-
this.indexes.set(treeNode.id, treeNode);
|
|
1791
|
-
};
|
|
1792
|
-
TreeIndex.prototype.remove = function (mutation, mirror) {
|
|
1793
|
-
var _this = this;
|
|
1794
|
-
var parentTreeNode = this.indexes.get(mutation.parentId);
|
|
1795
|
-
var treeNode = this.indexes.get(mutation.id);
|
|
1796
|
-
var deepRemoveFromMirror = function (id) {
|
|
1797
|
-
_this.removeIdSet.add(id);
|
|
1798
|
-
var node = mirror.getNode(id);
|
|
1799
|
-
node === null || node === void 0 ? void 0 : node.childNodes.forEach(function (childNode) {
|
|
1800
|
-
if ('__sn' in childNode) {
|
|
1801
|
-
deepRemoveFromMirror(childNode.__sn.id);
|
|
1802
|
-
}
|
|
1803
|
-
});
|
|
1804
|
-
};
|
|
1805
|
-
var deepRemoveFromTreeIndex = function (node) {
|
|
1806
|
-
_this.removeIdSet.add(node.id);
|
|
1807
|
-
Object.values(node.children).forEach(function (n) { return deepRemoveFromTreeIndex(n); });
|
|
1808
|
-
var _treeNode = _this.indexes.get(node.id);
|
|
1809
|
-
if (_treeNode) {
|
|
1810
|
-
var _parentTreeNode = _treeNode.parent;
|
|
1811
|
-
if (_parentTreeNode) {
|
|
1812
|
-
delete _treeNode.parent;
|
|
1813
|
-
delete _parentTreeNode.children[_treeNode.id];
|
|
1814
|
-
_this.indexes.delete(mutation.id);
|
|
1815
|
-
}
|
|
1816
|
-
}
|
|
1817
|
-
};
|
|
1818
|
-
if (!treeNode) {
|
|
1819
|
-
this.removeNodeMutations.push(mutation);
|
|
1820
|
-
deepRemoveFromMirror(mutation.id);
|
|
1821
|
-
}
|
|
1822
|
-
else if (!parentTreeNode) {
|
|
1823
|
-
delete this.tree[treeNode.id];
|
|
1824
|
-
this.indexes.delete(treeNode.id);
|
|
1825
|
-
deepRemoveFromTreeIndex(treeNode);
|
|
1826
|
-
}
|
|
1827
|
-
else {
|
|
1828
|
-
delete treeNode.parent;
|
|
1829
|
-
delete parentTreeNode.children[treeNode.id];
|
|
1830
|
-
this.indexes.delete(mutation.id);
|
|
1831
|
-
deepRemoveFromTreeIndex(treeNode);
|
|
1832
|
-
}
|
|
1833
|
-
};
|
|
1834
|
-
TreeIndex.prototype.text = function (mutation) {
|
|
1835
|
-
var treeNode = this.indexes.get(mutation.id);
|
|
1836
|
-
if (treeNode) {
|
|
1837
|
-
treeNode.texts.push(mutation);
|
|
1838
|
-
}
|
|
1839
|
-
else {
|
|
1840
|
-
this.textMutations.push(mutation);
|
|
1841
|
-
}
|
|
1842
|
-
};
|
|
1843
|
-
TreeIndex.prototype.attribute = function (mutation) {
|
|
1844
|
-
var treeNode = this.indexes.get(mutation.id);
|
|
1845
|
-
if (treeNode) {
|
|
1846
|
-
treeNode.attributes.push(mutation);
|
|
1847
|
-
}
|
|
1848
|
-
else {
|
|
1849
|
-
this.attributeMutations.push(mutation);
|
|
1850
|
-
}
|
|
1851
|
-
};
|
|
1852
|
-
TreeIndex.prototype.scroll = function (d) {
|
|
1853
|
-
this.scrollMap.set(d.id, d);
|
|
1854
|
-
};
|
|
1855
|
-
TreeIndex.prototype.input = function (d) {
|
|
1856
|
-
this.inputMap.set(d.id, d);
|
|
1857
|
-
};
|
|
1858
|
-
TreeIndex.prototype.flush = function () {
|
|
1859
|
-
var e_1, _a, e_2, _b;
|
|
1860
|
-
var _this = this;
|
|
1861
|
-
var _c = this, tree = _c.tree, removeNodeMutations = _c.removeNodeMutations, textMutations = _c.textMutations, attributeMutations = _c.attributeMutations;
|
|
1862
|
-
var batchMutationData = {
|
|
1863
|
-
source: IncrementalSource.Mutation,
|
|
1864
|
-
removes: removeNodeMutations,
|
|
1865
|
-
texts: textMutations,
|
|
1866
|
-
attributes: attributeMutations,
|
|
1867
|
-
adds: [],
|
|
1868
|
-
};
|
|
1869
|
-
var walk = function (treeNode, removed) {
|
|
1870
|
-
if (removed) {
|
|
1871
|
-
_this.removeIdSet.add(treeNode.id);
|
|
1872
|
-
}
|
|
1873
|
-
batchMutationData.texts = batchMutationData.texts
|
|
1874
|
-
.concat(removed ? [] : treeNode.texts)
|
|
1875
|
-
.filter(function (m) { return !_this.removeIdSet.has(m.id); });
|
|
1876
|
-
batchMutationData.attributes = batchMutationData.attributes
|
|
1877
|
-
.concat(removed ? [] : treeNode.attributes)
|
|
1878
|
-
.filter(function (m) { return !_this.removeIdSet.has(m.id); });
|
|
1879
|
-
if (!_this.removeIdSet.has(treeNode.id) &&
|
|
1880
|
-
!_this.removeIdSet.has(treeNode.mutation.parentId) &&
|
|
1881
|
-
!removed) {
|
|
1882
|
-
batchMutationData.adds.push(treeNode.mutation);
|
|
1883
|
-
if (treeNode.children) {
|
|
1884
|
-
Object.values(treeNode.children).forEach(function (n) { return walk(n, false); });
|
|
1885
|
-
}
|
|
1886
|
-
}
|
|
1887
|
-
else {
|
|
1888
|
-
Object.values(treeNode.children).forEach(function (n) { return walk(n, true); });
|
|
1889
|
-
}
|
|
1890
|
-
};
|
|
1891
|
-
Object.values(tree).forEach(function (n) { return walk(n, false); });
|
|
1892
|
-
try {
|
|
1893
|
-
for (var _d = __values(this.scrollMap.keys()), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1894
|
-
var id = _e.value;
|
|
1895
|
-
if (this.removeIdSet.has(id)) {
|
|
1896
|
-
this.scrollMap.delete(id);
|
|
1897
|
-
}
|
|
1898
|
-
}
|
|
1899
|
-
}
|
|
1900
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1901
|
-
finally {
|
|
1902
|
-
try {
|
|
1903
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1904
|
-
}
|
|
1905
|
-
finally { if (e_1) throw e_1.error; }
|
|
1906
|
-
}
|
|
1907
|
-
try {
|
|
1908
|
-
for (var _f = __values(this.inputMap.keys()), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
1909
|
-
var id = _g.value;
|
|
1910
|
-
if (this.removeIdSet.has(id)) {
|
|
1911
|
-
this.inputMap.delete(id);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1916
|
-
finally {
|
|
1917
|
-
try {
|
|
1918
|
-
if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
|
1919
|
-
}
|
|
1920
|
-
finally { if (e_2) throw e_2.error; }
|
|
1921
|
-
}
|
|
1922
|
-
var scrollMap = new Map(this.scrollMap);
|
|
1923
|
-
var inputMap = new Map(this.inputMap);
|
|
1924
|
-
this.reset();
|
|
1925
|
-
return {
|
|
1926
|
-
mutationData: batchMutationData,
|
|
1927
|
-
scrollMap: scrollMap,
|
|
1928
|
-
inputMap: inputMap,
|
|
1929
|
-
};
|
|
1930
|
-
};
|
|
1931
|
-
TreeIndex.prototype.reset = function () {
|
|
1932
|
-
this.tree = [];
|
|
1933
|
-
this.indexes = new Map();
|
|
1934
|
-
this.removeNodeMutations = [];
|
|
1935
|
-
this.textMutations = [];
|
|
1936
|
-
this.attributeMutations = [];
|
|
1937
|
-
this.removeIdSet = new Set();
|
|
1938
|
-
this.scrollMap = new Map();
|
|
1939
|
-
this.inputMap = new Map();
|
|
1940
|
-
};
|
|
1941
|
-
TreeIndex.prototype.idRemoved = function (id) {
|
|
1942
|
-
return this.removeIdSet.has(id);
|
|
1943
|
-
};
|
|
1944
|
-
return TreeIndex;
|
|
1945
|
-
}());
|
|
1946
|
-
function queueToResolveTrees(queue) {
|
|
1947
|
-
var e_3, _a;
|
|
1948
|
-
var queueNodeMap = {};
|
|
1949
|
-
var putIntoMap = function (m, parent) {
|
|
1950
|
-
var nodeInTree = {
|
|
1951
|
-
value: m,
|
|
1952
|
-
parent: parent,
|
|
1953
|
-
children: [],
|
|
1954
|
-
};
|
|
1955
|
-
queueNodeMap[m.node.id] = nodeInTree;
|
|
1956
|
-
return nodeInTree;
|
|
1957
|
-
};
|
|
1958
|
-
var queueNodeTrees = [];
|
|
1959
|
-
try {
|
|
1960
|
-
for (var queue_1 = __values(queue), queue_1_1 = queue_1.next(); !queue_1_1.done; queue_1_1 = queue_1.next()) {
|
|
1961
|
-
var mutation = queue_1_1.value;
|
|
1962
|
-
var nextId = mutation.nextId, parentId = mutation.parentId;
|
|
1963
|
-
if (nextId && nextId in queueNodeMap) {
|
|
1964
|
-
var nextInTree = queueNodeMap[nextId];
|
|
1965
|
-
if (nextInTree.parent) {
|
|
1966
|
-
var idx = nextInTree.parent.children.indexOf(nextInTree);
|
|
1967
|
-
nextInTree.parent.children.splice(idx, 0, putIntoMap(mutation, nextInTree.parent));
|
|
1968
|
-
}
|
|
1969
|
-
else {
|
|
1970
|
-
var idx = queueNodeTrees.indexOf(nextInTree);
|
|
1971
|
-
queueNodeTrees.splice(idx, 0, putIntoMap(mutation, null));
|
|
1972
|
-
}
|
|
1973
|
-
continue;
|
|
1974
|
-
}
|
|
1975
|
-
if (parentId in queueNodeMap) {
|
|
1976
|
-
var parentInTree = queueNodeMap[parentId];
|
|
1977
|
-
parentInTree.children.push(putIntoMap(mutation, parentInTree));
|
|
1978
|
-
continue;
|
|
1979
|
-
}
|
|
1980
|
-
queueNodeTrees.push(putIntoMap(mutation, null));
|
|
1981
|
-
}
|
|
1982
|
-
}
|
|
1983
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1984
|
-
finally {
|
|
1985
|
-
try {
|
|
1986
|
-
if (queue_1_1 && !queue_1_1.done && (_a = queue_1.return)) _a.call(queue_1);
|
|
1987
|
-
}
|
|
1988
|
-
finally { if (e_3) throw e_3.error; }
|
|
1989
|
-
}
|
|
1990
|
-
return queueNodeTrees;
|
|
1991
|
-
}
|
|
1992
|
-
function iterateResolveTree(tree, cb) {
|
|
1993
|
-
cb(tree.value);
|
|
1994
|
-
for (var i = tree.children.length - 1; i >= 0; i--) {
|
|
1995
|
-
iterateResolveTree(tree.children[i], cb);
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
function isIframeINode(node) {
|
|
1999
|
-
if ('__sn' in node) {
|
|
2000
|
-
return (node.__sn.type === NodeType.Element && node.__sn.tagName === 'iframe');
|
|
2001
|
-
}
|
|
2002
|
-
return false;
|
|
2003
|
-
}
|
|
2004
|
-
function getBaseDimension(node, rootIframe) {
|
|
2005
|
-
var _a, _b;
|
|
2006
|
-
var frameElement = (_b = (_a = node.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) === null || _b === void 0 ? void 0 : _b.frameElement;
|
|
2007
|
-
if (!frameElement || frameElement === rootIframe) {
|
|
2008
|
-
return {
|
|
2009
|
-
x: 0,
|
|
2010
|
-
y: 0,
|
|
2011
|
-
relativeScale: 1,
|
|
2012
|
-
absoluteScale: 1,
|
|
2013
|
-
};
|
|
2014
|
-
}
|
|
2015
|
-
var frameDimension = frameElement.getBoundingClientRect();
|
|
2016
|
-
var frameBaseDimension = getBaseDimension(frameElement, rootIframe);
|
|
2017
|
-
var relativeScale = frameDimension.height / frameElement.clientHeight;
|
|
2018
|
-
return {
|
|
2019
|
-
x: frameDimension.x * frameBaseDimension.relativeScale +
|
|
2020
|
-
frameBaseDimension.x,
|
|
2021
|
-
y: frameDimension.y * frameBaseDimension.relativeScale +
|
|
2022
|
-
frameBaseDimension.y,
|
|
2023
|
-
relativeScale: relativeScale,
|
|
2024
|
-
absoluteScale: frameBaseDimension.absoluteScale * relativeScale,
|
|
2025
|
-
};
|
|
2026
|
-
}
|
|
2027
|
-
function hasShadowRoot(n) {
|
|
2028
|
-
return Boolean(n === null || n === void 0 ? void 0 : n.shadowRoot);
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
var rules = function (blockClass) { return [
|
|
2032
|
-
".".concat(blockClass, " { background: currentColor }"),
|
|
2033
|
-
'noscript { display: none !important; }',
|
|
2034
|
-
".".concat(blockClass, " { background: currentColor; border-radius: 5px; }"),
|
|
2035
|
-
".".concat(blockClass, ":hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}"),
|
|
2036
|
-
]; };
|
|
2037
|
-
|
|
2038
|
-
var StyleRuleType;
|
|
2039
|
-
(function (StyleRuleType) {
|
|
2040
|
-
StyleRuleType[StyleRuleType["Insert"] = 0] = "Insert";
|
|
2041
|
-
StyleRuleType[StyleRuleType["Remove"] = 1] = "Remove";
|
|
2042
|
-
StyleRuleType[StyleRuleType["Snapshot"] = 2] = "Snapshot";
|
|
2043
|
-
StyleRuleType[StyleRuleType["SetProperty"] = 3] = "SetProperty";
|
|
2044
|
-
StyleRuleType[StyleRuleType["RemoveProperty"] = 4] = "RemoveProperty";
|
|
2045
|
-
})(StyleRuleType || (StyleRuleType = {}));
|
|
2046
|
-
function getNestedRule(rules, position) {
|
|
2047
|
-
var rule = rules[position[0]];
|
|
2048
|
-
if (position.length === 1) {
|
|
2049
|
-
return rule;
|
|
2050
|
-
}
|
|
2051
|
-
else {
|
|
2052
|
-
return getNestedRule(rule.cssRules[position[1]]
|
|
2053
|
-
.cssRules, position.slice(2));
|
|
2054
|
-
}
|
|
2055
|
-
}
|
|
2056
|
-
function getPositionsAndIndex(nestedIndex) {
|
|
2057
|
-
var positions = __spreadArray([], __read(nestedIndex), false);
|
|
2058
|
-
var index = positions.pop();
|
|
2059
|
-
return { positions: positions, index: index };
|
|
2060
|
-
}
|
|
2061
|
-
function applyVirtualStyleRulesToNode(storedRules, styleNode) {
|
|
2062
|
-
var sheet = styleNode.sheet;
|
|
2063
|
-
if (!sheet) {
|
|
2064
|
-
return;
|
|
2065
|
-
}
|
|
2066
|
-
storedRules.forEach(function (rule) {
|
|
2067
|
-
if (rule.type === StyleRuleType.Insert) {
|
|
2068
|
-
try {
|
|
2069
|
-
if (Array.isArray(rule.index)) {
|
|
2070
|
-
var _a = getPositionsAndIndex(rule.index), positions = _a.positions, index = _a.index;
|
|
2071
|
-
var nestedRule = getNestedRule(sheet.cssRules, positions);
|
|
2072
|
-
nestedRule.insertRule(rule.cssText, index);
|
|
2073
|
-
}
|
|
2074
|
-
else {
|
|
2075
|
-
sheet.insertRule(rule.cssText, rule.index);
|
|
2076
|
-
}
|
|
2077
|
-
}
|
|
2078
|
-
catch (e) {
|
|
2079
|
-
}
|
|
2080
|
-
}
|
|
2081
|
-
else if (rule.type === StyleRuleType.Remove) {
|
|
2082
|
-
try {
|
|
2083
|
-
if (Array.isArray(rule.index)) {
|
|
2084
|
-
var _b = getPositionsAndIndex(rule.index), positions = _b.positions, index = _b.index;
|
|
2085
|
-
var nestedRule = getNestedRule(sheet.cssRules, positions);
|
|
2086
|
-
nestedRule.deleteRule(index || 0);
|
|
2087
|
-
}
|
|
2088
|
-
else {
|
|
2089
|
-
sheet.deleteRule(rule.index);
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2092
|
-
catch (e) {
|
|
2093
|
-
}
|
|
2094
|
-
}
|
|
2095
|
-
else if (rule.type === StyleRuleType.Snapshot) {
|
|
2096
|
-
restoreSnapshotOfStyleRulesToNode(rule.cssTexts, styleNode);
|
|
2097
|
-
}
|
|
2098
|
-
else if (rule.type === StyleRuleType.SetProperty) {
|
|
2099
|
-
var nativeRule = getNestedRule(sheet.cssRules, rule.index);
|
|
2100
|
-
nativeRule.style.setProperty(rule.property, rule.value, rule.priority);
|
|
2101
|
-
}
|
|
2102
|
-
else if (rule.type === StyleRuleType.RemoveProperty) {
|
|
2103
|
-
var nativeRule = getNestedRule(sheet.cssRules, rule.index);
|
|
2104
|
-
nativeRule.style.removeProperty(rule.property);
|
|
2105
|
-
}
|
|
2106
|
-
});
|
|
2107
|
-
}
|
|
2108
|
-
function restoreSnapshotOfStyleRulesToNode(cssTexts, styleNode) {
|
|
2109
|
-
var _a;
|
|
2110
|
-
try {
|
|
2111
|
-
var existingRules = Array.from(((_a = styleNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) || []).map(function (rule) { return rule.cssText; });
|
|
2112
|
-
var existingRulesReversed = Object.entries(existingRules).reverse();
|
|
2113
|
-
var lastMatch_1 = existingRules.length;
|
|
2114
|
-
existingRulesReversed.forEach(function (_a) {
|
|
2115
|
-
var _b;
|
|
2116
|
-
var _c = __read(_a, 2), index = _c[0], rule = _c[1];
|
|
2117
|
-
var indexOf = cssTexts.indexOf(rule);
|
|
2118
|
-
if (indexOf === -1 || indexOf > lastMatch_1) {
|
|
2119
|
-
try {
|
|
2120
|
-
(_b = styleNode.sheet) === null || _b === void 0 ? void 0 : _b.deleteRule(Number(index));
|
|
2121
|
-
}
|
|
2122
|
-
catch (e) {
|
|
2123
|
-
}
|
|
2124
|
-
}
|
|
2125
|
-
lastMatch_1 = indexOf;
|
|
2126
|
-
});
|
|
2127
|
-
cssTexts.forEach(function (cssText, index) {
|
|
2128
|
-
var _a, _b, _c;
|
|
2129
|
-
try {
|
|
2130
|
-
if (((_b = (_a = styleNode.sheet) === null || _a === void 0 ? void 0 : _a.cssRules[index]) === null || _b === void 0 ? void 0 : _b.cssText) !== cssText) {
|
|
2131
|
-
(_c = styleNode.sheet) === null || _c === void 0 ? void 0 : _c.insertRule(cssText, index);
|
|
2132
|
-
}
|
|
2133
|
-
}
|
|
2134
|
-
catch (e) {
|
|
2135
|
-
}
|
|
2136
|
-
});
|
|
2137
|
-
}
|
|
2138
|
-
catch (e) {
|
|
2139
|
-
}
|
|
2140
|
-
}
|
|
2141
|
-
function storeCSSRules(parentElement, virtualStyleRulesMap) {
|
|
2142
|
-
var _a;
|
|
2143
|
-
try {
|
|
2144
|
-
var cssTexts = Array.from(((_a = parentElement.sheet) === null || _a === void 0 ? void 0 : _a.cssRules) || []).map(function (rule) { return rule.cssText; });
|
|
2145
|
-
virtualStyleRulesMap.set(parentElement, [
|
|
2146
|
-
{
|
|
2147
|
-
type: StyleRuleType.Snapshot,
|
|
2148
|
-
cssTexts: cssTexts,
|
|
2149
|
-
},
|
|
2150
|
-
]);
|
|
2151
|
-
}
|
|
2152
|
-
catch (e) {
|
|
2153
|
-
}
|
|
2154
|
-
}
|
|
2155
|
-
|
|
2156
|
-
/*
|
|
2157
|
-
* base64-arraybuffer 1.0.1 <https://github.com/niklasvh/base64-arraybuffer>
|
|
2158
|
-
* Copyright (c) 2021 Niklas von Hertzen <https://hertzen.com>
|
|
2159
|
-
* Released under MIT License
|
|
2160
|
-
*/
|
|
2161
|
-
var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
2162
|
-
// Use a lookup table to find the index.
|
|
2163
|
-
var lookup = typeof Uint8Array === 'undefined' ? [] : new Uint8Array(256);
|
|
2164
|
-
for (var i$1 = 0; i$1 < chars.length; i$1++) {
|
|
2165
|
-
lookup[chars.charCodeAt(i$1)] = i$1;
|
|
2166
|
-
}
|
|
2167
|
-
var decode = function (base64) {
|
|
2168
|
-
var bufferLength = base64.length * 0.75, len = base64.length, i, p = 0, encoded1, encoded2, encoded3, encoded4;
|
|
2169
|
-
if (base64[base64.length - 1] === '=') {
|
|
2170
|
-
bufferLength--;
|
|
2171
|
-
if (base64[base64.length - 2] === '=') {
|
|
2172
|
-
bufferLength--;
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
var arraybuffer = new ArrayBuffer(bufferLength), bytes = new Uint8Array(arraybuffer);
|
|
2176
|
-
for (i = 0; i < len; i += 4) {
|
|
2177
|
-
encoded1 = lookup[base64.charCodeAt(i)];
|
|
2178
|
-
encoded2 = lookup[base64.charCodeAt(i + 1)];
|
|
2179
|
-
encoded3 = lookup[base64.charCodeAt(i + 2)];
|
|
2180
|
-
encoded4 = lookup[base64.charCodeAt(i + 3)];
|
|
2181
|
-
bytes[p++] = (encoded1 << 2) | (encoded2 >> 4);
|
|
2182
|
-
bytes[p++] = ((encoded2 & 15) << 4) | (encoded3 >> 2);
|
|
2183
|
-
bytes[p++] = ((encoded3 & 3) << 6) | (encoded4 & 63);
|
|
2184
|
-
}
|
|
2185
|
-
return arraybuffer;
|
|
2186
|
-
};
|
|
2187
|
-
|
|
2188
|
-
var webGLVarMap = new Map();
|
|
2189
|
-
function variableListFor(ctx, ctor) {
|
|
2190
|
-
var contextMap = webGLVarMap.get(ctx);
|
|
2191
|
-
if (!contextMap) {
|
|
2192
|
-
contextMap = new Map();
|
|
2193
|
-
webGLVarMap.set(ctx, contextMap);
|
|
2194
|
-
}
|
|
2195
|
-
if (!contextMap.has(ctor)) {
|
|
2196
|
-
contextMap.set(ctor, []);
|
|
2197
|
-
}
|
|
2198
|
-
return contextMap.get(ctor);
|
|
2199
|
-
}
|
|
2200
|
-
function getContext(target, type) {
|
|
2201
|
-
try {
|
|
2202
|
-
if (type === CanvasContext.WebGL) {
|
|
2203
|
-
return (target.getContext('webgl') || target.getContext('experimental-webgl'));
|
|
2204
|
-
}
|
|
2205
|
-
return target.getContext('webgl2');
|
|
2206
|
-
}
|
|
2207
|
-
catch (e) {
|
|
2208
|
-
return null;
|
|
2209
|
-
}
|
|
2210
|
-
}
|
|
2211
|
-
var WebGLVariableConstructorsNames = [
|
|
2212
|
-
'WebGLActiveInfo',
|
|
2213
|
-
'WebGLBuffer',
|
|
2214
|
-
'WebGLFramebuffer',
|
|
2215
|
-
'WebGLProgram',
|
|
2216
|
-
'WebGLRenderbuffer',
|
|
2217
|
-
'WebGLShader',
|
|
2218
|
-
'WebGLShaderPrecisionFormat',
|
|
2219
|
-
'WebGLTexture',
|
|
2220
|
-
'WebGLUniformLocation',
|
|
2221
|
-
'WebGLVertexArrayObject',
|
|
2222
|
-
];
|
|
2223
|
-
function saveToWebGLVarMap(ctx, result) {
|
|
2224
|
-
if (!(result === null || result === void 0 ? void 0 : result.constructor))
|
|
2225
|
-
return;
|
|
2226
|
-
var name = result.constructor.name;
|
|
2227
|
-
if (!WebGLVariableConstructorsNames.includes(name))
|
|
2228
|
-
return;
|
|
2229
|
-
var variables = variableListFor(ctx, name);
|
|
2230
|
-
if (!variables.includes(result))
|
|
2231
|
-
variables.push(result);
|
|
2232
|
-
}
|
|
2233
|
-
function deserializeArg(imageMap, ctx) {
|
|
2234
|
-
return function (arg) {
|
|
2235
|
-
if (arg && typeof arg === 'object' && 'rr_type' in arg) {
|
|
2236
|
-
if ('index' in arg) {
|
|
2237
|
-
var name_1 = arg.rr_type, index = arg.index;
|
|
2238
|
-
return variableListFor(ctx, name_1)[index];
|
|
2239
|
-
}
|
|
2240
|
-
else if ('args' in arg) {
|
|
2241
|
-
var name_2 = arg.rr_type, args = arg.args;
|
|
2242
|
-
var ctor = window[name_2];
|
|
2243
|
-
return new (ctor.bind.apply(ctor, __spreadArray([void 0], __read(args.map(deserializeArg(imageMap, ctx))), false)))();
|
|
2244
|
-
}
|
|
2245
|
-
else if ('base64' in arg) {
|
|
2246
|
-
return decode(arg.base64);
|
|
2247
|
-
}
|
|
2248
|
-
else if ('src' in arg) {
|
|
2249
|
-
var image = imageMap.get(arg.src);
|
|
2250
|
-
if (image) {
|
|
2251
|
-
return image;
|
|
2252
|
-
}
|
|
2253
|
-
else {
|
|
2254
|
-
var image_1 = new Image();
|
|
2255
|
-
image_1.src = arg.src;
|
|
2256
|
-
imageMap.set(arg.src, image_1);
|
|
2257
|
-
return image_1;
|
|
2258
|
-
}
|
|
2259
|
-
}
|
|
2260
|
-
}
|
|
2261
|
-
else if (Array.isArray(arg)) {
|
|
2262
|
-
return arg.map(deserializeArg(imageMap, ctx));
|
|
2263
|
-
}
|
|
2264
|
-
return arg;
|
|
2265
|
-
};
|
|
2266
|
-
}
|
|
2267
|
-
function webglMutation(_a) {
|
|
2268
|
-
var mutation = _a.mutation, target = _a.target, type = _a.type, imageMap = _a.imageMap, errorHandler = _a.errorHandler;
|
|
2269
|
-
try {
|
|
2270
|
-
var ctx = getContext(target, type);
|
|
2271
|
-
if (!ctx)
|
|
2272
|
-
return;
|
|
2273
|
-
if (mutation.setter) {
|
|
2274
|
-
ctx[mutation.property] = mutation.args[0];
|
|
2275
|
-
return;
|
|
2276
|
-
}
|
|
2277
|
-
var original = ctx[mutation.property];
|
|
2278
|
-
var args = mutation.args.map(deserializeArg(imageMap, ctx));
|
|
2279
|
-
var result = original.apply(ctx, args);
|
|
2280
|
-
saveToWebGLVarMap(ctx, result);
|
|
2281
|
-
var debugMode = false;
|
|
2282
|
-
if (debugMode) {
|
|
2283
|
-
if (mutation.property === 'compileShader') {
|
|
2284
|
-
if (!ctx.getShaderParameter(args[0], ctx.COMPILE_STATUS))
|
|
2285
|
-
console.warn('something went wrong in replay', ctx.getShaderInfoLog(args[0]));
|
|
2286
|
-
}
|
|
2287
|
-
else if (mutation.property === 'linkProgram') {
|
|
2288
|
-
ctx.validateProgram(args[0]);
|
|
2289
|
-
if (!ctx.getProgramParameter(args[0], ctx.LINK_STATUS))
|
|
2290
|
-
console.warn('something went wrong in replay', ctx.getProgramInfoLog(args[0]));
|
|
2291
|
-
}
|
|
2292
|
-
var webglError = ctx.getError();
|
|
2293
|
-
if (webglError !== ctx.NO_ERROR) {
|
|
2294
|
-
console.warn.apply(console, __spreadArray(['WEBGL ERROR',
|
|
2295
|
-
webglError,
|
|
2296
|
-
'on command:',
|
|
2297
|
-
mutation.property], __read(args), false));
|
|
2298
|
-
}
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
catch (error) {
|
|
2302
|
-
errorHandler(mutation, error);
|
|
2303
|
-
}
|
|
2304
|
-
}
|
|
2305
|
-
|
|
2306
|
-
function canvasMutation$1(_a) {
|
|
2307
|
-
var event = _a.event, mutation = _a.mutation, target = _a.target, imageMap = _a.imageMap, errorHandler = _a.errorHandler;
|
|
2308
|
-
try {
|
|
2309
|
-
var ctx = target.getContext('2d');
|
|
2310
|
-
if (mutation.setter) {
|
|
2311
|
-
ctx[mutation.property] = mutation.args[0];
|
|
2312
|
-
return;
|
|
2313
|
-
}
|
|
2314
|
-
var original = ctx[mutation.property];
|
|
2315
|
-
if (mutation.property === 'drawImage' &&
|
|
2316
|
-
typeof mutation.args[0] === 'string') {
|
|
2317
|
-
var image = imageMap.get(event);
|
|
2318
|
-
mutation.args[0] = image;
|
|
2319
|
-
original.apply(ctx, mutation.args);
|
|
2320
|
-
}
|
|
2321
|
-
else {
|
|
2322
|
-
original.apply(ctx, mutation.args);
|
|
2323
|
-
}
|
|
2324
|
-
}
|
|
2325
|
-
catch (error) {
|
|
2326
|
-
errorHandler(mutation, error);
|
|
2327
|
-
}
|
|
2328
|
-
}
|
|
2329
|
-
|
|
2330
|
-
function canvasMutation(_a) {
|
|
2331
|
-
var event = _a.event, mutation = _a.mutation, target = _a.target, imageMap = _a.imageMap, errorHandler = _a.errorHandler;
|
|
2332
|
-
try {
|
|
2333
|
-
var mutations = 'commands' in mutation ? mutation.commands : [mutation];
|
|
2334
|
-
if ([CanvasContext.WebGL, CanvasContext.WebGL2].includes(mutation.type)) {
|
|
2335
|
-
return mutations.forEach(function (command) {
|
|
2336
|
-
webglMutation({
|
|
2337
|
-
mutation: command,
|
|
2338
|
-
type: mutation.type,
|
|
2339
|
-
target: target,
|
|
2340
|
-
imageMap: imageMap,
|
|
2341
|
-
errorHandler: errorHandler,
|
|
2342
|
-
});
|
|
2343
|
-
});
|
|
2344
|
-
}
|
|
2345
|
-
return mutations.forEach(function (command) {
|
|
2346
|
-
canvasMutation$1({
|
|
2347
|
-
event: event,
|
|
2348
|
-
mutation: command,
|
|
2349
|
-
target: target,
|
|
2350
|
-
imageMap: imageMap,
|
|
2351
|
-
errorHandler: errorHandler,
|
|
2352
|
-
});
|
|
2353
|
-
});
|
|
2354
|
-
}
|
|
2355
|
-
catch (error) {
|
|
2356
|
-
errorHandler(mutation, error);
|
|
2357
|
-
}
|
|
2358
|
-
}
|
|
2359
|
-
|
|
2360
|
-
var SKIP_TIME_THRESHOLD = 10 * 1000;
|
|
2361
|
-
var SKIP_TIME_INTERVAL = 2 * 1000;
|
|
2362
|
-
var SKIP_TIME_MIN = 1 * 1000;
|
|
2363
|
-
var SKIP_DURATION_LIMIT = 60 * 60 * 1000;
|
|
2364
|
-
var mitt = mitt$1 || mittProxy;
|
|
2365
|
-
var REPLAY_CONSOLE_PREFIX = '[replayer]';
|
|
2366
|
-
var defaultMouseTailConfig = {
|
|
2367
|
-
duration: 500,
|
|
2368
|
-
lineCap: 'round',
|
|
2369
|
-
lineWidth: 3,
|
|
2370
|
-
strokeStyle: 'red',
|
|
2371
|
-
};
|
|
2372
|
-
function indicatesTouchDevice(e) {
|
|
2373
|
-
return (e.type == EventType.IncrementalSnapshot &&
|
|
2374
|
-
(e.data.source == IncrementalSource.TouchMove ||
|
|
2375
|
-
(e.data.source == IncrementalSource.MouseInteraction &&
|
|
2376
|
-
e.data.type == MouseInteractions.TouchStart)));
|
|
2377
|
-
}
|
|
2378
|
-
var Replayer = (function () {
|
|
2379
|
-
function Replayer(events, config) {
|
|
2380
|
-
var _this = this;
|
|
2381
|
-
this.mouseTail = null;
|
|
2382
|
-
this.tailPositions = [];
|
|
2383
|
-
this.emitter = mitt();
|
|
2384
|
-
this.activityIntervals = [];
|
|
2385
|
-
this.legacy_missingNodeRetryMap = {};
|
|
2386
|
-
this.cache = createCache();
|
|
2387
|
-
this.imageMap = new Map();
|
|
2388
|
-
this.mirror = createMirror();
|
|
2389
|
-
this.firstFullSnapshot = null;
|
|
2390
|
-
this.newDocumentQueue = [];
|
|
2391
|
-
this.mousePos = null;
|
|
2392
|
-
this.touchActive = null;
|
|
2393
|
-
if (!(config === null || config === void 0 ? void 0 : config.liveMode) && events.length < 2) {
|
|
2394
|
-
throw new Error('Replayer need at least 2 events.');
|
|
2395
|
-
}
|
|
2396
|
-
var defaultConfig = {
|
|
2397
|
-
speed: 1,
|
|
2398
|
-
maxSpeed: 360,
|
|
2399
|
-
root: document.body,
|
|
2400
|
-
loadTimeout: 0,
|
|
2401
|
-
skipInactive: false,
|
|
2402
|
-
showWarning: true,
|
|
2403
|
-
showDebug: false,
|
|
2404
|
-
blockClass: 'highlight-block',
|
|
2405
|
-
liveMode: false,
|
|
2406
|
-
insertStyleRules: [],
|
|
2407
|
-
triggerFocus: true,
|
|
2408
|
-
UNSAFE_replayCanvas: false,
|
|
2409
|
-
pauseAnimation: true,
|
|
2410
|
-
mouseTail: defaultMouseTailConfig,
|
|
2411
|
-
inactiveThreshold: 0.02,
|
|
2412
|
-
inactiveSkipTime: SKIP_TIME_INTERVAL,
|
|
2413
|
-
};
|
|
2414
|
-
this.config = Object.assign({}, defaultConfig, config);
|
|
2415
|
-
this.handleResize = this.handleResize.bind(this);
|
|
2416
|
-
this.getCastFn = this.getCastFn.bind(this);
|
|
2417
|
-
this.applyEventsSynchronously = this.applyEventsSynchronously.bind(this);
|
|
2418
|
-
this.emitter.on(ReplayerEvents.Resize, this.handleResize);
|
|
2419
|
-
this.setupDom();
|
|
2420
|
-
this.treeIndex = new TreeIndex();
|
|
2421
|
-
this.fragmentParentMap = new Map();
|
|
2422
|
-
this.elementStateMap = new Map();
|
|
2423
|
-
this.virtualStyleRulesMap = new Map();
|
|
2424
|
-
this.emitter.on(ReplayerEvents.Flush, function () {
|
|
2425
|
-
var e_1, _a, e_2, _b, e_3, _c, e_4, _d;
|
|
2426
|
-
var _e = _this.treeIndex.flush(), scrollMap = _e.scrollMap, inputMap = _e.inputMap, mutationData = _e.mutationData;
|
|
2427
|
-
_this.fragmentParentMap.forEach(function (parent, frag) {
|
|
2428
|
-
return _this.restoreRealParent(frag, parent);
|
|
2429
|
-
});
|
|
2430
|
-
try {
|
|
2431
|
-
for (var _f = __values(mutationData.texts), _g = _f.next(); !_g.done; _g = _f.next()) {
|
|
2432
|
-
var d = _g.value;
|
|
2433
|
-
_this.applyText(d, mutationData);
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2437
|
-
finally {
|
|
2438
|
-
try {
|
|
2439
|
-
if (_g && !_g.done && (_a = _f.return)) _a.call(_f);
|
|
2440
|
-
}
|
|
2441
|
-
finally { if (e_1) throw e_1.error; }
|
|
2442
|
-
}
|
|
2443
|
-
try {
|
|
2444
|
-
for (var _h = __values(_this.virtualStyleRulesMap.keys()), _j = _h.next(); !_j.done; _j = _h.next()) {
|
|
2445
|
-
var node = _j.value;
|
|
2446
|
-
_this.restoreNodeSheet(node);
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2450
|
-
finally {
|
|
2451
|
-
try {
|
|
2452
|
-
if (_j && !_j.done && (_b = _h.return)) _b.call(_h);
|
|
2453
|
-
}
|
|
2454
|
-
finally { if (e_2) throw e_2.error; }
|
|
2455
|
-
}
|
|
2456
|
-
_this.fragmentParentMap.clear();
|
|
2457
|
-
_this.elementStateMap.clear();
|
|
2458
|
-
_this.virtualStyleRulesMap.clear();
|
|
2459
|
-
try {
|
|
2460
|
-
for (var _k = __values(scrollMap.values()), _l = _k.next(); !_l.done; _l = _k.next()) {
|
|
2461
|
-
var d = _l.value;
|
|
2462
|
-
_this.applyScroll(d, true);
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2466
|
-
finally {
|
|
2467
|
-
try {
|
|
2468
|
-
if (_l && !_l.done && (_c = _k.return)) _c.call(_k);
|
|
2469
|
-
}
|
|
2470
|
-
finally { if (e_3) throw e_3.error; }
|
|
2471
|
-
}
|
|
2472
|
-
try {
|
|
2473
|
-
for (var _m = __values(inputMap.values()), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
2474
|
-
var d = _o.value;
|
|
2475
|
-
_this.applyInput(d);
|
|
2476
|
-
}
|
|
2477
|
-
}
|
|
2478
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
2479
|
-
finally {
|
|
2480
|
-
try {
|
|
2481
|
-
if (_o && !_o.done && (_d = _m.return)) _d.call(_m);
|
|
2482
|
-
}
|
|
2483
|
-
finally { if (e_4) throw e_4.error; }
|
|
2484
|
-
}
|
|
2485
|
-
});
|
|
2486
|
-
this.emitter.on(ReplayerEvents.PlayBack, function () {
|
|
2487
|
-
_this.firstFullSnapshot = null;
|
|
2488
|
-
_this.mirror.reset();
|
|
2489
|
-
});
|
|
2490
|
-
var timer = new Timer([], (config === null || config === void 0 ? void 0 : config.speed) || defaultConfig.speed);
|
|
2491
|
-
this.service = createPlayerService({
|
|
2492
|
-
events: events
|
|
2493
|
-
.map(function (e) {
|
|
2494
|
-
if (config && config.unpackFn) {
|
|
2495
|
-
return config.unpackFn(e);
|
|
2496
|
-
}
|
|
2497
|
-
return e;
|
|
2498
|
-
})
|
|
2499
|
-
.sort(function (a1, a2) { return a1.timestamp - a2.timestamp; }),
|
|
2500
|
-
timer: timer,
|
|
2501
|
-
timeOffset: 0,
|
|
2502
|
-
baselineTime: 0,
|
|
2503
|
-
lastPlayedEvent: null,
|
|
2504
|
-
}, {
|
|
2505
|
-
getCastFn: this.getCastFn,
|
|
2506
|
-
applyEventsSynchronously: this.applyEventsSynchronously,
|
|
2507
|
-
emitter: this.emitter,
|
|
2508
|
-
});
|
|
2509
|
-
this.service.start();
|
|
2510
|
-
this.service.subscribe(function (state) {
|
|
2511
|
-
_this.emitter.emit(ReplayerEvents.StateChange, {
|
|
2512
|
-
player: state,
|
|
2513
|
-
});
|
|
2514
|
-
});
|
|
2515
|
-
this.speedService = createSpeedService({
|
|
2516
|
-
normalSpeed: -1,
|
|
2517
|
-
timer: timer,
|
|
2518
|
-
});
|
|
2519
|
-
this.speedService.start();
|
|
2520
|
-
this.speedService.subscribe(function (state) {
|
|
2521
|
-
_this.emitter.emit(ReplayerEvents.StateChange, {
|
|
2522
|
-
speed: state,
|
|
2523
|
-
});
|
|
2524
|
-
});
|
|
2525
|
-
var firstMeta = this.service.state.context.events.find(function (e) { return e.type === EventType.Meta; });
|
|
2526
|
-
var firstFullsnapshot = this.service.state.context.events.find(function (e) { return e.type === EventType.FullSnapshot; });
|
|
2527
|
-
if (firstMeta) {
|
|
2528
|
-
var _a = firstMeta.data, width_1 = _a.width, height_1 = _a.height;
|
|
2529
|
-
setTimeout(function () {
|
|
2530
|
-
_this.emitter.emit(ReplayerEvents.Resize, {
|
|
2531
|
-
width: width_1,
|
|
2532
|
-
height: height_1,
|
|
2533
|
-
});
|
|
2534
|
-
}, 0);
|
|
2535
|
-
}
|
|
2536
|
-
if (firstFullsnapshot) {
|
|
2537
|
-
setTimeout(function () {
|
|
2538
|
-
if (_this.firstFullSnapshot) {
|
|
2539
|
-
return;
|
|
2540
|
-
}
|
|
2541
|
-
_this.firstFullSnapshot = firstFullsnapshot;
|
|
2542
|
-
_this.rebuildFullSnapshot(firstFullsnapshot);
|
|
2543
|
-
_this.iframe.contentWindow.scrollTo(firstFullsnapshot.data.initialOffset);
|
|
2544
|
-
}, 1);
|
|
2545
|
-
}
|
|
2546
|
-
if (this.service.state.context.events.find(indicatesTouchDevice)) {
|
|
2547
|
-
this.mouse.classList.add('touch-device');
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
|
-
Object.defineProperty(Replayer.prototype, "timer", {
|
|
2551
|
-
get: function () {
|
|
2552
|
-
return this.service.state.context.timer;
|
|
2553
|
-
},
|
|
2554
|
-
enumerable: false,
|
|
2555
|
-
configurable: true
|
|
2556
|
-
});
|
|
2557
|
-
Replayer.prototype.on = function (event, handler) {
|
|
2558
|
-
this.emitter.on(event, handler);
|
|
2559
|
-
return this;
|
|
2560
|
-
};
|
|
2561
|
-
Replayer.prototype.off = function (event, handler) {
|
|
2562
|
-
this.emitter.off(event, handler);
|
|
2563
|
-
return this;
|
|
2564
|
-
};
|
|
2565
|
-
Replayer.prototype.setConfig = function (config) {
|
|
2566
|
-
var _this = this;
|
|
2567
|
-
Object.keys(config).forEach(function (key) {
|
|
2568
|
-
_this.config[key] = config[key];
|
|
2569
|
-
});
|
|
2570
|
-
if (!this.config.skipInactive) {
|
|
2571
|
-
this.backToNormal();
|
|
2572
|
-
}
|
|
2573
|
-
if (typeof config.speed !== 'undefined') {
|
|
2574
|
-
this.speedService.send({
|
|
2575
|
-
type: 'SET_SPEED',
|
|
2576
|
-
payload: {
|
|
2577
|
-
speed: config.speed,
|
|
2578
|
-
},
|
|
2579
|
-
});
|
|
2580
|
-
}
|
|
2581
|
-
if (typeof config.mouseTail !== 'undefined') {
|
|
2582
|
-
if (config.mouseTail === false) {
|
|
2583
|
-
if (this.mouseTail) {
|
|
2584
|
-
this.mouseTail.style.display = 'none';
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
else {
|
|
2588
|
-
if (!this.mouseTail) {
|
|
2589
|
-
this.mouseTail = document.createElement('canvas');
|
|
2590
|
-
this.mouseTail.width = Number.parseFloat(this.iframe.width);
|
|
2591
|
-
this.mouseTail.height = Number.parseFloat(this.iframe.height);
|
|
2592
|
-
this.mouseTail.classList.add('replayer-mouse-tail');
|
|
2593
|
-
this.wrapper.insertBefore(this.mouseTail, this.iframe);
|
|
2594
|
-
}
|
|
2595
|
-
this.mouseTail.style.display = 'inherit';
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
};
|
|
2599
|
-
Replayer.prototype.getActivityIntervals = function () {
|
|
2600
|
-
var _this = this;
|
|
2601
|
-
if (this.activityIntervals.length == 0) {
|
|
2602
|
-
var allIntervals = [];
|
|
2603
|
-
var metadata = this.getMetaData();
|
|
2604
|
-
var userInteractionEvents = __spreadArray(__spreadArray([
|
|
2605
|
-
{ timestamp: metadata.startTime }
|
|
2606
|
-
], __read(this.service.state.context.events.filter(function (ev) {
|
|
2607
|
-
return _this.isUserInteraction(ev);
|
|
2608
|
-
})), false), [
|
|
2609
|
-
{ timestamp: metadata.endTime },
|
|
2610
|
-
], false);
|
|
2611
|
-
for (var i = 1; i < userInteractionEvents.length; i++) {
|
|
2612
|
-
var currentInterval_1 = userInteractionEvents[i - 1];
|
|
2613
|
-
var _event = userInteractionEvents[i];
|
|
2614
|
-
if (_event.timestamp - currentInterval_1.timestamp >
|
|
2615
|
-
SKIP_TIME_THRESHOLD) {
|
|
2616
|
-
allIntervals.push({
|
|
2617
|
-
startTime: currentInterval_1.timestamp,
|
|
2618
|
-
endTime: _event.timestamp,
|
|
2619
|
-
duration: _event.timestamp - currentInterval_1.timestamp,
|
|
2620
|
-
active: false,
|
|
2621
|
-
});
|
|
2622
|
-
}
|
|
2623
|
-
else {
|
|
2624
|
-
allIntervals.push({
|
|
2625
|
-
startTime: currentInterval_1.timestamp,
|
|
2626
|
-
endTime: _event.timestamp,
|
|
2627
|
-
duration: _event.timestamp - currentInterval_1.timestamp,
|
|
2628
|
-
active: true,
|
|
2629
|
-
});
|
|
2630
|
-
}
|
|
2631
|
-
}
|
|
2632
|
-
var mergedIntervals = [];
|
|
2633
|
-
var currentInterval = allIntervals[0];
|
|
2634
|
-
for (var i = 1; i < allIntervals.length; i++) {
|
|
2635
|
-
if (allIntervals[i].active != allIntervals[i - 1].active) {
|
|
2636
|
-
mergedIntervals.push({
|
|
2637
|
-
startTime: currentInterval.startTime,
|
|
2638
|
-
endTime: allIntervals[i - 1].endTime,
|
|
2639
|
-
duration: allIntervals[i - 1].endTime - currentInterval.startTime,
|
|
2640
|
-
active: allIntervals[i - 1].active,
|
|
2641
|
-
});
|
|
2642
|
-
currentInterval = allIntervals[i];
|
|
2643
|
-
}
|
|
2644
|
-
}
|
|
2645
|
-
if (currentInterval && allIntervals.length > 0) {
|
|
2646
|
-
mergedIntervals.push({
|
|
2647
|
-
startTime: currentInterval.startTime,
|
|
2648
|
-
endTime: allIntervals[allIntervals.length - 1].endTime,
|
|
2649
|
-
duration: allIntervals[allIntervals.length - 1].endTime -
|
|
2650
|
-
currentInterval.startTime,
|
|
2651
|
-
active: allIntervals[allIntervals.length - 1].active,
|
|
2652
|
-
});
|
|
2653
|
-
}
|
|
2654
|
-
currentInterval = mergedIntervals[0];
|
|
2655
|
-
for (var i = 1; i < mergedIntervals.length; i++) {
|
|
2656
|
-
if ((!mergedIntervals[i].active &&
|
|
2657
|
-
mergedIntervals[i].duration >
|
|
2658
|
-
this.config.inactiveThreshold * metadata.totalTime) ||
|
|
2659
|
-
(!mergedIntervals[i - 1].active &&
|
|
2660
|
-
mergedIntervals[i - 1].duration >
|
|
2661
|
-
this.config.inactiveThreshold * metadata.totalTime)) {
|
|
2662
|
-
this.activityIntervals.push({
|
|
2663
|
-
startTime: currentInterval.startTime,
|
|
2664
|
-
endTime: mergedIntervals[i - 1].endTime,
|
|
2665
|
-
duration: mergedIntervals[i - 1].endTime - currentInterval.startTime,
|
|
2666
|
-
active: mergedIntervals[i - 1].active,
|
|
2667
|
-
});
|
|
2668
|
-
currentInterval = mergedIntervals[i];
|
|
2669
|
-
}
|
|
2670
|
-
}
|
|
2671
|
-
if (currentInterval && mergedIntervals.length > 0) {
|
|
2672
|
-
this.activityIntervals.push({
|
|
2673
|
-
startTime: currentInterval.startTime,
|
|
2674
|
-
endTime: mergedIntervals[mergedIntervals.length - 1].endTime,
|
|
2675
|
-
duration: mergedIntervals[mergedIntervals.length - 1].endTime -
|
|
2676
|
-
currentInterval.startTime,
|
|
2677
|
-
active: mergedIntervals[mergedIntervals.length - 1].active,
|
|
2678
|
-
});
|
|
2679
|
-
}
|
|
2680
|
-
}
|
|
2681
|
-
return this.activityIntervals;
|
|
2682
|
-
};
|
|
2683
|
-
Replayer.prototype.getMetaData = function () {
|
|
2684
|
-
var firstEvent = this.service.state.context.events[0];
|
|
2685
|
-
var lastEvent = this.service.state.context.events[this.service.state.context.events.length - 1];
|
|
2686
|
-
return {
|
|
2687
|
-
startTime: firstEvent.timestamp,
|
|
2688
|
-
endTime: lastEvent.timestamp,
|
|
2689
|
-
totalTime: lastEvent.timestamp - firstEvent.timestamp,
|
|
2690
|
-
};
|
|
2691
|
-
};
|
|
2692
|
-
Replayer.prototype.getCurrentTime = function () {
|
|
2693
|
-
return this.timer.timeOffset + this.getTimeOffset();
|
|
2694
|
-
};
|
|
2695
|
-
Replayer.prototype.getTimeOffset = function () {
|
|
2696
|
-
var _a = this.service.state.context, baselineTime = _a.baselineTime, events = _a.events;
|
|
2697
|
-
return baselineTime - events[0].timestamp;
|
|
2698
|
-
};
|
|
2699
|
-
Replayer.prototype.getMirror = function () {
|
|
2700
|
-
return this.mirror;
|
|
2701
|
-
};
|
|
2702
|
-
Replayer.prototype.play = function (timeOffset) {
|
|
2703
|
-
var _a;
|
|
2704
|
-
if (timeOffset === void 0) { timeOffset = 0; }
|
|
2705
|
-
if (this.service.state.matches('paused')) {
|
|
2706
|
-
this.service.send({ type: 'PLAY', payload: { timeOffset: timeOffset } });
|
|
2707
|
-
}
|
|
2708
|
-
else {
|
|
2709
|
-
this.service.send({ type: 'PAUSE' });
|
|
2710
|
-
this.service.send({ type: 'PLAY', payload: { timeOffset: timeOffset } });
|
|
2711
|
-
}
|
|
2712
|
-
(_a = this.iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('html')[0].classList.remove('rrweb-paused');
|
|
2713
|
-
this.emitter.emit(ReplayerEvents.Start);
|
|
2714
|
-
this.handleInactivity(this.getMetaData().startTime + timeOffset, true);
|
|
2715
|
-
};
|
|
2716
|
-
Replayer.prototype.pause = function (timeOffset) {
|
|
2717
|
-
var _a;
|
|
2718
|
-
if (timeOffset === undefined && this.service.state.matches('playing')) {
|
|
2719
|
-
this.service.send({ type: 'PAUSE' });
|
|
2720
|
-
}
|
|
2721
|
-
if (typeof timeOffset === 'number') {
|
|
2722
|
-
this.play(timeOffset);
|
|
2723
|
-
this.service.send({ type: 'PAUSE' });
|
|
2724
|
-
}
|
|
2725
|
-
(_a = this.iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.getElementsByTagName('html')[0].classList.add('rrweb-paused');
|
|
2726
|
-
this.emitter.emit(ReplayerEvents.Pause);
|
|
2727
|
-
};
|
|
2728
|
-
Replayer.prototype.resume = function (timeOffset) {
|
|
2729
|
-
if (timeOffset === void 0) { timeOffset = 0; }
|
|
2730
|
-
console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface.");
|
|
2731
|
-
this.play(timeOffset);
|
|
2732
|
-
this.emitter.emit(ReplayerEvents.Resume);
|
|
2733
|
-
};
|
|
2734
|
-
Replayer.prototype.startLive = function (baselineTime) {
|
|
2735
|
-
this.service.send({ type: 'TO_LIVE', payload: { baselineTime: baselineTime } });
|
|
2736
|
-
};
|
|
2737
|
-
Replayer.prototype.addEvent = function (rawEvent) {
|
|
2738
|
-
var _this = this;
|
|
2739
|
-
var event = this.config.unpackFn
|
|
2740
|
-
? this.config.unpackFn(rawEvent)
|
|
2741
|
-
: rawEvent;
|
|
2742
|
-
if (indicatesTouchDevice(event)) {
|
|
2743
|
-
this.mouse.classList.add('touch-device');
|
|
2744
|
-
}
|
|
2745
|
-
Promise.resolve().then(function () {
|
|
2746
|
-
return _this.service.send({ type: 'ADD_EVENT', payload: { event: event } });
|
|
2747
|
-
});
|
|
2748
|
-
};
|
|
2749
|
-
Replayer.prototype.replaceEvents = function (events) {
|
|
2750
|
-
var e_5, _a;
|
|
2751
|
-
try {
|
|
2752
|
-
for (var events_1 = __values(events), events_1_1 = events_1.next(); !events_1_1.done; events_1_1 = events_1.next()) {
|
|
2753
|
-
var event_1 = events_1_1.value;
|
|
2754
|
-
if (indicatesTouchDevice(event_1)) {
|
|
2755
|
-
this.mouse.classList.add('touch-device');
|
|
2756
|
-
break;
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
}
|
|
2760
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
2761
|
-
finally {
|
|
2762
|
-
try {
|
|
2763
|
-
if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
|
|
2764
|
-
}
|
|
2765
|
-
finally { if (e_5) throw e_5.error; }
|
|
2766
|
-
}
|
|
2767
|
-
this.service.send({ type: 'REPLACE_EVENTS', payload: { events: events } });
|
|
2768
|
-
};
|
|
2769
|
-
Replayer.prototype.enableInteract = function () {
|
|
2770
|
-
this.iframe.setAttribute('scrolling', 'auto');
|
|
2771
|
-
this.iframe.style.pointerEvents = 'auto';
|
|
2772
|
-
};
|
|
2773
|
-
Replayer.prototype.disableInteract = function () {
|
|
2774
|
-
this.iframe.setAttribute('scrolling', 'no');
|
|
2775
|
-
this.iframe.style.pointerEvents = 'none';
|
|
2776
|
-
};
|
|
2777
|
-
Replayer.prototype.resetCache = function () {
|
|
2778
|
-
this.cache = createCache();
|
|
2779
|
-
};
|
|
2780
|
-
Replayer.prototype.setupDom = function () {
|
|
2781
|
-
this.wrapper = document.createElement('div');
|
|
2782
|
-
this.wrapper.classList.add('replayer-wrapper');
|
|
2783
|
-
this.config.root.appendChild(this.wrapper);
|
|
2784
|
-
this.mouse = document.createElement('div');
|
|
2785
|
-
this.mouse.classList.add('replayer-mouse');
|
|
2786
|
-
this.wrapper.appendChild(this.mouse);
|
|
2787
|
-
if (this.config.mouseTail !== false) {
|
|
2788
|
-
this.mouseTail = document.createElement('canvas');
|
|
2789
|
-
this.mouseTail.classList.add('replayer-mouse-tail');
|
|
2790
|
-
this.mouseTail.style.display = 'inherit';
|
|
2791
|
-
this.wrapper.appendChild(this.mouseTail);
|
|
2792
|
-
}
|
|
2793
|
-
this.iframe = document.createElement('iframe');
|
|
2794
|
-
var attributes = ['allow-same-origin'];
|
|
2795
|
-
if (this.config.UNSAFE_replayCanvas) {
|
|
2796
|
-
attributes.push('allow-scripts');
|
|
2797
|
-
}
|
|
2798
|
-
this.iframe.style.display = 'none';
|
|
2799
|
-
this.iframe.setAttribute('sandbox', attributes.join(' '));
|
|
2800
|
-
this.disableInteract();
|
|
2801
|
-
this.wrapper.appendChild(this.iframe);
|
|
2802
|
-
if (this.iframe.contentWindow && this.iframe.contentDocument) {
|
|
2803
|
-
polyfill$1(this.iframe.contentWindow, this.iframe.contentDocument);
|
|
2804
|
-
polyfill(this.iframe.contentWindow);
|
|
2805
|
-
}
|
|
2806
|
-
};
|
|
2807
|
-
Replayer.prototype.handleResize = function (dimension) {
|
|
2808
|
-
var e_6, _a;
|
|
2809
|
-
this.iframe.style.display = 'inherit';
|
|
2810
|
-
try {
|
|
2811
|
-
for (var _b = __values([this.mouseTail, this.iframe]), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2812
|
-
var el = _c.value;
|
|
2813
|
-
if (!el) {
|
|
2814
|
-
continue;
|
|
2815
|
-
}
|
|
2816
|
-
el.setAttribute('width', String(dimension.width));
|
|
2817
|
-
el.setAttribute('height', String(dimension.height));
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
2821
|
-
finally {
|
|
2822
|
-
try {
|
|
2823
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2824
|
-
}
|
|
2825
|
-
finally { if (e_6) throw e_6.error; }
|
|
2826
|
-
}
|
|
2827
|
-
};
|
|
2828
|
-
Replayer.prototype.applyEventsSynchronously = function (events) {
|
|
2829
|
-
var e_7, _a;
|
|
2830
|
-
try {
|
|
2831
|
-
for (var events_2 = __values(events), events_2_1 = events_2.next(); !events_2_1.done; events_2_1 = events_2.next()) {
|
|
2832
|
-
var event_2 = events_2_1.value;
|
|
2833
|
-
switch (event_2.type) {
|
|
2834
|
-
case EventType.DomContentLoaded:
|
|
2835
|
-
case EventType.Load:
|
|
2836
|
-
case EventType.Custom:
|
|
2837
|
-
continue;
|
|
2838
|
-
case EventType.FullSnapshot:
|
|
2839
|
-
case EventType.Meta:
|
|
2840
|
-
case EventType.Plugin:
|
|
2841
|
-
break;
|
|
2842
|
-
case EventType.IncrementalSnapshot:
|
|
2843
|
-
switch (event_2.data.source) {
|
|
2844
|
-
case IncrementalSource.MediaInteraction:
|
|
2845
|
-
continue;
|
|
2846
|
-
default:
|
|
2847
|
-
break;
|
|
2848
|
-
}
|
|
2849
|
-
break;
|
|
2850
|
-
default:
|
|
2851
|
-
break;
|
|
2852
|
-
}
|
|
2853
|
-
var castFn = this.getCastFn(event_2, true);
|
|
2854
|
-
castFn();
|
|
2855
|
-
}
|
|
2856
|
-
}
|
|
2857
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2858
|
-
finally {
|
|
2859
|
-
try {
|
|
2860
|
-
if (events_2_1 && !events_2_1.done && (_a = events_2.return)) _a.call(events_2);
|
|
2861
|
-
}
|
|
2862
|
-
finally { if (e_7) throw e_7.error; }
|
|
2863
|
-
}
|
|
2864
|
-
if (this.mousePos) {
|
|
2865
|
-
this.moveAndHover(this.mousePos.x, this.mousePos.y, this.mousePos.id, true, this.mousePos.debugData);
|
|
2866
|
-
}
|
|
2867
|
-
this.mousePos = null;
|
|
2868
|
-
if (this.touchActive === true) {
|
|
2869
|
-
this.mouse.classList.add('touch-active');
|
|
2870
|
-
}
|
|
2871
|
-
else if (this.touchActive === false) {
|
|
2872
|
-
this.mouse.classList.remove('touch-active');
|
|
2873
|
-
}
|
|
2874
|
-
this.touchActive = null;
|
|
2875
|
-
};
|
|
2876
|
-
Replayer.prototype.getCastFn = function (event, isSync) {
|
|
2877
|
-
var _this = this;
|
|
2878
|
-
if (isSync === void 0) { isSync = false; }
|
|
2879
|
-
var castFn;
|
|
2880
|
-
switch (event.type) {
|
|
2881
|
-
case EventType.DomContentLoaded:
|
|
2882
|
-
case EventType.Load:
|
|
2883
|
-
break;
|
|
2884
|
-
case EventType.Custom:
|
|
2885
|
-
castFn = function () {
|
|
2886
|
-
_this.emitter.emit(ReplayerEvents.CustomEvent, event);
|
|
2887
|
-
};
|
|
2888
|
-
break;
|
|
2889
|
-
case EventType.Meta:
|
|
2890
|
-
castFn = function () {
|
|
2891
|
-
return _this.emitter.emit(ReplayerEvents.Resize, {
|
|
2892
|
-
width: event.data.width,
|
|
2893
|
-
height: event.data.height,
|
|
2894
|
-
});
|
|
2895
|
-
};
|
|
2896
|
-
break;
|
|
2897
|
-
case EventType.FullSnapshot:
|
|
2898
|
-
castFn = function () {
|
|
2899
|
-
if (_this.firstFullSnapshot) {
|
|
2900
|
-
if (_this.firstFullSnapshot === event) {
|
|
2901
|
-
_this.firstFullSnapshot = true;
|
|
2902
|
-
return;
|
|
2903
|
-
}
|
|
2904
|
-
}
|
|
2905
|
-
else {
|
|
2906
|
-
_this.firstFullSnapshot = true;
|
|
2907
|
-
}
|
|
2908
|
-
_this.rebuildFullSnapshot(event, isSync);
|
|
2909
|
-
_this.iframe.contentWindow.scrollTo(event.data.initialOffset);
|
|
2910
|
-
};
|
|
2911
|
-
break;
|
|
2912
|
-
case EventType.IncrementalSnapshot:
|
|
2913
|
-
castFn = function () {
|
|
2914
|
-
var e_8, _a;
|
|
2915
|
-
_this.applyIncremental(event, isSync);
|
|
2916
|
-
if (isSync) {
|
|
2917
|
-
return;
|
|
2918
|
-
}
|
|
2919
|
-
_this.handleInactivity(event.timestamp);
|
|
2920
|
-
if (event === _this.nextUserInteractionEvent) {
|
|
2921
|
-
_this.nextUserInteractionEvent = null;
|
|
2922
|
-
_this.backToNormal();
|
|
2923
|
-
}
|
|
2924
|
-
if (_this.config.skipInactive && !_this.nextUserInteractionEvent) {
|
|
2925
|
-
try {
|
|
2926
|
-
for (var _b = __values(_this.service.state.context.events), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2927
|
-
var _event = _c.value;
|
|
2928
|
-
if (_event.timestamp <= event.timestamp) {
|
|
2929
|
-
continue;
|
|
2930
|
-
}
|
|
2931
|
-
if (_this.isUserInteraction(_event)) {
|
|
2932
|
-
if (_event.delay - event.delay >
|
|
2933
|
-
SKIP_TIME_THRESHOLD *
|
|
2934
|
-
_this.speedService.state.context.timer.speed) {
|
|
2935
|
-
_this.nextUserInteractionEvent = _event;
|
|
2936
|
-
}
|
|
2937
|
-
break;
|
|
2938
|
-
}
|
|
2939
|
-
}
|
|
2940
|
-
}
|
|
2941
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
2942
|
-
finally {
|
|
2943
|
-
try {
|
|
2944
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2945
|
-
}
|
|
2946
|
-
finally { if (e_8) throw e_8.error; }
|
|
2947
|
-
}
|
|
2948
|
-
if (_this.nextUserInteractionEvent) {
|
|
2949
|
-
var skipTime = _this.nextUserInteractionEvent.delay - event.delay;
|
|
2950
|
-
var payload = {
|
|
2951
|
-
speed: Math.min(Math.round(skipTime / SKIP_TIME_INTERVAL), _this.config.maxSpeed),
|
|
2952
|
-
};
|
|
2953
|
-
_this.speedService.send({ type: 'FAST_FORWARD', payload: payload });
|
|
2954
|
-
_this.emitter.emit(ReplayerEvents.SkipStart, payload);
|
|
2955
|
-
}
|
|
2956
|
-
}
|
|
2957
|
-
};
|
|
2958
|
-
break;
|
|
2959
|
-
}
|
|
2960
|
-
var wrappedCastFn = function () {
|
|
2961
|
-
var e_9, _a;
|
|
2962
|
-
if (castFn) {
|
|
2963
|
-
castFn();
|
|
2964
|
-
}
|
|
2965
|
-
try {
|
|
2966
|
-
for (var _b = __values(_this.config.plugins || []), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
2967
|
-
var plugin = _c.value;
|
|
2968
|
-
plugin.handler(event, isSync, { replayer: _this });
|
|
2969
|
-
}
|
|
2970
|
-
}
|
|
2971
|
-
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
2972
|
-
finally {
|
|
2973
|
-
try {
|
|
2974
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
2975
|
-
}
|
|
2976
|
-
finally { if (e_9) throw e_9.error; }
|
|
2977
|
-
}
|
|
2978
|
-
_this.service.send({ type: 'CAST_EVENT', payload: { event: event } });
|
|
2979
|
-
var last_index = _this.service.state.context.events.length - 1;
|
|
2980
|
-
if (event === _this.service.state.context.events[last_index]) {
|
|
2981
|
-
var finish_1 = function () {
|
|
2982
|
-
if (last_index < _this.service.state.context.events.length - 1) {
|
|
2983
|
-
return;
|
|
2984
|
-
}
|
|
2985
|
-
_this.backToNormal();
|
|
2986
|
-
_this.service.send('END');
|
|
2987
|
-
_this.emitter.emit(ReplayerEvents.Finish);
|
|
2988
|
-
};
|
|
2989
|
-
if (event.type === EventType.IncrementalSnapshot &&
|
|
2990
|
-
event.data.source === IncrementalSource.MouseMove &&
|
|
2991
|
-
event.data.positions.length) {
|
|
2992
|
-
setTimeout(function () {
|
|
2993
|
-
finish_1();
|
|
2994
|
-
}, Math.max(0, -event.data.positions[0].timeOffset + 50));
|
|
2995
|
-
}
|
|
2996
|
-
else {
|
|
2997
|
-
finish_1();
|
|
2998
|
-
}
|
|
2999
|
-
}
|
|
3000
|
-
_this.emitter.emit(ReplayerEvents.EventCast, event);
|
|
3001
|
-
};
|
|
3002
|
-
return wrappedCastFn;
|
|
3003
|
-
};
|
|
3004
|
-
Replayer.prototype.handleInactivity = function (timestamp, resetNext) {
|
|
3005
|
-
var e_10, _a;
|
|
3006
|
-
if (timestamp === this.inactiveEndTimestamp || resetNext) {
|
|
3007
|
-
this.inactiveEndTimestamp = null;
|
|
3008
|
-
this.backToNormal();
|
|
3009
|
-
}
|
|
3010
|
-
if (this.config.skipInactive && !this.inactiveEndTimestamp) {
|
|
3011
|
-
try {
|
|
3012
|
-
for (var _b = __values(this.getActivityIntervals()), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3013
|
-
var interval = _c.value;
|
|
3014
|
-
if (timestamp >= interval.startTime &&
|
|
3015
|
-
timestamp < interval.endTime &&
|
|
3016
|
-
!interval.active) {
|
|
3017
|
-
this.inactiveEndTimestamp = interval.endTime;
|
|
3018
|
-
break;
|
|
3019
|
-
}
|
|
3020
|
-
}
|
|
3021
|
-
}
|
|
3022
|
-
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
3023
|
-
finally {
|
|
3024
|
-
try {
|
|
3025
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3026
|
-
}
|
|
3027
|
-
finally { if (e_10) throw e_10.error; }
|
|
3028
|
-
}
|
|
3029
|
-
if (this.inactiveEndTimestamp) {
|
|
3030
|
-
var skipTime = this.inactiveEndTimestamp - timestamp;
|
|
3031
|
-
var payload = {
|
|
3032
|
-
speed: (skipTime / SKIP_DURATION_LIMIT) * this.config.inactiveSkipTime <
|
|
3033
|
-
SKIP_TIME_MIN
|
|
3034
|
-
? skipTime / SKIP_TIME_MIN
|
|
3035
|
-
: Math.round(Math.max(skipTime, SKIP_DURATION_LIMIT) /
|
|
3036
|
-
this.config.inactiveSkipTime),
|
|
3037
|
-
};
|
|
3038
|
-
this.speedService.send({ type: 'FAST_FORWARD', payload: payload });
|
|
3039
|
-
this.emitter.emit(ReplayerEvents.SkipStart, payload);
|
|
3040
|
-
}
|
|
3041
|
-
}
|
|
3042
|
-
};
|
|
3043
|
-
Replayer.prototype.rebuildFullSnapshot = function (event, isSync) {
|
|
3044
|
-
var e_11, _a;
|
|
3045
|
-
var _this = this;
|
|
3046
|
-
if (isSync === void 0) { isSync = false; }
|
|
3047
|
-
if (!this.iframe.contentDocument) {
|
|
3048
|
-
return console.warn('Looks like your replayer has been destroyed.');
|
|
3049
|
-
}
|
|
3050
|
-
if (Object.keys(this.legacy_missingNodeRetryMap).length) {
|
|
3051
|
-
console.warn('Found unresolved missing node map', this.legacy_missingNodeRetryMap);
|
|
3052
|
-
}
|
|
3053
|
-
this.legacy_missingNodeRetryMap = {};
|
|
3054
|
-
var collected = [];
|
|
3055
|
-
this.mirror.map = rebuild(event.data.node, {
|
|
3056
|
-
doc: this.iframe.contentDocument,
|
|
3057
|
-
afterAppend: function (builtNode) {
|
|
3058
|
-
_this.collectIframeAndAttachDocument(collected, builtNode);
|
|
3059
|
-
},
|
|
3060
|
-
cache: this.cache,
|
|
3061
|
-
})[1];
|
|
3062
|
-
var _loop_1 = function (mutationInQueue, builtNode) {
|
|
3063
|
-
this_1.attachDocumentToIframe(mutationInQueue, builtNode);
|
|
3064
|
-
this_1.newDocumentQueue = this_1.newDocumentQueue.filter(function (m) { return m !== mutationInQueue; });
|
|
3065
|
-
};
|
|
3066
|
-
var this_1 = this;
|
|
3067
|
-
try {
|
|
3068
|
-
for (var collected_1 = __values(collected), collected_1_1 = collected_1.next(); !collected_1_1.done; collected_1_1 = collected_1.next()) {
|
|
3069
|
-
var _b = collected_1_1.value, mutationInQueue = _b.mutationInQueue, builtNode = _b.builtNode;
|
|
3070
|
-
_loop_1(mutationInQueue, builtNode);
|
|
3071
|
-
}
|
|
3072
|
-
}
|
|
3073
|
-
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
3074
|
-
finally {
|
|
3075
|
-
try {
|
|
3076
|
-
if (collected_1_1 && !collected_1_1.done && (_a = collected_1.return)) _a.call(collected_1);
|
|
3077
|
-
}
|
|
3078
|
-
finally { if (e_11) throw e_11.error; }
|
|
3079
|
-
}
|
|
3080
|
-
var _c = this.iframe.contentDocument, documentElement = _c.documentElement, head = _c.head;
|
|
3081
|
-
this.insertStyleRules(documentElement, head);
|
|
3082
|
-
if (!this.service.state.matches('playing')) {
|
|
3083
|
-
this.iframe.contentDocument
|
|
3084
|
-
.getElementsByTagName('html')[0]
|
|
3085
|
-
.classList.add('rrweb-paused');
|
|
3086
|
-
}
|
|
3087
|
-
this.emitter.emit(ReplayerEvents.FullsnapshotRebuilded, event);
|
|
3088
|
-
if (!isSync) {
|
|
3089
|
-
this.waitForStylesheetLoad();
|
|
3090
|
-
}
|
|
3091
|
-
if (this.config.UNSAFE_replayCanvas) {
|
|
3092
|
-
this.preloadAllImages();
|
|
3093
|
-
}
|
|
3094
|
-
};
|
|
3095
|
-
Replayer.prototype.insertStyleRules = function (documentElement, head) {
|
|
3096
|
-
var styleEl = document.createElement('style');
|
|
3097
|
-
documentElement.insertBefore(styleEl, head);
|
|
3098
|
-
var injectStylesRules = rules(this.config.blockClass).concat(this.config.insertStyleRules);
|
|
3099
|
-
if (this.config.pauseAnimation) {
|
|
3100
|
-
injectStylesRules.push('html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }');
|
|
3101
|
-
}
|
|
3102
|
-
for (var idx = 0; idx < injectStylesRules.length; idx++) {
|
|
3103
|
-
styleEl.sheet.insertRule(injectStylesRules[idx], idx);
|
|
3104
|
-
}
|
|
3105
|
-
};
|
|
3106
|
-
Replayer.prototype.attachDocumentToIframe = function (mutation, iframeEl) {
|
|
3107
|
-
var e_12, _a;
|
|
3108
|
-
var _this = this;
|
|
3109
|
-
var collected = [];
|
|
3110
|
-
if (!iframeEl.contentDocument) {
|
|
3111
|
-
var parent_1 = iframeEl.parentNode;
|
|
3112
|
-
while (parent_1) {
|
|
3113
|
-
if (this.fragmentParentMap.has(parent_1)) {
|
|
3114
|
-
var frag = parent_1;
|
|
3115
|
-
var realParent = this.fragmentParentMap.get(frag);
|
|
3116
|
-
this.restoreRealParent(frag, realParent);
|
|
3117
|
-
break;
|
|
3118
|
-
}
|
|
3119
|
-
parent_1 = parent_1.parentNode;
|
|
3120
|
-
}
|
|
3121
|
-
}
|
|
3122
|
-
buildNodeWithSN(mutation.node, {
|
|
3123
|
-
doc: iframeEl.contentDocument,
|
|
3124
|
-
map: this.mirror.map,
|
|
3125
|
-
hackCss: true,
|
|
3126
|
-
skipChild: false,
|
|
3127
|
-
afterAppend: function (builtNode) {
|
|
3128
|
-
_this.collectIframeAndAttachDocument(collected, builtNode);
|
|
3129
|
-
if (builtNode.__sn.type === NodeType.Element &&
|
|
3130
|
-
builtNode.__sn.tagName.toUpperCase() === 'HTML') {
|
|
3131
|
-
var _a = iframeEl.contentDocument, documentElement = _a.documentElement, head = _a.head;
|
|
3132
|
-
_this.insertStyleRules(documentElement, head);
|
|
3133
|
-
}
|
|
3134
|
-
},
|
|
3135
|
-
cache: this.cache,
|
|
3136
|
-
});
|
|
3137
|
-
var _loop_2 = function (mutationInQueue, builtNode) {
|
|
3138
|
-
this_2.attachDocumentToIframe(mutationInQueue, builtNode);
|
|
3139
|
-
this_2.newDocumentQueue = this_2.newDocumentQueue.filter(function (m) { return m !== mutationInQueue; });
|
|
3140
|
-
};
|
|
3141
|
-
var this_2 = this;
|
|
3142
|
-
try {
|
|
3143
|
-
for (var collected_2 = __values(collected), collected_2_1 = collected_2.next(); !collected_2_1.done; collected_2_1 = collected_2.next()) {
|
|
3144
|
-
var _b = collected_2_1.value, mutationInQueue = _b.mutationInQueue, builtNode = _b.builtNode;
|
|
3145
|
-
_loop_2(mutationInQueue, builtNode);
|
|
3146
|
-
}
|
|
3147
|
-
}
|
|
3148
|
-
catch (e_12_1) { e_12 = { error: e_12_1 }; }
|
|
3149
|
-
finally {
|
|
3150
|
-
try {
|
|
3151
|
-
if (collected_2_1 && !collected_2_1.done && (_a = collected_2.return)) _a.call(collected_2);
|
|
3152
|
-
}
|
|
3153
|
-
finally { if (e_12) throw e_12.error; }
|
|
3154
|
-
}
|
|
3155
|
-
};
|
|
3156
|
-
Replayer.prototype.collectIframeAndAttachDocument = function (collected, builtNode) {
|
|
3157
|
-
if (isIframeINode(builtNode)) {
|
|
3158
|
-
var mutationInQueue = this.newDocumentQueue.find(function (m) { return m.parentId === builtNode.__sn.id; });
|
|
3159
|
-
if (mutationInQueue) {
|
|
3160
|
-
collected.push({ mutationInQueue: mutationInQueue, builtNode: builtNode });
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
};
|
|
3164
|
-
Replayer.prototype.waitForStylesheetLoad = function () {
|
|
3165
|
-
var _this = this;
|
|
3166
|
-
var _a;
|
|
3167
|
-
var head = (_a = this.iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.head;
|
|
3168
|
-
if (head) {
|
|
3169
|
-
var unloadSheets_1 = new Set();
|
|
3170
|
-
var timer_1;
|
|
3171
|
-
var beforeLoadState_1 = this.service.state;
|
|
3172
|
-
var stateHandler_1 = function () {
|
|
3173
|
-
beforeLoadState_1 = _this.service.state;
|
|
3174
|
-
};
|
|
3175
|
-
this.emitter.on(ReplayerEvents.Start, stateHandler_1);
|
|
3176
|
-
this.emitter.on(ReplayerEvents.Pause, stateHandler_1);
|
|
3177
|
-
var unsubscribe_1 = function () {
|
|
3178
|
-
_this.emitter.off(ReplayerEvents.Start, stateHandler_1);
|
|
3179
|
-
_this.emitter.off(ReplayerEvents.Pause, stateHandler_1);
|
|
3180
|
-
};
|
|
3181
|
-
head
|
|
3182
|
-
.querySelectorAll('link[rel="stylesheet"]')
|
|
3183
|
-
.forEach(function (css) {
|
|
3184
|
-
if (!css.sheet) {
|
|
3185
|
-
unloadSheets_1.add(css);
|
|
3186
|
-
css.addEventListener('load', function () {
|
|
3187
|
-
unloadSheets_1.delete(css);
|
|
3188
|
-
if (unloadSheets_1.size === 0 && timer_1 !== -1) {
|
|
3189
|
-
if (beforeLoadState_1.matches('playing')) {
|
|
3190
|
-
_this.play(_this.getCurrentTime());
|
|
3191
|
-
}
|
|
3192
|
-
_this.emitter.emit(ReplayerEvents.LoadStylesheetEnd);
|
|
3193
|
-
if (timer_1) {
|
|
3194
|
-
clearTimeout(timer_1);
|
|
3195
|
-
}
|
|
3196
|
-
unsubscribe_1();
|
|
3197
|
-
}
|
|
3198
|
-
});
|
|
3199
|
-
}
|
|
3200
|
-
});
|
|
3201
|
-
if (unloadSheets_1.size > 0) {
|
|
3202
|
-
this.service.send({ type: 'PAUSE' });
|
|
3203
|
-
this.emitter.emit(ReplayerEvents.LoadStylesheetStart);
|
|
3204
|
-
timer_1 = setTimeout(function () {
|
|
3205
|
-
if (beforeLoadState_1.matches('playing')) {
|
|
3206
|
-
_this.play(_this.getCurrentTime());
|
|
3207
|
-
}
|
|
3208
|
-
timer_1 = -1;
|
|
3209
|
-
unsubscribe_1();
|
|
3210
|
-
}, this.config.loadTimeout);
|
|
3211
|
-
}
|
|
3212
|
-
}
|
|
3213
|
-
};
|
|
3214
|
-
Replayer.prototype.hasImageArg = function (args) {
|
|
3215
|
-
var e_13, _a;
|
|
3216
|
-
try {
|
|
3217
|
-
for (var args_1 = __values(args), args_1_1 = args_1.next(); !args_1_1.done; args_1_1 = args_1.next()) {
|
|
3218
|
-
var arg = args_1_1.value;
|
|
3219
|
-
if (!arg || typeof arg !== 'object') {
|
|
3220
|
-
}
|
|
3221
|
-
else if ('rr_type' in arg && 'args' in arg) {
|
|
3222
|
-
if (this.hasImageArg(arg.args))
|
|
3223
|
-
return true;
|
|
3224
|
-
}
|
|
3225
|
-
else if ('rr_type' in arg && arg.rr_type === 'HTMLImageElement') {
|
|
3226
|
-
return true;
|
|
3227
|
-
}
|
|
3228
|
-
else if (arg instanceof Array) {
|
|
3229
|
-
if (this.hasImageArg(arg))
|
|
3230
|
-
return true;
|
|
3231
|
-
}
|
|
3232
|
-
}
|
|
3233
|
-
}
|
|
3234
|
-
catch (e_13_1) { e_13 = { error: e_13_1 }; }
|
|
3235
|
-
finally {
|
|
3236
|
-
try {
|
|
3237
|
-
if (args_1_1 && !args_1_1.done && (_a = args_1.return)) _a.call(args_1);
|
|
3238
|
-
}
|
|
3239
|
-
finally { if (e_13) throw e_13.error; }
|
|
3240
|
-
}
|
|
3241
|
-
return false;
|
|
3242
|
-
};
|
|
3243
|
-
Replayer.prototype.getImageArgs = function (args) {
|
|
3244
|
-
var e_14, _a;
|
|
3245
|
-
var images = [];
|
|
3246
|
-
try {
|
|
3247
|
-
for (var args_2 = __values(args), args_2_1 = args_2.next(); !args_2_1.done; args_2_1 = args_2.next()) {
|
|
3248
|
-
var arg = args_2_1.value;
|
|
3249
|
-
if (!arg || typeof arg !== 'object') {
|
|
3250
|
-
}
|
|
3251
|
-
else if ('rr_type' in arg && 'args' in arg) {
|
|
3252
|
-
images.push.apply(images, __spreadArray([], __read(this.getImageArgs(arg.args)), false));
|
|
3253
|
-
}
|
|
3254
|
-
else if ('rr_type' in arg && arg.rr_type === 'HTMLImageElement') {
|
|
3255
|
-
images.push(arg.src);
|
|
3256
|
-
}
|
|
3257
|
-
else if (arg instanceof Array) {
|
|
3258
|
-
images.push.apply(images, __spreadArray([], __read(this.getImageArgs(arg)), false));
|
|
3259
|
-
}
|
|
3260
|
-
}
|
|
3261
|
-
}
|
|
3262
|
-
catch (e_14_1) { e_14 = { error: e_14_1 }; }
|
|
3263
|
-
finally {
|
|
3264
|
-
try {
|
|
3265
|
-
if (args_2_1 && !args_2_1.done && (_a = args_2.return)) _a.call(args_2);
|
|
3266
|
-
}
|
|
3267
|
-
finally { if (e_14) throw e_14.error; }
|
|
3268
|
-
}
|
|
3269
|
-
return images;
|
|
3270
|
-
};
|
|
3271
|
-
Replayer.prototype.preloadAllImages = function () {
|
|
3272
|
-
var e_15, _a;
|
|
3273
|
-
var _this = this;
|
|
3274
|
-
this.service.state;
|
|
3275
|
-
var stateHandler = function () {
|
|
3276
|
-
_this.service.state;
|
|
3277
|
-
};
|
|
3278
|
-
this.emitter.on(ReplayerEvents.Start, stateHandler);
|
|
3279
|
-
this.emitter.on(ReplayerEvents.Pause, stateHandler);
|
|
3280
|
-
var _loop_3 = function (event_3) {
|
|
3281
|
-
if (event_3.type === EventType.IncrementalSnapshot &&
|
|
3282
|
-
event_3.data.source === IncrementalSource.CanvasMutation)
|
|
3283
|
-
if ('commands' in event_3.data) {
|
|
3284
|
-
event_3.data.commands.forEach(function (c) { return _this.preloadImages(c, event_3); });
|
|
3285
|
-
}
|
|
3286
|
-
else {
|
|
3287
|
-
this_3.preloadImages(event_3.data, event_3);
|
|
3288
|
-
}
|
|
3289
|
-
};
|
|
3290
|
-
var this_3 = this;
|
|
3291
|
-
try {
|
|
3292
|
-
for (var _b = __values(this.service.state.context.events), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
3293
|
-
var event_3 = _c.value;
|
|
3294
|
-
_loop_3(event_3);
|
|
3295
|
-
}
|
|
3296
|
-
}
|
|
3297
|
-
catch (e_15_1) { e_15 = { error: e_15_1 }; }
|
|
3298
|
-
finally {
|
|
3299
|
-
try {
|
|
3300
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
3301
|
-
}
|
|
3302
|
-
finally { if (e_15) throw e_15.error; }
|
|
3303
|
-
}
|
|
3304
|
-
};
|
|
3305
|
-
Replayer.prototype.preloadImages = function (data, event) {
|
|
3306
|
-
var _this = this;
|
|
3307
|
-
if (data.property === 'drawImage' &&
|
|
3308
|
-
typeof data.args[0] === 'string' &&
|
|
3309
|
-
!this.imageMap.has(event)) {
|
|
3310
|
-
var canvas = document.createElement('canvas');
|
|
3311
|
-
var ctx = canvas.getContext('2d');
|
|
3312
|
-
var imgd = ctx === null || ctx === void 0 ? void 0 : ctx.createImageData(canvas.width, canvas.height);
|
|
3313
|
-
imgd === null || imgd === void 0 ? void 0 : imgd.data;
|
|
3314
|
-
JSON.parse(data.args[0]);
|
|
3315
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.putImageData(imgd, 0, 0);
|
|
3316
|
-
}
|
|
3317
|
-
else if (this.hasImageArg(data.args)) {
|
|
3318
|
-
this.getImageArgs(data.args).forEach(function (url) {
|
|
3319
|
-
var image = new Image();
|
|
3320
|
-
image.src = url;
|
|
3321
|
-
_this.imageMap.set(url, image);
|
|
3322
|
-
});
|
|
3323
|
-
}
|
|
3324
|
-
};
|
|
3325
|
-
Replayer.prototype.applyIncremental = function (e, isSync) {
|
|
3326
|
-
var _this = this;
|
|
3327
|
-
var _a, _b;
|
|
3328
|
-
var d = e.data;
|
|
3329
|
-
switch (d.source) {
|
|
3330
|
-
case IncrementalSource.Mutation: {
|
|
3331
|
-
if (isSync) {
|
|
3332
|
-
d.adds.forEach(function (m) { return _this.treeIndex.add(m); });
|
|
3333
|
-
d.texts.forEach(function (m) {
|
|
3334
|
-
var target = _this.mirror.getNode(m.id);
|
|
3335
|
-
var parent = target === null || target === void 0 ? void 0 : target.parentNode;
|
|
3336
|
-
if (parent && _this.virtualStyleRulesMap.has(parent))
|
|
3337
|
-
_this.virtualStyleRulesMap.delete(parent);
|
|
3338
|
-
_this.treeIndex.text(m);
|
|
3339
|
-
});
|
|
3340
|
-
d.attributes.forEach(function (m) { return _this.treeIndex.attribute(m); });
|
|
3341
|
-
d.removes.forEach(function (m) { return _this.treeIndex.remove(m, _this.mirror); });
|
|
3342
|
-
}
|
|
3343
|
-
try {
|
|
3344
|
-
this.applyMutation(d, isSync);
|
|
3345
|
-
}
|
|
3346
|
-
catch (error) {
|
|
3347
|
-
this.warn("Exception in mutation ".concat(error.message || error), d);
|
|
3348
|
-
}
|
|
3349
|
-
break;
|
|
3350
|
-
}
|
|
3351
|
-
case IncrementalSource.Drag:
|
|
3352
|
-
case IncrementalSource.TouchMove:
|
|
3353
|
-
case IncrementalSource.MouseMove:
|
|
3354
|
-
if (isSync) {
|
|
3355
|
-
var lastPosition = d.positions[d.positions.length - 1];
|
|
3356
|
-
this.mousePos = {
|
|
3357
|
-
x: lastPosition.x,
|
|
3358
|
-
y: lastPosition.y,
|
|
3359
|
-
id: lastPosition.id,
|
|
3360
|
-
debugData: d,
|
|
3361
|
-
};
|
|
3362
|
-
}
|
|
3363
|
-
else {
|
|
3364
|
-
d.positions.forEach(function (p) {
|
|
3365
|
-
var action = {
|
|
3366
|
-
doAction: function () {
|
|
3367
|
-
_this.moveAndHover(p.x, p.y, p.id, isSync, d);
|
|
3368
|
-
},
|
|
3369
|
-
delay: p.timeOffset +
|
|
3370
|
-
e.timestamp -
|
|
3371
|
-
_this.service.state.context.baselineTime,
|
|
3372
|
-
};
|
|
3373
|
-
_this.timer.addAction(action);
|
|
3374
|
-
});
|
|
3375
|
-
this.timer.addAction({
|
|
3376
|
-
doAction: function () { },
|
|
3377
|
-
delay: e.delay - ((_a = d.positions[0]) === null || _a === void 0 ? void 0 : _a.timeOffset),
|
|
3378
|
-
});
|
|
3379
|
-
}
|
|
3380
|
-
break;
|
|
3381
|
-
case IncrementalSource.MouseInteraction: {
|
|
3382
|
-
if (d.id === -1) {
|
|
3383
|
-
break;
|
|
3384
|
-
}
|
|
3385
|
-
var event_4 = new Event(MouseInteractions[d.type].toLowerCase());
|
|
3386
|
-
var target = this.mirror.getNode(d.id);
|
|
3387
|
-
if (!target) {
|
|
3388
|
-
return this.debugNodeNotFound(d, d.id);
|
|
3389
|
-
}
|
|
3390
|
-
this.emitter.emit(ReplayerEvents.MouseInteraction, {
|
|
3391
|
-
type: d.type,
|
|
3392
|
-
target: target,
|
|
3393
|
-
});
|
|
3394
|
-
var triggerFocus = this.config.triggerFocus;
|
|
3395
|
-
switch (d.type) {
|
|
3396
|
-
case MouseInteractions.Blur:
|
|
3397
|
-
if ('blur' in target) {
|
|
3398
|
-
target.blur();
|
|
3399
|
-
}
|
|
3400
|
-
break;
|
|
3401
|
-
case MouseInteractions.Focus:
|
|
3402
|
-
if (triggerFocus && target.focus) {
|
|
3403
|
-
target.focus({
|
|
3404
|
-
preventScroll: true,
|
|
3405
|
-
});
|
|
3406
|
-
}
|
|
3407
|
-
break;
|
|
3408
|
-
case MouseInteractions.Click:
|
|
3409
|
-
case MouseInteractions.TouchStart:
|
|
3410
|
-
case MouseInteractions.TouchEnd:
|
|
3411
|
-
if (isSync) {
|
|
3412
|
-
if (d.type === MouseInteractions.TouchStart) {
|
|
3413
|
-
this.touchActive = true;
|
|
3414
|
-
}
|
|
3415
|
-
else if (d.type === MouseInteractions.TouchEnd) {
|
|
3416
|
-
this.touchActive = false;
|
|
3417
|
-
}
|
|
3418
|
-
this.mousePos = {
|
|
3419
|
-
x: d.x,
|
|
3420
|
-
y: d.y,
|
|
3421
|
-
id: d.id,
|
|
3422
|
-
debugData: d,
|
|
3423
|
-
};
|
|
3424
|
-
}
|
|
3425
|
-
else {
|
|
3426
|
-
if (d.type === MouseInteractions.TouchStart) {
|
|
3427
|
-
this.tailPositions.length = 0;
|
|
3428
|
-
}
|
|
3429
|
-
this.moveAndHover(d.x, d.y, d.id, isSync, d);
|
|
3430
|
-
if (d.type === MouseInteractions.Click) {
|
|
3431
|
-
this.mouse.classList.remove('active');
|
|
3432
|
-
void this.mouse.offsetWidth;
|
|
3433
|
-
this.mouse.classList.add('active');
|
|
3434
|
-
}
|
|
3435
|
-
else if (d.type === MouseInteractions.TouchStart) {
|
|
3436
|
-
void this.mouse.offsetWidth;
|
|
3437
|
-
this.mouse.classList.add('touch-active');
|
|
3438
|
-
}
|
|
3439
|
-
else if (d.type === MouseInteractions.TouchEnd) {
|
|
3440
|
-
this.mouse.classList.remove('touch-active');
|
|
3441
|
-
}
|
|
3442
|
-
}
|
|
3443
|
-
break;
|
|
3444
|
-
case MouseInteractions.TouchCancel:
|
|
3445
|
-
if (isSync) {
|
|
3446
|
-
this.touchActive = false;
|
|
3447
|
-
}
|
|
3448
|
-
else {
|
|
3449
|
-
this.mouse.classList.remove('touch-active');
|
|
3450
|
-
}
|
|
3451
|
-
break;
|
|
3452
|
-
default:
|
|
3453
|
-
target.dispatchEvent(event_4);
|
|
3454
|
-
}
|
|
3455
|
-
break;
|
|
3456
|
-
}
|
|
3457
|
-
case IncrementalSource.Scroll: {
|
|
3458
|
-
if (d.id === -1) {
|
|
3459
|
-
break;
|
|
3460
|
-
}
|
|
3461
|
-
if (isSync) {
|
|
3462
|
-
this.treeIndex.scroll(d);
|
|
3463
|
-
break;
|
|
3464
|
-
}
|
|
3465
|
-
this.applyScroll(d, false);
|
|
3466
|
-
break;
|
|
3467
|
-
}
|
|
3468
|
-
case IncrementalSource.ViewportResize:
|
|
3469
|
-
this.emitter.emit(ReplayerEvents.Resize, {
|
|
3470
|
-
width: d.width,
|
|
3471
|
-
height: d.height,
|
|
3472
|
-
});
|
|
3473
|
-
break;
|
|
3474
|
-
case IncrementalSource.Input: {
|
|
3475
|
-
if (d.id === -1) {
|
|
3476
|
-
break;
|
|
3477
|
-
}
|
|
3478
|
-
if (isSync) {
|
|
3479
|
-
this.treeIndex.input(d);
|
|
3480
|
-
break;
|
|
3481
|
-
}
|
|
3482
|
-
this.applyInput(d);
|
|
3483
|
-
break;
|
|
3484
|
-
}
|
|
3485
|
-
case IncrementalSource.MediaInteraction: {
|
|
3486
|
-
var target = this.mirror.getNode(d.id);
|
|
3487
|
-
if (!target) {
|
|
3488
|
-
return this.debugNodeNotFound(d, d.id);
|
|
3489
|
-
}
|
|
3490
|
-
var mediaEl = target;
|
|
3491
|
-
try {
|
|
3492
|
-
if (d.currentTime) {
|
|
3493
|
-
mediaEl.currentTime = d.currentTime;
|
|
3494
|
-
}
|
|
3495
|
-
if (d.volume) {
|
|
3496
|
-
mediaEl.volume = d.volume;
|
|
3497
|
-
}
|
|
3498
|
-
if (d.muted) {
|
|
3499
|
-
mediaEl.muted = d.muted;
|
|
3500
|
-
}
|
|
3501
|
-
if (d.type === 1) {
|
|
3502
|
-
mediaEl.pause();
|
|
3503
|
-
}
|
|
3504
|
-
if (d.type === 0) {
|
|
3505
|
-
mediaEl.play();
|
|
3506
|
-
}
|
|
3507
|
-
}
|
|
3508
|
-
catch (error) {
|
|
3509
|
-
if (this.config.showWarning) {
|
|
3510
|
-
console.warn("Failed to replay media interactions: ".concat(error.message || error));
|
|
3511
|
-
}
|
|
3512
|
-
}
|
|
3513
|
-
break;
|
|
3514
|
-
}
|
|
3515
|
-
case IncrementalSource.StyleSheetRule: {
|
|
3516
|
-
var target = this.mirror.getNode(d.id);
|
|
3517
|
-
if (!target) {
|
|
3518
|
-
return this.debugNodeNotFound(d, d.id);
|
|
3519
|
-
}
|
|
3520
|
-
var styleEl = target;
|
|
3521
|
-
var parent_2 = target.parentNode;
|
|
3522
|
-
var usingVirtualParent_1 = this.fragmentParentMap.has(parent_2);
|
|
3523
|
-
var styleSheet_1 = usingVirtualParent_1 ? null : styleEl.sheet;
|
|
3524
|
-
var rules_1;
|
|
3525
|
-
if (!styleSheet_1) {
|
|
3526
|
-
if (this.virtualStyleRulesMap.has(target)) {
|
|
3527
|
-
rules_1 = this.virtualStyleRulesMap.get(target);
|
|
3528
|
-
}
|
|
3529
|
-
else {
|
|
3530
|
-
rules_1 = [];
|
|
3531
|
-
this.virtualStyleRulesMap.set(target, rules_1);
|
|
3532
|
-
}
|
|
3533
|
-
}
|
|
3534
|
-
if (d.adds) {
|
|
3535
|
-
d.adds.forEach(function (_a) {
|
|
3536
|
-
var rule = _a.rule, nestedIndex = _a.index;
|
|
3537
|
-
if (styleSheet_1) {
|
|
3538
|
-
try {
|
|
3539
|
-
if (Array.isArray(nestedIndex)) {
|
|
3540
|
-
var _b = getPositionsAndIndex(nestedIndex), positions = _b.positions, index = _b.index;
|
|
3541
|
-
var nestedRule = getNestedRule(styleSheet_1.cssRules, positions);
|
|
3542
|
-
nestedRule.insertRule(rule, index);
|
|
3543
|
-
}
|
|
3544
|
-
else {
|
|
3545
|
-
var index = nestedIndex === undefined
|
|
3546
|
-
? undefined
|
|
3547
|
-
: Math.min(nestedIndex, styleSheet_1.cssRules.length);
|
|
3548
|
-
styleSheet_1.insertRule(rule, index);
|
|
3549
|
-
}
|
|
3550
|
-
}
|
|
3551
|
-
catch (e) {
|
|
3552
|
-
}
|
|
3553
|
-
}
|
|
3554
|
-
else {
|
|
3555
|
-
rules_1 === null || rules_1 === void 0 ? void 0 : rules_1.push({
|
|
3556
|
-
cssText: rule,
|
|
3557
|
-
index: nestedIndex,
|
|
3558
|
-
type: StyleRuleType.Insert,
|
|
3559
|
-
});
|
|
3560
|
-
}
|
|
3561
|
-
});
|
|
3562
|
-
}
|
|
3563
|
-
if (d.removes) {
|
|
3564
|
-
d.removes.forEach(function (_a) {
|
|
3565
|
-
var nestedIndex = _a.index;
|
|
3566
|
-
if (usingVirtualParent_1) {
|
|
3567
|
-
rules_1 === null || rules_1 === void 0 ? void 0 : rules_1.push({ index: nestedIndex, type: StyleRuleType.Remove });
|
|
3568
|
-
}
|
|
3569
|
-
else {
|
|
3570
|
-
try {
|
|
3571
|
-
if (Array.isArray(nestedIndex)) {
|
|
3572
|
-
var _b = getPositionsAndIndex(nestedIndex), positions = _b.positions, index = _b.index;
|
|
3573
|
-
var nestedRule = getNestedRule(styleSheet_1.cssRules, positions);
|
|
3574
|
-
nestedRule.deleteRule(index || 0);
|
|
3575
|
-
}
|
|
3576
|
-
else {
|
|
3577
|
-
styleSheet_1 === null || styleSheet_1 === void 0 ? void 0 : styleSheet_1.deleteRule(nestedIndex);
|
|
3578
|
-
}
|
|
3579
|
-
}
|
|
3580
|
-
catch (e) {
|
|
3581
|
-
}
|
|
3582
|
-
}
|
|
3583
|
-
});
|
|
3584
|
-
}
|
|
3585
|
-
break;
|
|
3586
|
-
}
|
|
3587
|
-
case IncrementalSource.StyleDeclaration: {
|
|
3588
|
-
var target = this.mirror.getNode(d.id);
|
|
3589
|
-
if (!target) {
|
|
3590
|
-
return this.debugNodeNotFound(d, d.id);
|
|
3591
|
-
}
|
|
3592
|
-
var styleEl = target;
|
|
3593
|
-
var parent_3 = target.parentNode;
|
|
3594
|
-
var usingVirtualParent = this.fragmentParentMap.has(parent_3);
|
|
3595
|
-
var styleSheet = usingVirtualParent ? null : styleEl.sheet;
|
|
3596
|
-
var rules = [];
|
|
3597
|
-
if (!styleSheet) {
|
|
3598
|
-
if (this.virtualStyleRulesMap.has(target)) {
|
|
3599
|
-
rules = this.virtualStyleRulesMap.get(target);
|
|
3600
|
-
}
|
|
3601
|
-
else {
|
|
3602
|
-
rules = [];
|
|
3603
|
-
this.virtualStyleRulesMap.set(target, rules);
|
|
3604
|
-
}
|
|
3605
|
-
}
|
|
3606
|
-
if (d.set) {
|
|
3607
|
-
if (styleSheet) {
|
|
3608
|
-
var rule = getNestedRule(styleSheet.rules, d.index);
|
|
3609
|
-
rule.style.setProperty(d.set.property, d.set.value, d.set.priority);
|
|
3610
|
-
}
|
|
3611
|
-
else {
|
|
3612
|
-
rules.push(__assign({ type: StyleRuleType.SetProperty, index: d.index }, d.set));
|
|
3613
|
-
}
|
|
3614
|
-
}
|
|
3615
|
-
if (d.remove) {
|
|
3616
|
-
if (styleSheet) {
|
|
3617
|
-
var rule = getNestedRule(styleSheet.rules, d.index);
|
|
3618
|
-
rule.style.removeProperty(d.remove.property);
|
|
3619
|
-
}
|
|
3620
|
-
else {
|
|
3621
|
-
rules.push(__assign({ type: StyleRuleType.RemoveProperty, index: d.index }, d.remove));
|
|
3622
|
-
}
|
|
3623
|
-
}
|
|
3624
|
-
break;
|
|
3625
|
-
}
|
|
3626
|
-
case IncrementalSource.CanvasMutation: {
|
|
3627
|
-
if (!this.config.UNSAFE_replayCanvas) {
|
|
3628
|
-
return;
|
|
3629
|
-
}
|
|
3630
|
-
var target = this.mirror.getNode(d.id);
|
|
3631
|
-
if (!target) {
|
|
3632
|
-
return this.debugNodeNotFound(d, d.id);
|
|
3633
|
-
}
|
|
3634
|
-
canvasMutation({
|
|
3635
|
-
event: e,
|
|
3636
|
-
mutation: d,
|
|
3637
|
-
target: target,
|
|
3638
|
-
imageMap: this.imageMap,
|
|
3639
|
-
errorHandler: this.warnCanvasMutationFailed.bind(this),
|
|
3640
|
-
});
|
|
3641
|
-
break;
|
|
3642
|
-
}
|
|
3643
|
-
case IncrementalSource.Font: {
|
|
3644
|
-
try {
|
|
3645
|
-
var fontFace = new FontFace(d.family, d.buffer ? new Uint8Array(JSON.parse(d.fontSource)) : d.fontSource, d.descriptors);
|
|
3646
|
-
(_b = this.iframe.contentDocument) === null || _b === void 0 ? void 0 : _b.fonts.add(fontFace);
|
|
3647
|
-
}
|
|
3648
|
-
catch (error) {
|
|
3649
|
-
if (this.config.showWarning) {
|
|
3650
|
-
console.warn(error);
|
|
3651
|
-
}
|
|
3652
|
-
}
|
|
3653
|
-
break;
|
|
3654
|
-
}
|
|
3655
|
-
}
|
|
3656
|
-
};
|
|
3657
|
-
Replayer.prototype.applyMutation = function (d, useVirtualParent) {
|
|
3658
|
-
var e_16, _a;
|
|
3659
|
-
var _this = this;
|
|
3660
|
-
d.removes.forEach(function (mutation) {
|
|
3661
|
-
var target = _this.mirror.getNode(mutation.id);
|
|
3662
|
-
if (!target) {
|
|
3663
|
-
if (d.removes.find(function (r) { return r.id === mutation.parentId; })) {
|
|
3664
|
-
return;
|
|
3665
|
-
}
|
|
3666
|
-
return _this.warnNodeNotFound(d, mutation.id);
|
|
3667
|
-
}
|
|
3668
|
-
if (_this.virtualStyleRulesMap.has(target)) {
|
|
3669
|
-
_this.virtualStyleRulesMap.delete(target);
|
|
3670
|
-
}
|
|
3671
|
-
var parent = _this.mirror.getNode(mutation.parentId);
|
|
3672
|
-
if (!parent) {
|
|
3673
|
-
return _this.warnNodeNotFound(d, mutation.parentId);
|
|
3674
|
-
}
|
|
3675
|
-
if (mutation.isShadow && hasShadowRoot(parent)) {
|
|
3676
|
-
parent = parent.shadowRoot;
|
|
3677
|
-
}
|
|
3678
|
-
_this.mirror.removeNodeFromMap(target);
|
|
3679
|
-
if (parent) {
|
|
3680
|
-
var realTarget = null;
|
|
3681
|
-
var realParent = '__sn' in parent ? _this.fragmentParentMap.get(parent) : undefined;
|
|
3682
|
-
if (realParent && realParent.contains(target)) {
|
|
3683
|
-
parent = realParent;
|
|
3684
|
-
}
|
|
3685
|
-
else if (_this.fragmentParentMap.has(target)) {
|
|
3686
|
-
realTarget = _this.fragmentParentMap.get(target);
|
|
3687
|
-
_this.fragmentParentMap.delete(target);
|
|
3688
|
-
target = realTarget;
|
|
3689
|
-
}
|
|
3690
|
-
try {
|
|
3691
|
-
parent.removeChild(target);
|
|
3692
|
-
}
|
|
3693
|
-
catch (error) {
|
|
3694
|
-
if (error instanceof DOMException) {
|
|
3695
|
-
_this.warn('parent could not remove child in mutation', parent, realParent, target, realTarget, d);
|
|
3696
|
-
}
|
|
3697
|
-
else {
|
|
3698
|
-
throw error;
|
|
3699
|
-
}
|
|
3700
|
-
}
|
|
3701
|
-
}
|
|
3702
|
-
});
|
|
3703
|
-
var legacy_missingNodeMap = __assign({}, this.legacy_missingNodeRetryMap);
|
|
3704
|
-
var queue = [];
|
|
3705
|
-
var nextNotInDOM = function (mutation) {
|
|
3706
|
-
var next = null;
|
|
3707
|
-
if (mutation.nextId) {
|
|
3708
|
-
next = _this.mirror.getNode(mutation.nextId);
|
|
3709
|
-
}
|
|
3710
|
-
if (mutation.nextId !== null &&
|
|
3711
|
-
mutation.nextId !== undefined &&
|
|
3712
|
-
mutation.nextId !== -1 &&
|
|
3713
|
-
!next) {
|
|
3714
|
-
return true;
|
|
3715
|
-
}
|
|
3716
|
-
return false;
|
|
3717
|
-
};
|
|
3718
|
-
var appendNode = function (mutation) {
|
|
3719
|
-
var e_17, _a;
|
|
3720
|
-
var _b, _c;
|
|
3721
|
-
if (!_this.iframe.contentDocument) {
|
|
3722
|
-
return console.warn('Looks like your replayer has been destroyed.');
|
|
3723
|
-
}
|
|
3724
|
-
var parent = _this.mirror.getNode(mutation.parentId);
|
|
3725
|
-
if (!parent) {
|
|
3726
|
-
if (mutation.node.type === NodeType.Document) {
|
|
3727
|
-
return _this.newDocumentQueue.push(mutation);
|
|
3728
|
-
}
|
|
3729
|
-
return queue.push(mutation);
|
|
3730
|
-
}
|
|
3731
|
-
var parentInDocument = null;
|
|
3732
|
-
if (_this.iframe.contentDocument.contains) {
|
|
3733
|
-
parentInDocument = _this.iframe.contentDocument.contains(parent);
|
|
3734
|
-
}
|
|
3735
|
-
else if (_this.iframe.contentDocument.body.contains) {
|
|
3736
|
-
parentInDocument = _this.iframe.contentDocument.body.contains(parent);
|
|
3737
|
-
}
|
|
3738
|
-
var hasIframeChild = ((_c = (_b = parent).getElementsByTagName) === null || _c === void 0 ? void 0 : _c.call(_b, 'iframe').length) > 0;
|
|
3739
|
-
if (useVirtualParent &&
|
|
3740
|
-
parentInDocument &&
|
|
3741
|
-
!isIframeINode(parent) &&
|
|
3742
|
-
!hasIframeChild) {
|
|
3743
|
-
var virtualParent = document.createDocumentFragment();
|
|
3744
|
-
_this.mirror.map[mutation.parentId] = virtualParent;
|
|
3745
|
-
_this.fragmentParentMap.set(virtualParent, parent);
|
|
3746
|
-
_this.storeState(parent);
|
|
3747
|
-
while (parent.firstChild) {
|
|
3748
|
-
virtualParent.appendChild(parent.firstChild);
|
|
3749
|
-
}
|
|
3750
|
-
parent = virtualParent;
|
|
3751
|
-
}
|
|
3752
|
-
if (mutation.node.isShadow) {
|
|
3753
|
-
if (!hasShadowRoot(parent)) {
|
|
3754
|
-
parent.attachShadow({ mode: 'open' });
|
|
3755
|
-
parent = parent.shadowRoot;
|
|
3756
|
-
}
|
|
3757
|
-
else
|
|
3758
|
-
parent = parent.shadowRoot;
|
|
3759
|
-
}
|
|
3760
|
-
var previous = null;
|
|
3761
|
-
var next = null;
|
|
3762
|
-
if (mutation.previousId) {
|
|
3763
|
-
previous = _this.mirror.getNode(mutation.previousId);
|
|
3764
|
-
}
|
|
3765
|
-
if (mutation.nextId) {
|
|
3766
|
-
next = _this.mirror.getNode(mutation.nextId);
|
|
3767
|
-
}
|
|
3768
|
-
if (nextNotInDOM(mutation)) {
|
|
3769
|
-
return queue.push(mutation);
|
|
3770
|
-
}
|
|
3771
|
-
if (mutation.node.rootId && !_this.mirror.getNode(mutation.node.rootId)) {
|
|
3772
|
-
return;
|
|
3773
|
-
}
|
|
3774
|
-
var targetDoc = mutation.node.rootId
|
|
3775
|
-
? _this.mirror.getNode(mutation.node.rootId)
|
|
3776
|
-
: _this.iframe.contentDocument;
|
|
3777
|
-
if (isIframeINode(parent)) {
|
|
3778
|
-
_this.attachDocumentToIframe(mutation, parent);
|
|
3779
|
-
return;
|
|
3780
|
-
}
|
|
3781
|
-
var target = buildNodeWithSN(mutation.node, {
|
|
3782
|
-
doc: targetDoc,
|
|
3783
|
-
map: _this.mirror.map,
|
|
3784
|
-
skipChild: true,
|
|
3785
|
-
hackCss: true,
|
|
3786
|
-
cache: _this.cache,
|
|
3787
|
-
});
|
|
3788
|
-
if (mutation.previousId === -1 || mutation.nextId === -1) {
|
|
3789
|
-
legacy_missingNodeMap[mutation.node.id] = {
|
|
3790
|
-
node: target,
|
|
3791
|
-
mutation: mutation,
|
|
3792
|
-
};
|
|
3793
|
-
return;
|
|
3794
|
-
}
|
|
3795
|
-
if ('__sn' in parent &&
|
|
3796
|
-
parent.__sn.type === NodeType.Element &&
|
|
3797
|
-
parent.__sn.tagName === 'textarea' &&
|
|
3798
|
-
mutation.node.type === NodeType.Text) {
|
|
3799
|
-
try {
|
|
3800
|
-
for (var _d = __values(Array.from(parent.childNodes)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
3801
|
-
var c = _e.value;
|
|
3802
|
-
if (c.nodeType === parent.TEXT_NODE) {
|
|
3803
|
-
parent.removeChild(c);
|
|
3804
|
-
}
|
|
3805
|
-
}
|
|
3806
|
-
}
|
|
3807
|
-
catch (e_17_1) { e_17 = { error: e_17_1 }; }
|
|
3808
|
-
finally {
|
|
3809
|
-
try {
|
|
3810
|
-
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
3811
|
-
}
|
|
3812
|
-
finally { if (e_17) throw e_17.error; }
|
|
3813
|
-
}
|
|
3814
|
-
}
|
|
3815
|
-
if (previous && previous.nextSibling && previous.nextSibling.parentNode) {
|
|
3816
|
-
parent.insertBefore(target, previous.nextSibling);
|
|
3817
|
-
}
|
|
3818
|
-
else if (next && next.parentNode) {
|
|
3819
|
-
parent.contains(next)
|
|
3820
|
-
? parent.insertBefore(target, next)
|
|
3821
|
-
: parent.insertBefore(target, null);
|
|
3822
|
-
}
|
|
3823
|
-
else {
|
|
3824
|
-
if (parent === targetDoc) {
|
|
3825
|
-
while (targetDoc.firstChild) {
|
|
3826
|
-
targetDoc.removeChild(targetDoc.firstChild);
|
|
3827
|
-
}
|
|
3828
|
-
}
|
|
3829
|
-
parent.appendChild(target);
|
|
3830
|
-
}
|
|
3831
|
-
if (isIframeINode(target)) {
|
|
3832
|
-
var mutationInQueue_1 = _this.newDocumentQueue.find(function (m) { return m.parentId === target.__sn.id; });
|
|
3833
|
-
if (mutationInQueue_1) {
|
|
3834
|
-
_this.attachDocumentToIframe(mutationInQueue_1, target);
|
|
3835
|
-
_this.newDocumentQueue = _this.newDocumentQueue.filter(function (m) { return m !== mutationInQueue_1; });
|
|
3836
|
-
}
|
|
3837
|
-
}
|
|
3838
|
-
if (mutation.previousId || mutation.nextId) {
|
|
3839
|
-
_this.legacy_resolveMissingNode(legacy_missingNodeMap, parent, target, mutation);
|
|
3840
|
-
}
|
|
3841
|
-
};
|
|
3842
|
-
d.adds.forEach(function (mutation) {
|
|
3843
|
-
appendNode(mutation);
|
|
3844
|
-
});
|
|
3845
|
-
var startTime = Date.now();
|
|
3846
|
-
while (queue.length) {
|
|
3847
|
-
var resolveTrees = queueToResolveTrees(queue);
|
|
3848
|
-
queue.length = 0;
|
|
3849
|
-
if (Date.now() - startTime > 500) {
|
|
3850
|
-
this.warn('Timeout in the loop, please check the resolve tree data:', resolveTrees);
|
|
3851
|
-
break;
|
|
3852
|
-
}
|
|
3853
|
-
try {
|
|
3854
|
-
for (var resolveTrees_1 = (e_16 = void 0, __values(resolveTrees)), resolveTrees_1_1 = resolveTrees_1.next(); !resolveTrees_1_1.done; resolveTrees_1_1 = resolveTrees_1.next()) {
|
|
3855
|
-
var tree = resolveTrees_1_1.value;
|
|
3856
|
-
var parent_4 = this.mirror.getNode(tree.value.parentId);
|
|
3857
|
-
if (!parent_4) {
|
|
3858
|
-
this.debug('Drop resolve tree since there is no parent for the root node.', tree);
|
|
3859
|
-
}
|
|
3860
|
-
else {
|
|
3861
|
-
iterateResolveTree(tree, function (mutation) {
|
|
3862
|
-
appendNode(mutation);
|
|
3863
|
-
});
|
|
3864
|
-
}
|
|
3865
|
-
}
|
|
3866
|
-
}
|
|
3867
|
-
catch (e_16_1) { e_16 = { error: e_16_1 }; }
|
|
3868
|
-
finally {
|
|
3869
|
-
try {
|
|
3870
|
-
if (resolveTrees_1_1 && !resolveTrees_1_1.done && (_a = resolveTrees_1.return)) _a.call(resolveTrees_1);
|
|
3871
|
-
}
|
|
3872
|
-
finally { if (e_16) throw e_16.error; }
|
|
3873
|
-
}
|
|
3874
|
-
}
|
|
3875
|
-
if (Object.keys(legacy_missingNodeMap).length) {
|
|
3876
|
-
Object.assign(this.legacy_missingNodeRetryMap, legacy_missingNodeMap);
|
|
3877
|
-
}
|
|
3878
|
-
d.texts.forEach(function (mutation) {
|
|
3879
|
-
var target = _this.mirror.getNode(mutation.id);
|
|
3880
|
-
if (!target) {
|
|
3881
|
-
if (d.removes.find(function (r) { return r.id === mutation.id; })) {
|
|
3882
|
-
return;
|
|
3883
|
-
}
|
|
3884
|
-
return _this.warnNodeNotFound(d, mutation.id);
|
|
3885
|
-
}
|
|
3886
|
-
if (_this.fragmentParentMap.has(target)) {
|
|
3887
|
-
target = _this.fragmentParentMap.get(target);
|
|
3888
|
-
}
|
|
3889
|
-
target.textContent = mutation.value;
|
|
3890
|
-
});
|
|
3891
|
-
d.attributes.forEach(function (mutation) {
|
|
3892
|
-
var target = _this.mirror.getNode(mutation.id);
|
|
3893
|
-
if (!target) {
|
|
3894
|
-
if (d.removes.find(function (r) { return r.id === mutation.id; })) {
|
|
3895
|
-
return;
|
|
3896
|
-
}
|
|
3897
|
-
return _this.warnNodeNotFound(d, mutation.id);
|
|
3898
|
-
}
|
|
3899
|
-
if (_this.fragmentParentMap.has(target)) {
|
|
3900
|
-
target = _this.fragmentParentMap.get(target);
|
|
3901
|
-
}
|
|
3902
|
-
for (var attributeName in mutation.attributes) {
|
|
3903
|
-
if (typeof attributeName === 'string') {
|
|
3904
|
-
var value = mutation.attributes[attributeName];
|
|
3905
|
-
if (value === null) {
|
|
3906
|
-
target.removeAttribute(attributeName);
|
|
3907
|
-
}
|
|
3908
|
-
else if (typeof value === 'string') {
|
|
3909
|
-
try {
|
|
3910
|
-
target.setAttribute(attributeName, value);
|
|
3911
|
-
}
|
|
3912
|
-
catch (error) {
|
|
3913
|
-
if (_this.config.showWarning) {
|
|
3914
|
-
console.warn('An error occurred may due to the checkout feature.', error);
|
|
3915
|
-
}
|
|
3916
|
-
}
|
|
3917
|
-
}
|
|
3918
|
-
else if (attributeName === 'style') {
|
|
3919
|
-
var styleValues = value;
|
|
3920
|
-
var targetEl = target;
|
|
3921
|
-
for (var s in styleValues) {
|
|
3922
|
-
if (styleValues[s] === false) {
|
|
3923
|
-
targetEl.style.removeProperty(s);
|
|
3924
|
-
}
|
|
3925
|
-
else if (styleValues[s] instanceof Array) {
|
|
3926
|
-
var svp = styleValues[s];
|
|
3927
|
-
targetEl.style.setProperty(s, svp[0], svp[1]);
|
|
3928
|
-
}
|
|
3929
|
-
else {
|
|
3930
|
-
var svs = styleValues[s];
|
|
3931
|
-
targetEl.style.setProperty(s, svs);
|
|
3932
|
-
}
|
|
3933
|
-
}
|
|
3934
|
-
}
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
});
|
|
3938
|
-
};
|
|
3939
|
-
Replayer.prototype.applyScroll = function (d, isSync) {
|
|
3940
|
-
var target = this.mirror.getNode(d.id);
|
|
3941
|
-
if (!target) {
|
|
3942
|
-
return this.debugNodeNotFound(d, d.id);
|
|
3943
|
-
}
|
|
3944
|
-
if (target === this.iframe.contentDocument) {
|
|
3945
|
-
this.iframe.contentWindow.scrollTo({
|
|
3946
|
-
top: d.y,
|
|
3947
|
-
left: d.x,
|
|
3948
|
-
behavior: isSync ? 'auto' : 'smooth',
|
|
3949
|
-
});
|
|
3950
|
-
}
|
|
3951
|
-
else if (target.__sn.type === NodeType.Document) {
|
|
3952
|
-
target.defaultView.scrollTo({
|
|
3953
|
-
top: d.y,
|
|
3954
|
-
left: d.x,
|
|
3955
|
-
behavior: isSync ? 'auto' : 'smooth',
|
|
3956
|
-
});
|
|
3957
|
-
}
|
|
3958
|
-
else {
|
|
3959
|
-
try {
|
|
3960
|
-
target.scrollTop = d.y;
|
|
3961
|
-
target.scrollLeft = d.x;
|
|
3962
|
-
}
|
|
3963
|
-
catch (error) {
|
|
3964
|
-
}
|
|
3965
|
-
}
|
|
3966
|
-
};
|
|
3967
|
-
Replayer.prototype.applyInput = function (d) {
|
|
3968
|
-
var target = this.mirror.getNode(d.id);
|
|
3969
|
-
if (!target) {
|
|
3970
|
-
return this.debugNodeNotFound(d, d.id);
|
|
3971
|
-
}
|
|
3972
|
-
try {
|
|
3973
|
-
target.checked = d.isChecked;
|
|
3974
|
-
target.value = d.text;
|
|
3975
|
-
}
|
|
3976
|
-
catch (error) {
|
|
3977
|
-
}
|
|
3978
|
-
};
|
|
3979
|
-
Replayer.prototype.applyText = function (d, mutation) {
|
|
3980
|
-
var target = this.mirror.getNode(d.id);
|
|
3981
|
-
if (!target) {
|
|
3982
|
-
return this.debugNodeNotFound(mutation, d.id);
|
|
3983
|
-
}
|
|
3984
|
-
try {
|
|
3985
|
-
target.textContent = d.value;
|
|
3986
|
-
}
|
|
3987
|
-
catch (error) {
|
|
3988
|
-
}
|
|
3989
|
-
};
|
|
3990
|
-
Replayer.prototype.legacy_resolveMissingNode = function (map, parent, target, targetMutation) {
|
|
3991
|
-
var previousId = targetMutation.previousId, nextId = targetMutation.nextId;
|
|
3992
|
-
var previousInMap = previousId && map[previousId];
|
|
3993
|
-
var nextInMap = nextId && map[nextId];
|
|
3994
|
-
if (previousInMap) {
|
|
3995
|
-
var _a = previousInMap, node = _a.node, mutation = _a.mutation;
|
|
3996
|
-
parent.insertBefore(node, target);
|
|
3997
|
-
delete map[mutation.node.id];
|
|
3998
|
-
delete this.legacy_missingNodeRetryMap[mutation.node.id];
|
|
3999
|
-
if (mutation.previousId || mutation.nextId) {
|
|
4000
|
-
this.legacy_resolveMissingNode(map, parent, node, mutation);
|
|
4001
|
-
}
|
|
4002
|
-
}
|
|
4003
|
-
if (nextInMap) {
|
|
4004
|
-
var _b = nextInMap, node = _b.node, mutation = _b.mutation;
|
|
4005
|
-
parent.insertBefore(node, target.nextSibling);
|
|
4006
|
-
delete map[mutation.node.id];
|
|
4007
|
-
delete this.legacy_missingNodeRetryMap[mutation.node.id];
|
|
4008
|
-
if (mutation.previousId || mutation.nextId) {
|
|
4009
|
-
this.legacy_resolveMissingNode(map, parent, node, mutation);
|
|
4010
|
-
}
|
|
4011
|
-
}
|
|
4012
|
-
};
|
|
4013
|
-
Replayer.prototype.moveAndHover = function (x, y, id, isSync, debugData) {
|
|
4014
|
-
var target = this.mirror.getNode(id);
|
|
4015
|
-
if (!target) {
|
|
4016
|
-
return this.debugNodeNotFound(debugData, id);
|
|
4017
|
-
}
|
|
4018
|
-
var base = getBaseDimension(target, this.iframe);
|
|
4019
|
-
var _x = x * base.absoluteScale + base.x;
|
|
4020
|
-
var _y = y * base.absoluteScale + base.y;
|
|
4021
|
-
this.mouse.style.left = "".concat(_x, "px");
|
|
4022
|
-
this.mouse.style.top = "".concat(_y, "px");
|
|
4023
|
-
if (!isSync) {
|
|
4024
|
-
this.drawMouseTail({ x: _x, y: _y });
|
|
4025
|
-
}
|
|
4026
|
-
this.hoverElements(target);
|
|
4027
|
-
};
|
|
4028
|
-
Replayer.prototype.drawMouseTail = function (position) {
|
|
4029
|
-
var _this = this;
|
|
4030
|
-
if (!this.mouseTail) {
|
|
4031
|
-
return;
|
|
4032
|
-
}
|
|
4033
|
-
var _a = this.config.mouseTail === true
|
|
4034
|
-
? defaultMouseTailConfig
|
|
4035
|
-
: Object.assign({}, defaultMouseTailConfig, this.config.mouseTail), lineCap = _a.lineCap, lineWidth = _a.lineWidth, strokeStyle = _a.strokeStyle, duration = _a.duration;
|
|
4036
|
-
var draw = function () {
|
|
4037
|
-
if (!_this.mouseTail) {
|
|
4038
|
-
return;
|
|
4039
|
-
}
|
|
4040
|
-
var ctx = _this.mouseTail.getContext('2d');
|
|
4041
|
-
if (!ctx || !_this.tailPositions.length) {
|
|
4042
|
-
return;
|
|
4043
|
-
}
|
|
4044
|
-
ctx.clearRect(0, 0, _this.mouseTail.width, _this.mouseTail.height);
|
|
4045
|
-
ctx.beginPath();
|
|
4046
|
-
ctx.lineWidth = lineWidth;
|
|
4047
|
-
ctx.lineCap = lineCap;
|
|
4048
|
-
ctx.strokeStyle = strokeStyle;
|
|
4049
|
-
ctx.moveTo(_this.tailPositions[0].x, _this.tailPositions[0].y);
|
|
4050
|
-
_this.tailPositions.forEach(function (p) { return ctx.lineTo(p.x, p.y); });
|
|
4051
|
-
ctx.stroke();
|
|
4052
|
-
};
|
|
4053
|
-
this.tailPositions.push(position);
|
|
4054
|
-
draw();
|
|
4055
|
-
setTimeout(function () {
|
|
4056
|
-
_this.tailPositions = _this.tailPositions.filter(function (p) { return p !== position; });
|
|
4057
|
-
draw();
|
|
4058
|
-
}, duration / this.speedService.state.context.timer.speed);
|
|
4059
|
-
};
|
|
4060
|
-
Replayer.prototype.hoverElements = function (el) {
|
|
4061
|
-
var _a;
|
|
4062
|
-
(_a = this.iframe.contentDocument) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.\\:hover').forEach(function (hoveredEl) {
|
|
4063
|
-
hoveredEl.classList.remove(':hover');
|
|
4064
|
-
});
|
|
4065
|
-
var currentEl = el;
|
|
4066
|
-
while (currentEl) {
|
|
4067
|
-
if (currentEl.classList) {
|
|
4068
|
-
currentEl.classList.add(':hover');
|
|
4069
|
-
}
|
|
4070
|
-
currentEl = currentEl.parentElement;
|
|
4071
|
-
}
|
|
4072
|
-
};
|
|
4073
|
-
Replayer.prototype.isUserInteraction = function (event) {
|
|
4074
|
-
if (event.type !== EventType.IncrementalSnapshot) {
|
|
4075
|
-
return false;
|
|
4076
|
-
}
|
|
4077
|
-
return (event.data.source > IncrementalSource.Mutation &&
|
|
4078
|
-
event.data.source <= IncrementalSource.Input);
|
|
4079
|
-
};
|
|
4080
|
-
Replayer.prototype.backToNormal = function () {
|
|
4081
|
-
this.nextUserInteractionEvent = null;
|
|
4082
|
-
if (this.speedService.state.matches('normal')) {
|
|
4083
|
-
return;
|
|
4084
|
-
}
|
|
4085
|
-
this.speedService.send({ type: 'BACK_TO_NORMAL' });
|
|
4086
|
-
this.emitter.emit(ReplayerEvents.SkipEnd, {
|
|
4087
|
-
speed: this.speedService.state.context.normalSpeed,
|
|
4088
|
-
});
|
|
4089
|
-
};
|
|
4090
|
-
Replayer.prototype.restoreRealParent = function (frag, parent) {
|
|
4091
|
-
this.mirror.map[parent.__sn.id] = parent;
|
|
4092
|
-
if (parent.__sn.type === NodeType.Element &&
|
|
4093
|
-
parent.__sn.tagName === 'textarea' &&
|
|
4094
|
-
frag.textContent) {
|
|
4095
|
-
parent.value = frag.textContent;
|
|
4096
|
-
}
|
|
4097
|
-
parent.appendChild(frag);
|
|
4098
|
-
this.restoreState(parent);
|
|
4099
|
-
};
|
|
4100
|
-
Replayer.prototype.storeState = function (parent) {
|
|
4101
|
-
var e_18, _a;
|
|
4102
|
-
if (parent) {
|
|
4103
|
-
if (parent.nodeType === parent.ELEMENT_NODE) {
|
|
4104
|
-
var parentElement = parent;
|
|
4105
|
-
if (parentElement.scrollLeft || parentElement.scrollTop) {
|
|
4106
|
-
this.elementStateMap.set(parent, {
|
|
4107
|
-
scroll: [parentElement.scrollLeft, parentElement.scrollTop],
|
|
4108
|
-
});
|
|
4109
|
-
}
|
|
4110
|
-
if (parentElement.tagName === 'STYLE')
|
|
4111
|
-
storeCSSRules(parentElement, this.virtualStyleRulesMap);
|
|
4112
|
-
var children = parentElement.children;
|
|
4113
|
-
try {
|
|
4114
|
-
for (var _b = __values(Array.from(children)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4115
|
-
var child = _c.value;
|
|
4116
|
-
this.storeState(child);
|
|
4117
|
-
}
|
|
4118
|
-
}
|
|
4119
|
-
catch (e_18_1) { e_18 = { error: e_18_1 }; }
|
|
4120
|
-
finally {
|
|
4121
|
-
try {
|
|
4122
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4123
|
-
}
|
|
4124
|
-
finally { if (e_18) throw e_18.error; }
|
|
4125
|
-
}
|
|
4126
|
-
}
|
|
4127
|
-
}
|
|
4128
|
-
};
|
|
4129
|
-
Replayer.prototype.restoreState = function (parent) {
|
|
4130
|
-
var e_19, _a;
|
|
4131
|
-
if (parent.nodeType === parent.ELEMENT_NODE) {
|
|
4132
|
-
var parentElement = parent;
|
|
4133
|
-
if (this.elementStateMap.has(parent)) {
|
|
4134
|
-
var storedState = this.elementStateMap.get(parent);
|
|
4135
|
-
if (storedState.scroll) {
|
|
4136
|
-
parentElement.scrollLeft = storedState.scroll[0];
|
|
4137
|
-
parentElement.scrollTop = storedState.scroll[1];
|
|
4138
|
-
}
|
|
4139
|
-
this.elementStateMap.delete(parent);
|
|
4140
|
-
}
|
|
4141
|
-
var children = parentElement.children;
|
|
4142
|
-
try {
|
|
4143
|
-
for (var _b = __values(Array.from(children)), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
4144
|
-
var child = _c.value;
|
|
4145
|
-
this.restoreState(child);
|
|
4146
|
-
}
|
|
4147
|
-
}
|
|
4148
|
-
catch (e_19_1) { e_19 = { error: e_19_1 }; }
|
|
4149
|
-
finally {
|
|
4150
|
-
try {
|
|
4151
|
-
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
4152
|
-
}
|
|
4153
|
-
finally { if (e_19) throw e_19.error; }
|
|
4154
|
-
}
|
|
4155
|
-
}
|
|
4156
|
-
};
|
|
4157
|
-
Replayer.prototype.restoreNodeSheet = function (node) {
|
|
4158
|
-
var storedRules = this.virtualStyleRulesMap.get(node);
|
|
4159
|
-
if (node.nodeName !== 'STYLE') {
|
|
4160
|
-
return;
|
|
4161
|
-
}
|
|
4162
|
-
if (!storedRules) {
|
|
4163
|
-
return;
|
|
4164
|
-
}
|
|
4165
|
-
var styleNode = node;
|
|
4166
|
-
applyVirtualStyleRulesToNode(storedRules, styleNode);
|
|
4167
|
-
};
|
|
4168
|
-
Replayer.prototype.warnNodeNotFound = function (d, id) {
|
|
4169
|
-
if (this.treeIndex.idRemoved(id)) {
|
|
4170
|
-
this.warn("Node with id '".concat(id, "' was previously removed. "), d);
|
|
4171
|
-
}
|
|
4172
|
-
else {
|
|
4173
|
-
this.warn("Node with id '".concat(id, "' not found. "), d);
|
|
4174
|
-
}
|
|
4175
|
-
};
|
|
4176
|
-
Replayer.prototype.warnCanvasMutationFailed = function (d, error) {
|
|
4177
|
-
this.warn("Has error on canvas update", error, 'canvas mutation:', d);
|
|
4178
|
-
};
|
|
4179
|
-
Replayer.prototype.debugNodeNotFound = function (d, id) {
|
|
4180
|
-
if (this.treeIndex.idRemoved(id)) {
|
|
4181
|
-
this.debug(REPLAY_CONSOLE_PREFIX, "Node with id '".concat(id, "' was previously removed. "), d);
|
|
4182
|
-
}
|
|
4183
|
-
else {
|
|
4184
|
-
this.debug(REPLAY_CONSOLE_PREFIX, "Node with id '".concat(id, "' not found. "), d);
|
|
4185
|
-
}
|
|
4186
|
-
};
|
|
4187
|
-
Replayer.prototype.warn = function () {
|
|
4188
|
-
var args = [];
|
|
4189
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4190
|
-
args[_i] = arguments[_i];
|
|
4191
|
-
}
|
|
4192
|
-
if (!this.config.showWarning) {
|
|
4193
|
-
return;
|
|
4194
|
-
}
|
|
4195
|
-
console.warn.apply(console, __spreadArray([REPLAY_CONSOLE_PREFIX], __read(args), false));
|
|
4196
|
-
};
|
|
4197
|
-
Replayer.prototype.debug = function () {
|
|
4198
|
-
var args = [];
|
|
4199
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
4200
|
-
args[_i] = arguments[_i];
|
|
4201
|
-
}
|
|
4202
|
-
if (!this.config.showDebug) {
|
|
4203
|
-
return;
|
|
4204
|
-
}
|
|
4205
|
-
console.log.apply(console, __spreadArray([REPLAY_CONSOLE_PREFIX], __read(args), false));
|
|
4206
|
-
};
|
|
4207
|
-
return Replayer;
|
|
4208
|
-
}());
|
|
4209
|
-
|
|
4210
|
-
// DEFLATE is a complex format; to read this code, you should probably check the RFC first:
|
|
4211
|
-
|
|
4212
|
-
// aliases for shorter compressed code (most minifers don't do this)
|
|
4213
|
-
var u8 = Uint8Array, u16 = Uint16Array, u32 = Uint32Array;
|
|
4214
|
-
// fixed length extra bits
|
|
4215
|
-
var fleb = new u8([0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, /* unused */ 0, 0, /* impossible */ 0]);
|
|
4216
|
-
// fixed distance extra bits
|
|
4217
|
-
// see fleb note
|
|
4218
|
-
var fdeb = new u8([0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, /* unused */ 0, 0]);
|
|
4219
|
-
// code length index map
|
|
4220
|
-
var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
|
|
4221
|
-
// get base, reverse index map from extra bits
|
|
4222
|
-
var freb = function (eb, start) {
|
|
4223
|
-
var b = new u16(31);
|
|
4224
|
-
for (var i = 0; i < 31; ++i) {
|
|
4225
|
-
b[i] = start += 1 << eb[i - 1];
|
|
4226
|
-
}
|
|
4227
|
-
// numbers here are at max 18 bits
|
|
4228
|
-
var r = new u32(b[30]);
|
|
4229
|
-
for (var i = 1; i < 30; ++i) {
|
|
4230
|
-
for (var j = b[i]; j < b[i + 1]; ++j) {
|
|
4231
|
-
r[j] = ((j - b[i]) << 5) | i;
|
|
4232
|
-
}
|
|
4233
|
-
}
|
|
4234
|
-
return [b, r];
|
|
4235
|
-
};
|
|
4236
|
-
var _a = freb(fleb, 2), fl = _a[0], revfl = _a[1];
|
|
4237
|
-
// we can ignore the fact that the other numbers are wrong; they never happen anyway
|
|
4238
|
-
fl[28] = 258, revfl[258] = 28;
|
|
4239
|
-
var _b = freb(fdeb, 0), fd = _b[0];
|
|
4240
|
-
// map of value to reverse (assuming 16 bits)
|
|
4241
|
-
var rev = new u16(32768);
|
|
4242
|
-
for (var i = 0; i < 32768; ++i) {
|
|
4243
|
-
// reverse table algorithm from SO
|
|
4244
|
-
var x = ((i & 0xAAAA) >>> 1) | ((i & 0x5555) << 1);
|
|
4245
|
-
x = ((x & 0xCCCC) >>> 2) | ((x & 0x3333) << 2);
|
|
4246
|
-
x = ((x & 0xF0F0) >>> 4) | ((x & 0x0F0F) << 4);
|
|
4247
|
-
rev[i] = (((x & 0xFF00) >>> 8) | ((x & 0x00FF) << 8)) >>> 1;
|
|
4248
|
-
}
|
|
4249
|
-
// create huffman tree from u8 "map": index -> code length for code index
|
|
4250
|
-
// mb (max bits) must be at most 15
|
|
4251
|
-
// TODO: optimize/split up?
|
|
4252
|
-
var hMap = (function (cd, mb, r) {
|
|
4253
|
-
var s = cd.length;
|
|
4254
|
-
// index
|
|
4255
|
-
var i = 0;
|
|
4256
|
-
// u16 "map": index -> # of codes with bit length = index
|
|
4257
|
-
var l = new u16(mb);
|
|
4258
|
-
// length of cd must be 288 (total # of codes)
|
|
4259
|
-
for (; i < s; ++i)
|
|
4260
|
-
++l[cd[i] - 1];
|
|
4261
|
-
// u16 "map": index -> minimum code for bit length = index
|
|
4262
|
-
var le = new u16(mb);
|
|
4263
|
-
for (i = 0; i < mb; ++i) {
|
|
4264
|
-
le[i] = (le[i - 1] + l[i - 1]) << 1;
|
|
4265
|
-
}
|
|
4266
|
-
var co;
|
|
4267
|
-
if (r) {
|
|
4268
|
-
// u16 "map": index -> number of actual bits, symbol for code
|
|
4269
|
-
co = new u16(1 << mb);
|
|
4270
|
-
// bits to remove for reverser
|
|
4271
|
-
var rvb = 15 - mb;
|
|
4272
|
-
for (i = 0; i < s; ++i) {
|
|
4273
|
-
// ignore 0 lengths
|
|
4274
|
-
if (cd[i]) {
|
|
4275
|
-
// num encoding both symbol and bits read
|
|
4276
|
-
var sv = (i << 4) | cd[i];
|
|
4277
|
-
// free bits
|
|
4278
|
-
var r_1 = mb - cd[i];
|
|
4279
|
-
// start value
|
|
4280
|
-
var v = le[cd[i] - 1]++ << r_1;
|
|
4281
|
-
// m is end value
|
|
4282
|
-
for (var m = v | ((1 << r_1) - 1); v <= m; ++v) {
|
|
4283
|
-
// every 16 bit value starting with the code yields the same result
|
|
4284
|
-
co[rev[v] >>> rvb] = sv;
|
|
4285
|
-
}
|
|
4286
|
-
}
|
|
4287
|
-
}
|
|
4288
|
-
}
|
|
4289
|
-
else {
|
|
4290
|
-
co = new u16(s);
|
|
4291
|
-
for (i = 0; i < s; ++i)
|
|
4292
|
-
co[i] = rev[le[cd[i] - 1]++] >>> (15 - cd[i]);
|
|
4293
|
-
}
|
|
4294
|
-
return co;
|
|
4295
|
-
});
|
|
4296
|
-
// fixed length tree
|
|
4297
|
-
var flt = new u8(288);
|
|
4298
|
-
for (var i = 0; i < 144; ++i)
|
|
4299
|
-
flt[i] = 8;
|
|
4300
|
-
for (var i = 144; i < 256; ++i)
|
|
4301
|
-
flt[i] = 9;
|
|
4302
|
-
for (var i = 256; i < 280; ++i)
|
|
4303
|
-
flt[i] = 7;
|
|
4304
|
-
for (var i = 280; i < 288; ++i)
|
|
4305
|
-
flt[i] = 8;
|
|
4306
|
-
// fixed distance tree
|
|
4307
|
-
var fdt = new u8(32);
|
|
4308
|
-
for (var i = 0; i < 32; ++i)
|
|
4309
|
-
fdt[i] = 5;
|
|
4310
|
-
// fixed length map
|
|
4311
|
-
var flrm = /*#__PURE__*/ hMap(flt, 9, 1);
|
|
4312
|
-
// fixed distance map
|
|
4313
|
-
var fdrm = /*#__PURE__*/ hMap(fdt, 5, 1);
|
|
4314
|
-
// find max of array
|
|
4315
|
-
var max = function (a) {
|
|
4316
|
-
var m = a[0];
|
|
4317
|
-
for (var i = 1; i < a.length; ++i) {
|
|
4318
|
-
if (a[i] > m)
|
|
4319
|
-
m = a[i];
|
|
4320
|
-
}
|
|
4321
|
-
return m;
|
|
4322
|
-
};
|
|
4323
|
-
// read d, starting at bit p and mask with m
|
|
4324
|
-
var bits = function (d, p, m) {
|
|
4325
|
-
var o = (p / 8) >> 0;
|
|
4326
|
-
return ((d[o] | (d[o + 1] << 8)) >>> (p & 7)) & m;
|
|
4327
|
-
};
|
|
4328
|
-
// read d, starting at bit p continuing for at least 16 bits
|
|
4329
|
-
var bits16 = function (d, p) {
|
|
4330
|
-
var o = (p / 8) >> 0;
|
|
4331
|
-
return ((d[o] | (d[o + 1] << 8) | (d[o + 2] << 16)) >>> (p & 7));
|
|
4332
|
-
};
|
|
4333
|
-
// get end of byte
|
|
4334
|
-
var shft = function (p) { return ((p / 8) >> 0) + (p & 7 && 1); };
|
|
4335
|
-
// typed array slice - allows garbage collector to free original reference,
|
|
4336
|
-
// while being more compatible than .slice
|
|
4337
|
-
var slc = function (v, s, e) {
|
|
4338
|
-
if (s == null || s < 0)
|
|
4339
|
-
s = 0;
|
|
4340
|
-
if (e == null || e > v.length)
|
|
4341
|
-
e = v.length;
|
|
4342
|
-
// can't use .constructor in case user-supplied
|
|
4343
|
-
var n = new (v instanceof u16 ? u16 : v instanceof u32 ? u32 : u8)(e - s);
|
|
4344
|
-
n.set(v.subarray(s, e));
|
|
4345
|
-
return n;
|
|
4346
|
-
};
|
|
4347
|
-
// expands raw DEFLATE data
|
|
4348
|
-
var inflt = function (dat, buf, st) {
|
|
4349
|
-
// source length
|
|
4350
|
-
var sl = dat.length;
|
|
4351
|
-
// have to estimate size
|
|
4352
|
-
var noBuf = !buf || st;
|
|
4353
|
-
// no state
|
|
4354
|
-
var noSt = !st || st.i;
|
|
4355
|
-
if (!st)
|
|
4356
|
-
st = {};
|
|
4357
|
-
// Assumes roughly 33% compression ratio average
|
|
4358
|
-
if (!buf)
|
|
4359
|
-
buf = new u8(sl * 3);
|
|
4360
|
-
// ensure buffer can fit at least l elements
|
|
4361
|
-
var cbuf = function (l) {
|
|
4362
|
-
var bl = buf.length;
|
|
4363
|
-
// need to increase size to fit
|
|
4364
|
-
if (l > bl) {
|
|
4365
|
-
// Double or set to necessary, whichever is greater
|
|
4366
|
-
var nbuf = new u8(Math.max(bl * 2, l));
|
|
4367
|
-
nbuf.set(buf);
|
|
4368
|
-
buf = nbuf;
|
|
4369
|
-
}
|
|
4370
|
-
};
|
|
4371
|
-
// last chunk bitpos bytes
|
|
4372
|
-
var final = st.f || 0, pos = st.p || 0, bt = st.b || 0, lm = st.l, dm = st.d, lbt = st.m, dbt = st.n;
|
|
4373
|
-
// total bits
|
|
4374
|
-
var tbts = sl * 8;
|
|
4375
|
-
do {
|
|
4376
|
-
if (!lm) {
|
|
4377
|
-
// BFINAL - this is only 1 when last chunk is next
|
|
4378
|
-
st.f = final = bits(dat, pos, 1);
|
|
4379
|
-
// type: 0 = no compression, 1 = fixed huffman, 2 = dynamic huffman
|
|
4380
|
-
var type = bits(dat, pos + 1, 3);
|
|
4381
|
-
pos += 3;
|
|
4382
|
-
if (!type) {
|
|
4383
|
-
// go to end of byte boundary
|
|
4384
|
-
var s = shft(pos) + 4, l = dat[s - 4] | (dat[s - 3] << 8), t = s + l;
|
|
4385
|
-
if (t > sl) {
|
|
4386
|
-
if (noSt)
|
|
4387
|
-
throw 'unexpected EOF';
|
|
4388
|
-
break;
|
|
4389
|
-
}
|
|
4390
|
-
// ensure size
|
|
4391
|
-
if (noBuf)
|
|
4392
|
-
cbuf(bt + l);
|
|
4393
|
-
// Copy over uncompressed data
|
|
4394
|
-
buf.set(dat.subarray(s, t), bt);
|
|
4395
|
-
// Get new bitpos, update byte count
|
|
4396
|
-
st.b = bt += l, st.p = pos = t * 8;
|
|
4397
|
-
continue;
|
|
4398
|
-
}
|
|
4399
|
-
else if (type == 1)
|
|
4400
|
-
lm = flrm, dm = fdrm, lbt = 9, dbt = 5;
|
|
4401
|
-
else if (type == 2) {
|
|
4402
|
-
// literal lengths
|
|
4403
|
-
var hLit = bits(dat, pos, 31) + 257, hcLen = bits(dat, pos + 10, 15) + 4;
|
|
4404
|
-
var tl = hLit + bits(dat, pos + 5, 31) + 1;
|
|
4405
|
-
pos += 14;
|
|
4406
|
-
// length+distance tree
|
|
4407
|
-
var ldt = new u8(tl);
|
|
4408
|
-
// code length tree
|
|
4409
|
-
var clt = new u8(19);
|
|
4410
|
-
for (var i = 0; i < hcLen; ++i) {
|
|
4411
|
-
// use index map to get real code
|
|
4412
|
-
clt[clim[i]] = bits(dat, pos + i * 3, 7);
|
|
4413
|
-
}
|
|
4414
|
-
pos += hcLen * 3;
|
|
4415
|
-
// code lengths bits
|
|
4416
|
-
var clb = max(clt), clbmsk = (1 << clb) - 1;
|
|
4417
|
-
if (!noSt && pos + tl * (clb + 7) > tbts)
|
|
4418
|
-
break;
|
|
4419
|
-
// code lengths map
|
|
4420
|
-
var clm = hMap(clt, clb, 1);
|
|
4421
|
-
for (var i = 0; i < tl;) {
|
|
4422
|
-
var r = clm[bits(dat, pos, clbmsk)];
|
|
4423
|
-
// bits read
|
|
4424
|
-
pos += r & 15;
|
|
4425
|
-
// symbol
|
|
4426
|
-
var s = r >>> 4;
|
|
4427
|
-
// code length to copy
|
|
4428
|
-
if (s < 16) {
|
|
4429
|
-
ldt[i++] = s;
|
|
4430
|
-
}
|
|
4431
|
-
else {
|
|
4432
|
-
// copy count
|
|
4433
|
-
var c = 0, n = 0;
|
|
4434
|
-
if (s == 16)
|
|
4435
|
-
n = 3 + bits(dat, pos, 3), pos += 2, c = ldt[i - 1];
|
|
4436
|
-
else if (s == 17)
|
|
4437
|
-
n = 3 + bits(dat, pos, 7), pos += 3;
|
|
4438
|
-
else if (s == 18)
|
|
4439
|
-
n = 11 + bits(dat, pos, 127), pos += 7;
|
|
4440
|
-
while (n--)
|
|
4441
|
-
ldt[i++] = c;
|
|
4442
|
-
}
|
|
4443
|
-
}
|
|
4444
|
-
// length tree distance tree
|
|
4445
|
-
var lt = ldt.subarray(0, hLit), dt = ldt.subarray(hLit);
|
|
4446
|
-
// max length bits
|
|
4447
|
-
lbt = max(lt);
|
|
4448
|
-
// max dist bits
|
|
4449
|
-
dbt = max(dt);
|
|
4450
|
-
lm = hMap(lt, lbt, 1);
|
|
4451
|
-
dm = hMap(dt, dbt, 1);
|
|
4452
|
-
}
|
|
4453
|
-
else
|
|
4454
|
-
throw 'invalid block type';
|
|
4455
|
-
if (pos > tbts)
|
|
4456
|
-
throw 'unexpected EOF';
|
|
4457
|
-
}
|
|
4458
|
-
// Make sure the buffer can hold this + the largest possible addition
|
|
4459
|
-
// Maximum chunk size (practically, theoretically infinite) is 2^17;
|
|
4460
|
-
if (noBuf)
|
|
4461
|
-
cbuf(bt + 131072);
|
|
4462
|
-
var lms = (1 << lbt) - 1, dms = (1 << dbt) - 1;
|
|
4463
|
-
var mxa = lbt + dbt + 18;
|
|
4464
|
-
while (noSt || pos + mxa < tbts) {
|
|
4465
|
-
// bits read, code
|
|
4466
|
-
var c = lm[bits16(dat, pos) & lms], sym = c >>> 4;
|
|
4467
|
-
pos += c & 15;
|
|
4468
|
-
if (pos > tbts)
|
|
4469
|
-
throw 'unexpected EOF';
|
|
4470
|
-
if (!c)
|
|
4471
|
-
throw 'invalid length/literal';
|
|
4472
|
-
if (sym < 256)
|
|
4473
|
-
buf[bt++] = sym;
|
|
4474
|
-
else if (sym == 256) {
|
|
4475
|
-
lm = null;
|
|
4476
|
-
break;
|
|
4477
|
-
}
|
|
4478
|
-
else {
|
|
4479
|
-
var add = sym - 254;
|
|
4480
|
-
// no extra bits needed if less
|
|
4481
|
-
if (sym > 264) {
|
|
4482
|
-
// index
|
|
4483
|
-
var i = sym - 257, b = fleb[i];
|
|
4484
|
-
add = bits(dat, pos, (1 << b) - 1) + fl[i];
|
|
4485
|
-
pos += b;
|
|
4486
|
-
}
|
|
4487
|
-
// dist
|
|
4488
|
-
var d = dm[bits16(dat, pos) & dms], dsym = d >>> 4;
|
|
4489
|
-
if (!d)
|
|
4490
|
-
throw 'invalid distance';
|
|
4491
|
-
pos += d & 15;
|
|
4492
|
-
var dt = fd[dsym];
|
|
4493
|
-
if (dsym > 3) {
|
|
4494
|
-
var b = fdeb[dsym];
|
|
4495
|
-
dt += bits16(dat, pos) & ((1 << b) - 1), pos += b;
|
|
4496
|
-
}
|
|
4497
|
-
if (pos > tbts)
|
|
4498
|
-
throw 'unexpected EOF';
|
|
4499
|
-
if (noBuf)
|
|
4500
|
-
cbuf(bt + 131072);
|
|
4501
|
-
var end = bt + add;
|
|
4502
|
-
for (; bt < end; bt += 4) {
|
|
4503
|
-
buf[bt] = buf[bt - dt];
|
|
4504
|
-
buf[bt + 1] = buf[bt + 1 - dt];
|
|
4505
|
-
buf[bt + 2] = buf[bt + 2 - dt];
|
|
4506
|
-
buf[bt + 3] = buf[bt + 3 - dt];
|
|
4507
|
-
}
|
|
4508
|
-
bt = end;
|
|
4509
|
-
}
|
|
4510
|
-
}
|
|
4511
|
-
st.l = lm, st.p = pos, st.b = bt;
|
|
4512
|
-
if (lm)
|
|
4513
|
-
final = 1, st.m = lbt, st.d = dm, st.n = dbt;
|
|
4514
|
-
} while (!final);
|
|
4515
|
-
return bt == buf.length ? buf : slc(buf, 0, bt);
|
|
4516
|
-
};
|
|
4517
|
-
// zlib valid
|
|
4518
|
-
var zlv = function (d) {
|
|
4519
|
-
if ((d[0] & 15) != 8 || (d[0] >>> 4) > 7 || ((d[0] << 8 | d[1]) % 31))
|
|
4520
|
-
throw 'invalid zlib data';
|
|
4521
|
-
if (d[1] & 32)
|
|
4522
|
-
throw 'invalid zlib data: preset dictionaries not supported';
|
|
4523
|
-
};
|
|
4524
|
-
/**
|
|
4525
|
-
* Expands Zlib data
|
|
4526
|
-
* @param data The data to decompress
|
|
4527
|
-
* @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
|
|
4528
|
-
* @returns The decompressed version of the data
|
|
4529
|
-
*/
|
|
4530
|
-
function unzlibSync(data, out) {
|
|
4531
|
-
return inflt((zlv(data), data.subarray(2, -4)), out);
|
|
4532
|
-
}
|
|
4533
|
-
/**
|
|
4534
|
-
* Converts a string into a Uint8Array for use with compression/decompression methods
|
|
4535
|
-
* @param str The string to encode
|
|
4536
|
-
* @param latin1 Whether or not to interpret the data as Latin-1. This should
|
|
4537
|
-
* not need to be true unless decoding a binary string.
|
|
4538
|
-
* @returns The string encoded in UTF-8/Latin-1 binary
|
|
4539
|
-
*/
|
|
4540
|
-
function strToU8(str, latin1) {
|
|
4541
|
-
var l = str.length;
|
|
4542
|
-
if (!latin1 && typeof TextEncoder != 'undefined')
|
|
4543
|
-
return new TextEncoder().encode(str);
|
|
4544
|
-
var ar = new u8(str.length + (str.length >>> 1));
|
|
4545
|
-
var ai = 0;
|
|
4546
|
-
var w = function (v) { ar[ai++] = v; };
|
|
4547
|
-
for (var i = 0; i < l; ++i) {
|
|
4548
|
-
if (ai + 5 > ar.length) {
|
|
4549
|
-
var n = new u8(ai + 8 + ((l - i) << 1));
|
|
4550
|
-
n.set(ar);
|
|
4551
|
-
ar = n;
|
|
4552
|
-
}
|
|
4553
|
-
var c = str.charCodeAt(i);
|
|
4554
|
-
if (c < 128 || latin1)
|
|
4555
|
-
w(c);
|
|
4556
|
-
else if (c < 2048)
|
|
4557
|
-
w(192 | (c >>> 6)), w(128 | (c & 63));
|
|
4558
|
-
else if (c > 55295 && c < 57344)
|
|
4559
|
-
c = 65536 + (c & 1023 << 10) | (str.charCodeAt(++i) & 1023),
|
|
4560
|
-
w(240 | (c >>> 18)), w(128 | ((c >>> 12) & 63)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));
|
|
4561
|
-
else
|
|
4562
|
-
w(224 | (c >>> 12)), w(128 | ((c >>> 6) & 63)), w(128 | (c & 63));
|
|
4563
|
-
}
|
|
4564
|
-
return slc(ar, 0, ai);
|
|
4565
|
-
}
|
|
4566
|
-
/**
|
|
4567
|
-
* Converts a Uint8Array to a string
|
|
4568
|
-
* @param dat The data to decode to string
|
|
4569
|
-
* @param latin1 Whether or not to interpret the data as Latin-1. This should
|
|
4570
|
-
* not need to be true unless encoding to binary string.
|
|
4571
|
-
* @returns The original UTF-8/Latin-1 string
|
|
4572
|
-
*/
|
|
4573
|
-
function strFromU8(dat, latin1) {
|
|
4574
|
-
var r = '';
|
|
4575
|
-
if (!latin1 && typeof TextDecoder != 'undefined')
|
|
4576
|
-
return new TextDecoder().decode(dat);
|
|
4577
|
-
for (var i = 0; i < dat.length;) {
|
|
4578
|
-
var c = dat[i++];
|
|
4579
|
-
if (c < 128 || latin1)
|
|
4580
|
-
r += String.fromCharCode(c);
|
|
4581
|
-
else if (c < 224)
|
|
4582
|
-
r += String.fromCharCode((c & 31) << 6 | (dat[i++] & 63));
|
|
4583
|
-
else if (c < 240)
|
|
4584
|
-
r += String.fromCharCode((c & 15) << 12 | (dat[i++] & 63) << 6 | (dat[i++] & 63));
|
|
4585
|
-
else
|
|
4586
|
-
c = ((c & 15) << 18 | (dat[i++] & 63) << 12 | (dat[i++] & 63) << 6 | (dat[i++] & 63)) - 65536,
|
|
4587
|
-
r += String.fromCharCode(55296 | (c >> 10), 56320 | (c & 1023));
|
|
4588
|
-
}
|
|
4589
|
-
return r;
|
|
4590
|
-
}
|
|
4591
|
-
|
|
4592
|
-
var MARK = 'v1';
|
|
4593
|
-
|
|
4594
|
-
var unpack = function (raw) {
|
|
4595
|
-
if (typeof raw !== 'string') {
|
|
4596
|
-
return raw;
|
|
4597
|
-
}
|
|
4598
|
-
try {
|
|
4599
|
-
var e = JSON.parse(raw);
|
|
4600
|
-
if (e.timestamp) {
|
|
4601
|
-
return e;
|
|
4602
|
-
}
|
|
4603
|
-
}
|
|
4604
|
-
catch (error) {
|
|
4605
|
-
}
|
|
4606
|
-
try {
|
|
4607
|
-
var e = JSON.parse(strFromU8(unzlibSync(strToU8(raw, true))));
|
|
4608
|
-
if (e.v === MARK) {
|
|
4609
|
-
return e;
|
|
4610
|
-
}
|
|
4611
|
-
throw new Error("These events were packed with packer ".concat(e.v, " which is incompatible with current packer ").concat(MARK, "."));
|
|
4612
|
-
}
|
|
4613
|
-
catch (error) {
|
|
4614
|
-
console.error(error);
|
|
4615
|
-
throw new Error('Unknown data format.');
|
|
4616
|
-
}
|
|
4617
|
-
};
|
|
4618
|
-
|
|
4619
|
-
exports.Replayer = Replayer;
|
|
4620
|
-
exports.unpack = unpack;
|
|
4621
|
-
|
|
4622
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4623
|
-
|
|
4624
|
-
return exports;
|
|
4625
|
-
|
|
4626
|
-
}({}));
|
|
15
|
+
***************************************************************************** */function rt(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),a=[];try{for(;(t===void 0||t-- >0)&&!(n=s.next()).done;)a.push(n.value)}catch(u){i={error:u}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return a}var ne;(function(e){e[e.NotStarted=0]="NotStarted",e[e.Running=1]="Running",e[e.Stopped=2]="Stopped"})(ne||(ne={}));var nt={type:"xstate.init"};function Se(e){return e===void 0?[]:[].concat(e)}function ee(e){return{type:"xstate.assign",assignment:e}}function it(e,t){return typeof(e=typeof e=="string"&&t&&t[e]?t[e]:e)=="string"?{type:e}:typeof e=="function"?{type:e.name,exec:e}:e}function ye(e){return function(t){return e===t}}function ot(e){return typeof e=="string"?{type:e}:e}function st(e,t){return{value:e,context:t,actions:[],changed:!1,matches:ye(e)}}function at(e,t,r){var n=t,i=!1;return[e.filter(function(s){if(s.type==="xstate.assign"){i=!0;var a=Object.assign({},n);return typeof s.assignment=="function"?a=s.assignment(n,r):Object.keys(s.assignment).forEach(function(u){a[u]=typeof s.assignment[u]=="function"?s.assignment[u](n,r):s.assignment[u]}),n=a,!1}return!0}),n,i]}function ct(e,t){t===void 0&&(t={});var r=rt(at(Se(e.states[e.initial].entry).map(function(a){return it(a,t.actions)}),e.context,nt),2),n=r[0],i=r[1],s={config:e,_options:t,initialState:{value:e.initial,actions:n,context:i,matches:ye(e.initial)},transition:function(a,u){var c,o,l=typeof a=="string"?{value:a,context:e.context}:a,d=l.value,m=l.context,f=ot(u),y=e.states[d];if(y.on){var v=Se(y.on[f.type]);try{for(var E=function(_){var te=typeof Symbol=="function"&&Symbol.iterator,g=te&&_[te],p=0;if(g)return g.call(_);if(_&&typeof _.length=="number")return{next:function(){return _&&p>=_.length&&(_=void 0),{value:_&&_[p++],done:!_}}};throw new TypeError(te?"Object is not iterable.":"Symbol.iterator is not defined.")}(v),h=E.next();!h.done;h=E.next()){var T=h.value;if(T===void 0)return st(d,m);var N=typeof T=="string"?{target:T}:T,R=N.target,F=N.actions,O=F===void 0?[]:F,M=N.cond,k=M===void 0?function(){return!0}:M,$=R===void 0,me=R??d,pe=e.states[me];if(k(m,f)){var J=rt(at(($?Se(O):[].concat(y.exit,O,pe.entry).filter(function(_){return _})).map(function(_){return it(_,s._options.actions)}),m,f),3),H=J[0],K=J[1],se=J[2],B=R??d;return{value:B,context:K,actions:H,changed:R!==d||H.length>0||se,matches:ye(B)}}}}catch(_){c={error:_}}finally{try{h&&!h.done&&(o=E.return)&&o.call(E)}finally{if(c)throw c.error}}}return st(d,m)}};return s}var lt=function(e,t){return e.actions.forEach(function(r){var n=r.exec;return n&&n(e.context,t)})};function ut(e){var t=e.initialState,r=ne.NotStarted,n=new Set,i={_machine:e,send:function(s){r===ne.Running&&(t=e.transition(t,s),lt(t,ot(s)),n.forEach(function(a){return a(t)}))},subscribe:function(s){return n.add(s),s(t),{unsubscribe:function(){return n.delete(s)}}},start:function(s){if(s){var a=typeof s=="object"?s:{context:e.config.context,value:s};t={value:a.value,actions:[],context:a.context,matches:ye(a.value)}}return r=ne.Running,lt(t,nt),i},stop:function(){return r=ne.Stopped,n.clear(),i},get state(){return t},get status(){return r}};return i}var Dr=Object.defineProperty,Cr=Object.defineProperties,xr=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,ht=(e,t,r)=>t in e?Dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Te=(e,t)=>{for(var r in t||(t={}))Mr.call(t,r)&&ht(e,r,t[r]);if(dt)for(var r of dt(t))Sr.call(t,r)&&ht(e,r,t[r]);return e},Ee=(e,t)=>Cr(e,xr(t));function Rr(e,t){for(let r=e.length-1;r>=0;r--){const n=e[r];if(n.type===S.Meta&&n.timestamp<=t)return e.slice(r)}return e}function Ar(e,{getCastFn:t,applyEventsSynchronously:r,emitter:n}){const i=ct({id:"player",context:e,initial:"paused",states:{playing:{on:{PAUSE:{target:"paused",actions:["pause"]},CAST_EVENT:{target:"playing",actions:"castEvent"},END:{target:"paused",actions:["resetLastPlayedEvent","pause"]},ADD_EVENT:{target:"playing",actions:["addEvent"]},REPLACE_EVENTS:{target:"playing",actions:["replaceEvents"]}}},paused:{on:{PLAY:{target:"playing",actions:["recordTimeOffset","play"]},CAST_EVENT:{target:"paused",actions:"castEvent"},TO_LIVE:{target:"live",actions:["startLive"]},ADD_EVENT:{target:"paused",actions:["addEvent"]},REPLACE_EVENTS:{target:"paused",actions:["replaceEvents"]}}},live:{on:{ADD_EVENT:{target:"live",actions:["addEvent"]},CAST_EVENT:{target:"live",actions:["castEvent"]}}}}},{actions:{castEvent:ee({lastPlayedEvent:(s,a)=>a.type==="CAST_EVENT"?a.payload.event:s.lastPlayedEvent}),recordTimeOffset:ee((s,a)=>{let u=s.timeOffset;return"payload"in a&&"timeOffset"in a.payload&&(u=a.payload.timeOffset),Ee(Te({},s),{timeOffset:u,baselineTime:s.events[0].timestamp+u})}),play(s){var a;const{timer:u,events:c,baselineTime:o,lastPlayedEvent:l}=s;u.clear();for(const v of c)Me(v,o);const d=Rr(c,o);let m=l?.timestamp;l?.type===S.IncrementalSnapshot&&l.data.source===I.MouseMove&&(m=l.timestamp+((a=l.data.positions[0])==null?void 0:a.timeOffset)),o<(m||0)&&n.emit(D.PlayBack);const f=new Array,y=new Array;for(const v of d)if(!(m&&m<o&&(v.timestamp<=m||v===l)))if(v.timestamp<o)f.push(v);else{const E=t(v,!1);y.push({doAction:()=>{E()},delay:v.delay})}r(f),n.emit(D.Flush),u.addActions(y),u.start()},pause(s){s.timer.clear()},resetLastPlayedEvent:ee(s=>Ee(Te({},s),{lastPlayedEvent:null})),startLive:ee({baselineTime:(s,a)=>(s.timer.toggleLiveMode(!0),s.timer.start(),a.type==="TO_LIVE"&&a.payload.baselineTime?a.payload.baselineTime:Date.now())}),replaceEvents:ee((s,a)=>{const{events:u,timer:c,baselineTime:o}=s;if(a.type==="REPLACE_EVENTS"){const{events:l}=a.payload;u.length=0;const d=[];for(const m of l)if(Me(m,o),u.push(m),m.timestamp>=c.timeOffset+o){const f=t(m,!1);d.push({doAction:()=>{f()},delay:m.delay})}c.isActive()&&c.replaceActions(d)}return Ee(Te({},s),{events:u})}),addEvent:ee((s,a)=>{const{baselineTime:u,timer:c,events:o}=s;if(a.type==="ADD_EVENT"){const{event:l}=a.payload;Me(l,u);let d=o.length-1;if(!o[d]||o[d].timestamp<=l.timestamp)o.push(l);else{let y=-1,v=0;for(;v<=d;){const E=Math.floor((v+d)/2);o[E].timestamp<=l.timestamp?v=E+1:d=E-1}y===-1&&(y=v),o.splice(y,0,l)}const m=l.timestamp<u,f=t(l,m);m?f():c.isActive()&&c.addAction({doAction:()=>{f()},delay:l.delay})}return Ee(Te({},s),{events:o})})}});return ut(i)}function Ir(e){const t=ct({id:"speed",context:e,initial:"normal",states:{normal:{on:{FAST_FORWARD:{target:"skipping",actions:["recordSpeed","setSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}},skipping:{on:{BACK_TO_NORMAL:{target:"normal",actions:["restoreSpeed"]},SET_SPEED:{target:"normal",actions:["setSpeed"]}}}}},{actions:{setSpeed:(r,n)=>{"payload"in n&&r.timer.setSpeed(n.payload.speed)},recordSpeed:ee({normalSpeed:r=>r.timer.speed}),restoreSpeed:r=>{r.timer.setSpeed(r.normalSpeed)}}});return ut(t)}const ie=`Please stop import mirror directly. Instead of that,\r
|
|
16
|
+
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
|
|
17
|
+
or you can use record.mirror to access the mirror instance during recording.`;let mt={map:{},getId(){return console.error(ie),-1},getNode(){return console.error(ie),null},removeNodeFromMap(){console.error(ie)},has(){return console.error(ie),!1},reset(){console.error(ie)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(mt=new Proxy(mt,{get(e,t,r){return t==="map"&&console.error(ie),Reflect.get(e,t,r)}}));function Or(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=function(t){if(!(0 in arguments))throw new TypeError("1 argument is required");do if(this===t)return!0;while(t=t&&t.parentNode);return!1})}function kr(e){const t={},r=(i,s)=>{const a={value:i,parent:s,children:[]};return t[i.node.id]=a,a},n=[];for(const i of e){const{nextId:s,parentId:a}=i;if(s&&s in t){const u=t[s];if(u.parent){const c=u.parent.children.indexOf(u);u.parent.children.splice(c,0,r(i,u.parent))}else{const c=n.indexOf(u);n.splice(c,0,r(i,null))}continue}if(a in t){const u=t[a];u.children.push(r(i,u));continue}n.push(r(i,null))}return n}function pt(e,t){t(e.value);for(let r=e.children.length-1;r>=0;r--)pt(e.children[r],t)}function Re(e,t){return Boolean(e.nodeName==="IFRAME"&&t.getMeta(e))}function ft(e,t){var r,n;const i=(n=(r=e.ownerDocument)==null?void 0:r.defaultView)==null?void 0:n.frameElement;if(!i||i===t)return{x:0,y:0,relativeScale:1,absoluteScale:1};const s=i.getBoundingClientRect(),a=ft(i,t),u=s.height/i.clientHeight;return{x:s.x*a.relativeScale+a.x,y:s.y*a.relativeScale+a.y,relativeScale:u,absoluteScale:a.absoluteScale*u}}function vt(e){return Boolean(e?.shadowRoot)}function le(e,t){const r=e[t[0]];return t.length===1?r:le(r.cssRules[t[1]].cssRules,t.slice(2))}function gt(e){const t=[...e],r=t.pop();return{positions:t,index:r}}function _r(e){const t=new Set,r=[];for(let n=e.length;n--;){const i=e[n];t.has(i.id)||(r.push(i),t.add(i.id))}return r}const Lr=e=>[`.${e} { background: currentColor }`,"noscript { display: none !important; }",`.${e} { background: currentColor; border-radius: 5px; }`,`.${e}:hover::after {content: 'Redacted'; color: white; background: black; text-align: center; width: 100%; display: block;}`];for(var yt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ue=typeof Uint8Array>"u"?[]:new Uint8Array(256),Ne=0;Ne<yt.length;Ne++)ue[yt.charCodeAt(Ne)]=Ne;var Fr=function(e){var t=e.length*.75,r=e.length,n,i=0,s,a,u,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);var o=new ArrayBuffer(t),l=new Uint8Array(o);for(n=0;n<r;n+=4)s=ue[e.charCodeAt(n)],a=ue[e.charCodeAt(n+1)],u=ue[e.charCodeAt(n+2)],c=ue[e.charCodeAt(n+3)],l[i++]=s<<2|a>>4,l[i++]=(a&15)<<4|u>>2,l[i++]=(u&3)<<6|c&63;return o},Pr=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{u(r.next(c))}catch(o){i(o)}},a=c=>{try{u(r.throw(c))}catch(o){i(o)}},u=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);u((r=r.apply(e,t)).next())});const Tt=new Map;function Et(e,t){let r=Tt.get(e);return r||(r=new Map,Tt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}function X(e,t,r){return n=>Pr(this,null,function*(){if(n&&typeof n=="object"&&"rr_type"in n)if(r&&(r.isUnchanged=!1),n.rr_type==="ImageBitmap"&&"args"in n){const i=yield X(e,t,r)(n.args);return yield createImageBitmap.apply(null,i)}else if("index"in n){if(r||t===null)return n;const{rr_type:i,index:s}=n;return Et(t,i)[s]}else if("args"in n){const{rr_type:i,args:s}=n,a=window[i];return new a(...yield Promise.all(s.map(X(e,t,r))))}else{if("base64"in n)return Fr(n.base64);if("src"in n){const i=e.get(n.src);if(i)return i;{const s=new Image;return s.src=n.src,e.set(n.src,s),s}}else if("data"in n&&n.rr_type==="Blob"){const i=yield Promise.all(n.data.map(X(e,t,r)));return new Blob(i,{type:n.type})}}else if(Array.isArray(n))return yield Promise.all(n.map(X(e,t,r)));return n})}var Ur=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{u(r.next(c))}catch(o){i(o)}},a=c=>{try{u(r.throw(c))}catch(o){i(o)}},u=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);u((r=r.apply(e,t)).next())});function Br(e,t){try{return t===ge.WebGL?e.getContext("webgl")||e.getContext("experimental-webgl"):e.getContext("webgl2")}catch{return null}}const Vr=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject"];function $r(e,t){if(!(t!=null&&t.constructor))return;const{name:r}=t.constructor;if(!Vr.includes(r))return;const n=Et(e,r);n.includes(t)||n.push(t)}function Wr(e){return Ur(this,arguments,function*({mutation:t,target:r,type:n,imageMap:i,errorHandler:s}){try{const a=Br(r,n);if(!a)return;if(t.setter){a[t.property]=t.args[0];return}const u=a[t.property],c=yield Promise.all(t.args.map(X(i,a))),o=u.apply(a,c);$r(a,o)}catch(a){s(t,a)}})}var jr=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{u(r.next(c))}catch(o){i(o)}},a=c=>{try{u(r.throw(c))}catch(o){i(o)}},u=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);u((r=r.apply(e,t)).next())});function Gr(e){return jr(this,arguments,function*({event:t,mutation:r,target:n,imageMap:i,errorHandler:s}){try{const a=n.getContext("2d");if(r.setter){a[r.property]=r.args[0];return}const u=a[r.property];if(r.property==="drawImage"&&typeof r.args[0]=="string"){const c=i.get(t);u.apply(a,r.args)}else{const c=yield Promise.all(r.args.map(X(i,a)));u.apply(a,c)}}catch(a){s(r,a)}})}var Hr=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{u(r.next(c))}catch(o){i(o)}},a=c=>{try{u(r.throw(c))}catch(o){i(o)}},u=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);u((r=r.apply(e,t)).next())});function Nt(e){return Hr(this,arguments,function*({event:t,mutation:r,target:n,imageMap:i,canvasEventMap:s,errorHandler:a}){try{const u=s.get(t)||r,c="commands"in u?u.commands:[u];if([ge.WebGL,ge.WebGL2].includes(r.type)){for(let o=0;o<c.length;o++){const l=c[o];yield Wr({mutation:l,type:r.type,target:n,imageMap:i,errorHandler:a})}return}for(let o=0;o<c.length;o++){const l=c[o];yield Gr({event:t,mutation:l,target:n,imageMap:i,errorHandler:a})}}catch(u){a(r,u)}})}var Yr=Object.defineProperty,zr=Object.defineProperties,Xr=Object.getOwnPropertyDescriptors,wt=Object.getOwnPropertySymbols,Qr=Object.prototype.hasOwnProperty,qr=Object.prototype.propertyIsEnumerable,bt=(e,t,r)=>t in e?Yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,oe=(e,t)=>{for(var r in t||(t={}))Qr.call(t,r)&&bt(e,r,t[r]);if(wt)for(var r of wt(t))qr.call(t,r)&&bt(e,r,t[r]);return e},Ae=(e,t)=>zr(e,Xr(t)),Ie=(e,t,r)=>new Promise((n,i)=>{var s=c=>{try{u(r.next(c))}catch(o){i(o)}},a=c=>{try{u(r.throw(c))}catch(o){i(o)}},u=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,a);u((r=r.apply(e,t)).next())});const Dt=10*1e3,Ct=2*1e3,xt=1*1e3,Mt=60*60*1e3,Jr=tt||Nr,Oe="[replayer]",ke={duration:500,lineCap:"round",lineWidth:3,strokeStyle:"red"};function _e(e){return e.type==S.IncrementalSnapshot&&(e.data.source==I.TouchMove||e.data.source==I.MouseInteraction&&e.data.type==U.TouchStart)}class Kr{constructor(t,r){if(this.usingVirtualDom=!1,this.virtualDom=new re,this.mouseTail=null,this.tailPositions=[],this.emitter=Jr(),this.activityIntervals=[],this.legacy_missingNodeRetryMap={},this.cache=Ge(),this.imageMap=new Map,this.canvasEventMap=new Map,this.mirror=Wt(),this.firstFullSnapshot=null,this.newDocumentQueue=[],this.mousePos=null,this.touchActive=null,!(r!=null&&r.liveMode)&&t.length<2)throw new Error("Replayer need at least 2 events.");const n={speed:1,maxSpeed:360,root:document.body,loadTimeout:0,skipInactive:!1,showWarning:!0,showDebug:!1,blockClass:"highlight-block",liveMode:!1,insertStyleRules:[],triggerFocus:!0,UNSAFE_replayCanvas:!1,pauseAnimation:!0,mouseTail:ke,useVirtualDom:!0,inactiveThreshold:.02,inactiveSkipTime:Ct};this.config=Object.assign({},n,r),this.handleResize=this.handleResize.bind(this),this.getCastFn=this.getCastFn.bind(this),this.applyEventsSynchronously=this.applyEventsSynchronously.bind(this),this.emitter.on(D.Resize,this.handleResize),this.setupDom(),this.emitter.on(D.Flush,()=>{if(this.usingVirtualDom){const u={mirror:this.mirror,applyCanvas:(c,o,l)=>{Nt({event:c,mutation:o,target:l,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})},applyInput:this.applyInput.bind(this),applyScroll:this.applyScroll.bind(this)};if(Y(this.iframe.contentDocument,this.virtualDom,u,this.virtualDom.mirror),this.virtualDom.destroyTree(),this.usingVirtualDom=!1,Object.keys(this.legacy_missingNodeRetryMap).length)for(const c in this.legacy_missingNodeRetryMap)try{const o=this.legacy_missingNodeRetryMap[c],l=Ce(o.node,this.mirror,this.virtualDom.mirror);Y(l,o.node,u,this.virtualDom.mirror),o.node=l}catch(o){this.config.showWarning&&console.warn(o)}}this.mousePos&&this.moveAndHover(this.mousePos.x,this.mousePos.y,this.mousePos.id,!0,this.mousePos.debugData),this.mousePos=null}),this.emitter.on(D.PlayBack,()=>{this.firstFullSnapshot=null,this.mirror.reset()});const i=new br([],r?.speed||n.speed);this.service=Ar({events:t.map(u=>r&&r.unpackFn?r.unpackFn(u):u).sort((u,c)=>u.timestamp-c.timestamp),timer:i,timeOffset:0,baselineTime:0,lastPlayedEvent:null},{getCastFn:this.getCastFn,applyEventsSynchronously:this.applyEventsSynchronously,emitter:this.emitter}),this.service.start(),this.service.subscribe(u=>{this.emitter.emit(D.StateChange,{player:u})}),this.speedService=Ir({normalSpeed:-1,timer:i}),this.speedService.start(),this.speedService.subscribe(u=>{this.emitter.emit(D.StateChange,{speed:u})});const s=this.service.state.context.events.find(u=>u.type===S.Meta),a=this.service.state.context.events.find(u=>u.type===S.FullSnapshot);if(s){const{width:u,height:c}=s.data;setTimeout(()=>{this.emitter.emit(D.Resize,{width:u,height:c})},0)}a&&setTimeout(()=>{this.firstFullSnapshot||(this.firstFullSnapshot=a,this.rebuildFullSnapshot(a),this.iframe.contentWindow.scrollTo(a.data.initialOffset))},1),this.service.state.context.events.find(_e)&&this.mouse.classList.add("touch-device")}get timer(){return this.service.state.context.timer}on(t,r){return this.emitter.on(t,r),this}off(t,r){return this.emitter.off(t,r),this}setConfig(t){Object.keys(t).forEach(r=>{this.config[r]=t[r]}),this.config.skipInactive||this.backToNormal(),typeof t.speed<"u"&&this.speedService.send({type:"SET_SPEED",payload:{speed:t.speed}}),typeof t.mouseTail<"u"&&(t.mouseTail===!1?this.mouseTail&&(this.mouseTail.style.display="none"):(this.mouseTail||(this.mouseTail=document.createElement("canvas"),this.mouseTail.width=Number.parseFloat(this.iframe.width),this.mouseTail.height=Number.parseFloat(this.iframe.height),this.mouseTail.classList.add("replayer-mouse-tail"),this.wrapper.insertBefore(this.mouseTail,this.iframe)),this.mouseTail.style.display="inherit"))}getActivityIntervals(){if(this.activityIntervals.length==0){const t=[],r=this.getMetaData(),n=[{timestamp:r.startTime},...this.service.state.context.events.filter(a=>this.isUserInteraction(a)),{timestamp:r.endTime}];for(let a=1;a<n.length;a++){const u=n[a-1],c=n[a];c.timestamp-u.timestamp>Dt?t.push({startTime:u.timestamp,endTime:c.timestamp,duration:c.timestamp-u.timestamp,active:!1}):t.push({startTime:u.timestamp,endTime:c.timestamp,duration:c.timestamp-u.timestamp,active:!0})}const i=[];let s=t[0];for(let a=1;a<t.length;a++)t[a].active!=t[a-1].active&&(i.push({startTime:s.startTime,endTime:t[a-1].endTime,duration:t[a-1].endTime-s.startTime,active:t[a-1].active}),s=t[a]);s&&t.length>0&&i.push({startTime:s.startTime,endTime:t[t.length-1].endTime,duration:t[t.length-1].endTime-s.startTime,active:t[t.length-1].active}),s=i[0];for(let a=1;a<i.length;a++)(!i[a].active&&i[a].duration>this.config.inactiveThreshold*r.totalTime||!i[a-1].active&&i[a-1].duration>this.config.inactiveThreshold*r.totalTime)&&(this.activityIntervals.push({startTime:s.startTime,endTime:i[a-1].endTime,duration:i[a-1].endTime-s.startTime,active:i[a-1].active}),s=i[a]);s&&i.length>0&&this.activityIntervals.push({startTime:s.startTime,endTime:i[i.length-1].endTime,duration:i[i.length-1].endTime-s.startTime,active:i[i.length-1].active})}return this.activityIntervals}getMetaData(){const t=this.service.state.context.events[0],r=this.service.state.context.events[this.service.state.context.events.length-1];return{startTime:t.timestamp,endTime:r.timestamp,totalTime:r.timestamp-t.timestamp}}getCurrentTime(){return this.timer.timeOffset+this.getTimeOffset()}getTimeOffset(){const{baselineTime:t,events:r}=this.service.state.context;return t-r[0].timestamp}getMirror(){return this.mirror}play(t=0){var r,n;this.service.state.matches("paused")?this.service.send({type:"PLAY",payload:{timeOffset:t}}):(this.service.send({type:"PAUSE"}),this.service.send({type:"PLAY",payload:{timeOffset:t}})),(n=(r=this.iframe.contentDocument)==null?void 0:r.getElementsByTagName("html")[0])==null||n.classList.remove("rrweb-paused"),this.emitter.emit(D.Start),this.handleInactivity(this.getMetaData().startTime+t,!0)}pause(t){var r,n;t===void 0&&this.service.state.matches("playing")&&this.service.send({type:"PAUSE"}),typeof t=="number"&&(this.play(t),this.service.send({type:"PAUSE"})),(n=(r=this.iframe.contentDocument)==null?void 0:r.getElementsByTagName("html")[0])==null||n.classList.add("rrweb-paused"),this.emitter.emit(D.Pause)}resume(t=0){console.warn("The 'resume' will be departed in 1.0. Please use 'play' method which has the same interface."),this.play(t),this.emitter.emit(D.Resume)}startLive(t){this.service.send({type:"TO_LIVE",payload:{baselineTime:t}})}addEvent(t){const r=this.config.unpackFn?this.config.unpackFn(t):t;_e(r)&&this.mouse.classList.add("touch-device"),Promise.resolve().then(()=>this.service.send({type:"ADD_EVENT",payload:{event:r}}))}replaceEvents(t){for(const r of t)if(_e(r)){this.mouse.classList.add("touch-device");break}this.service.send({type:"REPLACE_EVENTS",payload:{events:t}})}enableInteract(){this.iframe.setAttribute("scrolling","auto"),this.iframe.style.pointerEvents="auto"}disableInteract(){this.iframe.setAttribute("scrolling","no"),this.iframe.style.pointerEvents="none"}resetCache(){this.cache=Ge()}setupDom(){this.wrapper=document.createElement("div"),this.wrapper.classList.add("replayer-wrapper"),this.config.root.appendChild(this.wrapper),this.mouse=document.createElement("div"),this.mouse.classList.add("replayer-mouse"),this.wrapper.appendChild(this.mouse),this.config.mouseTail!==!1&&(this.mouseTail=document.createElement("canvas"),this.mouseTail.classList.add("replayer-mouse-tail"),this.mouseTail.style.display="inherit",this.wrapper.appendChild(this.mouseTail)),this.iframe=document.createElement("iframe");const t=["allow-same-origin"];this.config.UNSAFE_replayCanvas&&t.push("allow-scripts"),this.iframe.style.display="none",this.iframe.setAttribute("sandbox",t.join(" ")),this.disableInteract(),this.wrapper.appendChild(this.iframe),this.iframe.contentWindow&&this.iframe.contentDocument&&(wr(this.iframe.contentWindow,this.iframe.contentDocument),Or(this.iframe.contentWindow))}handleResize(t){this.iframe.style.display="inherit";for(const r of[this.mouseTail,this.iframe])!r||(r.setAttribute("width",String(t.width)),r.setAttribute("height",String(t.height)))}applyEventsSynchronously(t){for(const r of t){switch(r.type){case S.DomContentLoaded:case S.Load:case S.Custom:continue;case S.FullSnapshot:case S.Meta:case S.Plugin:case S.IncrementalSnapshot:break}this.getCastFn(r,!0)()}this.touchActive===!0?this.mouse.classList.add("touch-active"):this.touchActive===!1&&this.mouse.classList.remove("touch-active"),this.touchActive=null}getCastFn(t,r=!1){let n;switch(t.type){case S.DomContentLoaded:case S.Load:break;case S.Custom:n=()=>{this.emitter.emit(D.CustomEvent,t)};break;case S.Meta:n=()=>this.emitter.emit(D.Resize,{width:t.data.width,height:t.data.height});break;case S.FullSnapshot:n=()=>{if(this.firstFullSnapshot){if(this.firstFullSnapshot===t){this.firstFullSnapshot=!0;return}}else this.firstFullSnapshot=!0;this.rebuildFullSnapshot(t,r),this.iframe.contentWindow.scrollTo(t.data.initialOffset)};break;case S.IncrementalSnapshot:n=()=>{if(this.applyIncremental(t,r),!r&&(this.handleInactivity(t.timestamp),t===this.nextUserInteractionEvent&&(this.nextUserInteractionEvent=null,this.backToNormal()),this.config.skipInactive&&!this.nextUserInteractionEvent)){for(const i of this.service.state.context.events)if(!(i.timestamp<=t.timestamp)&&this.isUserInteraction(i)){i.delay-t.delay>Dt*this.speedService.state.context.timer.speed&&(this.nextUserInteractionEvent=i);break}if(this.nextUserInteractionEvent){const i=this.nextUserInteractionEvent.delay-t.delay,s={speed:Math.min(Math.round(i/Ct),this.config.maxSpeed)};this.speedService.send({type:"FAST_FORWARD",payload:s}),this.emitter.emit(D.SkipStart,s)}}};break}return()=>{n&&n();for(const s of this.config.plugins||[])s.handler(t,r,{replayer:this});this.service.send({type:"CAST_EVENT",payload:{event:t}});const i=this.service.state.context.events.length-1;if(t===this.service.state.context.events[i]){const s=()=>{i<this.service.state.context.events.length-1||(this.backToNormal(),this.service.send("END"),this.emitter.emit(D.Finish))};t.type===S.IncrementalSnapshot&&t.data.source===I.MouseMove&&t.data.positions.length?setTimeout(()=>{s()},Math.max(0,-t.data.positions[0].timeOffset+50)):s()}this.emitter.emit(D.EventCast,t)}}handleInactivity(t,r){if((t===this.inactiveEndTimestamp||r)&&(this.inactiveEndTimestamp=null,this.backToNormal()),this.config.skipInactive&&!this.inactiveEndTimestamp){for(const n of this.getActivityIntervals())if(t>=n.startTime&&t<n.endTime&&!n.active){this.inactiveEndTimestamp=n.endTime;break}if(this.inactiveEndTimestamp){const n=this.inactiveEndTimestamp-t,i={speed:n/Mt*this.config.inactiveSkipTime<xt?n/xt:Math.round(Math.max(n,Mt)/this.config.inactiveSkipTime)};this.speedService.send({type:"FAST_FORWARD",payload:i}),this.emitter.emit(D.SkipStart,i)}}}rebuildFullSnapshot(t,r=!1){if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");Object.keys(this.legacy_missingNodeRetryMap).length&&console.warn("Found unresolved missing node map",this.legacy_missingNodeRetryMap),this.legacy_missingNodeRetryMap={};const n=[];qt(t.data.node,{doc:this.iframe.contentDocument,afterAppend:a=>{this.collectIframeAndAttachDocument(n,a)},cache:this.cache,mirror:this.mirror});for(const{mutationInQueue:a,builtNode:u}of n)this.attachDocumentToIframe(a,u),this.newDocumentQueue=this.newDocumentQueue.filter(c=>c!==a);const{documentElement:i,head:s}=this.iframe.contentDocument;this.insertStyleRules(i,s),this.service.state.matches("playing")||this.iframe.contentDocument.getElementsByTagName("html")[0].classList.add("rrweb-paused"),this.emitter.emit(D.FullsnapshotRebuilded,t),r||this.waitForStylesheetLoad(),this.config.UNSAFE_replayCanvas&&this.preloadAllImages()}insertStyleRules(t,r){const n=Lr(this.config.blockClass).concat(this.config.insertStyleRules);if(this.config.pauseAnimation&&n.push("html.rrweb-paused *, html.rrweb-paused *:before, html.rrweb-paused *:after { animation-play-state: paused !important; }"),this.usingVirtualDom){const i=this.virtualDom.createElement("style");this.virtualDom.mirror.add(i,et(i,this.virtualDom.unserializedId)),t.insertBefore(i,r);for(let s=0;s<n.length;s++)i.rules.push({cssText:n[s],type:j.Insert,index:s})}else{const i=document.createElement("style");t.insertBefore(i,r);for(let s=0;s<n.length;s++)i.sheet.insertRule(n[s],s)}}attachDocumentToIframe(t,r){const n=this.usingVirtualDom?this.virtualDom.mirror:this.mirror,i=[];ve(t.node,{doc:r.contentDocument,mirror:n,hackCss:!0,skipChild:!1,afterAppend:s=>{this.collectIframeAndAttachDocument(i,s);const a=n.getMeta(s);if(a?.type===L.Element&&a?.tagName.toUpperCase()==="HTML"){const{documentElement:u,head:c}=r.contentDocument;this.insertStyleRules(u,c)}},cache:this.cache});for(const{mutationInQueue:s,builtNode:a}of i)this.attachDocumentToIframe(s,a),this.newDocumentQueue=this.newDocumentQueue.filter(u=>u!==s)}collectIframeAndAttachDocument(t,r){if(Re(r,this.mirror)){const n=this.newDocumentQueue.find(i=>i.parentId===this.mirror.getId(r));n&&t.push({mutationInQueue:n,builtNode:r})}}waitForStylesheetLoad(){var t;const r=(t=this.iframe.contentDocument)==null?void 0:t.head;if(r){const n=new Set;let i,s=this.service.state;const a=()=>{s=this.service.state};this.emitter.on(D.Start,a),this.emitter.on(D.Pause,a);const u=()=>{this.emitter.off(D.Start,a),this.emitter.off(D.Pause,a)};r.querySelectorAll('link[rel="stylesheet"]').forEach(c=>{c.sheet||(n.add(c),c.addEventListener("load",()=>{n.delete(c),n.size===0&&i!==-1&&(s.matches("playing")&&this.play(this.getCurrentTime()),this.emitter.emit(D.LoadStylesheetEnd),i&&clearTimeout(i),u())}))}),n.size>0&&(this.service.send({type:"PAUSE"}),this.emitter.emit(D.LoadStylesheetStart),i=setTimeout(()=>{s.matches("playing")&&this.play(this.getCurrentTime()),i=-1,u()},this.config.loadTimeout))}}hasImageArg(t){for(const r of t)if(!(!r||typeof r!="object")){if("rr_type"in r&&"args"in r){if(this.hasImageArg(r.args))return!0}else if("rr_type"in r&&r.rr_type==="HTMLImageElement"||r instanceof Array&&this.hasImageArg(r))return!0}return!1}getImageArgs(t){const r=[];for(const n of t)!n||typeof n!="object"||("rr_type"in n&&"args"in n?r.push(...this.getImageArgs(n.args)):"rr_type"in n&&n.rr_type==="HTMLImageElement"?r.push(n.src):n instanceof Array&&r.push(...this.getImageArgs(n)));return r}preloadAllImages(){return Ie(this,null,function*(){this.service.state;const t=()=>{this.service.state};this.emitter.on(D.Start,t),this.emitter.on(D.Pause,t);const r=[];for(const n of this.service.state.context.events)n.type===S.IncrementalSnapshot&&n.data.source===I.CanvasMutation&&(r.push(this.deserializeAndPreloadCanvasEvents(n.data,n)),("commands"in n.data?n.data.commands:[n.data]).forEach(i=>{this.preloadImages(i,n)}));return Promise.all(r)})}preloadImages(t,r){if(t.property==="drawImage"&&typeof t.args[0]=="string"&&!this.imageMap.has(r)){const n=document.createElement("canvas"),i=n.getContext("2d"),s=i?.createImageData(n.width,n.height);s?.data,JSON.parse(t.args[0]),i?.putImageData(s,0,0)}}deserializeAndPreloadCanvasEvents(t,r){return Ie(this,null,function*(){if(!this.canvasEventMap.has(r)){const n={isUnchanged:!0};if("commands"in t){const i=yield Promise.all(t.commands.map(s=>Ie(this,null,function*(){const a=yield Promise.all(s.args.map(X(this.imageMap,null,n)));return Ae(oe({},s),{args:a})})));n.isUnchanged===!1&&this.canvasEventMap.set(r,Ae(oe({},t),{commands:i}))}else{const i=yield Promise.all(t.args.map(X(this.imageMap,null,n)));n.isUnchanged===!1&&this.canvasEventMap.set(r,Ae(oe({},t),{args:i}))}}})}applyIncremental(t,r){var n,i,s,a,u,c;const{data:o}=t;switch(o.source){case I.Mutation:{try{this.applyMutation(o,r)}catch(l){this.warn(`Exception in mutation ${l.message||l}`,o)}break}case I.Drag:case I.TouchMove:case I.MouseMove:if(r){const l=o.positions[o.positions.length-1];this.mousePos={x:l.x,y:l.y,id:l.id,debugData:o}}else o.positions.forEach(l=>{const d={doAction:()=>{this.moveAndHover(l.x,l.y,l.id,r,o)},delay:l.timeOffset+t.timestamp-this.service.state.context.baselineTime};this.timer.addAction(d)}),this.timer.addAction({doAction(){},delay:t.delay-((n=o.positions[0])==null?void 0:n.timeOffset)});break;case I.MouseInteraction:{if(o.id===-1||r)break;const l=new Event(U[o.type].toLowerCase()),d=this.mirror.getNode(o.id);if(!d)return this.debugNodeNotFound(o,o.id);this.emitter.emit(D.MouseInteraction,{type:o.type,target:d});const{triggerFocus:m}=this.config;switch(o.type){case U.Blur:"blur"in d&&d.blur();break;case U.Focus:m&&d.focus&&d.focus({preventScroll:!0});break;case U.Click:case U.TouchStart:case U.TouchEnd:r?(o.type===U.TouchStart?this.touchActive=!0:o.type===U.TouchEnd&&(this.touchActive=!1),this.mousePos={x:o.x,y:o.y,id:o.id,debugData:o}):(o.type===U.TouchStart&&(this.tailPositions.length=0),this.moveAndHover(o.x,o.y,o.id,r,o),o.type===U.Click?(this.mouse.classList.remove("active"),this.mouse.offsetWidth,this.mouse.classList.add("active")):o.type===U.TouchStart?(this.mouse.offsetWidth,this.mouse.classList.add("touch-active")):o.type===U.TouchEnd&&this.mouse.classList.remove("touch-active"));break;case U.TouchCancel:r?this.touchActive=!1:this.mouse.classList.remove("touch-active");break;default:d.dispatchEvent(l)}break}case I.Scroll:{if(o.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.scrollData=o;break}this.applyScroll(o,r);break}case I.ViewportResize:this.emitter.emit(D.Resize,{width:o.width,height:o.height});break;case I.Input:{if(o.id===-1)break;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.inputData=o;break}this.applyInput(o);break}case I.MediaInteraction:{const l=this.usingVirtualDom?this.virtualDom.mirror.getNode(o.id):this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);const d=l;try{o.currentTime&&(d.currentTime=o.currentTime),o.volume&&(d.volume=o.volume),o.muted&&(d.muted=o.muted),o.type===xe.Pause&&d.pause(),o.type===xe.Play&&d.play()}catch(m){this.config.showWarning&&console.warn(`Failed to replay media interactions: ${m.message||m}`)}break}case I.StyleSheetRule:{if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);const d=l.rules;(i=o.adds)==null||i.forEach(({rule:m,index:f})=>d?.push({cssText:m,index:f,type:j.Insert})),(s=o.removes)==null||s.forEach(({index:m})=>d?.push({index:m,type:j.Remove}))}else{const l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);const d=l.sheet;(a=o.adds)==null||a.forEach(({rule:m,index:f})=>{try{if(Array.isArray(f)){const{positions:y,index:v}=gt(f);le(d.cssRules,y).insertRule(m,v)}else{const y=f===void 0?void 0:Math.min(f,d.cssRules.length);d.insertRule(m,y)}}catch{}}),(u=o.removes)==null||u.forEach(({index:m})=>{try{if(Array.isArray(m)){const{positions:f,index:y}=gt(m);le(d.cssRules,f).deleteRule(y||0)}else d?.deleteRule(m)}catch{}})}break}case I.StyleDeclaration:{if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);const d=l.rules;o.set&&d.push(oe({type:j.SetProperty,index:o.index},o.set)),o.remove&&d.push(oe({type:j.RemoveProperty,index:o.index},o.remove))}else{const l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);const d=l.sheet;o.set&&le(d.rules,o.index).style.setProperty(o.set.property,o.set.value,o.set.priority),o.remove&&le(d.rules,o.index).style.removeProperty(o.remove.property)}break}case I.CanvasMutation:{if(!this.config.UNSAFE_replayCanvas)return;if(this.usingVirtualDom){const l=this.virtualDom.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);l.canvasMutations.push({event:t,mutation:o})}else{const l=this.mirror.getNode(o.id);if(!l)return this.debugNodeNotFound(o,o.id);Nt({event:t,mutation:o,target:l,imageMap:this.imageMap,canvasEventMap:this.canvasEventMap,errorHandler:this.warnCanvasMutationFailed.bind(this)})}break}case I.Font:{try{const l=new FontFace(o.family,o.buffer?new Uint8Array(JSON.parse(o.fontSource)):o.fontSource,o.descriptors);(c=this.iframe.contentDocument)==null||c.fonts.add(l)}catch(l){this.config.showWarning&&console.warn(l)}break}}}applyMutation(t,r){if(this.config.useVirtualDom&&!this.usingVirtualDom&&r&&(this.usingVirtualDom=!0,yr(this.iframe.contentDocument,this.mirror,this.virtualDom),Object.keys(this.legacy_missingNodeRetryMap).length))for(const o in this.legacy_missingNodeRetryMap)try{const l=this.legacy_missingNodeRetryMap[o],d=Ze(l.node,this.virtualDom,this.mirror);d&&(l.node=d)}catch(l){this.config.showWarning&&console.warn(l)}const n=this.usingVirtualDom?this.virtualDom.mirror:this.mirror;t.removes.forEach(o=>{var l;const d=n.getNode(o.id);if(!d)return t.removes.find(f=>f.id===o.parentId)?void 0:this.warnNodeNotFound(t,o.id);let m=n.getNode(o.parentId);if(!m)return this.warnNodeNotFound(t,o.parentId);if(o.isShadow&&vt(m)&&(m=m.shadowRoot),n.removeNodeFromMap(d),m)try{m.removeChild(d),this.usingVirtualDom&&d.nodeName==="#text"&&m.nodeName==="STYLE"&&((l=m.rules)==null?void 0:l.length)>0&&(m.rules=[])}catch(f){if(f instanceof DOMException)this.warn("parent could not remove child in mutation",m,d,t);else throw f}});const i=oe({},this.legacy_missingNodeRetryMap),s=[],a=o=>{let l=null;return o.nextId&&(l=n.getNode(o.nextId)),o.nextId!==null&&o.nextId!==void 0&&o.nextId!==-1&&!l},u=o=>{var l;if(!this.iframe.contentDocument)return console.warn("Looks like your replayer has been destroyed.");let d=n.getNode(o.parentId);if(!d)return o.node.type===L.Document?this.newDocumentQueue.push(o):s.push(o);o.node.isShadow&&(vt(d)||d.attachShadow({mode:"open"}),d=d.shadowRoot);let m=null,f=null;if(o.previousId&&(m=n.getNode(o.previousId)),o.nextId&&(f=n.getNode(o.nextId)),a(o))return s.push(o);if(o.node.rootId&&!n.getNode(o.node.rootId))return;const y=o.node.rootId?n.getNode(o.node.rootId):this.usingVirtualDom?this.virtualDom:this.iframe.contentDocument;if(Re(d,n)){this.attachDocumentToIframe(o,d);return}const v=ve(o.node,{doc:y,mirror:n,skipChild:!0,hackCss:!0,cache:this.cache});if(o.previousId===-1||o.nextId===-1){i[o.node.id]={node:v,mutation:o};return}const E=n.getMeta(d);if(E&&E.type===L.Element&&E.tagName==="textarea"&&o.node.type===L.Text){const h=Array.isArray(d.childNodes)?d.childNodes:Array.from(d.childNodes);for(const T of h)T.nodeType===d.TEXT_NODE&&d.removeChild(T)}if(m&&m.nextSibling&&m.nextSibling.parentNode)d.insertBefore(v,m.nextSibling);else if(f&&f.parentNode)d.contains(f)?d.insertBefore(v,f):d.insertBefore(v,null);else{if(d===y)for(;y.firstChild;)y.removeChild(y.firstChild);d.appendChild(v)}if(this.usingVirtualDom&&v.nodeName==="#text"&&d.nodeName==="STYLE"&&((l=d.rules)==null?void 0:l.length)>0&&(d.rules=[]),Re(v,this.mirror)){const h=this.mirror.getId(v),T=this.newDocumentQueue.find(N=>N.parentId===h);T&&(this.attachDocumentToIframe(T,v),this.newDocumentQueue=this.newDocumentQueue.filter(N=>N!==T))}(o.previousId||o.nextId)&&this.legacy_resolveMissingNode(i,d,v,o)};t.adds.forEach(o=>{u(o)});const c=Date.now();for(;s.length;){const o=kr(s);if(s.length=0,Date.now()-c>500){this.warn("Timeout in the loop, please check the resolve tree data:",o);break}for(const l of o)n.getNode(l.value.parentId)?pt(l,d=>{u(d)}):this.debug("Drop resolve tree since there is no parent for the root node.",l)}Object.keys(i).length&&Object.assign(this.legacy_missingNodeRetryMap,i),_r(t.texts).forEach(o=>{var l;const d=n.getNode(o.id);if(!d)return t.removes.find(m=>m.id===o.id)?void 0:this.warnNodeNotFound(t,o.id);if(d.textContent=o.value,this.usingVirtualDom){const m=d.parentNode;((l=m?.rules)==null?void 0:l.length)>0&&(m.rules=[])}}),t.attributes.forEach(o=>{const l=n.getNode(o.id);if(!l)return t.removes.find(d=>d.id===o.id)?void 0:this.warnNodeNotFound(t,o.id);for(const d in o.attributes)if(typeof d=="string"){const m=o.attributes[d];if(m===null)l.removeAttribute(d);else if(typeof m=="string")try{l.setAttribute(d,m)}catch(f){this.config.showWarning&&console.warn("An error occurred may due to the checkout feature.",f)}else if(d==="style"){const f=m,y=l;for(const v in f)if(f[v]===!1)y.style.removeProperty(v);else if(f[v]instanceof Array){const E=f[v];y.style.setProperty(v,E[0],E[1])}else{const E=f[v];y.style.setProperty(v,E)}}}})}applyScroll(t,r){const n=this.mirror.getNode(t.id);if(!n)return this.debugNodeNotFound(t,t.id);const i=this.mirror.getMeta(n);if(n===this.iframe.contentDocument)this.iframe.contentWindow.scrollTo({top:t.y,left:t.x,behavior:r?"auto":"smooth"});else if(i?.type===L.Document)n.defaultView.scrollTo({top:t.y,left:t.x,behavior:r?"auto":"smooth"});else try{n.scrollTop=t.y,n.scrollLeft=t.x}catch{}}applyInput(t){const r=this.mirror.getNode(t.id);if(!r)return this.debugNodeNotFound(t,t.id);try{r.checked=t.isChecked,r.value=t.text}catch{}}legacy_resolveMissingNode(t,r,n,i){const{previousId:s,nextId:a}=i,u=s&&t[s],c=a&&t[a];if(u){const{node:o,mutation:l}=u;r.insertBefore(o,n),delete t[l.node.id],delete this.legacy_missingNodeRetryMap[l.node.id],(l.previousId||l.nextId)&&this.legacy_resolveMissingNode(t,r,o,l)}if(c){const{node:o,mutation:l}=c;r.insertBefore(o,n.nextSibling),delete t[l.node.id],delete this.legacy_missingNodeRetryMap[l.node.id],(l.previousId||l.nextId)&&this.legacy_resolveMissingNode(t,r,o,l)}}moveAndHover(t,r,n,i,s){const a=this.mirror.getNode(n);if(!a)return this.debugNodeNotFound(s,n);const u=ft(a,this.iframe),c=t*u.absoluteScale+u.x,o=r*u.absoluteScale+u.y;this.mouse.style.left=`${c}px`,this.mouse.style.top=`${o}px`,i||this.drawMouseTail({x:c,y:o}),this.hoverElements(a)}drawMouseTail(t){if(!this.mouseTail)return;const{lineCap:r,lineWidth:n,strokeStyle:i,duration:s}=this.config.mouseTail===!0?ke:Object.assign({},ke,this.config.mouseTail),a=()=>{if(!this.mouseTail)return;const u=this.mouseTail.getContext("2d");!u||!this.tailPositions.length||(u.clearRect(0,0,this.mouseTail.width,this.mouseTail.height),u.beginPath(),u.lineWidth=n,u.lineCap=r,u.strokeStyle=i,u.moveTo(this.tailPositions[0].x,this.tailPositions[0].y),this.tailPositions.forEach(c=>u.lineTo(c.x,c.y)),u.stroke())};this.tailPositions.push(t),a(),setTimeout(()=>{this.tailPositions=this.tailPositions.filter(u=>u!==t),a()},s/this.speedService.state.context.timer.speed)}hoverElements(t){var r;(r=this.iframe.contentDocument)==null||r.querySelectorAll(".\\:hover").forEach(i=>{i.classList.remove(":hover")});let n=t;for(;n;)n.classList&&n.classList.add(":hover"),n=n.parentElement}isUserInteraction(t){return t.type!==S.IncrementalSnapshot?!1:t.data.source>I.Mutation&&t.data.source<=I.Input}backToNormal(){this.nextUserInteractionEvent=null,!this.speedService.state.matches("normal")&&(this.speedService.send({type:"BACK_TO_NORMAL"}),this.emitter.emit(D.SkipEnd,{speed:this.speedService.state.context.normalSpeed}))}warnNodeNotFound(t,r){this.warn(`Node with id '${r}' not found. `,t)}warnCanvasMutationFailed(t,r){this.warn("Has error on canvas update",r,"canvas mutation:",t)}debugNodeNotFound(t,r){this.debug(Oe,`Node with id '${r}' not found. `,t)}warn(...t){!this.config.showWarning||console.warn(Oe,...t)}debug(...t){!this.config.showDebug||console.log(Oe,...t)}}var V=Uint8Array,Q=Uint16Array,Le=Uint32Array,St=new V([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Rt=new V([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Zr=new V([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),At=function(e,t){for(var r=new Q(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];for(var i=new Le(r[30]),n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return[r,i]},It=At(St,2),Ot=It[0],en=It[1];Ot[28]=258,en[258]=28;for(var tn=At(Rt,0),rn=tn[0],Fe=new Q(32768),x=0;x<32768;++x){var q=(x&43690)>>>1|(x&21845)<<1;q=(q&52428)>>>2|(q&13107)<<2,q=(q&61680)>>>4|(q&3855)<<4,Fe[x]=((q&65280)>>>8|(q&255)<<8)>>>1}for(var de=function(e,t,r){for(var n=e.length,i=0,s=new Q(t);i<n;++i)++s[e[i]-1];var a=new Q(t);for(i=0;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;var u;if(r){u=new Q(1<<t);var c=15-t;for(i=0;i<n;++i)if(e[i])for(var o=i<<4|e[i],l=t-e[i],d=a[e[i]-1]++<<l,m=d|(1<<l)-1;d<=m;++d)u[Fe[d]>>>c]=o}else for(u=new Q(n),i=0;i<n;++i)u[i]=Fe[a[e[i]-1]++]>>>15-e[i];return u},he=new V(288),x=0;x<144;++x)he[x]=8;for(var x=144;x<256;++x)he[x]=9;for(var x=256;x<280;++x)he[x]=7;for(var x=280;x<288;++x)he[x]=8;for(var kt=new V(32),x=0;x<32;++x)kt[x]=5;var nn=de(he,9,1),on=de(kt,5,1),Pe=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},G=function(e,t,r){var n=t/8>>0;return(e[n]|e[n+1]<<8)>>>(t&7)&r},Ue=function(e,t){var r=t/8>>0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>>(t&7)},sn=function(e){return(e/8>>0)+(e&7&&1)},_t=function(e,t,r){(t==null||t<0)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new(e instanceof Q?Q:e instanceof Le?Le:V)(r-t);return n.set(e.subarray(t,r)),n},an=function(e,t,r){var n=e.length,i=!t||r,s=!r||r.i;r||(r={}),t||(t=new V(n*3));var a=function(Pt){var Ut=t.length;if(Pt>Ut){var Bt=new V(Math.max(Ut*2,Pt));Bt.set(t),t=Bt}},u=r.f||0,c=r.p||0,o=r.b||0,l=r.l,d=r.d,m=r.m,f=r.n,y=n*8;do{if(!l){r.f=u=G(e,c,1);var v=G(e,c+1,3);if(c+=3,v)if(v==1)l=nn,d=on,m=9,f=5;else if(v==2){var N=G(e,c,31)+257,R=G(e,c+10,15)+4,F=N+G(e,c+5,31)+1;c+=14;for(var O=new V(F),M=new V(19),k=0;k<R;++k)M[Zr[k]]=G(e,c+k*3,7);c+=R*3;var $=Pe(M),me=(1<<$)-1;if(!s&&c+F*($+7)>y)break;for(var pe=de(M,$,1),k=0;k<F;){var J=pe[G(e,c,me)];c+=J&15;var E=J>>>4;if(E<16)O[k++]=E;else{var H=0,K=0;for(E==16?(K=3+G(e,c,3),c+=2,H=O[k-1]):E==17?(K=3+G(e,c,7),c+=3):E==18&&(K=11+G(e,c,127),c+=7);K--;)O[k++]=H}}var se=O.subarray(0,N),B=O.subarray(N);m=Pe(se),f=Pe(B),l=de(se,m,1),d=de(B,f,1)}else throw"invalid block type";else{var E=sn(c)+4,h=e[E-4]|e[E-3]<<8,T=E+h;if(T>n){if(s)throw"unexpected EOF";break}i&&a(o+h),t.set(e.subarray(E,T),o),r.b=o+=h,r.p=c=T*8;continue}if(c>y)throw"unexpected EOF"}i&&a(o+131072);for(var _=(1<<m)-1,te=(1<<f)-1,g=m+f+18;s||c+g<y;){var H=l[Ue(e,c)&_],p=H>>>4;if(c+=H&15,c>y)throw"unexpected EOF";if(!H)throw"invalid length/literal";if(p<256)t[o++]=p;else if(p==256){l=null;break}else{var b=p-254;if(p>264){var k=p-257,C=St[k];b=G(e,c,(1<<C)-1)+Ot[k],c+=C}var P=d[Ue(e,c)&te],Z=P>>>4;if(!P)throw"invalid distance";c+=P&15;var B=rn[Z];if(Z>3){var C=Rt[Z];B+=Ue(e,c)&(1<<C)-1,c+=C}if(c>y)throw"unexpected EOF";i&&a(o+131072);for(var Ft=o+b;o<Ft;o+=4)t[o]=t[o-B],t[o+1]=t[o+1-B],t[o+2]=t[o+2-B],t[o+3]=t[o+3-B];o=Ft}}r.l=l,r.p=c,r.b=o,l&&(u=1,r.m=m,r.d=d,r.n=f)}while(!u);return o==t.length?t:_t(t,0,o)},cn=function(e){if((e[0]&15)!=8||e[0]>>>4>7||(e[0]<<8|e[1])%31)throw"invalid zlib data";if(e[1]&32)throw"invalid zlib data: preset dictionaries not supported"};function ln(e,t){return an((cn(e),e.subarray(2,-4)),t)}function un(e,t){var r=e.length;if(!t&&typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var n=new V(e.length+(e.length>>>1)),i=0,s=function(o){n[i++]=o},a=0;a<r;++a){if(i+5>n.length){var u=new V(i+8+(r-a<<1));u.set(n),n=u}var c=e.charCodeAt(a);c<128||t?s(c):c<2048?(s(192|c>>>6),s(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|e.charCodeAt(++a)&1023,s(240|c>>>18),s(128|c>>>12&63),s(128|c>>>6&63),s(128|c&63)):(s(224|c>>>12),s(128|c>>>6&63),s(128|c&63))}return _t(n,0,i)}function dn(e,t){var r="";if(!t&&typeof TextDecoder<"u")return new TextDecoder().decode(e);for(var n=0;n<e.length;){var i=e[n++];i<128||t?r+=String.fromCharCode(i):i<224?r+=String.fromCharCode((i&31)<<6|e[n++]&63):i<240?r+=String.fromCharCode((i&15)<<12|(e[n++]&63)<<6|e[n++]&63):(i=((i&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,r+=String.fromCharCode(55296|i>>10,56320|i&1023))}return r}const Lt="v1",hn=e=>{if(typeof e!="string")return e;try{const t=JSON.parse(e);if(t.timestamp)return t}catch{}try{const t=JSON.parse(dn(ln(un(e,!0))));if(t.v===Lt)return t;throw new Error(`These events were packed with packer ${t.v} which is incompatible with current packer ${Lt}.`)}catch(t){throw console.error(t),new Error("Unknown data format.")}};return fe.Replayer=Kr,fe.unpack=hn,Object.defineProperty(fe,"__esModule",{value:!0}),fe}({});
|