sparkforensics-server 0.5.2 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/assets/AutoscalingChurn-CRA2Mb7F.js +1 -0
- package/public/assets/CacheUtilization-Bh9OY_V9.js +1 -0
- package/public/assets/{CachingOpportunity-D1NcHs0V.js → CachingOpportunity-oCiQwmTJ.js} +1 -1
- package/public/assets/{ColdStart-CdRJ9gD8.js → ColdStart-BJrtjfmn.js} +1 -1
- package/public/assets/ConfigAudit-DMvKxySP.js +1 -0
- package/public/assets/{CoreUsageArea-a--NTRGY.js → CoreUsageArea-REC2zsKw.js} +1 -1
- package/public/assets/Dashboard-BHZ76JCu.js +2 -0
- package/public/assets/DisclosureContext-OO7X1HAx.js +1 -0
- package/public/assets/{DuplicatePlanSubtree-dobXdz7E.js → DuplicatePlanSubtree-BgG-L-cK.js} +1 -1
- package/public/assets/ExecutorUtilization-D2KhSVbY.js +1 -0
- package/public/assets/{GcPressure-8-G2ri10.js → GcPressure-D1BTE8qh.js} +1 -1
- package/public/assets/{IncompleteRun-B91lky7a.js → IncompleteRun-DD40xUpy.js} +1 -1
- package/public/assets/{JobFailures-BsWvBMyJ.js → JobFailures-YwNzCF19.js} +1 -1
- package/public/assets/MemoryUtilization-9b8ee_3_.js +1 -0
- package/public/assets/{OverBroadcast-DdN8JIJH.js → OverBroadcast-CfctS8a8.js} +1 -1
- package/public/assets/{PartitionSizing-CY5HDYtp.js → PartitionSizing-VG8kBgG5.js} +1 -1
- package/public/assets/{PlanExplorer-DgHCDBD_.js → PlanExplorer-DmubTAOP.js} +1 -1
- package/public/assets/PlanGraphRoute-DctPZjS0.js +1 -0
- package/public/assets/RetryWaste-CnpM8bB7.js +1 -0
- package/public/assets/{ShuffleIO-MMnDESkF.js → ShuffleIO-D13vGmas.js} +1 -1
- package/public/assets/Skew-DlagstYP.js +1 -0
- package/public/assets/SlowHost-cSkLRZ_e.js +1 -0
- package/public/assets/{SmallFiles-BoK3R1Ex.js → SmallFiles-B-kERMcq.js} +1 -1
- package/public/assets/{SpeculationWaste-CnVxB5AJ.js → SpeculationWaste-DaysAzXO.js} +1 -1
- package/public/assets/Spill-H44Gz4US.js +1 -0
- package/public/assets/{StageFailed-mAhHU4l_.js → StageFailed-DCfii9h_.js} +1 -1
- package/public/assets/{StageFindingGroup-BEtPWcT0.js → StageFindingGroup-BXJ0Mj5n.js} +1 -1
- package/public/assets/{StageHeader-DJkYkrsU.js → StageHeader--oN2J-oD.js} +1 -1
- package/public/assets/StageShape-IZ80CZiJ.js +1 -0
- package/public/assets/{StageSlowness-BPRw-otN.js → StageSlowness--BRIaBc1.js} +1 -1
- package/public/assets/Straggler-Ctq0Df_o.js +1 -0
- package/public/assets/TaskFailures-Bks_gqhL.js +1 -0
- package/public/assets/{TinyTask-Bi84qU7n.js → TinyTask-BssfzGFB.js} +1 -1
- package/public/assets/{UnderBroadcast-DdQV7htE.js → UnderBroadcast-DsScrxc-.js} +1 -1
- package/public/assets/{finding-anchor-Cl6_5hfV.js → finding-anchor-BYW1oz5R.js} +1 -1
- package/public/assets/{impact-sort-CssZ6MT2.js → impact-sort-xzy0g-Vh.js} +1 -1
- package/public/assets/index-DhpRGMZc.css +2 -0
- package/public/assets/index-DwqkFUFk.js +14 -0
- package/public/assets/instrument-sans-latin-ext-wdth-normal-C5E2Gvlv.woff2 +0 -0
- package/public/assets/instrument-sans-latin-wdth-normal-BVScPF0l.woff2 +0 -0
- package/public/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/public/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/public/assets/react-vendor-DfpuPQZf.js +9 -0
- package/public/assets/{select-CQjNhprm.js → select-C8edjYTq.js} +1 -1
- package/public/assets/{usePagedRows-Dyl6T8Ok.js → usePagedRows-CsuUFeYx.js} +1 -1
- package/public/assets/useRecentFiles-BvkKo3JN.js +11 -0
- package/public/assets/{useSortMode-Dhvit8dt.js → useSortMode-joX71BZN.js} +1 -1
- package/public/docs/404.html +3 -7
- package/public/docs/assets/{app.eYTPqTeq.js → app.CnWL6bKV.js} +1 -1
- package/public/docs/assets/chunks/@localSearchIndexroot.tE5pz54z.js +1 -0
- package/public/docs/assets/chunks/{VPLocalSearchBox.DsZrQKQR.js → VPLocalSearchBox.C0IBKeRQ.js} +1 -1
- package/public/docs/assets/chunks/{theme.DsTNE2pE.js → theme.BH-2HuRf.js} +2 -2
- package/public/docs/assets/{contributor-guide_architecture_board-widgets_caching-and-memory.md.8bH1HnZp.js → contributor-guide_architecture_board-widgets_caching-and-memory.md.CQgn1t_M.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_board-widgets_visual-system-and-templating.md.wulOueeB.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.wj6Et6UD.js → contributor-guide_architecture_detector-contract.md.N4hhenrA.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_detector-contract_threshold-tables.md.CKjWG56Y.js → contributor-guide_architecture_detector-contract_threshold-tables.md.Dp3c40rx.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DfvbqEUu.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_impact-estimation.md.CZv_ZGOp.lean.js → contributor-guide_architecture_impact-estimation.md.DfvbqEUu.lean.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_impact-estimation_caveats-tuning-and-coverage.md.BUucRc0A.js → contributor-guide_architecture_impact-estimation_caveats-tuning-and-coverage.md.Cwm1jHmn.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_impact-estimation_caveats-tuning-and-coverage.md.BUucRc0A.lean.js → contributor-guide_architecture_impact-estimation_caveats-tuning-and-coverage.md.Cwm1jHmn.lean.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_worker-protocol_cli-and-mcp.md.DC1YqXBp.js → contributor-guide_architecture_worker-protocol_cli-and-mcp.md.BX1XnFbq.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_worker-protocol_evidence-report.md.DVGZOWvW.js → contributor-guide_architecture_worker-protocol_evidence-report.md.CiQl1MLb.js} +1 -1
- package/public/docs/assets/{contributor-guide_development-setup.md.D9bu4j_c.js → contributor-guide_development-setup.md.DQdzera7.js} +1 -1
- package/public/docs/assets/instrument-sans-latin-ext-wdth-normal.C5E2Gvlv.woff2 +0 -0
- package/public/docs/assets/instrument-sans-latin-wdth-normal.BVScPF0l.woff2 +0 -0
- package/public/docs/assets/jetbrains-mono-cyrillic-wght-normal.D73BlboJ.woff2 +0 -0
- package/public/docs/assets/jetbrains-mono-greek-wght-normal.Bw9x6K1M.woff2 +0 -0
- package/public/docs/assets/jetbrains-mono-latin-ext-wght-normal.DBQx-q_a.woff2 +0 -0
- package/public/docs/assets/jetbrains-mono-latin-wght-normal.B9CIFXIH.woff2 +0 -0
- package/public/docs/assets/jetbrains-mono-vietnamese-wght-normal.Bt-aOZkq.woff2 +0 -0
- package/public/docs/assets/style.CyK9Ss73.css +1 -0
- package/public/docs/assets/user-guide_getting-started_ci-and-automation.md.BEepbDDL.js +24 -0
- package/public/docs/assets/user-guide_getting-started_ci-and-automation.md.BEepbDDL.lean.js +1 -0
- package/public/docs/assets/{user-guide_mcp-tools_get-run-summary.md.DpxZ4ZNp.js → user-guide_mcp-tools_get-run-summary.md.EhaIsele.js} +1 -1
- package/public/docs/assets/user-guide_understanding-findings.md.3C7KCEZO.js +1 -0
- package/public/docs/contributor-guide/architecture/board-widgets/caching-and-memory.html +6 -10
- package/public/docs/contributor-guide/architecture/board-widgets/plan-advisor.html +4 -8
- package/public/docs/contributor-guide/architecture/board-widgets/visual-system-and-templating.html +6 -10
- package/public/docs/contributor-guide/architecture/board-widgets.html +4 -8
- package/public/docs/contributor-guide/architecture/detector-contract/plan-attribution.html +4 -8
- package/public/docs/contributor-guide/architecture/detector-contract/threshold-tables.html +6 -10
- package/public/docs/contributor-guide/architecture/detector-contract.html +6 -10
- package/public/docs/contributor-guide/architecture/drill-down/plan-graph.html +4 -8
- package/public/docs/contributor-guide/architecture/drill-down.html +4 -8
- package/public/docs/contributor-guide/architecture/impact-estimation/caveats-tuning-and-coverage.html +6 -10
- package/public/docs/contributor-guide/architecture/impact-estimation/stage-union-rollup.html +4 -8
- package/public/docs/contributor-guide/architecture/impact-estimation.html +6 -10
- package/public/docs/contributor-guide/architecture/index.html +4 -8
- package/public/docs/contributor-guide/architecture/overview.html +4 -8
- package/public/docs/contributor-guide/architecture/state-and-history/history-server-intake.html +4 -8
- package/public/docs/contributor-guide/architecture/state-and-history/run-comparison-internals.html +4 -8
- package/public/docs/contributor-guide/architecture/state-and-history.html +4 -8
- package/public/docs/contributor-guide/architecture/widget-rendering/findings-tab.html +4 -8
- package/public/docs/contributor-guide/architecture/widget-rendering/investigation-routing.html +4 -8
- package/public/docs/contributor-guide/architecture/widget-rendering/list-sort-mode.html +4 -8
- package/public/docs/contributor-guide/architecture/widget-rendering/reference-section.html +4 -8
- package/public/docs/contributor-guide/architecture/widget-rendering/row-expand-contract.html +4 -8
- package/public/docs/contributor-guide/architecture/widget-rendering.html +4 -8
- package/public/docs/contributor-guide/architecture/worker-protocol/cli-and-mcp.html +6 -10
- package/public/docs/contributor-guide/architecture/worker-protocol/core-and-event-validation.html +4 -8
- package/public/docs/contributor-guide/architecture/worker-protocol/evidence-availability.html +4 -8
- package/public/docs/contributor-guide/architecture/worker-protocol/evidence-report.html +6 -10
- package/public/docs/contributor-guide/architecture/worker-protocol.html +4 -8
- package/public/docs/contributor-guide/contributing.html +4 -8
- package/public/docs/contributor-guide/development-setup.html +6 -10
- package/public/docs/contributor-guide/testing.html +4 -8
- package/public/docs/favicon.svg +2 -2
- package/public/docs/hashmap.json +1 -1
- package/public/docs/index.html +4 -8
- package/public/docs/tuning-reference/anti-patterns.html +4 -8
- package/public/docs/tuning-reference/aqe.html +4 -8
- package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +4 -8
- package/public/docs/tuning-reference/bottleneck-cold-start.html +4 -8
- package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +4 -8
- package/public/docs/tuning-reference/bottleneck-failures.html +4 -8
- package/public/docs/tuning-reference/bottleneck-gc.html +4 -8
- package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +4 -8
- package/public/docs/tuning-reference/bottleneck-memory-utilization.html +4 -8
- package/public/docs/tuning-reference/bottleneck-retry-waste.html +4 -8
- package/public/docs/tuning-reference/bottleneck-shuffle.html +4 -8
- package/public/docs/tuning-reference/bottleneck-skew.html +4 -8
- package/public/docs/tuning-reference/bottleneck-slow-host.html +4 -8
- package/public/docs/tuning-reference/bottleneck-small-files.html +4 -8
- package/public/docs/tuning-reference/bottleneck-spill.html +4 -8
- package/public/docs/tuning-reference/bottleneck-straggler.html +4 -8
- package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +4 -8
- package/public/docs/tuning-reference/bottleneck-utilization.html +4 -8
- package/public/docs/tuning-reference/caching.html +4 -8
- package/public/docs/tuning-reference/cluster-config.html +4 -8
- package/public/docs/tuning-reference/config.html +4 -8
- package/public/docs/tuning-reference/data-formats.html +4 -8
- package/public/docs/tuning-reference/index.html +5 -9
- package/public/docs/tuning-reference/intro.html +4 -8
- package/public/docs/tuning-reference/joins.html +4 -8
- package/public/docs/tuning-reference/memory-model.html +4 -8
- package/public/docs/tuning-reference/metrics.html +4 -8
- package/public/docs/tuning-reference/partitioning.html +4 -8
- package/public/docs/tuning-reference/pyspark.html +4 -8
- package/public/docs/tuning-reference/shuffle.html +4 -8
- package/public/docs/tuning-reference/spark-architecture.html +4 -8
- package/public/docs/tuning-reference/table-formats.html +4 -8
- package/public/docs/user-guide/alternative-log-retrieval/managed-platforms.html +4 -8
- package/public/docs/user-guide/alternative-log-retrieval/ssh-bastion.html +4 -8
- package/public/docs/user-guide/alternative-log-retrieval.html +4 -8
- package/public/docs/user-guide/getting-started/ci-and-automation.html +9 -12
- package/public/docs/user-guide/getting-started/reading-the-dashboard.html +4 -8
- package/public/docs/user-guide/getting-started/regression-metric-keys.html +4 -8
- package/public/docs/user-guide/getting-started/tuning-thresholds.html +4 -8
- package/public/docs/user-guide/getting-started.html +4 -8
- package/public/docs/user-guide/mcp-tools/compare-runs.html +4 -8
- package/public/docs/user-guide/mcp-tools/diagnose-run.html +4 -8
- package/public/docs/user-guide/mcp-tools/evaluate-budgets.html +4 -8
- package/public/docs/user-guide/mcp-tools/get-finding-documentation.html +4 -8
- package/public/docs/user-guide/mcp-tools/get-finding-evidence.html +4 -8
- package/public/docs/user-guide/mcp-tools/get-reference-doc.html +4 -8
- package/public/docs/user-guide/mcp-tools/get-run-summary.html +6 -10
- package/public/docs/user-guide/mcp-tools/list-runs.html +4 -8
- package/public/docs/user-guide/mcp-tools.html +4 -8
- package/public/docs/user-guide/run-comparison/how-stages-are-matched.html +4 -8
- package/public/docs/user-guide/run-comparison.html +4 -8
- package/public/docs/user-guide/understanding-findings.html +6 -10
- package/public/export-template.html +46 -46
- package/public/favicon.svg +2 -2
- package/public/index.html +4 -7
- package/vendor-core/allocation.js +105 -20
- package/vendor-core/api-merge-writes.js +1 -0
- package/vendor-core/core-source-hash.txt +1 -1
- package/vendor-core/delta-log-paths.js +10 -1
- package/vendor-core/detectors.js +73 -38
- package/vendor-core/docs-content/detection/mem.md +1 -1
- package/vendor-core/docs-content/detection/skew.md +2 -1
- package/vendor-core/docs-content/detection/util.md +6 -2
- package/vendor-core/efficiency-model.js +22 -14
- package/vendor-core/finding-presentation.js +13 -6
- package/vendor-core/finding-types.js +21 -10
- package/vendor-core/impact-model.js +2 -2
- package/vendor-core/remediation.js +10 -5
- package/vendor-core/run-output.js +14 -3
- package/vendor-core/types.js +12 -2
- package/vendor-core/wall-clock.js +8 -0
- package/vendor-core/wasted-core-hours.js +12 -11
- package/vendor-core/write-targets.js +32 -0
- package/public/assets/AutoscalingChurn-8t3U3isq.js +0 -1
- package/public/assets/CacheUtilization-CJs9tTum.js +0 -1
- package/public/assets/ConfigAudit-B5Gbe5js.js +0 -1
- package/public/assets/Dashboard-C1hNeX49.js +0 -2
- package/public/assets/DisclosureContext-ZpE6CkHx.js +0 -1
- package/public/assets/ExecutorUtilization-D9grwi7t.js +0 -1
- package/public/assets/MemoryUtilization-BM5schZI.js +0 -1
- package/public/assets/PlanGraphRoute-DH3KJb8j.js +0 -1
- package/public/assets/RetryWaste-DOnE9vGF.js +0 -1
- package/public/assets/Skew-BmZZJ5ms.js +0 -1
- package/public/assets/SlowHost-CsJzfEqo.js +0 -1
- package/public/assets/Spill-BhNicyBy.js +0 -1
- package/public/assets/StageShape-BDxRknLp.js +0 -1
- package/public/assets/Straggler-CZCbnOWP.js +0 -1
- package/public/assets/TaskFailures-C57YcLFQ.js +0 -1
- package/public/assets/index-2h_TgUAb.css +0 -2
- package/public/assets/index-B-03mG7K.js +0 -14
- package/public/assets/react-vendor-DEdfrRTJ.js +0 -9
- package/public/assets/useRecentFiles-XZEnLlal.js +0 -11
- package/public/docs/assets/chunks/@localSearchIndexroot.u_e5bQz4.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_board-widgets_visual-system-and-templating.md.DYgUpIJB.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.CZv_ZGOp.js +0 -1
- package/public/docs/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
- package/public/docs/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
- package/public/docs/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
- package/public/docs/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
- package/public/docs/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
- package/public/docs/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
- package/public/docs/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
- package/public/docs/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
- package/public/docs/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
- package/public/docs/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
- package/public/docs/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
- package/public/docs/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
- package/public/docs/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
- package/public/docs/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
- package/public/docs/assets/style.tmDhD3c8.css +0 -1
- package/public/docs/assets/user-guide_getting-started_ci-and-automation.md.OUQqw3mI.js +0 -23
- package/public/docs/assets/user-guide_getting-started_ci-and-automation.md.OUQqw3mI.lean.js +0 -1
- package/public/docs/assets/user-guide_understanding-findings.md.C9YRruMT.js +0 -1
- /package/public/docs/assets/{contributor-guide_architecture_board-widgets_caching-and-memory.md.8bH1HnZp.lean.js → contributor-guide_architecture_board-widgets_caching-and-memory.md.CQgn1t_M.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_board-widgets_visual-system-and-templating.md.DYgUpIJB.lean.js → contributor-guide_architecture_board-widgets_visual-system-and-templating.md.wulOueeB.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.wj6Et6UD.lean.js → contributor-guide_architecture_detector-contract.md.N4hhenrA.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_detector-contract_threshold-tables.md.CKjWG56Y.lean.js → contributor-guide_architecture_detector-contract_threshold-tables.md.Dp3c40rx.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_worker-protocol_cli-and-mcp.md.DC1YqXBp.lean.js → contributor-guide_architecture_worker-protocol_cli-and-mcp.md.BX1XnFbq.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_worker-protocol_evidence-report.md.DVGZOWvW.lean.js → contributor-guide_architecture_worker-protocol_evidence-report.md.CiQl1MLb.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_development-setup.md.D9bu4j_c.lean.js → contributor-guide_development-setup.md.DQdzera7.lean.js} +0 -0
- /package/public/docs/assets/{user-guide_mcp-tools_get-run-summary.md.DpxZ4ZNp.lean.js → user-guide_mcp-tools_get-run-summary.md.EhaIsele.lean.js} +0 -0
- /package/public/docs/assets/{user-guide_understanding-findings.md.C9YRruMT.lean.js → user-guide_understanding-findings.md.3C7KCEZO.lean.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sparkforensics-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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.",
|
|
@@ -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{C as u,c as d,s as f}from"./DisclosureContext-OO7X1HAx.js";import{p}from"./plan-graph-vendor-BYl-AzN5.js";import{d as m,m as h}from"./useRecentFiles-BvkKo3JN.js";import{k as g}from"./index-DwqkFUFk.js";import{c as _,o as v,t as y}from"./Dashboard-BHZ76JCu.js";var b=e(t(),1),x=p(),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)(f,{impactBand:e.impactBand,className:`mt-1.5`}),(0,x.jsx)(`span`,{children:(0,x.jsx)(u,{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 f=(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(!f.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:p,removed:y,rows:S,yAxisScale:C}=f,D=l.find(e=>e.type===`autoscalingChurn`);return(0,x.jsx)(g,{title:`Autoscaling Churn`,impactBand:D?.impactBand,fixFor:D?[D]:[],badges:D&&(0,x.jsx)(d,{type:`autoscalingChurn`,impactBand:D.impactBand}),defaultCollapsed:u,summary:(0,x.jsx)(v,{value:`${p.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)(h,{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:m.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:m.stage,shape:k}),(0,x.jsx)(i,{dataKey:`removed`,name:`Removed`,stackId:`churn`,fill:m.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{C as n,G as r,Z as i,c as a,ft as o,ot as s,s as c,st as l,tt as u}from"./DisclosureContext-OO7X1HAx.js";import{p as d}from"./plan-graph-vendor-BYl-AzN5.js";import{c as f}from"./useRecentFiles-BvkKo3JN.js";import{H as p,P as m,R as h,U as g,V as _,W as v,k as y,z as b}from"./index-DwqkFUFk.js";import{o as x,r as S,t as C}from"./Dashboard-BHZ76JCu.js";import{n as w}from"./finding-anchor-BYW1oz5R.js";import{t as T}from"./usePagedRows-CsuUFeYx.js";var E=e(t(),1),D=d(),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){if(e.variant===`storageUnobserved`)return`No block updates logged: cached partition counts and sizes are unknown`;let t=u(`pct`,s(e));return e.variant===`diskSpillover`?`${t} spilled to disk: ${i(e.diskSize??0)} disk / ${i(e.memorySize??0)} memory`:`${t} cached (${e.numCachedPartitions??0}/${e.numPartitions??0} partitions)`}function N({finding:e}){let t=w([e]),n=e.dataUnavailable?`Cache storage not logged`: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)(c,{impactBand:e.impactBand,className:`mt-1.5`}),(0,D.jsx)(`span`,{children:n})]}),(0,D.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e.dataUnavailable?e.recommendation:M(e)}),(0,D.jsx)(C,{finding:e})]})}var P=(0,E.memo)(function({appModel:e,catalog:t}){let[l,u]=(0,E.useState)(0),[d,C]=(0,E.useState)(0),w=e.app?.rddInfo,O=(0,E.useMemo)(()=>w?[...w.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]),M=(0,E.useMemo)(()=>f(t,`cacheUtilization`).sort((e,t)=>r[e.impactBand]-r[t.impactBand]),[t]),P=T(O,l,u),F=m(),I=F?M.findIndex(e=>e===F.finding):null,L=T(M,d,C,I),R=M.find(e=>e.dataUnavailable);if(O.length===0&&!R)return null;let z=e=>M.filter(t=>t.rddId===e),B=O.reduce((e,t)=>e+(t.memorySize??0)+(t.diskSize??0),0);return(0,D.jsx)(`div`,{"data-widget":`cache-utilization`,children:(0,D.jsxs)(y,{title:`Cache Storage`,fixFor:M,impactBand:o(M),badges:(0,D.jsxs)(D.Fragment,{children:[M.length>0?(0,D.jsx)(a,{type:`cacheUtilization`,impactBand:o(M)??`info`}):null,(0,D.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[O.length>0?`${O.length} cached RDD${O.length===1?``:`s`}`:`cache storage not logged`,`, see`,` `,(0,D.jsx)(n,{anchor:`#memory-model`,children:`how Spark accounts cached memory`})]})]}),defaultCollapsed:!0,summary:O.length>0?(0,D.jsx)(x,{value:i(B),context:`cached across memory + disk`}):(0,D.jsx)(x,{value:`Unknown`,context:`${s(R)} persisted, no block updates`}),children:[O.length>0?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(h,{children:[(0,D.jsx)(g,{children:(0,D.jsxs)(v,{children:[(0,D.jsx)(p,{children:`RDD`}),(0,D.jsx)(p,{children:`Storage level`}),(0,D.jsx)(p,{className:`text-right`,children:`Cached partitions`}),(0,D.jsx)(p,{className:`text-right`,children:`Memory`}),(0,D.jsx)(p,{className:`text-right`,children:`Disk`})]})}),(0,D.jsx)(b,{children:P.visible.map(e=>{let t=A(e),n=j(e),r=z(e.id);return(0,D.jsxs)(v,{children:[(0,D.jsxs)(_,{className:`max-w-80 truncate`,title:t===n?void 0:t,children:[n,r.length>0&&(0,D.jsx)(c,{impactBand:o(r)??`info`,className:`ml-1.5`})]}),(0,D.jsx)(_,{children:k(e.storageLevel)}),(0,D.jsxs)(_,{className:`text-right`,children:[e.numCachedPartitions,` / `,e.numPartitions]}),(0,D.jsx)(_,{className:`text-right`,children:i(e.memorySize??0)}),(0,D.jsx)(_,{className:`text-right`,children:i(e.diskSize??0)})]},e.id)})})]}),(0,D.jsx)(S,{page:P.effectivePage,totalPages:P.totalPages,onPrev:()=>u(e=>e-1),onNext:()=>u(e=>e+1)})]}):null,M.length>0?(0,D.jsxs)(`div`,{className:`mt-3 space-y-2 text-sm`,children:[L.visible.map(e=>(0,D.jsx)(N,{finding:e},e.id)),(0,D.jsx)(S,{page:L.effectivePage,totalPages:L.totalPages,onPrev:()=>C(e=>e-1),onNext:()=>C(e=>e+1)})]}):null]})})});export{P as CacheUtilization};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{Z as n,c as r,u as i,x as a,yt as o}from"./DisclosureContext-OO7X1HAx.js";import{p as s}from"./plan-graph-vendor-BYl-AzN5.js";import{c,l}from"./useRecentFiles-BvkKo3JN.js";import{H as u,P as d,R as f,U as p,V as m,W as h,k as g,z as _}from"./index-DwqkFUFk.js";import{o as v,r as y,t as b}from"./Dashboard-BHZ76JCu.js";import{n as x}from"./finding-anchor-BYW1oz5R.js";import{t as S}from"./usePagedRows-CsuUFeYx.js";var C={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`}]]};C.node;var w=o(C),T=e(t(),1),E=s();function D({relations:e,operator:t}){let n=t===`union`?`union`:`join`;return(0,E.jsx)(`span`,{className:`inline-flex flex-wrap items-baseline`,children:e.map((e,t)=>(0,E.jsxs)(`span`,{children:[t>0?(0,E.jsxs)(E.Fragment,{children:[` `,(0,E.jsx)(`span`,{className:`mx-1 font-semibold uppercase text-xs tracking-wide text-primary`,children:n}),` `]}):null,e.relation]},e.relation))})}function O({finding:e}){let t=x([e]),r=e.variant===`composite`;return(0,E.jsxs)(h,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[(0,E.jsx)(m,{children:(0,E.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[r?(0,E.jsx)(w,{className:`size-3.5 text-muted-foreground`,"aria-hidden":`true`}):null,r&&e.relations&&e.relations.length>0?(0,E.jsx)(D,{relations:e.relations,operator:e.operator}):(0,E.jsx)(`span`,{children:e.relation}),r?(0,E.jsx)(a,{variant:`outline`,className:`text-xs uppercase border-dashed`,children:e.operator?.toUpperCase()}):(0,E.jsx)(a,{variant:`secondary`,className:`text-xs uppercase`,children:e.format})]})}),(0,E.jsxs)(m,{children:[e.value,` queries`]}),(0,E.jsx)(m,{className:`text-right`,children:n(e.totalReadBytes)}),(0,E.jsxs)(m,{children:[(0,E.jsx)(b,{finding:e}),(0,E.jsx)(i,{children:(0,E.jsx)(l,{confidence:e.confidence,validationRequired:e.validationRequired})})]})]})}var k=(0,T.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[n,a]=(0,T.useState)(0),o=(0,T.useMemo)(()=>c(e,`cachingOpportunity`).sort((e,t)=>t.totalReadBytes-e.totalReadBytes||(t.value??0)-(e.value??0)),[e]),s=d(),l=s?o.findIndex(e=>e===s.finding):null,{totalPages:m,effectivePage:b,visible:x}=S(o,n,a,l);if(o.length===0)return null;let C=o[0];return(0,E.jsx)(g,{title:`Caching Opportunities`,fixFor:o,impactBand:`info`,badges:(0,E.jsx)(r,{type:`cachingOpportunity`,impactBand:`info`}),defaultCollapsed:t,summary:(0,E.jsx)(v,{value:`${C.value}×`,context:`read by ${C.value} queries: ${C.relation}`}),children:(0,E.jsxs)(`div`,{className:`space-y-3`,children:[(0,E.jsxs)(f,{children:[(0,E.jsx)(p,{children:(0,E.jsxs)(h,{children:[(0,E.jsx)(u,{children:`Relation`}),(0,E.jsx)(u,{children:`Read by`}),(0,E.jsx)(u,{className:`text-right`,children:`Data read`}),(0,E.jsx)(u,{children:`Estimate`})]})}),(0,E.jsx)(_,{children:x.map((e,t)=>(0,E.jsx)(O,{finding:e},`${e.format}:${e.relation}:${(e.executionIds??[]).join(`,`)}:${t}`))})]}),(0,E.jsx)(i,{children:(0,E.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Reuse is inferred from plan structure, not confirmed by execution. Verify before caching.`})}),(0,E.jsx)(y,{page:b,totalPages:m,onPrev:()=>a(e=>e-1),onNext:()=>a(e=>e+1)})]})})});export{k as CachingOpportunity};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{M as t}from"./charts-vendor-0VMaLVLN.js";import{G as n,c as r,s as i}from"./DisclosureContext-OO7X1HAx.js";import{p as a}from"./plan-graph-vendor-BYl-AzN5.js";import{P as o,k as s}from"./index-DwqkFUFk.js";import{o as c,r as l,s as u,t as d}from"./Dashboard-BHZ76JCu.js";import{r as f}from"./impact-sort-xzy0g-Vh.js";import{n as p}from"./finding-anchor-BYW1oz5R.js";import{t as m}from"./usePagedRows-CsuUFeYx.js";import{n as h,t as g}from"./useSortMode-joX71BZN.js";var _=e(t(),1),v=a();function y(e){return`${e.value}s`}function b({finding:e}){let t=p([e]);return(0,v.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 text-sm transition-colors ${t.flashClassName}`,children:[(0,v.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,v.jsx)(i,{impactBand:e.impactBand}),(0,v.jsx)(`strong`,{children:y(e)})]}),(0,v.jsx)(d,{finding:e})]})}var x=(0,_.memo)(function({catalog:e,defaultCollapsed:t=!0}){let{sortMode:i,setSortMode:a,orderBy:d}=g(),[p,x]=(0,_.useState)(!t),[S,C]=(0,_.useState)(0),w=e.filter(e=>e.type===`coldStart`).slice().sort((e,t)=>n[e.impactBand]-n[t.impactBand]),T=d(w,e=>[e],e=>e.stageId??null),E=o(),D=E?T.findIndex(e=>e===E.finding):null,{totalPages:O,effectivePage:k,visible:A}=m(T,S,C,D);return w.length===0?null:(0,v.jsxs)(s,{title:`Cold Start`,fixFor:w,impactBand:w[0].impactBand,badges:(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(r,{type:`coldStart`,impactBand:w[0].impactBand}),f(w,w.length,p)?(0,v.jsx)(h,{mode:i,onChange:a}):null]}),open:p,onOpenChange:x,summary:(0,v.jsx)(c,{value:y(w[0]),context:u(w.length)}),children:[(0,v.jsx)(`ul`,{className:`space-y-2`,children:A.map(e=>(0,v.jsx)(b,{finding:e},e.id))}),(0,v.jsx)(l,{page:k,totalPages:O,onPrev:()=>C(e=>e-1),onNext:()=>C(e=>e+1)})]})});export{x 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{C as n,G as r,N as i,c as a,ft as o,s,u as c}from"./DisclosureContext-OO7X1HAx.js";import{p as l}from"./plan-graph-vendor-BYl-AzN5.js";import{c as u,l as d}from"./useRecentFiles-BvkKo3JN.js";import{P as f,k as p,l as m}from"./index-DwqkFUFk.js";import{o as h,r as g,t as _}from"./Dashboard-BHZ76JCu.js";import{n as v}from"./finding-anchor-BYW1oz5R.js";import{t as y}from"./usePagedRows-CsuUFeYx.js";var b=e(t(),1),x=l();function S({finding:e}){let t=v([e]);return(0,x.jsxs)(`li`,{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:[(0,x.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,x.jsx)(s,{impactBand:e.impactBand}),(0,x.jsx)(`code`,{className:`text-xs`,children:e.property}),(0,x.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`=`}),(0,x.jsx)(`code`,{className:`rounded bg-accent/10 px-1.5 py-0.5 font-mono text-xs text-accent`,children:e.valueText})]}),(0,x.jsx)(_,{finding:e}),(0,x.jsxs)(`p`,{className:`text-sm`,children:[m(e.recommendation??``).measured??e.recommendation,e.docAnchor?(0,x.jsxs)(x.Fragment,{children:[` `,(0,x.jsxs)(n,{anchor:e.docAnchor,children:[`Why `,e.property,` matters`]})]}):null]})]})}var C=(0,b.memo)(function({appModel:e,configFindings:t,defaultCollapsed:n=!0}){let[s,l]=(0,b.useState)(0),m=(0,b.useMemo)(()=>u(t??[],`configAudit`).sort((e,t)=>r[e.impactBand]-r[t.impactBand]),[t]),_=f(),v=_?m.findIndex(e=>e===_.finding):null,{totalPages:C,effectivePage:w,visible:T}=y(m,s,l,v);if(m.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,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`span`,{children:[t.summary,` `]}),(0,x.jsx)(c,{children:(0,x.jsx)(d,{evidenceKey:`sparkConfiguration`})})]}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{children:`No environment info captured in this log. `}),(0,x.jsx)(c,{children:(0,x.jsx)(d,{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,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`span`,{children:`No environment info captured in this log. `}),(0,x.jsx)(c,{children:(0,x.jsx)(d,{evidenceKey:`sparkConfiguration`})})]})}let r=(0,x.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:n});return(0,x.jsx)(p,{title:`Config Audit`,compact:!0,summary:r,children:r})}let E=o(m);return(0,x.jsxs)(p,{title:`Config Audit`,fixFor:m,impactBand:E,badges:(0,x.jsx)(a,{type:`configAudit`,impactBand:E??`info`,docAnchor:i(m)}),statusBadge:(0,x.jsx)(c,{children:(0,x.jsx)(d,{evidenceKey:`sparkConfiguration`})}),defaultCollapsed:n,summary:(0,x.jsx)(h,{value:`${m.length}`,context:`misconfiguration${m.length===1?``:`s`} flagged`}),children:[(0,x.jsx)(`ul`,{className:`space-y-4`,children:T.map(e=>(0,x.jsx)(S,{finding:e},e.id))}),(0,x.jsx)(g,{page:w,totalPages:C,onPrev:()=>l(e=>e-1),onNext:()=>l(e=>e+1)})]})});export{C as ConfigAudit};
|
|
@@ -1 +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{
|
|
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{C as l,H as u,Q as d,c as f,s as p,u as m,v as h}from"./DisclosureContext-OO7X1HAx.js";import{p as g}from"./plan-graph-vendor-BYl-AzN5.js";import{d as _,l as v,m as y,p as b}from"./useRecentFiles-BvkKo3JN.js";import{k as x}from"./index-DwqkFUFk.js";import{c as S,f as C,o as w,p as T,r as E,t as D}from"./Dashboard-BHZ76JCu.js";import{t as O}from"./usePagedRows-CsuUFeYx.js";var k=e(t(),1),A=g(),j=240,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:_.clean,NODE_LOCAL:_.accent,RACK_LOCAL:_.warning,NO_PREF:_.muted,ANY:_.critical,OTHER:_.muted,idle:_.muted},P=`Core Usage by Locality`,F=(0,k.memo)(function({catalog:e,defaultCollapsed:t=!0}){let[g,F]=(0,k.useState)(0),I=h()?.data.coreLocality,L=(0,k.useMemo)(()=>{let e=I?.chart??{hasActivity:!1};return e.hasActivity?{...e,sampled:S(e.points)}:e},[I]),R=I?.ratio.topStages??[],z=e.find(e=>e.type===`coreLocality`),B=e.some(e=>e.type===`memoryUtilization`&&e.variant===`idleCores`),V=R.filter(e=>e.nonLocalTasks>0),{totalPages:H,effectivePage:U,visible:W}=O(V,g,F);if(!L.hasActivity)return(0,A.jsx)(x,{title:P,summary:(0,A.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`No stage activity to plot.`}),children:(0,A.jsx)(C,{tone:`neutral`,icon:T,title:`No stage activity to plot.`})});let{order:G,points:K,sampled:q,peakCores:J}=L;return(0,A.jsx)(x,{title:P,impactBand:z?.impactBand,badges:z?(0,A.jsx)(f,{type:`coreLocality`,impactBand:z.impactBand}):null,defaultCollapsed:t,summary:(0,A.jsx)(w,{value:`${d(J)} cores`,context:`busy at the peak`}),children:(0,A.jsxs)(`div`,{className:`space-y-2`,children:[(0,A.jsx)(m,{children:(0,A.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`approximate: stage-level attribution`,z?null:(0,A.jsxs)(A.Fragment,{children:[`, see `,(0,A.jsx)(l,{anchor:`#bottleneck-utilization`,children:`how utilization is measured`})]})]})}),z?(0,A.jsxs)(`p`,{className:`flex flex-wrap items-start gap-2 text-sm`,children:[(0,A.jsx)(p,{impactBand:z.impactBand,className:`mt-1.5`}),(0,A.jsxs)(`span`,{children:[(0,A.jsxs)(`strong`,{children:[z.value,`% non-local`]}),`. `,u(z)]})]}):null,z?(0,A.jsx)(D,{finding:z}):null,(0,A.jsx)(m,{children:z?(0,A.jsx)(v,{confidence:z.confidence,validationRequired:z.validationRequired}):null}),(0,A.jsx)(y,{ariaLabel:`Approximate concurrent core usage over time, stacked by task locality tier, with idle capacity shown. See the legend for tier colors.`,height:j,table:{caption:`Concurrent core usage over time by locality tier`,columns:[`Time (s)`,...G.map(e=>M[e]??e)],rows:K.map(e=>[e.t,...G.map(t=>Math.round(e[t]))]),align:Array.from({length:G.length+1},()=>`right`)},children:(0,A.jsxs)(i,{data:q,children:[(0,A.jsx)(r,{vertical:!1,stroke:_.muted,strokeOpacity:.2}),(0,A.jsx)(o,{dataKey:`t`,tick:{fontSize:10},tickFormatter:e=>`${e}s`}),(0,A.jsx)(a,{tick:{fontSize:10},width:36,label:{value:`avg concurrent cores`,angle:-90,position:`insideLeft`,fontSize:10}}),(0,A.jsx)(c,{...b,labelFormatter:e=>`${e}s from app start`,formatter:e=>typeof e==`number`?e.toFixed(2):String(e)}),(0,A.jsx)(n,{wrapperStyle:{fontSize:10}}),G.map(e=>(0,A.jsx)(s,{type:`monotone`,dataKey:e,name:M[e]??e,stackId:`cores`,stroke:N[e]??_.muted,fill:N[e]??_.muted,fillOpacity:e===`idle`?.15:.8,isAnimationActive:!1},e))]})}),(0,A.jsx)(m,{children:W.length>0?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`ul`,{className:`space-y-1 text-xs text-muted-foreground`,children:W.map(e=>(0,A.jsxs)(`li`,{children:[`Stage `,e.stageId,`: `,Math.round(e.ratio*100),`% non-local (`,e.nonLocalTasks,`/`,e.taskCount,` tasks)`]},e.stageId))}),(0,A.jsx)(E,{page:U,totalPages:H,onPrev:()=>F(e=>e-1),onNext:()=>F(e=>e+1)})]}):null}),(0,A.jsx)(m,{children:B?(0,A.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,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Skew-DlagstYP.js","./rolldown-runtime-hePW80VL.js","./charts-vendor-0VMaLVLN.js","./DisclosureContext-OO7X1HAx.js","./react-vendor-DfpuPQZf.js","./plan-graph-vendor-BYl-AzN5.js","./plan-graph-vendor-DLioOiRN.css","./StageFindingGroup-BXJ0Mj5n.js","./useRecentFiles-BvkKo3JN.js","./index-DwqkFUFk.js","./index-DhpRGMZc.css","./impact-sort-xzy0g-Vh.js","./finding-anchor-BYW1oz5R.js","./usePagedRows-CsuUFeYx.js","./useSortMode-joX71BZN.js","./StageHeader--oN2J-oD.js","./PlanExplorer-DmubTAOP.js","./StageShape-IZ80CZiJ.js","./TinyTask-BssfzGFB.js","./ShuffleIO-D13vGmas.js","./select-C8edjYTq.js","./PartitionHint-CUvbnnxy.js","./PartitionSizing-VG8kBgG5.js","./Spill-H44Gz4US.js","./GcPressure-D1BTE8qh.js","./StageFailed-DCfii9h_.js","./TaskFailures-Bks_gqhL.js","./RetryWaste-CnpM8bB7.js","./SlowHost-cSkLRZ_e.js","./StageSlowness--BRIaBc1.js","./Straggler-Ctq0Df_o.js","./SpeculationWaste-DaysAzXO.js","./ColdStart-BJrtjfmn.js","./MemoryUtilization-9b8ee_3_.js","./ExecutorUtilization-D2KhSVbY.js","./CachingOpportunity-oCiQwmTJ.js","./JobFailures-YwNzCF19.js","./ConfigAudit-DMvKxySP.js","./DuplicatePlanSubtree-BgG-L-cK.js","./SmallFiles-B-kERMcq.js","./UnderBroadcast-DsScrxc-.js","./OverBroadcast-CfctS8a8.js","./CacheUtilization-Bh9OY_V9.js","./CoreUsageArea-REC2zsKw.js","./AutoscalingChurn-CRA2Mb7F.js","./IncompleteRun-DD40xUpy.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
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,p,s as m,u as h,v as g}from"./charts-vendor-0VMaLVLN.js";import{A as _,D as v,E as y,M as b,O as x,P as S,j as C,k as ee}from"./react-vendor-DfpuPQZf.js";import{$ as w,A as T,C as te,Dt as E,E as ne,Et as re,G as ie,H as D,I as O,J as ae,N as oe,St as k,Y as se,Z as A,_ as ce,_t as j,bt as le,c as M,d as ue,dt as de,f as fe,ft as pe,g as me,h as he,i as ge,m as _e,o as ve,p as ye,q as be,r as xe,rt as Se,s as Ce,st as we,u as N,v as P,vt as Te,x as Ee,xt as F,y as De,yt as Oe}from"./DisclosureContext-OO7X1HAx.js";import{p as ke}from"./plan-graph-vendor-BYl-AzN5.js";import{A as Ae,C as je,D as Me,E as Ne,O as Pe,S as Fe,T as Ie,_ as Le,a as Re,b as ze,d as I,f as Be,g as Ve,h as He,i as Ue,k as We,l as Ge,m as L,n as Ke,o as qe,p as Je,r as Ye,s as Xe,t as Ze,u as Qe,v as $e,w as et,x as tt,y as nt}from"./useRecentFiles-BvkKo3JN.js";import{A as rt,C as it,D as at,Dt as ot,H as st,L as ct,M as R,Mt as lt,N as ut,O as dt,Ot as ft,P as pt,R as mt,T as ht,U as gt,V as z,W as B,Y as _t,a as vt,b as V,c as yt,j as bt,jt as H,k as U,l as xt,lt as St,s as Ct,u as wt,w as Tt,x as Et,xt as Dt,z as Ot}from"./index-DwqkFUFk.js";var kt={name:`circle-dashed`,size:24,node:[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]};kt.node;var At=Oe(kt),jt={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};jt.node;var Mt=Oe(jt),Nt={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`}]]};Nt.node;var Pt=Oe(Nt),Ft={name:`inbox`,size:24,node:[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]};Ft.node;var It=Oe(Ft),Lt={name:`list-filter`,size:24,node:[[`path`,{d:`M2 5h20`,key:`1fs1ex`}],[`path`,{d:`M6 12h12`,key:`8npq4p`}],[`path`,{d:`M9 19h6`,key:`456am0`}]]};Lt.node;var Rt=Oe(Lt),zt={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`}]]};zt.node;var Bt=Oe(zt),W=e(n(),1),Vt=(0,W.lazy)(()=>V(()=>import(`./Skew-DlagstYP.js`).then(e=>({default:e.Skew})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url)),Ht=(0,W.lazy)(()=>V(()=>import(`./StageShape-IZ80CZiJ.js`).then(e=>({default:e.StageShape})),__vite__mapDeps([17,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]),import.meta.url)),Ut=(0,W.lazy)(()=>V(()=>import(`./TinyTask-BssfzGFB.js`).then(e=>({default:e.TinyTask})),__vite__mapDeps([18,1,2,5,6,7,3,4,8,9,10,11,12,13,14,15,16]),import.meta.url)),Wt=(0,W.lazy)(()=>V(()=>import(`./ShuffleIO-D13vGmas.js`).then(e=>({default:e.ShuffleIO})),__vite__mapDeps([19,1,2,3,4,5,6,8,9,10,11,12,13,14,15,20,16,21]),import.meta.url)),Gt=(0,W.lazy)(()=>V(()=>import(`./PartitionSizing-VG8kBgG5.js`).then(e=>({default:e.PartitionSizing})),__vite__mapDeps([22,1,2,3,4,5,6,8,9,10,11,12,13,14,15,20,16]),import.meta.url)),Kt=(0,W.lazy)(()=>V(()=>import(`./Spill-H44Gz4US.js`).then(e=>({default:e.Spill})),__vite__mapDeps([23,1,2,3,4,5,6,8,9,10,11,12,13,14,16,21]),import.meta.url)),qt=(0,W.lazy)(()=>V(()=>import(`./GcPressure-D1BTE8qh.js`).then(e=>({default:e.GcPressure})),__vite__mapDeps([24,1,2,3,4,5,6,8,9,10,11,12,13,14,15]),import.meta.url)),Jt=(0,W.lazy)(()=>V(()=>import(`./StageFailed-DCfii9h_.js`).then(e=>({default:e.StageFailed})),__vite__mapDeps([25,1,2,3,4,5,6,8,9,10,11,12,13,14]),import.meta.url)),Yt=(0,W.lazy)(()=>V(()=>import(`./TaskFailures-Bks_gqhL.js`).then(e=>({default:e.TaskFailures})),__vite__mapDeps([26,1,2,3,4,5,6,8,9,10,11,12,13,14]),import.meta.url)),Xt=(0,W.lazy)(()=>V(()=>import(`./RetryWaste-CnpM8bB7.js`).then(e=>({default:e.RetryWaste})),__vite__mapDeps([27,1,2,3,4,5,6,8,9,10,11,12,13,14]),import.meta.url)),Zt=(0,W.lazy)(()=>V(()=>import(`./SlowHost-cSkLRZ_e.js`).then(e=>({default:e.SlowHost})),__vite__mapDeps([28,1,2,3,4,5,6,8,9,10,11,12,13,14,15]),import.meta.url)),Qt=(0,W.lazy)(()=>V(()=>import(`./StageSlowness--BRIaBc1.js`).then(e=>({default:e.StageSlowness})),__vite__mapDeps([29,1,2,3,4,5,6,9,10,11,8,12,13,14,15]),import.meta.url)),$t=(0,W.lazy)(()=>V(()=>import(`./Straggler-Ctq0Df_o.js`).then(e=>({default:e.Straggler})),__vite__mapDeps([30,1,2,3,4,5,6,8,9,10,11,12,13,14,15]),import.meta.url)),en=(0,W.lazy)(()=>V(()=>import(`./SpeculationWaste-DaysAzXO.js`).then(e=>({default:e.SpeculationWaste})),__vite__mapDeps([31,1,2,3,4,5,6,9,10,11,8,12,13,14,15]),import.meta.url)),tn=(0,W.lazy)(()=>V(()=>import(`./ColdStart-BJrtjfmn.js`).then(e=>({default:e.ColdStart})),__vite__mapDeps([32,1,2,3,4,5,6,9,10,11,8,12,13,14]),import.meta.url)),nn=(0,W.lazy)(()=>V(()=>import(`./MemoryUtilization-9b8ee_3_.js`).then(e=>({default:e.MemoryUtilization})),__vite__mapDeps([33,1,2,3,4,5,6,8,9,10,12,13]),import.meta.url)),rn=(0,W.lazy)(()=>V(()=>import(`./ExecutorUtilization-D2KhSVbY.js`).then(e=>({default:e.ExecutorUtilization})),__vite__mapDeps([34,1,2,3,4,5,6,9,10,12,13]),import.meta.url)),an=(0,W.lazy)(()=>V(()=>import(`./CachingOpportunity-oCiQwmTJ.js`).then(e=>({default:e.CachingOpportunity})),__vite__mapDeps([35,1,2,3,4,5,6,8,9,10,12,13]),import.meta.url)),on=(0,W.lazy)(()=>V(()=>import(`./JobFailures-YwNzCF19.js`).then(e=>({default:e.JobFailures})),__vite__mapDeps([36,3,1,2,4,5,6,8,9,10]),import.meta.url)),sn=(0,W.lazy)(()=>V(()=>import(`./ConfigAudit-DMvKxySP.js`).then(e=>({default:e.ConfigAudit})),__vite__mapDeps([37,1,2,3,4,5,6,8,9,10,12,13]),import.meta.url)),cn=(0,W.lazy)(()=>V(()=>import(`./DuplicatePlanSubtree-BgG-L-cK.js`).then(e=>({default:e.DuplicatePlanSubtree})),__vite__mapDeps([38,1,2,3,4,5,6,8,9,10,11,12,13,14]),import.meta.url)),ln=(0,W.lazy)(()=>V(()=>import(`./SmallFiles-B-kERMcq.js`).then(e=>({default:e.SmallFiles})),__vite__mapDeps([39,1,2,3,4,5,6,8,9,10,11,12,13,14]),import.meta.url)),un=(0,W.lazy)(()=>V(()=>import(`./UnderBroadcast-DsScrxc-.js`).then(e=>({default:e.UnderBroadcast})),__vite__mapDeps([40,1,2,3,4,5,6,8,9,10,11,12,13,14]),import.meta.url)),dn=(0,W.lazy)(()=>V(()=>import(`./OverBroadcast-CfctS8a8.js`).then(e=>({default:e.OverBroadcast})),__vite__mapDeps([41,1,2,3,4,5,6,8,9,10,11,12,13,14]),import.meta.url)),fn=(0,W.lazy)(()=>V(()=>import(`./CacheUtilization-Bh9OY_V9.js`).then(e=>({default:e.CacheUtilization})),__vite__mapDeps([42,1,2,3,4,5,6,8,9,10,12,13]),import.meta.url)),pn=(0,W.lazy)(()=>V(()=>import(`./CoreUsageArea-REC2zsKw.js`).then(e=>({default:e.CoreUsageArea})),__vite__mapDeps([43,1,2,3,4,5,6,8,9,10,13]),import.meta.url)),mn=(0,W.lazy)(()=>V(()=>import(`./AutoscalingChurn-CRA2Mb7F.js`).then(e=>({default:e.AutoscalingChurn})),__vite__mapDeps([44,1,2,3,4,5,6,8,9,10]),import.meta.url)),hn=(0,W.lazy)(()=>V(()=>import(`./IncompleteRun-DD40xUpy.js`).then(e=>({default:e.IncompleteRun})),__vite__mapDeps([45,3,1,2,4,5,6,9,10]),import.meta.url));function G(e,t){e.displayName=t}G(Vt,`Skew`),G(Ht,`StageShape`),G(Ut,`TinyTask`),G(Wt,`ShuffleIO`),G(Gt,`PartitionSizing`),G(Kt,`Spill`),G(qt,`GcPressure`),G(Jt,`StageFailed`),G(Yt,`TaskFailures`),G(Xt,`RetryWaste`),G(Zt,`SlowHost`),G(Qt,`StageSlowness`),G($t,`Straggler`),G(en,`SpeculationWaste`),G(tn,`ColdStart`),G(nn,`MemoryUtilization`),G(rn,`ExecutorUtilization`),G(an,`CachingOpportunity`),G(on,`JobFailures`),G(sn,`ConfigAudit`),G(cn,`DuplicatePlanSubtree`),G(ln,`SmallFiles`),G(un,`UnderBroadcast`),G(dn,`OverBroadcast`),G(fn,`CacheUtilization`),G(pn,`CoreUsageArea`),G(mn,`AutoscalingChurn`),G(hn,`IncompleteRun`);var gn={incompleteRun:{component:hn,region:`action`,widgetId:`incomplete-run`,routeable:!0},skew:{component:Vt,region:`action`,widgetId:`skew`,routeable:!0},stageShape:{component:Ht,region:`action`,widgetId:`stage-shape`,routeable:!0},tinyTask:{component:Ut,region:`action`,widgetId:`tiny-task`,routeable:!0},shuffle:{component:Wt,region:`action`,widgetId:`shuffle-io`,routeable:!0},partitionSizing:{component:Gt,region:`action`,widgetId:`partition-sizing`,routeable:!0},spill:{component:Kt,region:`action`,widgetId:`spill`,routeable:!0},gc:{component:qt,region:`action`,widgetId:`gc-pressure`,routeable:!0},stageFailed:{component:Jt,region:`action`,widgetId:`stage-failed`,routeable:!0},failures:{component:Yt,region:`action`,widgetId:`task-failures`,routeable:!0},retryWaste:{component:Xt,region:`action`,widgetId:`retry-waste`,routeable:!0},slowHost:{component:Zt,region:`action`,widgetId:`slow-host`,routeable:!0},stageSlowness:{component:Qt,region:`action`,widgetId:`stage-slowness`,routeable:!0},straggler:{component:$t,region:`action`,widgetId:`straggler`,routeable:!0},speculationWaste:{component:en,region:`action`,widgetId:`speculation-waste`,routeable:!0},coldStart:{component:tn,region:`action`,widgetId:`cold-start`,routeable:!0},memoryUtilization:{component:nn,region:`reference`,widgetId:`memory-utilization`,routeable:!0},utilization:{component:rn,region:`reference`,widgetId:`executor-utilization`,routeable:!0},coreLocality:{component:pn,region:`reference`,widgetId:`core-usage-area`,routeable:!0},cachingOpportunity:{component:an,region:`action`,widgetId:`caching-opportunity`,routeable:!0},cacheUtilization:{component:fn,region:`reference`,widgetId:`cache-utilization`,routeable:!0},jobFailureRate:{component:on,region:`action`,widgetId:`job-failures`,routeable:!0},autoscalingChurn:{component:mn,region:`action`,widgetId:`autoscaling-churn`,routeable:!0},configAudit:{component:sn,region:`action`,widgetId:`config-audit`,routeable:!0},duplicatePlanSubtree:{component:cn,region:`action`,widgetId:`duplicate-plan-subtree`,routeable:!0},smallFiles:{component:ln,region:`action`,widgetId:`small-files`,routeable:!0},underBroadcast:{component:un,region:`action`,widgetId:`under-broadcast`,routeable:!0},overBroadcast:{component:dn,region:`action`,widgetId:`over-broadcast`,routeable:!0}},_n={action:0,reference:1};function vn(e){return Object.entries(e).filter(([e])=>gn[e]!==void 0).map(([e,{order:t}])=>({entry:gn[e],type:e,order:t})).sort((e,t)=>_n[e.entry.region]-_n[t.entry.region]||e.order-t.order).map(({entry:e,type:t})=>({component:e.component,region:e.region,widgetId:e.widgetId,type:t}))}var yn=new Set([`cacheUtilization`,`memoryUtilization`,`utilization`]);function bn(e){let t=gn[e];return t!==void 0&&t.region===`reference`&&!yn.has(e)}function xn(){return Object.entries(gn).filter(([e])=>bn(e)).map(([,e])=>({component:e.component,widgetId:e.widgetId}))}var K=ke(),Sn={clean:{box:`border-clean/40 bg-clean/10`,icon:`text-clean`,title:`text-clean`},neutral:{box:`border-border bg-background`,icon:`text-muted-foreground`,title:`text-foreground`}};function Cn({icon:e,tone:t=`neutral`,title:n,description:r,action:i,className:a}){let o=Sn[t];return(0,K.jsxs)(`div`,{className:E(`flex items-start gap-3 rounded-xl border p-4`,o.box,a),children:[(0,K.jsx)(e,{"aria-hidden":`true`,className:E(`mt-0.5 size-4 shrink-0`,o.icon)}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`p`,{className:E(`text-sm font-medium`,o.title),children:n}),r?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r}):null]}),i]})}var wn=[`critical`,`warning`,`info`];function Tn(){return{impactBands:new Set,types:new Set,stages:new Set}}function En(e){return e.impactBands.size===0&&e.types.size===0&&e.stages.size===0}function Dn(e,t){return vt(e,{impactBand:t.impactBands,type:t.types,stageId:t.stages})}function On(e,t){return e.filter(e=>Dn(e,t))}function kn(e,t){return[`impactBands`,`types`,`stages`].filter(n=>!Dn(e,{...Tn(),[n]:t[n]}))}function An(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:wn.filter(e=>n.has(e)),types:[...r].sort(),stages:[...i].sort((e,t)=>e-t)}}function jn(e){return e?e.split(`,`).map(e=>e.trim()).filter(Boolean):[]}function Mn(e,t){let n=new URLSearchParams(e),r=Tn();for(let e of jn(n.get(`impact`)))wn.includes(e)&&r.impactBands.add(e);let i=new Set(t.types);for(let e of jn(n.get(`type`)))i.has(e)&&r.types.add(e);for(let e of jn(n.get(`stage`))){let t=Number(e);Number.isInteger(t)&&r.stages.add(t)}return r}function Nn(e){let t=[];return e.impactBands.size&&t.push(`impact=${wn.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 Pn=(0,W.createContext)(null);function Fn(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function In({options:e,fileId:t,children:n}){let[r,i]=(0,W.useState)(()=>Mn(typeof window>`u`?``:window.location.search,e));(0,W.useEffect)(()=>{if(typeof window>`u`)return;let e=Nn(r),t=`${window.location.pathname}${e}${window.location.hash}`;window.history.replaceState(window.history.state,``,t)},[r]);let a=(0,W.useRef)(t);(0,W.useEffect)(()=>{a.current!==t&&(a.current=t,i(Tn()))},[t]),(0,W.useEffect)(()=>()=>{if(typeof window>`u`)return;let e=`${window.location.pathname}${window.location.hash}`;window.history.replaceState(window.history.state,``,e)},[]),(0,W.useEffect)(()=>{if(typeof window>`u`)return;let t=()=>i(Mn(window.location.search,e));return window.addEventListener(`popstate`,t),()=>window.removeEventListener(`popstate`,t)},[e]);let o=(0,W.useCallback)(e=>i(t=>({...t,impactBands:Fn(t.impactBands,e)})),[]),s=(0,W.useCallback)(e=>i(t=>({...t,types:Fn(t.types,e)})),[]),c=(0,W.useCallback)(e=>i(t=>({...t,stages:Fn(t.stages,e)})),[]),l=(0,W.useCallback)(()=>i(Tn()),[]),u=(0,W.useMemo)(()=>({selection:r,toggleImpactBand:o,toggleType:s,toggleStage:c,clearAll:l,replaceSelection:i}),[r,o,s,c,l]);return(0,K.jsx)(Pn.Provider,{value:u,children:n})}function Ln(){let e=(0,W.useContext)(Pn);if(!e)throw Error(`useFindingFilter outside FindingFilterProvider`);return e}function Rn(){let{clearAll:e}=Ln();return(0,K.jsx)(Cn,{icon:Bt,title:`No findings match the active filters`,description:`Adjust or clear the filters to see findings.`,action:(0,K.jsx)(`button`,{type:`button`,onClick:e,className:`cursor-pointer text-sm font-medium text-accent underline-offset-4 hover:underline`,children:`Clear all filters`})})}function zn({className:e,orientation:t=`horizontal`,...n}){return(0,K.jsx)(S,{"data-slot":`separator`,orientation:t,className:E(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var Bn=W.createContext({size:`default`,variant:`default`,spacing:2,orientation:`horizontal`});function Vn({className:e,variant:t,size:n,spacing:r=2,orientation:i=`horizontal`,children:a,...o}){return(0,K.jsx)(C,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,"data-orientation":i,style:{"--gap":r},className:E(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,e),...o,children:(0,K.jsx)(Bn.Provider,{value:{variant:t,size:n,spacing:r,orientation:i},children:a})})}function Hn({className:e,children:t,variant:n=`default`,size:r=`default`,...i}){let a=W.useContext(Bn);return(0,K.jsx)(b,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:E(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t`,Ve({variant:a.variant||n,size:a.size||r}),e),...i,children:t})}var Un={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 Wn(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 Gn({label:e,count:t,children:n}){return(0,K.jsxs)($e,{children:[(0,K.jsxs)(tt,{className:E(lt({variant:`outline`,size:`sm`}),`gap-1.5`),"aria-label":`Filter by ${e.toLowerCase()}`,children:[e,t>0&&(0,K.jsx)(`span`,{className:`rounded-sm bg-primary px-1.5 text-xs font-medium text-primary-foreground`,children:t}),(0,K.jsx)(Te,{"aria-hidden":`true`,className:`opacity-60`})]}),(0,K.jsx)(ze,{align:`start`,className:`max-h-72 w-56 overflow-y-auto`,children:n})]})}function Kn({options:e,resultCount:t}){let{selection:n,toggleImpactBand:r,toggleType:i,toggleStage:a,clearAll:o}=Ln(),[s,c]=(0,W.useState)(``),[l,u]=(0,W.useState)(``),d=(0,W.useMemo)(()=>{let t=s.trim();return t?e.stages.filter(e=>String(e).includes(t)):e.stages},[e.stages,s]),f=(0,W.useMemo)(()=>{let t=l.trim().toLowerCase();return t?e.types.filter(e=>e.toLowerCase().includes(t)||de(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=!En(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,K.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,K.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,K.jsx)(Rt,{"aria-hidden":`true`,className:`size-3.5`}),`Filter findings`]}),(0,K.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,K.jsx)(zn,{orientation:`vertical`,className:`h-6`}),e.impactBands.length>0&&(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Impact`}),(0,K.jsx)(Vn,{multiple:!0,"aria-label":`Filter by impact`,value:[...n.impactBands],onValueChange:e=>Wn(e,n.impactBands,r),children:e.impactBands.map(e=>(0,K.jsxs)(Hn,{value:e,variant:`outline`,size:`sm`,"aria-label":`Filter by impact: ${e}`,className:E(`tap-target-comfortable gap-1.5`,Un[e]),children:[(0,K.jsx)(Ce,{impactBand:e}),e]},e))})]}),e.types.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(zn,{orientation:`vertical`,className:`h-6`}),(0,K.jsxs)(Gn,{label:`Type`,count:n.types.size,children:[(0,K.jsx)(`div`,{className:`p-1`,children:(0,K.jsx)(Le,{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,K.jsxs)(nt,{checked:n.types.has(e),onCheckedChange:()=>i(e),"aria-label":`Filter by type: ${e}`,children:[(0,K.jsx)(`span`,{className:`rounded bg-muted px-1 text-xs font-medium text-foreground!`,children:de(e)}),` `,e]},e)),f.length===0&&(0,K.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching type`})]})]}),e.stages.length>0&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(zn,{orientation:`vertical`,className:`h-6`}),(0,K.jsxs)(Gn,{label:`Stage`,count:n.stages.size,children:[(0,K.jsx)(`div`,{className:`p-1`,children:(0,K.jsx)(Le,{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,K.jsxs)(nt,{checked:n.stages.has(e),onCheckedChange:()=>a(e),"aria-label":`Filter by stage: ${e}`,children:[`Stage `,e]},e)),d.length===0&&(0,K.jsx)(`p`,{className:`px-2 py-1.5 text-xs text-muted-foreground`,children:`No matching stage`})]})]}),p&&(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(zn,{orientation:`vertical`,className:`h-6`}),(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[m.map(e=>(0,K.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-sm border border-border bg-muted px-2 py-0.5 text-xs hover:bg-muted/70`,children:[e.label,` `,(0,K.jsx)(Dt,{"aria-hidden":`true`,className:`size-3`})]},e.key)),(0,K.jsx)(`button`,{type:`button`,onClick:o,className:`tap-target-comfortable cursor-pointer text-xs underline`,children:`Clear all filters`})]})]})]})}function qn(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 Jn(e,{bucketBy:t=`time`,bucketWidthMs:n=1e3,hypotheticalCores:r=null}={}){let i=qn(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}}async function Yn(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}}async function Xn(e,t){let{intervals:n,incomplete:r}=await Yn(e,t),{histogram:i}=Jn(n,{bucketBy:`coreCount`});return{histogram:i??[],incomplete:r}}function Zn(e){let t=F(e=>e.exportMode);return{exportMode:t,getTaskData:t?void 0:e}}function Qn(e,t=2e3){if(e.length<=t)return e;if(t<=1)return e.length?[e[0]]:[];let n=e.length-1,r=n/(t-1),i=Array(t);for(let a=0;a<t;a++)i[a]=e[Math.min(n,Math.round(a*r))];return i}function $n(e){return`${e} finding${e===1?``:`s`}`}function q({value:e,context:t}){return(0,K.jsx)(`div`,{className:`space-y-2`,children:(0,K.jsxs)(`p`,{className:`flex min-h-[4rem] flex-wrap content-start items-baseline gap-x-2`,children:[(0,K.jsx)(`span`,{className:`line-clamp-2 font-mono text-xl font-semibold tracking-[-0.02em]`,title:typeof e==`string`?e:void 0,children:e}),(0,K.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:t})]})})}var er=220;function tr({appModel:e,getTaskData:t}){let{exportMode:n,getTaskData:r}=Zn(t),[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1),[d,p]=(0,W.useState)(!1),h=e.stages.size>0;if((0,W.useEffect)(()=>{if(!h||!d||i!==null||!r)return;let t=!1;return Xn(e,r).then(({histogram:e,incomplete:n})=>{t||(a(e),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})),_=Qn(g),v=g.reduce((e,t)=>t.ms>e.ms?t:e,g[0]);return(0,K.jsx)(U,{title:`Core-Usage Distribution`,id:`core-usage-histogram`,open:d,onOpenChange:p,summary:i!==null&&v?(0,K.jsx)(q,{value:w(v.ms),context:`at ${v.coreCount} concurrent core${v.coreCount===1?``:`s`}`}):void 0,children:i===null?n?(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Core-usage detail isn’t included in exported reports.`}):(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Loading core usage…`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(L,{ariaLabel:`Wall-clock time spent at each concurrent-core count across the run. See the table below for exact values.`,height:er,table:{caption:`Wall-clock time by concurrent-core count`,columns:[`Concurrent cores`,`Time`],rows:i.map((e,t)=>[t,w(e)]),align:[`right`,`right`]},children:(0,K.jsxs)(l,{data:_,children:[(0,K.jsx)(c,{vertical:!1,stroke:I.muted,strokeOpacity:.2}),(0,K.jsx)(m,{dataKey:`cores`,tick:{fontSize:10},label:{value:`Concurrent busy cores`,position:`insideBottom`,offset:-5,fontSize:10}}),(0,K.jsx)(f,{tick:{fontSize:10},width:48,tickFormatter:e=>w(e)}),(0,K.jsx)(u,{dataKey:`ms`,name:`Time`,fill:I.stage})]})}),o?(0,K.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,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`See `,(0,K.jsx)(te,{anchor:`#bottleneck-utilization`,children:`how to read concurrent-core utilization`}),`.`]})]})})}var nr=`This estimate is derived from a simplified compute model; compare it against wall-clock data before acting on it.`,rr=e=>`${Math.round(e*100)/100} core-h`;function ir(){let e=P()?.data,t=e?.efficiency;if(!e||!t||t.availableComputeHours<=0)return null;let{usefulCoreHours:n,totalCores:r,topStages:i}=e.wastedCoreHours,a=null;return t.dominantWaste===`driver`?a=(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`strong`,{children:`Most of it is driver waste:`}),` review spark.driver.memory and spark.driver.cores before scaling executors.`]}):t.dominantWaste===`executor`&&(a=(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`strong`,{children:`Most of it is executor waste:`}),` reduce cluster size or enable dynamic allocation.`]})),(0,K.jsx)(U,{title:`Compute Efficiency`,statusBadge:(0,K.jsx)(N,{children:(0,K.jsx)(Ge,{confidence:`low`,validationRequired:nr})}),defaultCollapsed:!0,summary:(0,K.jsx)(q,{value:t.wastagePct==null?rr(t.availableComputeHours):`${t.wastagePct}% wasted`,context:`of ${rr(t.availableComputeHours)} available`}),children:(0,K.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[!e.wallClockReliable&&(0,K.jsx)(N,{children:(0,K.jsx)(`p`,{className:`text-muted-foreground`,children:`This run used concurrent job groups: the driver/executor split below is approximate, not precise.`})}),(0,K.jsxs)(`p`,{children:[`Available: `,(0,K.jsx)(`strong`,{children:rr(t.availableComputeHours)}),n!=null&&(0,K.jsxs)(K.Fragment,{children:[` `,`· Used: `,(0,K.jsx)(`strong`,{children:rr(n)})]}),t.wastagePct!=null&&(0,K.jsxs)(K.Fragment,{children:[` `,`· wasted `,(0,K.jsxs)(`strong`,{children:[t.wastagePct,`%`]})]})]}),r!=null&&(0,K.jsx)(N,{children:(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Available = cores × the time each executor was alive (peak `,r,` cores); used = core-time that actually ran tasks.`]})}),(0,K.jsxs)(`p`,{children:[(0,K.jsx)(Ce,{impactBand:`info`}),` Driver-bound waste: `,(0,K.jsx)(`strong`,{children:rr(t.driverWasteHours)})]}),(0,K.jsxs)(`p`,{children:[(0,K.jsx)(Ce,{impactBand:`info`}),` Executor-bound waste: `,(0,K.jsx)(`strong`,{children:rr(t.executorWasteHours)})]}),(0,K.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Floor (same executors, zero skew): `,w(t.floorZeroSkewMs)]}),a,i.length>0&&(0,K.jsxs)(`div`,{className:`space-y-1`,children:[(0,K.jsx)(`p`,{className:`text-muted-foreground text-xs`,children:`Top stages by task core-time`}),(0,K.jsx)(`ul`,{className:`space-y-0.5`,children:i.map(e=>(0,K.jsxs)(`li`,{className:`flex justify-between gap-2`,children:[(0,K.jsxs)(`span`,{children:[`Stage `,e.stageId]}),(0,K.jsx)(`span`,{className:`text-muted-foreground tabular-nums`,children:rr(e.coreMs/36e5)})]},e.stageId))})]})]})})}var ar=[{label:`Extract`,key:`extract`},{label:`Transform`,key:`transform`},{label:`Load`,key:`load`}];function or(){let e=P()?.data.etlPhases;if(!e||e.extract+e.transform+e.load===0)return null;let t=ar.reduce((t,n)=>e[n.key]>e[t.key]?n:t);return(0,K.jsx)(U,{title:`ETL Phase Attribution`,defaultCollapsed:!0,summary:(0,K.jsx)(q,{value:`${t.label} ${w(e[t.key])}`,context:`largest phase`}),children:(0,K.jsxs)(`div`,{className:`space-y-1`,children:[ar.map(({label:t,key:n})=>(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`strong`,{children:t}),`: `,w(e[n])]},n)),(0,K.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Sums the run time of each phase's stages, so overlapping stages count twice and a phase can exceed the wall-clock.`}),(0,K.jsx)(N,{children:(0,K.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:`Heuristic: a stage that both shuffles and writes counts in Transform and Load.`})})]})})}var sr=220;function cr(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}}function lr({active:e,payload:t,label:n}){return!e||!t||t.length===0?null:(0,K.jsxs)(`div`,{style:Be,"data-testid":`executor-count-tooltip`,children:[`At `,String(n),`: Active executors `,String(t[0].value)]})}var ur=(0,W.memo)(function({appModel:e,activeFileId:t}){let{chartData:n,sampled:r,hasSeries:i,peak:a}=(0,W.useMemo)(()=>{let{times:t,counts:n}=cr(e),r=t.map((e,t)=>({label:e,count:n[t]})),i=Qn(r),a=n.length>0;return{chartData:r,sampled:i,hasSeries:a,peak:a?Math.max(...n):0}},[e,t]);return i?(0,K.jsx)(U,{title:`Executor Count Over Time`,summary:(0,K.jsx)(q,{value:`${a} peak`,context:`concurrent executors`}),children:(0,K.jsx)(L,{ariaLabel:`Executor count over time. See the table below for exact values.`,height:sr,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,K.jsxs)(d,{data:r,children:[(0,K.jsx)(c,{vertical:!1,stroke:I.muted,strokeOpacity:.2}),(0,K.jsx)(m,{dataKey:`label`,tick:{fontSize:10},minTickGap:24}),(0,K.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,K.jsx)(g,{content:lr}),(0,K.jsx)(h,{type:`stepAfter`,dataKey:`count`,name:`Active executors`,stroke:I.stage,fill:I.stage,fillOpacity:.15})]})})}):(0,K.jsx)(U,{title:`Executor Count Over Time`,summary:(0,K.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:`Timeline unavailable: no end time recorded.`}),children:(0,K.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.`})})}),dr=[10,20,50,80,100,110,120,150,200,300,400,500];function fr(e,t,n){return t<=0||n<=0?0:e/Math.min(n,t)}function pr(e,t){let n=0;for(let r of Object.keys(e)){let{totalTaskDurationSum:i,taskCount:a}=e[r];n+=fr(i,a,t)}return n}function mr({app:e,observedActiveMs:t,runAggregates:n,executorsAdded:r}){let i=n?.perStage??{},a=St(e??{},r),o=a>0?pr(i,a):0,s=t>0?Math.round(Math.abs(o-t)/t*100):null,c=o>0?t/o:1;return{baselineCores:a,testPercentages:dr,predictions:dr.map(e=>{let t=Math.max(1,Math.round(a*e/100));return{pct:e,cores:t,estMakespanMs:Math.round(pr(i,t)*c)}}),modelErrorPct:s}}var hr=`What-If Executor Scaling`,gr=220,_r=20;function vr([e,t]){let n=(t-e)*.1;return[Math.max(0,e-n),t+n]}function yr(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 br(e){return e.evidenceAvailability?.entries.find(e=>e.key===`taskCoreTime`)}function xr({reason:e,evidence:t}){return(0,K.jsx)(U,{title:hr,summary:(0,K.jsxs)(`span`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e]}),children:(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Not available: `,e,` `,(0,K.jsx)(Ge,{evidenceKey:t})]})})}function Sr(e){if(e===100)return`with the current executors`;if(e<100)return`with ${e}% of the executors`;let t=e/100;return`with ${Number.isInteger(t)?t:t.toFixed(1)}× the executors`}function Cr({appModel:e}){let t=P()?.data,n=br(e);if(!re(e.runAggregates)||n!=null&&n.state!==`present`)return(0,K.jsx)(xr,{reason:n?.summary??`No usable task and core-time evidence in this log.`,evidence:`taskCoreTime`});if(!t)return null;let r=mr({app:e.app,observedActiveMs:t.wallClock.stagesActive,runAggregates:e.runAggregates,executorsAdded:e.executors.added});if(r.baselineCores<=0)return(0,K.jsx)(xr,{reason:`Baseline executor/core capacity is unavailable in this log.`});if(!yr(e))return(0,K.jsx)(xr,{reason:`Usable stage timing is unavailable in this log.`});let i=r.modelErrorPct!=null&&r.modelErrorPct>=_r,a=Qn(r.predictions),l=r.predictions.reduce((e,t)=>t.estMakespanMs<e.estMakespanMs?t:e);return(0,K.jsx)(U,{title:hr,defaultCollapsed:!0,summary:(0,K.jsx)(q,{value:w(l.estMakespanMs),context:`best case, ${Sr(l.pct)}`}),children:(0,K.jsxs)(`div`,{className:`space-y-3`,children:[(0,K.jsx)(N,{children:(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Model Error:`,` `,(0,K.jsx)(`strong`,{className:i?`text-warning`:void 0,children:r.modelErrorPct==null?`—`:`${r.modelErrorPct}%`}),` `,`(idealized makespan vs. observed); higher means all estimates below carry more error, since a single log only observes one scale.`]})}),(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Move along this curve by changing `,(0,K.jsx)(`code`,{children:`spark.dynamicAllocation`}),`’s executor bounds, see the `,(0,K.jsx)(te,{anchor:`#config-autoscale-bounds`,children:`autoscaling config guide`}),`.`]}),t.wallClockReliable?null:(0,K.jsx)(N,{children:(0,K.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,K.jsx)(N,{children:(0,K.jsx)(`p`,{className:`text-xs`,children:(0,K.jsx)(Ge,{evidenceKey:`taskCoreTime`})})}),(0,K.jsx)(L,{ariaLabel:`Estimated makespan by executor percentage: diminishing-returns curve.`,height:gr,table:{caption:`Estimated makespan by executor percentage`,columns:[`% Executors`,`Cores`,`Est. makespan`],rows:r.predictions.map(e=>[`${e.pct}%`,e.cores,w(e.estMakespanMs)]),align:[`right`,`right`,`right`]},children:(0,K.jsxs)(o,{data:a,children:[(0,K.jsx)(c,{stroke:I.muted,strokeOpacity:.2}),(0,K.jsx)(m,{dataKey:`pct`,tickFormatter:e=>`${e}%`,tick:{fontSize:10}}),(0,K.jsx)(f,{domain:vr,tickFormatter:e=>w(e),tick:{fontSize:10},width:56}),(0,K.jsx)(g,{formatter:e=>[w(Number(e)),`Est. makespan`],labelFormatter:e=>`${e}% executors`}),(0,K.jsx)(s,{type:`monotone`,dataKey:`estMakespanMs`,name:`Est. makespan`,stroke:I.accent,dot:{r:3}})]})})]})})}function wr({code:e,impactBand:t,className:n}){return(0,K.jsx)(`span`,{"data-step-code":e,title:`Step ${e} in the verdict`,className:E(`shrink-0 font-mono text-xs font-semibold tabular-nums`,t?ve[t]:`text-muted-foreground`,n),children:e})}function Tr(e){if(e.app?.startTime)return e.app.startTime;let t=1/0;for(let n of e.stages.values())n.submittedAt&&(t=Math.min(t,n.submittedAt));return Number.isFinite(t)?t:null}function Er(e){let t=-1/0;for(let n of e.stages.values())n.completedAt&&(t=Math.max(t,n.completedAt));let n=Tr(e),r=e.app?.endTime??(Number.isFinite(t)?t:null);return n==null||r==null||r<=n?null:(r-n)/1e3}var Dr=[.1,.2,.5,1,2,5,10,15,30,60,120,300,600,900,1800,3600,7200,10800,21600,43200,86400],Or=.5;function kr(e,t=10){if(!(e>0))return[0];let n=Dr.find(n=>Math.ceil(e/n)<=t-1)??Dr[Dr.length-1],r=[];for(let t=0;t*n<e-Or*n;t++)r.push(Math.round(t*n*1e3)/1e3);return r.push(e),r}var Ar=e=>String(e).padStart(2,`0`);function jr(e){if(!Number.isFinite(e)||e<0)return`0s`;if(e<60)return`${Number(e.toFixed(1))}s`;if(e<3600){let t=Math.floor(e/60),n=Math.round(e-t*60);return n===60&&(t+=1,n=0),t===60?`1h`:n===0?`${t}m`:`${t}m${Ar(n)}s`}let t=Math.floor(e/3600),n=Math.round((e-t*3600)/60);return n===60&&(t+=1,n=0),n===0?`${t}h`:`${t}h${Ar(n)}m`}var Mr=20,Nr=24,Pr=40,Fr=200,Ir=640;function Lr(e,t=Mr){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 Rr({appModel:e,catalog:t}){let{openStage:n}=Et(),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)),p=k(),[h,_]=(0,W.useState)(()=>p===`advanced`?i:Mr),{stages:v}=Lr(r,h),y=Qn(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(Ir,Math.max(Fr,y.length*Nr+Pr)),x=b-Pr,S=Math.max(1,Math.floor(x/Nr)),C=Math.max(1,Math.ceil(y.length/S));return(0,K.jsx)(U,{title:`Job Timeline`,subtitle:`seconds from app start`,summary:i>0?(0,K.jsx)(q,{value:`${i} stage${i===1?``:`s`}`,context:`${d.size} flagged`}):void 0,children:i===0?(0,K.jsx)(Cn,{tone:`neutral`,icon:It,title:`No stages in this run.`}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,K.jsx)(`label`,{htmlFor:`timeline-topn`,children:`showing top`}),(0,K.jsx)(`input`,{id:`timeline-topn`,type:`number`,min:1,max:i,value:Math.min(h,i),onChange:e=>{let t=parseInt(e.target.value,10);Number.isFinite(t)||(t=h),_(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,K.jsxs)(`span`,{children:[`of `,i,` by duration · flagged in red`]})]}),(0,K.jsx)(L,{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,w(e.wait),w(e.duration)]),align:[`left`,`right`,`right`]},children:(0,K.jsxs)(l,{data:y,layout:`vertical`,children:[(0,K.jsx)(c,{stroke:I.muted,strokeOpacity:.2,horizontal:!1}),(0,K.jsx)(m,{type:`number`,tickFormatter:e=>`${Math.round(e/1e3)}s`,tick:{fontSize:10},tickCount:10}),(0,K.jsx)(f,{type:`category`,dataKey:`label`,tick:{fontSize:10},width:64,interval:0,tickFormatter:(e,t)=>t%C===0?e:``}),(0,K.jsx)(g,{formatter:(e,t)=>t===`Duration`?w(Number(e)):[null,null]}),(0,K.jsx)(u,{dataKey:`wait`,stackId:`timeline`,fill:`transparent`,name:`Wait`}),(0,K.jsx)(u,{dataKey:`duration`,stackId:`timeline`,name:`Duration`,cursor:`pointer`,onClick:e=>n(e.payload.stageId),children:y.map(e=>(0,K.jsx)(a,{fill:e.flagged?I.critical:I.stage,stroke:e.flagged?I.critical:`none`,strokeWidth:e.flagged?2:0},e.stageId))})]})})]})})}var zr=8,Br=6,Vr=8,Hr=(e,t)=>Math.max(0,Math.min(100,e/t*100));function Ur({interpretation:e}){let t=F(e=>e.appModel),n=e.data.verdict.steps,r=(0,W.useMemo)(()=>{let r=Er(t),i=Tr(t);if(r==null||i==null)return null;let a=new Map,{byStage:o}=me(e);n.forEach((t,n)=>{let r=ye(e,t.leadIndex);t.stageId!=null&&r&&o.get(t.stageId)===`F${n+1}`&&a.set(t.stageId,{code:o.get(t.stageId),impactBand:r.impactBand})});let s=[...t.stages.values()].filter(e=>e.submittedAt&&e.completedAt),{stages:c,total:l}=Lr(s,zr),u=new Set(c.map(e=>e.id)),d=s.filter(e=>a.has(e.id)&&!u.has(e.id)),f=[...c,...d].sort((e,t)=>e.submittedAt-t.submittedAt);return f.length===0?null:{rows:f.map(e=>{let t=Hr((e.submittedAt-i)/1e3,r),n=Hr((e.completedAt-i)/1e3,r);return{stage:e,leftPct:t,widthPct:Math.max(n-t,.5),step:a.get(e.id)??null}}),runEndSec:r,total:l,ticks:kr(r,Br)}},[t,e,n]);if(!r)return null;let{rows:i,runEndSec:a,total:o,ticks:s}=r,c=[`${i.length===o?`All ${o}`:`${i.length} of ${o}`} stages on the run clock, ${jr(a)} total.`,...i.filter(e=>e.step).map(e=>`Step ${e.step.code}: Stage ${e.stage.id}, from ${jr(e.leftPct/100*a)} to ${jr((e.leftPct+e.widthPct)/100*a)}.`)].join(` `);return(0,K.jsx)(`figure`,{"data-testid":`verdict-strip`,className:`verdict-strip m-0`,role:`img`,"aria-label":c,children:(0,K.jsxs)(`div`,{"aria-hidden":`true`,children:[i.map(({stage:e,leftPct:t,widthPct:n,step:r})=>{let i=n>=Vr;return(0,K.jsxs)(`div`,{className:`verdict-strip__row`,"data-step-code":r?.code,children:[(0,K.jsxs)(`span`,{className:E(`truncate`,r&&`text-foreground`),children:[`stage `,e.id]}),(0,K.jsxs)(`div`,{className:`verdict-strip__lane`,children:[s.slice(1,-1).map(e=>(0,K.jsx)(`i`,{className:`verdict-strip__grid`,style:{left:`${Hr(e,a)}%`}},e)),(0,K.jsx)(`div`,{className:E(`verdict-strip__bar`,r?ge[r.impactBand]:`verdict-strip__bar--neutral`),style:{left:`${t}%`,width:`${n}%`},children:r&&i?(0,K.jsx)(`span`,{className:`verdict-strip__code verdict-strip__code--inside`,children:r.code}):null}),r&&!i?(0,K.jsx)(`span`,{className:E(`verdict-strip__code`,ve[r.impactBand]),style:t+n<88?{left:`calc(${t+n}% + 4px)`}:{right:`calc(${100-t}% + 4px)`},children:r.code}):null]})]},e.id)}),(0,K.jsxs)(`div`,{className:`verdict-strip__axis`,children:[(0,K.jsx)(`span`,{}),(0,K.jsx)(`div`,{children:s.map((e,t)=>(0,K.jsx)(`span`,{style:t===0?{left:0}:t===s.length-1?{right:0}:{left:`${Hr(e,a)}%`,transform:`translateX(-50%)`},children:jr(e)},e))})]})]})})}function Wr(e){let t=gn[e.type],n=typeof e.recommendation==`string`?e.recommendation.trim():``;return!t?.routeable||!n?null:{finding:e,widgetId:t.widgetId,region:t.region,findingLabel:yt(e.type),stageId:typeof e.stageId==`number`?e.stageId:null,recommendation:n}}function Gr(e,t){return t.includes(e)?Wr(e):null}function Kr(e,t){return qr(e,t)[0]??null}function qr(e,t){return _e(e,t).map(Wr).filter(e=>e!==null)}function Jr(e,t){return`${e} ${t}${e===1?``:`s`}`}function Yr({text:e,label:t,testId:n}){let[r,i]=(0,W.useState)(!1);return(0,K.jsxs)(H,{variant:`outline`,size:`sm`,className:`h-7 border-border bg-transparent text-xs`,"data-testid":n,onClick:()=>{He(e).then(()=>{i(!0),setTimeout(()=>i(!1),1500)}).catch(()=>{})},children:[r?(0,K.jsx)(Ae,{"aria-hidden":`true`}):(0,K.jsx)(Pt,{"aria-hidden":`true`}),r?`Copied`:t]})}function Xr({text:e}){let[t,n]=(0,W.useState)(!1),r=async()=>{try{await He(e),n(!0),setTimeout(()=>n(!1),1500)}catch{}};return(0,K.jsxs)(H,{variant:`outline`,size:`sm`,className:Zr,"data-testid":`copy-finding-button`,onClick:()=>void r(),children:[t?(0,K.jsx)(Ae,{"aria-hidden":`true`}):(0,K.jsx)(Pt,{"aria-hidden":`true`}),t?`Copied`:`Copy`]})}var Zr=`h-6 border-border bg-transparent px-2 text-xs font-medium dark:bg-transparent`;function Qr({step:e,finding:t,interpretation:n,index:r,onRoute:i}){let{openStage:a}=Et(),{measured:o,fix:s}=xt(e.recommendation),c=he(n,t),l=c?.figure??null,u=c?.meaning??null,d=`next-step-${r}-title`,f=k()===`advanced`,p=f?c?.provenance??null:null,m=f&&t.confidence&&t.confidence!==`high`?t.confidence:null;return(0,K.jsxs)(`li`,{className:`verdict-step`,"data-testid":`next-step`,"aria-labelledby":d,children:[(0,K.jsx)(wr,{code:`F${r+1}`,impactBand:r===0?t.impactBand:void 0,className:`pt-0.5`}),(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-x-2.5 gap-y-1 [overflow-wrap:anywhere]`,children:[(0,K.jsx)(M,{type:t.type,impactBand:t.impactBand,docAnchor:t.docAnchor}),(0,K.jsxs)(`h3`,{id:d,className:`text-[0.9375rem] font-semibold`,children:[Ct(t),e.stageId==null?null:(0,K.jsxs)(`span`,{className:`font-normal text-muted-foreground`,children:[` in Stage `,e.stageId]})]})]}),l?(0,K.jsxs)(`p`,{className:`verdict-step__save font-mono text-xs text-muted-foreground tabular-nums`,children:[(0,K.jsx)(`span`,{className:`verdict-step__save-label`,children:`Potential savings `}),(0,K.jsx)(`span`,{className:`verdict-step__save-figure font-semibold text-foreground`,children:l}),u?(0,K.jsxs)(`span`,{className:`verdict-step__save-meaning`,children:[` `,u]}):null]}):(0,K.jsx)(`span`,{"aria-hidden":`true`}),(0,K.jsxs)(`div`,{className:`verdict-step__body min-w-0 space-y-1 [overflow-wrap:anywhere]`,children:[o?(0,K.jsxs)(`p`,{className:`text-[0.8125rem] text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`font-semibold text-foreground`,children:`What's happening: `}),o]}):null,(0,K.jsxs)(`p`,{className:`text-[0.8125rem] text-muted-foreground`,children:[(0,K.jsx)(`span`,{className:`font-semibold text-foreground`,children:`What to try: `}),s]}),p||m?(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`next-step-provenance`,children:[p?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`Estimate: `}),p]}):null,m?(0,K.jsxs)(`span`,{title:typeof t.validationRequired==`string`?t.validationRequired:void 0,children:[p?` `:``,`${m[0].toUpperCase()}${m.slice(1)} confidence: verify before acting.`]}):null]}):null,e.relatedTypes.length>0?(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Also flagged here, likely the same cause: `,e.relatedTypes.map(yt).join(`, `),`.`]}):null,(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 pt-1`,children:[(0,K.jsxs)(H,{size:`sm`,variant:r===0?`soft`:`outline`,className:E(Zr,r===0&&`border-transparent bg-accent-soft dark:bg-accent-soft`),"data-shortcut-target":!0,onClick:()=>{let e=Wr(t);e&&i(e)},children:[`Show evidence`,(0,K.jsx)(ft,{"aria-hidden":`true`})]}),e.stageId==null?null:(0,K.jsxs)(H,{size:`sm`,variant:`outline`,className:Zr,onClick:()=>a(e.stageId),children:[`Stage `,e.stageId,` details`]}),(0,K.jsx)(Xr,{text:e.copyText})]})]})]})}var $r=`docs/user-guide/understanding-findings.html`;function ei(){let[e,t]=(0,W.useState)(!1),n=ne(),r=F(e=>e.exportMode);return(0,K.jsxs)(`div`,{className:`text-sm`,children:[(0,K.jsxs)(`button`,{type:`button`,className:`tap-target-comfortable inline-flex cursor-pointer items-center gap-1 rounded-sm text-left font-medium text-primary underline-offset-4 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"aria-expanded":e,"aria-controls":`newcomer-primer`,onClick:()=>t(e=>!e),children:[`New to Spark tuning? How to read this report`,e?(0,K.jsx)(j,{"aria-hidden":`true`,className:`size-4`}):(0,K.jsx)(Te,{"aria-hidden":`true`,className:`size-4`})]}),e?(0,K.jsxs)(`div`,{id:`newcomer-primer`,className:`mt-2 max-w-prose space-y-2 rounded-md border border-border bg-muted/40 p-3 text-muted-foreground`,children:[(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`Stages and tasks.`}),` Spark splits each job into stages. A stage runs the same code as many tasks, one per slice (partition) of the data, and it finishes only when its slowest task does. Stage numbers match the Spark UI.`]}),(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`Executors and cores.`}),` Tasks run on executors, the worker processes of your cluster, one task per core at a time. Idle capacity is how much of those cores ran nothing.`]}),(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`Shuffle.`}),` Moving data between stages, for example for a join or a group-by. It is often the most expensive part of a job.`]}),(0,K.jsxs)(`p`,{children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`Potential savings and colors.`}),` A time figure, such as 58.6s of run time, estimates how much sooner the run could finish; it is not a guarantee. A resource figure in core-hours (core-h) or gigabyte-hours of memory (GB-h) is cluster time a fix would free up: it cuts cost, but may not shorten the run. Red (critical), amber (warning) and blue (info) show how serious each finding is. When a finding shows a time-savings figure, its color usually follows that figure.`]}),r?null:(0,K.jsx)(`a`,{href:$r,target:`_blank`,rel:`noopener noreferrer`,className:`inline-block text-primary underline-offset-4 hover:underline`,onClick:e=>{!n||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),n.openSite($r))},children:`What every finding means`})]}):null]})}function ti({interpretation:e,onRoute:t}){let{title:n,summary:r,failed:i,clean:a,failureReason:o,remaining:s,copyText:c}=e.data.verdict,l=e.data.verdict.steps.map(t=>({step:t,finding:ye(e,t.leadIndex)})).filter(e=>e.finding!=null),u=k();return(0,K.jsxs)(`section`,{id:`run-verdict`,tabIndex:-1,"aria-labelledby":`run-verdict-title`,"data-testid":`run-verdict`,className:E(`scroll-mt-20 rounded-xl border bg-card px-4 pt-5 pb-4 outline-none focus-visible:ring-2 focus-visible:ring-ring sm:px-5`,a?`border-clean/40`:i?`border-critical/40`:`border-border`),children:[(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`p`,{className:`trace-eyebrow`,"aria-hidden":`true`,children:`Verdict`}),(0,K.jsxs)(`h2`,{id:`run-verdict-title`,className:E(`mt-1 flex items-center gap-2 font-heading text-[1.375rem] leading-tight font-semibold sm:text-[1.625rem]`,a&&`text-clean`,i&&`text-critical`),children:[a?(0,K.jsx)(ot,{"aria-hidden":`true`,className:`size-5 shrink-0`}):null,i?(0,K.jsx)(Mt,{"aria-hidden":`true`,className:`size-5 shrink-0`}):null,n]}),(0,K.jsx)(`p`,{className:`mt-1.5 max-w-[72ch] text-sm text-muted-foreground`,children:r.join(` `)}),o?(0,K.jsxs)(`p`,{"data-testid":`run-failure-reason`,className:`max-w-prose pt-1 text-sm`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`Spark's recorded reason: `}),(0,K.jsx)(`code`,{className:`font-mono text-xs [overflow-wrap:anywhere]`,children:o})]}):null]}),(0,K.jsx)(Ur,{interpretation:e}),u===`advanced`?null:(0,K.jsx)(`div`,{className:`mt-4`,children:(0,K.jsx)(ei,{})}),l.length>0?(0,K.jsx)(`ol`,{"aria-label":`Next steps`,className:`verdict-steps`,children:l.map(({step:n,finding:r},i)=>(0,K.jsx)(Qr,{step:n,finding:r,interpretation:e,index:i,onRoute:t},n.key))}):null,l.length>0?(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[s>0?(0,K.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[Jr(s,`more place`),` under Findings.`]}):(0,K.jsx)(`span`,{}),(0,K.jsx)(Yr,{label:`Copy next steps`,testId:`copy-plan-button`,text:c??``})]}):null,u===`advanced`&&l.length>1?(0,K.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:i?`Order: failures first, then highest potential savings; impact band breaks ties.`:`Order: highest potential savings first, unestimated last; impact band breaks ties.`}):null]})}function ni(){let e=F(e=>e.activeFileId),t=F(e=>e.exportMode),{resetToDropZone:n}=_t(),r=ne();return t||e!==`sample-run`?null:(0,K.jsxs)(`section`,{"aria-label":`Sample run`,"data-testid":`sample-run-notice`,className:`flex flex-col gap-2 rounded-xl border border-border border-l-[3px] border-l-accent bg-card px-4 py-2.5 text-[0.8125rem] text-muted-foreground sm:flex-row sm:items-center sm:justify-between sm:gap-4`,children:[(0,K.jsxs)(`p`,{className:`max-w-prose`,children:[(0,K.jsx)(`span`,{className:`font-medium text-foreground`,children:`This is the sample run`}),`, a real Spark job from a public example corpus, picked because it shows several common problems. Everything below works the same on your own event log.`]}),(0,K.jsxs)(`div`,{className:`-ml-2.5 flex shrink-0 flex-wrap items-center gap-1 sm:ml-0`,children:[(0,K.jsxs)(H,{size:`sm`,variant:`ghost`,className:`text-accent hover:text-accent`,onClick:n,children:[`Load my event log`,(0,K.jsx)(ft,{"aria-hidden":`true`})]}),(0,K.jsx)(`a`,{href:T,target:`_blank`,rel:`noopener noreferrer`,className:`tap-target-comfortable inline-flex h-7 items-center rounded-lg px-2.5 text-[0.8rem] font-medium text-accent underline-offset-4 hover:underline`,onClick:e=>{!r||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||(e.preventDefault(),r.openSite(T))},children:`Where do I find my log?`})]})]})}function ri({eyebrow:e,value:t,meta:n,flag:r=null,bar:i,dataTestid:a}){return(0,K.jsxs)(`div`,{"data-testid":a,"data-flag":r??void 0,className:`flex flex-col px-4 py-3.5`,children:[(0,K.jsxs)(`span`,{className:`trace-eyebrow flex items-center gap-1.5 tracking-[.06em]`,children:[r&&(0,K.jsx)(Ce,{impactBand:r}),e]}),(0,K.jsx)(`div`,{className:`kpi-value mt-1 font-mono text-[1.875rem] leading-[1.2] font-semibold tracking-[-0.02em] tabular-nums`,children:t}),(0,K.jsx)(`p`,{className:`mt-0.5 text-xs text-muted-foreground`,children:n}),i]})}function ii({pct:e,flag:t,label:n}){let r=Math.max(0,Math.min(100,e));return(0,K.jsx)(`div`,{role:`img`,"aria-label":n,className:`mt-2.5 h-1.5 w-full overflow-hidden rounded-[1px] bg-chart-idle`,children:(0,K.jsx)(`div`,{className:E(`h-full rounded-[1px]`,t?ge[t]:`bg-clean`),style:{width:`${r}%`}})})}function ai({active:e,total:t}){let n=t>0?Math.max(0,Math.min(100,e/t*100)):0;return(0,K.jsxs)(`div`,{role:`img`,"aria-label":`Active ${w(e)} of ${w(t)} total`,className:`mt-2.5 flex h-1.5 w-full overflow-hidden rounded-[1px] bg-chart-idle`,children:[(0,K.jsx)(`div`,{className:`h-full bg-muted-foreground`,style:{width:`${n}%`}}),(0,K.jsx)(`div`,{className:`h-full flex-1 bg-muted-foreground/35`})]})}function oi(e){let t=/^(\d[\d.,]*)\s*([a-zA-Z%]+)$/.exec(e);return t?(0,K.jsxs)(K.Fragment,{children:[t[1],(0,K.jsx)(`small`,{children:t[2]})]}):e}function si(e){return e>0?`Ran ${w(e)}`:`No stage activity recorded`}function ci(){return(0,K.jsxs)(`div`,{className:`flex items-start gap-2 rounded-xl border border-warning/40 bg-warning/10 p-4`,children:[(0,K.jsx)(Ce,{impactBand:`warning`,className:`mt-1.5`}),(0,K.jsxs)(`p`,{className:`text-sm text-warning`,children:[(0,K.jsx)(`span`,{className:`font-semibold tracking-wide uppercase`,children:`Timing unavailable`}),`. This run has no complete application timing interval, so wall-clock, efficiency, and unused core time can’t be measured.`]})]})}function li({interpretation:e,catalog:t}){let n=k(),{runShape:r,coverage:i,wallClock:a}=e;if(r.wallClockMs==null)return(0,K.jsx)(ci,{});let o=r.wallClockMs,s=a.stagesActive,c=!i.noFinishedStages,l=r.efficiencyPct,u=r.efficiencyFlag,d=t.find(e=>e.type===`coldStart`),f=r.unusedCoreTimePct,p=r.unusedCoreTimeFlag;return(0,K.jsx)(ct,{className:`overflow-hidden py-0`,children:(0,K.jsxs)(`div`,{className:`grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0`,children:[(0,K.jsx)(ri,{eyebrow:`Wall-clock`,dataTestid:`kpi-wall-clock`,value:o>0?oi(w(o)):`—`,meta:n===`advanced`||s<=0?(0,K.jsxs)(K.Fragment,{children:[si(s),d?` · ${d.value}s cold start`:``]}):`Total run time.`,bar:(0,K.jsx)(ai,{active:s,total:o})}),(0,K.jsx)(ri,{eyebrow:`Efficiency`,dataTestid:`kpi-efficiency`,value:c?l==null?(0,K.jsx)(`span`,{className:`text-base`,children:`Unavailable`}):(0,K.jsxs)(K.Fragment,{children:[l,(0,K.jsx)(`small`,{children:`%`})]}):(0,K.jsx)(`span`,{className:`text-base`,children:`Not measured`}),flag:u,meta:c?l==null?`This run has no complete application timing interval.`:n===`advanced`?o>s?`${si(s)} · ${w(o-s)} idle/gap time`:`executors active the whole run`:`Share of the run with a stage running (${w(s)}). Higher is better.`:`No stage in this log recorded an end, so there is no stage time to measure.`,bar:l==null?void 0:(0,K.jsx)(ii,{pct:l,flag:u,label:`Efficiency ${l}%`})}),(0,K.jsx)(ri,{eyebrow:`Unused core time`,dataTestid:`kpi-wastage`,value:f==null?(0,K.jsx)(`span`,{className:`text-base`,children:`Unavailable`}):(0,K.jsxs)(K.Fragment,{children:[f,(0,K.jsx)(`small`,{children:`%`})]}),flag:p,meta:r.unusedCoreTimeUnavailableReason===`application-timing`?`Unused core time needs complete application timing.`:r.unusedCoreTimeUnavailableReason===`core-usage-summary`?`Unused core time needs the core-usage summary.`:r.unusedCoreTimeUnavailableReason===`executor-capacity`?`Unused core time needs usable executor-capacity data.`:n===`advanced`?`Driver-idle + executor-slack core-hours as a share of available capacity. Directional, not a cost figure.`:`Share of executor core time that ran no task. Lower is better. Not a cost figure.`,bar:f==null?void 0:(0,K.jsx)(ii,{pct:f,flag:p,label:`Unused core time ${f}%`})})]})})}function ui({className:e,...t}){return(0,K.jsx)(_,{"data-slot":`accordion`,className:E(`flex w-full flex-col`,e),...t})}function di({className:e,...t}){return(0,K.jsx)(ee,{"data-slot":`accordion-item`,className:E(`not-last:border-b`,e),...t})}function fi({className:e,children:t,headingLevel:n=3,...r}){let i=`h${n}`;return(0,K.jsx)(x,{className:`flex`,render:(0,K.jsx)(i,{}),children:(0,K.jsxs)(v,{"data-slot":`accordion-trigger`,className:E(`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,K.jsx)(Te,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden`}),(0,K.jsx)(j,{"data-slot":`accordion-trigger-icon`,className:`pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline`})]})})}function pi({className:e,children:t,...n}){return(0,K.jsx)(y,{"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,K.jsx)(`div`,{className:E(`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 mi(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function hi({type:e,label:t,thresholdSummary:n,status:r=`passed`}){let i=r===`notRun`;return(0,K.jsxs)(B,{"data-testid":`clean-check-row`,"data-clean-check-type":e,"data-clean-check-status":r,children:[(0,K.jsx)(z,{className:`w-px`,children:(0,K.jsxs)(`span`,{className:i?`inline-flex h-6 items-center gap-1 rounded-sm bg-muted px-2 font-mono text-xs font-medium whitespace-nowrap text-muted-foreground`:`inline-flex h-6 items-center gap-1 rounded-sm bg-clean/10 px-2 font-mono text-xs font-medium whitespace-nowrap text-clean`,children:[(0,K.jsx)(i?At:ot,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),de(e)]})}),(0,K.jsxs)(z,{className:`whitespace-normal`,children:[(0,K.jsx)(`span`,{className:`block text-sm font-medium text-foreground`,children:mi(t)}),(0,K.jsx)(N,{children:(0,K.jsx)(`span`,{className:`block text-xs text-muted-foreground`,children:mi(`${n}.`)})})]})]})}var gi=`suggested-improvements`,_i={stage:`per-stage`,app:`app-level`,sql:`sql-scope`,config:`config-scope`},vi=[`per-stage`,`app-level`,`sql-scope`,`config-scope`],yi={"per-stage":`Per-stage checks`,"app-level":`App-level checks`,"sql-scope":`SQL plan checks`,"config-scope":`Config checks`};function bi(e,t,n){let r=[...e,...t].filter(O);return vn(n).filter(({type:e})=>!bn(e)).map(({component:e,widgetId:t,type:n},i)=>{let a=r.filter(e=>e.type===n);return{component:e,widgetId:t,index:i,findings:a,impactBand:pe(a)}}).filter(e=>e.impactBand!==void 0).sort((e,t)=>ie[e.impactBand]-ie[t.impactBand]||e.index-t.index)}function xi({catalog:e,configFindings:t=[],coverage:n,detectors:r}){let i=[...e,...t].filter(O),a=e=>e in n.notRunReasons,o=Object.keys(gn).filter(e=>!bn(e)).filter(e=>!i.some(t=>t.type===e)).map(e=>({type:e,findingLabel:yt(e)})),s=o.filter(({type:e})=>!a(e)),c=o.filter(({type:e})=>a(e)),l=c.length>0?n.gaps:[],u=new Map;for(let e of s){let t=r[e.type]?.scope,n=t?_i[t]:`app-level`;u.has(n)||u.set(n,[]),u.get(n).push(e)}return(0,K.jsx)(ui,{children:(0,K.jsxs)(di,{value:`clean-checks`,children:[(0,K.jsx)(fi,{children:`Clean checks`}),(0,K.jsxs)(pi,{children:[c.length>0?(0,K.jsxs)(`div`,{"data-testid":`clean-checks-not-run`,className:`pb-4`,children:[(0,K.jsx)(`p`,{className:`pb-1 text-xs font-medium text-muted-foreground`,children:`Not checked on this log`}),(0,K.jsx)(`p`,{className:`pb-2 text-xs text-muted-foreground`,children:`The log lacked the data these checks need, so they neither passed nor failed.`}),l.length>0?(0,K.jsx)(`ul`,{"data-testid":`clean-checks-not-run-reasons`,className:`list-disc space-y-0.5 pb-2 pl-5 text-xs text-muted-foreground [overflow-wrap:anywhere]`,children:l.map(e=>(0,K.jsx)(`li`,{children:e},e))}):null,(0,K.jsx)(mt,{children:(0,K.jsx)(Ot,{children:c.map(({type:e,findingLabel:t})=>(0,K.jsx)(hi,{type:e,label:t,thresholdSummary:r[e]?.thresholdSummary??``,status:`notRun`},e))})})]}):null,(0,K.jsxs)(`p`,{className:`pb-2 text-xs text-muted-foreground`,children:[s.length===0?`No check could run on this log.`:`Every check below passed.`,(0,K.jsx)(N,{children:` Each caption gives the threshold it was held to.`})]}),vi.map(e=>{let t=u.get(e);return!t||t.length===0?null:(0,K.jsxs)(`div`,{className:`pt-3 first:pt-0`,children:[(0,K.jsx)(`p`,{className:`pb-1 text-xs font-medium text-muted-foreground`,children:yi[e]}),(0,K.jsx)(mt,{children:(0,K.jsx)(Ot,{children:t.map(({type:e,findingLabel:t})=>(0,K.jsx)(hi,{type:e,label:t,thresholdSummary:r[e]?.thresholdSummary??``},e))})})]},e)})]})]})})}var Si=`inline-flex h-7 shrink-0 cursor-pointer items-center gap-1 rounded-sm border border-border bg-background px-2 font-mono text-xs font-medium whitespace-nowrap outline-none transition-colors hover:bg-muted focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`;function Ci({stageId:e,className:t}){let{openStage:n}=Et();return(0,K.jsxs)(`button`,{type:`button`,className:E(Si,t),title:`Open details for Stage ${e}`,"aria-label":`Open details for Stage ${e}`,onClick:()=>n(e),children:[`Stage `,(0,K.jsx)(`b`,{children:e})]})}var wi=30;function Ti(e,{limit:t=6,chunk:n=wi,dataset:r=e}={}){let[i,a]=(0,W.useState)({dataset:r,revealed:0}),o=!Object.is(i.dataset,r);o&&a({dataset:r,revealed:0});let s=t+(o?0:i.revealed);return{visible:e.slice(0,s),remaining:Math.max(0,e.length-s),revealMore:()=>a(e=>({dataset:r,revealed:(Object.is(e.dataset,r)?e.revealed:0)+n})),revealThrough:e=>a(n=>{let i=Object.is(n.dataset,r)?n.revealed:0,a=Math.max(i,e-t+1);return a>i?{dataset:r,revealed:a}:n})}}function Ei({pills:e}){let t=new Set,n=e.filter(e=>!t.has(e.id)&&(t.add(e.id),!0)),{visible:r,remaining:i,revealMore:a}=Ti(n,{limit:6,dataset:JSON.stringify(n.map(({id:e})=>e))}),o=n.slice(r.length);return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[r.map(e=>(0,K.jsx)(Ci,{stageId:e.id},e.id)),i>0&&(0,K.jsxs)(`button`,{type:`button`,className:E(Si,`bg-muted`),title:`Also flagged: Stage ${o.map(e=>e.id).join(`, Stage `)}`,"aria-label":`Show ${i} more stage${i===1?``:`s`}`,onClick:a,children:[`+`,i]})]})}function Di({page:e,totalPages:t,onPrev:n,onNext:r,renderJumpControl:i}){return t<=1?null:(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs ${i?`justify-between`:`justify-end`}`,children:[i?.(),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable tap-target-comfortable--sm`,onClick:n,disabled:e===0,children:`Previous`}),(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Page `,e+1,` of `,t]}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable tap-target-comfortable--sm`,onClick:r,disabled:e===t-1,children:`Next`})]})]})}var Oi=10,ki=`max-sm:flex max-sm:flex-wrap max-sm:items-start`,Ai=`max-sm:w-auto max-sm:shrink-0`,ji=`max-sm:min-w-0 max-sm:flex-1 max-sm:whitespace-normal max-sm:[overflow-wrap:anywhere]`,Mi=`max-sm:w-full max-sm:basis-full max-sm:pt-0 max-sm:text-left`;function Ni(e){let t=Xe(e),n=e.stageId==null?t&&t.length>0?`St.${Se(t)}`:null:`St.${e.stageId}`;if(e.type===`duplicatePlanSubtree`&&e.rootName!=null){let t=Pi(e);return n&&t?`${n} · ${t}`:t??n}return n||(e.type===`configAudit`?e.property:null)}function Pi(e){if(e.type!==`duplicatePlanSubtree`||e.rootName==null)return null;let t=we(e.rootName),n=e.groupIndex==null?t:`${t} #${Number(e.groupIndex)+1}`;return e.executionId==null?n:`${n} (SQL ${e.executionId})`}function Fi({finding:e,textClassName:t}){let{stageId:n}=e,r=Xe(e);if(n!=null)return(0,K.jsx)(Ci,{stageId:n});if(r&&r.length>0){let n=Pi(e);return(0,K.jsxs)(`span`,{className:`inline-flex min-w-0 flex-wrap items-center gap-1.5`,children:[(0,K.jsx)(Ei,{pills:r.map(e=>({id:e}))}),n?(0,K.jsx)(`span`,{className:E(`truncate`,t),title:n,children:n}):null]})}let i=Ni(e);return i?(0,K.jsx)(`span`,{className:E(`min-w-0 truncate`,t),title:i,children:i}):null}function Ii({finding:e,allFindings:t,onRoute:n}){let r=Gr(e,t),i=Ni(e),a=ce(e)?.figure??null,o=wt(e),s=Ct(e),c=De().byFinding.get(e)??null;return(0,K.jsxs)(B,{"data-testid":`fix-these-first-row`,"data-finding-type":e.type,className:ki,children:[(0,K.jsx)(z,{className:E(`w-px`,Ai),children:(0,K.jsx)(M,{type:e.type,impactBand:e.impactBand,docAnchor:e.docAnchor})}),(0,K.jsx)(z,{className:E(`whitespace-normal`,ji),children:(0,K.jsxs)(`button`,{type:`button`,"data-shortcut-target":!0,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,K.jsx)(`span`,{className:`block text-sm font-semibold`,children:s}),(0,K.jsx)(`span`,{className:`block text-[0.8125rem] text-muted-foreground`,children:o})]})}),(0,K.jsx)(z,{className:E(`w-px text-right font-mono text-xs text-muted-foreground`,Mi),title:[i,a].filter(Boolean).join(` · `),children:(0,K.jsxs)(`span`,{className:`flex items-center justify-end gap-2 max-sm:justify-start`,children:[c?(0,K.jsx)(wr,{code:c,impactBand:c===`F1`?e.impactBand:void 0}):null,(0,K.jsx)(Fi,{finding:e}),a?(0,K.jsx)(`span`,{className:`shrink-0 font-semibold text-foreground`,children:a}):null]})})]})}function Li({finding:e,allFindings:t,onRoute:n,id:r}){let i=Gr(e,t),a=Ni(e),o=ce(e)?.figure??null,s=wt(e),c=Ct(e),l=e.stageId!=null||a!=null;return(0,K.jsxs)(B,{id:r,"data-testid":`fix-these-first-row`,"data-finding-type":e.type,className:`bg-muted/50`,children:[(0,K.jsxs)(z,{colSpan:2,className:`whitespace-normal`,children:[l?(0,K.jsx)(`div`,{className:`mb-1`,children:(0,K.jsx)(Fi,{finding:e,textClassName:`line-clamp-1 break-words text-xs font-medium font-mono`})}):null,(0,K.jsxs)(`button`,{type:`button`,"data-shortcut-target":!0,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,K.jsx)(`span`,{className:`line-clamp-1 break-words text-xs font-medium`,children:c}),(0,K.jsx)(`span`,{className:`line-clamp-1 break-words text-xs text-muted-foreground`,children:s})]})]}),(0,K.jsx)(z,{className:`w-px text-right font-mono text-xs text-muted-foreground`,children:o})]})}function Ri({group:e,allFindings:t,expanded:n,onToggle:r,onRoute:i}){let[a,o]=(0,W.useState)(0),s=e.findings,c=s[0],l=D(c),u=Ct(c),d=De().byFinding,f=e.findings.map(e=>d.get(e)).find(e=>e!=null)??null,p=Math.ceil(s.length/Oi),m=Math.min(a,Math.max(0,p-1)),h=s.slice(m*Oi,m*Oi+Oi),g=`fix-these-first-group-content-${e.kind}-${e.type}${e.unit?`-${e.unit}`:``}`;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(B,{"data-testid":`fix-these-first-group-row`,"data-finding-type":e.type,className:ki,children:[(0,K.jsx)(z,{className:E(`w-px`,Ai),children:(0,K.jsx)(M,{type:e.type,impactBand:c.impactBand,docAnchor:oe(e.findings)})}),(0,K.jsx)(z,{className:E(`whitespace-normal`,ji),children:(0,K.jsxs)(`button`,{type:`button`,"aria-expanded":n,"aria-controls":g,"data-shortcut-target":!0,className:`cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50`,onClick:r,children:[(0,K.jsx)(`span`,{className:`block text-sm font-semibold`,children:u}),l?(0,K.jsx)(`span`,{className:`block text-[0.8125rem] text-muted-foreground`,children:l}):null]})}),(0,K.jsx)(z,{className:E(`w-px text-right font-mono text-xs text-muted-foreground`,Mi),children:(0,K.jsxs)(`span`,{className:`inline-flex items-center justify-end gap-1.5`,title:e.statTitle,children:[f?(0,K.jsx)(wr,{code:f,className:`mr-0.5`}):null,e.stat,n?(0,K.jsx)(j,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`}):(0,K.jsx)(Te,{"aria-hidden":`true`,className:`size-4 shrink-0 text-muted-foreground`})]})})]}),n&&h.map((e,n)=>(0,K.jsx)(Li,{finding:e,allFindings:t,onRoute:i,id:n===0?g:void 0},e.id)),n&&p>1&&(0,K.jsx)(B,{className:`bg-muted/50`,children:(0,K.jsx)(z,{colSpan:3,children:(0,K.jsx)(Di,{page:m,totalPages:p,onPrev:()=>o(e=>e-1),onNext:()=>o(e=>e+1)})})})]})}function zi(e,t,n,r){let{eligible:i,groups:a}=ue(r,[...e,...t],n);return{eligible:i,groups:a,triageTarget:Kr(r,i)}}var Bi={critical:`Critical`,warning:`Warning`,info:`Info`},Vi=[`critical`,`warning`,`info`];function Hi({impactBand:e,groups:t,widgets:n,allFindings:r,expandedGroupKey:i,onToggleGroup:a,onRoute:o,appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d}){let f=k(),[p,m]=(0,W.useState)(!1),h=pt(),g=h!=null&&n.some(e=>e.widgetId===h.widgetId);if((0,W.useLayoutEffect)(()=>{g&&m(!0)},[g]),t.length===0&&n.length===0)return null;let _=`impact-band-${e}-heading`,v=`impact-band-${e}-evidence`,y=f===`basic`&&t.length>0&&n.length>0,b=!y||p||g;return(0,K.jsxs)(`section`,{"aria-labelledby":_,className:`space-y-2`,children:[(0,K.jsx)(`h2`,{id:_,tabIndex:-1,className:`trace-eyebrow scroll-mt-20 rounded-sm px-1 pt-2 outline-none focus-visible:ring-2 focus-visible:ring-ring`,children:Bi[e]}),t.length>0&&(0,K.jsx)(mt,{className:`findings-table`,children:(0,K.jsx)(Ot,{children:t.map(e=>{if(e.findings.length===1)return(0,K.jsx)(Ii,{finding:e.findings[0],allFindings:r,onRoute:o},e.findings[0].id);let{key:t}=e;return(0,K.jsx)(Ri,{group:e,allFindings:r,expanded:i===t,onToggle:()=>a(t),onRoute:o},t)})})}),y?(0,K.jsxs)(H,{variant:`ghost`,size:`sm`,"aria-expanded":b,"aria-controls":v,onClick:()=>m(!b),children:[b?`Hide the evidence`:`Show the evidence (${n.length} ${n.length===1?`card`:`cards`})`,b?(0,K.jsx)(j,{"aria-hidden":`true`}):(0,K.jsx)(Te,{"aria-hidden":`true`})]}):null,n.length>0&&b&&(0,K.jsx)(`div`,{id:v,children:(0,K.jsx)(bt,{children:n.map(({component:e,widgetId:t,index:n})=>(0,K.jsx)(R,{cardId:`alert-${n}`,widgetId:t,children:(0,K.jsx)(W.Suspense,{fallback:(0,K.jsx)(rt,{}),children:(0,K.jsx)(e,{appModel:s,catalog:c,configFindings:l,getTaskData:u,activeFileId:d,defaultCollapsed:!0})})},t))})})]})}function Ui({appModel:e,catalog:t,configFindings:n=[],stages:r,getTaskData:i,activeFileId:a,onRoute:o}){let s=P(),{groups:c}=(0,W.useMemo)(()=>zi(t,n,r,s),[t,n,r,s]),l=[...t,...n],u=s?.data.detectors,d=(0,W.useMemo)(()=>u?bi(t,n,u):[],[t,n,u]),[f,p]=(0,W.useState)(null),{groupsByImpactBand:m,widgetsByImpactBand:h}=(0,W.useMemo)(()=>{let e=new Map;for(let t of c){let n=t.band;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,K.jsxs)(`div`,{id:gi,className:`space-y-6 scroll-mt-20`,children:[Vi.map(r=>(0,K.jsx)(Hi,{impactBand:r,groups:m.get(r)??[],widgets:h.get(r)??[],allFindings:l,expandedGroupKey:f,onToggleGroup:e=>p(t=>t===e?null:e),onRoute:o,appModel:e,catalog:t,configFindings:n,getTaskData:i,activeFileId:a},r)),s?(0,K.jsx)(xi,{catalog:t,configFindings:n,coverage:s.data.coverage,detectors:s.data.detectors}):null]})}var Wi=5,Gi=30,Ki=220;function qi(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 Ji({metrics:e,fieldNames:t,markers:n={}}){let r=t.indexOf(`duration`);if(r===-1)return null;let i=t.length,a=e.length/i,o=[];for(let t=0;t<a;t++)o.push(e[t*i+r]);if(o.length<Wi)return(0,K.jsxs)(`p`,{className:`text-muted-foreground text-xs`,children:[`Too few tasks (`,o.length,`) for a distribution.`]});let{labels:s,data:d}=se(o,Gi),h=s[1]-s[0],_=s.map((e,t)=>({bin:`${(e/1e3).toFixed(1)}s`,range:`${(e/1e3).toFixed(1)}s – ${((e+h)/1e3).toFixed(1)}s`,ms:e,count:d[t]})),v=n.p50==null?null:qi(s,n.p50),y=n.p95==null?null:qi(s,n.p95),b=v==null?void 0:_.find(e=>e.ms===v)?.bin,x=y==null?void 0:_.find(e=>e.ms===y)?.bin;return(0,K.jsx)(L,{title:`Task duration`,ariaLabel:`Task duration histogram`,height:Ki,table:{caption:`Task duration histogram`,columns:[`Duration bin`,`Task count`],rows:_.map(e=>[e.range,e.count]),align:[`right`,`right`]},children:(0,K.jsxs)(l,{data:_,children:[(0,K.jsx)(c,{vertical:!1,stroke:I.muted,strokeOpacity:.2}),(0,K.jsx)(m,{dataKey:`bin`,tick:{fontSize:10}}),(0,K.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,K.jsx)(g,{...Je,formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Count`],labelFormatter:(e,t)=>t?.[0]?.payload?.range??e}),(0,K.jsx)(u,{dataKey:`count`,name:`Tasks`,fill:I.stage}),b?(0,K.jsx)(p,{x:b,stroke:I.accent,label:`P50`}):null,x?(0,K.jsx)(p,{x,stroke:I.warning,label:`P95`}):null]})})}function Yi({finding:e}){let t=(0,W.useId)(),n=ce(e),r=e.impactEstimate;if(!r)return null;let i=n?.board;if(!i)return null;let a=`Estimate method: ${r.estimateMethod}`;return(0,K.jsxs)(`span`,{className:`impact-estimate text-xs text-muted-foreground`,title:a,tabIndex:0,"aria-describedby":t,children:[`Potential savings: `,(0,K.jsx)(`strong`,{children:i}),(0,K.jsx)(`span`,{id:t,className:`sr-only`,children:a})]})}var Xi=[`PROCESS_LOCAL`,`NODE_LOCAL`,`RACK_LOCAL`,`NO_PREF`,`ANY`],Zi=[I.clean,I.accent,I.warning,I.muted,I.critical];function Qi(e){return e?new Date(e).toLocaleString():`—`}function $i({stats:e}){let t=new Map(e.map(e=>[e.locality,e.count])),n=Xi.filter(e=>t.has(e));for(let t of e)Xi.includes(t.locality)||n.push(t.locality);let r=n.map((e,n)=>({locality:e,count:t.get(e)??0,color:Zi[Math.min(n,Zi.length-1)]}));return(0,K.jsx)(L,{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,K.jsxs)(l,{data:r,children:[(0,K.jsx)(c,{vertical:!1,stroke:I.muted,strokeOpacity:.2}),(0,K.jsx)(m,{dataKey:`locality`,tick:{fontSize:10}}),(0,K.jsx)(f,{allowDecimals:!1,tick:{fontSize:10},width:32}),(0,K.jsx)(g,{formatter:e=>[`${Number(e)} task${Number(e)===1?``:`s`}`,`Tasks`]}),(0,K.jsx)(u,{dataKey:`count`,name:`Tasks`,children:r.map(e=>(0,K.jsx)(a,{fill:e.color},e.locality))})]})})}function ea(e,t){let n=new Map;for(let t of e){n.has(t.type)||n.set(t.type,{impactBand:t.impactBand,finding:t,recs:new Map});let e=n.get(t.type);ie[t.impactBand]<ie[e.impactBand]&&(e.impactBand=t.impactBand,e.finding=t),t.recommendation&&!e.recs.has(t.recommendation)&&e.recs.set(t.recommendation,{extended:t.type===`retryWaste`?t.extended??null:null})}let r=e=>t.includes(e)?t.indexOf(e):t.length;return[...n.entries()].sort(([e],[t])=>r(e)-r(t))}function ta({rec:e,extended:t,finding:n,showImpactEstimate:r}){let{measured:i,fix:a}=xt(e);return(0,K.jsxs)(`div`,{className:`space-y-1 text-sm`,children:[i?(0,K.jsxs)(`p`,{className:`max-w-full leading-normal break-words`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`What's happening: `}),i]}):null,(0,K.jsxs)(`p`,{className:`max-w-full leading-normal break-words`,children:[(0,K.jsx)(`span`,{className:`font-medium`,children:`What to try: `}),a]}),t?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t}):null,r?(0,K.jsx)(Yi,{finding:n}):null]})}function na(e,t){return`${e} ${t}${e===1?``:`s`}`}function ra(e,t,n){let r=(e.completedAt??0)-(e.submittedAt??0),i=[];if(r>0){let e=t!=null&&t>0?Math.round(r/t*100):null;i.push(`Ran for ${w(r)}${e==null?``:`, ${e}% of this ${w(t)} run`}`)}return(e.taskCount??0)>0&&i.push(`split into ${na(e.taskCount,`task`)}`),[i.length>0?`${i.join(`, `)}.`:``,n===0?`Nothing was flagged on this stage.`:n===1?`1 finding here.`:`${n} findings here. They often share one cause, so start with the first.`].filter(Boolean).join(` `)}function ia({stage:e,findings:t,typeOrder:n,catalog:r,runMs:i,onShowEvidence:a}){let o=P(),s=ea(t,n);return(0,K.jsxs)(`section`,{"aria-label":`Why this stage was flagged`,className:`space-y-3`,children:[(0,K.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:ra(e,i,s.length)}),s.length>0?(0,K.jsx)(`ol`,{className:`space-y-4 rounded-md border p-3`,children:s.map(([e,{impactBand:t,finding:n,recs:i}])=>{let s=he(o,n)?.compact!=null,c=a?Gr(n,r):null;return(0,K.jsxs)(`li`,{className:`space-y-1.5`,"data-testid":`stage-finding`,children:[(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,K.jsx)(M,{type:e,impactBand:t}),(0,K.jsx)(`h3`,{className:`text-sm font-semibold`,children:Ct(n)})]}),[...i.entries()].map(([e,{extended:t}],r)=>(0,K.jsx)(ta,{rec:e,extended:t,finding:n,showImpactEstimate:r===0&&s},r)),c&&a?(0,K.jsxs)(H,{size:`sm`,variant:`outline`,onClick:()=>a(c),children:[`Show evidence`,(0,K.jsx)(ft,{"aria-hidden":`true`})]}):null]},e)})}):null]})}function aa({stage:e,appModel:t}){return Ue(e.id,t)?(0,K.jsx)(qe,{title:`Query Plan`,children:(0,K.jsx)(Ye,{stageId:e.id,appModel:t})}):null}function oa({stage:e,appModel:t,catalog:n,getTaskData:r,onShowEvidence:i}){let{exportMode:a,getTaskData:o}=Zn(r),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(!1),[d,f]=(0,W.useState)(0),p=(e.taskCount??0)>0,m=P(),h=m?.data.stages[String(e.id)],g=m&&h?h.findingIndexes.map(e=>ye(m,e)).filter(e=>e!=null):[];(0,W.useEffect)(()=>{if(!p||!o)return;let t=!1;return u(!1),o(e.id).catch(()=>null).then(e=>{t||(e?c(e):u(!0))}),()=>{t=!0}},[d]);let _=(e.completedAt??0)-(e.submittedAt??0),v=(e.memoryBytesSpilled??0)>0||(e.diskBytesSpilled??0)>0,y=(e.jvmGCTime??0)>0||(e.gcPct??0)>0,b=e.fetchWaitTime??0,x=b>0&&_>0?Math.round(b/_*100):null,S=(e.inputBytes??0)>0?((e.outputBytes??0)/(e.inputBytes??0)).toFixed(2):null,C=e.localityStats??[];return(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsx)(ia,{stage:e,findings:g,typeOrder:h?.typeOrder??[],catalog:n,runMs:m?.data.runShape.wallClockMs??null,onShowEvidence:i}),(0,K.jsx)(Re,{title:`Overview`,collapsible:!0,defaultOpen:!0,rows:[[`Duration`,w(_)],[`Submitted`,Qi(e.submittedAt)],[`Completed`,Qi(e.completedAt)],e.sqlExecutionId!=null&&[`SQL Execution`,`#${e.sqlExecutionId}`],e.stageType?[`Stage type`,e.stageType]:!1]}),(0,K.jsx)(Re,{title:`Tasks`,collapsible:!0,rows:[[`Total`,String(e.taskCount)],[`Failed`,String(e.failedTasks)],[`P50 duration`,(e.taskDurationP50??0)>0?w(e.taskDurationP50):`—`],[`P95 duration`,(e.taskDurationP95??0)>0?w(e.taskDurationP95):`—`],[`Max duration`,(e.taskDurationMax??0)>0?w(e.taskDurationMax):`—`],(e.peakExecutionMemoryMax??0)>0&&[`Peak execution memory`,A(e.peakExecutionMemoryMax)]],children:p?a?(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Per-task duration data isn’t included in exported reports.`}):s?(0,K.jsx)(Ji,{metrics:s.metrics,fieldNames:s.fieldNames,markers:{p50:e.taskDurationP50,p95:e.taskDurationP95}}):l?(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Couldn’t load task data for this stage.`}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>f(e=>e+1),children:`Retry`})]}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Loading task data…`}):null}),(0,K.jsx)(Re,{title:`Locality`,collapsible:!0,rows:[],children:C.length>0?(0,K.jsx)($i,{stats:C}):null}),(0,K.jsx)(Re,{title:`I/O`,collapsible:!0,rows:[[`Input`,A(e.inputBytes)],[`Output`,A(e.outputBytes)],[`Shuffle read`,A(e.shuffleReadBytes)],[`Shuffle write`,A(e.shuffleWriteBytes)],b>0&&[`Fetch wait`,`${w(b)}${x==null?``:` (${x}%)`}`],S!=null&&[`I/O ratio`,S]]}),v?(0,K.jsx)(Re,{title:`Spill`,collapsible:!0,rows:[[`Memory spilled`,A(e.memoryBytesSpilled)],[`Disk spilled`,A(e.diskBytesSpilled)],(e.memoryBytesSpilled??0)>0&&[`Classification`,e.spillClassification??`unclassified`]]}):null,y?(0,K.jsx)(Re,{title:`GC`,collapsible:!0,rows:[[`JVM GC time`,w(e.jvmGCTime)],[`Executor run time`,w(e.executorRunTime)],[`GC %`,`${(e.gcPct??0).toFixed(1)}%`]]}):null,e.details?(0,K.jsx)(N,{children:(0,K.jsx)(qe,{title:`Call Stack`,children:(0,K.jsx)(`pre`,{className:`overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre-wrap`,children:e.details})})}):null,(0,K.jsx)(aa,{stage:e,appModel:t})]})}function sa({appModel:e,catalog:t,getTaskData:n,onRoute:r}){let{stageId:i,close:a}=Et(),o=i==null?void 0:e.stages.get(i),s=o!=null,c=(0,W.useRef)(!1),l=r?e=>{c.current=!0,a(),r(e)}:void 0;return(0,K.jsx)(it,{open:s,onOpenChange:e=>{e||a()},children:(0,K.jsx)(Tt,{className:`max-h-[85vh] overflow-y-auto sm:max-w-4xl`,finalFocus:()=>{let e=c.current;return c.current=!1,!e},children:o?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(at,{children:[(0,K.jsxs)(dt,{children:[`Stage `,o.id]}),o.name?(0,K.jsxs)(ht,{className:`font-mono text-xs [overflow-wrap:anywhere]`,children:[(0,K.jsx)(`span`,{className:`font-sans`,children:`Code location: `}),o.name]}):null]}),(0,K.jsx)(oa,{stage:o,appModel:e,catalog:t,getTaskData:n,onShowEvidence:l},o.id)]}):null})})}function ca(e){return la(e)||typeof e==`function`||ua(e)}function la(e){return typeof e==`function`&&(()=>{let t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function ua(e){return typeof e==`object`&&typeof e.$$typeof==`symbol`&&[`react.memo`,`react.forward_ref`].includes(e.$$typeof.description)}function da(e,t){return e==null?null:ca(e)?W.createElement(e,t):e}function fa(e){if(`cell`in e&&e.cell){let t=e.cell,n=t.column.columnDef,r=t,i=n;return r.getIsAggregated?.()?da(i.aggregatedCell??n.cell,t.getContext()):r.getIsPlaceholder?.()?null:da(n.cell,t.getContext())}return`header`in e&&e.header?da(e.header.column.columnDef.header,e.header.getContext()):`footer`in e&&e.footer?da(e.footer.column.columnDef.footer,e.footer.getContext()):null}function pa({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 ma(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 ha=[],ga=0,{link:_a,unlink:va,propagate:ya,checkDirty:ba,shallowPropagate:xa}=pa({update(e){return e._update()},notify(e){ha[Ca++]=e,e.flags&=-3},unwatched(e){e.depsTail!==void 0&&(e.depsTail=void 0,e.flags=17,Ea(e))}}),Sa=0,Ca=0,J,wa=0;function Ta(e){try{++wa,e()}finally{--wa||Da()}}function Ea(e){let t=e.depsTail,n=t===void 0?e.deps:t.nextDep;for(;n!==void 0;)n=va(n,e)}function Da(){if(!(wa>0)){for(;Sa<Ca;){let e=ha[Sa];ha[Sa++]=void 0,e.notify()}Sa=0,Ca=0}}function Oa(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 J!==void 0&&_a(i,J,ga),i._snapshot},subscribe(e){let t=ma(e),n={current:!1},r=ka(()=>{i.get(),n.current?t.next?.(i._snapshot):n.current=!0});return{unsubscribe:()=>{r.stop()}}},_update(e){let a=J,o=t?.compare??Object.is;if(n)J=i,++ga,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{J=a,n&&(i.flags&=-5),Ea(i)}}};return n?(i.flags=17,i.get=function(){let e=i.flags;if(e&16||e&32&&ba(i.deps,i)){if(i._update()){let e=i.subs;e!==void 0&&xa(e)}}else e&32&&(i.flags=e&-33);return J!==void 0&&_a(i,J,ga),i._snapshot}):i.set=function(e){if(i._update(e)){let e=i.subs;e!==void 0&&(ya(e),xa(e),Da())}},i}function ka(e){let t=()=>{let t=J;J=n,++ga,n.depsTail=void 0,n.flags=6;try{return e()}finally{J=t,n.flags&=-5,Ea(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&&ba(this.deps,this)?t():this.flags=2},stop(){this.flags=0,this.depsTail=void 0,Ea(this)}};return t(),n}function Aa(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=ja(e);if(n.length!==ja(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 ja(e){return Object.keys(e).concat(Object.getOwnPropertySymbols(e))}var Ma=e(r(),1);function Na(e,t){return e===t}function Pa(e,t=e=>e,n){let r=n?.compare??Na,i=(0,W.useCallback)(t=>{let{unsubscribe:n}=e.subscribe(t);return n},[e]),a=(0,W.useCallback)(()=>e.get(),[e]);return(0,Ma.useSyncExternalStoreWithSelector)(i,a,a,t,r)}function Fa(e){let t=Pa(e.source,e.selector,{compare:Aa});return typeof e.children==`function`?e.children(t):e.children}function Ia(e){let t=e;return Object.defineProperty(e,"state",{get(){return e.get()}}),`set`in e&&(t.setState=e.set.bind(e)),t}function La(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 Ra(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 za(){return La({createAtom:Oa,batch:Ta})}function Ba(e,t){return typeof e==`function`?e(t):e}function Y(e){if(Array.isArray(e))return e.map(Y);if(e&&typeof e==`object`){let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return e;let n=t===null?X():{},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:Y(e[i]),writable:!0})}return n}return e}function Va(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 X(){return Object.create(null)}function Ha(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ua(e,t){return n=>{(t.options.atoms?.[e]??t.baseAtoms[e]).set(e=>Ba(n,e))}}function Wa(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 Ga(e){return Reflect.ownKeys(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}var Ka=3;function qa(e,t){return Ja(e,t,Ka)}function Ja(e,t,n){if(Object.is(e,t))return!0;if(n<=0||!Wa(e)||!Wa(t)||(Array.isArray(e)||Array.isArray(t))&&(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length))return!1;let r=Ga(e),i=Ga(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)||!Ja(a[i],o[i],n-1))return!1}return!0}function Ya(e,t,n,r=qa){let i=`on${t.charAt(0).toUpperCase()}${t.slice(1)}Change`,a=e.options[i];a&&a(e=>{let t=Ba(n,e);return r(e,t)?e:t})}function Xa(e){return e instanceof Function}function Za(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 Qa=({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 $a(e){let t=!1;return()=>{if(!t){t=!0;return}e()}}function eo({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 Qa({...a,...s})}function to(e,t=`_`){let[n,r]=e.split(t);return{fnKey:r,fnName:`${n}.${r}`,parentName:n}}function Z(e,t,n){for(let[r,{fn:i,memoDeps:a}]of Object.entries(n)){let{fnKey:n,fnName:o}=to(r);t[n]=a?eo({memoDeps:a,fn:i,fnName:o,table:t,feature:e}):i}}function no(e,t,n,r){for(let[i,{fn:a,memoDeps:o}]of Object.entries(r)){let{fnKey:r,fnName:s}=to(i);if(o){let i=`_memo_${r}`;t[r]=function(...t){if(!this[i]){let t=this;this[i]=eo({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 Q(e,t,n,...r){return e[t]?.(...r)??n(e,...r)}function ro(e){return e.row.getValue(e.column.id)}function io(e){return e.getValue()??e.table.options.renderFallbackValue}function ao(e){return{table:e.table,column:e.column,row:e.row,cell:e,getValue:()=>e.getValue(),renderValue:()=>e.renderValue()}}var oo={assignCellPrototype:(e,t)=>{no(`coreCellsFeature`,e,t,{cell_getValue:{fn:e=>ro(e)},cell_renderValue:{fn:e=>io(e)},cell_getContext:{fn:e=>ao(e),memoDeps:e=>[e]}})}};function so(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 co(e,t,n){let r=so(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 lo(){return{start:[],end:[]}}function uo(){return X()}function fo(e,t){po(e)&&yo(e.table,n=>{let r=Object.assign(X(),n),i=t??!Q(e,`getIsVisible`,$),a=e.getLeafColumns();for(let e=0;e<a.length;e++){let t=a[e];po(t)&&(r[t.id]=i)}return r})}function $(e){let t=e.table.atoms.columnVisibility?.get();if(!t)return!0;let n=e.columns;return n.length?n.some(e=>Q(e,`getIsVisible`,$)):(Ha(t,e.id)?t[e.id]:void 0)??!0}function po(e){return(e.columnDef.enableHiding??!0)&&(e.table.options.enableHiding??!0)}function mo(e){return t=>{fo(e,t.target.checked)}}function ho(e){let t=e.getAllCells(),n=[];for(let e=0;e<t.length;e++){let r=t[e];Q(r.column,`getIsVisible`,$)&&n.push(r)}let{start:r,end:i}=e.table.atoms.columnPinning?.get()??lo();if(!r.length&&!i.length)return n;let a=Q(e,`getVisibleCellsByColumnId`,go),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 go(e){let t=X(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];Q(r.column,`getIsVisible`,$)&&(t[r.column.id]=r)}return t}function _o(e){return e.getAllFlatColumns().filter(e=>Q(e,`getIsVisible`,$))}function vo(e){return e.getAllLeafColumns().filter(e=>Q(e,`getIsVisible`,$))}function yo(e,t){Ya(e,`columnVisibility`,t)}function bo(e,t){yo(e,t?X():Object.assign(X(),Y(e.initialState.columnVisibility??{})))}function xo(e,t){t??=!So(e);let n=X(),r=e.getAllLeafColumns();for(let e=0;e<r.length;e++){let i=r[e];n[i.id]=t||!po(i)}yo(e,n)}function So(e){return!e.getAllLeafColumns().some(e=>!Q(e,`getIsVisible`,$))}function Co(e){return e.getAllLeafColumns().some(e=>Q(e,`getIsVisible`,$))}function wo(e){return t=>{xo(e,t.target.checked)}}function To(e,t=1){let n=t;for(let r=0;r<e.length;r++){let i=e[r];Q(i,`getIsVisible`,$)&&i.columns.length&&(n=Math.max(n,To(i.columns,t+1)))}return n}function Eo(e,t){return e?`${e}_${t}`:String(t)}function Do(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 Oo(e,t){let n=0;for(let r=0;r<e.length;r++)e[r].column===t&&n++;return n}function ko(e,t,n,r,i,a){let o={depth:t,id:Eo(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=co(n,u,{id:Do(r,t,u.id,a.id),isPlaceholder:d,placeholderId:d?String(Oo(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&&ko(s,t-1,n,r,i,a)}function Ao(e){for(let t=0;t<e.length;t++){let n=e[t];if(!Q(n.column,`getIsVisible`,$))continue;let r=0;if(n.subHeaders.length){Ao(n.subHeaders);for(let e=0;e<n.subHeaders.length;e++){let t=n.subHeaders[e];Q(t.column,`getIsVisible`,$)&&(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 jo(e,t,n,r){let i=To(e),a=[],o=n._headerGroupInstanceInitFns,s=Array(t.length);for(let e=0;e<t.length;e++)e in t&&(s[e]=co(n,t[e],{depth:i,index:e}));return ko(s,i-1,n,r,a,o),a.reverse(),Ao(a[0]?.headers??[]),a}function Mo(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 No(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=Mo(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 Po(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 Fo(e,r)}}function Fo(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 Io(e){return[e,...e.columns.flatMap(e=>e.getFlatColumns())]}function Lo(e){if(e.columns.length){let t=e.columns.flatMap(e=>e.getLeafColumns());return Q(e.table,`getOrderColumns`,Po)(t)}return[e]}function Ro(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 zo(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=No(e,o,r,n),c=o;s.columns=c.columns?zo(e,c.columns,s,r+1):[],i[a]=s}return i}function Bo(e){return zo(e,e.options.columns)}function Vo(e){return e.getAllColumns().flatMap(e=>e.getFlatColumns())}function Ho(e){let t=X(),n=e.getAllFlatColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function Uo(e){let t=e.getAllColumns().flatMap(e=>e.getLeafColumns());return Q(e,`getOrderColumns`,Po)(t)}function Wo(e){let t=X(),n=e.getAllLeafColumns();for(let e=0;e<n.length;e++){let r=n[e];t[r.id]=r}return t}function Go(e,t){return e.getAllFlatColumnsById()[t]}var Ko={assignColumnPrototype:(e,t)=>{no(`coreColumnsFeature`,e,t,{column_getFlatColumns:{fn:e=>Io(e),memoDeps:e=>[e.table.options.columns]},column_getLeafColumns:{fn:e=>Lo(e),memoDeps:e=>[e.table.atoms.columnOrder?.get(),e.table.atoms.grouping?.get(),e.table.options.columns,e.table.options.groupedColumnMode]}})},constructTableAPIs:e=>{Z(`coreColumnsFeature`,e,{table_getDefaultColumnDef:{fn:()=>Ro(e),memoDeps:()=>[e.options.defaultColumn]},table_getAllColumns:{fn:()=>Bo(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumns:{fn:()=>Vo(e),memoDeps:()=>[e.options.columns]},table_getAllFlatColumnsById:{fn:()=>Ho(e),memoDeps:()=>[e.options.columns]},table_getAllLeafColumns:{fn:()=>Uo(e),memoDeps:()=>[e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getAllLeafColumnsById:{fn:()=>Wo(e),memoDeps:()=>[e.getAllLeafColumns()]},table_getColumn:{fn:t=>Go(e,t)}})}};function qo(e,t){for(let n=0;n<e.subHeaders.length;n++)qo(e.subHeaders[n],t);t.push(e)}function Jo(e){let t=[];return qo(e,t),t}function Yo(e){return{column:e.column,header:e,table:e.column.table}}function Xo(e){let{start:t,end:n}=e.atoms.columnPinning?.get()??lo(),r=e.getAllColumns(),i=Q(e,`getVisibleLeafColumns`,vo);if(!t.length&&!n.length)return jo(r,i,e);let a=e.getAllLeafColumnsById(),o=[];for(let e=0;e<t.length;e++){let n=a[t[e]];n&&Q(n,`getIsVisible`,$)&&o.push(n)}let s=[];for(let e=0;e<n.length;e++){let t=a[n[e]];t&&Q(t,`getIsVisible`,$)&&s.push(t)}let c=i.filter(e=>!t.includes(e.id)&&!n.includes(e.id));return jo(r,[...o,...c,...s],e)}function Zo(e){return[...e.getHeaderGroups()].reverse()}function Qo(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 $o(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 es={assignHeaderPrototype:(e,t)=>{no(`coreHeadersFeature`,e,t,{header_getLeafHeaders:{fn:e=>Jo(e),memoDeps:e=>[e.column.table.options.columns]},header_getContext:{fn:e=>Yo(e),memoDeps:e=>[e.column.table.options.columns]}})},constructTableAPIs:e=>{Z(`coreHeadersFeature`,e,{table_getHeaderGroups:{fn:()=>Xo(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:()=>Zo(e),memoDeps:()=>[e.getHeaderGroups()]},table_getFlatHeaders:{fn:()=>Qo(e),memoDeps:()=>[e.getHeaderGroups()]},table_getLeafHeaders:{fn:()=>$o(e),memoDeps:()=>[e.getHeaderGroups()]}})}};function ts(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 ns=(e,t,n,r,i,a,o)=>{let s=ts(e),c=Object.create(s);c._displayIndexCache=-1,c._uniqueValuesCache=X(),c._valuesCache=X(),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},rs=/([0-9]+)/gm;function is(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}is({resolveDataValue:e=>cs(e).toLowerCase(),sort:(e,t)=>ls(e,t)}),is({resolveDataValue:e=>cs(e),sort:(e,t)=>ls(e,t)}),is({resolveDataValue:e=>cs(e).toLowerCase(),sort:(e,t)=>os(e,t)}),is({resolveDataValue:e=>cs(e),sort:(e,t)=>os(e,t)}),is({resolveDataValue:e=>ss(e),sort:(e,t)=>e>t?1:e<t?-1:0});var as=is({sort:(e,t)=>os(e,t)});function os(e,t){return e===t?0:e>t?1:-1}function ss(e){return e instanceof Date?e.getTime():e}function cs(e){return typeof e==`number`?isNaN(e)||e===1/0||e===-1/0?``:String(e):typeof e==`string`?e:``}function ls(e,t){let n=0,r=0,i=e.length,a=t.length;for(;n<i&&r<a;){let i=us(e.charCodeAt(n)),a=us(t.charCodeAt(r)),o=ds(e,n,i),s=ds(t,r,a);if(!i&&!a){let i=fs(e,n,o,t,r,s);if(i)return i;n=o,r=s;continue}if(i!==a)return i?1:-1;let c=ps(e,n,o,t,r,s);if(c)return c;n=o,r=s}return hs(e,n)-hs(t,r)}function us(e){return e>=48&&e<=57}function ds(e,t,n){let r=t+1;for(;r<e.length&&us(e.charCodeAt(r))===n;)r++;return r}function fs(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 ps(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=ms(e,o,n),i=ms(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 ms(e,t,n){let r=0;for(let i=t;i<n;i++)r=r*10+e.charCodeAt(i)-48;return r}function hs(e,t){let n=0,r=t;for(;r<e.length;)n++,r=ds(e,r,us(e.charCodeAt(r)));return n}function gs(){return[]}function _s(e,t){Ya(e,`cellSelection`,t?gs():Y(e.initialState.cellSelection)??gs())}function vs(e){e.atoms.cellSelection&&(e.options.autoResetAll??e.options.autoResetCellSelection??!0)&&e._reactivity.schedule(()=>_s(e))}function ys(e){e.atoms.expanded&&(e.options.autoResetAll??e.options.autoResetExpanded??!e.options.manualExpanding)&&e._reactivity.schedule(()=>bs(e))}function bs(e,t){let n=e.initialState.expanded;Ya(e,`expanded`,t?X():n===!0||Object.assign(X(),Y(n??{})))}function xs(e){let t=e.table.atoms.expanded?.get()??{};return!!(e.table.options.getIsRowExpanded?.(e)??(t===!0||Ss(t,e.id)))}function Ss(e,t){return!!(e&&e!==!0&&Ha(e,t)&&e[t])}var Cs=0,ws=10;function Ts(){return{pageIndex:Cs,pageSize:ws}}function Es(e){if(e.options.autoResetAll??e.options.autoResetPageIndex??!e.options.manualPagination){if((e.atoms.pagination?.get()?.pageIndex??Cs)===Cs)return;As(e,!0)}}function Ds(e,t){Ya(e,`pagination`,t)}function Os(e,t){Ds(e,t?Ts():Y(e.initialState.pagination??Ts()))}function ks(e,t){Ds(e,n=>{let r=Ba(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 As(e,t){ks(e,t?Cs:e.initialState.pagination?.pageIndex??Cs)}function js(e,t){Ms(e,t?ws:e.initialState.pagination?.pageSize??ws)}function Ms(e,t){Ds(e,e=>{let n=Math.max(1,Ba(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 Ns(e){let t=Vs(e),n=[];return t&&t>0&&(n=[...Array(t)].fill(null).map((e,t)=>t)),n}function Ps(e){return(e.atoms.pagination?.get()?.pageIndex??0)>0}function Fs(e){let t=e.atoms.pagination?.get()?.pageIndex??Cs,n=Vs(e);return n===-1||n!==0&&t<n-1}function Is(e){let t=e.atoms.pagination?.get()?.pageIndex??Cs,n=Vs(e);return Number.isFinite(n)&&n>0&&t<n-1}function Ls(e){return ks(e,e=>e-1)}function Rs(e){return ks(e,e=>e+1)}function zs(e){return ks(e,0)}function Bs(e){let t=Vs(e);if(!(!Number.isFinite(t)||t<=0))return ks(e,t-1)}function Vs(e){let t=e.options.pageCount;if(t!=null)return t;let n=Hs(e),r=e.atoms.pagination?.get()?.pageSize??ws;return r===1/0&&Number.isFinite(n)&&n>0?1:Math.ceil(n/r)}function Hs(e){return e.options.rowCount??e.getPrePaginatedRowModel().rows.length}function Us(){return[]}function Ws(e,t){Ya(e,`sorting`,t)}function Gs(e,t){Ws(e,t?[]:Y(e.initialState.sorting??[]))}function Ks(e){e.atoms.sorting&&(e.options.autoResetAll??e.options.autoResetSorting??!1)&&Gs(e)}function qs(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(rs).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 as}function Js(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 Ys(e){let t=e.table._rowModelFns.sortFns;return Xa(e.columnDef.sortFn)?e.columnDef.sortFn:e.columnDef.sortFn===`auto`?qs(e):t?.[e.columnDef.sortFn]??as}function Xs(e,t,n){let r=Qs(e,n&&ec(e)),i=t!==void 0;Ws(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&&ec(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 Zs(e){return e.columnDef.sortDescFirst??e.table.options.sortDescFirst??Js(e)===`desc`?`desc`:`asc`}function Qs(e,t){let n=Zs(e),r=tc(e);return r?r!==n&&(e.table.options.enableSortingRemoval??!0)&&(!t||(e.table.options.enableMultiRemove??!0))?!1:r===`desc`?`asc`:`desc`:n}function $s(e){return(e.columnDef.enableSorting??!0)&&(e.table.options.enableSorting??!0)&&!!e.accessorFn}function ec(e){return e.columnDef.enableMultiSort??e.table.options.enableMultiSort??!!e.accessorFn}function tc(e){let t=e.table.atoms.sorting?.get()?.find(t=>t.id===e.id);return t?t.desc?`desc`:`asc`:!1}function nc(e){return e.table.atoms.sorting?.get()?.findIndex(t=>t.id===e.id)??-1}function rc(e){Ws(e.table,t=>t.length?t.filter(t=>t.id!==e.id):[])}function ic(e){let t=$s(e);return n=>{t&&Xs(e,void 0,ec(e)?e.table.options.isMultiSortEvent?.(n):!1)}}function ac(){return e=>eo({feature:`coreRowModelsFeature`,table:e,fnName:`table.getCoreRowModel`,memoDeps:()=>[e.options.data],fn:()=>sc(e,e.options.data),onAfterUpdate:$a(()=>{ys(e),Es(e),Ks(e),vs(e)})})}function oc(e,t,n,r=0,i){let a=[];for(let o=0;o<n.length;o++){let s=n[o],c=ns(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=oc(e,t,c.originalSubRows,r+1,c)))}return a}function sc(e,t){let n={rows:[],flatRows:[],rowsById:X()};return n.rows=oc(e,n,t),n}function cc(e){return e._rowModels.coreRowModel||(e._rowModels.coreRowModel=e.options.features.coreRowModel?.(e)??ac()(e)),e._rowModels.coreRowModel()}function lc(e){return e.getCoreRowModel()}function uc(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 dc(e){return e.getFilteredRowModel()}function fc(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 pc(e){return e.getGroupedRowModel()}function mc(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 hc(e){return e.getSortedRowModel()}function gc(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 _c(e){return e.getExpandedRowModel()}function vc(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 yc(e){return e.getPaginatedRowModel()}var bc={constructTableAPIs:e=>{Z(`coreRowModelsFeature`,e,{table_getCoreRowModel:{fn:()=>cc(e)},table_getPreFilteredRowModel:{fn:()=>lc(e)},table_getFilteredRowModel:{fn:()=>uc(e)},table_getPreGroupedRowModel:{fn:()=>dc(e)},table_getGroupedRowModel:{fn:()=>fc(e)},table_getPreSortedRowModel:{fn:()=>pc(e)},table_getSortedRowModel:{fn:()=>mc(e)},table_getPreExpandedRowModel:{fn:()=>hc(e)},table_getExpandedRowModel:{fn:()=>gc(e)},table_getPrePaginatedRowModel:{fn:()=>_c(e)},table_getPaginatedRowModel:{fn:()=>vc(e)},table_getRowModel:{fn:()=>yc(e)}})}};function xc(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 Sc(e,t,n){let r=xc(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 Cc(e){let t=e.table.getRowsInDisplayOrder(),n=e._displayIndexCache;return t[n]===e?n:-1}function wc(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 Tc(e,t){if(Ha(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 Ec(e,t){if(Ha(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 Dc(e,t){return e.getValue(t)??e.table.options.renderFallbackValue}function Oc(e){return Za(e.subRows,e=>e.subRows)}function kc(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 Ac(e){if(e.parentId)return e.table.getCoreRowModel().rowsById[e.parentId]??e.table.getRow(e.parentId,!0)}function jc(e){let t=[],n=e;for(;;){let e=n.getParentRow();if(!e)break;t.push(e),n=e}return t.reverse()}function Mc(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=Sc(a,e,e.table),n.set(a,o)),r[i]=o}return r}function Nc(e){let t=X(),n=e.getAllCells();for(let e=0;e<n.length;e++){let r=n[e];t[r.column.id]=r}return t}function Pc(e,t,n,r){return t.options.getRowId?.(e,n,r)??(r?`${r.id}.${n}`:String(n))}function Fc(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 Ic={assignRowPrototype:(e,t)=>{no(`coreRowsFeature`,e,t,{row_getDisplayIndex:{fn:e=>Cc(e)},row_getAllCellsByColumnId:{fn:e=>Nc(e),memoDeps:e=>[e.getAllCells()]},row_getAllCells:{fn:e=>Mc(e),memoDeps:e=>[e.table.getAllLeafColumns()]},row_getLeafRows:{fn:e=>Oc(e),memoDeps:e=>[e.subRows]},row_getParentRow:{fn:e=>Ac(e)},row_getParentRows:{fn:e=>jc(e)},row_getUniqueValues:{fn:(e,t)=>Ec(e,t)},row_getValue:{fn:(e,t)=>Tc(e,t)},row_renderValue:{fn:(e,t)=>Dc(e,t)}})},constructTableAPIs:e=>{Z(`coreRowsFeature`,e,{table_getRowsInDisplayOrder:{fn:()=>wc(e),memoDeps:()=>[e.getPrePaginatedRowModel().rows,e.options.paginateExpandedRows,e.options.paginateExpandedRows===!1?e.atoms.expanded?.get():void 0]},table_getRowId:{fn:(t,n,r)=>Pc(t,e,n,r)},table_getRow:{fn:(t,n)=>Fc(e,t,n)},table_getMaxSubRowDepth:{fn:()=>kc(e),memoDeps:()=>[e.getCoreRowModel()]}})}};function Lc(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 Rc(e,t,n=(e,t)=>e===t){e._reactivity.batch(()=>{Lc(e,t,n),e._reactivity.commit?.()})}function zc(e){let t=Y(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 Bc(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 Vc(e,t,n){let r=Bc(e,Ba(t,e.options));e.optionsStore?e.optionsStore.set(()=>r):e.options=r,n?.syncExternalState!==!1&&Rc(e,r.state??null)}var Hc={coreCellsFeature:oo,coreColumnsFeature:Ko,coreHeadersFeature:es,coreRowModelsFeature:bc,coreRowsFeature:Ic,coreTablesFeature:{constructTableAPIs:e=>{Z(`coreTablesFeature`,e,{table_reset:{fn:()=>zc(e)},table_setOptions:{fn:t=>Vc(e,t)}})}}};function Uc(e){return e}function Wc(e,t={}){return Object.values(e).forEach(e=>{t=e.getInitialState?.(t)??t}),Y(t)}function Gc(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:{...Hc,..._},_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=Wc(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&&Ha(i,n)){let e=i[n];return e===void 0?v.initialState[n]:e}return r},{debugName:`table/atoms/${n}`})}Lc(v),v.store=Ia(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:Aa,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 Kc={getInitialState:e=>({columnVisibility:uo(),...e}),getDefaultTableOptions:e=>({onColumnVisibilityChange:Ua(`columnVisibility`,e)}),assignColumnPrototype:(e,t)=>{no(`columnVisibilityFeature`,e,t,{column_getIsVisible:{fn:e=>$(e),memoDeps:e=>[t.options.columns,t.atoms.columnVisibility?.get(),e.columns]},column_getCanHide:{fn:e=>po(e)},column_getToggleVisibilityHandler:{fn:e=>mo(e)},column_toggleVisibility:{fn:(e,t)=>fo(e,t)}})},assignRowPrototype:(e,t)=>{no(`columnVisibilityFeature`,e,t,{row_getVisibleCells:{fn:e=>ho(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnPinning?.get(),t.atoms.columnVisibility?.get()]},row_getVisibleCellsByColumnId:{fn:e=>go(e),memoDeps:e=>[e.getAllCells(),t.atoms.columnVisibility?.get()]}})},constructTableAPIs:e=>{Z(`columnVisibilityFeature`,e,{table_getVisibleFlatColumns:{fn:()=>_o(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_getVisibleLeafColumns:{fn:()=>vo(e),memoDeps:()=>[e.atoms.columnVisibility?.get(),e.atoms.columnOrder?.get(),e.atoms.grouping?.get(),e.options.columns,e.options.groupedColumnMode]},table_setColumnVisibility:{fn:t=>yo(e,t)},table_resetColumnVisibility:{fn:t=>bo(e,t)},table_toggleAllColumnsVisible:{fn:t=>xo(e,t)},table_getIsAllColumnsVisible:{fn:()=>So(e)},table_getIsSomeColumnsVisible:{fn:()=>Co(e)},table_getToggleAllColumnsVisibilityHandler:{fn:()=>wo(e)}})}},qc={getInitialState:e=>({...e,pagination:{...Ts(),...e.pagination}}),getDefaultTableOptions:e=>({onPaginationChange:Ua(`pagination`,e)}),constructTableAPIs:e=>{Z(`rowPaginationFeature`,e,{table_autoResetPageIndex:{fn:()=>Es(e)},table_setPagination:{fn:t=>Ds(e,t)},table_resetPagination:{fn:t=>Os(e,t)},table_setPageIndex:{fn:t=>ks(e,t)},table_resetPageIndex:{fn:t=>As(e,t)},table_setPageSize:{fn:t=>Ms(e,t)},table_getPageCount:{fn:()=>Vs(e)},table_resetPageSize:{fn:t=>js(e,t)},table_getPageOptions:{fn:()=>Ns(e)},table_getCanPreviousPage:{fn:()=>Ps(e)},table_getCanNextPage:{fn:()=>Fs(e)},table_getCanLastPage:{fn:()=>Is(e)},table_previousPage:{fn:()=>Ls(e)},table_nextPage:{fn:()=>Rs(e)},table_firstPage:{fn:()=>zs(e)},table_lastPage:{fn:()=>Bs(e)},table_getRowCount:{fn:()=>Hs(e)}})}},Jc={getInitialState(e){return{sorting:Us(),...e}},getDefaultColumnDef(){return{sortFn:`auto`,sortUndefined:1}},getDefaultTableOptions(e){return{autoResetSorting:!1,onSortingChange:Ua(`sorting`,e),isMultiSortEvent:e=>e.shiftKey}},assignColumnPrototype(e,t){no(`rowSortingFeature`,e,t,{column_getAutoSortFn:{fn:e=>qs(e)},column_getAutoSortDir:{fn:e=>Js(e)},column_getSortFn:{fn:e=>Ys(e)},column_toggleSorting:{fn:(e,t,n)=>Xs(e,t,n)},column_getFirstSortDir:{fn:e=>Zs(e)},column_getNextSortingOrder:{fn:(e,t)=>Qs(e,t)},column_getCanSort:{fn:e=>$s(e)},column_getCanMultiSort:{fn:e=>ec(e)},column_getIsSorted:{fn:e=>tc(e)},column_getSortIndex:{fn:e=>nc(e)},column_clearSorting:{fn:e=>rc(e)},column_getToggleSortingHandler:{fn:e=>ic(e)}})},constructTableAPIs(e){Z(`rowSortingFeature`,e,{table_setSorting:{fn:t=>Ws(e,t)},table_resetSorting:{fn:t=>Gs(e,t)}})}};function Yc(e){let t=[],n=e=>{t.push(e),e.subRows.length&&xs(e)&&e.subRows.forEach(n)};return e.rows.forEach(n),{rows:t,flatRows:e.flatRows,rowsById:e.rowsById}}function Xc(){return e=>{let t=e;return eo({feature:`rowPaginationFeature`,table:t,fnName:`table.getPaginatedRowModel`,memoDeps:()=>[t.getPrePaginatedRowModel(),t.atoms.pagination?.get(),t.options.paginateExpandedRows?void 0:t.atoms.expanded?.get()],fn:()=>Zc(t)})}}function Zc(e){let t=e.getPrePaginatedRowModel(),n=e.atoms.pagination?.get();if(!t.rows.length)return t;let{pageSize:r,pageIndex:i}=n??Ts(),{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}:Yc({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 Qc(){return e=>{let t=e;return eo({feature:`rowSortingFeature`,table:t,fnName:`table.getSortedRowModel`,memoDeps:()=>[t.atoms.sorting?.get(),t.getPreSortedRowModel()],fn:()=>$c(t),onAfterUpdate:$a(()=>Es(t))})}}function $c(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?$s(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:Ys(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));Va(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 el=typeof window>`u`?W.useEffect:W.useLayoutEffect;function tl(e,t){let[{table:n,rootSource:r}]=(0,W.useState)(()=>{let t=Gc({...e,features:{coreReactivityFeature:za(),...e.features}});return t.Subscribe=(e=>Fa({...e,source:e.source??t.store})),t.FlexRender=fa,{table:t,rootSource:Ra(t.store,Aa)}}),i=n;Vc(i,t=>({...t,...e}),{syncExternalState:!1});let a=i.options.state,o=r.get(),s=Pa(r,t,{compare:Aa});return el(()=>{r.markCommitted(o),Rc(i,a??null,Aa)}),(0,W.useMemo)(()=>({...n,options:e,state:s}),[n,e,s])}var nl=Uc({columnVisibilityFeature:Kc,rowSortingFeature:Jc,rowPaginationFeature:qc,sortedRowModel:Qc(),paginatedRowModel:Xc()}),rl=10,il=10,al=new Set([`duration`,`taskCount`,`shuffleRead`,`fetchWait`,`gcPct`,`skew`,`spill`,`findingCount`]);function ol(e,t){return e.length>t?`${e.slice(0,t)}…`:e}function sl(e){return e<=0?(0,K.jsx)(K.Fragment,{children:`0`}):(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[e,` `,(0,K.jsx)(xe,{label:`RETRY`,impactBand:`critical`})]})}function cl(e,t,n){if(e<=0)return(0,K.jsx)(K.Fragment,{children:`—`});let r=w(e);if(t<=0)return(0,K.jsx)(K.Fragment,{children:r});let i=e/t;return i>.3?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,K.jsx)(xe,{label:n===`advanced`?`${Math.round(i*100)}%`:`High`,impactBand:`critical`})]}):i>.15?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,K.jsx)(xe,{label:n===`advanced`?`${Math.round(i*100)}%`:`Elevated`,impactBand:`info`})]}):(0,K.jsx)(K.Fragment,{children:r})}function ll(e,t){if(!e||e<=0||!t||t<=0)return(0,K.jsx)(K.Fragment,{children:`—`});let n=t/e,r=n<.01?`${n.toExponential(1)}×`:`${n.toFixed(2)}×`;return n>2||n<.1?(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[r,` `,(0,K.jsx)(xe,{label:`extreme`,impactBand:`info`})]}):(0,K.jsx)(K.Fragment,{children:r})}function ul(e,t){if(e<=0)return(0,K.jsx)(K.Fragment,{children:`—`});let n=t??`unclassified`;return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[A(e),` `,(0,K.jsx)(xe,{label:be[n],impactBand:`warning`,title:ae[n]})]})}function dl(e,t){return!e||e<=0?0:(t??0)/e}function fl(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=pe(e);return e.find(e=>e.impactBand===t)??e[0]})}function pl({appModel:e,catalog:t,getTaskData:n,onRoute:r}){let{openStage:i}=Et(),a=k(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(``),[u,d]=(0,W.useState)([]),[f,p]=(0,W.useState)({pageIndex:0,pageSize:rl}),{catalogByStage:m,flaggedStageIds:h}=(0,W.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}},[t]),g=(0,W.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,il),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:fl(m.get(e.id)??[])}))},[e.stages,o,h,m,c]),_=P(),v=(0,W.useMemo)(()=>{if(!r)return null;let e=new Map;for(let n of t){let r=Gr(n,t);r&&e.set(n,r)}return e},[t,r]),y=(0,W.useMemo)(()=>[{id:`id`,header:`Stage`,accessorFn:e=>e.stage.id,cell:({getValue:e})=>{let t=e(),n=me(_).byStage.get(t);return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,K.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,K.jsx)(`strong`,{className:`font-mono font-semibold`,children:t})}),n?(0,K.jsx)(wr,{code:n}):null]})}},{id:`name`,header:`Operation`,accessorFn:e=>e.stage.name??``,cell:({row:e})=>{let t=e.original.stage.id;return(0,K.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-1.5`,children:[ol(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=he(_,e)?.compact??null;return(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[a?(0,K.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-sm 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,K.jsx)(M,{type:e.type,impactBand:e.impactBand,plainBadge:!0})}):(0,K.jsx)(M,{type:e.type,impactBand:e.impactBand}),o?(0,K.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,K.jsx)(Ee,{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,K.jsx)(K.Fragment,{children:w(e())})},{id:`taskCount`,header:`Tasks`,accessorFn:e=>e.stage.taskCount},{id:`retried`,header:`Retried`,accessorFn:e=>e.stage.failedTasks??0,cell:({getValue:e})=>sl(e())},{id:`shuffleRead`,header:`Shuffle Read`,accessorFn:e=>e.stage.shuffleReadBytes??0,cell:({getValue:e})=>(0,K.jsx)(K.Fragment,{children:A(e())})},{id:`fetchWait`,header:`Fetch Wait`,accessorFn:e=>e.stage.fetchWaitTime??0,cell:({row:e})=>cl(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})=>ll(e.original.stage.inputBytes??0,e.original.stage.outputBytes??0)}]:[],{id:`spill`,header:`Spill (mem)`,accessorFn:e=>e.stage.memoryBytesSpilled??0,cell:({row:e})=>ul(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,K.jsxs)(K.Fragment,{children:[e().toFixed(1),`%`]})},{id:`skew`,header:`Skew P95/median`,accessorFn:e=>dl(e.stage.taskDurationP50,e.stage.taskDurationP95),cell:({getValue:e})=>{let t=e();return(0,K.jsx)(K.Fragment,{children:t>0?`${t.toFixed(1)}×`:`—`})}}]:[],{id:`findingCount`,header:`Findings`,accessorFn:e=>e.tags.length,cell:({getValue:e})=>{let t=e();return(0,K.jsx)(K.Fragment,{children:t>0?t:`—`})}}],[t,r,v,i,a,_]),b=tl({features:nl,data:g,columns:y,state:{sorting:u,pagination:f},sortDescFirst:!1,onSortingChange:d,onPaginationChange:p});function x(){s(e=>!e),d([]),p({pageIndex:0,pageSize:rl})}let S=(0,W.useRef)(null),[C,ee]=(0,W.useState)(!0);(0,W.useLayoutEffect)(()=>{let e=S.current?.querySelector(`[data-slot="table-container"]`);if(!e?.firstElementChild||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>ee(e.scrollWidth>e.clientWidth));return t.observe(e),t.observe(e.firstElementChild),()=>t.disconnect()},[]);let T=e=>e===`asc`?` ▲`:e===`desc`?` ▼`:``,te=e=>e===`asc`?`ascending`:e===`desc`?`descending`:`none`;return(0,K.jsx)(U,{title:`Stage Summary`,subtitle:`${g.length} of ${e.stages.size} stage${e.stages.size===1?``:`s`}`,children:(0,K.jsxs)(`div`,{ref:S,className:`space-y-3`,children:[(0,K.jsx)(Le,{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,K.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsx)(`p`,{className:E(`text-muted-foreground text-xs`,!C&&`invisible`),children:`Scroll sideways to see all columns →`}),(0,K.jsx)(H,{type:`button`,variant:`outline`,size:`sm`,onClick:x,children:o?`Top ${il} by duration`:`Problems only`})]}),(0,K.jsxs)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:[`Showing `,g.length,` stage`,g.length===1?``:`s`,`: `,` `,o?`problems only`:`top ${il} by duration`,`.`]}),(0,K.jsxs)(mt,{children:[(0,K.jsx)(gt,{children:b.getHeaderGroups().map(e=>(0,K.jsx)(B,{children:e.headers.map(e=>{let t=e.column.getIsSorted(),n=e.column.getToggleSortingHandler();return(0,K.jsxs)(st,{scope:`col`,tabIndex:e.column.getCanSort()?0:void 0,"aria-sort":te(t),className:E(e.column.getCanSort()&&`tap-target-comfortable cursor-pointer select-none`,al.has(e.column.id)&&`text-right`),onClick:n,onKeyDown:e=>{n&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(e))},children:[da(e.column.columnDef.header,e.getContext()),T(t)]},e.id)})},e.id))}),(0,K.jsx)(Ot,{children:b.getRowModel().rows.length===0?(0,K.jsx)(B,{children:(0,K.jsx)(z,{colSpan:y.length,className:`text-muted-foreground`,children:(0,K.jsxs)(`span`,{className:`flex items-center justify-center gap-2 py-2`,children:[(0,K.jsx)(It,{"aria-hidden":`true`,className:`size-4 shrink-0`}),`No stages to show.`]})})}):b.getRowModel().rows.map(e=>(0,K.jsx)(B,{"data-flag":pe(e.original.tags)??void 0,className:`cursor-pointer`,onClick:()=>i(e.original.stage.id),children:e.getVisibleCells().map(e=>(0,K.jsx)(z,{className:al.has(e.column.id)?`text-right`:void 0,children:da(e.column.columnDef.cell,e.getContext())},e.id))},e.id))})]}),b.getPageCount()>1?(0,K.jsxs)(`div`,{className:`flex items-center justify-end gap-2 text-xs`,children:[(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.previousPage(),disabled:!b.getCanPreviousPage(),children:`Previous`}),(0,K.jsxs)(`span`,{className:`text-muted-foreground`,children:[`Page `,f.pageIndex+1,` of `,b.getPageCount()]}),(0,K.jsx)(H,{type:`button`,variant:`ghost`,size:`sm`,className:`tap-target-comfortable`,onClick:()=>b.nextPage(),disabled:!b.getCanNextPage(),children:`Next`})]}):null]})})}var ml={present:`present`,disabled:`disabled`,notEmitted:`not emitted`,notApplicable:`not applicable`,outsideEventLog:`outside event log`,unknown:`unknown`},hl={present:`info`,disabled:`warning`,notEmitted:`warning`,notApplicable:`muted`,outsideEventLog:`muted`,unknown:`muted`},gl=new Set([`noRddStorageSnapshot`,`noUsableCoreTimeAggregate`,`parseIncomplete`]);function _l({entry:e}){let t=e.evidence?.count,n=Ie(),r=`${e.summary}${t==null?``:` · ${t} observed`}`,i=gl.has(e.reasonCode)?r:t==null?null:`${t} observed`,{tooltipProps:a,srOnlyTooltip:o}=Qe(r);return(0,K.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`,...a,children:[(0,K.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,K.jsx)(Ce,{impactBand:hl[e.state]}),(0,K.jsx)(`span`,{className:`truncate text-sm font-medium`,children:je(e.key)})]}),(0,K.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground`,children:ml[e.state]}),o]}),i?(0,K.jsx)(N,{children:(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:i})}):null]})}function vl(e){return Object.keys(ml).map(t=>[t,e.filter(e=>e.state===t).length]).filter(([,e])=>e>0).map(([e,t])=>`${t} ${ml[e]}`).join(` · `)}function yl({ledger:e}){let{evidenceCardOpen:t,setEvidenceCardOpen:n}=et();return(0,K.jsx)(U,{title:`Evidence availability`,open:t,onOpenChange:n,summary:(0,K.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?vl(e.entries):`Unavailable for this restored run`}),children:e?(0,K.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,K.jsx)(_l,{entry:e},e.key))}):(0,K.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Evidence availability is unavailable for this restored run.`})})}var bl=64;function xl(e,t){return t>=1?e:`color-mix(in srgb, ${e} ${t*100}%, transparent)`}function Sl(e){return[{key:`startup`,label:`Startup`,value:e.startup,color:I.startup,fillOpacity:1},{key:`stagesActive`,label:`Stages active`,value:e.stagesActive,color:I.stage,fillOpacity:1},{key:`gaps`,label:`Scheduler gaps`,value:e.gaps,color:I.gap,fillOpacity:1},{key:`idle`,label:`Idle`,value:e.idle,color:I.muted,fillOpacity:.6}].filter(e=>e.value>0).map(e=>({...e,legendColor:xl(e.color,e.fillOpacity)}))}var Cl=(0,W.memo)(function(){let e=P()?.data.wallClock;if(!e||e.total<=0)return null;let n=Sl(e),r=t=>e.total>0?t/e.total*100:0,a=n.reduce((e,t)=>t.value>e.value?t:e,n[0]),o=[n.reduce((e,t)=>({...e,[t.key]:t.value}),{name:`total`})];return(0,K.jsxs)(U,{title:`Wall-Clock Breakdown`,subtitle:`${w(e.total)} total`,summary:(0,K.jsx)(q,{value:`${a.label} ${Math.round(r(a.value))}%`,context:`of ${w(e.total)} total`}),children:[(0,K.jsx)(L,{ariaLabel:`Wall-clock breakdown: ${w(e.total)} total, split across startup, active stages, scheduler gaps and idle time. See the table below for exact values.`,height:bl,table:{caption:`Wall-clock time breakdown`,columns:[`Segment`,`Duration`,`% of total`],rows:n.map(e=>[e.label,w(e.value),`${Math.round(r(e.value))}%`]),align:[`left`,`right`,`right`]},children:(0,K.jsxs)(l,{data:o,layout:`vertical`,stackOffset:`expand`,margin:{top:0,right:0,bottom:0,left:0},children:[(0,K.jsx)(m,{type:`number`,hide:!0,domain:[0,1]}),(0,K.jsx)(f,{type:`category`,dataKey:`name`,hide:!0}),(0,K.jsx)(g,{shared:!1,labelFormatter:()=>``,formatter:(e,t)=>[w(Number(e)),t]}),(0,K.jsx)(i,{wrapperStyle:{fontSize:12},itemSorter:e=>n.findIndex(t=>t.key===e.dataKey),formatter:(e,t)=>{let r=n.find(e=>e.key===t.dataKey);return(0,K.jsx)(`span`,{style:{color:r?.color},children:e})},content:e=>(0,K.jsx)(t,{...e,payload:e.payload?.map(e=>{let t=n.find(t=>t.key===e.dataKey);return t?{...e,color:t.legendColor}:e})})}),n.map(e=>(0,K.jsx)(u,{dataKey:e.key,name:e.label,stackId:`wallclock`,fill:e.color,fillOpacity:e.fillOpacity},e.key))]})}),(0,K.jsx)(N,{children:(0,K.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground`,children:n.map(e=>(0,K.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,K.jsx)(`span`,{className:`inline-block size-2.5 rounded-sm`,style:{backgroundColor:e.color,opacity:e.fillOpacity}}),e.label,` (`,w(e.value),`)`]},e.key))})})]})}),wl=[`[data-testid="next-step"] [data-shortcut-target]`,`[data-testid="fix-these-first-row"] button[data-shortcut-target]`,`[data-testid="fix-these-first-group-row"] button[data-shortcut-target]`].join(`, `);function Tl(e){if(e.defaultPrevented||e.metaKey||e.ctrlKey||e.altKey)return!0;let t=e.target,n=t?.tagName;return n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t?.isContentEditable||t?.closest?.(`[role="listbox"], [role="combobox"]`)?!0:[...document.querySelectorAll(`[role="dialog"], [role="menu"], [role="alertdialog"], [role="listbox"]`)].some(e=>!e.closest(`[hidden]`)&&e.getClientRects().length>0)}function El(){return[...document.querySelectorAll(wl)].filter(e=>e.offsetParent!==null||e.getClientRects().length>0)}function Dl(e){let t=El();if(t.length===0)return null;let n=t.indexOf(document.activeElement),r=t[n===-1?e===1?0:t.length-1:Math.min(t.length-1,Math.max(0,n+e))],i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;return r.focus({preventScroll:!0}),r.scrollIntoView?.({block:`nearest`,behavior:i?`auto`:`smooth`}),r}function Ol({enabled:e,showFindings:t,showFullReport:n}){(0,W.useEffect)(()=>{if(!e)return;function r(e){if(!Tl(e))switch(e.key){case`j`:case`k`:{let n=e.key===`j`?1:-1;e.preventDefault(),t(),requestAnimationFrame(()=>Dl(n));return}case`f`:{let t=document.querySelector(`[aria-label="Filter findings"] button`);if(!t)return;e.preventDefault(),t.focus();return}case`1`:t(),e.preventDefault();return;case`2`:n(),e.preventDefault();return}}return window.addEventListener(`keydown`,r),()=>window.removeEventListener(`keydown`,r)},[e,t,n])}function kl({appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,onRoute:a}){return(0,K.jsxs)(`div`,{className:`space-y-6`,children:[(0,K.jsx)(`h2`,{className:`sr-only`,children:`Full app report`}),(0,K.jsx)(Cl,{}),(0,K.jsx)(Rr,{appModel:e,catalog:t}),(0,K.jsx)(ur,{appModel:e,activeFileId:i}),(0,K.jsx)(pl,{appModel:e,catalog:t,getTaskData:r,onRoute:a}),(0,K.jsxs)(bt,{children:[xn().map(({component:a,widgetId:o})=>(0,K.jsx)(R,{cardId:`reference-${o}`,widgetId:o,collapsedTile:!0,children:(0,K.jsx)(W.Suspense,{fallback:(0,K.jsx)(rt,{}),children:(0,K.jsx)(a,{appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,defaultCollapsed:!0})})},o)),(0,K.jsx)(R,{cardId:`reference-evidence-availability`,collapsedTile:!0,children:(0,K.jsx)(yl,{ledger:e.evidenceAvailability})}),(0,K.jsx)(R,{cardId:`reference-etl-phases`,collapsedTile:!0,children:(0,K.jsx)(or,{})}),(0,K.jsx)(R,{cardId:`reference-scaling-sim`,collapsedTile:!0,children:(0,K.jsx)(Cr,{appModel:e})}),(0,K.jsx)(R,{cardId:`reference-efficiency-model`,collapsedTile:!0,children:(0,K.jsx)(ir,{})}),(0,K.jsx)(R,{cardId:`reference-core-usage-histogram`,collapsedTile:!0,children:(0,K.jsx)(tr,{appModel:e,getTaskData:r})})]})]})}function Al(e,t,n){let r=e.map(e=>e===`impactBands`?`${[...t.impactBands].join(`, `)} impact`:e===`types`?[...t.types].map(e=>yt(e)).join(`, `):[...t.stages].map(e=>`Stage ${e}`).join(`, `));return`Cleared the ${r.join(` and `)} filter${r.length===1?``:`s`} to show ${n}.`}function jl({appModel:e,catalog:t,configFindings:n,getTaskData:r,activeFileId:i,options:a,onRoute:o,activeTab:s,onActiveTabChange:c,renderTopbar:l}){let{selection:u,replaceSelection:d}=Ln(),f=k(),p=P(),[m,h]=(0,W.useState)(null),g=(0,W.useCallback)((e,t)=>{let n=kn(e,u);if(n.length===0)return;let r={...u};for(let e of n)Object.assign(r,{[e]:Tn()[e]});d(r),h({text:Al(n,u,t),selection:r})},[u,d]),_=(0,W.useCallback)(e=>{bn(e.finding.type)||g(e.finding,`this finding`),o(e)},[g,o]),v=(0,W.useCallback)(e=>{let t=fe(p).filter(t=>t.impactBand===e).reduce((e,t)=>!e||kn(t,u).length<kn(e,u).length?t:e,null);t&&g(t,`the ${e} findings`),c(`findings`),requestAnimationFrame(()=>{let t=document.getElementById(`impact-band-${e}-heading`);if(!t)return;let n=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches??!1;t.scrollIntoView?.({block:`start`,behavior:n?`auto`:`smooth`}),t.focus({preventScroll:!0})})},[p,u,g,c]),y=(0,W.useMemo)(()=>On(t,u),[t,u]),b=(0,W.useMemo)(()=>On(n??[],u),[n,u]),x=(0,W.useMemo)(()=>{let e=new Set([...y,...b]);return fe(p).filter(t=>e.has(t)).length},[p,y,b]),S=y.length+b.length,C=t.length+(n??[]).length>0&&S===0,ee=f===`advanced`||!En(u);return(0,K.jsxs)(K.Fragment,{children:[l(v),(0,K.jsxs)(`main`,{className:`mx-auto w-full max-w-[80rem] min-w-0 flex-1 space-y-4 px-4 pt-5 pb-12 sm:px-8`,children:[(0,K.jsx)(ni,{}),p?(0,K.jsx)(ti,{interpretation:p,onRoute:_}):null,p?(0,K.jsx)(li,{interpretation:p.data,catalog:y}):null,ee&&(0,K.jsx)(Kn,{options:a,resultCount:S}),ee&&m?.selection===u?(0,K.jsx)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:m.text}):null,C&&(0,K.jsx)(Rn,{}),!C&&(0,K.jsxs)(Ne,{value:s,onValueChange:e=>c(e),children:[(0,K.jsxs)(Pe,{variant:`chrome`,"aria-label":`Report view`,children:[(0,K.jsxs)(We,{value:`findings`,className:`tap-target-comfortable`,children:[`Findings`,x>0?(0,K.jsx)(`span`,{"aria-hidden":`true`,className:`font-mono text-xs font-normal text-muted-foreground tabular-nums`,children:x}):null]}),(0,K.jsx)(We,{value:`full-report`,className:`tap-target-comfortable`,children:`Full app report`})]}),(0,K.jsxs)(Me,{value:`findings`,keepMounted:!0,children:[(0,K.jsx)(`h2`,{className:`sr-only`,children:`Findings`}),(0,K.jsx)(Ui,{appModel:e,catalog:y,configFindings:b,stages:e.stages,getTaskData:r,activeFileId:i,onRoute:o})]}),(0,K.jsx)(Me,{value:`full-report`,keepMounted:!0,children:(0,K.jsx)(kl,{appModel:e,catalog:y,getTaskData:r,configFindings:b,activeFileId:i,onRoute:o})})]}),(0,K.jsx)(sa,{appModel:e,catalog:t,getTaskData:r,onRoute:_})]})]})}function Ml(){let{resetToDropZone:e,startLoad:t,getTaskData:n,compareWithAnotherRun:r}=_t(),i=F(e=>e.appModel),a=F(e=>e.catalog),o=F(e=>e.activeFileId),s=F(e=>e.exportMode),{recentEntries:c,onPickRecent:l,onRemoveRecent:u}=Ze(o),[d,f]=(0,W.useState)(!1),[p,m]=(0,W.useState)(`findings`),h=k(),g=(0,W.useCallback)(()=>m(`findings`),[]),_=(0,W.useCallback)(()=>m(`full-report`),[]);Ol({enabled:h===`advanced`,showFindings:g,showFullReport:_});let{revealRequest:v}=et(),[y,b]=(0,W.useState)(null),[x,S]=(0,W.useState)(null),[C,ee]=(0,W.useState)(null),w=(0,W.useRef)(0),T=(0,W.useRef)(null),te=(0,W.useRef)(null),E=(0,W.useRef)(new Map),ne=(0,W.useRef)(new Map),re=(0,W.useRef)(null),ie=y?.target??null;(0,W.useEffect)(()=>()=>{re.current&&clearTimeout(re.current)},[]),(0,W.useLayoutEffect)(()=>{v>0&&m(`full-report`)},[v]);let D=(0,W.useCallback)(e=>{T.current?.token===e&&(T.current=null,te.current=null,b(t=>t?.token===e?null:t))},[]),O=(0,W.useCallback)(e=>{if(T.current?.token!==e.token)return null;let{catalog:t,configFindings:n,activeFileId:r}=le.getState();if(te.current!==r)return null;let i=Gr(e.target.finding,[...t,...n]);return!i||i.widgetId!==e.target.widgetId||i.region!==e.target.region?null:i},[]),ae=(0,W.useCallback)(e=>{m(bn(e.finding.type)?`full-report`:`findings`);let t=w.current+1;w.current=t;let{catalog:n,configFindings:r,activeFileId:i}=le.getState(),a=Gr(e.finding,[...n,...r]);if(!a||a.widgetId!==e.widgetId||a.region!==e.region){T.current=null,te.current=null,b(null);return}let o={target:a,token:t};T.current=o,te.current=i,b(o)},[]),oe=(0,W.useCallback)((e,t)=>{E.current.set(e,t);let n=T.current;return n?.target.widgetId===e&&O(n)&&t.open(),()=>{E.current.get(e)===t&&E.current.delete(e)}},[O]),se=(0,W.useCallback)((e,t)=>(ne.current.set(e,t),()=>{ne.current.get(e)===t&&ne.current.delete(e)}),[]),A=(0,W.useCallback)((e,t)=>{if(!t)return;let n=T.current;if(!n||n.target.widgetId!==e)return;let r=O(n);if(!r){D(n.token);return}let i=E.current.get(e);if(!i)return;let a=i.getDisclosureButton();if(!a){D(n.token);return}let o=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,s=ne.current.get(r.finding);s?(s.scrollIntoView({behavior:o?`auto`:`smooth`,block:`center`,inline:`nearest`}),s.focus({preventScroll:!0}),re.current&&clearTimeout(re.current),ee(r.finding),re.current=setTimeout(()=>{re.current=null,ee(null)},2e3)):(i.wrapperElement.scrollIntoView({behavior:o?`auto`:`smooth`,block:`start`,inline:`nearest`}),a.focus({preventScroll:!0}),S(e)),D(n.token)},[D,O]),ce=(0,W.useCallback)(e=>{S(t=>t===e?null:t)},[]);(0,W.useLayoutEffect)(()=>{if(!y)return;let e=O(y);if(!e){D(y.token);return}E.current.get(e.widgetId)?.open()},[D,O,y]),(0,W.useLayoutEffect)(()=>{let e=T.current;e&&!O(e)&&D(e.token)},[o,a,D,O]);let j=F(e=>e.configFindings),M=(0,W.useMemo)(()=>An(a,j),[a,j]);return(0,K.jsxs)(`div`,{"data-testid":`dashboard`,className:`relative flex min-h-screen flex-col`,style:{paddingRight:`var(--docs-inset, 0px)`},onDragOver:e=>{s||(e.preventDefault(),f(!0))},onDragLeave:()=>f(!1),onDrop:e=>{if(s)return;e.preventDefault(),f(!1);let n=e.dataTransfer.files[0];n&&t(n)},children:[(0,K.jsx)(`button`,{type:`button`,className:`sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-50 focus:rounded-md focus:bg-background focus:px-3 focus:py-2 focus:text-sm focus:font-medium focus:shadow focus:ring-2 focus:ring-ring`,onClick:()=>{let e=document.getElementById(`run-verdict`);e?.scrollIntoView?.({block:`start`}),e?.focus({preventScroll:!0})},children:`Skip to the verdict`}),(0,K.jsx)(In,{options:M,fileId:o,children:(0,K.jsx)(ut,{registerWidget:oe,registerFindingAnchor:se,reportWidgetOpen:A,clearRouteFocus:ce,focusedWidgetId:x,activeRouteTarget:ie,flashedFinding:C,children:(0,K.jsx)(jl,{appModel:i,catalog:a,configFindings:j,getTaskData:n,activeFileId:o,options:M,onRoute:ae,activeTab:p,onActiveTabChange:m,renderTopbar:t=>(0,K.jsx)(Ke,{onJumpToFindings:t,onLoadNew:e,onCompare:r,recentEntries:c,activeFileId:o,onPickRecent:l,onRemoveRecent:u})})})}),d&&(0,K.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 z-50 flex items-center justify-center bg-background/80`,children:(0,K.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 Nl(){return(0,K.jsx)(Fe,{children:(0,K.jsx)(Ml,{})})}export{Nl as Dashboard,Ei as a,Qn as c,Hn as d,Cn as f,Ci as i,Zn as l,Ji as n,q as o,It as p,Di as r,$n as s,Yi as t,Vn as u};
|