@posthog/rrweb-player 0.0.33 → 0.0.35

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.
@@ -539,7 +539,7 @@ function getDefaultExportFromCjs$1(x) {
539
539
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
540
540
  }
541
541
  function getAugmentedNamespace$1(n2) {
542
- if (n2.__esModule) return n2;
542
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
543
543
  var f2 = n2.default;
544
544
  if (typeof f2 == "function") {
545
545
  var a2 = function a3() {
@@ -1058,6 +1058,9 @@ function requireNode$1() {
1058
1058
  return offset;
1059
1059
  }
1060
1060
  class Node2 {
1061
+ get proxyOf() {
1062
+ return this;
1063
+ }
1061
1064
  constructor(defaults = {}) {
1062
1065
  this.raws = {};
1063
1066
  this[isClean] = false;
@@ -1176,7 +1179,7 @@ function requireNode$1() {
1176
1179
  let index2 = this.parent.index(this);
1177
1180
  return this.parent.nodes[index2 + 1];
1178
1181
  }
1179
- positionBy(opts) {
1182
+ positionBy(opts = {}) {
1180
1183
  let pos = this.source.start;
1181
1184
  if (opts.index) {
1182
1185
  pos = this.positionInside(opts.index);
@@ -1205,27 +1208,38 @@ function requireNode$1() {
1205
1208
  column += 1;
1206
1209
  }
1207
1210
  }
1208
- return { column, line };
1211
+ return { column, line, offset: end };
1209
1212
  }
1210
1213
  prev() {
1211
1214
  if (!this.parent) return void 0;
1212
1215
  let index2 = this.parent.index(this);
1213
1216
  return this.parent.nodes[index2 - 1];
1214
1217
  }
1215
- rangeBy(opts) {
1218
+ rangeBy(opts = {}) {
1219
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
1216
1220
  let start = {
1217
1221
  column: this.source.start.column,
1218
- line: this.source.start.line
1222
+ line: this.source.start.line,
1223
+ offset: sourceOffset(inputString, this.source.start)
1219
1224
  };
1220
1225
  let end = this.source.end ? {
1221
1226
  column: this.source.end.column + 1,
1222
- line: this.source.end.line
1227
+ line: this.source.end.line,
1228
+ offset: typeof this.source.end.offset === "number" ? (
1229
+ // `source.end.offset` is exclusive, so we don't need to add 1
1230
+ this.source.end.offset
1231
+ ) : (
1232
+ // Since line/column in this.source.end is inclusive,
1233
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
1234
+ // So, we add 1 to convert it to exclusive.
1235
+ sourceOffset(inputString, this.source.end) + 1
1236
+ )
1223
1237
  } : {
1224
1238
  column: start.column + 1,
1225
- line: start.line
1239
+ line: start.line,
1240
+ offset: start.offset + 1
1226
1241
  };
1227
1242
  if (opts.word) {
1228
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
1229
1243
  let stringRepresentation = inputString.slice(
1230
1244
  sourceOffset(inputString, this.source.start),
1231
1245
  sourceOffset(inputString, this.source.end)
@@ -1233,15 +1247,14 @@ function requireNode$1() {
1233
1247
  let index2 = stringRepresentation.indexOf(opts.word);
1234
1248
  if (index2 !== -1) {
1235
1249
  start = this.positionInside(index2);
1236
- end = this.positionInside(
1237
- index2 + opts.word.length
1238
- );
1250
+ end = this.positionInside(index2 + opts.word.length);
1239
1251
  }
1240
1252
  } else {
1241
1253
  if (opts.start) {
1242
1254
  start = {
1243
1255
  column: opts.start.column,
1244
- line: opts.start.line
1256
+ line: opts.start.line,
1257
+ offset: sourceOffset(inputString, opts.start)
1245
1258
  };
1246
1259
  } else if (opts.index) {
1247
1260
  start = this.positionInside(opts.index);
@@ -1249,7 +1262,8 @@ function requireNode$1() {
1249
1262
  if (opts.end) {
1250
1263
  end = {
1251
1264
  column: opts.end.column,
1252
- line: opts.end.line
1265
+ line: opts.end.line,
1266
+ offset: sourceOffset(inputString, opts.end)
1253
1267
  };
1254
1268
  } else if (typeof opts.endIndex === "number") {
1255
1269
  end = this.positionInside(opts.endIndex);
@@ -1258,7 +1272,11 @@ function requireNode$1() {
1258
1272
  }
1259
1273
  }
1260
1274
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
1261
- end = { column: start.column + 1, line: start.line };
1275
+ end = {
1276
+ column: start.column + 1,
1277
+ line: start.line,
1278
+ offset: start.offset + 1
1279
+ };
1262
1280
  }
1263
1281
  return { end, start };
1264
1282
  }
@@ -1322,6 +1340,7 @@ function requireNode$1() {
1322
1340
  } else if (typeof value === "object" && value.toJSON) {
1323
1341
  fixed[name] = value.toJSON(null, inputs);
1324
1342
  } else if (name === "source") {
1343
+ if (value == null) continue;
1325
1344
  let inputId = inputs.get(value.input);
1326
1345
  if (inputId == null) {
1327
1346
  inputId = inputsNextIndex;
@@ -1356,14 +1375,11 @@ function requireNode$1() {
1356
1375
  });
1357
1376
  return result2;
1358
1377
  }
1359
- warn(result2, text2, opts) {
1378
+ warn(result2, text2, opts = {}) {
1360
1379
  let data = { node: this };
1361
1380
  for (let i2 in opts) data[i2] = opts[i2];
1362
1381
  return result2.warn(text2, data);
1363
1382
  }
1364
- get proxyOf() {
1365
- return this;
1366
- }
1367
1383
  }
1368
1384
  node$1 = Node2;
1369
1385
  Node2.default = Node2;
@@ -1392,6 +1408,9 @@ function requireDeclaration$1() {
1392
1408
  hasRequiredDeclaration$1 = 1;
1393
1409
  let Node2 = requireNode$1();
1394
1410
  class Declaration extends Node2 {
1411
+ get variable() {
1412
+ return this.prop.startsWith("--") || this.prop[0] === "$";
1413
+ }
1395
1414
  constructor(defaults) {
1396
1415
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
1397
1416
  defaults = { ...defaults, value: String(defaults.value) };
@@ -1399,9 +1418,6 @@ function requireDeclaration$1() {
1399
1418
  super(defaults);
1400
1419
  this.type = "decl";
1401
1420
  }
1402
- get variable() {
1403
- return this.prop.startsWith("--") || this.prop[0] === "$";
1404
- }
1405
1421
  }
1406
1422
  declaration$1 = Declaration;
1407
1423
  Declaration.default = Declaration;
@@ -1433,6 +1449,14 @@ function requireContainer$1() {
1433
1449
  }
1434
1450
  }
1435
1451
  class Container extends Node2 {
1452
+ get first() {
1453
+ if (!this.proxyOf.nodes) return void 0;
1454
+ return this.proxyOf.nodes[0];
1455
+ }
1456
+ get last() {
1457
+ if (!this.proxyOf.nodes) return void 0;
1458
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
1459
+ }
1436
1460
  append(...children2) {
1437
1461
  for (let child of children2) {
1438
1462
  let nodes = this.normalize(child, this.last);
@@ -1745,14 +1769,6 @@ function requireContainer$1() {
1745
1769
  }
1746
1770
  });
1747
1771
  }
1748
- get first() {
1749
- if (!this.proxyOf.nodes) return void 0;
1750
- return this.proxyOf.nodes[0];
1751
- }
1752
- get last() {
1753
- if (!this.proxyOf.nodes) return void 0;
1754
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
1755
- }
1756
1772
  }
1757
1773
  Container.registerParse = (dependant) => {
1758
1774
  parse = dependant;
@@ -2002,10 +2018,25 @@ function requireInput$1() {
2002
2018
  let CssSyntaxError = requireCssSyntaxError$1();
2003
2019
  let PreviousMap = requirePreviousMap$1();
2004
2020
  let terminalHighlight = require$$2$1;
2005
- let fromOffsetCache = Symbol("fromOffsetCache");
2021
+ let lineToIndexCache = Symbol("lineToIndexCache");
2006
2022
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2007
2023
  let pathAvailable = Boolean(resolve && isAbsolute);
2024
+ function getLineToIndex(input2) {
2025
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
2026
+ let lines = input2.css.split("\n");
2027
+ let lineToIndex = new Array(lines.length);
2028
+ let prevIndex = 0;
2029
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2030
+ lineToIndex[i2] = prevIndex;
2031
+ prevIndex += lines[i2].length + 1;
2032
+ }
2033
+ input2[lineToIndexCache] = lineToIndex;
2034
+ return lineToIndex;
2035
+ }
2008
2036
  class Input {
2037
+ get from() {
2038
+ return this.file || this.id;
2039
+ }
2009
2040
  constructor(css, opts = {}) {
2010
2041
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
2011
2042
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -2040,30 +2071,37 @@ function requireInput$1() {
2040
2071
  if (this.map) this.map.file = this.from;
2041
2072
  }
2042
2073
  error(message, line, column, opts = {}) {
2043
- let endColumn, endLine, result2;
2074
+ let endColumn, endLine, endOffset, offset, result2;
2044
2075
  if (line && typeof line === "object") {
2045
2076
  let start = line;
2046
2077
  let end = column;
2047
2078
  if (typeof start.offset === "number") {
2048
- let pos = this.fromOffset(start.offset);
2079
+ offset = start.offset;
2080
+ let pos = this.fromOffset(offset);
2049
2081
  line = pos.line;
2050
2082
  column = pos.col;
2051
2083
  } else {
2052
2084
  line = start.line;
2053
2085
  column = start.column;
2086
+ offset = this.fromLineAndColumn(line, column);
2054
2087
  }
2055
2088
  if (typeof end.offset === "number") {
2056
- let pos = this.fromOffset(end.offset);
2089
+ endOffset = end.offset;
2090
+ let pos = this.fromOffset(endOffset);
2057
2091
  endLine = pos.line;
2058
2092
  endColumn = pos.col;
2059
2093
  } else {
2060
2094
  endLine = end.line;
2061
2095
  endColumn = end.column;
2096
+ endOffset = this.fromLineAndColumn(end.line, end.column);
2062
2097
  }
2063
2098
  } else if (!column) {
2064
- let pos = this.fromOffset(line);
2099
+ offset = line;
2100
+ let pos = this.fromOffset(offset);
2065
2101
  line = pos.line;
2066
2102
  column = pos.col;
2103
+ } else {
2104
+ offset = this.fromLineAndColumn(line, column);
2067
2105
  }
2068
2106
  let origin = this.origin(line, column, endLine, endColumn);
2069
2107
  if (origin) {
@@ -2085,7 +2123,7 @@ function requireInput$1() {
2085
2123
  opts.plugin
2086
2124
  );
2087
2125
  }
2088
- result2.input = { column, endColumn, endLine, line, source: this.css };
2126
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
2089
2127
  if (this.file) {
2090
2128
  if (pathToFileURL) {
2091
2129
  result2.input.url = pathToFileURL(this.file).toString();
@@ -2094,21 +2132,14 @@ function requireInput$1() {
2094
2132
  }
2095
2133
  return result2;
2096
2134
  }
2135
+ fromLineAndColumn(line, column) {
2136
+ let lineToIndex = getLineToIndex(this);
2137
+ let index2 = lineToIndex[line - 1];
2138
+ return index2 + column - 1;
2139
+ }
2097
2140
  fromOffset(offset) {
2098
- let lastLine, lineToIndex;
2099
- if (!this[fromOffsetCache]) {
2100
- let lines = this.css.split("\n");
2101
- lineToIndex = new Array(lines.length);
2102
- let prevIndex = 0;
2103
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2104
- lineToIndex[i2] = prevIndex;
2105
- prevIndex += lines[i2].length + 1;
2106
- }
2107
- this[fromOffsetCache] = lineToIndex;
2108
- } else {
2109
- lineToIndex = this[fromOffsetCache];
2110
- }
2111
- lastLine = lineToIndex[lineToIndex.length - 1];
2141
+ let lineToIndex = getLineToIndex(this);
2142
+ let lastLine = lineToIndex[lineToIndex.length - 1];
2112
2143
  let min = 0;
2113
2144
  if (offset >= lastLine) {
2114
2145
  min = lineToIndex.length - 1;
@@ -2189,9 +2220,6 @@ function requireInput$1() {
2189
2220
  }
2190
2221
  return json;
2191
2222
  }
2192
- get from() {
2193
- return this.file || this.id;
2194
- }
2195
2223
  }
2196
2224
  input$1 = Input;
2197
2225
  Input.default = Input;
@@ -2317,11 +2345,6 @@ function requireRule$1() {
2317
2345
  let Container = requireContainer$1();
2318
2346
  let list = requireList$1();
2319
2347
  class Rule extends Container {
2320
- constructor(defaults) {
2321
- super(defaults);
2322
- this.type = "rule";
2323
- if (!this.nodes) this.nodes = [];
2324
- }
2325
2348
  get selectors() {
2326
2349
  return list.comma(this.selector);
2327
2350
  }
@@ -2330,6 +2353,11 @@ function requireRule$1() {
2330
2353
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
2331
2354
  this.selector = values.join(sep);
2332
2355
  }
2356
+ constructor(defaults) {
2357
+ super(defaults);
2358
+ this.type = "rule";
2359
+ if (!this.nodes) this.nodes = [];
2360
+ }
2333
2361
  }
2334
2362
  rule$1 = Rule;
2335
2363
  Rule.default = Rule;
@@ -3229,6 +3257,8 @@ function requireParser$1() {
3229
3257
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
3230
3258
  prev.raws.ownSemicolon = this.spaces;
3231
3259
  this.spaces = "";
3260
+ prev.source.end = this.getPosition(token[2]);
3261
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
3232
3262
  }
3233
3263
  }
3234
3264
  }
@@ -3440,7 +3470,7 @@ function requireParser$1() {
3440
3470
  }
3441
3471
  unknownWord(tokens) {
3442
3472
  throw this.input.error(
3443
- "Unknown word",
3473
+ "Unknown word " + tokens[0][1],
3444
3474
  { offset: tokens[0][2] },
3445
3475
  { offset: tokens[0][2] + tokens[0][1].length }
3446
3476
  );
@@ -3533,12 +3563,15 @@ function requireResult$1() {
3533
3563
  hasRequiredResult$1 = 1;
3534
3564
  let Warning = requireWarning$1();
3535
3565
  class Result {
3566
+ get content() {
3567
+ return this.css;
3568
+ }
3536
3569
  constructor(processor2, root2, opts) {
3537
3570
  this.processor = processor2;
3538
3571
  this.messages = [];
3539
3572
  this.root = root2;
3540
3573
  this.opts = opts;
3541
- this.css = void 0;
3574
+ this.css = "";
3542
3575
  this.map = void 0;
3543
3576
  }
3544
3577
  toString() {
@@ -3557,9 +3590,6 @@ function requireResult$1() {
3557
3590
  warnings() {
3558
3591
  return this.messages.filter((i2) => i2.type === "warning");
3559
3592
  }
3560
- get content() {
3561
- return this.css;
3562
- }
3563
3593
  }
3564
3594
  result$1 = Result;
3565
3595
  Result.default = Result;
@@ -3678,6 +3708,30 @@ function requireLazyResult$1() {
3678
3708
  }
3679
3709
  let postcss2 = {};
3680
3710
  class LazyResult {
3711
+ get content() {
3712
+ return this.stringify().content;
3713
+ }
3714
+ get css() {
3715
+ return this.stringify().css;
3716
+ }
3717
+ get map() {
3718
+ return this.stringify().map;
3719
+ }
3720
+ get messages() {
3721
+ return this.sync().messages;
3722
+ }
3723
+ get opts() {
3724
+ return this.result.opts;
3725
+ }
3726
+ get processor() {
3727
+ return this.result.processor;
3728
+ }
3729
+ get root() {
3730
+ return this.sync().root;
3731
+ }
3732
+ get [Symbol.toStringTag]() {
3733
+ return "LazyResult";
3734
+ }
3681
3735
  constructor(processor2, css, opts) {
3682
3736
  this.stringified = false;
3683
3737
  this.processed = false;
@@ -4020,30 +4074,6 @@ function requireLazyResult$1() {
4020
4074
  warnings() {
4021
4075
  return this.sync().warnings();
4022
4076
  }
4023
- get content() {
4024
- return this.stringify().content;
4025
- }
4026
- get css() {
4027
- return this.stringify().css;
4028
- }
4029
- get map() {
4030
- return this.stringify().map;
4031
- }
4032
- get messages() {
4033
- return this.sync().messages;
4034
- }
4035
- get opts() {
4036
- return this.result.opts;
4037
- }
4038
- get processor() {
4039
- return this.result.processor;
4040
- }
4041
- get root() {
4042
- return this.sync().root;
4043
- }
4044
- get [Symbol.toStringTag]() {
4045
- return "LazyResult";
4046
- }
4047
4077
  }
4048
4078
  LazyResult.registerPostcss = (dependant) => {
4049
4079
  postcss2 = dependant;
@@ -4065,6 +4095,45 @@ function requireNoWorkResult$1() {
4065
4095
  let stringify = requireStringify$1();
4066
4096
  let warnOnce2 = requireWarnOnce$1();
4067
4097
  class NoWorkResult {
4098
+ get content() {
4099
+ return this.result.css;
4100
+ }
4101
+ get css() {
4102
+ return this.result.css;
4103
+ }
4104
+ get map() {
4105
+ return this.result.map;
4106
+ }
4107
+ get messages() {
4108
+ return [];
4109
+ }
4110
+ get opts() {
4111
+ return this.result.opts;
4112
+ }
4113
+ get processor() {
4114
+ return this.result.processor;
4115
+ }
4116
+ get root() {
4117
+ if (this._root) {
4118
+ return this._root;
4119
+ }
4120
+ let root2;
4121
+ let parser2 = parse;
4122
+ try {
4123
+ root2 = parser2(this._css, this._opts);
4124
+ } catch (error) {
4125
+ this.error = error;
4126
+ }
4127
+ if (this.error) {
4128
+ throw this.error;
4129
+ } else {
4130
+ this._root = root2;
4131
+ return root2;
4132
+ }
4133
+ }
4134
+ get [Symbol.toStringTag]() {
4135
+ return "NoWorkResult";
4136
+ }
4068
4137
  constructor(processor2, css, opts) {
4069
4138
  css = css.toString();
4070
4139
  this.stringified = false;
@@ -4126,45 +4195,6 @@ function requireNoWorkResult$1() {
4126
4195
  warnings() {
4127
4196
  return [];
4128
4197
  }
4129
- get content() {
4130
- return this.result.css;
4131
- }
4132
- get css() {
4133
- return this.result.css;
4134
- }
4135
- get map() {
4136
- return this.result.map;
4137
- }
4138
- get messages() {
4139
- return [];
4140
- }
4141
- get opts() {
4142
- return this.result.opts;
4143
- }
4144
- get processor() {
4145
- return this.result.processor;
4146
- }
4147
- get root() {
4148
- if (this._root) {
4149
- return this._root;
4150
- }
4151
- let root2;
4152
- let parser2 = parse;
4153
- try {
4154
- root2 = parser2(this._css, this._opts);
4155
- } catch (error) {
4156
- this.error = error;
4157
- }
4158
- if (this.error) {
4159
- throw this.error;
4160
- } else {
4161
- this._root = root2;
4162
- return root2;
4163
- }
4164
- }
4165
- get [Symbol.toStringTag]() {
4166
- return "NoWorkResult";
4167
- }
4168
4198
  }
4169
4199
  noWorkResult$1 = NoWorkResult;
4170
4200
  NoWorkResult.default = NoWorkResult;
@@ -4181,7 +4211,7 @@ function requireProcessor$1() {
4181
4211
  let Root = requireRoot$1();
4182
4212
  class Processor {
4183
4213
  constructor(plugins = []) {
4184
- this.version = "8.5.1";
4214
+ this.version = "8.5.6";
4185
4215
  this.plugins = this.normalize(plugins);
4186
4216
  }
4187
4217
  normalize(plugins) {
@@ -4637,6 +4667,12 @@ function buildNode(n2, options) {
4637
4667
  node2.style.setProperty("width", value.toString());
4638
4668
  } else if (name === "rr_height") {
4639
4669
  node2.style.setProperty("height", value.toString());
4670
+ } else if (name === "rr_left") {
4671
+ node2.style.setProperty("left", value.toString());
4672
+ node2.style.setProperty("position", "absolute");
4673
+ } else if (name === "rr_top") {
4674
+ node2.style.setProperty("top", value.toString());
4675
+ node2.style.setProperty("position", "absolute");
4640
4676
  } else if (name === "rr_mediaCurrentTime" && typeof value === "number") {
4641
4677
  node2.currentTime = value;
4642
4678
  } else if (name === "rr_mediaState") {
@@ -4896,7 +4932,7 @@ function getDefaultExportFromCjs(x) {
4896
4932
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
4897
4933
  }
4898
4934
  function getAugmentedNamespace(n2) {
4899
- if (n2.__esModule) return n2;
4935
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
4900
4936
  var f2 = n2.default;
4901
4937
  if (typeof f2 == "function") {
4902
4938
  var a2 = function a3() {
@@ -5415,6 +5451,9 @@ function requireNode() {
5415
5451
  return offset;
5416
5452
  }
5417
5453
  class Node2 {
5454
+ get proxyOf() {
5455
+ return this;
5456
+ }
5418
5457
  constructor(defaults = {}) {
5419
5458
  this.raws = {};
5420
5459
  this[isClean] = false;
@@ -5533,7 +5572,7 @@ function requireNode() {
5533
5572
  let index2 = this.parent.index(this);
5534
5573
  return this.parent.nodes[index2 + 1];
5535
5574
  }
5536
- positionBy(opts) {
5575
+ positionBy(opts = {}) {
5537
5576
  let pos = this.source.start;
5538
5577
  if (opts.index) {
5539
5578
  pos = this.positionInside(opts.index);
@@ -5562,27 +5601,38 @@ function requireNode() {
5562
5601
  column += 1;
5563
5602
  }
5564
5603
  }
5565
- return { column, line };
5604
+ return { column, line, offset: end };
5566
5605
  }
5567
5606
  prev() {
5568
5607
  if (!this.parent) return void 0;
5569
5608
  let index2 = this.parent.index(this);
5570
5609
  return this.parent.nodes[index2 - 1];
5571
5610
  }
5572
- rangeBy(opts) {
5611
+ rangeBy(opts = {}) {
5612
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
5573
5613
  let start = {
5574
5614
  column: this.source.start.column,
5575
- line: this.source.start.line
5615
+ line: this.source.start.line,
5616
+ offset: sourceOffset(inputString, this.source.start)
5576
5617
  };
5577
5618
  let end = this.source.end ? {
5578
5619
  column: this.source.end.column + 1,
5579
- line: this.source.end.line
5620
+ line: this.source.end.line,
5621
+ offset: typeof this.source.end.offset === "number" ? (
5622
+ // `source.end.offset` is exclusive, so we don't need to add 1
5623
+ this.source.end.offset
5624
+ ) : (
5625
+ // Since line/column in this.source.end is inclusive,
5626
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
5627
+ // So, we add 1 to convert it to exclusive.
5628
+ sourceOffset(inputString, this.source.end) + 1
5629
+ )
5580
5630
  } : {
5581
5631
  column: start.column + 1,
5582
- line: start.line
5632
+ line: start.line,
5633
+ offset: start.offset + 1
5583
5634
  };
5584
5635
  if (opts.word) {
5585
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
5586
5636
  let stringRepresentation = inputString.slice(
5587
5637
  sourceOffset(inputString, this.source.start),
5588
5638
  sourceOffset(inputString, this.source.end)
@@ -5590,15 +5640,14 @@ function requireNode() {
5590
5640
  let index2 = stringRepresentation.indexOf(opts.word);
5591
5641
  if (index2 !== -1) {
5592
5642
  start = this.positionInside(index2);
5593
- end = this.positionInside(
5594
- index2 + opts.word.length
5595
- );
5643
+ end = this.positionInside(index2 + opts.word.length);
5596
5644
  }
5597
5645
  } else {
5598
5646
  if (opts.start) {
5599
5647
  start = {
5600
5648
  column: opts.start.column,
5601
- line: opts.start.line
5649
+ line: opts.start.line,
5650
+ offset: sourceOffset(inputString, opts.start)
5602
5651
  };
5603
5652
  } else if (opts.index) {
5604
5653
  start = this.positionInside(opts.index);
@@ -5606,7 +5655,8 @@ function requireNode() {
5606
5655
  if (opts.end) {
5607
5656
  end = {
5608
5657
  column: opts.end.column,
5609
- line: opts.end.line
5658
+ line: opts.end.line,
5659
+ offset: sourceOffset(inputString, opts.end)
5610
5660
  };
5611
5661
  } else if (typeof opts.endIndex === "number") {
5612
5662
  end = this.positionInside(opts.endIndex);
@@ -5615,7 +5665,11 @@ function requireNode() {
5615
5665
  }
5616
5666
  }
5617
5667
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
5618
- end = { column: start.column + 1, line: start.line };
5668
+ end = {
5669
+ column: start.column + 1,
5670
+ line: start.line,
5671
+ offset: start.offset + 1
5672
+ };
5619
5673
  }
5620
5674
  return { end, start };
5621
5675
  }
@@ -5679,6 +5733,7 @@ function requireNode() {
5679
5733
  } else if (typeof value === "object" && value.toJSON) {
5680
5734
  fixed[name] = value.toJSON(null, inputs);
5681
5735
  } else if (name === "source") {
5736
+ if (value == null) continue;
5682
5737
  let inputId = inputs.get(value.input);
5683
5738
  if (inputId == null) {
5684
5739
  inputId = inputsNextIndex;
@@ -5713,14 +5768,11 @@ function requireNode() {
5713
5768
  });
5714
5769
  return result2;
5715
5770
  }
5716
- warn(result2, text2, opts) {
5771
+ warn(result2, text2, opts = {}) {
5717
5772
  let data = { node: this };
5718
5773
  for (let i2 in opts) data[i2] = opts[i2];
5719
5774
  return result2.warn(text2, data);
5720
5775
  }
5721
- get proxyOf() {
5722
- return this;
5723
- }
5724
5776
  }
5725
5777
  node = Node2;
5726
5778
  Node2.default = Node2;
@@ -5749,6 +5801,9 @@ function requireDeclaration() {
5749
5801
  hasRequiredDeclaration = 1;
5750
5802
  let Node2 = requireNode();
5751
5803
  class Declaration extends Node2 {
5804
+ get variable() {
5805
+ return this.prop.startsWith("--") || this.prop[0] === "$";
5806
+ }
5752
5807
  constructor(defaults) {
5753
5808
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
5754
5809
  defaults = { ...defaults, value: String(defaults.value) };
@@ -5756,9 +5811,6 @@ function requireDeclaration() {
5756
5811
  super(defaults);
5757
5812
  this.type = "decl";
5758
5813
  }
5759
- get variable() {
5760
- return this.prop.startsWith("--") || this.prop[0] === "$";
5761
- }
5762
5814
  }
5763
5815
  declaration = Declaration;
5764
5816
  Declaration.default = Declaration;
@@ -5790,6 +5842,14 @@ function requireContainer() {
5790
5842
  }
5791
5843
  }
5792
5844
  class Container extends Node2 {
5845
+ get first() {
5846
+ if (!this.proxyOf.nodes) return void 0;
5847
+ return this.proxyOf.nodes[0];
5848
+ }
5849
+ get last() {
5850
+ if (!this.proxyOf.nodes) return void 0;
5851
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
5852
+ }
5793
5853
  append(...children2) {
5794
5854
  for (let child of children2) {
5795
5855
  let nodes = this.normalize(child, this.last);
@@ -6102,14 +6162,6 @@ function requireContainer() {
6102
6162
  }
6103
6163
  });
6104
6164
  }
6105
- get first() {
6106
- if (!this.proxyOf.nodes) return void 0;
6107
- return this.proxyOf.nodes[0];
6108
- }
6109
- get last() {
6110
- if (!this.proxyOf.nodes) return void 0;
6111
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6112
- }
6113
6165
  }
6114
6166
  Container.registerParse = (dependant) => {
6115
6167
  parse = dependant;
@@ -6359,10 +6411,25 @@ function requireInput() {
6359
6411
  let CssSyntaxError = requireCssSyntaxError();
6360
6412
  let PreviousMap = requirePreviousMap();
6361
6413
  let terminalHighlight = require$$2;
6362
- let fromOffsetCache = Symbol("fromOffsetCache");
6414
+ let lineToIndexCache = Symbol("lineToIndexCache");
6363
6415
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
6364
6416
  let pathAvailable = Boolean(resolve && isAbsolute);
6417
+ function getLineToIndex(input2) {
6418
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
6419
+ let lines = input2.css.split("\n");
6420
+ let lineToIndex = new Array(lines.length);
6421
+ let prevIndex = 0;
6422
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6423
+ lineToIndex[i2] = prevIndex;
6424
+ prevIndex += lines[i2].length + 1;
6425
+ }
6426
+ input2[lineToIndexCache] = lineToIndex;
6427
+ return lineToIndex;
6428
+ }
6365
6429
  class Input {
6430
+ get from() {
6431
+ return this.file || this.id;
6432
+ }
6366
6433
  constructor(css, opts = {}) {
6367
6434
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
6368
6435
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -6397,30 +6464,37 @@ function requireInput() {
6397
6464
  if (this.map) this.map.file = this.from;
6398
6465
  }
6399
6466
  error(message, line, column, opts = {}) {
6400
- let endColumn, endLine, result2;
6467
+ let endColumn, endLine, endOffset, offset, result2;
6401
6468
  if (line && typeof line === "object") {
6402
6469
  let start = line;
6403
6470
  let end = column;
6404
6471
  if (typeof start.offset === "number") {
6405
- let pos = this.fromOffset(start.offset);
6472
+ offset = start.offset;
6473
+ let pos = this.fromOffset(offset);
6406
6474
  line = pos.line;
6407
6475
  column = pos.col;
6408
6476
  } else {
6409
6477
  line = start.line;
6410
6478
  column = start.column;
6479
+ offset = this.fromLineAndColumn(line, column);
6411
6480
  }
6412
6481
  if (typeof end.offset === "number") {
6413
- let pos = this.fromOffset(end.offset);
6482
+ endOffset = end.offset;
6483
+ let pos = this.fromOffset(endOffset);
6414
6484
  endLine = pos.line;
6415
6485
  endColumn = pos.col;
6416
6486
  } else {
6417
6487
  endLine = end.line;
6418
6488
  endColumn = end.column;
6489
+ endOffset = this.fromLineAndColumn(end.line, end.column);
6419
6490
  }
6420
6491
  } else if (!column) {
6421
- let pos = this.fromOffset(line);
6492
+ offset = line;
6493
+ let pos = this.fromOffset(offset);
6422
6494
  line = pos.line;
6423
6495
  column = pos.col;
6496
+ } else {
6497
+ offset = this.fromLineAndColumn(line, column);
6424
6498
  }
6425
6499
  let origin = this.origin(line, column, endLine, endColumn);
6426
6500
  if (origin) {
@@ -6442,7 +6516,7 @@ function requireInput() {
6442
6516
  opts.plugin
6443
6517
  );
6444
6518
  }
6445
- result2.input = { column, endColumn, endLine, line, source: this.css };
6519
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
6446
6520
  if (this.file) {
6447
6521
  if (pathToFileURL) {
6448
6522
  result2.input.url = pathToFileURL(this.file).toString();
@@ -6451,21 +6525,14 @@ function requireInput() {
6451
6525
  }
6452
6526
  return result2;
6453
6527
  }
6528
+ fromLineAndColumn(line, column) {
6529
+ let lineToIndex = getLineToIndex(this);
6530
+ let index2 = lineToIndex[line - 1];
6531
+ return index2 + column - 1;
6532
+ }
6454
6533
  fromOffset(offset) {
6455
- let lastLine, lineToIndex;
6456
- if (!this[fromOffsetCache]) {
6457
- let lines = this.css.split("\n");
6458
- lineToIndex = new Array(lines.length);
6459
- let prevIndex = 0;
6460
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6461
- lineToIndex[i2] = prevIndex;
6462
- prevIndex += lines[i2].length + 1;
6463
- }
6464
- this[fromOffsetCache] = lineToIndex;
6465
- } else {
6466
- lineToIndex = this[fromOffsetCache];
6467
- }
6468
- lastLine = lineToIndex[lineToIndex.length - 1];
6534
+ let lineToIndex = getLineToIndex(this);
6535
+ let lastLine = lineToIndex[lineToIndex.length - 1];
6469
6536
  let min = 0;
6470
6537
  if (offset >= lastLine) {
6471
6538
  min = lineToIndex.length - 1;
@@ -6546,9 +6613,6 @@ function requireInput() {
6546
6613
  }
6547
6614
  return json;
6548
6615
  }
6549
- get from() {
6550
- return this.file || this.id;
6551
- }
6552
6616
  }
6553
6617
  input = Input;
6554
6618
  Input.default = Input;
@@ -6674,11 +6738,6 @@ function requireRule() {
6674
6738
  let Container = requireContainer();
6675
6739
  let list = requireList();
6676
6740
  class Rule extends Container {
6677
- constructor(defaults) {
6678
- super(defaults);
6679
- this.type = "rule";
6680
- if (!this.nodes) this.nodes = [];
6681
- }
6682
6741
  get selectors() {
6683
6742
  return list.comma(this.selector);
6684
6743
  }
@@ -6687,6 +6746,11 @@ function requireRule() {
6687
6746
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
6688
6747
  this.selector = values.join(sep);
6689
6748
  }
6749
+ constructor(defaults) {
6750
+ super(defaults);
6751
+ this.type = "rule";
6752
+ if (!this.nodes) this.nodes = [];
6753
+ }
6690
6754
  }
6691
6755
  rule = Rule;
6692
6756
  Rule.default = Rule;
@@ -7586,6 +7650,8 @@ function requireParser() {
7586
7650
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
7587
7651
  prev.raws.ownSemicolon = this.spaces;
7588
7652
  this.spaces = "";
7653
+ prev.source.end = this.getPosition(token[2]);
7654
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
7589
7655
  }
7590
7656
  }
7591
7657
  }
@@ -7797,7 +7863,7 @@ function requireParser() {
7797
7863
  }
7798
7864
  unknownWord(tokens) {
7799
7865
  throw this.input.error(
7800
- "Unknown word",
7866
+ "Unknown word " + tokens[0][1],
7801
7867
  { offset: tokens[0][2] },
7802
7868
  { offset: tokens[0][2] + tokens[0][1].length }
7803
7869
  );
@@ -7890,12 +7956,15 @@ function requireResult() {
7890
7956
  hasRequiredResult = 1;
7891
7957
  let Warning = requireWarning();
7892
7958
  class Result {
7959
+ get content() {
7960
+ return this.css;
7961
+ }
7893
7962
  constructor(processor2, root2, opts) {
7894
7963
  this.processor = processor2;
7895
7964
  this.messages = [];
7896
7965
  this.root = root2;
7897
7966
  this.opts = opts;
7898
- this.css = void 0;
7967
+ this.css = "";
7899
7968
  this.map = void 0;
7900
7969
  }
7901
7970
  toString() {
@@ -7914,9 +7983,6 @@ function requireResult() {
7914
7983
  warnings() {
7915
7984
  return this.messages.filter((i2) => i2.type === "warning");
7916
7985
  }
7917
- get content() {
7918
- return this.css;
7919
- }
7920
7986
  }
7921
7987
  result = Result;
7922
7988
  Result.default = Result;
@@ -8035,6 +8101,30 @@ function requireLazyResult() {
8035
8101
  }
8036
8102
  let postcss2 = {};
8037
8103
  class LazyResult {
8104
+ get content() {
8105
+ return this.stringify().content;
8106
+ }
8107
+ get css() {
8108
+ return this.stringify().css;
8109
+ }
8110
+ get map() {
8111
+ return this.stringify().map;
8112
+ }
8113
+ get messages() {
8114
+ return this.sync().messages;
8115
+ }
8116
+ get opts() {
8117
+ return this.result.opts;
8118
+ }
8119
+ get processor() {
8120
+ return this.result.processor;
8121
+ }
8122
+ get root() {
8123
+ return this.sync().root;
8124
+ }
8125
+ get [Symbol.toStringTag]() {
8126
+ return "LazyResult";
8127
+ }
8038
8128
  constructor(processor2, css, opts) {
8039
8129
  this.stringified = false;
8040
8130
  this.processed = false;
@@ -8377,30 +8467,6 @@ function requireLazyResult() {
8377
8467
  warnings() {
8378
8468
  return this.sync().warnings();
8379
8469
  }
8380
- get content() {
8381
- return this.stringify().content;
8382
- }
8383
- get css() {
8384
- return this.stringify().css;
8385
- }
8386
- get map() {
8387
- return this.stringify().map;
8388
- }
8389
- get messages() {
8390
- return this.sync().messages;
8391
- }
8392
- get opts() {
8393
- return this.result.opts;
8394
- }
8395
- get processor() {
8396
- return this.result.processor;
8397
- }
8398
- get root() {
8399
- return this.sync().root;
8400
- }
8401
- get [Symbol.toStringTag]() {
8402
- return "LazyResult";
8403
- }
8404
8470
  }
8405
8471
  LazyResult.registerPostcss = (dependant) => {
8406
8472
  postcss2 = dependant;
@@ -8422,6 +8488,45 @@ function requireNoWorkResult() {
8422
8488
  let stringify = requireStringify();
8423
8489
  let warnOnce2 = requireWarnOnce();
8424
8490
  class NoWorkResult {
8491
+ get content() {
8492
+ return this.result.css;
8493
+ }
8494
+ get css() {
8495
+ return this.result.css;
8496
+ }
8497
+ get map() {
8498
+ return this.result.map;
8499
+ }
8500
+ get messages() {
8501
+ return [];
8502
+ }
8503
+ get opts() {
8504
+ return this.result.opts;
8505
+ }
8506
+ get processor() {
8507
+ return this.result.processor;
8508
+ }
8509
+ get root() {
8510
+ if (this._root) {
8511
+ return this._root;
8512
+ }
8513
+ let root2;
8514
+ let parser2 = parse;
8515
+ try {
8516
+ root2 = parser2(this._css, this._opts);
8517
+ } catch (error) {
8518
+ this.error = error;
8519
+ }
8520
+ if (this.error) {
8521
+ throw this.error;
8522
+ } else {
8523
+ this._root = root2;
8524
+ return root2;
8525
+ }
8526
+ }
8527
+ get [Symbol.toStringTag]() {
8528
+ return "NoWorkResult";
8529
+ }
8425
8530
  constructor(processor2, css, opts) {
8426
8531
  css = css.toString();
8427
8532
  this.stringified = false;
@@ -8483,45 +8588,6 @@ function requireNoWorkResult() {
8483
8588
  warnings() {
8484
8589
  return [];
8485
8590
  }
8486
- get content() {
8487
- return this.result.css;
8488
- }
8489
- get css() {
8490
- return this.result.css;
8491
- }
8492
- get map() {
8493
- return this.result.map;
8494
- }
8495
- get messages() {
8496
- return [];
8497
- }
8498
- get opts() {
8499
- return this.result.opts;
8500
- }
8501
- get processor() {
8502
- return this.result.processor;
8503
- }
8504
- get root() {
8505
- if (this._root) {
8506
- return this._root;
8507
- }
8508
- let root2;
8509
- let parser2 = parse;
8510
- try {
8511
- root2 = parser2(this._css, this._opts);
8512
- } catch (error) {
8513
- this.error = error;
8514
- }
8515
- if (this.error) {
8516
- throw this.error;
8517
- } else {
8518
- this._root = root2;
8519
- return root2;
8520
- }
8521
- }
8522
- get [Symbol.toStringTag]() {
8523
- return "NoWorkResult";
8524
- }
8525
8591
  }
8526
8592
  noWorkResult = NoWorkResult;
8527
8593
  NoWorkResult.default = NoWorkResult;
@@ -8538,7 +8604,7 @@ function requireProcessor() {
8538
8604
  let Root = requireRoot();
8539
8605
  class Processor {
8540
8606
  constructor(plugins = []) {
8541
- this.version = "8.5.1";
8607
+ this.version = "8.5.6";
8542
8608
  this.plugins = this.normalize(plugins);
8543
8609
  }
8544
8610
  normalize(plugins) {
@@ -13780,14 +13846,7 @@ function strToU8(str, latin1) {
13780
13846
  ar = n2;
13781
13847
  }
13782
13848
  var c2 = str.charCodeAt(i);
13783
- if (c2 < 128 || latin1)
13784
- w(c2);
13785
- else if (c2 < 2048)
13786
- w(192 | c2 >>> 6), w(128 | c2 & 63);
13787
- else if (c2 > 55295 && c2 < 57344)
13788
- c2 = 65536 + (c2 & 1023 << 10) | str.charCodeAt(++i) & 1023, w(240 | c2 >>> 18), w(128 | c2 >>> 12 & 63), w(128 | c2 >>> 6 & 63), w(128 | c2 & 63);
13789
- else
13790
- w(224 | c2 >>> 12), w(128 | c2 >>> 6 & 63), w(128 | c2 & 63);
13849
+ w(c2);
13791
13850
  }
13792
13851
  return slc(ar, 0, ai);
13793
13852
  }