@glimt/record 0.0.47 → 0.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/record.cjs CHANGED
@@ -443,7 +443,7 @@ function isShadowRoot(n2) {
443
443
  function isNativeShadowDom(shadowRoot2) {
444
444
  return Object.prototype.toString.call(shadowRoot2) === "[object ShadowRoot]";
445
445
  }
446
- function fixBrowserCompatibilityIssuesInCSS$1(cssText) {
446
+ function fixBrowserCompatibilityIssuesInCSS(cssText) {
447
447
  if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
448
448
  cssText = cssText.replace(
449
449
  /\sbackground-clip:\s*text;/g,
@@ -452,7 +452,7 @@ function fixBrowserCompatibilityIssuesInCSS$1(cssText) {
452
452
  }
453
453
  return cssText;
454
454
  }
455
- function escapeImportStatement$1(rule2) {
455
+ function escapeImportStatement(rule2) {
456
456
  const { cssText } = rule2;
457
457
  if (cssText.split('"').length < 3) return cssText;
458
458
  const statement = ["@import", `url(${JSON.stringify(rule2.href)})`];
@@ -469,7 +469,7 @@ function escapeImportStatement$1(rule2) {
469
469
  }
470
470
  return statement.join(" ") + ";";
471
471
  }
472
- function stringifyStylesheet$1(s2) {
472
+ function stringifyStylesheet(s2) {
473
473
  try {
474
474
  const rules2 = s2.rules || s2.cssRules;
475
475
  if (!rules2) {
@@ -481,47 +481,47 @@ function stringifyStylesheet$1(s2) {
481
481
  }
482
482
  const stringifiedRules = Array.from(
483
483
  rules2,
484
- (rule2) => stringifyRule$1(rule2, sheetHref)
484
+ (rule2) => stringifyRule(rule2, sheetHref)
485
485
  ).join("");
486
- return fixBrowserCompatibilityIssuesInCSS$1(stringifiedRules);
486
+ return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
487
487
  } catch (error) {
488
488
  return null;
489
489
  }
490
490
  }
491
- function stringifyRule$1(rule2, sheetHref) {
492
- if (isCSSImportRule$1(rule2)) {
491
+ function stringifyRule(rule2, sheetHref) {
492
+ if (isCSSImportRule(rule2)) {
493
493
  let importStringified;
494
494
  try {
495
495
  importStringified = // for same-origin stylesheets,
496
496
  // we can access the imported stylesheet rules directly
497
- stringifyStylesheet$1(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
498
- escapeImportStatement$1(rule2);
497
+ stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
498
+ escapeImportStatement(rule2);
499
499
  } catch (error) {
500
500
  importStringified = rule2.cssText;
501
501
  }
502
502
  if (rule2.styleSheet.href) {
503
- return absolutifyURLs$1(importStringified, rule2.styleSheet.href);
503
+ return absolutifyURLs(importStringified, rule2.styleSheet.href);
504
504
  }
505
505
  return importStringified;
506
506
  } else {
507
507
  let ruleStringified = rule2.cssText;
508
- if (isCSSStyleRule$1(rule2) && rule2.selectorText.includes(":")) {
509
- ruleStringified = fixSafariColons$1(ruleStringified);
508
+ if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
509
+ ruleStringified = fixSafariColons(ruleStringified);
510
510
  }
511
511
  if (sheetHref) {
512
- return absolutifyURLs$1(ruleStringified, sheetHref);
512
+ return absolutifyURLs(ruleStringified, sheetHref);
513
513
  }
514
514
  return ruleStringified;
515
515
  }
516
516
  }
517
- function fixSafariColons$1(cssStringified) {
517
+ function fixSafariColons(cssStringified) {
518
518
  const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
519
519
  return cssStringified.replace(regex, "$1\\$2");
520
520
  }
521
- function isCSSImportRule$1(rule2) {
521
+ function isCSSImportRule(rule2) {
522
522
  return "styleSheet" in rule2;
523
523
  }
524
- function isCSSStyleRule$1(rule2) {
524
+ function isCSSStyleRule(rule2) {
525
525
  return "selectorText" in rule2;
526
526
  }
527
527
  class Mirror {
@@ -658,7 +658,7 @@ function extractFileExtension(path, baseURL) {
658
658
  const match = url.pathname.match(regex);
659
659
  return (match == null ? void 0 : match[1]) ?? null;
660
660
  }
661
- function extractOrigin$1(url) {
661
+ function extractOrigin(url) {
662
662
  let origin = "";
663
663
  if (url.indexOf("//") > -1) {
664
664
  origin = url.split("/").slice(0, 3).join("/");
@@ -668,27 +668,27 @@ function extractOrigin$1(url) {
668
668
  origin = origin.split("?")[0];
669
669
  return origin;
670
670
  }
671
- const URL_IN_CSS_REF$1 = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
672
- const URL_PROTOCOL_MATCH$1 = /^(?:[a-z+]+:)?\/\//i;
673
- const URL_WWW_MATCH$1 = /^www\..*/i;
674
- const DATA_URI$1 = /^(data:)([^,]*),(.*)/i;
675
- function absolutifyURLs$1(cssText, href) {
671
+ const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
672
+ const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
673
+ const URL_WWW_MATCH = /^www\..*/i;
674
+ const DATA_URI = /^(data:)([^,]*),(.*)/i;
675
+ function absolutifyURLs(cssText, href) {
676
676
  return (cssText || "").replace(
677
- URL_IN_CSS_REF$1,
677
+ URL_IN_CSS_REF,
678
678
  (origin, quote1, path1, quote2, path2, path3) => {
679
679
  const filePath = path1 || path2 || path3;
680
680
  const maybeQuote = quote1 || quote2 || "";
681
681
  if (!filePath) {
682
682
  return origin;
683
683
  }
684
- if (URL_PROTOCOL_MATCH$1.test(filePath) || URL_WWW_MATCH$1.test(filePath)) {
684
+ if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
685
685
  return `url(${maybeQuote}${filePath}${maybeQuote})`;
686
686
  }
687
- if (DATA_URI$1.test(filePath)) {
687
+ if (DATA_URI.test(filePath)) {
688
688
  return `url(${maybeQuote}${filePath}${maybeQuote})`;
689
689
  }
690
690
  if (filePath[0] === "/") {
691
- return `url(${maybeQuote}${extractOrigin$1(href) + filePath}${maybeQuote})`;
691
+ return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;
692
692
  }
693
693
  const stack = href.split("/");
694
694
  const parts = filePath.split("/");
@@ -811,189 +811,6 @@ function splitCssText(cssText, style, _testNoPxNorm = false) {
811
811
  function markCssSplits(cssText, style) {
812
812
  return splitCssText(cssText, style).join("/* rr_split */");
813
813
  }
814
- const CLEANUP_DEBOUNCE_TIME$1 = 1e3 * 30;
815
- const DATA_ATTRIBUTE_CLONED_NAME$1 = "data-rrweb-link-cloned";
816
- const DISALLOWED_EXTENSIONS$1 = [
817
- // Fonts
818
- "woff",
819
- "woff2",
820
- "ttf",
821
- "otf",
822
- // Embedded OpenType font
823
- "eot",
824
- // Images
825
- "png",
826
- "jpg",
827
- "jpeg",
828
- "gif",
829
- "svg",
830
- "webp",
831
- "ico",
832
- // Scripts
833
- "js",
834
- "mjs",
835
- "ts",
836
- "jsx",
837
- "tsx",
838
- // Data files
839
- "json",
840
- "map",
841
- // Media
842
- "mp4",
843
- "webm",
844
- "ogg",
845
- "mp3",
846
- "wav",
847
- // Archives
848
- "zip",
849
- "rar",
850
- "7z",
851
- "tar",
852
- "gz",
853
- // Documents
854
- "pdf",
855
- "doc",
856
- "docx",
857
- "xls",
858
- "xlsx"
859
- ];
860
- const _AsyncStylesheetManager$1 = class _AsyncStylesheetManager {
861
- constructor() {
862
- __publicField$1(this, "currentHref", null);
863
- __publicField$1(this, "clones", {});
864
- __publicField$1(this, "cleanTimeout", null);
865
- if (_AsyncStylesheetManager.instance) return _AsyncStylesheetManager.instance;
866
- _AsyncStylesheetManager.instance = this;
867
- }
868
- removeCloneNode(href) {
869
- var _a2;
870
- if (!(href in this.clones) || this.clones[href] === void 0) return;
871
- const clone = document.querySelector(
872
- `link[${DATA_ATTRIBUTE_CLONED_NAME$1}="${this.clones[href].cloneNodeAttrId}"]`
873
- );
874
- if (!clone) return;
875
- (_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
876
- }
877
- onLoad(href) {
878
- if (!(href in this.clones) || this.clones[href] === void 0) return;
879
- const styleSheets2 = Array.from(document.styleSheets);
880
- let clonedStyleSheet = null;
881
- for (let i2 = styleSheets2.length - 1; i2 >= 0; i2--) {
882
- if (styleSheets2[i2].href === href) {
883
- clonedStyleSheet = styleSheets2[i2];
884
- break;
885
- }
886
- }
887
- if (!clonedStyleSheet) return this.removeCloneNode(href);
888
- const newCssText = stringifyStylesheet$1(clonedStyleSheet);
889
- this.removeCloneNode(href);
890
- if (!newCssText) return;
891
- this.clones[href].cssText = newCssText;
892
- this.clones[href].loaded = true;
893
- const original = document.querySelector(
894
- `link[${DATA_ATTRIBUTE_CLONED_NAME$1}="source-${this.clones[href].cloneNodeAttrId}"]`
895
- );
896
- if (original) {
897
- original.setAttribute("data-rrweb-mutation", Date.now().toString());
898
- original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME$1);
899
- } else {
900
- this.clones[href].original.setAttribute(
901
- "data-rrweb-mutation",
902
- Date.now().toString()
903
- );
904
- this.clones[href].original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME$1);
905
- }
906
- window.dispatchEvent(
907
- new CustomEvent("__rrweb_custom_event__", {
908
- detail: {
909
- type: 5,
910
- timestamp: Date.now(),
911
- data: {
912
- tag: "async-css-resolution",
913
- requestCssId: this.clones[href].requestCssId,
914
- cssText: this.clones[href].cssText
915
- }
916
- }
917
- })
918
- );
919
- }
920
- onLoadError(href) {
921
- if (!(href in this.clones) || this.clones[href] === void 0) return;
922
- this.removeCloneNode(href);
923
- }
924
- removeAllCloneElements() {
925
- for (const href of Object.keys(this.clones)) {
926
- this.removeCloneNode(href);
927
- }
928
- }
929
- onCleanTimeout() {
930
- asyncStylesheetManager$1.cleanTimeout = null;
931
- asyncStylesheetManager$1.removeAllCloneElements();
932
- }
933
- blowCache() {
934
- this.removeAllCloneElements();
935
- this.clones = {};
936
- }
937
- requestClone({
938
- forElement,
939
- requestCssId
940
- }) {
941
- if (this.currentHref != null && document.location.href !== this.currentHref)
942
- this.blowCache();
943
- this.currentHref = document.location.href;
944
- const href = forElement.href;
945
- if (!href) return;
946
- if (href in this.clones && this.clones[href] !== void 0) return;
947
- if (forElement.getAttribute("crossorigin") === "anonymous") return;
948
- if (forElement.rel !== "stylesheet") {
949
- const last = href.split("/").pop();
950
- if (last && last.includes(".")) {
951
- const [filename] = last.split("?");
952
- const ext = filename.split(".").pop();
953
- if (ext) {
954
- if (DISALLOWED_EXTENSIONS$1.includes(ext.trim().toLowerCase())) return;
955
- }
956
- }
957
- }
958
- const clone = forElement.cloneNode();
959
- const cloneNodeAttrId = Math.random().toString(36).slice(2);
960
- clone.setAttribute("crossorigin", "anonymous");
961
- clone.setAttribute(DATA_ATTRIBUTE_CLONED_NAME$1, cloneNodeAttrId);
962
- forElement.setAttribute(
963
- DATA_ATTRIBUTE_CLONED_NAME$1,
964
- `source-${cloneNodeAttrId}`
965
- );
966
- document.head.appendChild(clone);
967
- this.clones[href] = {
968
- original: forElement,
969
- clone,
970
- loaded: false,
971
- cssText: null,
972
- cloneNodeAttrId,
973
- requestCssId
974
- };
975
- clone.onload = () => {
976
- this.onLoad(href);
977
- };
978
- clone.onerror = () => {
979
- this.onLoadError(href);
980
- };
981
- if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
982
- this.cleanTimeout = setTimeout(
983
- asyncStylesheetManager$1.onCleanTimeout,
984
- CLEANUP_DEBOUNCE_TIME$1
985
- );
986
- }
987
- getClonedCssTextIfAvailable(href) {
988
- if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
989
- return this.clones[href].cssText;
990
- }
991
- return null;
992
- }
993
- };
994
- __publicField$1(_AsyncStylesheetManager$1, "instance");
995
- let AsyncStylesheetManager$1 = _AsyncStylesheetManager$1;
996
- const asyncStylesheetManager$1 = new AsyncStylesheetManager$1();
997
814
  let _id = 1;
998
815
  const tagNameRegex = new RegExp("[^a-z0-9-_:]");
999
816
  const IGNORED_NODE = -2;
@@ -1105,7 +922,7 @@ function transformAttribute(doc, tagName, name, value) {
1105
922
  } else if (name === "srcset") {
1106
923
  return getAbsoluteSrcsetString(doc, value);
1107
924
  } else if (name === "style") {
1108
- return absolutifyURLs$1(value, getHref(doc));
925
+ return absolutifyURLs(value, getHref(doc));
1109
926
  } else if (tagName === "object" && name === "data") {
1110
927
  return absoluteToDoc(doc, value);
1111
928
  }
@@ -1342,7 +1159,7 @@ function serializeTextNode(n2, options) {
1342
1159
  } else if (!cssCaptured) {
1343
1160
  textContent2 = index.textContent(n2);
1344
1161
  if (isStyle && textContent2) {
1345
- textContent2 = absolutifyURLs$1(textContent2, getHref(options.doc));
1162
+ textContent2 = absolutifyURLs(textContent2, getHref(options.doc));
1346
1163
  }
1347
1164
  }
1348
1165
  if (!isStyle && !isScript && textContent2 && needsMask) {
@@ -1385,38 +1202,21 @@ function serializeElementNode(n2, options) {
1385
1202
  }
1386
1203
  }
1387
1204
  if (tagName === "link" && inlineStylesheet) {
1388
- const styleSheets2 = Array.from(doc.styleSheets);
1389
- let stylesheet = null;
1390
- for (let i2 = 0; i2 < styleSheets2.length; i2++) {
1391
- if (styleSheets2[i2].href === n2.href) {
1392
- stylesheet = styleSheets2[i2];
1393
- break;
1394
- }
1395
- }
1205
+ const stylesheet = Array.from(doc.styleSheets).find((s2) => {
1206
+ return s2.href === n2.href;
1207
+ });
1396
1208
  let cssText = null;
1397
1209
  if (stylesheet) {
1398
- cssText = stringifyStylesheet$1(stylesheet);
1399
- }
1400
- if (!cssText) {
1401
- cssText = asyncStylesheetManager$1.getClonedCssTextIfAvailable(
1402
- n2.href
1403
- );
1210
+ cssText = stringifyStylesheet(stylesheet);
1404
1211
  }
1405
1212
  if (cssText) {
1406
1213
  delete attributes.rel;
1407
1214
  delete attributes.href;
1408
1215
  attributes._cssText = cssText;
1409
- } else {
1410
- const requestCssId = `css-request-${Math.random().toString(36).slice(2)}`;
1411
- asyncStylesheetManager$1.requestClone({
1412
- forElement: n2,
1413
- requestCssId
1414
- });
1415
- attributes._requestCssId = requestCssId;
1416
1216
  }
1417
1217
  }
1418
1218
  if (tagName === "style" && n2.sheet) {
1419
- let cssText = stringifyStylesheet$1(
1219
+ let cssText = stringifyStylesheet(
1420
1220
  n2.sheet
1421
1221
  );
1422
1222
  if (cssText) {
@@ -1489,17 +1289,18 @@ function serializeElementNode(n2, options) {
1489
1289
  canvasService = doc.createElement("canvas");
1490
1290
  canvasCtx = canvasService.getContext("2d");
1491
1291
  }
1492
- let image = n2.cloneNode(true);
1292
+ let image = n2;
1493
1293
  const imageSrc = image.currentSrc || image.getAttribute("src") || "<unknown-src>";
1294
+ const imageHeight = image.naturalHeight;
1295
+ const imageWidth = image.naturalWidth;
1494
1296
  const inlineImageCleanup = () => {
1495
1297
  image = null;
1496
1298
  };
1497
1299
  const recordInlineImage = () => {
1498
- image.removeEventListener("load", recordInlineImage);
1499
1300
  image.removeEventListener("error", onImageLoadError);
1500
1301
  try {
1501
- canvasService.width = image.naturalWidth;
1502
- canvasService.height = image.naturalHeight;
1302
+ canvasService.width = imageWidth;
1303
+ canvasService.height = imageHeight;
1503
1304
  canvasCtx.drawImage(image, 0, 0);
1504
1305
  attributes.rr_dataURL = canvasService.toDataURL(
1505
1306
  dataURLOptions.type,
@@ -1507,12 +1308,16 @@ function serializeElementNode(n2, options) {
1507
1308
  );
1508
1309
  } catch (err) {
1509
1310
  if (image.crossOrigin !== "anonymous") {
1311
+ image = new Image();
1312
+ image.src = imageSrc;
1510
1313
  image.crossOrigin = "anonymous";
1511
- if (image.complete && image.naturalWidth !== 0)
1314
+ image.height = imageHeight;
1315
+ image.width = imageWidth;
1316
+ if (image.complete && image.naturalWidth !== 0) {
1512
1317
  recordInlineImage();
1513
- else {
1514
- image.addEventListener("load", recordInlineImage);
1515
- image.addEventListener("error", onImageLoadError);
1318
+ } else {
1319
+ image.addEventListener("load", recordInlineImage, { once: true });
1320
+ image.addEventListener("error", onImageLoadError, { once: true });
1516
1321
  }
1517
1322
  return;
1518
1323
  } else {
@@ -1525,13 +1330,12 @@ function serializeElementNode(n2, options) {
1525
1330
  };
1526
1331
  const onImageLoadError = () => {
1527
1332
  image.removeEventListener("load", recordInlineImage);
1528
- image.removeEventListener("error", onImageLoadError);
1529
1333
  inlineImageCleanup();
1530
1334
  };
1531
1335
  if (image.complete && image.naturalWidth !== 0) recordInlineImage();
1532
1336
  else {
1533
- image.addEventListener("load", recordInlineImage);
1534
- image.addEventListener("error", onImageLoadError);
1337
+ image.addEventListener("load", recordInlineImage, { once: true });
1338
+ image.addEventListener("error", onImageLoadError, { once: true });
1535
1339
  }
1536
1340
  }
1537
1341
  if (tagName === "audio" || tagName === "video") {
@@ -2544,7 +2348,7 @@ let Node$4$1 = class Node2 {
2544
2348
  let index2 = this.parent.index(this);
2545
2349
  return this.parent.nodes[index2 + 1];
2546
2350
  }
2547
- positionBy(opts = {}) {
2351
+ positionBy(opts) {
2548
2352
  let pos = this.source.start;
2549
2353
  if (opts.index) {
2550
2354
  pos = this.positionInside(opts.index);
@@ -2573,38 +2377,27 @@ let Node$4$1 = class Node2 {
2573
2377
  column += 1;
2574
2378
  }
2575
2379
  }
2576
- return { column, line, offset: end };
2380
+ return { column, line };
2577
2381
  }
2578
2382
  prev() {
2579
2383
  if (!this.parent) return void 0;
2580
2384
  let index2 = this.parent.index(this);
2581
2385
  return this.parent.nodes[index2 - 1];
2582
2386
  }
2583
- rangeBy(opts = {}) {
2584
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2387
+ rangeBy(opts) {
2585
2388
  let start = {
2586
2389
  column: this.source.start.column,
2587
- line: this.source.start.line,
2588
- offset: sourceOffset$1(inputString, this.source.start)
2390
+ line: this.source.start.line
2589
2391
  };
2590
2392
  let end = this.source.end ? {
2591
2393
  column: this.source.end.column + 1,
2592
- line: this.source.end.line,
2593
- offset: typeof this.source.end.offset === "number" ? (
2594
- // `source.end.offset` is exclusive, so we don't need to add 1
2595
- this.source.end.offset
2596
- ) : (
2597
- // Since line/column in this.source.end is inclusive,
2598
- // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
2599
- // So, we add 1 to convert it to exclusive.
2600
- sourceOffset$1(inputString, this.source.end) + 1
2601
- )
2394
+ line: this.source.end.line
2602
2395
  } : {
2603
2396
  column: start.column + 1,
2604
- line: start.line,
2605
- offset: start.offset + 1
2397
+ line: start.line
2606
2398
  };
2607
2399
  if (opts.word) {
2400
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
2608
2401
  let stringRepresentation = inputString.slice(
2609
2402
  sourceOffset$1(inputString, this.source.start),
2610
2403
  sourceOffset$1(inputString, this.source.end)
@@ -2612,14 +2405,15 @@ let Node$4$1 = class Node2 {
2612
2405
  let index2 = stringRepresentation.indexOf(opts.word);
2613
2406
  if (index2 !== -1) {
2614
2407
  start = this.positionInside(index2);
2615
- end = this.positionInside(index2 + opts.word.length);
2408
+ end = this.positionInside(
2409
+ index2 + opts.word.length
2410
+ );
2616
2411
  }
2617
2412
  } else {
2618
2413
  if (opts.start) {
2619
2414
  start = {
2620
2415
  column: opts.start.column,
2621
- line: opts.start.line,
2622
- offset: sourceOffset$1(inputString, opts.start)
2416
+ line: opts.start.line
2623
2417
  };
2624
2418
  } else if (opts.index) {
2625
2419
  start = this.positionInside(opts.index);
@@ -2627,8 +2421,7 @@ let Node$4$1 = class Node2 {
2627
2421
  if (opts.end) {
2628
2422
  end = {
2629
2423
  column: opts.end.column,
2630
- line: opts.end.line,
2631
- offset: sourceOffset$1(inputString, opts.end)
2424
+ line: opts.end.line
2632
2425
  };
2633
2426
  } else if (typeof opts.endIndex === "number") {
2634
2427
  end = this.positionInside(opts.endIndex);
@@ -2637,11 +2430,7 @@ let Node$4$1 = class Node2 {
2637
2430
  }
2638
2431
  }
2639
2432
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
2640
- end = {
2641
- column: start.column + 1,
2642
- line: start.line,
2643
- offset: start.offset + 1
2644
- };
2433
+ end = { column: start.column + 1, line: start.line };
2645
2434
  }
2646
2435
  return { end, start };
2647
2436
  }
@@ -2705,7 +2494,6 @@ let Node$4$1 = class Node2 {
2705
2494
  } else if (typeof value === "object" && value.toJSON) {
2706
2495
  fixed[name] = value.toJSON(null, inputs);
2707
2496
  } else if (name === "source") {
2708
- if (value == null) continue;
2709
2497
  let inputId = inputs.get(value.input);
2710
2498
  if (inputId == null) {
2711
2499
  inputId = inputsNextIndex;
@@ -2740,7 +2528,7 @@ let Node$4$1 = class Node2 {
2740
2528
  });
2741
2529
  return result2;
2742
2530
  }
2743
- warn(result2, text, opts = {}) {
2531
+ warn(result2, text, opts) {
2744
2532
  let data = { node: this };
2745
2533
  for (let i2 in opts) data[i2] = opts[i2];
2746
2534
  return result2.warn(text, data);
@@ -3317,21 +3105,9 @@ let { fileURLToPath: fileURLToPath$1, pathToFileURL: pathToFileURL$1$1 } = requi
3317
3105
  let CssSyntaxError$1$1 = cssSyntaxError$1;
3318
3106
  let PreviousMap$1$1 = previousMap$1;
3319
3107
  let terminalHighlight$2 = require$$2$1;
3320
- let lineToIndexCache$1 = Symbol("lineToIndexCache");
3108
+ let fromOffsetCache$1 = Symbol("fromOffsetCache");
3321
3109
  let sourceMapAvailable$1$1 = Boolean(SourceMapConsumer$1$1 && SourceMapGenerator$1$1);
3322
3110
  let pathAvailable$1$1 = Boolean(resolve$1$1 && isAbsolute$1);
3323
- function getLineToIndex$1(input2) {
3324
- if (input2[lineToIndexCache$1]) return input2[lineToIndexCache$1];
3325
- let lines = input2.css.split("\n");
3326
- let lineToIndex = new Array(lines.length);
3327
- let prevIndex = 0;
3328
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
3329
- lineToIndex[i2] = prevIndex;
3330
- prevIndex += lines[i2].length + 1;
3331
- }
3332
- input2[lineToIndexCache$1] = lineToIndex;
3333
- return lineToIndex;
3334
- }
3335
3111
  let Input$4$1 = class Input {
3336
3112
  get from() {
3337
3113
  return this.file || this.id;
@@ -3370,37 +3146,30 @@ let Input$4$1 = class Input {
3370
3146
  if (this.map) this.map.file = this.from;
3371
3147
  }
3372
3148
  error(message, line, column, opts = {}) {
3373
- let endColumn, endLine, endOffset, offset, result2;
3149
+ let endColumn, endLine, result2;
3374
3150
  if (line && typeof line === "object") {
3375
3151
  let start = line;
3376
3152
  let end = column;
3377
3153
  if (typeof start.offset === "number") {
3378
- offset = start.offset;
3379
- let pos = this.fromOffset(offset);
3154
+ let pos = this.fromOffset(start.offset);
3380
3155
  line = pos.line;
3381
3156
  column = pos.col;
3382
3157
  } else {
3383
3158
  line = start.line;
3384
3159
  column = start.column;
3385
- offset = this.fromLineAndColumn(line, column);
3386
3160
  }
3387
3161
  if (typeof end.offset === "number") {
3388
- endOffset = end.offset;
3389
- let pos = this.fromOffset(endOffset);
3162
+ let pos = this.fromOffset(end.offset);
3390
3163
  endLine = pos.line;
3391
3164
  endColumn = pos.col;
3392
3165
  } else {
3393
3166
  endLine = end.line;
3394
3167
  endColumn = end.column;
3395
- endOffset = this.fromLineAndColumn(end.line, end.column);
3396
3168
  }
3397
3169
  } else if (!column) {
3398
- offset = line;
3399
- let pos = this.fromOffset(offset);
3170
+ let pos = this.fromOffset(line);
3400
3171
  line = pos.line;
3401
3172
  column = pos.col;
3402
- } else {
3403
- offset = this.fromLineAndColumn(line, column);
3404
3173
  }
3405
3174
  let origin = this.origin(line, column, endLine, endColumn);
3406
3175
  if (origin) {
@@ -3422,7 +3191,7 @@ let Input$4$1 = class Input {
3422
3191
  opts.plugin
3423
3192
  );
3424
3193
  }
3425
- result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
3194
+ result2.input = { column, endColumn, endLine, line, source: this.css };
3426
3195
  if (this.file) {
3427
3196
  if (pathToFileURL$1$1) {
3428
3197
  result2.input.url = pathToFileURL$1$1(this.file).toString();
@@ -3431,14 +3200,21 @@ let Input$4$1 = class Input {
3431
3200
  }
3432
3201
  return result2;
3433
3202
  }
3434
- fromLineAndColumn(line, column) {
3435
- let lineToIndex = getLineToIndex$1(this);
3436
- let index2 = lineToIndex[line - 1];
3437
- return index2 + column - 1;
3438
- }
3439
3203
  fromOffset(offset) {
3440
- let lineToIndex = getLineToIndex$1(this);
3441
- let lastLine = lineToIndex[lineToIndex.length - 1];
3204
+ let lastLine, lineToIndex;
3205
+ if (!this[fromOffsetCache$1]) {
3206
+ let lines = this.css.split("\n");
3207
+ lineToIndex = new Array(lines.length);
3208
+ let prevIndex = 0;
3209
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
3210
+ lineToIndex[i2] = prevIndex;
3211
+ prevIndex += lines[i2].length + 1;
3212
+ }
3213
+ this[fromOffsetCache$1] = lineToIndex;
3214
+ } else {
3215
+ lineToIndex = this[fromOffsetCache$1];
3216
+ }
3217
+ lastLine = lineToIndex[lineToIndex.length - 1];
3442
3218
  let min = 0;
3443
3219
  if (offset >= lastLine) {
3444
3220
  min = lineToIndex.length - 1;
@@ -4800,7 +4576,7 @@ let Result$3$1 = class Result {
4800
4576
  this.messages = [];
4801
4577
  this.root = root2;
4802
4578
  this.opts = opts;
4803
- this.css = "";
4579
+ this.css = void 0;
4804
4580
  this.map = void 0;
4805
4581
  }
4806
4582
  toString() {
@@ -5412,7 +5188,7 @@ let NoWorkResult2$1 = noWorkResult$1;
5412
5188
  let Root$1$1 = root$1;
5413
5189
  let Processor$1$1 = class Processor {
5414
5190
  constructor(plugins = []) {
5415
- this.version = "8.5.4";
5191
+ this.version = "8.5.3";
5416
5192
  this.plugins = this.normalize(plugins);
5417
5193
  }
5418
5194
  normalize(plugins) {
@@ -5566,321 +5342,6 @@ postcss$1$1.Node;
5566
5342
  var __defProp2 = Object.defineProperty;
5567
5343
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5568
5344
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
5569
- var __defProp22 = Object.defineProperty;
5570
- var __defNormalProp22 = (obj, key, value) => key in obj ? __defProp22(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
5571
- var __publicField22 = (obj, key, value) => __defNormalProp22(obj, typeof key !== "symbol" ? key + "" : key, value);
5572
- function fixBrowserCompatibilityIssuesInCSS(cssText) {
5573
- if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
5574
- cssText = cssText.replace(
5575
- /\sbackground-clip:\s*text;/g,
5576
- " -webkit-background-clip: text; background-clip: text;"
5577
- );
5578
- }
5579
- return cssText;
5580
- }
5581
- function escapeImportStatement(rule2) {
5582
- const { cssText } = rule2;
5583
- if (cssText.split('"').length < 3) return cssText;
5584
- const statement = ["@import", `url(${JSON.stringify(rule2.href)})`];
5585
- if (rule2.layerName === "") {
5586
- statement.push(`layer`);
5587
- } else if (rule2.layerName) {
5588
- statement.push(`layer(${rule2.layerName})`);
5589
- }
5590
- if (rule2.supportsText) {
5591
- statement.push(`supports(${rule2.supportsText})`);
5592
- }
5593
- if (rule2.media.length) {
5594
- statement.push(rule2.media.mediaText);
5595
- }
5596
- return statement.join(" ") + ";";
5597
- }
5598
- function stringifyStylesheet(s2) {
5599
- try {
5600
- const rules2 = s2.rules || s2.cssRules;
5601
- if (!rules2) {
5602
- return null;
5603
- }
5604
- let sheetHref = s2.href;
5605
- if (!sheetHref && s2.ownerNode && s2.ownerNode.ownerDocument) {
5606
- sheetHref = s2.ownerNode.ownerDocument.location.href;
5607
- }
5608
- const stringifiedRules = Array.from(
5609
- rules2,
5610
- (rule2) => stringifyRule(rule2, sheetHref)
5611
- ).join("");
5612
- return fixBrowserCompatibilityIssuesInCSS(stringifiedRules);
5613
- } catch (error) {
5614
- return null;
5615
- }
5616
- }
5617
- function stringifyRule(rule2, sheetHref) {
5618
- if (isCSSImportRule(rule2)) {
5619
- let importStringified;
5620
- try {
5621
- importStringified = // for same-origin stylesheets,
5622
- // we can access the imported stylesheet rules directly
5623
- stringifyStylesheet(rule2.styleSheet) || // work around browser issues with the raw string `@import url(...)` statement
5624
- escapeImportStatement(rule2);
5625
- } catch (error) {
5626
- importStringified = rule2.cssText;
5627
- }
5628
- if (rule2.styleSheet.href) {
5629
- return absolutifyURLs(importStringified, rule2.styleSheet.href);
5630
- }
5631
- return importStringified;
5632
- } else {
5633
- let ruleStringified = rule2.cssText;
5634
- if (isCSSStyleRule(rule2) && rule2.selectorText.includes(":")) {
5635
- ruleStringified = fixSafariColons(ruleStringified);
5636
- }
5637
- if (sheetHref) {
5638
- return absolutifyURLs(ruleStringified, sheetHref);
5639
- }
5640
- return ruleStringified;
5641
- }
5642
- }
5643
- function fixSafariColons(cssStringified) {
5644
- const regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
5645
- return cssStringified.replace(regex, "$1\\$2");
5646
- }
5647
- function isCSSImportRule(rule2) {
5648
- return "styleSheet" in rule2;
5649
- }
5650
- function isCSSStyleRule(rule2) {
5651
- return "selectorText" in rule2;
5652
- }
5653
- function extractOrigin(url) {
5654
- let origin = "";
5655
- if (url.indexOf("//") > -1) {
5656
- origin = url.split("/").slice(0, 3).join("/");
5657
- } else {
5658
- origin = url.split("/")[0];
5659
- }
5660
- origin = origin.split("?")[0];
5661
- return origin;
5662
- }
5663
- const URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm;
5664
- const URL_PROTOCOL_MATCH = /^(?:[a-z+]+:)?\/\//i;
5665
- const URL_WWW_MATCH = /^www\..*/i;
5666
- const DATA_URI = /^(data:)([^,]*),(.*)/i;
5667
- function absolutifyURLs(cssText, href) {
5668
- return (cssText || "").replace(
5669
- URL_IN_CSS_REF,
5670
- (origin, quote1, path1, quote2, path2, path3) => {
5671
- const filePath = path1 || path2 || path3;
5672
- const maybeQuote = quote1 || quote2 || "";
5673
- if (!filePath) {
5674
- return origin;
5675
- }
5676
- if (URL_PROTOCOL_MATCH.test(filePath) || URL_WWW_MATCH.test(filePath)) {
5677
- return `url(${maybeQuote}${filePath}${maybeQuote})`;
5678
- }
5679
- if (DATA_URI.test(filePath)) {
5680
- return `url(${maybeQuote}${filePath}${maybeQuote})`;
5681
- }
5682
- if (filePath[0] === "/") {
5683
- return `url(${maybeQuote}${extractOrigin(href) + filePath}${maybeQuote})`;
5684
- }
5685
- const stack = href.split("/");
5686
- const parts = filePath.split("/");
5687
- stack.pop();
5688
- for (const part of parts) {
5689
- if (part === ".") {
5690
- continue;
5691
- } else if (part === "..") {
5692
- stack.pop();
5693
- } else {
5694
- stack.push(part);
5695
- }
5696
- }
5697
- return `url(${maybeQuote}${stack.join("/")}${maybeQuote})`;
5698
- }
5699
- );
5700
- }
5701
- const CLEANUP_DEBOUNCE_TIME = 1e3 * 30;
5702
- const DATA_ATTRIBUTE_CLONED_NAME = "data-rrweb-link-cloned";
5703
- const DISALLOWED_EXTENSIONS = [
5704
- // Fonts
5705
- "woff",
5706
- "woff2",
5707
- "ttf",
5708
- "otf",
5709
- // Embedded OpenType font
5710
- "eot",
5711
- // Images
5712
- "png",
5713
- "jpg",
5714
- "jpeg",
5715
- "gif",
5716
- "svg",
5717
- "webp",
5718
- "ico",
5719
- // Scripts
5720
- "js",
5721
- "mjs",
5722
- "ts",
5723
- "jsx",
5724
- "tsx",
5725
- // Data files
5726
- "json",
5727
- "map",
5728
- // Media
5729
- "mp4",
5730
- "webm",
5731
- "ogg",
5732
- "mp3",
5733
- "wav",
5734
- // Archives
5735
- "zip",
5736
- "rar",
5737
- "7z",
5738
- "tar",
5739
- "gz",
5740
- // Documents
5741
- "pdf",
5742
- "doc",
5743
- "docx",
5744
- "xls",
5745
- "xlsx"
5746
- ];
5747
- const _AsyncStylesheetManager2 = class _AsyncStylesheetManager22 {
5748
- constructor() {
5749
- __publicField22(this, "currentHref", null);
5750
- __publicField22(this, "clones", {});
5751
- __publicField22(this, "cleanTimeout", null);
5752
- if (_AsyncStylesheetManager22.instance) return _AsyncStylesheetManager22.instance;
5753
- _AsyncStylesheetManager22.instance = this;
5754
- }
5755
- removeCloneNode(href) {
5756
- var _a2;
5757
- if (!(href in this.clones) || this.clones[href] === void 0) return;
5758
- const clone = document.querySelector(
5759
- `link[${DATA_ATTRIBUTE_CLONED_NAME}="${this.clones[href].cloneNodeAttrId}"]`
5760
- );
5761
- if (!clone) return;
5762
- (_a2 = clone.parentNode) == null ? void 0 : _a2.removeChild(clone);
5763
- }
5764
- onLoad(href) {
5765
- if (!(href in this.clones) || this.clones[href] === void 0) return;
5766
- const styleSheets2 = Array.from(document.styleSheets);
5767
- let clonedStyleSheet = null;
5768
- for (let i2 = styleSheets2.length - 1; i2 >= 0; i2--) {
5769
- if (styleSheets2[i2].href === href) {
5770
- clonedStyleSheet = styleSheets2[i2];
5771
- break;
5772
- }
5773
- }
5774
- if (!clonedStyleSheet) return this.removeCloneNode(href);
5775
- const newCssText = stringifyStylesheet(clonedStyleSheet);
5776
- this.removeCloneNode(href);
5777
- if (!newCssText) return;
5778
- this.clones[href].cssText = newCssText;
5779
- this.clones[href].loaded = true;
5780
- const original = document.querySelector(
5781
- `link[${DATA_ATTRIBUTE_CLONED_NAME}="source-${this.clones[href].cloneNodeAttrId}"]`
5782
- );
5783
- if (original) {
5784
- original.setAttribute("data-rrweb-mutation", Date.now().toString());
5785
- original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME);
5786
- } else {
5787
- this.clones[href].original.setAttribute(
5788
- "data-rrweb-mutation",
5789
- Date.now().toString()
5790
- );
5791
- this.clones[href].original.removeAttribute(DATA_ATTRIBUTE_CLONED_NAME);
5792
- }
5793
- window.dispatchEvent(
5794
- new CustomEvent("__rrweb_custom_event__", {
5795
- detail: {
5796
- type: 5,
5797
- timestamp: Date.now(),
5798
- data: {
5799
- tag: "async-css-resolution",
5800
- requestCssId: this.clones[href].requestCssId,
5801
- cssText: this.clones[href].cssText
5802
- }
5803
- }
5804
- })
5805
- );
5806
- }
5807
- onLoadError(href) {
5808
- if (!(href in this.clones) || this.clones[href] === void 0) return;
5809
- this.removeCloneNode(href);
5810
- }
5811
- removeAllCloneElements() {
5812
- for (const href of Object.keys(this.clones)) {
5813
- this.removeCloneNode(href);
5814
- }
5815
- }
5816
- onCleanTimeout() {
5817
- asyncStylesheetManager.cleanTimeout = null;
5818
- asyncStylesheetManager.removeAllCloneElements();
5819
- }
5820
- blowCache() {
5821
- this.removeAllCloneElements();
5822
- this.clones = {};
5823
- }
5824
- requestClone({
5825
- forElement,
5826
- requestCssId
5827
- }) {
5828
- if (this.currentHref != null && document.location.href !== this.currentHref)
5829
- this.blowCache();
5830
- this.currentHref = document.location.href;
5831
- const href = forElement.href;
5832
- if (!href) return;
5833
- if (href in this.clones && this.clones[href] !== void 0) return;
5834
- if (forElement.getAttribute("crossorigin") === "anonymous") return;
5835
- if (forElement.rel !== "stylesheet") {
5836
- const last = href.split("/").pop();
5837
- if (last && last.includes(".")) {
5838
- const [filename] = last.split("?");
5839
- const ext = filename.split(".").pop();
5840
- if (ext) {
5841
- if (DISALLOWED_EXTENSIONS.includes(ext.trim().toLowerCase())) return;
5842
- }
5843
- }
5844
- }
5845
- const clone = forElement.cloneNode();
5846
- const cloneNodeAttrId = Math.random().toString(36).slice(2);
5847
- clone.setAttribute("crossorigin", "anonymous");
5848
- clone.setAttribute(DATA_ATTRIBUTE_CLONED_NAME, cloneNodeAttrId);
5849
- forElement.setAttribute(
5850
- DATA_ATTRIBUTE_CLONED_NAME,
5851
- `source-${cloneNodeAttrId}`
5852
- );
5853
- document.head.appendChild(clone);
5854
- this.clones[href] = {
5855
- original: forElement,
5856
- clone,
5857
- loaded: false,
5858
- cssText: null,
5859
- cloneNodeAttrId,
5860
- requestCssId
5861
- };
5862
- clone.onload = () => {
5863
- this.onLoad(href);
5864
- };
5865
- clone.onerror = () => {
5866
- this.onLoadError(href);
5867
- };
5868
- if (this.cleanTimeout) clearTimeout(this.cleanTimeout);
5869
- this.cleanTimeout = setTimeout(
5870
- asyncStylesheetManager.onCleanTimeout,
5871
- CLEANUP_DEBOUNCE_TIME
5872
- );
5873
- }
5874
- getClonedCssTextIfAvailable(href) {
5875
- if (href in this.clones && this.clones[href] !== void 0 && this.clones[href].loaded === true) {
5876
- return this.clones[href].cssText;
5877
- }
5878
- return null;
5879
- }
5880
- };
5881
- __publicField22(_AsyncStylesheetManager2, "instance");
5882
- let AsyncStylesheetManager = _AsyncStylesheetManager2;
5883
- const asyncStylesheetManager = new AsyncStylesheetManager();
5884
5345
  function getDefaultExportFromCjs(x2) {
5885
5346
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
5886
5347
  }
@@ -6488,7 +5949,7 @@ let Node$4 = class Node3 {
6488
5949
  let index2 = this.parent.index(this);
6489
5950
  return this.parent.nodes[index2 + 1];
6490
5951
  }
6491
- positionBy(opts = {}) {
5952
+ positionBy(opts) {
6492
5953
  let pos = this.source.start;
6493
5954
  if (opts.index) {
6494
5955
  pos = this.positionInside(opts.index);
@@ -6517,38 +5978,27 @@ let Node$4 = class Node3 {
6517
5978
  column += 1;
6518
5979
  }
6519
5980
  }
6520
- return { column, line, offset: end };
5981
+ return { column, line };
6521
5982
  }
6522
5983
  prev() {
6523
5984
  if (!this.parent) return void 0;
6524
5985
  let index2 = this.parent.index(this);
6525
5986
  return this.parent.nodes[index2 - 1];
6526
5987
  }
6527
- rangeBy(opts = {}) {
6528
- let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
5988
+ rangeBy(opts) {
6529
5989
  let start = {
6530
5990
  column: this.source.start.column,
6531
- line: this.source.start.line,
6532
- offset: sourceOffset(inputString, this.source.start)
5991
+ line: this.source.start.line
6533
5992
  };
6534
5993
  let end = this.source.end ? {
6535
5994
  column: this.source.end.column + 1,
6536
- line: this.source.end.line,
6537
- offset: typeof this.source.end.offset === "number" ? (
6538
- // `source.end.offset` is exclusive, so we don't need to add 1
6539
- this.source.end.offset
6540
- ) : (
6541
- // Since line/column in this.source.end is inclusive,
6542
- // the `sourceOffset(... , this.source.end)` returns an inclusive offset.
6543
- // So, we add 1 to convert it to exclusive.
6544
- sourceOffset(inputString, this.source.end) + 1
6545
- )
5995
+ line: this.source.end.line
6546
5996
  } : {
6547
5997
  column: start.column + 1,
6548
- line: start.line,
6549
- offset: start.offset + 1
5998
+ line: start.line
6550
5999
  };
6551
6000
  if (opts.word) {
6001
+ let inputString = "document" in this.source.input ? this.source.input.document : this.source.input.css;
6552
6002
  let stringRepresentation = inputString.slice(
6553
6003
  sourceOffset(inputString, this.source.start),
6554
6004
  sourceOffset(inputString, this.source.end)
@@ -6556,14 +6006,15 @@ let Node$4 = class Node3 {
6556
6006
  let index2 = stringRepresentation.indexOf(opts.word);
6557
6007
  if (index2 !== -1) {
6558
6008
  start = this.positionInside(index2);
6559
- end = this.positionInside(index2 + opts.word.length);
6009
+ end = this.positionInside(
6010
+ index2 + opts.word.length
6011
+ );
6560
6012
  }
6561
6013
  } else {
6562
6014
  if (opts.start) {
6563
6015
  start = {
6564
6016
  column: opts.start.column,
6565
- line: opts.start.line,
6566
- offset: sourceOffset(inputString, opts.start)
6017
+ line: opts.start.line
6567
6018
  };
6568
6019
  } else if (opts.index) {
6569
6020
  start = this.positionInside(opts.index);
@@ -6571,8 +6022,7 @@ let Node$4 = class Node3 {
6571
6022
  if (opts.end) {
6572
6023
  end = {
6573
6024
  column: opts.end.column,
6574
- line: opts.end.line,
6575
- offset: sourceOffset(inputString, opts.end)
6025
+ line: opts.end.line
6576
6026
  };
6577
6027
  } else if (typeof opts.endIndex === "number") {
6578
6028
  end = this.positionInside(opts.endIndex);
@@ -6581,11 +6031,7 @@ let Node$4 = class Node3 {
6581
6031
  }
6582
6032
  }
6583
6033
  if (end.line < start.line || end.line === start.line && end.column <= start.column) {
6584
- end = {
6585
- column: start.column + 1,
6586
- line: start.line,
6587
- offset: start.offset + 1
6588
- };
6034
+ end = { column: start.column + 1, line: start.line };
6589
6035
  }
6590
6036
  return { end, start };
6591
6037
  }
@@ -6649,7 +6095,6 @@ let Node$4 = class Node3 {
6649
6095
  } else if (typeof value === "object" && value.toJSON) {
6650
6096
  fixed[name] = value.toJSON(null, inputs);
6651
6097
  } else if (name === "source") {
6652
- if (value == null) continue;
6653
6098
  let inputId = inputs.get(value.input);
6654
6099
  if (inputId == null) {
6655
6100
  inputId = inputsNextIndex;
@@ -6684,7 +6129,7 @@ let Node$4 = class Node3 {
6684
6129
  });
6685
6130
  return result2;
6686
6131
  }
6687
- warn(result2, text, opts = {}) {
6132
+ warn(result2, text, opts) {
6688
6133
  let data = { node: this };
6689
6134
  for (let i2 in opts) data[i2] = opts[i2];
6690
6135
  return result2.warn(text, data);
@@ -7261,21 +6706,9 @@ let { fileURLToPath, pathToFileURL: pathToFileURL$1 } = require$$2;
7261
6706
  let CssSyntaxError$1 = cssSyntaxError;
7262
6707
  let PreviousMap$1 = previousMap;
7263
6708
  let terminalHighlight = require$$2;
7264
- let lineToIndexCache = Symbol("lineToIndexCache");
6709
+ let fromOffsetCache = Symbol("fromOffsetCache");
7265
6710
  let sourceMapAvailable$1 = Boolean(SourceMapConsumer$1 && SourceMapGenerator$1);
7266
6711
  let pathAvailable$1 = Boolean(resolve$1 && isAbsolute);
7267
- function getLineToIndex(input2) {
7268
- if (input2[lineToIndexCache]) return input2[lineToIndexCache];
7269
- let lines = input2.css.split("\n");
7270
- let lineToIndex = new Array(lines.length);
7271
- let prevIndex = 0;
7272
- for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
7273
- lineToIndex[i2] = prevIndex;
7274
- prevIndex += lines[i2].length + 1;
7275
- }
7276
- input2[lineToIndexCache] = lineToIndex;
7277
- return lineToIndex;
7278
- }
7279
6712
  let Input$4 = class Input2 {
7280
6713
  get from() {
7281
6714
  return this.file || this.id;
@@ -7314,37 +6747,30 @@ let Input$4 = class Input2 {
7314
6747
  if (this.map) this.map.file = this.from;
7315
6748
  }
7316
6749
  error(message, line, column, opts = {}) {
7317
- let endColumn, endLine, endOffset, offset, result2;
6750
+ let endColumn, endLine, result2;
7318
6751
  if (line && typeof line === "object") {
7319
6752
  let start = line;
7320
6753
  let end = column;
7321
6754
  if (typeof start.offset === "number") {
7322
- offset = start.offset;
7323
- let pos = this.fromOffset(offset);
6755
+ let pos = this.fromOffset(start.offset);
7324
6756
  line = pos.line;
7325
6757
  column = pos.col;
7326
6758
  } else {
7327
6759
  line = start.line;
7328
6760
  column = start.column;
7329
- offset = this.fromLineAndColumn(line, column);
7330
6761
  }
7331
6762
  if (typeof end.offset === "number") {
7332
- endOffset = end.offset;
7333
- let pos = this.fromOffset(endOffset);
6763
+ let pos = this.fromOffset(end.offset);
7334
6764
  endLine = pos.line;
7335
6765
  endColumn = pos.col;
7336
6766
  } else {
7337
6767
  endLine = end.line;
7338
6768
  endColumn = end.column;
7339
- endOffset = this.fromLineAndColumn(end.line, end.column);
7340
6769
  }
7341
6770
  } else if (!column) {
7342
- offset = line;
7343
- let pos = this.fromOffset(offset);
6771
+ let pos = this.fromOffset(line);
7344
6772
  line = pos.line;
7345
6773
  column = pos.col;
7346
- } else {
7347
- offset = this.fromLineAndColumn(line, column);
7348
6774
  }
7349
6775
  let origin = this.origin(line, column, endLine, endColumn);
7350
6776
  if (origin) {
@@ -7366,7 +6792,7 @@ let Input$4 = class Input2 {
7366
6792
  opts.plugin
7367
6793
  );
7368
6794
  }
7369
- result2.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css };
6795
+ result2.input = { column, endColumn, endLine, line, source: this.css };
7370
6796
  if (this.file) {
7371
6797
  if (pathToFileURL$1) {
7372
6798
  result2.input.url = pathToFileURL$1(this.file).toString();
@@ -7375,14 +6801,21 @@ let Input$4 = class Input2 {
7375
6801
  }
7376
6802
  return result2;
7377
6803
  }
7378
- fromLineAndColumn(line, column) {
7379
- let lineToIndex = getLineToIndex(this);
7380
- let index2 = lineToIndex[line - 1];
7381
- return index2 + column - 1;
7382
- }
7383
6804
  fromOffset(offset) {
7384
- let lineToIndex = getLineToIndex(this);
7385
- let lastLine = lineToIndex[lineToIndex.length - 1];
6805
+ let lastLine, lineToIndex;
6806
+ if (!this[fromOffsetCache]) {
6807
+ let lines = this.css.split("\n");
6808
+ lineToIndex = new Array(lines.length);
6809
+ let prevIndex = 0;
6810
+ for (let i2 = 0, l2 = lines.length; i2 < l2; i2++) {
6811
+ lineToIndex[i2] = prevIndex;
6812
+ prevIndex += lines[i2].length + 1;
6813
+ }
6814
+ this[fromOffsetCache] = lineToIndex;
6815
+ } else {
6816
+ lineToIndex = this[fromOffsetCache];
6817
+ }
6818
+ lastLine = lineToIndex[lineToIndex.length - 1];
7386
6819
  let min = 0;
7387
6820
  if (offset >= lastLine) {
7388
6821
  min = lineToIndex.length - 1;
@@ -8744,7 +8177,7 @@ let Result$3 = class Result2 {
8744
8177
  this.messages = [];
8745
8178
  this.root = root2;
8746
8179
  this.opts = opts;
8747
- this.css = "";
8180
+ this.css = void 0;
8748
8181
  this.map = void 0;
8749
8182
  }
8750
8183
  toString() {
@@ -9356,7 +8789,7 @@ let NoWorkResult22 = noWorkResult;
9356
8789
  let Root$1 = root;
9357
8790
  let Processor$1 = class Processor2 {
9358
8791
  constructor(plugins = []) {
9359
- this.version = "8.5.4";
8792
+ this.version = "8.5.3";
9360
8793
  this.plugins = this.normalize(plugins);
9361
8794
  }
9362
8795
  normalize(plugins) {
@@ -12635,7 +12068,7 @@ class StylesheetManager {
12635
12068
  styles.push({
12636
12069
  styleId,
12637
12070
  rules: Array.from(sheet.rules || CSSRule, (r2, index2) => ({
12638
- rule: stringifyRule$1(r2, sheet.href),
12071
+ rule: stringifyRule(r2, sheet.href),
12639
12072
  index: index2
12640
12073
  }))
12641
12074
  });
@@ -13095,26 +12528,12 @@ function record(options = {}) {
13095
12528
  console.warn(error);
13096
12529
  }
13097
12530
  });
13098
- let initedAt = null;
13099
12531
  const init = () => {
13100
- initedAt = Date.now();
13101
12532
  takeFullSnapshot$1();
13102
12533
  handlers.push(observe(document));
13103
12534
  recording = true;
13104
12535
  };
13105
- const customOnLoad = () => {
13106
- window.removeEventListener("load", customOnLoad);
13107
- if (!recording || initedAt == null) return;
13108
- if (Date.now() - initedAt <= 10) {
13109
- return;
13110
- }
13111
- takeFullSnapshot$1();
13112
- };
13113
- window.addEventListener("load", customOnLoad);
13114
12536
  if (document.readyState === "interactive" || document.readyState === "complete") {
13115
- if (document.readyState === "complete") {
13116
- window.removeEventListener("load", customOnLoad);
13117
- }
13118
12537
  init();
13119
12538
  } else {
13120
12539
  handlers.push(
@@ -13123,9 +12542,7 @@ function record(options = {}) {
13123
12542
  type: EventType.DomContentLoaded,
13124
12543
  data: {}
13125
12544
  });
13126
- if (recordAfter === "DOMContentLoaded") {
13127
- init();
13128
- }
12545
+ if (recordAfter === "DOMContentLoaded") init();
13129
12546
  })
13130
12547
  );
13131
12548
  handlers.push(
@@ -13136,9 +12553,7 @@ function record(options = {}) {
13136
12553
  type: EventType.Load,
13137
12554
  data: {}
13138
12555
  });
13139
- if (recordAfter === "load") {
13140
- init();
13141
- }
12556
+ if (recordAfter === "load") init();
13142
12557
  },
13143
12558
  window
13144
12559
  )