@paulirish/trace_engine 0.0.7 → 0.0.8

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/trace.mjs CHANGED
@@ -502,7 +502,7 @@ __export(TraceEvents_exports, {
502
502
  isTraceEventLargestTextPaintCandidate: () => isTraceEventLargestTextPaintCandidate,
503
503
  isTraceEventLayerTreeHostImplSnapshot: () => isTraceEventLayerTreeHostImplSnapshot,
504
504
  isTraceEventLayout: () => isTraceEventLayout,
505
- isTraceEventLayoutInvalidation: () => isTraceEventLayoutInvalidation,
505
+ isTraceEventLayoutInvalidationTracking: () => isTraceEventLayoutInvalidationTracking,
506
506
  isTraceEventLayoutShift: () => isTraceEventLayoutShift,
507
507
  isTraceEventMainFrameViewport: () => isTraceEventMainFrameViewport,
508
508
  isTraceEventMarkDOMContent: () => isTraceEventMarkDOMContent,
@@ -529,9 +529,12 @@ __export(TraceEvents_exports, {
529
529
  isTraceEventResourceReceivedData: () => isTraceEventResourceReceivedData,
530
530
  isTraceEventResourceSendRequest: () => isTraceEventResourceSendRequest,
531
531
  isTraceEventResourceWillSendRequest: () => isTraceEventResourceWillSendRequest,
532
+ isTraceEventScheduleStyleInvalidationTracking: () => isTraceEventScheduleStyleInvalidationTracking,
532
533
  isTraceEventScheduleStyleRecalculation: () => isTraceEventScheduleStyleRecalculation,
533
534
  isTraceEventSetLayerId: () => isTraceEventSetLayerId,
534
- isTraceEventStyleRecalcInvalidation: () => isTraceEventStyleRecalcInvalidation,
535
+ isTraceEventStyleInvalidatorInvalidationTracking: () => isTraceEventStyleInvalidatorInvalidationTracking,
536
+ isTraceEventStyleRecalcInvalidationTracking: () => isTraceEventStyleRecalcInvalidationTracking,
537
+ isTraceEventSyntheticInvalidation: () => isTraceEventSyntheticInvalidation,
535
538
  isTraceEventTimeStamp: () => isTraceEventTimeStamp,
536
539
  isTraceEventTimerFire: () => isTraceEventTimerFire,
537
540
  isTraceEventTimerInstall: () => isTraceEventTimerInstall,
@@ -540,6 +543,7 @@ __export(TraceEvents_exports, {
540
543
  isTraceEventUpdateCounters: () => isTraceEventUpdateCounters,
541
544
  isTraceEventUpdateLayer: () => isTraceEventUpdateLayer,
542
545
  isTraceEventUpdateLayoutTree: () => isTraceEventUpdateLayoutTree,
546
+ isTraceEventV8Compile: () => isTraceEventV8Compile,
543
547
  isTraceEventWebSocketCreate: () => isTraceEventWebSocketCreate,
544
548
  isTraceEventWebSocketDestroy: () => isTraceEventWebSocketDestroy,
545
549
  isTraceEventWebSocketReceiveHandshakeResponse: () => isTraceEventWebSocketReceiveHandshakeResponse,
@@ -614,10 +618,19 @@ var LayoutInvalidationReason = /* @__PURE__ */ ((LayoutInvalidationReason2) => {
614
618
  LayoutInvalidationReason2["UNKNOWN"] = "Unknown";
615
619
  return LayoutInvalidationReason2;
616
620
  })(LayoutInvalidationReason || {});
621
+ function isTraceEventScheduleStyleInvalidationTracking(event) {
622
+ return event.name === KnownEventName.ScheduleStyleInvalidationTracking;
623
+ }
617
624
  var StyleRecalcInvalidationReason = /* @__PURE__ */ ((StyleRecalcInvalidationReason2) => {
618
625
  StyleRecalcInvalidationReason2["ANIMATION"] = "Animation";
619
626
  return StyleRecalcInvalidationReason2;
620
627
  })(StyleRecalcInvalidationReason || {});
628
+ function isTraceEventStyleRecalcInvalidationTracking(event) {
629
+ return event.name === KnownEventName.StyleRecalcInvalidationTracking;
630
+ }
631
+ function isTraceEventStyleInvalidatorInvalidationTracking(event) {
632
+ return event.name === KnownEventName.StyleInvalidatorInvalidationTracking;
633
+ }
621
634
  function isTraceEventScheduleStyleRecalculation(event) {
622
635
  return event.name === KnownEventName.ScheduleStyleRecalculation;
623
636
  }
@@ -660,6 +673,9 @@ function isTraceEventCompositeLayers(event) {
660
673
  function isTraceEventActivateLayerTree(event) {
661
674
  return event.name === KnownEventName.ActivateLayerTree;
662
675
  }
676
+ function isTraceEventSyntheticInvalidation(event) {
677
+ return event.name === "SyntheticInvalidation";
678
+ }
663
679
  function isTraceEventUpdateLayoutTree(event) {
664
680
  return event.name === KnownEventName.UpdateLayoutTree;
665
681
  }
@@ -730,7 +746,7 @@ function isProcessName(traceEventData) {
730
746
  return traceEventData.name === "process_name";
731
747
  }
732
748
  function isTraceEventTracingStartedInBrowser(traceEventData) {
733
- return traceEventData.name === "TracingStartedInBrowser";
749
+ return traceEventData.name === KnownEventName.TracingStartedInBrowser;
734
750
  }
735
751
  function isTraceEventFrameCommittedInBrowser(traceEventData) {
736
752
  return traceEventData.name === "FrameCommittedInBrowser";
@@ -747,11 +763,8 @@ function isTraceEventAnimation(traceEventData) {
747
763
  function isTraceEventLayoutShift(traceEventData) {
748
764
  return traceEventData.name === "LayoutShift";
749
765
  }
750
- function isTraceEventLayoutInvalidation(traceEventData) {
751
- return traceEventData.name === "LayoutInvalidationTracking" || traceEventData.name === "ScheduleStyleInvalidationTracking";
752
- }
753
- function isTraceEventStyleRecalcInvalidation(traceEventData) {
754
- return traceEventData.name === "StyleRecalcInvalidationTracking";
766
+ function isTraceEventLayoutInvalidationTracking(traceEventData) {
767
+ return traceEventData.name === KnownEventName.LayoutInvalidationTracking;
755
768
  }
756
769
  function isTraceEventFirstContentfulPaint(traceEventData) {
757
770
  return traceEventData.name === "firstContentfulPaint";
@@ -835,21 +848,21 @@ function isSyntheticUserTimingTraceEvent(traceEventData) {
835
848
  if (traceEventData.cat !== "blink.user_timing") {
836
849
  return false;
837
850
  }
838
- const data21 = traceEventData.args?.data;
839
- if (!data21) {
851
+ const data22 = traceEventData.args?.data;
852
+ if (!data22) {
840
853
  return false;
841
854
  }
842
- return "beginEvent" in data21 && "endEvent" in data21;
855
+ return "beginEvent" in data22 && "endEvent" in data22;
843
856
  }
844
857
  function isSyntheticConsoleTimingTraceEvent(traceEventData) {
845
858
  if (traceEventData.cat !== "blink.console") {
846
859
  return false;
847
860
  }
848
- const data21 = traceEventData.args?.data;
849
- if (!data21) {
861
+ const data22 = traceEventData.args?.data;
862
+ if (!data22) {
850
863
  return false;
851
864
  }
852
- return "beginEvent" in data21 && "endEvent" in data21;
865
+ return "beginEvent" in data22 && "endEvent" in data22;
853
866
  }
854
867
  function isTraceEventPerformanceMeasure(traceEventData) {
855
868
  return traceEventData.cat === "blink.user_timing" && isTraceEventAsyncPhase(traceEventData);
@@ -932,6 +945,9 @@ function isTraceEventWebSocketDestroy(event) {
932
945
  function isWebSocketTraceEvent(event) {
933
946
  return isTraceEventWebSocketCreate(event) || isTraceEventWebSocketDestroy(event) || isTraceEventWebSocketReceiveHandshakeResponse(event) || isTraceEventWebSocketSendHandshakeRequest(event);
934
947
  }
948
+ function isTraceEventV8Compile(event) {
949
+ return event.name === KnownEventName.Compile;
950
+ }
935
951
  var KnownEventName = /* @__PURE__ */ ((KnownEventName2) => {
936
952
  KnownEventName2["ThreadName"] = "thread_name";
937
953
  KnownEventName2["Program"] = "Program";
@@ -942,9 +958,10 @@ var KnownEventName = /* @__PURE__ */ ((KnownEventName2) => {
942
958
  KnownEventName2["XHRReadyStateChange"] = "XHRReadyStateChange";
943
959
  KnownEventName2["ParseHTML"] = "ParseHTML";
944
960
  KnownEventName2["ParseCSS"] = "ParseAuthorStyleSheet";
945
- KnownEventName2["CompileScript"] = "V8.CompileScript";
946
961
  KnownEventName2["CompileCode"] = "V8.CompileCode";
947
962
  KnownEventName2["CompileModule"] = "V8.CompileModule";
963
+ KnownEventName2["Compile"] = "v8.compile";
964
+ KnownEventName2["CompileScript"] = "V8.CompileScript";
948
965
  KnownEventName2["Optimize"] = "V8.OptimizeCode";
949
966
  KnownEventName2["WasmStreamFromResponseCallback"] = "v8.wasm.streamFromResponseCallback";
950
967
  KnownEventName2["WasmCompiledModule"] = "v8.wasm.compiledModule";
@@ -1066,6 +1083,7 @@ var KnownEventName = /* @__PURE__ */ ((KnownEventName2) => {
1066
1083
  KnownEventName2["EmbedderCallback"] = "EmbedderCallback";
1067
1084
  KnownEventName2["SetLayerTreeId"] = "SetLayerTreeId";
1068
1085
  KnownEventName2["TracingStartedInPage"] = "TracingStartedInPage";
1086
+ KnownEventName2["TracingStartedInBrowser"] = "TracingStartedInBrowser";
1069
1087
  KnownEventName2["TracingSessionIdForWorker"] = "TracingSessionIdForWorker";
1070
1088
  KnownEventName2["LazyPixelRef"] = "LazyPixelRef";
1071
1089
  KnownEventName2["LayerTreeHostImplSnapshot"] = "cc::LayerTreeHostImpl";
@@ -1091,6 +1109,7 @@ __export(Timing_exports3, {
1091
1109
  secondsToMicroseconds: () => secondsToMicroseconds,
1092
1110
  secondsToMilliseconds: () => secondsToMilliseconds,
1093
1111
  timeStampForEventAdjustedByClosestNavigation: () => timeStampForEventAdjustedByClosestNavigation,
1112
+ traceWindowFromMicroSeconds: () => traceWindowFromMicroSeconds,
1094
1113
  traceWindowFromMilliSeconds: () => traceWindowFromMilliSeconds,
1095
1114
  traceWindowMilliSeconds: () => traceWindowMilliSeconds,
1096
1115
  traceWindowMillisecondsToMicroSeconds: () => traceWindowMillisecondsToMicroSeconds
@@ -1109,8 +1128,21 @@ __export(Trace_exports, {
1109
1128
  makeProfileCall: () => makeProfileCall,
1110
1129
  matchBeginningAndEndEvents: () => matchBeginningAndEndEvents,
1111
1130
  mergeEventsInOrder: () => mergeEventsInOrder,
1112
- sortTraceEventsInPlace: () => sortTraceEventsInPlace
1131
+ sortTraceEventsInPlace: () => sortTraceEventsInPlace,
1132
+ stackTraceForEvent: () => stackTraceForEvent
1113
1133
  });
1134
+ function stackTraceForEvent(event) {
1135
+ if (TraceEvents_exports.isTraceEventSyntheticInvalidation(event)) {
1136
+ return event.stackTrace || null;
1137
+ }
1138
+ if (event.args?.data?.stackTrace) {
1139
+ return event.args.data.stackTrace;
1140
+ }
1141
+ if (TraceEvents_exports.isTraceEventUpdateLayoutTree(event)) {
1142
+ return event.args.beginData?.stackTrace || null;
1143
+ }
1144
+ return null;
1145
+ }
1114
1146
  function extractOriginFromTrace(firstNavigationURL) {
1115
1147
  const url = new URL(firstNavigationURL);
1116
1148
  if (url) {
@@ -1410,7 +1442,15 @@ function traceWindowFromMilliSeconds(min, max) {
1410
1442
  const traceWindow = {
1411
1443
  min: millisecondsToMicroseconds(min),
1412
1444
  max: millisecondsToMicroseconds(max),
1413
- range: millisecondsToMicroseconds(Timing_exports2.MilliSeconds(max - min))
1445
+ range: Timing_exports2.MicroSeconds(millisecondsToMicroseconds(max) - millisecondsToMicroseconds(min))
1446
+ };
1447
+ return traceWindow;
1448
+ }
1449
+ function traceWindowFromMicroSeconds(min, max) {
1450
+ const traceWindow = {
1451
+ min,
1452
+ max,
1453
+ range: Timing_exports2.MicroSeconds(max - min)
1414
1454
  };
1415
1455
  return traceWindow;
1416
1456
  }
@@ -1784,9 +1824,8 @@ var FilterApplyAction = /* @__PURE__ */ ((FilterApplyAction2) => {
1784
1824
  return FilterApplyAction2;
1785
1825
  })(FilterApplyAction || {});
1786
1826
  var FilterUndoAction = /* @__PURE__ */ ((FilterUndoAction2) => {
1827
+ FilterUndoAction2["RESET_CHILDREN"] = "RESET_CHILDREN";
1787
1828
  FilterUndoAction2["UNDO_ALL_ACTIONS"] = "UNDO_ALL_ACTIONS";
1788
- FilterUndoAction2["UNDO_COLLAPSE_FUNCTION"] = "UNDO_COLLAPSE_FUNCTION";
1789
- FilterUndoAction2["UNDO_COLLAPSE_REPEATING_DESCENDANTS"] = "UNDO_COLLAPSE_REPEATING_DESCENDANTS";
1790
1829
  return FilterUndoAction2;
1791
1830
  })(FilterUndoAction || {});
1792
1831
  var filterApplyActionSet = /* @__PURE__ */ new Set([
@@ -1795,120 +1834,92 @@ var filterApplyActionSet = /* @__PURE__ */ new Set([
1795
1834
  "COLLAPSE_REPEATING_DESCENDANTS" /* COLLAPSE_REPEATING_DESCENDANTS */
1796
1835
  ]);
1797
1836
  var filterUndoActionSet = /* @__PURE__ */ new Set([
1798
- "UNDO_ALL_ACTIONS" /* UNDO_ALL_ACTIONS */,
1799
- "UNDO_COLLAPSE_FUNCTION" /* UNDO_COLLAPSE_FUNCTION */,
1800
- "UNDO_COLLAPSE_REPEATING_DESCENDANTS" /* UNDO_COLLAPSE_REPEATING_DESCENDANTS */
1801
- ]);
1802
- var actionToUndoActionMap = /* @__PURE__ */ new Map([
1803
- ["UNDO_COLLAPSE_FUNCTION" /* UNDO_COLLAPSE_FUNCTION */, "COLLAPSE_FUNCTION" /* COLLAPSE_FUNCTION */],
1804
- ["UNDO_COLLAPSE_REPEATING_DESCENDANTS" /* UNDO_COLLAPSE_REPEATING_DESCENDANTS */, "COLLAPSE_REPEATING_DESCENDANTS" /* COLLAPSE_REPEATING_DESCENDANTS */]
1837
+ "RESET_CHILDREN" /* RESET_CHILDREN */,
1838
+ "UNDO_ALL_ACTIONS" /* UNDO_ALL_ACTIONS */
1805
1839
  ]);
1806
1840
  var EntriesFilter = class {
1807
1841
  #entryToNode;
1808
- #lastInvisibleEntries = null;
1809
- #activeActions = [];
1842
+ #invisibleEntries = [];
1810
1843
  #modifiedVisibleEntries = [];
1844
+ #entryToAncestorsMap = /* @__PURE__ */ new Map();
1811
1845
  constructor(entryToNode3) {
1812
1846
  this.#entryToNode = entryToNode3;
1813
1847
  }
1814
1848
  applyAction(action) {
1815
- if (this.isUserApplyFilterAction(action)) {
1816
- this.#modifiedVisibleEntries.push(action.entry);
1817
- if (this.#actionIsActive(action)) {
1818
- return;
1819
- }
1820
- this.#activeActions.push(action);
1821
- } else if (this.isFilterUndoAction(action.type)) {
1822
- const entryIndex = this.#modifiedVisibleEntries.indexOf(action.entry);
1823
- this.#modifiedVisibleEntries.splice(entryIndex);
1824
- this.#applyUndoAction(action.type, action.entry);
1849
+ if (this.#isUserApplyFilterAction(action)) {
1850
+ this.#applyFilterAction(action);
1851
+ } else if (this.#isFilterUndoAction(action.type)) {
1852
+ this.#applyUndoAction(action);
1825
1853
  }
1826
- this.#lastInvisibleEntries = null;
1827
1854
  }
1828
- #applyUndoAction(action, entry) {
1829
- switch (action) {
1855
+ #applyUndoAction(action) {
1856
+ switch (action.type) {
1830
1857
  case "UNDO_ALL_ACTIONS" /* UNDO_ALL_ACTIONS */: {
1831
- this.#activeActions = [];
1858
+ this.#invisibleEntries = [];
1832
1859
  this.#modifiedVisibleEntries = [];
1833
1860
  break;
1834
1861
  }
1835
- default: {
1836
- const actionToRemove = actionToUndoActionMap.get(action);
1837
- if (actionToRemove) {
1838
- this.removeActiveAction({
1839
- type: actionToRemove,
1840
- entry
1841
- });
1842
- }
1862
+ case "RESET_CHILDREN" /* RESET_CHILDREN */: {
1863
+ this.#makeEntryChildrenVisible(action.entry);
1843
1864
  break;
1844
1865
  }
1845
1866
  }
1846
1867
  }
1847
- removeActiveAction(action) {
1848
- this.#activeActions = this.#activeActions.filter((activeAction) => {
1849
- if (activeAction.type === action.type && activeAction.entry === action.entry) {
1850
- return false;
1851
- }
1852
- return true;
1853
- });
1854
- }
1855
- #actionIsActive(action) {
1856
- return this.#activeActions.some((activeAction) => {
1857
- return action.entry === activeAction.entry && action.type === activeAction.type;
1858
- });
1859
- }
1860
1868
  invisibleEntries() {
1861
- if (this.#activeActions.length === 0) {
1862
- return [];
1863
- }
1864
- return this.#calculateInvisibleEntries();
1869
+ return this.#invisibleEntries;
1865
1870
  }
1866
- #calculateInvisibleEntries() {
1867
- if (this.#lastInvisibleEntries) {
1868
- return this.#lastInvisibleEntries;
1869
- }
1871
+ #applyFilterAction(action) {
1872
+ this.#modifiedVisibleEntries.push(action.entry);
1870
1873
  const entriesToHide = /* @__PURE__ */ new Set();
1871
- for (const action of this.#activeActions) {
1872
- switch (action.type) {
1873
- case "MERGE_FUNCTION" /* MERGE_FUNCTION */: {
1874
- entriesToHide.add(action.entry);
1875
- break;
1876
- }
1877
- case "COLLAPSE_FUNCTION" /* COLLAPSE_FUNCTION */: {
1878
- const entryNode = this.#entryToNode.get(action.entry);
1879
- if (!entryNode) {
1880
- continue;
1881
- }
1882
- const allAncestors = this.#findAllAncestorsOfNode(entryNode);
1883
- allAncestors.forEach((ancestor) => entriesToHide.add(ancestor));
1874
+ switch (action.type) {
1875
+ case "MERGE_FUNCTION" /* MERGE_FUNCTION */: {
1876
+ entriesToHide.add(action.entry);
1877
+ break;
1878
+ }
1879
+ case "COLLAPSE_FUNCTION" /* COLLAPSE_FUNCTION */: {
1880
+ const entryNode = this.#entryToNode.get(action.entry);
1881
+ if (!entryNode) {
1884
1882
  break;
1885
1883
  }
1886
- case "COLLAPSE_REPEATING_DESCENDANTS" /* COLLAPSE_REPEATING_DESCENDANTS */: {
1887
- const entryNode = this.#entryToNode.get(action.entry);
1888
- if (!entryNode) {
1889
- continue;
1890
- }
1891
- const allRepeatingDescendants = this.#findAllRepeatingDescendantsOfNext(entryNode);
1892
- allRepeatingDescendants.forEach((ancestor) => entriesToHide.add(ancestor));
1884
+ const allAncestors = this.#findAllAncestorsOfNode(entryNode);
1885
+ allAncestors.forEach((ancestor) => entriesToHide.add(ancestor));
1886
+ break;
1887
+ }
1888
+ case "COLLAPSE_REPEATING_DESCENDANTS" /* COLLAPSE_REPEATING_DESCENDANTS */: {
1889
+ const entryNode = this.#entryToNode.get(action.entry);
1890
+ if (!entryNode) {
1893
1891
  break;
1894
1892
  }
1895
- default:
1896
- assertNever(action.type, `Unknown EntriesFilter action: ${action.type}`);
1893
+ const allRepeatingDescendants = this.#findAllRepeatingDescendantsOfNext(entryNode);
1894
+ allRepeatingDescendants.forEach((ancestor) => entriesToHide.add(ancestor));
1895
+ break;
1897
1896
  }
1897
+ default:
1898
+ assertNever(action.type, `Unknown EntriesFilter action: ${action.type}`);
1898
1899
  }
1899
- this.#lastInvisibleEntries = [...entriesToHide];
1900
- return this.#lastInvisibleEntries;
1900
+ this.#invisibleEntries.push(...entriesToHide);
1901
+ return this.#invisibleEntries;
1901
1902
  }
1902
1903
  #findAllAncestorsOfNode(root) {
1904
+ const cachedAncestors = this.#entryToAncestorsMap.get(root);
1905
+ if (cachedAncestors) {
1906
+ return cachedAncestors;
1907
+ }
1903
1908
  const ancestors = [];
1904
1909
  const children = [...root.children];
1905
1910
  while (children.length > 0) {
1906
1911
  const childNode = children.shift();
1907
1912
  if (childNode) {
1908
1913
  ancestors.push(childNode.entry);
1909
- children.push(...childNode.children);
1914
+ const childNodeCachedAncestors = this.#entryToAncestorsMap.get(childNode);
1915
+ if (childNodeCachedAncestors) {
1916
+ ancestors.push(...childNodeCachedAncestors);
1917
+ } else {
1918
+ children.push(...childNode.children);
1919
+ }
1910
1920
  }
1911
1921
  }
1922
+ this.#entryToAncestorsMap.set(root, ancestors);
1912
1923
  return ancestors;
1913
1924
  }
1914
1925
  #findAllRepeatingDescendantsOfNext(root) {
@@ -1935,13 +1946,32 @@ var EntriesFilter = class {
1935
1946
  }
1936
1947
  return repeatingNodes;
1937
1948
  }
1949
+ #makeEntryChildrenVisible(entry) {
1950
+ const entryNode = this.#entryToNode.get(entry);
1951
+ if (!entryNode) {
1952
+ return;
1953
+ }
1954
+ const ancestors = this.#findAllAncestorsOfNode(entryNode);
1955
+ this.#invisibleEntries = this.#invisibleEntries.filter((entry2) => {
1956
+ if (ancestors.includes(entry2)) {
1957
+ return false;
1958
+ }
1959
+ return true;
1960
+ });
1961
+ this.#modifiedVisibleEntries = this.#modifiedVisibleEntries.filter((iterEntry) => {
1962
+ if (ancestors.includes(iterEntry) || iterEntry === entry) {
1963
+ return false;
1964
+ }
1965
+ return true;
1966
+ });
1967
+ }
1938
1968
  isEntryModified(event) {
1939
1969
  return this.#modifiedVisibleEntries.includes(event);
1940
1970
  }
1941
- isUserApplyFilterAction(action) {
1971
+ #isUserApplyFilterAction(action) {
1942
1972
  return filterApplyActionSet.has(action.type);
1943
1973
  }
1944
- isFilterUndoAction(action) {
1974
+ #isFilterUndoAction(action) {
1945
1975
  return filterUndoActionSet.has(action);
1946
1976
  }
1947
1977
  };
@@ -1965,6 +1995,7 @@ __export(ModelHandlers_exports, {
1965
1995
  Frames: () => FramesHandler_exports,
1966
1996
  GPU: () => GPUHandler_exports,
1967
1997
  Initiators: () => InitiatorsHandler_exports,
1998
+ Invalidations: () => InvalidationsHandler_exports,
1968
1999
  LargestImagePaint: () => LargestImagePaintHandler_exports,
1969
2000
  LargestTextPaint: () => LargestTextPaintHandler_exports,
1970
2001
  LayerTree: () => LayerTreeHandler_exports,
@@ -1997,10 +2028,10 @@ __export(types_exports2, {
1997
2028
  HandlerState: () => HandlerState,
1998
2029
  handlerDataHasAllHandlers: () => handlerDataHasAllHandlers
1999
2030
  });
2000
- function handlerDataHasAllHandlers(data21) {
2031
+ function handlerDataHasAllHandlers(data22) {
2001
2032
  let isMissingHandler = false;
2002
2033
  for (const handlerName of Object.keys(ModelHandlers_exports)) {
2003
- if (handlerName in data21 === false) {
2034
+ if (handlerName in data22 === false) {
2004
2035
  isMissingHandler = true;
2005
2036
  break;
2006
2037
  }
@@ -2166,6 +2197,7 @@ __export(FramesHandler_exports, {
2166
2197
  data: () => data7,
2167
2198
  deps: () => deps3,
2168
2199
  finalize: () => finalize7,
2200
+ framesWithinWindow: () => framesWithinWindow,
2169
2201
  handleEvent: () => handleEvent7,
2170
2202
  initialize: () => initialize5,
2171
2203
  reset: () => reset7
@@ -2218,6 +2250,12 @@ var eventPhasesOfInterestForTraceBounds = /* @__PURE__ */ new Set([
2218
2250
  TraceEvents_exports.Phase.INSTANT
2219
2251
  ]);
2220
2252
  var handlerState2 = 1 /* UNINITIALIZED */;
2253
+ var traceIsGeneric = true;
2254
+ var CHROME_WEB_TRACE_EVENTS = /* @__PURE__ */ new Set([
2255
+ TraceEvents_exports.KnownEventName.TracingStartedInPage,
2256
+ TraceEvents_exports.KnownEventName.TracingSessionIdForWorker,
2257
+ TraceEvents_exports.KnownEventName.TracingStartedInBrowser
2258
+ ]);
2221
2259
  function reset3() {
2222
2260
  navigationsByFrameId.clear();
2223
2261
  navigationsByNavigationId.clear();
@@ -2235,6 +2273,7 @@ function reset3() {
2235
2273
  traceBounds.max = Timing_exports2.MicroSeconds(Number.NEGATIVE_INFINITY);
2236
2274
  traceBounds.range = Timing_exports2.MicroSeconds(Number.POSITIVE_INFINITY);
2237
2275
  traceStartedTimeFromTracingStartedEvent = Timing_exports2.MicroSeconds(-1);
2276
+ traceIsGeneric = true;
2238
2277
  handlerState2 = 1 /* UNINITIALIZED */;
2239
2278
  }
2240
2279
  function initialize() {
@@ -2267,6 +2306,9 @@ function handleEvent3(event) {
2267
2306
  if (handlerState2 !== 2 /* INITIALIZED */) {
2268
2307
  throw new Error("Meta Handler is not initialized");
2269
2308
  }
2309
+ if (traceIsGeneric && CHROME_WEB_TRACE_EVENTS.has(event.name)) {
2310
+ traceIsGeneric = false;
2311
+ }
2270
2312
  if (event.ts !== 0 && !event.name.endsWith("::UMA") && eventPhasesOfInterestForTraceBounds.has(event.ph)) {
2271
2313
  traceBounds.min = Timing_exports2.MicroSeconds(Math.min(event.ts, traceBounds.min));
2272
2314
  const eventDuration = event.dur || Timing_exports2.MicroSeconds(0);
@@ -2340,7 +2382,7 @@ function handleEvent3(event) {
2340
2382
  if (TraceEvents_exports.isTraceEventNavigationStartWithURL(event) && event.args.data) {
2341
2383
  const navigationId = event.args.data.navigationId;
2342
2384
  if (navigationsByNavigationId.has(navigationId)) {
2343
- throw new Error("Found multiple navigation start events with the same navigation ID.");
2385
+ return;
2344
2386
  }
2345
2387
  navigationsByNavigationId.set(navigationId, event);
2346
2388
  const frameId = event.args.frame;
@@ -2387,6 +2429,14 @@ async function finalize3() {
2387
2429
  navigationsByNavigationId.delete(navigation.args.data.navigationId);
2388
2430
  }
2389
2431
  }
2432
+ const firstMainFrameNav = mainFrameNavigations.at(0);
2433
+ const firstNavTimeThreshold = Timing_exports3.secondsToMicroseconds(Timing_exports2.Seconds(0.5));
2434
+ if (firstMainFrameNav) {
2435
+ const navigationIsWithinThreshold = firstMainFrameNav.ts - traceBounds.min < firstNavTimeThreshold;
2436
+ if (firstMainFrameNav.args.data?.isOutermostMainFrame && firstMainFrameNav.args.data?.documentLoaderURL && navigationIsWithinThreshold) {
2437
+ mainFrameURL = firstMainFrameNav.args.data.documentLoaderURL;
2438
+ }
2439
+ }
2390
2440
  handlerState2 = 3 /* FINALIZED */;
2391
2441
  }
2392
2442
  function data3() {
@@ -2408,7 +2458,8 @@ function data3() {
2408
2458
  rendererProcessesByFrame: new Map(rendererProcessesByFrameId),
2409
2459
  topLevelRendererIds: new Set(topLevelRendererIds),
2410
2460
  frameByProcessId: new Map(framesByProcessId),
2411
- mainFrameNavigations: [...mainFrameNavigations]
2461
+ mainFrameNavigations: [...mainFrameNavigations],
2462
+ traceIsGeneric
2412
2463
  };
2413
2464
  }
2414
2465
 
@@ -3167,8 +3218,8 @@ function getOrCreatePreProcessedData(processId, profileId) {
3167
3218
  profileId
3168
3219
  }));
3169
3220
  }
3170
- function getProfileCallFunctionName(data21, entry) {
3171
- const profile = data21.profilesInProcess.get(entry.pid)?.get(entry.tid);
3221
+ function getProfileCallFunctionName(data22, entry) {
3222
+ const profile = data22.profilesInProcess.get(entry.pid)?.get(entry.tid);
3172
3223
  const node = profile?.parsedProfile.nodeById(entry.nodeId);
3173
3224
  if (node?.functionName) {
3174
3225
  return node.functionName;
@@ -3331,10 +3382,6 @@ function sanitizeProcesses(processes2) {
3331
3382
  }
3332
3383
  continue;
3333
3384
  }
3334
- const asUrl = new URL(process.url);
3335
- if (asUrl.protocol === "about:") {
3336
- processes2.delete(pid);
3337
- }
3338
3385
  }
3339
3386
  }
3340
3387
  function sanitizeThreads(processes2) {
@@ -3408,6 +3455,7 @@ var ThreadType = /* @__PURE__ */ ((ThreadType2) => {
3408
3455
  ThreadType2["AUCTION_WORKLET"] = "AUCTION_WORKLET";
3409
3456
  ThreadType2["OTHER"] = "OTHER";
3410
3457
  ThreadType2["CPU_PROFILE"] = "CPU_PROFILE";
3458
+ ThreadType2["THREAD_POOL"] = "THREAD_POOL";
3411
3459
  return ThreadType2;
3412
3460
  })(ThreadType || {});
3413
3461
  function getThreadTypeForRendererThread(auctionWorkletsData, pid, thread) {
@@ -3420,6 +3468,8 @@ function getThreadTypeForRendererThread(auctionWorkletsData, pid, thread) {
3420
3468
  threadType = "RASTERIZER" /* RASTERIZER */;
3421
3469
  } else if (auctionWorkletsData.worklets.has(pid)) {
3422
3470
  threadType = "AUCTION_WORKLET" /* AUCTION_WORKLET */;
3471
+ } else if (thread.name?.startsWith("ThreadPool")) {
3472
+ threadType = "THREAD_POOL" /* THREAD_POOL */;
3423
3473
  }
3424
3474
  return threadType;
3425
3475
  }
@@ -3496,12 +3546,14 @@ async function finalize7() {
3496
3546
  if (handlerState6 !== 2 /* INITIALIZED */) {
3497
3547
  throw new Error("FramesHandler is not initialized");
3498
3548
  }
3549
+ Trace_exports.sortTraceEventsInPlace(allEvents);
3499
3550
  const modelForTrace = new TimelineFrameModel(allEvents, data6(), data2(), data3(), data4());
3500
3551
  model = modelForTrace;
3501
3552
  }
3502
3553
  function data7() {
3503
3554
  return {
3504
- frames: model ? Array.from(model.frames()) : []
3555
+ frames: model ? Array.from(model.frames()) : [],
3556
+ framesById: model ? { ...model.framesById() } : {}
3505
3557
  };
3506
3558
  }
3507
3559
  function deps3() {
@@ -3510,14 +3562,6 @@ function deps3() {
3510
3562
  function isFrameEvent(event) {
3511
3563
  return TraceEvents_exports.isTraceEventSetLayerId(event) || TraceEvents_exports.isTraceEventBeginFrame(event) || TraceEvents_exports.isTraceEventDroppedFrame(event) || TraceEvents_exports.isTraceEventRequestMainThreadFrame(event) || TraceEvents_exports.isTraceEventBeginMainThreadFrame(event) || TraceEvents_exports.isTraceEventNeedsBeginFrameChanged(event) || TraceEvents_exports.isTraceEventCommit(event) || TraceEvents_exports.isTraceEventCompositeLayers(event) || TraceEvents_exports.isTraceEventActivateLayerTree(event) || TraceEvents_exports.isTraceEventDrawFrame(event);
3512
3564
  }
3513
- function idForEntry(entry) {
3514
- const scope = TraceEvents_exports.isTraceEventInstant(entry) && entry.s || void 0;
3515
- if (TraceEvents_exports.isNestableAsyncPhase(entry.ph)) {
3516
- const id = Trace_exports.extractId(entry);
3517
- return scope ? `${scope}@${id}` : id;
3518
- }
3519
- return void 0;
3520
- }
3521
3565
  function entryIsTopLevel(entry) {
3522
3566
  const devtoolsTimelineCategory = "disabled-by-default-devtools.timeline";
3523
3567
  return entry.name === TraceEvents_exports.KnownEventName.RunTask && entry.cat.includes(devtoolsTimelineCategory);
@@ -3526,7 +3570,6 @@ var TimelineFrameModel = class {
3526
3570
  #frames = [];
3527
3571
  #frameById = {};
3528
3572
  #beginFrameQueue = new TimelineFrameBeginFrameQueue();
3529
- #minimumRecordTime = Timing_exports2.MicroSeconds(Infinity);
3530
3573
  #lastFrame = null;
3531
3574
  #mainFrameCommitted = false;
3532
3575
  #mainFrameRequested = false;
@@ -3554,6 +3597,9 @@ var TimelineFrameModel = class {
3554
3597
  this.#layerTreeData = layerTreeData;
3555
3598
  this.#addTraceEvents(allEvents3, threadData, metaData.mainFrameId);
3556
3599
  }
3600
+ framesById() {
3601
+ return this.#frameById;
3602
+ }
3557
3603
  frames() {
3558
3604
  return this.#frames;
3559
3605
  }
@@ -3638,7 +3684,7 @@ var TimelineFrameModel = class {
3638
3684
  if (this.#lastFrame) {
3639
3685
  this.#flushFrame(this.#lastFrame, startTime);
3640
3686
  }
3641
- this.#lastFrame = new TimelineFrame(seqId, startTime, Timing_exports2.MicroSeconds(startTime - this.#minimumRecordTime));
3687
+ this.#lastFrame = new TimelineFrame(seqId, startTime, Timing_exports2.MicroSeconds(startTime - data3().traceBounds.min));
3642
3688
  }
3643
3689
  #flushFrame(frame, endTime) {
3644
3690
  frame.setLayerTree(this.#lastLayerTree);
@@ -3678,13 +3724,9 @@ var TimelineFrameModel = class {
3678
3724
  this.#activeProcessId = null;
3679
3725
  }
3680
3726
  #addTraceEvent(event, mainFrameId2) {
3681
- if (event.ts && event.ts < this.#minimumRecordTime) {
3682
- this.#minimumRecordTime = event.ts;
3683
- }
3684
- const entryId = idForEntry(event);
3685
3727
  if (TraceEvents_exports.isTraceEventSetLayerId(event) && event.args.data.frame === mainFrameId2) {
3686
3728
  this.#layerTreeId = event.args.data.layerTreeId;
3687
- } else if (entryId && TraceEvents_exports.isTraceEventLayerTreeHostImplSnapshot(event) && Number(entryId) === this.#layerTreeId) {
3729
+ } else if (TraceEvents_exports.isTraceEventLayerTreeHostImplSnapshot(event) && Number(event.id) === this.#layerTreeId) {
3688
3730
  this.#handleLayerTreeSnapshot({
3689
3731
  entry: event,
3690
3732
  paints: []
@@ -3857,6 +3899,11 @@ var TimelineFrameBeginFrameQueue = class {
3857
3899
  return framesToVisualize;
3858
3900
  }
3859
3901
  };
3902
+ function framesWithinWindow(frames, startTime, endTime) {
3903
+ const firstFrame = array_utilities_exports.lowerBound(frames, startTime || 0, (time, frame) => time - frame.endTime);
3904
+ const lastFrame = array_utilities_exports.lowerBound(frames, endTime || Infinity, (time, frame) => time - frame.startTime);
3905
+ return frames.slice(firstFrame, lastFrame);
3906
+ }
3860
3907
 
3861
3908
  // front_end/models/trace/handlers/GPUHandler.ts
3862
3909
  var GPUHandler_exports = {};
@@ -3951,11 +3998,11 @@ function initialize7() {
3951
3998
  }
3952
3999
  handlerState8 = 2 /* INITIALIZED */;
3953
4000
  }
3954
- function storeInitiator(data21) {
3955
- eventToInitiatorMap.set(data21.event, data21.initiator);
3956
- const eventsForInitiator = initiatorToEventsMap.get(data21.initiator) || [];
3957
- eventsForInitiator.push(data21.event);
3958
- initiatorToEventsMap.set(data21.initiator, eventsForInitiator);
4001
+ function storeInitiator(data22) {
4002
+ eventToInitiatorMap.set(data22.event, data22.initiator);
4003
+ const eventsForInitiator = initiatorToEventsMap.get(data22.initiator) || [];
4004
+ eventsForInitiator.push(data22.event);
4005
+ initiatorToEventsMap.set(data22.initiator, eventsForInitiator);
3959
4006
  }
3960
4007
  function handleEvent9(event) {
3961
4008
  if (TraceEvents_exports.isTraceEventScheduleStyleRecalculation(event)) {
@@ -4053,18 +4100,123 @@ function data9() {
4053
4100
  };
4054
4101
  }
4055
4102
 
4056
- // front_end/models/trace/handlers/LargestImagePaintHandler.ts
4057
- var LargestImagePaintHandler_exports = {};
4058
- __export(LargestImagePaintHandler_exports, {
4103
+ // front_end/models/trace/handlers/InvalidationsHandler.ts
4104
+ var InvalidationsHandler_exports = {};
4105
+ __export(InvalidationsHandler_exports, {
4059
4106
  data: () => data10,
4107
+ finalize: () => finalize10,
4060
4108
  handleEvent: () => handleEvent10,
4109
+ initialize: () => initialize8,
4061
4110
  reset: () => reset10
4062
4111
  });
4063
- var imageByDOMNodeId = /* @__PURE__ */ new Map();
4112
+ var handlerState9 = 1 /* UNINITIALIZED */;
4113
+ var invalidationsForEvent = /* @__PURE__ */ new Map();
4114
+ var lastRecalcStyleEvent = null;
4115
+ var hasPainted = false;
4116
+ var allInvalidationTrackingEvents = [];
4064
4117
  function reset10() {
4065
- imageByDOMNodeId.clear();
4118
+ handlerState9 = 1 /* UNINITIALIZED */;
4119
+ invalidationsForEvent.clear();
4120
+ lastRecalcStyleEvent = null;
4121
+ allInvalidationTrackingEvents.length = 0;
4122
+ hasPainted = false;
4123
+ }
4124
+ function initialize8() {
4125
+ if (handlerState9 !== 1 /* UNINITIALIZED */) {
4126
+ throw new Error("InvalidationsHandler was not reset before being initialized");
4127
+ }
4128
+ handlerState9 = 2 /* INITIALIZED */;
4129
+ }
4130
+ function addInvalidationToEvent(event, invalidation) {
4131
+ const existingInvalidations = invalidationsForEvent.get(event) || [];
4132
+ const syntheticInvalidation = {
4133
+ ...invalidation,
4134
+ name: "SyntheticInvalidation",
4135
+ frame: invalidation.args.data.frame,
4136
+ nodeId: invalidation.args.data.nodeId,
4137
+ rawEvent: invalidation
4138
+ };
4139
+ if (invalidation.args.data.nodeName) {
4140
+ syntheticInvalidation.nodeName = invalidation.args.data.nodeName;
4141
+ }
4142
+ if (invalidation.args.data.reason) {
4143
+ syntheticInvalidation.reason = invalidation.args.data.reason;
4144
+ }
4145
+ if (invalidation.args.data.stackTrace) {
4146
+ syntheticInvalidation.stackTrace = invalidation.args.data.stackTrace;
4147
+ }
4148
+ existingInvalidations.push(syntheticInvalidation);
4149
+ invalidationsForEvent.set(event, existingInvalidations);
4066
4150
  }
4067
4151
  function handleEvent10(event) {
4152
+ if (TraceEvents_exports.isTraceEventUpdateLayoutTree(event)) {
4153
+ lastRecalcStyleEvent = event;
4154
+ for (const invalidation of allInvalidationTrackingEvents) {
4155
+ if (TraceEvents_exports.isTraceEventLayoutInvalidationTracking(invalidation)) {
4156
+ continue;
4157
+ }
4158
+ const recalcFrameId = lastRecalcStyleEvent.args.beginData?.frame;
4159
+ if (recalcFrameId && invalidation.args.data.frame === recalcFrameId) {
4160
+ addInvalidationToEvent(event, invalidation);
4161
+ }
4162
+ }
4163
+ return;
4164
+ }
4165
+ if (TraceEvents_exports.isTraceEventScheduleStyleInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleRecalcInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleInvalidatorInvalidationTracking(event) || TraceEvents_exports.isTraceEventLayoutInvalidationTracking(event)) {
4166
+ if (hasPainted) {
4167
+ allInvalidationTrackingEvents.length = 0;
4168
+ lastRecalcStyleEvent = null;
4169
+ hasPainted = false;
4170
+ }
4171
+ if (lastRecalcStyleEvent && (TraceEvents_exports.isTraceEventScheduleStyleInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleRecalcInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleInvalidatorInvalidationTracking(event))) {
4172
+ const recalcEndTime = lastRecalcStyleEvent.ts + (lastRecalcStyleEvent.dur || 0);
4173
+ if (event.ts >= lastRecalcStyleEvent.ts && event.ts <= recalcEndTime && lastRecalcStyleEvent.args.beginData?.frame === event.args.data.frame) {
4174
+ addInvalidationToEvent(lastRecalcStyleEvent, event);
4175
+ }
4176
+ }
4177
+ allInvalidationTrackingEvents.push(event);
4178
+ return;
4179
+ }
4180
+ if (TraceEvents_exports.isTraceEventPaint(event)) {
4181
+ hasPainted = true;
4182
+ return;
4183
+ }
4184
+ if (TraceEvents_exports.isTraceEventLayout(event)) {
4185
+ const layoutFrame = event.args.beginData.frame;
4186
+ for (const invalidation of allInvalidationTrackingEvents) {
4187
+ if (!TraceEvents_exports.isTraceEventLayoutInvalidationTracking(invalidation)) {
4188
+ continue;
4189
+ }
4190
+ if (invalidation.args.data.frame === layoutFrame) {
4191
+ addInvalidationToEvent(event, invalidation);
4192
+ }
4193
+ }
4194
+ }
4195
+ }
4196
+ async function finalize10() {
4197
+ if (handlerState9 !== 2 /* INITIALIZED */) {
4198
+ throw new Error("InvalidationsHandler is not initialized");
4199
+ }
4200
+ handlerState9 = 3 /* FINALIZED */;
4201
+ }
4202
+ function data10() {
4203
+ return {
4204
+ invalidationsForEvent: new Map(invalidationsForEvent)
4205
+ };
4206
+ }
4207
+
4208
+ // front_end/models/trace/handlers/LargestImagePaintHandler.ts
4209
+ var LargestImagePaintHandler_exports = {};
4210
+ __export(LargestImagePaintHandler_exports, {
4211
+ data: () => data11,
4212
+ handleEvent: () => handleEvent11,
4213
+ reset: () => reset11
4214
+ });
4215
+ var imageByDOMNodeId = /* @__PURE__ */ new Map();
4216
+ function reset11() {
4217
+ imageByDOMNodeId.clear();
4218
+ }
4219
+ function handleEvent11(event) {
4068
4220
  if (!TraceEvents_exports.isTraceEventLargestImagePaintCandidate(event)) {
4069
4221
  return;
4070
4222
  }
@@ -4073,22 +4225,22 @@ function handleEvent10(event) {
4073
4225
  }
4074
4226
  imageByDOMNodeId.set(event.args.data.DOMNodeId, event);
4075
4227
  }
4076
- function data10() {
4228
+ function data11() {
4077
4229
  return new Map(imageByDOMNodeId);
4078
4230
  }
4079
4231
 
4080
4232
  // front_end/models/trace/handlers/LargestTextPaintHandler.ts
4081
4233
  var LargestTextPaintHandler_exports = {};
4082
4234
  __export(LargestTextPaintHandler_exports, {
4083
- data: () => data11,
4084
- handleEvent: () => handleEvent11,
4085
- reset: () => reset11
4235
+ data: () => data12,
4236
+ handleEvent: () => handleEvent12,
4237
+ reset: () => reset12
4086
4238
  });
4087
4239
  var textPaintByDOMNodeId = /* @__PURE__ */ new Map();
4088
- function reset11() {
4240
+ function reset12() {
4089
4241
  textPaintByDOMNodeId.clear();
4090
4242
  }
4091
- function handleEvent11(event) {
4243
+ function handleEvent12(event) {
4092
4244
  if (!TraceEvents_exports.isTraceEventLargestTextPaintCandidate(event)) {
4093
4245
  return;
4094
4246
  }
@@ -4097,7 +4249,7 @@ function handleEvent11(event) {
4097
4249
  }
4098
4250
  textPaintByDOMNodeId.set(event.args.data.DOMNodeId, event);
4099
4251
  }
4100
- function data11() {
4252
+ function data12() {
4101
4253
  return new Map(textPaintByDOMNodeId);
4102
4254
  }
4103
4255
 
@@ -4107,13 +4259,13 @@ __export(LayoutShiftsHandler_exports, {
4107
4259
  LayoutShiftsThreshold: () => LayoutShiftsThreshold,
4108
4260
  MAX_CLUSTER_DURATION: () => MAX_CLUSTER_DURATION,
4109
4261
  MAX_SHIFT_TIME_DELTA: () => MAX_SHIFT_TIME_DELTA,
4110
- data: () => data14,
4262
+ data: () => data15,
4111
4263
  deps: () => deps7,
4112
- finalize: () => finalize12,
4264
+ finalize: () => finalize13,
4113
4265
  findNextScreenshotEventIndex: () => findNextScreenshotEventIndex,
4114
- handleEvent: () => handleEvent14,
4115
- initialize: () => initialize8,
4116
- reset: () => reset14,
4266
+ handleEvent: () => handleEvent15,
4267
+ initialize: () => initialize9,
4268
+ reset: () => reset15,
4117
4269
  stateForLayoutShiftScore: () => stateForLayoutShiftScore
4118
4270
  });
4119
4271
 
@@ -4123,14 +4275,14 @@ __export(PageLoadMetricsHandler_exports, {
4123
4275
  MarkerName: () => MarkerName,
4124
4276
  MetricName: () => MetricName,
4125
4277
  ScoreClassification: () => ScoreClassification,
4126
- data: () => data12,
4278
+ data: () => data13,
4127
4279
  deps: () => deps5,
4128
4280
  eventIsPageLoadEvent: () => eventIsPageLoadEvent,
4129
- finalize: () => finalize10,
4281
+ finalize: () => finalize11,
4130
4282
  getFrameIdForPageLoadEvent: () => getFrameIdForPageLoadEvent,
4131
- handleEvent: () => handleEvent12,
4283
+ handleEvent: () => handleEvent13,
4132
4284
  isTraceEventMarkerEvent: () => isTraceEventMarkerEvent,
4133
- reset: () => reset12,
4285
+ reset: () => reset13,
4134
4286
  scoreClassificationForDOMContentLoaded: () => scoreClassificationForDOMContentLoaded,
4135
4287
  scoreClassificationForFirstContentfulPaint: () => scoreClassificationForFirstContentfulPaint,
4136
4288
  scoreClassificationForLargestContentfulPaint: () => scoreClassificationForLargestContentfulPaint,
@@ -4139,7 +4291,7 @@ __export(PageLoadMetricsHandler_exports, {
4139
4291
  });
4140
4292
  var metricScoresByFrameId = /* @__PURE__ */ new Map();
4141
4293
  var allMarkerEvents = [];
4142
- function reset12() {
4294
+ function reset13() {
4143
4295
  metricScoresByFrameId.clear();
4144
4296
  pageLoadEventsArray = [];
4145
4297
  allMarkerEvents = [];
@@ -4166,7 +4318,7 @@ var pageLoadEventTypeGuards = [
4166
4318
  function eventIsPageLoadEvent(event) {
4167
4319
  return pageLoadEventTypeGuards.some((fn) => fn(event));
4168
4320
  }
4169
- function handleEvent12(event) {
4321
+ function handleEvent13(event) {
4170
4322
  if (!eventIsPageLoadEvent(event)) {
4171
4323
  return;
4172
4324
  }
@@ -4425,7 +4577,7 @@ function gatherFinalLCPEvents() {
4425
4577
  }
4426
4578
  return allFinalLCPEvents;
4427
4579
  }
4428
- async function finalize10() {
4580
+ async function finalize11() {
4429
4581
  pageLoadEventsArray.sort((a, b) => a.ts - b.ts);
4430
4582
  for (const pageLoadEvent of pageLoadEventsArray) {
4431
4583
  const navigation = getNavigationForPageLoadEvent(pageLoadEvent);
@@ -4439,7 +4591,7 @@ async function finalize10() {
4439
4591
  const markerEvents = [...allFinalLCPEvents, ...allEventsButLCP].filter(isTraceEventMarkerEvent);
4440
4592
  allMarkerEvents = markerEvents.filter((event) => getFrameIdForPageLoadEvent(event) === mainFrame).sort((a, b) => a.ts - b.ts);
4441
4593
  }
4442
- function data12() {
4594
+ function data13() {
4443
4595
  return {
4444
4596
  metricScoresByFrameId: new Map(metricScoresByFrameId),
4445
4597
  allMarkerEvents: [...allMarkerEvents]
@@ -4470,32 +4622,32 @@ var MetricName = /* @__PURE__ */ ((MetricName2) => {
4470
4622
  // front_end/models/trace/handlers/ScreenshotsHandler.ts
4471
4623
  var ScreenshotsHandler_exports = {};
4472
4624
  __export(ScreenshotsHandler_exports, {
4473
- data: () => data13,
4625
+ data: () => data14,
4474
4626
  deps: () => deps6,
4475
- finalize: () => finalize11,
4476
- handleEvent: () => handleEvent13,
4477
- reset: () => reset13
4627
+ finalize: () => finalize12,
4628
+ handleEvent: () => handleEvent14,
4629
+ reset: () => reset14
4478
4630
  });
4479
4631
  var eventsInProcessThread2 = /* @__PURE__ */ new Map();
4480
4632
  var snapshots = [];
4481
- function reset13() {
4633
+ function reset14() {
4482
4634
  eventsInProcessThread2.clear();
4483
4635
  snapshots.length = 0;
4484
4636
  }
4485
- function handleEvent13(event) {
4637
+ function handleEvent14(event) {
4486
4638
  if (event.name !== "Screenshot") {
4487
4639
  return;
4488
4640
  }
4489
4641
  Trace_exports.addEventToProcessThread(event, eventsInProcessThread2);
4490
4642
  }
4491
- async function finalize11() {
4643
+ async function finalize12() {
4492
4644
  const { browserProcessId: browserProcessId2, browserThreadId: browserThreadId2 } = data3();
4493
4645
  const browserThreads = eventsInProcessThread2.get(browserProcessId2);
4494
4646
  if (browserThreads) {
4495
4647
  snapshots = browserThreads.get(browserThreadId2) || [];
4496
4648
  }
4497
4649
  }
4498
- function data13() {
4650
+ function data14() {
4499
4651
  return [...snapshots];
4500
4652
  }
4501
4653
  function deps6() {
@@ -4507,6 +4659,7 @@ var MAX_CLUSTER_DURATION = Timing_exports3.millisecondsToMicroseconds(Timing_exp
4507
4659
  var MAX_SHIFT_TIME_DELTA = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(1e3));
4508
4660
  var layoutShiftEvents = [];
4509
4661
  var layoutInvalidationEvents = [];
4662
+ var scheduleStyleInvalidationEvents = [];
4510
4663
  var styleRecalcInvalidationEvents = [];
4511
4664
  var backendNodeIds = /* @__PURE__ */ new Set();
4512
4665
  var prePaintEvents = [];
@@ -4514,17 +4667,19 @@ var sessionMaxScore = 0;
4514
4667
  var clsWindowID = -1;
4515
4668
  var clusters = [];
4516
4669
  var scoreRecords = [];
4517
- var handlerState9 = 1 /* UNINITIALIZED */;
4518
- function initialize8() {
4519
- if (handlerState9 !== 1 /* UNINITIALIZED */) {
4670
+ var handlerState10 = 1 /* UNINITIALIZED */;
4671
+ function initialize9() {
4672
+ if (handlerState10 !== 1 /* UNINITIALIZED */) {
4520
4673
  throw new Error("LayoutShifts Handler was not reset");
4521
4674
  }
4522
- handlerState9 = 2 /* INITIALIZED */;
4675
+ handlerState10 = 2 /* INITIALIZED */;
4523
4676
  }
4524
- function reset14() {
4525
- handlerState9 = 1 /* UNINITIALIZED */;
4677
+ function reset15() {
4678
+ handlerState10 = 1 /* UNINITIALIZED */;
4526
4679
  layoutShiftEvents.length = 0;
4527
4680
  layoutInvalidationEvents.length = 0;
4681
+ scheduleStyleInvalidationEvents.length = 0;
4682
+ styleRecalcInvalidationEvents.length = 0;
4528
4683
  prePaintEvents.length = 0;
4529
4684
  backendNodeIds.clear();
4530
4685
  clusters.length = 0;
@@ -4532,19 +4687,22 @@ function reset14() {
4532
4687
  scoreRecords.length = 0;
4533
4688
  clsWindowID = -1;
4534
4689
  }
4535
- function handleEvent14(event) {
4536
- if (handlerState9 !== 2 /* INITIALIZED */) {
4690
+ function handleEvent15(event) {
4691
+ if (handlerState10 !== 2 /* INITIALIZED */) {
4537
4692
  throw new Error("Handler is not initialized");
4538
4693
  }
4539
4694
  if (TraceEvents_exports.isTraceEventLayoutShift(event) && !event.args.data?.had_recent_input) {
4540
4695
  layoutShiftEvents.push(event);
4541
4696
  return;
4542
4697
  }
4543
- if (TraceEvents_exports.isTraceEventLayoutInvalidation(event)) {
4698
+ if (TraceEvents_exports.isTraceEventLayoutInvalidationTracking(event)) {
4544
4699
  layoutInvalidationEvents.push(event);
4545
4700
  return;
4546
4701
  }
4547
- if (TraceEvents_exports.isTraceEventStyleRecalcInvalidation(event)) {
4702
+ if (TraceEvents_exports.isTraceEventScheduleStyleInvalidationTracking(event)) {
4703
+ scheduleStyleInvalidationEvents.push(event);
4704
+ }
4705
+ if (TraceEvents_exports.isTraceEventStyleRecalcInvalidationTracking(event)) {
4548
4706
  styleRecalcInvalidationEvents.push(event);
4549
4707
  }
4550
4708
  if (TraceEvents_exports.isTraceEventPrePaint(event)) {
@@ -4564,7 +4722,7 @@ function updateTraceWindowMax(traceWindow, newMax) {
4564
4722
  traceWindow.range = Timing_exports2.MicroSeconds(traceWindow.max - traceWindow.min);
4565
4723
  }
4566
4724
  function findNextScreenshotSource(timestamp) {
4567
- const screenshots = data13();
4725
+ const screenshots = data14();
4568
4726
  const screenshotIndex = findNextScreenshotEventIndex(screenshots, timestamp);
4569
4727
  if (!screenshotIndex) {
4570
4728
  return void 0;
@@ -4609,15 +4767,21 @@ function collectNodes() {
4609
4767
  }
4610
4768
  backendNodeIds.add(layoutInvalidation.args.data.nodeId);
4611
4769
  }
4770
+ for (const scheduleStyleInvalidation of scheduleStyleInvalidationEvents) {
4771
+ if (!scheduleStyleInvalidation.args.data?.nodeId) {
4772
+ continue;
4773
+ }
4774
+ backendNodeIds.add(scheduleStyleInvalidation.args.data.nodeId);
4775
+ }
4612
4776
  }
4613
- async function finalize12() {
4777
+ async function finalize13() {
4614
4778
  layoutShiftEvents.sort((a, b) => a.ts - b.ts);
4615
4779
  prePaintEvents.sort((a, b) => a.ts - b.ts);
4616
4780
  layoutInvalidationEvents.sort((a, b) => a.ts - b.ts);
4617
4781
  await buildLayoutShiftsClusters();
4618
4782
  buildScoreRecords();
4619
4783
  collectNodes();
4620
- handlerState9 = 3 /* FINALIZED */;
4784
+ handlerState10 = 3 /* FINALIZED */;
4621
4785
  }
4622
4786
  async function buildLayoutShiftsClusters() {
4623
4787
  const { navigationsByFrameId: navigationsByFrameId2, mainFrameId: mainFrameId2, traceBounds: traceBounds2 } = data3();
@@ -4731,8 +4895,8 @@ async function buildLayoutShiftsClusters() {
4731
4895
  }
4732
4896
  }
4733
4897
  }
4734
- function data14() {
4735
- if (handlerState9 !== 3 /* FINALIZED */) {
4898
+ function data15() {
4899
+ if (handlerState10 !== 3 /* FINALIZED */) {
4736
4900
  throw new Error("Layout Shifts Handler is not finalized");
4737
4901
  }
4738
4902
  return {
@@ -4741,6 +4905,7 @@ function data14() {
4741
4905
  clsWindowID,
4742
4906
  prePaintEvents: [...prePaintEvents],
4743
4907
  layoutInvalidationEvents: [...layoutInvalidationEvents],
4908
+ scheduleStyleInvalidationEvents: [...scheduleStyleInvalidationEvents],
4744
4909
  styleRecalcInvalidationEvents: [],
4745
4910
  scoreRecords: [...scoreRecords],
4746
4911
  backendNodeIds: [...backendNodeIds]
@@ -4769,34 +4934,34 @@ var LayoutShiftsThreshold = /* @__PURE__ */ ((LayoutShiftsThreshold2) => {
4769
4934
  // front_end/models/trace/handlers/MemoryHandler.ts
4770
4935
  var MemoryHandler_exports = {};
4771
4936
  __export(MemoryHandler_exports, {
4772
- data: () => data15,
4773
- handleEvent: () => handleEvent15,
4774
- reset: () => reset15
4937
+ data: () => data16,
4938
+ handleEvent: () => handleEvent16,
4939
+ reset: () => reset16
4775
4940
  });
4776
4941
  var updateCountersByProcess = /* @__PURE__ */ new Map();
4777
- function reset15() {
4942
+ function reset16() {
4778
4943
  updateCountersByProcess.clear();
4779
4944
  }
4780
- function handleEvent15(event) {
4945
+ function handleEvent16(event) {
4781
4946
  if (TraceEvents_exports.isTraceEventUpdateCounters(event)) {
4782
4947
  const countersForProcess = map_utilities_exports.getWithDefault(updateCountersByProcess, event.pid, () => []);
4783
4948
  countersForProcess.push(event);
4784
4949
  updateCountersByProcess.set(event.pid, countersForProcess);
4785
4950
  }
4786
4951
  }
4787
- function data15() {
4952
+ function data16() {
4788
4953
  return { updateCountersByProcess: new Map(updateCountersByProcess) };
4789
4954
  }
4790
4955
 
4791
4956
  // front_end/models/trace/handlers/NetworkRequestsHandler.ts
4792
4957
  var NetworkRequestsHandler_exports = {};
4793
4958
  __export(NetworkRequestsHandler_exports, {
4794
- data: () => data16,
4959
+ data: () => data17,
4795
4960
  deps: () => deps8,
4796
- finalize: () => finalize13,
4797
- handleEvent: () => handleEvent16,
4798
- initialize: () => initialize9,
4799
- reset: () => reset16
4961
+ finalize: () => finalize14,
4962
+ handleEvent: () => handleEvent17,
4963
+ initialize: () => initialize10,
4964
+ reset: () => reset17
4800
4965
  });
4801
4966
  var MILLISECONDS_TO_MICROSECONDS = 1e3;
4802
4967
  var SECONDS_TO_MICROSECONDS = 1e6;
@@ -4827,18 +4992,18 @@ function firstPositiveValueInList(entries) {
4827
4992
  }
4828
4993
  return 0;
4829
4994
  }
4830
- var handlerState10 = 1 /* UNINITIALIZED */;
4831
- function reset16() {
4995
+ var handlerState11 = 1 /* UNINITIALIZED */;
4996
+ function reset17() {
4832
4997
  requestsByOrigin.clear();
4833
4998
  requestMap.clear();
4834
4999
  requestsByTime.length = 0;
4835
- handlerState10 = 1 /* UNINITIALIZED */;
5000
+ handlerState11 = 1 /* UNINITIALIZED */;
4836
5001
  }
4837
- function initialize9() {
4838
- handlerState10 = 2 /* INITIALIZED */;
5002
+ function initialize10() {
5003
+ handlerState11 = 2 /* INITIALIZED */;
4839
5004
  }
4840
- function handleEvent16(event) {
4841
- if (handlerState10 !== 2 /* INITIALIZED */) {
5005
+ function handleEvent17(event) {
5006
+ if (handlerState11 !== 2 /* INITIALIZED */) {
4842
5007
  throw new Error("Network Request handler is not initialized");
4843
5008
  }
4844
5009
  if (TraceEvents_exports.isTraceEventResourceChangePriority(event)) {
@@ -4870,8 +5035,8 @@ function handleEvent16(event) {
4870
5035
  return;
4871
5036
  }
4872
5037
  }
4873
- async function finalize13() {
4874
- if (handlerState10 !== 2 /* INITIALIZED */) {
5038
+ async function finalize14() {
5039
+ if (handlerState11 !== 2 /* INITIALIZED */) {
4875
5040
  throw new Error("Network Request handler is not initialized");
4876
5041
  }
4877
5042
  const { rendererProcessesByFrame } = data3();
@@ -5015,10 +5180,10 @@ async function finalize13() {
5015
5180
  requests.all.push(networkEvent);
5016
5181
  requestsByTime.push(networkEvent);
5017
5182
  }
5018
- handlerState10 = 3 /* FINALIZED */;
5183
+ handlerState11 = 3 /* FINALIZED */;
5019
5184
  }
5020
- function data16() {
5021
- if (handlerState10 !== 3 /* FINALIZED */) {
5185
+ function data17() {
5186
+ if (handlerState11 !== 3 /* FINALIZED */) {
5022
5187
  throw new Error("Network Request handler is not finalized");
5023
5188
  }
5024
5189
  return {
@@ -5035,11 +5200,11 @@ var UserInteractionsHandler_exports = {};
5035
5200
  __export(UserInteractionsHandler_exports, {
5036
5201
  LONG_INTERACTION_THRESHOLD: () => LONG_INTERACTION_THRESHOLD,
5037
5202
  categoryOfInteraction: () => categoryOfInteraction,
5038
- data: () => data17,
5039
- finalize: () => finalize14,
5040
- handleEvent: () => handleEvent17,
5203
+ data: () => data18,
5204
+ finalize: () => finalize15,
5205
+ handleEvent: () => handleEvent18,
5041
5206
  removeNestedInteractions: () => removeNestedInteractions,
5042
- reset: () => reset17
5207
+ reset: () => reset18
5043
5208
  });
5044
5209
  var allEvents2 = [];
5045
5210
  var LONG_INTERACTION_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(200));
@@ -5048,18 +5213,18 @@ var interactionEvents = [];
5048
5213
  var interactionEventsWithNoNesting = [];
5049
5214
  var eventTimingEndEventsById = /* @__PURE__ */ new Map();
5050
5215
  var eventTimingStartEventsForInteractions = [];
5051
- var handlerState11 = 1 /* UNINITIALIZED */;
5052
- function reset17() {
5216
+ var handlerState12 = 1 /* UNINITIALIZED */;
5217
+ function reset18() {
5053
5218
  allEvents2.length = 0;
5054
5219
  interactionEvents.length = 0;
5055
5220
  eventTimingStartEventsForInteractions.length = 0;
5056
5221
  eventTimingEndEventsById.clear();
5057
5222
  interactionEventsWithNoNesting.length = 0;
5058
5223
  longestInteractionEvent = null;
5059
- handlerState11 = 2 /* INITIALIZED */;
5224
+ handlerState12 = 2 /* INITIALIZED */;
5060
5225
  }
5061
- function handleEvent17(event) {
5062
- if (handlerState11 !== 2 /* INITIALIZED */) {
5226
+ function handleEvent18(event) {
5227
+ if (handlerState12 !== 2 /* INITIALIZED */) {
5063
5228
  throw new Error("Handler is not initialized");
5064
5229
  }
5065
5230
  if (!TraceEvents_exports.isTraceEventEventTiming(event)) {
@@ -5150,7 +5315,7 @@ function writeSyntheticTimespans(event) {
5150
5315
  event.mainThreadHandling = Timing_exports2.MicroSeconds(event.processingEnd - event.processingStart);
5151
5316
  event.presentationDelay = Timing_exports2.MicroSeconds(endEvent.ts - event.processingEnd);
5152
5317
  }
5153
- async function finalize14() {
5318
+ async function finalize15() {
5154
5319
  for (const interactionStartEvent of eventTimingStartEventsForInteractions) {
5155
5320
  const endEvent = eventTimingEndEventsById.get(interactionStartEvent.id);
5156
5321
  if (!endEvent) {
@@ -5186,7 +5351,7 @@ async function finalize14() {
5186
5351
  writeSyntheticTimespans(interactionEvent);
5187
5352
  interactionEvents.push(interactionEvent);
5188
5353
  }
5189
- handlerState11 = 3 /* FINALIZED */;
5354
+ handlerState12 = 3 /* FINALIZED */;
5190
5355
  interactionEventsWithNoNesting.push(...removeNestedInteractions(interactionEvents));
5191
5356
  for (const interactionEvent of interactionEventsWithNoNesting) {
5192
5357
  if (!longestInteractionEvent || longestInteractionEvent.dur < interactionEvent.dur) {
@@ -5194,7 +5359,7 @@ async function finalize14() {
5194
5359
  }
5195
5360
  }
5196
5361
  }
5197
- function data17() {
5362
+ function data18() {
5198
5363
  return {
5199
5364
  allEvents: [...allEvents2],
5200
5365
  interactionEvents: [...interactionEvents],
@@ -5209,24 +5374,24 @@ function data17() {
5209
5374
  // front_end/models/trace/handlers/UserTimingsHandler.ts
5210
5375
  var UserTimingsHandler_exports = {};
5211
5376
  __export(UserTimingsHandler_exports, {
5212
- data: () => data18,
5213
- finalize: () => finalize15,
5214
- handleEvent: () => handleEvent18,
5215
- reset: () => reset18
5377
+ data: () => data19,
5378
+ finalize: () => finalize16,
5379
+ handleEvent: () => handleEvent19,
5380
+ reset: () => reset19
5216
5381
  });
5217
5382
  var syntheticEvents = [];
5218
5383
  var performanceMeasureEvents = [];
5219
5384
  var performanceMarkEvents = [];
5220
5385
  var consoleTimings = [];
5221
5386
  var timestampEvents = [];
5222
- var handlerState12 = 1 /* UNINITIALIZED */;
5223
- function reset18() {
5387
+ var handlerState13 = 1 /* UNINITIALIZED */;
5388
+ function reset19() {
5224
5389
  syntheticEvents.length = 0;
5225
5390
  performanceMeasureEvents.length = 0;
5226
5391
  performanceMarkEvents.length = 0;
5227
5392
  consoleTimings.length = 0;
5228
5393
  timestampEvents.length = 0;
5229
- handlerState12 = 2 /* INITIALIZED */;
5394
+ handlerState13 = 2 /* INITIALIZED */;
5230
5395
  }
5231
5396
  var resourceTimingNames = [
5232
5397
  "workerStart",
@@ -5266,8 +5431,8 @@ var navTimingNames = [
5266
5431
  "loadEventStart",
5267
5432
  "loadEventEnd"
5268
5433
  ];
5269
- function handleEvent18(event) {
5270
- if (handlerState12 !== 2 /* INITIALIZED */) {
5434
+ function handleEvent19(event) {
5435
+ if (handlerState13 !== 2 /* INITIALIZED */) {
5271
5436
  throw new Error("UserTimings handler is not initialized");
5272
5437
  }
5273
5438
  const ignoredNames = [...resourceTimingNames, ...navTimingNames];
@@ -5288,16 +5453,16 @@ function handleEvent18(event) {
5288
5453
  timestampEvents.push(event);
5289
5454
  }
5290
5455
  }
5291
- async function finalize15() {
5292
- if (handlerState12 !== 2 /* INITIALIZED */) {
5456
+ async function finalize16() {
5457
+ if (handlerState13 !== 2 /* INITIALIZED */) {
5293
5458
  throw new Error("UserTimings handler is not initialized");
5294
5459
  }
5295
5460
  const asyncEvents = [...performanceMeasureEvents, ...consoleTimings];
5296
5461
  syntheticEvents.push(...Trace_exports.createMatchedSortedSyntheticEvents(asyncEvents));
5297
- handlerState12 = 3 /* FINALIZED */;
5462
+ handlerState13 = 3 /* FINALIZED */;
5298
5463
  }
5299
- function data18() {
5300
- if (handlerState12 !== 3 /* FINALIZED */) {
5464
+ function data19() {
5465
+ if (handlerState13 !== 3 /* FINALIZED */) {
5301
5466
  throw new Error("UserTimings handler is not finalized");
5302
5467
  }
5303
5468
  return {
@@ -5313,17 +5478,17 @@ var WarningsHandler_exports = {};
5313
5478
  __export(WarningsHandler_exports, {
5314
5479
  FORCED_LAYOUT_AND_STYLES_THRESHOLD: () => FORCED_LAYOUT_AND_STYLES_THRESHOLD,
5315
5480
  LONG_MAIN_THREAD_TASK_THRESHOLD: () => LONG_MAIN_THREAD_TASK_THRESHOLD,
5316
- data: () => data19,
5481
+ data: () => data20,
5317
5482
  deps: () => deps9,
5318
- finalize: () => finalize16,
5319
- handleEvent: () => handleEvent19,
5320
- reset: () => reset19
5483
+ finalize: () => finalize17,
5484
+ handleEvent: () => handleEvent20,
5485
+ reset: () => reset20
5321
5486
  });
5322
5487
  var warningsPerEvent = /* @__PURE__ */ new Map();
5323
5488
  var eventsPerWarning = /* @__PURE__ */ new Map();
5324
5489
  var FORCED_LAYOUT_AND_STYLES_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(10));
5325
5490
  var LONG_MAIN_THREAD_TASK_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(50));
5326
- function reset19() {
5491
+ function reset20() {
5327
5492
  warningsPerEvent.clear();
5328
5493
  eventsPerWarning.clear();
5329
5494
  }
@@ -5335,7 +5500,7 @@ function storeWarning(event, warning) {
5335
5500
  existingEvents.push(event);
5336
5501
  eventsPerWarning.set(warning, existingEvents);
5337
5502
  }
5338
- function handleEvent19(event) {
5503
+ function handleEvent20(event) {
5339
5504
  if (event.name === TraceEvents_exports.KnownEventName.RunTask) {
5340
5505
  const { duration } = Timing_exports3.eventTimingsMicroSeconds(event);
5341
5506
  if (duration > LONG_MAIN_THREAD_TASK_THRESHOLD) {
@@ -5366,13 +5531,13 @@ function handleEvent19(event) {
5366
5531
  function deps9() {
5367
5532
  return ["UserInteractions"];
5368
5533
  }
5369
- async function finalize16() {
5370
- const longInteractions = data17().interactionsOverThreshold;
5534
+ async function finalize17() {
5535
+ const longInteractions = data18().interactionsOverThreshold;
5371
5536
  for (const interaction of longInteractions) {
5372
5537
  storeWarning(interaction, "LONG_INTERACTION");
5373
5538
  }
5374
5539
  }
5375
- function data19() {
5540
+ function data20() {
5376
5541
  return {
5377
5542
  perEvent: new Map(warningsPerEvent),
5378
5543
  perWarning: new Map(eventsPerWarning)
@@ -5382,38 +5547,38 @@ function data19() {
5382
5547
  // front_end/models/trace/handlers/WorkersHandler.ts
5383
5548
  var WorkersHandler_exports = {};
5384
5549
  __export(WorkersHandler_exports, {
5385
- data: () => data20,
5386
- finalize: () => finalize17,
5387
- handleEvent: () => handleEvent20,
5388
- initialize: () => initialize10,
5389
- reset: () => reset20
5550
+ data: () => data21,
5551
+ finalize: () => finalize18,
5552
+ handleEvent: () => handleEvent21,
5553
+ initialize: () => initialize11,
5554
+ reset: () => reset21
5390
5555
  });
5391
- var handlerState13 = 1 /* UNINITIALIZED */;
5556
+ var handlerState14 = 1 /* UNINITIALIZED */;
5392
5557
  var sessionIdEvents = [];
5393
5558
  var workerIdByThread = /* @__PURE__ */ new Map();
5394
5559
  var workerURLById = /* @__PURE__ */ new Map();
5395
- function initialize10() {
5396
- if (handlerState13 !== 1 /* UNINITIALIZED */) {
5560
+ function initialize11() {
5561
+ if (handlerState14 !== 1 /* UNINITIALIZED */) {
5397
5562
  throw new Error("Workers Handler was not reset");
5398
5563
  }
5399
- handlerState13 = 2 /* INITIALIZED */;
5564
+ handlerState14 = 2 /* INITIALIZED */;
5400
5565
  }
5401
- function reset20() {
5566
+ function reset21() {
5402
5567
  sessionIdEvents.length = 0;
5403
5568
  workerIdByThread.clear();
5404
5569
  workerURLById.clear();
5405
- handlerState13 = 1 /* UNINITIALIZED */;
5570
+ handlerState14 = 1 /* UNINITIALIZED */;
5406
5571
  }
5407
- function handleEvent20(event) {
5408
- if (handlerState13 !== 2 /* INITIALIZED */) {
5572
+ function handleEvent21(event) {
5573
+ if (handlerState14 !== 2 /* INITIALIZED */) {
5409
5574
  throw new Error("Workers Handler is not initialized");
5410
5575
  }
5411
5576
  if (TraceEvents_exports.isTraceEventTracingSessionIdForWorker(event)) {
5412
5577
  sessionIdEvents.push(event);
5413
5578
  }
5414
5579
  }
5415
- async function finalize17() {
5416
- if (handlerState13 !== 2 /* INITIALIZED */) {
5580
+ async function finalize18() {
5581
+ if (handlerState14 !== 2 /* INITIALIZED */) {
5417
5582
  throw new Error("Handler is not initialized");
5418
5583
  }
5419
5584
  for (const sessionIdEvent of sessionIdEvents) {
@@ -5423,10 +5588,10 @@ async function finalize17() {
5423
5588
  workerIdByThread.set(sessionIdEvent.args.data.workerThreadId, sessionIdEvent.args.data.workerId);
5424
5589
  workerURLById.set(sessionIdEvent.args.data.workerId, sessionIdEvent.args.data.url);
5425
5590
  }
5426
- handlerState13 = 3 /* FINALIZED */;
5591
+ handlerState14 = 3 /* FINALIZED */;
5427
5592
  }
5428
- function data20() {
5429
- if (handlerState13 !== 3 /* FINALIZED */) {
5593
+ function data21() {
5594
+ if (handlerState14 !== 3 /* FINALIZED */) {
5430
5595
  throw new Error("Workers Handler is not finalized");
5431
5596
  }
5432
5597
  return {
@@ -6120,9 +6285,9 @@ __export(Processor_exports, {
6120
6285
  sortHandlers: () => sortHandlers
6121
6286
  });
6122
6287
  var _TraceParseProgressEvent = class extends Event {
6123
- constructor(data21, init = { bubbles: true }) {
6288
+ constructor(data22, init = { bubbles: true }) {
6124
6289
  super(_TraceParseProgressEvent.eventName, init);
6125
- this.data = data21;
6290
+ this.data = data22;
6126
6291
  }
6127
6292
  };
6128
6293
  var TraceParseProgressEvent = _TraceParseProgressEvent;
@@ -6226,11 +6391,11 @@ var TraceProcessor = class extends EventTarget {
6226
6391
  if (this.#status !== "FINISHED_PARSING" /* FINISHED_PARSING */) {
6227
6392
  return null;
6228
6393
  }
6229
- const data21 = {};
6394
+ const data22 = {};
6230
6395
  for (const [name, handler] of Object.entries(this.#traceHandlers)) {
6231
- Object.assign(data21, { [name]: handler.data() });
6396
+ Object.assign(data22, { [name]: handler.data() });
6232
6397
  }
6233
- return data21;
6398
+ return data22;
6234
6399
  }
6235
6400
  };
6236
6401
  function sortHandlers(traceHandlers) {
@@ -6316,8 +6481,8 @@ var Model = class extends EventTarget {
6316
6481
  const metadata = config2?.metadata || {};
6317
6482
  const isFreshRecording = config2?.isFreshRecording || false;
6318
6483
  const onTraceUpdate = (event) => {
6319
- const { data: data21 } = event;
6320
- this.dispatchEvent(new ModelUpdateEvent({ type: ModelUpdateType.PROGRESS_UPDATE, data: data21 }));
6484
+ const { data: data22 } = event;
6485
+ this.dispatchEvent(new ModelUpdateEvent({ type: ModelUpdateType.PROGRESS_UPDATE, data: data22 }));
6321
6486
  };
6322
6487
  this.#processor.addEventListener(TraceParseProgressEvent.eventName, onTraceUpdate);
6323
6488
  const file = {
@@ -6336,8 +6501,8 @@ var Model = class extends EventTarget {
6336
6501
  this.dispatchEvent(new ModelUpdateEvent({ type: ModelUpdateType.COMPLETE, data: "done" }));
6337
6502
  }
6338
6503
  }
6339
- #storeParsedFileData(file, data21) {
6340
- file.traceParsedData = data21;
6504
+ #storeParsedFileData(file, data22) {
6505
+ file.traceParsedData = data22;
6341
6506
  this.#lastRecordingIndex++;
6342
6507
  let recordingName = `Trace ${this.#lastRecordingIndex}`;
6343
6508
  let origin = null;
@@ -6389,9 +6554,9 @@ var ModelUpdateType = /* @__PURE__ */ ((ModelUpdateType2) => {
6389
6554
  return ModelUpdateType2;
6390
6555
  })(ModelUpdateType || {});
6391
6556
  var _ModelUpdateEvent = class extends Event {
6392
- constructor(data21) {
6557
+ constructor(data22) {
6393
6558
  super(_ModelUpdateEvent.eventName);
6394
- this.data = data21;
6559
+ this.data = data22;
6395
6560
  }
6396
6561
  };
6397
6562
  var ModelUpdateEvent = _ModelUpdateEvent;
@@ -6462,14 +6627,15 @@ var LayoutShiftRootCauses = class {
6462
6627
  this.linkShiftsToLayoutEvents(layoutShifts, modelData);
6463
6628
  }
6464
6629
  async linkShiftsToLayoutInvalidations(layoutShifts, modelData) {
6465
- const { prePaintEvents: prePaintEvents2, layoutInvalidationEvents: liEvents, backendNodeIds: backendNodeIds2 } = modelData.LayoutShifts;
6630
+ const { prePaintEvents: prePaintEvents2, layoutInvalidationEvents: layoutInvalidationEvents2, scheduleStyleInvalidationEvents: scheduleStyleInvalidationEvents2, backendNodeIds: backendNodeIds2 } = modelData.LayoutShifts;
6631
+ const eventsForLayoutInvalidation = [...layoutInvalidationEvents2, ...scheduleStyleInvalidationEvents2];
6466
6632
  const nodes = await this.#protocolInterface.pushNodesByBackendIdsToFrontend(backendNodeIds2);
6467
6633
  const nodeIdsByBackendIdMap = /* @__PURE__ */ new Map();
6468
6634
  for (let i = 0; i < backendNodeIds2.length; i++) {
6469
6635
  nodeIdsByBackendIdMap.set(backendNodeIds2[i], nodes[i]);
6470
6636
  }
6471
6637
  const shiftsByPrePaint = getShiftsByPrePaintEvents(layoutShifts, prePaintEvents2);
6472
- for (const layoutInvalidation of liEvents) {
6638
+ for (const layoutInvalidation of eventsForLayoutInvalidation) {
6473
6639
  const nextPrePaintIndex = array_utilities_exports.nearestIndexFromBeginning(prePaintEvents2, (prePaint) => prePaint.ts > layoutInvalidation.ts);
6474
6640
  if (nextPrePaintIndex === null) {
6475
6641
  continue;
@@ -6485,9 +6651,9 @@ var LayoutShiftRootCauses = class {
6485
6651
  const layoutInvalidationNode = layoutInvalidationNodeId !== void 0 ? await this.#protocolInterface.getNode(layoutInvalidationNodeId) : null;
6486
6652
  let unsizedMediaRootCause = null;
6487
6653
  let iframeRootCause = null;
6488
- if (layoutInvalidationNode) {
6654
+ if (layoutInvalidationNode && layoutInvalidation.args.data.reason) {
6489
6655
  unsizedMediaRootCause = await this.getUnsizedMediaRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);
6490
- iframeRootCause = await this.getIframeRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);
6656
+ iframeRootCause = this.getIframeRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);
6491
6657
  }
6492
6658
  if (!unsizedMediaRootCause && !iframeRootCause && !fontChangeRootCause && !renderBlockRootCause) {
6493
6659
  continue;