@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.
@@ -537,7 +537,7 @@ function getDefaultExportFromCjs$1(x) {
537
537
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
538
538
  }
539
539
  function getAugmentedNamespace$1(n2) {
540
- if (n2.__esModule) return n2;
540
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
541
541
  var f2 = n2.default;
542
542
  if (typeof f2 == "function") {
543
543
  var a2 = function a3() {
@@ -1056,6 +1056,9 @@ function requireNode$1() {
1056
1056
  return offset;
1057
1057
  }
1058
1058
  class Node2 {
1059
+ get proxyOf() {
1060
+ return this;
1061
+ }
1059
1062
  constructor(defaults = {}) {
1060
1063
  this.raws = {};
1061
1064
  this[isClean] = false;
@@ -1174,7 +1177,7 @@ function requireNode$1() {
1174
1177
  let index2 = this.parent.index(this);
1175
1178
  return this.parent.nodes[index2 + 1];
1176
1179
  }
1177
- positionBy(opts) {
1180
+ positionBy(opts = {}) {
1178
1181
  let pos = this.source.start;
1179
1182
  if (opts.index) {
1180
1183
  pos = this.positionInside(opts.index);
@@ -1203,27 +1206,38 @@ function requireNode$1() {
1203
1206
  column += 1;
1204
1207
  }
1205
1208
  }
1206
- return { column, line };
1209
+ return { column, line, offset: end };
1207
1210
  }
1208
1211
  prev() {
1209
1212
  if (!this.parent) return void 0;
1210
1213
  let index2 = this.parent.index(this);
1211
1214
  return this.parent.nodes[index2 - 1];
1212
1215
  }
1213
- rangeBy(opts) {
1216
+ rangeBy(opts = {}) {
1217
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
1214
1218
  let start = {
1215
1219
  column: this.source.start.column,
1216
- line: this.source.start.line
1220
+ line: this.source.start.line,
1221
+ offset: sourceOffset(inputString, this.source.start)
1217
1222
  };
1218
1223
  let end = this.source.end ? {
1219
1224
  column: this.source.end.column + 1,
1220
- line: this.source.end.line
1225
+ line: this.source.end.line,
1226
+ offset: typeof this.source.end.offset === "number" ? (
1227
+ // `source.end.offset` is exclusive, so we don't need to add 1
1228
+ this.source.end.offset
1229
+ ) : (
1230
+ // Since line/column in this.source.end is inclusive,
1231
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
1232
+ // So, we add 1 to convert it to exclusive.
1233
+ sourceOffset(inputString, this.source.end) + 1
1234
+ )
1221
1235
  } : {
1222
1236
  column: start.column + 1,
1223
- line: start.line
1237
+ line: start.line,
1238
+ offset: start.offset + 1
1224
1239
  };
1225
1240
  if (opts.word) {
1226
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
1227
1241
  let stringRepresentation = inputString.slice(
1228
1242
  sourceOffset(inputString, this.source.start),
1229
1243
  sourceOffset(inputString, this.source.end)
@@ -1231,15 +1245,14 @@ function requireNode$1() {
1231
1245
  let index2 = stringRepresentation.indexOf(opts.word);
1232
1246
  if (index2 !== -1) {
1233
1247
  start = this.positionInside(index2);
1234
- end = this.positionInside(
1235
- index2 + opts.word.length
1236
- );
1248
+ end = this.positionInside(index2 + opts.word.length);
1237
1249
  }
1238
1250
  } else {
1239
1251
  if (opts.start) {
1240
1252
  start = {
1241
1253
  column: opts.start.column,
1242
- line: opts.start.line
1254
+ line: opts.start.line,
1255
+ offset: sourceOffset(inputString, opts.start)
1243
1256
  };
1244
1257
  } else if (opts.index) {
1245
1258
  start = this.positionInside(opts.index);
@@ -1247,7 +1260,8 @@ function requireNode$1() {
1247
1260
  if (opts.end) {
1248
1261
  end = {
1249
1262
  column: opts.end.column,
1250
- line: opts.end.line
1263
+ line: opts.end.line,
1264
+ offset: sourceOffset(inputString, opts.end)
1251
1265
  };
1252
1266
  } else if (typeof opts.endIndex === "number") {
1253
1267
  end = this.positionInside(opts.endIndex);
@@ -1256,7 +1270,11 @@ function requireNode$1() {
1256
1270
  }
1257
1271
  }
1258
1272
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
1259
- end = { column: start.column + 1, line: start.line };
1273
+ end = {
1274
+ column: start.column + 1,
1275
+ line: start.line,
1276
+ offset: start.offset + 1
1277
+ };
1260
1278
  }
1261
1279
  return { end, start };
1262
1280
  }
@@ -1320,6 +1338,7 @@ function requireNode$1() {
1320
1338
  } else if (typeof value === "object" && value.toJSON) {
1321
1339
  fixed[name] = value.toJSON(null, inputs);
1322
1340
  } else if (name === "source") {
1341
+ if (value == null) continue;
1323
1342
  let inputId = inputs.get(value.input);
1324
1343
  if (inputId == null) {
1325
1344
  inputId = inputsNextIndex;
@@ -1354,14 +1373,11 @@ function requireNode$1() {
1354
1373
  });
1355
1374
  return result2;
1356
1375
  }
1357
- warn(result2, text2, opts) {
1376
+ warn(result2, text2, opts = {}) {
1358
1377
  let data = { node: this };
1359
1378
  for (let i2 in opts) data[i2] = opts[i2];
1360
1379
  return result2.warn(text2, data);
1361
1380
  }
1362
- get proxyOf() {
1363
- return this;
1364
- }
1365
1381
  }
1366
1382
  node$1 = Node2;
1367
1383
  Node2.default = Node2;
@@ -1390,6 +1406,9 @@ function requireDeclaration$1() {
1390
1406
  hasRequiredDeclaration$1 = 1;
1391
1407
  let Node2 = requireNode$1();
1392
1408
  class Declaration extends Node2 {
1409
+ get variable() {
1410
+ return this.prop.startsWith("--") || this.prop[0] === "$";
1411
+ }
1393
1412
  constructor(defaults) {
1394
1413
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
1395
1414
  defaults = { ...defaults, value: String(defaults.value) };
@@ -1397,9 +1416,6 @@ function requireDeclaration$1() {
1397
1416
  super(defaults);
1398
1417
  this.type = "decl";
1399
1418
  }
1400
- get variable() {
1401
- return this.prop.startsWith("--") || this.prop[0] === "$";
1402
- }
1403
1419
  }
1404
1420
  declaration$1 = Declaration;
1405
1421
  Declaration.default = Declaration;
@@ -1431,6 +1447,14 @@ function requireContainer$1() {
1431
1447
  }
1432
1448
  }
1433
1449
  class Container extends Node2 {
1450
+ get first() {
1451
+ if (!this.proxyOf.nodes) return void 0;
1452
+ return this.proxyOf.nodes[0];
1453
+ }
1454
+ get last() {
1455
+ if (!this.proxyOf.nodes) return void 0;
1456
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
1457
+ }
1434
1458
  append(...children2) {
1435
1459
  for (let child of children2) {
1436
1460
  let nodes = this.normalize(child, this.last);
@@ -1743,14 +1767,6 @@ function requireContainer$1() {
1743
1767
  }
1744
1768
  });
1745
1769
  }
1746
- get first() {
1747
- if (!this.proxyOf.nodes) return void 0;
1748
- return this.proxyOf.nodes[0];
1749
- }
1750
- get last() {
1751
- if (!this.proxyOf.nodes) return void 0;
1752
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
1753
- }
1754
1770
  }
1755
1771
  Container.registerParse = (dependant) => {
1756
1772
  parse = dependant;
@@ -2000,10 +2016,25 @@ function requireInput$1() {
2000
2016
  let CssSyntaxError = requireCssSyntaxError$1();
2001
2017
  let PreviousMap = requirePreviousMap$1();
2002
2018
  let terminalHighlight = require$$2$1;
2003
- let fromOffsetCache = Symbol("fromOffsetCache");
2019
+ let lineToIndexCache = Symbol("lineToIndexCache");
2004
2020
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
2005
2021
  let pathAvailable = Boolean(resolve && isAbsolute);
2022
+ function getLineToIndex(input2) {
2023
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
2024
+ let lines = input2.css.split("\n");
2025
+ let lineToIndex = new Array(lines.length);
2026
+ let prevIndex = 0;
2027
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2028
+ lineToIndex[i2] = prevIndex;
2029
+ prevIndex += lines[i2].length + 1;
2030
+ }
2031
+ input2[lineToIndexCache] = lineToIndex;
2032
+ return lineToIndex;
2033
+ }
2006
2034
  class Input {
2035
+ get from() {
2036
+ return this.file || this.id;
2037
+ }
2007
2038
  constructor(css, opts = {}) {
2008
2039
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
2009
2040
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -2038,30 +2069,37 @@ function requireInput$1() {
2038
2069
  if (this.map) this.map.file = this.from;
2039
2070
  }
2040
2071
  error(message, line, column, opts = {}) {
2041
- let endColumn, endLine, result2;
2072
+ let endColumn, endLine, endOffset, offset, result2;
2042
2073
  if (line && typeof line === "object") {
2043
2074
  let start = line;
2044
2075
  let end = column;
2045
2076
  if (typeof start.offset === "number") {
2046
- let pos = this.fromOffset(start.offset);
2077
+ offset = start.offset;
2078
+ let pos = this.fromOffset(offset);
2047
2079
  line = pos.line;
2048
2080
  column = pos.col;
2049
2081
  } else {
2050
2082
  line = start.line;
2051
2083
  column = start.column;
2084
+ offset = this.fromLineAndColumn(line, column);
2052
2085
  }
2053
2086
  if (typeof end.offset === "number") {
2054
- let pos = this.fromOffset(end.offset);
2087
+ endOffset = end.offset;
2088
+ let pos = this.fromOffset(endOffset);
2055
2089
  endLine = pos.line;
2056
2090
  endColumn = pos.col;
2057
2091
  } else {
2058
2092
  endLine = end.line;
2059
2093
  endColumn = end.column;
2094
+ endOffset = this.fromLineAndColumn(end.line, end.column);
2060
2095
  }
2061
2096
  } else if (!column) {
2062
- let pos = this.fromOffset(line);
2097
+ offset = line;
2098
+ let pos = this.fromOffset(offset);
2063
2099
  line = pos.line;
2064
2100
  column = pos.col;
2101
+ } else {
2102
+ offset = this.fromLineAndColumn(line, column);
2065
2103
  }
2066
2104
  let origin = this.origin(line, column, endLine, endColumn);
2067
2105
  if (origin) {
@@ -2083,7 +2121,7 @@ function requireInput$1() {
2083
2121
  opts.plugin
2084
2122
  );
2085
2123
  }
2086
- result2.input = { column, endColumn, endLine, line, source: this.css };
2124
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
2087
2125
  if (this.file) {
2088
2126
  if (pathToFileURL) {
2089
2127
  result2.input.url = pathToFileURL(this.file).toString();
@@ -2092,21 +2130,14 @@ function requireInput$1() {
2092
2130
  }
2093
2131
  return result2;
2094
2132
  }
2133
+ fromLineAndColumn(line, column) {
2134
+ let lineToIndex = getLineToIndex(this);
2135
+ let index2 = lineToIndex[line - 1];
2136
+ return index2 + column - 1;
2137
+ }
2095
2138
  fromOffset(offset) {
2096
- let lastLine, lineToIndex;
2097
- if (!this[fromOffsetCache]) {
2098
- let lines = this.css.split("\n");
2099
- lineToIndex = new Array(lines.length);
2100
- let prevIndex = 0;
2101
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
2102
- lineToIndex[i2] = prevIndex;
2103
- prevIndex += lines[i2].length + 1;
2104
- }
2105
- this[fromOffsetCache] = lineToIndex;
2106
- } else {
2107
- lineToIndex = this[fromOffsetCache];
2108
- }
2109
- lastLine = lineToIndex[lineToIndex.length - 1];
2139
+ let lineToIndex = getLineToIndex(this);
2140
+ let lastLine = lineToIndex[lineToIndex.length - 1];
2110
2141
  let min = 0;
2111
2142
  if (offset >= lastLine) {
2112
2143
  min = lineToIndex.length - 1;
@@ -2187,9 +2218,6 @@ function requireInput$1() {
2187
2218
  }
2188
2219
  return json;
2189
2220
  }
2190
- get from() {
2191
- return this.file || this.id;
2192
- }
2193
2221
  }
2194
2222
  input$1 = Input;
2195
2223
  Input.default = Input;
@@ -2315,11 +2343,6 @@ function requireRule$1() {
2315
2343
  let Container = requireContainer$1();
2316
2344
  let list = requireList$1();
2317
2345
  class Rule extends Container {
2318
- constructor(defaults) {
2319
- super(defaults);
2320
- this.type = "rule";
2321
- if (!this.nodes) this.nodes = [];
2322
- }
2323
2346
  get selectors() {
2324
2347
  return list.comma(this.selector);
2325
2348
  }
@@ -2328,6 +2351,11 @@ function requireRule$1() {
2328
2351
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
2329
2352
  this.selector = values.join(sep);
2330
2353
  }
2354
+ constructor(defaults) {
2355
+ super(defaults);
2356
+ this.type = "rule";
2357
+ if (!this.nodes) this.nodes = [];
2358
+ }
2331
2359
  }
2332
2360
  rule$1 = Rule;
2333
2361
  Rule.default = Rule;
@@ -3227,6 +3255,8 @@ function requireParser$1() {
3227
3255
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
3228
3256
  prev.raws.ownSemicolon = this.spaces;
3229
3257
  this.spaces = "";
3258
+ prev.source.end = this.getPosition(token[2]);
3259
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
3230
3260
  }
3231
3261
  }
3232
3262
  }
@@ -3438,7 +3468,7 @@ function requireParser$1() {
3438
3468
  }
3439
3469
  unknownWord(tokens) {
3440
3470
  throw this.input.error(
3441
- "Unknown word",
3471
+ "Unknown word " + tokens[0][1],
3442
3472
  { offset: tokens[0][2] },
3443
3473
  { offset: tokens[0][2] + tokens[0][1].length }
3444
3474
  );
@@ -3531,12 +3561,15 @@ function requireResult$1() {
3531
3561
  hasRequiredResult$1 = 1;
3532
3562
  let Warning = requireWarning$1();
3533
3563
  class Result {
3564
+ get content() {
3565
+ return this.css;
3566
+ }
3534
3567
  constructor(processor2, root2, opts) {
3535
3568
  this.processor = processor2;
3536
3569
  this.messages = [];
3537
3570
  this.root = root2;
3538
3571
  this.opts = opts;
3539
- this.css = void 0;
3572
+ this.css = "";
3540
3573
  this.map = void 0;
3541
3574
  }
3542
3575
  toString() {
@@ -3555,9 +3588,6 @@ function requireResult$1() {
3555
3588
  warnings() {
3556
3589
  return this.messages.filter((i2) => i2.type === "warning");
3557
3590
  }
3558
- get content() {
3559
- return this.css;
3560
- }
3561
3591
  }
3562
3592
  result$1 = Result;
3563
3593
  Result.default = Result;
@@ -3676,6 +3706,30 @@ function requireLazyResult$1() {
3676
3706
  }
3677
3707
  let postcss2 = {};
3678
3708
  class LazyResult {
3709
+ get content() {
3710
+ return this.stringify().content;
3711
+ }
3712
+ get css() {
3713
+ return this.stringify().css;
3714
+ }
3715
+ get map() {
3716
+ return this.stringify().map;
3717
+ }
3718
+ get messages() {
3719
+ return this.sync().messages;
3720
+ }
3721
+ get opts() {
3722
+ return this.result.opts;
3723
+ }
3724
+ get processor() {
3725
+ return this.result.processor;
3726
+ }
3727
+ get root() {
3728
+ return this.sync().root;
3729
+ }
3730
+ get [Symbol.toStringTag]() {
3731
+ return "LazyResult";
3732
+ }
3679
3733
  constructor(processor2, css, opts) {
3680
3734
  this.stringified = false;
3681
3735
  this.processed = false;
@@ -4018,30 +4072,6 @@ function requireLazyResult$1() {
4018
4072
  warnings() {
4019
4073
  return this.sync().warnings();
4020
4074
  }
4021
- get content() {
4022
- return this.stringify().content;
4023
- }
4024
- get css() {
4025
- return this.stringify().css;
4026
- }
4027
- get map() {
4028
- return this.stringify().map;
4029
- }
4030
- get messages() {
4031
- return this.sync().messages;
4032
- }
4033
- get opts() {
4034
- return this.result.opts;
4035
- }
4036
- get processor() {
4037
- return this.result.processor;
4038
- }
4039
- get root() {
4040
- return this.sync().root;
4041
- }
4042
- get [Symbol.toStringTag]() {
4043
- return "LazyResult";
4044
- }
4045
4075
  }
4046
4076
  LazyResult.registerPostcss = (dependant) => {
4047
4077
  postcss2 = dependant;
@@ -4063,6 +4093,45 @@ function requireNoWorkResult$1() {
4063
4093
  let stringify = requireStringify$1();
4064
4094
  let warnOnce2 = requireWarnOnce$1();
4065
4095
  class NoWorkResult {
4096
+ get content() {
4097
+ return this.result.css;
4098
+ }
4099
+ get css() {
4100
+ return this.result.css;
4101
+ }
4102
+ get map() {
4103
+ return this.result.map;
4104
+ }
4105
+ get messages() {
4106
+ return [];
4107
+ }
4108
+ get opts() {
4109
+ return this.result.opts;
4110
+ }
4111
+ get processor() {
4112
+ return this.result.processor;
4113
+ }
4114
+ get root() {
4115
+ if (this._root) {
4116
+ return this._root;
4117
+ }
4118
+ let root2;
4119
+ let parser2 = parse;
4120
+ try {
4121
+ root2 = parser2(this._css, this._opts);
4122
+ } catch (error) {
4123
+ this.error = error;
4124
+ }
4125
+ if (this.error) {
4126
+ throw this.error;
4127
+ } else {
4128
+ this._root = root2;
4129
+ return root2;
4130
+ }
4131
+ }
4132
+ get [Symbol.toStringTag]() {
4133
+ return "NoWorkResult";
4134
+ }
4066
4135
  constructor(processor2, css, opts) {
4067
4136
  css = css.toString();
4068
4137
  this.stringified = false;
@@ -4124,45 +4193,6 @@ function requireNoWorkResult$1() {
4124
4193
  warnings() {
4125
4194
  return [];
4126
4195
  }
4127
- get content() {
4128
- return this.result.css;
4129
- }
4130
- get css() {
4131
- return this.result.css;
4132
- }
4133
- get map() {
4134
- return this.result.map;
4135
- }
4136
- get messages() {
4137
- return [];
4138
- }
4139
- get opts() {
4140
- return this.result.opts;
4141
- }
4142
- get processor() {
4143
- return this.result.processor;
4144
- }
4145
- get root() {
4146
- if (this._root) {
4147
- return this._root;
4148
- }
4149
- let root2;
4150
- let parser2 = parse;
4151
- try {
4152
- root2 = parser2(this._css, this._opts);
4153
- } catch (error) {
4154
- this.error = error;
4155
- }
4156
- if (this.error) {
4157
- throw this.error;
4158
- } else {
4159
- this._root = root2;
4160
- return root2;
4161
- }
4162
- }
4163
- get [Symbol.toStringTag]() {
4164
- return "NoWorkResult";
4165
- }
4166
4196
  }
4167
4197
  noWorkResult$1 = NoWorkResult;
4168
4198
  NoWorkResult.default = NoWorkResult;
@@ -4179,7 +4209,7 @@ function requireProcessor$1() {
4179
4209
  let Root = requireRoot$1();
4180
4210
  class Processor {
4181
4211
  constructor(plugins = []) {
4182
- this.version = "8.5.1";
4212
+ this.version = "8.5.6";
4183
4213
  this.plugins = this.normalize(plugins);
4184
4214
  }
4185
4215
  normalize(plugins) {
@@ -4635,6 +4665,12 @@ function buildNode(n2, options) {
4635
4665
  node2.style.setProperty("width", value.toString());
4636
4666
  } else if (name === "rr_height") {
4637
4667
  node2.style.setProperty("height", value.toString());
4668
+ } else if (name === "rr_left") {
4669
+ node2.style.setProperty("left", value.toString());
4670
+ node2.style.setProperty("position", "absolute");
4671
+ } else if (name === "rr_top") {
4672
+ node2.style.setProperty("top", value.toString());
4673
+ node2.style.setProperty("position", "absolute");
4638
4674
  } else if (name === "rr_mediaCurrentTime" && typeof value === "number") {
4639
4675
  node2.currentTime = value;
4640
4676
  } else if (name === "rr_mediaState") {
@@ -4894,7 +4930,7 @@ function getDefaultExportFromCjs(x) {
4894
4930
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
4895
4931
  }
4896
4932
  function getAugmentedNamespace(n2) {
4897
- if (n2.__esModule) return n2;
4933
+ if (Object.prototype.hasOwnProperty.call(n2, "__esModule")) return n2;
4898
4934
  var f2 = n2.default;
4899
4935
  if (typeof f2 == "function") {
4900
4936
  var a2 = function a3() {
@@ -5413,6 +5449,9 @@ function requireNode() {
5413
5449
  return offset;
5414
5450
  }
5415
5451
  class Node2 {
5452
+ get proxyOf() {
5453
+ return this;
5454
+ }
5416
5455
  constructor(defaults = {}) {
5417
5456
  this.raws = {};
5418
5457
  this[isClean] = false;
@@ -5531,7 +5570,7 @@ function requireNode() {
5531
5570
  let index2 = this.parent.index(this);
5532
5571
  return this.parent.nodes[index2 + 1];
5533
5572
  }
5534
- positionBy(opts) {
5573
+ positionBy(opts = {}) {
5535
5574
  let pos = this.source.start;
5536
5575
  if (opts.index) {
5537
5576
  pos = this.positionInside(opts.index);
@@ -5560,27 +5599,38 @@ function requireNode() {
5560
5599
  column += 1;
5561
5600
  }
5562
5601
  }
5563
- return { column, line };
5602
+ return { column, line, offset: end };
5564
5603
  }
5565
5604
  prev() {
5566
5605
  if (!this.parent) return void 0;
5567
5606
  let index2 = this.parent.index(this);
5568
5607
  return this.parent.nodes[index2 - 1];
5569
5608
  }
5570
- rangeBy(opts) {
5609
+ rangeBy(opts = {}) {
5610
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
5571
5611
  let start = {
5572
5612
  column: this.source.start.column,
5573
- line: this.source.start.line
5613
+ line: this.source.start.line,
5614
+ offset: sourceOffset(inputString, this.source.start)
5574
5615
  };
5575
5616
  let end = this.source.end ? {
5576
5617
  column: this.source.end.column + 1,
5577
- line: this.source.end.line
5618
+ line: this.source.end.line,
5619
+ offset: typeof this.source.end.offset === "number" ? (
5620
+ // `source.end.offset` is exclusive, so we don't need to add 1
5621
+ this.source.end.offset
5622
+ ) : (
5623
+ // Since line/column in this.source.end is inclusive,
5624
+ // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
5625
+ // So, we add 1 to convert it to exclusive.
5626
+ sourceOffset(inputString, this.source.end) + 1
5627
+ )
5578
5628
  } : {
5579
5629
  column: start.column + 1,
5580
- line: start.line
5630
+ line: start.line,
5631
+ offset: start.offset + 1
5581
5632
  };
5582
5633
  if (opts.word) {
5583
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
5584
5634
  let stringRepresentation = inputString.slice(
5585
5635
  sourceOffset(inputString, this.source.start),
5586
5636
  sourceOffset(inputString, this.source.end)
@@ -5588,15 +5638,14 @@ function requireNode() {
5588
5638
  let index2 = stringRepresentation.indexOf(opts.word);
5589
5639
  if (index2 !== -1) {
5590
5640
  start = this.positionInside(index2);
5591
- end = this.positionInside(
5592
- index2 + opts.word.length
5593
- );
5641
+ end = this.positionInside(index2 + opts.word.length);
5594
5642
  }
5595
5643
  } else {
5596
5644
  if (opts.start) {
5597
5645
  start = {
5598
5646
  column: opts.start.column,
5599
- line: opts.start.line
5647
+ line: opts.start.line,
5648
+ offset: sourceOffset(inputString, opts.start)
5600
5649
  };
5601
5650
  } else if (opts.index) {
5602
5651
  start = this.positionInside(opts.index);
@@ -5604,7 +5653,8 @@ function requireNode() {
5604
5653
  if (opts.end) {
5605
5654
  end = {
5606
5655
  column: opts.end.column,
5607
- line: opts.end.line
5656
+ line: opts.end.line,
5657
+ offset: sourceOffset(inputString, opts.end)
5608
5658
  };
5609
5659
  } else if (typeof opts.endIndex === "number") {
5610
5660
  end = this.positionInside(opts.endIndex);
@@ -5613,7 +5663,11 @@ function requireNode() {
5613
5663
  }
5614
5664
  }
5615
5665
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
5616
- end = { column: start.column + 1, line: start.line };
5666
+ end = {
5667
+ column: start.column + 1,
5668
+ line: start.line,
5669
+ offset: start.offset + 1
5670
+ };
5617
5671
  }
5618
5672
  return { end, start };
5619
5673
  }
@@ -5677,6 +5731,7 @@ function requireNode() {
5677
5731
  } else if (typeof value === "object" && value.toJSON) {
5678
5732
  fixed[name] = value.toJSON(null, inputs);
5679
5733
  } else if (name === "source") {
5734
+ if (value == null) continue;
5680
5735
  let inputId = inputs.get(value.input);
5681
5736
  if (inputId == null) {
5682
5737
  inputId = inputsNextIndex;
@@ -5711,14 +5766,11 @@ function requireNode() {
5711
5766
  });
5712
5767
  return result2;
5713
5768
  }
5714
- warn(result2, text2, opts) {
5769
+ warn(result2, text2, opts = {}) {
5715
5770
  let data = { node: this };
5716
5771
  for (let i2 in opts) data[i2] = opts[i2];
5717
5772
  return result2.warn(text2, data);
5718
5773
  }
5719
- get proxyOf() {
5720
- return this;
5721
- }
5722
5774
  }
5723
5775
  node = Node2;
5724
5776
  Node2.default = Node2;
@@ -5747,6 +5799,9 @@ function requireDeclaration() {
5747
5799
  hasRequiredDeclaration = 1;
5748
5800
  let Node2 = requireNode();
5749
5801
  class Declaration extends Node2 {
5802
+ get variable() {
5803
+ return this.prop.startsWith("--") || this.prop[0] === "$";
5804
+ }
5750
5805
  constructor(defaults) {
5751
5806
  if (defaults && typeof defaults.value !== "undefined" && typeof defaults.value !== "string") {
5752
5807
  defaults = { ...defaults, value: String(defaults.value) };
@@ -5754,9 +5809,6 @@ function requireDeclaration() {
5754
5809
  super(defaults);
5755
5810
  this.type = "decl";
5756
5811
  }
5757
- get variable() {
5758
- return this.prop.startsWith("--") || this.prop[0] === "$";
5759
- }
5760
5812
  }
5761
5813
  declaration = Declaration;
5762
5814
  Declaration.default = Declaration;
@@ -5788,6 +5840,14 @@ function requireContainer() {
5788
5840
  }
5789
5841
  }
5790
5842
  class Container extends Node2 {
5843
+ get first() {
5844
+ if (!this.proxyOf.nodes) return void 0;
5845
+ return this.proxyOf.nodes[0];
5846
+ }
5847
+ get last() {
5848
+ if (!this.proxyOf.nodes) return void 0;
5849
+ return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
5850
+ }
5791
5851
  append(...children2) {
5792
5852
  for (let child of children2) {
5793
5853
  let nodes = this.normalize(child, this.last);
@@ -6100,14 +6160,6 @@ function requireContainer() {
6100
6160
  }
6101
6161
  });
6102
6162
  }
6103
- get first() {
6104
- if (!this.proxyOf.nodes) return void 0;
6105
- return this.proxyOf.nodes[0];
6106
- }
6107
- get last() {
6108
- if (!this.proxyOf.nodes) return void 0;
6109
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
6110
- }
6111
6163
  }
6112
6164
  Container.registerParse = (dependant) => {
6113
6165
  parse = dependant;
@@ -6357,10 +6409,25 @@ function requireInput() {
6357
6409
  let CssSyntaxError = requireCssSyntaxError();
6358
6410
  let PreviousMap = requirePreviousMap();
6359
6411
  let terminalHighlight = require$$2;
6360
- let fromOffsetCache = Symbol("fromOffsetCache");
6412
+ let lineToIndexCache = Symbol("lineToIndexCache");
6361
6413
  let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
6362
6414
  let pathAvailable = Boolean(resolve && isAbsolute);
6415
+ function getLineToIndex(input2) {
6416
+ if (input2[lineToIndexCache]) return input2[lineToIndexCache];
6417
+ let lines = input2.css.split("\n");
6418
+ let lineToIndex = new Array(lines.length);
6419
+ let prevIndex = 0;
6420
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6421
+ lineToIndex[i2] = prevIndex;
6422
+ prevIndex += lines[i2].length + 1;
6423
+ }
6424
+ input2[lineToIndexCache] = lineToIndex;
6425
+ return lineToIndex;
6426
+ }
6363
6427
  class Input {
6428
+ get from() {
6429
+ return this.file || this.id;
6430
+ }
6364
6431
  constructor(css, opts = {}) {
6365
6432
  if (css === null || typeof css === "undefined" || typeof css === "object" && !css.toString) {
6366
6433
  throw new Error(`PostCSS received ${css} instead of CSS string`);
@@ -6395,30 +6462,37 @@ function requireInput() {
6395
6462
  if (this.map) this.map.file = this.from;
6396
6463
  }
6397
6464
  error(message, line, column, opts = {}) {
6398
- let endColumn, endLine, result2;
6465
+ let endColumn, endLine, endOffset, offset, result2;
6399
6466
  if (line && typeof line === "object") {
6400
6467
  let start = line;
6401
6468
  let end = column;
6402
6469
  if (typeof start.offset === "number") {
6403
- let pos = this.fromOffset(start.offset);
6470
+ offset = start.offset;
6471
+ let pos = this.fromOffset(offset);
6404
6472
  line = pos.line;
6405
6473
  column = pos.col;
6406
6474
  } else {
6407
6475
  line = start.line;
6408
6476
  column = start.column;
6477
+ offset = this.fromLineAndColumn(line, column);
6409
6478
  }
6410
6479
  if (typeof end.offset === "number") {
6411
- let pos = this.fromOffset(end.offset);
6480
+ endOffset = end.offset;
6481
+ let pos = this.fromOffset(endOffset);
6412
6482
  endLine = pos.line;
6413
6483
  endColumn = pos.col;
6414
6484
  } else {
6415
6485
  endLine = end.line;
6416
6486
  endColumn = end.column;
6487
+ endOffset = this.fromLineAndColumn(end.line, end.column);
6417
6488
  }
6418
6489
  } else if (!column) {
6419
- let pos = this.fromOffset(line);
6490
+ offset = line;
6491
+ let pos = this.fromOffset(offset);
6420
6492
  line = pos.line;
6421
6493
  column = pos.col;
6494
+ } else {
6495
+ offset = this.fromLineAndColumn(line, column);
6422
6496
  }
6423
6497
  let origin = this.origin(line, column, endLine, endColumn);
6424
6498
  if (origin) {
@@ -6440,7 +6514,7 @@ function requireInput() {
6440
6514
  opts.plugin
6441
6515
  );
6442
6516
  }
6443
- result2.input = { column, endColumn, endLine, line, source: this.css };
6517
+ result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
6444
6518
  if (this.file) {
6445
6519
  if (pathToFileURL) {
6446
6520
  result2.input.url = pathToFileURL(this.file).toString();
@@ -6449,21 +6523,14 @@ function requireInput() {
6449
6523
  }
6450
6524
  return result2;
6451
6525
  }
6526
+ fromLineAndColumn(line, column) {
6527
+ let lineToIndex = getLineToIndex(this);
6528
+ let index2 = lineToIndex[line - 1];
6529
+ return index2 + column - 1;
6530
+ }
6452
6531
  fromOffset(offset) {
6453
- let lastLine, lineToIndex;
6454
- if (!this[fromOffsetCache]) {
6455
- let lines = this.css.split("\n");
6456
- lineToIndex = new Array(lines.length);
6457
- let prevIndex = 0;
6458
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6459
- lineToIndex[i2] = prevIndex;
6460
- prevIndex += lines[i2].length + 1;
6461
- }
6462
- this[fromOffsetCache] = lineToIndex;
6463
- } else {
6464
- lineToIndex = this[fromOffsetCache];
6465
- }
6466
- lastLine = lineToIndex[lineToIndex.length - 1];
6532
+ let lineToIndex = getLineToIndex(this);
6533
+ let lastLine = lineToIndex[lineToIndex.length - 1];
6467
6534
  let min = 0;
6468
6535
  if (offset >= lastLine) {
6469
6536
  min = lineToIndex.length - 1;
@@ -6544,9 +6611,6 @@ function requireInput() {
6544
6611
  }
6545
6612
  return json;
6546
6613
  }
6547
- get from() {
6548
- return this.file || this.id;
6549
- }
6550
6614
  }
6551
6615
  input = Input;
6552
6616
  Input.default = Input;
@@ -6672,11 +6736,6 @@ function requireRule() {
6672
6736
  let Container = requireContainer();
6673
6737
  let list = requireList();
6674
6738
  class Rule extends Container {
6675
- constructor(defaults) {
6676
- super(defaults);
6677
- this.type = "rule";
6678
- if (!this.nodes) this.nodes = [];
6679
- }
6680
6739
  get selectors() {
6681
6740
  return list.comma(this.selector);
6682
6741
  }
@@ -6685,6 +6744,11 @@ function requireRule() {
6685
6744
  let sep = match ? match[0] : "," + this.raw("between", "beforeOpen");
6686
6745
  this.selector = values.join(sep);
6687
6746
  }
6747
+ constructor(defaults) {
6748
+ super(defaults);
6749
+ this.type = "rule";
6750
+ if (!this.nodes) this.nodes = [];
6751
+ }
6688
6752
  }
6689
6753
  rule = Rule;
6690
6754
  Rule.default = Rule;
@@ -7584,6 +7648,8 @@ function requireParser() {
7584
7648
  if (prev && prev.type === "rule" && !prev.raws.ownSemicolon) {
7585
7649
  prev.raws.ownSemicolon = this.spaces;
7586
7650
  this.spaces = "";
7651
+ prev.source.end = this.getPosition(token[2]);
7652
+ prev.source.end.offset += prev.raws.ownSemicolon.length;
7587
7653
  }
7588
7654
  }
7589
7655
  }
@@ -7795,7 +7861,7 @@ function requireParser() {
7795
7861
  }
7796
7862
  unknownWord(tokens) {
7797
7863
  throw this.input.error(
7798
- "Unknown word",
7864
+ "Unknown word " + tokens[0][1],
7799
7865
  { offset: tokens[0][2] },
7800
7866
  { offset: tokens[0][2] + tokens[0][1].length }
7801
7867
  );
@@ -7888,12 +7954,15 @@ function requireResult() {
7888
7954
  hasRequiredResult = 1;
7889
7955
  let Warning = requireWarning();
7890
7956
  class Result {
7957
+ get content() {
7958
+ return this.css;
7959
+ }
7891
7960
  constructor(processor2, root2, opts) {
7892
7961
  this.processor = processor2;
7893
7962
  this.messages = [];
7894
7963
  this.root = root2;
7895
7964
  this.opts = opts;
7896
- this.css = void 0;
7965
+ this.css = "";
7897
7966
  this.map = void 0;
7898
7967
  }
7899
7968
  toString() {
@@ -7912,9 +7981,6 @@ function requireResult() {
7912
7981
  warnings() {
7913
7982
  return this.messages.filter((i2) => i2.type === "warning");
7914
7983
  }
7915
- get content() {
7916
- return this.css;
7917
- }
7918
7984
  }
7919
7985
  result = Result;
7920
7986
  Result.default = Result;
@@ -8033,6 +8099,30 @@ function requireLazyResult() {
8033
8099
  }
8034
8100
  let postcss2 = {};
8035
8101
  class LazyResult {
8102
+ get content() {
8103
+ return this.stringify().content;
8104
+ }
8105
+ get css() {
8106
+ return this.stringify().css;
8107
+ }
8108
+ get map() {
8109
+ return this.stringify().map;
8110
+ }
8111
+ get messages() {
8112
+ return this.sync().messages;
8113
+ }
8114
+ get opts() {
8115
+ return this.result.opts;
8116
+ }
8117
+ get processor() {
8118
+ return this.result.processor;
8119
+ }
8120
+ get root() {
8121
+ return this.sync().root;
8122
+ }
8123
+ get [Symbol.toStringTag]() {
8124
+ return "LazyResult";
8125
+ }
8036
8126
  constructor(processor2, css, opts) {
8037
8127
  this.stringified = false;
8038
8128
  this.processed = false;
@@ -8375,30 +8465,6 @@ function requireLazyResult() {
8375
8465
  warnings() {
8376
8466
  return this.sync().warnings();
8377
8467
  }
8378
- get content() {
8379
- return this.stringify().content;
8380
- }
8381
- get css() {
8382
- return this.stringify().css;
8383
- }
8384
- get map() {
8385
- return this.stringify().map;
8386
- }
8387
- get messages() {
8388
- return this.sync().messages;
8389
- }
8390
- get opts() {
8391
- return this.result.opts;
8392
- }
8393
- get processor() {
8394
- return this.result.processor;
8395
- }
8396
- get root() {
8397
- return this.sync().root;
8398
- }
8399
- get [Symbol.toStringTag]() {
8400
- return "LazyResult";
8401
- }
8402
8468
  }
8403
8469
  LazyResult.registerPostcss = (dependant) => {
8404
8470
  postcss2 = dependant;
@@ -8420,6 +8486,45 @@ function requireNoWorkResult() {
8420
8486
  let stringify = requireStringify();
8421
8487
  let warnOnce2 = requireWarnOnce();
8422
8488
  class NoWorkResult {
8489
+ get content() {
8490
+ return this.result.css;
8491
+ }
8492
+ get css() {
8493
+ return this.result.css;
8494
+ }
8495
+ get map() {
8496
+ return this.result.map;
8497
+ }
8498
+ get messages() {
8499
+ return [];
8500
+ }
8501
+ get opts() {
8502
+ return this.result.opts;
8503
+ }
8504
+ get processor() {
8505
+ return this.result.processor;
8506
+ }
8507
+ get root() {
8508
+ if (this._root) {
8509
+ return this._root;
8510
+ }
8511
+ let root2;
8512
+ let parser2 = parse;
8513
+ try {
8514
+ root2 = parser2(this._css, this._opts);
8515
+ } catch (error) {
8516
+ this.error = error;
8517
+ }
8518
+ if (this.error) {
8519
+ throw this.error;
8520
+ } else {
8521
+ this._root = root2;
8522
+ return root2;
8523
+ }
8524
+ }
8525
+ get [Symbol.toStringTag]() {
8526
+ return "NoWorkResult";
8527
+ }
8423
8528
  constructor(processor2, css, opts) {
8424
8529
  css = css.toString();
8425
8530
  this.stringified = false;
@@ -8481,45 +8586,6 @@ function requireNoWorkResult() {
8481
8586
  warnings() {
8482
8587
  return [];
8483
8588
  }
8484
- get content() {
8485
- return this.result.css;
8486
- }
8487
- get css() {
8488
- return this.result.css;
8489
- }
8490
- get map() {
8491
- return this.result.map;
8492
- }
8493
- get messages() {
8494
- return [];
8495
- }
8496
- get opts() {
8497
- return this.result.opts;
8498
- }
8499
- get processor() {
8500
- return this.result.processor;
8501
- }
8502
- get root() {
8503
- if (this._root) {
8504
- return this._root;
8505
- }
8506
- let root2;
8507
- let parser2 = parse;
8508
- try {
8509
- root2 = parser2(this._css, this._opts);
8510
- } catch (error) {
8511
- this.error = error;
8512
- }
8513
- if (this.error) {
8514
- throw this.error;
8515
- } else {
8516
- this._root = root2;
8517
- return root2;
8518
- }
8519
- }
8520
- get [Symbol.toStringTag]() {
8521
- return "NoWorkResult";
8522
- }
8523
8589
  }
8524
8590
  noWorkResult = NoWorkResult;
8525
8591
  NoWorkResult.default = NoWorkResult;
@@ -8536,7 +8602,7 @@ function requireProcessor() {
8536
8602
  let Root = requireRoot();
8537
8603
  class Processor {
8538
8604
  constructor(plugins = []) {
8539
- this.version = "8.5.1";
8605
+ this.version = "8.5.6";
8540
8606
  this.plugins = this.normalize(plugins);
8541
8607
  }
8542
8608
  normalize(plugins) {
@@ -13778,14 +13844,7 @@ function strToU8(str, latin1) {
13778
13844
  ar = n2;
13779
13845
  }
13780
13846
  var c2 = str.charCodeAt(i);
13781
- if (c2 < 128 || latin1)
13782
- w(c2);
13783
- else if (c2 < 2048)
13784
- w(192 | c2 >>> 6), w(128 | c2 & 63);
13785
- else if (c2 > 55295 && c2 < 57344)
13786
- 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);
13787
- else
13788
- w(224 | c2 >>> 12), w(128 | c2 >>> 6 & 63), w(128 | c2 & 63);
13847
+ w(c2);
13789
13848
  }
13790
13849
  return slc(ar, 0, ai);
13791
13850
  }