sparkforensics-server 0.2.0 → 0.2.3

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 (288) hide show
  1. package/index.js +1 -1
  2. package/lib/static-files.js +5 -4
  3. package/package.json +4 -3
  4. package/public/assets/AutoscalingChurn-Bf5TN-s_.js +1 -0
  5. package/public/assets/CacheUtilization-DRf_FNrK.js +1 -0
  6. package/public/assets/CachingOpportunity-BTJzIhtI.js +1 -0
  7. package/public/assets/ColdStart-DnFgnD3n.js +1 -0
  8. package/public/assets/ConfigAudit-B5FsOdmu.js +1 -0
  9. package/public/assets/CoreUsageArea-CTksBPuq.js +1 -0
  10. package/public/assets/Dashboard-BFMsMuc_.js +1 -0
  11. package/public/assets/DuplicatePlanSubtree-BCt-Guuh.js +1 -0
  12. package/public/assets/DurationHistogram-xRcnND4k.js +1 -0
  13. package/public/assets/EmptyState-CnTrSjtU.js +1 -0
  14. package/public/assets/ExecutorUtilization-CP21XlUq.js +1 -0
  15. package/public/assets/GcPressure-BoEJsLjb.js +1 -0
  16. package/public/assets/ImpactEstimate-BHcqJkcZ.js +1 -0
  17. package/public/assets/IncompleteRun-b9FWrOHn.js +1 -0
  18. package/public/assets/JobFailures-C5FkTq3O.js +1 -0
  19. package/public/assets/MemoryUtilization-D2W4AB_f.js +1 -0
  20. package/public/assets/OverBroadcast-Btu3xorf.js +1 -0
  21. package/public/assets/PartitionSizing-yZWhLN0e.js +1 -0
  22. package/public/assets/PlanExplorer-DSk1ivS4.js +1 -0
  23. package/public/assets/PlanGraphRoute-C3iOzUdB.js +1 -0
  24. package/public/assets/RetryWaste-B4436kr1.js +1 -0
  25. package/public/assets/RowPagination-oeWB8gBm.js +1 -0
  26. package/public/assets/ShuffleIO-DUiv8EJe.js +1 -0
  27. package/public/assets/Skew-D2lB1oQc.js +1 -0
  28. package/public/assets/SlowHost-Qb_8aa-W.js +1 -0
  29. package/public/assets/SmallFiles-u6suTgfj.js +1 -0
  30. package/public/assets/SpeculationWaste-vUCniiFP.js +1 -0
  31. package/public/assets/Spill-BskXFX2e.js +1 -0
  32. package/public/assets/StageFailed-D9b83Jvy.js +1 -0
  33. package/public/assets/StageFindingGroup-DagqHOUz.js +1 -0
  34. package/public/assets/StageHeader-DibMSunO.js +1 -0
  35. package/public/assets/StagePill-Dt6V9yVw.js +1 -0
  36. package/public/assets/StageShape-CfdrDUZa.js +1 -0
  37. package/public/assets/StageSlowness-BoGLIYKR.js +1 -0
  38. package/public/assets/Straggler-DU1WSU-m.js +1 -0
  39. package/public/assets/TaskFailures-DkY6zBNJ.js +1 -0
  40. package/public/assets/TinyTask-Lsnt5mJF.js +1 -0
  41. package/public/assets/UnderBroadcast-DxHc0lwy.js +1 -0
  42. package/public/assets/WidgetLeadSummary-BdUUi7L5.js +1 -0
  43. package/public/assets/charts-vendor-0VMaLVLN.js +59 -0
  44. package/public/assets/downsample-WmNM1qc9.js +1 -0
  45. package/public/assets/finding-anchor-Bl1hRK5E.js +1 -0
  46. package/public/assets/impact-sort-DxaUheWV.js +1 -0
  47. package/public/assets/inbox-DHIFHqcn.js +1 -0
  48. package/public/assets/index-CjVklAdW.css +2 -0
  49. package/public/assets/index-U654cmB8.js +9 -0
  50. package/public/assets/parser-worker-5a9aUx3o.js +115 -0
  51. package/public/assets/plan-graph-vendor-B0sEms9Z.js +7 -0
  52. package/public/assets/plan-graph-vendor-DLioOiRN.css +1 -0
  53. package/public/assets/react-vendor-D2TLlSzI.js +9 -0
  54. package/public/assets/rolldown-runtime-hePW80VL.js +1 -0
  55. package/public/assets/select-CtKaJ5Hx.js +1 -0
  56. package/public/assets/toggle-group-DB2VfFIx.js +1 -0
  57. package/public/assets/usePagedRows-jNUWgVTD.js +1 -0
  58. package/public/assets/useRecentFiles-BiYdWs8J.js +11 -0
  59. package/public/assets/useSortMode-BhPky1lW.js +1 -0
  60. package/public/docs/404.html +3 -3
  61. package/public/docs/assets/{app.BgzsaTS3.js → app.BczRxXPr.js} +1 -1
  62. package/public/docs/assets/chunks/@localSearchIndexroot.c2HfrwDg.js +1 -0
  63. package/public/docs/assets/chunks/{VPLocalSearchBox.DOq3t-On.js → VPLocalSearchBox.DXvkTVnC.js} +1 -1
  64. package/public/docs/assets/chunks/theme.ByUdwrLG.js +2 -0
  65. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.9ToZXcTk.js +1 -0
  66. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.9ToZXcTk.lean.js +1 -0
  67. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.B1vUqtry.js +1 -0
  68. package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.BOeH4d1J.lean.js → contributor-guide_architecture_detector-contract.md.B1vUqtry.lean.js} +1 -1
  69. package/public/docs/assets/{contributor-guide_architecture_drill-down.md.BtPdlM7r.js → contributor-guide_architecture_drill-down.md.Bawx6NgP.js} +1 -1
  70. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.js +1 -0
  71. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.lean.js +1 -0
  72. package/public/docs/assets/{contributor-guide_architecture_overview.md.CehiRmGn.js → contributor-guide_architecture_overview.md.DkXdJ9jE.js} +1 -1
  73. package/public/docs/assets/contributor-guide_architecture_overview.md.DkXdJ9jE.lean.js +1 -0
  74. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.js +1 -0
  75. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.lean.js +1 -0
  76. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DYwFeyjV.js +1 -0
  77. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.C0SovZX8.js +6 -0
  78. package/public/docs/assets/{contributor-guide_architecture_worker-protocol.md.B93qJ_tT.lean.js → contributor-guide_architecture_worker-protocol.md.C0SovZX8.lean.js} +1 -1
  79. package/public/docs/assets/{contributor-guide_development-setup.md.DvAN_9mK.js → contributor-guide_development-setup.md.DvMV1xhQ.js} +3 -3
  80. package/public/docs/assets/contributor-guide_development-setup.md.DvMV1xhQ.lean.js +1 -0
  81. package/public/docs/assets/{contributor-guide_testing.md.6rIKqSyY.js → contributor-guide_testing.md.BohuQWvl.js} +1 -1
  82. package/public/docs/assets/{contributor-guide_testing.md.6rIKqSyY.lean.js → contributor-guide_testing.md.BohuQWvl.lean.js} +1 -1
  83. package/public/docs/assets/{style.DXOMCXxn.css → style.DSixAiZE.css} +1 -1
  84. package/public/docs/assets/{tuning-reference_bottleneck-failures.md.4z5BXGJ2.js → tuning-reference_bottleneck-failures.md.CAsFf3RR.js} +1 -1
  85. package/public/docs/assets/{tuning-reference_bottleneck-gc.md.DSxzZRK7.js → tuning-reference_bottleneck-gc.md.B4T3kJYV.js} +2 -2
  86. package/public/docs/assets/{tuning-reference_bottleneck-gc.md.DSxzZRK7.lean.js → tuning-reference_bottleneck-gc.md.B4T3kJYV.lean.js} +1 -1
  87. package/public/docs/assets/tuning-reference_bottleneck-shuffle.md.DDMQVOW6.js +12 -0
  88. package/public/docs/assets/{tuning-reference_bottleneck-shuffle.md.CM-nTmIH.lean.js → tuning-reference_bottleneck-shuffle.md.DDMQVOW6.lean.js} +1 -1
  89. package/public/docs/assets/{tuning-reference_bottleneck-skew.md.BdUwiDhn.js → tuning-reference_bottleneck-skew.md.B0MzhWcX.js} +4 -4
  90. package/public/docs/assets/{tuning-reference_bottleneck-skew.md.BdUwiDhn.lean.js → tuning-reference_bottleneck-skew.md.B0MzhWcX.lean.js} +1 -1
  91. package/public/docs/assets/{tuning-reference_bottleneck-small-files.md.B8kloyx8.js → tuning-reference_bottleneck-small-files.md.DHGMTmPs.js} +2 -2
  92. package/public/docs/assets/{tuning-reference_bottleneck-small-files.md.B8kloyx8.lean.js → tuning-reference_bottleneck-small-files.md.DHGMTmPs.lean.js} +1 -1
  93. package/public/docs/assets/{tuning-reference_bottleneck-straggler.md.DY36fHN5.js → tuning-reference_bottleneck-straggler.md.DIbXdAcQ.js} +2 -2
  94. package/public/docs/assets/{tuning-reference_bottleneck-straggler.md.DY36fHN5.lean.js → tuning-reference_bottleneck-straggler.md.DIbXdAcQ.lean.js} +1 -1
  95. package/public/docs/assets/{tuning-reference_bottleneck-tiny-tasks.md.QTV7O8kU.js → tuning-reference_bottleneck-tiny-tasks.md.CB05v3zh.js} +1 -1
  96. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DqC_iGkw.js +5 -0
  97. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DqC_iGkw.lean.js +1 -0
  98. package/public/docs/assets/{tuning-reference_cluster-config.md.ZVmDGsQ3.js → tuning-reference_cluster-config.md.CD6vzYtD.js} +1 -1
  99. package/public/docs/assets/{tuning-reference_cluster-config.md.ZVmDGsQ3.lean.js → tuning-reference_cluster-config.md.CD6vzYtD.lean.js} +1 -1
  100. package/public/docs/assets/{tuning-reference_memory-model.md.DhT-n4y3.js → tuning-reference_memory-model.md.CWhvgevP.js} +1 -1
  101. package/public/docs/assets/{tuning-reference_memory-model.md.DhT-n4y3.lean.js → tuning-reference_memory-model.md.CWhvgevP.lean.js} +1 -1
  102. package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.js → user-guide_alternative-log-retrieval.md.B4tPGIal.js} +1 -1
  103. package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.lean.js → user-guide_alternative-log-retrieval.md.B4tPGIal.lean.js} +1 -1
  104. package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.js +3 -0
  105. package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.lean.js +1 -0
  106. package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.js → user-guide_mcp-tools.md.DGvolGzt.js} +4 -4
  107. package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.lean.js → user-guide_mcp-tools.md.DGvolGzt.lean.js} +1 -1
  108. package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.js +1 -0
  109. package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.lean.js +1 -0
  110. package/public/docs/assets/user-guide_understanding-findings.md.B29f0ucS.js +1 -0
  111. package/public/docs/assets/user-guide_understanding-findings.md.B29f0ucS.lean.js +1 -0
  112. package/public/docs/contributor-guide/architecture/board-widgets.html +6 -6
  113. package/public/docs/contributor-guide/architecture/detector-contract.html +6 -6
  114. package/public/docs/contributor-guide/architecture/drill-down.html +6 -6
  115. package/public/docs/contributor-guide/architecture/impact-estimation.html +6 -6
  116. package/public/docs/contributor-guide/architecture/index.html +4 -4
  117. package/public/docs/contributor-guide/architecture/overview.html +6 -6
  118. package/public/docs/contributor-guide/architecture/state-and-history.html +6 -6
  119. package/public/docs/contributor-guide/architecture/widget-rendering.html +6 -6
  120. package/public/docs/contributor-guide/architecture/worker-protocol.html +7 -7
  121. package/public/docs/contributor-guide/contributing.html +4 -4
  122. package/public/docs/contributor-guide/development-setup.html +6 -6
  123. package/public/docs/contributor-guide/testing.html +6 -6
  124. package/public/docs/hashmap.json +1 -1
  125. package/public/docs/index.html +4 -4
  126. package/public/docs/tuning-reference/anti-patterns.html +4 -4
  127. package/public/docs/tuning-reference/aqe.html +4 -4
  128. package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +4 -4
  129. package/public/docs/tuning-reference/bottleneck-cold-start.html +4 -4
  130. package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +4 -4
  131. package/public/docs/tuning-reference/bottleneck-failures.html +6 -6
  132. package/public/docs/tuning-reference/bottleneck-gc.html +6 -6
  133. package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +4 -4
  134. package/public/docs/tuning-reference/bottleneck-memory-utilization.html +4 -4
  135. package/public/docs/tuning-reference/bottleneck-retry-waste.html +4 -4
  136. package/public/docs/tuning-reference/bottleneck-shuffle.html +7 -7
  137. package/public/docs/tuning-reference/bottleneck-skew.html +8 -8
  138. package/public/docs/tuning-reference/bottleneck-slow-host.html +4 -4
  139. package/public/docs/tuning-reference/bottleneck-small-files.html +7 -7
  140. package/public/docs/tuning-reference/bottleneck-spill.html +4 -4
  141. package/public/docs/tuning-reference/bottleneck-straggler.html +6 -6
  142. package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +6 -6
  143. package/public/docs/tuning-reference/bottleneck-utilization.html +7 -7
  144. package/public/docs/tuning-reference/caching.html +4 -4
  145. package/public/docs/tuning-reference/cluster-config.html +6 -6
  146. package/public/docs/tuning-reference/config.html +4 -4
  147. package/public/docs/tuning-reference/data-formats.html +4 -4
  148. package/public/docs/tuning-reference/index.html +4 -4
  149. package/public/docs/tuning-reference/intro.html +4 -4
  150. package/public/docs/tuning-reference/joins.html +4 -4
  151. package/public/docs/tuning-reference/memory-model.html +6 -6
  152. package/public/docs/tuning-reference/metrics.html +4 -4
  153. package/public/docs/tuning-reference/partitioning.html +4 -4
  154. package/public/docs/tuning-reference/pyspark.html +4 -4
  155. package/public/docs/tuning-reference/shuffle.html +4 -4
  156. package/public/docs/tuning-reference/spark-architecture.html +4 -4
  157. package/public/docs/tuning-reference/table-formats.html +4 -4
  158. package/public/docs/user-guide/alternative-log-retrieval.html +6 -6
  159. package/public/docs/user-guide/getting-started.html +7 -7
  160. package/public/docs/user-guide/mcp-tools.html +9 -9
  161. package/public/docs/user-guide/run-comparison.html +6 -6
  162. package/public/docs/user-guide/understanding-findings.html +6 -6
  163. package/public/index.html +7 -6
  164. package/public/sample-runs/sample-run.ndjson.gz +0 -0
  165. package/vendor-core/cli/collect-run.js +3 -2
  166. package/vendor-core/cli/native-zstd.js +351 -0
  167. package/vendor-core/detectors.js +390 -75
  168. package/vendor-core/docs-config.js +34 -8
  169. package/vendor-core/docs-content/chapters/03-memory-model.md +39 -0
  170. package/vendor-core/docs-content/chapters/11-cluster-config.md +40 -0
  171. package/vendor-core/docs-content/detection/cache.md +4 -3
  172. package/vendor-core/docs-content/detection/chrn.md +4 -2
  173. package/vendor-core/docs-content/detection/gc.md +2 -0
  174. package/vendor-core/docs-content/detection/host.md +2 -1
  175. package/vendor-core/docs-content/detection/local.md +2 -3
  176. package/vendor-core/docs-content/detection/mem.md +3 -3
  177. package/vendor-core/docs-content/detection/plan.md +3 -1
  178. package/vendor-core/docs-content/detection/shape.md +2 -1
  179. package/vendor-core/docs-content/detection/shfl.md +2 -1
  180. package/vendor-core/docs-content/detection/spec.md +4 -3
  181. package/vendor-core/docs-content/detection/spill.md +1 -1
  182. package/vendor-core/docs-content/detection/strag.md +2 -1
  183. package/vendor-core/docs-content/detection/tiny.md +2 -1
  184. package/vendor-core/docs-content/tuning/failures.md +1 -1
  185. package/vendor-core/docs-content/tuning/gc.md +11 -4
  186. package/vendor-core/docs-content/tuning/shuffle.md +25 -5
  187. package/vendor-core/docs-content/tuning/skew.md +14 -6
  188. package/vendor-core/docs-content/tuning/small-files.md +12 -7
  189. package/vendor-core/docs-content/tuning/straggler.md +34 -0
  190. package/vendor-core/docs-content/tuning/tiny-tasks.md +1 -1
  191. package/vendor-core/docs-content/tuning/utilization.md +57 -7
  192. package/vendor-core/docs-content/upstream.json +4 -0
  193. package/vendor-core/event-handlers.js +321 -69
  194. package/vendor-core/event-schemas.js +8 -6
  195. package/vendor-core/evidence-report.js +4 -2
  196. package/vendor-core/impact-estimator.js +150 -34
  197. package/vendor-core/mcp-tools.js +20 -7
  198. package/vendor-core/occupancy.js +70 -2
  199. package/vendor-core/parser-worker.js +30 -14
  200. package/vendor-core/plan-summary.js +4 -0
  201. package/vendor-core/run-comparison.js +22 -17
  202. package/vendor-core/shs-fetch.js +18 -7
  203. package/vendor-core/shs-load.js +2 -1
  204. package/vendor-core/stage-quantiles.js +59 -3
  205. package/vendor-core/string-hash.js +15 -0
  206. package/vendor-core/types.js +9 -1
  207. package/vendor-core/vendor/fzstd.js +94 -18
  208. package/public/assets/AutoscalingChurn-CFJkiqxW.js +0 -1
  209. package/public/assets/CacheUtilization-kTKZBzDA.js +0 -1
  210. package/public/assets/CachingOpportunity-CU70EWcF.js +0 -1
  211. package/public/assets/ColdStart-hOI-WOvm.js +0 -1
  212. package/public/assets/ConfigAudit-B4oAksZY.js +0 -1
  213. package/public/assets/CoreUsageArea-D-dR3SQk.js +0 -1
  214. package/public/assets/Dashboard-MDhohsq4.js +0 -4
  215. package/public/assets/DuplicatePlanSubtree-54RKsfI7.js +0 -1
  216. package/public/assets/DurationHistogram-CviQyPNM.js +0 -1
  217. package/public/assets/EmptyState-v2ehFncc.js +0 -1
  218. package/public/assets/ExecutorUtilization-vHyFHgL6.js +0 -1
  219. package/public/assets/GcPressure-DINuhcno.js +0 -1
  220. package/public/assets/ImpactEstimate-C6GzFOY9.js +0 -1
  221. package/public/assets/IncompleteRun-a1kuCnU6.js +0 -1
  222. package/public/assets/JobFailures-CYwPfUhR.js +0 -1
  223. package/public/assets/MemoryUtilization-Dlfj0e_f.js +0 -1
  224. package/public/assets/OverBroadcast-BMu7Y8l9.js +0 -1
  225. package/public/assets/PartitionSizing-CvMGfSVB.js +0 -1
  226. package/public/assets/PlanExplorer-xYFme_Rx.js +0 -1
  227. package/public/assets/PlanGraphRoute-a3OGg6ET.js +0 -1
  228. package/public/assets/RetryWaste-JKRjOZ-J.js +0 -1
  229. package/public/assets/RowPagination-DypWbnic.js +0 -1
  230. package/public/assets/ShuffleIO-Mi8HiVu-.js +0 -1
  231. package/public/assets/Skew-C3iOScTC.js +0 -1
  232. package/public/assets/SlowHost-DKBg18v-.js +0 -1
  233. package/public/assets/SmallFiles-CCCB6AIu.js +0 -1
  234. package/public/assets/SpeculationWaste-DUNupw0_.js +0 -1
  235. package/public/assets/Spill-BlLdatik.js +0 -1
  236. package/public/assets/StageFailed-qtY7C7Yo.js +0 -1
  237. package/public/assets/StageFindingGroup-CoVdEZYs.js +0 -1
  238. package/public/assets/StageHeader-uDBLHgdg.js +0 -1
  239. package/public/assets/StagePill-CYCMdlIx.js +0 -1
  240. package/public/assets/StageShape-zs0mAjQJ.js +0 -1
  241. package/public/assets/StageSlowness-C7vg0u5Q.js +0 -1
  242. package/public/assets/Straggler-4BRGAQP4.js +0 -1
  243. package/public/assets/TaskFailures-CSjO23Kg.js +0 -1
  244. package/public/assets/TinyTask-6Zuovcn5.js +0 -1
  245. package/public/assets/UnderBroadcast-CePjo0ZV.js +0 -1
  246. package/public/assets/WidgetLeadSummary-DRNRVvn7.js +0 -1
  247. package/public/assets/charts-vendor-Cf1-wzeH.js +0 -59
  248. package/public/assets/downsample-D8XmJk6i.js +0 -1
  249. package/public/assets/finding-anchor-4TmpXd7j.js +0 -1
  250. package/public/assets/impact-sort-Cq6KOLqh.js +0 -1
  251. package/public/assets/inbox-DBFovbUX.js +0 -1
  252. package/public/assets/index-CHjV2-jB.js +0 -9
  253. package/public/assets/index-DMEtaP4u.css +0 -1
  254. package/public/assets/parser-worker-BMPPE37w.js +0 -64
  255. package/public/assets/plan-graph-vendor-B96a-e4N.js +0 -7
  256. package/public/assets/plan-graph-vendor-BnuhLJ6X.css +0 -1
  257. package/public/assets/react-vendor-DA6opS-q.js +0 -9
  258. package/public/assets/select-D5fK-za0.js +0 -1
  259. package/public/assets/toggle-group-lbIXRG0W.js +0 -1
  260. package/public/assets/usePagedRows-CFoZrPr4.js +0 -1
  261. package/public/assets/useRecentFiles-BPGQ6XII.js +0 -13
  262. package/public/assets/useSortMode-BOPpfLhJ.js +0 -1
  263. package/public/docs/assets/chunks/@localSearchIndexroot.PQ5JepCp.js +0 -1
  264. package/public/docs/assets/chunks/theme.BP14rGBx.js +0 -2
  265. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.js +0 -1
  266. package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.lean.js +0 -1
  267. package/public/docs/assets/contributor-guide_architecture_detector-contract.md.BOeH4d1J.js +0 -1
  268. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DYCDPgkh.js +0 -1
  269. package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DYCDPgkh.lean.js +0 -1
  270. package/public/docs/assets/contributor-guide_architecture_overview.md.CehiRmGn.lean.js +0 -1
  271. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.js +0 -1
  272. package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.lean.js +0 -1
  273. package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DbqPf2OT.js +0 -1
  274. package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.B93qJ_tT.js +0 -6
  275. package/public/docs/assets/contributor-guide_development-setup.md.DvAN_9mK.lean.js +0 -1
  276. package/public/docs/assets/tuning-reference_bottleneck-shuffle.md.CM-nTmIH.js +0 -12
  277. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DTiueZC3.js +0 -5
  278. package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DTiueZC3.lean.js +0 -1
  279. package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.js +0 -3
  280. package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.lean.js +0 -1
  281. package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.js +0 -1
  282. package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.lean.js +0 -1
  283. package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.js +0 -1
  284. package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.lean.js +0 -1
  285. /package/public/docs/assets/{contributor-guide_architecture_drill-down.md.BtPdlM7r.lean.js → contributor-guide_architecture_drill-down.md.Bawx6NgP.lean.js} +0 -0
  286. /package/public/docs/assets/{contributor-guide_architecture_widget-rendering.md.DbqPf2OT.lean.js → contributor-guide_architecture_widget-rendering.md.DYwFeyjV.lean.js} +0 -0
  287. /package/public/docs/assets/{tuning-reference_bottleneck-failures.md.4z5BXGJ2.lean.js → tuning-reference_bottleneck-failures.md.CAsFf3RR.lean.js} +0 -0
  288. /package/public/docs/assets/{tuning-reference_bottleneck-tiny-tasks.md.QTV7O8kU.lean.js → tuning-reference_bottleneck-tiny-tasks.md.CB05v3zh.lean.js} +0 -0
package/index.js CHANGED
@@ -85,7 +85,7 @@ export function createServer({
85
85
  await serveStatic(req, res, root);
86
86
  }
87
87
  } catch (err) {
88
- console.error(`[server] ${req.method} ${req.url} failed:`, err?.stack ?? err);
88
+ console.error('[server] %s %s failed:', req.method, req.url, err?.stack ?? err);
89
89
  if (!res.headersSent) res.writeHead(500, { 'content-type': 'text/plain' });
90
90
  res.end(`Internal server error: ${err.message}`);
91
91
  }
@@ -1,6 +1,6 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { readFile } from 'node:fs/promises';
3
- import { join, normalize, sep, extname } from 'node:path';
3
+ import { join, resolve, sep, extname } from 'node:path';
4
4
 
5
5
  const CONTENT_TYPES = {
6
6
  '.html': 'text/html; charset=utf-8',
@@ -29,11 +29,12 @@ export async function serveStatic(req, res, root) {
29
29
  // Any directory-style request (trailing slash, including '/' itself) seeks
30
30
  // that directory's index.html, same as a browser navigating to it directly.
31
31
  const relative = pathname.endsWith('/') ? `${stripped}index.html` : stripped;
32
- const target = normalize(join(root, relative));
32
+ const safeRoot = resolve(root);
33
+ const target = resolve(safeRoot, relative);
33
34
 
34
35
  // Path-traversal guard: the resolved path must stay within root.
35
- const rootPrefix = normalize(root + sep);
36
- if (target !== normalize(root) && !target.startsWith(rootPrefix)) {
36
+ const rootPrefix = safeRoot + sep;
37
+ if (target !== safeRoot && !target.startsWith(rootPrefix)) {
37
38
  res.writeHead(403, { 'content-type': 'text/plain; charset=utf-8' });
38
39
  res.end('Forbidden');
39
40
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkforensics-server",
3
- "version": "0.2.0",
3
+ "version": "0.2.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Local companion server for the SparkForensics dashboard: serves the app and proxies Spark History Server fetches to avoid browser CORS restrictions.",
@@ -35,13 +35,14 @@
35
35
  ],
36
36
  "scripts": {
37
37
  "test": "vitest run",
38
+ "test:coverage": "vitest run --coverage",
38
39
  "prepack": "node ../../scripts/vendor-core.mjs . && node scripts/copy-frontend.js"
39
40
  },
40
41
  "dependencies": {
41
42
  "@modelcontextprotocol/sdk": "^1.30.0",
42
- "zod": "^4.4.3"
43
+ "zod": "^4.6.5"
43
44
  },
44
45
  "devDependencies": {
45
- "vitest": "^4.1.10"
46
+ "vitest": "^5.0.1"
46
47
  }
47
48
  }
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t,T as n,f as r,l as i,o as a,s as o,t as s,v as c,w as l}from"./charts-vendor-0VMaLVLN.js";import{p as u}from"./plan-graph-vendor-B0sEms9Z.js";import{T as d,w as f}from"./useRecentFiles-BiYdWs8J.js";import{A as p,D as m,O as h,i as g}from"./index-U654cmB8.js";import{t as _}from"./downsample-WmNM1qc9.js";import{t as v}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as y}from"./ImpactEstimate-BHcqJkcZ.js";var b=e(t(),1),x=u(),S=60,C=6e4,w=220;function T(e,t,n,r,i){if(e.length===0&&t.length===0)return[];let a=Math.max(i,r-n),o=Math.max(1,Math.ceil(a/i)),s=[];for(let e=0;e<o;e++)s.push({tStart:n+e*i,adds:0,removes:0});let c=e=>Math.min(o-1,Math.max(0,Math.floor((e-n)/i)));for(let t of e)s[c(t.timestamp)].adds++;for(let e of t)s[c(e.timestamp)].removes++;return s}function E(e,t){let n=Math.max(1,t-e);return Math.max(C,Math.ceil(n/S))}function D(e){if(e<=0)return 1;let t=10**Math.floor(Math.log10(e)),n=e/t;return(n<=1?1:n<=2?2:n<=5?5:10)*t}function O(e){let t=D(e.reduce((e,t)=>Math.max(e,Math.abs(t.added),Math.abs(t.removed)),0));return{domain:[-t,t],ticks:[-t,-t/2,0,t/2,t]}}function k(e){return Math.abs(e.height)<1?null:(0,x.jsx)(l,{...e})}function A({finding:e}){return(0,x.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Short-lived executors: `,(0,x.jsxs)(`strong`,{children:[e.value,`%`]})]}),(0,x.jsx)(y,{finding:e}),(0,x.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2 text-sm`,children:[(0,x.jsx)(m,{impactBand:e.impactBand,className:`mt-1.5`}),(0,x.jsxs)(`span`,{children:[e.recommendation,` `,(0,x.jsx)(p,{anchor:`#config-autoscale-bounds`,children:`Tuning executorIdleTimeout and the min/max bounds`}),`.`]})]})]})}var j=(0,b.memo)(function({appModel:e,activeFileId:t,catalog:l=[],defaultCollapsed:u=!0}){let p=(0,b.useMemo)(()=>{let t=e.executors.added,n=e.executors.removed;if(t.length===0&&n.length===0)return{hasEvents:!1,added:t,removed:n};let r=e.app,i=r?.startTime??0,a=r?.endTime??i,o=E(i,a),s=_(T(t,n,i,a,o)).map(e=>({t:`${Math.round((e.tStart-i)/1e3)}s`,added:e.adds,removed:-e.removes}));return{hasEvents:!0,added:t,removed:n,rows:s,yAxisScale:O(s)}},[e,t]);if(!p.hasEvents)return(0,x.jsx)(g,{title:`Autoscaling Churn`,summary:(0,x.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`No executor add/remove events (static allocation).`}),children:(0,x.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`No executor add/remove events (static allocation).`})});let{added:m,removed:y,rows:S,yAxisScale:C}=p,D=l.find(e=>e.type===`autoscalingChurn`);return(0,x.jsx)(g,{title:`Autoscaling Churn`,impactBand:D?.impactBand,badges:D&&(0,x.jsx)(h,{type:`autoscalingChurn`,impactBand:D.impactBand}),defaultCollapsed:u,summary:(0,x.jsx)(v,{value:`${m.length} added / ${y.length} removed`,context:D?`${D.value}% short-lived executors, ${D.impactBand}`:`executor churn events`}),children:(0,x.jsxs)(`div`,{className:`space-y-2`,children:[D&&(0,x.jsx)(A,{finding:D}),(0,x.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`executors added / removed over time`}),(0,x.jsx)(d,{ariaLabel:`Executor added and removed counts per time bucket over the run.`,height:w,table:{caption:`Executor added/removed counts by time bucket`,columns:[`Time`,`Executors added`,`Executors removed`],rows:S.map(e=>[e.t,e.added,Math.abs(e.removed)]),align:[`right`,`right`,`right`]},children:(0,x.jsxs)(s,{data:S,children:[(0,x.jsx)(r,{stroke:f.muted,strokeOpacity:.2}),(0,x.jsx)(o,{dataKey:`t`,tick:{fontSize:10}}),(0,x.jsx)(a,{tick:{fontSize:10},width:32,domain:C.domain,ticks:C.ticks}),(0,x.jsx)(c,{formatter:(e,t)=>[Math.abs(Number(e)),t]}),(0,x.jsx)(n,{wrapperStyle:{fontSize:10}}),(0,x.jsx)(i,{dataKey:`added`,name:`Added`,stackId:`churn`,fill:f.clean,shape:k}),(0,x.jsx)(i,{dataKey:`removed`,name:`Removed`,stackId:`churn`,fill:f.muted,shape:k})]})})]})})});export{j as AutoscalingChurn};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{A as r,D as i,O as a,_ as o,b as s,bt as c,gt as l,h as u,ht as d,i as f,k as p,l as m,m as h,ot as g,pt as _,ut as v,v as y,y as b}from"./index-U654cmB8.js";import{t as x}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as S}from"./ImpactEstimate-BHcqJkcZ.js";import{t as C}from"./RowPagination-oeWB8gBm.js";import{n as w}from"./finding-anchor-Bl1hRK5E.js";import{t as T}from"./usePagedRows-jNUWgVTD.js";var E=e(t(),1),D=n(),O=70;function k(e){if(!e)return`—`;let t=[];return e.useMemory&&t.push(`Memory`),e.useDisk&&t.push(`Disk`),e.deserialized?t.push(`Deserialized`):(e.useMemory||e.useDisk)&&t.push(`Serialized`),(e.replication??1)>1&&t.push(`x${e.replication}`),t.join(` · `)||`—`}function A(e){return e.name||`RDD ${e.id}`}function j(e){let t=l(A(e));return t.length<=O?t:`${t.slice(0,O)}…`}function M(e){let t=_(`pct`,d(e));return e.variant===`diskSpillover`?`${t} spilled to disk: ${v(e.diskSize??0)} disk / ${v(e.memorySize??0)} memory`:`${t} cached (${e.numCachedPartitions??0}/${e.numPartitions??0} partitions)`}function N({finding:e}){let t=w([e]),n=e.rddName??`RDD ${e.rddId}`;return(0,D.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:[(0,D.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,D.jsx)(i,{impactBand:e.impactBand,className:`mt-1.5`}),(0,D.jsx)(`span`,{children:n})]}),(0,D.jsx)(p,{children:(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:M(e)})}),(0,D.jsx)(S,{finding:e}),(0,D.jsx)(`p`,{className:`text-sm`,children:e.recommendation})]})}var P=(0,E.memo)(function({appModel:e,catalog:t}){let[n,l]=(0,E.useState)(0),[d,p]=(0,E.useState)(0),_=e.app?.rddInfo,S=(0,E.useMemo)(()=>_?[..._.values()].filter(e=>(e.storageLevel?.useMemory||e.storageLevel?.useDisk)&&(e.numCachedPartitions??0)>0).sort((e,t)=>(t.memorySize??0)+(t.diskSize??0)-((e.memorySize??0)+(e.diskSize??0))):[],[_]),w=(0,E.useMemo)(()=>t.filter(e=>e.type===`cacheUtilization`).sort((e,t)=>g[e.impactBand]-g[t.impactBand]),[t]),O=T(S,n,l),M=m(),P=M?w.findIndex(e=>e===M.finding):null,F=T(w,d,p,P);if(S.length===0)return null;let I=e=>w.filter(t=>t.rddId===e),L=S.reduce((e,t)=>e+(t.memorySize??0)+(t.diskSize??0),0);return(0,D.jsx)(`div`,{"data-widget":`cache-utilization`,children:(0,D.jsxs)(f,{title:`Cache Storage`,impactBand:c(w),badges:(0,D.jsxs)(D.Fragment,{children:[w.length>0?(0,D.jsx)(a,{type:`cacheUtilization`,impactBand:c(w)??`info`}):null,(0,D.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[S.length,` cached RDD`,S.length===1?``:`s`,`, see`,` `,(0,D.jsx)(r,{anchor:`#memory-model`,children:`how Spark accounts cached memory`})]})]}),defaultCollapsed:!0,summary:(0,D.jsx)(x,{value:v(L),context:`cached across memory + disk`}),children:[(0,D.jsxs)(h,{children:[(0,D.jsx)(b,{children:(0,D.jsxs)(s,{children:[(0,D.jsx)(y,{children:`RDD`}),(0,D.jsx)(y,{children:`Storage level`}),(0,D.jsx)(y,{className:`text-right`,children:`Cached partitions`}),(0,D.jsx)(y,{className:`text-right`,children:`Memory`}),(0,D.jsx)(y,{className:`text-right`,children:`Disk`})]})}),(0,D.jsx)(u,{children:O.visible.map(e=>{let t=A(e),n=j(e),r=I(e.id);return(0,D.jsxs)(s,{children:[(0,D.jsxs)(o,{className:`max-w-80 truncate`,title:t===n?void 0:t,children:[n,r.length>0&&(0,D.jsx)(i,{impactBand:c(r)??`info`,className:`ml-1.5`})]}),(0,D.jsx)(o,{children:k(e.storageLevel)}),(0,D.jsxs)(o,{className:`text-right`,children:[e.numCachedPartitions,` / `,e.numPartitions]}),(0,D.jsx)(o,{className:`text-right`,children:v(e.memorySize??0)}),(0,D.jsx)(o,{className:`text-right`,children:v(e.diskSize??0)})]},e.id)})})]}),(0,D.jsx)(C,{page:O.effectivePage,totalPages:O.totalPages,onPrev:()=>l(e=>e-1),onNext:()=>l(e=>e+1)}),w.length>0?(0,D.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[F.visible.map(e=>(0,D.jsx)(N,{finding:e},e.id)),(0,D.jsx)(C,{page:F.effectivePage,totalPages:F.totalPages,onPrev:()=>p(e=>e-1),onNext:()=>p(e=>e+1)})]}):null]})})});export{P as CacheUtilization};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{At as i,O as a,_ as o,b as s,h as c,i as l,j as u,k as d,l as f,m as p,ut as m,v as h,y as g}from"./index-U654cmB8.js";import{t as _}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as v}from"./ImpactEstimate-BHcqJkcZ.js";import{t as y}from"./RowPagination-oeWB8gBm.js";import{n as b}from"./finding-anchor-Bl1hRK5E.js";import{t as x}from"./usePagedRows-jNUWgVTD.js";var S={name:`git-merge`,size:24,node:[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]};S.node;var C=i(S),w=e(t(),1),T=n();function E({relations:e,operator:t}){let n=t===`union`?`union`:`join`;return(0,T.jsx)(`span`,{className:`inline-flex flex-wrap items-baseline`,children:e.map((e,t)=>(0,T.jsxs)(`span`,{children:[t>0?(0,T.jsxs)(T.Fragment,{children:[` `,(0,T.jsx)(`span`,{className:`mx-1 font-semibold uppercase text-xs tracking-wide text-primary`,children:n}),` `]}):null,e.relation]},e.relation))})}function D({finding:e}){let t=b([e]),n=e.variant===`composite`;return(0,T.jsxs)(s,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,T.jsx)(o,{children:(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[n?(0,T.jsx)(C,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}):null,n&&e.relations&&e.relations.length>0?(0,T.jsx)(E,{relations:e.relations,operator:e.operator}):(0,T.jsx)(`span`,{children:e.relation}),n?(0,T.jsx)(u,{variant:`outline`,className:`text-xs uppercase border-dashed`,children:e.operator?.toUpperCase()}):(0,T.jsx)(u,{variant:`secondary`,className:`text-xs uppercase`,children:e.format})]})}),(0,T.jsxs)(o,{children:[e.value,` queries`]}),(0,T.jsx)(o,{className:`text-right`,children:m(e.totalReadBytes??0)}),(0,T.jsxs)(o,{children:[(0,T.jsx)(v,{finding:e}),(0,T.jsx)(`p`,{className:`mt-1`,children:e.recommendation}),(0,T.jsx)(d,{children:(0,T.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]})]})}var O=(0,w.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,r]=(0,w.useState)(0),i=(0,w.useMemo)(()=>e.filter(e=>e.type===`cachingOpportunity`).sort((e,t)=>(t.totalReadBytes??0)-(e.totalReadBytes??0)||(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0)),[e]),o=f(),u=o?i.findIndex(e=>e===o.finding):null,{totalPages:m,effectivePage:v,visible:b}=x(i,n,r,u);if(i.length===0)return null;let S=i[0];return(0,T.jsx)(l,{title:`Caching Opportunities`,impactBand:`info`,badges:(0,T.jsx)(a,{type:`cachingOpportunity`,impactBand:`info`}),defaultCollapsed:t,summary:(0,T.jsx)(_,{value:`${S.value}×`,context:`read by ${S.value} queries: ${S.relation}`}),children:(0,T.jsxs)(`div`,{className:`space-y-3`,children:[(0,T.jsxs)(p,{children:[(0,T.jsx)(g,{children:(0,T.jsxs)(s,{children:[(0,T.jsx)(h,{children:`Relation`}),(0,T.jsx)(h,{children:`Read by`}),(0,T.jsx)(h,{className:`text-right`,children:`Data read`}),(0,T.jsx)(h,{children:`Recommendation`})]})}),(0,T.jsx)(c,{children:b.map((e,t)=>(0,T.jsx)(D,{finding:e},`${e.format}:${e.relation}:${(e.executionIds??[]).join(`,`)}:${t}`))})]}),(0,T.jsx)(d,{children:(0,T.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reuse is inferred from plan structure, not confirmed by execution. Verify before caching.`})}),(0,T.jsx)(y,{page:v,totalPages:m,onPrev:()=>r(e=>e-1),onNext:()=>r(e=>e+1)})]})})});export{O as CachingOpportunity};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,i as a,l as o,ot as s}from"./index-U654cmB8.js";import{t as c}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as l}from"./ImpactEstimate-BHcqJkcZ.js";import{t as u}from"./RowPagination-oeWB8gBm.js";import{r as d}from"./impact-sort-DxaUheWV.js";import{n as f}from"./finding-anchor-Bl1hRK5E.js";import{t as p}from"./usePagedRows-jNUWgVTD.js";import{n as m,t as h}from"./useSortMode-BhPky1lW.js";var g=e(t(),1),_=n();function v(e){return`${e.value}s`}function y({finding:e}){let t=f([e]);return(0,_.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 text-sm transition-colors ${t.flashClassName}`,children:[(0,_.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,_.jsx)(r,{impactBand:e.impactBand}),(0,_.jsx)(`strong`,{children:v(e)})]}),(0,_.jsx)(l,{finding:e}),(0,_.jsx)(`p`,{className:`text-muted-foreground pt-1`,children:e.recommendation})]})}var b=(0,g.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:r,orderBy:l}=h(),[f,b]=(0,g.useState)(!t),[x,S]=(0,g.useState)(0),C=e.filter(e=>e.type===`coldStart`).slice().sort((e,t)=>s[e.impactBand]-s[t.impactBand]),w=l(C,e=>[e],e=>e.stageId??null),T=o(),E=T?w.findIndex(e=>e===T.finding):null,{totalPages:D,effectivePage:O,visible:k}=p(w,x,S,E);return C.length===0?null:(0,_.jsxs)(a,{title:`Cold Start`,impactBand:C[0].impactBand,badges:(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(i,{type:`coldStart`,impactBand:C[0].impactBand}),d(C,C.length,f)?(0,_.jsx)(m,{mode:n,onChange:r}):null]}),open:f,onOpenChange:b,summary:(0,_.jsx)(c,{value:v(C[0]),context:`${C.length} issue${C.length===1?``:`s`} flagged`}),children:[(0,_.jsx)(`ul`,{className:`space-y-2`,children:k.map(e=>(0,_.jsx)(y,{finding:e},e.id))}),(0,_.jsx)(u,{page:O,totalPages:D,onPrev:()=>S(e=>e-1),onNext:()=>S(e=>e+1)})]})});export{b as ColdStart};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{A as i,D as a,H as o,N as s,O as c,bt as l,i as u,k as d,l as f,ot as p}from"./index-U654cmB8.js";import{t as m}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as h}from"./ImpactEstimate-BHcqJkcZ.js";import{t as g}from"./RowPagination-oeWB8gBm.js";import{n as _}from"./finding-anchor-Bl1hRK5E.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";var y=e(t(),1),b=n();function x({finding:e}){let t=_([e]);return(0,b.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(a,{impactBand:e.impactBand}),(0,b.jsx)(`code`,{className:`text-xs`,children:e.property}),(0,b.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`=`}),(0,b.jsx)(`code`,{className:`rounded bg-accent/10 px-1.5 py-0.5 font-mono text-xs text-accent`,children:String(e.value)})]}),(0,b.jsx)(h,{finding:e}),(0,b.jsxs)(`p`,{className:`text-sm`,children:[e.recommendation,e.docAnchor?(0,b.jsxs)(b.Fragment,{children:[` `,(0,b.jsxs)(i,{anchor:e.docAnchor,children:[`Why `,e.property,` matters`]})]}):null]})]})}var S=(0,y.memo)(function({appModel:e,configFindings:t,defaultCollapsed:n=!0}){let[i,a]=(0,y.useState)(0),h=(0,y.useMemo)(()=>(t??o(e.app)).filter(e=>e.type===`configAudit`).slice().sort((e,t)=>p[e.impactBand]-p[t.impactBand]),[t,e]),_=f(),S=_?h.findIndex(e=>e===_.finding):null,{totalPages:C,effectivePage:w,visible:T}=v(h,i,a,S);if(h.length===0){let t=e.evidenceAvailability?.entries.find(e=>e.key===`sparkConfiguration`),n;if(t)n=t.state===`present`?`No misconfigurations detected.`:t.state===`unknown`&&t.reasonCode===`parseIncomplete`?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`span`,{children:[t.summary,` `]}),(0,b.jsx)(d,{children:(0,b.jsx)(r,{evidenceKey:`sparkConfiguration`})})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{children:`No environment info captured in this log. `}),(0,b.jsx)(d,{children:(0,b.jsx)(r,{evidenceKey:`sparkConfiguration`})})]});else{let t=e.app?.evidenceInputs;n=(t?t.environmentUpdates>0:Object.keys(e.app?.config??{}).length>0||e.app?.resources)?`No misconfigurations detected.`:(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{children:`No environment info captured in this log. `}),(0,b.jsx)(d,{children:(0,b.jsx)(r,{evidenceKey:`sparkConfiguration`})})]})}let i=(0,b.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:n});return(0,b.jsx)(u,{title:`Config Sanity`,compact:!0,summary:i,children:i})}let E=l(h);return(0,b.jsxs)(u,{title:`Config Sanity`,impactBand:E,badges:(0,b.jsx)(c,{type:`configAudit`,impactBand:E??`info`,docAnchor:s(h)}),statusBadge:(0,b.jsx)(d,{children:(0,b.jsx)(r,{evidenceKey:`sparkConfiguration`})}),defaultCollapsed:n,summary:(0,b.jsx)(m,{value:`${h.length}`,context:`misconfiguration${h.length===1?``:`s`} flagged`}),children:[(0,b.jsx)(`ul`,{className:`space-y-4`,children:T.map(e=>(0,b.jsx)(x,{finding:e},e.id))}),(0,b.jsx)(g,{page:w,totalPages:C,onPrev:()=>a(e=>e-1),onNext:()=>a(e=>e+1)})]})});export{S as ConfigAudit};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t,T as n,f as r,n as i,o as a,s as o,u as s,v as c}from"./charts-vendor-0VMaLVLN.js";import{p as l}from"./plan-graph-vendor-B0sEms9Z.js";import{S as u,T as d,w as f}from"./useRecentFiles-BiYdWs8J.js";import{t as p}from"./inbox-DHIFHqcn.js";import{A as m,D as h,J as g,O as _,i as v,k as y}from"./index-U654cmB8.js";import{t as b}from"./EmptyState-CnTrSjtU.js";import{t as x}from"./downsample-WmNM1qc9.js";import{t as S}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as C}from"./ImpactEstimate-BHcqJkcZ.js";import{t as w}from"./RowPagination-oeWB8gBm.js";import{t as T}from"./usePagedRows-jNUWgVTD.js";var E=e(t(),1),D=[`PROCESS_LOCAL`,`NODE_LOCAL`,`RACK_LOCAL`,`NO_PREF`,`ANY`];function O(e,{bucketWidthMs:t=6e4,tiers:n=D}={}){let r=e.filter(e=>(e.completedAt??0)>(e.submittedAt??0)&&(e.executorRunTime??0)>0);if(r.length===0)return{labels:[],series:{}};let i=r.reduce((e,t)=>Math.min(e,t.submittedAt??e),1/0),a=r.reduce((e,t)=>Math.max(e,t.completedAt??e),-1/0),o=Math.max(1,Math.ceil((a-i)/t)),s={};for(let e of n)s[e]=Array(o).fill(0);let c=Array(o).fill(0);for(let e of r){let n=e.completedAt??0,r=e.submittedAt??0,a=n-r,l=(e.executorRunTime??0)/a,u=(e.localityStats??[]).reduce((e,t)=>e+t.count,0)||1,d=new Map((e.localityStats??[]).map(e=>[e.locality,e.count/u]));for(let e=0;e<o;e++){let a=i+e*t,o=a+t,u=Math.min(n,o)-Math.max(r,a);if(u<=0)continue;let f=u/t;for(let[t,n]of d){let r=l*n*f;s[t]?s[t][e]+=r:c[e]+=r}}}c.some(e=>e>0)&&(s.OTHER=c);let l=Array(o).fill(0);for(let e of Object.keys(s))for(let t=0;t<o;t++)l[t]+=s[e][t];let u=l.reduce((e,t)=>Math.max(e,t),0);s.idle=l.map(e=>Math.max(0,u-e));let d=[];for(let e=0;e<o;e++)d.push(i+e*t);return{labels:d,series:s}}var k=l(),A=240,j=60,M={PROCESS_LOCAL:`Process-local`,NODE_LOCAL:`Node-local`,RACK_LOCAL:`Rack-local`,NO_PREF:`No preference`,ANY:`Any`,OTHER:`Other`,idle:`Idle`},N={PROCESS_LOCAL:f.clean,NODE_LOCAL:f.accent,RACK_LOCAL:f.warning,NO_PREF:f.muted,ANY:f.critical,OTHER:f.muted,idle:f.muted},P=`Core Usage by Locality`,F=(0,E.memo)(function({appModel:e,catalog:t,activeFileId:l,defaultCollapsed:F=!0}){let[I,L]=(0,E.useState)(0),R=(0,E.useMemo)(()=>{let t=[...e.stages.values()];if(!t.some(e=>(e.executorRunTime??0)>0&&(e.completedAt??0)>(e.submittedAt??0)))return{hasActivity:!1};let n=e.app,r=n?.startTime??0,i=n?.endTime??r,{labels:a,series:o}=O(t,{bucketWidthMs:Math.max(6e4,Math.ceil(Math.max(1,i-r)/j))}),s=[...D.filter(e=>o[e]),...o.OTHER?[`OTHER`]:[],`idle`],c=a.map((e,t)=>{let n={t:Math.round((e-r)/1e3)};for(let e of s)n[e]=o[e]?.[t]??0;return n}),l=x(c),u=s.filter(e=>e!==`idle`);return{hasActivity:!0,order:s,points:c,sampled:l,peakCores:c.reduce((e,t)=>Math.max(e,u.reduce((e,n)=>e+t[n],0)),0)}},[e,l]),z=(0,E.useMemo)(()=>g([...e.stages.values()],{topN:1/0}),[e,l]),B=t.find(e=>e.type===`coreLocality`),V=t.some(e=>e.type===`memoryUtilization`&&e.variant===`idleCores`),H=z.topStages.filter(e=>e.nonLocalTasks>0),{totalPages:U,effectivePage:W,visible:G}=T(H,I,L);if(!R.hasActivity)return(0,k.jsx)(v,{title:P,summary:(0,k.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`No stage activity to plot.`}),children:(0,k.jsx)(b,{tone:`neutral`,icon:p,title:`No stage activity to plot.`})});let{order:K,points:q,sampled:J,peakCores:Y}=R;return(0,k.jsx)(v,{title:P,impactBand:B?.impactBand,badges:B?(0,k.jsx)(_,{type:`coreLocality`,impactBand:B.impactBand}):null,defaultCollapsed:F,summary:(0,k.jsx)(S,{value:`${Math.round(Y)} cores`,context:`peak concurrent, by locality`}),children:(0,k.jsxs)(`div`,{className:`space-y-2`,children:[(0,k.jsx)(y,{children:(0,k.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`approximate: stage-level attribution`,B?null:(0,k.jsxs)(k.Fragment,{children:[`, see `,(0,k.jsx)(m,{anchor:`#bottleneck-utilization`,children:`how utilization is measured`})]})]})}),B?(0,k.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2 text-sm`,children:[(0,k.jsx)(h,{impactBand:B.impactBand,className:`mt-1.5`}),(0,k.jsxs)(`span`,{children:[(0,k.jsxs)(`strong`,{children:[B.value,`% non-local`]}),`: `,B.recommendation]})]}):null,B?(0,k.jsx)(C,{finding:B}):null,(0,k.jsx)(y,{children:B?(0,k.jsx)(u,{confidence:B.confidence,validationRequired:B.validationRequired}):null}),(0,k.jsx)(d,{ariaLabel:`Approximate concurrent core usage over time, stacked by task locality tier, with idle capacity shown. See the legend for tier colors.`,height:A,table:{caption:`Concurrent core usage over time by locality tier`,columns:[`Time (s)`,...K.map(e=>M[e]??e)],rows:q.map(e=>[e.t,...K.map(t=>Math.round(e[t]))]),align:Array.from({length:K.length+1},()=>`right`)},children:(0,k.jsxs)(i,{data:J,children:[(0,k.jsx)(r,{vertical:!1,stroke:f.muted,strokeOpacity:.2}),(0,k.jsx)(o,{dataKey:`t`,tick:{fontSize:10},label:{value:`seconds from app start`,position:`insideBottom`,offset:-2,fontSize:10}}),(0,k.jsx)(a,{tick:{fontSize:10},width:36,label:{value:`avg concurrent cores`,angle:-90,position:`insideLeft`,fontSize:10}}),(0,k.jsx)(c,{}),(0,k.jsx)(n,{wrapperStyle:{fontSize:10}}),K.map(e=>(0,k.jsx)(s,{type:`monotone`,dataKey:e,name:M[e]??e,stackId:`cores`,stroke:N[e]??f.muted,fill:N[e]??f.muted,fillOpacity:e===`idle`?.15:.8,isAnimationActive:!1},e))]})}),(0,k.jsx)(y,{children:G.length>0?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:G.map(e=>(0,k.jsxs)(`li`,{children:[`Stage `,e.stageId,`: `,Math.round(e.ratio*100),`% non-local (`,e.nonLocalTasks,`/`,e.taskCount,` tasks)`]},e.stageId))}),(0,k.jsx)(w,{page:W,totalPages:U,onPrev:()=>L(e=>e-1),onNext:()=>L(e=>e+1)})]}):null}),(0,k.jsx)(y,{children:V?(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Idle cores also flagged → see Memory Utilization widget`}):null})]})})});export{F as CoreUsageArea};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{D as t,M as n,O as r,T as i,_ as a,a as o,d as s,f as c,i as l,l as u,n as d,o as f,s as p,u as m,v as h}from"./charts-vendor-0VMaLVLN.js";import{A as g,D as _,E as v,O as y,P as b,k as x}from"./react-vendor-D2TLlSzI.js";import{p as S}from"./plan-graph-vendor-B0sEms9Z.js";import{A as C,B as w,C as ee,E as T,F as te,H as ne,I as E,L as D,M as re,N as ie,O as ae,P as oe,R as se,S as O,T as k,V as ce,_ as le,a as ue,b as de,d as fe,f as pe,g as me,h as he,i as ge,j as _e,k as ve,l as ye,m as be,n as xe,o as Se,p as Ce,r as we,s as Te,t as Ee,u as De,v as Oe,w as A,x as ke,y as Ae,z as je}from"./useRecentFiles-BiYdWs8J.js";import{t as Me}from"./inbox-DHIFHqcn.js";import{A as Ne,At as Pe,D as j,Dt as Fe,E as Ie,F as Le,Ft as Re,It as ze,K as Be,L as Ve,Lt as M,N as He,Nt as Ue,O as We,Ot as Ge,P as Ke,Pt as qe,T as Je,Y as Ye,_ as N,a as Xe,b as P,bt as Ze,c as Qe,ct as $e,dt as F,gt as et,h as tt,i as I,j as nt,k as L,kt as rt,m as it,mt as at,n as ot,o as st,ot as ct,p as lt,s as R,st as ut,ut as z,v as dt,vt as ft,w as pt,xt as mt,y as ht,yt as gt}from"./index-U654cmB8.js";import{t as _t}from"./EmptyState-CnTrSjtU.js";import{n as vt,t as yt}from"./toggle-group-DB2VfFIx.js";import{n as bt,t as xt}from"./DurationHistogram-xRcnND4k.js";import{t as St}from"./downsample-WmNM1qc9.js";import{t as B}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as Ct,t as wt}from"./StagePill-Dt6V9yVw.js";import{i as Tt,n as Et,r as Dt,t as Ot}from"./ImpactEstimate-BHcqJkcZ.js";import{t as kt}from"./RowPagination-oeWB8gBm.js";var At={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};At.node;var jt=Pe(At),Mt={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};Mt.node;var Nt=Pe(Mt),Pt={name:`search-x`,size:24,node:[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};Pt.node;var Ft=Pe(Pt),It={name:`target`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`6`,key:`1vlfrh`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]};It.node;var Lt=Pe(It),V=e(n(),1),Rt=[`critical`,`warning`,`info`];function zt(){return{impactBands:new Set,types:new Set,stages:new Set}}function Bt(e){return e.impactBands.size===0&&e.types.size===0&&e.stages.size===0}function Vt(e,t){return D(e,{impactBand:t.impactBands,type:t.types,stageId:t.stages})}function Ht(e,t){return e.filter(e=>Vt(e,t))}function Ut(e,t){let n=new Set,r=new Set,i=new Set;for(let a of[...e,...t])n.add(a.impactBand),r.add(a.type),a.stageId!=null&&i.add(a.stageId);return{impactBands:Rt.filter(e=>n.has(e)),types:[...r].sort(),stages:[...i].sort((e,t)=>e-t)}}function Wt(e){return e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function Gt(e,t){let n=new URLSearchParams(e),r=zt();for(let e of Wt(n.get(`impact`)))Rt.includes(e)&&r.impactBands.add(e);let i=new Set(t.types);for(let e of Wt(n.get(`type`)))i.has(e)&&r.types.add(e);for(let e of Wt(n.get(`stage`))){let t=Number(e);Number.isInteger(t)&&r.stages.add(t)}return r}function Kt(e){let t=[];return e.impactBands.size&&t.push(`impact=${Rt.filter(t=>e.impactBands.has(t)).join(`,`)}`),e.types.size&&t.push(`type=${[...e.types].sort().join(`,`)}`),e.stages.size&&t.push(`stage=${[...e.stages].sort((e,t)=>e-t).join(`,`)}`),t.length?`?${t.join(`&`)}`:``}var H=S(),qt=(0,V.createContext)(null);function Jt(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function Yt({options:e,fileId:t,children:n}){let[r,i]=(0,V.useState)(()=>Gt(typeof window>`u`?``:window.location.search,e));(0,V.useEffect)(()=>{if(typeof window>`u`)return;let e=Kt(r),t=`${window.location.pathname}${e}${window.location.hash}`;window.history.replaceState(window.history.state,``,t)},[r]);let a=(0,V.useRef)(t);(0,V.useEffect)(()=>{a.current!==t&&(a.current=t,i(zt()))},[t]),(0,V.useEffect)(()=>()=>{if(typeof window>`u`)return;let e=`${window.location.pathname}${window.location.hash}`;window.history.replaceState(window.history.state,``,e)},[]),(0,V.useEffect)(()=>{if(typeof window>`u`)return;let t=()=>i(Gt(window.location.search,e));return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let o=(0,V.useCallback)(e=>i(t=>({...t,impactBands:Jt(t.impactBands,e)})),[]),s=(0,V.useCallback)(e=>i(t=>({...t,types:Jt(t.types,e)})),[]),c=(0,V.useCallback)(e=>i(t=>({...t,stages:Jt(t.stages,e)})),[]),l=(0,V.useCallback)(()=>i(zt()),[]),u=(0,V.useMemo)(()=>({selection:r,toggleImpactBand:o,toggleType:s,toggleStage:c,clearAll:l}),[r,o,s,c,l]);return(0,H.jsx)(qt.Provider,{value:u,children:n})}function Xt(){let e=(0,V.useContext)(qt);if(!e)throw Error(`useFindingFilter outside FindingFilterProvider`);return e}function Zt(){let{clearAll:e}=Xt();return(0,H.jsx)(_t,{icon:Ft,title:`No findings match the active filters`,description:`Adjust or clear the filters to see findings.`,action:(0,H.jsx)(`button`,{type:`button`,onClick:e,className:`cursor-pointer text-sm underline`,children:`Clear all filters`})})}function Qt({className:e,orientation:t=`horizontal`,...n}){return(0,H.jsx)(b,{"data-slot":`separator`,orientation:t,className:M(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var $t={critical:`aria-pressed:bg-critical/10 aria-pressed:text-critical`,warning:`aria-pressed:bg-warning/10 aria-pressed:text-warning`,info:`aria-pressed:bg-info/10 aria-pressed:text-info`};function en(e,t,n){let r=new Set(e);for(let e of r)t.has(e)||n(e);for(let e of t)r.has(e)||n(e)}function tn({label:e,count:t,children:n}){return(0,H.jsxs)(ve,{children:[(0,H.jsxs)(re,{className:M(Le({variant:`outline`,size:`sm`}),`gap-1.5`),"aria-label":`Filter by ${e.toLowerCase()}`,children:[e,t>0&&(0,H.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-xs font-medium text-primary-foreground`,children:t}),(0,H.jsx)(rt,{"aria-hidden":`true`,className:`opacity-60`})]}),(0,H.jsx)(_e,{align:`start`,className:`max-h-72 w-56 overflow-y-auto`,children:n})]})}function nn({options:e,resultCount:t}){let{selection:n,toggleImpactBand:r,toggleType:i,toggleStage:a,clearAll:o}=Xt(),[s,c]=(0,V.useState)(``),[l,u]=(0,V.useState)(``),d=(0,V.useMemo)(()=>{let t=s.trim();return t?e.stages.filter(e=>String(e).includes(t)):e.stages},[e.stages,s]),f=(0,V.useMemo)(()=>{let t=l.trim().toLowerCase();return t?e.types.filter(e=>e.toLowerCase().includes(t)||gt(e).toLowerCase().includes(t)):e.types},[e.types,l]);if(e.impactBands.length===0&&e.types.length===0&&e.stages.length===0)return null;let p=!Bt(n),m=[...[...n.impactBands].map(e=>({key:`impact-${e}`,label:`impact ${e}`,onRemove:()=>r(e)})),...[...n.types].map(e=>({key:`type-${e}`,label:`type ${e}`,onRemove:()=>i(e)})),...[...n.stages].map(e=>({key:`stage-${e}`,label:`stage ${e}`,onRemove:()=>a(e)}))];return(0,H.jsxs)(`section`,{"aria-label":`Filter findings`,className:`flex flex-wrap items-center gap-x-3 gap-y-2 rounded-xl border border-border/60 p-2`,children:[(0,H.jsxs)(`span`,{title:`Narrow the whole dashboard to findings matching the chosen impact bands, types, or stages`,className:`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,children:[(0,H.jsx)(Nt,{"aria-hidden":`true`,className:`size-3.5`}),`Filter findings`]}),(0,H.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`text-xs text-muted-foreground`,children:p?`${t} finding${t===1?``:`s`} match${t===1?`es`:``} the active filters`:`Showing all ${t} finding${t===1?``:`s`}`}),(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),e.impactBands.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Impact`}),(0,H.jsx)(yt,{multiple:!0,"aria-label":`Filter by impact`,value:[...n.impactBands],onValueChange:e=>en(e,n.impactBands,r),children:e.impactBands.map(e=>(0,H.jsxs)(vt,{value:e,variant:`outline`,size:`sm`,"aria-label":`Filter by impact: ${e}`,className:M(`tap-target-comfortable gap-1.5`,$t[e]),children:[(0,H.jsx)(j,{impactBand:e}),e]},e))})]}),e.types.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),(0,H.jsxs)(tn,{label:`Type`,count:n.types.size,children:[(0,H.jsx)(`div`,{className:`p-1`,children:(0,H.jsx)(ae,{type:`text`,value:l,onChange:e=>u(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Search type…`,"aria-label":`Search types`,autoComplete:`off`,className:`h-8`})}),f.map(e=>(0,H.jsxs)(C,{checked:n.types.has(e),onCheckedChange:()=>i(e),"aria-label":`Filter by type: ${e}`,children:[(0,H.jsx)(`span`,{className:`rounded bg-muted px-1 text-xs font-medium text-foreground!`,children:gt(e)}),` `,e]},e)),f.length===0&&(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching type`})]})]}),e.stages.length>0&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),(0,H.jsxs)(tn,{label:`Stage`,count:n.stages.size,children:[(0,H.jsx)(`div`,{className:`p-1`,children:(0,H.jsx)(ae,{type:`text`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>e.stopPropagation(),placeholder:`Search stage id…`,"aria-label":`Search stages`,autoComplete:`off`,className:`h-8`})}),d.map(e=>(0,H.jsxs)(C,{checked:n.stages.has(e),onCheckedChange:()=>a(e),"aria-label":`Filter by stage: ${e}`,children:[`Stage `,e]},e)),d.length===0&&(0,H.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching stage`})]})]}),p&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Qt,{orientation:`vertical`,className:`h-6`}),(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[m.map(e=>(0,H.jsxs)(`button`,{type:`button`,onClick:e.onRemove,"aria-label":`Remove filter: ${e.label}`,className:`tap-target-comfortable inline-flex cursor-pointer items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs hover:bg-muted/70`,children:[e.label,` `,(0,H.jsx)(mt,{"aria-hidden":`true`,className:`size-3`})]},e.key)),(0,H.jsx)(`button`,{type:`button`,onClick:o,className:`tap-target-comfortable cursor-pointer text-xs underline`,children:`Clear all filters`})]})]})]})}function rn(e,t){let n=[];for(let{launch:t,finish:r}of e)r>t&&(n.push({t,delta:1}),n.push({t:r,delta:-1}));n.sort((e,t)=>e.t-t.t||e.delta-t.delta);let r=[],i=0;for(let e=0;e<n.length;e++){let a=n[e];i+=a.delta;let o=n[e+1];if(!o||o.t===a.t)continue;let s=t==null?i:Math.min(i,t);r.push({tStart:a.t,tEnd:o.t,busy:s})}return r}function an(e,{bucketBy:t=`time`,bucketWidthMs:n=1e3,hypotheticalCores:r=null}={}){let i=rn(e,r);if(t===`coreCount`){let e=[];for(let t of i)e[t.busy]=(e[t.busy]??0)+(t.tEnd-t.tStart);for(let t=0;t<e.length;t++)e[t]===void 0&&(e[t]=0);return{mode:`coreCount`,histogram:e}}if(i.length===0)return{mode:`time`,bucketWidthMs:n,startTime:null,endTime:null,buckets:[]};let a=i[0].tStart,o=i[i.length-1].tEnd,s=[];for(let e=a;e<o;e+=n){let t=e+n,r=0;for(let n of i){let i=Math.max(n.tStart,e),a=Math.min(n.tEnd,t);a>i&&(r+=n.busy*(a-i))}s.push({tStart:e,tEnd:t,busyCoreMs:r,avgBusyCores:r/n})}return{mode:`time`,bucketWidthMs:n,startTime:a,endTime:o,buckets:s}}var on=220;async function sn(e,t){let n=[...e.stages.keys()],r=await Promise.all(n.map(e=>t(e).catch(()=>null))),i=[],a=!1;for(let e of r){if(!e){a=!0;continue}let{metrics:t,fieldNames:n}=e,r=n.length,o=n.indexOf(`launchTime`),s=n.indexOf(`finishTime`);if(o!==-1&&s!==-1)for(let e=0;e<t.length;e+=r)i.push({launch:t[e+o],finish:t[e+s]})}return{intervals:i,incomplete:a}}function cn({appModel:e,getTaskData:t}){let{exportMode:n,getTaskData:r}=bt(t),[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),[d,m]=(0,V.useState)(!1),h=e.stages.size>0;if((0,V.useEffect)(()=>{if(!h||!d||i!==null||!r)return;let t=!1;return sn(e,r).then(({intervals:e,incomplete:n})=>{if(t)return;let{histogram:r}=an(e,{bucketBy:`coreCount`});a(r??[]),s(n)}),()=>{t=!0}},[e,r,h,d,i]),!h)return null;let g=(i??[]).map((e,t)=>({cores:String(t),coreCount:t,ms:e})),_=St(g),v=g.reduce((e,t)=>t.ms>e.ms?t:e,g[0]);return(0,H.jsx)(I,{title:`Core-Usage Distribution`,id:`core-usage-histogram`,open:d,onOpenChange:m,summary:i!==null&&v?(0,H.jsx)(B,{value:F(v.ms),context:`at ${v.coreCount} concurrent core${v.coreCount===1?``:`s`}`}):void 0,children:i===null?n?(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Core-usage detail isn’t included in exported reports.`}):(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading core usage…`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(k,{ariaLabel:`Wall-clock time spent at each concurrent-core count across the run. See the table below for exact values.`,height:on,table:{caption:`Wall-clock time by concurrent-core count`,columns:[`Concurrent cores`,`Time`],rows:i.map((e,t)=>[t,F(e)]),align:[`right`,`right`]},children:(0,H.jsxs)(l,{data:_,children:[(0,H.jsx)(c,{vertical:!1,stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`cores`,tick:{fontSize:10},label:{value:`Concurrent busy cores`,position:`insideBottom`,offset:-5,fontSize:10}}),(0,H.jsx)(f,{tick:{fontSize:10},width:48,tickFormatter:e=>F(e)}),(0,H.jsx)(u,{dataKey:`ms`,name:`Time`,fill:A.accent})]})}),o?(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Reopen this file to compute full core usage because some task data was released.`}):null,(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`See `,(0,H.jsx)(Ne,{anchor:`#bottleneck-utilization`,children:`how to read concurrent-core utilization`}),`.`]})]})})}function ln({app:e,stages:t,executorsAdded:n,runAggregates:r}){let i=Ye(e??{},n),a=(e?.endTime??0)-(e?.startTime??0),o=Be(e,t),s=a/36e5*i,c=i*((o.startup+o.gaps+o.idle)/36e5),l=i*o.stagesActive,u=r?.busyCoreMs??0,d=Math.max(0,l-u)/36e5,f=c+d,p=s>0?Math.round(f/s*100):null,m=0,h=r?.perStage??{};for(let e of Object.keys(h))m+=h[e].totalTaskDurationSum;let g=i>0?m/i:0,_=null;return(c>0||d>0)&&(_=c>=d?`driver`:`executor`),{availableComputeHours:s,driverWasteHours:c,executorWasteHours:d,wastagePct:p,floorZeroSkewMs:g,dominantWaste:_}}function un(e){let t=e?[...e.values()]:[],n=new Map,r=0;for(let e of t){if(e.submissionTime==null||e.completionTime==null)continue;let t=e.sqlExecutionId==null?`job:${e.id??r++}`:`sql:${e.sqlExecutionId}`,i=n.get(t);i?(i.start=Math.min(i.start,e.submissionTime),i.end=Math.max(i.end,e.completionTime)):n.set(t,{start:e.submissionTime,end:e.completionTime})}let i=[...n.entries()].sort((e,t)=>e[1].start-t[1].start),a=[];for(let e=1;e<i.length;e++)for(let t=0;t<e;t++){let[n,r]=i[t],[o,s]=i[e];s.start<r.end&&r.start<s.end&&a.push([n,o])}return{wallClockReliable:a.length===0,overlappingGroupIds:a}}var dn=`This estimate is derived from a simplified compute model; compare it against wall-clock data before acting on it.`,U=e=>`${Math.round(e*100)/100} core-h`;function fn(){return(0,H.jsx)(L,{children:(0,H.jsx)(O,{confidence:`low`,validationRequired:dn})})}function pn({appModel:e}){if(!e.runAggregates)return null;let t=ln({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});if(t.availableComputeHours<=0)return null;let n=un(e.jobs),r=null;return t.dominantWaste===`driver`?r=(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:`Driver-bound waste dominates.`}),` Review driver sizing (spark.driver.memory / spark.driver.cores) before scaling executors.`]}):t.dominantWaste===`executor`&&(r=(0,H.jsxs)(`p`,{children:[(0,H.jsx)(`strong`,{children:`Executor-bound waste dominates.`}),` Review executor count / cores by reducing cluster size or enabling dynamic allocation.`]})),(0,H.jsx)(I,{title:`Compute Efficiency`,statusBadge:(0,H.jsx)(fn,{}),defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:t.wastagePct==null?U(t.availableComputeHours):`${t.wastagePct}% wasted`,context:`of ${U(t.availableComputeHours)} available`}),children:(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[!n.wallClockReliable&&(0,H.jsx)(L,{children:(0,H.jsx)(`p`,{className:`text-muted-foreground`,children:`This run used concurrent job groups: the driver/executor split below is approximate, not precise.`})}),(0,H.jsxs)(`p`,{children:[`Available: `,(0,H.jsx)(`strong`,{children:U(t.availableComputeHours)}),t.wastagePct!=null&&(0,H.jsxs)(H.Fragment,{children:[` `,`· wasted `,(0,H.jsxs)(`strong`,{children:[t.wastagePct,`%`]})]})]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(j,{impactBand:`info`}),` Driver-bound waste: `,(0,H.jsx)(`strong`,{children:U(t.driverWasteHours)})]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(j,{impactBand:`info`}),` Executor-bound waste: `,(0,H.jsx)(`strong`,{children:U(t.executorWasteHours)})]}),(0,H.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Floor (same executors, zero skew): `,F(t.floorZeroSkewMs)]}),r]})})}function mn(e){let t={extract:0,transform:0,load:0};for(let n of e.values()){let e=Math.max(0,(n.completedAt??0)-(n.submittedAt??0));if(e===0)continue;let r=(n.shuffleReadBytes??0)>0||(n.shuffleWriteBytes??0)>0;(n.inputBytes??0)>0&&(n.shuffleReadBytes??0)===0&&(t.extract+=e),r&&(t.transform+=e),(n.outputBytes??0)>0&&(t.load+=e)}return t}var hn=[{label:`Extract`,key:`extract`},{label:`Transform`,key:`transform`},{label:`Load`,key:`load`}];function gn({appModel:e}){let t=mn(e.stages);if(t.extract+t.transform+t.load===0)return null;let n=hn.reduce((e,n)=>t[n.key]>t[e.key]?n:e);return(0,H.jsx)(I,{title:`ETL Phase Attribution`,defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:`${n.label} ${F(t[n.key])}`,context:`dominant phase`}),children:(0,H.jsxs)(`div`,{className:`space-y-1`,children:[hn.map(({label:e,key:n})=>(0,H.jsxs)(`div`,{children:[(0,H.jsx)(`strong`,{children:e}),`: `,F(t[n])]},n)),(0,H.jsx)(L,{children:(0,H.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Heuristic: a stage that both shuffles and writes counts in Transform and Load, so phases can overlap and need not sum to wall-clock.`})})]})})}var _n=220;function vn(e){let t=e.app,n=e.executors.added,r=e.executors.removed;if(t?.startTime==null||t?.endTime==null)return{times:[],counts:[]};let i=t.endTime-t.startTime,a=Math.max(5e3,Math.floor(i/100)),o=[],s=[],c=new Map(r.map(e=>[e.executorId,e.timestamp]));for(let e=t.startTime;e<=t.endTime;e+=a){let r=n.filter(t=>{let n=c.get(t.executorId)??1/0;return t.timestamp<=e&&e<n}).length;o.push(((e-t.startTime)/1e3).toFixed(0)+`s`),s.push(r)}return{times:o,counts:s}}var yn=(0,V.memo)(function({appModel:e,activeFileId:t}){let{chartData:n,sampled:r,hasSeries:i,peak:a}=(0,V.useMemo)(()=>{let{times:t,counts:n}=vn(e),r=t.map((e,t)=>({label:e,count:n[t]})),i=St(r),a=n.length>0;return{chartData:r,sampled:i,hasSeries:a,peak:a?Math.max(...n):0}},[e,t]);return i?(0,H.jsx)(I,{title:`Executor Count Over Time`,summary:(0,H.jsx)(B,{value:`${a} peak`,context:`concurrent executors`}),children:(0,H.jsx)(k,{ariaLabel:`Executor count over time. See the table below for exact values.`,height:_n,table:{caption:`Executor timeline: active executor count over time`,columns:[`Time`,`Active executors`],rows:n.map(e=>[e.label,e.count]),align:[`left`,`right`]},children:(0,H.jsxs)(d,{data:r,children:[(0,H.jsx)(c,{vertical:!1,stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`label`,tick:{fontSize:10},minTickGap:24}),(0,H.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,H.jsx)(h,{formatter:e=>[`${e} executor${e===1?``:`s`} active`,``],labelFormatter:()=>``}),(0,H.jsx)(m,{type:`monotone`,dataKey:`count`,name:`Active executors`,stroke:A.clean,fill:A.clean,fillOpacity:.15})]})})}):(0,H.jsx)(I,{title:`Executor Count Over Time`,summary:(0,H.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Timeline unavailable: no end time recorded.`}),children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This run has no ApplicationEnd event, so the executor timeline can't be plotted without fabricating an end time. See the Incomplete Run finding for what's still reliable.`})})}),bn=[10,20,50,80,100,110,120,150,200,300,400,500];function xn(e,t,n){return t<=0||n<=0?0:e/Math.min(n,t)}function Sn(e,t){let n=0;for(let r of Object.keys(e)){let{totalTaskDurationSum:i,taskCount:a}=e[r];n+=xn(i,a,t)}return n}function Cn({app:e,stages:t,runAggregates:n,executorsAdded:r}){let i=n?.perStage??{},a=Ye(e??{},r),o=Be(e,t).stagesActive,s=a>0?Sn(i,a):0,c=o>0?Math.round(Math.abs(s-o)/o*100):null,l=s>0?o/s:1;return{baselineCores:a,testPercentages:bn,predictions:bn.map(e=>{let t=Math.max(1,Math.round(a*e/100));return{pct:e,cores:t,estMakespanMs:Math.round(Sn(i,t)*l)}}),modelErrorPct:c}}var wn=`What-If Executor Scaling`,Tn=220,En=20;function Dn([e,t]){let n=(t-e)*.1;return[Math.max(0,e-n),t+n]}function On(e){return[...e.stages.values()].some(e=>{let t=e.submittedAt,n=e.completedAt;return typeof t==`number`&&Number.isFinite(t)&&typeof n==`number`&&Number.isFinite(n)&&n>t})}function kn(e){return e.evidenceAvailability?.entries.find(e=>e.key===`taskCoreTime`)}function An({reason:e,evidence:t}){return(0,H.jsx)(I,{title:wn,summary:(0,H.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e]}),children:(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e,` `,(0,H.jsx)(O,{evidenceKey:t})]})})}function jn({appModel:e}){let t=kn(e);if(!ze(e.runAggregates)||t!=null&&t.state!==`present`)return(0,H.jsx)(An,{reason:t?.summary??`No usable task and core-time evidence in this log.`,evidence:`taskCoreTime`});let n=Cn({app:e.app,stages:e.stages,runAggregates:e.runAggregates,executorsAdded:e.executors.added});if(n.baselineCores<=0)return(0,H.jsx)(An,{reason:`Baseline executor/core capacity is unavailable in this log.`});if(!On(e))return(0,H.jsx)(An,{reason:`Usable stage timing is unavailable in this log.`});let r=un(e.jobs),i=n.modelErrorPct!=null&&n.modelErrorPct>=En,a=St(n.predictions),l=n.predictions.reduce((e,t)=>t.estMakespanMs<e.estMakespanMs?t:e);return(0,H.jsx)(I,{title:wn,defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:F(l.estMakespanMs),context:`best case at ${l.pct}% executors`}),children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(L,{children:(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Model Error:`,` `,(0,H.jsx)(`strong`,{className:i?`text-warning`:void 0,children:n.modelErrorPct==null?`—`:`${n.modelErrorPct}%`}),` `,`(idealized makespan vs. observed); higher means all estimates below carry more error, since a single log only observes one scale.`]})}),(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Move along this curve by changing `,(0,H.jsx)(`code`,{children:`spark.dynamicAllocation`}),`’s executor bounds, see the `,(0,H.jsx)(Ne,{anchor:`#config-autoscale-bounds`,children:`autoscaling config guide`}),`.`]}),r.wallClockReliable?null:(0,H.jsx)(L,{children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`This run used concurrent job groups, so the wall-clock-based estimates below may be unreliable.`})}),(0,H.jsx)(L,{children:(0,H.jsx)(`p`,{className:`text-xs`,children:(0,H.jsx)(O,{evidenceKey:`taskCoreTime`})})}),(0,H.jsx)(k,{ariaLabel:`Estimated makespan by executor percentage: diminishing-returns curve.`,height:Tn,table:{caption:`Estimated makespan by executor percentage`,columns:[`% Executors`,`Cores`,`Est. makespan`],rows:n.predictions.map(e=>[`${e.pct}%`,e.cores,F(e.estMakespanMs)]),align:[`right`,`right`,`right`]},children:(0,H.jsxs)(o,{data:a,children:[(0,H.jsx)(c,{stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`pct`,tickFormatter:e=>`${e}%`,tick:{fontSize:10}}),(0,H.jsx)(f,{domain:Dn,tickFormatter:e=>F(e),tick:{fontSize:10},width:56}),(0,H.jsx)(h,{formatter:e=>[F(Number(e)),`Est. makespan`],labelFormatter:e=>`${e}% executors`}),(0,H.jsx)(s,{type:`monotone`,dataKey:`estMakespanMs`,name:`Est. makespan`,stroke:A.accent,dot:{r:3}})]})})]})})}function Mn(e){return typeof e?.startTime==`number`&&Number.isFinite(e.startTime)&&typeof e?.endTime==`number`&&Number.isFinite(e.endTime)&&e.endTime>e.startTime}function Nn(e){if(!Mn(e.app))return{efficiency:{value:null,unavailableReason:`application-timing`},wastage:{value:null,unavailableReason:`application-timing`}};let t=Be(e.app,e.stages),n=Math.min(100,Math.round(t.stagesActive/t.total*100));if(!e.runAggregates)return{efficiency:{value:n,unavailableReason:null},wastage:{value:null,unavailableReason:`core-usage-summary`}};let r=ln({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});return!Number.isFinite(r.availableComputeHours)||r.availableComputeHours<=0?{efficiency:{value:n,unavailableReason:null},wastage:{value:null,unavailableReason:`executor-capacity`}}:{efficiency:{value:n,unavailableReason:null},wastage:{value:r.wastagePct,unavailableReason:null}}}var Pn={critical:`inset 4px 0 0 var(--color-critical)`,warning:`inset 4px 0 0 var(--color-warning)`};function Fn({eyebrow:e,value:t,meta:n,flag:r=null,bar:i,dataTestid:a}){return(0,H.jsxs)(`div`,{"data-testid":a,className:`flex flex-col gap-1 p-3`,style:r?{boxShadow:Pn[r]}:void 0,children:[(0,H.jsxs)(`span`,{className:M(`flex items-center gap-1.5 text-xs font-medium text-muted-foreground`,r&&Ie[r]),children:[r&&(0,H.jsx)(j,{impactBand:r}),e]}),(0,H.jsx)(`div`,{className:M(`font-heading text-2xl font-semibold`,r&&Ie[r]),children:t}),(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n}),i]})}function In({pct:e,flag:t,label:n}){let r=Math.max(0,Math.min(100,e));return(0,H.jsx)(`div`,{role:`img`,"aria-label":n,className:`mt-0.5 h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:(0,H.jsx)(`div`,{className:M(`h-full rounded-full`,t?Je[t]:`bg-clean`),style:{width:`${r}%`}})})}function Ln({active:e,total:t}){let n=t>0?Math.max(0,Math.min(100,e/t*100)):0;return(0,H.jsxs)(`div`,{role:`img`,"aria-label":`Active ${F(e)} of ${F(t)} total`,className:`mt-0.5 flex h-1.5 w-full overflow-hidden rounded-full bg-muted`,children:[(0,H.jsx)(`div`,{className:`h-full bg-clean`,style:{width:`${n}%`}}),(0,H.jsx)(`div`,{className:`h-full flex-1 bg-muted-foreground/60`})]})}function Rn(e){return e>0?`Ran ${F(e)}`:`No stage activity recorded`}function zn(){return(0,H.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl border border-warning/40 bg-warning/10 p-4`,children:[(0,H.jsx)(j,{impactBand:`warning`,className:`mt-1.5`}),(0,H.jsxs)(`p`,{className:`text-sm text-warning`,children:[(0,H.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Timing unavailable`}),`. This run has no complete application timing interval, so wall-clock, efficiency, and wastage can’t be measured.`]})]})}function Bn({appModel:e,catalog:t}){let n=Re(),{app:r,stages:i}=e;if(!Mn(r))return(0,H.jsx)(zn,{});let a=Be(r,i),o=Nn(e),s=a.total,c=o.efficiency.value,l=c==null?null:c<75?`critical`:c<90?`warning`:null,u=t.find(e=>e.type===`coldStart`),d=o.wastage.value,f=d==null?null:d>=70?`critical`:d>=40?`warning`:null;return(0,H.jsx)(lt,{className:`overflow-hidden py-0`,children:(0,H.jsxs)(`div`,{className:`grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0`,children:[(0,H.jsx)(Fn,{eyebrow:`Wall-clock`,dataTestid:`kpi-wall-clock`,value:s>0?F(s):`—`,meta:(0,H.jsxs)(H.Fragment,{children:[Rn(a.stagesActive),u?` · ${u.value}s cold start`:``]}),bar:(0,H.jsx)(Ln,{active:a.stagesActive,total:s})}),(0,H.jsx)(Fn,{eyebrow:`Efficiency`,dataTestid:`kpi-efficiency`,value:c==null?`Unavailable`:(0,H.jsxs)(H.Fragment,{children:[c,(0,H.jsx)(`small`,{children:`%`})]}),flag:l,meta:c==null?`This run has no complete application timing interval.`:s>a.stagesActive?`${Rn(a.stagesActive)} · ${F(s-a.stagesActive)} idle/gap time`:`executors active the whole run`,bar:c==null?void 0:(0,H.jsx)(In,{pct:c,flag:l,label:`Efficiency ${c}%`})}),(0,H.jsx)(Fn,{eyebrow:`Wastage`,dataTestid:`kpi-wastage`,value:d==null?`Unavailable`:(0,H.jsxs)(H.Fragment,{children:[d,(0,H.jsx)(`small`,{children:`%`})]}),flag:f,meta:o.wastage.unavailableReason===`application-timing`?`Wastage needs complete application timing.`:o.wastage.unavailableReason===`core-usage-summary`?`Wastage needs the core-usage summary.`:o.wastage.unavailableReason===`executor-capacity`?`Wastage needs usable executor-capacity data.`:n===`advanced`?`Driver-idle + executor-slack core-hours as a share of available capacity. Directional, not a cost figure.`:`Executor capacity that sat idle. Not a cost figure.`,bar:d==null?void 0:(0,H.jsx)(In,{pct:d,flag:f,label:`Wastage ${d}%`})})]})})}function Vn({className:e,...t}){return(0,H.jsx)(g,{"data-slot":`accordion`,className:M(`flex w-full flex-col`,e),...t})}function Hn({className:e,...t}){return(0,H.jsx)(x,{"data-slot":`accordion-item`,className:M(`not-last:border-b`,e),...t})}function Un({className:e,children:t,headingLevel:n=3,...r}){let i=`h${n}`;return(0,H.jsx)(y,{className:`flex`,render:(0,H.jsx)(i,{}),children:(0,H.jsxs)(_,{"data-slot":`accordion-trigger`,className:M(`group/accordion-trigger relative flex flex-1 cursor-pointer items-start justify-between rounded-lg border border-transparent py-2.5 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:after:border-ring aria-disabled:pointer-events-none aria-disabled:cursor-default aria-disabled:opacity-50 **:data-[slot=accordion-trigger-icon]:ml-auto **:data-[slot=accordion-trigger-icon]:size-4 **:data-[slot=accordion-trigger-icon]:text-muted-foreground`,e),...r,children:[t,(0,H.jsx)(rt,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),(0,H.jsx)(Ge,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function Wn({className:e,children:t,...n}){return(0,H.jsx)(v,{"data-slot":`accordion-content`,className:`h-(--accordion-panel-height) overflow-hidden text-sm transition-[height] duration-150 ease-out data-ending-style:h-0 data-starting-style:h-0 motion-reduce:transition-none`,...n,children:(0,H.jsx)(`div`,{className:M(`pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),children:t})})}function Gn(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Kn({type:e,label:t,thresholdSummary:n}){return(0,H.jsxs)(P,{"data-testid":`clean-check-row`,"data-clean-check-type":e,children:[(0,H.jsx)(N,{className:`w-px`,children:(0,H.jsxs)(`span`,{className:`inline-flex h-6 items-center gap-1 rounded-full bg-clean/10 px-2 font-mono text-xs font-medium whitespace-nowrap text-clean`,children:[(0,H.jsx)(Fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),gt(e)]})}),(0,H.jsxs)(N,{className:`whitespace-normal`,children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:Gn(t)}),(0,H.jsx)(L,{children:(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:Gn(`${n}.`)})})]})]})}var qn=`suggested-improvements`,Jn={skew:`per-stage`,stageShape:`per-stage`,tinyTask:`per-stage`,shuffle:`per-stage`,partitionSizing:`per-stage`,spill:`per-stage`,gc:`per-stage`,stageFailed:`per-stage`,failures:`per-stage`,retryWaste:`per-stage`,slowHost:`per-stage`,stageSlowness:`per-stage`,straggler:`per-stage`,speculationWaste:`per-stage`,incompleteRun:`app-level`,coldStart:`app-level`,memoryUtilization:`app-level`,utilization:`app-level`,coreLocality:`app-level`,cachingOpportunity:`app-level`,cacheUtilization:`app-level`,jobFailureRate:`app-level`,autoscalingChurn:`app-level`,duplicatePlanSubtree:`sql-scope`,smallFiles:`sql-scope`,underBroadcast:`sql-scope`,overBroadcast:`sql-scope`,configAudit:`config-scope`},Yn=[`per-stage`,`app-level`,`sql-scope`,`config-scope`],Xn={"per-stage":`Per-stage checks`,"app-level":`App-level checks`,"sql-scope":`SQL plan checks`,"config-scope":`Config checks`};function Zn(e,t){let n=[...e,...t].filter(de);return me().filter(({type:e})=>!he(e)).map(({component:e,widgetId:t,type:r},i)=>{let a=n.filter(e=>e.type===r);return{component:e,widgetId:t,index:i,findings:a,impactBand:Ze(a)}}).filter(e=>e.impactBand!==void 0).sort((e,t)=>ct[e.impactBand]-ct[t.impactBand]||e.index-t.index)}function Qn({appModel:e,catalog:t,configFindings:n=[],getTaskData:r,activeFileId:i}){let a=[...t,...n].filter(de),o=Object.keys(Ce).filter(e=>!he(e)).filter(e=>!a.some(t=>t.type===e)).map(e=>({type:e,findingLabel:Ce[e].findingLabel})),s=new Map;for(let e of o){let t=Jn[e.type]??`app-level`;s.has(t)||s.set(t,[]),s.get(t).push(e)}let c=be();return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(st,{children:c.map(({component:a,widgetId:o})=>(0,H.jsx)(R,{cardId:`reference-${o}`,widgetId:o,children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Xe,{}),children:(0,H.jsx)(a,{appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,defaultCollapsed:!0})})},o))}),(0,H.jsx)(Vn,{children:(0,H.jsxs)(Hn,{value:`clean-checks`,children:[(0,H.jsx)(Un,{children:`Clean checks`}),(0,H.jsxs)(Wn,{children:[(0,H.jsxs)(`p`,{className:`pb-2 text-xs text-muted-foreground`,children:[`Every check below passed. No fix needed.`,(0,H.jsx)(L,{children:` Each line's caption states the threshold it was measured against.`})]}),Yn.map(e=>{let t=s.get(e);return!t||t.length===0?null:(0,H.jsxs)(`div`,{className:`pt-3 first:pt-0`,children:[(0,H.jsx)(`p`,{className:`pb-1 text-xs font-medium text-muted-foreground`,children:Xn[e]}),(0,H.jsx)(it,{children:(0,H.jsx)(tt,{children:t.map(({type:e,findingLabel:t})=>(0,H.jsx)(Kn,{type:e,label:t,thresholdSummary:le(e)},e))})})]},e)})]})]})})]})}function $n(e){switch(e.type){case`skew`:return`For join-driven skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key to reduce task skew.`;case`stageShape`:switch(e.rule){case`lowParallelism`:return`Too few tasks run relative to the cores available, leaving cluster capacity idle: repartition to use more of it.`;case`dataExplosion`:return`Output volume far exceeds input volume: check for an exploding join or a cross product.`;case`taskStageSkew`:return`A single straggler task gates the whole stage's wall-clock duration.`}break;case`shuffle`:return`Consider increasing spark.sql.shuffle.partitions or adding a broadcast join to shrink the shuffle.`;case`partitionSizing`:switch(e.rule){case`shufflePartitionSkew`:return`For join skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key.`;case`lowShuffleParallelism`:return`Raise spark.sql.shuffle.partitions so each partition is smaller.`;case`maxPartitionTooBig`:return`Repartition to break up the oversized partition before this stage.`}break;case`spill`:return`If the spill is skew-driven, fix task skew first: adding memory will not help. Otherwise raise spark.sql.shuffle.partitions or increase executor memory.`;case`gc`:return e.direction===`low`?`Memory may be over-provisioned here: consider reducing spark.executor.memory for cost savings.`:`Reduce object creation, use primitive types, avoid UDFs, or increase executor memory to cut GC time.`;case`slowHost`:return e.variant===`durationShare`?`Check for data locality or partition assignment skewing work onto one node.`:e.variant===`multiDim`?`Investigate uneven partition assignment or a degraded executor.`:`Check what this host was running: it may just hold data locality for its tasks or carry one heavy stage, rather than a hardware fault. Enable spark.speculation to relaunch a lagging task automatically.`;case`stageSlowness`:return`Often a partition-count problem: raise parallelism via spark.sql.shuffle.partitions or spark.default.parallelism, or check for a large per-task data volume driving heavy shuffle and spill.`;case`stageFailed`:return`Inspect the driver log for the failure reason and the job that triggered it.`;case`failures`:return`Investigate driver logs for executor instability or data-driven errors.`;case`straggler`:return`Rule out a GC pause or a slow shuffle fetch before assuming a hardware issue. If a skewed key is the real cause, that is a candidate for AQE's skew-join handling.`;case`speculationWaste`:return`If task durations are naturally variable rather than genuine stragglers, consider tuning spark.speculation.multiplier/quantile.`;case`retryWaste`:return`Investigate executor loss or fetch failures behind the retried attempts.`;case`tinyTask`:return`Scheduler overhead may dominate: lower spark.sql.shuffle.partitions, or coalesce down to fewer, larger tasks.`;case`coldStart`:return`Keep a warm pool of idle executors, or if using dynamic allocation, raise the minimum/initial executor count so it does not scale up from zero.`;case`utilization`:return`Consider reducing cluster size or enabling dynamic allocation.`;case`memoryUtilization`:switch(e.variant){case`idleCores`:return`Reduce cluster size or enable dynamic allocation.`;case`wasteModel`:return`Review spark.executor.memory and executor count.`;case`memoryBand`:if(e.dataUnavailable)break;return e.rule===`heapNearCapacity`?`Memory may be too small: raise spark.executor.memory to avoid OOM/spill.`:`Memory may be over-provisioned: consider reducing spark.executor.memory for cost savings.`}break;case`cacheUtilization`:switch(e.variant){case`partialCache`:return`Increase executor memory or reduce the cached dataset size so more of it stays cached.`;case`diskSpillover`:return`Executor memory may be too small for this cached dataset: increase executor memory or reduce its size.`}break;case`coreLocality`:return`Check spark.locality.wait settings and executor/data colocation.`;case`autoscalingChurn`:return`This looks like wasteful re-provisioning rather than normal scale-down: consider raising spark.dynamicAllocation.executorIdleTimeout or widening the minExecutors/maxExecutors bounds to reduce flapping.`;case`cachingOpportunity`:return e.variant===`composite`?`Cache or persist the repeated join/union result so it is computed once instead of recomputed per query.`:`Cache the shared DataFrame, or broadcast it if it is a small join lookup.`;case`jobFailureRate`:return`Inspect the driver log for the failed job(s) and the stage failures that triggered them.`;case`configAudit`:switch(e.property){case`spark.shuffle.service.enabled`:return`Set spark.shuffle.service.enabled=true so shuffle data survives executor removal.`;case`spark.dynamicAllocation.minExecutors`:return`Set the minimum executor bound at or below the maximum.`;case`spark.dynamicAllocation.maxExecutors`:return`Set spark.dynamicAllocation.maxExecutors to cap cluster growth.`;case`spark.serializer`:return`Consider spark.serializer=org.apache.spark.serializer.KryoSerializer for faster, smaller buffers.`;case`spark.executor.memoryOverhead`:return`Raise executor memoryOverhead above Spark's default floor to avoid off-heap OOM-kills.`}break;case`duplicatePlanSubtree`:return`Check whether the repeated subtree could be computed once and reused, or cache/persist the shared computation.`;case`smallFiles`:return e.direction===`write`?`Repartition or coalesce before writing to raise the average file size.`:`Compact the upstream output so fewer, larger files are produced.`;case`underBroadcast`:return`This could have been a broadcast join: consider a broadcast() hint or raising spark.sql.autoBroadcastJoinThreshold.`;case`overBroadcast`:return`Check for a misapplied broadcast hint or a misconfigured spark.sql.autoBroadcastJoinThreshold.`}}function er(e){let t=Ce[e.type],n=typeof e.recommendation==`string`?e.recommendation.trim():``;return!t?.routeable||!n?null:{finding:e,widgetId:t.widgetId,region:t.region,findingLabel:t.findingLabel,stageId:typeof e.stageId==`number`?e.stageId:null,recommendation:n}}function tr(e,t){return t.includes(e)?er(e):null}function nr(e){return e.impactEstimate?.wallClock?.high??null}function rr(e){let t=new Map(me().map((e,t)=>[e.widgetId,t])),n=e.map((e,t)=>({target:er(e),catalogIndex:t})).filter(e=>e.target!==null);return n.sort((e,n)=>{let r=nr(e.target.finding),i=nr(n.target.finding);return r!==null&&i!==null&&r!==i?i-r:r!==null==(i!==null)?(t.get(e.target.widgetId)??2**53-1)-(t.get(n.target.widgetId)??2**53-1)||e.catalogIndex-n.catalogIndex:r===null?1:-1}),n[0]?.target??null}var ir=10;function ar(e){return Ae(e)&&Ce[e.type]!=null}function or(e){return ke(e.findings)[0].impactBand}function sr(e){let t=e.impactEstimate;return t?t.wallClock?Tt(t.wallClock.low,t.wallClock.high):t.rawWaste?Dt(t.rawWaste):null:null}function cr(e){let t=e.stageId==null?e.stageIds&&e.stageIds.length>0?`St.${at(e.stageIds)}`:null:`St.${e.stageId}`;if(e.type===`duplicatePlanSubtree`&&e.rootName!=null){let n=lr(e);return t&&n?`${t} · ${n}`:n??t}return t||(e.property?String(e.property):null)}function lr(e){if(e.type!==`duplicatePlanSubtree`||e.rootName==null)return null;let t=et(e.rootName),n=e.groupIndex==null?t:`${t} #${Number(e.groupIndex)+1}`;return e.executionId==null?n:`${n} (SQL ${e.executionId})`}function ur({finding:e,textClassName:t,visibleLimit:n,stackIdentity:r,stagePillClassName:i}){let{stageId:a,stageIds:o}=e;if(a!=null)return(0,H.jsx)(wt,{stageId:a});if(o&&o.length>0){let a=lr(e),s=a?(0,H.jsx)(`span`,{className:M(`truncate`,t),title:a,children:a}):null,c=(0,H.jsx)(Ct,{pills:o.map(e=>({id:e})),visibleLimit:n,pillOverrideClassName:r?i:void 0});return(0,H.jsx)(`span`,{className:M(`inline-flex min-w-0 items-center gap-1.5`,r?`flex-col`:`flex-wrap`),children:r?(0,H.jsxs)(H.Fragment,{children:[s,c]}):(0,H.jsxs)(H.Fragment,{children:[c,s]})})}let s=cr(e);return s?(0,H.jsx)(`span`,{className:M(`min-w-0 truncate`,t),title:s,children:s}):null}function dr(e){return(typeof e.recommendation==`string`?e.recommendation.trim():``)||(Ce[e.type]?.findingLabel??e.type)}function fr({finding:e,allFindings:t,onRoute:n}){let r=tr(e,t),i=cr(e),a=sr(e),o=dr(e),s=pe(e);return(0,H.jsxs)(P,{"data-testid":`fix-these-first-row`,"data-finding-type":e.type,children:[(0,H.jsx)(N,{className:`w-px`,children:(0,H.jsx)(We,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor})}),(0,H.jsx)(N,{className:`whitespace-normal`,children:(0,H.jsxs)(`button`,{type:`button`,className:`cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:()=>r&&n(r),children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium`,children:s}),(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:o})]})}),(0,H.jsx)(N,{className:`w-px text-right font-mono text-xs text-muted-foreground`,title:[i,a].filter(Boolean).join(` · `),children:(0,H.jsxs)(`span`,{className:`flex items-center justify-end gap-1.5`,children:[(0,H.jsx)(ur,{finding:e}),a?(0,H.jsx)(`span`,{className:`shrink-0`,children:a}):null]})})]})}function pr({finding:e,allFindings:t,onRoute:n,id:r}){let i=tr(e,t),a=cr(e),o=sr(e),s=dr(e),c=pe(e),l=e.stageId!=null||a!=null;return(0,H.jsxs)(P,{id:r,"data-testid":`fix-these-first-row`,"data-finding-type":e.type,className:`bg-muted/50`,children:[(0,H.jsxs)(N,{colSpan:2,className:`whitespace-normal`,children:[l?(0,H.jsx)(`div`,{className:`mb-1`,children:(0,H.jsx)(ur,{finding:e,textClassName:`line-clamp-1 break-words text-xs font-medium font-mono`})}):null,(0,H.jsxs)(`button`,{type:`button`,className:`block w-full cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:()=>i&&n(i),children:[l?null:(0,H.jsx)(`span`,{className:`line-clamp-1 break-words text-xs font-medium`,children:c}),(0,H.jsx)(`span`,{className:`line-clamp-1 break-words text-xs text-muted-foreground`,children:s})]})]}),(0,H.jsx)(N,{className:`w-px text-right font-mono text-xs text-muted-foreground`,children:o})]})}function mr(e){return e.kind===`time`?`×${e.findingCount} · ${Tt(e.recoverableMsHigh,e.recoverableMsHigh)} recoverable`:e.kind===`resource`?`×${e.findingCount} · resource-cost projection`:Object.entries(e.byImpactBand).map(([e,t])=>`${t} ${e}`).join(`, `)}function hr(e){return e.kind===`time`?`${e.findingCount} findings of this type; up to ${Tt(e.recoverableMsHigh,e.recoverableMsHigh)} of run time could be recovered by fixing them`:e.kind===`resource`?`${e.findingCount} findings of this type; a resource-cost estimate (not run time) is projected for fixing them`:`${e.findingCount} findings of this type, by impact`}function gr({group:e,allFindings:t,expanded:n,onToggle:r,onRoute:i}){let[a,o]=(0,V.useState)(0),s=ke(e.findings),c=s[0],l=$n(c),u=pe(c),d=Math.ceil(s.length/ir),f=Math.min(a,Math.max(0,d-1)),p=s.slice(f*ir,f*ir+ir),m=`fix-these-first-group-content-${e.kind}-${e.type}${`unit`in e?`-${e.unit}`:``}`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(P,{"data-testid":`fix-these-first-group-row`,"data-finding-type":e.type,children:[(0,H.jsx)(N,{className:`w-px`,children:(0,H.jsx)(We,{type:e.type,impactBand:c.impactBand,docAnchor:He(e.findings)})}),(0,H.jsx)(N,{className:`whitespace-normal`,children:(0,H.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":m,className:`cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:r,children:[(0,H.jsx)(`span`,{className:`block text-sm font-medium`,children:u}),l?(0,H.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:l}):null]})}),(0,H.jsx)(N,{className:`w-px text-right font-mono text-xs text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1.5`,title:hr(e),children:[mr(e),n?(0,H.jsx)(Ge,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,H.jsx)(rt,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]})})]}),n&&p.map((e,n)=>(0,H.jsx)(pr,{finding:e,allFindings:t,onRoute:i,id:n===0?m:void 0},e.id)),n&&d>1&&(0,H.jsx)(P,{className:`bg-muted/50`,children:(0,H.jsx)(N,{colSpan:3,children:(0,H.jsx)(kt,{page:f,totalPages:d,onPrev:()=>o(e=>e-1),onNext:()=>o(e=>e+1)})})})]})}function _r({target:e,onRoute:t}){let n=cr(e.finding),r=sr(e.finding),i=e.finding.stageId!=null||n!=null,[a,o]=(0,V.useState)(!1),s=async()=>{let t=`${pe(e.finding)} — ${dr(e.finding)}`,n=[/[.!?]$/.test(t)?t:`${t}.`,r?`Potential savings: ${r}`:null].filter(Boolean).join(` `);try{await T(n),o(!0),setTimeout(()=>o(!1),1500)}catch{}};return(0,H.jsxs)(`div`,{className:`mb-3 flex flex-col gap-2 rounded-lg border border-primary/40 bg-primary/5 transition-colors hover:bg-primary/10`,children:[(0,H.jsxs)(`button`,{type:`button`,"aria-label":`${pe(e.finding)}, ${dr(e.finding)}`,onClick:()=>t(e),className:`flex cursor-pointer flex-col gap-2 rounded-lg px-4 py-3 text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:flex-row sm:items-start sm:justify-between sm:gap-4`,children:[(0,H.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-xs font-semibold tracking-wide text-primary uppercase`,children:[(0,H.jsx)(Lt,{"aria-hidden":`true`,className:`size-3.5`}),`Highest impact`]}),(0,H.jsxs)(`p`,{className:`mt-2 min-w-0`,children:[(0,H.jsx)(`span`,{className:`text-sm font-semibold`,children:pe(e.finding)}),(0,H.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[`, `,dr(e.finding)]})]})]}),r?(0,H.jsxs)(`div`,{className:`min-w-0 sm:shrink-0 sm:text-right`,children:[(0,H.jsx)(`p`,{className:`text-[11px] uppercase tracking-wide text-muted-foreground`,children:`Potential savings`}),(0,H.jsx)(`p`,{className:`whitespace-nowrap font-mono text-lg font-semibold leading-tight tabular-nums text-primary`,children:r})]}):null]}),(0,H.jsxs)(`div`,{className:M(`flex items-center gap-3 px-4 pb-3`,i?`justify-between`:`justify-end`),children:[i?(0,H.jsx)(ur,{finding:e.finding,textClassName:`line-clamp-2 max-w-[140px] break-words text-xs font-semibold text-muted-foreground`,visibleLimit:2,stackIdentity:!0,stagePillClassName:`h-5 px-1.5 text-[10px] font-normal`}):null,(0,H.jsx)(`button`,{type:`button`,"data-testid":`copy-finding-button`,onClick:()=>void s(),className:`inline-flex shrink-0 cursor-pointer items-center gap-1 rounded text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ne,{"aria-hidden":`true`,className:`size-3.5`}),`Copied`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(jt,{"aria-hidden":`true`,className:`size-3.5`}),`Copy finding`]})})]})]})}function vr(e,t,n){let r=[...e,...t].filter(ar);return{eligible:r,groups:Oe(r,n),triageTarget:rr(r)}}var yr={critical:`Critical`,warning:`Warning`,info:`Info`},br=[`critical`,`warning`,`info`];function xr(e){return`${e.kind}-${e.type}-${`unit`in e?e.unit:``}`}function Sr({impactBand:e,groups:t,widgets:n,allFindings:r,expandedGroupKey:i,onToggleGroup:a,onRoute:o,appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d}){if(t.length===0&&n.length===0)return null;let f=`impact-band-${e}-heading`;return(0,H.jsxs)(`section`,{"aria-labelledby":f,className:`space-y-3`,children:[(0,H.jsx)(`h2`,{id:f,className:`font-heading text-base font-semibold`,children:yr[e]}),t.length>0&&(0,H.jsx)(it,{children:(0,H.jsx)(tt,{children:t.map(e=>{if(e.findingCount===1)return(0,H.jsx)(fr,{finding:e.findings[0],allFindings:r,onRoute:o},e.findings[0].id);let t=xr(e);return(0,H.jsx)(gr,{group:e,allFindings:r,expanded:i===t,onToggle:()=>a(t),onRoute:o},t)})})}),n.length>0&&(0,H.jsx)(st,{children:n.map(({component:e,widgetId:t,index:n})=>(0,H.jsx)(R,{cardId:`alert-${n}`,widgetId:t,children:(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(Xe,{}),children:(0,H.jsx)(e,{appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d,defaultCollapsed:!0})})},t))})]})}function Cr({appModel:e,catalog:t,configFindings:n=[],stages:r,getTaskData:i,activeFileId:a,onRoute:o}){let{eligible:s,groups:c,triageTarget:l}=(0,V.useMemo)(()=>vr(t,n,r),[t,n,r]),u=[...t,...n],d=(0,V.useMemo)(()=>Zn(t,n),[t,n]),[f,p]=(0,V.useState)(null),{groupsByImpactBand:m,widgetsByImpactBand:h}=(0,V.useMemo)(()=>{let e=new Map;for(let t of c){let n=or(t);e.has(n)||e.set(n,[]),e.get(n).push(t)}let t=new Map;for(let e of d)t.has(e.impactBand)||t.set(e.impactBand,[]),t.get(e.impactBand).push(e);return{groupsByImpactBand:e,widgetsByImpactBand:t}},[c,d]);return(0,H.jsxs)(`div`,{id:qn,className:`space-y-6 scroll-mt-20`,children:[l?(0,H.jsx)(_r,{target:l,onRoute:o}):null,s.length===0?(0,H.jsx)(_t,{tone:`clean`,icon:Fe,title:`No findings to fix right now.`}):null,br.map(r=>(0,H.jsx)(Sr,{impactBand:r,groups:m.get(r)??[],widgets:h.get(r)??[],allFindings:u,expandedGroupKey:f,onToggleGroup:e=>p(t=>t===e?null:e),onRoute:o,appModel:e,catalog:t,configFindings:n,getTaskData:i,activeFileId:a},r)),(0,H.jsx)(Qn,{appModel:e,catalog:t,configFindings:n,getTaskData:i,activeFileId:a})]})}var wr=[`PROCESS_LOCAL`,`NODE_LOCAL`,`RACK_LOCAL`,`NO_PREF`,`ANY`],Tr=[A.clean,A.accent,A.warning,A.muted,A.critical];function Er(e){return e?new Date(e).toLocaleString():`—`}function Dr({stats:e}){let t=new Map(e.map(e=>[e.locality,e.count])),n=wr.filter(e=>t.has(e));for(let t of e)wr.includes(t.locality)||n.push(t.locality);let r=n.map((e,n)=>({locality:e,count:t.get(e)??0,color:Tr[Math.min(n,Tr.length-1)]}));return(0,H.jsx)(k,{ariaLabel:`Task locality distribution`,height:140,table:{caption:`Task locality distribution`,columns:[`Locality tier`,`Task count`],rows:r.map(e=>[e.locality,e.count]),align:[`left`,`right`]},children:(0,H.jsxs)(l,{data:r,children:[(0,H.jsx)(c,{vertical:!1,stroke:A.muted,strokeOpacity:.2}),(0,H.jsx)(p,{dataKey:`locality`,tick:{fontSize:10}}),(0,H.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,H.jsx)(h,{formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Tasks`]}),(0,H.jsx)(u,{dataKey:`count`,name:`Tasks`,children:r.map(e=>(0,H.jsx)(a,{fill:e.color},e.locality))})]})})}function Or(e){let t=new Map;for(let n of e){t.has(n.type)||t.set(n.type,{impactBand:n.impactBand,finding:n,recs:new Map});let e=t.get(n.type);ct[n.impactBand]<ct[e.impactBand]&&(e.impactBand=n.impactBand,e.finding=n),n.recommendation&&!e.recs.has(n.recommendation)&&e.recs.set(n.recommendation,{extended:n.extended??null})}return[...t.entries()].sort(([,e],[,t])=>ct[e.impactBand]-ct[t.impactBand])}function kr({rec:e,extended:t,finding:n,showImpactEstimate:r}){return(0,H.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[(0,H.jsx)(`p`,{className:`max-w-full leading-normal break-words`,children:e}),t?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null,r?(0,H.jsx)(Ot,{finding:n}):null]})}function Ar({findings:e}){if(e.length===0)return null;let t=Or(e);return(0,H.jsx)(`section`,{className:`space-y-3 rounded-md border p-3`,children:t.map(([e,{impactBand:t,finding:n,recs:r}])=>{let i=Et(n.impactEstimate)!==null;return(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(We,{type:e,impactBand:t}),[...r.entries()].map(([e,{extended:t}],r)=>(0,H.jsx)(kr,{rec:e,extended:t,finding:n,showImpactEstimate:r===0&&i},r))]},e)})})}function jr({stage:e,appModel:t}){return ge(e.id,t)?(0,H.jsx)(fe,{title:`Query Plan`,children:(0,H.jsx)(we,{stageId:e.id,appModel:t})}):null}function Mr({stage:e,appModel:t,catalog:n,getTaskData:r}){let{exportMode:i,getTaskData:a}=bt(r),[o,s]=(0,V.useState)(null),[c,l]=(0,V.useState)(!1),[u,d]=(0,V.useState)(0),f=(e.taskCount??0)>0,p=n.filter(t=>t.stageId===e.id);(0,V.useEffect)(()=>{if(!f||!a)return;let t=!1;return l(!1),a(e.id).catch(()=>null).then(e=>{t||(e?s(e):l(!0))}),()=>{t=!0}},[u]);let m=(e.completedAt??0)-(e.submittedAt??0),h=(e.memoryBytesSpilled??0)>0||(e.diskBytesSpilled??0)>0,g=(e.jvmGCTime??0)>0||(e.gcPct??0)>0,_=e.fetchWaitTime??0,v=_>0&&m>0?Math.round(_/m*100):null,y=(e.inputBytes??0)>0?((e.outputBytes??0)/(e.inputBytes??0)).toFixed(2):null,b=e.localityStats??[];return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(Ar,{findings:p}),(0,H.jsx)(ue,{title:`Overview`,collapsible:!0,defaultOpen:!0,rows:[[`Duration`,F(m)],[`Submitted`,Er(e.submittedAt)],[`Completed`,Er(e.completedAt)],e.sqlExecutionId!=null&&[`SQL Execution`,`#${e.sqlExecutionId}`],e.stageType?[`Stage type`,e.stageType]:!1]}),(0,H.jsx)(ue,{title:`Tasks`,collapsible:!0,rows:[[`Total`,String(e.taskCount)],[`Failed`,String(e.failedTasks)],[`P50 duration`,(e.taskDurationP50??0)>0?F(e.taskDurationP50):`—`],[`P95 duration`,(e.taskDurationP95??0)>0?F(e.taskDurationP95):`—`],[`Max duration`,(e.taskDurationMax??0)>0?F(e.taskDurationMax):`—`],(e.peakExecutionMemoryMax??0)>0&&[`Peak execution memory`,z(e.peakExecutionMemoryMax)]],children:f?i?(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Per-task duration data isn’t included in exported reports.`}):o?(0,H.jsx)(xt,{metrics:o.metrics,fieldNames:o.fieldNames,markers:{p50:e.taskDurationP50,p95:e.taskDurationP95}}):c?(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Couldn’t load task data for this stage.`}),(0,H.jsx)(Ke,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>d(e=>e+1),children:`Retry`})]}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading task data…`}):null}),(0,H.jsx)(ue,{title:`Locality`,collapsible:!0,rows:[],children:b.length>0?(0,H.jsx)(Dr,{stats:b}):null}),(0,H.jsx)(ue,{title:`I/O`,collapsible:!0,rows:[[`Input`,z(e.inputBytes)],[`Output`,z(e.outputBytes)],[`Shuffle read`,z(e.shuffleReadBytes)],[`Shuffle write`,z(e.shuffleWriteBytes)],_>0&&[`Fetch wait`,`${F(_)}${v==null?``:` (${v}%)`}`],y!=null&&[`I/O ratio`,y]]}),h?(0,H.jsx)(ue,{title:`Spill`,collapsible:!0,rows:[[`Memory spilled`,z(e.memoryBytesSpilled)],[`Disk spilled`,z(e.diskBytesSpilled)],(e.memoryBytesSpilled??0)>0&&[`Classification`,e.spillClassification??`unclassified`]]}):null,g?(0,H.jsx)(ue,{title:`GC`,collapsible:!0,rows:[[`JVM GC time`,F(e.jvmGCTime)],[`Executor run time`,F(e.executorRunTime)],[`GC %`,`${(e.gcPct??0).toFixed(1)}%`]]}):null,e.details?(0,H.jsx)(L,{children:(0,H.jsx)(fe,{title:`Call Stack`,children:(0,H.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre-wrap`,children:e.details})})}):null,(0,H.jsx)(jr,{stage:e,appModel:t})]})}function Nr({appModel:e,catalog:t,getTaskData:n}){let{stageId:r,close:i}=ot(),a=r==null?void 0:e.stages.get(r);return(0,H.jsx)(Se,{open:a!=null,onOpenChange:e=>{e||i()},children:(0,H.jsx)(Te,{className:`max-h-[85vh] overflow-y-auto sm:max-w-4xl`,children:a?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(ye,{children:(0,H.jsxs)(De,{children:[`Stage `,a.id,` `,(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`— `,a.name??``]})]})}),(0,H.jsx)(Mr,{stage:a,appModel:e,catalog:t,getTaskData:n},a.id)]}):null})})}function Pr(e){return Fr(e)||typeof e==`function`||Ir(e)}function Fr(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function Ir(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function W(e,t){return e==null?null:Pr(e)?V.createElement(e,t):e}function Lr(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?W(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:W(n.cell,t.getContext())}return`header`in e&&e.header?W(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?W(e.footer.column.columnDef.footer,e.footer.getContext()):null}function Rr({update:e,notify:t,unwatched:n}){return{link:r,unlink:i,propagate:a,checkDirty:o,shallowPropagate:s};function r(e,t,n){let r=t.depsTail;if(r!==void 0&&r.dep===e)return;let i=r===void 0?t.deps:r.nextDep;if(i!==void 0&&i.dep===e){i.version=n,t.depsTail=i;return}let a=e.subsTail;if(a!==void 0&&a.version===n&&a.sub===t)return;let o=t.depsTail=e.subsTail={version:n,dep:e,sub:t,prevDep:r,nextDep:i,prevSub:a,nextSub:void 0};i!==void 0&&(i.prevDep=o),r===void 0?t.deps=o:r.nextDep=o,a===void 0?e.subs=o:a.nextSub=o}function i(e,t=e.sub){let r=e.dep,i=e.prevDep,a=e.nextDep,o=e.nextSub,s=e.prevSub;return a===void 0?t.depsTail=i:a.prevDep=i,i===void 0?t.deps=a:i.nextDep=a,o===void 0?r.subsTail=s:o.prevSub=s,s===void 0?(r.subs=o)===void 0&&n(r):s.nextSub=o,a}function a(e){let n=e.nextSub,r;top:do{let i=e.sub,a=i.flags;if(a&60?a&12?a&4?!(a&48)&&c(e,i)?(i.flags=a|40,a&=1):a=0:i.flags=a&-9|32:a=0:i.flags=a|32,a&2&&t(i),a&1){let t=i.subs;if(t!==void 0){let i=(e=t).nextSub;i!==void 0&&(r={value:n,prev:r},n=i);continue}}if((e=n)!==void 0){n=e.nextSub;continue}for(;r!==void 0;)if(e=r.value,r=r.prev,e!==void 0){n=e.nextSub;continue top}break}while(1)}function o(t,n){let r,i=0,a=!1;top:do{let o=t.dep,c=o.flags;if(n.flags&16)a=!0;else if((c&17)==17){if(e(o)){let e=o.subs;e.nextSub!==void 0&&s(e),a=!0}}else if((c&33)==33){(t.nextSub!==void 0||t.prevSub!==void 0)&&(r={value:t,prev:r}),t=o.deps,n=o,++i;continue}if(!a){let e=t.nextDep;if(e!==void 0){t=e;continue}}for(;i--;){let i=n.subs,o=i.nextSub!==void 0;if(o?(t=r.value,r=r.prev):t=i,a){if(e(n)){o&&s(i),n=t.sub;continue}a=!1}else n.flags&=-33;n=t.sub;let c=t.nextDep;if(c!==void 0){t=c;continue top}}return a}while(1)}function s(e){do{let n=e.sub,r=n.flags;(r&48)==32&&(n.flags=r|16,(r&6)==2&&t(n))}while((e=e.nextSub)!==void 0)}function c(e,t){let n=t.depsTail;for(;n!==void 0;){if(n===e)return!0;n=n.prevDep}return!1}}function zr(e,t,n){let r=typeof e==`object`,i=r?e:void 0;return{next:(r?e.next:e)?.bind(i),error:(r?e.error:t)?.bind(i),complete:(r?e.complete:n)?.bind(i)}}var Br=[],Vr=0,{link:Hr,unlink:Ur,propagate:Wr,checkDirty:Gr,shallowPropagate:Kr}=Rr({update(e){return e._update()},notify(e){Br[Jr++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Zr(e))}}),qr=0,Jr=0,G,Yr=0;function Xr(e){try{++Yr,e()}finally{--Yr||Qr()}}function Zr(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=Ur(n,e)}function Qr(){if(!(Yr>0)){for(;qr<Jr;){let e=Br[qr];Br[qr++]=void 0,e.notify()}qr=0,Jr=0}}function $r(e,t){let n=typeof e==`function`,r=e,i={_snapshot:n?void 0:e,subs:void 0,subsTail:void 0,deps:void 0,depsTail:void 0,flags:+!n,get(){return G!==void 0&&Hr(i,G,Vr),i._snapshot},subscribe(e){let t=zr(e),n={current:!1},r=ei(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=G,o=t?.compare??Object.is;if(n)G=i,++Vr,i.depsTail=void 0;else if(e===void 0)return!1;n&&(i.flags=5);try{let t=i._snapshot,a=typeof e==`function`?e(t):e===void 0&&n?r(t):e;return t===void 0||!o(t,a)?(i._snapshot=a,!0):!1}finally{G=a,n&&(i.flags&=-5),Zr(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&Gr(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&Kr(e)}}else e&32&&(i.flags=e&-33);return G!==void 0&&Hr(i,G,Vr),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(Wr(e),Kr(e),Qr())}},i}function ei(e){let t=()=>{let t=G;G=n,++Vr,n.depsTail=void 0,n.flags=6;try{return e()}finally{G=t,n.flags&=-5,Zr(n)}},n={deps:void 0,depsTail:void 0,subs:void 0,subsTail:void 0,flags:6,notify(){let e=this.flags;e&16||e&32&&Gr(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Zr(this)}};return t(),n}function ti(e,t){if(Object.is(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||!Object.is(r,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();let n=ni(e);if(n.length!==ni(t).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(t,n[r])||!Object.is(e[n[r]],t[n[r]]))return!1;return!0}function ni(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var ri=e(r(),1);function ii(e,t){return e===t}function ai(e,t=e=>e,n){let r=n?.compare??ii,i=(0,V.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,V.useCallback)(()=>e.get(),[e]);return(0,ri.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function oi(e){let t=ai(e.source,e.selector,{compare:ti});return typeof e.children==`function`?e.children(t):e.children}function si(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function ci(e){let{createAtom:t,batch:n}=e,r=t(0);return{createOptionsStore:!1,wrapExternalAtoms:!1,addSubscription:()=>{throw Error(`Feature not supported in current reactivity implementation`)},unmount:()=>{throw Error(`Feature not supported in current reactivity implementation`)},schedule:e.schedule??(e=>queueMicrotask(e)),batch:n,untrack:e=>e(),createReadonlyAtom:(e,n)=>{let i=n?.compare??Object.is,a=!1,o,s=()=>{let t=e();return(!a||!i(o,t))&&(o=t,a=!0),o},c=t(()=>(r.get(),s()),{compare:i});return{get:s,subscribe:c.subscribe.bind(c)}},createWritableAtom:(e,n)=>t(e,{compare:n?.compare}),commit:()=>{r.set(e=>e+1)}}}function li(e,t=Object.is){let n=!1,r;return{get:e.get,markCommitted:e=>{r=e,n=!0},subscribe:i=>e.subscribe(e=>{(!n||!t(r,e))&&i(e)})}}function ui(){return ci({createAtom:$r,batch:Xr})}function di(e,t){return typeof e==`function`?e(t):e}function K(e){if(Array.isArray(e))return e.map(K);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?q():{},r=Object.keys(e);for(let t=0;t<r.length;t++){let i=r[t];Object.defineProperty(n,i,{configurable:!0,enumerable:!0,value:K(e[i]),writable:!0})}return n}return e}function fi(e,t){let n=Object.keys(t),r=e;for(let e=0;e<n.length;e++){let i=n[e];!i.startsWith(`_memo_`)&&i!==`_cellsCache`&&(r[i]=t[i])}return e}function q(){return Object.create(null)}function pi(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function mi(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>di(n,e))}}function hi(e){if(typeof e!=`object`||!e)return!1;if(Array.isArray(e))return!0;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function gi(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var _i=3;function vi(e,t){return yi(e,t,_i)}function yi(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!hi(e)||!hi(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=gi(e),i=gi(t);if(r.length!==i.length)return!1;let a=e,o=t;for(let e=0;e<r.length;e++){let i=r[e];if(!Object.prototype.propertyIsEnumerable.call(t,i)||!yi(a[i],o[i],n-1))return!1}return!0}function bi(e,t,n,r=vi){let i=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,a=e.options[i];a&&a(e=>{let t=di(n,e);return r(e,t)?e:t})}function xi(e){return e instanceof Function}function Si(e,t){let n=[],r=e=>{e.forEach(e=>{n.push(e);let i=t(e);i.length&&r(i)})};return r(e),n}var Ci=({fn:e,memoDeps:t,onAfterCompare:n,onAfterUpdate:r,onBeforeCompare:i,onBeforeUpdate:a})=>{let o=[],s;return c=>{i?.();let l=t?.(c),u=!l||l.length!==o?.length;if(!u&&l){for(let e=0;e<l.length;e++)if(l[e]!==o[e]){u=!0;break}}return n?.(u),u?(o=l,a?.(),s=e(...l??[]),r?.(s),s):s}};function wi(e){let t=!1;return()=>{if(!t){t=!0;return}e()}}function Ti({feature:e,fnName:t,objectId:n,onAfterUpdate:r,table:i,...a}){let o=()=>{if(!r)return;let{schedule:e,untrack:t}=i._reactivity;e(()=>t(()=>r()))},s={onAfterUpdate:()=>{o()}};return Ci({...a,...s})}function Ei(e,t=`_`){let[n,r]=e.split(t);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function J(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=Ei(r);t[n]=a?Ti({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function Y(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=Ei(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=Ti({memoDeps:e=>o(t,e),fn:(...e)=>a(t,...e),fnName:s,objectId:t.id,table:n,feature:e})}return this[i](...t)}}else t[r]=function(...e){return a(this,...e)}}}function X(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function Di(e){return e.row.getValue(e.column.id)}function Oi(e){return e.getValue()??e.table.options.renderFallbackValue}function ki(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var Ai={assignCellPrototype:(e,t)=>{Y(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>Di(e)},cell_renderValue:{fn:e=>Oi(e)},cell_getContext:{fn:e=>ki(e),memoDeps:e=>[e]}})}};function ji(e){if(!e._headerPrototype){e._headerPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignHeaderPrototype?.(e._headerPrototype,e)}return e._headerPrototype}function Mi(e,t,n){let r=ji(e),i=Object.create(r);i.colSpan=0,i.column=t,i.depth=n.depth,i.headerGroup=null,i.id=n.id??t.id,i.index=n.index,i.isPlaceholder=!!n.isPlaceholder,i.placeholderId=n.placeholderId,i.rowSpan=0,i.subHeaders=[];let a=e._headerInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Ni(){return{start:[],end:[]}}function Pi(){return q()}function Fi(e,t){Ii(e)&&Hi(e.table,n=>{let r=Object.assign(q(),n),i=t??!X(e,`getIsVisible`,Z),a=e.getLeafColumns();for(let e=0;e<a.length;e++){let t=a[e];Ii(t)&&(r[t.id]=i)}return r})}function Z(e){let t=e.table.atoms.columnVisibility?.get();if(!t)return!0;let n=e.columns;return n.length?n.some(e=>X(e,`getIsVisible`,Z)):(pi(t,e.id)?t[e.id]:void 0)??!0}function Ii(e){return(e.columnDef.enableHiding??!0)&&(e.table.options.enableHiding??!0)}function Li(e){return t=>{Fi(e,t.target.checked)}}function Ri(e){let t=e.getAllCells(),n=[];for(let e=0;e<t.length;e++){let r=t[e];X(r.column,`getIsVisible`,Z)&&n.push(r)}let{start:r,end:i}=e.table.atoms.columnPinning?.get()??Ni();if(!r.length&&!i.length)return n;let a=X(e,`getVisibleCellsByColumnId`,zi),o=[];for(let e=0;e<r.length;e++){let t=a[r[e]];t&&o.push(t)}let s=[];for(let e=0;e<i.length;e++){let t=a[i[e]];t&&s.push(t)}let c=[];for(let e=0;e<n.length;e++){let t=n[e],a=t.column.id;!r.includes(a)&&!i.includes(a)&&c.push(t)}return[...o,...c,...s]}function zi(e){let t=q(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];X(r.column,`getIsVisible`,Z)&&(t[r.column.id]=r)}return t}function Bi(e){return e.getAllFlatColumns().filter(e=>X(e,`getIsVisible`,Z))}function Vi(e){return e.getAllLeafColumns().filter(e=>X(e,`getIsVisible`,Z))}function Hi(e,t){bi(e,`columnVisibility`,t)}function Ui(e,t){Hi(e,t?q():Object.assign(q(),K(e.initialState.columnVisibility??{})))}function Wi(e,t){t??=!Gi(e);let n=q(),r=e.getAllLeafColumns();for(let e=0;e<r.length;e++){let i=r[e];n[i.id]=t||!Ii(i)}Hi(e,n)}function Gi(e){return!e.getAllLeafColumns().some(e=>!X(e,`getIsVisible`,Z))}function Ki(e){return e.getAllLeafColumns().some(e=>X(e,`getIsVisible`,Z))}function qi(e){return t=>{Wi(e,t.target.checked)}}function Ji(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];X(i,`getIsVisible`,Z)&&i.columns.length&&(n=Math.max(n,Ji(i.columns,t+1)))}return n}function Yi(e,t){return e?`${e}_${t}`:String(t)}function Xi(e,t,n,r){let i=e??``;return t&&(i=i?`${i}_${t}`:String(t)),n&&(i=i?`${i}_${n}`:n),r&&(i=i?`${i}_${r}`:r),i}function Zi(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function Qi(e,t,n,r,i,a){let o={depth:t,id:Yi(r,t),headers:[]},s=[];for(let i=0;i<e.length;i++){if(!(i in e))continue;let a=e[i],c=s[s.length-1],l=a.column.depth===o.depth,u,d=!1;if(l&&a.column.parent?u=a.column.parent:(u=a.column,d=!0),c&&c.column===u)c.subHeaders.push(a);else{let e=Mi(n,u,{id:Xi(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(Zi(s,u)):void 0,depth:t,index:s.length});e.subHeaders.push(a),s.push(e)}o.headers.push(a),a.headerGroup=o}for(let e=0;e<a.length;e++)a[e](o);i.push(o),t>0&&Qi(s,t-1,n,r,i,a)}function $i(e){for(let t=0;t<e.length;t++){let n=e[t];if(!X(n.column,`getIsVisible`,Z))continue;let r=0;if(n.subHeaders.length){$i(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];X(t.column,`getIsVisible`,Z)&&(r+=t.colSpan)}}else r=1;if(n.colSpan=r,n.isPlaceholder&&n.subHeaders.length===1&&n.subHeaders[0].column===n.column){let e=1,t=n.subHeaders[0];for(;t;)t.rowSpan=0,e++,t=t.subHeaders.length===1&&t.subHeaders[0].column===n.column?t.subHeaders[0]:void 0;n.rowSpan=e}else n.rowSpan=1}}function ea(e,t,n,r){let i=Ji(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=Mi(n,t[e],{depth:i,index:e}));return Qi(s,i-1,n,r,a,o),a.reverse(),$i(a[0]?.headers??[]),a}function ta(e){if(!e._columnPrototype){e._columnPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignColumnPrototype?.(e._columnPrototype,e)}return e._columnPrototype}function na(e,t,n,r){let i={...e.getDefaultColumnDef(),...t},a=i.accessorKey,o=a===void 0?void 0:String(a),s=i.id??o?.replaceAll(`.`,`_`)??(typeof i.header==`string`?i.header:void 0),c;if(i.accessorFn)c=i.accessorFn;else if(a!==void 0){if(typeof a==`string`&&a.includes(`.`)){let e=a.split(`.`);c=t=>{let n=t;for(let t=0;t<e.length;t++){let r=e[t];n=n?.[r]}return n}}else c=e=>e[i.accessorKey]}if(!s)throw Error();let l=ta(e),u=Object.create(l);u.accessorFn=c,u.columnDef=i,u.columns=[],u.depth=n,u.id=`${String(s)}`,u.parent=r;let d=e._columnInstanceInitFns;for(let e=0;e<d.length;e++)d[e](u);return u}function ra(e){let t=e.atoms.columnOrder?.get();return n=>{let r=[];if(!t?.length)r=n;else{let e=new Map;for(let t=0;t<n.length;t++){let r=n[t];e.set(r.id,r)}for(let n=0;n<t.length;n++){let i=t[n],a=e.get(i);a&&(r.push(a),e.delete(i))}for(let t=0;t<n.length;t++){let i=n[t];e.has(i.id)&&r.push(i)}}return ia(e,r)}}function ia(e,t){let n=e.atoms.grouping?.get()??[],{groupedColumnMode:r}=e.options;if(!n.length||!r)return t;let i=t.filter(e=>!n.includes(e.id));if(r===`remove`)return i;let a=new Map;for(let e=0;e<t.length;e++){let n=t[e];a.set(n.id,n)}let o=[];for(let e=0;e<n.length;e++){let t=a.get(n[e]);t&&o.push(t)}return[...o,...i]}function aa(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function oa(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return X(e.table,`getOrderColumns`,ra)(t)}return[e]}function sa(e){return{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>e.renderValue()?.toString?.()??null,...Object.values(e._features).reduce((e,t)=>Object.assign(e,t.getDefaultColumnDef?.()),{}),...e.options.defaultColumn}}function ca(e,t,n,r=0){let i=Array(t.length);for(let a=0;a<t.length;a++){if(!(a in t))continue;let o=t[a],s=na(e,o,r,n),c=o;s.columns=c.columns?ca(e,c.columns,s,r+1):[],i[a]=s}return i}function la(e){return ca(e,e.options.columns)}function ua(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function da(e){let t=q(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function fa(e){let t=e.getAllColumns().flatMap(e=>e.getLeafColumns());return X(e,`getOrderColumns`,ra)(t)}function pa(e){let t=q(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function ma(e,t){return e.getAllFlatColumnsById()[t]}var ha={assignColumnPrototype:(e,t)=>{Y(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>aa(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>oa(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{J(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>sa(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>la(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>ua(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>da(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>fa(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>pa(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>ma(e,t)}})}};function ga(e,t){for(let n=0;n<e.subHeaders.length;n++)ga(e.subHeaders[n],t);t.push(e)}function _a(e){let t=[];return ga(e,t),t}function va(e){return{column:e.column,header:e,table:e.column.table}}function ya(e){let{start:t,end:n}=e.atoms.columnPinning?.get()??Ni(),r=e.getAllColumns(),i=X(e,`getVisibleLeafColumns`,Vi);if(!t.length&&!n.length)return ea(r,i,e);let a=e.getAllLeafColumnsById(),o=[];for(let e=0;e<t.length;e++){let n=a[t[e]];n&&X(n,`getIsVisible`,Z)&&o.push(n)}let s=[];for(let e=0;e<n.length;e++){let t=a[n[e]];t&&X(t,`getIsVisible`,Z)&&s.push(t)}let c=i.filter(e=>!t.includes(e.id)&&!n.includes(e.id));return ea(r,[...o,...c,...s],e)}function ba(e){return[...e.getHeaderGroups()].reverse()}function xa(e){let t=e.getHeaderGroups(),n=[];for(let e=0;e<t.length;e++){let r=t[e].headers;for(let e=0;e<r.length;e++)n.push(r[e])}return n}function Sa(e){let t=e.getHeaderGroups()[0]?.headers??[],n=[];for(let e=0;e<t.length;e++){let r=t[e].getLeafHeaders();for(let e=0;e<r.length;e++)n.push(r[e])}return n}var Ca={assignHeaderPrototype:(e,t)=>{Y(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>_a(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>va(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{J(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>ya(e),memoDeps:()=>[e.options.columns,e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.atoms.columnPinning?.get(),e.atoms.columnVisibility?.get(),e.options.groupedColumnMode]},table_getFooterGroups:{fn:()=>ba(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>xa(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>Sa(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function wa(e){if(!e._rowPrototype){e._rowPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignRowPrototype?.(e._rowPrototype,e)}return e._rowPrototype}var Ta=(e,t,n,r,i,a,o)=>{let s=wa(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=q(),c._valuesCache=q(),c.depth=i,c.id=t,c.index=r,c.original=n,c.parentId=o,c.subRows=a??[];let l=e._rowInstanceInitFns;for(let e=0;e<l.length;e++)l[e](c);return c},Ea=/([0-9]+)/gm;function Q(e){let t=Object.assign((e,n,r)=>{let i=e.getValue(r),a=n.getValue(r),o=t.resolveDataValue;return o&&(i=o(i),a=o(a)),t.sort(i,a,e,n,r)},e);return t}Q({resolveDataValue:e=>Aa(e).toLowerCase(),sort:(e,t)=>ja(e,t)}),Q({resolveDataValue:e=>Aa(e),sort:(e,t)=>ja(e,t)}),Q({resolveDataValue:e=>Aa(e).toLowerCase(),sort:(e,t)=>Oa(e,t)}),Q({resolveDataValue:e=>Aa(e),sort:(e,t)=>Oa(e,t)}),Q({resolveDataValue:e=>ka(e),sort:(e,t)=>e>t?1:e<t?-1:0});var Da=Q({sort:(e,t)=>Oa(e,t)});function Oa(e,t){return e===t?0:e>t?1:-1}function ka(e){return e instanceof Date?e.getTime():e}function Aa(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function ja(e,t){let n=0,r=0,i=e.length,a=t.length;for(;n<i&&r<a;){let i=Ma(e.charCodeAt(n)),a=Ma(t.charCodeAt(r)),o=Na(e,n,i),s=Na(t,r,a);if(!i&&!a){let i=Pa(e,n,o,t,r,s);if(i)return i;n=o,r=s;continue}if(i!==a)return i?1:-1;let c=Fa(e,n,o,t,r,s);if(c)return c;n=o,r=s}return La(e,n)-La(t,r)}function Ma(e){return e>=48&&e<=57}function Na(e,t,n){let r=t+1;for(;r<e.length&&Ma(e.charCodeAt(r))===n;)r++;return r}function Pa(e,t,n,r,i,a){let o=n-t,s=a-i,c=o<s?o:s;for(let n=0;n<c;n++){let a=e.charCodeAt(t+n),o=r.charCodeAt(i+n);if(a>o)return 1;if(o>a)return-1}return o>s?1:s>o?-1:0}function Fa(e,t,n,r,i,a){let o=t;for(;o<n&&e.charCodeAt(o)===48;)o++;let s=i;for(;s<a&&r.charCodeAt(s)===48;)s++;let c=n-o,l=a-s;if(c===0&&l===0)return 0;if(c<=15&&l<=15){let t=Ia(e,o,n),i=Ia(r,s,a);return t>i?1:i>t?-1:0}let u=parseInt(e.slice(t,n),10),d=parseInt(r.slice(i,a),10);return u>d?1:d>u?-1:0}function Ia(e,t,n){let r=0;for(let i=t;i<n;i++)r=r*10+e.charCodeAt(i)-48;return r}function La(e,t){let n=0,r=t;for(;r<e.length;)n++,r=Na(e,r,Ma(e.charCodeAt(r)));return n}function Ra(){return[]}function za(e,t){bi(e,`cellSelection`,t?Ra():K(e.initialState.cellSelection)??Ra())}function Ba(e){e.atoms.cellSelection&&(e.options.autoResetAll??e.options.autoResetCellSelection??!0)&&e._reactivity.schedule(()=>za(e))}function Va(e){e.atoms.expanded&&(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding)&&e._reactivity.schedule(()=>Ha(e))}function Ha(e,t){let n=e.initialState.expanded;bi(e,`expanded`,t?q():n===!0||Object.assign(q(),K(n??{})))}function Ua(e){let t=e.table.atoms.expanded?.get()??{};return!!(e.table.options.getIsRowExpanded?.(e)??(t===!0||Wa(t,e.id)))}function Wa(e,t){return!!(e&&e!==!0&&pi(e,t)&&e[t])}var $=0,Ga=10;function Ka(){return{pageIndex:$,pageSize:Ga}}function qa(e){if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if((e.atoms.pagination?.get()?.pageIndex??$)===$)return;Za(e,!0)}}function Ja(e,t){bi(e,`pagination`,t)}function Ya(e,t){Ja(e,t?Ka():K(e.initialState.pagination??Ka()))}function Xa(e,t){Ja(e,n=>{let r=di(t,n.pageIndex),i=e.options.pageCount===void 0||e.options.pageCount===-1?2**53-1:e.options.pageCount-1;return r=Math.max(0,Math.min(r,i)),{...n,pageIndex:r}})}function Za(e,t){Xa(e,t?$:e.initialState.pagination?.pageIndex??$)}function Qa(e,t){$a(e,t?Ga:e.initialState.pagination?.pageSize??Ga)}function $a(e,t){Ja(e,e=>{let n=Math.max(1,di(t,e.pageSize)),r=e.pageSize===1/0?0:e.pageSize*e.pageIndex,i=n===1/0?0:Math.floor(r/n);return{...e,pageIndex:i,pageSize:n}})}function eo(e){let t=co(e),n=[];return t&&t>0&&(n=[...Array(t)].fill(null).map((e,t)=>t)),n}function to(e){return(e.atoms.pagination?.get()?.pageIndex??0)>0}function no(e){let t=e.atoms.pagination?.get()?.pageIndex??$,n=co(e);return n===-1||n!==0&&t<n-1}function ro(e){let t=e.atoms.pagination?.get()?.pageIndex??$,n=co(e);return Number.isFinite(n)&&n>0&&t<n-1}function io(e){return Xa(e,e=>e-1)}function ao(e){return Xa(e,e=>e+1)}function oo(e){return Xa(e,0)}function so(e){let t=co(e);if(!(!Number.isFinite(t)||t<=0))return Xa(e,t-1)}function co(e){let t=e.options.pageCount;if(t!=null)return t;let n=lo(e),r=e.atoms.pagination?.get()?.pageSize??Ga;return r===1/0&&Number.isFinite(n)&&n>0?1:Math.ceil(n/r)}function lo(e){return e.options.rowCount??e.getPrePaginatedRowModel().rows.length}function uo(){return[]}function fo(e,t){bi(e,`sorting`,t)}function po(e,t){fo(e,t?[]:K(e.initialState.sorting??[]))}function mo(e){e.atoms.sorting&&(e.options.autoResetAll??e.options.autoResetSorting??!1)&&po(e)}function ho(e){let t=e.table._rowModelFns.sortFns,n=e.table.getFilteredRowModel().flatRows.slice(0,10),r,i=!1;for(let t=0;t<n.length;t++){let a=n[t].getValue(e.id);if(Object.prototype.toString.call(a)===`[object Date]`){r=`datetime`;break}if(typeof a==`string`&&(i=!0,a.split(Ea).length>1)){r=`alphanumeric`;break}}if(!r&&i&&(r=`text`),r){let e=t?.[r];if(e||r===`alphanumeric`&&(e=t?.text),e)return e}return Da}function go(e){let t=e.table.getFilteredRowModel().flatRows.slice(0,10);for(let n=0;n<t.length;n++){let r=t[n].getValue(e.id);if(r!=null)return typeof r==`string`?`asc`:`desc`}return`desc`}function _o(e){let t=e.table._rowModelFns.sortFns;return xi(e.columnDef.sortFn)?e.columnDef.sortFn:e.columnDef.sortFn===`auto`?ho(e):t?.[e.columnDef.sortFn]??Da}function vo(e,t,n){let r=bo(e,n&&So(e)),i=t!==void 0;fo(e.table,a=>{let o=a.findIndex(t=>t.id===e.id),s=o===-1?void 0:a[o],c=[],l,u=i?t:r===`desc`,d=!!(a.length&&So(e)&&n);return l=d?s?`toggle`:`add`:s?`toggle`:`replace`,l===`toggle`&&(i||r||(l=`remove`)),l===`add`?(c=[...a,{id:e.id,desc:u}],c.splice(0,c.length-(e.table.options.maxMultiSortColCount??2**53-1))):c=l===`toggle`?d?a.map(t=>t.id===e.id?{...t,desc:u}:t):[{id:e.id,desc:u}]:l===`remove`?d?a.filter(t=>t.id!==e.id):[]:[{id:e.id,desc:u}],c})}function yo(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??go(e)===`desc`?`desc`:`asc`}function bo(e,t){let n=yo(e),r=Co(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r===`desc`?`asc`:`desc`:n}function xo(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function So(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function Co(e){let t=e.table.atoms.sorting?.get()?.find(t=>t.id===e.id);return t?t.desc?`desc`:`asc`:!1}function wo(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function To(e){fo(e.table,t=>t.length?t.filter(t=>t.id!==e.id):[])}function Eo(e){let t=xo(e);return n=>{t&&vo(e,void 0,So(e)?e.table.options.isMultiSortEvent?.(n):!1)}}function Do(){return e=>Ti({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>ko(e,e.options.data),onAfterUpdate:wi(()=>{Va(e),qa(e),mo(e),Ba(e)})})}function Oo(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=Ta(e,e.getRowId(s,o,i),s,o,r,void 0,i?.id);t.flatRows.push(c),t.rowsById[c.id]=c,a.push(c),e.options.getSubRows&&(c.originalSubRows=e.options.getSubRows(s,o),c.originalSubRows?.length&&(c.subRows=Oo(e,t,c.originalSubRows,r+1,c)))}return a}function ko(e,t){let n={rows:[],flatRows:[],rowsById:q()};return n.rows=Oo(e,n,t),n}function Ao(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??Do()(e)),e._rowModels.coreRowModel()}function jo(e){return e.getCoreRowModel()}function Mo(e){return e._rowModels.filteredRowModel||(e._rowModels.filteredRowModel=e.options.features.filteredRowModel?.(e)),e.options.manualFiltering||!e._rowModels.filteredRowModel?e.getPreFilteredRowModel():e._rowModels.filteredRowModel()}function No(e){return e.getFilteredRowModel()}function Po(e){return e._rowModels.groupedRowModel||(e._rowModels.groupedRowModel=e.options.features.groupedRowModel?.(e)),e.options.manualGrouping||!e._rowModels.groupedRowModel?e.getPreGroupedRowModel():e._rowModels.groupedRowModel()}function Fo(e){return e.getGroupedRowModel()}function Io(e){return e._rowModels.sortedRowModel||(e._rowModels.sortedRowModel=e.options.features.sortedRowModel?.(e)),e.options.manualSorting||!e._rowModels.sortedRowModel?e.getPreSortedRowModel():e._rowModels.sortedRowModel()}function Lo(e){return e.getSortedRowModel()}function Ro(e){return e._rowModels.expandedRowModel||(e._rowModels.expandedRowModel=e.options.features.expandedRowModel?.(e)),e.options.manualExpanding||!e._rowModels.expandedRowModel?e.getPreExpandedRowModel():e._rowModels.expandedRowModel()}function zo(e){return e.getExpandedRowModel()}function Bo(e){return e._rowModels.paginatedRowModel||(e._rowModels.paginatedRowModel=e.options.features.paginatedRowModel?.(e)),e.options.manualPagination||!e._rowModels.paginatedRowModel?e.getPrePaginatedRowModel():e._rowModels.paginatedRowModel()}function Vo(e){return e.getPaginatedRowModel()}var Ho={constructTableAPIs:e=>{J(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>Ao(e)},table_getPreFilteredRowModel:{fn:()=>jo(e)},table_getFilteredRowModel:{fn:()=>Mo(e)},table_getPreGroupedRowModel:{fn:()=>No(e)},table_getGroupedRowModel:{fn:()=>Po(e)},table_getPreSortedRowModel:{fn:()=>Fo(e)},table_getSortedRowModel:{fn:()=>Io(e)},table_getPreExpandedRowModel:{fn:()=>Lo(e)},table_getExpandedRowModel:{fn:()=>Ro(e)},table_getPrePaginatedRowModel:{fn:()=>zo(e)},table_getPaginatedRowModel:{fn:()=>Bo(e)},table_getRowModel:{fn:()=>Vo(e)}})}};function Uo(e){if(!e._cellPrototype){e._cellPrototype={table:e};let t=Object.values(e._features);for(let n=0;n<t.length;n++)t[n].assignCellPrototype?.(e._cellPrototype,e)}return e._cellPrototype}function Wo(e,t,n){let r=Uo(n),i=Object.create(r);i.column=e,i.id=`${t.id}_${e.id}`,i.row=t;let a=n._cellInstanceInitFns;for(let e=0;e<a.length;e++)a[e](i);return i}function Go(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function Ko(e){let t=e.getPrePaginatedRowModel().rows;if(e.options.paginateExpandedRows===!1){let e=[],n=t=>{t._displayIndexCache=e.length,e.push(t),t.subRows.length&&t.getIsExpanded?.()&&t.subRows.forEach(n)};return t.forEach(n),e}for(let e=0;e<t.length;e++)t[e]._displayIndexCache=e;return t}function qo(e,t){if(pi(e._valuesCache,t))return e._valuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return e._valuesCache[t]=n.accessorFn(e.original,e.index),e._valuesCache[t]}function Jo(e,t){if(pi(e._uniqueValuesCache,t))return e._uniqueValuesCache[t];let n=e.table.getColumn(t);if(n?.accessorFn)return n.columnDef.getUniqueValues?(e._uniqueValuesCache[t]=n.columnDef.getUniqueValues(e.original,e.index),e._uniqueValuesCache[t]):(e._uniqueValuesCache[t]=[e.getValue(t)],e._uniqueValuesCache[t])}function Yo(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function Xo(e){return Si(e.subRows,e=>e.subRows)}function Zo(e){let t=e.getCoreRowModel().flatRows,n=0;for(let e=0;e<t.length;e++)n=Math.max(n,t[e].depth);return n}function Qo(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function $o(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function es(e){let t=e.table.getAllLeafColumns(),n=e._cellsCache;n||=e._cellsCache=new WeakMap;let r=Array(t.length);for(let i=0;i<t.length;i++){let a=t[i],o=n.get(a);o||(o=Wo(a,e,e.table),n.set(a,o)),r[i]=o}return r}function ts(e){let t=q(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function ns(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function rs(e,t,n){let r=(n?e.getPrePaginatedRowModel():e.getRowModel()).rowsById[t];if(!r&&(r=e.getCoreRowModel().rowsById[t],!r))throw Error();return r}var is={assignRowPrototype:(e,t)=>{Y(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>Go(e)},row_getAllCellsByColumnId:{fn:e=>ts(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>es(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>Xo(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>Qo(e)},row_getParentRows:{fn:e=>$o(e)},row_getUniqueValues:{fn:(e,t)=>Jo(e,t)},row_getValue:{fn:(e,t)=>qo(e,t)},row_renderValue:{fn:(e,t)=>Yo(e,t)}})},constructTableAPIs:e=>{J(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>Ko(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>ns(t,e,n,r)},table_getRow:{fn:(t,n)=>rs(e,t,n)},table_getMaxSubRowDepth:{fn:()=>Zo(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function as(e,t,n=(e,t)=>e===t){let r=t===void 0?e.options.state:t;e._reactivity.batch(()=>{if(r)for(let t in r){let i=e.baseAtoms[t];if(!i)continue;let a=r[t],o=a===void 0?e.initialState[t]:a;n(e._reactivity.untrack(()=>i.get()),o)||i.set(()=>o)}})}function os(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{as(e,t,n),e._reactivity.commit?.()})}function ss(e){let t=K(e.initialState);e._reactivity.batch(()=>{let n=Object.keys(t);for(let r=0;r<n.length;r++){let i=n[r];e.baseAtoms[i].set(t[i])}});let n=Object.values(e._features);for(let t=0;t<n.length;t++)n[t].resetTableInstanceData?.(e)}function cs(e,t){let{features:n,atoms:r,initialState:i}=e.options;if(!e.options.mergeOptions)return{...e.options,...t,features:n,atoms:r,initialState:i};let a=e.options.mergeOptions(e.options,t),o={...Object.getOwnPropertyDescriptors(a)};return Object.defineProperties(Object.create(Object.getPrototypeOf(a)),{...o,features:{value:n,enumerable:!0,configurable:!0,writable:!0},atoms:{value:r,enumerable:!0,configurable:!0,writable:!0},initialState:{value:i,enumerable:!0,configurable:!0,writable:!0}})}function ls(e,t,n){let r=cs(e,di(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&os(e,r.state??null)}var us={coreCellsFeature:Ai,coreColumnsFeature:ha,coreHeadersFeature:Ca,coreRowModelsFeature:Ho,coreRowsFeature:is,coreTablesFeature:{constructTableAPIs:e=>{J(`coreTablesFeature`,e,{table_reset:{fn:()=>ss(e)},table_setOptions:{fn:t=>ls(e,t)}})}}};function ds(e){return e}function fs(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),K(t)}function ps(e){let t=e.features.coreReactivityFeature,{aggregationFns:n,columnMeta:r,coreRowModel:i,expandedRowModel:a,facetedMinMaxValues:o,facetedRowModel:s,facetedUniqueValues:c,filterFns:l,filterMeta:u,filteredRowModel:d,groupedRowModel:f,paginatedRowModel:p,sortFns:m,sortedRowModel:h,tableMeta:g,..._}=e.features,v={_cellInstanceInitFns:[],_columnInstanceInitFns:[],_features:{...us,..._},_headerGroupInstanceInitFns:[],_headerInstanceInitFns:[],_reactivity:t,_rowInstanceInitFns:[],_rowModelFns:{aggregationFns:n,filterFns:l,sortFns:m},_rowModels:{},atoms:{},baseAtoms:{}},y=Object.values(v._features),b={...y.reduce((e,t)=>Object.assign(e,t.getDefaultTableOptions?.(v)),{}),...e};if(t.wrapExternalAtoms&&b.atoms)for(let[e,n]of Object.entries(b.atoms)){let r=n,i=t.createWritableAtom(r.get(),{debugName:`externalAtom/${e}`});b.atoms[e]=i;let a=!1,o=r.subscribe(e=>{a||i.set(e)}),s=i.subscribe(e=>{a=!0,r.set(e),a=!1});t.addSubscription(o),t.addSubscription(s)}t.createOptionsStore?(v.optionsStore=t.createWritableAtom(b,{debugName:`table/optionsStore`}),Object.defineProperty(v,"options",{configurable:!0,enumerable:!0,get(){return v.optionsStore.get()},set(e){v.optionsStore.set(()=>e)}})):v.options=b,v.initialState=fs(v._features,v.options.initialState);let x=Object.keys(v.initialState);for(let e=0;e<x.length;e++){let n=x[e];v.baseAtoms[n]=t.createWritableAtom(v.initialState[n],{debugName:`table/baseAtoms/${n}`}),v.atoms[n]=t.createReadonlyAtom(()=>{let e=v.options,t=e.atoms?.[n],r=t?t.get():v.baseAtoms[n].get();if(t)return r;let i=e.state;if(i&&pi(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}as(v),v.store=si(t.createReadonlyAtom(()=>{let e={};for(let t=0;t<x.length;t++){let n=x[t];e[n]=v.atoms[n].get()}return e},{compare:ti,debugName:`table/store`}));for(let e=0;e<y.length;e++){let t=y[e];t.initTableInstanceData?.(v),t.initCellInstanceData&&v._cellInstanceInitFns.push(t.initCellInstanceData.bind(t)),t.initColumnInstanceData&&v._columnInstanceInitFns.push(t.initColumnInstanceData.bind(t)),t.initHeaderGroupInstanceData&&v._headerGroupInstanceInitFns.push(t.initHeaderGroupInstanceData.bind(t)),t.initHeaderInstanceData&&v._headerInstanceInitFns.push(t.initHeaderInstanceData.bind(t)),t.initRowInstanceData&&v._rowInstanceInitFns.push(t.initRowInstanceData.bind(t)),t.constructTableAPIs?.(v)}return v}var ms={getInitialState:e=>({columnVisibility:Pi(),...e}),getDefaultTableOptions:e=>({onColumnVisibilityChange:mi(`columnVisibility`,e)}),assignColumnPrototype:(e,t)=>{Y(`columnVisibilityFeature`,e,t,{column_getIsVisible:{fn:e=>Z(e),memoDeps:e=>[t.options.columns,t.atoms.columnVisibility?.get(),e.columns]},column_getCanHide:{fn:e=>Ii(e)},column_getToggleVisibilityHandler:{fn:e=>Li(e)},column_toggleVisibility:{fn:(e,t)=>Fi(e,t)}})},assignRowPrototype:(e,t)=>{Y(`columnVisibilityFeature`,e,t,{row_getVisibleCells:{fn:e=>Ri(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get()]},row_getVisibleCellsByColumnId:{fn:e=>zi(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnVisibility?.get()]}})},constructTableAPIs:e=>{J(`columnVisibilityFeature`,e,{table_getVisibleFlatColumns:{fn:()=>Bi(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getVisibleLeafColumns:{fn:()=>Vi(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_setColumnVisibility:{fn:t=>Hi(e,t)},table_resetColumnVisibility:{fn:t=>Ui(e,t)},table_toggleAllColumnsVisible:{fn:t=>Wi(e,t)},table_getIsAllColumnsVisible:{fn:()=>Gi(e)},table_getIsSomeColumnsVisible:{fn:()=>Ki(e)},table_getToggleAllColumnsVisibilityHandler:{fn:()=>qi(e)}})}},hs={getInitialState:e=>({...e,pagination:{...Ka(),...e.pagination}}),getDefaultTableOptions:e=>({onPaginationChange:mi(`pagination`,e)}),constructTableAPIs:e=>{J(`rowPaginationFeature`,e,{table_autoResetPageIndex:{fn:()=>qa(e)},table_setPagination:{fn:t=>Ja(e,t)},table_resetPagination:{fn:t=>Ya(e,t)},table_setPageIndex:{fn:t=>Xa(e,t)},table_resetPageIndex:{fn:t=>Za(e,t)},table_setPageSize:{fn:t=>$a(e,t)},table_getPageCount:{fn:()=>co(e)},table_resetPageSize:{fn:t=>Qa(e,t)},table_getPageOptions:{fn:()=>eo(e)},table_getCanPreviousPage:{fn:()=>to(e)},table_getCanNextPage:{fn:()=>no(e)},table_getCanLastPage:{fn:()=>ro(e)},table_previousPage:{fn:()=>io(e)},table_nextPage:{fn:()=>ao(e)},table_firstPage:{fn:()=>oo(e)},table_lastPage:{fn:()=>so(e)},table_getRowCount:{fn:()=>lo(e)}})}},gs={getInitialState(e){return{sorting:uo(),...e}},getDefaultColumnDef(){return{sortFn:`auto`,sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:mi(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}},assignColumnPrototype(e,t){Y(`rowSortingFeature`,e,t,{column_getAutoSortFn:{fn:e=>ho(e)},column_getAutoSortDir:{fn:e=>go(e)},column_getSortFn:{fn:e=>_o(e)},column_toggleSorting:{fn:(e,t,n)=>vo(e,t,n)},column_getFirstSortDir:{fn:e=>yo(e)},column_getNextSortingOrder:{fn:(e,t)=>bo(e,t)},column_getCanSort:{fn:e=>xo(e)},column_getCanMultiSort:{fn:e=>So(e)},column_getIsSorted:{fn:e=>Co(e)},column_getSortIndex:{fn:e=>wo(e)},column_clearSorting:{fn:e=>To(e)},column_getToggleSortingHandler:{fn:e=>Eo(e)}})},constructTableAPIs(e){J(`rowSortingFeature`,e,{table_setSorting:{fn:t=>fo(e,t)},table_resetSorting:{fn:t=>po(e,t)}})}};function _s(e){let t=[],n=e=>{t.push(e),e.subRows.length&&Ua(e)&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function vs(){return e=>{let t=e;return Ti({feature:`rowPaginationFeature`,table:t,fnName:`table.getPaginatedRowModel`,memoDeps:()=>[t.getPrePaginatedRowModel(),t.atoms.pagination?.get(),t.options.paginateExpandedRows?void 0:t.atoms.expanded?.get()],fn:()=>ys(t)})}}function ys(e){let t=e.getPrePaginatedRowModel(),n=e.atoms.pagination?.get();if(!t.rows.length)return t;let{pageSize:r,pageIndex:i}=n??Ka(),{rows:a,flatRows:o,rowsById:s}=t,c=a;if(r!==1/0||i!==0){let e=r*i,t=e+r;c=a.slice(e,t)}let l;l=e.options.paginateExpandedRows?{rows:c,flatRows:o,rowsById:s}:_s({rows:c,flatRows:o,rowsById:s}),l.flatRows=[];let u=new Set,d=e=>{u.has(e.id)||(u.add(e.id),l.flatRows.push(e),e.subRows.length&&e.subRows.forEach(d))};return l.rows.forEach(d),l}function bs(){return e=>{let t=e;return Ti({feature:`rowSortingFeature`,table:t,fnName:`table.getSortedRowModel`,memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>xs(t),onAfterUpdate:wi(()=>qa(t))})}}function xs(e){let t=e.getPreSortedRowModel(),n=e.atoms.sorting?.get();if(!t.rows.length||!n?.length)return t;let r=[],i=n.filter(t=>{let n=e.getColumn(t.id);return n?xo(n):!1});if(!i.length)return t;let a=[];for(let t=0;t<i.length;t++){let n=i[t],r=e.getColumn(n.id);r&&a.push({id:n.id,desc:n.desc,sortUndefined:r.columnDef.sortUndefined,invertSorting:r.columnDef.invertSorting,sortFn:_o(r)})}let o=(e,t)=>{for(let n=0;n<a.length;n++){let r=a[n],i=r.sortUndefined,o=r.desc,s=0;if(i){let n=e.getValue(r.id),a=t.getValue(r.id),o=n===void 0,c=a===void 0;if(o&&c)continue;if(o||c){if(i===`first`)return o?-1:1;if(i===`last`)return o?1:-1;s=o?i:-i}}if(s===0&&(s=r.sortFn(e,t,r.id)),s!==0)return o&&(s*=-1),r.invertSorting&&(s*=-1),s}return e.index-t.index},s=e=>{let t=e.slice();t.sort(o);let n=!1;for(let i=0;i<t.length;i++){let a=t[i];a!==e[i]&&(n=!0);let o=r.length;if(r.push(a),a.subRows.length){let e=s(a.subRows);if(e.changed){let s=Object.create(Object.getPrototypeOf(a));fi(s,a),s.subRows=e.rows,t[i]=s,r[o]=s,n=!0}}}return{rows:t,changed:n}};return{rows:s(t.rows).rows,flatRows:r,rowsById:t.rowsById}}var Ss=typeof window>`u`?V.useEffect:V.useLayoutEffect;function Cs(e,t){let[{table:n,rootSource:r}]=(0,V.useState)(()=>{let t=ps({...e,features:{coreReactivityFeature:ui(),...e.features}});return t.Subscribe=(e=>oi({...e,source:e.source??t.store})),t.FlexRender=Lr,{table:t,rootSource:li(t.store,ti)}}),i=n;ls(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=ai(r,t,{compare:ti});return Ss(()=>{r.markCommitted(o),os(i,a??null,ti)}),(0,V.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}var ws=ds({columnVisibilityFeature:ms,rowSortingFeature:gs,rowPaginationFeature:hs,sortedRowModel:bs(),paginatedRowModel:vs()}),Ts=10,Es=10,Ds=new Set([`duration`,`taskCount`,`shuffleRead`,`fetchWait`,`gcPct`,`skew`,`spill`]);function Os(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function ks(e){return e<=0?(0,H.jsx)(H.Fragment,{children:`0`}):(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e,` `,(0,H.jsx)(pt,{label:`RETRY`,impactBand:`critical`})]})}function As(e,t,n){if(e<=0)return(0,H.jsx)(H.Fragment,{children:`—`});let r=F(e);if(t<=0)return(0,H.jsx)(H.Fragment,{children:r});let i=e/t;return i>.3?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,H.jsx)(pt,{label:n===`advanced`?`${Math.round(i*100)}%`:`High`,impactBand:`critical`})]}):i>.15?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,H.jsx)(pt,{label:n===`advanced`?`${Math.round(i*100)}%`:`Elevated`,impactBand:`info`})]}):(0,H.jsx)(H.Fragment,{children:r})}function js(e,t){if(!e||e<=0||!t||t<=0)return(0,H.jsx)(H.Fragment,{children:`—`});let n=t/e,r=n<.01?`${n.toExponential(1)}×`:`${n.toFixed(2)}×`;return n>2||n<.1?(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,H.jsx)(pt,{label:`extreme`,impactBand:`info`})]}):(0,H.jsx)(H.Fragment,{children:r})}function Ms(e,t){if(e<=0)return(0,H.jsx)(H.Fragment,{children:`—`});let n=t??`unclassified`;return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[z(e),` `,(0,H.jsx)(pt,{label:ut[n],impactBand:`warning`,title:$e[n]})]})}function Ns(e,t){return!e||e<=0?0:(t??0)/e}function Ps(e){let t=new Map;for(let n of e)t.has(n.type)||t.set(n.type,[]),t.get(n.type).push(n);return[...t.values()].map(e=>{let t=Ze(e);return e.find(e=>e.impactBand===t)??e[0]})}function Fs({appModel:e,catalog:t,getTaskData:n,onRoute:r}){let{openStage:i}=ot(),a=Re(),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(``),[u,d]=(0,V.useState)([]),[f,p]=(0,V.useState)({pageIndex:0,pageSize:Ts}),{catalogByStage:m,flaggedStageIds:h,frequency:g}=(0,V.useMemo)(()=>{let e=new Map,n=new Set;for(let r of t)r.stageId!=null&&(n.add(r.stageId),e.has(r.stageId)||e.set(r.stageId,[]),e.get(r.stageId).push(r));return{catalogByStage:e,flaggedStageIds:n,frequency:ft(t)}},[t]),_=(0,V.useMemo)(()=>{let t=[...e.stages.values()],n=o?t.filter(e=>h.has(e.id)):[...t].sort((e,t)=>(t.completedAt??0)-(t.submittedAt??0)-((e.completedAt??0)-(e.submittedAt??0))).slice(0,Es),r=c.trim().toLowerCase();return(r?n.filter(e=>(e.name??``).toLowerCase().includes(r)||String(e.id).includes(r)):n).map(e=>({stage:e,tags:Ps(m.get(e.id)??[]),frequency:g.get(e.id)??0}))},[e.stages,o,h,m,g,c]),v=(0,V.useMemo)(()=>{if(!r)return null;let e=new Map;for(let n of t){let r=tr(n,t);r&&e.set(n,r)}return e},[t,r]),y=(0,V.useMemo)(()=>[{id:`id`,header:`Stage`,accessorFn:e=>e.stage.id,cell:({getValue:e})=>{let t=e();return(0,H.jsx)(`button`,{type:`button`,"aria-label":`Open Stage ${t} details`,className:`inline-flex cursor-pointer items-center rounded-sm hover:underline underline-offset-2 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:e=>{e.stopPropagation(),i(t)},children:(0,H.jsx)(`strong`,{children:t})})}},{id:`name`,header:`Operation`,accessorFn:e=>e.stage.name??``,cell:({row:e})=>{let t=e.original.stage.id;return(0,H.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[Os(e.original.stage.name??``,40),e.original.tags.map((e,n)=>{let i=v?v.get(e)??null:null,a=i&&r?{target:i,onRoute:r}:null,o=Et(e.impactEstimate);return(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[a?(0,H.jsx)(`button`,{type:`button`,"aria-label":`Investigate ${a.target.findingLabel} in Stage ${t}`,title:`Investigate ${a.target.findingLabel} in Stage ${t}`,className:`inline-flex cursor-pointer items-center rounded-full hover:underline underline-offset-2 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:e=>{e.stopPropagation(),a.onRoute(a.target)},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&e.stopPropagation()},children:(0,H.jsx)(We,{type:e.type,impactBand:e.impactBand,plainBadge:!0})}):(0,H.jsx)(We,{type:e.type,impactBand:e.impactBand}),o?(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:o}):null]},n)})]})}},{id:`type`,header:`Type`,accessorFn:e=>e.stage.stageType??``,cell:({row:e})=>(0,H.jsx)(nt,{variant:`outline`,children:e.original.stage.stageType??`—`})},{id:`duration`,header:`Duration`,accessorFn:e=>(e.stage.completedAt??0)-(e.stage.submittedAt??0),cell:({getValue:e})=>(0,H.jsx)(H.Fragment,{children:F(e())})},{id:`taskCount`,header:`Tasks`,accessorFn:e=>e.stage.taskCount},{id:`retried`,header:`Retried`,accessorFn:e=>e.stage.failedTasks??0,cell:({getValue:e})=>ks(e())},{id:`shuffleRead`,header:`Shuffle Read`,accessorFn:e=>e.stage.shuffleReadBytes??0,cell:({getValue:e})=>(0,H.jsx)(H.Fragment,{children:z(e())})},{id:`fetchWait`,header:`Fetch Wait`,accessorFn:e=>e.stage.fetchWaitTime??0,cell:({row:e})=>As(e.original.stage.fetchWaitTime??0,e.original.stage.executorRunTime??0,a)},...a===`advanced`?[{id:`ioRatio`,header:`I/O Ratio`,accessorFn:e=>e.stage.inputBytes?(e.stage.outputBytes??0)/e.stage.inputBytes:0,cell:({row:e})=>js(e.original.stage.inputBytes??0,e.original.stage.outputBytes??0)}]:[],{id:`spill`,header:`Spill (mem)`,accessorFn:e=>e.stage.memoryBytesSpilled??0,cell:({row:e})=>Ms(e.original.stage.memoryBytesSpilled??0,e.original.stage.spillClassification)},...a===`advanced`?[{id:`gcPct`,header:`GC%`,accessorFn:e=>e.stage.gcPct??0,cell:({getValue:e})=>(0,H.jsxs)(H.Fragment,{children:[e().toFixed(1),`%`]})},{id:`skew`,header:`Skew P95/median`,accessorFn:e=>Ns(e.stage.taskDurationP50,e.stage.taskDurationP95),cell:({getValue:e})=>{let t=e();return(0,H.jsx)(H.Fragment,{children:t>0?`${t.toFixed(1)}×`:`—`})}}]:[],{id:`frequency`,header:`Flagged`,accessorFn:e=>e.frequency,cell:({getValue:e})=>{let t=e();return t<=1?(0,H.jsx)(H.Fragment,{children:`—`}):(0,H.jsx)(nt,{variant:`outline`,children:`Flagged by ${t}`})}}],[t,r,v,i,a]),b=Cs({features:ws,data:_,columns:y,state:{sorting:u,pagination:f},sortDescFirst:!1,onSortingChange:d,onPaginationChange:p});function x(){s(e=>!e),d([]),p({pageIndex:0,pageSize:Ts})}let S=e=>e===`asc`?` ▲`:e===`desc`?` ▼`:``,C=e=>e===`asc`?`ascending`:e===`desc`?`descending`:`none`;return(0,H.jsx)(I,{title:`Stage Summary`,children:(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(ae,{type:`text`,value:c,onChange:e=>{l(e.target.value),p(e=>({...e,pageIndex:0}))},placeholder:`Filter by stage name or ID…`,"aria-label":`Filter by stage name or ID`,className:`max-w-xs`}),(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Scroll sideways to see all columns →`}),(0,H.jsx)(Ke,{type:`button`,variant:`outline`,size:`sm`,onClick:x,children:o?`Top ${Es} by duration`:`Problems only`})]}),(0,H.jsxs)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:[`Showing `,_.length,` stage`,_.length===1?``:`s`,`: `,` `,o?`problems only`:`top ${Es} by duration`,`.`]}),(0,H.jsxs)(it,{children:[(0,H.jsx)(ht,{children:b.getHeaderGroups().map(e=>(0,H.jsx)(P,{children:e.headers.map(e=>{let t=e.column.getIsSorted(),n=e.column.getToggleSortingHandler();return(0,H.jsxs)(dt,{scope:`col`,tabIndex:e.column.getCanSort()?0:void 0,"aria-sort":C(t),className:M(e.column.getCanSort()&&`tap-target-comfortable cursor-pointer select-none`,Ds.has(e.column.id)&&`text-right`),onClick:n,onKeyDown:e=>{n&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e))},children:[W(e.column.columnDef.header,e.getContext()),S(t)]},e.id)})},e.id))}),(0,H.jsx)(tt,{children:b.getRowModel().rows.length===0?(0,H.jsx)(P,{children:(0,H.jsx)(N,{colSpan:y.length,className:`text-muted-foreground`,children:(0,H.jsxs)(`span`,{className:`flex items-center justify-center gap-2 py-2`,children:[(0,H.jsx)(Me,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`No stages to show.`]})})}):b.getRowModel().rows.map(e=>(0,H.jsx)(P,{className:`cursor-pointer`,onClick:()=>i(e.original.stage.id),children:e.getVisibleCells().map(e=>(0,H.jsx)(N,{className:Ds.has(e.column.id)?`text-right`:void 0,children:W(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]}),b.getPageCount()>1?(0,H.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[(0,H.jsx)(Ke,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.previousPage(),disabled:!b.getCanPreviousPage(),children:`Previous`}),(0,H.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Page `,f.pageIndex+1,` of `,b.getPageCount()]}),(0,H.jsx)(Ke,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.nextPage(),disabled:!b.getCanNextPage(),children:`Next`})]}):null]})})}var Is=20,Ls=24,Rs=40,zs=200,Bs=640;function Vs(e,t=Is){let n=[...e].filter(e=>e.submittedAt&&e.completedAt),r=n.length;return r<=t?{stages:n.sort((e,t)=>e.submittedAt-t.submittedAt),total:r,capped:!1}:{stages:[...n].sort((e,t)=>t.completedAt-t.submittedAt-(e.completedAt-e.submittedAt)).slice(0,t).sort((e,t)=>e.submittedAt-t.submittedAt),total:r,capped:!0}}function Hs({appModel:e,catalog:t}){let{openStage:n}=ot(),r=[...e.stages.values()].filter(e=>e.submittedAt&&e.completedAt),i=r.length,o=r.reduce((e,t)=>Math.min(e,t.submittedAt),1/0),s=e.app?.startTime??(Number.isFinite(o)?o:0),d=new Set(t.filter(e=>e.stageId!=null).map(e=>e.stageId)),m=Re(),[g,_]=(0,V.useState)(()=>m===`advanced`?i:Is),{stages:v}=Vs(r,g),y=St(v).map(e=>({stageId:e.id,label:`Stage ${e.id}`,wait:e.submittedAt-s,duration:e.completedAt-e.submittedAt,flagged:d.has(e.id)})),b=Math.min(Bs,Math.max(zs,y.length*Ls+Rs)),x=b-Rs,S=Math.max(1,Math.floor(x/Ls)),C=Math.max(1,Math.ceil(y.length/S));return(0,H.jsx)(I,{title:`Job Timeline`,summary:i>0?(0,H.jsx)(B,{value:`${i} stage${i===1?``:`s`}`,context:`${d.size} flagged`}):void 0,children:i===0?(0,H.jsx)(_t,{tone:`neutral`,icon:Me,title:`No stages in this run.`}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,H.jsx)(`label`,{htmlFor:`timeline-topn`,children:`showing top`}),(0,H.jsx)(`input`,{id:`timeline-topn`,type:`number`,min:1,max:i,value:Math.min(g,i),onChange:e=>{let t=parseInt(e.target.value,10);Number.isFinite(t)||(t=g),_(Math.max(1,Math.min(i,t)))},className:`w-16 rounded border border-input bg-transparent px-1 py-0.5`,"aria-label":`Number of stages to show`}),(0,H.jsxs)(`span`,{children:[`of `,i,` by duration · flagged in red`]})]}),(0,H.jsx)(k,{ariaLabel:`Job timeline: stage durations by time from app start.`,height:b,table:{caption:`Job timeline: stage durations by time from app start`,columns:[`Stage`,`Start`,`Duration`],rows:y.map(e=>[e.label,F(e.wait),F(e.duration)]),align:[`left`,`right`,`right`]},children:(0,H.jsxs)(l,{data:y,layout:`vertical`,children:[(0,H.jsx)(c,{stroke:A.muted,strokeOpacity:.2,horizontal:!1}),(0,H.jsx)(p,{type:`number`,tickFormatter:e=>`${Math.round(e/1e3)}s`,tick:{fontSize:10},tickCount:10}),(0,H.jsx)(f,{type:`category`,dataKey:`label`,tick:{fontSize:10},width:64,interval:0,tickFormatter:(e,t)=>t%C===0?e:``}),(0,H.jsx)(h,{formatter:(e,t)=>t===`Duration`?F(Number(e)):[null,null]}),(0,H.jsx)(u,{dataKey:`wait`,stackId:`timeline`,fill:`transparent`,name:`Wait`}),(0,H.jsx)(u,{dataKey:`duration`,stackId:`timeline`,name:`Duration`,cursor:`pointer`,onClick:e=>n(e.payload.stageId),children:y.map(e=>(0,H.jsx)(a,{fill:e.flagged?A.critical:A.accent,stroke:e.flagged?A.critical:`none`,strokeWidth:e.flagged?2:0},e.stageId))})]})})]})})}var Us={present:`present`,disabled:`disabled`,notEmitted:`not emitted`,notApplicable:`not applicable`,outsideEventLog:`outside event log`,unknown:`unknown`},Ws={present:`info`,disabled:`warning`,notEmitted:`warning`,notApplicable:`muted`,outsideEventLog:`muted`,unknown:`muted`};function Gs({entry:e}){let t=e.evidence?.count,n=E(),r=`${e.summary}${t==null?``:` · ${t} observed`}`,{tooltipProps:i,srOnlyTooltip:a}=ee(r);return(0,H.jsxs)(`li`,{id:`evidence-availability-${e.key}`,tabIndex:-1,ref:t=>n(e.key,t),className:`flex flex-col gap-0.5 rounded-md px-2 py-1 outline-none focus:ring-2 focus:ring-ring`,...i,children:[(0,H.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,H.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,H.jsx)(j,{impactBand:Ws[e.state]}),(0,H.jsx)(`span`,{className:`truncate text-sm font-medium`,children:oe(e.key)})]}),(0,H.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:Us[e.state]}),a]}),(0,H.jsx)(L,{children:(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:r})})]})}function Ks(e){return Object.keys(Us).map(t=>[t,e.filter(e=>e.state===t).length]).filter(([,e])=>e>0).map(([e,t])=>`${t} ${Us[e]}`).join(` · `)}function qs({ledger:e}){let{evidenceCardOpen:t,setEvidenceCardOpen:n}=te();return(0,H.jsx)(I,{title:`Evidence availability`,open:t,onOpenChange:n,summary:(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?Ks(e.entries):`Unavailable for this restored run`}),children:e?(0,H.jsx)(`ul`,{className:`grid grid-cols-1 gap-x-4 gap-y-0.5 sm:grid-cols-2`,"aria-label":`Evidence availability ledger`,children:e.entries.map(e=>(0,H.jsx)(Gs,{entry:e},e.key))}):(0,H.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Evidence availability is unavailable for this restored run.`})})}var Js=64;function Ys(e,t){return t>=1?e:`color-mix(in srgb, ${e} ${t*100}%, transparent)`}function Xs(e){return[{key:`startup`,label:`Startup`,value:e.startup,color:A.info,fillOpacity:1},{key:`stagesActive`,label:`Stages active`,value:e.stagesActive,color:A.clean,fillOpacity:1},{key:`gaps`,label:`Scheduler gaps`,value:e.gaps,color:A.warning,fillOpacity:1},{key:`idle`,label:`Idle`,value:e.idle,color:A.muted,fillOpacity:.6}].filter(e=>e.value>0).map(e=>({...e,legendColor:Ys(e.color,e.fillOpacity)}))}var Zs=(0,V.memo)(function({appModel:e}){let{app:n,stages:r}=e,a=Be(n,r);if(a.total<=0)return null;let o=Xs(a),s=e=>a.total>0?e/a.total*100:0,c=o.reduce((e,t)=>t.value>e.value?t:e,o[0]),d=[o.reduce((e,t)=>({...e,[t.key]:t.value}),{name:`total`})];return(0,H.jsxs)(I,{title:`Wall-Clock Breakdown`,badges:(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[F(a.total),` total`]}),summary:(0,H.jsx)(B,{value:`${c.label} ${Math.round(s(c.value))}%`,context:`of ${F(a.total)} total`}),children:[(0,H.jsx)(k,{ariaLabel:`Wall-clock breakdown: ${F(a.total)} total, split across startup, active stages, scheduler gaps and idle time. See the table below for exact values.`,height:Js,table:{caption:`Wall-clock time breakdown`,columns:[`Segment`,`Duration`,`% of total`],rows:o.map(e=>[e.label,F(e.value),`${Math.round(s(e.value))}%`]),align:[`left`,`right`,`right`]},children:(0,H.jsxs)(l,{data:d,layout:`vertical`,stackOffset:`expand`,margin:{top:0,right:0,bottom:0,left:0},children:[(0,H.jsx)(p,{type:`number`,hide:!0,domain:[0,1]}),(0,H.jsx)(f,{type:`category`,dataKey:`name`,hide:!0}),(0,H.jsx)(h,{shared:!1,labelFormatter:()=>``,formatter:(e,t)=>[F(Number(e)),t]}),(0,H.jsx)(i,{wrapperStyle:{fontSize:12},itemSorter:e=>o.findIndex(t=>t.key===e.dataKey),formatter:(e,t)=>{let n=o.find(e=>e.key===t.dataKey);return(0,H.jsx)(`span`,{style:{color:n?.color},children:e})},content:e=>(0,H.jsx)(t,{...e,payload:e.payload?.map(e=>{let t=o.find(t=>t.key===e.dataKey);return t?{...e,color:t.legendColor}:e})})}),o.map(e=>(0,H.jsx)(u,{dataKey:e.key,name:e.label,stackId:`wallclock`,fill:e.color,fillOpacity:e.fillOpacity},e.key))]})}),(0,H.jsx)(L,{children:(0,H.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground`,children:o.map(e=>(0,H.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,H.jsx)(`span`,{className:`inline-block size-2.5 rounded-sm`,style:{backgroundColor:e.color,opacity:e.fillOpacity}}),e.label,` (`,F(e.value),`)`]},e.key))})})]})}),Qs=36e5,$s=5,ec={totalCoreHours:null,usefulCoreHours:null,wastedCoreHours:null,totalCores:null,topStages:[]};function tc(e,t=[],n){if(!n||e?.startTime==null||e?.endTime==null)return ec;let r=e.endTime-e.startTime;if(r<=0)return ec;let i=Ye(e,t);if(i<=0)return ec;let a=i*r/Qs,o=(n.busyCoreMs??0)/Qs;return{totalCoreHours:a,usefulCoreHours:o,wastedCoreHours:Math.max(0,a-o),totalCores:i,topStages:Object.entries(n.perStage??{}).map(([e,t])=>({stageId:Number(e),coreMs:t?.totalTaskDurationSum??0})).sort((e,t)=>t.coreMs-e.coreMs).slice(0,$s)}}function nc({appModel:e}){let t=tc(e.app,e.executors.added,e.runAggregates);if(t.totalCoreHours==null)return null;let n=t.totalCoreHours>0?Math.round(t.wastedCoreHours/t.totalCoreHours*100):0;return(0,H.jsx)(I,{title:`Wasted Core-Hours`,statusBadge:(0,H.jsx)(fn,{}),defaultCollapsed:!0,summary:(0,H.jsx)(B,{value:(0,H.jsx)(`span`,{className:`whitespace-nowrap`,children:U(t.wastedCoreHours)}),context:`wasted of ${U(t.totalCoreHours)} allocated`}),children:(0,H.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,H.jsxs)(`p`,{children:[`Allocated: `,(0,H.jsx)(`strong`,{children:U(t.totalCoreHours)}),` · Used:`,` `,(0,H.jsx)(`strong`,{children:U(t.usefulCoreHours)})]}),(0,H.jsxs)(`p`,{children:[(0,H.jsx)(j,{impactBand:`info`}),` Wasted: `,(0,H.jsx)(`strong`,{children:U(t.wastedCoreHours)}),` (`,n,`% of allocated)`]}),(0,H.jsx)(L,{children:(0,H.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Allocated = `,t.totalCores,` cores over the run; used = core-time that actually ran tasks.`]})}),t.topStages.length>0&&(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Top stages by task core-time`}),(0,H.jsx)(`ul`,{className:`space-y-0.5`,children:t.topStages.map(e=>(0,H.jsxs)(`li`,{className:`flex justify-between gap-2`,children:[(0,H.jsxs)(`span`,{children:[`Stage `,e.stageId]}),(0,H.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:U(e.coreMs/36e5)})]},e.stageId))})]})]})})}function rc({appModel:e,catalog:t,getTaskData:n,activeFileId:r,onRoute:i}){return(0,H.jsxs)(`div`,{className:`space-y-6`,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Full app report`}),(0,H.jsx)(Zs,{appModel:e}),(0,H.jsx)(Hs,{appModel:e,catalog:t}),(0,H.jsx)(yn,{appModel:e,activeFileId:r}),(0,H.jsx)(Fs,{appModel:e,catalog:t,getTaskData:n,onRoute:i}),(0,H.jsxs)(st,{children:[(0,H.jsx)(R,{cardId:`reference-evidence-availability`,collapsedTile:!0,children:(0,H.jsx)(qs,{ledger:e.evidenceAvailability})}),(0,H.jsx)(R,{cardId:`reference-etl-phases`,collapsedTile:!0,children:(0,H.jsx)(gn,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-scaling-sim`,collapsedTile:!0,children:(0,H.jsx)(jn,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-efficiency-model`,collapsedTile:!0,children:(0,H.jsx)(pn,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-wasted-core-hours`,collapsedTile:!0,children:(0,H.jsx)(nc,{appModel:e})}),(0,H.jsx)(R,{cardId:`reference-core-usage-histogram`,collapsedTile:!0,children:(0,H.jsx)(cn,{appModel:e,getTaskData:n})})]})]})}function ic({appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,options:a,onRoute:o,activeTab:s,onActiveTabChange:c}){let{selection:l}=Xt(),u=(0,V.useMemo)(()=>Ht(t,l),[t,l]),d=(0,V.useMemo)(()=>Ht(n??[],l),[n,l]),f=u.length+d.length,p=t.length+(n??[]).length>0&&f===0;return(0,H.jsxs)(`main`,{className:`flex-1 space-y-6 p-4`,children:[(0,H.jsx)(nn,{options:a,resultCount:f}),p&&(0,H.jsx)(Zt,{}),(0,H.jsx)(Bn,{appModel:e,catalog:u}),!p&&(0,H.jsxs)(se,{value:s,onValueChange:e=>c(e),children:[(0,H.jsxs)(w,{variant:`chrome`,"aria-label":`Report view`,children:[(0,H.jsx)(ce,{value:`findings`,className:`tap-target-comfortable`,children:`Findings`}),(0,H.jsx)(ce,{value:`full-report`,className:`tap-target-comfortable`,children:`Full app report`})]}),(0,H.jsxs)(je,{value:`findings`,keepMounted:!0,children:[(0,H.jsx)(`h2`,{className:`sr-only`,children:`Findings`}),(0,H.jsx)(Cr,{appModel:e,catalog:u,configFindings:d,stages:e.stages,getTaskData:r,activeFileId:i,onRoute:o})]}),(0,H.jsx)(je,{value:`full-report`,keepMounted:!0,children:(0,H.jsx)(rc,{appModel:e,catalog:u,getTaskData:r,configFindings:d,activeFileId:i,onRoute:o})})]})]})}function ac(){let{resetToDropZone:e,startLoad:t,getTaskData:n}=Ve(),r=qe(e=>e.appModel),i=qe(e=>e.catalog),a=qe(e=>e.activeFileId),o=qe(e=>e.exportMode),{recentEntries:s,onPickRecent:c,onRemoveRecent:l}=Ee(a),[u,d]=(0,V.useState)(!1),[f,p]=(0,V.useState)(`findings`),{referenceOpen:m}=te(),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(null),[y,b]=(0,V.useState)(null),x=(0,V.useRef)(0),S=(0,V.useRef)(null),C=(0,V.useRef)(null),w=(0,V.useRef)(new Map),ee=(0,V.useRef)(new Map),T=(0,V.useRef)(null),ne=h?.target??null;(0,V.useEffect)(()=>()=>{T.current&&clearTimeout(T.current)},[]),(0,V.useEffect)(()=>{m&&p(`full-report`)},[m]);let E=(0,V.useCallback)(e=>{S.current?.token===e&&(S.current=null,C.current=null,g(t=>t?.token===e?null:t))},[]),D=(0,V.useCallback)(e=>{if(S.current?.token!==e.token)return null;let{catalog:t,activeFileId:n}=Ue.getState();if(C.current!==n)return null;let r=tr(e.target.finding,t);return!r||r.widgetId!==e.target.widgetId||r.region!==e.target.region?null:r},[]),re=(0,V.useCallback)(e=>{p(`findings`);let t=x.current+1;x.current=t;let{catalog:n,activeFileId:r}=Ue.getState(),i=tr(e.finding,n);if(!i||i.widgetId!==e.widgetId||i.region!==e.region){S.current=null,C.current=null,g(null);return}let a={target:i,token:t};S.current=a,C.current=r,g(a)},[]),ie=(0,V.useCallback)((e,t)=>{w.current.set(e,t);let n=S.current;return n?.target.widgetId===e&&D(n)&&t.open(),()=>{w.current.get(e)===t&&w.current.delete(e)}},[D]),ae=(0,V.useCallback)((e,t)=>(ee.current.set(e,t),()=>{ee.current.get(e)===t&&ee.current.delete(e)}),[]),oe=(0,V.useCallback)((e,t)=>{if(!t)return;let n=S.current;if(!n||n.target.widgetId!==e)return;let r=D(n);if(!r){E(n.token);return}let i=w.current.get(e);if(!i)return;let a=i.getDisclosureButton();if(!a){E(n.token);return}let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=ee.current.get(r.finding);s?(s.scrollIntoView({behavior:o?`auto`:`smooth`,block:`center`,inline:`nearest`}),s.focus({preventScroll:!0}),T.current&&clearTimeout(T.current),b(r.finding),T.current=setTimeout(()=>{T.current=null,b(null)},2e3)):(i.wrapperElement.scrollIntoView({behavior:o?`auto`:`smooth`,block:`start`,inline:`nearest`}),a.focus({preventScroll:!0}),v(e)),E(n.token)},[E,D]),se=(0,V.useCallback)(e=>{v(t=>t===e?null:t)},[]);(0,V.useLayoutEffect)(()=>{if(!h)return;let e=D(h);if(!e){E(h.token);return}w.current.get(e.widgetId)?.open()},[E,D,h]),(0,V.useLayoutEffect)(()=>{let e=S.current;e&&!D(e)&&E(e.token)},[a,i,E,D]);let O=qe(e=>e.configFindings),k=(0,V.useMemo)(()=>Ut(i,O),[i,O]);return(0,H.jsxs)(`div`,{"data-testid":`dashboard`,className:`relative flex min-h-screen flex-col`,style:{paddingRight:`var(--docs-inset, 0px)`},onDragOver:e=>{o||(e.preventDefault(),d(!0))},onDragLeave:()=>d(!1),onDrop:e=>{if(o)return;e.preventDefault(),d(!1);let n=e.dataTransfer.files[0];n&&t(n)},children:[(0,H.jsx)(xe,{onLoadNew:e,recentEntries:s,activeFileId:a,onPickRecent:c,onRemoveRecent:l}),(0,H.jsx)(Yt,{options:k,fileId:a,children:(0,H.jsx)(Qe,{registerWidget:ie,registerFindingAnchor:ae,reportWidgetOpen:oe,clearRouteFocus:se,focusedWidgetId:_,activeRouteTarget:ne,flashedFinding:y,children:(0,H.jsx)(ic,{appModel:r,catalog:i,configFindings:O,getTaskData:n,activeFileId:a,options:k,onRoute:re,activeTab:f,onActiveTabChange:p})})}),(0,H.jsx)(Nr,{appModel:r,catalog:i,getTaskData:n}),u&&(0,H.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 z-50 flex items-center justify-center bg-background/80`,children:(0,H.jsx)(`p`,{className:`rounded-lg border-2 border-dashed border-primary px-6 py-4 text-lg font-medium`,children:`Drop to load a new event log`})})]})}function oc(){return(0,H.jsx)(ie,{children:(0,H.jsx)(ac,{})})}export{oc as Dashboard};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-Dt6V9yVw.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-Bl1hRK5E.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BhPky1lW.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O,groupConfidence:k}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`duplicatePlanSubtree`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e})),groupConfidence:t.every(e=>e.confidence===t[0]?.confidence)?t[0]:void 0}},[e]),A=p(D,e=>[e],h),j=c(),M=j?A.findIndex(e=>e===j.finding):null,{totalPages:N,effectivePage:P,visible:F}=y(A,T,E,M);return D.length===0?null:(0,C.jsxs)(o,{title:`Redundant Plan Subtree`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`duplicatePlanSubtree`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:k?.confidence,validationRequired:k?.validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:F.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:P,totalPages:N,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as DuplicatePlanSubtree};
@@ -0,0 +1 @@
1
+ import{f as e,i as t,l as n,o as r,p as i,s as a,v as o}from"./charts-vendor-0VMaLVLN.js";import{p as s}from"./plan-graph-vendor-B0sEms9Z.js";import{T as c,w as l}from"./useRecentFiles-BiYdWs8J.js";import{Pt as u,lt as d}from"./index-U654cmB8.js";function f(e){let t=u(e=>e.exportMode);return{exportMode:t,getTaskData:t?void 0:e}}var p=s(),m=5,h=30,g=220;function _(e,t){if(e.length<2)return e[0]??null;let n=e[1]-e[0],r=Math.round((t-e[0])/n);return e[Math.min(e.length-1,Math.max(0,r))]}function v({metrics:s,fieldNames:u,markers:f={}}){let v=u.indexOf(`duration`);if(v===-1)return null;let y=u.length,b=s.length/y,x=[];for(let e=0;e<b;e++)x.push(s[e*y+v]);if(x.length<m)return(0,p.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Too few tasks (`,x.length,`) for a distribution.`]});let{labels:S,data:C}=d(x,h),w=S[1]-S[0],T=S.map((e,t)=>({bin:`${(e/1e3).toFixed(1)}s`,range:`${(e/1e3).toFixed(1)}s – ${((e+w)/1e3).toFixed(1)}s`,ms:e,count:C[t]})),E=f.p50==null?null:_(S,f.p50),D=f.p95==null?null:_(S,f.p95),O=E==null?void 0:T.find(e=>e.ms===E)?.bin,k=D==null?void 0:T.find(e=>e.ms===D)?.bin;return(0,p.jsx)(c,{title:`Task duration`,ariaLabel:`Task duration histogram`,height:g,table:{caption:`Task duration histogram`,columns:[`Duration bin`,`Task count`],rows:T.map(e=>[e.range,e.count]),align:[`right`,`right`]},children:(0,p.jsxs)(t,{data:T,children:[(0,p.jsx)(e,{vertical:!1,stroke:l.muted,strokeOpacity:.2}),(0,p.jsx)(a,{dataKey:`bin`,tick:{fontSize:10}}),(0,p.jsx)(r,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,p.jsx)(o,{formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Count`],labelFormatter:(e,t)=>t?.[0]?.payload?.range??e}),(0,p.jsx)(n,{dataKey:`count`,name:`Tasks`,fill:l.accent}),O?(0,p.jsx)(i,{x:O,stroke:l.accent,label:`P50`}):null,k?(0,p.jsx)(i,{x:k,stroke:l.warning,label:`P95`}):null]})})}export{f as n,v as t};
@@ -0,0 +1 @@
1
+ import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{Lt as t}from"./index-U654cmB8.js";var n=e(),r={clean:{box:`border-clean/40 bg-clean/10`,icon:`text-clean`,title:`text-clean`},neutral:{box:`border-border/60 bg-muted/40`,icon:`text-muted-foreground`,title:`text-foreground`}};function i({icon:e,tone:i=`neutral`,title:a,description:o,action:s,className:c}){let l=r[i];return(0,n.jsxs)(`div`,{className:t(`flex items-start gap-3 rounded-xl border p-4`,l.box,c),children:[(0,n.jsx)(e,{"aria-hidden":`true`,className:t(`mt-0.5 size-4 shrink-0`,l.icon)}),(0,n.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,n.jsx)(`p`,{className:t(`text-sm font-medium`,l.title),children:a}),o?(0,n.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:o}):null]}),s]})}export{i as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{D as r,O as i,bt as a,ht as o,i as s,l as c,ot as l,pt as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as f}from"./ImpactEstimate-BHcqJkcZ.js";import{t as p}from"./RowPagination-oeWB8gBm.js";import{n as m}from"./finding-anchor-Bl1hRK5E.js";import{t as h}from"./usePagedRows-jNUWgVTD.js";var g=e(t(),1),_=n();function v({finding:e}){let t=m([e]);return(0,_.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,_.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,_.jsx)(r,{impactBand:e.impactBand,className:`mt-1.5`}),(0,_.jsx)(`strong`,{children:u(`pct`,o(e))}),` average executor utilization`]}),(0,_.jsx)(f,{finding:e}),(0,_.jsx)(`p`,{children:e.recommendation})]})}var y=(0,g.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,r]=(0,g.useState)(0),f=(0,g.useMemo)(()=>e.filter(e=>e.type===`utilization`).slice().sort((e,t)=>l[e.impactBand]-l[t.impactBand]),[e]),m=c(),y=m?f.findIndex(e=>e===m.finding):null,{totalPages:b,effectivePage:x,visible:S}=h(f,n,r,y);return f.length===0?null:(0,_.jsxs)(s,{title:`Executor Utilization`,impactBand:a(f),badges:(0,_.jsx)(i,{type:`utilization`,impactBand:a(f)??`info`}),defaultCollapsed:t,summary:(0,_.jsx)(d,{value:`${u(`pct`,o(f[0]))} average`,context:`${f.length} item${f.length===1?``:`s`} flagged`}),children:[(0,_.jsx)(`div`,{className:`space-y-2 text-sm`,children:S.map(e=>(0,_.jsx)(v,{finding:e},e.id))}),(0,_.jsx)(p,{page:x,totalPages:b,onPrev:()=>r(e=>e-1),onNext:()=>r(e=>e+1)})]})});export{y as ExecutorUtilization};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,dt as o,i as s,k as c,l}from"./index-U654cmB8.js";import{t as u}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as d}from"./ImpactEstimate-BHcqJkcZ.js";import{t as f}from"./RowPagination-oeWB8gBm.js";import{r as p}from"./impact-sort-DxaUheWV.js";import{n as m,t as h}from"./finding-anchor-Bl1hRK5E.js";import{t as g}from"./usePagedRows-jNUWgVTD.js";import{n as _,t as v}from"./useSortMode-BhPky1lW.js";import{t as y}from"./StageHeader-DibMSunO.js";var b=e(t(),1),x=n(),S=`GC % = total JVM GC time ÷ total executor run time; it can exceed 100% when GC pauses overlap many concurrent task threads.`;function C(e){return[...e].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))}function w({finding:e,appModel:t}){let n=m([e]),i=(e.stageId==null?void 0:t.stages.get(e.stageId))?.executorRunTime;return(0,x.jsxs)(`li`,{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-2 ${h} transition-colors ${n.flashClassName}`,children:[(0,x.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,x.jsx)(y,{stageId:e.stageId,appModel:t}),(0,x.jsx)(c,{children:(0,x.jsx)(r,{confidence:e.confidence,validationRequired:e.validationRequired})})]}),(0,x.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`GC: `,(0,x.jsxs)(`strong`,{children:[e.value,`%`]}),` · Executor run time:`,` `,(0,x.jsx)(`strong`,{children:o(i??0)})]}),(0,x.jsx)(d,{finding:e}),(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.recommendation})]})}function T({title:e,findings:t,appModel:n,page:r,setPage:i,routeTarget:a,orderBy:o}){let s=o(C(t),e=>[e],e=>e.stageId),c=a?s.findIndex(e=>e===a.finding):null,{totalPages:l,effectivePage:u,visible:d}=g(s,r,i,c);return(0,x.jsxs)(`section`,{className:`space-y-2`,children:[(0,x.jsxs)(`h4`,{className:`font-heading text-sm font-medium`,children:[e,` · `,t.length,` stage`,t.length===1?``:`s`]}),(0,x.jsx)(`ul`,{className:`space-y-3`,children:d.map(e=>(0,x.jsx)(w,{finding:e,appModel:n},e.stageId))}),(0,x.jsx)(f,{page:u,totalPages:l,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1)})]})}function E({catalog:e,appModel:t,defaultCollapsed:n=!0}){let[r,o]=(0,b.useState)(0),[d,f]=(0,b.useState)(0),{sortMode:m,setSortMode:h,orderBy:g}=v(),[y,C]=(0,b.useState)(!n),w=l(),E=(0,b.useRef)(!1);(0,b.useEffect)(()=>{if(!E.current){E.current=!0;return}o(0),f(0)},[t]);let D=e.filter(e=>e.type===`gc`);if(D.length===0)return null;let O=D.filter(e=>e.direction!==`low`),k=D.filter(e=>e.direction===`low`),A=a(D),j=[...D].sort((e,t)=>(typeof t.value==`number`?t.value:0)-(typeof e.value==`number`?e.value:0))[0];return(0,x.jsx)(s,{title:`GC Pressure`,impactBand:A,badges:(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(i,{type:`gc`,impactBand:A??`info`}),p(D,D.length,y)?(0,x.jsx)(_,{mode:m,onChange:e=>{h(e),o(0),f(0)}}):null]}),defaultCollapsed:n,open:y,onOpenChange:C,summary:(0,x.jsx)(u,{value:`${j.value}%`,context:`${D.length} stage${D.length===1?``:`s`} flagged`}),children:(0,x.jsxs)(`div`,{className:`space-y-4`,children:[(0,x.jsx)(c,{children:(0,x.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:S})}),O.length>0&&(0,x.jsx)(T,{title:`GC overhead`,findings:O,appModel:t,page:r,setPage:o,routeTarget:w,orderBy:g}),k.length>0&&(0,x.jsx)(T,{title:`Low GC (cost)`,findings:k,appModel:t,page:d,setPage:f,routeTarget:w,orderBy:g})]})})}export{E as GcPressure};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{dt as r,ut as i}from"./index-U654cmB8.js";var a=e(t(),1),o=n();function s(e){return e===0?`0s`:r(e)}function c(e,t){let n=s(e),r=s(t);return n===r?r:`${n}-${r}`}function l(e){let t=Math.round(e.value*10)/10;switch(e.unit){case`bytes`:return i(e.value);case`ms`:return s(e.value);case`mbSeconds`:return`${t.toLocaleString(`en-US`)} MB-s`;case`coreHours`:return`${t.toFixed(1)} core-h`;case`coreMs`:return`${t.toLocaleString(`en-US`)} core-ms`;default:return String(e.value)}}function u(e){return/^0(\.0+)?(?:[^0-9.]|$)/.test(e)}function d(e){if(!e)return null;if(e.wallClock){if(e.wallClock.high<=0)return null;let t=s(e.wallClock.high);return u(t)?null:t}if(e.rawWaste){if(e.rawWaste.value<=0)return null;let t=l(e.rawWaste);return u(t)?null:t}return null}function f({finding:e}){let t=(0,a.useId)(),n=e.impactEstimate;if(!n)return null;let r=n.wallClock&&n.wallClock.high>0?s(n.wallClock.high):null,i=r&&!u(r)?c(n.wallClock.low,n.wallClock.high):null,d=n.rawWaste&&n.rawWaste.value>0?l(n.rawWaste):null,f=!i&&d&&!u(d)?d:null,p=i??f;if(!p)return null;let m=`Estimate method: ${n.estimateMethod}`;return(0,o.jsxs)(`span`,{className:`impact-estimate text-xs text-muted-foreground`,title:m,tabIndex:0,"aria-describedby":t,children:[`Potential savings: `,(0,o.jsx)(`strong`,{children:p}),(0,o.jsx)(`span`,{id:t,className:`sr-only`,children:m})]})}export{c as i,d as n,l as r,f as t};
@@ -0,0 +1 @@
1
+ import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n}from"./index-U654cmB8.js";import{t as r}from"./ImpactEstimate-BHcqJkcZ.js";var i=e();function a({finding:e}){let{recommendation:t}=e;return(0,i.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,i.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`ApplicationEnd event: `,(0,i.jsx)(`strong`,{children:`missing`})]}),(0,i.jsx)(r,{finding:e}),(0,i.jsxs)(`div`,{className:`space-y-1 pt-1`,children:[(0,i.jsx)(`p`,{children:`This run’s event log never recorded an ApplicationEnd event.`}),t?(0,i.jsx)(`p`,{children:t}):null]})]})}function o({catalog:e,defaultCollapsed:r=!0}){let o=e.find(e=>e.type===`incompleteRun`);if(!o)return null;let{impactBand:s}=o;return(0,i.jsx)(n,{title:`Incomplete Run`,impactBand:s,badges:(0,i.jsx)(t,{type:`incompleteRun`,impactBand:s}),defaultCollapsed:r,children:(0,i.jsx)(a,{finding:o})})}export{o as IncompleteRun};
@@ -0,0 +1 @@
1
+ import{p as e}from"./plan-graph-vendor-B0sEms9Z.js";import{O as t,i as n,k as r}from"./index-U654cmB8.js";import{t as i}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as a}from"./ImpactEstimate-BHcqJkcZ.js";var o=e();function s({finding:e}){let t=e.failedJobs,n=e.totalJobs,i=e.failedTasks,s=e.totalTasks,c=e.taskFailureRate,{value:l,recommendation:u}=e;return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1 transition-colors`,children:[(0,o.jsxs)(`p`,{children:[`Failure rate: `,(0,o.jsxs)(`strong`,{children:[l,`%`]}),` (`,t,` of `,n,` completed jobs)`]}),(0,o.jsx)(r,{children:(0,o.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Task-failure context: `,i,` of `,s,` tasks failed (`,c,`%).`]})}),(0,o.jsx)(a,{finding:e}),u?(0,o.jsx)(`p`,{children:u}):null]})}function c({catalog:e,defaultCollapsed:r=!0}){let a=e.find(e=>e.type===`jobFailureRate`);if(!a)return null;let{impactBand:c,value:l}=a,u=a.failedJobs,d=a.totalJobs;return(0,o.jsx)(n,{title:`Job Failures`,impactBand:c,badges:(0,o.jsx)(t,{type:`jobFailureRate`,impactBand:c}),defaultCollapsed:r,summary:(0,o.jsx)(i,{value:`${l}%`,context:`${u} of ${d} completed jobs failed`}),children:(0,o.jsx)(s,{finding:a})})}export{c as JobFailures};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r,b as i}from"./useRecentFiles-BiYdWs8J.js";import{D as a,O as o,bt as s,ht as c,i as l,k as u,l as d,ot as f,pt as p}from"./index-U654cmB8.js";import{t as m}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as h}from"./ImpactEstimate-BHcqJkcZ.js";import{t as g}from"./RowPagination-oeWB8gBm.js";import{n as _}from"./finding-anchor-Bl1hRK5E.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";var y=e(t(),1),b=n();function x(e){let t=c(e),n=p(`pct`,t);return e.variant===`idleCores`?`${n} of allocated core-time idle`:e.variant===`memoryBand`?e.rule===`heapNearCapacity`?`${n} of allocated heap used: near capacity`:`${n} of allocated heap used: over-provisioned`:`~${t.toLocaleString(`en-US`)} MB-seconds wasted`}function S(e){let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?` ${t}`:`; ${t.slice(n+2)}`}function C(e){if(e.rule==null)return null;let t=e.recommendation??``,n=t.indexOf(`: `);return n===-1?null:` ${t.slice(0,n)}.`}function w(e){return`executorId`in e&&e.executorId!=null?`Executor ${e.executorId}`:e.variant===`idleCores`?`Idle cores`:`Memory waste`}function T({finding:e}){let t=_([e]);return e.dataUnavailable?(0,b.jsx)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:(0,b.jsx)(u,{children:(0,b.jsx)(`p`,{className:`text-muted-foreground`,children:e.recommendation})})}):(0,b.jsxs)(`div`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,b.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2`,children:[(0,b.jsx)(a,{impactBand:e.impactBand,className:`mt-1.5`}),(0,b.jsx)(`strong`,{children:w(e)})]}),(0,b.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[x(e),S(e),C(e)==null?null:(0,b.jsx)(u,{children:C(e)})]}),(0,b.jsx)(h,{finding:e})]})}var E=(0,y.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,a]=(0,y.useState)(0),{findings:c,groupConfidence:p}=(0,y.useMemo)(()=>{let t=e.filter(e=>e.type===`memoryUtilization`).sort((e,t)=>f[e.impactBand]-f[t.impactBand]),n=t.filter(i);return{findings:t,groupConfidence:n.every(e=>e.confidence===n[0]?.confidence)?n[0]:void 0}},[e]),h=d(),_=h?c.findIndex(e=>e===h.finding):null,{totalPages:x,effectivePage:S,visible:C}=v(c,n,a,_);if(!c.some(i))return null;let E=c.find(e=>!e.dataUnavailable)??c[0];return(0,b.jsxs)(l,{title:`Memory Utilization`,impactBand:s(c),badges:(0,b.jsx)(o,{type:`memoryUtilization`,impactBand:s(c)??`info`}),statusBadge:(0,b.jsx)(u,{children:(0,b.jsx)(r,{confidence:p?.confidence,validationRequired:p?.validationRequired,evidenceKey:`executorMetrics`})}),defaultCollapsed:t,summary:(0,b.jsx)(m,{value:w(E),context:`${c.length} item${c.length===1?``:`s`} flagged`}),children:[(0,b.jsx)(`div`,{className:`space-y-2 text-sm`,children:C.map(e=>(0,b.jsx)(T,{finding:e},e.id))}),(0,b.jsx)(g,{page:S,totalPages:x,onPrev:()=>a(e=>e-1),onNext:()=>a(e=>e+1)})]})});export{E as MemoryUtilization};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{S as r}from"./useRecentFiles-BiYdWs8J.js";import{O as i,bt as a,i as o,k as s,l as c,ot as l,r as u}from"./index-U654cmB8.js";import{t as d}from"./WidgetLeadSummary-BdUUi7L5.js";import{n as f}from"./StagePill-Dt6V9yVw.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{i as h,r as g}from"./impact-sort-DxaUheWV.js";import{n as _,t as v}from"./finding-anchor-Bl1hRK5E.js";import{t as y}from"./usePagedRows-jNUWgVTD.js";import{n as b,t as x}from"./useSortMode-BhPky1lW.js";var S=e(t(),1),C=n();function w({finding:e}){let t=_([e]);return(0,C.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-2 ${v} transition-colors ${t.flashClassName}`,children:[e.stageIds&&e.stageIds.length>0?(0,C.jsx)(f,{pills:e.stageIds.map(e=>({id:e}))}):null,(0,C.jsxs)(`p`,{children:[e.recommendation,` `,(0,C.jsx)(p,{finding:e})]})]})}var T=(0,S.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:n,setSortMode:f,orderBy:p}=x(),[_,v]=(0,S.useState)(!t),[T,E]=(0,S.useState)(0),{findings:D,pills:O}=(0,S.useMemo)(()=>{let t=e.filter(e=>e.type===`overBroadcast`).sort((e,t)=>l[e.impactBand]-l[t.impactBand]);return{findings:t,pills:[...new Set(t.flatMap(e=>e.stageIds??[]))].map(e=>({id:e}))}},[e]),k=p(D,e=>[e],h),A=c(),j=A?k.findIndex(e=>e===A.finding):null,{totalPages:M,effectivePage:N,visible:P}=y(k,T,E,j);return D.length===0?null:(0,C.jsxs)(o,{title:`Oversized Broadcast Join`,impactBand:a(D),open:_,onOpenChange:v,badges:(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(i,{type:`overBroadcast`,impactBand:a(D)??`info`,className:u}),g(D,D.length,_)?(0,C.jsx)(b,{mode:n,onChange:f}):null]}),statusBadge:(0,C.jsx)(s,{children:(0,C.jsx)(r,{confidence:D[0].confidence,validationRequired:D[0].validationRequired,evidenceKey:`sqlPlan`})}),summary:(0,C.jsx)(d,{value:`${O.length} stage${O.length===1?``:`s`}`,context:`${D.length} finding${D.length===1?``:`s`} flagged`}),children:[(0,C.jsx)(`ul`,{className:`space-y-3 text-sm`,children:P.map(e=>(0,C.jsx)(w,{finding:e},e.id))}),(0,C.jsx)(m,{page:N,totalPages:M,onPrev:()=>E(e=>e-1),onNext:()=>E(e=>e+1)})]})});export{T as OverBroadcast};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r}from"./useRecentFiles-BiYdWs8J.js";import{Ft as i,O as a,bt as o,ht as s,i as c,l,ot as u,ut as d}from"./index-U654cmB8.js";import{t as f}from"./WidgetLeadSummary-BdUUi7L5.js";import{t as p}from"./ImpactEstimate-BHcqJkcZ.js";import{t as m}from"./RowPagination-oeWB8gBm.js";import{r as h}from"./impact-sort-DxaUheWV.js";import{n as g,t as _}from"./finding-anchor-Bl1hRK5E.js";import{t as v}from"./usePagedRows-jNUWgVTD.js";import{n as y,t as b}from"./useSortMode-BhPky1lW.js";import{t as x}from"./StageHeader-DibMSunO.js";import{a as S,i as C,n as w,r as T,t as E}from"./select-CtKaJ5Hx.js";import{t as D}from"./PlanExplorer-DSk1ivS4.js";var O=e(t(),1),k=n();function A(e){if(e.rule===`lowShuffleParallelism`)return`${s(e)} tasks carrying the shuffle`;let t=s(e);return e.rule===`maxPartitionTooBig`?`Largest partition ${d(t)} (too large)`:`Largest partition ${d(t)}`}function j({entry:e,appModel:t}){let n=i(),a=g(e.partitions),o=n===`advanced`&&r(e.stageId,t);return(0,k.jsxs)(`div`,{ref:a.ref,tabIndex:a.tabIndex,"data-flashed":a.dataFlashed,className:`space-y-2 ${_} transition-colors ${a.flashClassName}`,children:[(0,k.jsx)(x,{stageId:e.stageId,appModel:t}),(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.partitions.map((e,t)=>(0,k.jsxs)(`span`,{children:[t>0?` · `:``,A(e)]},e.id))}),(0,k.jsx)(p,{finding:e.partitions[0]}),(0,k.jsxs)(`div`,{className:`space-y-2 pt-1`,children:[(0,k.jsx)(`ul`,{className:`list-disc space-y-1 pl-5 text-xs text-muted-foreground`,children:e.partitions.map(e=>(0,k.jsxs)(`li`,{children:[e.recommendation,` `,(0,k.jsx)(p,{finding:e})]},e.id))}),o?(0,k.jsx)(D,{stageId:e.stageId,appModel:t}):null]})]})}var M=(0,O.memo)(function({appModel:e,catalog:t,defaultCollapsed:n=!0}){let[r,i]=(0,O.useState)(0),[s,d]=(0,O.useState)(!n),{sortMode:p,setSortMode:g,orderBy:_}=b(),x=l(),{partitionFindings:D,sorted:A,orderedEntries:M}=(0,O.useMemo)(()=>{let e=t.filter(e=>e.type===`partitionSizing`),n=new Map;for(let t of e){if(t.stageId==null)continue;let e=n.get(t.stageId);e?(e.partitions.push(t),u[t.impactBand]<u[e.impactBand]&&(e.impactBand=t.impactBand)):n.set(t.stageId,{stageId:t.stageId,partitions:[t],impactBand:t.impactBand})}let r=[...n.values()].sort((e,t)=>u[e.impactBand]-u[t.impactBand]||e.stageId-t.stageId);return{partitionFindings:e,sorted:r,orderedEntries:_(r,e=>e.partitions,e=>e.stageId)}},[t,p]),N=x?M.findIndex(e=>e.partitions.includes(x.finding)):null,{totalPages:P,effectivePage:F,visible:I}=v(M,r,i,N);if(D.length===0){let t=e.stages.size;return(0,k.jsx)(c,{title:`Partition Sizing`,open:s,onOpenChange:d,summary:(0,k.jsx)(f,{value:`No issues`,context:`no issue detected: partition sizing checked across ${t} stage${t===1?``:`s`}`}),children:(0,k.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No partition-sizing issues detected.`})})}let L=o(D),R=h(D,A.length,s);return(0,k.jsx)(c,{title:`Partition Sizing`,impactBand:L,open:s,onOpenChange:d,summary:(0,k.jsx)(f,{value:`Stage ${A[0].stageId}`,context:`${A.length} stage${A.length===1?``:`s`} flagged`}),badges:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(a,{type:`partitionSizing`,impactBand:L??`info`}),R?(0,k.jsx)(y,{mode:p,onChange:e=>{g(e),i(0)}}):null]}),children:(0,k.jsxs)(`div`,{className:`space-y-4`,children:[I.map(t=>(0,k.jsx)(j,{entry:t,appModel:e},t.stageId)),(0,k.jsx)(m,{page:F,totalPages:P,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1),renderJumpControl:()=>(0,k.jsxs)(E,{value:String(F*6),onValueChange:e=>i(Math.floor(Number(e)/6)),children:[(0,k.jsx)(C,{size:`sm`,"aria-label":`Jump to stage`,children:(0,k.jsx)(S,{placeholder:`Jump to stage`})}),(0,k.jsx)(w,{children:M.map((e,t)=>(0,k.jsxs)(T,{value:String(t),children:[`Stage `,e.stageId]},e.stageId))})]})})]})})});export{M as PartitionSizing};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{p as n}from"./plan-graph-vendor-B0sEms9Z.js";import{i as r,r as i}from"./useRecentFiles-BiYdWs8J.js";import{C as a,Ot as o,S as s,kt as c,x as l}from"./index-U654cmB8.js";var u=e(t(),1),d=n();function f({stageId:e,appModel:t}){let[n,f]=(0,u.useState)(!1);return r(e,t)?(0,d.jsx)(`div`,{className:`space-y-3`,children:(0,d.jsxs)(l,{open:n,onOpenChange:f,children:[(0,d.jsxs)(a,{"aria-expanded":String(n),className:`flex cursor-pointer items-center gap-2 bg-transparent text-left`,children:[(0,d.jsx)(`h3`,{className:`font-heading text-sm font-medium`,children:`Plan context`}),n?(0,d.jsx)(o,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,d.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]}),(0,d.jsx)(s,{keepMounted:!0,children:(0,d.jsx)(`div`,{className:`pt-3`,children:(0,d.jsx)(i,{stageId:e,appModel:t})})})]})}):null}export{f as t};