@parca/profile 0.19.140 → 0.19.142

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.
Files changed (253) hide show
  1. package/CHANGELOG.md +5 -1
  2. package/dist/GraphTooltipArrow/Content.js +224 -30
  3. package/dist/GraphTooltipArrow/DockedGraphTooltip/index.js +192 -33
  4. package/dist/GraphTooltipArrow/ExpandOnHoverValue.js +53 -3
  5. package/dist/GraphTooltipArrow/index.d.ts.map +1 -1
  6. package/dist/GraphTooltipArrow/index.js +86 -56
  7. package/dist/GraphTooltipArrow/useGraphTooltip/index.js +37 -37
  8. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.d.ts.map +1 -1
  9. package/dist/GraphTooltipArrow/useGraphTooltipMetaInfo/index.js +104 -72
  10. package/dist/MatchersInput/SuggestionItem.js +91 -12
  11. package/dist/MatchersInput/SuggestionsList.d.ts +2 -1
  12. package/dist/MatchersInput/SuggestionsList.d.ts.map +1 -1
  13. package/dist/MatchersInput/SuggestionsList.js +371 -157
  14. package/dist/MatchersInput/SuggestionsList.test.d.ts +2 -0
  15. package/dist/MatchersInput/SuggestionsList.test.d.ts.map +1 -0
  16. package/dist/MatchersInput/index.js +308 -115
  17. package/dist/MetricsCircle/index.js +39 -3
  18. package/dist/MetricsGraph/MetricsContextMenu/index.js +119 -19
  19. package/dist/MetricsGraph/MetricsInfoPanel/index.js +81 -20
  20. package/dist/MetricsGraph/MetricsTooltip/index.d.ts.map +1 -1
  21. package/dist/MetricsGraph/MetricsTooltip/index.js +107 -74
  22. package/dist/MetricsGraph/index.js +552 -203
  23. package/dist/MetricsGraph/useMetricsGraphDimensions.js +46 -25
  24. package/dist/MetricsGraph/utils/colorMapping.js +24 -17
  25. package/dist/MetricsSeries/index.js +70 -7
  26. package/dist/PreSelectedMatchers/index.d.ts.map +1 -1
  27. package/dist/PreSelectedMatchers/index.js +249 -102
  28. package/dist/ProfileExplorer/ProfileExplorerCompare.d.ts.map +1 -1
  29. package/dist/ProfileExplorer/ProfileExplorerCompare.js +241 -45
  30. package/dist/ProfileExplorer/ProfileExplorerSingle.js +98 -11
  31. package/dist/ProfileExplorer/index.js +183 -32
  32. package/dist/ProfileFlameChart/SamplesStrips/SamplesGraph/index.js +333 -148
  33. package/dist/ProfileFlameChart/SamplesStrips/SamplesStrips.stories.js +69 -35
  34. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts +2 -2
  35. package/dist/ProfileFlameChart/SamplesStrips/index.d.ts.map +1 -1
  36. package/dist/ProfileFlameChart/SamplesStrips/index.js +645 -134
  37. package/dist/ProfileFlameChart/SamplesStrips/labelSetUtils.js +114 -55
  38. package/dist/ProfileFlameChart/index.d.ts.map +1 -1
  39. package/dist/ProfileFlameChart/index.js +267 -129
  40. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.d.ts.map +1 -1
  41. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenu.js +288 -89
  42. package/dist/ProfileFlameGraph/FlameGraphArrow/ContextMenuWrapper.js +56 -20
  43. package/dist/ProfileFlameGraph/FlameGraphArrow/FlameGraphNodes.js +211 -140
  44. package/dist/ProfileFlameGraph/FlameGraphArrow/MemoizedTooltip.js +133 -38
  45. package/dist/ProfileFlameGraph/FlameGraphArrow/MiniMap.js +261 -216
  46. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.d.ts.map +1 -1
  47. package/dist/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.js +72 -47
  48. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.d.ts.map +1 -1
  49. package/dist/ProfileFlameGraph/FlameGraphArrow/TooltipContext.js +58 -28
  50. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.d.ts.map +1 -1
  51. package/dist/ProfileFlameGraph/FlameGraphArrow/ZoomControls.js +59 -8
  52. package/dist/ProfileFlameGraph/FlameGraphArrow/index.js +396 -179
  53. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.d.ts.map +1 -1
  54. package/dist/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.js +68 -50
  55. package/dist/ProfileFlameGraph/FlameGraphArrow/useMappingList.js +62 -38
  56. package/dist/ProfileFlameGraph/FlameGraphArrow/useNodeColor.js +14 -6
  57. package/dist/ProfileFlameGraph/FlameGraphArrow/useScrollViewport.js +124 -82
  58. package/dist/ProfileFlameGraph/FlameGraphArrow/useVisibleNodes.js +160 -98
  59. package/dist/ProfileFlameGraph/FlameGraphArrow/useZoom.js +232 -112
  60. package/dist/ProfileFlameGraph/FlameGraphArrow/utils.js +137 -114
  61. package/dist/ProfileFlameGraph/benchmarks/benchdata/populateData.js +85 -0
  62. package/dist/ProfileFlameGraph/index.d.ts.map +1 -1
  63. package/dist/ProfileFlameGraph/index.js +324 -150
  64. package/dist/ProfileMetricsGraph/hooks/useQueryRange.js +140 -32
  65. package/dist/ProfileMetricsGraph/index.d.ts.map +1 -1
  66. package/dist/ProfileMetricsGraph/index.js +519 -258
  67. package/dist/ProfileSelector/CompareButton.js +132 -12
  68. package/dist/ProfileSelector/MetricsGraphSection.d.ts.map +1 -1
  69. package/dist/ProfileSelector/MetricsGraphSection.js +236 -64
  70. package/dist/ProfileSelector/index.d.ts.map +1 -1
  71. package/dist/ProfileSelector/index.js +727 -141
  72. package/dist/ProfileSelector/useAutoQuerySelector.js +249 -130
  73. package/dist/ProfileSource.js +230 -163
  74. package/dist/ProfileTypeSelector/index.js +214 -125
  75. package/dist/ProfileView/components/ActionButtons/GroupByDropdown.js +50 -4
  76. package/dist/ProfileView/components/ActionButtons/SortByDropdown.d.ts.map +1 -1
  77. package/dist/ProfileView/components/ActionButtons/SortByDropdown.js +141 -35
  78. package/dist/ProfileView/components/ColorStackLegend.d.ts.map +1 -1
  79. package/dist/ProfileView/components/ColorStackLegend.js +185 -55
  80. package/dist/ProfileView/components/DashboardItems/index.js +87 -28
  81. package/dist/ProfileView/components/DashboardLayout/index.js +108 -16
  82. package/dist/ProfileView/components/DiffLegend.js +172 -29
  83. package/dist/ProfileView/components/GroupByLabelsDropdown/index.js +199 -55
  84. package/dist/ProfileView/components/InvertCallStack/index.d.ts.map +1 -1
  85. package/dist/ProfileView/components/InvertCallStack/index.js +100 -12
  86. package/dist/ProfileView/components/ProfileFilters/filterPresets.js +260 -315
  87. package/dist/ProfileView/components/ProfileFilters/index.js +518 -215
  88. package/dist/ProfileView/components/ProfileFilters/useProfileFilters.js +370 -306
  89. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts +2 -1
  90. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.d.ts.map +1 -1
  91. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.js +188 -118
  92. package/dist/ProfileView/components/ProfileHeader/index.js +105 -11
  93. package/dist/ProfileView/components/ShareButton/ResultBox.js +119 -16
  94. package/dist/ProfileView/components/ShareButton/index.js +352 -62
  95. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.d.ts.map +1 -1
  96. package/dist/ProfileView/components/Toolbars/MultiLevelDropdown.js +678 -194
  97. package/dist/ProfileView/components/Toolbars/SwitchMenuItem.js +94 -7
  98. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.d.ts.map +1 -1
  99. package/dist/ProfileView/components/Toolbars/TableColumnsDropdown.js +199 -157
  100. package/dist/ProfileView/components/Toolbars/index.d.ts +2 -2
  101. package/dist/ProfileView/components/Toolbars/index.d.ts.map +1 -1
  102. package/dist/ProfileView/components/Toolbars/index.js +441 -21
  103. package/dist/ProfileView/components/ViewSelector/Dropdown.js +233 -22
  104. package/dist/ProfileView/components/ViewSelector/index.d.ts.map +1 -1
  105. package/dist/ProfileView/components/ViewSelector/index.js +212 -86
  106. package/dist/ProfileView/components/VisualizationContainer/index.d.ts.map +1 -1
  107. package/dist/ProfileView/components/VisualizationContainer/index.js +52 -7
  108. package/dist/ProfileView/components/VisualizationPanel.js +185 -8
  109. package/dist/ProfileView/context/DashboardContext.d.ts.map +1 -1
  110. package/dist/ProfileView/context/DashboardContext.js +85 -29
  111. package/dist/ProfileView/context/ProfileViewContext.js +56 -15
  112. package/dist/ProfileView/hooks/useAutoSelectDimension.js +71 -41
  113. package/dist/ProfileView/hooks/useProfileMetadata.js +50 -18
  114. package/dist/ProfileView/hooks/useResetFlameGraphState.d.ts.map +1 -1
  115. package/dist/ProfileView/hooks/useResetFlameGraphState.js +32 -12
  116. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.d.ts.map +1 -1
  117. package/dist/ProfileView/hooks/useResetStateOnProfileTypeChange.js +71 -27
  118. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.d.ts.map +1 -1
  119. package/dist/ProfileView/hooks/useResetStateOnSeriesChange.js +40 -19
  120. package/dist/ProfileView/hooks/useVisualizationState.d.ts +3 -3
  121. package/dist/ProfileView/hooks/useVisualizationState.d.ts.map +1 -1
  122. package/dist/ProfileView/hooks/useVisualizationState.js +258 -67
  123. package/dist/ProfileView/index.js +383 -45
  124. package/dist/ProfileView/types/visualization.js +1 -13
  125. package/dist/ProfileView/utils/colorUtils.js +8 -7
  126. package/dist/ProfileViewWithData.d.ts.map +1 -1
  127. package/dist/ProfileViewWithData.js +332 -228
  128. package/dist/QueryControls/index.js +418 -47
  129. package/dist/Sandwich/components/CalleesSection.js +54 -4
  130. package/dist/Sandwich/components/CallersSection.js +97 -27
  131. package/dist/Sandwich/components/TableSection.js +77 -4
  132. package/dist/Sandwich/index.d.ts.map +1 -1
  133. package/dist/Sandwich/index.js +126 -14
  134. package/dist/Sandwich/utils/processRowData.js +48 -39
  135. package/dist/SelectWithRefresh/index.js +102 -28
  136. package/dist/SimpleMatchers/Select.js +520 -187
  137. package/dist/SimpleMatchers/index.js +590 -288
  138. package/dist/SourceView/Highlighter.js +230 -70
  139. package/dist/SourceView/LineNo.js +72 -17
  140. package/dist/SourceView/index.d.ts.map +1 -1
  141. package/dist/SourceView/index.js +178 -104
  142. package/dist/SourceView/lang-detector/ext-to-lang.json +798 -798
  143. package/dist/SourceView/lang-detector/index.js +28 -14
  144. package/dist/SourceView/useSelectedLineRange.d.ts.map +1 -1
  145. package/dist/SourceView/useSelectedLineRange.js +99 -23
  146. package/dist/Table/ColorCell.js +42 -1
  147. package/dist/Table/ColumnsVisibility.js +114 -6
  148. package/dist/Table/MoreDropdown.d.ts.map +1 -1
  149. package/dist/Table/MoreDropdown.js +122 -25
  150. package/dist/Table/TableContextMenu.d.ts.map +1 -1
  151. package/dist/Table/TableContextMenu.js +151 -137
  152. package/dist/Table/TableContextMenuWrapper.js +59 -14
  153. package/dist/Table/hooks/useColorManagement.js +58 -16
  154. package/dist/Table/hooks/useTableConfiguration.d.ts.map +1 -1
  155. package/dist/Table/hooks/useTableConfiguration.js +333 -169
  156. package/dist/Table/index.d.ts.map +1 -1
  157. package/dist/Table/index.js +222 -128
  158. package/dist/Table/utils/functions.js +169 -144
  159. package/dist/Table/utils/topAndBottomExpandedRowModel.js +69 -52
  160. package/dist/TimelineGuide/index.js +209 -16
  161. package/dist/TopTable/benchmarks/benchdata/populateData.js +91 -0
  162. package/dist/TopTable/index.d.ts.map +1 -1
  163. package/dist/TopTable/index.js +342 -123
  164. package/dist/contexts/LabelsQueryProvider.js +94 -32
  165. package/dist/contexts/UnifiedLabelsContext.js +114 -49
  166. package/dist/contexts/utils.js +37 -15
  167. package/dist/hooks/useCompareModeMeta.d.ts.map +1 -1
  168. package/dist/hooks/useCompareModeMeta.js +158 -64
  169. package/dist/hooks/useLabels.js +295 -52
  170. package/dist/hooks/useQueryState.d.ts +3 -3
  171. package/dist/hooks/useQueryState.d.ts.map +1 -1
  172. package/dist/hooks/useQueryState.js +373 -332
  173. package/dist/index.d.ts +2 -3
  174. package/dist/index.d.ts.map +1 -1
  175. package/dist/index.js +22 -8
  176. package/dist/testdata/fg-diff.json +3750 -0
  177. package/dist/testdata/fg-simple.json +1879 -0
  178. package/dist/testdata/link_data.json +56 -0
  179. package/dist/testdata/tabular.json +30 -0
  180. package/dist/testdata/test_flamegraph.json +26846 -0
  181. package/dist/testdata/test_graph.json +53 -0
  182. package/dist/useDelayedLoader.js +32 -18
  183. package/dist/useGrpcQuery/index.js +71 -11
  184. package/dist/useHasProfileData.js +90 -12
  185. package/dist/useQuery.js +205 -64
  186. package/dist/useSumBy.d.ts +1 -1
  187. package/dist/useSumBy.d.ts.map +1 -1
  188. package/dist/useSumBy.js +294 -138
  189. package/dist/utils.js +62 -30
  190. package/package.json +9 -10
  191. package/src/GraphTooltipArrow/index.tsx +3 -0
  192. package/src/GraphTooltipArrow/useGraphTooltipMetaInfo/index.ts +13 -11
  193. package/src/MatchersInput/SuggestionsList.test.tsx +70 -0
  194. package/src/MatchersInput/SuggestionsList.tsx +11 -10
  195. package/src/MatchersInput/index.tsx +1 -1
  196. package/src/MetricsGraph/MetricsTooltip/index.tsx +22 -34
  197. package/src/PreSelectedMatchers/index.tsx +3 -0
  198. package/src/ProfileExplorer/ProfileExplorerCompare.tsx +9 -4
  199. package/src/ProfileFlameChart/SamplesStrips/index.tsx +2 -2
  200. package/src/ProfileFlameChart/index.tsx +28 -21
  201. package/src/ProfileFlameGraph/FlameGraphArrow/ContextMenu.tsx +9 -10
  202. package/src/ProfileFlameGraph/FlameGraphArrow/TextWithEllipsis.tsx +6 -5
  203. package/src/ProfileFlameGraph/FlameGraphArrow/TooltipContext.tsx +3 -0
  204. package/src/ProfileFlameGraph/FlameGraphArrow/ZoomControls.tsx +3 -0
  205. package/src/ProfileFlameGraph/FlameGraphArrow/useBatchedRendering.ts +3 -0
  206. package/src/ProfileFlameGraph/index.tsx +9 -6
  207. package/src/ProfileMetricsGraph/index.tsx +8 -6
  208. package/src/ProfileSelector/MetricsGraphSection.tsx +10 -5
  209. package/src/ProfileSelector/index.tsx +61 -39
  210. package/src/ProfileView/components/ActionButtons/SortByDropdown.tsx +6 -10
  211. package/src/ProfileView/components/ColorStackLegend.tsx +4 -2
  212. package/src/ProfileView/components/InvertCallStack/index.tsx +4 -5
  213. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.tsx +192 -94
  214. package/src/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.ts +21 -21
  215. package/src/ProfileView/components/Toolbars/MultiLevelDropdown.tsx +28 -24
  216. package/src/ProfileView/components/Toolbars/TableColumnsDropdown.tsx +5 -4
  217. package/src/ProfileView/components/Toolbars/index.tsx +3 -3
  218. package/src/ProfileView/components/ViewSelector/index.tsx +16 -9
  219. package/src/ProfileView/components/VisualizationContainer/index.tsx +3 -0
  220. package/src/ProfileView/context/DashboardContext.tsx +6 -6
  221. package/src/ProfileView/hooks/useResetFlameGraphState.ts +4 -6
  222. package/src/ProfileView/hooks/useResetStateOnProfileTypeChange.ts +26 -24
  223. package/src/ProfileView/hooks/useResetStateOnSeriesChange.ts +8 -16
  224. package/src/ProfileView/hooks/useVisualizationState.ts +69 -61
  225. package/src/ProfileViewWithData.tsx +35 -29
  226. package/src/Sandwich/index.tsx +3 -4
  227. package/src/SourceView/index.tsx +2 -4
  228. package/src/SourceView/useSelectedLineRange.ts +19 -34
  229. package/src/Table/MoreDropdown.tsx +11 -9
  230. package/src/Table/TableContextMenu.tsx +13 -10
  231. package/src/Table/hooks/useTableConfiguration.tsx +11 -16
  232. package/src/Table/index.tsx +21 -12
  233. package/src/TopTable/index.tsx +4 -3
  234. package/src/hooks/useCompareModeMeta.ts +91 -61
  235. package/src/hooks/useQueryState.test.tsx +345 -275
  236. package/src/hooks/useQueryState.ts +118 -136
  237. package/src/index.tsx +15 -16
  238. package/src/useDelayedLoader.ts +10 -10
  239. package/src/useSumBy.ts +15 -21
  240. package/dist/ProfileView/components/ProfileFilters/useProfileFiltersUrlState.test.js +0 -455
  241. package/dist/hooks/urlParsers.d.ts +0 -18
  242. package/dist/hooks/urlParsers.d.ts.map +0 -1
  243. package/dist/hooks/urlParsers.js +0 -32
  244. package/dist/hooks/useColorBy.d.ts +0 -5
  245. package/dist/hooks/useColorBy.d.ts.map +0 -1
  246. package/dist/hooks/useColorBy.js +0 -26
  247. package/dist/hooks/useDashboardItems.d.ts +0 -5
  248. package/dist/hooks/useDashboardItems.d.ts.map +0 -1
  249. package/dist/hooks/useDashboardItems.js +0 -27
  250. package/dist/hooks/useQueryState.test.js +0 -868
  251. package/src/hooks/urlParsers.ts +0 -38
  252. package/src/hooks/useColorBy.ts +0 -42
  253. package/src/hooks/useDashboardItems.ts +0 -46
@@ -1,4 +1,20 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
5
+ function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
6
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
8
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
10
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
11
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
12
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
13
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
14
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
15
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
16
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
17
+ import { c as _c } from "react-compiler-runtime";
2
18
  // Copyright 2022 The Parca Authors
3
19
  // Licensed under the Apache License, Version 2.0 (the "License");
4
20
  // you may not use this file except in compliance with the License.
@@ -11,6 +27,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
11
27
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
28
  // See the License for the specific language governing permissions and
13
29
  // limitations under the License.
30
+
14
31
  import { useMemo, useRef, useState } from 'react';
15
32
  import { Icon } from '@iconify/react';
16
33
  import cx from 'classnames';
@@ -21,147 +38,641 @@ import { Button, useParcaContext } from '@parca/components';
21
38
  import { TimelineGuide } from '../../TimelineGuide';
22
39
  import { SamplesGraph } from './SamplesGraph';
23
40
  import { createLabelSetComparator, labelSetToString } from './labelSetUtils';
24
- const STRIP_HEIGHT = 24;
25
- const LABEL_ROW_HEIGHT = 16; // text-xs label row above each strip
26
- const GAP = 4; // gap-1 between flex children
27
- const MAX_VISIBLE_STRIPS = 20;
28
- const LOADING_STRIP_COUNT = 8;
29
- const generateMockStripData = (bounds) => {
30
- const stepMs = Math.max(Math.floor((bounds[1] - bounds[0]) / 240), 100);
31
- const cpus = Array.from({ length: LOADING_STRIP_COUNT }, (_, i) => ({
32
- labels: [{ name: 'cpu', value: String(i) }],
33
- }));
34
- let seed = 42;
35
- const data = cpus.map(() => {
36
- const points = [];
37
- for (let ts = bounds[0]; ts < bounds[1]; ts += stepMs) {
38
- seed = (seed * 16807 + 11) % 2147483647;
39
- const value = (seed % 80) + 10;
40
- seed = (seed * 16807 + 11) % 2147483647;
41
- const sampleCount = (seed % 50) + 1;
42
- points.push({ timestamp: ts, value, sampleCount });
43
- }
44
- return points;
45
- });
46
- return { cpus, data, stepMs };
41
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
42
+ var STRIP_HEIGHT = 24;
43
+ var LABEL_ROW_HEIGHT = 16; // text-xs label row above each strip
44
+ var GAP = 4; // gap-1 between flex children
45
+ var MAX_VISIBLE_STRIPS = 20;
46
+ var LOADING_STRIP_COUNT = 8;
47
+ var generateMockStripData = function generateMockStripData(bounds) {
48
+ var stepMs = Math.max(Math.floor((bounds[1] - bounds[0]) / 240), 100);
49
+ var cpus = Array.from({
50
+ length: LOADING_STRIP_COUNT
51
+ }, function (_, i) {
52
+ return {
53
+ labels: [{
54
+ name: 'cpu',
55
+ value: String(i)
56
+ }]
57
+ };
58
+ });
59
+ var seed = 42;
60
+ var data = cpus.map(function () {
61
+ var points = [];
62
+ for (var ts = bounds[0]; ts < bounds[1]; ts += stepMs) {
63
+ seed = (seed * 16807 + 11) % 2147483647;
64
+ var value = seed % 80 + 10;
65
+ seed = (seed * 16807 + 11) % 2147483647;
66
+ var sampleCount = seed % 50 + 1;
67
+ points.push({
68
+ timestamp: ts,
69
+ value: value,
70
+ sampleCount: sampleCount
71
+ });
72
+ }
73
+ return points;
74
+ });
75
+ return {
76
+ cpus: cpus,
77
+ data: data,
78
+ stepMs: stepMs
79
+ };
47
80
  };
48
- const getTimelineGuideHeight = (cpusCount, collapsedCount) => {
49
- const expandedCount = cpusCount - collapsedCount;
50
- // Each expanded strip: label row + graph height
51
- // Each collapsed strip: min-h-5 (20px)
52
- // Gaps between strips (gap-1 = 4px)
53
- const expandedTotal = expandedCount * (LABEL_ROW_HEIGHT + STRIP_HEIGHT);
54
- const collapsedTotal = collapsedCount * 20; // min-h-5
55
- const gaps = cpusCount * GAP + 20; // timeline header
56
- return expandedTotal + collapsedTotal + gaps;
81
+ var getTimelineGuideHeight = function getTimelineGuideHeight(cpusCount, collapsedCount) {
82
+ var expandedCount = cpusCount - collapsedCount;
83
+ // Each expanded strip: label row + graph height
84
+ // Each collapsed strip: min-h-5 (20px)
85
+ // Gaps between strips (gap-1 = 4px)
86
+ var expandedTotal = expandedCount * (LABEL_ROW_HEIGHT + STRIP_HEIGHT);
87
+ var collapsedTotal = collapsedCount * 20; // min-h-5
88
+ var gaps = cpusCount * GAP + 20; // timeline header
89
+ return expandedTotal + collapsedTotal + gaps;
57
90
  };
58
- const stickyPx = 0;
59
- const SamplesGraphContainer = ({ isSelected, isCollapsed, label: labelStr, width, onToggleCollapse, data, selectionBounds, setSelectionBounds, color, stepMs, onDragStart, dragState, stripIndex, isAnyDragActive, timeBounds, loading, }) => {
60
- const { isIntersecting, ref } = useIntersectionObserver({
61
- rootMargin: `${stickyPx}px 0px 0px 0px`,
91
+ var stickyPx = 0;
92
+ var SamplesGraphContainer = function SamplesGraphContainer(t0) {
93
+ var $ = _c(36);
94
+ var isSelected = t0.isSelected,
95
+ isCollapsed = t0.isCollapsed,
96
+ labelStr = t0.label,
97
+ width = t0.width,
98
+ onToggleCollapse = t0.onToggleCollapse,
99
+ data = t0.data,
100
+ selectionBounds = t0.selectionBounds,
101
+ setSelectionBounds = t0.setSelectionBounds,
102
+ color = t0.color,
103
+ stepMs = t0.stepMs,
104
+ _onDragStart = t0.onDragStart,
105
+ dragState = t0.dragState,
106
+ stripIndex = t0.stripIndex,
107
+ isAnyDragActive = t0.isAnyDragActive,
108
+ timeBounds = t0.timeBounds,
109
+ loading = t0.loading;
110
+ var t1;
111
+ if ($[0] === Symbol["for"]("react.memo_cache_sentinel")) {
112
+ t1 = {
113
+ rootMargin: "".concat(stickyPx, "px 0px 0px 0px")
114
+ };
115
+ $[0] = t1;
116
+ } else {
117
+ t1 = $[0];
118
+ }
119
+ var _useIntersectionObser = useIntersectionObserver(t1),
120
+ isIntersecting = _useIntersectionObser.isIntersecting,
121
+ ref = _useIntersectionObser.ref;
122
+ var isSticky = isSelected && isIntersecting;
123
+ var t2 = !isSelected;
124
+ var t3;
125
+ if ($[1] !== isSelected || $[2] !== isSticky || $[3] !== t2) {
126
+ t3 = cx("min-h-5", {
127
+ relative: t2,
128
+ "sticky z-30 bg-white dark:bg-black bg-opacity-75": isSelected,
129
+ "!bg-opacity-100": isSticky
62
130
  });
63
- const isSticky = useMemo(() => {
64
- return isSelected && isIntersecting;
65
- }, [isSelected, isIntersecting]);
66
- return (_jsxs("div", { className: cx('min-h-5', {
67
- relative: !isSelected,
68
- 'sticky z-30 bg-white dark:bg-black bg-opacity-75': isSelected,
69
- '!bg-opacity-100': isSticky,
70
- }), style: { width: width ?? 1468, top: isSelected ? stickyPx : undefined }, ref: ref, children: [_jsx("div", { className: "text-xs flex gap-[2px] items-center px-1 cursor-pointer text-gray-600 dark:text-gray-400", onClick: loading === true ? undefined : onToggleCollapse, children: loading === true ? (_jsx("div", { className: "h-3 w-24 rounded bg-gray-200 dark:bg-gray-700 mb-1" })) : (_jsxs(_Fragment, { children: [_jsx(Icon, { icon: isCollapsed ? 'bxs:right-arrow' : 'bxs:down-arrow', className: "shrink-0" }), labelStr] })) }), !isCollapsed ? (_jsx(SamplesGraph, { data: data, height: STRIP_HEIGHT, width: width ?? 1468, fill: color(labelStr), selectionBounds: selectionBounds, setSelectionBounds: setSelectionBounds, stepMs: stepMs, onDragStart: (startX) => onDragStart(stripIndex, startX), dragState: dragState?.stripIndex === stripIndex ? dragState : undefined, isAnyDragActive: isAnyDragActive, timeBounds: timeBounds })) : null] }, labelStr));
131
+ $[1] = isSelected;
132
+ $[2] = isSticky;
133
+ $[3] = t2;
134
+ $[4] = t3;
135
+ } else {
136
+ t3 = $[4];
137
+ }
138
+ var t4 = width !== null && width !== void 0 ? width : 1468;
139
+ var t5 = isSelected ? stickyPx : undefined;
140
+ var t6;
141
+ if ($[5] !== t4 || $[6] !== t5) {
142
+ t6 = {
143
+ width: t4,
144
+ top: t5
145
+ };
146
+ $[5] = t4;
147
+ $[6] = t5;
148
+ $[7] = t6;
149
+ } else {
150
+ t6 = $[7];
151
+ }
152
+ var t7 = loading === true ? undefined : onToggleCollapse;
153
+ var t8;
154
+ if ($[8] !== isCollapsed || $[9] !== labelStr || $[10] !== loading) {
155
+ t8 = loading === true ? /*#__PURE__*/_jsx("div", {
156
+ className: "h-3 w-24 rounded bg-gray-200 dark:bg-gray-700 mb-1"
157
+ }) : /*#__PURE__*/_jsxs(_Fragment, {
158
+ children: [/*#__PURE__*/_jsx(Icon, {
159
+ icon: isCollapsed ? "bxs:right-arrow" : "bxs:down-arrow",
160
+ className: "shrink-0"
161
+ }), labelStr]
162
+ });
163
+ $[8] = isCollapsed;
164
+ $[9] = labelStr;
165
+ $[10] = loading;
166
+ $[11] = t8;
167
+ } else {
168
+ t8 = $[11];
169
+ }
170
+ var t9;
171
+ if ($[12] !== t7 || $[13] !== t8) {
172
+ t9 = /*#__PURE__*/_jsx("div", {
173
+ className: "text-xs flex gap-[2px] items-center px-1 cursor-pointer text-gray-600 dark:text-gray-400",
174
+ onClick: t7,
175
+ children: t8
176
+ });
177
+ $[12] = t7;
178
+ $[13] = t8;
179
+ $[14] = t9;
180
+ } else {
181
+ t9 = $[14];
182
+ }
183
+ var t10;
184
+ if ($[15] !== color || $[16] !== data || $[17] !== dragState || $[18] !== isAnyDragActive || $[19] !== isCollapsed || $[20] !== labelStr || $[21] !== _onDragStart || $[22] !== selectionBounds || $[23] !== setSelectionBounds || $[24] !== stepMs || $[25] !== stripIndex || $[26] !== timeBounds || $[27] !== width) {
185
+ t10 = !isCollapsed ? /*#__PURE__*/_jsx(SamplesGraph, {
186
+ data: data,
187
+ height: STRIP_HEIGHT,
188
+ width: width !== null && width !== void 0 ? width : 1468,
189
+ fill: color(labelStr),
190
+ selectionBounds: selectionBounds,
191
+ setSelectionBounds: setSelectionBounds,
192
+ stepMs: stepMs,
193
+ onDragStart: function onDragStart(startX) {
194
+ return _onDragStart(stripIndex, startX);
195
+ },
196
+ dragState: (dragState === null || dragState === void 0 ? void 0 : dragState.stripIndex) === stripIndex ? dragState : undefined,
197
+ isAnyDragActive: isAnyDragActive,
198
+ timeBounds: timeBounds
199
+ }) : null;
200
+ $[15] = color;
201
+ $[16] = data;
202
+ $[17] = dragState;
203
+ $[18] = isAnyDragActive;
204
+ $[19] = isCollapsed;
205
+ $[20] = labelStr;
206
+ $[21] = _onDragStart;
207
+ $[22] = selectionBounds;
208
+ $[23] = setSelectionBounds;
209
+ $[24] = stepMs;
210
+ $[25] = stripIndex;
211
+ $[26] = timeBounds;
212
+ $[27] = width;
213
+ $[28] = t10;
214
+ } else {
215
+ t10 = $[28];
216
+ }
217
+ var t11;
218
+ if ($[29] !== labelStr || $[30] !== ref || $[31] !== t10 || $[32] !== t3 || $[33] !== t6 || $[34] !== t9) {
219
+ t11 = /*#__PURE__*/_jsxs("div", {
220
+ className: t3,
221
+ style: t6,
222
+ ref: ref,
223
+ children: [t9, t10]
224
+ }, labelStr);
225
+ $[29] = labelStr;
226
+ $[30] = ref;
227
+ $[31] = t10;
228
+ $[32] = t3;
229
+ $[33] = t6;
230
+ $[34] = t9;
231
+ $[35] = t11;
232
+ } else {
233
+ t11 = $[35];
234
+ }
235
+ return t11;
71
236
  };
72
- export const SamplesStrip = ({ loading, cpus, data, selectedTimeframe, onSelectedTimeframe, width, bounds, stepMs, }) => {
73
- const { isDarkMode } = useParcaContext();
74
- const effectiveLoading = loading === true;
75
- // When loading, use mock data to render a pixel-perfect skeleton
76
- const mockData = useMemo(() => (effectiveLoading && bounds[0] !== bounds[1] ? generateMockStripData(bounds) : null), [effectiveLoading, bounds]);
77
- const effectiveCpus = mockData?.cpus ?? cpus;
78
- const effectiveData = mockData?.data ?? data;
79
- const effectiveStepMs = mockData?.stepMs ?? stepMs;
80
- const [collapsedLabels, setCollapsedLabels] = useState(new Set());
81
- const [showAll, setShowAll] = useState(false);
82
- const [dragState, setDragState] = useState(undefined);
83
- const containerRef = useRef(null);
84
- const isDragging = dragState !== undefined;
85
- const { compare, keyOrder } = useMemo(() => createLabelSetComparator(effectiveCpus), [effectiveCpus]);
86
- const sortedItems = useMemo(() => {
87
- const items = effectiveCpus.map((cpu, i) => ({
88
- cpu,
89
- data: effectiveData[i],
90
- label: labelSetToString(cpu, keyOrder),
91
- }));
92
- return items.sort((a, b) => compare(a.cpu, b.cpu));
93
- }, [effectiveCpus, effectiveData, compare, keyOrder]);
94
- const hasMore = useMemo(() => sortedItems.length > MAX_VISIBLE_STRIPS, [sortedItems]);
95
- const visibleItems = useMemo(() => (showAll || !hasMore ? sortedItems : sortedItems.slice(0, MAX_VISIBLE_STRIPS)), [sortedItems, showAll, hasMore]);
96
- // Deterministic color: hash the label string so the same label always gets the same color
97
- // regardless of render order. When loading, use muted gray.
98
- const color = useMemo(() => {
99
- if (effectiveLoading) {
100
- return (_label) => (isDarkMode ? '#374151' : '#d1d5db');
101
- }
102
- const palette = d3.schemeObservable10;
103
- const hashStr = (s) => {
104
- let h = 0;
105
- for (let i = 0; i < s.length; i++) {
106
- h = (Math.imul(31, h) + s.charCodeAt(i)) | 0;
107
- }
108
- return Math.abs(h);
237
+ export var SamplesStrip = function SamplesStrip(t0) {
238
+ var _mockData$cpus, _mockData$data, _mockData$stepMs;
239
+ var $ = _c(95);
240
+ var loading = t0.loading,
241
+ cpus = t0.cpus,
242
+ data = t0.data,
243
+ selectedTimeframe = t0.selectedTimeframe,
244
+ onSelectedTimeframe = t0.onSelectedTimeframe,
245
+ width = t0.width,
246
+ bounds = t0.bounds,
247
+ stepMs = t0.stepMs;
248
+ var _useParcaContext = useParcaContext(),
249
+ isDarkMode = _useParcaContext.isDarkMode;
250
+ var effectiveLoading = loading === true;
251
+ var t1;
252
+ if ($[0] !== bounds || $[1] !== effectiveLoading) {
253
+ t1 = effectiveLoading && bounds[0] !== bounds[1] ? generateMockStripData(bounds) : null;
254
+ $[0] = bounds;
255
+ $[1] = effectiveLoading;
256
+ $[2] = t1;
257
+ } else {
258
+ t1 = $[2];
259
+ }
260
+ var mockData = t1;
261
+ var effectiveCpus = (_mockData$cpus = mockData === null || mockData === void 0 ? void 0 : mockData.cpus) !== null && _mockData$cpus !== void 0 ? _mockData$cpus : cpus;
262
+ var effectiveData = (_mockData$data = mockData === null || mockData === void 0 ? void 0 : mockData.data) !== null && _mockData$data !== void 0 ? _mockData$data : data;
263
+ var effectiveStepMs = (_mockData$stepMs = mockData === null || mockData === void 0 ? void 0 : mockData.stepMs) !== null && _mockData$stepMs !== void 0 ? _mockData$stepMs : stepMs;
264
+ var t2;
265
+ if ($[3] === Symbol["for"]("react.memo_cache_sentinel")) {
266
+ t2 = new Set();
267
+ $[3] = t2;
268
+ } else {
269
+ t2 = $[3];
270
+ }
271
+ var _useState = useState(t2),
272
+ _useState2 = _slicedToArray(_useState, 2),
273
+ collapsedLabels = _useState2[0],
274
+ setCollapsedLabels = _useState2[1];
275
+ var _useState3 = useState(false),
276
+ _useState4 = _slicedToArray(_useState3, 2),
277
+ showAll = _useState4[0],
278
+ setShowAll = _useState4[1];
279
+ var _useState5 = useState(undefined),
280
+ _useState6 = _slicedToArray(_useState5, 2),
281
+ dragState = _useState6[0],
282
+ setDragState = _useState6[1];
283
+ var containerRef = useRef(null);
284
+ var isDragging = dragState !== undefined;
285
+ var t3;
286
+ if ($[4] !== effectiveCpus) {
287
+ t3 = createLabelSetComparator(effectiveCpus);
288
+ $[4] = effectiveCpus;
289
+ $[5] = t3;
290
+ } else {
291
+ t3 = $[5];
292
+ }
293
+ var _t = t3,
294
+ compare = _t.compare,
295
+ keyOrder = _t.keyOrder;
296
+ var t4;
297
+ if ($[6] !== compare || $[7] !== effectiveCpus || $[8] !== effectiveData || $[9] !== keyOrder) {
298
+ var _t2;
299
+ if ($[11] !== effectiveData || $[12] !== keyOrder) {
300
+ _t2 = function _t2(cpu, i) {
301
+ return {
302
+ cpu: cpu,
303
+ data: effectiveData[i],
304
+ label: labelSetToString(cpu, keyOrder)
109
305
  };
110
- return (label) => palette[hashStr(label) % palette.length];
111
- }, [effectiveLoading, isDarkMode]);
112
- const handleDragStart = (stripIndex, startX) => {
113
- setDragState({ stripIndex, startX, currentX: startX });
306
+ };
307
+ $[11] = effectiveData;
308
+ $[12] = keyOrder;
309
+ $[13] = _t2;
310
+ } else {
311
+ _t2 = $[13];
312
+ }
313
+ var items = effectiveCpus.map(_t2);
314
+ var _t3;
315
+ if ($[14] !== compare) {
316
+ _t3 = function _t3(a, b) {
317
+ return compare(a.cpu, b.cpu);
318
+ };
319
+ $[14] = compare;
320
+ $[15] = _t3;
321
+ } else {
322
+ _t3 = $[15];
323
+ }
324
+ t4 = items.sort(_t3);
325
+ $[6] = compare;
326
+ $[7] = effectiveCpus;
327
+ $[8] = effectiveData;
328
+ $[9] = keyOrder;
329
+ $[10] = t4;
330
+ } else {
331
+ t4 = $[10];
332
+ }
333
+ var sortedItems = t4;
334
+ var hasMore = sortedItems.length > MAX_VISIBLE_STRIPS;
335
+ var t5;
336
+ if ($[16] !== hasMore || $[17] !== showAll || $[18] !== sortedItems) {
337
+ t5 = showAll || !hasMore ? sortedItems : sortedItems.slice(0, MAX_VISIBLE_STRIPS);
338
+ $[16] = hasMore;
339
+ $[17] = showAll;
340
+ $[18] = sortedItems;
341
+ $[19] = t5;
342
+ } else {
343
+ t5 = $[19];
344
+ }
345
+ var visibleItems = t5;
346
+ var t6;
347
+ bb0: {
348
+ if (effectiveLoading) {
349
+ var _t4;
350
+ if ($[20] !== isDarkMode) {
351
+ _t4 = function _t4(_label) {
352
+ return isDarkMode ? "#374151" : "#d1d5db";
353
+ };
354
+ $[20] = isDarkMode;
355
+ $[21] = _t4;
356
+ } else {
357
+ _t4 = $[21];
358
+ }
359
+ t6 = _t4;
360
+ break bb0;
361
+ }
362
+ var palette = d3.schemeObservable10;
363
+ var hashStr = _temp;
364
+ var _t5;
365
+ if ($[22] === Symbol["for"]("react.memo_cache_sentinel")) {
366
+ _t5 = function _t5(label) {
367
+ return palette[hashStr(label) % palette.length];
368
+ };
369
+ $[22] = _t5;
370
+ } else {
371
+ _t5 = $[22];
372
+ }
373
+ t6 = _t5;
374
+ }
375
+ var color = t6;
376
+ var t7;
377
+ if ($[23] === Symbol["for"]("react.memo_cache_sentinel")) {
378
+ t7 = function t7(stripIndex, startX) {
379
+ setDragState({
380
+ stripIndex: stripIndex,
381
+ startX: startX,
382
+ currentX: startX
383
+ });
114
384
  };
115
- const handleMouseMove = (e) => {
116
- if (dragState === undefined || containerRef.current === null)
117
- return;
118
- const rect = containerRef.current.getBoundingClientRect();
119
- const x = e.clientX - rect.left;
120
- // Clamp to container bounds
121
- const clampedX = Math.max(0, Math.min(x, width ?? rect.width));
122
- setDragState({ ...dragState, currentX: clampedX });
385
+ $[23] = t7;
386
+ } else {
387
+ t7 = $[23];
388
+ }
389
+ var handleDragStart = t7;
390
+ var t8;
391
+ if ($[24] !== dragState || $[25] !== width) {
392
+ t8 = function t8(e) {
393
+ if (dragState === undefined || containerRef.current === null) {
394
+ return;
395
+ }
396
+ var rect = containerRef.current.getBoundingClientRect();
397
+ var x = e.clientX - rect.left;
398
+ var clampedX = Math.max(0, Math.min(x, width !== null && width !== void 0 ? width : rect.width));
399
+ setDragState(_objectSpread(_objectSpread({}, dragState), {}, {
400
+ currentX: clampedX
401
+ }));
123
402
  };
124
- const handleMouseUp = (e) => {
125
- if (dragState === undefined || containerRef.current === null)
126
- return;
127
- const rect = containerRef.current.getBoundingClientRect();
128
- const x = e.clientX - rect.left;
129
- const clampedX = Math.max(0, Math.min(x, width ?? rect.width));
130
- const { stripIndex, startX } = dragState;
131
- if (startX !== clampedX) {
132
- const start = Math.min(startX, clampedX);
133
- const end = Math.max(startX, clampedX);
134
- // Convert pixel positions to timestamps
135
- const innerWidth = width ?? rect.width;
136
- const startTs = bounds[0] + (start / innerWidth) * (bounds[1] - bounds[0]);
137
- const endTs = bounds[0] + (end / innerWidth) * (bounds[1] - bounds[0]);
138
- onSelectedTimeframe(visibleItems[stripIndex].cpu, [startTs, endTs]);
139
- }
140
- setDragState(undefined);
403
+ $[24] = dragState;
404
+ $[25] = width;
405
+ $[26] = t8;
406
+ } else {
407
+ t8 = $[26];
408
+ }
409
+ var handleMouseMove = t8;
410
+ var t9;
411
+ if ($[27] !== bounds || $[28] !== dragState || $[29] !== onSelectedTimeframe || $[30] !== visibleItems || $[31] !== width) {
412
+ t9 = function t9(e_0) {
413
+ if (dragState === undefined || containerRef.current === null) {
414
+ return;
415
+ }
416
+ var rect_0 = containerRef.current.getBoundingClientRect();
417
+ var x_0 = e_0.clientX - rect_0.left;
418
+ var clampedX_0 = Math.max(0, Math.min(x_0, width !== null && width !== void 0 ? width : rect_0.width));
419
+ var stripIndex_0 = dragState.stripIndex,
420
+ startX_0 = dragState.startX;
421
+ if (startX_0 !== clampedX_0) {
422
+ var start = Math.min(startX_0, clampedX_0);
423
+ var end = Math.max(startX_0, clampedX_0);
424
+ var innerWidth = width !== null && width !== void 0 ? width : rect_0.width;
425
+ var startTs = bounds[0] + start / innerWidth * (bounds[1] - bounds[0]);
426
+ var endTs = bounds[0] + end / innerWidth * (bounds[1] - bounds[0]);
427
+ onSelectedTimeframe(visibleItems[stripIndex_0].cpu, [startTs, endTs]);
428
+ }
429
+ setDragState(undefined);
141
430
  };
142
- const handleMouseLeave = () => {
143
- setDragState(undefined);
431
+ $[27] = bounds;
432
+ $[28] = dragState;
433
+ $[29] = onSelectedTimeframe;
434
+ $[30] = visibleItems;
435
+ $[31] = width;
436
+ $[32] = t9;
437
+ } else {
438
+ t9 = $[32];
439
+ }
440
+ var handleMouseUp = t9;
441
+ var t10;
442
+ if ($[33] === Symbol["for"]("react.memo_cache_sentinel")) {
443
+ t10 = function t10() {
444
+ setDragState(undefined);
144
445
  };
145
- if (!effectiveLoading && effectiveData.length === 0) {
146
- return (_jsx("span", { className: "flex justify-center my-10", children: "There is no data matching your filter criteria, please try changing the filter." }));
446
+ $[33] = t10;
447
+ } else {
448
+ t10 = $[33];
449
+ }
450
+ var handleMouseLeave = t10;
451
+ if (!effectiveLoading && effectiveData.length === 0) {
452
+ var _t6;
453
+ if ($[34] === Symbol["for"]("react.memo_cache_sentinel")) {
454
+ _t6 = /*#__PURE__*/_jsx("span", {
455
+ className: "flex justify-center my-10",
456
+ children: "There is no data matching your filter criteria, please try changing the filter."
457
+ });
458
+ $[34] = _t6;
459
+ } else {
460
+ _t6 = $[34];
147
461
  }
148
- return (_jsxs("div", { ref: containerRef, className: cx('flex flex-col gap-1 relative my-0', {
149
- 'cursor-ew-resize': isDragging,
150
- 'animate-pulse pointer-events-none': effectiveLoading,
151
- }), style: { width: width ?? '100%' }, onMouseMove: effectiveLoading ? undefined : handleMouseMove, onMouseUp: effectiveLoading ? undefined : handleMouseUp, onMouseLeave: effectiveLoading ? undefined : handleMouseLeave, children: [_jsx(TimelineGuide, { bounds: [BigInt(0), BigInt(bounds[1] - bounds[0])], width: width ?? 1468, height: getTimelineGuideHeight(visibleItems.length, [...collapsedLabels].filter(l => visibleItems.some(item => item.label === l)).length), margin: 1, elevateGuideLines: true }), visibleItems.map((item, i) => {
152
- const isCollapsed = collapsedLabels.has(item.label);
153
- const isSelected = isEqual(item.cpu, selectedTimeframe?.labels);
154
- return (_jsx(SamplesGraphContainer, { isSelected: isSelected, isCollapsed: isCollapsed, label: item.label, width: width, data: item.data, onToggleCollapse: () => {
155
- const newCollapsedLabels = new Set(collapsedLabels);
156
- if (collapsedLabels.has(item.label)) {
157
- newCollapsedLabels.delete(item.label);
158
- }
159
- else {
160
- newCollapsedLabels.add(item.label);
161
- }
162
- setCollapsedLabels(newCollapsedLabels);
163
- }, selectionBounds: isSelected ? selectedTimeframe?.bounds : undefined, setSelectionBounds: newBounds => {
164
- onSelectedTimeframe(item.cpu, newBounds);
165
- }, color: color, stepMs: effectiveStepMs, onDragStart: handleDragStart, dragState: dragState, stripIndex: i, isAnyDragActive: isDragging, timeBounds: bounds, loading: effectiveLoading }, item.label));
166
- }), hasMore && !showAll && (_jsxs(Button, { variant: "secondary", onClick: () => setShowAll(true), className: "w-fit mx-auto mt-2", children: ["Show all ", sortedItems.length, " rows"] }))] }));
462
+ return _t6;
463
+ }
464
+ var t11;
465
+ if ($[35] !== effectiveLoading || $[36] !== isDragging) {
466
+ t11 = cx("flex flex-col gap-1 relative my-0", {
467
+ "cursor-ew-resize": isDragging,
468
+ "animate-pulse pointer-events-none": effectiveLoading
469
+ });
470
+ $[35] = effectiveLoading;
471
+ $[36] = isDragging;
472
+ $[37] = t11;
473
+ } else {
474
+ t11 = $[37];
475
+ }
476
+ var t12 = width !== null && width !== void 0 ? width : "100%";
477
+ var t13;
478
+ if ($[38] !== t12) {
479
+ t13 = {
480
+ width: t12
481
+ };
482
+ $[38] = t12;
483
+ $[39] = t13;
484
+ } else {
485
+ t13 = $[39];
486
+ }
487
+ var t14 = effectiveLoading ? undefined : handleMouseMove;
488
+ var t15 = effectiveLoading ? undefined : handleMouseUp;
489
+ var t16 = effectiveLoading ? undefined : handleMouseLeave;
490
+ var t17;
491
+ if ($[40] === Symbol["for"]("react.memo_cache_sentinel")) {
492
+ t17 = BigInt(0);
493
+ $[40] = t17;
494
+ } else {
495
+ t17 = $[40];
496
+ }
497
+ var t18 = bounds[1] - bounds[0];
498
+ var t19;
499
+ if ($[41] !== t18) {
500
+ t19 = BigInt(t18);
501
+ $[41] = t18;
502
+ $[42] = t19;
503
+ } else {
504
+ t19 = $[42];
505
+ }
506
+ var t20;
507
+ if ($[43] !== t19) {
508
+ t20 = [t17, t19];
509
+ $[43] = t19;
510
+ $[44] = t20;
511
+ } else {
512
+ t20 = $[44];
513
+ }
514
+ var t21 = width !== null && width !== void 0 ? width : 1468;
515
+ var t22 = visibleItems.length;
516
+ var t23;
517
+ if ($[45] !== collapsedLabels) {
518
+ t23 = _toConsumableArray(collapsedLabels);
519
+ $[45] = collapsedLabels;
520
+ $[46] = t23;
521
+ } else {
522
+ t23 = $[46];
523
+ }
524
+ var t24;
525
+ if ($[47] !== t23 || $[48] !== visibleItems) {
526
+ t24 = t23.filter(function (l) {
527
+ return visibleItems.some(function (item) {
528
+ return item.label === l;
529
+ });
530
+ });
531
+ $[47] = t23;
532
+ $[48] = visibleItems;
533
+ $[49] = t24;
534
+ } else {
535
+ t24 = $[49];
536
+ }
537
+ var t25;
538
+ if ($[50] !== t24.length || $[51] !== visibleItems.length) {
539
+ t25 = getTimelineGuideHeight(t22, t24.length);
540
+ $[50] = t24.length;
541
+ $[51] = visibleItems.length;
542
+ $[52] = t25;
543
+ } else {
544
+ t25 = $[52];
545
+ }
546
+ var t26;
547
+ if ($[53] !== t20 || $[54] !== t21 || $[55] !== t25) {
548
+ t26 = /*#__PURE__*/_jsx(TimelineGuide, {
549
+ bounds: t20,
550
+ width: t21,
551
+ height: t25,
552
+ margin: 1,
553
+ elevateGuideLines: true
554
+ });
555
+ $[53] = t20;
556
+ $[54] = t21;
557
+ $[55] = t25;
558
+ $[56] = t26;
559
+ } else {
560
+ t26 = $[56];
561
+ }
562
+ var t27;
563
+ if ($[57] !== bounds || $[58] !== collapsedLabels || $[59] !== color || $[60] !== dragState || $[61] !== effectiveLoading || $[62] !== effectiveStepMs || $[63] !== isDragging || $[64] !== onSelectedTimeframe || $[65] !== (selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.bounds) || $[66] !== (selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.labels) || $[67] !== visibleItems || $[68] !== width) {
564
+ var _t7;
565
+ if ($[70] !== bounds || $[71] !== collapsedLabels || $[72] !== color || $[73] !== dragState || $[74] !== effectiveLoading || $[75] !== effectiveStepMs || $[76] !== isDragging || $[77] !== onSelectedTimeframe || $[78] !== (selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.bounds) || $[79] !== (selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.labels) || $[80] !== width) {
566
+ _t7 = function _t7(item_0, i_1) {
567
+ var isCollapsed = collapsedLabels.has(item_0.label);
568
+ var isSelected = isEqual(item_0.cpu, selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.labels);
569
+ return /*#__PURE__*/_jsx(SamplesGraphContainer, {
570
+ isSelected: isSelected,
571
+ isCollapsed: isCollapsed,
572
+ label: item_0.label,
573
+ width: width,
574
+ data: item_0.data,
575
+ onToggleCollapse: function onToggleCollapse() {
576
+ var newCollapsedLabels = new Set(collapsedLabels);
577
+ if (collapsedLabels.has(item_0.label)) {
578
+ newCollapsedLabels["delete"](item_0.label);
579
+ } else {
580
+ newCollapsedLabels.add(item_0.label);
581
+ }
582
+ setCollapsedLabels(newCollapsedLabels);
583
+ },
584
+ selectionBounds: isSelected ? selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.bounds : undefined,
585
+ setSelectionBounds: function setSelectionBounds(newBounds) {
586
+ onSelectedTimeframe(item_0.cpu, newBounds);
587
+ },
588
+ color: color,
589
+ stepMs: effectiveStepMs,
590
+ onDragStart: handleDragStart,
591
+ dragState: dragState,
592
+ stripIndex: i_1,
593
+ isAnyDragActive: isDragging,
594
+ timeBounds: bounds,
595
+ loading: effectiveLoading
596
+ }, item_0.label);
597
+ };
598
+ $[70] = bounds;
599
+ $[71] = collapsedLabels;
600
+ $[72] = color;
601
+ $[73] = dragState;
602
+ $[74] = effectiveLoading;
603
+ $[75] = effectiveStepMs;
604
+ $[76] = isDragging;
605
+ $[77] = onSelectedTimeframe;
606
+ $[78] = selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.bounds;
607
+ $[79] = selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.labels;
608
+ $[80] = width;
609
+ $[81] = _t7;
610
+ } else {
611
+ _t7 = $[81];
612
+ }
613
+ t27 = visibleItems.map(_t7);
614
+ $[57] = bounds;
615
+ $[58] = collapsedLabels;
616
+ $[59] = color;
617
+ $[60] = dragState;
618
+ $[61] = effectiveLoading;
619
+ $[62] = effectiveStepMs;
620
+ $[63] = isDragging;
621
+ $[64] = onSelectedTimeframe;
622
+ $[65] = selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.bounds;
623
+ $[66] = selectedTimeframe === null || selectedTimeframe === void 0 ? void 0 : selectedTimeframe.labels;
624
+ $[67] = visibleItems;
625
+ $[68] = width;
626
+ $[69] = t27;
627
+ } else {
628
+ t27 = $[69];
629
+ }
630
+ var t28;
631
+ if ($[82] !== hasMore || $[83] !== showAll || $[84] !== sortedItems.length) {
632
+ t28 = hasMore && !showAll && /*#__PURE__*/_jsxs(Button, {
633
+ variant: "secondary",
634
+ onClick: function onClick() {
635
+ return setShowAll(true);
636
+ },
637
+ className: "w-fit mx-auto mt-2",
638
+ children: ["Show all ", sortedItems.length, " rows"]
639
+ });
640
+ $[82] = hasMore;
641
+ $[83] = showAll;
642
+ $[84] = sortedItems.length;
643
+ $[85] = t28;
644
+ } else {
645
+ t28 = $[85];
646
+ }
647
+ var t29;
648
+ if ($[86] !== t11 || $[87] !== t13 || $[88] !== t14 || $[89] !== t15 || $[90] !== t16 || $[91] !== t26 || $[92] !== t27 || $[93] !== t28) {
649
+ t29 = /*#__PURE__*/_jsxs("div", {
650
+ ref: containerRef,
651
+ className: t11,
652
+ style: t13,
653
+ onMouseMove: t14,
654
+ onMouseUp: t15,
655
+ onMouseLeave: t16,
656
+ children: [t26, t27, t28]
657
+ });
658
+ $[86] = t11;
659
+ $[87] = t13;
660
+ $[88] = t14;
661
+ $[89] = t15;
662
+ $[90] = t16;
663
+ $[91] = t26;
664
+ $[92] = t27;
665
+ $[93] = t28;
666
+ $[94] = t29;
667
+ } else {
668
+ t29 = $[94];
669
+ }
670
+ return t29;
167
671
  };
672
+ function _temp(s) {
673
+ var h = 0;
674
+ for (var i_0 = 0; i_0 < s.length; i_0++) {
675
+ h = Math.imul(31, h) + s.charCodeAt(i_0) | 0;
676
+ }
677
+ return Math.abs(h);
678
+ }