@highlight-run/rrweb 2.0.0-lambda.2 → 2.0.0-lambda.4
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/assets/image-bitmap-data-url-worker-DwtK8A0z.js.map +1 -1
- package/dist/rrweb.cjs +311 -112
- package/dist/rrweb.cjs.map +1 -1
- package/dist/rrweb.d.cts +40 -40
- package/dist/rrweb.d.ts +40 -40
- package/dist/rrweb.js +311 -112
- package/dist/rrweb.js.map +1 -1
- package/dist/rrweb.umd.cjs +325 -114
- package/dist/rrweb.umd.cjs.map +4 -4
- package/dist/rrweb.umd.min.cjs +40 -28
- package/dist/rrweb.umd.min.cjs.map +4 -4
- package/package.json +5 -5
package/dist/rrweb.umd.cjs
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
(function (g, f) {
|
|
1
|
+
(function (g, f) {
|
|
2
|
+
if ("object" == typeof exports && "object" == typeof module) {
|
|
3
|
+
module.exports = f();
|
|
4
|
+
} else if ("function" == typeof define && define.amd) {
|
|
5
|
+
define("rrweb", [], f);
|
|
6
|
+
} else if ("object" == typeof exports) {
|
|
7
|
+
exports["rrweb"] = f();
|
|
8
|
+
} else {
|
|
9
|
+
g["rrweb"] = f();
|
|
10
|
+
}
|
|
11
|
+
}(this, () => {
|
|
12
|
+
var exports = {};
|
|
13
|
+
var module = { exports };
|
|
2
14
|
"use strict";
|
|
3
15
|
var __defProp = Object.defineProperty;
|
|
4
16
|
var __defProps = Object.defineProperties;
|
|
@@ -48,6 +60,53 @@ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
|
|
|
48
60
|
NodeType2[NodeType2["Comment"] = 5] = "Comment";
|
|
49
61
|
return NodeType2;
|
|
50
62
|
})(NodeType$3 || {});
|
|
63
|
+
const pendingImageLoads$2 = /* @__PURE__ */ new Map();
|
|
64
|
+
const wrappedContexts$2 = /* @__PURE__ */ new WeakSet();
|
|
65
|
+
function isHTMLImageElement$2(img) {
|
|
66
|
+
return img !== null && typeof img === "object" && "complete" in img && "naturalWidth" in img && "naturalHeight" in img && "src" in img && "onload" in img;
|
|
67
|
+
}
|
|
68
|
+
function wrapCanvasContextDrawImage$2(ctx) {
|
|
69
|
+
if (wrappedContexts$2.has(ctx)) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
wrappedContexts$2.add(ctx);
|
|
73
|
+
const originalDrawImage = ctx.drawImage.bind(ctx);
|
|
74
|
+
ctx.drawImage = function(image, ...args) {
|
|
75
|
+
const pending = pendingImageLoads$2.get(ctx);
|
|
76
|
+
if (pending) {
|
|
77
|
+
pending.cancelled = true;
|
|
78
|
+
}
|
|
79
|
+
const drawImageWithArgs = () => {
|
|
80
|
+
if (args.length === 2 && isHTMLImageElement$2(image)) {
|
|
81
|
+
args.push(image.naturalWidth || image.width, image.naturalHeight || image.height);
|
|
82
|
+
}
|
|
83
|
+
originalDrawImage(image, ...args);
|
|
84
|
+
};
|
|
85
|
+
if (isHTMLImageElement$2(image) && !image.complete) {
|
|
86
|
+
const loadState = { cancelled: false };
|
|
87
|
+
pendingImageLoads$2.set(ctx, loadState);
|
|
88
|
+
const onLoad = () => {
|
|
89
|
+
if (!loadState.cancelled) {
|
|
90
|
+
pendingImageLoads$2.delete(ctx);
|
|
91
|
+
drawImageWithArgs();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
const onError = () => {
|
|
95
|
+
if (!loadState.cancelled) {
|
|
96
|
+
pendingImageLoads$2.delete(ctx);
|
|
97
|
+
try {
|
|
98
|
+
drawImageWithArgs();
|
|
99
|
+
} catch (e2) {
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
image.onload = onLoad;
|
|
104
|
+
image.onerror = onError;
|
|
105
|
+
} else {
|
|
106
|
+
drawImageWithArgs();
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
51
110
|
const testableAccessors$1 = {
|
|
52
111
|
Node: ["childNodes", "parentNode", "parentElement", "textContent"],
|
|
53
112
|
ShadowRoot: ["host", "styleSheets"],
|
|
@@ -215,7 +274,8 @@ const index$1 = {
|
|
|
215
274
|
querySelector: querySelector$1,
|
|
216
275
|
querySelectorAll: querySelectorAll$1,
|
|
217
276
|
mutationObserver: mutationObserverCtor$1,
|
|
218
|
-
patch: patch$1
|
|
277
|
+
patch: patch$1,
|
|
278
|
+
wrapCanvasContextDrawImage: wrapCanvasContextDrawImage$2
|
|
219
279
|
};
|
|
220
280
|
function isElement(n2) {
|
|
221
281
|
return n2.nodeType === n2.ELEMENT_NODE;
|
|
@@ -2271,7 +2331,7 @@ let Node$4$1 = class Node2 {
|
|
|
2271
2331
|
let index2 = this.parent.index(this);
|
|
2272
2332
|
return this.parent.nodes[index2 + 1];
|
|
2273
2333
|
}
|
|
2274
|
-
positionBy(opts) {
|
|
2334
|
+
positionBy(opts = {}) {
|
|
2275
2335
|
let pos = this.source.start;
|
|
2276
2336
|
if (opts.index) {
|
|
2277
2337
|
pos = this.positionInside(opts.index);
|
|
@@ -2300,27 +2360,38 @@ let Node$4$1 = class Node2 {
|
|
|
2300
2360
|
column += 1;
|
|
2301
2361
|
}
|
|
2302
2362
|
}
|
|
2303
|
-
return { column, line };
|
|
2363
|
+
return { column, line, offset: end };
|
|
2304
2364
|
}
|
|
2305
2365
|
prev() {
|
|
2306
2366
|
if (!this.parent) return void 0;
|
|
2307
2367
|
let index2 = this.parent.index(this);
|
|
2308
2368
|
return this.parent.nodes[index2 - 1];
|
|
2309
2369
|
}
|
|
2310
|
-
rangeBy(opts) {
|
|
2370
|
+
rangeBy(opts = {}) {
|
|
2371
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2311
2372
|
let start = {
|
|
2312
2373
|
column: this.source.start.column,
|
|
2313
|
-
line: this.source.start.line
|
|
2374
|
+
line: this.source.start.line,
|
|
2375
|
+
offset: sourceOffset$1(inputString, this.source.start)
|
|
2314
2376
|
};
|
|
2315
2377
|
let end = this.source.end ? {
|
|
2316
2378
|
column: this.source.end.column + 1,
|
|
2317
|
-
line: this.source.end.line
|
|
2379
|
+
line: this.source.end.line,
|
|
2380
|
+
offset: typeof this.source.end.offset === "number" ? (
|
|
2381
|
+
// `source.end.offset` is exclusive, so we don't need to add 1
|
|
2382
|
+
this.source.end.offset
|
|
2383
|
+
) : (
|
|
2384
|
+
// Since line/column in this.source.end is inclusive,
|
|
2385
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
2386
|
+
// So, we add 1 to convert it to exclusive.
|
|
2387
|
+
sourceOffset$1(inputString, this.source.end) + 1
|
|
2388
|
+
)
|
|
2318
2389
|
} : {
|
|
2319
2390
|
column: start.column + 1,
|
|
2320
|
-
line: start.line
|
|
2391
|
+
line: start.line,
|
|
2392
|
+
offset: start.offset + 1
|
|
2321
2393
|
};
|
|
2322
2394
|
if (opts.word) {
|
|
2323
|
-
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
2324
2395
|
let stringRepresentation = inputString.slice(
|
|
2325
2396
|
sourceOffset$1(inputString, this.source.start),
|
|
2326
2397
|
sourceOffset$1(inputString, this.source.end)
|
|
@@ -2328,15 +2399,14 @@ let Node$4$1 = class Node2 {
|
|
|
2328
2399
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
2329
2400
|
if (index2 !== -1) {
|
|
2330
2401
|
start = this.positionInside(index2);
|
|
2331
|
-
end = this.positionInside(
|
|
2332
|
-
index2 + opts.word.length
|
|
2333
|
-
);
|
|
2402
|
+
end = this.positionInside(index2 + opts.word.length);
|
|
2334
2403
|
}
|
|
2335
2404
|
} else {
|
|
2336
2405
|
if (opts.start) {
|
|
2337
2406
|
start = {
|
|
2338
2407
|
column: opts.start.column,
|
|
2339
|
-
line: opts.start.line
|
|
2408
|
+
line: opts.start.line,
|
|
2409
|
+
offset: sourceOffset$1(inputString, opts.start)
|
|
2340
2410
|
};
|
|
2341
2411
|
} else if (opts.index) {
|
|
2342
2412
|
start = this.positionInside(opts.index);
|
|
@@ -2344,7 +2414,8 @@ let Node$4$1 = class Node2 {
|
|
|
2344
2414
|
if (opts.end) {
|
|
2345
2415
|
end = {
|
|
2346
2416
|
column: opts.end.column,
|
|
2347
|
-
line: opts.end.line
|
|
2417
|
+
line: opts.end.line,
|
|
2418
|
+
offset: sourceOffset$1(inputString, opts.end)
|
|
2348
2419
|
};
|
|
2349
2420
|
} else if (typeof opts.endIndex === "number") {
|
|
2350
2421
|
end = this.positionInside(opts.endIndex);
|
|
@@ -2353,7 +2424,11 @@ let Node$4$1 = class Node2 {
|
|
|
2353
2424
|
}
|
|
2354
2425
|
}
|
|
2355
2426
|
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
2356
|
-
end = {
|
|
2427
|
+
end = {
|
|
2428
|
+
column: start.column + 1,
|
|
2429
|
+
line: start.line,
|
|
2430
|
+
offset: start.offset + 1
|
|
2431
|
+
};
|
|
2357
2432
|
}
|
|
2358
2433
|
return { end, start };
|
|
2359
2434
|
}
|
|
@@ -2417,6 +2492,7 @@ let Node$4$1 = class Node2 {
|
|
|
2417
2492
|
} else if (typeof value === "object" && value.toJSON) {
|
|
2418
2493
|
fixed[name] = value.toJSON(null, inputs);
|
|
2419
2494
|
} else if (name === "source") {
|
|
2495
|
+
if (value == null) continue;
|
|
2420
2496
|
let inputId = inputs.get(value.input);
|
|
2421
2497
|
if (inputId == null) {
|
|
2422
2498
|
inputId = inputsNextIndex;
|
|
@@ -2451,7 +2527,7 @@ let Node$4$1 = class Node2 {
|
|
|
2451
2527
|
});
|
|
2452
2528
|
return result2;
|
|
2453
2529
|
}
|
|
2454
|
-
warn(result2, text, opts) {
|
|
2530
|
+
warn(result2, text, opts = {}) {
|
|
2455
2531
|
let data = { node: this };
|
|
2456
2532
|
for (let i2 in opts) data[i2] = opts[i2];
|
|
2457
2533
|
return result2.warn(text, data);
|
|
@@ -3032,9 +3108,21 @@ let { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1$1 } = requi
|
|
|
3032
3108
|
let CssSyntaxError$1$1 = cssSyntaxError$1;
|
|
3033
3109
|
let PreviousMap$1$1 = previousMap$1;
|
|
3034
3110
|
let terminalHighlight$2 = require$$2$1;
|
|
3035
|
-
let
|
|
3111
|
+
let lineToIndexCache$1 = Symbol("lineToIndexCache");
|
|
3036
3112
|
let sourceMapAvailable$1$1 = Boolean(SourceMapConsumer$1$1 && SourceMapGenerator$1$1);
|
|
3037
3113
|
let pathAvailable$1$1 = Boolean(resolve$1$1 && isAbsolute$1);
|
|
3114
|
+
function getLineToIndex$1(input2) {
|
|
3115
|
+
if (input2[lineToIndexCache$1]) return input2[lineToIndexCache$1];
|
|
3116
|
+
let lines = input2.css.split("\n");
|
|
3117
|
+
let lineToIndex = new Array(lines.length);
|
|
3118
|
+
let prevIndex = 0;
|
|
3119
|
+
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
3120
|
+
lineToIndex[i2] = prevIndex;
|
|
3121
|
+
prevIndex += lines[i2].length + 1;
|
|
3122
|
+
}
|
|
3123
|
+
input2[lineToIndexCache$1] = lineToIndex;
|
|
3124
|
+
return lineToIndex;
|
|
3125
|
+
}
|
|
3038
3126
|
let Input$4$1 = class Input {
|
|
3039
3127
|
get from() {
|
|
3040
3128
|
return this.file || this.id;
|
|
@@ -3073,30 +3161,37 @@ let Input$4$1 = class Input {
|
|
|
3073
3161
|
if (this.map) this.map.file = this.from;
|
|
3074
3162
|
}
|
|
3075
3163
|
error(message, line, column, opts = {}) {
|
|
3076
|
-
let endColumn, endLine, result2;
|
|
3164
|
+
let endColumn, endLine, endOffset, offset, result2;
|
|
3077
3165
|
if (line && typeof line === "object") {
|
|
3078
3166
|
let start = line;
|
|
3079
3167
|
let end = column;
|
|
3080
3168
|
if (typeof start.offset === "number") {
|
|
3081
|
-
|
|
3169
|
+
offset = start.offset;
|
|
3170
|
+
let pos = this.fromOffset(offset);
|
|
3082
3171
|
line = pos.line;
|
|
3083
3172
|
column = pos.col;
|
|
3084
3173
|
} else {
|
|
3085
3174
|
line = start.line;
|
|
3086
3175
|
column = start.column;
|
|
3176
|
+
offset = this.fromLineAndColumn(line, column);
|
|
3087
3177
|
}
|
|
3088
3178
|
if (typeof end.offset === "number") {
|
|
3089
|
-
|
|
3179
|
+
endOffset = end.offset;
|
|
3180
|
+
let pos = this.fromOffset(endOffset);
|
|
3090
3181
|
endLine = pos.line;
|
|
3091
3182
|
endColumn = pos.col;
|
|
3092
3183
|
} else {
|
|
3093
3184
|
endLine = end.line;
|
|
3094
3185
|
endColumn = end.column;
|
|
3186
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
3095
3187
|
}
|
|
3096
3188
|
} else if (!column) {
|
|
3097
|
-
|
|
3189
|
+
offset = line;
|
|
3190
|
+
let pos = this.fromOffset(offset);
|
|
3098
3191
|
line = pos.line;
|
|
3099
3192
|
column = pos.col;
|
|
3193
|
+
} else {
|
|
3194
|
+
offset = this.fromLineAndColumn(line, column);
|
|
3100
3195
|
}
|
|
3101
3196
|
let origin = this.origin(line, column, endLine, endColumn);
|
|
3102
3197
|
if (origin) {
|
|
@@ -3118,7 +3213,7 @@ let Input$4$1 = class Input {
|
|
|
3118
3213
|
opts.plugin
|
|
3119
3214
|
);
|
|
3120
3215
|
}
|
|
3121
|
-
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
3216
|
+
result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
3122
3217
|
if (this.file) {
|
|
3123
3218
|
if (pathToFileURL$1$1) {
|
|
3124
3219
|
result2.input.url = pathToFileURL$1$1(this.file).toString();
|
|
@@ -3127,21 +3222,14 @@ let Input$4$1 = class Input {
|
|
|
3127
3222
|
}
|
|
3128
3223
|
return result2;
|
|
3129
3224
|
}
|
|
3225
|
+
fromLineAndColumn(line, column) {
|
|
3226
|
+
let lineToIndex = getLineToIndex$1(this);
|
|
3227
|
+
let index2 = lineToIndex[line - 1];
|
|
3228
|
+
return index2 + column - 1;
|
|
3229
|
+
}
|
|
3130
3230
|
fromOffset(offset) {
|
|
3131
|
-
let
|
|
3132
|
-
|
|
3133
|
-
let lines = this.css.split("\n");
|
|
3134
|
-
lineToIndex = new Array(lines.length);
|
|
3135
|
-
let prevIndex = 0;
|
|
3136
|
-
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
3137
|
-
lineToIndex[i2] = prevIndex;
|
|
3138
|
-
prevIndex += lines[i2].length + 1;
|
|
3139
|
-
}
|
|
3140
|
-
this[fromOffsetCache$1] = lineToIndex;
|
|
3141
|
-
} else {
|
|
3142
|
-
lineToIndex = this[fromOffsetCache$1];
|
|
3143
|
-
}
|
|
3144
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
3231
|
+
let lineToIndex = getLineToIndex$1(this);
|
|
3232
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
3145
3233
|
let min = 0;
|
|
3146
3234
|
if (offset >= lastLine) {
|
|
3147
3235
|
min = lineToIndex.length - 1;
|
|
@@ -4503,7 +4591,7 @@ let Result$3$1 = class Result {
|
|
|
4503
4591
|
this.messages = [];
|
|
4504
4592
|
this.root = root2;
|
|
4505
4593
|
this.opts = opts;
|
|
4506
|
-
this.css =
|
|
4594
|
+
this.css = "";
|
|
4507
4595
|
this.map = void 0;
|
|
4508
4596
|
}
|
|
4509
4597
|
toString() {
|
|
@@ -5115,7 +5203,7 @@ let NoWorkResult2$1 = noWorkResult$1;
|
|
|
5115
5203
|
let Root$1$1 = root$1;
|
|
5116
5204
|
let Processor$1$1 = class Processor {
|
|
5117
5205
|
constructor(plugins = []) {
|
|
5118
|
-
this.version = "8.5.
|
|
5206
|
+
this.version = "8.5.6";
|
|
5119
5207
|
this.plugins = this.normalize(plugins);
|
|
5120
5208
|
}
|
|
5121
5209
|
normalize(plugins) {
|
|
@@ -5483,13 +5571,12 @@ function buildNode(n2, options) {
|
|
|
5483
5571
|
const value = specialAttributes[name];
|
|
5484
5572
|
if (tagName === "canvas" && name === "rr_dataURL") {
|
|
5485
5573
|
const image = doc.createElement("img");
|
|
5486
|
-
image.onload = () => {
|
|
5487
|
-
const ctx = node2.getContext("2d");
|
|
5488
|
-
if (ctx) {
|
|
5489
|
-
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
5490
|
-
}
|
|
5491
|
-
};
|
|
5492
5574
|
image.src = value.toString();
|
|
5575
|
+
const ctx = node2.getContext("2d");
|
|
5576
|
+
if (ctx) {
|
|
5577
|
+
wrapCanvasContextDrawImage$2(ctx);
|
|
5578
|
+
ctx.drawImage(image, 0, 0);
|
|
5579
|
+
}
|
|
5493
5580
|
if (node2.RRNodeType)
|
|
5494
5581
|
node2.rr_dataURL = value.toString();
|
|
5495
5582
|
} else if (tagName === "img" && name === "rr_dataURL") {
|
|
@@ -6358,7 +6445,7 @@ let Node$4 = class Node3 {
|
|
|
6358
6445
|
let index2 = this.parent.index(this);
|
|
6359
6446
|
return this.parent.nodes[index2 + 1];
|
|
6360
6447
|
}
|
|
6361
|
-
positionBy(opts) {
|
|
6448
|
+
positionBy(opts = {}) {
|
|
6362
6449
|
let pos = this.source.start;
|
|
6363
6450
|
if (opts.index) {
|
|
6364
6451
|
pos = this.positionInside(opts.index);
|
|
@@ -6387,27 +6474,38 @@ let Node$4 = class Node3 {
|
|
|
6387
6474
|
column += 1;
|
|
6388
6475
|
}
|
|
6389
6476
|
}
|
|
6390
|
-
return { column, line };
|
|
6477
|
+
return { column, line, offset: end };
|
|
6391
6478
|
}
|
|
6392
6479
|
prev() {
|
|
6393
6480
|
if (!this.parent) return void 0;
|
|
6394
6481
|
let index2 = this.parent.index(this);
|
|
6395
6482
|
return this.parent.nodes[index2 - 1];
|
|
6396
6483
|
}
|
|
6397
|
-
rangeBy(opts) {
|
|
6484
|
+
rangeBy(opts = {}) {
|
|
6485
|
+
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
6398
6486
|
let start = {
|
|
6399
6487
|
column: this.source.start.column,
|
|
6400
|
-
line: this.source.start.line
|
|
6488
|
+
line: this.source.start.line,
|
|
6489
|
+
offset: sourceOffset(inputString, this.source.start)
|
|
6401
6490
|
};
|
|
6402
6491
|
let end = this.source.end ? {
|
|
6403
6492
|
column: this.source.end.column + 1,
|
|
6404
|
-
line: this.source.end.line
|
|
6493
|
+
line: this.source.end.line,
|
|
6494
|
+
offset: typeof this.source.end.offset === "number" ? (
|
|
6495
|
+
// `source.end.offset` is exclusive, so we don't need to add 1
|
|
6496
|
+
this.source.end.offset
|
|
6497
|
+
) : (
|
|
6498
|
+
// Since line/column in this.source.end is inclusive,
|
|
6499
|
+
// the `sourceOffset(... , this.source.end)` returns an inclusive offset.
|
|
6500
|
+
// So, we add 1 to convert it to exclusive.
|
|
6501
|
+
sourceOffset(inputString, this.source.end) + 1
|
|
6502
|
+
)
|
|
6405
6503
|
} : {
|
|
6406
6504
|
column: start.column + 1,
|
|
6407
|
-
line: start.line
|
|
6505
|
+
line: start.line,
|
|
6506
|
+
offset: start.offset + 1
|
|
6408
6507
|
};
|
|
6409
6508
|
if (opts.word) {
|
|
6410
|
-
let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
|
|
6411
6509
|
let stringRepresentation = inputString.slice(
|
|
6412
6510
|
sourceOffset(inputString, this.source.start),
|
|
6413
6511
|
sourceOffset(inputString, this.source.end)
|
|
@@ -6415,15 +6513,14 @@ let Node$4 = class Node3 {
|
|
|
6415
6513
|
let index2 = stringRepresentation.indexOf(opts.word);
|
|
6416
6514
|
if (index2 !== -1) {
|
|
6417
6515
|
start = this.positionInside(index2);
|
|
6418
|
-
end = this.positionInside(
|
|
6419
|
-
index2 + opts.word.length
|
|
6420
|
-
);
|
|
6516
|
+
end = this.positionInside(index2 + opts.word.length);
|
|
6421
6517
|
}
|
|
6422
6518
|
} else {
|
|
6423
6519
|
if (opts.start) {
|
|
6424
6520
|
start = {
|
|
6425
6521
|
column: opts.start.column,
|
|
6426
|
-
line: opts.start.line
|
|
6522
|
+
line: opts.start.line,
|
|
6523
|
+
offset: sourceOffset(inputString, opts.start)
|
|
6427
6524
|
};
|
|
6428
6525
|
} else if (opts.index) {
|
|
6429
6526
|
start = this.positionInside(opts.index);
|
|
@@ -6431,7 +6528,8 @@ let Node$4 = class Node3 {
|
|
|
6431
6528
|
if (opts.end) {
|
|
6432
6529
|
end = {
|
|
6433
6530
|
column: opts.end.column,
|
|
6434
|
-
line: opts.end.line
|
|
6531
|
+
line: opts.end.line,
|
|
6532
|
+
offset: sourceOffset(inputString, opts.end)
|
|
6435
6533
|
};
|
|
6436
6534
|
} else if (typeof opts.endIndex === "number") {
|
|
6437
6535
|
end = this.positionInside(opts.endIndex);
|
|
@@ -6440,7 +6538,11 @@ let Node$4 = class Node3 {
|
|
|
6440
6538
|
}
|
|
6441
6539
|
}
|
|
6442
6540
|
if (end.line < start.line || end.line === start.line && end.column <= start.column) {
|
|
6443
|
-
end = {
|
|
6541
|
+
end = {
|
|
6542
|
+
column: start.column + 1,
|
|
6543
|
+
line: start.line,
|
|
6544
|
+
offset: start.offset + 1
|
|
6545
|
+
};
|
|
6444
6546
|
}
|
|
6445
6547
|
return { end, start };
|
|
6446
6548
|
}
|
|
@@ -6504,6 +6606,7 @@ let Node$4 = class Node3 {
|
|
|
6504
6606
|
} else if (typeof value === "object" && value.toJSON) {
|
|
6505
6607
|
fixed[name] = value.toJSON(null, inputs);
|
|
6506
6608
|
} else if (name === "source") {
|
|
6609
|
+
if (value == null) continue;
|
|
6507
6610
|
let inputId = inputs.get(value.input);
|
|
6508
6611
|
if (inputId == null) {
|
|
6509
6612
|
inputId = inputsNextIndex;
|
|
@@ -6538,7 +6641,7 @@ let Node$4 = class Node3 {
|
|
|
6538
6641
|
});
|
|
6539
6642
|
return result2;
|
|
6540
6643
|
}
|
|
6541
|
-
warn(result2, text, opts) {
|
|
6644
|
+
warn(result2, text, opts = {}) {
|
|
6542
6645
|
let data = { node: this };
|
|
6543
6646
|
for (let i2 in opts) data[i2] = opts[i2];
|
|
6544
6647
|
return result2.warn(text, data);
|
|
@@ -7119,9 +7222,21 @@ let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
|
|
|
7119
7222
|
let CssSyntaxError$1 = cssSyntaxError;
|
|
7120
7223
|
let PreviousMap$1 = previousMap;
|
|
7121
7224
|
let terminalHighlight = require$$2;
|
|
7122
|
-
let
|
|
7225
|
+
let lineToIndexCache = Symbol("lineToIndexCache");
|
|
7123
7226
|
let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
|
|
7124
7227
|
let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
|
|
7228
|
+
function getLineToIndex(input2) {
|
|
7229
|
+
if (input2[lineToIndexCache]) return input2[lineToIndexCache];
|
|
7230
|
+
let lines = input2.css.split("\n");
|
|
7231
|
+
let lineToIndex = new Array(lines.length);
|
|
7232
|
+
let prevIndex = 0;
|
|
7233
|
+
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
7234
|
+
lineToIndex[i2] = prevIndex;
|
|
7235
|
+
prevIndex += lines[i2].length + 1;
|
|
7236
|
+
}
|
|
7237
|
+
input2[lineToIndexCache] = lineToIndex;
|
|
7238
|
+
return lineToIndex;
|
|
7239
|
+
}
|
|
7125
7240
|
let Input$4 = class Input2 {
|
|
7126
7241
|
get from() {
|
|
7127
7242
|
return this.file || this.id;
|
|
@@ -7160,30 +7275,37 @@ let Input$4 = class Input2 {
|
|
|
7160
7275
|
if (this.map) this.map.file = this.from;
|
|
7161
7276
|
}
|
|
7162
7277
|
error(message, line, column, opts = {}) {
|
|
7163
|
-
let endColumn, endLine, result2;
|
|
7278
|
+
let endColumn, endLine, endOffset, offset, result2;
|
|
7164
7279
|
if (line && typeof line === "object") {
|
|
7165
7280
|
let start = line;
|
|
7166
7281
|
let end = column;
|
|
7167
7282
|
if (typeof start.offset === "number") {
|
|
7168
|
-
|
|
7283
|
+
offset = start.offset;
|
|
7284
|
+
let pos = this.fromOffset(offset);
|
|
7169
7285
|
line = pos.line;
|
|
7170
7286
|
column = pos.col;
|
|
7171
7287
|
} else {
|
|
7172
7288
|
line = start.line;
|
|
7173
7289
|
column = start.column;
|
|
7290
|
+
offset = this.fromLineAndColumn(line, column);
|
|
7174
7291
|
}
|
|
7175
7292
|
if (typeof end.offset === "number") {
|
|
7176
|
-
|
|
7293
|
+
endOffset = end.offset;
|
|
7294
|
+
let pos = this.fromOffset(endOffset);
|
|
7177
7295
|
endLine = pos.line;
|
|
7178
7296
|
endColumn = pos.col;
|
|
7179
7297
|
} else {
|
|
7180
7298
|
endLine = end.line;
|
|
7181
7299
|
endColumn = end.column;
|
|
7300
|
+
endOffset = this.fromLineAndColumn(end.line, end.column);
|
|
7182
7301
|
}
|
|
7183
7302
|
} else if (!column) {
|
|
7184
|
-
|
|
7303
|
+
offset = line;
|
|
7304
|
+
let pos = this.fromOffset(offset);
|
|
7185
7305
|
line = pos.line;
|
|
7186
7306
|
column = pos.col;
|
|
7307
|
+
} else {
|
|
7308
|
+
offset = this.fromLineAndColumn(line, column);
|
|
7187
7309
|
}
|
|
7188
7310
|
let origin = this.origin(line, column, endLine, endColumn);
|
|
7189
7311
|
if (origin) {
|
|
@@ -7205,7 +7327,7 @@ let Input$4 = class Input2 {
|
|
|
7205
7327
|
opts.plugin
|
|
7206
7328
|
);
|
|
7207
7329
|
}
|
|
7208
|
-
result2.input = { column, endColumn, endLine, line, source: this.css };
|
|
7330
|
+
result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
|
|
7209
7331
|
if (this.file) {
|
|
7210
7332
|
if (pathToFileURL$1) {
|
|
7211
7333
|
result2.input.url = pathToFileURL$1(this.file).toString();
|
|
@@ -7214,21 +7336,14 @@ let Input$4 = class Input2 {
|
|
|
7214
7336
|
}
|
|
7215
7337
|
return result2;
|
|
7216
7338
|
}
|
|
7339
|
+
fromLineAndColumn(line, column) {
|
|
7340
|
+
let lineToIndex = getLineToIndex(this);
|
|
7341
|
+
let index2 = lineToIndex[line - 1];
|
|
7342
|
+
return index2 + column - 1;
|
|
7343
|
+
}
|
|
7217
7344
|
fromOffset(offset) {
|
|
7218
|
-
let
|
|
7219
|
-
|
|
7220
|
-
let lines = this.css.split("\n");
|
|
7221
|
-
lineToIndex = new Array(lines.length);
|
|
7222
|
-
let prevIndex = 0;
|
|
7223
|
-
for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
|
|
7224
|
-
lineToIndex[i2] = prevIndex;
|
|
7225
|
-
prevIndex += lines[i2].length + 1;
|
|
7226
|
-
}
|
|
7227
|
-
this[fromOffsetCache] = lineToIndex;
|
|
7228
|
-
} else {
|
|
7229
|
-
lineToIndex = this[fromOffsetCache];
|
|
7230
|
-
}
|
|
7231
|
-
lastLine = lineToIndex[lineToIndex.length - 1];
|
|
7345
|
+
let lineToIndex = getLineToIndex(this);
|
|
7346
|
+
let lastLine = lineToIndex[lineToIndex.length - 1];
|
|
7232
7347
|
let min = 0;
|
|
7233
7348
|
if (offset >= lastLine) {
|
|
7234
7349
|
min = lineToIndex.length - 1;
|
|
@@ -8590,7 +8705,7 @@ let Result$3 = class Result2 {
|
|
|
8590
8705
|
this.messages = [];
|
|
8591
8706
|
this.root = root2;
|
|
8592
8707
|
this.opts = opts;
|
|
8593
|
-
this.css =
|
|
8708
|
+
this.css = "";
|
|
8594
8709
|
this.map = void 0;
|
|
8595
8710
|
}
|
|
8596
8711
|
toString() {
|
|
@@ -9202,7 +9317,7 @@ let NoWorkResult22 = noWorkResult;
|
|
|
9202
9317
|
let Root$1 = root;
|
|
9203
9318
|
let Processor$1 = class Processor2 {
|
|
9204
9319
|
constructor(plugins = []) {
|
|
9205
|
-
this.version = "8.5.
|
|
9320
|
+
this.version = "8.5.6";
|
|
9206
9321
|
this.plugins = this.normalize(plugins);
|
|
9207
9322
|
}
|
|
9208
9323
|
normalize(plugins) {
|
|
@@ -9886,6 +10001,53 @@ var NodeType$2 = /* @__PURE__ */ ((NodeType2) => {
|
|
|
9886
10001
|
NodeType2[NodeType2["DOCUMENT_FRAGMENT_NODE"] = 11] = "DOCUMENT_FRAGMENT_NODE";
|
|
9887
10002
|
return NodeType2;
|
|
9888
10003
|
})(NodeType$2 || {});
|
|
10004
|
+
const pendingImageLoads$1 = /* @__PURE__ */ new Map();
|
|
10005
|
+
const wrappedContexts$1 = /* @__PURE__ */ new WeakSet();
|
|
10006
|
+
function isHTMLImageElement$1(img) {
|
|
10007
|
+
return img !== null && typeof img === "object" && "complete" in img && "naturalWidth" in img && "naturalHeight" in img && "src" in img && "onload" in img;
|
|
10008
|
+
}
|
|
10009
|
+
function wrapCanvasContextDrawImage$1(ctx) {
|
|
10010
|
+
if (wrappedContexts$1.has(ctx)) {
|
|
10011
|
+
return;
|
|
10012
|
+
}
|
|
10013
|
+
wrappedContexts$1.add(ctx);
|
|
10014
|
+
const originalDrawImage = ctx.drawImage.bind(ctx);
|
|
10015
|
+
ctx.drawImage = function(image, ...args) {
|
|
10016
|
+
const pending = pendingImageLoads$1.get(ctx);
|
|
10017
|
+
if (pending) {
|
|
10018
|
+
pending.cancelled = true;
|
|
10019
|
+
}
|
|
10020
|
+
const drawImageWithArgs = () => {
|
|
10021
|
+
if (args.length === 2 && isHTMLImageElement$1(image)) {
|
|
10022
|
+
args.push(image.naturalWidth || image.width, image.naturalHeight || image.height);
|
|
10023
|
+
}
|
|
10024
|
+
originalDrawImage(image, ...args);
|
|
10025
|
+
};
|
|
10026
|
+
if (isHTMLImageElement$1(image) && !image.complete) {
|
|
10027
|
+
const loadState = { cancelled: false };
|
|
10028
|
+
pendingImageLoads$1.set(ctx, loadState);
|
|
10029
|
+
const onLoad = () => {
|
|
10030
|
+
if (!loadState.cancelled) {
|
|
10031
|
+
pendingImageLoads$1.delete(ctx);
|
|
10032
|
+
drawImageWithArgs();
|
|
10033
|
+
}
|
|
10034
|
+
};
|
|
10035
|
+
const onError = () => {
|
|
10036
|
+
if (!loadState.cancelled) {
|
|
10037
|
+
pendingImageLoads$1.delete(ctx);
|
|
10038
|
+
try {
|
|
10039
|
+
drawImageWithArgs();
|
|
10040
|
+
} catch (e2) {
|
|
10041
|
+
}
|
|
10042
|
+
}
|
|
10043
|
+
};
|
|
10044
|
+
image.onload = onLoad;
|
|
10045
|
+
image.onerror = onError;
|
|
10046
|
+
} else {
|
|
10047
|
+
drawImageWithArgs();
|
|
10048
|
+
}
|
|
10049
|
+
};
|
|
10050
|
+
}
|
|
9889
10051
|
const NAMESPACES = {
|
|
9890
10052
|
svg: "http://www.w3.org/2000/svg",
|
|
9891
10053
|
"xlink:href": "http://www.w3.org/1999/xlink",
|
|
@@ -10039,13 +10201,12 @@ function diffAfterUpdatingChildren(oldTree, newTree, replayer) {
|
|
|
10039
10201
|
const rrCanvasElement = newTree;
|
|
10040
10202
|
if (rrCanvasElement.rr_dataURL !== null) {
|
|
10041
10203
|
const image = document.createElement("img");
|
|
10042
|
-
image.onload = () => {
|
|
10043
|
-
const ctx = oldElement.getContext("2d");
|
|
10044
|
-
if (ctx) {
|
|
10045
|
-
ctx.drawImage(image, 0, 0, image.width, image.height);
|
|
10046
|
-
}
|
|
10047
|
-
};
|
|
10048
10204
|
image.src = rrCanvasElement.rr_dataURL;
|
|
10205
|
+
const ctx = oldElement.getContext("2d");
|
|
10206
|
+
if (ctx) {
|
|
10207
|
+
wrapCanvasContextDrawImage$1(ctx);
|
|
10208
|
+
ctx.drawImage(image, 0, 0);
|
|
10209
|
+
}
|
|
10049
10210
|
}
|
|
10050
10211
|
rrCanvasElement.canvasMutations.forEach(
|
|
10051
10212
|
(canvasMutation2) => replayer.applyCanvas(
|
|
@@ -10110,12 +10271,11 @@ function diffProps(oldTree, newTree, rrnodeMirror) {
|
|
|
10110
10271
|
else if (newTree.tagName === "CANVAS" && name === "rr_dataURL") {
|
|
10111
10272
|
const image = document.createElement("img");
|
|
10112
10273
|
image.src = newValue;
|
|
10113
|
-
|
|
10114
|
-
|
|
10115
|
-
|
|
10116
|
-
|
|
10117
|
-
|
|
10118
|
-
};
|
|
10274
|
+
const ctx = oldTree.getContext("2d");
|
|
10275
|
+
if (ctx) {
|
|
10276
|
+
wrapCanvasContextDrawImage$1(ctx);
|
|
10277
|
+
ctx.drawImage(image, 0, 0);
|
|
10278
|
+
}
|
|
10119
10279
|
} else if (newTree.tagName === "IFRAME" && name === "srcdoc") continue;
|
|
10120
10280
|
else {
|
|
10121
10281
|
try {
|
|
@@ -10626,6 +10786,53 @@ function getDefaultSN(node2, id) {
|
|
|
10626
10786
|
};
|
|
10627
10787
|
}
|
|
10628
10788
|
}
|
|
10789
|
+
const pendingImageLoads = /* @__PURE__ */ new Map();
|
|
10790
|
+
const wrappedContexts = /* @__PURE__ */ new WeakSet();
|
|
10791
|
+
function isHTMLImageElement(img) {
|
|
10792
|
+
return img !== null && typeof img === "object" && "complete" in img && "naturalWidth" in img && "naturalHeight" in img && "src" in img && "onload" in img;
|
|
10793
|
+
}
|
|
10794
|
+
function wrapCanvasContextDrawImage(ctx) {
|
|
10795
|
+
if (wrappedContexts.has(ctx)) {
|
|
10796
|
+
return;
|
|
10797
|
+
}
|
|
10798
|
+
wrappedContexts.add(ctx);
|
|
10799
|
+
const originalDrawImage = ctx.drawImage.bind(ctx);
|
|
10800
|
+
ctx.drawImage = function(image, ...args) {
|
|
10801
|
+
const pending = pendingImageLoads.get(ctx);
|
|
10802
|
+
if (pending) {
|
|
10803
|
+
pending.cancelled = true;
|
|
10804
|
+
}
|
|
10805
|
+
const drawImageWithArgs = () => {
|
|
10806
|
+
if (args.length === 2 && isHTMLImageElement(image)) {
|
|
10807
|
+
args.push(image.naturalWidth || image.width, image.naturalHeight || image.height);
|
|
10808
|
+
}
|
|
10809
|
+
originalDrawImage(image, ...args);
|
|
10810
|
+
};
|
|
10811
|
+
if (isHTMLImageElement(image) && !image.complete) {
|
|
10812
|
+
const loadState = { cancelled: false };
|
|
10813
|
+
pendingImageLoads.set(ctx, loadState);
|
|
10814
|
+
const onLoad = () => {
|
|
10815
|
+
if (!loadState.cancelled) {
|
|
10816
|
+
pendingImageLoads.delete(ctx);
|
|
10817
|
+
drawImageWithArgs();
|
|
10818
|
+
}
|
|
10819
|
+
};
|
|
10820
|
+
const onError = () => {
|
|
10821
|
+
if (!loadState.cancelled) {
|
|
10822
|
+
pendingImageLoads.delete(ctx);
|
|
10823
|
+
try {
|
|
10824
|
+
drawImageWithArgs();
|
|
10825
|
+
} catch (e2) {
|
|
10826
|
+
}
|
|
10827
|
+
}
|
|
10828
|
+
};
|
|
10829
|
+
image.onload = onLoad;
|
|
10830
|
+
image.onerror = onError;
|
|
10831
|
+
} else {
|
|
10832
|
+
drawImageWithArgs();
|
|
10833
|
+
}
|
|
10834
|
+
};
|
|
10835
|
+
}
|
|
10629
10836
|
const testableAccessors = {
|
|
10630
10837
|
Node: ["childNodes", "parentNode", "parentElement", "textContent"],
|
|
10631
10838
|
ShadowRoot: ["host", "styleSheets"],
|
|
@@ -10793,7 +11000,8 @@ const index = {
|
|
|
10793
11000
|
querySelector,
|
|
10794
11001
|
querySelectorAll,
|
|
10795
11002
|
mutationObserver: mutationObserverCtor,
|
|
10796
|
-
patch
|
|
11003
|
+
patch,
|
|
11004
|
+
wrapCanvasContextDrawImage
|
|
10797
11005
|
};
|
|
10798
11006
|
function on(type, fn, target = document) {
|
|
10799
11007
|
const options = { capture: true };
|
|
@@ -15011,8 +15219,12 @@ class Timer {
|
|
|
15011
15219
|
this.actions = this.actions.concat(actions);
|
|
15012
15220
|
}
|
|
15013
15221
|
replaceActions(actions) {
|
|
15222
|
+
const rafWasActive = this.raf === true;
|
|
15014
15223
|
this.actions.length = 0;
|
|
15015
|
-
this.actions
|
|
15224
|
+
this.actions = [...actions];
|
|
15225
|
+
if (rafWasActive) {
|
|
15226
|
+
this.raf = requestAnimationFrame(this.rafCheck.bind(this));
|
|
15227
|
+
}
|
|
15016
15228
|
}
|
|
15017
15229
|
/* End Highlight Code */
|
|
15018
15230
|
start() {
|
|
@@ -15379,28 +15591,26 @@ function createPlayerService(context, { getCastFn, applyEventsSynchronously, emi
|
|
|
15379
15591
|
}),
|
|
15380
15592
|
/* Highlight Code Start */
|
|
15381
15593
|
replaceEvents: o((ctx, machineEvent) => {
|
|
15594
|
+
if (machineEvent.type !== "REPLACE_EVENTS") return ctx;
|
|
15382
15595
|
const { events: curEvents, timer, baselineTime } = ctx;
|
|
15383
|
-
|
|
15384
|
-
|
|
15385
|
-
|
|
15386
|
-
|
|
15387
|
-
|
|
15388
|
-
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15396
|
-
delay: event.delay
|
|
15397
|
-
});
|
|
15398
|
-
}
|
|
15399
|
-
}
|
|
15400
|
-
if (timer.isActive()) {
|
|
15401
|
-
timer.replaceActions(actions);
|
|
15596
|
+
const { events: newEvents } = machineEvent.payload;
|
|
15597
|
+
if (newEvents.length === 0) return ctx;
|
|
15598
|
+
curEvents.length = 0;
|
|
15599
|
+
const actions = [];
|
|
15600
|
+
const timeThreshold = timer.timeOffset + baselineTime;
|
|
15601
|
+
for (const event of newEvents) {
|
|
15602
|
+
addDelay(event, baselineTime);
|
|
15603
|
+
curEvents.push(event);
|
|
15604
|
+
if (event.timestamp >= timeThreshold) {
|
|
15605
|
+
actions.push({
|
|
15606
|
+
doAction: getCastFn(event, false),
|
|
15607
|
+
delay: event.delay
|
|
15608
|
+
});
|
|
15402
15609
|
}
|
|
15403
15610
|
}
|
|
15611
|
+
if (timer.isActive()) {
|
|
15612
|
+
timer.replaceActions(actions);
|
|
15613
|
+
}
|
|
15404
15614
|
return __spreadProps(__spreadValues({}, ctx), { events: curEvents });
|
|
15405
15615
|
}),
|
|
15406
15616
|
/* Highlight Code End */
|
|
@@ -15632,6 +15842,7 @@ async function canvasMutation$1({
|
|
|
15632
15842
|
errorHandler2(mutations[0], new Error("Canvas context is null"));
|
|
15633
15843
|
return;
|
|
15634
15844
|
}
|
|
15845
|
+
wrapCanvasContextDrawImage(ctx);
|
|
15635
15846
|
const mutationArgsPromises = mutations.map(
|
|
15636
15847
|
async (mutation) => {
|
|
15637
15848
|
return Promise.all(mutation.args.map(deserializeArg(imageMap, ctx)));
|
|
@@ -17790,7 +18001,7 @@ exports.freezePage = freezePage;
|
|
|
17790
18001
|
exports.record = record;
|
|
17791
18002
|
exports.takeFullSnapshot = takeFullSnapshot;
|
|
17792
18003
|
exports.utils = utils;
|
|
17793
|
-
|
|
18004
|
+
if (typeof module.exports == "object" && typeof exports == "object") {
|
|
17794
18005
|
var __cp = (to, from, except, desc) => {
|
|
17795
18006
|
if ((from && typeof from === "object") || typeof from === "function") {
|
|
17796
18007
|
for (let key of Object.getOwnPropertyNames(from)) {
|