sparkforensics-server 0.2.0 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +1 -1
- package/lib/static-files.js +5 -4
- package/package.json +4 -3
- package/public/assets/AutoscalingChurn-Bf5TN-s_.js +1 -0
- package/public/assets/CacheUtilization-DRf_FNrK.js +1 -0
- package/public/assets/CachingOpportunity-BTJzIhtI.js +1 -0
- package/public/assets/ColdStart-DnFgnD3n.js +1 -0
- package/public/assets/ConfigAudit-B5FsOdmu.js +1 -0
- package/public/assets/CoreUsageArea-CTksBPuq.js +1 -0
- package/public/assets/Dashboard-BFMsMuc_.js +1 -0
- package/public/assets/DuplicatePlanSubtree-BCt-Guuh.js +1 -0
- package/public/assets/DurationHistogram-xRcnND4k.js +1 -0
- package/public/assets/EmptyState-CnTrSjtU.js +1 -0
- package/public/assets/ExecutorUtilization-CP21XlUq.js +1 -0
- package/public/assets/GcPressure-BoEJsLjb.js +1 -0
- package/public/assets/ImpactEstimate-BHcqJkcZ.js +1 -0
- package/public/assets/IncompleteRun-b9FWrOHn.js +1 -0
- package/public/assets/JobFailures-C5FkTq3O.js +1 -0
- package/public/assets/MemoryUtilization-D2W4AB_f.js +1 -0
- package/public/assets/OverBroadcast-Btu3xorf.js +1 -0
- package/public/assets/PartitionSizing-yZWhLN0e.js +1 -0
- package/public/assets/PlanExplorer-DSk1ivS4.js +1 -0
- package/public/assets/PlanGraphRoute-C3iOzUdB.js +1 -0
- package/public/assets/RetryWaste-B4436kr1.js +1 -0
- package/public/assets/RowPagination-oeWB8gBm.js +1 -0
- package/public/assets/ShuffleIO-DUiv8EJe.js +1 -0
- package/public/assets/Skew-D2lB1oQc.js +1 -0
- package/public/assets/SlowHost-Qb_8aa-W.js +1 -0
- package/public/assets/SmallFiles-u6suTgfj.js +1 -0
- package/public/assets/SpeculationWaste-vUCniiFP.js +1 -0
- package/public/assets/Spill-BskXFX2e.js +1 -0
- package/public/assets/StageFailed-D9b83Jvy.js +1 -0
- package/public/assets/StageFindingGroup-DagqHOUz.js +1 -0
- package/public/assets/StageHeader-DibMSunO.js +1 -0
- package/public/assets/StagePill-Dt6V9yVw.js +1 -0
- package/public/assets/StageShape-CfdrDUZa.js +1 -0
- package/public/assets/StageSlowness-BoGLIYKR.js +1 -0
- package/public/assets/Straggler-DU1WSU-m.js +1 -0
- package/public/assets/TaskFailures-DkY6zBNJ.js +1 -0
- package/public/assets/TinyTask-Lsnt5mJF.js +1 -0
- package/public/assets/UnderBroadcast-DxHc0lwy.js +1 -0
- package/public/assets/WidgetLeadSummary-BdUUi7L5.js +1 -0
- package/public/assets/charts-vendor-0VMaLVLN.js +59 -0
- package/public/assets/downsample-WmNM1qc9.js +1 -0
- package/public/assets/finding-anchor-Bl1hRK5E.js +1 -0
- package/public/assets/impact-sort-DxaUheWV.js +1 -0
- package/public/assets/inbox-DHIFHqcn.js +1 -0
- package/public/assets/index-CjVklAdW.css +2 -0
- package/public/assets/index-U654cmB8.js +9 -0
- package/public/assets/parser-worker-5a9aUx3o.js +115 -0
- package/public/assets/plan-graph-vendor-B0sEms9Z.js +7 -0
- package/public/assets/plan-graph-vendor-DLioOiRN.css +1 -0
- package/public/assets/react-vendor-D2TLlSzI.js +9 -0
- package/public/assets/rolldown-runtime-hePW80VL.js +1 -0
- package/public/assets/select-CtKaJ5Hx.js +1 -0
- package/public/assets/toggle-group-DB2VfFIx.js +1 -0
- package/public/assets/usePagedRows-jNUWgVTD.js +1 -0
- package/public/assets/useRecentFiles-BiYdWs8J.js +11 -0
- package/public/assets/useSortMode-BhPky1lW.js +1 -0
- package/public/docs/404.html +3 -3
- package/public/docs/assets/{app.BgzsaTS3.js → app.BczRxXPr.js} +1 -1
- package/public/docs/assets/chunks/@localSearchIndexroot.c2HfrwDg.js +1 -0
- package/public/docs/assets/chunks/{VPLocalSearchBox.DOq3t-On.js → VPLocalSearchBox.DXvkTVnC.js} +1 -1
- package/public/docs/assets/chunks/theme.ByUdwrLG.js +2 -0
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.9ToZXcTk.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.9ToZXcTk.lean.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_detector-contract.md.B1vUqtry.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_detector-contract.md.BOeH4d1J.lean.js → contributor-guide_architecture_detector-contract.md.B1vUqtry.lean.js} +1 -1
- package/public/docs/assets/{contributor-guide_architecture_drill-down.md.BtPdlM7r.js → contributor-guide_architecture_drill-down.md.Bawx6NgP.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DHVq1UPt.lean.js +1 -0
- package/public/docs/assets/{contributor-guide_architecture_overview.md.CehiRmGn.js → contributor-guide_architecture_overview.md.DkXdJ9jE.js} +1 -1
- package/public/docs/assets/contributor-guide_architecture_overview.md.DkXdJ9jE.lean.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.C-xxn0q7.lean.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DYwFeyjV.js +1 -0
- package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.C0SovZX8.js +6 -0
- package/public/docs/assets/{contributor-guide_architecture_worker-protocol.md.B93qJ_tT.lean.js → contributor-guide_architecture_worker-protocol.md.C0SovZX8.lean.js} +1 -1
- package/public/docs/assets/{contributor-guide_development-setup.md.DvAN_9mK.js → contributor-guide_development-setup.md.DvMV1xhQ.js} +3 -3
- package/public/docs/assets/contributor-guide_development-setup.md.DvMV1xhQ.lean.js +1 -0
- package/public/docs/assets/{contributor-guide_testing.md.6rIKqSyY.js → contributor-guide_testing.md.BohuQWvl.js} +1 -1
- package/public/docs/assets/{contributor-guide_testing.md.6rIKqSyY.lean.js → contributor-guide_testing.md.BohuQWvl.lean.js} +1 -1
- package/public/docs/assets/{style.DXOMCXxn.css → style.DSixAiZE.css} +1 -1
- package/public/docs/assets/{tuning-reference_bottleneck-failures.md.4z5BXGJ2.js → tuning-reference_bottleneck-failures.md.CAsFf3RR.js} +1 -1
- package/public/docs/assets/{tuning-reference_bottleneck-gc.md.DSxzZRK7.js → tuning-reference_bottleneck-gc.md.B4T3kJYV.js} +2 -2
- package/public/docs/assets/{tuning-reference_bottleneck-gc.md.DSxzZRK7.lean.js → tuning-reference_bottleneck-gc.md.B4T3kJYV.lean.js} +1 -1
- package/public/docs/assets/tuning-reference_bottleneck-shuffle.md.DDMQVOW6.js +12 -0
- package/public/docs/assets/{tuning-reference_bottleneck-shuffle.md.CM-nTmIH.lean.js → tuning-reference_bottleneck-shuffle.md.DDMQVOW6.lean.js} +1 -1
- package/public/docs/assets/{tuning-reference_bottleneck-skew.md.BdUwiDhn.js → tuning-reference_bottleneck-skew.md.B0MzhWcX.js} +4 -4
- package/public/docs/assets/{tuning-reference_bottleneck-skew.md.BdUwiDhn.lean.js → tuning-reference_bottleneck-skew.md.B0MzhWcX.lean.js} +1 -1
- package/public/docs/assets/{tuning-reference_bottleneck-small-files.md.B8kloyx8.js → tuning-reference_bottleneck-small-files.md.DHGMTmPs.js} +2 -2
- package/public/docs/assets/{tuning-reference_bottleneck-small-files.md.B8kloyx8.lean.js → tuning-reference_bottleneck-small-files.md.DHGMTmPs.lean.js} +1 -1
- package/public/docs/assets/{tuning-reference_bottleneck-straggler.md.DY36fHN5.js → tuning-reference_bottleneck-straggler.md.DIbXdAcQ.js} +2 -2
- package/public/docs/assets/{tuning-reference_bottleneck-straggler.md.DY36fHN5.lean.js → tuning-reference_bottleneck-straggler.md.DIbXdAcQ.lean.js} +1 -1
- package/public/docs/assets/{tuning-reference_bottleneck-tiny-tasks.md.QTV7O8kU.js → tuning-reference_bottleneck-tiny-tasks.md.CB05v3zh.js} +1 -1
- package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DqC_iGkw.js +5 -0
- package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DqC_iGkw.lean.js +1 -0
- package/public/docs/assets/{tuning-reference_cluster-config.md.ZVmDGsQ3.js → tuning-reference_cluster-config.md.CD6vzYtD.js} +1 -1
- package/public/docs/assets/{tuning-reference_cluster-config.md.ZVmDGsQ3.lean.js → tuning-reference_cluster-config.md.CD6vzYtD.lean.js} +1 -1
- package/public/docs/assets/{tuning-reference_memory-model.md.DhT-n4y3.js → tuning-reference_memory-model.md.CWhvgevP.js} +1 -1
- package/public/docs/assets/{tuning-reference_memory-model.md.DhT-n4y3.lean.js → tuning-reference_memory-model.md.CWhvgevP.lean.js} +1 -1
- package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.js → user-guide_alternative-log-retrieval.md.B4tPGIal.js} +1 -1
- package/public/docs/assets/{user-guide_alternative-log-retrieval.md.sU3KGarf.lean.js → user-guide_alternative-log-retrieval.md.B4tPGIal.lean.js} +1 -1
- package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.js +3 -0
- package/public/docs/assets/user-guide_getting-started.md.BJvwLEIM.lean.js +1 -0
- package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.js → user-guide_mcp-tools.md.DGvolGzt.js} +4 -4
- package/public/docs/assets/{user-guide_mcp-tools.md.C8MiIu7F.lean.js → user-guide_mcp-tools.md.DGvolGzt.lean.js} +1 -1
- package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.js +1 -0
- package/public/docs/assets/user-guide_run-comparison.md.CQc1aoU8.lean.js +1 -0
- package/public/docs/assets/user-guide_understanding-findings.md.B29f0ucS.js +1 -0
- package/public/docs/assets/user-guide_understanding-findings.md.B29f0ucS.lean.js +1 -0
- package/public/docs/contributor-guide/architecture/board-widgets.html +6 -6
- package/public/docs/contributor-guide/architecture/detector-contract.html +6 -6
- package/public/docs/contributor-guide/architecture/drill-down.html +6 -6
- package/public/docs/contributor-guide/architecture/impact-estimation.html +6 -6
- package/public/docs/contributor-guide/architecture/index.html +4 -4
- package/public/docs/contributor-guide/architecture/overview.html +6 -6
- package/public/docs/contributor-guide/architecture/state-and-history.html +6 -6
- package/public/docs/contributor-guide/architecture/widget-rendering.html +6 -6
- package/public/docs/contributor-guide/architecture/worker-protocol.html +7 -7
- package/public/docs/contributor-guide/contributing.html +4 -4
- package/public/docs/contributor-guide/development-setup.html +6 -6
- package/public/docs/contributor-guide/testing.html +6 -6
- package/public/docs/hashmap.json +1 -1
- package/public/docs/index.html +4 -4
- package/public/docs/tuning-reference/anti-patterns.html +4 -4
- package/public/docs/tuning-reference/aqe.html +4 -4
- package/public/docs/tuning-reference/bottleneck-broadcast-sizing.html +4 -4
- package/public/docs/tuning-reference/bottleneck-cold-start.html +4 -4
- package/public/docs/tuning-reference/bottleneck-duplicate-plan-subtree.html +4 -4
- package/public/docs/tuning-reference/bottleneck-failures.html +6 -6
- package/public/docs/tuning-reference/bottleneck-gc.html +6 -6
- package/public/docs/tuning-reference/bottleneck-job-failure-rate.html +4 -4
- package/public/docs/tuning-reference/bottleneck-memory-utilization.html +4 -4
- package/public/docs/tuning-reference/bottleneck-retry-waste.html +4 -4
- package/public/docs/tuning-reference/bottleneck-shuffle.html +7 -7
- package/public/docs/tuning-reference/bottleneck-skew.html +8 -8
- package/public/docs/tuning-reference/bottleneck-slow-host.html +4 -4
- package/public/docs/tuning-reference/bottleneck-small-files.html +7 -7
- package/public/docs/tuning-reference/bottleneck-spill.html +4 -4
- package/public/docs/tuning-reference/bottleneck-straggler.html +6 -6
- package/public/docs/tuning-reference/bottleneck-tiny-tasks.html +6 -6
- package/public/docs/tuning-reference/bottleneck-utilization.html +7 -7
- package/public/docs/tuning-reference/caching.html +4 -4
- package/public/docs/tuning-reference/cluster-config.html +6 -6
- package/public/docs/tuning-reference/config.html +4 -4
- package/public/docs/tuning-reference/data-formats.html +4 -4
- package/public/docs/tuning-reference/index.html +4 -4
- package/public/docs/tuning-reference/intro.html +4 -4
- package/public/docs/tuning-reference/joins.html +4 -4
- package/public/docs/tuning-reference/memory-model.html +6 -6
- package/public/docs/tuning-reference/metrics.html +4 -4
- package/public/docs/tuning-reference/partitioning.html +4 -4
- package/public/docs/tuning-reference/pyspark.html +4 -4
- package/public/docs/tuning-reference/shuffle.html +4 -4
- package/public/docs/tuning-reference/spark-architecture.html +4 -4
- package/public/docs/tuning-reference/table-formats.html +4 -4
- package/public/docs/user-guide/alternative-log-retrieval.html +6 -6
- package/public/docs/user-guide/getting-started.html +7 -7
- package/public/docs/user-guide/mcp-tools.html +9 -9
- package/public/docs/user-guide/run-comparison.html +6 -6
- package/public/docs/user-guide/understanding-findings.html +6 -6
- package/public/index.html +7 -6
- package/public/sample-runs/sample-run.ndjson.gz +0 -0
- package/vendor-core/cli/collect-run.js +3 -2
- package/vendor-core/cli/native-zstd.js +351 -0
- package/vendor-core/detectors.js +390 -75
- package/vendor-core/docs-config.js +34 -8
- package/vendor-core/docs-content/chapters/03-memory-model.md +39 -0
- package/vendor-core/docs-content/chapters/11-cluster-config.md +40 -0
- package/vendor-core/docs-content/detection/cache.md +4 -3
- package/vendor-core/docs-content/detection/chrn.md +4 -2
- package/vendor-core/docs-content/detection/gc.md +2 -0
- package/vendor-core/docs-content/detection/host.md +2 -1
- package/vendor-core/docs-content/detection/local.md +2 -3
- package/vendor-core/docs-content/detection/mem.md +3 -3
- package/vendor-core/docs-content/detection/plan.md +3 -1
- package/vendor-core/docs-content/detection/shape.md +2 -1
- package/vendor-core/docs-content/detection/shfl.md +2 -1
- package/vendor-core/docs-content/detection/spec.md +4 -3
- package/vendor-core/docs-content/detection/spill.md +1 -1
- package/vendor-core/docs-content/detection/strag.md +2 -1
- package/vendor-core/docs-content/detection/tiny.md +2 -1
- package/vendor-core/docs-content/tuning/failures.md +1 -1
- package/vendor-core/docs-content/tuning/gc.md +11 -4
- package/vendor-core/docs-content/tuning/shuffle.md +25 -5
- package/vendor-core/docs-content/tuning/skew.md +14 -6
- package/vendor-core/docs-content/tuning/small-files.md +12 -7
- package/vendor-core/docs-content/tuning/straggler.md +34 -0
- package/vendor-core/docs-content/tuning/tiny-tasks.md +1 -1
- package/vendor-core/docs-content/tuning/utilization.md +57 -7
- package/vendor-core/docs-content/upstream.json +4 -0
- package/vendor-core/event-handlers.js +321 -69
- package/vendor-core/event-schemas.js +8 -6
- package/vendor-core/evidence-report.js +4 -2
- package/vendor-core/impact-estimator.js +150 -34
- package/vendor-core/mcp-tools.js +20 -7
- package/vendor-core/occupancy.js +70 -2
- package/vendor-core/parser-worker.js +30 -14
- package/vendor-core/plan-summary.js +4 -0
- package/vendor-core/run-comparison.js +22 -17
- package/vendor-core/shs-fetch.js +18 -7
- package/vendor-core/shs-load.js +2 -1
- package/vendor-core/stage-quantiles.js +59 -3
- package/vendor-core/string-hash.js +15 -0
- package/vendor-core/types.js +9 -1
- package/vendor-core/vendor/fzstd.js +94 -18
- package/public/assets/AutoscalingChurn-CFJkiqxW.js +0 -1
- package/public/assets/CacheUtilization-kTKZBzDA.js +0 -1
- package/public/assets/CachingOpportunity-CU70EWcF.js +0 -1
- package/public/assets/ColdStart-hOI-WOvm.js +0 -1
- package/public/assets/ConfigAudit-B4oAksZY.js +0 -1
- package/public/assets/CoreUsageArea-D-dR3SQk.js +0 -1
- package/public/assets/Dashboard-MDhohsq4.js +0 -4
- package/public/assets/DuplicatePlanSubtree-54RKsfI7.js +0 -1
- package/public/assets/DurationHistogram-CviQyPNM.js +0 -1
- package/public/assets/EmptyState-v2ehFncc.js +0 -1
- package/public/assets/ExecutorUtilization-vHyFHgL6.js +0 -1
- package/public/assets/GcPressure-DINuhcno.js +0 -1
- package/public/assets/ImpactEstimate-C6GzFOY9.js +0 -1
- package/public/assets/IncompleteRun-a1kuCnU6.js +0 -1
- package/public/assets/JobFailures-CYwPfUhR.js +0 -1
- package/public/assets/MemoryUtilization-Dlfj0e_f.js +0 -1
- package/public/assets/OverBroadcast-BMu7Y8l9.js +0 -1
- package/public/assets/PartitionSizing-CvMGfSVB.js +0 -1
- package/public/assets/PlanExplorer-xYFme_Rx.js +0 -1
- package/public/assets/PlanGraphRoute-a3OGg6ET.js +0 -1
- package/public/assets/RetryWaste-JKRjOZ-J.js +0 -1
- package/public/assets/RowPagination-DypWbnic.js +0 -1
- package/public/assets/ShuffleIO-Mi8HiVu-.js +0 -1
- package/public/assets/Skew-C3iOScTC.js +0 -1
- package/public/assets/SlowHost-DKBg18v-.js +0 -1
- package/public/assets/SmallFiles-CCCB6AIu.js +0 -1
- package/public/assets/SpeculationWaste-DUNupw0_.js +0 -1
- package/public/assets/Spill-BlLdatik.js +0 -1
- package/public/assets/StageFailed-qtY7C7Yo.js +0 -1
- package/public/assets/StageFindingGroup-CoVdEZYs.js +0 -1
- package/public/assets/StageHeader-uDBLHgdg.js +0 -1
- package/public/assets/StagePill-CYCMdlIx.js +0 -1
- package/public/assets/StageShape-zs0mAjQJ.js +0 -1
- package/public/assets/StageSlowness-C7vg0u5Q.js +0 -1
- package/public/assets/Straggler-4BRGAQP4.js +0 -1
- package/public/assets/TaskFailures-CSjO23Kg.js +0 -1
- package/public/assets/TinyTask-6Zuovcn5.js +0 -1
- package/public/assets/UnderBroadcast-CePjo0ZV.js +0 -1
- package/public/assets/WidgetLeadSummary-DRNRVvn7.js +0 -1
- package/public/assets/charts-vendor-Cf1-wzeH.js +0 -59
- package/public/assets/downsample-D8XmJk6i.js +0 -1
- package/public/assets/finding-anchor-4TmpXd7j.js +0 -1
- package/public/assets/impact-sort-Cq6KOLqh.js +0 -1
- package/public/assets/inbox-DBFovbUX.js +0 -1
- package/public/assets/index-CHjV2-jB.js +0 -9
- package/public/assets/index-DMEtaP4u.css +0 -1
- package/public/assets/parser-worker-BMPPE37w.js +0 -64
- package/public/assets/plan-graph-vendor-B96a-e4N.js +0 -7
- package/public/assets/plan-graph-vendor-BnuhLJ6X.css +0 -1
- package/public/assets/react-vendor-DA6opS-q.js +0 -9
- package/public/assets/select-D5fK-za0.js +0 -1
- package/public/assets/toggle-group-lbIXRG0W.js +0 -1
- package/public/assets/usePagedRows-CFoZrPr4.js +0 -1
- package/public/assets/useRecentFiles-BPGQ6XII.js +0 -13
- package/public/assets/useSortMode-BOPpfLhJ.js +0 -1
- package/public/docs/assets/chunks/@localSearchIndexroot.PQ5JepCp.js +0 -1
- package/public/docs/assets/chunks/theme.BP14rGBx.js +0 -2
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_board-widgets.md.B-OsL91z.lean.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_detector-contract.md.BOeH4d1J.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DYCDPgkh.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_impact-estimation.md.DYCDPgkh.lean.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_overview.md.CehiRmGn.lean.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_state-and-history.md.m3S3UdMk.lean.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_widget-rendering.md.DbqPf2OT.js +0 -1
- package/public/docs/assets/contributor-guide_architecture_worker-protocol.md.B93qJ_tT.js +0 -6
- package/public/docs/assets/contributor-guide_development-setup.md.DvAN_9mK.lean.js +0 -1
- package/public/docs/assets/tuning-reference_bottleneck-shuffle.md.CM-nTmIH.js +0 -12
- package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DTiueZC3.js +0 -5
- package/public/docs/assets/tuning-reference_bottleneck-utilization.md.DTiueZC3.lean.js +0 -1
- package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.js +0 -3
- package/public/docs/assets/user-guide_getting-started.md.DtEM37MK.lean.js +0 -1
- package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.js +0 -1
- package/public/docs/assets/user-guide_run-comparison.md.S0TWWmLY.lean.js +0 -1
- package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.js +0 -1
- package/public/docs/assets/user-guide_understanding-findings.md.D0R_Y-R2.lean.js +0 -1
- /package/public/docs/assets/{contributor-guide_architecture_drill-down.md.BtPdlM7r.lean.js → contributor-guide_architecture_drill-down.md.Bawx6NgP.lean.js} +0 -0
- /package/public/docs/assets/{contributor-guide_architecture_widget-rendering.md.DbqPf2OT.lean.js → contributor-guide_architecture_widget-rendering.md.DYwFeyjV.lean.js} +0 -0
- /package/public/docs/assets/{tuning-reference_bottleneck-failures.md.4z5BXGJ2.lean.js → tuning-reference_bottleneck-failures.md.CAsFf3RR.lean.js} +0 -0
- /package/public/docs/assets/{tuning-reference_bottleneck-tiny-tasks.md.QTV7O8kU.lean.js → tuning-reference_bottleneck-tiny-tasks.md.CB05v3zh.lean.js} +0 -0
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{r as w,j as o,S as An,J as Dn,K as Vn,L as Bn,M as Ln,N as Hn}from"./react-vendor-DA6opS-q.js";import{c as _e,e as D,t as Je,I as se,X as zn,v as it,k as On,W as z,q as I,D as Xt,x as at,y as Se,A as H,z as Gn,E as lt,F as qn,h as Rt,i as Wn,G as Jt,H as Z,J as B,K as Qt,n as Yt,L as oe,M as ut,N as Q,O as Zt,P as ct,Q as dt,R as Un,T as pe,S as Kn,U as gt,B as $e,j as K,V as Xn,Y as bt,Z as Jn,_ as Qn,C as he,$ as Yn,a0 as Zn,u as es,a1 as de,r as kt,a2 as ts}from"./index-CHjV2-jB.js";import{m as ns,I as Qe,e as Ft,g as ss,h as rs,i as os,j as ae,C as N,R as ft,k as en,o as tn,l as nn,n as xe,p as is,q as as,s as ls,t as sn,f as ie,v as us,w as cs,x as ds,D as gs,a as fs,b as ms,c as ps,S as re,y as rn,r as hs,P as xs,z as on,A as vs,B as ws,E as Ss,F as Cs,u as ys,T as js,G as Rs,H as bs,J as It,K as $t}from"./useRecentFiles-BPGQ6XII.js";import{E as mt}from"./EmptyState-v2ehFncc.js";import{T as ks,a as Fs}from"./toggle-group-lbIXRG0W.js";import{u as an,D as Is}from"./DurationHistogram-CviQyPNM.js";import{d as Me}from"./downsample-D8XmJk6i.js";import{W as te}from"./WidgetLeadSummary-DRNRVvn7.js";import{B as Pe,C as Ce,X as le,Y as ue,a as ve,A as $s,T as ye,b as _s,L as Ms,d as Ps,e as ln,f as Ns,D as Es}from"./charts-vendor-Cf1-wzeH.js";import{S as Ts,a as As}from"./StagePill-CYCMdlIx.js";import{f as un,a as Ds,b as cn,I as Vs}from"./ImpactEstimate-C6GzFOY9.js";import{R as Bs}from"./RowPagination-DypWbnic.js";import{I as dn}from"./inbox-DBFovbUX.js";import"./plan-graph-vendor-B96a-e4N.js";const Ls=[["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"}]],Hs=_e("copy",Ls);const zs=[["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M9 19h6",key:"456am0"}]],Os=_e("list-filter",zs);const Gs=[["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"}]],qs=_e("search-x",Gs);const Ws=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],Us=_e("target",Ws),pt=["critical","warning","info"];function Ye(){return{impactBands:new Set,types:new Set,stages:new Set}}function Ks(e){return e.impactBands.size===0&&e.types.size===0&&e.stages.size===0}function Xs(e,n){return ns(e,{impactBand:n.impactBands,type:n.types,stageId:n.stages})}function _t(e,n){return e.filter(t=>Xs(t,n))}function Js(e,n){const t=new Set,s=new Set,r=new Set;for(const i of[...e,...n])t.add(i.impactBand),s.add(i.type),i.stageId!=null&&r.add(i.stageId);return{impactBands:pt.filter(i=>t.has(i)),types:[...s].sort(),stages:[...r].sort((i,a)=>i-a)}}function De(e){return e?e.split(",").map(n=>n.trim()).filter(Boolean):[]}function Mt(e,n){const t=new URLSearchParams(e),s=Ye();for(const i of De(t.get("impact")))pt.includes(i)&&s.impactBands.add(i);const r=new Set(n.types);for(const i of De(t.get("type")))r.has(i)&&s.types.add(i);for(const i of De(t.get("stage"))){const a=Number(i);Number.isInteger(a)&&s.stages.add(a)}return s}function Qs(e){const n=[];return e.impactBands.size&&n.push(`impact=${pt.filter(t=>e.impactBands.has(t)).join(",")}`),e.types.size&&n.push(`type=${[...e.types].sort().join(",")}`),e.stages.size&&n.push(`stage=${[...e.stages].sort((t,s)=>t-s).join(",")}`),n.length?`?${n.join("&")}`:""}const gn=w.createContext(null);function Ve(e,n){const t=new Set(e);return t.has(n)?t.delete(n):t.add(n),t}function Ys({options:e,fileId:n,children:t}){const[s,r]=w.useState(()=>Mt(typeof window>"u"?"":window.location.search,e));w.useEffect(()=>{if(typeof window>"u")return;const p=Qs(s),f=`${window.location.pathname}${p}${window.location.hash}`;window.history.replaceState(window.history.state,"",f)},[s]);const i=w.useRef(n);w.useEffect(()=>{i.current!==n&&(i.current=n,r(Ye()))},[n]),w.useEffect(()=>()=>{if(typeof window>"u")return;const p=`${window.location.pathname}${window.location.hash}`;window.history.replaceState(window.history.state,"",p)},[]),w.useEffect(()=>{if(typeof window>"u")return;const p=()=>r(Mt(window.location.search,e));return window.addEventListener("popstate",p),()=>window.removeEventListener("popstate",p)},[e]);const a=w.useCallback(p=>r(f=>({...f,impactBands:Ve(f.impactBands,p)})),[]),u=w.useCallback(p=>r(f=>({...f,types:Ve(f.types,p)})),[]),c=w.useCallback(p=>r(f=>({...f,stages:Ve(f.stages,p)})),[]),l=w.useCallback(()=>r(Ye()),[]),d=w.useMemo(()=>({selection:s,toggleImpactBand:a,toggleType:u,toggleStage:c,clearAll:l}),[s,a,u,c,l]);return o.jsx(gn.Provider,{value:d,children:t})}function ht(){const e=w.useContext(gn);if(!e)throw new Error("useFindingFilter outside FindingFilterProvider");return e}function Zs(){const{clearAll:e}=ht();return o.jsx(mt,{icon:qs,title:"No findings match the active filters",description:"Adjust or clear the filters to see findings.",action:o.jsx("button",{type:"button",onClick:e,className:"cursor-pointer text-sm underline",children:"Clear all filters"})})}function Re({className:e,orientation:n="horizontal",...t}){return o.jsx(An,{"data-slot":"separator",orientation:n,className:D("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",e),...t})}const er={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 tr(e,n,t){const s=new Set(e);for(const r of s)n.has(r)||t(r);for(const r of n)s.has(r)||t(r)}function Pt({label:e,count:n,children:t}){return o.jsxs(ss,{children:[o.jsxs(rs,{className:D(On({variant:"outline",size:"sm"}),"gap-1.5"),"aria-label":`Filter by ${e.toLowerCase()}`,children:[e,n>0&&o.jsx("span",{className:"rounded-full bg-primary px-1.5 text-xs font-medium text-primary-foreground",children:n}),o.jsx(it,{"aria-hidden":"true",className:"opacity-60"})]}),o.jsx(os,{align:"start",className:"max-h-72 w-56 overflow-y-auto",children:t})]})}function nr({options:e,resultCount:n}){const{selection:t,toggleImpactBand:s,toggleType:r,toggleStage:i,clearAll:a}=ht(),[u,c]=w.useState(""),[l,d]=w.useState(""),p=w.useMemo(()=>{const m=u.trim();return m?e.stages.filter(S=>String(S).includes(m)):e.stages},[e.stages,u]),f=w.useMemo(()=>{const m=l.trim().toLowerCase();return m?e.types.filter(S=>S.toLowerCase().includes(m)||Je(S).toLowerCase().includes(m)):e.types},[e.types,l]);if(e.impactBands.length===0&&e.types.length===0&&e.stages.length===0)return null;const g=!Ks(t),h=[...[...t.impactBands].map(m=>({key:`impact-${m}`,label:`impact ${m}`,onRemove:()=>s(m)})),...[...t.types].map(m=>({key:`type-${m}`,label:`type ${m}`,onRemove:()=>r(m)})),...[...t.stages].map(m=>({key:`stage-${m}`,label:`stage ${m}`,onRemove:()=>i(m)}))];return o.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:[o.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:[o.jsx(Os,{"aria-hidden":"true",className:"size-3.5"}),"Filter findings"]}),o.jsx("span",{role:"status","aria-live":"polite",className:"text-xs text-muted-foreground",children:g?`${n} finding${n===1?"":"s"} match${n===1?"es":""} the active filters`:`Showing all ${n} finding${n===1?"":"s"}`}),o.jsx(Re,{orientation:"vertical",className:"h-6"}),e.impactBands.length>0&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Impact"}),o.jsx(ks,{multiple:!0,"aria-label":"Filter by impact",value:[...t.impactBands],onValueChange:m=>tr(m,t.impactBands,s),children:e.impactBands.map(m=>o.jsxs(Fs,{value:m,variant:"outline",size:"sm","aria-label":`Filter by impact: ${m}`,className:D("tap-target-comfortable gap-1.5",er[m]),children:[o.jsx(se,{impactBand:m}),m]},m))})]}),e.types.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Re,{orientation:"vertical",className:"h-6"}),o.jsxs(Pt,{label:"Type",count:t.types.size,children:[o.jsx("div",{className:"p-1",children:o.jsx(Qe,{type:"text",value:l,onChange:m=>d(m.target.value),onKeyDown:m=>m.stopPropagation(),placeholder:"Search type…","aria-label":"Search types",autoComplete:"off",className:"h-8"})}),f.map(m=>o.jsxs(Ft,{checked:t.types.has(m),onCheckedChange:()=>r(m),"aria-label":`Filter by type: ${m}`,children:[o.jsx("span",{className:"rounded bg-muted px-1 text-xs font-medium text-foreground!",children:Je(m)})," ",m]},m)),f.length===0&&o.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No matching type"})]})]}),e.stages.length>0&&o.jsxs(o.Fragment,{children:[o.jsx(Re,{orientation:"vertical",className:"h-6"}),o.jsxs(Pt,{label:"Stage",count:t.stages.size,children:[o.jsx("div",{className:"p-1",children:o.jsx(Qe,{type:"text",value:u,onChange:m=>c(m.target.value),onKeyDown:m=>m.stopPropagation(),placeholder:"Search stage id…","aria-label":"Search stages",autoComplete:"off",className:"h-8"})}),p.map(m=>o.jsxs(Ft,{checked:t.stages.has(m),onCheckedChange:()=>i(m),"aria-label":`Filter by stage: ${m}`,children:["Stage ",m]},m)),p.length===0&&o.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:"No matching stage"})]})]}),g&&o.jsxs(o.Fragment,{children:[o.jsx(Re,{orientation:"vertical",className:"h-6"}),o.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[h.map(m=>o.jsxs("button",{type:"button",onClick:m.onRemove,"aria-label":`Remove filter: ${m.label}`,className:"tap-target-comfortable inline-flex cursor-pointer items-center gap-1 rounded-full border border-border bg-muted px-2 py-0.5 text-xs hover:bg-muted/70",children:[m.label," ",o.jsx(zn,{"aria-hidden":"true",className:"size-3"})]},m.key)),o.jsx("button",{type:"button",onClick:a,className:"tap-target-comfortable cursor-pointer text-xs underline",children:"Clear all filters"})]})]})]})}function sr(e,n){const t=[];for(const{launch:i,finish:a}of e)a>i&&(t.push({t:i,delta:1}),t.push({t:a,delta:-1}));t.sort((i,a)=>i.t-a.t||i.delta-a.delta);const s=[];let r=0;for(let i=0;i<t.length;i++){const a=t[i];r+=a.delta;const u=t[i+1];if(!u||u.t===a.t)continue;const c=n!=null?Math.min(r,n):r;s.push({tStart:a.t,tEnd:u.t,busy:c})}return s}function rr(e,{bucketBy:n="time",bucketWidthMs:t=1e3,hypotheticalCores:s=null}={}){const r=sr(e,s);if(n==="coreCount"){const c=[];for(const l of r)c[l.busy]=(c[l.busy]??0)+(l.tEnd-l.tStart);for(let l=0;l<c.length;l++)c[l]===void 0&&(c[l]=0);return{mode:"coreCount",histogram:c}}if(r.length===0)return{mode:"time",bucketWidthMs:t,startTime:null,endTime:null,buckets:[]};const i=r[0].tStart,a=r[r.length-1].tEnd,u=[];for(let c=i;c<a;c+=t){const l=c+t;let d=0;for(const p of r){const f=Math.max(p.tStart,c),g=Math.min(p.tEnd,l);g>f&&(d+=p.busy*(g-f))}u.push({tStart:c,tEnd:l,busyCoreMs:d,avgBusyCores:d/t})}return{mode:"time",bucketWidthMs:t,startTime:i,endTime:a,buckets:u}}const or=220;async function ir(e,n){const t=[...e.stages.keys()],s=await Promise.all(t.map(a=>n(a).catch(()=>null))),r=[];let i=!1;for(const a of s){if(!a){i=!0;continue}const{metrics:u,fieldNames:c}=a,l=c.length,d=c.indexOf("launchTime"),p=c.indexOf("finishTime");if(!(d===-1||p===-1))for(let f=0;f<u.length;f+=l)r.push({launch:u[f+d],finish:u[f+p]})}return{intervals:r,incomplete:i}}function ar({appModel:e,getTaskData:n}){const{exportMode:t,getTaskData:s}=an(n),[r,i]=w.useState(null),[a,u]=w.useState(!1),[c,l]=w.useState(!1),d=e.stages.size>0;if(w.useEffect(()=>{if(!d||!c||r!==null||!s)return;let h=!1;return ir(e,s).then(({intervals:m,incomplete:S})=>{if(h)return;const{histogram:C}=rr(m,{bucketBy:"coreCount"});i(C??[]),u(S)}),()=>{h=!0}},[e,s,d,c,r]),!d)return null;const p=(r??[]).map((h,m)=>({cores:String(m),coreCount:m,ms:h})),f=Me(p),g=p.reduce((h,m)=>m.ms>h.ms?m:h,p[0]);return o.jsx(z,{title:"Core-Usage Distribution",id:"core-usage-histogram",open:c,onOpenChange:l,summary:r!==null&&g?o.jsx(te,{value:I(g.ms),context:`at ${g.coreCount} concurrent core${g.coreCount===1?"":"s"}`}):void 0,children:r===null?t?o.jsx("p",{className:"text-muted-foreground text-xs",children:"Core-usage detail isn’t included in exported reports."}):o.jsx("p",{className:"text-muted-foreground text-xs",children:"Loading core usage…"}):o.jsxs(o.Fragment,{children:[o.jsx(ae,{ariaLabel:"Wall-clock time spent at each concurrent-core count across the run. See the table below for exact values.",height:or,table:{caption:"Wall-clock time by concurrent-core count",columns:["Concurrent cores","Time"],rows:r.map((h,m)=>[m,I(h)]),align:["right","right"]},children:o.jsxs(Pe,{data:f,children:[o.jsx(Ce,{vertical:!1,stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"cores",tick:{fontSize:10},label:{value:"Concurrent busy cores",position:"insideBottom",offset:-5,fontSize:10}}),o.jsx(ue,{tick:{fontSize:10},width:48,tickFormatter:h=>I(h)}),o.jsx(ve,{dataKey:"ms",name:"Time",fill:N.accent})]})}),a?o.jsx("p",{className:"text-muted-foreground text-xs",children:"Reopen this file to compute full core usage because some task data was released."}):null,o.jsxs("p",{className:"text-muted-foreground text-xs",children:["See ",o.jsx(Xt,{anchor:"#bottleneck-utilization",children:"how to read concurrent-core utilization"}),"."]})]})})}function fn({app:e,stages:n,executorsAdded:t,runAggregates:s}){const r=at(e??{},t),i=(e?.endTime??0)-(e?.startTime??0),a=Se(e,n),u=r*(i/36e5),c=a.startup+a.gaps+a.idle,l=r*(c/36e5),d=r*a.stagesActive,p=s?.busyCoreMs??0,f=Math.max(0,d-p)/36e5,g=l+f,h=u>0?Math.round(g/u*100):null;let m=0;const S=s?.perStage??{};for(const b of Object.keys(S))m+=S[b].totalTaskDurationSum;const C=r>0?m/r:0;let v=null;return(l>0||f>0)&&(v=l>=f?"driver":"executor"),{availableComputeHours:u,driverWasteHours:l,executorWasteHours:f,wastagePct:h,floorZeroSkewMs:C,dominantWaste:v}}function mn(e){const n=e?[...e.values()]:[],t=new Map;let s=0;for(const a of n){if(a.submissionTime==null||a.completionTime==null)continue;const u=a.sqlExecutionId!=null?`sql:${a.sqlExecutionId}`:`job:${a.id??s++}`,c=t.get(u);c?(c.start=Math.min(c.start,a.submissionTime),c.end=Math.max(c.end,a.completionTime)):t.set(u,{start:a.submissionTime,end:a.completionTime})}const r=[...t.entries()].sort((a,u)=>a[1].start-u[1].start),i=[];for(let a=1;a<r.length;a++)for(let u=0;u<a;u++){const[c,l]=r[u],[d,p]=r[a];p.start<l.end&&l.start<p.end&&i.push([c,d])}return{wallClockReliable:i.length===0,overlappingGroupIds:i}}const lr="This is a design-spike estimate; verify against wall-clock data before acting on it.",G=e=>`${Math.round(e*100)/100} core-h`;function pn(){return o.jsx(H,{children:o.jsx(ft,{confidence:"low",validationRequired:lr})})}function ur({appModel:e}){if(!e.runAggregates)return null;const n=fn({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});if(n.availableComputeHours<=0)return null;const t=mn(e.jobs);let s=null;return n.dominantWaste==="driver"?s=o.jsxs("p",{children:[o.jsx("strong",{children:"Driver-bound waste dominates."})," Review driver sizing (spark.driver.memory / spark.driver.cores) before scaling executors."]}):n.dominantWaste==="executor"&&(s=o.jsxs("p",{children:[o.jsx("strong",{children:"Executor-bound waste dominates."})," Review executor count / cores by reducing cluster size or enabling dynamic allocation."]})),o.jsx(z,{title:"Compute Efficiency",statusBadge:o.jsx(pn,{}),defaultCollapsed:!0,summary:o.jsx(te,{value:n.wastagePct!=null?`${n.wastagePct}% wasted`:G(n.availableComputeHours),context:`of ${G(n.availableComputeHours)} available`}),children:o.jsxs("div",{className:"space-y-2 text-sm",children:[!t.wallClockReliable&&o.jsx(H,{children:o.jsx("p",{className:"text-muted-foreground",children:"This run used concurrent job groups: the driver/executor split below is approximate, not precise."})}),o.jsxs("p",{children:["Available: ",o.jsx("strong",{children:G(n.availableComputeHours)}),n.wastagePct!=null&&o.jsxs(o.Fragment,{children:[" ","· wasted ",o.jsxs("strong",{children:[n.wastagePct,"%"]})]})]}),o.jsxs("p",{children:[o.jsx(se,{impactBand:"info"})," Driver-bound waste: ",o.jsx("strong",{children:G(n.driverWasteHours)})]}),o.jsxs("p",{children:[o.jsx(se,{impactBand:"info"})," Executor-bound waste: ",o.jsx("strong",{children:G(n.executorWasteHours)})]}),o.jsxs("p",{className:"text-muted-foreground",children:["Floor (same executors, zero skew): ",I(n.floorZeroSkewMs)]}),s]})})}function cr(e){const n={extract:0,transform:0,load:0};for(const t of e.values()){const s=Math.max(0,(t.completedAt??0)-(t.submittedAt??0));if(s===0)continue;const r=(t.shuffleReadBytes??0)>0||(t.shuffleWriteBytes??0)>0;(t.inputBytes??0)>0&&(t.shuffleReadBytes??0)===0&&(n.extract+=s),r&&(n.transform+=s),(t.outputBytes??0)>0&&(n.load+=s)}return n}const Nt=[{label:"Extract",key:"extract"},{label:"Transform",key:"transform"},{label:"Load",key:"load"}];function dr({appModel:e}){const n=cr(e.stages);if(n.extract+n.transform+n.load===0)return null;const s=Nt.reduce((r,i)=>n[i.key]>n[r.key]?i:r);return o.jsx(z,{title:"ETL Phase Attribution",defaultCollapsed:!0,summary:o.jsx(te,{value:`${s.label} ${I(n[s.key])}`,context:"dominant phase"}),children:o.jsxs("div",{className:"space-y-1",children:[Nt.map(({label:r,key:i})=>o.jsxs("div",{children:[o.jsx("strong",{children:r}),": ",I(n[i])]},i)),o.jsx(H,{children:o.jsx("div",{className:"text-xs text-muted-foreground",children:"Heuristic: a stage that both shuffles and writes counts in Transform and Load, so phases can overlap and need not sum to wall-clock."})})]})})}const gr=220;function fr(e){const n=e.app,t=e.executors.added,s=e.executors.removed;if(n?.startTime==null||n?.endTime==null)return{times:[],counts:[]};const r=n.endTime-n.startTime,i=Math.max(5e3,Math.floor(r/100)),a=[],u=[],c=new Map(s.map(l=>[l.executorId,l.timestamp]));for(let l=n.startTime;l<=n.endTime;l+=i){const d=t.filter(p=>{const f=c.get(p.executorId)??1/0;return p.timestamp<=l&&l<f}).length;a.push(((l-n.startTime)/1e3).toFixed(0)+"s"),u.push(d)}return{times:a,counts:u}}const mr=w.memo(function({appModel:n,activeFileId:t}){const{chartData:s,sampled:r,hasSeries:i,peak:a}=w.useMemo(()=>{const{times:u,counts:c}=fr(n),l=u.map((g,h)=>({label:g,count:c[h]})),d=Me(l),p=c.length>0,f=p?Math.max(...c):0;return{chartData:l,sampled:d,hasSeries:p,peak:f}},[n,t]);return i?o.jsx(z,{title:"Executor Count Over Time",summary:o.jsx(te,{value:`${a} peak`,context:"concurrent executors"}),children:o.jsx(ae,{ariaLabel:"Executor count over time. See the table below for exact values.",height:gr,table:{caption:"Executor timeline: active executor count over time",columns:["Time","Active executors"],rows:s.map(u=>[u.label,u.count]),align:["left","right"]},children:o.jsxs($s,{data:r,children:[o.jsx(Ce,{vertical:!1,stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"label",tick:{fontSize:10},minTickGap:24}),o.jsx(ue,{allowDecimals:!1,tick:{fontSize:10},width:32}),o.jsx(ye,{formatter:u=>[`${u} executor${u===1?"":"s"} active`,""],labelFormatter:()=>""}),o.jsx(_s,{type:"monotone",dataKey:"count",name:"Active executors",stroke:N.clean,fill:N.clean,fillOpacity:.15})]})})}):o.jsx(z,{title:"Executor Count Over Time",summary:o.jsx("span",{className:"text-muted-foreground text-xs",children:"Timeline unavailable: no end time recorded."}),children:o.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."})})}),Et=[10,20,50,80,100,110,120,150,200,300,400,500];function pr(e,n,t){return n<=0||t<=0?0:e/Math.min(t,n)}function Tt(e,n){let t=0;for(const s of Object.keys(e)){const{totalTaskDurationSum:r,taskCount:i}=e[s];t+=pr(r,i,n)}return t}function hr({app:e,stages:n,runAggregates:t,executorsAdded:s}){const r=t?.perStage??{},i=at(e??{},s),u=Se(e,n).stagesActive,c=i>0?Tt(r,i):0,l=u>0?Math.round(Math.abs(c-u)/u*100):null,d=c>0?u/c:1,p=Et.map(f=>{const g=Math.max(1,Math.round(i*f/100)),h=Math.round(Tt(r,g)*d);return{pct:f,cores:g,estMakespanMs:h}});return{baselineCores:i,testPercentages:Et,predictions:p,modelErrorPct:l}}const hn="What-If Executor Scaling",xr=220,vr=20;function wr([e,n]){const t=(n-e)*.1;return[Math.max(0,e-t),n+t]}function Sr(e){return[...e.stages.values()].some(n=>{const t=n.submittedAt,s=n.completedAt;return typeof t=="number"&&Number.isFinite(t)&&typeof s=="number"&&Number.isFinite(s)&&s>t})}function Cr(e){return e.evidenceAvailability?.entries.find(n=>n.key==="taskCoreTime")}function Be({reason:e,evidence:n}){return o.jsx(z,{title:hn,summary:o.jsxs("span",{className:"text-muted-foreground text-xs",children:["Not available: ",e]}),children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Not available: ",e," ",o.jsx(ft,{evidenceKey:n})]})})}function yr({appModel:e}){const n=Cr(e);if(!(Gn(e.runAggregates)&&(n==null||n.state==="present")))return o.jsx(Be,{reason:n?.summary??"No usable task and core-time evidence in this log.",evidence:"taskCoreTime"});const s=hr({app:e.app,stages:e.stages,runAggregates:e.runAggregates,executorsAdded:e.executors.added});if(s.baselineCores<=0)return o.jsx(Be,{reason:"Baseline executor/core capacity is unavailable in this log."});if(!Sr(e))return o.jsx(Be,{reason:"Usable stage timing is unavailable in this log."});const r=mn(e.jobs),i=s.modelErrorPct!=null&&s.modelErrorPct>=vr,a=Me(s.predictions),u=s.predictions.reduce((c,l)=>l.estMakespanMs<c.estMakespanMs?l:c);return o.jsx(z,{title:hn,defaultCollapsed:!0,summary:o.jsx(te,{value:I(u.estMakespanMs),context:`best case at ${u.pct}% executors`}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(H,{children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Model Error:"," ",o.jsx("strong",{className:i?"text-warning":void 0,children:s.modelErrorPct==null?"—":`${s.modelErrorPct}%`})," ","(idealized makespan vs. observed); higher means all estimates below are less trustworthy. Predictions are unvalidated (a single log observes only one scale)."]})}),o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Move along this curve by changing ",o.jsx("code",{children:"spark.dynamicAllocation"}),"’s executor bounds, see the ",o.jsx(Xt,{anchor:"#config-autoscale-bounds",children:"autoscaling config guide"}),"."]}),r.wallClockReliable?null:o.jsx(H,{children:o.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."})}),o.jsx(H,{children:o.jsx("p",{className:"text-xs",children:o.jsx(ft,{evidenceKey:"taskCoreTime"})})}),o.jsx(ae,{ariaLabel:"Estimated makespan by executor percentage: diminishing-returns curve.",height:xr,table:{caption:"Estimated makespan by executor percentage",columns:["% Executors","Cores","Est. makespan"],rows:s.predictions.map(c=>[`${c.pct}%`,c.cores,I(c.estMakespanMs)]),align:["right","right","right"]},children:o.jsxs(Ms,{data:a,children:[o.jsx(Ce,{stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"pct",tickFormatter:c=>`${c}%`,tick:{fontSize:10}}),o.jsx(ue,{domain:wr,tickFormatter:c=>I(c),tick:{fontSize:10},width:56}),o.jsx(ye,{formatter:c=>[I(Number(c)),"Est. makespan"],labelFormatter:c=>`${c}% executors`}),o.jsx(Ps,{type:"monotone",dataKey:"estMakespanMs",name:"Est. makespan",stroke:N.accent,dot:{r:3}})]})})]})})}function xn(e){return typeof e?.startTime=="number"&&Number.isFinite(e.startTime)&&typeof e?.endTime=="number"&&Number.isFinite(e.endTime)&&e.endTime>e.startTime}function jr(e){if(!xn(e.app))return{efficiency:{value:null,unavailableReason:"application-timing"},wastage:{value:null,unavailableReason:"application-timing"}};const n=Se(e.app,e.stages),t=Math.min(100,Math.round(n.stagesActive/n.total*100));if(!e.runAggregates)return{efficiency:{value:t,unavailableReason:null},wastage:{value:null,unavailableReason:"core-usage-summary"}};const s=fn({app:e.app,stages:e.stages,executorsAdded:e.executors.added,runAggregates:e.runAggregates});return!Number.isFinite(s.availableComputeHours)||s.availableComputeHours<=0?{efficiency:{value:t,unavailableReason:null},wastage:{value:null,unavailableReason:"executor-capacity"}}:{efficiency:{value:t,unavailableReason:null},wastage:{value:s.wastagePct,unavailableReason:null}}}const Rr={critical:"inset 4px 0 0 var(--color-critical)",warning:"inset 4px 0 0 var(--color-warning)"};function Le({eyebrow:e,value:n,meta:t,flag:s=null,bar:r,dataTestid:i}){return o.jsxs("div",{"data-testid":i,className:"flex flex-col gap-1 p-3",style:s?{boxShadow:Rr[s]}:void 0,children:[o.jsxs("span",{className:D("flex items-center gap-1.5 text-xs font-medium text-muted-foreground",s&&Rt[s]),children:[s&&o.jsx(se,{impactBand:s}),e]}),o.jsx("div",{className:D("font-heading text-2xl font-semibold",s&&Rt[s]),children:n}),o.jsx("p",{className:"text-xs text-muted-foreground",children:t}),r]})}function At({pct:e,flag:n,label:t}){const s=Math.max(0,Math.min(100,e));return o.jsx("div",{role:"img","aria-label":t,className:"mt-0.5 h-1.5 w-full overflow-hidden rounded-full bg-muted",children:o.jsx("div",{className:D("h-full rounded-full",n?Wn[n]:"bg-clean"),style:{width:`${s}%`}})})}function br({active:e,total:n}){const t=n>0?Math.max(0,Math.min(100,e/n*100)):0;return o.jsxs("div",{role:"img","aria-label":`Active ${I(e)} of ${I(n)} total`,className:"mt-0.5 flex h-1.5 w-full overflow-hidden rounded-full bg-muted",children:[o.jsx("div",{className:"h-full bg-clean",style:{width:`${t}%`}}),o.jsx("div",{className:"h-full flex-1 bg-muted-foreground/60"})]})}function kr(){return o.jsxs("div",{className:"flex items-start gap-2 rounded-xl border border-warning/40 bg-warning/10 p-4",children:[o.jsx(se,{impactBand:"warning",className:"mt-1.5"}),o.jsxs("p",{className:"text-sm text-warning",children:[o.jsx("span",{className:"font-semibold tracking-wide uppercase",children:"Timing unavailable"}),". This run has no complete application timing interval, so wall-clock, efficiency, and wastage can’t be measured."]})]})}function Fr({appModel:e,catalog:n}){const t=lt(),{app:s,stages:r}=e;if(!xn(s))return o.jsx(kr,{});const a=Se(s,r),u=jr(e),c=a.total,l=u.efficiency.value,d=l==null?null:l<75?"critical":l<90?"warning":null,p=n.find(h=>h.type==="coldStart"),f=u.wastage.value,g=f==null?null:f>=70?"critical":f>=40?"warning":null;return o.jsx(qn,{className:"overflow-hidden py-0",children:o.jsxs("div",{className:"grid grid-cols-1 divide-y divide-border sm:grid-cols-3 sm:divide-x sm:divide-y-0",children:[o.jsx(Le,{eyebrow:"Wall-clock",dataTestid:"kpi-wall-clock",value:c>0?I(c):"—",meta:o.jsxs(o.Fragment,{children:["Ran ",I(a.stagesActive),p?` · ${p.value}s cold start`:""]}),bar:o.jsx(br,{active:a.stagesActive,total:c})}),o.jsx(Le,{eyebrow:"Efficiency",dataTestid:"kpi-efficiency",value:l==null?"Unavailable":o.jsxs(o.Fragment,{children:[l,o.jsx("small",{children:"%"})]}),flag:d,meta:l==null?"This run has no complete application timing interval.":c>a.stagesActive?`Ran ${I(a.stagesActive)} · ${I(c-a.stagesActive)} idle/gap time`:"executors active the whole run",bar:l!=null?o.jsx(At,{pct:l,flag:d,label:`Efficiency ${l}%`}):void 0}),o.jsx(Le,{eyebrow:"Wastage",dataTestid:"kpi-wastage",value:f==null?"Unavailable":o.jsxs(o.Fragment,{children:[f,o.jsx("small",{children:"%"})]}),flag:g,meta:u.wastage.unavailableReason==="application-timing"?"Wastage needs complete application timing.":u.wastage.unavailableReason==="core-usage-summary"?"Wastage needs the core-usage summary.":u.wastage.unavailableReason==="executor-capacity"?"Wastage needs usable executor-capacity data.":t==="advanced"?"Driver-idle + executor-slack core-hours as a share of available capacity. Directional, not a cost figure.":"Executor capacity that sat idle. Not a cost figure.",bar:f!=null?o.jsx(At,{pct:f,flag:g,label:`Wastage ${f}%`}):void 0})]})})}function Ir({className:e,...n}){return o.jsx(Dn,{"data-slot":"accordion",className:D("flex w-full flex-col",e),...n})}function $r({className:e,...n}){return o.jsx(Vn,{"data-slot":"accordion-item",className:D("not-last:border-b",e),...n})}function _r({className:e,children:n,headingLevel:t=3,...s}){const r=`h${t}`;return o.jsx(Bn,{className:"flex",render:o.jsx(r,{}),children:o.jsxs(Ln,{"data-slot":"accordion-trigger",className:D("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),...s,children:[n,o.jsx(it,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none shrink-0 group-aria-expanded/accordion-trigger:hidden"}),o.jsx(Jt,{"data-slot":"accordion-trigger-icon",className:"pointer-events-none hidden shrink-0 group-aria-expanded/accordion-trigger:inline"})]})})}function Mr({className:e,children:n,...t}){return o.jsx(Hn,{"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",...t,children:o.jsx("div",{className:D("pt-0 pb-2.5 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4",e),children:n})})}function Dt(e){return e.length===0?e:e[0].toUpperCase()+e.slice(1)}function Pr({type:e,label:n,thresholdSummary:t}){return o.jsxs(Z,{"data-testid":"clean-check-row","data-clean-check-type":e,children:[o.jsx(B,{className:"w-px",children:o.jsxs("span",{className:"inline-flex h-6 items-center gap-1 rounded-full bg-clean/10 px-2 font-mono text-xs font-medium whitespace-nowrap text-clean",children:[o.jsx(Qt,{"aria-hidden":"true",className:"size-3.5 shrink-0"}),Je(e)]})}),o.jsxs(B,{className:"whitespace-normal",children:[o.jsx("span",{className:"block text-sm font-medium text-foreground",children:Dt(n)}),o.jsx(H,{children:o.jsx("span",{className:"block text-xs text-muted-foreground",children:Dt(`${t}.`)})})]})]})}const Nr="suggested-improvements",Er={skew:"per-stage",stageShape:"per-stage",tinyTask:"per-stage",shuffle:"per-stage",partitionSizing:"per-stage",spill:"per-stage",gc:"per-stage",stageFailed:"per-stage",failures:"per-stage",retryWaste:"per-stage",slowHost:"per-stage",stageSlowness:"per-stage",straggler:"per-stage",speculationWaste:"per-stage",incompleteRun:"app-level",coldStart:"app-level",memoryUtilization:"app-level",utilization:"app-level",coreLocality:"app-level",cachingOpportunity:"app-level",cacheUtilization:"app-level",jobFailureRate:"app-level",autoscalingChurn:"app-level",duplicatePlanSubtree:"sql-scope",smallFiles:"sql-scope",underBroadcast:"sql-scope",overBroadcast:"sql-scope",configAudit:"config-scope"},Tr=["per-stage","app-level","sql-scope","config-scope"],Ar={"per-stage":"Per-stage checks","app-level":"App-level checks","sql-scope":"SQL plan checks","config-scope":"Config checks"};function Dr(e,n){const t=[...e,...n].filter(en);return tn().filter(({type:r})=>!nn(r)).map(({component:r,widgetId:i,type:a},u)=>{const c=t.filter(l=>l.type===a);return{component:r,widgetId:i,index:u,findings:c,impactBand:Yt(c)}}).filter(r=>r.impactBand!==void 0).sort((r,i)=>oe[r.impactBand]-oe[i.impactBand]||r.index-i.index)}function Vr({appModel:e,catalog:n,configFindings:t=[],getTaskData:s,activeFileId:r}){const i=[...n,...t].filter(en),a=Object.keys(xe).filter(l=>!nn(l)).filter(l=>!i.some(d=>d.type===l)).map(l=>({type:l,findingLabel:xe[l].findingLabel})),u=new Map;for(const l of a){const d=Er[l.type]??"app-level";u.has(d)||u.set(d,[]),u.get(d).push(l)}const c=is();return o.jsxs(o.Fragment,{children:[o.jsx(ut,{children:c.map(({component:l,widgetId:d})=>o.jsx(Q,{cardId:`reference-${d}`,widgetId:d,children:o.jsx(w.Suspense,{fallback:o.jsx(Zt,{}),children:o.jsx(l,{appModel:e,catalog:n,configFindings:t,getTaskData:s,activeFileId:r,defaultCollapsed:!0})})},d))}),o.jsx(Ir,{children:o.jsxs($r,{value:"clean-checks",children:[o.jsx(_r,{children:"Clean checks"}),o.jsxs(Mr,{children:[o.jsxs("p",{className:"pb-2 text-xs text-muted-foreground",children:["Every check below passed. No fix needed.",o.jsx(H,{children:" Each line's caption states the threshold it was measured against."})]}),Tr.map(l=>{const d=u.get(l);return!d||d.length===0?null:o.jsxs("div",{className:"pt-3 first:pt-0",children:[o.jsx("p",{className:"pb-1 text-xs font-medium text-muted-foreground",children:Ar[l]}),o.jsx(ct,{children:o.jsx(dt,{children:d.map(({type:p,findingLabel:f})=>o.jsx(Pr,{type:p,label:f,thresholdSummary:as(p)},p))})})]},l)})]})]})})]})}function Br(e){switch(e.type){case"skew":return"For join-driven skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key to reduce task skew.";case"stageShape":switch(e.rule){case"lowParallelism":return"Too few tasks run relative to the cores available, leaving cluster capacity idle: repartition to use more of it.";case"dataExplosion":return"Output volume far exceeds input volume: check for an exploding join or a cross product.";case"taskStageSkew":return"A single straggler task gates the whole stage's wall-clock duration."}break;case"shuffle":return"Consider increasing spark.sql.shuffle.partitions or adding a broadcast join to shrink the shuffle.";case"partitionSizing":switch(e.rule){case"shufflePartitionSkew":return"For join skew, enable AQE skew-join handling (spark.sql.adaptive.skewJoin.enabled); otherwise salt the key or repartition on a better key.";case"lowShuffleParallelism":return"Raise spark.sql.shuffle.partitions so each partition is smaller.";case"maxPartitionTooBig":return"Repartition to break up the oversized partition before this stage."}break;case"spill":return"If the spill is skew-driven, fix task skew first: adding memory will not help. Otherwise raise spark.sql.shuffle.partitions or increase executor memory.";case"gc":return e.direction==="low"?"Memory may be over-provisioned here: consider reducing spark.executor.memory for cost savings.":"Reduce object creation, use primitive types, avoid UDFs, or increase executor memory to cut GC time.";case"slowHost":return e.variant==="durationShare"?"Check for data locality or partition assignment skewing work onto one node.":e.variant==="multiDim"?"Investigate uneven partition assignment or a degraded executor.":"Check what this host was running: it may just hold data locality for its tasks or carry one heavy stage, rather than a hardware fault. Enable spark.speculation to relaunch a lagging task automatically.";case"stageSlowness":return"Often a partition-count problem: raise parallelism via spark.sql.shuffle.partitions or spark.default.parallelism, or check for a large per-task data volume driving heavy shuffle and spill.";case"stageFailed":return"Inspect the driver log for the failure reason and the job that triggered it.";case"failures":return"Investigate driver logs for executor instability or data-driven errors.";case"straggler":return"Rule out a GC pause or a slow shuffle fetch before assuming a hardware issue. If a skewed key is the real cause, that is a candidate for AQE's skew-join handling.";case"speculationWaste":return"If task durations are naturally variable rather than genuine stragglers, consider tuning spark.speculation.multiplier/quantile.";case"retryWaste":return"Investigate executor loss or fetch failures behind the retried attempts.";case"tinyTask":return"Scheduler overhead may dominate: lower spark.sql.shuffle.partitions, or coalesce down to fewer, larger tasks.";case"coldStart":return"Keep a warm pool of idle executors, or if using dynamic allocation, raise the minimum/initial executor count so it does not scale up from zero.";case"utilization":return"Consider reducing cluster size or enabling dynamic allocation.";case"memoryUtilization":switch(e.variant){case"idleCores":return"Reduce cluster size or enable dynamic allocation.";case"wasteModel":return"Review spark.executor.memory and executor count.";case"memoryBand":if(e.dataUnavailable)break;return e.rule==="heapNearCapacity"?"Memory may be too small: raise spark.executor.memory to avoid OOM/spill.":"Memory may be over-provisioned: consider reducing spark.executor.memory for cost savings."}break;case"cacheUtilization":switch(e.variant){case"partialCache":return"Increase executor memory or reduce the cached dataset size so more of it stays cached.";case"diskSpillover":return"Executor memory may be too small for this cached dataset: increase executor memory or reduce its size."}break;case"coreLocality":return"Check spark.locality.wait settings and executor/data colocation.";case"autoscalingChurn":return"This looks like wasteful re-provisioning rather than normal scale-down: consider raising spark.dynamicAllocation.executorIdleTimeout or widening the minExecutors/maxExecutors bounds to reduce flapping.";case"cachingOpportunity":return e.variant==="composite"?"Cache or persist the repeated join/union result so it is computed once instead of recomputed per query.":"Cache the shared DataFrame, or broadcast it if it is a small join lookup.";case"jobFailureRate":return"Inspect the driver log for the failed job(s) and the stage failures that triggered them.";case"configAudit":switch(e.property){case"spark.shuffle.service.enabled":return"Set spark.shuffle.service.enabled=true so shuffle data survives executor removal.";case"spark.dynamicAllocation.minExecutors":return"Set the minimum executor bound at or below the maximum.";case"spark.dynamicAllocation.maxExecutors":return"Set spark.dynamicAllocation.maxExecutors to cap cluster growth.";case"spark.serializer":return"Consider spark.serializer=org.apache.spark.serializer.KryoSerializer for faster, smaller buffers.";case"spark.executor.memoryOverhead":return"Raise executor memoryOverhead above Spark's default floor to avoid off-heap OOM-kills."}break;case"duplicatePlanSubtree":return"Check whether the repeated subtree could be computed once and reused, or cache/persist the shared computation.";case"smallFiles":return e.direction==="write"?"Repartition or coalesce before writing to raise the average file size.":"Compact the upstream output so fewer, larger files are produced.";case"underBroadcast":return"This could have been a broadcast join: consider a broadcast() hint or raising spark.sql.autoBroadcastJoinThreshold.";case"overBroadcast":return"Check for a misapplied broadcast hint or a misconfigured spark.sql.autoBroadcastJoinThreshold."}}function vn(e){const n=xe[e.type],t=typeof e.recommendation=="string"?e.recommendation.trim():"";return!n?.routeable||!t?null:{finding:e,widgetId:n.widgetId,region:n.region,findingLabel:n.findingLabel,stageId:typeof e.stageId=="number"?e.stageId:null,recommendation:t}}function we(e,n){return n.includes(e)?vn(e):null}function Vt(e){return e.impactEstimate?.wallClock?.high??null}function Lr(e){const n=new Map(tn().map((s,r)=>[s.widgetId,r])),t=e.map((s,r)=>({target:vn(s),catalogIndex:r})).filter(s=>s.target!==null);return t.sort((s,r)=>{const i=Vt(s.target.finding),a=Vt(r.target.finding);return i!==null&&a!==null&&i!==a?a-i:i!==null!=(a!==null)?i!==null?-1:1:(n.get(s.target.widgetId)??Number.MAX_SAFE_INTEGER)-(n.get(r.target.widgetId)??Number.MAX_SAFE_INTEGER)||s.catalogIndex-r.catalogIndex}),t[0]?.target??null}const be=10;function Hr(e){return cs(e)&&xe[e.type]!=null}function zr(e){return sn(e.findings)[0].impactBand}function xt(e){const n=e.impactEstimate;return n?n.wallClock?un(n.wallClock.low,n.wallClock.high):n.rawWaste?Ds(n.rawWaste):null:null}function Ne(e){const n=e.stageId!=null?`St.${e.stageId}`:e.stageIds&&e.stageIds.length>0?`St.${Un(e.stageIds)}`:null;if(e.type==="duplicatePlanSubtree"&&e.rootName!=null){const t=wn(e);return n&&t?`${n} · ${t}`:t??n}return n||(e.property?String(e.property):null)}function wn(e){if(e.type!=="duplicatePlanSubtree"||e.rootName==null)return null;const n=Kn(e.rootName),t=e.groupIndex!=null?`${n} #${Number(e.groupIndex)+1}`:n;return e.executionId!=null?`${t} (SQL ${e.executionId})`:t}function vt({finding:e,textClassName:n,visibleLimit:t,stackIdentity:s,stagePillClassName:r}){const{stageId:i,stageIds:a}=e;if(i!=null)return o.jsx(Ts,{stageId:i});if(a&&a.length>0){const c=wn(e),l=c?o.jsx("span",{className:D("truncate",n),title:c,children:c}):null,d=o.jsx(As,{pills:a.map(p=>({id:p})),visibleLimit:t,pillOverrideClassName:s?r:void 0});return o.jsx("span",{className:D("inline-flex min-w-0 items-center gap-1.5",s?"flex-col":"flex-wrap"),children:s?o.jsxs(o.Fragment,{children:[l,d]}):o.jsxs(o.Fragment,{children:[d,l]})})}const u=Ne(e);return u?o.jsx("span",{className:D("min-w-0 truncate",n),title:u,children:u}):null}function fe(e){const n=typeof e.recommendation=="string"?e.recommendation.trim():"";return n||(xe[e.type]?.findingLabel??e.type)}function Or({finding:e,allFindings:n,onRoute:t}){const s=we(e,n),r=Ne(e),i=xt(e),a=fe(e),u=ie(e);return o.jsxs(Z,{"data-testid":"fix-these-first-row","data-finding-type":e.type,children:[o.jsx(B,{className:"w-px",children:o.jsx(pe,{type:e.type,impactBand:e.impactBand})}),o.jsx(B,{className:"whitespace-normal",children:o.jsxs("button",{type:"button",className:"cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",onClick:()=>s&&t(s),children:[o.jsx("span",{className:"block text-sm font-medium",children:u}),o.jsx("span",{className:"block text-xs text-muted-foreground",children:a})]})}),o.jsx(B,{className:"w-px text-right font-mono text-xs text-muted-foreground",title:[r,i].filter(Boolean).join(" · "),children:o.jsxs("span",{className:"flex items-center justify-end gap-1.5",children:[o.jsx(vt,{finding:e}),i?o.jsx("span",{className:"shrink-0",children:i}):null]})})]})}function Gr({finding:e,allFindings:n,onRoute:t,id:s}){const r=we(e,n),i=Ne(e),a=xt(e),u=fe(e),c=ie(e),l=e.stageId!=null||i!=null;return o.jsxs(Z,{id:s,"data-testid":"fix-these-first-row","data-finding-type":e.type,className:"bg-muted/50",children:[o.jsxs(B,{colSpan:2,className:"whitespace-normal",children:[l?o.jsx("div",{className:"mb-1",children:o.jsx(vt,{finding:e,textClassName:"line-clamp-1 break-words text-xs font-medium font-mono"})}):null,o.jsxs("button",{type:"button",className:"block w-full cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",onClick:()=>r&&t(r),children:[l?null:o.jsx("span",{className:"line-clamp-1 break-words text-xs font-medium",children:c}),o.jsx("span",{className:"line-clamp-1 break-words text-xs text-muted-foreground",children:u})]})]}),o.jsx(B,{className:"w-px text-right font-mono text-xs text-muted-foreground",children:a})]})}function qr(e){return e.kind==="time"?`×${e.findingCount} · ${un(e.recoverableMsHigh,e.recoverableMsHigh)} recoverable`:e.kind==="resource"?`×${e.findingCount} · resource-cost projection`:Object.entries(e.byImpactBand).map(([n,t])=>`${t} ${n}`).join(", ")}function Wr({group:e,allFindings:n,expanded:t,onToggle:s,onRoute:r}){const[i,a]=w.useState(0),u=sn(e.findings),c=u[0],l=Br(c),d=ie(c),p=Math.ceil(u.length/be),f=Math.min(i,Math.max(0,p-1)),g=u.slice(f*be,f*be+be),h=`fix-these-first-group-content-${e.kind}-${e.type}${"unit"in e?`-${e.unit}`:""}`;return o.jsxs(o.Fragment,{children:[o.jsxs(Z,{"data-testid":"fix-these-first-group-row","data-finding-type":e.type,children:[o.jsx(B,{className:"w-px",children:o.jsx(pe,{type:e.type,impactBand:c.impactBand})}),o.jsx(B,{className:"whitespace-normal",children:o.jsxs("button",{type:"button","aria-expanded":t,"aria-controls":h,className:"cursor-pointer rounded-sm text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",onClick:s,children:[o.jsx("span",{className:"block text-sm font-medium",children:d}),l?o.jsx("span",{className:"block text-xs text-muted-foreground",children:l}):null]})}),o.jsx(B,{className:"w-px text-right font-mono text-xs text-muted-foreground",children:o.jsxs("span",{className:"inline-flex items-center justify-end gap-1.5",children:[qr(e),t?o.jsx(Jt,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"}):o.jsx(it,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})]})})]}),t&&g.map((m,S)=>o.jsx(Gr,{finding:m,allFindings:n,onRoute:r,id:S===0?h:void 0},m.id)),t&&p>1&&o.jsx(Z,{className:"bg-muted/50",children:o.jsx(B,{colSpan:3,children:o.jsx(Bs,{page:f,totalPages:p,onPrev:()=>a(m=>m-1),onNext:()=>a(m=>m+1)})})})]})}function Ur({target:e,onRoute:n}){const t=Ne(e.finding),s=xt(e.finding),r=e.finding.stageId!=null||t!=null,[i,a]=w.useState(!1),u=async()=>{const c=`${ie(e.finding)} — ${fe(e.finding)}`,l=[/[.!?]$/.test(c)?c:`${c}.`,s?`Potential savings: ${s}`:null].filter(Boolean).join(" ");try{await ds(l),a(!0),setTimeout(()=>a(!1),1500)}catch{}};return o.jsxs("div",{className:"mb-3 flex flex-col gap-2 rounded-lg border border-primary/40 bg-primary/5 transition-colors hover:bg-primary/10",children:[o.jsxs("button",{type:"button","aria-label":`${ie(e.finding)}, ${fe(e.finding)}`,onClick:()=>n(e),className:"flex cursor-pointer flex-col gap-2 rounded-lg px-4 py-3 text-left focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 sm:flex-row sm:items-start sm:justify-between sm:gap-4",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs font-semibold tracking-wide text-primary uppercase",children:[o.jsx(Us,{"aria-hidden":"true",className:"size-3.5"}),"Highest impact"]}),o.jsxs("p",{className:"mt-2 min-w-0",children:[o.jsx("span",{className:"text-sm font-semibold",children:ie(e.finding)}),o.jsxs("span",{className:"text-sm text-muted-foreground",children:[", ",fe(e.finding)]})]})]}),s?o.jsxs("div",{className:"min-w-0 sm:shrink-0 sm:text-right",children:[o.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Potential savings"}),o.jsx("p",{className:"whitespace-nowrap font-mono text-lg font-semibold leading-tight tabular-nums text-primary",children:s})]}):null]}),o.jsxs("div",{className:D("flex items-center gap-3 px-4 pb-3",r?"justify-between":"justify-end"),children:[r?o.jsx(vt,{finding:e.finding,textClassName:"line-clamp-2 max-w-[140px] break-words text-xs font-semibold text-muted-foreground",visibleLimit:2,stackIdentity:!0,stagePillClassName:"h-5 px-1.5 text-[10px] font-normal"}):null,o.jsx("button",{type:"button","data-testid":"copy-finding-button",onClick:()=>{u()},className:"inline-flex shrink-0 cursor-pointer items-center gap-1 rounded text-xs text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",children:i?o.jsxs(o.Fragment,{children:[o.jsx(us,{"aria-hidden":"true",className:"size-3.5"}),"Copied"]}):o.jsxs(o.Fragment,{children:[o.jsx(Hs,{"aria-hidden":"true",className:"size-3.5"}),"Copy finding"]})})]})]})}function Kr(e,n,t){const r=[...e,...n].filter(Hr),i=ls(r,t),a=Lr(r);return{eligible:r,groups:i,triageTarget:a}}const Xr={critical:"Critical",warning:"Warning",info:"Info"},Jr=["critical","warning","info"];function Qr(e){return`${e.kind}-${e.type}-${"unit"in e?e.unit:""}`}function Yr({impactBand:e,groups:n,widgets:t,allFindings:s,expandedGroupKey:r,onToggleGroup:i,onRoute:a,appModel:u,catalog:c,configFindings:l,getTaskData:d,activeFileId:p}){if(n.length===0&&t.length===0)return null;const f=`impact-band-${e}-heading`;return o.jsxs("section",{"aria-labelledby":f,className:"space-y-3",children:[o.jsx("h2",{id:f,className:"font-heading text-base font-semibold",children:Xr[e]}),n.length>0&&o.jsx(ct,{children:o.jsx(dt,{children:n.map(g=>{if(g.findingCount===1)return o.jsx(Or,{finding:g.findings[0],allFindings:s,onRoute:a},g.findings[0].id);const h=Qr(g);return o.jsx(Wr,{group:g,allFindings:s,expanded:r===h,onToggle:()=>i(h),onRoute:a},h)})})}),t.length>0&&o.jsx(ut,{children:t.map(({component:g,widgetId:h,index:m})=>o.jsx(Q,{cardId:`alert-${m}`,widgetId:h,children:o.jsx(w.Suspense,{fallback:o.jsx(Zt,{}),children:o.jsx(g,{appModel:u,catalog:c,configFindings:l,getTaskData:d,activeFileId:p,defaultCollapsed:!0})})},h))})]})}function Zr({appModel:e,catalog:n,configFindings:t=[],stages:s,getTaskData:r,activeFileId:i,onRoute:a}){const{eligible:u,groups:c,triageTarget:l}=w.useMemo(()=>Kr(n,t,s),[n,t,s]),d=[...n,...t],p=w.useMemo(()=>Dr(n,t),[n,t]),[f,g]=w.useState(null),{groupsByImpactBand:h,widgetsByImpactBand:m}=w.useMemo(()=>{const S=new Map;for(const v of c){const b=zr(v);S.has(b)||S.set(b,[]),S.get(b).push(v)}const C=new Map;for(const v of p)C.has(v.impactBand)||C.set(v.impactBand,[]),C.get(v.impactBand).push(v);return{groupsByImpactBand:S,widgetsByImpactBand:C}},[c,p]);return o.jsxs("div",{id:Nr,className:"space-y-6 scroll-mt-20",children:[l?o.jsx(Ur,{target:l,onRoute:a}):null,u.length===0?o.jsx(mt,{tone:"clean",icon:Qt,title:"No findings to fix right now."}):null,Jr.map(S=>o.jsx(Yr,{impactBand:S,groups:h.get(S)??[],widgets:m.get(S)??[],allFindings:d,expandedGroupKey:f,onToggleGroup:C=>g(v=>v===C?null:C),onRoute:a,appModel:e,catalog:n,configFindings:t,getTaskData:r,activeFileId:i},S)),o.jsx(Vr,{appModel:e,catalog:n,configFindings:t,getTaskData:r,activeFileId:i})]})}const Bt=["PROCESS_LOCAL","NODE_LOCAL","RACK_LOCAL","NO_PREF","ANY"],Lt=[N.clean,N.accent,N.warning,N.muted,N.critical];function Ht(e){return e?new Date(e).toLocaleString():"—"}function eo({stats:e}){const n=new Map(e.map(r=>[r.locality,r.count])),t=Bt.filter(r=>n.has(r));for(const r of e)Bt.includes(r.locality)||t.push(r.locality);const s=t.map((r,i)=>({locality:r,count:n.get(r)??0,color:Lt[Math.min(i,Lt.length-1)]}));return o.jsx(ae,{ariaLabel:"Task locality distribution",height:140,table:{caption:"Task locality distribution",columns:["Locality tier","Task count"],rows:s.map(r=>[r.locality,r.count]),align:["left","right"]},children:o.jsxs(Pe,{data:s,children:[o.jsx(Ce,{vertical:!1,stroke:N.muted,strokeOpacity:.2}),o.jsx(le,{dataKey:"locality",tick:{fontSize:10}}),o.jsx(ue,{allowDecimals:!1,tick:{fontSize:10},width:32}),o.jsx(ye,{formatter:r=>[`${Number(r)} task${Number(r)===1?"":"s"}`,"Tasks"]}),o.jsx(ve,{dataKey:"count",name:"Tasks",children:s.map(r=>o.jsx(ln,{fill:r.color},r.locality))})]})})}function to(e){const n=new Map;for(const t of e){n.has(t.type)||n.set(t.type,{impactBand:t.impactBand,finding:t,recs:new Map});const s=n.get(t.type);oe[t.impactBand]<oe[s.impactBand]&&(s.impactBand=t.impactBand,s.finding=t),t.recommendation&&!s.recs.has(t.recommendation)&&s.recs.set(t.recommendation,{extended:t.extended??null})}return[...n.entries()].sort(([,t],[,s])=>oe[t.impactBand]-oe[s.impactBand])}function no({rec:e,extended:n,finding:t,showImpactEstimate:s}){return o.jsxs("div",{className:"space-y-1 text-sm",children:[o.jsx("p",{className:"max-w-full leading-normal break-words",children:e}),n?o.jsx("p",{className:"text-xs text-muted-foreground",children:n}):null,s?o.jsx(Vs,{finding:t}):null]})}function so({findings:e}){if(e.length===0)return null;const n=to(e);return o.jsx("section",{className:"space-y-3 rounded-md border p-3",children:n.map(([t,{impactBand:s,finding:r,recs:i}])=>{const a=cn(r.impactEstimate)!==null;return o.jsxs("div",{className:"space-y-1",children:[o.jsx(pe,{type:t,impactBand:s}),[...i.entries()].map(([u,{extended:c}],l)=>o.jsx(no,{rec:u,extended:c,finding:r,showImpactEstimate:l===0&&a},l))]},t)})})}function ro({stage:e,appModel:n}){return hs(e.id,n)?o.jsx(rn,{title:"Query Plan",children:o.jsx(xs,{stageId:e.id,appModel:n})}):null}function oo({stage:e,appModel:n,catalog:t,getTaskData:s}){const{exportMode:r,getTaskData:i}=an(s),[a,u]=w.useState(null),[c,l]=w.useState(!1),[d,p]=w.useState(0),f=(e.taskCount??0)>0,g=t.filter(M=>M.stageId===e.id);w.useEffect(()=>{if(!f||!i)return;let M=!1;return l(!1),i(e.id).catch(()=>null).then(E=>{M||(E?u(E):l(!0))}),()=>{M=!0}},[d]);const h=(e.completedAt??0)-(e.submittedAt??0),m=(e.memoryBytesSpilled??0)>0||(e.diskBytesSpilled??0)>0,S=(e.jvmGCTime??0)>0||(e.gcPct??0)>0,C=e.fetchWaitTime??0,v=C>0&&h>0?Math.round(C/h*100):null,b=(e.inputBytes??0)>0?((e.outputBytes??0)/(e.inputBytes??0)).toFixed(2):null,_=e.localityStats??[];return o.jsxs("div",{className:"space-y-6",children:[o.jsx(so,{findings:g}),o.jsx(re,{title:"Overview",collapsible:!0,defaultOpen:!0,rows:[["Duration",I(h)],["Submitted",Ht(e.submittedAt)],["Completed",Ht(e.completedAt)],e.sqlExecutionId!=null&&["SQL Execution",`#${e.sqlExecutionId}`],e.stageType?["Stage type",e.stageType]:!1]}),o.jsx(re,{title:"Tasks",collapsible:!0,rows:[["Total",String(e.taskCount)],["Failed",String(e.failedTasks)],["P50 duration",(e.taskDurationP50??0)>0?I(e.taskDurationP50):"—"],["P95 duration",(e.taskDurationP95??0)>0?I(e.taskDurationP95):"—"],["Max duration",(e.taskDurationMax??0)>0?I(e.taskDurationMax):"—"],(e.peakExecutionMemoryMax??0)>0&&["Peak execution memory",K(e.peakExecutionMemoryMax)]],children:f?r?o.jsx("p",{className:"text-xs text-muted-foreground",children:"Per-task duration data isn’t included in exported reports."}):a?o.jsx(Is,{metrics:a.metrics,fieldNames:a.fieldNames,markers:{p50:e.taskDurationP50,p95:e.taskDurationP95}}):c?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Couldn’t load task data for this stage."}),o.jsx($e,{type:"button",variant:"ghost",size:"sm",onClick:()=>p(M=>M+1),children:"Retry"})]}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading task data…"}):null}),o.jsx(re,{title:"Locality",collapsible:!0,rows:[],children:_.length>0?o.jsx(eo,{stats:_}):null}),o.jsx(re,{title:"I/O",collapsible:!0,rows:[["Input",K(e.inputBytes)],["Output",K(e.outputBytes)],["Shuffle read",K(e.shuffleReadBytes)],["Shuffle write",K(e.shuffleWriteBytes)],C>0&&["Fetch wait",`${I(C)}${v!=null?` (${v}%)`:""}`],b!=null&&["I/O ratio",b]]}),m?o.jsx(re,{title:"Spill",collapsible:!0,rows:[["Memory spilled",K(e.memoryBytesSpilled)],["Disk spilled",K(e.diskBytesSpilled)],(e.memoryBytesSpilled??0)>0&&["Classification",e.spillClassification??"unclassified"]]}):null,S?o.jsx(re,{title:"GC",collapsible:!0,rows:[["JVM GC time",I(e.jvmGCTime)],["Executor run time",I(e.executorRunTime)],["GC %",`${(e.gcPct??0).toFixed(1)}%`]]}):null,e.details?o.jsx(H,{children:o.jsx(rn,{title:"Call Stack",children:o.jsx("pre",{className:"overflow-x-auto rounded-md bg-muted p-2 text-xs whitespace-pre-wrap",children:e.details})})}):null,o.jsx(ro,{stage:e,appModel:n})]})}function io({appModel:e,catalog:n,getTaskData:t}){const{stageId:s,close:r}=gt(),i=s!=null?e.stages.get(s):void 0,a=i!=null;return o.jsx(gs,{open:a,onOpenChange:u=>{u||r()},children:o.jsx(fs,{className:"max-h-[85vh] overflow-y-auto sm:max-w-4xl",children:i?o.jsxs(o.Fragment,{children:[o.jsx(ms,{children:o.jsxs(ps,{children:["Stage ",i.id," ",o.jsxs("span",{className:"text-muted-foreground",children:["— ",i.name??""]})]})}),o.jsx(oo,{stage:i,appModel:e,catalog:n,getTaskData:t},i.id)]}):null})})}function Y(e,n){return typeof e=="function"?e(n):e}function L(e,n){return t=>{n.setState(s=>({...s,[e]:Y(t,s[e])}))}}function Ee(e){return e instanceof Function}function ao(e){return Array.isArray(e)&&e.every(n=>typeof n=="number")}function lo(e,n){const t=[],s=r=>{r.forEach(i=>{t.push(i);const a=n(i);a!=null&&a.length&&s(a)})};return s(e),t}function y(e,n,t){let s=[],r;return i=>{let a;t.key&&t.debug&&(a=Date.now());const u=e(i);if(!(u.length!==s.length||u.some((d,p)=>s[p]!==d)))return r;s=u;let l;if(t.key&&t.debug&&(l=Date.now()),r=n(...u),t==null||t.onChange==null||t.onChange(r),t.key&&t.debug&&t!=null&&t.debug()){const d=Math.round((Date.now()-a)*100)/100,p=Math.round((Date.now()-l)*100)/100,f=p/16,g=(h,m)=>{for(h=String(h);h.length<m;)h=" "+h;return h};console.info(`%c⏱ ${g(p,5)} /${g(d,5)} ms`,`
|
|
2
|
-
font-size: .6rem;
|
|
3
|
-
font-weight: bold;
|
|
4
|
-
color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,t?.key)}return r}}function j(e,n,t,s){return{debug:()=>{var r;return(r=e?.debugAll)!=null?r:e[n]},key:!1,onChange:s}}function uo(e,n,t,s){const r=()=>{var a;return(a=i.getValue())!=null?a:e.options.renderFallbackValue},i={id:`${n.id}_${t.id}`,row:n,column:t,getValue:()=>n.getValue(s),renderValue:r,getContext:y(()=>[e,t,n,i],(a,u,c,l)=>({table:a,column:u,row:c,cell:l,getValue:l.getValue,renderValue:l.renderValue}),j(e.options,"debugCells"))};return e._features.forEach(a=>{a.createCell==null||a.createCell(i,t,n,e)},{}),i}function co(e,n,t,s){var r,i;const u={...e._getDefaultColumnDef(),...n},c=u.accessorKey;let l=(r=(i=u.id)!=null?i:c?typeof String.prototype.replaceAll=="function"?c.replaceAll(".","_"):c.replace(/\./g,"_"):void 0)!=null?r:typeof u.header=="string"?u.header:void 0,d;if(u.accessorFn?d=u.accessorFn:c&&(c.includes(".")?d=f=>{let g=f;for(const m of c.split(".")){var h;g=(h=g)==null?void 0:h[m]}return g}:d=f=>f[u.accessorKey]),!l)throw new Error;let p={id:`${String(l)}`,accessorFn:d,parent:s,depth:t,columnDef:u,columns:[],getFlatColumns:y(()=>[!0],()=>{var f;return[p,...(f=p.columns)==null?void 0:f.flatMap(g=>g.getFlatColumns())]},j(e.options,"debugColumns")),getLeafColumns:y(()=>[e._getOrderColumnsFn()],f=>{var g;if((g=p.columns)!=null&&g.length){let h=p.columns.flatMap(m=>m.getLeafColumns());return f(h)}return[p]},j(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(p,e);return p}const A="debugHeaders";function zt(e,n,t){var s;let i={id:(s=t.id)!=null?s:n.id,column:n,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const a=[],u=c=>{c.subHeaders&&c.subHeaders.length&&c.subHeaders.map(u),a.push(c)};return u(i),a},getContext:()=>({table:e,header:i,column:n})};return e._features.forEach(a=>{a.createHeader==null||a.createHeader(i,e)}),i}const go={createTable:e=>{e.getHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s,r)=>{var i,a;const u=(i=s?.map(p=>t.find(f=>f.id===p)).filter(Boolean))!=null?i:[],c=(a=r?.map(p=>t.find(f=>f.id===p)).filter(Boolean))!=null?a:[],l=t.filter(p=>!(s!=null&&s.includes(p.id))&&!(r!=null&&r.includes(p.id)));return ke(n,[...u,...l,...c],e)},j(e.options,A)),e.getCenterHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s,r)=>(t=t.filter(i=>!(s!=null&&s.includes(i.id))&&!(r!=null&&r.includes(i.id))),ke(n,t,e,"center")),j(e.options,A)),e.getLeftHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(n,t,s)=>{var r;const i=(r=s?.map(a=>t.find(u=>u.id===a)).filter(Boolean))!=null?r:[];return ke(n,i,e,"left")},j(e.options,A)),e.getRightHeaderGroups=y(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(n,t,s)=>{var r;const i=(r=s?.map(a=>t.find(u=>u.id===a)).filter(Boolean))!=null?r:[];return ke(n,i,e,"right")},j(e.options,A)),e.getFooterGroups=y(()=>[e.getHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getLeftFooterGroups=y(()=>[e.getLeftHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getCenterFooterGroups=y(()=>[e.getCenterHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getRightFooterGroups=y(()=>[e.getRightHeaderGroups()],n=>[...n].reverse(),j(e.options,A)),e.getFlatHeaders=y(()=>[e.getHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getLeftFlatHeaders=y(()=>[e.getLeftHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getCenterFlatHeaders=y(()=>[e.getCenterHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getRightFlatHeaders=y(()=>[e.getRightHeaderGroups()],n=>n.map(t=>t.headers).flat(),j(e.options,A)),e.getCenterLeafHeaders=y(()=>[e.getCenterFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),j(e.options,A)),e.getLeftLeafHeaders=y(()=>[e.getLeftFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),j(e.options,A)),e.getRightLeafHeaders=y(()=>[e.getRightFlatHeaders()],n=>n.filter(t=>{var s;return!((s=t.subHeaders)!=null&&s.length)}),j(e.options,A)),e.getLeafHeaders=y(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(n,t,s)=>{var r,i,a,u,c,l;return[...(r=(i=n[0])==null?void 0:i.headers)!=null?r:[],...(a=(u=t[0])==null?void 0:u.headers)!=null?a:[],...(c=(l=s[0])==null?void 0:l.headers)!=null?c:[]].map(d=>d.getLeafHeaders()).flat()},j(e.options,A))}};function ke(e,n,t,s){var r,i;let a=0;const u=function(f,g){g===void 0&&(g=1),a=Math.max(a,g),f.filter(h=>h.getIsVisible()).forEach(h=>{var m;(m=h.columns)!=null&&m.length&&u(h.columns,g+1)},0)};u(e);let c=[];const l=(f,g)=>{const h={depth:g,id:[s,`${g}`].filter(Boolean).join("_"),headers:[]},m=[];f.forEach(S=>{const C=[...m].reverse()[0],v=S.column.depth===h.depth;let b,_=!1;if(v&&S.column.parent?b=S.column.parent:(b=S.column,_=!0),C&&C?.column===b)C.subHeaders.push(S);else{const M=zt(t,b,{id:[s,g,b.id,S?.id].filter(Boolean).join("_"),isPlaceholder:_,placeholderId:_?`${m.filter(E=>E.column===b).length}`:void 0,depth:g,index:m.length});M.subHeaders.push(S),m.push(M)}h.headers.push(S),S.headerGroup=h}),c.push(h),g>0&&l(m,g-1)},d=n.map((f,g)=>zt(t,f,{depth:a,index:g}));l(d,a-1),c.reverse();const p=f=>f.filter(h=>h.column.getIsVisible()).map(h=>{let m=0,S=0,C=[0];h.subHeaders&&h.subHeaders.length?(C=[],p(h.subHeaders).forEach(b=>{let{colSpan:_,rowSpan:M}=b;m+=_,C.push(M)})):m=1;const v=Math.min(...C);return S=S+v,h.colSpan=m,h.rowSpan=S,{colSpan:m,rowSpan:S}});return p((r=(i=c[0])==null?void 0:i.headers)!=null?r:[]),c}const fo=(e,n,t,s,r,i,a)=>{let u={id:n,index:s,original:t,depth:r,parentId:a,_valuesCache:{},_uniqueValuesCache:{},getValue:c=>{if(u._valuesCache.hasOwnProperty(c))return u._valuesCache[c];const l=e.getColumn(c);if(l!=null&&l.accessorFn)return u._valuesCache[c]=l.accessorFn(u.original,s),u._valuesCache[c]},getUniqueValues:c=>{if(u._uniqueValuesCache.hasOwnProperty(c))return u._uniqueValuesCache[c];const l=e.getColumn(c);if(l!=null&&l.accessorFn)return l.columnDef.getUniqueValues?(u._uniqueValuesCache[c]=l.columnDef.getUniqueValues(u.original,s),u._uniqueValuesCache[c]):(u._uniqueValuesCache[c]=[u.getValue(c)],u._uniqueValuesCache[c])},renderValue:c=>{var l;return(l=u.getValue(c))!=null?l:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>lo(u.subRows,c=>c.subRows),getParentRow:()=>u.parentId?e.getRow(u.parentId,!0):void 0,getParentRows:()=>{let c=[],l=u;for(;;){const d=l.getParentRow();if(!d)break;c.push(d),l=d}return c.reverse()},getAllCells:y(()=>[e.getAllLeafColumns()],c=>c.map(l=>uo(e,u,l,l.id)),j(e.options,"debugRows")),_getAllCellsByColumnId:y(()=>[u.getAllCells()],c=>c.reduce((l,d)=>(l[d.column.id]=d,l),{}),j(e.options,"debugRows"))};for(let c=0;c<e._features.length;c++){const l=e._features[c];l==null||l.createRow==null||l.createRow(u,e)}return u},mo={createColumn:(e,n)=>{e._getFacetedRowModel=n.options.getFacetedRowModel&&n.options.getFacetedRowModel(n,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():n.getPreFilteredRowModel(),e._getFacetedUniqueValues=n.options.getFacetedUniqueValues&&n.options.getFacetedUniqueValues(n,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=n.options.getFacetedMinMaxValues&&n.options.getFacetedMinMaxValues(n,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},Sn=(e,n,t)=>{var s,r;const i=t==null||(s=t.toString())==null?void 0:s.toLowerCase();return!!(!((r=e.getValue(n))==null||(r=r.toString())==null||(r=r.toLowerCase())==null)&&r.includes(i))};Sn.autoRemove=e=>q(e);const Cn=(e,n,t)=>{var s;return!!(!((s=e.getValue(n))==null||(s=s.toString())==null)&&s.includes(t))};Cn.autoRemove=e=>q(e);const yn=(e,n,t)=>{var s;return((s=e.getValue(n))==null||(s=s.toString())==null?void 0:s.toLowerCase())===t?.toLowerCase()};yn.autoRemove=e=>q(e);const jn=(e,n,t)=>{var s;return(s=e.getValue(n))==null?void 0:s.includes(t)};jn.autoRemove=e=>q(e);const Rn=(e,n,t)=>!t.some(s=>{var r;return!((r=e.getValue(n))!=null&&r.includes(s))});Rn.autoRemove=e=>q(e)||!(e!=null&&e.length);const bn=(e,n,t)=>t.some(s=>{var r;return(r=e.getValue(n))==null?void 0:r.includes(s)});bn.autoRemove=e=>q(e)||!(e!=null&&e.length);const kn=(e,n,t)=>e.getValue(n)===t;kn.autoRemove=e=>q(e);const Fn=(e,n,t)=>e.getValue(n)==t;Fn.autoRemove=e=>q(e);const wt=(e,n,t)=>{let[s,r]=t;const i=e.getValue(n);return i>=s&&i<=r};wt.resolveFilterValue=e=>{let[n,t]=e,s=typeof n!="number"?parseFloat(n):n,r=typeof t!="number"?parseFloat(t):t,i=n===null||Number.isNaN(s)?-1/0:s,a=t===null||Number.isNaN(r)?1/0:r;if(i>a){const u=i;i=a,a=u}return[i,a]};wt.autoRemove=e=>q(e)||q(e[0])&&q(e[1]);const X={includesString:Sn,includesStringSensitive:Cn,equalsString:yn,arrIncludes:jn,arrIncludesAll:Rn,arrIncludesSome:bn,equals:kn,weakEquals:Fn,inNumberRange:wt};function q(e){return e==null||e===""}const po={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:L("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,n)=>{e.getAutoFilterFn=()=>{const t=n.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);return typeof s=="string"?X.includesString:typeof s=="number"?X.inNumberRange:typeof s=="boolean"||s!==null&&typeof s=="object"?X.equals:Array.isArray(s)?X.arrIncludes:X.weakEquals},e.getFilterFn=()=>{var t,s;return Ee(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(s=n.options.filterFns)==null?void 0:s[e.columnDef.filterFn])!=null?t:X[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,s,r;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((s=n.options.enableColumnFilters)!=null?s:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=n.getState().columnFilters)==null||(t=t.find(s=>s.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,s;return(t=(s=n.getState().columnFilters)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?t:-1},e.setFilterValue=t=>{n.setColumnFilters(s=>{const r=e.getFilterFn(),i=s?.find(d=>d.id===e.id),a=Y(t,i?i.value:void 0);if(Ot(r,a,e)){var u;return(u=s?.filter(d=>d.id!==e.id))!=null?u:[]}const c={id:e.id,value:a};if(i){var l;return(l=s?.map(d=>d.id===e.id?c:d))!=null?l:[]}return s!=null&&s.length?[...s,c]:[c]})}},createRow:(e,n)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=n=>{const t=e.getAllLeafColumns(),s=r=>{var i;return(i=Y(n,r))==null?void 0:i.filter(a=>{const u=t.find(c=>c.id===a.id);if(u){const c=u.getFilterFn();if(Ot(c,a.value,u))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(s)},e.resetColumnFilters=n=>{var t,s;e.setColumnFilters(n?[]:(t=(s=e.initialState)==null?void 0:s.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Ot(e,n,t){return(e&&e.autoRemove?e.autoRemove(n,t):!1)||typeof n>"u"||typeof n=="string"&&!n}const ho=(e,n,t)=>t.reduce((s,r)=>{const i=r.getValue(e);return s+(typeof i=="number"?i:0)},0),xo=(e,n,t)=>{let s;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(s>i||s===void 0&&i>=i)&&(s=i)}),s},vo=(e,n,t)=>{let s;return t.forEach(r=>{const i=r.getValue(e);i!=null&&(s<i||s===void 0&&i>=i)&&(s=i)}),s},wo=(e,n,t)=>{let s,r;return t.forEach(i=>{const a=i.getValue(e);a!=null&&(s===void 0?a>=a&&(s=r=a):(s>a&&(s=a),r<a&&(r=a)))}),[s,r]},So=(e,n)=>{let t=0,s=0;if(n.forEach(r=>{let i=r.getValue(e);i!=null&&(i=+i)>=i&&(++t,s+=i)}),t)return s/t},Co=(e,n)=>{if(!n.length)return;const t=n.map(i=>i.getValue(e));if(!ao(t))return;if(t.length===1)return t[0];const s=Math.floor(t.length/2),r=t.sort((i,a)=>i-a);return t.length%2!==0?r[s]:(r[s-1]+r[s])/2},yo=(e,n)=>Array.from(new Set(n.map(t=>t.getValue(e))).values()),jo=(e,n)=>new Set(n.map(t=>t.getValue(e))).size,Ro=(e,n)=>n.length,He={sum:ho,min:xo,max:vo,extent:wo,mean:So,median:Co,unique:yo,uniqueCount:jo,count:Ro},bo={getDefaultColumnDef:()=>({aggregatedCell:e=>{var n,t;return(n=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?n:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:L("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,n)=>{e.toggleGrouping=()=>{n.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(s=>s!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,s;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((s=n.options.enableGrouping)!=null?s:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=n.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=n.getCoreRowModel().flatRows[0],s=t?.getValue(e.id);if(typeof s=="number")return He.sum;if(Object.prototype.toString.call(s)==="[object Date]")return He.extent},e.getAggregationFn=()=>{var t,s;if(!e)throw new Error;return Ee(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(s=n.options.aggregationFns)==null?void 0:s[e.columnDef.aggregationFn])!=null?t:He[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=n=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(n),e.resetGrouping=n=>{var t,s;e.setGrouping(n?[]:(t=(s=e.initialState)==null?void 0:s.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,n)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const s=n.getColumn(t);return s!=null&&s.columnDef.getGroupingValue?(e._groupingValuesCache[t]=s.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,n,t,s)=>{e.getIsGrouped=()=>n.getIsGrouped()&&n.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&n.getIsGrouped(),e.getIsAggregated=()=>{var r;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((r=t.subRows)!=null&&r.length)}}};function ko(e,n,t){if(!(n!=null&&n.length)||!t)return e;const s=e.filter(i=>!n.includes(i.id));return t==="remove"?s:[...n.map(i=>e.find(a=>a.id===i)).filter(Boolean),...s]}const Fo={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:L("columnOrder",e)}),createColumn:(e,n)=>{e.getIndex=y(t=>[me(n,t)],t=>t.findIndex(s=>s.id===e.id),j(n.options,"debugColumns")),e.getIsFirstColumn=t=>{var s;return((s=me(n,t)[0])==null?void 0:s.id)===e.id},e.getIsLastColumn=t=>{var s;const r=me(n,t);return((s=r[r.length-1])==null?void 0:s.id)===e.id}},createTable:e=>{e.setColumnOrder=n=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(n),e.resetColumnOrder=n=>{var t;e.setColumnOrder(n?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=y(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(n,t,s)=>r=>{let i=[];if(!(n!=null&&n.length))i=r;else{const a=[...n],u=[...r];for(;u.length&&a.length;){const c=a.shift(),l=u.findIndex(d=>d.id===c);l>-1&&i.push(u.splice(l,1)[0])}i=[...i,...u]}return ko(i,t,s)},j(e.options,"debugTable"))}},ze=()=>({left:[],right:[]}),Io={getInitialState:e=>({columnPinning:ze(),...e}),getDefaultOptions:e=>({onColumnPinningChange:L("columnPinning",e)}),createColumn:(e,n)=>{e.pin=t=>{const s=e.getLeafColumns().map(r=>r.id).filter(Boolean);n.setColumnPinning(r=>{var i,a;if(t==="right"){var u,c;return{left:((u=r?.left)!=null?u:[]).filter(p=>!(s!=null&&s.includes(p))),right:[...((c=r?.right)!=null?c:[]).filter(p=>!(s!=null&&s.includes(p))),...s]}}if(t==="left"){var l,d;return{left:[...((l=r?.left)!=null?l:[]).filter(p=>!(s!=null&&s.includes(p))),...s],right:((d=r?.right)!=null?d:[]).filter(p=>!(s!=null&&s.includes(p)))}}return{left:((i=r?.left)!=null?i:[]).filter(p=>!(s!=null&&s.includes(p))),right:((a=r?.right)!=null?a:[]).filter(p=>!(s!=null&&s.includes(p)))}})},e.getCanPin=()=>e.getLeafColumns().some(s=>{var r,i,a;return((r=s.columnDef.enablePinning)!=null?r:!0)&&((i=(a=n.options.enableColumnPinning)!=null?a:n.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(u=>u.id),{left:s,right:r}=n.getState().columnPinning,i=t.some(u=>s?.includes(u)),a=t.some(u=>r?.includes(u));return i?"left":a?"right":!1},e.getPinnedIndex=()=>{var t,s;const r=e.getIsPinned();return r?(t=(s=n.getState().columnPinning)==null||(s=s[r])==null?void 0:s.indexOf(e.id))!=null?t:-1:0}},createRow:(e,n)=>{e.getCenterVisibleCells=y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left,n.getState().columnPinning.right],(t,s,r)=>{const i=[...s??[],...r??[]];return t.filter(a=>!i.includes(a.column.id))},j(n.options,"debugRows")),e.getLeftVisibleCells=y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.left],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),j(n.options,"debugRows")),e.getRightVisibleCells=y(()=>[e._getAllVisibleCells(),n.getState().columnPinning.right],(t,s)=>(s??[]).map(i=>t.find(a=>a.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),j(n.options,"debugRows"))},createTable:e=>{e.setColumnPinning=n=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(n),e.resetColumnPinning=n=>{var t,s;return e.setColumnPinning(n?ze():(t=(s=e.initialState)==null?void 0:s.columnPinning)!=null?t:ze())},e.getIsSomeColumnsPinned=n=>{var t;const s=e.getState().columnPinning;if(!n){var r,i;return!!((r=s.left)!=null&&r.length||(i=s.right)!=null&&i.length)}return!!((t=s[n])!=null&&t.length)},e.getLeftLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(n,t)=>(t??[]).map(s=>n.find(r=>r.id===s)).filter(Boolean),j(e.options,"debugColumns")),e.getRightLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(n,t)=>(t??[]).map(s=>n.find(r=>r.id===s)).filter(Boolean),j(e.options,"debugColumns")),e.getCenterLeafColumns=y(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(n,t,s)=>{const r=[...t??[],...s??[]];return n.filter(i=>!r.includes(i.id))},j(e.options,"debugColumns"))}};function $o(e){return e||(typeof document<"u"?document:null)}const Fe={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Oe=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),_o={getDefaultColumnDef:()=>Fe,getInitialState:e=>({columnSizing:{},columnSizingInfo:Oe(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:L("columnSizing",e),onColumnSizingInfoChange:L("columnSizingInfo",e)}),createColumn:(e,n)=>{e.getSize=()=>{var t,s,r;const i=n.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:Fe.minSize,(s=i??e.columnDef.size)!=null?s:Fe.size),(r=e.columnDef.maxSize)!=null?r:Fe.maxSize)},e.getStart=y(t=>[t,me(n,t),n.getState().columnSizing],(t,s)=>s.slice(0,e.getIndex(t)).reduce((r,i)=>r+i.getSize(),0),j(n.options,"debugColumns")),e.getAfter=y(t=>[t,me(n,t),n.getState().columnSizing],(t,s)=>s.slice(e.getIndex(t)+1).reduce((r,i)=>r+i.getSize(),0),j(n.options,"debugColumns")),e.resetSize=()=>{n.setColumnSizing(t=>{let{[e.id]:s,...r}=t;return r})},e.getCanResize=()=>{var t,s;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((s=n.options.enableColumnResizing)!=null?s:!0)},e.getIsResizing=()=>n.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,n)=>{e.getSize=()=>{let t=0;const s=r=>{if(r.subHeaders.length)r.subHeaders.forEach(s);else{var i;t+=(i=r.column.getSize())!=null?i:0}};return s(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const s=n.getColumn(e.column.id),r=s?.getCanResize();return i=>{if(!s||!r||(i.persist==null||i.persist(),Ge(i)&&i.touches&&i.touches.length>1))return;const a=e.getSize(),u=e?e.getLeafHeaders().map(C=>[C.column.id,C.column.getSize()]):[[s.id,s.getSize()]],c=Ge(i)?Math.round(i.touches[0].clientX):i.clientX,l={},d=(C,v)=>{typeof v=="number"&&(n.setColumnSizingInfo(b=>{var _,M;const E=n.options.columnResizeDirection==="rtl"?-1:1,U=(v-((_=b?.startOffset)!=null?_:0))*E,x=Math.max(U/((M=b?.startSize)!=null?M:0),-.999999);return b.columnSizingStart.forEach(k=>{let[F,O]=k;l[F]=Math.round(Math.max(O+O*x,0)*100)/100}),{...b,deltaOffset:U,deltaPercentage:x}}),(n.options.columnResizeMode==="onChange"||C==="end")&&n.setColumnSizing(b=>({...b,...l})))},p=C=>d("move",C),f=C=>{d("end",C),n.setColumnSizingInfo(v=>({...v,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g=$o(t),h={moveHandler:C=>p(C.clientX),upHandler:C=>{g?.removeEventListener("mousemove",h.moveHandler),g?.removeEventListener("mouseup",h.upHandler),f(C.clientX)}},m={moveHandler:C=>(C.cancelable&&(C.preventDefault(),C.stopPropagation()),p(C.touches[0].clientX),!1),upHandler:C=>{var v;g?.removeEventListener("touchmove",m.moveHandler),g?.removeEventListener("touchend",m.upHandler),C.cancelable&&(C.preventDefault(),C.stopPropagation()),f((v=C.touches[0])==null?void 0:v.clientX)}},S=Mo()?{passive:!1}:!1;Ge(i)?(g?.addEventListener("touchmove",m.moveHandler,S),g?.addEventListener("touchend",m.upHandler,S)):(g?.addEventListener("mousemove",h.moveHandler,S),g?.addEventListener("mouseup",h.upHandler,S)),n.setColumnSizingInfo(C=>({...C,startOffset:c,startSize:a,deltaOffset:0,deltaPercentage:0,columnSizingStart:u,isResizingColumn:s.id}))}}},createTable:e=>{e.setColumnSizing=n=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(n),e.setColumnSizingInfo=n=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(n),e.resetColumnSizing=n=>{var t;e.setColumnSizing(n?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=n=>{var t;e.setColumnSizingInfo(n?Oe():(t=e.initialState.columnSizingInfo)!=null?t:Oe())},e.getTotalSize=()=>{var n,t;return(n=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0},e.getLeftTotalSize=()=>{var n,t;return(n=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0},e.getCenterTotalSize=()=>{var n,t;return(n=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0},e.getRightTotalSize=()=>{var n,t;return(n=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((s,r)=>s+r.getSize(),0))!=null?n:0}}};let Ie=null;function Mo(){if(typeof Ie=="boolean")return Ie;let e=!1;try{const n={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,n),window.removeEventListener("test",t)}catch{e=!1}return Ie=e,Ie}function Ge(e){return e.type==="touchstart"}const Po={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:L("columnVisibility",e)}),createColumn:(e,n)=>{e.toggleVisibility=t=>{e.getCanHide()&&n.setColumnVisibility(s=>({...s,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,s;const r=e.columns;return(t=r.length?r.some(i=>i.getIsVisible()):(s=n.getState().columnVisibility)==null?void 0:s[e.id])!=null?t:!0},e.getCanHide=()=>{var t,s;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((s=n.options.enableHiding)!=null?s:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,n)=>{e._getAllVisibleCells=y(()=>[e.getAllCells(),n.getState().columnVisibility],t=>t.filter(s=>s.column.getIsVisible()),j(n.options,"debugRows")),e.getVisibleCells=y(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,s,r)=>[...t,...s,...r],j(n.options,"debugRows"))},createTable:e=>{const n=(t,s)=>y(()=>[s(),s().filter(r=>r.getIsVisible()).map(r=>r.id).join("_")],r=>r.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),j(e.options,"debugColumns"));e.getVisibleFlatColumns=n("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=n("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=n("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=n("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=n("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var s;e.setColumnVisibility(t?{}:(s=e.initialState.columnVisibility)!=null?s:{})},e.toggleAllColumnsVisible=t=>{var s;t=(s=t)!=null?s:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((r,i)=>({...r,[i.id]:t||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var s;e.toggleAllColumnsVisible((s=t.target)==null?void 0:s.checked)}}};function me(e,n){return n?n==="center"?e.getCenterVisibleLeafColumns():n==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const No={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},Eo={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:L("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:n=>{var t;const s=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[n.id])==null?void 0:t.getValue();return typeof s=="string"||typeof s=="number"}}),createColumn:(e,n)=>{e.getCanGlobalFilter=()=>{var t,s,r,i;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((s=n.options.enableGlobalFilter)!=null?s:!0)&&((r=n.options.enableFilters)!=null?r:!0)&&((i=n.options.getColumnCanGlobalFilter==null?void 0:n.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>X.includesString,e.getGlobalFilterFn=()=>{var n,t;const{globalFilterFn:s}=e.options;return Ee(s)?s:s==="auto"?e.getGlobalAutoFilterFn():(n=(t=e.options.filterFns)==null?void 0:t[s])!=null?n:X[s]},e.setGlobalFilter=n=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(n)},e.resetGlobalFilter=n=>{e.setGlobalFilter(n?void 0:e.initialState.globalFilter)}}},To={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:L("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let n=!1,t=!1;e._autoResetExpanded=()=>{var s,r;if(!n){e._queue(()=>{n=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetExpanded)!=null?s:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=s=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(s),e.toggleAllRowsExpanded=s=>{s??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=s=>{var r,i;e.setExpanded(s?{}:(r=(i=e.initialState)==null?void 0:i.expanded)!=null?r:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(s=>s.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>s=>{s.persist==null||s.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const s=e.getState().expanded;return s===!0||Object.values(s).some(Boolean)},e.getIsAllRowsExpanded=()=>{const s=e.getState().expanded;return typeof s=="boolean"?s===!0:!(!Object.keys(s).length||e.getRowModel().flatRows.some(r=>!r.getIsExpanded()))},e.getExpandedDepth=()=>{let s=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const a=i.split(".");s=Math.max(s,a.length)}),s},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,n)=>{e.toggleExpanded=t=>{n.setExpanded(s=>{var r;const i=s===!0?!0:!!(s!=null&&s[e.id]);let a={};if(s===!0?Object.keys(n.getRowModel().rowsById).forEach(u=>{a[u]=!0}):a=s,t=(r=t)!=null?r:!i,!i&&t)return{...a,[e.id]:!0};if(i&&!t){const{[e.id]:u,...c}=a;return c}return s})},e.getIsExpanded=()=>{var t;const s=n.getState().expanded;return!!((t=n.options.getIsRowExpanded==null?void 0:n.options.getIsRowExpanded(e))!=null?t:s===!0||s?.[e.id])},e.getCanExpand=()=>{var t,s,r;return(t=n.options.getRowCanExpand==null?void 0:n.options.getRowCanExpand(e))!=null?t:((s=n.options.enableExpanding)!=null?s:!0)&&!!((r=e.subRows)!=null&&r.length)},e.getIsAllParentsExpanded=()=>{let t=!0,s=e;for(;t&&s.parentId;)s=n.getRow(s.parentId,!0),t=s.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},Ze=0,et=10,qe=()=>({pageIndex:Ze,pageSize:et}),Ao={getInitialState:e=>({...e,pagination:{...qe(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:L("pagination",e)}),createTable:e=>{let n=!1,t=!1;e._autoResetPageIndex=()=>{var s,r;if(!n){e._queue(()=>{n=!0});return}if((s=(r=e.options.autoResetAll)!=null?r:e.options.autoResetPageIndex)!=null?s:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=s=>{const r=i=>Y(s,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(r)},e.resetPagination=s=>{var r;e.setPagination(s?qe():(r=e.initialState.pagination)!=null?r:qe())},e.setPageIndex=s=>{e.setPagination(r=>{let i=Y(s,r.pageIndex);const a=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,a)),{...r,pageIndex:i}})},e.resetPageIndex=s=>{var r,i;e.setPageIndex(s?Ze:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?r:Ze)},e.resetPageSize=s=>{var r,i;e.setPageSize(s?et:(r=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?r:et)},e.setPageSize=s=>{e.setPagination(r=>{const i=Math.max(1,Y(s,r.pageSize)),a=r.pageSize*r.pageIndex,u=Math.floor(a/i);return{...r,pageIndex:u,pageSize:i}})},e.setPageCount=s=>e.setPagination(r=>{var i;let a=Y(s,(i=e.options.pageCount)!=null?i:-1);return typeof a=="number"&&(a=Math.max(-1,a)),{...r,pageCount:a}}),e.getPageOptions=y(()=>[e.getPageCount()],s=>{let r=[];return s&&s>0&&(r=[...new Array(s)].fill(null).map((i,a)=>a)),r},j(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:s}=e.getState().pagination,r=e.getPageCount();return r===-1?!0:r===0?!1:s<r-1},e.previousPage=()=>e.setPageIndex(s=>s-1),e.nextPage=()=>e.setPageIndex(s=>s+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var s;return(s=e.options.pageCount)!=null?s:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var s;return(s=e.options.rowCount)!=null?s:e.getPrePaginationRowModel().rows.length}}},We=()=>({top:[],bottom:[]}),Do={getInitialState:e=>({rowPinning:We(),...e}),getDefaultOptions:e=>({onRowPinningChange:L("rowPinning",e)}),createRow:(e,n)=>{e.pin=(t,s,r)=>{const i=s?e.getLeafRows().map(c=>{let{id:l}=c;return l}):[],a=r?e.getParentRows().map(c=>{let{id:l}=c;return l}):[],u=new Set([...a,e.id,...i]);n.setRowPinning(c=>{var l,d;if(t==="bottom"){var p,f;return{top:((p=c?.top)!=null?p:[]).filter(m=>!(u!=null&&u.has(m))),bottom:[...((f=c?.bottom)!=null?f:[]).filter(m=>!(u!=null&&u.has(m))),...Array.from(u)]}}if(t==="top"){var g,h;return{top:[...((g=c?.top)!=null?g:[]).filter(m=>!(u!=null&&u.has(m))),...Array.from(u)],bottom:((h=c?.bottom)!=null?h:[]).filter(m=>!(u!=null&&u.has(m)))}}return{top:((l=c?.top)!=null?l:[]).filter(m=>!(u!=null&&u.has(m))),bottom:((d=c?.bottom)!=null?d:[]).filter(m=>!(u!=null&&u.has(m)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:s,enablePinning:r}=n.options;return typeof s=="function"?s(e):(t=s??r)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:s,bottom:r}=n.getState().rowPinning,i=t.some(u=>s?.includes(u)),a=t.some(u=>r?.includes(u));return i?"top":a?"bottom":!1},e.getPinnedIndex=()=>{var t,s;const r=e.getIsPinned();if(!r)return-1;const i=(t=r==="top"?n.getTopRows():n.getBottomRows())==null?void 0:t.map(a=>{let{id:u}=a;return u});return(s=i?.indexOf(e.id))!=null?s:-1}},createTable:e=>{e.setRowPinning=n=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(n),e.resetRowPinning=n=>{var t,s;return e.setRowPinning(n?We():(t=(s=e.initialState)==null?void 0:s.rowPinning)!=null?t:We())},e.getIsSomeRowsPinned=n=>{var t;const s=e.getState().rowPinning;if(!n){var r,i;return!!((r=s.top)!=null&&r.length||(i=s.bottom)!=null&&i.length)}return!!((t=s[n])!=null&&t.length)},e._getPinnedRows=(n,t,s)=>{var r;return((r=e.options.keepPinnedRows)==null||r?(t??[]).map(a=>{const u=e.getRow(a,!0);return u.getIsAllParentsExpanded()?u:null}):(t??[]).map(a=>n.find(u=>u.id===a))).filter(Boolean).map(a=>({...a,position:s}))},e.getTopRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(n,t)=>e._getPinnedRows(n,t,"top"),j(e.options,"debugRows")),e.getBottomRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(n,t)=>e._getPinnedRows(n,t,"bottom"),j(e.options,"debugRows")),e.getCenterRows=y(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(n,t,s)=>{const r=new Set([...t??[],...s??[]]);return n.filter(i=>!r.has(i.id))},j(e.options,"debugRows"))}},Vo={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:L("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=n=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(n),e.resetRowSelection=n=>{var t;return e.setRowSelection(n?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=n=>{e.setRowSelection(t=>{n=typeof n<"u"?n:!e.getIsAllRowsSelected();const s={...t},r=e.getPreGroupedRowModel().flatRows;return n?r.forEach(i=>{i.getCanSelect()&&(s[i.id]=!0)}):r.forEach(i=>{delete s[i.id]}),s})},e.toggleAllPageRowsSelected=n=>e.setRowSelection(t=>{const s=typeof n<"u"?n:!e.getIsAllPageRowsSelected(),r={...t};return e.getRowModel().rows.forEach(i=>{tt(r,i.id,s,!0,e)}),r}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=y(()=>[e.getState().rowSelection,e.getCoreRowModel()],(n,t)=>Object.keys(n).length?Ue(e,t):{rows:[],flatRows:[],rowsById:{}},j(e.options,"debugTable")),e.getFilteredSelectedRowModel=y(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(n,t)=>Object.keys(n).length?Ue(e,t):{rows:[],flatRows:[],rowsById:{}},j(e.options,"debugTable")),e.getGroupedSelectedRowModel=y(()=>[e.getState().rowSelection,e.getSortedRowModel()],(n,t)=>Object.keys(n).length?Ue(e,t):{rows:[],flatRows:[],rowsById:{}},j(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const n=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let s=!!(n.length&&Object.keys(t).length);return s&&n.some(r=>r.getCanSelect()&&!t[r.id])&&(s=!1),s},e.getIsAllPageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows.filter(r=>r.getCanSelect()),{rowSelection:t}=e.getState();let s=!!n.length;return s&&n.some(r=>!t[r.id])&&(s=!1),s},e.getIsSomeRowsSelected=()=>{var n;const t=Object.keys((n=e.getState().rowSelection)!=null?n:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const n=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:n.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>n=>{e.toggleAllRowsSelected(n.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>n=>{e.toggleAllPageRowsSelected(n.target.checked)}},createRow:(e,n)=>{e.toggleSelected=(t,s)=>{const r=e.getIsSelected();n.setRowSelection(i=>{var a;if(t=typeof t<"u"?t:!r,e.getCanSelect()&&r===t)return i;const u={...i};return tt(u,e.id,t,(a=s?.selectChildren)!=null?a:!0,n),u})},e.getIsSelected=()=>{const{rowSelection:t}=n.getState();return St(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=n.getState();return nt(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=n.getState();return nt(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof n.options.enableRowSelection=="function"?n.options.enableRowSelection(e):(t=n.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof n.options.enableSubRowSelection=="function"?n.options.enableSubRowSelection(e):(t=n.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof n.options.enableMultiRowSelection=="function"?n.options.enableMultiRowSelection(e):(t=n.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return s=>{var r;t&&e.toggleSelected((r=s.target)==null?void 0:r.checked)}}}},tt=(e,n,t,s,r)=>{var i;const a=r.getRow(n,!0);t?(a.getCanMultiSelect()||Object.keys(e).forEach(u=>delete e[u]),a.getCanSelect()&&(e[n]=!0)):delete e[n],s&&(i=a.subRows)!=null&&i.length&&a.getCanSelectSubRows()&&a.subRows.forEach(u=>tt(e,u.id,t,s,r))};function Ue(e,n){const t=e.getState().rowSelection,s=[],r={},i=function(a,u){return a.map(c=>{var l;const d=St(c,t);if(d&&(s.push(c),r[c.id]=c),(l=c.subRows)!=null&&l.length&&(c={...c,subRows:i(c.subRows)}),d)return c}).filter(Boolean)};return{rows:i(n.rows),flatRows:s,rowsById:r}}function St(e,n){var t;return(t=n[e.id])!=null?t:!1}function nt(e,n,t){var s;if(!((s=e.subRows)!=null&&s.length))return!1;let r=!0,i=!1;return e.subRows.forEach(a=>{if(!(i&&!r)&&(a.getCanSelect()&&(St(a,n)?i=!0:r=!1),a.subRows&&a.subRows.length)){const u=nt(a,n);u==="all"?i=!0:(u==="some"&&(i=!0),r=!1)}}),r?"all":i?"some":!1}const st=/([0-9]+)/gm,Bo=(e,n,t)=>In(ee(e.getValue(t)).toLowerCase(),ee(n.getValue(t)).toLowerCase()),Lo=(e,n,t)=>In(ee(e.getValue(t)),ee(n.getValue(t))),Ho=(e,n,t)=>Ct(ee(e.getValue(t)).toLowerCase(),ee(n.getValue(t)).toLowerCase()),zo=(e,n,t)=>Ct(ee(e.getValue(t)),ee(n.getValue(t))),Oo=(e,n,t)=>{const s=e.getValue(t),r=n.getValue(t);return s>r?1:s<r?-1:0},Go=(e,n,t)=>Ct(e.getValue(t),n.getValue(t));function Ct(e,n){return e===n?0:e>n?1:-1}function ee(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function In(e,n){const t=e.split(st).filter(Boolean),s=n.split(st).filter(Boolean);for(;t.length&&s.length;){const r=t.shift(),i=s.shift(),a=parseInt(r,10),u=parseInt(i,10),c=[a,u].sort();if(isNaN(c[0])){if(r>i)return 1;if(i>r)return-1;continue}if(isNaN(c[1]))return isNaN(a)?-1:1;if(a>u)return 1;if(u>a)return-1}return t.length-s.length}const ge={alphanumeric:Bo,alphanumericCaseSensitive:Lo,text:Ho,textCaseSensitive:zo,datetime:Oo,basic:Go},qo={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:L("sorting",e),isMultiSortEvent:n=>n.shiftKey}),createColumn:(e,n)=>{e.getAutoSortingFn=()=>{const t=n.getFilteredRowModel().flatRows.slice(10);let s=!1;for(const r of t){const i=r?.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return ge.datetime;if(typeof i=="string"&&(s=!0,i.split(st).length>1))return ge.alphanumeric}return s?ge.text:ge.basic},e.getAutoSortDir=()=>{const t=n.getFilteredRowModel().flatRows[0];return typeof t?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,s;if(!e)throw new Error;return Ee(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(s=n.options.sortingFns)==null?void 0:s[e.columnDef.sortingFn])!=null?t:ge[e.columnDef.sortingFn]},e.toggleSorting=(t,s)=>{const r=e.getNextSortingOrder(),i=typeof t<"u"&&t!==null;n.setSorting(a=>{const u=a?.find(g=>g.id===e.id),c=a?.findIndex(g=>g.id===e.id);let l=[],d,p=i?t:r==="desc";if(a!=null&&a.length&&e.getCanMultiSort()&&s?u?d="toggle":d="add":a!=null&&a.length&&c!==a.length-1?d="replace":u?d="toggle":d="replace",d==="toggle"&&(i||r||(d="remove")),d==="add"){var f;l=[...a,{id:e.id,desc:p}],l.splice(0,l.length-((f=n.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?l=a.map(g=>g.id===e.id?{...g,desc:p}:g):d==="remove"?l=a.filter(g=>g.id!==e.id):l=[{id:e.id,desc:p}];return l})},e.getFirstSortDir=()=>{var t,s;return((t=(s=e.columnDef.sortDescFirst)!=null?s:n.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var s,r;const i=e.getFirstSortDir(),a=e.getIsSorted();return a?a!==i&&((s=n.options.enableSortingRemoval)==null||s)&&(!(t&&(r=n.options.enableMultiRemove)!=null)||r)?!1:a==="desc"?"asc":"desc":i},e.getCanSort=()=>{var t,s;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((s=n.options.enableSorting)!=null?s:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,s;return(t=(s=e.columnDef.enableMultiSort)!=null?s:n.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const s=(t=n.getState().sorting)==null?void 0:t.find(r=>r.id===e.id);return s?s.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,s;return(t=(s=n.getState().sorting)==null?void 0:s.findIndex(r=>r.id===e.id))!=null?t:-1},e.clearSorting=()=>{n.setSorting(t=>t!=null&&t.length?t.filter(s=>s.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return s=>{t&&(s.persist==null||s.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?n.options.isMultiSortEvent==null?void 0:n.options.isMultiSortEvent(s):!1))}}},createTable:e=>{e.setSorting=n=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(n),e.resetSorting=n=>{var t,s;e.setSorting(n?[]:(t=(s=e.initialState)==null?void 0:s.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Wo=[go,Po,Fo,Io,mo,po,No,Eo,qo,bo,To,Ao,Do,Vo,_o];function Uo(e){var n,t;const s=[...Wo,...(n=e._features)!=null?n:[]];let r={_features:s};const i=r._features.reduce((f,g)=>Object.assign(f,g.getDefaultOptions==null?void 0:g.getDefaultOptions(r)),{}),a=f=>r.options.mergeOptions?r.options.mergeOptions(i,f):{...i,...f};let c={...{},...(t=e.initialState)!=null?t:{}};r._features.forEach(f=>{var g;c=(g=f.getInitialState==null?void 0:f.getInitialState(c))!=null?g:c});const l=[];let d=!1;const p={_features:s,options:{...i,...e},initialState:c,_queue:f=>{l.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();d=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{r.setState(r.initialState)},setOptions:f=>{const g=Y(f,r.options);r.options=a(g)},getState:()=>r.options.state,setState:f=>{r.options.onStateChange==null||r.options.onStateChange(f)},_getRowId:(f,g,h)=>{var m;return(m=r.options.getRowId==null?void 0:r.options.getRowId(f,g,h))!=null?m:`${h?[h.id,g].join("."):g}`},getCoreRowModel:()=>(r._getCoreRowModel||(r._getCoreRowModel=r.options.getCoreRowModel(r)),r._getCoreRowModel()),getRowModel:()=>r.getPaginationRowModel(),getRow:(f,g)=>{let h=(g?r.getPrePaginationRowModel():r.getRowModel()).rowsById[f];if(!h&&(h=r.getCoreRowModel().rowsById[f],!h))throw new Error;return h},_getDefaultColumnDef:y(()=>[r.options.defaultColumn],f=>{var g;return f=(g=f)!=null?g:{},{header:h=>{const m=h.header.column.columnDef;return m.accessorKey?m.accessorKey:m.accessorFn?m.id:null},cell:h=>{var m,S;return(m=(S=h.renderValue())==null||S.toString==null?void 0:S.toString())!=null?m:null},...r._features.reduce((h,m)=>Object.assign(h,m.getDefaultColumnDef==null?void 0:m.getDefaultColumnDef()),{}),...f}},j(e,"debugColumns")),_getColumnDefs:()=>r.options.columns,getAllColumns:y(()=>[r._getColumnDefs()],f=>{const g=function(h,m,S){return S===void 0&&(S=0),h.map(C=>{const v=co(r,C,S,m),b=C;return v.columns=b.columns?g(b.columns,v,S+1):[],v})};return g(f)},j(e,"debugColumns")),getAllFlatColumns:y(()=>[r.getAllColumns()],f=>f.flatMap(g=>g.getFlatColumns()),j(e,"debugColumns")),_getAllFlatColumnsById:y(()=>[r.getAllFlatColumns()],f=>f.reduce((g,h)=>(g[h.id]=h,g),{}),j(e,"debugColumns")),getAllLeafColumns:y(()=>[r.getAllColumns(),r._getOrderColumnsFn()],(f,g)=>{let h=f.flatMap(m=>m.getLeafColumns());return g(h)},j(e,"debugColumns")),getColumn:f=>r._getAllFlatColumnsById()[f]};Object.assign(r,p);for(let f=0;f<r._features.length;f++){const g=r._features[f];g==null||g.createTable==null||g.createTable(r)}return r}function Ko(){return e=>y(()=>[e.options.data],n=>{const t={rows:[],flatRows:[],rowsById:{}},s=function(r,i,a){i===void 0&&(i=0);const u=[];for(let l=0;l<r.length;l++){const d=fo(e,e._getRowId(r[l],l,a),r[l],l,i,void 0,a?.id);if(t.flatRows.push(d),t.rowsById[d.id]=d,u.push(d),e.options.getSubRows){var c;d.originalSubRows=e.options.getSubRows(r[l],l),(c=d.originalSubRows)!=null&&c.length&&(d.subRows=s(d.originalSubRows,i+1,d))}}return u};return t.rows=s(n),t},j(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function Xo(e){const n=[],t=s=>{var r;n.push(s),(r=s.subRows)!=null&&r.length&&s.getIsExpanded()&&s.subRows.forEach(t)};return e.rows.forEach(t),{rows:n,flatRows:e.flatRows,rowsById:e.rowsById}}function Jo(e){return n=>y(()=>[n.getState().pagination,n.getPrePaginationRowModel(),n.options.paginateExpandedRows?void 0:n.getState().expanded],(t,s)=>{if(!s.rows.length)return s;const{pageSize:r,pageIndex:i}=t;let{rows:a,flatRows:u,rowsById:c}=s;const l=r*i,d=l+r;a=a.slice(l,d);let p;n.options.paginateExpandedRows?p={rows:a,flatRows:u,rowsById:c}:p=Xo({rows:a,flatRows:u,rowsById:c}),p.flatRows=[];const f=g=>{p.flatRows.push(g),g.subRows.length&&g.subRows.forEach(f)};return p.rows.forEach(f),p},j(n.options,"debugTable"))}function Qo(){return e=>y(()=>[e.getState().sorting,e.getPreSortedRowModel()],(n,t)=>{if(!t.rows.length||!(n!=null&&n.length))return t;const s=e.getState().sorting,r=[],i=s.filter(c=>{var l;return(l=e.getColumn(c.id))==null?void 0:l.getCanSort()}),a={};i.forEach(c=>{const l=e.getColumn(c.id);l&&(a[c.id]={sortUndefined:l.columnDef.sortUndefined,invertSorting:l.columnDef.invertSorting,sortingFn:l.getSortingFn()})});const u=c=>{const l=c.map(d=>({...d}));return l.sort((d,p)=>{for(let g=0;g<i.length;g+=1){var f;const h=i[g],m=a[h.id],S=m.sortUndefined,C=(f=h?.desc)!=null?f:!1;let v=0;if(S){const b=d.getValue(h.id),_=p.getValue(h.id),M=b===void 0,E=_===void 0;if(M||E){if(S==="first")return M?-1:1;if(S==="last")return M?1:-1;v=M&&E?0:M?S:-S}}if(v===0&&(v=m.sortingFn(d,p,h.id)),v!==0)return C&&(v*=-1),m.invertSorting&&(v*=-1),v}return d.index-p.index}),l.forEach(d=>{var p;r.push(d),(p=d.subRows)!=null&&p.length&&(d.subRows=u(d.subRows))}),l};return{rows:u(t.rows),flatRows:r,rowsById:t.rowsById}},j(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Gt(e,n){return e?Yo(e)?w.createElement(e,n):e:null}function Yo(e){return Zo(e)||typeof e=="function"||ei(e)}function Zo(e){return typeof e=="function"&&(()=>{const n=Object.getPrototypeOf(e);return n.prototype&&n.prototype.isReactComponent})()}function ei(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function ti(e){const n={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=w.useState(()=>({current:Uo(n)})),[s,r]=w.useState(()=>t.current.initialState);return t.current.setOptions(i=>({...i,...e,state:{...s,...e.state},onStateChange:a=>{r(a),e.onStateChange==null||e.onStateChange(a)}})),t.current}const qt=10,Ke=10,Wt=new Set(["duration","taskCount","shuffleRead","fetchWait","gcPct","skew","spill"]);function ni(e,n){return e.length>n?`${e.slice(0,n)}…`:e}function si(e){return e<=0?o.jsx(o.Fragment,{children:"0"}):o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e," ",o.jsx(he,{label:"RETRY",impactBand:"critical"})]})}function ri(e,n,t){if(e<=0)return o.jsx(o.Fragment,{children:"—"});const s=I(e);if(n<=0)return o.jsx(o.Fragment,{children:s});const r=e/n;return r>.3?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s," ",o.jsx(he,{label:t==="advanced"?`${Math.round(r*100)}%`:"High",impactBand:"critical"})]}):r>.15?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s," ",o.jsx(he,{label:t==="advanced"?`${Math.round(r*100)}%`:"Elevated",impactBand:"info"})]}):o.jsx(o.Fragment,{children:s})}function oi(e,n){if(!e||e<=0)return o.jsx(o.Fragment,{children:"—"});if(!n||n<=0)return o.jsx(o.Fragment,{children:"—"});const t=n/e,s=t<.01?`${t.toExponential(1)}×`:`${t.toFixed(2)}×`;return t>2||t<.1?o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s," ",o.jsx(he,{label:"extreme",impactBand:"info"})]}):o.jsx(o.Fragment,{children:s})}function ii(e,n){if(e<=0)return o.jsx(o.Fragment,{children:"—"});const t=n??"unclassified";return o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[K(e)," ",o.jsx(he,{label:Zn[t],impactBand:"warning",title:Yn[t]})]})}function ai(e,n){return!e||e<=0?0:(n??0)/e}function li(e){const n=new Map;for(const t of e)n.has(t.type)||n.set(t.type,[]),n.get(t.type).push(t);return[...n.values()].map(t=>{const s=Yt(t);return t.find(r=>r.impactBand===s)??t[0]})}function ui({appModel:e,catalog:n,getTaskData:t,onRoute:s}){const{openStage:r}=gt(),i=lt(),[a,u]=w.useState(!1),[c,l]=w.useState(""),[d,p]=w.useState([]),[f,g]=w.useState({pageIndex:0,pageSize:qt}),{catalogByStage:h,flaggedStageIds:m,frequency:S}=w.useMemo(()=>{const x=new Map,k=new Set;for(const F of n)F.stageId!=null&&(k.add(F.stageId),x.has(F.stageId)||x.set(F.stageId,[]),x.get(F.stageId).push(F));return{catalogByStage:x,flaggedStageIds:k,frequency:Xn(n)}},[n]),C=w.useMemo(()=>{const x=[...e.stages.values()],k=a?x.filter($=>m.has($.id)):[...x].sort(($,T)=>(T.completedAt??0)-(T.submittedAt??0)-(($.completedAt??0)-($.submittedAt??0))).slice(0,Ke),F=c.trim().toLowerCase();return(F?k.filter($=>($.name??"").toLowerCase().includes(F)||String($.id).includes(F)):k).map($=>({stage:$,tags:li(h.get($.id)??[]),frequency:S.get($.id)??0}))},[e.stages,a,m,h,S,c]),v=w.useMemo(()=>{if(!s)return null;const x=new Map;for(const k of n){const F=we(k,n);F&&x.set(k,F)}return x},[n,s]),b=w.useMemo(()=>[{id:"id",header:"Stage",accessorFn:x=>x.stage.id,cell:({getValue:x})=>{const k=x();return o.jsx("button",{type:"button","aria-label":`Open Stage ${k} 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:F=>{F.stopPropagation(),r(k)},children:o.jsx("strong",{children:k})})}},{id:"name",header:"Operation",accessorFn:x=>x.stage.name??"",cell:({row:x})=>{const k=x.original.stage.id;return o.jsxs("span",{className:"inline-flex flex-wrap items-center gap-1.5",children:[ni(x.original.stage.name??"",40),x.original.tags.map((F,O)=>{const $=v?v.get(F)??null:null,T=$&&s?{target:$,onRoute:s}:null,je=cn(F.impactEstimate);return o.jsxs("span",{className:"inline-flex items-center gap-1",children:[T?o.jsx("button",{type:"button","aria-label":`Investigate ${T.target.findingLabel} in Stage ${k}`,title:`Investigate ${T.target.findingLabel} in Stage ${k}`,className:"inline-flex cursor-pointer items-center rounded-full hover:underline underline-offset-2 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50",onClick:ne=>{ne.stopPropagation(),T.onRoute(T.target)},onKeyDown:ne=>{(ne.key==="Enter"||ne.key===" ")&&ne.stopPropagation()},children:o.jsx(pe,{type:F.type,impactBand:F.impactBand,plainBadge:!0})}):o.jsx(pe,{type:F.type,impactBand:F.impactBand}),je?o.jsx("span",{className:"text-xs text-muted-foreground",children:je}):null]},O)})]})}},{id:"type",header:"Type",accessorFn:x=>x.stage.stageType??"",cell:({row:x})=>o.jsx(bt,{variant:"outline",children:x.original.stage.stageType??"—"})},{id:"duration",header:"Duration",accessorFn:x=>(x.stage.completedAt??0)-(x.stage.submittedAt??0),cell:({getValue:x})=>o.jsx(o.Fragment,{children:I(x())})},{id:"taskCount",header:"Tasks",accessorFn:x=>x.stage.taskCount},{id:"retried",header:"Retried",accessorFn:x=>x.stage.failedTasks??0,cell:({getValue:x})=>si(x())},{id:"shuffleRead",header:"Shuffle Read",accessorFn:x=>x.stage.shuffleReadBytes??0,cell:({getValue:x})=>o.jsx(o.Fragment,{children:K(x())})},{id:"fetchWait",header:"Fetch Wait",accessorFn:x=>x.stage.fetchWaitTime??0,cell:({row:x})=>ri(x.original.stage.fetchWaitTime??0,x.original.stage.executorRunTime??0,i)},...i==="advanced"?[{id:"ioRatio",header:"I/O Ratio",accessorFn:x=>x.stage.inputBytes?(x.stage.outputBytes??0)/x.stage.inputBytes:0,cell:({row:x})=>oi(x.original.stage.inputBytes??0,x.original.stage.outputBytes??0)}]:[],{id:"spill",header:"Spill (mem)",accessorFn:x=>x.stage.memoryBytesSpilled??0,cell:({row:x})=>ii(x.original.stage.memoryBytesSpilled??0,x.original.stage.spillClassification)},...i==="advanced"?[{id:"gcPct",header:"GC%",accessorFn:x=>x.stage.gcPct??0,cell:({getValue:x})=>o.jsxs(o.Fragment,{children:[x().toFixed(1),"%"]})},{id:"skew",header:"Skew P95/median",accessorFn:x=>ai(x.stage.taskDurationP50,x.stage.taskDurationP95),cell:({getValue:x})=>{const k=x();return o.jsx(o.Fragment,{children:k>0?`${k.toFixed(1)}×`:"—"})}}]:[],{id:"frequency",header:"Flagged",accessorFn:x=>x.frequency,cell:({getValue:x})=>{const k=x();return k<=1?o.jsx(o.Fragment,{children:"—"}):o.jsx(bt,{variant:"outline",children:`Flagged by ${k}`})}}],[n,s,v,r,i]),_=ti({data:C,columns:b,state:{sorting:d,pagination:f},sortDescFirst:!1,onSortingChange:p,onPaginationChange:g,getCoreRowModel:Ko(),getSortedRowModel:Qo(),getPaginationRowModel:Jo()});function M(){u(x=>!x),p([]),g({pageIndex:0,pageSize:qt})}const E=x=>x==="asc"?" ▲":x==="desc"?" ▼":"",U=x=>x==="asc"?"ascending":x==="desc"?"descending":"none";return o.jsx(z,{title:"Stage Summary",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(Qe,{type:"text",value:c,onChange:x=>{l(x.target.value),g(k=>({...k,pageIndex:0}))},placeholder:"Filter by stage name or ID…","aria-label":"Filter by stage name or ID",className:"max-w-xs"}),o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("p",{className:"text-muted-foreground text-xs",children:"Scroll sideways to see all columns →"}),o.jsx($e,{type:"button",variant:"outline",size:"sm",onClick:M,children:a?`Top ${Ke} by duration`:"Problems only"})]}),o.jsxs("p",{className:"sr-only",role:"status","aria-live":"polite",children:["Showing ",C.length," stage",C.length===1?"":"s",": "," ",a?"problems only":`top ${Ke} by duration`,"."]}),o.jsxs(ct,{children:[o.jsx(Jn,{children:_.getHeaderGroups().map(x=>o.jsx(Z,{children:x.headers.map(k=>{const F=k.column.getIsSorted(),O=k.column.getToggleSortingHandler();return o.jsxs(Qn,{scope:"col",tabIndex:k.column.getCanSort()?0:void 0,"aria-sort":U(F),className:D(k.column.getCanSort()&&"tap-target-comfortable cursor-pointer select-none",Wt.has(k.column.id)&&"text-right"),onClick:O,onKeyDown:$=>{O&&($.key==="Enter"||$.key===" ")&&($.preventDefault(),O($))},children:[Gt(k.column.columnDef.header,k.getContext()),E(F)]},k.id)})},x.id))}),o.jsx(dt,{children:_.getRowModel().rows.length===0?o.jsx(Z,{children:o.jsx(B,{colSpan:b.length,className:"text-muted-foreground",children:o.jsxs("span",{className:"flex items-center justify-center gap-2 py-2",children:[o.jsx(dn,{"aria-hidden":"true",className:"size-4 shrink-0"}),"No stages to show."]})})}):_.getRowModel().rows.map(x=>o.jsx(Z,{className:"cursor-pointer",onClick:()=>r(x.original.stage.id),children:x.getVisibleCells().map(k=>o.jsx(B,{className:Wt.has(k.column.id)?"text-right":void 0,children:Gt(k.column.columnDef.cell,k.getContext())},k.id))},x.id))})]}),_.getPageCount()>1?o.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[o.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable",onClick:()=>_.previousPage(),disabled:!_.getCanPreviousPage(),children:"Previous"}),o.jsxs("span",{className:"text-muted-foreground",children:["Page ",f.pageIndex+1," of ",_.getPageCount()]}),o.jsx($e,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable",onClick:()=>_.nextPage(),disabled:!_.getCanNextPage(),children:"Next"})]}):null]})})}const $n=20,Ut=24,Kt=40,ci=200,di=640;function gi(e,n=$n){const t=[...e].filter(i=>i.submittedAt&&i.completedAt),s=t.length;return s<=n?{stages:t.sort((i,a)=>i.submittedAt-a.submittedAt),total:s,capped:!1}:{stages:[...t].sort((i,a)=>a.completedAt-a.submittedAt-(i.completedAt-i.submittedAt)).slice(0,n).sort((i,a)=>i.submittedAt-a.submittedAt),total:s,capped:!0}}function fi({appModel:e,catalog:n}){const{openStage:t}=gt(),s=[...e.stages.values()].filter(v=>v.submittedAt&&v.completedAt),r=s.length,i=s.reduce((v,b)=>Math.min(v,b.submittedAt),1/0),a=e.app?.startTime??(Number.isFinite(i)?i:0),u=new Set(n.filter(v=>v.stageId!=null).map(v=>v.stageId)),c=lt(),[l,d]=w.useState(()=>c==="advanced"?r:$n),{stages:p}=gi(s,l),g=Me(p).map(v=>({stageId:v.id,label:`Stage ${v.id}`,wait:v.submittedAt-a,duration:v.completedAt-v.submittedAt,flagged:u.has(v.id)})),h=Math.min(di,Math.max(ci,g.length*Ut+Kt)),m=h-Kt,S=Math.max(1,Math.floor(m/Ut)),C=Math.max(1,Math.ceil(g.length/S));return o.jsx(z,{title:"Job Timeline",summary:r>0?o.jsx(te,{value:`${r} stage${r===1?"":"s"}`,context:`${u.size} flagged`}):void 0,children:r===0?o.jsx(mt,{tone:"neutral",icon:dn,title:"No stages in this run."}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"mb-2 flex items-center gap-2 text-xs text-muted-foreground",children:[o.jsx("label",{htmlFor:"timeline-topn",children:"showing top"}),o.jsx("input",{id:"timeline-topn",type:"number",min:1,max:r,value:Math.min(l,r),onChange:v=>{let b=parseInt(v.target.value,10);Number.isFinite(b)||(b=l),d(Math.max(1,Math.min(r,b)))},className:"w-16 rounded border border-input bg-transparent px-1 py-0.5","aria-label":"Number of stages to show"}),o.jsxs("span",{children:["of ",r," by duration · flagged in red"]})]}),o.jsx(ae,{ariaLabel:"Job timeline: stage durations by time from app start.",height:h,table:{caption:"Job timeline: stage durations by time from app start",columns:["Stage","Start","Duration"],rows:g.map(v=>[v.label,I(v.wait),I(v.duration)]),align:["left","right","right"]},children:o.jsxs(Pe,{data:g,layout:"vertical",children:[o.jsx(Ce,{stroke:N.muted,strokeOpacity:.2,horizontal:!1}),o.jsx(le,{type:"number",tickFormatter:v=>`${Math.round(v/1e3)}s`,tick:{fontSize:10},tickCount:10}),o.jsx(ue,{type:"category",dataKey:"label",tick:{fontSize:10},width:64,interval:0,tickFormatter:(v,b)=>b%C===0?v:""}),o.jsx(ye,{formatter:(v,b)=>b==="Duration"?I(Number(v)):[null,null]}),o.jsx(ve,{dataKey:"wait",stackId:"timeline",fill:"transparent",name:"Wait"}),o.jsx(ve,{dataKey:"duration",stackId:"timeline",name:"Duration",cursor:"pointer",onClick:v=>t(v.payload.stageId),children:g.map(v=>o.jsx(ln,{fill:v.flagged?N.critical:N.accent,stroke:v.flagged?N.critical:"none",strokeWidth:v.flagged?2:0},v.stageId))})]})})]})})}const rt={present:"present",disabled:"disabled",notEmitted:"not emitted",notApplicable:"not applicable",outsideEventLog:"outside event log",unknown:"unknown"},mi={present:"info",disabled:"warning",notEmitted:"warning",notApplicable:"muted",outsideEventLog:"muted",unknown:"muted"};function pi({entry:e}){const n=e.evidence?.count,t=vs(),s=`${e.summary}${n!=null?` · ${n} observed`:""}`,{tooltipProps:r,srOnlyTooltip:i}=ws(s);return o.jsxs("li",{id:`evidence-availability-${e.key}`,tabIndex:-1,ref:a=>t(e.key,a),className:"flex flex-col gap-0.5 rounded-md px-2 py-1 outline-none focus:ring-2 focus:ring-ring",...r,children:[o.jsxs("span",{className:"flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[o.jsx(se,{impactBand:mi[e.state]}),o.jsx("span",{className:"truncate text-sm font-medium",children:Ss(e.key)})]}),o.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:rt[e.state]}),i]}),o.jsx(H,{children:o.jsx("span",{className:"text-xs text-muted-foreground",children:s})})]})}function hi(e){return Object.keys(rt).map(n=>[n,e.filter(t=>t.state===n).length]).filter(([,n])=>n>0).map(([n,t])=>`${t} ${rt[n]}`).join(" · ")}function xi({ledger:e}){const{evidenceCardOpen:n,setEvidenceCardOpen:t}=on();return o.jsx(z,{title:"Evidence availability",open:n,onOpenChange:t,summary:o.jsx("span",{className:"text-xs text-muted-foreground",children:e?hi(e.entries):"Unavailable for this restored run"}),children:e?o.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(s=>o.jsx(pi,{entry:s},s.key))}):o.jsx("p",{className:"text-xs text-muted-foreground",children:"Evidence availability is unavailable for this restored run."})})}const vi=64;function wi(e,n){return n>=1?e:`color-mix(in srgb, ${e} ${n*100}%, transparent)`}function Si(e){return[{key:"startup",label:"Startup",value:e.startup,color:N.info,fillOpacity:1},{key:"stagesActive",label:"Stages active",value:e.stagesActive,color:N.clean,fillOpacity:1},{key:"gaps",label:"Scheduler gaps",value:e.gaps,color:N.warning,fillOpacity:1},{key:"idle",label:"Idle",value:e.idle,color:N.muted,fillOpacity:.6}].filter(n=>n.value>0).map(n=>({...n,legendColor:wi(n.color,n.fillOpacity)}))}const Ci=w.memo(function({appModel:n}){const{app:t,stages:s}=n,r=Se(t,s);if(r.total<=0)return null;const i=Si(r),a=l=>r.total>0?l/r.total*100:0,u=i.reduce((l,d)=>d.value>l.value?d:l,i[0]),c=[i.reduce((l,d)=>({...l,[d.key]:d.value}),{name:"total"})];return o.jsxs(z,{title:"Wall-Clock Breakdown",badges:o.jsxs("span",{className:"text-xs text-muted-foreground",children:[I(r.total)," total"]}),summary:o.jsx(te,{value:`${u.label} ${Math.round(a(u.value))}%`,context:`of ${I(r.total)} total`}),children:[o.jsx(ae,{ariaLabel:`Wall-clock breakdown: ${I(r.total)} total, split across startup, active stages, scheduler gaps and idle time. See the table below for exact values.`,height:vi,table:{caption:"Wall-clock time breakdown",columns:["Segment","Duration","% of total"],rows:i.map(l=>[l.label,I(l.value),`${Math.round(a(l.value))}%`]),align:["left","right","right"]},children:o.jsxs(Pe,{data:c,layout:"vertical",stackOffset:"expand",margin:{top:0,right:0,bottom:0,left:0},children:[o.jsx(le,{type:"number",hide:!0,domain:[0,1]}),o.jsx(ue,{type:"category",dataKey:"name",hide:!0}),o.jsx(ye,{shared:!1,labelFormatter:()=>"",formatter:(l,d)=>[I(Number(l)),d]}),o.jsx(Ns,{wrapperStyle:{fontSize:12},itemSorter:l=>i.findIndex(d=>d.key===l.dataKey),formatter:(l,d)=>{const p=i.find(f=>f.key===d.dataKey);return o.jsx("span",{style:{color:p?.color},children:l})},content:l=>o.jsx(Es,{...l,payload:l.payload?.map(d=>{const p=i.find(f=>f.key===d.dataKey);return p?{...d,color:p.legendColor}:d})})}),i.map(l=>o.jsx(ve,{dataKey:l.key,name:l.label,stackId:"wallclock",fill:l.color,fillOpacity:l.fillOpacity},l.key))]})}),o.jsx(H,{children:o.jsx("div",{className:"mt-3 flex flex-wrap gap-3 text-xs text-muted-foreground",children:i.map(l=>o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx("span",{className:"inline-block size-2.5 rounded-sm",style:{backgroundColor:l.color,opacity:l.fillOpacity}}),l.label," (",I(l.value),")"]},l.key))})})]})}),ot=36e5,yi=5,Xe={totalCoreHours:null,usefulCoreHours:null,wastedCoreHours:null,totalCores:null,topStages:[]};function ji(e,n=[],t){if(!t||e?.startTime==null||e?.endTime==null)return Xe;const s=e.endTime-e.startTime;if(s<=0)return Xe;const r=at(e,n);if(r<=0)return Xe;const i=r*s/ot,a=(t.busyCoreMs??0)/ot,u=Math.max(0,i-a),c=Object.entries(t.perStage??{}).map(([l,d])=>({stageId:Number(l),coreMs:d?.totalTaskDurationSum??0})).sort((l,d)=>d.coreMs-l.coreMs).slice(0,yi);return{totalCoreHours:i,usefulCoreHours:a,wastedCoreHours:u,totalCores:r,topStages:c}}function Ri({appModel:e}){const n=ji(e.app,e.executors.added,e.runAggregates);if(n.totalCoreHours==null)return null;const t=n.totalCoreHours>0?Math.round(n.wastedCoreHours/n.totalCoreHours*100):0;return o.jsx(z,{title:"Wasted Core-Hours",statusBadge:o.jsx(pn,{}),defaultCollapsed:!0,summary:o.jsx(te,{value:o.jsx("span",{className:"whitespace-nowrap",children:G(n.wastedCoreHours)}),context:`wasted of ${G(n.totalCoreHours)} allocated`}),children:o.jsxs("div",{className:"space-y-2 text-sm",children:[o.jsxs("p",{children:["Allocated: ",o.jsx("strong",{children:G(n.totalCoreHours)})," · Used:"," ",o.jsx("strong",{children:G(n.usefulCoreHours)})]}),o.jsxs("p",{children:[o.jsx(se,{impactBand:"info"})," Wasted: ",o.jsx("strong",{children:G(n.wastedCoreHours)})," (",t,"% of allocated)"]}),o.jsx(H,{children:o.jsxs("p",{className:"text-muted-foreground text-xs",children:["Allocated = ",n.totalCores," cores over the run; used = core-time that actually ran tasks."]})}),n.topStages.length>0&&o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-muted-foreground text-xs",children:"Top stages by task core-time"}),o.jsx("ul",{className:"space-y-0.5",children:n.topStages.map(s=>o.jsxs("li",{className:"flex justify-between gap-2",children:[o.jsxs("span",{children:["Stage ",s.stageId]}),o.jsx("span",{className:"text-muted-foreground tabular-nums",children:G(s.coreMs/ot)})]},s.stageId))})]})]})})}function bi({appModel:e,catalog:n,getTaskData:t,activeFileId:s,onRoute:r}){return o.jsxs("div",{className:"space-y-6",children:[o.jsx("h2",{className:"sr-only",children:"Full app report"}),o.jsx(Ci,{appModel:e}),o.jsx(fi,{appModel:e,catalog:n}),o.jsx(mr,{appModel:e,activeFileId:s}),o.jsx(ui,{appModel:e,catalog:n,getTaskData:t,onRoute:r}),o.jsxs(ut,{children:[o.jsx(Q,{cardId:"reference-evidence-availability",collapsedTile:!0,children:o.jsx(xi,{ledger:e.evidenceAvailability})}),o.jsx(Q,{cardId:"reference-etl-phases",collapsedTile:!0,children:o.jsx(dr,{appModel:e})}),o.jsx(Q,{cardId:"reference-scaling-sim",collapsedTile:!0,children:o.jsx(yr,{appModel:e})}),o.jsx(Q,{cardId:"reference-efficiency-model",collapsedTile:!0,children:o.jsx(ur,{appModel:e})}),o.jsx(Q,{cardId:"reference-wasted-core-hours",collapsedTile:!0,children:o.jsx(Ri,{appModel:e})}),o.jsx(Q,{cardId:"reference-core-usage-histogram",collapsedTile:!0,children:o.jsx(ar,{appModel:e,getTaskData:t})})]})]})}function ki({appModel:e,catalog:n,configFindings:t,getTaskData:s,activeFileId:r,options:i,onRoute:a,activeTab:u,onActiveTabChange:c}){const{selection:l}=ht(),d=w.useMemo(()=>_t(n,l),[n,l]),p=w.useMemo(()=>_t(t??[],l),[t,l]),f=d.length+p.length,g=n.length+(t??[]).length>0&&f===0;return o.jsxs("main",{className:"flex-1 space-y-6 p-4",children:[o.jsx(nr,{options:i,resultCount:f}),g&&o.jsx(Zs,{}),o.jsx(Fr,{appModel:e,catalog:d}),!g&&o.jsxs(Rs,{value:u,onValueChange:h=>c(h),children:[o.jsxs(bs,{variant:"chrome","aria-label":"Report view",children:[o.jsx(It,{value:"findings",className:"tap-target-comfortable",children:"Findings"}),o.jsx(It,{value:"full-report",className:"tap-target-comfortable",children:"Full app report"})]}),o.jsxs($t,{value:"findings",keepMounted:!0,children:[o.jsx("h2",{className:"sr-only",children:"Findings"}),o.jsx(Zr,{appModel:e,catalog:d,configFindings:p,stages:e.stages,getTaskData:s,activeFileId:r,onRoute:a})]}),o.jsx($t,{value:"full-report",keepMounted:!0,children:o.jsx(bi,{appModel:e,catalog:d,getTaskData:s,configFindings:p,activeFileId:r,onRoute:a})})]})]})}function Fi(){const{resetToDropZone:e,startLoad:n,getTaskData:t}=es(),s=de(R=>R.appModel),r=de(R=>R.catalog),i=de(R=>R.activeFileId),a=de(R=>R.exportMode),{recentEntries:u,onPickRecent:c,onRemoveRecent:l}=ys(i),[d,p]=w.useState(!1),[f,g]=w.useState("findings"),{referenceOpen:h}=on(),[m,S]=w.useState(null),[C,v]=w.useState(null),[b,_]=w.useState(null),M=w.useRef(0),E=w.useRef(null),U=w.useRef(null),x=w.useRef(new Map),k=w.useRef(new Map),F=w.useRef(null),O=m?.target??null;w.useEffect(()=>()=>{F.current&&clearTimeout(F.current)},[]),w.useEffect(()=>{h&&g("full-report")},[h]);const $=w.useCallback(R=>{E.current?.token===R&&(E.current=null,U.current=null,S(P=>P?.token===R?null:P))},[]),T=w.useCallback(R=>{if(E.current?.token!==R.token)return null;const{catalog:P,activeFileId:V}=kt.getState();if(U.current!==V)return null;const W=we(R.target.finding,P);return!W||W.widgetId!==R.target.widgetId||W.region!==R.target.region?null:W},[]),je=w.useCallback(R=>{g("findings");const P=M.current+1;M.current=P;const{catalog:V,activeFileId:W}=kt.getState(),J=we(R.finding,V);if(!J||J.widgetId!==R.widgetId||J.region!==R.region){E.current=null,U.current=null,S(null);return}const ce={target:J,token:P};E.current=ce,U.current=W,S(ce)},[]),ne=w.useCallback((R,P)=>{x.current.set(R,P);const V=E.current;return V?.target.widgetId===R&&T(V)&&P.open(),()=>{x.current.get(R)===P&&x.current.delete(R)}},[T]),_n=w.useCallback((R,P)=>(k.current.set(R,P),()=>{k.current.get(R)===P&&k.current.delete(R)}),[]),Mn=w.useCallback((R,P)=>{if(!P)return;const V=E.current;if(!V||V.target.widgetId!==R)return;const W=T(V);if(!W){$(V.token);return}const J=x.current.get(R);if(!J)return;const ce=J.getDisclosureButton();if(!ce){$(V.token);return}const jt=window.matchMedia("(prefers-reduced-motion: reduce)").matches,Ae=k.current.get(W.finding);Ae?(Ae.scrollIntoView({behavior:jt?"auto":"smooth",block:"center",inline:"nearest"}),Ae.focus({preventScroll:!0}),F.current&&clearTimeout(F.current),_(W.finding),F.current=setTimeout(()=>{F.current=null,_(null)},2e3)):(J.wrapperElement.scrollIntoView({behavior:jt?"auto":"smooth",block:"start",inline:"nearest"}),ce.focus({preventScroll:!0}),v(R)),$(V.token)},[$,T]),Pn=w.useCallback(R=>{v(P=>P===R?null:P)},[]);w.useLayoutEffect(()=>{if(!m)return;const R=T(m);if(!R){$(m.token);return}x.current.get(R.widgetId)?.open()},[$,T,m]),w.useLayoutEffect(()=>{const R=E.current;R&&!T(R)&&$(R.token)},[i,r,$,T]);const Te=de(R=>R.configFindings),yt=w.useMemo(()=>Js(r,Te),[r,Te]),Nn=R=>{a||(R.preventDefault(),p(!0))},En=()=>p(!1),Tn=R=>{if(a)return;R.preventDefault(),p(!1);const P=R.dataTransfer.files[0];P&&n(P)};return o.jsxs("div",{"data-testid":"dashboard",className:"relative flex min-h-screen flex-col",style:{paddingRight:"var(--docs-inset, 0px)"},onDragOver:Nn,onDragLeave:En,onDrop:Tn,children:[o.jsx(js,{onLoadNew:e,recentEntries:u,activeFileId:i,onPickRecent:c,onRemoveRecent:l}),o.jsx(Ys,{options:yt,fileId:i,children:o.jsx(ts,{registerWidget:ne,registerFindingAnchor:_n,reportWidgetOpen:Mn,clearRouteFocus:Pn,focusedWidgetId:C,activeRouteTarget:O,flashedFinding:b,children:o.jsx(ki,{appModel:s,catalog:r,configFindings:Te,getTaskData:t,activeFileId:i,options:yt,onRoute:je,activeTab:f,onActiveTabChange:g})})}),o.jsx(io,{appModel:s,catalog:r,getTaskData:t}),d&&o.jsx("div",{"aria-hidden":"true",className:"pointer-events-none fixed inset-0 z-50 flex items-center justify-center bg-background/80",children:o.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 zi(){return o.jsx(Cs,{children:o.jsx(Fi,{})})}export{zi as Dashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,j as t}from"./react-vendor-DA6opS-q.js";import{L as g,at as B,W as T,A as O,T as w,a8 as M,n as f}from"./index-CHjV2-jB.js";import{R as N}from"./useRecentFiles-BPGQ6XII.js";import{I as _}from"./ImpactEstimate-C6GzFOY9.js";import{u as $,R as D}from"./finding-anchor-4TmpXd7j.js";import{a as E}from"./StagePill-CYCMdlIx.js";import{W as L}from"./WidgetLeadSummary-DRNRVvn7.js";import{s as W,c as q}from"./impact-sort-Cq6KOLqh.js";import{u as F,S as G}from"./useSortMode-BOPpfLhJ.js";import{u as K}from"./usePagedRows-CFoZrPr4.js";import{R as k}from"./RowPagination-DypWbnic.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./toggle-group-lbIXRG0W.js";function z({finding:n}){const o=$([n]);return t.jsxs("li",{ref:o.ref,tabIndex:o.tabIndex,"data-flashed":o.dataFlashed,className:`space-y-2 ${D} transition-colors ${o.flashClassName}`,children:[n.stageIds&&n.stageIds.length>0?t.jsx(E,{pills:n.stageIds.map(i=>({id:i}))}):null,t.jsxs("p",{children:[n.recommendation," ",t.jsx(_,{finding:n})]})]})}const re=r.memo(function({catalog:o,defaultCollapsed:i=!0}){const{sortMode:x,setSortMode:S,orderBy:h}=F(),[l,R]=r.useState(!i),[P,d]=r.useState(0),{findings:s,pills:c,groupConfidence:m}=r.useMemo(()=>{const e=o.filter(a=>a.type==="duplicatePlanSubtree").sort((a,y)=>g[a.impactBand]-g[y.impactBand]),C=[...new Set(e.flatMap(a=>a.stageIds??[]))].map(a=>({id:a})),b=e.every(a=>a.confidence===e[0]?.confidence)?e[0]:void 0;return{findings:e,pills:C,groupConfidence:b}},[o]),p=h(s,e=>[e],W),u=B(),j=u?p.findIndex(e=>e===u.finding):null,{totalPages:I,effectivePage:v,visible:A}=K(p,P,d,j);return s.length===0?null:t.jsxs(T,{title:"Redundant Plan Subtree",impactBand:f(s),open:l,onOpenChange:R,badges:t.jsxs(t.Fragment,{children:[t.jsx(w,{type:"duplicatePlanSubtree",impactBand:f(s)??"info",className:M}),q(s,s.length,l)?t.jsx(G,{mode:x,onChange:S}):null]}),statusBadge:t.jsx(O,{children:t.jsx(N,{confidence:m?.confidence,validationRequired:m?.validationRequired,evidenceKey:"sqlPlan"})}),summary:t.jsx(L,{value:`${c.length} stage${c.length===1?"":"s"}`,context:`${s.length} finding${s.length===1?"":"s"} flagged`}),children:[t.jsx("ul",{className:"space-y-3 text-sm",children:A.map(e=>t.jsx(z,{finding:e},e.id))}),t.jsx(k,{page:v,totalPages:I,onPrev:()=>d(e=>e-1),onNext:()=>d(e=>e+1)})]})});export{re as DuplicatePlanSubtree};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a1 as M,au as b}from"./index-CHjV2-jB.js";import{j as a}from"./react-vendor-DA6opS-q.js";import{j as S,C as l}from"./useRecentFiles-BPGQ6XII.js";import{B as C,C as B,X as H,Y as w,T as A,a as D,i as m}from"./charts-vendor-Cf1-wzeH.js";function G(n){const s=M(o=>o.exportMode);return{exportMode:s,getTaskData:s?void 0:n}}const I=5,O=30,R=220;function g(n,s){if(n.length<2)return n[0]??null;const o=n[1]-n[0],e=Math.round((s-n[0])/o);return n[Math.min(n.length-1,Math.max(0,e))]}function L({metrics:n,fieldNames:s,markers:o={}}){const e=s.indexOf("duration");if(e===-1)return null;const d=s.length,T=n.length/d,r=[];for(let t=0;t<T;t++)r.push(n[t*d+e]);if(r.length<I)return a.jsxs("p",{className:"text-muted-foreground text-xs",children:["Too few tasks (",r.length,") for a distribution."]});const{labels:i,data:j}=b(r,O),k=i[1]-i[0],u=i.map((t,c)=>({bin:`${(t/1e3).toFixed(1)}s`,range:`${(t/1e3).toFixed(1)}s – ${((t+k)/1e3).toFixed(1)}s`,ms:t,count:j[c]})),x=o.p50!=null?g(i,o.p50):null,p=o.p95!=null?g(i,o.p95):null,f=x!=null?u.find(t=>t.ms===x)?.bin:void 0,h=p!=null?u.find(t=>t.ms===p)?.bin:void 0;return a.jsx(S,{title:"Task duration",ariaLabel:"Task duration histogram",height:R,table:{caption:"Task duration histogram",columns:["Duration bin","Task count"],rows:u.map(t=>[t.range,t.count]),align:["right","right"]},children:a.jsxs(C,{data:u,children:[a.jsx(B,{vertical:!1,stroke:l.muted,strokeOpacity:.2}),a.jsx(H,{dataKey:"bin",tick:{fontSize:10}}),a.jsx(w,{allowDecimals:!1,tick:{fontSize:10},width:32}),a.jsx(A,{formatter:t=>[`${Number(t)} task${Number(t)===1?"":"s"}`,"Count"],labelFormatter:(t,c)=>c?.[0]?.payload?.range??t}),a.jsx(D,{dataKey:"count",name:"Tasks",fill:l.accent}),f?a.jsx(m,{x:f,stroke:l.accent,label:"P50"}):null,h?a.jsx(m,{x:h,stroke:l.warning,label:"P95"}):null]})})}export{L as D,G as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./react-vendor-DA6opS-q.js";import{e as r}from"./index-CHjV2-jB.js";const x={clean:{box:"border-clean/40 bg-clean/10",icon:"text-clean",title:"text-clean"},neutral:{box:"border-border/60 bg-muted/40",icon:"text-muted-foreground",title:"text-foreground"}};function m({icon:n,tone:o="neutral",title:a,description:s,action:l,className:i}){const t=x[o];return e.jsxs("div",{className:r("flex items-start gap-3 rounded-xl border p-4",t.box,i),children:[e.jsx(n,{"aria-hidden":"true",className:r("mt-0.5 size-4 shrink-0",t.icon)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:r("text-sm font-medium",t.title),children:a}),s?e.jsx("p",{className:"text-xs text-muted-foreground",children:s}):null]}),l]})}export{m as E};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r,j as a}from"./react-vendor-DA6opS-q.js";import{L as m,at as v,W as I,ar as l,as as d,T as R,n as c,I as B}from"./index-CHjV2-jB.js";import{I as z}from"./ImpactEstimate-C6GzFOY9.js";import{R as E}from"./RowPagination-DypWbnic.js";import{u as N}from"./finding-anchor-4TmpXd7j.js";import{u as P}from"./usePagedRows-CFoZrPr4.js";import{W as w}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function y({finding:i}){const s=N([i]);return a.jsxs("div",{ref:s.ref,tabIndex:s.tabIndex,"data-flashed":s.dataFlashed,className:`transition-colors ${s.flashClassName}`,children:[a.jsxs("p",{className:"flex flex-wrap items-start gap-2",children:[a.jsx(B,{impactBand:i.impactBand,className:"mt-1.5"}),a.jsx("strong",{children:l("pct",d(i))})," average executor utilization"]}),a.jsx(z,{finding:i}),a.jsx("p",{children:i.recommendation})]})}const L=r.memo(function({catalog:s,defaultCollapsed:p=!0}){const[u,o]=r.useState(0),e=r.useMemo(()=>s.filter(t=>t.type==="utilization").slice().sort((t,j)=>m[t.impactBand]-m[j.impactBand]),[s]),n=v(),x=n?e.findIndex(t=>t===n.finding):null,{totalPages:f,effectivePage:g,visible:h}=P(e,u,o,x);return e.length===0?null:a.jsxs(I,{title:"Executor Utilization",impactBand:c(e),badges:a.jsx(R,{type:"utilization",impactBand:c(e)??"info"}),defaultCollapsed:p,summary:a.jsx(w,{value:`${l("pct",d(e[0]))} average`,context:`${e.length} item${e.length===1?"":"s"} flagged`}),children:[a.jsx("div",{className:"space-y-2 text-sm",children:h.map(t=>a.jsx(y,{finding:t},t.id))}),a.jsx(E,{page:g,totalPages:f,onPrev:()=>o(t=>t-1),onNext:()=>o(t=>t+1)})]})});export{L as ExecutorUtilization};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as e}from"./react-vendor-DA6opS-q.js";import{at as I,n as N,W as P,A as w,T as G,q as T}from"./index-CHjV2-jB.js";import{W as b}from"./WidgetLeadSummary-DRNRVvn7.js";import{R as A}from"./useRecentFiles-BPGQ6XII.js";import{S as E}from"./StageHeader-uDBLHgdg.js";import{I as O}from"./ImpactEstimate-C6GzFOY9.js";import{R as B}from"./RowPagination-DypWbnic.js";import{u as W}from"./usePagedRows-CFoZrPr4.js";import{u as $,R as F}from"./finding-anchor-4TmpXd7j.js";import{c as L}from"./impact-sort-Cq6KOLqh.js";import{u as q,S as _}from"./useSortMode-BOPpfLhJ.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./StagePill-CYCMdlIx.js";import"./toggle-group-lbIXRG0W.js";const H="GC % = total JVM GC time ÷ total executor run time; it can exceed 100% when GC pauses overlap many concurrent task threads.";function M(t){return[...t].sort((a,r)=>(typeof r.value=="number"?r.value:0)-(typeof a.value=="number"?a.value:0))}function V({finding:t,appModel:a}){const r=$([t]),n=(t.stageId!=null?a.stages.get(t.stageId):void 0)?.executorRunTime;return e.jsxs("li",{ref:r.ref,tabIndex:r.tabIndex,"data-flashed":r.dataFlashed,className:`space-y-2 ${F} transition-colors ${r.flashClassName}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[e.jsx(E,{stageId:t.stageId,appModel:a}),e.jsx(w,{children:e.jsx(A,{confidence:t.confidence,validationRequired:t.validationRequired})})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["GC: ",e.jsxs("strong",{children:[t.value,"%"]})," · Executor run time:"," ",e.jsx("strong",{children:T(n??0)})]}),e.jsx(O,{finding:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.recommendation})]})}function S({title:t,findings:a,appModel:r,page:u,setPage:n,routeTarget:d,orderBy:i}){const h=M(a),m=i(h,s=>[s],s=>s.stageId),g=d?m.findIndex(s=>s===d.finding):null,{totalPages:x,effectivePage:p,visible:f}=W(m,u,n,g);return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("h4",{className:"font-heading text-sm font-medium",children:[t," · ",a.length," stage",a.length===1?"":"s"]}),e.jsx("ul",{className:"space-y-3",children:f.map(s=>e.jsx(V,{finding:s,appModel:r},s.stageId))}),e.jsx(B,{page:p,totalPages:x,onPrev:()=>n(s=>s-1),onNext:()=>n(s=>s+1)})]})}function oe({catalog:t,appModel:a,defaultCollapsed:r=!0}){const[u,n]=l.useState(0),[d,i]=l.useState(0),{sortMode:h,setSortMode:m,orderBy:g}=q(),[x,p]=l.useState(!r),f=I(),s=l.useRef(!1);l.useEffect(()=>{if(!s.current){s.current=!0;return}n(0),i(0)},[a]);const c=t.filter(o=>o.type==="gc");if(c.length===0)return null;const j=c.filter(o=>o.direction!=="low"),v=c.filter(o=>o.direction==="low"),R=N(c),C=[...c].sort((o,y)=>(typeof y.value=="number"?y.value:0)-(typeof o.value=="number"?o.value:0))[0];return e.jsx(P,{title:"GC Pressure",impactBand:R,badges:e.jsxs(e.Fragment,{children:[e.jsx(G,{type:"gc",impactBand:R??"info"}),L(c,c.length,x)?e.jsx(_,{mode:h,onChange:o=>{m(o),n(0),i(0)}}):null]}),defaultCollapsed:r,open:x,onOpenChange:p,summary:e.jsx(b,{value:`${C.value}%`,context:`${c.length} stage${c.length===1?"":"s"} flagged`}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(w,{children:e.jsx("p",{className:"text-xs text-muted-foreground",children:H})}),j.length>0&&e.jsx(S,{title:"GC overhead",findings:j,appModel:a,page:u,setPage:n,routeTarget:f,orderBy:g}),v.length>0&&e.jsx(S,{title:"Low GC (cost)",findings:v,appModel:a,page:d,setPage:i,routeTarget:f,orderBy:g})]})})}export{oe as GcPressure};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as h,j as s}from"./react-vendor-DA6opS-q.js";import{j as d,q as x}from"./index-CHjV2-jB.js";function a(t){return t===0?"0s":x(t)}function w(t,e){const n=a(t),r=a(e);return n===r?r:`${n}-${r}`}function f(t){const e=Math.round(t.value*10)/10;switch(t.unit){case"bytes":return d(t.value);case"ms":return a(t.value);case"mbSeconds":return`${e.toLocaleString("en-US")} MB-s`;case"coreHours":return`${e.toFixed(1)} core-h`;case"coreMs":return`${e.toLocaleString("en-US")} core-ms`;default:return String(t.value)}}function l(t){return/^0(\.0+)?(?:[^0-9.]|$)/.test(t)}function C(t){if(!t)return null;if(t.wallClock){if(t.wallClock.high<=0)return null;const e=a(t.wallClock.high);return l(e)?null:e}if(t.rawWaste){if(t.rawWaste.value<=0)return null;const e=f(t.rawWaste);return l(e)?null:e}return null}function k({finding:t}){const e=h.useId(),n=t.impactEstimate;if(!n)return null;const r=n.wallClock&&n.wallClock.high>0?a(n.wallClock.high):null,u=r&&!l(r)?w(n.wallClock.low,n.wallClock.high):null,o=n.rawWaste&&n.rawWaste.value>0?f(n.rawWaste):null,m=!u&&o&&!l(o)?o:null,c=u??m;if(!c)return null;const i=`Estimate method: ${n.estimateMethod}`;return s.jsxs("span",{className:"impact-estimate text-xs text-muted-foreground",title:i,tabIndex:0,"aria-describedby":e,children:["Potential savings: ",s.jsx("strong",{children:c}),s.jsx("span",{id:e,className:"sr-only",children:i})]})}export{k as I,f as a,C as b,w as f};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e}from"./react-vendor-DA6opS-q.js";import{I as o}from"./ImpactEstimate-C6GzFOY9.js";import{W as c,T as l}from"./index-CHjV2-jB.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function p({finding:n}){const{recommendation:t}=n;return e.jsxs("div",{className:"flex flex-col gap-1 transition-colors",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["ApplicationEnd event: ",e.jsx("strong",{children:"missing"})]}),e.jsx(o,{finding:n}),e.jsxs("div",{className:"space-y-1 pt-1",children:[e.jsx("p",{children:"This run’s event log never recorded an ApplicationEnd event."}),t?e.jsx("p",{children:t}):null]})]})}function j({catalog:n,defaultCollapsed:t=!0}){const s=n.find(r=>r.type==="incompleteRun");if(!s)return null;const{impactBand:i}=s;return e.jsx(c,{title:"Incomplete Run",impactBand:i,badges:e.jsx(l,{type:"incompleteRun",impactBand:i}),defaultCollapsed:t,children:e.jsx(p,{finding:s})})}export{j as IncompleteRun};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as s}from"./react-vendor-DA6opS-q.js";import{I as n}from"./ImpactEstimate-C6GzFOY9.js";import{W as d,T as m,A as u}from"./index-CHjV2-jB.js";import{W as x}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function f({finding:t}){const l=t.failedJobs,a=t.totalJobs,e=t.failedTasks,r=t.totalTasks,i=t.taskFailureRate,{value:c,recommendation:o}=t;return s.jsxs("div",{className:"flex flex-col gap-1 transition-colors",children:[s.jsxs("p",{children:["Failure rate: ",s.jsxs("strong",{children:[c,"%"]})," (",l," of ",a," completed jobs)"]}),s.jsx(u,{children:s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Task-failure context: ",e," of ",r," tasks failed (",i,"%)."]})}),s.jsx(n,{finding:t}),o?s.jsx("p",{children:o}):null]})}function h({catalog:t,defaultCollapsed:l=!0}){const a=t.find(o=>o.type==="jobFailureRate");if(!a)return null;const{impactBand:e,value:r}=a,i=a.failedJobs,c=a.totalJobs;return s.jsx(d,{title:"Job Failures",impactBand:e,badges:s.jsx(m,{type:"jobFailureRate",impactBand:e}),defaultCollapsed:l,summary:s.jsx(x,{value:`${r}%`,context:`${i} of ${c} completed jobs failed`}),children:s.jsx(f,{finding:a})})}export{h as JobFailures};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as d,j as a}from"./react-vendor-DA6opS-q.js";import{L as p,at as w,W as C,A as l,T as M,n as x,I as b,as as U,ar as A}from"./index-CHjV2-jB.js";import{k as f,R as P}from"./useRecentFiles-BPGQ6XII.js";import{u as S}from"./finding-anchor-4TmpXd7j.js";import{I as z}from"./ImpactEstimate-C6GzFOY9.js";import{R as D}from"./RowPagination-DypWbnic.js";import{u as E}from"./usePagedRows-CFoZrPr4.js";import{W as T}from"./WidgetLeadSummary-DRNRVvn7.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";function F(e){const t=U(e),o=A("pct",t);return e.variant==="idleCores"?`${o} of allocated core-time idle`:e.variant==="memoryBand"?e.rule==="heapNearCapacity"?`${o} of allocated heap used: near capacity`:`${o} of allocated heap used: over-provisioned`:`~${t.toLocaleString("en-US")} MB-seconds wasted`}function L(e){const t=e.recommendation??"",o=t.indexOf(": ");return o===-1?` ${t}`:`; ${t.slice(o+2)}`}function g(e){if(e.rule==null)return null;const t=e.recommendation??"",o=t.indexOf(": ");return o===-1?null:` ${t.slice(0,o)}.`}function v(e){return"executorId"in e&&e.executorId!=null?`Executor ${e.executorId}`:e.variant==="idleCores"?"Idle cores":"Memory waste"}function O({finding:e}){const t=S([e]);return e.dataUnavailable?a.jsx("div",{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`space-y-1 transition-colors ${t.flashClassName}`,children:a.jsx(l,{children:a.jsx("p",{className:"text-muted-foreground",children:e.recommendation})})}):a.jsxs("div",{ref:t.ref,tabIndex:t.tabIndex,"data-flashed":t.dataFlashed,className:`transition-colors ${t.flashClassName}`,children:[a.jsxs("p",{className:"flex flex-wrap items-start gap-2",children:[a.jsx(b,{impactBand:e.impactBand,className:"mt-1.5"}),a.jsx("strong",{children:v(e)})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[F(e),L(e),g(e)!=null?a.jsx(l,{children:g(e)}):null]}),a.jsx(z,{finding:e})]})}const X=d.memo(function({catalog:t,defaultCollapsed:o=!0}){const[h,i]=d.useState(0),{findings:r,groupConfidence:m}=d.useMemo(()=>{const n=t.filter(s=>s.type==="memoryUtilization").sort((s,$)=>p[s.impactBand]-p[$.impactBand]),c=n.filter(f),N=c.every(s=>s.confidence===c[0]?.confidence)?c[0]:void 0;return{findings:n,groupConfidence:N}},[t]),u=w(),y=u?r.findIndex(n=>n===u.finding):null,{totalPages:j,effectivePage:I,visible:R}=E(r,h,i,y);if(!r.some(f))return null;const B=r.find(n=>!n.dataUnavailable)??r[0];return a.jsxs(C,{title:"Memory Utilization",impactBand:x(r),badges:a.jsx(M,{type:"memoryUtilization",impactBand:x(r)??"info"}),statusBadge:a.jsx(l,{children:a.jsx(P,{confidence:m?.confidence,validationRequired:m?.validationRequired,evidenceKey:"executorMetrics"})}),defaultCollapsed:o,summary:a.jsx(T,{value:v(B),context:`${r.length} item${r.length===1?"":"s"} flagged`}),children:[a.jsx("div",{className:"space-y-2 text-sm",children:R.map(n=>a.jsx(O,{finding:n},n.id))}),a.jsx(D,{page:I,totalPages:j,onPrev:()=>i(n=>n-1),onNext:()=>i(n=>n+1)})]})});export{X as MemoryUtilization};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as n,j as e}from"./react-vendor-DA6opS-q.js";import{L as g,at as P,W as y,A as C,T,a8 as w,n as u}from"./index-CHjV2-jB.js";import{R as M}from"./useRecentFiles-BPGQ6XII.js";import{I as N}from"./ImpactEstimate-C6GzFOY9.js";import{u as _,R as $}from"./finding-anchor-4TmpXd7j.js";import{a as E}from"./StagePill-CYCMdlIx.js";import{W as L}from"./WidgetLeadSummary-DRNRVvn7.js";import{s as W,c as b}from"./impact-sort-Cq6KOLqh.js";import{u as q,S as F}from"./useSortMode-BOPpfLhJ.js";import{u as D}from"./usePagedRows-CFoZrPr4.js";import{R as G}from"./RowPagination-DypWbnic.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./toggle-group-lbIXRG0W.js";function z({finding:a}){const o=_([a]);return e.jsxs("li",{ref:o.ref,tabIndex:o.tabIndex,"data-flashed":o.dataFlashed,className:`space-y-2 ${$} transition-colors ${o.flashClassName}`,children:[a.stageIds&&a.stageIds.length>0?e.jsx(E,{pills:a.stageIds.map(i=>({id:i}))}):null,e.jsxs("p",{children:[a.recommendation," ",e.jsx(N,{finding:a})]})]})}const oe=n.memo(function({catalog:o,defaultCollapsed:i=!0}){const{sortMode:f,setSortMode:x,orderBy:h}=q(),[l,R]=n.useState(!i),[j,d]=n.useState(0),{findings:t,pills:c}=n.useMemo(()=>{const s=o.filter(r=>r.type==="overBroadcast").sort((r,O)=>g[r.impactBand]-g[O.impactBand]),A=[...new Set(s.flatMap(r=>r.stageIds??[]))].map(r=>({id:r}));return{findings:s,pills:A}},[o]),m=h(t,s=>[s],W),p=P(),v=p?m.findIndex(s=>s===p.finding):null,{totalPages:S,effectivePage:B,visible:I}=D(m,j,d,v);return t.length===0?null:e.jsxs(y,{title:"Oversized Broadcast Join",impactBand:u(t),open:l,onOpenChange:R,badges:e.jsxs(e.Fragment,{children:[e.jsx(T,{type:"overBroadcast",impactBand:u(t)??"info",className:w}),b(t,t.length,l)?e.jsx(F,{mode:f,onChange:x}):null]}),statusBadge:e.jsx(C,{children:e.jsx(M,{confidence:t[0].confidence,validationRequired:t[0].validationRequired,evidenceKey:"sqlPlan"})}),summary:e.jsx(L,{value:`${c.length} stage${c.length===1?"":"s"}`,context:`${t.length} finding${t.length===1?"":"s"} flagged`}),children:[e.jsx("ul",{className:"space-y-3 text-sm",children:I.map(s=>e.jsx(z,{finding:s},s.id))}),e.jsx(G,{page:B,totalPages:S,onPrev:()=>d(s=>s-1),onNext:()=>d(s=>s+1)})]})});export{oe as OverBroadcast};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as t}from"./react-vendor-DA6opS-q.js";import{S as O,a as M,b as W,c as F,d as _}from"./select-D5fK-za0.js";import{at as V,L as p,W as v,n as D,av as R,T as J,E as k,as as z,j as C}from"./index-CHjV2-jB.js";import{W as E}from"./WidgetLeadSummary-DRNRVvn7.js";import{S as H}from"./StageHeader-uDBLHgdg.js";import{u as q,R as G}from"./finding-anchor-4TmpXd7j.js";import{I as N}from"./ImpactEstimate-C6GzFOY9.js";import{c as K}from"./impact-sort-Cq6KOLqh.js";import{u as Q,S as U}from"./useSortMode-BOPpfLhJ.js";import{R as X}from"./RowPagination-DypWbnic.js";import{u as Y}from"./usePagedRows-CFoZrPr4.js";import{P as Z}from"./PlanExplorer-xYFme_Rx.js";import{r as tt}from"./useRecentFiles-BPGQ6XII.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./StagePill-CYCMdlIx.js";import"./toggle-group-lbIXRG0W.js";function et(a){if(a.rule==="lowShuffleParallelism")return`${z(a)} tasks carrying the shuffle`;const n=z(a);return a.rule==="maxPartitionTooBig"?`Largest partition ${C(n)} (too large)`:`Largest partition ${C(n)}`}function st({entry:a,appModel:n}){const g=k(),r=q(a.partitions),u=g==="advanced"&&tt(a.stageId,n);return t.jsxs("div",{ref:r.ref,tabIndex:r.tabIndex,"data-flashed":r.dataFlashed,className:`space-y-2 ${G} transition-colors ${r.flashClassName}`,children:[t.jsx(H,{stageId:a.stageId,appModel:n}),t.jsx("p",{className:"text-xs text-muted-foreground",children:a.partitions.map((i,d)=>t.jsxs("span",{children:[d>0?" · ":"",et(i)]},i.id))}),t.jsx(N,{finding:a.partitions[0]}),t.jsxs("div",{className:"space-y-2 pt-1",children:[t.jsx("ul",{className:"list-disc space-y-1 pl-5 text-xs text-muted-foreground",children:a.partitions.map(i=>t.jsxs("li",{children:[i.recommendation," ",t.jsx(N,{finding:i})]},i.id))}),u?t.jsx(Z,{stageId:a.stageId,appModel:n}):null]})]})}const jt=l.memo(function({appModel:n,catalog:g,defaultCollapsed:r=!0}){const[u,i]=l.useState(0),[d,h]=l.useState(!r),{sortMode:S,setSortMode:T,orderBy:$}=Q(),I=V(),{partitionFindings:x,sorted:m,orderedEntries:f}=l.useMemo(()=>{const e=g.filter(s=>s.type==="partitionSizing"),c=new Map;for(const s of e){if(s.stageId==null)continue;const o=c.get(s.stageId);o?(o.partitions.push(s),p[s.impactBand]<p[o.impactBand]&&(o.impactBand=s.impactBand)):c.set(s.stageId,{stageId:s.stageId,partitions:[s],impactBand:s.impactBand})}const P=[...c.values()].sort((s,o)=>p[s.impactBand]-p[o.impactBand]||s.stageId-o.stageId),A=$(P,s=>s.partitions,s=>s.stageId);return{partitionFindings:e,sorted:P,orderedEntries:A}},[g,S]),b=I?f.findIndex(e=>e.partitions.includes(I.finding)):null,{totalPages:w,effectivePage:j,visible:y}=Y(f,u,i,b);if(x.length===0){const e=n.stages.size;return t.jsx(v,{title:"Partition Sizing",open:d,onOpenChange:h,summary:t.jsx(E,{value:"No issues",context:`no issue detected: partition sizing checked across ${e} stage${e===1?"":"s"}`}),children:t.jsx("p",{className:"text-xs text-muted-foreground",children:"No partition-sizing issues detected."})})}const B=D(x),L=K(x,m.length,d);return t.jsx(v,{title:"Partition Sizing",impactBand:B,open:d,onOpenChange:h,summary:t.jsx(E,{value:`Stage ${m[0].stageId}`,context:`${m.length} stage${m.length===1?"":"s"} flagged`}),badges:t.jsxs(t.Fragment,{children:[t.jsx(J,{type:"partitionSizing",impactBand:B??"info"}),L?t.jsx(U,{mode:S,onChange:e=>{T(e),i(0)}}):null]}),children:t.jsxs("div",{className:"space-y-4",children:[y.map(e=>t.jsx(st,{entry:e,appModel:n},e.stageId)),t.jsx(X,{page:j,totalPages:w,onPrev:()=>i(e=>e-1),onNext:()=>i(e=>e+1),renderJumpControl:()=>t.jsxs(O,{value:String(j*R),onValueChange:e=>i(Math.floor(Number(e)/R)),children:[t.jsx(M,{size:"sm","aria-label":"Jump to stage",children:t.jsx(W,{placeholder:"Jump to stage"})}),t.jsx(F,{children:f.map((e,c)=>t.jsxs(_,{value:String(c),children:["Stage ",e.stageId]},e.stageId))})]})})]})})});export{jt as PartitionSizing};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,j as e}from"./react-vendor-DA6opS-q.js";import{a4 as i,a5 as l,G as o,v as x,a6 as c}from"./index-CHjV2-jB.js";import{r as d,P as m}from"./useRecentFiles-BPGQ6XII.js";function f({stageId:r,appModel:a}){const[s,n]=t.useState(!1);return d(r,a)?e.jsx("div",{className:"space-y-3",children:e.jsxs(i,{open:s,onOpenChange:n,children:[e.jsxs(l,{"aria-expanded":String(s),className:"flex cursor-pointer items-center gap-2 bg-transparent text-left",children:[e.jsx("h3",{className:"font-heading text-sm font-medium",children:"Plan context"}),s?e.jsx(o,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"}):e.jsx(x,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})]}),e.jsx(c,{keepMounted:!0,children:e.jsx("div",{className:"pt-3",children:e.jsx(m,{stageId:r,appModel:a})})})]})}):null}export{f as P};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,T as Ke,t as Qe,v as et,x as tt,y as nt,z as st,A as at,E as ot,F as rt,G as it,H as lt,I as dt,r as p}from"./react-vendor-DA6opS-q.js";import{c as U,a as ct,b as Ie,s as ut,m as gt,w as ht,d as pt,f as ft,g as mt,p as xt,e as Y,I as Pe,t as bt,h as Ce,i as ce,B as Q,X as jt,j as ze,T as $e,C as Fe,k as yt,l as wt,n as Nt,o as vt,q as St,u as kt,D as Et,r as Le}from"./index-CHjV2-jB.js";import{f as He,C as It,D as Pt,a as Ct,b as Mt,c as Tt,d as Dt,u as Gt,r as _t,T as Rt}from"./useRecentFiles-BPGQ6XII.js";import{$ as Me,H as Te,P as De,u as Xe,g as Bt,B as At,E as Ot,R as zt,c as $t,d as Ft,e as Ge,M as Lt}from"./plan-graph-vendor-B96a-e4N.js";import{b as Ht}from"./impact-sort-Cq6KOLqh.js";import"./charts-vendor-Cf1-wzeH.js";const Xt=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],Yt=U("arrow-left-right",Xt);const Wt=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],qt=U("flag",Wt);const Vt=[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]],Zt=U("map",Vt);const Ut=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],Jt=U("maximize-2",Ut);const Kt=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Qt=U("settings",Kt);const en=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],tn=U("timer",en);const nn=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],sn=U("zoom-in",nn);const an=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],on=U("zoom-out",an);function rn({id:t,sourceNodeId:s,planNode:n,category:a,segmentIndex:r,splitRole:o,durationShare:i,exclusiveDurationShare:l,findings:c}){return{id:t,sourceNodeId:s,label:n.name,category:a,operatorDetail:xt(n.name,n.detail??""),primaryMetric:mt(n.metrics),segmentIndex:r,splitRole:o,durationShare:i??null,exclusiveDurationShare:l??null,findings:c,metrics:(n.metrics??[]).map(g=>({name:g.name,value:ft(g)})),detailText:n.detail&&n.detail!==n.name?n.detail:""}}function ln(t,s){const{scope:n,stageId:a,appModel:r,findings:o=[],durationMode:i="exclusive"}=s;if(!t)return{nodes:[],edges:[],segmentIndex:null,segmentCount:0,scope:"full",segmentStageIds:new Map};const c=r.stages.get(a)?.sqlExecutionId??null,g=c!=null?r.sql.get(c):null,{segments:m,segOf:j,segmentTopology:k}=ct(t),N=m.filter(Boolean).length,I=g&&c!=null?Ie(t,r,g,c,i):null,M=i==="exclusive"?I:g&&c!=null?Ie(t,r,g,c,"exclusive"):null,_=new Map,B=g&&c!=null?ut(c,r.stages):[];if(B.length){const u=new Map;for(const f of B){const y=r.stages.get(f);y&&u.set(f,{submittedAt:y.submittedAt,completedAt:y.completedAt})}for(const[f,y]of gt(m,u,B,k))_.set(f,y)}const A=new Map;if(c!=null){for(const u of o)if(u.executionId===c)for(const f of u.planNodeIds??[]){const y=A.get(f);y?y.push(u):A.set(f,[u])}}const R=[],F=[],T=new Map;ht(t,(u,f)=>{const y=u.id,ee=pt(u.name),H=j.get(u),h=f?f.id:null,v=u.exchangeRole==="write"&&f?f.id:y,P=rn({id:y,sourceNodeId:v,planNode:u,category:ee,segmentIndex:H,splitRole:u.exchangeRole??null,durationShare:I?.get(u),exclusiveDurationShare:M?.get(u),findings:A.get(y)??[]});if(R.push(P),u.exchangeRole){const C=T.get(v)??{};C[u.exchangeRole]=P,T.set(v,C)}if(h){const C={id:`${h}->${y}`,source:h,target:y};if(u.exchangeRole==="write"){const D=_.get(H),V=D!=null?r.stages.get(D):void 0,$=V?.shuffleWriteBytes||V?.shuffleReadBytes;if($){C.shuffleBytes=$;const Z=T.get(v)??{};Z.shuffleBytes=$,T.set(v,Z)}}F.push(C)}},{dedupe:!0});for(const{read:u,write:f,shuffleBytes:y}of T.values())u&&f&&(u.pairedNodeId=f.id,f.pairedNodeId=u.id),y!=null&&(u&&(u.exchangeShuffleBytes=y),f&&(f.exchangeShuffleBytes=y));if(n==="full")return{nodes:R,edges:F,segmentIndex:null,segmentCount:N,scope:"full",segmentStageIds:_};let x=null;for(const[u,f]of _)if(f===a){x=u;break}if(x===null)return{nodes:R,edges:F,segmentIndex:null,segmentCount:N,scope:"full",segmentStageIds:_};const O=new Set,L=R.filter(u=>u.segmentIndex!==x?!1:(O.add(u.id),!0)),z=F.filter(u=>O.has(u.source)&&O.has(u.target));return{nodes:L,edges:z,segmentIndex:x,segmentCount:N,scope:"segment",segmentStageIds:_}}const se=220,ae=90,_e=24,dn=32,cn=32,Ye=64,un=0;function me(t,s,n={}){const a=new Me.graphlib.Graph({compound:!!n.groupOf});a.setGraph({rankdir:"RL",nodesep:Ye*2,ranksep:60,ranker:"tight-tree"}),a.setDefaultEdgeLabel(()=>({}));const r=new Set;if(n.groupOf){for(const o of t){const i=n.groupOf(o);i&&r.add(i)}for(const o of r)a.setNode(o,{})}for(const o of t){a.setNode(o.id,{width:se,height:ae});const i=n.groupOf?.(o);i&&a.setParent(o.id,i)}for(const o of s)a.setEdge(o.source,o.target);return Me.layout(a),t.map(o=>{const i=a.node(o.id);return{...o,position:{x:i.x-se/2,y:i.y-ae/2}}})}function gn(t,s,n={}){const a=n.paddingX??_e,r=n.paddingY??_e,o=n.headerHeight??dn,i=new Map;for(const l of t){const c=s(l);if(!c)continue;const g=l.position.x,m=l.position.y,j=g+se,k=m+ae,N=i.get(c);N?(N.minX=Math.min(N.minX,g),N.minY=Math.min(N.minY,m),N.maxX=Math.max(N.maxX,j),N.maxY=Math.max(N.maxY,k)):i.set(c,{minX:g,minY:m,maxX:j,maxY:k})}return[...i.entries()].map(([l,c])=>({id:l,position:{x:c.minX-a,y:c.minY-r-o},width:c.maxX-c.minX+a*2,height:c.maxY-c.minY+r*2+o}))}function xe(t,s,n={}){const a=new Set,r=[];for(const o of s){const i=l=>{const c=t(l);return c&&!a.has(c)?c:null};for(const l of gn(o,i,n))a.add(l.id),r.push(l)}return r}function We({delay:t=0,...s}){return e.jsx(Ke,{"data-slot":"tooltip-provider",delay:t,...s})}function Se({...t}){return e.jsx(Qe,{"data-slot":"tooltip",...t})}function ke({...t}){return e.jsx(et,{"data-slot":"tooltip-trigger",...t})}function Ee({className:t,side:s="top",sideOffset:n=4,align:a="center",alignOffset:r=0,children:o,...i}){return e.jsx(tt,{children:e.jsx(nt,{align:a,alignOffset:r,side:s,sideOffset:n,className:"isolate z-50",children:e.jsxs(st,{"data-slot":"tooltip-content",className:Y("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none",t),...i,children:[o,e.jsx(at,{className:"z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"})]})})})}const hn=40,pn=15;function fn(t){return t==null?null:t>=hn?"critical":t>=pn?"warning":"info"}const oe={scan:"⇩",exchange:"⇄",join:"⋈",aggregate:"Σ",sort:"↕",filter:"∇",aqe:"⚙",boilerplate:"·",transform:"→"};function mn(t){return t.find(s=>s.impactBand==="critical")??t.find(s=>s.impactBand==="warning")??t[0]}function xn({data:t}){const{label:s,operatorDetail:n,primaryMetric:a,category:r,splitRole:o,durationSharePct:i,findings:l}=t,c=oe[r]??oe.transform,g=fn(i);return e.jsxs("div",{className:"relative flex flex-col overflow-visible rounded-md border border-border bg-card px-3 py-2 text-xs shadow-sm",style:{width:se,height:ae},"data-category":r,children:[e.jsx(Te,{type:"target",position:De.Right,className:"opacity-0!"}),e.jsx(Te,{type:"source",position:De.Left,className:"opacity-0!"}),l&&l.length>0?(()=>{const m=mn(l);return e.jsxs(Se,{children:[e.jsxs(ke,{"data-testid":"node-finding-badge",className:Y("absolute -right-1 -top-1 flex items-center gap-1 rounded-full bg-card px-1.5 py-0.5 text-[10px] font-medium leading-none shadow-sm ring-1 ring-border",Ce[m.impactBand]),children:[e.jsx(Pe,{impactBand:m.impactBand}),bt(m.type),l.length>1?e.jsx("span",{children:l.length}):null]}),e.jsx(Ee,{className:"max-w-xs",children:e.jsx("ul",{className:"flex flex-col gap-1 text-left",children:l.map((j,k)=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx(Pe,{impactBand:j.impactBand}),e.jsx("span",{children:He(j)})]},j.id??`${j.type}-${k}`))})})]})})():null,o==="read"?e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:"paired: see write half"}):null,i!=null&&g?e.jsxs("div",{className:"mb-1 flex shrink-0 items-center gap-1.5",title:"Share of the plan's total stage wall time",children:[e.jsxs("span",{className:Y("shrink-0 text-[10px] font-medium tabular-nums",Ce[g]),children:[i,"%"]}),e.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-muted",children:e.jsx("div",{"data-testid":"duration-heat-bar-fill",className:Y("h-full rounded-full",ce[g]),style:{width:`${i>0?Math.max(i,4):0}%`}})}),e.jsxs("span",{className:"sr-only",children:["Duration share ",i,"%, ",g==="critical"?"high":g==="warning"?"medium":"low"]})]}):null,e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:c}),e.jsx("span",{className:"min-w-0 truncate font-medium",title:s,children:s})]}),n?e.jsx("p",{className:"truncate text-muted-foreground",title:n,children:n}):null,a?e.jsx("p",{className:"truncate text-muted-foreground",title:a,children:a}):null]})}const bn={read:"Read half. Consumes the shuffle written by its paired write half.",write:"Write half. Produces the shuffle its paired read half consumes."};function jn({node:t,onClose:s,onJumpToPaired:n}){const a=oe[t.category]??oe.transform,r=t.findings??[],o=t.metrics??[],i=t.category.charAt(0).toUpperCase()+t.category.slice(1);return e.jsxs("div",{"data-testid":"plan-node-detail",role:"dialog","aria-label":`Plan node detail: ${t.label}`,className:"flex h-full w-80 shrink-0 flex-col gap-3 overflow-y-auto border-l border-border bg-card p-3 text-xs",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:"shrink-0",children:a}),e.jsx("span",{className:"break-words font-medium",children:t.label})]}),e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:"size-6 shrink-0","aria-label":"Close node detail",onClick:s,children:e.jsx(jt,{className:"size-4"})})]}),e.jsxs("p",{className:"text-muted-foreground",children:[i," · Segment ",t.segmentIndex+1,t.durationSharePct!=null?e.jsxs(e.Fragment,{children:[" · ",e.jsxs("span",{className:"text-foreground",children:[t.durationSharePct,"%"]})," of plan stage time"]}):null]}),t.splitRole?e.jsxs(de,{title:"Exchange",children:[e.jsx("p",{className:"text-muted-foreground",children:bn[t.splitRole]}),t.exchangeShuffleBytes!=null?e.jsxs("p",{className:"mt-1 text-muted-foreground",children:["Shuffle written"," ",e.jsx("span",{className:"font-medium tabular-nums text-foreground",children:ze(t.exchangeShuffleBytes)})]}):t.label.startsWith("Broadcast")?e.jsx("p",{className:"mt-1 text-muted-foreground",children:"Broadcast, no shuffle"}):null,t.pairedNodeId&&n?e.jsxs(Q,{type:"button",variant:"outline",size:"sm",className:"mt-2 h-7 w-full justify-start gap-1.5",onClick:()=>n(t.pairedNodeId),children:[e.jsx(Yt,{className:"size-3.5","aria-hidden":"true"}),"Jump to ",t.splitRole==="read"?"write":"read"," half"]}):null]}):null,r.length>0?e.jsx(de,{title:"Findings",children:e.jsx("ul",{className:"flex flex-col gap-1.5",children:r.map((l,c)=>e.jsxs("li",{className:"flex items-start gap-1.5",children:[e.jsx($e,{type:l.type,impactBand:l.impactBand,className:"shrink-0"}),e.jsx("span",{className:"break-words",children:He(l)})]},l.id??`${l.type}-${c}`))})}):null,o.length>0?e.jsx(de,{title:"Metrics",children:e.jsx("dl",{className:"grid grid-cols-[1fr_auto] gap-x-3 gap-y-1",children:o.map((l,c)=>e.jsxs("div",{className:"contents",children:[e.jsx("dt",{className:"min-w-0 break-words text-muted-foreground",children:l.name}),e.jsx("dd",{className:"text-right font-medium tabular-nums",children:l.value})]},`${l.name}-${c}`))})}):null,t.detailText?e.jsx(de,{title:"Plan detail",children:e.jsx("pre",{"data-testid":"plan-node-detail-text",className:"max-h-48 overflow-auto whitespace-pre-wrap break-words rounded bg-muted p-2 font-mono text-[11px] leading-snug",children:t.detailText})}):null]})}function de({title:t,children:s}){return e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 font-medium text-muted-foreground",children:t}),s]})}const yn=[{category:"scan",label:"Scan"},{category:"filter",label:"Filter"},{category:"join",label:"Join"},{category:"aggregate",label:"Aggregate"},{category:"sort",label:"Sort"},{category:"exchange",label:"Exchange"},{category:"transform",label:"Transform"}];function wn(){return e.jsxs("div",{"data-testid":"plan-graph-legend",role:"region","aria-label":"Plan graph legend",className:"flex max-w-md flex-col gap-2 rounded-md border border-border bg-card p-3 text-xs shadow-md",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 font-medium text-muted-foreground",children:"Operators"}),e.jsx("div",{className:"flex flex-wrap gap-x-3 gap-y-1",children:yn.map(({category:t,label:s})=>e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{"aria-hidden":"true",children:oe[t]}),s]},t))})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 font-medium text-muted-foreground",children:"Duration share"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:Y("h-1.5 w-6 rounded-full",ce.info)})," low"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:Y("h-1.5 w-6 rounded-full",ce.warning)})," medium"]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx("span",{className:Y("h-1.5 w-6 rounded-full",ce.critical)})," high"]})]})]}),e.jsxs("p",{className:"text-muted-foreground",children:[e.jsx("span",{className:"text-foreground",children:"Edge thickness"})," = shuffle bytes moved across an exchange."]}),e.jsxs("p",{className:"text-muted-foreground",children:["A ",e.jsx("span",{className:"text-foreground",children:"segment"})," box groups one Exchange-bounded stage of the plan; a"," ",e.jsx("span",{className:"text-foreground",children:"stage"})," box (full-plan view) wraps every segment of one Spark stage."]})]})}function Nn({...t}){return e.jsx(ot,{"data-slot":"popover",...t})}function vn({...t}){return e.jsx(rt,{"data-slot":"popover-trigger",...t})}function Sn({align:t="center",alignOffset:s=0,side:n="bottom",sideOffset:a=8,className:r,...o}){return e.jsx(it,{children:e.jsx(lt,{className:"isolate z-50 outline-none",align:t,alignOffset:s,side:n,sideOffset:a,children:e.jsx(dt,{"data-slot":"popover-content",className:Y("z-50 w-72 origin-(--transform-origin) rounded-lg bg-popover p-3 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95 motion-reduce:animate-none",r),...o})})})}function qe({ariaLabel:t,name:s,options:n,value:a,onChange:r,trailingContent:o}){return e.jsx(We,{children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",role:"radiogroup","aria-label":t,children:[n.map(i=>e.jsxs(Se,{children:[e.jsxs(ke,{render:e.jsx("label",{className:"tap-target-comfortable flex min-h-8 items-center gap-1.5 px-1 text-sm"}),children:[e.jsx("input",{type:"radio",name:s,value:i.value,checked:a===i.value,onChange:()=>r(i.value)}),i.label]}),e.jsx(Ee,{children:i.description})]},i.value)),o]})})}const kn=[{value:"io",label:"I/O only",description:"Show only scan and exchange nodes, where the plan reads or shuffles/broadcasts data."},{value:"basic",label:"Basic",description:"Add join, aggregate, sort, and filter nodes to I/O; hide pass-through and boilerplate operators like Project or WholeStageCodegen."},{value:"advanced",label:"Advanced",description:"Show every operator, including the pass-through and boilerplate nodes the other two modes hide."}];function En({mode:t,onChange:s,hiddenCount:n}){return e.jsx(qe,{ariaLabel:"Node filter",name:"plan-graph-filter",options:kn,value:t,onChange:s,trailingContent:n>0?e.jsx(Fe,{label:`${n} nodes hidden`,impactBand:"info"}):null})}const In=[{value:"exclusive",label:"Node only",description:"Each node's share reflects time spent in that operator alone, excluding its descendants."},{value:"inclusive",label:"Node + descendants",description:"Each node's share adds in every descendant operator's time, so an ancestor's bar reflects its whole subtree."}];function Pn({mode:t,onChange:s}){return e.jsx(qe,{ariaLabel:"Duration heat bar scope",name:"plan-graph-duration-mode",options:In,value:t,onChange:s})}function Cn({filterMode:t,onFilterModeChange:s,hiddenCount:n,durationMode:a,onDurationModeChange:r,iconOnly:o=!1}){return e.jsxs(Nn,{children:[e.jsxs(vn,{"aria-label":o?"Settings":void 0,title:o?"Settings":void 0,className:Y(yt({variant:"ghost",size:o?"icon":"sm"}),"tap-target-comfortable",o?void 0:"gap-1.5"),children:[e.jsx(Qt,{"aria-hidden":"true"}),o?null:"Settings"]}),e.jsxs(Sn,{align:o?"start":"end",side:o?"right":"bottom","aria-label":"Plan graph settings",className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Node filter"}),e.jsx(En,{mode:t,onChange:s,hiddenCount:n})]}),e.jsx("div",{"aria-hidden":"true",className:"h-px bg-border"}),e.jsxs("div",{children:[e.jsx("h2",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Duration attribution"}),e.jsx(Pn,{mode:a,onChange:r})]})]})]})}const be=t=>t.data;function Mn({planNodes:t,problemNodes:s,filterMode:n,onFilterModeChange:a,hiddenCount:r,durationMode:o,onDurationModeChange:i,legendOpen:l,onToggleLegend:c,miniMapOpen:g,onToggleMiniMap:m}){const{zoomIn:j,zoomOut:k,fitView:N,setCenter:I}=Xe(),[M,_]=p.useState(null),[B,A]=p.useState(null),R=[...t].filter(x=>be(x).durationSharePct!=null).sort((x,O)=>(be(O).durationSharePct??0)-(be(x).durationSharePct??0)),F=x=>{x&&I(x.position.x,x.position.y,{zoom:1,duration:300})},T=(x,O,L)=>{if(x.length===0)return;const z=O?x.findIndex(f=>f.id===O):-1,u=x[(z+1)%x.length];F(u),L(u.id)};return e.jsxs("div",{className:"flex w-12 shrink-0 flex-col items-center gap-1 border-r border-border bg-card/60 py-2",children:[e.jsxs(je,{children:[e.jsx(K,{label:"Zoom in",onClick:()=>j({duration:200}),children:e.jsx(sn,{"aria-hidden":"true"})}),e.jsx(K,{label:"Zoom out",onClick:()=>k({duration:200}),children:e.jsx(on,{"aria-hidden":"true"})}),e.jsx(K,{label:"Fit to view",onClick:()=>N({duration:200}),children:e.jsx(Jt,{"aria-hidden":"true"})})]}),e.jsx(Re,{}),e.jsxs(je,{children:[e.jsx(K,{label:"Next worst duration",disabled:R.length===0,onClick:()=>T(R,M,_),children:e.jsx(tn,{"aria-hidden":"true"})}),s.length>0?e.jsx(K,{label:"Next problem",onClick:()=>T(s,B,A),children:e.jsx(qt,{"aria-hidden":"true"})}):null]}),e.jsx(Re,{}),e.jsxs(je,{children:[e.jsx(Cn,{iconOnly:!0,filterMode:n,onFilterModeChange:a,hiddenCount:r,durationMode:o,onDurationModeChange:i}),e.jsx(K,{label:l?"Hide legend":"Legend",pressed:l,onClick:c,children:e.jsx(wt,{"aria-hidden":"true"})}),e.jsx(K,{label:g?"Hide minimap":"Show minimap",pressed:g,onClick:m,children:e.jsx(Zt,{"aria-hidden":"true"})})]})]})}function je({children:t}){return e.jsx("div",{className:"flex flex-col items-center gap-1",children:t})}function Re(){return e.jsx("div",{"aria-hidden":"true",className:"my-0.5 h-px w-6 bg-border"})}function K({label:t,onClick:s,disabled:n,pressed:a,children:r}){return e.jsx(Q,{type:"button",variant:"ghost",size:"icon",className:Y("tap-target-comfortable",a&&"bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary"),"aria-label":t,title:t,"aria-pressed":a,disabled:n,onClick:s,children:r})}function Tn(t){if(t.type!=="planNode")return"var(--muted)";const s=t.data.findings??[],n=Nt(s);return n?It[n]:"var(--plan-aggregate)"}function Ve({finding:t,className:s}){const n=vt(t);return e.jsxs("span",{className:"inline-flex items-center gap-1",children:[e.jsx($e,{type:t.type,impactBand:t.impactBand,className:s}),n?e.jsx("span",{className:"font-mono text-[10px] leading-none whitespace-nowrap text-muted-foreground",children:n}):null]})}function Dn({data:t}){const{width:s,height:n,stageId:a,durationLabel:r,findings:o}=t;return e.jsx("div",{className:"overflow-hidden rounded-lg border border-dashed border-border/70 bg-muted/10 nopan nodrag",style:{width:s,height:n,pointerEvents:"all"},children:e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 px-2 py-1 text-xs text-muted-foreground",children:[e.jsx("span",{title:a==null?"This plan segment couldn't be matched to a specific Spark stage":void 0,children:a!=null?`Stage ${a}`:"Stage —"}),e.jsx(Fe,{label:r??"—",impactBand:"info",title:"Approximate share of this stage's wall time"}),o.length>0?e.jsx("div",{className:"ml-auto flex min-w-0 flex-wrap items-center justify-end gap-1",children:o.map((i,l)=>e.jsx(Ve,{finding:i,className:"h-4 gap-1 px-1.5 text-xs"},i.id??`${i.type}-${l}`))}):null]})})}function Gn({data:t}){const{width:s,height:n,stageId:a,findings:r,showOwnFindings:o=!0,onSelect:i}=t;return e.jsxs("div",{className:"relative rounded-xl border border-primary/25 bg-primary/5 nopan nodrag",style:{width:s,height:n,pointerEvents:"all"},children:[e.jsx("button",{type:"button","aria-label":`Focus stage ${a}`,onClick:i,style:{pointerEvents:"auto"},className:"absolute inset-0 size-full cursor-pointer rounded-xl transition-colors hover:border-primary/50 hover:bg-primary/10"}),o&&r.length>0?e.jsx("div",{className:"absolute left-2 right-2 top-1 flex flex-wrap gap-1",children:r.map((l,c)=>e.jsx(Ve,{finding:l,className:"h-4 gap-1 px-1.5 text-xs"},l.id??`${l.type}-${c}`))}):null,e.jsxs("span",{className:"absolute right-2 bottom-1 text-xs font-medium text-primary",children:["Stage ",a]})]})}const Be=1.5,_n=9,Ae=.55,Rn=1;function Ze(t,s){return!(t>0)||!(s>0)?0:Math.min(1,Math.log(t+1)/Math.log(s+1))}function Bn(t,s){const n=Ze(t,s);return Be+(_n-Be)*n}function An(t,s){const n=Ze(t,s);return Ae+(Rn-Ae)*n}function On({sourceX:t,sourceY:s,targetX:n,targetY:a,sourcePosition:r,targetPosition:o,markerEnd:i,data:l}){const[c,g,m]=Bt({sourceX:t,sourceY:s,targetX:n,targetY:a,sourcePosition:r,targetPosition:o}),{shuffleBytes:j=0,maxShuffleBytes:k=0}=l??{},N=Bn(j,k),I=An(j,k),M=j>0&&j<1e3?"<1 KB":ze(j);return e.jsxs(e.Fragment,{children:[e.jsx(At,{path:c,markerEnd:i,style:{stroke:"var(--text-muted)",strokeWidth:N,strokeOpacity:I}}),e.jsx(Ot,{children:e.jsxs(Se,{children:[e.jsx(ke,{"data-testid":"exchange-edge-label",className:"nodrag nopan pointer-events-auto absolute cursor-help rounded bg-card/90 px-1 py-0.5 font-mono text-[10px] leading-none text-muted-foreground ring-1 ring-border",style:{transform:`translate(-50%, -50%) translate(${g}px, ${m}px)`},children:M}),e.jsx(Ee,{className:"max-w-xs",children:e.jsxs("p",{children:[M," of shuffle written across this exchange. Edge thickness scales with the volume moved."]})})]})})]})}const zn={planNode:xn,segmentGroup:Dn,stageGroup:Gn},$n={exchange:On},Fn=1,Ln=2,Hn=3,Xn=t=>t.data,ue={padding:.06,maxZoom:1.75};function Yn({resizeTick:t,fitSignal:s,centerRequest:n}){const{fitView:a,setCenter:r,getNode:o}=Xe();return p.useEffect(()=>{if(!n||n.token===0||!n.nodeId)return;const i=o(n.nodeId);i?r(i.position.x,i.position.y,{zoom:1,duration:300}):a({nodes:[{id:n.nodeId}],duration:300,maxZoom:1})},[n,r,o,a]),p.useEffect(()=>{const i=()=>a({duration:200,...ue});return window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[a]),p.useEffect(()=>{t!==0&&a({duration:200,...ue})},[t,a]),p.useEffect(()=>{s!==0&&a({duration:300,...ue})},[s,a]),null}function Wn(){const t=p.useRef(null),[s,n]=p.useState(0);return p.useEffect(()=>{const a=t.current;if(!a)return;let r=!0;const o=new ResizeObserver(()=>{if(r){r=!1;return}n(i=>i+1)});return o.observe(a),()=>o.disconnect()},[]),{ref:t,tick:s}}function ye(t,s){return t.filter(n=>n.stageId===s||n.stageIds?.includes(s))}function qn({model:t,showMiniMap:s,findings:n=[],stageId:a,segmentStageIds:r,visibleNodeIds:o,visibleEdges:i,onSelectStage:l,selectedNodeId:c=null,onSelectNode:g,onJumpToPaired:m,centerRequest:j,fitSignal:k=0,filterMode:N="basic",onFilterModeChange:I=()=>{},hiddenCount:M=0,durationMode:_="exclusive",onDurationModeChange:B=()=>{}}){const{flowNodes:A,flowEdges:R}=p.useMemo(()=>{const h=t.nodes.reduce((d,w)=>d+(w.exclusiveDurationShare??w.durationShare??0),0),v=d=>`segment-${d.segmentIndex}`,P=t.scope==="full",C=d=>{const w=r?.get(d.segmentIndex);return w!=null?`stage-${w}`:null},D=o?me(t.nodes.filter(d=>o.has(d.id)),i??t.edges,{groupOf:v}):me(t.nodes,t.edges,{groupOf:v}),V=new Set(D.map(v)),$=P?new Set(D.map(C).filter(d=>d!=null)):null,J=t.nodes.some(d=>!V.has(v(d)))||$!=null&&t.nodes.some(d=>{const w=C(d);return w!=null&&!$.has(w)})?me(t.nodes,t.edges,{groupOf:v}):D,S=D.map(d=>{const w=d.durationShare!=null&&h>0?Math.round(d.durationShare/h*100):null,W=d.splitRole==="read"?`${d.label}, paired: see write half`:[d.label,d.operatorDetail,d.primaryMetric,w!=null?`${w}% of the plan's total stage duration`:null].filter(Boolean).join(", ");return{id:d.id,type:"planNode",position:d.position,draggable:!1,zIndex:Hn,measured:{width:se,height:ae},ariaLabel:W,ariaRole:"button",data:{...d,durationSharePct:w}}}),te=xe(v,[D,J]).map(d=>{const w=Number(d.id.replace("segment-","")),W=t.nodes.filter(q=>v(q)===d.id),E=W.reduce((q,b)=>q+(b.exclusiveDurationShare??b.durationShare??0),0),X=W.some(q=>q.durationShare!=null),ne=r?.get(w)??null,ie=ne!=null?ye(n,ne):[];return{id:d.id,type:"segmentGroup",position:d.position,draggable:!1,selectable:!1,focusable:!1,zIndex:Ln,style:{width:d.width,height:d.height},measured:{width:d.width,height:d.height},data:{width:d.width,height:d.height,stageId:ne,durationLabel:X?St(E):null,findings:ie}}}),ge=new Set(te.map(d=>d.data.stageId).filter(d=>d!=null)),he=P?(()=>{const d={paddingX:cn,paddingY:Ye,headerHeight:un},w=xe(C,[D,J],d),W=`stage-${a}`;if(ye(n,a).length>0&&!w.some(E=>E.id===W)){const[E]=xe(()=>W,[D,J],d);E&&w.push(E)}return w.map(E=>{const X=Number(E.id.replace("stage-",""));return{id:E.id,type:"stageGroup",position:E.position,draggable:!1,selectable:!1,focusable:!1,zIndex:Fn,style:{width:E.width,height:E.height},measured:{width:E.width,height:E.height},data:{width:E.width,height:E.height,stageId:X,findings:ye(n,X),showOwnFindings:!ge.has(X),onSelect:()=>l?.(X)}}})})():[],re=i??t.edges,pe=re.reduce((d,w)=>Math.max(d,w.shuffleBytes??0),0),fe=re.map(d=>d.shuffleBytes?{id:d.id,source:d.source,target:d.target,type:"exchange",data:{shuffleBytes:d.shuffleBytes,maxShuffleBytes:pe}}:{id:d.id,source:d.source,target:d.target});return{flowNodes:[...he,...te,...S],flowEdges:fe}},[t,n,a,r,o,i,l]),{ref:F,tick:T}=Wn(),[x,O]=p.useState(!0),[L,z]=p.useState(!0),u=c?A.find(h=>h.id===c&&h.type==="planNode"):void 0,f=A.filter(h=>h.type==="planNode"),y=A.filter(h=>h.type==="stageGroup"&&(h.data.findings?.length??0)>0).sort(Ht(h=>h.data.findings??[])),ee=o!=null&&o.size===0&&t.nodes.length>0,H=h=>{if(h.key!=="Enter"&&h.key!==" ")return;const P=h.target.closest(".react-flow__node-planNode")?.getAttribute("data-id");P&&(h.preventDefault(),g?.(P))};return e.jsx(zt,{children:e.jsx(We,{children:e.jsxs("div",{ref:F,className:"flex min-h-0 flex-1",children:[e.jsx(Mn,{planNodes:f,problemNodes:y,filterMode:N,onFilterModeChange:I,hiddenCount:M,durationMode:_,onDurationModeChange:B,legendOpen:x,onToggleLegend:()=>O(h=>!h),miniMapOpen:s&&L,onToggleMiniMap:()=>z(h=>!h)}),e.jsx("div",{className:"relative min-w-0 flex-1",onKeyDown:H,children:e.jsxs($t,{nodes:A,edges:R,nodeTypes:zn,edgeTypes:$n,"aria-label":"Plan graph. Operators and the data flowing between them. Tab to move between operators, Enter to open an operator's details.",fitView:!0,fitViewOptions:ue,minZoom:.05,edgesFocusable:!1,onNodeClick:(h,v)=>{v.type==="planNode"&&g?.(v.id)},onPaneClick:()=>g?.(null),children:[e.jsx(Ft,{}),e.jsx(Yn,{resizeTick:T,fitSignal:k,centerRequest:j}),ee?e.jsx(Ge,{position:"top-center",children:e.jsxs("p",{role:"status",className:"rounded-md border border-border bg-card px-3 py-2 text-xs text-muted-foreground shadow-sm",children:["All ",t.nodes.length," operators are hidden by the node filter. Change it in Settings to show them."]})}):null,x?e.jsx(Ge,{position:"bottom-left",children:e.jsx(wn,{})}):null,s&&L?e.jsx(Lt,{nodeColor:Tn,pannable:!0,zoomable:!0,ariaLabel:"Plan overview. Drag to pan and scroll to zoom the graph."}):null]})}),u?e.jsx(jn,{node:Xn(u),onClose:()=>g?.(null),onJumpToPaired:m}):null]})})})}function Vn({open:t,nodeCount:s,onConfirm:n,onCancel:a}){return e.jsx(Pt,{open:t,onOpenChange:r=>{r||a()},children:e.jsxs(Ct,{children:[e.jsx(Mt,{children:e.jsx(Tt,{children:"Expand to full plan?"})}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["This plan has ",s," nodes. Rendering the full graph may take several seconds."]}),e.jsxs(Dt,{children:[e.jsx(Q,{type:"button",variant:"outline",size:"sm",onClick:a,children:"Cancel"}),e.jsx(Q,{type:"button",size:"sm",onClick:n,children:"Expand anyway"})]})]})})}const Zn={io:["scan","exchange"],basic:["scan","exchange","join","aggregate","sort","filter"],advanced:null},we=300;function Un(t,s){const n=new Map;for(const l of t){const c=n.get(l.source);c?c.push(l.target):n.set(l.source,[l.target])}const a=new Map;function r(l){const c=a.get(l);if(c)return c;const g=new Set;a.set(l,g);for(const m of n.get(l)??[])if(s.has(m))g.add(m);else for(const j of r(m))g.add(j);return g}const o=new Map;for(const l of t)l.shuffleBytes&&o.set(`${l.source}->${l.target}`,l.shuffleBytes);const i=[];for(const l of s)for(const c of r(l)){const g={id:`${l}=>${c}`,source:l,target:c},m=o.get(`${l}->${c}`);m&&(g.shuffleBytes=m),i.push(g)}return i}function Jn(t,s){try{return ln(t,s)}catch{return null}}const ve=new Map;function Kn(t,s,n,a){return`${t??"none"}::${s}::${n}::${a}`}function Qn(){ve.clear()}let Oe=Le.getState().modelResetCount;Le.subscribe(t=>{t.modelResetCount!==Oe&&(Oe=t.modelResetCount,Qn())});function Ne(t,s,n){const a=Kn(n,s.stageId,s.scope,s.durationMode),r=ve.get(a);if(r)return r;const o=Jn(t,s);return o&&ve.set(a,o),o}function is({stageId:t,appModel:s,findings:n,activeFileId:a,onClose:r,initialScope:o}){const{resetToDropZone:i}=kt(),{recentEntries:l,onPickRecent:c,onRemoveRecent:g}=Gt(a),[m,j]=p.useState("basic"),[k,N]=p.useState("exclusive"),[I,M]=p.useState(o??"segment"),[_,B]=p.useState(!1),[A,R]=p.useState(o!=="full"),[F,T]=p.useState(!1),[x,O]=p.useState(t),[L,z]=p.useState(null),[u,f]=p.useState(0),[y,ee]=p.useState({nodeId:null,token:0}),[H,h]=p.useState(null),v=b=>ee(G=>({nodeId:b,token:G.token+1}));p.useEffect(()=>{z(null)},[x,I,m]);const P=_t(x,s),C=P?Ne(P,{scope:"segment",stageId:x,appModel:s,findings:n,durationMode:k},a):null,D=C!=null&&C.scope==="full"&&I==="segment"&&C.nodes.length>we,V=D&&!F;p.useEffect(()=>{V&&B(!0)},[V]);const $=P&&(I==="full"||_)?Ne(P,{scope:"full",stageId:x,appModel:s,findings:n,durationMode:k},a):null,Z=!A&&I==="full"&&$!=null&&$.nodes.length>we,J=_||Z;p.useEffect(()=>{const b=G=>{G.key!=="Escape"||J||(L?z(null):r())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[r,J,L]);const S=D||Z?null:I==="full"?$:C;p.useEffect(()=>{!H||I!=="full"||S?.nodes.some(b=>b.id===H)&&(z(H),v(H),h(null))},[H,I,S]);function te(){const b=P?Ne(P,{scope:"full",stageId:x,appModel:s,findings:n,durationMode:k},a):null;b&&b.nodes.length>we?B(!0):(M("full"),f(G=>G+1))}function ge(){M("segment"),f(b=>b+1)}function he(b){if(S?.nodes.some(G=>G.id===b)){z(b),v(b);return}h(b),te()}const re=p.useCallback(b=>{O(b),M("segment"),R(!0),T(!1),h(null),f(G=>G+1)},[]);function pe(){R(!0),M("full"),B(!1),f(b=>b+1)}function fe(){B(!1),h(null),Z&&(R(!0),M("segment"),C?.scope==="full"&&T(!0)),V&&T(!0)}function d(b){return r(),c(b)}const{visibleNodeIds:w,filteredEdges:W,hiddenNodes:E}=p.useMemo(()=>{const b=Zn[m],G=new Set;if(S)for(const le of S.nodes)(!b||b.includes(le.category))&&G.add(le.id);const Ue=S?Un(S.edges,G):[],Je=S?S.nodes.filter(le=>!G.has(le.id)):[];return{visibleNodeIds:G,filteredEdges:Ue,hiddenNodes:Je}},[S,m]),X=S?.scope==="full",ne=I==="full",ie=p.useId(),q=X&&!ne;return e.jsxs("div",{"data-testid":"dashboard",className:"flex h-screen flex-col",style:{paddingRight:"var(--docs-inset, 0px)"},children:[e.jsx(Rt,{onLoadNew:i,recentEntries:l,activeFileId:a,onPickRecent:d,onRemoveRecent:g,leadingContent:e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h1",{className:"truncate font-heading text-sm font-semibold",children:["Plan graph: Stage ",x]}),S&&S.scope==="segment"?e.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["Segment ",S.segmentIndex+1," of ",S.segmentCount]}):null,e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.jsx(Et,{anchor:"#bottleneck-duplicate-plan-subtree",children:"Plan Advisor docs"})})]}),sectionControls:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-end gap-0.5",children:[e.jsx(Q,{type:"button",variant:"outline",size:"sm",disabled:q,"aria-describedby":q?ie:void 0,onClick:X?ge:te,children:X?"Back to segment view":"Expand to full plan"}),q?e.jsx("p",{id:ie,className:"text-xs text-muted-foreground",children:"This stage's plan couldn't be scoped to a single segment"}):null]}),e.jsx(Q,{variant:"ghost",size:"sm",onClick:r,children:"Close"})]})}),e.jsx("div",{className:"flex flex-1 flex-col overflow-hidden",children:Z?null:!P||!S?e.jsx("p",{role:"alert",className:"p-6 text-sm text-destructive",children:D?'This plan has more nodes than the graph view can safely render without expanding. Click "Expand to full plan" to confirm.':"Couldn't build the plan graph for this stage."}):e.jsx(qn,{model:S,visibleNodeIds:w,visibleEdges:W,showMiniMap:!0,findings:n,stageId:x,segmentStageIds:S.segmentStageIds,onSelectStage:re,selectedNodeId:L,onSelectNode:z,onJumpToPaired:he,centerRequest:y,fitSignal:u,filterMode:m,onFilterModeChange:j,hiddenCount:E.length,durationMode:k,onDurationModeChange:N})}),e.jsx(Vn,{open:J,nodeCount:$?.nodes.length??0,onConfirm:pe,onCancel:fe})]})}export{is as PlanGraphRoute,Qn as clearPlanGraphModelCache,Un as collapseHiddenEdges};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as t}from"./react-vendor-DA6opS-q.js";import{at as N,L as p,W as P,q as g,as as h,T,n as f,I as w,A as C}from"./index-CHjV2-jB.js";import{S as E}from"./StagePill-CYCMdlIx.js";import{W as O}from"./WidgetLeadSummary-DRNRVvn7.js";import{u as M}from"./finding-anchor-4TmpXd7j.js";import{I as b}from"./ImpactEstimate-C6GzFOY9.js";import{c as D}from"./impact-sort-Cq6KOLqh.js";import{u as $,S as F}from"./useSortMode-BOPpfLhJ.js";import{R as L}from"./RowPagination-DypWbnic.js";import{u as _}from"./usePagedRows-CFoZrPr4.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./toggle-group-lbIXRG0W.js";import"./useRecentFiles-BPGQ6XII.js";function q(a){return a.stageId!=null}function V(a){return String(a.extended??"").replace(/, wasting \d+s of executor time\./,".")}function k(a){const s=String(a.recommendation??""),n=s.indexOf(": ");return n===-1?s:s.slice(n+2)}function z({finding:a}){const s=M([a]);return t.jsxs("li",{ref:s.ref,tabIndex:s.tabIndex,"data-flashed":s.dataFlashed,className:`flex flex-col gap-1 transition-colors ${s.flashClassName}`,children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(E,{stageId:a.stageId}),t.jsx(w,{impactBand:a.impactBand})]}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Wasted ",t.jsx("strong",{children:g(h(a))})," of executor time.",a.extended?t.jsxs(C,{children:[" ",V(a)]}):null]}),a.recommendation?t.jsx("p",{className:"text-xs text-muted-foreground",children:k(a)}):null,t.jsx(b,{finding:a})]})}function oe({appModel:a,catalog:s,defaultCollapsed:n=!0}){const[j,o]=c.useState(0),{sortMode:y,setSortMode:R,orderBy:v}=$(),[m,I]=c.useState(!n),i=N(),l=c.useRef(!1);c.useEffect(()=>{if(!l.current){l.current=!0;return}o(0)},[a]);const r=s.filter(q).filter(e=>e.type==="retryWaste"),u=[...r].sort((e,d)=>p[e.impactBand]-p[d.impactBand]||(typeof d.value=="number"?d.value:0)-(typeof e.value=="number"?e.value:0)),x=v(u,e=>[e],e=>e.stageId),S=i?x.findIndex(e=>e===i.finding):null,{totalPages:W,effectivePage:B,visible:A}=_(x,j,o,S);return r.length===0?null:t.jsxs(P,{title:"Retry Waste",impactBand:f(r),badges:t.jsxs(t.Fragment,{children:[t.jsx(T,{type:"retryWaste",impactBand:f(r)}),D(r,r.length,m)?t.jsx(F,{mode:y,onChange:e=>{R(e),o(0)}}):null]}),open:m,onOpenChange:I,summary:t.jsx(O,{value:g(h(u[0])),context:`${r.length} item${r.length===1?"":"s"} flagged`}),children:[t.jsx("ul",{className:"space-y-3",children:A.map(e=>t.jsx(z,{finding:e},e.id))}),t.jsx(L,{page:B,totalPages:W,onPrev:()=>o(e=>e-1),onNext:()=>o(e=>e+1)})]})}export{oe as RetryWaste};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t}from"./react-vendor-DA6opS-q.js";import{B as r}from"./index-CHjV2-jB.js";function m({page:e,totalPages:s,onPrev:i,onNext:n,renderJumpControl:a}){return s<=1?null:t.jsxs("div",{className:`flex flex-wrap items-center gap-2 text-xs ${a?"justify-between":"justify-end"}`,children:[a?.(),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(r,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable tap-target-comfortable--sm",onClick:i,disabled:e===0,children:"Previous"}),t.jsxs("span",{className:"text-muted-foreground",children:["Page ",e+1," of ",s]}),t.jsx(r,{type:"button",variant:"ghost",size:"sm",className:"tap-target-comfortable tap-target-comfortable--sm",onClick:n,disabled:e===s-1,children:"Next"})]})]})}export{m as R};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as g,j as e}from"./react-vendor-DA6opS-q.js";import{S as M,a as F,b as L,c as _,d as V}from"./select-D5fK-za0.js";import{at as $,as as T,L as R,W as P,j as d,n as D,av as E,T as J,E as H,aw as q}from"./index-CHjV2-jB.js";import{W as N}from"./WidgetLeadSummary-DRNRVvn7.js";import{a as z}from"./StagePill-CYCMdlIx.js";import{S as G}from"./StageHeader-uDBLHgdg.js";import{u as K,R as Q}from"./finding-anchor-4TmpXd7j.js";import{I as U}from"./ImpactEstimate-C6GzFOY9.js";import{c as X}from"./impact-sort-Cq6KOLqh.js";import{u as Y,S as Z}from"./useSortMode-BOPpfLhJ.js";import{R as ee}from"./RowPagination-DypWbnic.js";import{u as se}from"./usePagedRows-CFoZrPr4.js";import{P as te}from"./PlanExplorer-xYFme_Rx.js";import{r as ae}from"./useRecentFiles-BPGQ6XII.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./toggle-group-lbIXRG0W.js";function re({entry:r,appModel:o}){const c=H(),n=K([r.shuffle]),l=o.stages.get(r.stageId),a=l?q(l):null,i=c==="advanced"&&ae(r.stageId,o);return e.jsxs("div",{ref:n.ref,tabIndex:n.tabIndex,"data-flashed":n.dataFlashed,className:`space-y-2 ${Q} transition-colors ${n.flashClassName}`,children:[e.jsx(G,{stageId:r.stageId,appModel:o}),e.jsxs("p",{className:"text-sm",children:["Shuffle read: ",e.jsx("strong",{children:d(T(r.shuffle))})," · ","Write: ",d(l?.shuffleWriteBytes??0)]}),e.jsx(U,{finding:r.shuffle}),a||i?e.jsxs("div",{className:"space-y-2 pt-1",children:[a?e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Try ",e.jsxs("code",{children:["spark.sql.shuffle.partitions = ",a.recommended]}),": current"," ",a.current," tasks, target 128 MB per partition"]}):null,i?e.jsx(te,{stageId:r.stageId,appModel:o}):null]}):null]})}const Be=g.memo(function({appModel:o,catalog:c,defaultCollapsed:n=!0}){const[l,a]=g.useState(0),[i,h]=g.useState(!n),{sortMode:x,setSortMode:C,orderBy:O}=Y(),I=$(),{shuffleFindings:p,sorted:m,orderedEntries:f}=g.useMemo(()=>{const s=c.filter(t=>t.type==="shuffle"),v=[...s.filter(t=>t.stageId!=null).map(t=>({stageId:t.stageId,shuffle:t,impactBand:t.impactBand,peak:T(t)}))].sort((t,B)=>R[t.impactBand]-R[B.impactBand]||B.peak-t.peak),A=O(v,t=>[t.shuffle],t=>t.stageId);return{shuffleFindings:s,sorted:v,orderedEntries:A}},[c,x]),k=I?f.findIndex(s=>s.shuffle===I.finding):null,{totalPages:w,effectivePage:S,visible:W}=se(f,l,a,k);if(p.length===0){let s=0;for(const u of o.stages.values())s=Math.max(s,u.shuffleReadBytes??0);return e.jsx(P,{title:"Shuffle I/O",open:i,onOpenChange:h,summary:e.jsx(N,{value:d(s),context:"no issue detected: peak shuffle read"}),children:e.jsx("div",{className:"flex flex-col gap-1",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No shuffle read/write issues detected."})})})}const j=D(p),b=f.map(s=>({id:s.stageId})),y=X(p,m.length,i);return e.jsx(P,{title:"Shuffle I/O",impactBand:j,open:i,onOpenChange:h,summary:e.jsx(N,{value:d(m[0].peak),context:`Peak shuffle read · ${m.length} stage${m.length===1?"":"s"} flagged`}),badges:e.jsxs(e.Fragment,{children:[e.jsx(J,{type:"shuffle",impactBand:j??"info"}),y?e.jsx(Z,{mode:x,onChange:s=>{C(s),a(0)}}):null]}),children:e.jsxs("div",{className:"space-y-4",children:[e.jsx(z,{pills:b}),W.map(s=>e.jsx(re,{entry:s,appModel:o},s.stageId)),e.jsx(ee,{page:S,totalPages:w,onPrev:()=>a(s=>s-1),onNext:()=>a(s=>s+1),renderJumpControl:()=>e.jsxs(M,{value:String(S*E),onValueChange:s=>a(Math.floor(Number(s)/E)),children:[e.jsx(F,{size:"sm","aria-label":"Jump to stage",children:e.jsx(L,{placeholder:"Jump to stage"})}),e.jsx(_,{children:f.map((s,u)=>e.jsxs(V,{value:String(u),children:["Stage ",s.stageId," (",d(s.peak),")"]},s.stageId))})]})})]})})});export{Be as ShuffleIO};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,j as o}from"./react-vendor-DA6opS-q.js";import{ar as m,as as p}from"./index-CHjV2-jB.js";import{S as e}from"./StageFindingGroup-CoVdEZYs.js";import"./charts-vendor-Cf1-wzeH.js";import"./plan-graph-vendor-B96a-e4N.js";import"./WidgetLeadSummary-DRNRVvn7.js";import"./useRecentFiles-BPGQ6XII.js";import"./StageHeader-uDBLHgdg.js";import"./StagePill-CYCMdlIx.js";import"./DurationHistogram-CviQyPNM.js";import"./finding-anchor-4TmpXd7j.js";import"./ImpactEstimate-C6GzFOY9.js";import"./impact-sort-Cq6KOLqh.js";import"./useSortMode-BOPpfLhJ.js";import"./toggle-group-lbIXRG0W.js";import"./RowPagination-DypWbnic.js";import"./usePagedRows-CFoZrPr4.js";import"./PlanExplorer-xYFme_Rx.js";function a(r){return`${r.metric}: ${m("ratio",p(r))}`}const F=i.memo(function(t){return o.jsx(e,{...t,type:"skew",title:"Task Skew",idPrefix:"skew",findingLabel:a})});export{F as Skew};
|