@paulirish/trace_engine 0.0.7 → 0.0.9

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
@@ -2200,6 +2232,7 @@ var browserThreadId = TraceEvents_exports.ThreadID(-1);
2200
2232
  var gpuProcessId = TraceEvents_exports.ProcessID(-1);
2201
2233
  var gpuThreadId = TraceEvents_exports.ThreadID(-1);
2202
2234
  var viewportRect = null;
2235
+ var processNames = /* @__PURE__ */ new Map();
2203
2236
  var topLevelRendererIds = /* @__PURE__ */ new Set();
2204
2237
  var traceBounds = {
2205
2238
  min: Timing_exports2.MicroSeconds(Number.POSITIVE_INFINITY),
@@ -2218,9 +2251,16 @@ var eventPhasesOfInterestForTraceBounds = /* @__PURE__ */ new Set([
2218
2251
  TraceEvents_exports.Phase.INSTANT
2219
2252
  ]);
2220
2253
  var handlerState2 = 1 /* UNINITIALIZED */;
2254
+ var traceIsGeneric = true;
2255
+ var CHROME_WEB_TRACE_EVENTS = /* @__PURE__ */ new Set([
2256
+ TraceEvents_exports.KnownEventName.TracingStartedInPage,
2257
+ TraceEvents_exports.KnownEventName.TracingSessionIdForWorker,
2258
+ TraceEvents_exports.KnownEventName.TracingStartedInBrowser
2259
+ ]);
2221
2260
  function reset3() {
2222
2261
  navigationsByFrameId.clear();
2223
2262
  navigationsByNavigationId.clear();
2263
+ processNames.clear();
2224
2264
  mainFrameNavigations.length = 0;
2225
2265
  browserProcessId = TraceEvents_exports.ProcessID(-1);
2226
2266
  browserThreadId = TraceEvents_exports.ThreadID(-1);
@@ -2235,6 +2275,7 @@ function reset3() {
2235
2275
  traceBounds.max = Timing_exports2.MicroSeconds(Number.NEGATIVE_INFINITY);
2236
2276
  traceBounds.range = Timing_exports2.MicroSeconds(Number.POSITIVE_INFINITY);
2237
2277
  traceStartedTimeFromTracingStartedEvent = Timing_exports2.MicroSeconds(-1);
2278
+ traceIsGeneric = true;
2238
2279
  handlerState2 = 1 /* UNINITIALIZED */;
2239
2280
  }
2240
2281
  function initialize() {
@@ -2267,6 +2308,12 @@ function handleEvent3(event) {
2267
2308
  if (handlerState2 !== 2 /* INITIALIZED */) {
2268
2309
  throw new Error("Meta Handler is not initialized");
2269
2310
  }
2311
+ if (traceIsGeneric && CHROME_WEB_TRACE_EVENTS.has(event.name)) {
2312
+ traceIsGeneric = false;
2313
+ }
2314
+ if (TraceEvents_exports.isProcessName(event)) {
2315
+ processNames.set(event.pid, event);
2316
+ }
2270
2317
  if (event.ts !== 0 && !event.name.endsWith("::UMA") && eventPhasesOfInterestForTraceBounds.has(event.ph)) {
2271
2318
  traceBounds.min = Timing_exports2.MicroSeconds(Math.min(event.ts, traceBounds.min));
2272
2319
  const eventDuration = event.dur || Timing_exports2.MicroSeconds(0);
@@ -2340,7 +2387,7 @@ function handleEvent3(event) {
2340
2387
  if (TraceEvents_exports.isTraceEventNavigationStartWithURL(event) && event.args.data) {
2341
2388
  const navigationId = event.args.data.navigationId;
2342
2389
  if (navigationsByNavigationId.has(navigationId)) {
2343
- throw new Error("Found multiple navigation start events with the same navigation ID.");
2390
+ return;
2344
2391
  }
2345
2392
  navigationsByNavigationId.set(navigationId, event);
2346
2393
  const frameId = event.args.frame;
@@ -2387,6 +2434,14 @@ async function finalize3() {
2387
2434
  navigationsByNavigationId.delete(navigation.args.data.navigationId);
2388
2435
  }
2389
2436
  }
2437
+ const firstMainFrameNav = mainFrameNavigations.at(0);
2438
+ const firstNavTimeThreshold = Timing_exports3.secondsToMicroseconds(Timing_exports2.Seconds(0.5));
2439
+ if (firstMainFrameNav) {
2440
+ const navigationIsWithinThreshold = firstMainFrameNav.ts - traceBounds.min < firstNavTimeThreshold;
2441
+ if (firstMainFrameNav.args.data?.isOutermostMainFrame && firstMainFrameNav.args.data?.documentLoaderURL && navigationIsWithinThreshold) {
2442
+ mainFrameURL = firstMainFrameNav.args.data.documentLoaderURL;
2443
+ }
2444
+ }
2390
2445
  handlerState2 = 3 /* FINALIZED */;
2391
2446
  }
2392
2447
  function data3() {
@@ -2397,6 +2452,7 @@ function data3() {
2397
2452
  traceBounds: { ...traceBounds },
2398
2453
  browserProcessId,
2399
2454
  browserThreadId,
2455
+ processNames: new Map(processNames),
2400
2456
  gpuProcessId,
2401
2457
  gpuThreadId: gpuThreadId === TraceEvents_exports.ThreadID(-1) ? void 0 : gpuThreadId,
2402
2458
  viewportRect: viewportRect || void 0,
@@ -2408,7 +2464,8 @@ function data3() {
2408
2464
  rendererProcessesByFrame: new Map(rendererProcessesByFrameId),
2409
2465
  topLevelRendererIds: new Set(topLevelRendererIds),
2410
2466
  frameByProcessId: new Map(framesByProcessId),
2411
- mainFrameNavigations: [...mainFrameNavigations]
2467
+ mainFrameNavigations: [...mainFrameNavigations],
2468
+ traceIsGeneric
2412
2469
  };
2413
2470
  }
2414
2471
 
@@ -3167,8 +3224,8 @@ function getOrCreatePreProcessedData(processId, profileId) {
3167
3224
  profileId
3168
3225
  }));
3169
3226
  }
3170
- function getProfileCallFunctionName(data21, entry) {
3171
- const profile = data21.profilesInProcess.get(entry.pid)?.get(entry.tid);
3227
+ function getProfileCallFunctionName(data22, entry) {
3228
+ const profile = data22.profilesInProcess.get(entry.pid)?.get(entry.tid);
3172
3229
  const node = profile?.parsedProfile.nodeById(entry.nodeId);
3173
3230
  if (node?.functionName) {
3174
3231
  return node.functionName;
@@ -3309,18 +3366,19 @@ function assignIsMainFrame(processes2, mainFrameId2, rendererProcessesByFrame) {
3309
3366
  }
3310
3367
  }
3311
3368
  function assignThreadName(processes2, rendererProcessesByFrame, threadsInProcess2) {
3312
- for (const [, renderProcessesByPid] of rendererProcessesByFrame) {
3313
- for (const [pid] of renderProcessesByPid) {
3314
- const process = getOrCreateRendererProcess(processes2, pid);
3315
- for (const [tid, threadInfo] of threadsInProcess2.get(pid) ?? []) {
3316
- const thread = getOrCreateRendererThread(process, tid);
3317
- thread.name = threadInfo?.args.name ?? `${tid}`;
3318
- }
3369
+ for (const [pid, process] of processes2) {
3370
+ for (const [tid, threadInfo] of threadsInProcess2.get(pid) ?? []) {
3371
+ const thread = getOrCreateRendererThread(process, tid);
3372
+ thread.name = threadInfo?.args.name ?? `${tid}`;
3319
3373
  }
3320
3374
  }
3321
3375
  }
3322
3376
  function sanitizeProcesses(processes2) {
3323
3377
  const auctionWorklets = data2().worklets;
3378
+ const metaData = data3();
3379
+ if (metaData.traceIsGeneric) {
3380
+ return;
3381
+ }
3324
3382
  for (const [pid, process] of processes2) {
3325
3383
  if (process.url === null) {
3326
3384
  const maybeWorklet = auctionWorklets.get(pid);
@@ -3331,10 +3389,6 @@ function sanitizeProcesses(processes2) {
3331
3389
  }
3332
3390
  continue;
3333
3391
  }
3334
- const asUrl = new URL(process.url);
3335
- if (asUrl.protocol === "about:") {
3336
- processes2.delete(pid);
3337
- }
3338
3392
  }
3339
3393
  }
3340
3394
  function sanitizeThreads(processes2) {
@@ -3408,6 +3462,7 @@ var ThreadType = /* @__PURE__ */ ((ThreadType2) => {
3408
3462
  ThreadType2["AUCTION_WORKLET"] = "AUCTION_WORKLET";
3409
3463
  ThreadType2["OTHER"] = "OTHER";
3410
3464
  ThreadType2["CPU_PROFILE"] = "CPU_PROFILE";
3465
+ ThreadType2["THREAD_POOL"] = "THREAD_POOL";
3411
3466
  return ThreadType2;
3412
3467
  })(ThreadType || {});
3413
3468
  function getThreadTypeForRendererThread(auctionWorkletsData, pid, thread) {
@@ -3420,6 +3475,8 @@ function getThreadTypeForRendererThread(auctionWorkletsData, pid, thread) {
3420
3475
  threadType = "RASTERIZER" /* RASTERIZER */;
3421
3476
  } else if (auctionWorkletsData.worklets.has(pid)) {
3422
3477
  threadType = "AUCTION_WORKLET" /* AUCTION_WORKLET */;
3478
+ } else if (thread.name?.startsWith("ThreadPool")) {
3479
+ threadType = "THREAD_POOL" /* THREAD_POOL */;
3423
3480
  }
3424
3481
  return threadType;
3425
3482
  }
@@ -3428,10 +3485,10 @@ function threadsInRenderer(rendererData, auctionWorkletsData) {
3428
3485
  if (rendererData.processes.size) {
3429
3486
  for (const [pid, process] of rendererData.processes) {
3430
3487
  for (const [tid, thread] of process.threads) {
3431
- const threadType = getThreadTypeForRendererThread(auctionWorkletsData, pid, thread);
3432
3488
  if (!thread.tree) {
3433
3489
  continue;
3434
3490
  }
3491
+ const threadType = getThreadTypeForRendererThread(auctionWorkletsData, pid, thread);
3435
3492
  foundThreads.push({
3436
3493
  name: thread.name,
3437
3494
  pid,
@@ -3496,12 +3553,14 @@ async function finalize7() {
3496
3553
  if (handlerState6 !== 2 /* INITIALIZED */) {
3497
3554
  throw new Error("FramesHandler is not initialized");
3498
3555
  }
3556
+ Trace_exports.sortTraceEventsInPlace(allEvents);
3499
3557
  const modelForTrace = new TimelineFrameModel(allEvents, data6(), data2(), data3(), data4());
3500
3558
  model = modelForTrace;
3501
3559
  }
3502
3560
  function data7() {
3503
3561
  return {
3504
- frames: model ? Array.from(model.frames()) : []
3562
+ frames: model ? Array.from(model.frames()) : [],
3563
+ framesById: model ? { ...model.framesById() } : {}
3505
3564
  };
3506
3565
  }
3507
3566
  function deps3() {
@@ -3510,14 +3569,6 @@ function deps3() {
3510
3569
  function isFrameEvent(event) {
3511
3570
  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
3571
  }
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
3572
  function entryIsTopLevel(entry) {
3522
3573
  const devtoolsTimelineCategory = "disabled-by-default-devtools.timeline";
3523
3574
  return entry.name === TraceEvents_exports.KnownEventName.RunTask && entry.cat.includes(devtoolsTimelineCategory);
@@ -3526,7 +3577,6 @@ var TimelineFrameModel = class {
3526
3577
  #frames = [];
3527
3578
  #frameById = {};
3528
3579
  #beginFrameQueue = new TimelineFrameBeginFrameQueue();
3529
- #minimumRecordTime = Timing_exports2.MicroSeconds(Infinity);
3530
3580
  #lastFrame = null;
3531
3581
  #mainFrameCommitted = false;
3532
3582
  #mainFrameRequested = false;
@@ -3554,6 +3604,9 @@ var TimelineFrameModel = class {
3554
3604
  this.#layerTreeData = layerTreeData;
3555
3605
  this.#addTraceEvents(allEvents3, threadData, metaData.mainFrameId);
3556
3606
  }
3607
+ framesById() {
3608
+ return this.#frameById;
3609
+ }
3557
3610
  frames() {
3558
3611
  return this.#frames;
3559
3612
  }
@@ -3638,7 +3691,7 @@ var TimelineFrameModel = class {
3638
3691
  if (this.#lastFrame) {
3639
3692
  this.#flushFrame(this.#lastFrame, startTime);
3640
3693
  }
3641
- this.#lastFrame = new TimelineFrame(seqId, startTime, Timing_exports2.MicroSeconds(startTime - this.#minimumRecordTime));
3694
+ this.#lastFrame = new TimelineFrame(seqId, startTime, Timing_exports2.MicroSeconds(startTime - data3().traceBounds.min));
3642
3695
  }
3643
3696
  #flushFrame(frame, endTime) {
3644
3697
  frame.setLayerTree(this.#lastLayerTree);
@@ -3678,13 +3731,9 @@ var TimelineFrameModel = class {
3678
3731
  this.#activeProcessId = null;
3679
3732
  }
3680
3733
  #addTraceEvent(event, mainFrameId2) {
3681
- if (event.ts && event.ts < this.#minimumRecordTime) {
3682
- this.#minimumRecordTime = event.ts;
3683
- }
3684
- const entryId = idForEntry(event);
3685
3734
  if (TraceEvents_exports.isTraceEventSetLayerId(event) && event.args.data.frame === mainFrameId2) {
3686
3735
  this.#layerTreeId = event.args.data.layerTreeId;
3687
- } else if (entryId && TraceEvents_exports.isTraceEventLayerTreeHostImplSnapshot(event) && Number(entryId) === this.#layerTreeId) {
3736
+ } else if (TraceEvents_exports.isTraceEventLayerTreeHostImplSnapshot(event) && Number(event.id) === this.#layerTreeId) {
3688
3737
  this.#handleLayerTreeSnapshot({
3689
3738
  entry: event,
3690
3739
  paints: []
@@ -3857,6 +3906,11 @@ var TimelineFrameBeginFrameQueue = class {
3857
3906
  return framesToVisualize;
3858
3907
  }
3859
3908
  };
3909
+ function framesWithinWindow(frames, startTime, endTime) {
3910
+ const firstFrame = array_utilities_exports.lowerBound(frames, startTime || 0, (time, frame) => time - frame.endTime);
3911
+ const lastFrame = array_utilities_exports.lowerBound(frames, endTime || Infinity, (time, frame) => time - frame.startTime);
3912
+ return frames.slice(firstFrame, lastFrame);
3913
+ }
3860
3914
 
3861
3915
  // front_end/models/trace/handlers/GPUHandler.ts
3862
3916
  var GPUHandler_exports = {};
@@ -3951,11 +4005,11 @@ function initialize7() {
3951
4005
  }
3952
4006
  handlerState8 = 2 /* INITIALIZED */;
3953
4007
  }
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);
4008
+ function storeInitiator(data22) {
4009
+ eventToInitiatorMap.set(data22.event, data22.initiator);
4010
+ const eventsForInitiator = initiatorToEventsMap.get(data22.initiator) || [];
4011
+ eventsForInitiator.push(data22.event);
4012
+ initiatorToEventsMap.set(data22.initiator, eventsForInitiator);
3959
4013
  }
3960
4014
  function handleEvent9(event) {
3961
4015
  if (TraceEvents_exports.isTraceEventScheduleStyleRecalculation(event)) {
@@ -4053,18 +4107,123 @@ function data9() {
4053
4107
  };
4054
4108
  }
4055
4109
 
4056
- // front_end/models/trace/handlers/LargestImagePaintHandler.ts
4057
- var LargestImagePaintHandler_exports = {};
4058
- __export(LargestImagePaintHandler_exports, {
4110
+ // front_end/models/trace/handlers/InvalidationsHandler.ts
4111
+ var InvalidationsHandler_exports = {};
4112
+ __export(InvalidationsHandler_exports, {
4059
4113
  data: () => data10,
4114
+ finalize: () => finalize10,
4060
4115
  handleEvent: () => handleEvent10,
4116
+ initialize: () => initialize8,
4061
4117
  reset: () => reset10
4062
4118
  });
4063
- var imageByDOMNodeId = /* @__PURE__ */ new Map();
4119
+ var handlerState9 = 1 /* UNINITIALIZED */;
4120
+ var invalidationsForEvent = /* @__PURE__ */ new Map();
4121
+ var lastRecalcStyleEvent = null;
4122
+ var hasPainted = false;
4123
+ var allInvalidationTrackingEvents = [];
4064
4124
  function reset10() {
4065
- imageByDOMNodeId.clear();
4125
+ handlerState9 = 1 /* UNINITIALIZED */;
4126
+ invalidationsForEvent.clear();
4127
+ lastRecalcStyleEvent = null;
4128
+ allInvalidationTrackingEvents.length = 0;
4129
+ hasPainted = false;
4130
+ }
4131
+ function initialize8() {
4132
+ if (handlerState9 !== 1 /* UNINITIALIZED */) {
4133
+ throw new Error("InvalidationsHandler was not reset before being initialized");
4134
+ }
4135
+ handlerState9 = 2 /* INITIALIZED */;
4136
+ }
4137
+ function addInvalidationToEvent(event, invalidation) {
4138
+ const existingInvalidations = invalidationsForEvent.get(event) || [];
4139
+ const syntheticInvalidation = {
4140
+ ...invalidation,
4141
+ name: "SyntheticInvalidation",
4142
+ frame: invalidation.args.data.frame,
4143
+ nodeId: invalidation.args.data.nodeId,
4144
+ rawEvent: invalidation
4145
+ };
4146
+ if (invalidation.args.data.nodeName) {
4147
+ syntheticInvalidation.nodeName = invalidation.args.data.nodeName;
4148
+ }
4149
+ if (invalidation.args.data.reason) {
4150
+ syntheticInvalidation.reason = invalidation.args.data.reason;
4151
+ }
4152
+ if (invalidation.args.data.stackTrace) {
4153
+ syntheticInvalidation.stackTrace = invalidation.args.data.stackTrace;
4154
+ }
4155
+ existingInvalidations.push(syntheticInvalidation);
4156
+ invalidationsForEvent.set(event, existingInvalidations);
4066
4157
  }
4067
4158
  function handleEvent10(event) {
4159
+ if (TraceEvents_exports.isTraceEventUpdateLayoutTree(event)) {
4160
+ lastRecalcStyleEvent = event;
4161
+ for (const invalidation of allInvalidationTrackingEvents) {
4162
+ if (TraceEvents_exports.isTraceEventLayoutInvalidationTracking(invalidation)) {
4163
+ continue;
4164
+ }
4165
+ const recalcFrameId = lastRecalcStyleEvent.args.beginData?.frame;
4166
+ if (recalcFrameId && invalidation.args.data.frame === recalcFrameId) {
4167
+ addInvalidationToEvent(event, invalidation);
4168
+ }
4169
+ }
4170
+ return;
4171
+ }
4172
+ if (TraceEvents_exports.isTraceEventScheduleStyleInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleRecalcInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleInvalidatorInvalidationTracking(event) || TraceEvents_exports.isTraceEventLayoutInvalidationTracking(event)) {
4173
+ if (hasPainted) {
4174
+ allInvalidationTrackingEvents.length = 0;
4175
+ lastRecalcStyleEvent = null;
4176
+ hasPainted = false;
4177
+ }
4178
+ if (lastRecalcStyleEvent && (TraceEvents_exports.isTraceEventScheduleStyleInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleRecalcInvalidationTracking(event) || TraceEvents_exports.isTraceEventStyleInvalidatorInvalidationTracking(event))) {
4179
+ const recalcEndTime = lastRecalcStyleEvent.ts + (lastRecalcStyleEvent.dur || 0);
4180
+ if (event.ts >= lastRecalcStyleEvent.ts && event.ts <= recalcEndTime && lastRecalcStyleEvent.args.beginData?.frame === event.args.data.frame) {
4181
+ addInvalidationToEvent(lastRecalcStyleEvent, event);
4182
+ }
4183
+ }
4184
+ allInvalidationTrackingEvents.push(event);
4185
+ return;
4186
+ }
4187
+ if (TraceEvents_exports.isTraceEventPaint(event)) {
4188
+ hasPainted = true;
4189
+ return;
4190
+ }
4191
+ if (TraceEvents_exports.isTraceEventLayout(event)) {
4192
+ const layoutFrame = event.args.beginData.frame;
4193
+ for (const invalidation of allInvalidationTrackingEvents) {
4194
+ if (!TraceEvents_exports.isTraceEventLayoutInvalidationTracking(invalidation)) {
4195
+ continue;
4196
+ }
4197
+ if (invalidation.args.data.frame === layoutFrame) {
4198
+ addInvalidationToEvent(event, invalidation);
4199
+ }
4200
+ }
4201
+ }
4202
+ }
4203
+ async function finalize10() {
4204
+ if (handlerState9 !== 2 /* INITIALIZED */) {
4205
+ throw new Error("InvalidationsHandler is not initialized");
4206
+ }
4207
+ handlerState9 = 3 /* FINALIZED */;
4208
+ }
4209
+ function data10() {
4210
+ return {
4211
+ invalidationsForEvent: new Map(invalidationsForEvent)
4212
+ };
4213
+ }
4214
+
4215
+ // front_end/models/trace/handlers/LargestImagePaintHandler.ts
4216
+ var LargestImagePaintHandler_exports = {};
4217
+ __export(LargestImagePaintHandler_exports, {
4218
+ data: () => data11,
4219
+ handleEvent: () => handleEvent11,
4220
+ reset: () => reset11
4221
+ });
4222
+ var imageByDOMNodeId = /* @__PURE__ */ new Map();
4223
+ function reset11() {
4224
+ imageByDOMNodeId.clear();
4225
+ }
4226
+ function handleEvent11(event) {
4068
4227
  if (!TraceEvents_exports.isTraceEventLargestImagePaintCandidate(event)) {
4069
4228
  return;
4070
4229
  }
@@ -4073,22 +4232,22 @@ function handleEvent10(event) {
4073
4232
  }
4074
4233
  imageByDOMNodeId.set(event.args.data.DOMNodeId, event);
4075
4234
  }
4076
- function data10() {
4235
+ function data11() {
4077
4236
  return new Map(imageByDOMNodeId);
4078
4237
  }
4079
4238
 
4080
4239
  // front_end/models/trace/handlers/LargestTextPaintHandler.ts
4081
4240
  var LargestTextPaintHandler_exports = {};
4082
4241
  __export(LargestTextPaintHandler_exports, {
4083
- data: () => data11,
4084
- handleEvent: () => handleEvent11,
4085
- reset: () => reset11
4242
+ data: () => data12,
4243
+ handleEvent: () => handleEvent12,
4244
+ reset: () => reset12
4086
4245
  });
4087
4246
  var textPaintByDOMNodeId = /* @__PURE__ */ new Map();
4088
- function reset11() {
4247
+ function reset12() {
4089
4248
  textPaintByDOMNodeId.clear();
4090
4249
  }
4091
- function handleEvent11(event) {
4250
+ function handleEvent12(event) {
4092
4251
  if (!TraceEvents_exports.isTraceEventLargestTextPaintCandidate(event)) {
4093
4252
  return;
4094
4253
  }
@@ -4097,7 +4256,7 @@ function handleEvent11(event) {
4097
4256
  }
4098
4257
  textPaintByDOMNodeId.set(event.args.data.DOMNodeId, event);
4099
4258
  }
4100
- function data11() {
4259
+ function data12() {
4101
4260
  return new Map(textPaintByDOMNodeId);
4102
4261
  }
4103
4262
 
@@ -4107,13 +4266,13 @@ __export(LayoutShiftsHandler_exports, {
4107
4266
  LayoutShiftsThreshold: () => LayoutShiftsThreshold,
4108
4267
  MAX_CLUSTER_DURATION: () => MAX_CLUSTER_DURATION,
4109
4268
  MAX_SHIFT_TIME_DELTA: () => MAX_SHIFT_TIME_DELTA,
4110
- data: () => data14,
4269
+ data: () => data15,
4111
4270
  deps: () => deps7,
4112
- finalize: () => finalize12,
4271
+ finalize: () => finalize13,
4113
4272
  findNextScreenshotEventIndex: () => findNextScreenshotEventIndex,
4114
- handleEvent: () => handleEvent14,
4115
- initialize: () => initialize8,
4116
- reset: () => reset14,
4273
+ handleEvent: () => handleEvent15,
4274
+ initialize: () => initialize9,
4275
+ reset: () => reset15,
4117
4276
  stateForLayoutShiftScore: () => stateForLayoutShiftScore
4118
4277
  });
4119
4278
 
@@ -4123,14 +4282,14 @@ __export(PageLoadMetricsHandler_exports, {
4123
4282
  MarkerName: () => MarkerName,
4124
4283
  MetricName: () => MetricName,
4125
4284
  ScoreClassification: () => ScoreClassification,
4126
- data: () => data12,
4285
+ data: () => data13,
4127
4286
  deps: () => deps5,
4128
4287
  eventIsPageLoadEvent: () => eventIsPageLoadEvent,
4129
- finalize: () => finalize10,
4288
+ finalize: () => finalize11,
4130
4289
  getFrameIdForPageLoadEvent: () => getFrameIdForPageLoadEvent,
4131
- handleEvent: () => handleEvent12,
4290
+ handleEvent: () => handleEvent13,
4132
4291
  isTraceEventMarkerEvent: () => isTraceEventMarkerEvent,
4133
- reset: () => reset12,
4292
+ reset: () => reset13,
4134
4293
  scoreClassificationForDOMContentLoaded: () => scoreClassificationForDOMContentLoaded,
4135
4294
  scoreClassificationForFirstContentfulPaint: () => scoreClassificationForFirstContentfulPaint,
4136
4295
  scoreClassificationForLargestContentfulPaint: () => scoreClassificationForLargestContentfulPaint,
@@ -4139,7 +4298,7 @@ __export(PageLoadMetricsHandler_exports, {
4139
4298
  });
4140
4299
  var metricScoresByFrameId = /* @__PURE__ */ new Map();
4141
4300
  var allMarkerEvents = [];
4142
- function reset12() {
4301
+ function reset13() {
4143
4302
  metricScoresByFrameId.clear();
4144
4303
  pageLoadEventsArray = [];
4145
4304
  allMarkerEvents = [];
@@ -4166,7 +4325,7 @@ var pageLoadEventTypeGuards = [
4166
4325
  function eventIsPageLoadEvent(event) {
4167
4326
  return pageLoadEventTypeGuards.some((fn) => fn(event));
4168
4327
  }
4169
- function handleEvent12(event) {
4328
+ function handleEvent13(event) {
4170
4329
  if (!eventIsPageLoadEvent(event)) {
4171
4330
  return;
4172
4331
  }
@@ -4425,7 +4584,7 @@ function gatherFinalLCPEvents() {
4425
4584
  }
4426
4585
  return allFinalLCPEvents;
4427
4586
  }
4428
- async function finalize10() {
4587
+ async function finalize11() {
4429
4588
  pageLoadEventsArray.sort((a, b) => a.ts - b.ts);
4430
4589
  for (const pageLoadEvent of pageLoadEventsArray) {
4431
4590
  const navigation = getNavigationForPageLoadEvent(pageLoadEvent);
@@ -4439,7 +4598,7 @@ async function finalize10() {
4439
4598
  const markerEvents = [...allFinalLCPEvents, ...allEventsButLCP].filter(isTraceEventMarkerEvent);
4440
4599
  allMarkerEvents = markerEvents.filter((event) => getFrameIdForPageLoadEvent(event) === mainFrame).sort((a, b) => a.ts - b.ts);
4441
4600
  }
4442
- function data12() {
4601
+ function data13() {
4443
4602
  return {
4444
4603
  metricScoresByFrameId: new Map(metricScoresByFrameId),
4445
4604
  allMarkerEvents: [...allMarkerEvents]
@@ -4470,32 +4629,32 @@ var MetricName = /* @__PURE__ */ ((MetricName2) => {
4470
4629
  // front_end/models/trace/handlers/ScreenshotsHandler.ts
4471
4630
  var ScreenshotsHandler_exports = {};
4472
4631
  __export(ScreenshotsHandler_exports, {
4473
- data: () => data13,
4632
+ data: () => data14,
4474
4633
  deps: () => deps6,
4475
- finalize: () => finalize11,
4476
- handleEvent: () => handleEvent13,
4477
- reset: () => reset13
4634
+ finalize: () => finalize12,
4635
+ handleEvent: () => handleEvent14,
4636
+ reset: () => reset14
4478
4637
  });
4479
4638
  var eventsInProcessThread2 = /* @__PURE__ */ new Map();
4480
4639
  var snapshots = [];
4481
- function reset13() {
4640
+ function reset14() {
4482
4641
  eventsInProcessThread2.clear();
4483
4642
  snapshots.length = 0;
4484
4643
  }
4485
- function handleEvent13(event) {
4644
+ function handleEvent14(event) {
4486
4645
  if (event.name !== "Screenshot") {
4487
4646
  return;
4488
4647
  }
4489
4648
  Trace_exports.addEventToProcessThread(event, eventsInProcessThread2);
4490
4649
  }
4491
- async function finalize11() {
4650
+ async function finalize12() {
4492
4651
  const { browserProcessId: browserProcessId2, browserThreadId: browserThreadId2 } = data3();
4493
4652
  const browserThreads = eventsInProcessThread2.get(browserProcessId2);
4494
4653
  if (browserThreads) {
4495
4654
  snapshots = browserThreads.get(browserThreadId2) || [];
4496
4655
  }
4497
4656
  }
4498
- function data13() {
4657
+ function data14() {
4499
4658
  return [...snapshots];
4500
4659
  }
4501
4660
  function deps6() {
@@ -4507,6 +4666,7 @@ var MAX_CLUSTER_DURATION = Timing_exports3.millisecondsToMicroseconds(Timing_exp
4507
4666
  var MAX_SHIFT_TIME_DELTA = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(1e3));
4508
4667
  var layoutShiftEvents = [];
4509
4668
  var layoutInvalidationEvents = [];
4669
+ var scheduleStyleInvalidationEvents = [];
4510
4670
  var styleRecalcInvalidationEvents = [];
4511
4671
  var backendNodeIds = /* @__PURE__ */ new Set();
4512
4672
  var prePaintEvents = [];
@@ -4514,17 +4674,19 @@ var sessionMaxScore = 0;
4514
4674
  var clsWindowID = -1;
4515
4675
  var clusters = [];
4516
4676
  var scoreRecords = [];
4517
- var handlerState9 = 1 /* UNINITIALIZED */;
4518
- function initialize8() {
4519
- if (handlerState9 !== 1 /* UNINITIALIZED */) {
4677
+ var handlerState10 = 1 /* UNINITIALIZED */;
4678
+ function initialize9() {
4679
+ if (handlerState10 !== 1 /* UNINITIALIZED */) {
4520
4680
  throw new Error("LayoutShifts Handler was not reset");
4521
4681
  }
4522
- handlerState9 = 2 /* INITIALIZED */;
4682
+ handlerState10 = 2 /* INITIALIZED */;
4523
4683
  }
4524
- function reset14() {
4525
- handlerState9 = 1 /* UNINITIALIZED */;
4684
+ function reset15() {
4685
+ handlerState10 = 1 /* UNINITIALIZED */;
4526
4686
  layoutShiftEvents.length = 0;
4527
4687
  layoutInvalidationEvents.length = 0;
4688
+ scheduleStyleInvalidationEvents.length = 0;
4689
+ styleRecalcInvalidationEvents.length = 0;
4528
4690
  prePaintEvents.length = 0;
4529
4691
  backendNodeIds.clear();
4530
4692
  clusters.length = 0;
@@ -4532,19 +4694,22 @@ function reset14() {
4532
4694
  scoreRecords.length = 0;
4533
4695
  clsWindowID = -1;
4534
4696
  }
4535
- function handleEvent14(event) {
4536
- if (handlerState9 !== 2 /* INITIALIZED */) {
4697
+ function handleEvent15(event) {
4698
+ if (handlerState10 !== 2 /* INITIALIZED */) {
4537
4699
  throw new Error("Handler is not initialized");
4538
4700
  }
4539
4701
  if (TraceEvents_exports.isTraceEventLayoutShift(event) && !event.args.data?.had_recent_input) {
4540
4702
  layoutShiftEvents.push(event);
4541
4703
  return;
4542
4704
  }
4543
- if (TraceEvents_exports.isTraceEventLayoutInvalidation(event)) {
4705
+ if (TraceEvents_exports.isTraceEventLayoutInvalidationTracking(event)) {
4544
4706
  layoutInvalidationEvents.push(event);
4545
4707
  return;
4546
4708
  }
4547
- if (TraceEvents_exports.isTraceEventStyleRecalcInvalidation(event)) {
4709
+ if (TraceEvents_exports.isTraceEventScheduleStyleInvalidationTracking(event)) {
4710
+ scheduleStyleInvalidationEvents.push(event);
4711
+ }
4712
+ if (TraceEvents_exports.isTraceEventStyleRecalcInvalidationTracking(event)) {
4548
4713
  styleRecalcInvalidationEvents.push(event);
4549
4714
  }
4550
4715
  if (TraceEvents_exports.isTraceEventPrePaint(event)) {
@@ -4564,7 +4729,7 @@ function updateTraceWindowMax(traceWindow, newMax) {
4564
4729
  traceWindow.range = Timing_exports2.MicroSeconds(traceWindow.max - traceWindow.min);
4565
4730
  }
4566
4731
  function findNextScreenshotSource(timestamp) {
4567
- const screenshots = data13();
4732
+ const screenshots = data14();
4568
4733
  const screenshotIndex = findNextScreenshotEventIndex(screenshots, timestamp);
4569
4734
  if (!screenshotIndex) {
4570
4735
  return void 0;
@@ -4609,15 +4774,21 @@ function collectNodes() {
4609
4774
  }
4610
4775
  backendNodeIds.add(layoutInvalidation.args.data.nodeId);
4611
4776
  }
4777
+ for (const scheduleStyleInvalidation of scheduleStyleInvalidationEvents) {
4778
+ if (!scheduleStyleInvalidation.args.data?.nodeId) {
4779
+ continue;
4780
+ }
4781
+ backendNodeIds.add(scheduleStyleInvalidation.args.data.nodeId);
4782
+ }
4612
4783
  }
4613
- async function finalize12() {
4784
+ async function finalize13() {
4614
4785
  layoutShiftEvents.sort((a, b) => a.ts - b.ts);
4615
4786
  prePaintEvents.sort((a, b) => a.ts - b.ts);
4616
4787
  layoutInvalidationEvents.sort((a, b) => a.ts - b.ts);
4617
4788
  await buildLayoutShiftsClusters();
4618
4789
  buildScoreRecords();
4619
4790
  collectNodes();
4620
- handlerState9 = 3 /* FINALIZED */;
4791
+ handlerState10 = 3 /* FINALIZED */;
4621
4792
  }
4622
4793
  async function buildLayoutShiftsClusters() {
4623
4794
  const { navigationsByFrameId: navigationsByFrameId2, mainFrameId: mainFrameId2, traceBounds: traceBounds2 } = data3();
@@ -4731,8 +4902,8 @@ async function buildLayoutShiftsClusters() {
4731
4902
  }
4732
4903
  }
4733
4904
  }
4734
- function data14() {
4735
- if (handlerState9 !== 3 /* FINALIZED */) {
4905
+ function data15() {
4906
+ if (handlerState10 !== 3 /* FINALIZED */) {
4736
4907
  throw new Error("Layout Shifts Handler is not finalized");
4737
4908
  }
4738
4909
  return {
@@ -4741,6 +4912,7 @@ function data14() {
4741
4912
  clsWindowID,
4742
4913
  prePaintEvents: [...prePaintEvents],
4743
4914
  layoutInvalidationEvents: [...layoutInvalidationEvents],
4915
+ scheduleStyleInvalidationEvents: [...scheduleStyleInvalidationEvents],
4744
4916
  styleRecalcInvalidationEvents: [],
4745
4917
  scoreRecords: [...scoreRecords],
4746
4918
  backendNodeIds: [...backendNodeIds]
@@ -4769,34 +4941,34 @@ var LayoutShiftsThreshold = /* @__PURE__ */ ((LayoutShiftsThreshold2) => {
4769
4941
  // front_end/models/trace/handlers/MemoryHandler.ts
4770
4942
  var MemoryHandler_exports = {};
4771
4943
  __export(MemoryHandler_exports, {
4772
- data: () => data15,
4773
- handleEvent: () => handleEvent15,
4774
- reset: () => reset15
4944
+ data: () => data16,
4945
+ handleEvent: () => handleEvent16,
4946
+ reset: () => reset16
4775
4947
  });
4776
4948
  var updateCountersByProcess = /* @__PURE__ */ new Map();
4777
- function reset15() {
4949
+ function reset16() {
4778
4950
  updateCountersByProcess.clear();
4779
4951
  }
4780
- function handleEvent15(event) {
4952
+ function handleEvent16(event) {
4781
4953
  if (TraceEvents_exports.isTraceEventUpdateCounters(event)) {
4782
4954
  const countersForProcess = map_utilities_exports.getWithDefault(updateCountersByProcess, event.pid, () => []);
4783
4955
  countersForProcess.push(event);
4784
4956
  updateCountersByProcess.set(event.pid, countersForProcess);
4785
4957
  }
4786
4958
  }
4787
- function data15() {
4959
+ function data16() {
4788
4960
  return { updateCountersByProcess: new Map(updateCountersByProcess) };
4789
4961
  }
4790
4962
 
4791
4963
  // front_end/models/trace/handlers/NetworkRequestsHandler.ts
4792
4964
  var NetworkRequestsHandler_exports = {};
4793
4965
  __export(NetworkRequestsHandler_exports, {
4794
- data: () => data16,
4966
+ data: () => data17,
4795
4967
  deps: () => deps8,
4796
- finalize: () => finalize13,
4797
- handleEvent: () => handleEvent16,
4798
- initialize: () => initialize9,
4799
- reset: () => reset16
4968
+ finalize: () => finalize14,
4969
+ handleEvent: () => handleEvent17,
4970
+ initialize: () => initialize10,
4971
+ reset: () => reset17
4800
4972
  });
4801
4973
  var MILLISECONDS_TO_MICROSECONDS = 1e3;
4802
4974
  var SECONDS_TO_MICROSECONDS = 1e6;
@@ -4827,18 +4999,18 @@ function firstPositiveValueInList(entries) {
4827
4999
  }
4828
5000
  return 0;
4829
5001
  }
4830
- var handlerState10 = 1 /* UNINITIALIZED */;
4831
- function reset16() {
5002
+ var handlerState11 = 1 /* UNINITIALIZED */;
5003
+ function reset17() {
4832
5004
  requestsByOrigin.clear();
4833
5005
  requestMap.clear();
4834
5006
  requestsByTime.length = 0;
4835
- handlerState10 = 1 /* UNINITIALIZED */;
5007
+ handlerState11 = 1 /* UNINITIALIZED */;
4836
5008
  }
4837
- function initialize9() {
4838
- handlerState10 = 2 /* INITIALIZED */;
5009
+ function initialize10() {
5010
+ handlerState11 = 2 /* INITIALIZED */;
4839
5011
  }
4840
- function handleEvent16(event) {
4841
- if (handlerState10 !== 2 /* INITIALIZED */) {
5012
+ function handleEvent17(event) {
5013
+ if (handlerState11 !== 2 /* INITIALIZED */) {
4842
5014
  throw new Error("Network Request handler is not initialized");
4843
5015
  }
4844
5016
  if (TraceEvents_exports.isTraceEventResourceChangePriority(event)) {
@@ -4870,8 +5042,8 @@ function handleEvent16(event) {
4870
5042
  return;
4871
5043
  }
4872
5044
  }
4873
- async function finalize13() {
4874
- if (handlerState10 !== 2 /* INITIALIZED */) {
5045
+ async function finalize14() {
5046
+ if (handlerState11 !== 2 /* INITIALIZED */) {
4875
5047
  throw new Error("Network Request handler is not initialized");
4876
5048
  }
4877
5049
  const { rendererProcessesByFrame } = data3();
@@ -5015,10 +5187,10 @@ async function finalize13() {
5015
5187
  requests.all.push(networkEvent);
5016
5188
  requestsByTime.push(networkEvent);
5017
5189
  }
5018
- handlerState10 = 3 /* FINALIZED */;
5190
+ handlerState11 = 3 /* FINALIZED */;
5019
5191
  }
5020
- function data16() {
5021
- if (handlerState10 !== 3 /* FINALIZED */) {
5192
+ function data17() {
5193
+ if (handlerState11 !== 3 /* FINALIZED */) {
5022
5194
  throw new Error("Network Request handler is not finalized");
5023
5195
  }
5024
5196
  return {
@@ -5035,11 +5207,11 @@ var UserInteractionsHandler_exports = {};
5035
5207
  __export(UserInteractionsHandler_exports, {
5036
5208
  LONG_INTERACTION_THRESHOLD: () => LONG_INTERACTION_THRESHOLD,
5037
5209
  categoryOfInteraction: () => categoryOfInteraction,
5038
- data: () => data17,
5039
- finalize: () => finalize14,
5040
- handleEvent: () => handleEvent17,
5210
+ data: () => data18,
5211
+ finalize: () => finalize15,
5212
+ handleEvent: () => handleEvent18,
5041
5213
  removeNestedInteractions: () => removeNestedInteractions,
5042
- reset: () => reset17
5214
+ reset: () => reset18
5043
5215
  });
5044
5216
  var allEvents2 = [];
5045
5217
  var LONG_INTERACTION_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(200));
@@ -5048,18 +5220,18 @@ var interactionEvents = [];
5048
5220
  var interactionEventsWithNoNesting = [];
5049
5221
  var eventTimingEndEventsById = /* @__PURE__ */ new Map();
5050
5222
  var eventTimingStartEventsForInteractions = [];
5051
- var handlerState11 = 1 /* UNINITIALIZED */;
5052
- function reset17() {
5223
+ var handlerState12 = 1 /* UNINITIALIZED */;
5224
+ function reset18() {
5053
5225
  allEvents2.length = 0;
5054
5226
  interactionEvents.length = 0;
5055
5227
  eventTimingStartEventsForInteractions.length = 0;
5056
5228
  eventTimingEndEventsById.clear();
5057
5229
  interactionEventsWithNoNesting.length = 0;
5058
5230
  longestInteractionEvent = null;
5059
- handlerState11 = 2 /* INITIALIZED */;
5231
+ handlerState12 = 2 /* INITIALIZED */;
5060
5232
  }
5061
- function handleEvent17(event) {
5062
- if (handlerState11 !== 2 /* INITIALIZED */) {
5233
+ function handleEvent18(event) {
5234
+ if (handlerState12 !== 2 /* INITIALIZED */) {
5063
5235
  throw new Error("Handler is not initialized");
5064
5236
  }
5065
5237
  if (!TraceEvents_exports.isTraceEventEventTiming(event)) {
@@ -5150,7 +5322,7 @@ function writeSyntheticTimespans(event) {
5150
5322
  event.mainThreadHandling = Timing_exports2.MicroSeconds(event.processingEnd - event.processingStart);
5151
5323
  event.presentationDelay = Timing_exports2.MicroSeconds(endEvent.ts - event.processingEnd);
5152
5324
  }
5153
- async function finalize14() {
5325
+ async function finalize15() {
5154
5326
  for (const interactionStartEvent of eventTimingStartEventsForInteractions) {
5155
5327
  const endEvent = eventTimingEndEventsById.get(interactionStartEvent.id);
5156
5328
  if (!endEvent) {
@@ -5186,7 +5358,7 @@ async function finalize14() {
5186
5358
  writeSyntheticTimespans(interactionEvent);
5187
5359
  interactionEvents.push(interactionEvent);
5188
5360
  }
5189
- handlerState11 = 3 /* FINALIZED */;
5361
+ handlerState12 = 3 /* FINALIZED */;
5190
5362
  interactionEventsWithNoNesting.push(...removeNestedInteractions(interactionEvents));
5191
5363
  for (const interactionEvent of interactionEventsWithNoNesting) {
5192
5364
  if (!longestInteractionEvent || longestInteractionEvent.dur < interactionEvent.dur) {
@@ -5194,7 +5366,7 @@ async function finalize14() {
5194
5366
  }
5195
5367
  }
5196
5368
  }
5197
- function data17() {
5369
+ function data18() {
5198
5370
  return {
5199
5371
  allEvents: [...allEvents2],
5200
5372
  interactionEvents: [...interactionEvents],
@@ -5209,24 +5381,24 @@ function data17() {
5209
5381
  // front_end/models/trace/handlers/UserTimingsHandler.ts
5210
5382
  var UserTimingsHandler_exports = {};
5211
5383
  __export(UserTimingsHandler_exports, {
5212
- data: () => data18,
5213
- finalize: () => finalize15,
5214
- handleEvent: () => handleEvent18,
5215
- reset: () => reset18
5384
+ data: () => data19,
5385
+ finalize: () => finalize16,
5386
+ handleEvent: () => handleEvent19,
5387
+ reset: () => reset19
5216
5388
  });
5217
5389
  var syntheticEvents = [];
5218
5390
  var performanceMeasureEvents = [];
5219
5391
  var performanceMarkEvents = [];
5220
5392
  var consoleTimings = [];
5221
5393
  var timestampEvents = [];
5222
- var handlerState12 = 1 /* UNINITIALIZED */;
5223
- function reset18() {
5394
+ var handlerState13 = 1 /* UNINITIALIZED */;
5395
+ function reset19() {
5224
5396
  syntheticEvents.length = 0;
5225
5397
  performanceMeasureEvents.length = 0;
5226
5398
  performanceMarkEvents.length = 0;
5227
5399
  consoleTimings.length = 0;
5228
5400
  timestampEvents.length = 0;
5229
- handlerState12 = 2 /* INITIALIZED */;
5401
+ handlerState13 = 2 /* INITIALIZED */;
5230
5402
  }
5231
5403
  var resourceTimingNames = [
5232
5404
  "workerStart",
@@ -5266,8 +5438,8 @@ var navTimingNames = [
5266
5438
  "loadEventStart",
5267
5439
  "loadEventEnd"
5268
5440
  ];
5269
- function handleEvent18(event) {
5270
- if (handlerState12 !== 2 /* INITIALIZED */) {
5441
+ function handleEvent19(event) {
5442
+ if (handlerState13 !== 2 /* INITIALIZED */) {
5271
5443
  throw new Error("UserTimings handler is not initialized");
5272
5444
  }
5273
5445
  const ignoredNames = [...resourceTimingNames, ...navTimingNames];
@@ -5288,16 +5460,16 @@ function handleEvent18(event) {
5288
5460
  timestampEvents.push(event);
5289
5461
  }
5290
5462
  }
5291
- async function finalize15() {
5292
- if (handlerState12 !== 2 /* INITIALIZED */) {
5463
+ async function finalize16() {
5464
+ if (handlerState13 !== 2 /* INITIALIZED */) {
5293
5465
  throw new Error("UserTimings handler is not initialized");
5294
5466
  }
5295
5467
  const asyncEvents = [...performanceMeasureEvents, ...consoleTimings];
5296
5468
  syntheticEvents.push(...Trace_exports.createMatchedSortedSyntheticEvents(asyncEvents));
5297
- handlerState12 = 3 /* FINALIZED */;
5469
+ handlerState13 = 3 /* FINALIZED */;
5298
5470
  }
5299
- function data18() {
5300
- if (handlerState12 !== 3 /* FINALIZED */) {
5471
+ function data19() {
5472
+ if (handlerState13 !== 3 /* FINALIZED */) {
5301
5473
  throw new Error("UserTimings handler is not finalized");
5302
5474
  }
5303
5475
  return {
@@ -5313,17 +5485,17 @@ var WarningsHandler_exports = {};
5313
5485
  __export(WarningsHandler_exports, {
5314
5486
  FORCED_LAYOUT_AND_STYLES_THRESHOLD: () => FORCED_LAYOUT_AND_STYLES_THRESHOLD,
5315
5487
  LONG_MAIN_THREAD_TASK_THRESHOLD: () => LONG_MAIN_THREAD_TASK_THRESHOLD,
5316
- data: () => data19,
5488
+ data: () => data20,
5317
5489
  deps: () => deps9,
5318
- finalize: () => finalize16,
5319
- handleEvent: () => handleEvent19,
5320
- reset: () => reset19
5490
+ finalize: () => finalize17,
5491
+ handleEvent: () => handleEvent20,
5492
+ reset: () => reset20
5321
5493
  });
5322
5494
  var warningsPerEvent = /* @__PURE__ */ new Map();
5323
5495
  var eventsPerWarning = /* @__PURE__ */ new Map();
5324
5496
  var FORCED_LAYOUT_AND_STYLES_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(10));
5325
5497
  var LONG_MAIN_THREAD_TASK_THRESHOLD = Timing_exports3.millisecondsToMicroseconds(Timing_exports2.MilliSeconds(50));
5326
- function reset19() {
5498
+ function reset20() {
5327
5499
  warningsPerEvent.clear();
5328
5500
  eventsPerWarning.clear();
5329
5501
  }
@@ -5335,7 +5507,7 @@ function storeWarning(event, warning) {
5335
5507
  existingEvents.push(event);
5336
5508
  eventsPerWarning.set(warning, existingEvents);
5337
5509
  }
5338
- function handleEvent19(event) {
5510
+ function handleEvent20(event) {
5339
5511
  if (event.name === TraceEvents_exports.KnownEventName.RunTask) {
5340
5512
  const { duration } = Timing_exports3.eventTimingsMicroSeconds(event);
5341
5513
  if (duration > LONG_MAIN_THREAD_TASK_THRESHOLD) {
@@ -5366,13 +5538,13 @@ function handleEvent19(event) {
5366
5538
  function deps9() {
5367
5539
  return ["UserInteractions"];
5368
5540
  }
5369
- async function finalize16() {
5370
- const longInteractions = data17().interactionsOverThreshold;
5541
+ async function finalize17() {
5542
+ const longInteractions = data18().interactionsOverThreshold;
5371
5543
  for (const interaction of longInteractions) {
5372
5544
  storeWarning(interaction, "LONG_INTERACTION");
5373
5545
  }
5374
5546
  }
5375
- function data19() {
5547
+ function data20() {
5376
5548
  return {
5377
5549
  perEvent: new Map(warningsPerEvent),
5378
5550
  perWarning: new Map(eventsPerWarning)
@@ -5382,38 +5554,38 @@ function data19() {
5382
5554
  // front_end/models/trace/handlers/WorkersHandler.ts
5383
5555
  var WorkersHandler_exports = {};
5384
5556
  __export(WorkersHandler_exports, {
5385
- data: () => data20,
5386
- finalize: () => finalize17,
5387
- handleEvent: () => handleEvent20,
5388
- initialize: () => initialize10,
5389
- reset: () => reset20
5557
+ data: () => data21,
5558
+ finalize: () => finalize18,
5559
+ handleEvent: () => handleEvent21,
5560
+ initialize: () => initialize11,
5561
+ reset: () => reset21
5390
5562
  });
5391
- var handlerState13 = 1 /* UNINITIALIZED */;
5563
+ var handlerState14 = 1 /* UNINITIALIZED */;
5392
5564
  var sessionIdEvents = [];
5393
5565
  var workerIdByThread = /* @__PURE__ */ new Map();
5394
5566
  var workerURLById = /* @__PURE__ */ new Map();
5395
- function initialize10() {
5396
- if (handlerState13 !== 1 /* UNINITIALIZED */) {
5567
+ function initialize11() {
5568
+ if (handlerState14 !== 1 /* UNINITIALIZED */) {
5397
5569
  throw new Error("Workers Handler was not reset");
5398
5570
  }
5399
- handlerState13 = 2 /* INITIALIZED */;
5571
+ handlerState14 = 2 /* INITIALIZED */;
5400
5572
  }
5401
- function reset20() {
5573
+ function reset21() {
5402
5574
  sessionIdEvents.length = 0;
5403
5575
  workerIdByThread.clear();
5404
5576
  workerURLById.clear();
5405
- handlerState13 = 1 /* UNINITIALIZED */;
5577
+ handlerState14 = 1 /* UNINITIALIZED */;
5406
5578
  }
5407
- function handleEvent20(event) {
5408
- if (handlerState13 !== 2 /* INITIALIZED */) {
5579
+ function handleEvent21(event) {
5580
+ if (handlerState14 !== 2 /* INITIALIZED */) {
5409
5581
  throw new Error("Workers Handler is not initialized");
5410
5582
  }
5411
5583
  if (TraceEvents_exports.isTraceEventTracingSessionIdForWorker(event)) {
5412
5584
  sessionIdEvents.push(event);
5413
5585
  }
5414
5586
  }
5415
- async function finalize17() {
5416
- if (handlerState13 !== 2 /* INITIALIZED */) {
5587
+ async function finalize18() {
5588
+ if (handlerState14 !== 2 /* INITIALIZED */) {
5417
5589
  throw new Error("Handler is not initialized");
5418
5590
  }
5419
5591
  for (const sessionIdEvent of sessionIdEvents) {
@@ -5423,10 +5595,10 @@ async function finalize17() {
5423
5595
  workerIdByThread.set(sessionIdEvent.args.data.workerThreadId, sessionIdEvent.args.data.workerId);
5424
5596
  workerURLById.set(sessionIdEvent.args.data.workerId, sessionIdEvent.args.data.url);
5425
5597
  }
5426
- handlerState13 = 3 /* FINALIZED */;
5598
+ handlerState14 = 3 /* FINALIZED */;
5427
5599
  }
5428
- function data20() {
5429
- if (handlerState13 !== 3 /* FINALIZED */) {
5600
+ function data21() {
5601
+ if (handlerState14 !== 3 /* FINALIZED */) {
5430
5602
  throw new Error("Workers Handler is not finalized");
5431
5603
  }
5432
5604
  return {
@@ -6120,9 +6292,9 @@ __export(Processor_exports, {
6120
6292
  sortHandlers: () => sortHandlers
6121
6293
  });
6122
6294
  var _TraceParseProgressEvent = class extends Event {
6123
- constructor(data21, init = { bubbles: true }) {
6295
+ constructor(data22, init = { bubbles: true }) {
6124
6296
  super(_TraceParseProgressEvent.eventName, init);
6125
- this.data = data21;
6297
+ this.data = data22;
6126
6298
  }
6127
6299
  };
6128
6300
  var TraceParseProgressEvent = _TraceParseProgressEvent;
@@ -6226,11 +6398,11 @@ var TraceProcessor = class extends EventTarget {
6226
6398
  if (this.#status !== "FINISHED_PARSING" /* FINISHED_PARSING */) {
6227
6399
  return null;
6228
6400
  }
6229
- const data21 = {};
6401
+ const data22 = {};
6230
6402
  for (const [name, handler] of Object.entries(this.#traceHandlers)) {
6231
- Object.assign(data21, { [name]: handler.data() });
6403
+ Object.assign(data22, { [name]: handler.data() });
6232
6404
  }
6233
- return data21;
6405
+ return data22;
6234
6406
  }
6235
6407
  };
6236
6408
  function sortHandlers(traceHandlers) {
@@ -6316,8 +6488,8 @@ var Model = class extends EventTarget {
6316
6488
  const metadata = config2?.metadata || {};
6317
6489
  const isFreshRecording = config2?.isFreshRecording || false;
6318
6490
  const onTraceUpdate = (event) => {
6319
- const { data: data21 } = event;
6320
- this.dispatchEvent(new ModelUpdateEvent({ type: ModelUpdateType.PROGRESS_UPDATE, data: data21 }));
6491
+ const { data: data22 } = event;
6492
+ this.dispatchEvent(new ModelUpdateEvent({ type: ModelUpdateType.PROGRESS_UPDATE, data: data22 }));
6321
6493
  };
6322
6494
  this.#processor.addEventListener(TraceParseProgressEvent.eventName, onTraceUpdate);
6323
6495
  const file = {
@@ -6336,8 +6508,8 @@ var Model = class extends EventTarget {
6336
6508
  this.dispatchEvent(new ModelUpdateEvent({ type: ModelUpdateType.COMPLETE, data: "done" }));
6337
6509
  }
6338
6510
  }
6339
- #storeParsedFileData(file, data21) {
6340
- file.traceParsedData = data21;
6511
+ #storeParsedFileData(file, data22) {
6512
+ file.traceParsedData = data22;
6341
6513
  this.#lastRecordingIndex++;
6342
6514
  let recordingName = `Trace ${this.#lastRecordingIndex}`;
6343
6515
  let origin = null;
@@ -6389,9 +6561,9 @@ var ModelUpdateType = /* @__PURE__ */ ((ModelUpdateType2) => {
6389
6561
  return ModelUpdateType2;
6390
6562
  })(ModelUpdateType || {});
6391
6563
  var _ModelUpdateEvent = class extends Event {
6392
- constructor(data21) {
6564
+ constructor(data22) {
6393
6565
  super(_ModelUpdateEvent.eventName);
6394
- this.data = data21;
6566
+ this.data = data22;
6395
6567
  }
6396
6568
  };
6397
6569
  var ModelUpdateEvent = _ModelUpdateEvent;
@@ -6462,14 +6634,15 @@ var LayoutShiftRootCauses = class {
6462
6634
  this.linkShiftsToLayoutEvents(layoutShifts, modelData);
6463
6635
  }
6464
6636
  async linkShiftsToLayoutInvalidations(layoutShifts, modelData) {
6465
- const { prePaintEvents: prePaintEvents2, layoutInvalidationEvents: liEvents, backendNodeIds: backendNodeIds2 } = modelData.LayoutShifts;
6637
+ const { prePaintEvents: prePaintEvents2, layoutInvalidationEvents: layoutInvalidationEvents2, scheduleStyleInvalidationEvents: scheduleStyleInvalidationEvents2, backendNodeIds: backendNodeIds2 } = modelData.LayoutShifts;
6638
+ const eventsForLayoutInvalidation = [...layoutInvalidationEvents2, ...scheduleStyleInvalidationEvents2];
6466
6639
  const nodes = await this.#protocolInterface.pushNodesByBackendIdsToFrontend(backendNodeIds2);
6467
6640
  const nodeIdsByBackendIdMap = /* @__PURE__ */ new Map();
6468
6641
  for (let i = 0; i < backendNodeIds2.length; i++) {
6469
6642
  nodeIdsByBackendIdMap.set(backendNodeIds2[i], nodes[i]);
6470
6643
  }
6471
6644
  const shiftsByPrePaint = getShiftsByPrePaintEvents(layoutShifts, prePaintEvents2);
6472
- for (const layoutInvalidation of liEvents) {
6645
+ for (const layoutInvalidation of eventsForLayoutInvalidation) {
6473
6646
  const nextPrePaintIndex = array_utilities_exports.nearestIndexFromBeginning(prePaintEvents2, (prePaint) => prePaint.ts > layoutInvalidation.ts);
6474
6647
  if (nextPrePaintIndex === null) {
6475
6648
  continue;
@@ -6485,9 +6658,9 @@ var LayoutShiftRootCauses = class {
6485
6658
  const layoutInvalidationNode = layoutInvalidationNodeId !== void 0 ? await this.#protocolInterface.getNode(layoutInvalidationNodeId) : null;
6486
6659
  let unsizedMediaRootCause = null;
6487
6660
  let iframeRootCause = null;
6488
- if (layoutInvalidationNode) {
6661
+ if (layoutInvalidationNode && layoutInvalidation.args.data.reason) {
6489
6662
  unsizedMediaRootCause = await this.getUnsizedMediaRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);
6490
- iframeRootCause = await this.getIframeRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);
6663
+ iframeRootCause = this.getIframeRootCause(layoutInvalidation.args.data.reason, layoutInvalidationNode);
6491
6664
  }
6492
6665
  if (!unsizedMediaRootCause && !iframeRootCause && !fontChangeRootCause && !renderBlockRootCause) {
6493
6666
  continue;