@posthog/rrweb-snapshot 0.0.34 → 0.0.36

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.
@@ -1,16 +1,4 @@
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("rrwebSnapshotReplay", [], f);
6
- } else if ("object" == typeof exports) {
7
- exports["rrwebSnapshotReplay"] = f();
8
- } else {
9
- g["rrwebSnapshotReplay"] = f();
10
- }
11
- }(this, () => {
12
- var exports = {};
13
- var module = { exports };
1
+ (function (g, f) {if ("object" == typeof exports && "object" == typeof module) {module.exports = f();} else if ("function" == typeof define && define.amd) {define("rrwebSnapshotReplay", [], f);} else if ("object" == typeof exports) {exports["rrwebSnapshotReplay"] = f();} else {g["rrwebSnapshotReplay"] = f();}}(typeof self !== 'undefined' ? self : typeof globalThis !== 'undefined' ? globalThis : this, () => {var exports = {};var module = { exports };
14
2
  "use strict";
15
3
  var __defProp = Object.defineProperty;
16
4
  var __defProps = Object.defineProperties;
@@ -629,7 +617,7 @@ function getDefaultExportFromCjs(x) {
629
617
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
630
618
  }
631
619
  function getAugmentedNamespace(n) {
632
- if (n.__esModule) return n;
620
+ if (Object.prototype.hasOwnProperty.call(n, "__esModule")) return n;
633
621
  var f = n.default;
634
622
  if (typeof f == "function") {
635
623
  var a = function a2() {
@@ -1148,6 +1136,9 @@ function requireNode() {
1148
1136
  return offset;
1149
1137
  }
1150
1138
  class Node {
1139
+ get proxyOf() {
1140
+ return this;
1141
+ }
1151
1142
  constructor(defaults = {}) {
1152
1143
  this.raws = {};
1153
1144
  this[isClean] = false;
@@ -1266,7 +1257,7 @@ function requireNode() {
1266
1257
  let index = this.parent.index(this);
1267
1258
  return this.parent.nodes[index + 1];
1268
1259
  }
1269
- positionBy(opts) {
1260
+ positionBy(opts = {}) {
1270
1261
  let pos = this.source.start;
1271
1262
  if (opts.index) {
1272
1263
  pos = this.positionInside(opts.index);
@@ -1295,27 +1286,38 @@ function requireNode() {
1295
1286
  column += 1;
1296
1287
  }
1297
1288
  }
1298
- return { column, line };
1289
+ return { column, line, offset: end };
1299
1290
  }
1300
1291
  prev() {
1301
1292
  if (!this.parent) return void 0;
1302
1293
  let index = this.parent.index(this);
1303
1294
  return this.parent.nodes[index - 1];
1304
1295
  }
1305
- rangeBy(opts) {
1296
+ rangeBy(opts = {}) {
1297
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
1306
1298
  let start = {
1307
1299
  column: this.source.start.column,
1308
- line: this.source.start.line
1300
+ line: this.source.start.line,
1301
+ offset: sourceOffset(inputString, this.source.start)
1309
1302
  };
1310
1303
  let end = this.source.end ? {
1311
1304
  column: this.source.end.column + 1,
1312
- line: this.source.end.line
1305
+ line: this.source.end.line,
1306
+ offset: typeof this.source.end.offset === "number" ? (
1307
+ // `source.end.offset` is exclusive, so we don't need to add 1
1308
+ this.source.end.offset
1309
+ ) : (
1310
+ // Since line/column in this.source.end is inclusive,
1311
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
1312
+ // So, we add 1 to convert it to exclusive.
1313
+ sourceOffset(inputString, this.source.end) + 1
1314
+ )
1313
1315
  } : {
1314
1316
  column: start.column + 1,
1315
- line: start.line
1317
+ line: start.line,
1318
+ offset: start.offset + 1
1316
1319
  };
1317
1320
  if (opts.word) {
1318
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
1319
1321
  let stringRepresentation = inputString.slice(
1320
1322
  sourceOffset(inputString, this.source.start),
1321
1323
  sourceOffset(inputString, this.source.end)
@@ -1323,15 +1325,14 @@ function requireNode() {
1323
1325
  let index = stringRepresentation.indexOf(opts.word);
1324
1326
  if (index !== -1) {
1325
1327
  start = this.positionInside(index);
1326
- end = this.positionInside(
1327
- index + opts.word.length
1328
- );
1328
+ end = this.positionInside(index + opts.word.length);
1329
1329
  }
1330
1330
  } else {
1331
1331
  if (opts.start) {
1332
1332
  start = {
1333
1333
  column: opts.start.column,
1334
- line: opts.start.line
1334
+ line: opts.start.line,
1335
+ offset: sourceOffset(inputString, opts.start)
1335
1336
  };
1336
1337
  } else if (opts.index) {
1337
1338
  start = this.positionInside(opts.index);
@@ -1339,7 +1340,8 @@ function requireNode() {
1339
1340
  if (opts.end) {
1340
1341
  end = {
1341
1342
  column: opts.end.column,
1342
- line: opts.end.line
1343
+ line: opts.end.line,
1344
+ offset: sourceOffset(inputString, opts.end)
1343
1345
  };
1344
1346
  } else if (typeof opts.endIndex === "number") {
1345
1347
  end = this.positionInside(opts.endIndex);
@@ -1348,7 +1350,11 @@ function requireNode() {
1348
1350
  }
1349
1351
  }
1350
1352
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
1351
- end = { column: start.column + 1, line: start.line };
1353
+ end = {
1354
+ column: start.column + 1,
1355
+ line: start.line,
1356
+ offset: start.offset + 1
1357
+ };
1352
1358
  }
1353
1359
  return { end, start };
1354
1360
  }
@@ -1412,6 +1418,7 @@ function requireNode() {
1412
1418
  } else if (typeof value === "object" && value.toJSON) {
1413
1419
  fixed[name] = value.toJSON(null, inputs);
1414
1420
  } else if (name === "source") {
1421
+ if (value == null) continue;
1415
1422
  let inputId = inputs.get(value.input);
1416
1423
  if (inputId == null) {
1417
1424
  inputId = inputsNextIndex;
@@ -1446,14 +1453,11 @@ function requireNode() {
1446
1453
  });
1447
1454
  return result2;
1448
1455
  }
1449
- warn(result2, text, opts) {
1456
+ warn(result2, text, opts = {}) {
1450
1457
  let data = { node: this };
1451
1458
  for (let i in opts) data[i] = opts[i];
1452
1459
  return result2.warn(text, data);
1453
1460
  }
1454
- get proxyOf() {
1455
- return this;
1456
- }
1457
1461
  }
1458
1462
  node = Node;
1459
1463
  Node.default = Node;
@@ -1482,6 +1486,9 @@ function requireDeclaration() {
1482
1486
  hasRequiredDeclaration = 1;
1483
1487
  let Node = requireNode();
1484
1488
  class Declaration extends Node {
1489
+ get variable() {
1490
+ return this.prop.startsWith("--") || this.prop[0] === "$";
1491
+ }
1485
1492
  constructor(defaults) {
1486
1493
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
1487
1494
  defaults = __spreadProps(__spreadValues({}, defaults), { value: String(defaults.value) });
@@ -1489,9 +1496,6 @@ function requireDeclaration() {
1489
1496
  super(defaults);
1490
1497
  this.type = "decl";
1491
1498
  }
1492
- get variable() {
1493
- return this.prop.startsWith("--") || this.prop[0] === "$";
1494
- }
1495
1499
  }
1496
1500
  declaration = Declaration;
1497
1501
  Declaration.default = Declaration;
@@ -1523,6 +1527,14 @@ function requireContainer() {
1523
1527
  }
1524
1528
  }
1525
1529
  class Container extends Node {
1530
+ get first() {
1531
+ if (!this.proxyOf.nodes) return void 0;
1532
+ return this.proxyOf.nodes[0];
1533
+ }
1534
+ get last() {
1535
+ if (!this.proxyOf.nodes) return void 0;
1536
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
1537
+ }
1526
1538
  append(...children) {
1527
1539
  for (let child of children) {
1528
1540
  let nodes = this.normalize(child, this.last);
@@ -1835,14 +1847,6 @@ function requireContainer() {
1835
1847
  }
1836
1848
  });
1837
1849
  }
1838
- get first() {
1839
- if (!this.proxyOf.nodes) return void 0;
1840
- return this.proxyOf.nodes[0];
1841
- }
1842
- get last() {
1843
- if (!this.proxyOf.nodes) return void 0;
1844
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
1845
- }
1846
1850
  }
1847
1851
  Container.registerParse = (dependant) => {
1848
1852
  parse = dependant;
@@ -2092,10 +2096,25 @@ function requireInput() {
2092
2096
  let CssSyntaxError = requireCssSyntaxError();
2093
2097
  let PreviousMap = requirePreviousMap();
2094
2098
  let terminalHighlight = require$$2;
2095
- let fromOffsetCache = Symbol("fromOffsetCache");
2099
+ let lineToIndexCache = Symbol("lineToIndexCache");
2096
2100
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2097
2101
  let pathAvailable = Boolean(resolve && isAbsolute);
2102
+ function getLineToIndex(input2) {
2103
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
2104
+ let lines = input2.css.split("\n");
2105
+ let lineToIndex = new Array(lines.length);
2106
+ let prevIndex = 0;
2107
+ for (let i = 0, l = lines.length; i < l; i++) {
2108
+ lineToIndex[i] = prevIndex;
2109
+ prevIndex += lines[i].length + 1;
2110
+ }
2111
+ input2[lineToIndexCache] = lineToIndex;
2112
+ return lineToIndex;
2113
+ }
2098
2114
  class Input {
2115
+ get from() {
2116
+ return this.file || this.id;
2117
+ }
2099
2118
  constructor(css, opts = {}) {
2100
2119
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
2101
2120
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -2130,30 +2149,37 @@ function requireInput() {
2130
2149
  if (this.map) this.map.file = this.from;
2131
2150
  }
2132
2151
  error(message, line, column, opts = {}) {
2133
- let endColumn, endLine, result2;
2152
+ let endColumn, endLine, endOffset, offset, result2;
2134
2153
  if (line && typeof line === "object") {
2135
2154
  let start = line;
2136
2155
  let end = column;
2137
2156
  if (typeof start.offset === "number") {
2138
- let pos = this.fromOffset(start.offset);
2157
+ offset = start.offset;
2158
+ let pos = this.fromOffset(offset);
2139
2159
  line = pos.line;
2140
2160
  column = pos.col;
2141
2161
  } else {
2142
2162
  line = start.line;
2143
2163
  column = start.column;
2164
+ offset = this.fromLineAndColumn(line, column);
2144
2165
  }
2145
2166
  if (typeof end.offset === "number") {
2146
- let pos = this.fromOffset(end.offset);
2167
+ endOffset = end.offset;
2168
+ let pos = this.fromOffset(endOffset);
2147
2169
  endLine = pos.line;
2148
2170
  endColumn = pos.col;
2149
2171
  } else {
2150
2172
  endLine = end.line;
2151
2173
  endColumn = end.column;
2174
+ endOffset = this.fromLineAndColumn(end.line, end.column);
2152
2175
  }
2153
2176
  } else if (!column) {
2154
- let pos = this.fromOffset(line);
2177
+ offset = line;
2178
+ let pos = this.fromOffset(offset);
2155
2179
  line = pos.line;
2156
2180
  column = pos.col;
2181
+ } else {
2182
+ offset = this.fromLineAndColumn(line, column);
2157
2183
  }
2158
2184
  let origin = this.origin(line, column, endLine, endColumn);
2159
2185
  if (origin) {
@@ -2175,7 +2201,7 @@ function requireInput() {
2175
2201
  opts.plugin
2176
2202
  );
2177
2203
  }
2178
- result2.input = { column, endColumn, endLine, line, source: this.css };
2204
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
2179
2205
  if (this.file) {
2180
2206
  if (pathToFileURL) {
2181
2207
  result2.input.url = pathToFileURL(this.file).toString();
@@ -2184,21 +2210,14 @@ function requireInput() {
2184
2210
  }
2185
2211
  return result2;
2186
2212
  }
2213
+ fromLineAndColumn(line, column) {
2214
+ let lineToIndex = getLineToIndex(this);
2215
+ let index = lineToIndex[line - 1];
2216
+ return index + column - 1;
2217
+ }
2187
2218
  fromOffset(offset) {
2188
- let lastLine, lineToIndex;
2189
- if (!this[fromOffsetCache]) {
2190
- let lines = this.css.split("\n");
2191
- lineToIndex = new Array(lines.length);
2192
- let prevIndex = 0;
2193
- for (let i = 0, l = lines.length; i < l; i++) {
2194
- lineToIndex[i] = prevIndex;
2195
- prevIndex += lines[i].length + 1;
2196
- }
2197
- this[fromOffsetCache] = lineToIndex;
2198
- } else {
2199
- lineToIndex = this[fromOffsetCache];
2200
- }
2201
- lastLine = lineToIndex[lineToIndex.length - 1];
2219
+ let lineToIndex = getLineToIndex(this);
2220
+ let lastLine = lineToIndex[lineToIndex.length - 1];
2202
2221
  let min = 0;
2203
2222
  if (offset >= lastLine) {
2204
2223
  min = lineToIndex.length - 1;
@@ -2279,9 +2298,6 @@ function requireInput() {
2279
2298
  }
2280
2299
  return json;
2281
2300
  }
2282
- get from() {
2283
- return this.file || this.id;
2284
- }
2285
2301
  }
2286
2302
  input = Input;
2287
2303
  Input.default = Input;
@@ -2407,11 +2423,6 @@ function requireRule() {
2407
2423
  let Container = requireContainer();
2408
2424
  let list = requireList();
2409
2425
  class Rule extends Container {
2410
- constructor(defaults) {
2411
- super(defaults);
2412
- this.type = "rule";
2413
- if (!this.nodes) this.nodes = [];
2414
- }
2415
2426
  get selectors() {
2416
2427
  return list.comma(this.selector);
2417
2428
  }
@@ -2420,6 +2431,11 @@ function requireRule() {
2420
2431
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
2421
2432
  this.selector = values.join(sep);
2422
2433
  }
2434
+ constructor(defaults) {
2435
+ super(defaults);
2436
+ this.type = "rule";
2437
+ if (!this.nodes) this.nodes = [];
2438
+ }
2423
2439
  }
2424
2440
  rule = Rule;
2425
2441
  Rule.default = Rule;
@@ -3318,6 +3334,8 @@ function requireParser() {
3318
3334
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
3319
3335
  prev.raws.ownSemicolon = this.spaces;
3320
3336
  this.spaces = "";
3337
+ prev.source.end = this.getPosition(token[2]);
3338
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
3321
3339
  }
3322
3340
  }
3323
3341
  }
@@ -3529,7 +3547,7 @@ function requireParser() {
3529
3547
  }
3530
3548
  unknownWord(tokens) {
3531
3549
  throw this.input.error(
3532
- "Unknown word",
3550
+ "Unknown word " + tokens[0][1],
3533
3551
  { offset: tokens[0][2] },
3534
3552
  { offset: tokens[0][2] + tokens[0][1].length }
3535
3553
  );
@@ -3622,12 +3640,15 @@ function requireResult() {
3622
3640
  hasRequiredResult = 1;
3623
3641
  let Warning = requireWarning();
3624
3642
  class Result {
3643
+ get content() {
3644
+ return this.css;
3645
+ }
3625
3646
  constructor(processor2, root2, opts) {
3626
3647
  this.processor = processor2;
3627
3648
  this.messages = [];
3628
3649
  this.root = root2;
3629
3650
  this.opts = opts;
3630
- this.css = void 0;
3651
+ this.css = "";
3631
3652
  this.map = void 0;
3632
3653
  }
3633
3654
  toString() {
@@ -3646,9 +3667,6 @@ function requireResult() {
3646
3667
  warnings() {
3647
3668
  return this.messages.filter((i) => i.type === "warning");
3648
3669
  }
3649
- get content() {
3650
- return this.css;
3651
- }
3652
3670
  }
3653
3671
  result = Result;
3654
3672
  Result.default = Result;
@@ -3767,6 +3785,30 @@ function requireLazyResult() {
3767
3785
  }
3768
3786
  let postcss2 = {};
3769
3787
  class LazyResult {
3788
+ get content() {
3789
+ return this.stringify().content;
3790
+ }
3791
+ get css() {
3792
+ return this.stringify().css;
3793
+ }
3794
+ get map() {
3795
+ return this.stringify().map;
3796
+ }
3797
+ get messages() {
3798
+ return this.sync().messages;
3799
+ }
3800
+ get opts() {
3801
+ return this.result.opts;
3802
+ }
3803
+ get processor() {
3804
+ return this.result.processor;
3805
+ }
3806
+ get root() {
3807
+ return this.sync().root;
3808
+ }
3809
+ get [Symbol.toStringTag]() {
3810
+ return "LazyResult";
3811
+ }
3770
3812
  constructor(processor2, css, opts) {
3771
3813
  this.stringified = false;
3772
3814
  this.processed = false;
@@ -4109,30 +4151,6 @@ function requireLazyResult() {
4109
4151
  warnings() {
4110
4152
  return this.sync().warnings();
4111
4153
  }
4112
- get content() {
4113
- return this.stringify().content;
4114
- }
4115
- get css() {
4116
- return this.stringify().css;
4117
- }
4118
- get map() {
4119
- return this.stringify().map;
4120
- }
4121
- get messages() {
4122
- return this.sync().messages;
4123
- }
4124
- get opts() {
4125
- return this.result.opts;
4126
- }
4127
- get processor() {
4128
- return this.result.processor;
4129
- }
4130
- get root() {
4131
- return this.sync().root;
4132
- }
4133
- get [Symbol.toStringTag]() {
4134
- return "LazyResult";
4135
- }
4136
4154
  }
4137
4155
  LazyResult.registerPostcss = (dependant) => {
4138
4156
  postcss2 = dependant;
@@ -4154,6 +4172,45 @@ function requireNoWorkResult() {
4154
4172
  let stringify = requireStringify();
4155
4173
  let warnOnce2 = requireWarnOnce();
4156
4174
  class NoWorkResult {
4175
+ get content() {
4176
+ return this.result.css;
4177
+ }
4178
+ get css() {
4179
+ return this.result.css;
4180
+ }
4181
+ get map() {
4182
+ return this.result.map;
4183
+ }
4184
+ get messages() {
4185
+ return [];
4186
+ }
4187
+ get opts() {
4188
+ return this.result.opts;
4189
+ }
4190
+ get processor() {
4191
+ return this.result.processor;
4192
+ }
4193
+ get root() {
4194
+ if (this._root) {
4195
+ return this._root;
4196
+ }
4197
+ let root2;
4198
+ let parser2 = parse;
4199
+ try {
4200
+ root2 = parser2(this._css, this._opts);
4201
+ } catch (error) {
4202
+ this.error = error;
4203
+ }
4204
+ if (this.error) {
4205
+ throw this.error;
4206
+ } else {
4207
+ this._root = root2;
4208
+ return root2;
4209
+ }
4210
+ }
4211
+ get [Symbol.toStringTag]() {
4212
+ return "NoWorkResult";
4213
+ }
4157
4214
  constructor(processor2, css, opts) {
4158
4215
  css = css.toString();
4159
4216
  this.stringified = false;
@@ -4215,45 +4272,6 @@ function requireNoWorkResult() {
4215
4272
  warnings() {
4216
4273
  return [];
4217
4274
  }
4218
- get content() {
4219
- return this.result.css;
4220
- }
4221
- get css() {
4222
- return this.result.css;
4223
- }
4224
- get map() {
4225
- return this.result.map;
4226
- }
4227
- get messages() {
4228
- return [];
4229
- }
4230
- get opts() {
4231
- return this.result.opts;
4232
- }
4233
- get processor() {
4234
- return this.result.processor;
4235
- }
4236
- get root() {
4237
- if (this._root) {
4238
- return this._root;
4239
- }
4240
- let root2;
4241
- let parser2 = parse;
4242
- try {
4243
- root2 = parser2(this._css, this._opts);
4244
- } catch (error) {
4245
- this.error = error;
4246
- }
4247
- if (this.error) {
4248
- throw this.error;
4249
- } else {
4250
- this._root = root2;
4251
- return root2;
4252
- }
4253
- }
4254
- get [Symbol.toStringTag]() {
4255
- return "NoWorkResult";
4256
- }
4257
4275
  }
4258
4276
  noWorkResult = NoWorkResult;
4259
4277
  NoWorkResult.default = NoWorkResult;
@@ -4270,7 +4288,7 @@ function requireProcessor() {
4270
4288
  let Root = requireRoot();
4271
4289
  class Processor {
4272
4290
  constructor(plugins = []) {
4273
- this.version = "8.5.1";
4291
+ this.version = "8.5.6";
4274
4292
  this.plugins = this.normalize(plugins);
4275
4293
  }
4276
4294
  normalize(plugins) {
@@ -4948,7 +4966,7 @@ exports.adaptCssForReplay = adaptCssForReplay;
4948
4966
  exports.buildNodeWithSN = buildNodeWithSN;
4949
4967
  exports.createCache = createCache;
4950
4968
  exports.rebuild = rebuild;
4951
- if (typeof module.exports == "object" && typeof exports == "object") {
4969
+ ;if (typeof module.exports == "object" && typeof exports == "object") {
4952
4970
  var __cp = (to, from, except, desc) => {
4953
4971
  if ((from && typeof from === "object") || typeof from === "function") {
4954
4972
  for (let key of Object.getOwnPropertyNames(from)) {