semiotic 3.7.5 → 3.8.1
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/CLAUDE.md +63 -18
- package/README.md +121 -27
- package/agent-skill/semiotic-charts/SKILL.md +146 -0
- package/ai/cli.js +133 -45
- package/ai/componentMetadata.cjs +6 -1
- package/ai/dist/mcp-server.js +1741 -163
- package/ai/examples.md +174 -0
- package/ai/schema.json +2733 -536
- package/ai/surface-manifest.json +201 -0
- package/ai/system-prompt.md +20 -4
- package/dist/__tests__/scenarios/mcpProtocolTypes.d.ts +20 -0
- package/dist/components/AccessibleNavTree.d.ts +7 -1
- package/dist/components/CategoryColors.d.ts +1 -1
- package/dist/components/ChartContainer.d.ts +91 -0
- package/dist/components/ChartGrid.d.ts +11 -1
- package/dist/components/CircularBrush.d.ts +61 -0
- package/dist/components/ContextLayout.d.ts +5 -1
- package/dist/components/DirectManipulationControl.d.ts +63 -0
- package/dist/components/LinkedCharts.d.ts +3 -1
- package/dist/components/MobileAnnotationCalloutList.d.ts +13 -0
- package/dist/components/MobileChartContainer.d.ts +51 -0
- package/dist/components/MobileStandardControls.d.ts +68 -0
- package/dist/components/SmallMultipleChart.d.ts +84 -0
- package/dist/components/Tooltip/FlippingTooltip.d.ts +21 -0
- package/dist/components/ai/ChartRecipe.d.ts +16 -0
- package/dist/components/ai/IntentMark.d.ts +15 -0
- package/dist/components/ai/chartCapabilities.d.ts +8 -1
- package/dist/components/ai/chartCapabilityTypes.d.ts +26 -1
- package/dist/components/ai/chartClinic.d.ts +91 -0
- package/dist/components/ai/chartClinicMetadata.generated.d.ts +15 -0
- package/dist/components/ai/chartRecipeRegistry.d.ts +14 -0
- package/dist/components/ai/chartRecipes.d.ts +278 -0
- package/dist/components/ai/dataPitfallsBridge.d.ts +102 -0
- package/dist/components/ai/describeChart.d.ts +7 -0
- package/dist/components/ai/describeRecipeChart.d.ts +16 -0
- package/dist/components/ai/generativeChart.d.ts +28 -3
- package/dist/components/ai/intentManifest.d.ts +62 -0
- package/dist/components/ai/navigationTree.d.ts +3 -0
- package/dist/components/ai/observedSceneAudit.d.ts +72 -0
- package/dist/components/ai/readerGrounding.d.ts +83 -0
- package/dist/components/ai/recipeCapability.d.ts +8 -0
- package/dist/components/ai/recipeNavigation.d.ts +13 -0
- package/dist/components/ai/recipeSemantics.d.ts +11 -0
- package/dist/components/ai/repairChartConfig.d.ts +9 -0
- package/dist/components/ai/suggestCharts.d.ts +11 -1
- package/dist/components/ai/useNavigationSync.d.ts +17 -2
- package/dist/components/chartContainerMobile.d.ts +9 -0
- package/dist/components/charts/custom/GeoCustomChart.d.ts +48 -0
- package/dist/components/charts/custom/NetworkCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/OrdinalCustomChart.d.ts +8 -2
- package/dist/components/charts/custom/XYCustomChart.d.ts +11 -2
- package/dist/components/charts/geo/ChoroplethMap.d.ts +19 -2
- package/dist/components/charts/geo/DistanceCartogram.d.ts +15 -3
- package/dist/components/charts/geo/FlowMap.d.ts +11 -7
- package/dist/components/charts/geo/ProportionalSymbolMap.d.ts +15 -3
- package/dist/components/charts/geo/index.d.ts +2 -0
- package/dist/components/charts/index.d.ts +35 -1
- package/dist/components/charts/network/ChordDiagram.d.ts +10 -2
- package/dist/components/charts/network/CirclePack.d.ts +1 -1
- package/dist/components/charts/network/ForceDirectedGraph.d.ts +26 -5
- package/dist/components/charts/network/OrbitDiagram.d.ts +1 -1
- package/dist/components/charts/network/ProcessSankey.d.ts +1 -1
- package/dist/components/charts/network/SankeyDiagram.d.ts +10 -2
- package/dist/components/charts/network/TreeDiagram.d.ts +1 -1
- package/dist/components/charts/network/Treemap.d.ts +1 -1
- package/dist/components/charts/network/useForceLayout.d.ts +17 -0
- package/dist/components/charts/ordinal/BarChart.d.ts +22 -1
- package/dist/components/charts/ordinal/BoxPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/DonutChart.d.ts +1 -1
- package/dist/components/charts/ordinal/DotPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/FunnelChart.d.ts +1 -1
- package/dist/components/charts/ordinal/GroupedBarChart.d.ts +12 -1
- package/dist/components/charts/ordinal/Histogram.d.ts +1 -1
- package/dist/components/charts/ordinal/PieChart.d.ts +1 -1
- package/dist/components/charts/ordinal/RidgelinePlot.d.ts +1 -1
- package/dist/components/charts/ordinal/StackedBarChart.d.ts +12 -1
- package/dist/components/charts/ordinal/SwarmPlot.d.ts +1 -1
- package/dist/components/charts/ordinal/SwimlaneChart.d.ts +1 -1
- package/dist/components/charts/ordinal/ViolinPlot.d.ts +1 -1
- package/dist/components/charts/physics/ChainReactionChart.d.ts +9 -0
- package/dist/components/charts/physics/CollisionSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/CollisionSwarmChart.d.ts +54 -0
- package/dist/components/charts/physics/EventDropChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/EventDropChart.d.ts +60 -0
- package/dist/components/charts/physics/GaltonBoardChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GaltonBoardChart.d.ts +74 -0
- package/dist/components/charts/physics/GauntletChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/GauntletChart.d.ts +73 -0
- package/dist/components/charts/physics/PhysicalFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicalFlowChart.d.ts +63 -0
- package/dist/components/charts/physics/PhysicsCustomChart.d.ts +99 -0
- package/dist/components/charts/physics/PhysicsPileChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/PhysicsPileChart.d.ts +60 -0
- package/dist/components/charts/physics/ProcessFlowChart.capability.d.ts +2 -0
- package/dist/components/charts/physics/ProcessFlowChart.d.ts +96 -0
- package/dist/components/charts/physics/chainReactionOverlay.d.ts +22 -0
- package/dist/components/charts/physics/chainReactionRuntime.d.ts +37 -0
- package/dist/components/charts/physics/chainReactionTypes.d.ts +97 -0
- package/dist/components/charts/physics/collisionSwarmPhysics.d.ts +27 -0
- package/dist/components/charts/physics/dependencyMachine.d.ts +188 -0
- package/dist/components/charts/physics/eventDropPhysics.d.ts +64 -0
- package/dist/components/charts/physics/galtonBoardPhysics.d.ts +28 -0
- package/dist/components/charts/physics/gauntletChartProps.d.ts +67 -0
- package/dist/components/charts/physics/gauntletChrome.d.ts +33 -0
- package/dist/components/charts/physics/gauntletController.d.ts +73 -0
- package/dist/components/charts/physics/gauntletEffects.d.ts +36 -0
- package/dist/components/charts/physics/gauntletPhysics.d.ts +71 -0
- package/dist/components/charts/physics/gauntletRuntime.d.ts +42 -0
- package/dist/components/charts/physics/gauntletTypes.d.ts +213 -0
- package/dist/components/charts/physics/physicalFlowPhysics.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartShared.d.ts +57 -0
- package/dist/components/charts/physics/physicsChartUtils.d.ts +18 -0
- package/dist/components/charts/physics/physicsCustomLayout.d.ts +32 -0
- package/dist/components/charts/physics/physicsEncoding.d.ts +142 -0
- package/dist/components/charts/physics/physicsHocHandle.d.ts +53 -0
- package/dist/components/charts/physics/physicsHocUtils.d.ts +128 -0
- package/dist/components/charts/physics/physicsPilePhysics.d.ts +41 -0
- package/dist/components/charts/physics/physicsProcessPrimitives.d.ts +38 -0
- package/dist/components/charts/physics/processFlowPhysics.d.ts +97 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +9 -1
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +16 -2
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +9 -1
- package/dist/components/charts/shared/AnnotationLabel.d.ts +88 -0
- package/dist/components/charts/shared/annotationActivation.d.ts +35 -0
- package/dist/components/charts/shared/annotationLabelLayout.d.ts +5 -0
- package/dist/components/charts/shared/annotationRules.d.ts +2 -1
- package/dist/components/charts/shared/auditMobileVisualization.d.ts +91 -0
- package/dist/components/charts/shared/chartDefinitionPilot.d.ts +145 -0
- package/dist/components/charts/shared/chartFamilySets.d.ts +20 -0
- package/dist/components/charts/shared/chartSelectionUtils.d.ts +4 -0
- package/dist/components/charts/shared/chartSpecCore.d.ts +165 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +8 -127
- package/dist/components/charts/shared/chartSpecsGeo.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsNetwork.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsOrdinal.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsPhysics.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsRealtime.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsValue.d.ts +2 -0
- package/dist/components/charts/shared/chartSpecsXY.d.ts +2 -0
- package/dist/components/charts/shared/colorContrast.d.ts +3 -0
- package/dist/components/charts/shared/colorUtils.d.ts +16 -1
- package/dist/components/charts/shared/datumTypes.d.ts +2 -0
- package/dist/components/charts/shared/diagnoseAnnotationChecks.d.ts +6 -0
- package/dist/components/charts/shared/diagnoseConfig.d.ts +9 -14
- package/dist/components/charts/shared/diagnoseMisleadingChecks.d.ts +9 -0
- package/dist/components/charts/shared/diagnosePhysicsChecks.d.ts +3 -0
- package/dist/components/charts/shared/diagnoseTypes.d.ts +10 -0
- package/dist/components/charts/shared/formatUtils.d.ts +3 -3
- package/dist/components/charts/shared/hatchFill.d.ts +87 -0
- package/dist/components/charts/shared/hooks.d.ts +34 -10
- package/dist/components/charts/shared/knownChartComponents.d.ts +9 -0
- package/dist/components/charts/shared/leastSquaresRegression.d.ts +16 -0
- package/dist/components/charts/shared/mergeShapeStyle.d.ts +3 -2
- package/dist/components/charts/shared/motionEncoding.d.ts +145 -0
- package/dist/components/charts/shared/responsiveRules.d.ts +56 -0
- package/dist/components/charts/shared/semanticInteractions.d.ts +42 -0
- package/dist/components/charts/shared/sparseArray.d.ts +1 -1
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +17 -5
- package/dist/components/charts/shared/styleRules.d.ts +205 -0
- package/dist/components/charts/shared/temporalStrings.d.ts +7 -0
- package/dist/components/charts/shared/tooltipUtils.d.ts +22 -9
- package/dist/components/charts/shared/types.d.ts +58 -7
- package/dist/components/charts/shared/useAreaSeriesSetup.d.ts +16 -2
- package/dist/components/charts/shared/useChartSetup.d.ts +11 -4
- package/dist/components/charts/shared/useCustomChartSetup.d.ts +17 -5
- package/dist/components/charts/shared/useFrameImperativeHandle.d.ts +1 -2
- package/dist/components/charts/shared/useLikertAggregation.d.ts +4 -4
- package/dist/components/charts/shared/useNetworkChartSetup.d.ts +6 -2
- package/dist/components/charts/shared/useOrdinalBrush.d.ts +2 -1
- package/dist/components/charts/shared/useOrdinalPieceStyle.d.ts +25 -2
- package/dist/components/charts/shared/useStreamingLegend.d.ts +2 -2
- package/dist/components/charts/shared/useSyncedPushData.d.ts +49 -0
- package/dist/components/charts/shared/useXYLineStyle.d.ts +10 -0
- package/dist/components/charts/shared/useXYPointStyle.d.ts +19 -1
- package/dist/components/charts/shared/validateChartData.d.ts +7 -5
- package/dist/components/charts/shared/validationMap.d.ts +7 -9
- package/dist/components/charts/shared/validationMap.generated.d.ts +6 -0
- package/dist/components/charts/shared/withChartWrapper.d.ts +4 -3
- package/dist/components/charts/value/targetPresentation.d.ts +22 -0
- package/dist/components/charts/value/types.d.ts +5 -6
- package/dist/components/charts/xy/AreaChart.d.ts +9 -1
- package/dist/components/charts/xy/BubbleChart.d.ts +10 -1
- package/dist/components/charts/xy/ConnectedScatterplot.d.ts +7 -0
- package/dist/components/charts/xy/DifferenceChart.d.ts +1 -52
- package/dist/components/charts/xy/Heatmap.d.ts +2 -2
- package/dist/components/charts/xy/LineChart.d.ts +12 -1
- package/dist/components/charts/xy/MinimapChart.d.ts +1 -1
- package/dist/components/charts/xy/MultiAxisLineChart.d.ts +2 -2
- package/dist/components/charts/xy/QuadrantChart.d.ts +8 -1
- package/dist/components/charts/xy/Scatterplot.d.ts +11 -1
- package/dist/components/charts/xy/ScatterplotMatrix.d.ts +11 -1
- package/dist/components/charts/xy/StackedAreaChart.d.ts +16 -4
- package/dist/components/charts/xy/differenceSegments.d.ts +49 -0
- package/dist/components/charts/xy/scatterplotMatrixInteractionTypes.d.ts +12 -0
- package/dist/components/controls/SentenceFilter.d.ts +97 -0
- package/dist/components/controls/controlAudit.d.ts +24 -0
- package/dist/components/controls/controlContract.d.ts +57 -0
- package/dist/components/data/fromFlintChart.d.ts +74 -0
- package/dist/components/data/fromVegaLite.d.ts +46 -9
- package/dist/components/data/portability/index.d.ts +6 -3
- package/dist/components/data/portability/result.d.ts +52 -0
- package/dist/components/data/portability/spec.d.ts +31 -0
- package/dist/components/data/portability/vegaLite.d.ts +24 -6
- package/dist/components/export/chartConfig.d.ts +11 -0
- package/dist/components/realtime/types.d.ts +11 -0
- package/dist/components/recipes/annotationLayout.d.ts +29 -0
- package/dist/components/recipes/axisFixedForce.d.ts +119 -0
- package/dist/components/recipes/{gofishBoba.d.ts → boba.d.ts} +2 -2
- package/dist/components/recipes/cyclical.d.ts +39 -0
- package/dist/components/recipes/edgeRouter.d.ts +103 -0
- package/dist/components/recipes/forceLayout.d.ts +48 -0
- package/dist/components/recipes/forceLayoutAsync.d.ts +17 -0
- package/dist/components/recipes/gofishBobaHandwritten.d.ts +3 -0
- package/dist/components/recipes/gofishDisplayListFixtures.generated.d.ts +37 -0
- package/dist/components/recipes/gofishIR.d.ts +178 -132
- package/dist/components/recipes/gofishIRExamples.d.ts +30 -81
- package/dist/components/recipes/intervalLanes.d.ts +87 -0
- package/dist/components/recipes/intervals.d.ts +80 -0
- package/dist/components/recipes/isometricLandmarks.d.ts +88 -0
- package/dist/components/recipes/isotypeGlyphs.d.ts +17 -0
- package/dist/components/recipes/mobileAnnotationStrategy.d.ts +48 -0
- package/dist/components/recipes/mobileChartFamilyRecipes.d.ts +59 -0
- package/dist/components/recipes/networkAnalysis.d.ts +102 -0
- package/dist/components/recipes/networkLayouts.d.ts +83 -0
- package/dist/components/recipes/physics.d.ts +122 -0
- package/dist/components/recipes/physicsReference.d.ts +102 -0
- package/dist/components/recipes/processAggregates.d.ts +32 -0
- package/dist/components/recipes/processChrome.d.ts +67 -0
- package/dist/components/recipes/processJourney.d.ts +54 -0
- package/dist/components/recipes/processPhysics.d.ts +300 -0
- package/dist/components/recipes/processVolumeGeometry.d.ts +28 -0
- package/dist/components/recipes/radialCoords.d.ts +69 -0
- package/dist/components/recipes/random.d.ts +2 -0
- package/dist/components/recipes/recipeChrome.d.ts +91 -0
- package/dist/components/recipes/recipeGlyph.d.ts +42 -0
- package/dist/components/recipes/recipeLegend.d.ts +53 -1
- package/dist/components/recipes/recipeUtils.d.ts +52 -0
- package/dist/components/recipes/runs.d.ts +59 -0
- package/dist/components/recipes/tokenEncoding.d.ts +157 -0
- package/dist/components/recipes/tokenLayer.d.ts +79 -0
- package/dist/components/recipes/unitize.d.ts +108 -0
- package/dist/components/recipes/vector.d.ts +28 -0
- package/dist/components/recipes/waffle.d.ts +43 -0
- package/dist/components/rough/createRoughRenderMode.d.ts +46 -0
- package/dist/components/semiotic-ai-core.d.ts +47 -0
- package/dist/components/semiotic-ai.d.ts +53 -9
- package/dist/components/semiotic-controls.d.ts +20 -0
- package/dist/components/semiotic-experimental.d.ts +38 -9
- package/dist/components/semiotic-geo.d.ts +15 -0
- package/dist/components/semiotic-network.d.ts +15 -0
- package/dist/components/semiotic-ordinal.d.ts +14 -0
- package/dist/components/semiotic-physics-matter.d.ts +10 -0
- package/dist/components/semiotic-physics-rapier.d.ts +9 -0
- package/dist/components/semiotic-physics.d.ts +60 -0
- package/dist/components/semiotic-realtime-core.d.ts +34 -0
- package/dist/components/semiotic-realtime-react.d.ts +10 -0
- package/dist/components/semiotic-realtime.d.ts +4 -30
- package/dist/components/semiotic-recipes-core.d.ts +92 -0
- package/dist/components/semiotic-recipes-react.d.ts +7 -0
- package/dist/components/semiotic-recipes.d.ts +4 -43
- package/dist/components/semiotic-rough.d.ts +4 -0
- package/dist/components/semiotic-server-edge.d.ts +8 -0
- package/dist/components/semiotic-server-node.d.ts +5 -0
- package/dist/components/semiotic-server.d.ts +2 -2
- package/dist/components/semiotic-themes-core.d.ts +53 -0
- package/dist/components/semiotic-themes-react.d.ts +4 -0
- package/dist/components/semiotic-themes.d.ts +6 -76
- package/dist/components/semiotic-utils-core.d.ts +50 -0
- package/dist/components/semiotic-utils-react.d.ts +5 -0
- package/dist/components/semiotic-utils.d.ts +3 -39
- package/dist/components/semiotic-xy.d.ts +12 -0
- package/dist/components/semiotic.d.ts +44 -8
- package/dist/components/server/animatedGif.d.ts +36 -0
- package/dist/components/server/optionalImageTypes.d.ts +37 -0
- package/dist/components/server/renderEvidence.d.ts +1 -1
- package/dist/components/server/renderToStaticSVG.d.ts +3 -35
- package/dist/components/server/serverChartConfigShared.d.ts +21 -0
- package/dist/components/server/serverChartConfigs.d.ts +22 -12
- package/dist/components/server/serverChartConfigsCustom.d.ts +5 -0
- package/dist/components/server/serverChartConfigsGeo.d.ts +9 -0
- package/dist/components/server/serverChartConfigsNetwork.d.ts +8 -0
- package/dist/components/server/serverChartConfigsOrdinal.d.ts +16 -0
- package/dist/components/server/serverChartConfigsPhysics.d.ts +9 -0
- package/dist/components/server/serverChartConfigsXY.d.ts +11 -0
- package/dist/components/server/staticAnnotations.d.ts +6 -3
- package/dist/components/server/staticGeo.d.ts +4 -0
- package/dist/components/server/staticLegend.d.ts +2 -2
- package/dist/components/server/staticNetwork.d.ts +8 -0
- package/dist/components/server/staticOrdinal.d.ts +11 -0
- package/dist/components/server/staticPhysics.d.ts +3 -0
- package/dist/components/server/staticSVGChrome.d.ts +110 -0
- package/dist/components/server/staticXY.d.ts +4 -0
- package/dist/components/store/ObservationStore.d.ts +23 -2
- package/dist/components/store/themeSerialization.d.ts +32 -0
- package/dist/components/store/useChartInterrogation.d.ts +9 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +7 -23
- package/dist/components/stream/AriaLiveTooltip.d.ts +9 -0
- package/dist/components/stream/CanvasHitTester.d.ts +4 -4
- package/dist/components/stream/DataSourceAdapter.d.ts +1 -1
- package/dist/components/stream/FocusRing.d.ts +4 -2
- package/dist/components/stream/FrameRuntime.d.ts +57 -0
- package/dist/components/stream/GeoCanvasHitTester.d.ts +1 -1
- package/dist/components/stream/GeoParticlePool.d.ts +1 -1
- package/dist/components/stream/GeoPipelineStore.d.ts +62 -3
- package/dist/components/stream/GeoSVGOverlay.d.ts +64 -0
- package/dist/components/stream/NetworkCanvasHitTester.d.ts +2 -1
- package/dist/components/stream/NetworkPipelineStore.d.ts +44 -36
- package/dist/components/stream/NetworkSSRFrame.d.ts +17 -0
- package/dist/components/stream/NetworkSVGOverlay.d.ts +10 -1
- package/dist/components/stream/OrdinalCanvasHitTester.d.ts +2 -2
- package/dist/components/stream/OrdinalPipelineStore.d.ts +55 -11
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +9 -1
- package/dist/components/stream/OrdinalStyleResolver.d.ts +12 -0
- package/dist/components/stream/ParticlePool.d.ts +1 -1
- package/dist/components/stream/PipelineStore.d.ts +81 -174
- package/dist/components/stream/SVGOverlay.d.ts +6 -0
- package/dist/components/stream/SceneGraph.d.ts +12 -4
- package/dist/components/stream/StreamGeoFrame.d.ts +1 -1
- package/dist/components/stream/StreamNetworkFrame.d.ts +1 -1
- package/dist/components/stream/StreamOrdinalFrame.d.ts +1 -1
- package/dist/components/stream/StreamXYFrame.d.ts +2 -18
- package/dist/components/stream/accessibleDataRows.d.ts +33 -0
- package/dist/components/stream/accessorUtils.d.ts +25 -12
- package/dist/components/stream/annotationAccessorResolver.d.ts +2 -2
- package/dist/components/stream/brushAccessibility.d.ts +25 -0
- package/dist/components/stream/canvasBackground.d.ts +24 -0
- package/dist/components/stream/canvasSetup.d.ts +4 -1
- package/dist/components/stream/customLayoutFailure.d.ts +33 -0
- package/dist/components/stream/customLayoutPalette.d.ts +19 -9
- package/dist/components/stream/frameGraphics.d.ts +4 -0
- package/dist/components/stream/frameKeyboardNavigation.d.ts +45 -0
- package/dist/components/stream/frameThemeColors.d.ts +24 -0
- package/dist/components/stream/geoAnnotationAnchors.d.ts +14 -0
- package/dist/components/stream/geoCartogram.d.ts +17 -0
- package/dist/components/stream/geoCustomLayout.d.ts +59 -0
- package/dist/components/stream/geoDefaultTooltip.d.ts +11 -0
- package/dist/components/stream/geoFrameHelpers.d.ts +34 -0
- package/dist/components/stream/geoPipelineHelpers.d.ts +46 -0
- package/dist/components/stream/geoPipelineUpdateResults.d.ts +34 -0
- package/dist/components/stream/geoSceneBuilder.d.ts +16 -0
- package/dist/components/stream/geoTypes.d.ts +97 -15
- package/dist/components/stream/glyphDef.d.ts +98 -0
- package/dist/components/stream/hitTarget.d.ts +170 -0
- package/dist/components/stream/hitTestUtils.d.ts +2 -2
- package/dist/components/stream/hoverUtils.d.ts +7 -2
- package/dist/components/stream/keyboardNav.d.ts +4 -1
- package/dist/components/stream/layouts/forceLayoutPlugin.d.ts +9 -1
- package/dist/components/stream/layouts/forceLayoutWorkerClient.d.ts +58 -0
- package/dist/components/stream/layouts/hierarchyUtils.d.ts +2 -2
- package/dist/components/stream/networkBezier.d.ts +10 -0
- package/dist/components/stream/networkColorAccessors.d.ts +49 -0
- package/dist/components/stream/networkCustomLayoutRunner.d.ts +23 -0
- package/dist/components/stream/networkCustomRestyle.d.ts +15 -0
- package/dist/components/stream/networkDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/networkFrameAnimation.d.ts +7 -0
- package/dist/components/stream/networkFrameHandleTypes.d.ts +39 -0
- package/dist/components/stream/networkFrameInteraction.d.ts +37 -0
- package/dist/components/stream/networkFrameObservations.d.ts +15 -0
- package/dist/components/stream/networkFramePaint.d.ts +52 -0
- package/dist/components/stream/networkInteractionTypes.d.ts +26 -0
- package/dist/components/stream/networkPipelineConfig.d.ts +22 -0
- package/dist/components/stream/networkPipelineHelpers.d.ts +12 -0
- package/dist/components/stream/networkPipelineUpdateResults.d.ts +38 -0
- package/dist/components/stream/networkRealtimeEncoding.d.ts +41 -0
- package/dist/components/stream/networkTypes.d.ts +103 -51
- package/dist/components/stream/ordinalCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/ordinalDataIndex.d.ts +5 -0
- package/dist/components/stream/ordinalDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/ordinalDomain.d.ts +38 -0
- package/dist/components/stream/ordinalPipelineUpdateResults.d.ts +31 -0
- package/dist/components/stream/ordinalPulse.d.ts +10 -0
- package/dist/components/stream/ordinalPulseResources.d.ts +3 -0
- package/dist/components/stream/ordinalSceneBuilders/sceneBuilderMap.d.ts +5 -0
- package/dist/components/stream/ordinalSceneBuilders/types.d.ts +2 -2
- package/dist/components/stream/ordinalSpatialIndex.d.ts +9 -0
- package/dist/components/stream/ordinalTypes.d.ts +68 -9
- package/dist/components/stream/paintNeeds.d.ts +31 -0
- package/dist/components/stream/physics/CapacityQueueController.d.ts +5 -0
- package/dist/components/stream/physics/CapacityQueueTypes.d.ts +134 -0
- package/dist/components/stream/physics/MatterPhysicsEngineAdapter.d.ts +42 -0
- package/dist/components/stream/physics/PhysicsAccessibility.d.ts +48 -0
- package/dist/components/stream/physics/PhysicsAnnotations.d.ts +58 -0
- package/dist/components/stream/physics/PhysicsBodyBudget.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsBodySpatialIndex.d.ts +10 -0
- package/dist/components/stream/physics/PhysicsCanvasTheme.d.ts +26 -0
- package/dist/components/stream/physics/PhysicsControllers.d.ts +75 -0
- package/dist/components/stream/physics/PhysicsEngineAdapter.d.ts +59 -0
- package/dist/components/stream/physics/PhysicsEngineConformance.d.ts +23 -0
- package/dist/components/stream/physics/PhysicsEvidence.d.ts +25 -0
- package/dist/components/stream/physics/PhysicsKernel.d.ts +207 -0
- package/dist/components/stream/physics/PhysicsOptionalEngineAdapters.d.ts +12 -0
- package/dist/components/stream/physics/PhysicsPipelineStore.d.ts +86 -0
- package/dist/components/stream/physics/PhysicsPipelineTypes.d.ts +181 -0
- package/dist/components/stream/physics/PhysicsSVGOverlay.d.ts +78 -0
- package/dist/components/stream/physics/PhysicsSediment.d.ts +69 -0
- package/dist/components/stream/physics/PhysicsSettledSVG.d.ts +18 -0
- package/dist/components/stream/physics/PhysicsSettledScene.d.ts +21 -0
- package/dist/components/stream/physics/PhysicsWorkerClient.d.ts +24 -0
- package/dist/components/stream/physics/PhysicsWorkerProtocol.d.ts +101 -0
- package/dist/components/stream/physics/PhysicsWorkerRuntime.d.ts +5 -0
- package/dist/components/stream/physics/RapierPhysicsEngineAdapter.d.ts +18 -0
- package/dist/components/stream/physics/ServiceOperationsControllers.d.ts +27 -0
- package/dist/components/stream/physics/ServiceOperationsTypes.d.ts +89 -0
- package/dist/components/stream/physics/StreamPhysicsFrame.d.ts +6 -0
- package/dist/components/stream/physics/StreamPhysicsTypes.d.ts +317 -0
- package/dist/components/stream/physics/physicsBodyCanvas.d.ts +27 -0
- package/dist/components/stream/physics/physicsFrameObservations.d.ts +19 -0
- package/dist/components/stream/physics/physicsFrameSetup.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineControls.d.ts +4 -0
- package/dist/components/stream/physics/physicsPipelineHelpers.d.ts +41 -0
- package/dist/components/stream/physics/physicsPipelineObservations.d.ts +14 -0
- package/dist/components/stream/physics/physicsPipelineUpdateResults.d.ts +27 -0
- package/dist/components/stream/physics/physicsRegionRuntime.d.ts +54 -0
- package/dist/components/stream/physics/physicsSemanticUI.d.ts +20 -0
- package/dist/components/stream/physics/usePhysicsFrameLifecyclePolicy.d.ts +18 -0
- package/dist/components/stream/pipelineBufferUtils.d.ts +26 -0
- package/dist/components/stream/pipelineConfig.d.ts +179 -0
- package/dist/components/stream/pipelineDecay.d.ts +21 -3
- package/dist/components/stream/pipelineDomainResolution.d.ts +62 -0
- package/dist/components/stream/pipelineIdentityOps.d.ts +26 -0
- package/dist/components/stream/pipelinePulse.d.ts +17 -3
- package/dist/components/stream/pipelineRibbons.d.ts +41 -0
- package/dist/components/stream/pipelineSpatialIndex.d.ts +12 -0
- package/dist/components/stream/pipelineStoreUpdateResults.d.ts +33 -0
- package/dist/components/stream/pipelineStyleResolvers.d.ts +46 -0
- package/dist/components/stream/pipelineTransitions.d.ts +3 -1
- package/dist/components/stream/pipelineUpdateContract.d.ts +69 -0
- package/dist/components/stream/pipelineUpdateStore.d.ts +21 -0
- package/dist/components/stream/pulseFrameRefresh.d.ts +22 -0
- package/dist/components/stream/renderBackend.d.ts +27 -0
- package/dist/components/stream/renderers/canvasRenderHelpers.d.ts +15 -1
- package/dist/components/stream/renderers/geoCanvasRenderer.d.ts +3 -2
- package/dist/components/stream/renderers/glyphCanvasRenderer.d.ts +6 -0
- package/dist/components/stream/renderers/networkParticleRenderer.d.ts +1 -1
- package/dist/components/stream/renderers/resolveCSSColor.d.ts +6 -0
- package/dist/components/stream/sceneRenderBackendTypes.d.ts +28 -0
- package/dist/components/stream/sceneRevisionDiagnostics.d.ts +45 -0
- package/dist/components/stream/streamSemanticTypes.d.ts +16 -0
- package/dist/components/stream/streamStoreSync.d.ts +37 -0
- package/dist/components/stream/streamThemeTypes.d.ts +14 -0
- package/dist/components/stream/svgOverlayUtils.d.ts +10 -0
- package/dist/components/stream/test-utils/frameScheduler.d.ts +12 -0
- package/dist/components/stream/test-utils/revisionConsumption.d.ts +13 -0
- package/dist/components/stream/titleLayout.d.ts +31 -0
- package/dist/components/stream/types.d.ts +165 -72
- package/dist/components/stream/useCanvasFrameHost.d.ts +71 -0
- package/dist/components/stream/useFrame.d.ts +44 -2
- package/dist/components/stream/useHydration.d.ts +6 -0
- package/dist/components/stream/useLegendCategoryEmission.d.ts +5 -0
- package/dist/components/stream/useSemanticFrameInteractions.d.ts +22 -0
- package/dist/components/stream/useUpdateResultSnapshot.d.ts +7 -0
- package/dist/components/stream/workerModuleUrl.d.ts +10 -0
- package/dist/components/stream/xyAnnotationAnchors.d.ts +13 -0
- package/dist/components/stream/xyCanvasRenderers.d.ts +7 -0
- package/dist/components/stream/xyCrosshair.d.ts +11 -0
- package/dist/components/stream/xyDateTicks.d.ts +9 -0
- package/dist/components/stream/xyDefaultTooltip.d.ts +10 -0
- package/dist/components/stream/xyFrameAxisTypes.d.ts +50 -0
- package/dist/components/stream/xySceneBuilders/types.d.ts +10 -9
- package/dist/controls.min.js +2 -0
- package/dist/controls.module.min.js +2 -0
- package/dist/forceLayoutWorker.js +1 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/physics-matter.min.js +1 -0
- package/dist/physics-matter.module.min.js +1 -0
- package/dist/physics-rapier.min.js +1 -0
- package/dist/physics-rapier.module.min.js +1 -0
- package/dist/physics.min.js +2 -0
- package/dist/physics.module.min.js +2 -0
- package/dist/physicsWorker.js +1 -0
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/rough.min.js +1 -0
- package/dist/rough.module.min.js +1 -0
- package/dist/semiotic-ai-chunk-OG7BQUUW.module.min.js +2 -0
- package/dist/semiotic-ai-core.d.ts +47 -0
- package/dist/semiotic-ai-core.min.js +1 -0
- package/dist/semiotic-ai-core.module.min.js +1 -0
- package/dist/semiotic-ai-statisticalOverlays-CY4WKR4A.module.min.js +2 -0
- package/dist/semiotic-ai.d.ts +53 -9
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-chunk-3FSVZ46U.module.min.js +2 -0
- package/dist/semiotic-controls.d.ts +20 -0
- package/dist/semiotic-data.min.js +1 -1
- package/dist/semiotic-data.module.min.js +1 -1
- package/dist/semiotic-experimental.d.ts +38 -9
- package/dist/semiotic-experimental.min.js +1 -1
- package/dist/semiotic-experimental.module.min.js +1 -1
- package/dist/semiotic-geo.d.ts +15 -0
- package/dist/semiotic-network.d.ts +15 -0
- package/dist/semiotic-ordinal.d.ts +14 -0
- package/dist/semiotic-physics-matter.d.ts +10 -0
- package/dist/semiotic-physics-rapier.d.ts +9 -0
- package/dist/semiotic-physics.d.ts +60 -0
- package/dist/semiotic-realtime-core.d.ts +34 -0
- package/dist/semiotic-realtime-core.min.js +1 -0
- package/dist/semiotic-realtime-core.module.min.js +1 -0
- package/dist/semiotic-realtime-react.d.ts +10 -0
- package/dist/semiotic-realtime-react.min.js +2 -0
- package/dist/semiotic-realtime-react.module.min.js +2 -0
- package/dist/semiotic-realtime.d.ts +4 -30
- package/dist/semiotic-recipes-core.d.ts +92 -0
- package/dist/semiotic-recipes-core.min.js +1 -0
- package/dist/semiotic-recipes-core.module.min.js +1 -0
- package/dist/semiotic-recipes-react.d.ts +7 -0
- package/dist/semiotic-recipes-react.min.js +2 -0
- package/dist/semiotic-recipes-react.module.min.js +2 -0
- package/dist/semiotic-recipes.d.ts +4 -43
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-rough.d.ts +4 -0
- package/dist/semiotic-server-edge.d.ts +8 -0
- package/dist/semiotic-server-edge.min.js +1 -0
- package/dist/semiotic-server-edge.module.min.js +1 -0
- package/dist/semiotic-server-node.d.ts +5 -0
- package/dist/semiotic-server-node.min.js +1 -0
- package/dist/semiotic-server-node.module.min.js +1 -0
- package/dist/semiotic-server.d.ts +2 -2
- package/dist/semiotic-statisticalOverlays-UOMSFKVJ.module.min.js +2 -0
- package/dist/semiotic-themes-core.d.ts +53 -0
- package/dist/semiotic-themes-core.min.js +1 -0
- package/dist/semiotic-themes-core.module.min.js +1 -0
- package/dist/semiotic-themes-react.d.ts +4 -0
- package/dist/semiotic-themes-react.min.js +2 -0
- package/dist/semiotic-themes-react.module.min.js +2 -0
- package/dist/semiotic-themes.d.ts +6 -76
- package/dist/semiotic-themes.min.js +1 -2
- package/dist/semiotic-themes.module.min.js +1 -2
- package/dist/semiotic-utils-core.d.ts +50 -0
- package/dist/semiotic-utils-core.min.js +1 -0
- package/dist/semiotic-utils-core.module.min.js +1 -0
- package/dist/semiotic-utils-react.d.ts +5 -0
- package/dist/semiotic-utils-react.min.js +2 -0
- package/dist/semiotic-utils-react.module.min.js +2 -0
- package/dist/semiotic-utils.d.ts +3 -39
- package/dist/semiotic-utils.min.js +1 -2
- package/dist/semiotic-utils.module.min.js +1 -2
- package/dist/semiotic-value.min.js +1 -1
- package/dist/semiotic-value.module.min.js +1 -1
- package/dist/semiotic-xy.d.ts +12 -0
- package/dist/semiotic.d.ts +44 -8
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/test-utils/capturedFrameProps.d.ts +67 -0
- package/dist/test-utils/frameMock.d.ts +12 -9
- package/dist/xy-chunk-IWD6IB6V.module.min.js +2 -0
- package/dist/xy-statisticalOverlays-7RWG6LJT.module.min.js +2 -0
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +259 -88
- package/spec/README.md +152 -0
- package/spec/bindings/README.md +35 -0
- package/spec/bindings/vega-lite.mjs +112 -0
- package/spec/v0.1/annotation-provenance.schema.json +127 -0
- package/spec/v0.1/audience-profile.schema.json +67 -0
- package/spec/v0.1/chart-capability.schema.json +186 -0
- package/dist/components/recipes/gofish.d.ts +0 -207
- package/dist/components/recipes/gofishInterpreter.d.ts +0 -52
- package/dist/components/recipes/gofishLambdas.d.ts +0 -145
- package/dist/semiotic-ai-semiotic-ai-u954ylUn.js +0 -2
- package/dist/semiotic-ai-statisticalOverlays-CU7jW05Q.js +0 -1
- package/dist/semiotic-semiotic-BmrYbi99.js +0 -2
- package/dist/semiotic-statisticalOverlays-IjZw8Lsu.js +0 -1
- package/dist/xy-semiotic-xy-Dufu3D0-.js +0 -2
- package/dist/xy-statisticalOverlays-3Ni9bRph.js +0 -1
package/dist/xy.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),t=require("react"),n=require("d3-selection"),o=require("d3-brush"),i=require("d3-scale"),s=require("d3-quadtree"),r=require("d3-shape"),l=require("d3-array"),a=require("d3-hierarchy"),c=require("regression");function u(e){return e&&e.__esModule?e:{default:e}}function d(e){if(e&&e.__esModule)return e;const t=Object.create(null);if(e)for(const n in e)if("default"!==n){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:function(){return e[n]}})}return t.default=e,Object.freeze(t)}const h=d(t),f=u(c);function g(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o+1>>1;t[i]>e?o=i-1:n=i}return t[n]}function p(e,t){let n=0,o=t.length-1;for(;o>n;){const i=n+o>>1;e>t[i]?n=i+1:o=i}return t[n]}function y({width:i,height:s,totalWidth:r,totalHeight:l,margin:a,dimension:c,scales:u,onBrush:d,binSize:h,snap:f,binBoundaries:y,snapDuring:m,streaming:v}){const b=t.useRef(null),x=t.useRef(null),k=t.useRef(d);k.current=d;const w=t.useRef(u);w.current=u;const j=t.useMemo(()=>y?[...y].sort((e,t)=>e-t):void 0,[y]),A=t.useRef(j);A.current=j;const O=t.useRef(!1),S=t.useRef(null);return t.useEffect(()=>{if(!b.current)return;const e=n.select(b.current).select(".brush-g"),t="x"===c?o.brushX():"y"===c?o.brushY():o.brush();return t.extent([[0,0],[i,s]]),t.on("brush end",n=>{if(O.current)return;const o=w.current;if(!o)return;if(!n.selection)return S.current=null,void k.current(null);let r,l;if("x"===c){const[e,t]=n.selection;r=[o.x.invert(e),o.x.invert(t)],l=[o.y.invert(s),o.y.invert(0)]}else if("y"===c){const[e,t]=n.selection;r=[o.x.invert(0),o.x.invert(i)],l=[o.y.invert(t),o.y.invert(e)]}else{const[[e,t],[i,s]]=n.selection;r=[o.x.invert(e),o.x.invert(i)],l=[o.y.invert(s),o.y.invert(t)]}if("bin"===f&&"y"!==c&&("end"===n.type||"brush"===n.type&&m)){const i=A.current;i&&i.length>0?r=function(e,t){return 0===t.length?e:[g(e[0],t),p(e[1],t)]}(r,i):h&&h>0&&(r=[Math.floor(r[0]/h)*h,Math.ceil(r[1]/h)*h]);const s=o.x(r[0]),l=o.x(r[1]);if(O.current=!0,"x"===c)e.call(t.move,[s,l]);else if("xy"===c){const o=n.selection;e.call(t.move,[[s,o[0][1]],[l,o[1][1]]])}O.current=!1}const a={x:r,y:l};S.current=a,k.current(a)}),e.call(t),x.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null),x.current=null}},[i,s,c,f,h,m]),t.useEffect(()=>{if(!(v&&u&&x.current&&S.current))return;if(!b.current)return;if("y"===c)return;const e=S.current,t=u.x.domain()[0],o=n.select(b.current).select(".brush-g");if(t>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,S.current=null,void k.current(null);let i=e.x[0],s=!1;if(t>e.x[0]){if(i=t,"bin"===f){const e=A.current;e&&e.length>0?i=p(t,e):h&&h>0&&(i=Math.ceil(t/h)*h)}if(i>=e.x[1])return O.current=!0,o.call(x.current.move,null),O.current=!1,S.current=null,void k.current(null);s=!0}const r=u.x(i),l=u.x(e.x[1]);if(O.current=!0,"x"===c)o.call(x.current.move,[r,l]);else{const t=u.y(e.y[1]),n=u.y(e.y[0]);o.call(x.current.move,[[r,t],[l,n]])}if(O.current=!1,s){const t={x:[i,e.x[1]],y:e.y};S.current=t,k.current(t)}},[u,v,c,f,h]),e.jsx("svg",{ref:b,width:r,height:l,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-g",transform:`translate(${a.left},${a.top})`})})}const m=Object.freeze([]);function v(e){if(!e)return m;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}class b{constructor(e,t){var n,o;this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=null!==(n=null==t?void 0:t.chunkThreshold)&&void 0!==n?n:5e3,this.chunkSize=null!==(o=null==t?void 0:t.chunkSize)&&void 0!==o?o:5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=v(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=v(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}}function x(n){let o=null;const i=()=>(o||(o=t.createContext(null)),o),s=k(n);return[function({children:o,initialState:s}){const r=t.useRef(s),l=t.useMemo(()=>k(n,r.current),[]),a=i();return e.jsx(a.Provider,{value:l,children:o})},(e,n)=>{var o;const r=i(),l=null!==(o=t.useContext(r))&&void 0!==o?o:s,a=t.useRef(e);a.current=e;const c=t.useRef({hasValue:!1,value:void 0}),u=t.useCallback(()=>{const e=a.current(l.getState()),t=c.current;return t.hasValue&&n&&n(t.value,e)?t.value:(c.current={hasValue:!0,value:e},e)},[l,n]),d=t.useCallback(()=>a.current(l.getState()),[l]);return t.useSyncExternalStore(l.subscribe,u,d)}]}function k(e,t){const n=new Set;let o=Object.assign(Object.assign({},e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o=Object.assign(Object.assign({},o),t);for(const e of n)e()}})),null!=t?t:{});return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function w(e){if(!(null==e?void 0:e.colors))return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function j(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{categorical:A})})),e.accessibility.highContrast){const e="dark"===t.mode;t=Object.assign(Object.assign({},t),{colors:Object.assign(Object.assign({},t.colors),{text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"})})}return t}const A=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],O={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},S={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},M={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:A,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function C(e,t){if("light"===t)return O;if("dark"===t)return S;if("high-contrast"===t)return M;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?S:O;return j(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}return j(Object.assign(Object.assign(Object.assign({},e),t),{colors:Object.assign(Object.assign({},e.colors),t.colors||{}),typography:Object.assign(Object.assign({},e.typography),t.typography||{})}))}const[_,P]=x(e=>({theme:O,setTheme(t){e(e=>({theme:C(e.theme,t)}))}}));class L{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray(),n=[];for(;t.length>e;)n.push(t.shift());this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(const e of t)this.push(e);return n}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let i=0;this._size>i;i++){const s=(o+i)%this._capacity,r=this.buffer[s];if(e(r)){let e;e="object"!=typeof r||null===r?r:Array.isArray(r)?[...r]:Object.assign({},r),n.push(e),this.buffer[s]=t(r)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}}class N{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}}function F(e,t,n,o,i){const s=new Map;for(const r of e){const e=t(r),l=n(r);if(null==e||null==l||Number.isNaN(e)||Number.isNaN(l))continue;const a=Math.floor(e/o)*o;let c=s.get(a);if(c||(c={start:a,end:a+o,total:0,categories:new Map},s.set(a,c)),c.total+=l,i){const e=i(r);c.categories.set(e,(c.categories.get(e)||0)+l)}}return s}function B(e,t,n,o,i,s){const r=[];for(const i of e){const e=n(i),s=o(i);Number.isFinite(e)&&Number.isFinite(s)&&r.push({px:t.x(e),py:t.y(s),rawY:s,d:i})}r.sort((e,t)=>e.px-t.px);const l=Array(r.length),a=Array(r.length),c=Array(r.length);for(let e=0;r.length>e;e++){const t=r[e];l[e]=[t.px,t.py],a[e]=t.rawY,c[e]=t.d}return{type:"line",path:l,rawValues:a,style:i,datum:c,group:s}}function R(e,t,n,o,i,s,r,l){const a=[];for(const s of e){const e=n(s),r=o(s);if(!Number.isFinite(e)||!Number.isFinite(r))continue;const c=t.x(e),u=l?l(s):i;a.push({px:c,topY:t.y(r),botY:t.y(u)})}a.sort((e,t)=>e.px-t.px);const c=Array(a.length),u=Array(a.length);for(let e=0;a.length>e;e++){const t=a[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:s,datum:e,group:r}}function T(e,t,n,o){var i,s,r;const l=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const i of t)e+=n(i,o)||0;l.set(o,-e/2)}else if("wiggle"===o){e.length>0&&l.set(e[0],0);for(let o=1;e.length>o;o++){const s=e[o-1],r=e[o];let a=0,c=0,u=0;for(const e of t){const t=n(e,r)||0;a+=(2*u+t)*(t-(n(e,s)||0)),c+=t,u+=t}const d=null!==(i=l.get(s))&&void 0!==i?i:0;l.set(r,d-(c>0?a/(2*c):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(null!==(s=l.get(i))&&void 0!==s?s:0)+e/2}const i=o/e.length;for(const t of e)l.set(t,(null!==(r=l.get(t))&&void 0!==r?r:0)-i)}}else for(const t of e)l.set(t,0);return l}function H(e,t,n,o,i,s,r){const l=n(e),a=o(e);if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c={type:"point",x:t.x(l),y:t.y(a),r:i,style:s,datum:e};return void 0!==r&&(c.pointId=r),c}function I(e,t,n,o,i,s,r,l){const a=n(e),c=o(e);if(!Number.isFinite(a)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(a),y:t.y(c),size:i,symbolType:s,style:r,datum:e};return void 0!==l&&(u.pointId=l),u}function D(e,t,n,o,i,s,r){return{type:"rect",x:e,y:t,w:n,h:o,style:i,datum:s,group:r}}function W(e,t,n,o,i,s,r){const l={type:"heatcell",x:e,y:t,w:n,h:o,fill:i,datum:s};return(null==r?void 0:r.showValues)&&(l.showValues=!0,l.value=r.value,r.valueFormat&&(l.valueFormat=r.valueFormat)),l}function E(e,t){return e===t||typeof e==typeof t&&"function"==typeof e&&"function"==typeof t&&""+e==""+t}function z(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function $(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function Y(e,t){return"function"==typeof e?e:e?t=>t[e]+"":void 0}function G(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function X(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function V(e){const t=e.map(G),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return X(e,n,o)}if(e>=1){const[e,o,i]=t[n];return X(e,o,i)}const o=e*n,i=Math.floor(o),s=o-i,[r,l,a]=t[i],[c,u,d]=t[i+1];return X(Math.round(r+(c-r)*s),Math.round(l+(u-l)*s),Math.round(a+(d-a)*s))}}const q=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],U=V(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),K=V(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),Q=V(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),Z=V(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),J=V(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ee=V(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),te=V(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),ne=V(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),oe=V(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),ie=V(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),se=V(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),re=V(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),le={blues:U,reds:K,greens:Q,viridis:te,oranges:Z,purples:J,greys:ee,plasma:ne,inferno:oe,magma:ie,cividis:se,turbo:re};function ae(e){return e&&le[e]||U}V(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),V(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),V(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),V(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),V(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),V(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),V(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);const ce=Object.assign({category10:q,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]},le),ue=q,de=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],he=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function fe(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||he.has(t)}(o)?n(o):o}const o=(null==e?void 0:e[t])+"";return n?n(o):ue[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%ue.length]}function ge(e,t,n="category10"){const o=Array.from(new Set(e.map(e=>null==e?void 0:e[t]).filter(e=>null!=e).map(e=>e+""))),s=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return i.scaleOrdinal().domain(o).range(n).unknown("#999");const r=ce[n]||ce.category10;if(s&&"function"==typeof r){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>r(Number(t)/e)}{const e=Array.isArray(r)?r:ue;return i.scaleOrdinal().domain(o).range(e).unknown("#999")}}function pe(e,t,n=[3,20],o){let i;if(i="function"==typeof t?t(e):null==e?void 0:e[t],!o)return i;const[s,r]=o,[l,a]=n;if(r===s)return(l+a)/2;let c=(i-s)/(r-s);return 0>c?c=0:c>1&&(c=1),l+c*(a-l)}function ye(e,t,n){var o,i,s;if(1>=n)return 1;const r=null!==(o=e.minOpacity)&&void 0!==o?o:.1,l=n-1-t;switch(e.type){case"linear":return r+(1-l/(n-1))*(1-r);case"exponential":{const t=null!==(i=e.halfLife)&&void 0!==i?i:n/2;return r+Math.pow(.5,l/t)*(1-r)}case"step":return(null!==(s=e.stepThreshold)&&void 0!==s?s:.5*n)>l?1:r;default:return 1}}function me(e,t,n){var o;const i=null!==(o=e.duration)&&void 0!==o?o:500,s=n-t;return i>s?1-s/i:0}function ve(e,t,n){return e+(t-e)*n}function be(e,t,n){var o,i,s,r;if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"rect":return`r:${t.group||""}:${null!==(r=null!==(i=null===(o=t.datum)||void 0===o?void 0:o.binStart)&&void 0!==i?i:null===(s=t.datum)||void 0===s?void 0:s.category)&&void 0!==r?r:n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function xe(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function ke(e,t,n,o){if(!e.scales)return null;const i=[],s=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const r=o.getTop(n),l=o.getBottom(n);if(!Number.isFinite(r)||!Number.isFinite(l))continue;const a=e.scales.x(t),c=e.scales.y(r),u=e.scales.y(l);Number.isFinite(a)&&Number.isFinite(c)&&Number.isFinite(u)&&(i.push([a,c]),s.push([a,u]))}return 2>i.length?null:{type:"area",topPath:i,bottomPath:s,style:xe(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function we(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function je(e,t,n){const o=[];for(const i of n){const n=ke(e,t,"__ribbon_aggregate",i);n&&o.push(n)}return o}function Ae(e,t,n,o){const i=[];for(const s of o){const o=ke(e,t,n,s);o&&i.push(o)}return i}function Oe(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),i=o.getBottom(e);Number.isFinite(i)&&Number.isFinite(t)&&n.push({y0:i,y1:t})}return 0===n.length?e:Object.assign(Object.assign({},e),{band:n[0],bands:n})}function Se(e,t,n,o){var i;if(!e.config.pointStyle)return;const s=null!=o?o:e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const r of o.data){let o=e.config.pointStyle(r);!o.fill&&t&&(o=Object.assign(Object.assign({},o),{fill:t}));const l=null!==(i=o.r)&&void 0!==i?i:3,a=e.getPointId?e.getPointId(r)+"":void 0,c=H(r,e.scales,e.getX,s,l,o,a);c&&n.push(c)}}}const Me={topOpacity:.8,bottomOpacity:.05};function Ce(e){var t,n;if(e)return!0===e?Me:"colorStops"in e?e:{topOpacity:null!==(t=e.topOpacity)&&void 0!==t?t:Me.topOpacity,bottomOpacity:null!==(n=e.bottomOpacity)&&void 0!==n?n:Me.bottomOpacity}}const _e={circle:r.symbolCircle,square:r.symbolSquare,triangle:r.symbolTriangle,diamond:r.symbolDiamond,star:r.symbolStar,cross:r.symbolCross,wye:r.symbolWye},Pe=["circle","triangle","diamond","star","square","chevron","cross","wye"];function Le(e,t,n){var o,i;if(n)return n;const s=null!=e?e:"circle";if("chevron"===s)return function(e){const t=1.5*Ne(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t);const l=null!==(o=_e[s])&&void 0!==o?o:r.symbolCircle;return null!==(i=r.symbol(l,Math.max(1,t))())&&void 0!==i?i:""}function Ne(e){return Math.sqrt(Math.max(1,e)/Math.PI)}const Fe=new Map;function Be(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(Be))}function Re(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function Te(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function He(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=Te(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=z(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t+i:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const i=n(e);return Number.isFinite(i)&&0!==i?t-i:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:Te(e.y1Accessor,"y1"),getBottom:Te(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}class Ie{constructor(e){if(this.xExtent=new N,this.yExtent=new N,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this._quadtree=null,this._maxPointRadius=0,this._lastBoundedInsertsRef=null,this.config=e,this.buffer=new L(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=z(e.timeAccessor||e.xAccessor,"time"),this.getY=z(e.valueAccessor||e.yAccessor,"value")):(this.getX=z(e.xAccessor,"x"),this.getY=z(e.yAccessor,"y")),this.getGroup=Y(e.groupAccessor),this.getCategory=Y(e.categoryAccessor),this.getSize=e.sizeAccessor?z(e.sizeAccessor,"size"):void 0,this.getColor=Y(e.colorAccessor),this.getSymbol=Y(e.symbolAccessor),this.getY0=e.y0Accessor?z(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=He(e),this.getPointId=Y(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?z(e.openAccessor,"open"):void 0,this.getHigh=z(e.highAccessor,"high"),this.getLow=z(e.lowAccessor,"low"),this.getClose=n?z(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new L(e.windowSize))}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return!1;const t="undefined"!=typeof performance?performance.now():Date.now();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){if(this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear(),this.getX=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?z(this.config.timeAccessor||this.config.xAccessor,"time"):z(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],i=o instanceof Date,s="string"==typeof o&&o.length>=10&&!isNaN(new Date(o).getTime())&&isNaN(Number(o));if(this.xIsDate=i||s,s){const e="string"==typeof n?n:void 0;this.getX=e?t=>+new Date(t[e]):e=>+(n(e)instanceof Date?n(e):new Date(n(e)))}}const n=e.totalSize||e.inserts.length;n>this.buffer.capacity&&(this.buffer.resize(n),this.timestampBuffer&&n>this.timestampBuffer.capacity&&this.timestampBuffer.resize(n));for(const n of e.inserts)if(this.buffer.push(n),this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity||1e6;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap))}const e=this.buffer.push(n);if(this.timestampBuffer&&this.timestampBuffer.push(t),this.xExtent.push(this.getX(n)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.push(this.getHigh(n)),this.yExtent.push(this.getLow(n));else{this.yExtent.push(this.getY(n)),this.getY0&&this.yExtent.push(this.getY0(n));for(const e of this.resolvedRibbons){const t=e.getTop(n),o=e.getBottom(n);Number.isFinite(t)&&this.yExtent.push(t),Number.isFinite(o)&&this.yExtent.push(o)}}if(null!=e)if(this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow)this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e));else{this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}}return!0}computeScene(e){var t,n,o,s,r,l,a,c,u,d,h,f,g,p;const{config:y,buffer:m}=this;if(!this.needsFullRebuild&&!y.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(null!==(t=this.config.scalePadding)&&void 0!==t?t:0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(m,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const v=this.getBufferArray(),b=this.xExtent.extent,x=this.yExtent.extent;let k=y.xExtent?[null!==(n=y.xExtent[0])&&void 0!==n?n:b[0],null!==(o=y.xExtent[1])&&void 0!==o?o:b[1]]:b,w=y.yExtent?[null!==(s=y.yExtent[0])&&void 0!==s?s:x[0],null!==(r=y.yExtent[1])&&void 0!==r?r:x[1]]:x;const j=y.yExtent&&null!=y.yExtent[0]&&null!=y.yExtent[1],A="exact"===y.axisExtent;if("stackedarea"===y.chartType&&!j&&m.size>0)if(y.normalize)w=[0,A?1:1+y.extentPadding];else{const e=`${m.size}:${this._ingestVersion}:${null!==(l=y.baseline)&&void 0!==l?l:"zero"}:${null!==(a=y.stackOrder)&&void 0!==a?a:"key"}`;if(this._stackExtentCache&&this._stackExtentCache.key===e)w=this._stackExtentCache.yDomain;else{const t=this.groupData(v),n=new Map,o=new Set;let i=0;const s=new Map,r=new Map;for(const e of t){const t=new Map;let l=0;for(const n of e.data){const e=this.getX(n),r=this.getY(n);if(!Number.isFinite(e)||!Number.isFinite(r))continue;t.set(e,(t.get(e)||0)+r),o.add(e),l+=r;const a=(s.get(e)||0)+r;s.set(e,a),a>i&&(i=a)}n.set(e.key,t),r.set(e.key,l)}const l=null!==(c=y.stackOrder)&&void 0!==c?c:"key",a=(e,t)=>t>e?-1:e>t?1:0;let g;if("insideOut"===l){const e=[...t].map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=r.get(t))&&void 0!==n?n:0)-(null!==(o=r.get(e))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}),n=[],o=[];let i=0,s=0;for(const t of e)s>i?(n.push(t),i+=null!==(u=r.get(t))&&void 0!==u?u:0):(o.push(t),s+=null!==(d=r.get(t))&&void 0!==d?d:0);g=[...o.reverse(),...n]}else g="asc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=r.get(e))&&void 0!==n?n:0)-(null!==(o=r.get(t))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}):"desc"===l?t.map(e=>e.key).sort((e,t)=>{var n,o;const i=(null!==(n=r.get(t))&&void 0!==n?n:0)-(null!==(o=r.get(e))&&void 0!==o?o:0);return 0!==i?i:a(e,t)}):t.map(e=>e.key).sort(a);if("wiggle"===y.baseline||"silhouette"===y.baseline){const e=Array.from(o).sort((e,t)=>e-t),t=T(e,g,(e,t)=>{var o;return(null===(o=n.get(e))||void 0===o?void 0:o.get(t))||0},y.baseline);let i=1/0,r=-1/0;for(const n of e){const e=null!==(h=t.get(n))&&void 0!==h?h:0,o=null!==(f=s.get(n))&&void 0!==f?f:0;i>e&&(i=e),e+o>r&&(r=e+o)}Number.isFinite(i)&&Number.isFinite(r)||(i=0,r=0);const l=r-i,a=A?0:l>0?l*y.extentPadding:1;w=[i-a,r+a]}else w=[0,i+(A?0:i>0?i*y.extentPadding:1)];this._stackExtentCache={key:e,yDomain:w}}}else if("bar"===y.chartType&&y.binSize&&!j&&m.size>0){const[,e]=function(e,t,n,o,i){const s=F(e,t,n,o,i);if(0===s.size)return[0,0];let r=0;for(const e of s.values())e.total>r&&(r=e.total);return[0,r]}(m,this.getX,this.getY,y.binSize,this.getCategory);w=[0,A?e:e+e*y.extentPadding]}else if("waterfall"===y.chartType&&!j&&m.size>0){const[e,t]=function(e,t){let n=0,o=0,i=0;for(const s of e){const e=t(s);null==e||Number.isNaN(e)||(i+=e,n>i&&(n=i),i>o&&(o=i))}return[n,o]}(m,this.getY),n=t-e,o=A?0:n>0?n*y.extentPadding:1;w=[Math.min(0,e-Math.abs(o)),Math.max(0,t+Math.abs(o))]}else if(!j&&w[0]!==1/0){if(this.resolvedRibbons.length>0)for(const e of v)for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&(w[0]>n&&(w[0]=n),n>w[1]&&(w[1]=n)),Number.isFinite(o)&&(w[0]>o&&(w[0]=o),o>w[1]&&(w[1]=o))}const e=w[1]-w[0],t=A?0:e>0?e*y.extentPadding:1,n=null===(g=y.yExtent)||void 0===g?void 0:g[0],o=null===(p=y.yExtent)||void 0===p?void 0:p[1];w=[null!=n?w[0]:w[0]-t,null!=o?w[1]:w[1]+t],"log"!==y.yScaleType||w[0]>0||0>=x[0]||A||(w[0]=null!=n?w[0]:x[0]/(1+y.extentPadding))}if(y.yExtent&&!j){const e=y.yExtent[0],t=y.yExtent[1];null==e&&null==t||(w=[null!=e?e:w[0],null!=t?t:w[1]])}if(k[0]===1/0||k[1]===-1/0)if("time"===y.xScaleType){const e=Date.now();k=[e-864e5,e]}else k=[0,1];w[0]!==1/0&&w[1]!==-1/0||(w=[0,1]);const O="streaming"===y.runtimeMode,S=Math.max(0,Math.min(y.scalePadding||0,Math.min(e.width,e.height)/2-1));if(O)if("x"==("up"===(M=y.arrowOfTime)||"down"===M?"y":"x")){const t="right"===y.arrowOfTime?[S,e.width-S]:[e.width-S,S];this.scales={x:i.scaleLinear().domain(k).range(t),y:i.scaleLinear().domain(w).range([e.height-S,S])}}else{const t="down"===y.arrowOfTime?[S,e.height-S]:[e.height-S,S];this.scales={x:i.scaleLinear().domain(w).range([S,e.width-S]),y:i.scaleLinear().domain(k).range(t)}}else{const t=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)};this.scales={x:t(y.xScaleType,k,[S,e.width-S]),y:t(y.yScaleType,w,[e.height-S,S])}}var M;this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=this.buildSceneNodes(e,v),this.config.decay&&this.applyDecay(this.scene,v),this.config.pulse&&this.applyPulse(this.scene,v),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.rebuildQuadtree(),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}rebuildQuadtree(){const e=this.config.chartType;if("scatter"!==e&&"bubble"!==e)return this._quadtree=null,void(this._maxPointRadius=0);let t=0,n=0;for(const e of this.scene)"point"===e.type&&(t++,e.r>n&&(n=e.r));if(this._maxPointRadius=n,Ie.QUADTREE_THRESHOLD>=t)return void(this._quadtree=null);const o=Array(t);let i=0;for(const e of this.scene)"point"===e.type&&(o[i++]=e);this._quadtree=s.quadtree().x(e=>e.x).y(e=>e.y).addAll(o)}get quadtree(){return this._quadtree}get maxPointRadius(){return this._maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),s=this.scales.y.domain(),r=this.scales.x.range(),l=this.scales.y.range(),a=(e,t,n)=>{if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return i.scaleLog().domain(e).range(n).clamp(!0)}return"time"===e?i.scaleTime().domain([new Date(t[0]),new Date(t[1])]).range(n):i.scaleLinear().domain(t).range(n)},c=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),u=l[1]>l[0];this.scales={x:a(this.config.xScaleType,o,r[0]>r[1]?[e.width-c,c]:[c,e.width-c]),y:a(this.config.yScaleType,s,u?[c,e.height-c]:[e.height-c,c])},this.lastLayout={width:e.width,height:e.height},this.rebuildQuadtree(),this.version++}buildSceneNodes(e,t){var n,o,i,s,r,l,a,c,u;const{config:d,scales:h}=this;if(!h)return[];if(d.customLayout){const u=null!==(n=d.layoutMargin)&&void 0!==n?n:{top:0,right:0,bottom:0,left:0},f={data:t,scales:h,dimensions:{width:e.width,height:e.height,margin:u,plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:null!==(o=d.themeSemantic)&&void 0!==o?o:{},categorical:null!==(i=d.themeCategorical)&&void 0!==i?i:de},resolveColor:(e,t)=>{var n,o;const i=this.resolveGroupColor(e);if(i)return i;const s=this.resolveLineStyle(e,t);return s.stroke?s.stroke:"string"==typeof s.fill?s.fill:null!==(o=null===(n=d.themeSemantic)||void 0===n?void 0:n.primary)&&void 0!==o?o:"#4e79a7"},config:null!==(s=d.layoutConfig)&&void 0!==s?s:{},selection:null!==(r=d.layoutSelection)&&void 0!==r?r:null};let g;try{g=d.customLayout(f)}catch(e){return"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e),this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,[]}this.customLayoutOverlays=null!==(l=g.overlays)&&void 0!==l?l:null;const p=null!==(a=g.nodes)&&void 0!==a?a:[];if(this._customRestyle=g.restyle,this.hasCustomRestyle=!!g.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of p)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(p,null!==(c=d.layoutSelection)&&void 0!==c?c:null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:i}=e;Be(o)&&0===n.length&&Re(i,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&Re(i,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"customLayout",nodes:p,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),p}if(this.customLayoutOverlays=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const f={scales:h,config:d,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(d.chartType){case"line":return function(e,t){var n;const o=e.groupData(t),i=[],s=null===(n=e.config.annotations)||void 0===n?void 0:n.filter(e=>"threshold"===e.type&&e.color).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:n,aggregate:s}=we(e.ribbons);if(s.length>0&&i.push(...je(e,t,s)),n.length>0)for(const t of o)i.push(...Ae(e,t.data,t.key,n))}for(const t of o){const n=e.resolveLineStyle(t.key,t.data[0]),o=B(t.data,e.scales,e.getX,e.getY,n,t.key);s&&s.length>0&&(o.colorThresholds=s),e.config.curve&&"linear"!==e.config.curve&&(o.curve=e.config.curve),e.config.lineGradient&&(o.strokeGradient=e.config.lineGradient),i.push(o)}return Se(e,o,i),i}(f,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:s}=we(e.ribbons);if(s.length>0&&o.push(...je(e,t,s)),i.length>0)for(const t of n)o.push(...Ae(e,t.data,t.key,i))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),r=R(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),l=Ce(e.config.gradientFill);l&&(r.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return Se(e,n,o),o}(f,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],i=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:i,aggregate:s}=we(e.ribbons);if(s.length>0&&o.push(...je(e,t,s)),i.length>0)for(const t of n)o.push(...Ae(e,t.data,t.key,i))}const s=e.scales.y.domain()[0],r=e.getY0?t=>{const n=e.getY0(t);return null==n?s:n}:void 0;for(const t of n)if(i.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),i=R(t.data,e.scales,e.getX,e.getY,s,n,t.key,r),l=Ce(e.config.gradientFill);l&&(i.fillGradient=l),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}else{const n=e.resolveLineStyle(t.key,t.data[0]),i=B(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return Se(e,n,o),o}(f,t);case"stackedarea":return function(e,t){var n,o,i,s;const r=e.groupData(t),l=null!==(n=e.config.stackOrder)&&void 0!==n?n:"key",a=()=>r.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("key"===l)a();else if("asc"===l||"desc"===l||"insideOut"===l){const t=new Map;for(const n of r){let o=0;for(const t of n.data){const n=e.getX(t),i=e.getY(t);Number.isFinite(n)&&Number.isFinite(i)&&(o+=i)}t.set(n.key,o)}const n=(e,t)=>t>e?-1:e>t?1:0;if("asc"===l)r.sort((e,o)=>{var i,s;const r=(null!==(i=t.get(e.key))&&void 0!==i?i:0)-(null!==(s=t.get(o.key))&&void 0!==s?s:0);return 0!==r?r:n(e.key,o.key)});else if("desc"===l)r.sort((e,o)=>{var i,s;const r=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(s=t.get(e.key))&&void 0!==s?s:0);return 0!==r?r:n(e.key,o.key)});else{const e=[...r].sort((e,o)=>{var i,s;const r=(null!==(i=t.get(o.key))&&void 0!==i?i:0)-(null!==(s=t.get(e.key))&&void 0!==s?s:0);return 0!==r?r:n(e.key,o.key)}),s=[],l=[];let a=0,c=0;for(const n of e)c>a?(s.push(n),a+=null!==(o=t.get(n.key))&&void 0!==o?o:0):(l.push(n),c+=null!==(i=t.get(n.key))&&void 0!==i?i:0);r.length=0,r.push(...l.reverse(),...s)}}else a();const c=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,u=e.config.normalize?"zero":null!==(s=e.config.baseline)&&void 0!==s?s:"zero",{nodes:d,stackedTops:h}=function(e,t,n,o,i,s,r,l="zero"){var a,c;const u=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&u.add(t)}const d=Array.from(u).sort((e,t)=>e-t),h=new Map;for(const t of e){const e=new Map;for(const i of t.data){const t=n(i),s=o(i);Number.isFinite(t)&&Number.isFinite(s)&&e.set(t,(e.get(t)||0)+s)}h.set(t.key,e)}let f;if(s){f=new Map;for(const t of d){let n=0;for(const o of e)n+=(null===(a=h.get(o.key))||void 0===a?void 0:a.get(t))||0;f.set(t,n||1)}}const g=T(d,e.map(e=>e.key),(e,t)=>{var n;return(null===(n=h.get(e))||void 0===n?void 0:n.get(t))||0},l),p=[],y=new Map,m=new Map;for(const e of d)m.set(e,null!==(c=g.get(e))&&void 0!==c?c:0);for(const n of e){const e=h.get(n.key),o=[],l=[],a=new Map;for(const n of d){let i=e.get(n)||0;const r=m.get(n);s&&(i/=f.get(n));const c=r+i,u=t.x(n);l.push([u,t.y(r)]),o.push([u,t.y(c)]),m.set(n,c),a.set(n,c)}y.set(n.key,a);const c={type:"area",topPath:o,bottomPath:l,style:i(n.key,n.data[0]),datum:n.data,group:n.key};r&&(c.curve=r),p.push(c)}return{nodes:p,stackedTops:y}}(r,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,c,u),f=d;if(e.config.pointStyle){const t=new WeakMap;for(const n of r){const o=h.get(n.key);if(o)for(const i of n.data){const n=e.getX(i),s=e.getY(i);null==n||Number.isNaN(n)||null==s||Number.isNaN(s)||!o.has(n)||t.set(i,o.get(n))}}const n=n=>{var o;return null!==(o=t.get(n))&&void 0!==o?o:e.getY(n)};Se(e,r,f,n)}return f}(f,t);case"scatter":case"bubble":return function(e,t){var n;const o=[],i="bubble"===e.config.chartType?10:5,s=e.config.sizeRange||[3,15];let r=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);r=n=>e===t?(s[0]+s[1])/2:s[0]+(n-e)/(t-e)*(s[1]-s[0])}}const l=e.getColor?e.resolveColorMap(t):null,a=(null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",c=e.getSymbol,u=e.config.symbolMap,d=new Map;let h=0;const f=e=>{const t=null==u?void 0:u[e];if(t)return t;let n=d.get(e);return n||(n=Pe[h%Pe.length],h++,d.set(e,n)),n};for(const n of t){let t=e.config.pointStyle?e.config.pointStyle(n):{fill:a,opacity:.8},s=t.r||i;if(r&&e.getSize){const t=e.getSize(n);null==t||Number.isNaN(t)||(s=r(t))}if(l&&e.getColor&&!t.fill){const o=e.getColor(n);o&&l.has(o)&&(t=Object.assign(Object.assign({},t),{fill:l.get(o)}))}const u=e.getPointId?e.getPointId(n)+"":void 0;if(c){const i=f(c(n)+""),r=I(n,e.scales,e.getX,e.getY,Math.PI*s*s,i,t,u);r&&o.push(r)}else{const i=H(n,e.scales,e.getX,e.getY,s,t,u);i&&o.push(i)}}return o}(f,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){var o,i,s;const r=Math.max(1,Math.floor(null!==(o=e.config.heatmapXBins)&&void 0!==o?o:20)),l=Math.max(1,Math.floor(null!==(i=e.config.heatmapYBins)&&void 0!==i?i:20)),a=null!==(s=e.config.heatmapAggregation)&&void 0!==s?s:"count",c=z(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[u,d]=e.scales.x.domain(),[h,f]=e.scales.y.domain(),g=(d-u||1)/r,p=(f-h||1)/l,y=r*l;if(y>1e6)return[];const m=new Int32Array(y),v=new Float64Array(y);for(let n=0;t.length>n;n++){const o=t[n],i=e.getX(o),s=e.getY(o);if(!isFinite(i)||!isFinite(s))continue;const a=Math.min(Math.floor((i-u)/g),r-1),d=Math.min(Math.floor((s-h)/p),l-1);if(0>a||0>d)continue;const f=d*r+a;m[f]++;const y=c(o);v[f]+=isFinite(y)?y:0}let b=1/0,x=-1/0;for(let e=0;y>e;e++){if(0===m[e])continue;let t;switch(a){case"sum":t=v[e];break;case"mean":t=v[e]/m[e];break;default:t=m[e]}b>t&&(b=t),t>x&&(x=t)}if(!isFinite(b))return[];const k=x-b||1,w=n.width/r,j=n.height/l,A=e.config.showValues,O=e.config.heatmapValueFormat,S=[];for(let e=0;l>e;e++){const t=e*r;for(let n=0;r>n;n++){const o=t+n;if(0===m[o])continue;let i;switch(a){case"sum":i=v[o];break;case"mean":i=v[o]/m[o];break;default:i=m[o]}const s=(i-b)/k;S.push(W(n*w,(l-1-e)*j,w,j,`rgb(${220-(180*s+.5)|0},${220-(100*s+.5)|0},${255-(50*s+.5)|0})`,{xi:n,yi:e,value:i,count:m[o],sum:v[o],xCenter:u+(n+.5)*g,yCenter:h+(e+.5)*p,agg:a},A?{value:i,showValues:!0,valueFormat:O}:void 0))}}return S}(e,t,n);if(0===t.length)return[];const o=z(e.config.valueAccessor,"value"),i=$(e.config.xAccessor,"x"),s=$(e.config.yAccessor,"y"),r=new Map,l=new Map,a=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=i(n),u=s(n);a[e]=o,c[e]=u,r.has(o)||r.set(o,r.size),l.has(u)||l.set(u,l.size)}const u=r.size,d=l.size;if(0===u||0===d)return[];const h=Array.from(r.keys()),f=Array.from(l.keys()),g=h.every(e=>"number"==typeof e&&!isNaN(e)),p=f.every(e=>"number"==typeof e&&!isNaN(e));if(g){h.sort((e,t)=>e-t),r.clear();for(let e=0;h.length>e;e++)r.set(h[e],e)}if(p){f.sort((e,t)=>e-t),l.clear();for(let e=0;f.length>e;e++)l.set(f[e],e)}const y=new Float64Array(t.length),m=new Float64Array(t.length),v=Array(t.length),b=new Map;let x=0;for(let e=0;t.length>e;e++){const n=t[e],i=r.get(a[e]),s=l.get(c[e]);if(void 0===i||void 0===s)continue;const d=o(n),h=s*u+i,f=b.get(h);let g;void 0!==f?g=f:(g=x++,b.set(h,g)),y[g]=h,m[g]=d,v[g]=n}let k=1/0,w=-1/0;for(let e=0;x>e;e++){const t=m[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const j=function(e){const t=e in le?e:"blues";let n=Fe.get(t);if(n)return n;n=Array(256);const o=ae(t);for(let e=0;256>e;e++)n[e]=o(e/255);return Fe.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),A=255/(w-k||1),O=n.width/u,S=n.height/d,M=e.config.showValues,C=e.config.heatmapValueFormat,_=[];for(let e=0;x>e;e++){const t=m[e];if(!isFinite(t))continue;const n=y[e],o=n%u;_.push(W(o*O,(d-1-(n-o)/u)*S,O,S,j[Math.min((t-k)*A+.5|0,255)],v[e],M?{value:t,showValues:!0,valueFormat:C}:void 0))}return _}(f,t,e);case"bar":{const e=function(e,t){var n,o;if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const i=F(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===i.size)return{nodes:[],binBoundaries:[]};let s=null;if(e.getCategory){const t=new Set;for(const e of i.values())for(const n of e.categories.keys())t.add(n);const n=e.config.barColors?Object.keys(e.config.barColors):[],o=new Set(n),r=Array.from(t).filter(e=>!o.has(e)).sort(),l=n.filter(e=>t.has(e)),a=l.join("\0")+""+r.join("\0");e.barCategoryCache&&e.barCategoryCache.key===a?s=e.barCategoryCache.order:(s=[...l,...r],e.barCategoryCache={key:a,order:s})}const r=[],l=e.scales,[a,c]=l.x.domain(),u=e.config.barStyle,d=null===(n=e.config.themeSemantic)||void 0===n?void 0:n.primary,h=null==u?void 0:u.gap,f="number"!=typeof h||0>h?1:h,g={};(null==u?void 0:u.stroke)&&(g.stroke=u.stroke),"number"==typeof(null==u?void 0:u.strokeWidth)&&(g.strokeWidth=u.strokeWidth),"number"==typeof(null==u?void 0:u.opacity)&&(g.opacity=u.opacity);for(const t of i.values()){const n=Math.max(t.start,a),i=Math.min(t.end,c);if(n>=i)continue;const h=l.x(n),p=l.x(i),y=Math.abs(p-h),m=y>f+1?f:0,v=Math.min(h,p)+m/2,b=Math.max(y-m,1);if(b>0)if(s&&t.categories.size>0){let n=0;for(const i of s){const s=t.categories.get(i)||0;if(0===s)continue;const a=l.y(n),c=l.y(n+s),h=(null===(o=e.config.barColors)||void 0===o?void 0:o[i])||(null==u?void 0:u.fill)||d||"#4e79a7";r.push(D(v,Math.min(a,c),b,Math.abs(a-c),Object.assign({fill:h},g),{binStart:t.start,binEnd:t.end,total:t.total,category:i,categoryValue:s},i)),n+=s}}else{const e=l.y(0),n=l.y(t.total);r.push(D(v,Math.min(e,n),b,Math.abs(e-n),Object.assign({fill:(null==u?void 0:u.fill)||d||"#007bff"},g),{binStart:t.start,binEnd:t.end,total:t.total}))}}const p=new Set;for(const e of i.values())p.add(e.start),p.add(e.end);return{nodes:r,binBoundaries:Array.from(p).sort((e,t)=>e-t)}}(f,t);return this._barCategoryCache=null!==(u=f.barCategoryCache)&&void 0!==u?u:null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){var n,o,i,s,r,l;const a=[],c=e.config.swarmStyle||{},u=null!==(n=c.radius)&&void 0!==n?n:3,d=null!==(s=null!==(o=c.fill)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.primary)&&void 0!==s?s:"#007bff",h=null!==(r=c.opacity)&&void 0!==r?r:.7,f=c.stroke,g=c.strokeWidth;for(const n of t){const t=e.getX(n),o=e.getY(n);if(null==o||Number.isNaN(o))continue;const i=e.scales.x(t),s=e.scales.y(o);let r=d;if(e.getCategory){const t=e.getCategory(n);r=(null===(l=e.config.barColors)||void 0===l?void 0:l[t])||r}const c={type:"point",x:i,y:s,r:u,style:{fill:r,opacity:h,stroke:f,strokeWidth:g},datum:n};e.getPointId&&(c.pointId=e.getPointId(n)+""),a.push(c)}return a}(f,t);case"waterfall":return function(e,t,n){var o,i,s,r,l,a,c;const u=[],d=e.scales,h=e.config.waterfallStyle,f=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===f.length)return u;const g=null!==(s=null!==(o=null==h?void 0:h.positiveColor)&&void 0!==o?o:null===(i=e.config.themeSemantic)||void 0===i?void 0:i.success)&&void 0!==s?s:"#28a745",p=null!==(a=null!==(r=null==h?void 0:h.negativeColor)&&void 0!==r?r:null===(l=e.config.themeSemantic)||void 0===l?void 0:l.danger)&&void 0!==a?a:"#dc3545",y=null!==(c=null==h?void 0:h.gap)&&void 0!==c?c:1,m=null==h?void 0:h.stroke,v=null==h?void 0:h.strokeWidth,b=null==h?void 0:h.opacity;let x=0;for(let t=0;f.length>t;t++){const o=f[t],i=e.getX(o),s=e.getY(o),r=x+s;let l;l=f.length-1>t?e.getX(f[t+1])-i:t>0?i-e.getX(f[t-1]):0;const a=d.x(i),c=0!==l?d.x(i+l):a+n.width/10,k=Math.min(a,c)+y/2,w=Math.max(a,c)-y/2-k;if(0>=w){x=r;continue}const j=d.y(x),A=d.y(r),O=Math.min(j,A),S=Math.abs(j-A),M={fill:0>s?p:g,stroke:m,strokeWidth:v};null!=b&&(M.opacity=b),u.push(D(k,O,w,S,M,Object.assign(Object.assign({},o),{baseline:x,cumEnd:r,delta:s,_connectorStroke:null==h?void 0:h.connectorStroke,_connectorWidth:null==h?void 0:h.connectorWidth}))),x=r}return u}(f,t,e);case"candlestick":return function(e,t){var n,o;if(!e.getHigh||!e.getLow||!e.scales)return[];const i=null!==(n=e.config.candlestickRangeMode)&&void 0!==n&&n;if(!(i||e.getOpen&&e.getClose))return[];const s=[],r=e.config.candlestickStyle||{},l=r.rangeColor||"#6366f1",a=i?l:r.upColor||"#28a745",c=i?l:r.downColor||"#dc3545",u=i?l:r.wickColor||"#333",d=r.wickWidth||(i?2:1),h=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let f=null!==(o=r.bodyWidth)&&void 0!==o?o:0;if(null==r.bodyWidth)if(h.length>1){let t=1/0;for(let n=1;h.length>n;n++){const o=Math.abs(e.scales.x(h[n])-e.scales.x(h[n-1]));o>0&&t>o&&(t=o)}f=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else f=6;for(const n of t){const t=e.getX(n);if(null==t||Number.isNaN(t))continue;const o=e.getHigh(n),r=e.getLow(n);if(null==o||Number.isNaN(o)||null==r||Number.isNaN(r))continue;const l=i?o:e.getOpen(n),h=i?r:e.getClose(n);if(!i&&[l,h].some(e=>null==e||Number.isNaN(e)))continue;const g=h>=l,p={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(l),closeY:e.scales.y(h),highY:e.scales.y(o),lowY:e.scales.y(r),bodyWidth:f,upColor:a,downColor:c,wickColor:u,wickWidth:d,isUp:g,datum:n};i&&(p.isRange=!0),s.push(p)}return s}(f,t);default:return[]}}resolveBoundsStyle(e,t){var n;const o=this.config.boundsStyle;return"function"==typeof o?o(t||{},e):o&&"object"==typeof o?o:{fill:this.resolveLineStyle(e,t).stroke||(null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary)||"#4e79a7",fillOpacity:.2,stroke:"none"}}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?ye(n,e,t):1}applyDecay(e,t){this.config.decay&&function(e,t,n){var o,i;const s=n.length;if(1>=s)return;const r=new Map;for(let e=0;n.length>e;e++)r.set(n[e],e);for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const o=Array(t.length);let i=!1;for(let n=0;t.length>n;n++){const l=r.get(t[n]);null!=l?(o[n]=ye(e,l,s),1>o[n]&&(i=!0)):o[n]=1}i&&(n._decayOpacities=o);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],o=n.topPath?n.topPath.length:t.length;if(2>o)continue;if(t.length===o){const i=Array(o);let l=!1;for(let n=0;t.length>n;n++){const o=r.get(t[n]);null!=o?(i[n]=ye(e,o,s),1>i[n]&&(l=!0)):i[n]=1}l&&(n._decayOpacities=i)}else{let i=1;for(const n of t){const t=r.get(n);if(null!=t){const n=ye(e,t,s);i>n&&(i=n)}}if(1>i){const e=Array(o);e.fill(i),n._decayOpacities=e}}continue}const t=r.get(n.datum);if(null==t)continue;const l=ye(e,t,s);if("heatcell"===n.type)n.style={opacity:l};else if("candlestick"===n.type)n._decayOpacity=l;else{const e=null!==(i=null===(o=n.style)||void 0===o?void 0:o.opacity)&&void 0!==i?i:1;n.style=Object.assign(Object.assign({},n.style),{opacity:e*l})}}}(this.config.decay,e,t)}applyPulse(e,t){this.config.pulse&&this.timestampBuffer&&function(e,t,n,o){var i,s;const r="undefined"!=typeof performance?performance.now():Date.now(),l=null!==(i=e.color)&&void 0!==i?i:"rgba(255,255,255,0.6)",a=null!==(s=e.glowRadius)&&void 0!==s?s:4,c=new Map;for(let e=0;n.length>e;e++)c.set(n[e],e);for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let i=0;for(const n of t){const t=c.get(n);if(null==t)continue;const s=o.get(t);if(null==s)continue;const l=me(e,s,r);l>i&&(i=l)}i>0&&(n._pulseIntensity=i,n._pulseColor=l);continue}const t=c.get(n.datum);if(null==t)continue;const i=o.get(t);if(null==i)continue;const s=me(e,i,r);s>0&&(n._pulseIntensity=s,n._pulseColor=l,n._pulseGlowRadius=a)}}(this.config.pulse,e,t,this.timestampBuffer)}get hasActivePulses(){return!!this.config.pulse&&function(e,t){var n;if(!t||0===t.size)return!1;const o="undefined"!=typeof performance?performance.now():Date.now(),i=null!==(n=e.duration)&&void 0!==n?n:500,s=t.peek();return null!=s&&i>o-s}(this.config.pulse,this.timestampBuffer)}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){var i,s,r,l;n.clear(),o.clear();for(let a=0;t.length>a;a++){const c=t[a],u=be(e,c,a);u&&("point"===c.type?n.set(u,{x:c.x,y:c.y,r:c.r,opacity:c.style.opacity}):"rect"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:c.style.opacity}):"heatcell"===c.type?n.set(u,{x:c.x,y:c.y,w:c.w,h:c.h,opacity:null===(i=c.style)||void 0===i?void 0:i.opacity}):"candlestick"===c.type?n.set(u,{x:c.x,y:c.openY,w:c.bodyWidth,openY:c.openY,closeY:c.closeY,highY:c.highY,lowY:c.lowY,opacity:null===(s=c.style)||void 0===s?void 0:s.opacity}):"line"===c.type?o.set(u,{path:c.path.map(e=>[e[0],e[1]]),opacity:null===(r=c.style)||void 0===r?void 0:r.opacity}):"area"===c.type&&o.set(u,{topPath:c.topPath.map(e=>[e[0],e[1]]),bottomPath:c.bottomPath.map(e=>[e[0],e[1]]),opacity:null===(l=c.style)||void 0===l?void 0:l.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){var e,t,n;this.prevPositionMap.clear(),this.prevPathMap.clear();const o=null!==(t=null===(e=this.scales)||void 0===e?void 0:e.y(0))&&void 0!==t?t:0;for(let e=0;this.scene.length>e;e++){const t=this.scene[e],i=be(this.transitionContext,t,e);i&&("point"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,r:0,opacity:0}):"rect"===t.type?this.prevPositionMap.set(i,{x:t.x,y:o,w:t.w,h:0,opacity:null!==(n=t.style.opacity)&&void 0!==n?n:1}):"heatcell"===t.type?this.prevPositionMap.set(i,{x:t.x,y:t.y,w:t.w,h:t.h,opacity:0}):"line"===t.type?(t._introClipFraction=0,this.prevPathMap.set(i,{path:t.path.map(e=>[e[0],e[1]]),opacity:t.style.opacity})):"area"===t.type&&(t._introClipFraction=0,this.prevPathMap.set(i,{topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),opacity:t.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,i){var s,r,l,a,c,u,d,h,f,g,p,y,m,v,b,x,k,w,j,A,O,S,M,C,_,P,L,N,F,B,R,T,H,I,D,W,E,z,$,Y,G;if(0===o.size&&0===i.size)return n;const X=null!==(s=t.duration)&&void 0!==s?s:300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let V=!1;const q=new Set,U=new Set;for(let t=0;n.scene.length>t;t++){const s=n.scene[t],P=be(e,s,t);if(!P)continue;if(s._transitionKey=P,"line"===s.type||"area"===s.type){const e=i.get(P);if(e){if(U.add(P),"line"===s.type&&e.path&&e.path.length===s.path.length){s._targetPath=s.path.map(e=>[e[0],e[1]]),s._prevPath=e.path;for(let t=0;s.path.length>t;t++)s.path[t]=[e.path[t][0],e.path[t][1]];V=!0}else if("area"===s.type&&e.topPath&&e.bottomPath&&e.topPath.length===s.topPath.length&&e.bottomPath.length===s.bottomPath.length){s._targetTopPath=s.topPath.map(e=>[e[0],e[1]]),s._targetBottomPath=s.bottomPath.map(e=>[e[0],e[1]]),s._prevTopPath=e.topPath,s._prevBottomPath=e.bottomPath;for(let t=0;s.topPath.length>t;t++)s.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;s.bottomPath.length>t;t++)s.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];V=!0}s._targetOpacity=null!==(r=s.style.opacity)&&void 0!==r?r:1,s._startOpacity=null!==(a=null!==(l=e.opacity)&&void 0!==l?l:s.style.opacity)&&void 0!==a?a:1}else s._targetOpacity=null!==(c=s.style.opacity)&&void 0!==c?c:1,s._startOpacity=0,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),V=!0;continue}const L=o.get(P);if("point"===s.type)if(L){q.add(P);const e={x:s.x,y:s.y,r:s.r};s._targetOpacity=null!==(u=s.style.opacity)&&void 0!==u?u:1,L.x===e.x&&L.y===e.y&&L.r===e.r||(s._targetX=e.x,s._targetY=e.y,s._targetR=e.r,s.x=L.x,s.y=L.y,s.r=null!==(d=L.r)&&void 0!==d?d:s.r,V=!0)}else s._targetOpacity=null!==(h=s.style.opacity)&&void 0!==h?h:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),V=!0;else if("rect"===s.type)if(L){q.add(P);const e={x:s.x,y:s.y,w:s.w,h:s.h};s._targetOpacity=null!==(f=s.style.opacity)&&void 0!==f?f:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=L.x,s.y=L.y,s.w=null!==(g=L.w)&&void 0!==g?g:s.w,s.h=null!==(p=L.h)&&void 0!==p?p:s.h,V=!0)}else s._targetOpacity=null!==(y=s.style.opacity)&&void 0!==y?y:1,s.style=Object.assign(Object.assign({},s.style),{opacity:0}),V=!0;else if("heatcell"===s.type)if(L){q.add(P);const e={x:s.x,y:s.y,w:s.w,h:s.h};s._targetOpacity=null!==(v=null===(m=s.style)||void 0===m?void 0:m.opacity)&&void 0!==v?v:1,L.x===e.x&&L.y===e.y&&L.w===e.w&&L.h===e.h||(s._targetX=e.x,s._targetY=e.y,s._targetW=e.w,s._targetH=e.h,s.x=L.x,s.y=L.y,s.w=null!==(b=L.w)&&void 0!==b?b:s.w,s.h=null!==(x=L.h)&&void 0!==x?x:s.h,V=!0)}else s._targetOpacity=null!==(w=null===(k=s.style)||void 0===k?void 0:k.opacity)&&void 0!==w?w:1,s.style=Object.assign(Object.assign({},s.style||{}),{opacity:0}),V=!0;else if("candlestick"===s.type)if(L&&null!=L.openY){q.add(P);const e={x:s.x,openY:s.openY,closeY:s.closeY,highY:s.highY,lowY:s.lowY};s._targetOpacity=null!==(A=null===(j=s.style)||void 0===j?void 0:j.opacity)&&void 0!==A?A:1,(L.x!==e.x||L.openY!==e.openY||L.closeY!==e.closeY||L.highY!==e.highY||L.lowY!==e.lowY)&&(s._targetX=e.x,s._targetOpenY=e.openY,s._targetCloseY=e.closeY,s._targetHighY=e.highY,s._targetLowY=e.lowY,s.x=L.x,s.openY=L.openY,s.closeY=null!==(O=L.closeY)&&void 0!==O?O:s.closeY,s.highY=null!==(S=L.highY)&&void 0!==S?S:s.highY,s.lowY=null!==(M=L.lowY)&&void 0!==M?M:s.lowY,V=!0)}else s._targetOpacity=null!==(_=null===(C=s.style)||void 0===C?void 0:C.opacity)&&void 0!==_?_:1,s.style=Object.assign(Object.assign({},s.style||{}),{opacity:0}),V=!0}for(const[e,t]of i)if(!U.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:null!==(P=t.opacity)&&void 0!==P?P:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:null!==(L=t.opacity)&&void 0!==L?L:1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),V=!0}for(const[e,t]of o)if(!q.has(e)){if(e.startsWith("p:")){const o={type:"point",x:t.x,y:t.y,r:null!==(N=t.r)&&void 0!==N?N:3,style:{opacity:null!==(F=t.opacity)&&void 0!==F?F:1},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("r:")){const o={type:"rect",x:t.x,y:t.y,w:null!==(B=t.w)&&void 0!==B?B:0,h:null!==(R=t.h)&&void 0!==R?R:0,style:{opacity:null!==(T=t.opacity)&&void 0!==T?T:1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("h:")){const o={type:"heatcell",x:t.x,y:t.y,w:null!==(H=t.w)&&void 0!==H?H:0,h:null!==(I=t.h)&&void 0!==I?I:0,fill:"#999",datum:null,style:{opacity:null!==(D=t.opacity)&&void 0!==D?D:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(o)}else if(e.startsWith("c:")){const o=null!==(W=t.openY)&&void 0!==W?W:t.y,i={type:"candlestick",x:t.x,openY:o,closeY:null!==(E=t.closeY)&&void 0!==E?E:o,highY:null!==(z=t.highY)&&void 0!==z?z:o,lowY:null!==($=t.lowY)&&void 0!==$?$:o,bodyWidth:null!==(Y=t.w)&&void 0!==Y?Y:6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:null!==(G=t.opacity)&&void 0!==G?G:1},_targetOpacity:0,_transitionKey:e};n.exitNodes.push(i)}V=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),V&&(n.activeTransition={startTime:"undefined"!=typeof performance?performance.now():Date.now(),duration:X}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap);this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){var i,s,r,l,a,c;if(!n.activeTransition)return!1;const u=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),d=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(u,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,s=n?null!==(i=n.opacity)&&void 0!==i?i:1:0;e.style.opacity=ve(s,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ve(n.x,e._targetX,d),e.y=ve(n.y,e._targetY,d),void 0!==e._targetR&&void 0!==n.r&&(e.r=ve(n.r,e._targetR,d))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(s=n.opacity)&&void 0!==s?s:1:0;e.style.opacity=ve(i,e._targetOpacity,d)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ve(n.x,e._targetX,d),e.y=ve(n.y,e._targetY,d),void 0!==n.w&&(e.w=ve(n.w,e._targetW,d)),void 0!==n.h&&(e.h=ve(n.h,e._targetH,d))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(r=n.opacity)&&void 0!==r?r:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:ve(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ve(n.x,e._targetX,d),e.y=ve(n.y,e._targetY,d),void 0!==n.w&&(e.w=ve(n.w,e._targetW,d)),void 0!==n.h&&(e.h=ve(n.h,e._targetH,d))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0,i=n?null!==(l=n.opacity)&&void 0!==l?l:1:0;e.style=Object.assign(Object.assign({},e.style||{}),{opacity:ve(i,e._targetOpacity,d)})}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=ve(n.x,e._targetX,d),void 0!==n.openY&&(e.openY=ve(n.openY,e._targetOpenY,d)),void 0!==n.closeY&&(e.closeY=ve(n.closeY,e._targetCloseY,d)),void 0!==n.highY&&(e.highY=ve(n.highY,e._targetHighY,d)),void 0!==n.lowY&&(e.lowY=ve(n.lowY,e._targetLowY,d))}else if("line"===e.type){if(void 0!==e._targetOpacity){const t=null!==(a=e._startOpacity)&&void 0!==a?a:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ve(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=ve(t[o][0],n[o][0],d),e.path[o][1]=ve(t[o][1],n[o][1],d)}else if("area"===e.type){if(void 0!==e._targetOpacity){const t=null!==(c=e._startOpacity)&&void 0!==c?c:0;e.style=Object.assign(Object.assign({},e.style),{opacity:ve(t,e._targetOpacity,d)})}void 0!==e._introClipFraction&&(e._introClipFraction=d);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,i=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=ve(t[n][0],o[n][0],d),e.topPath[n][1]=ve(t[n][1],o[n][1],d);if(n&&i&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=ve(n[t][0],i[t][0],d),e.bottomPath[t][1]=ve(n[t][1],i[t][1],d)}}if(u>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style=Object.assign(Object.assign({},"line"===e.type||"area"===e.type?e.style:e.style||{}),{opacity:0===t?0:t}),e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){if(this._groupDataCache&&this._groupDataCache.version===this._ingestVersion&&this._groupDataCache.group===this.getGroup&&this._groupDataCache.data===e)return this._groupDataCache.result;let t;if(this.getGroup){const n=new Map;for(const t of e){const e=this.getGroup(t);n.has(e)||n.set(e,[]),n.get(e).push(t)}t=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else t=[{key:"_default",data:e}];return this._groupDataCache={version:this._ingestVersion,group:this.getGroup,data:e,result:t},t}resolveColorMap(e){if(this._colorMapCache&&this._colorMapCache.version===this._ingestVersion)return this._colorMapCache.map;const t=new Set;for(const n of e){const e=this.getColor(n);e&&t.add(e)}const n=Array.from(t).sort(),o=n.join("\0");if(this._colorMapCache&&this._colorMapCache.key===o)return this._colorMapCache.version=this._ingestVersion,this._colorMapCache.map;const i=Array.isArray(this.config.colorScheme)?this.config.colorScheme:this.config.themeCategorical||de,s=new Map;for(let e=0;n.length>e;e++)s.set(n[e],i[e%i.length]);return this._colorMapCache={key:o,map:s,version:this._ingestVersion},s}resolveLineStyle(e,t){var n;const o=this.config.lineStyle;if("function"==typeof o){const n=o(t||{},e);if(n&&!n.stroke&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{stroke:t})}return n}const i=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;return o&&"object"==typeof o?{stroke:o.stroke||i||"#007bff",strokeWidth:o.strokeWidth||2,strokeDasharray:o.strokeDasharray,fill:o.fill,fillOpacity:o.fillOpacity,opacity:o.opacity}:{stroke:this.resolveGroupColor(e)||i||"#007bff",strokeWidth:2}}resolveAreaStyle(e,t){var n,o;if(this.config.areaStyle){const n=this.config.areaStyle(t||{});if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const i=this.config.lineStyle;if("function"==typeof i){const n=i(t||{},e);if(n&&!n.fill&&e){const t=this.resolveGroupColor(e);if(t)return Object.assign(Object.assign({},n),{fill:t,stroke:n.stroke||t})}return n}const s=null===(n=this.config.themeSemantic)||void 0===n?void 0:n.primary;if(i&&"object"==typeof i)return{fill:i.fill||i.stroke||s||"#4e79a7",fillOpacity:null!==(o=i.fillOpacity)&&void 0!==o?o:.7,stroke:i.stroke||s||"#4e79a7",strokeWidth:i.strokeWidth||2};const r=this.resolveGroupColor(e)||s||"#4e79a7";return{fill:r,fillOpacity:.7,stroke:r,strokeWidth:2}}resolveGroupColor(e){if(this._colorMapCache){const t=this._colorMapCache.map.get(e);if(t)return t}const t=this._groupColorMap.get(e);if(t)return t;const n=(Array.isArray(this.config.colorScheme)&&this.config.colorScheme.length>0?this.config.colorScheme:null)||(Array.isArray(this.config.themeCategorical)&&this.config.themeCategorical.length>0?this.config.themeCategorical:null)||de;if(0===n.length)return null;const o=n[this._groupColorCounter%n.length];if(this._groupColorCounter++,this._groupColorMap.set(e,o),this._groupColorMap.size>Ie.GROUP_COLOR_MAP_CAP){const e=this._groupColorMap.keys().next().value;void 0!==e&&this._groupColorMap.delete(e)}return o}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=new Set(Array.isArray(e)?e:[e]),n=this.getPointId,o=e=>t.has(n(e));if(this.timestampBuffer&&this.timestampBuffer.size>0){const e=this.timestampBuffer.toArray(),t=new Set;this.buffer.forEach((e,n)=>{o(e)&&t.add(n)}),this.timestampBuffer.clear();for(let n=0;e.length>n;n++)t.has(n)||this.timestampBuffer.push(e[n])}const i=this.buffer.remove(o);if(0===i.length)return i;for(const e of i)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),i}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=new Set(Array.isArray(e)?e:[e]),o=this.getPointId,i=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&i.add(t)});const s=this.buffer.update(e=>n.has(o(e)),t);if(0===s.length)return s;for(const e of s)this.xExtent.evict(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.evict(this.getHigh(e)),this.yExtent.evict(this.getLow(e))):(this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e)));return this.buffer.forEach((e,t)=>{i.has(t)&&(this.xExtent.push(this.getX(e)),"candlestick"===this.config.chartType&&this.getHigh&&this.getLow?(this.yExtent.push(this.getHigh(e)),this.yExtent.push(this.getLow(e))):(this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e))))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime="undefined"!=typeof performance?performance.now():Date.now(),s}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this._quadtree=null,this._maxPointRadius=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}setLayoutSelection(e){this.config.layoutSelection=e}applyCustomRestyle(e,t){var n,o;const i=this._customRestyle;if(i)for(const s of e){const e=null!==(o=null!==(n=this._baseStyles.get(s))&&void 0!==n?n:s.style)&&void 0!==o?o:{},r=i(s,t);s.style=r?Object.assign(Object.assign({},e),r):e}}restyleScene(e){this._customRestyle&&this.applyCustomRestyle(this.scene,e)}updateConfig(e){var t,n,o,i;const s=Object.assign({},this.config);("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let r=!1,l=!1;Object.assign(this.config,e);const a="chartType"in e&&e.chartType!==s.chartType||"runtimeMode"in e&&e.runtimeMode!==s.runtimeMode;if(a||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const c=a||!E(null!==(t=e.xAccessor)&&void 0!==t?t:e.timeAccessor,null!==(n=s.xAccessor)&&void 0!==n?n:s.timeAccessor),u=a||!E(null!==(o=e.yAccessor)&&void 0!==o?o:e.valueAccessor,null!==(i=s.yAccessor)&&void 0!==i?i:s.valueAccessor);(c||u)&&(["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode?(this.getX=z(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=z(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=z(this.config.xAccessor,"x"),this.getY=z(this.config.yAccessor,"y")),u&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=He(this.config)),r=!0,l=!0)}if("groupAccessor"in e&&!E(e.groupAccessor,s.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?Y(this.config.groupAccessor):void 0,r=!0),"categoryAccessor"in e&&!E(e.categoryAccessor,s.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?Y(this.config.categoryAccessor):void 0,r=!0),"sizeAccessor"in e&&!E(e.sizeAccessor,s.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?z(this.config.sizeAccessor,"size"):void 0,r=!0),"symbolAccessor"in e&&!E(e.symbolAccessor,s.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?Y(this.config.symbolAccessor):void 0,r=!0),"colorAccessor"in e&&!E(e.colorAccessor,s.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?Y(this.config.colorAccessor):void 0,r=!0),"y0Accessor"in e&&!E(e.y0Accessor,s.y0Accessor)&&(this.getY0=this.config.y0Accessor?z(this.config.y0Accessor,"y0"):void 0,r=!0,l=!0),("boundsAccessor"in e&&!E(e.boundsAccessor,s.boundsAccessor)||"band"in e&&e.band!==s.band||"boundsStyle"in e&&e.boundsStyle!==s.boundsStyle)&&(this.resolvedRibbons=He(this.config),r=!0,l=!0),"pointIdAccessor"in e&&!E(e.pointIdAccessor,s.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?Y(this.config.pointIdAccessor):void 0,r=!0),"candlestick"===this.config.chartType&&(a||"openAccessor"in e&&!E(e.openAccessor,s.openAccessor)||"closeAccessor"in e&&!E(e.closeAccessor,s.closeAccessor)||"highAccessor"in e&&!E(e.highAccessor,s.highAccessor)||"lowAccessor"in e&&!E(e.lowAccessor,s.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?z(this.config.openAccessor,"open"):void 0,this.getHigh=z(this.config.highAccessor,"high"),this.getLow=z(this.config.lowAccessor,"low"),this.getClose=t?z(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,r=!0,l=!0}if(!r){const t=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const n of t)if(e[n]!==s[n]){r=!0;break}}r&&(l&&this.rebuildExtents(),this.needsFullRebuild=!0)}}function De(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:h.createElement(h.Fragment,null,...t)}Ie.GROUP_COLOR_MAP_CAP=1e3,Ie.QUADTREE_THRESHOLD=500;const We={isActive:!1,predicate:()=>!0},Ee=h.createContext(null);function ze({value:t,children:n}){return e.jsx(Ee.Provider,{value:t,children:n})}function $e(t,n){return null!=t?e.jsx(ze,{value:n,children:t}):t}function Ye(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function Ge(e,t=30){return Math.max((null!=e?e:4)+5,12,t)}function Xe(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function Ve(e,t){const n=Xe(e);if(!n)return!1;const o=Xe(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}const qe=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Ue=new WeakMap;let Ke=0,Qe=!1,Ze=null,Je=null,et=null;function tt(e,t){var n,o;if(!t)return t;const i=qe.exec(t);if(!i)return t;const s=e.canvas;if(!s)return(null===(n=i[2])||void 0===n?void 0:n.trim())||t;!function(){if(Qe)return;if("undefined"==typeof window||"undefined"==typeof document)return;Qe=!0;const e=()=>{Ke++};if("undefined"!=typeof MutationObserver&&document.documentElement&&(Ze=new MutationObserver(e),Ze.observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]})),"function"==typeof window.matchMedia)try{Je=window.matchMedia("(prefers-color-scheme: dark)"),et=e,"function"==typeof Je.addEventListener?Je.addEventListener("change",et):"function"==typeof Je.addListener&&Je.addListener(et)}catch(e){}}();let r=Ue.get(s);r&&r.version===Ke||(r={version:Ke,map:new Map},Ue.set(s,r));const l=r.map.get(t);if(void 0!==l)return l;const a=getComputedStyle(s).getPropertyValue(i[1]).trim()||(null===(o=i[2])||void 0===o?void 0:o.trim())||t;return r.map.set(t,a),a}function nt(e){switch(e){case"monotoneX":return r.curveMonotoneX;case"monotoneY":return r.curveMonotoneY;case"cardinal":return r.curveCardinal;case"catmullRom":return r.curveCatmullRom;case"step":return r.curveStep;case"stepBefore":return r.curveStepBefore;case"stepAfter":return r.curveStepAfter;case"basis":return r.curveBasis;case"natural":return r.curveNatural;default:return null}}function ot(e,t,n){return null==t?n:"string"!=typeof t?t:tt(e,t)||n}function it(e,t,n,o,i,s,r){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const l=e.createLinearGradient(o,i,s,r);for(const e of n)l.addColorStop(e.offset,e.color);return l}const{topOpacity:l,bottomOpacity:a}=t;if(!Number.isFinite(l)||!Number.isFinite(a))return null;const c=Math.max(0,Math.min(1,l)),u=Math.max(0,Math.min(1,a)),d=e.createLinearGradient(o,i,s,r),[h,f,g]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch(t){return e.fillStyle=n,[78,121,167]}const i=e.fillStyle;if(e.fillStyle=n,"string"!=typeof i)return[78,121,167];if(i.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(i.startsWith("#"))return[parseInt(i.slice(1,3),16),parseInt(i.slice(3,5),16),parseInt(i.slice(5,7),16)];const s=i.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return s?[+s[1],+s[2],+s[3]]:[78,121,167]}(e,n);return d.addColorStop(0,`rgba(${h},${f},${g},${c})`),d.addColorStop(1,`rgba(${h},${f},${g},${u})`),d}function st(e,t,n,o,i,s){const r=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>r.length)return null;const l=e.createLinearGradient(n,o,i,s);for(const e of r)l.addColorStop(e.offset,e.color);return l}const rt=new WeakMap;function lt(e,t){const n=nt(t);if(!n)return e;const o=rt.get(e);if(o)return o;const i=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let i=null;const s={moveTo(e,t){i=[e,t],o.push([e,t])},lineTo(e,t){i=[e,t],o.push([e,t])},bezierCurveTo(e,t,s,r,l,a){if(!i)return i=[l,a],void o.push([l,a]);const[c,u]=i;for(let i=1;n>=i;i++){const d=i/n,h=1-d;o.push([h*h*h*c+3*h*h*d*e+3*h*d*d*s+d*d*d*l,h*h*h*u+3*h*h*d*t+3*h*d*d*r+d*d*d*a])}i=[l,a]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,s){i=[n,s],o.push([n,s])}};return r.line().x(e=>e[0]).y(e=>e[1]).curve(t).context(s)(e),o}(e,n);return rt.set(e,i),i}function at(e,t,n,o=30,i,s=0){let r=null;if(i){const e=function(e,t,n,o,i,s=e=>e.x,r=e=>e.y,l=e=>e.r){const a=Math.max(o,i+5,12),c=t-a,u=t+a,d=n-a,h=n+a;let f=null,g=1/0;return e.visit((e,i,a,p,y)=>{if(i>u||c>p||a>h||d>y)return!0;if(!e.length){let i=e;do{const e=i.data,a=s(e)-t,c=r(e)-n,u=Math.sqrt(a*a+c*c);Ge(l(e),o)>=u&&g>u&&(f=e,g=u),i=i.next}while(i)}return!1}),f?{node:f,distance:g}:null}(i,t,n,o,s);e&&(r={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const s of e){let e=null;switch(s.type){case"point":if(i)break;e=ut(s,t,n,o);break;case"symbol":e=dt(s,t,n,o);break;case"line":e=ht(s,t,n,o);break;case"rect":if(null==s.datum)break;e=gt(s,t,n);break;case"heatcell":e=pt(s,t,n);break;case"area":if(!1===s.interactive)break;e=mt(s,t,n);break;case"candlestick":e=yt(s,t,n)}e&&o>e.distance&&(r&&e.distance>=r.distance||(r=e))}return r}function ct(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=vt(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let i=o,s=o;o>0&&e[o][0]>=t?(i=o-1,s=o):e.length-1>o&&(i=o,s=o+1);const[r,l]=e[i],[a,c]=e[s];return a===r?l:l+Math.max(0,Math.min(1,(t-r)/(a-r)))*(c-l)}function ut(e,t,n,o=30){const i=t-e.x,s=n-e.y,r=Math.sqrt(i*i+s*s);return r>Ge(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:r}}function dt(e,t,n,o=30){const i=t-e.x,s=n-e.y,r=Math.sqrt(i*i+s*s);return r>Ge(Ne(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:r}}function ht(e,t,n,o=30){var i,s;if(0===e.path.length)return null;const r=vt(e.path,t);if(0>r)return null;const[l,a]=e.path[r];let c;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[l,a]=e.path[r+1],c=ft(t,n,i,s,l,a);o>c&&(o=c)}c=o}else{const e=t-l,o=n-a;c=Math.sqrt(e*e+o*o)}const u=e.style,d=null!==(s=null!==(i=u.strokeWidth)&&void 0!==i?i:u.lineWidth)&&void 0!==s?s:1;return c>Math.max(5,d/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:l,y:a,distance:c}}function ft(e,t,n,o,i,s){const r=i-n,l=s-o,a=r*r+l*l;if(0===a)return Math.sqrt(Math.pow(e-n,2)+Math.pow(t-o,2));let c=((e-n)*r+(t-o)*l)/a;c=Math.max(0,Math.min(1,c));const u=o+c*l;return Math.sqrt(Math.pow(e-(n+c*r),2)+Math.pow(t-u,2))}function gt(e,t,n){const o=Ye(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function pt(e,t,n){const o=Ye(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function yt(e,t,n){const o=e.bodyWidth/2,i=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=i+Math.max(Math.max(e.openY,e.closeY)-i,1)/2,s=t-e.x,r=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(s*s+r*r)}}return null}function mt(e,t,n){if(0===e.topPath.length)return null;const o=vt(e.topPath,t);if(0>o)return null;const[i,s]=e.topPath[o],r=t-i,l=n-s,a=Math.sqrt(r*r+l*l);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:i,y:s,distance:a}}function vt(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const i=n+o>>1;t>e[i][0]?n=i+1:o=i}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}function bt(e,t,n){const o=e.byGroup.get(t);let i=0,s=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);s>t&&(s=t,i=e)}return o[i]._flatIndex}function xt(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}const kt={fresh:1,aging:.7,stale:.45,expired:.25},wt={alpha:1,band:"fresh",isStale:!1};function jt(e,t){var n,o;if(!e||0>=t)return wt;const i=null!=e.threshold&&e.threshold>0?e.threshold:5e3,s=e.graded;if(s){const e="object"==typeof s?s:{},o=function(e,t,n={}){var o,i,s;if(!Number.isFinite(t)||0>=t)return"fresh";if(Number.isNaN(e))return"fresh";if(e===1/0)return"expired";if(0>e)return"fresh";const r=null!==(o=n.fresh)&&void 0!==o?o:1,l=null!==(i=n.aging)&&void 0!==i?i:1.5,a=null!==(s=n.stale)&&void 0!==s?s:3;return t*r>e?"fresh":t*l>e?"aging":t*a>e?"stale":"expired"}(t,i,e.thresholds);return{alpha:Object.assign(Object.assign({},kt),null!==(n=e.opacities)&&void 0!==n?n:{})[o],band:o,isStale:"fresh"!==o}}return t>i?{alpha:null!==(o=e.dimOpacity)&&void 0!==o?o:.5,band:"stale",isStale:!0}:wt}function At({isStale:t,position:n}){return e.jsx("div",{className:"stream-staleness-badge",style:Object.assign(Object.assign({position:"absolute"},"top-left"===n?{top:4,left:4}:"bottom-left"===n?{bottom:4,left:4}:"bottom-right"===n?{bottom:4,right:4}:{top:4,right:4}),{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:t?"#dc3545":"#28a745",color:"white"}),children:t?"STALE":"LIVE"})}const Ot={fill:(t,n)=>e.jsx("rect",{style:t,width:n,height:n}),line:(t,n)=>e.jsx("line",{style:t,x1:0,y1:0,x2:n,y2:n})};function St(e,t,n,o,i){let s;return s="function"==typeof n?n(e):(0,Ot[n])(o(e,t),i),s}function Mt({swatchSize:t}){return e.jsx("path",{d:`M${.25*t},${.55*t} L${.45*t},${.75*t} L${.8*t},${.3*t}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function Ct(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}const _t=(t,n,o,i,s,r,l,a,c,u,d)=>{const{type:h="fill",styleFn:f,items:g}=t,p=[];let y=0;const m=!(!n&&!o),v="isolate"===u||void 0===u&&null!=s,{swatchSize:b,labelGap:x,rowHeight:k}=d;return g.forEach((t,u)=>{const d=St(t,u,h,f,b),w=Ct(t,i,s),j=s&&s.size>0&&s.has(t.label);p.push(e.jsxs("g",{transform:`translate(0,${y})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:m?a===r&&u===l?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&v?j||!1:void 0,"aria-current":m&&!v&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:m?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowDown"===e.key||"ArrowUp"===e.key){e.preventDefault();const t=(u+("ArrowDown"===e.key?1:-1)+g.length)%g.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:m?e=>{c(a,u),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:w,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:b+x+2+7*t.label.length,height:b+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),d,j&&e.jsx(Mt,{swatchSize:b}),e.jsx("text",{y:b/2,x:b+x,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+u)),y+=k}),p};function Pt({config:t,orientation:n="vertical",width:o=100}){const{colorFn:i,domain:s,label:r,format:l}=t,a=l||(e=>Math.round(100*e)/100+""),c="grad-legend-"+h.useId();if("horizontal"===n){const t=12,n=Math.min(o,200),l=Math.max(0,(o-n)/2),u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(s[0]+n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":r||"Gradient legend",children:[e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:u})}),r&&e.jsx("text",{x:l+n/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:r}),e.jsx("rect",{x:l,y:0,width:n,height:t,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:l,y:t+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[0])}),e.jsx("text",{x:l+n,y:t+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[1])})]})}const u=[];for(let t=0;64>=t;t++){const n=t/64;u.push(e.jsx("stop",{offset:100*n+"%",stopColor:i(s[1]-n*(s[1]-s[0]))},t))}return e.jsxs("g",{"aria-label":r||"Gradient legend",children:[r&&e.jsx("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:r}),e.jsx("defs",{children:e.jsx("linearGradient",{id:c,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:u})}),e.jsx("rect",{x:0,y:0,width:14,height:100,fill:`url(#${c})`,rx:2}),e.jsx("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[1])}),e.jsx("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(s[0])})]})}function Lt(t){const{legendGroups:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,legendInteraction:l,title:a="Legend",width:c=100,height:u=20,orientation:d="vertical",legendLayout:f}=t,g=function(e){var t,n,o,i,s;const r=Math.max(1,null!==(t=null==e?void 0:e.swatchSize)&&void 0!==t?t:16),l=Math.max(r,null!==(n=null==e?void 0:e.rowHeight)&&void 0!==n?n:22);return{swatchSize:r,labelGap:Math.max(0,null!==(o=null==e?void 0:e.labelGap)&&void 0!==o?o:6),itemGap:Math.max(0,null!==(i=null==e?void 0:e.itemGap)&&void 0!==i?i:10),rowHeight:l,align:"left"===(null==e?void 0:e.align)?"start":"right"===(null==e?void 0:e.align)?"end":null!==(s=null==e?void 0:e.align)&&void 0!==s?s:"start",maxWidth:null==e?void 0:e.maxWidth}}(f),[p,y]=h.useState(0),[m,v]=h.useState(0),b=h.useCallback((e,t)=>{y(e),v(t)},[]),x="vertical"===d?(({legendGroups:t,width:n,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,focusedGroupIndex:l,focusedItemIndex:a,onFocusedIndexChange:c,legendInteraction:u,metrics:d})=>{let h=24;const f=[];return t.forEach((t,g)=>{h+=5,f.push(e.jsx("line",{stroke:"gray",x1:0,y1:h,x2:n,y2:h},"legend-top-line legend-symbol-"+g)),h+=8,t.label&&(h+=16,f.push(e.jsx("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label},"legend-text-"+g)),h+=8),f.push(e.jsx("g",{className:"legend-item",transform:`translate(0,${h})`,children:_t(t,o,i,s,r,l,a,g,c,u,d)},"legend-group-"+g)),h+=t.items.length*d.rowHeight+8}),f})({legendGroups:n||[],width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:l,metrics:g}):(({legendGroups:t,height:n,width:o,customClickBehavior:i,customHoverBehavior:s,highlightedCategory:r,isolatedCategories:l,focusedGroupIndex:a,focusedItemIndex:c,onFocusedIndexChange:u,legendInteraction:d,metrics:h})=>{var f;let g=0;const p=[];t.forEach((t,n)=>{var f;let y=0;t.label&&(y+=16);const m=((t,n,o,i,s,r,l,a,c,u,d,h)=>{const{type:f="fill",styleFn:g,items:p}=t,y=[],{swatchSize:m,labelGap:v,itemGap:b,rowHeight:x,align:k}=d,w=!(!n&&!o),j="isolate"===u||void 0===u&&null!=s,A=p.map(e=>m+v+7*e.label.length),O=[];let S=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+b+e;h&&h>0&&M>0&&n>h?(O.push({start:S,end:t,width:M}),S=t,M=e):M=n}),p.length>0&&O.push({start:S,end:p.length,width:M}),O.forEach((t,u)=>{let d="center"===k?Math.max(0,((null!=h?h:t.width)-t.width)/2):"end"===k?Math.max(0,(null!=h?h:t.width)-t.width):0;for(let h=t.start;t.end>h;h++){const t=p[h],k=St(t,h,f,g,m),O=Ct(t,i,s),S=s&&s.size>0&&s.has(t.label);y.push(e.jsxs("g",{transform:`translate(${d},${u*x})`,onClick:n?()=>n(t):void 0,onMouseEnter:o?()=>o(t):void 0,onMouseLeave:o?()=>o(null):void 0,tabIndex:w?a===r&&h===l?0:-1:void 0,role:w?"option":void 0,"aria-selected":w&&j?S||!1:void 0,"aria-current":w&&!j&&null!=i&&t.label===i||void 0,"aria-label":t.label,onKeyDown:w?e=>{var o;if("Enter"!==e.key&&" "!==e.key||(e.preventDefault(),n&&n(t)),"ArrowRight"===e.key||"ArrowLeft"===e.key){e.preventDefault();const t=(h+("ArrowRight"===e.key?1:-1)+p.length)%p.length;c(a,t);const n=null===(o=e.currentTarget.parentElement)||void 0===o?void 0:o.children[t];n instanceof SVGElement&&n.focus()}}:void 0,onFocus:w?e=>{c(a,h),o&&o(t);const n=e.currentTarget.querySelector(".semiotic-legend-focus-ring");n&&n.setAttribute("visibility","visible")}:void 0,onBlur:w?e=>{o&&o(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:w?"pointer":"default",opacity:O,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[w&&e.jsx("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+v+2+7*t.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),k,S&&e.jsx(Mt,{swatchSize:m}),e.jsx("text",{y:m/2,x:m+v,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:t.label})]},"legend-item-"+h)),d+=A[h]+b}});const C=Math.max(0,...O.map(e=>e.width)),_=O.length;return{items:y,offset:C,totalRows:_,totalHeight:_*x}})(t,i,s,r,l,a,c,n,u,d,h,null!==(f=h.maxWidth)&&void 0!==f?f:o);y+=m.offset+5,p.push(Object.assign(Object.assign({label:t.label},m),{offset:y,totalRows:m.totalRows,totalHeight:m.totalHeight})),g+=y+12});const y=null!==(f=h.maxWidth)&&void 0!==f?f:o;let m=g>y?0:"center"===h.align?Math.max(0,(y-g)/2):"end"===h.align?Math.max(0,y-g):0;const v=[];return p.forEach((o,i)=>{const s=t[i];s.label&&(v.push(e.jsx("text",{transform:`translate(${m},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:s.label},"legend-text-"+i)),m+=16),v.push(e.jsx("g",{className:"legend-item",transform:`translate(${m},0)`,children:o.items},"legend-group-"+i)),m+=o.offset+5,t[i+1]&&v.push(e.jsx("line",{stroke:"gray",x1:m,y1:-8,x2:m,y2:(o.totalHeight||n)+0+8},"legend-top-line legend-symbol-"+i)),m+=12}),e.jsx("g",{children:v})})({legendGroups:n||[],title:a,height:u,width:c,customClickBehavior:o,customHoverBehavior:i,highlightedCategory:s,isolatedCategories:r,focusedGroupIndex:p,focusedItemIndex:m,onFocusedIndexChange:b,legendInteraction:l,metrics:g}),k=!(!o&&!i);return e.jsxs("g",{role:k?"listbox":void 0,"aria-multiselectable":!(!k||"isolate"!==l&&(void 0!==l||null==r))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===d&&e.jsx("text",{className:"legend-title",y:16,x:c/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function Nt(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}function Ft(t){var n;const{legend:o,totalWidth:i,totalHeight:s,margin:r,legendPosition:l="right",legendLayout:a,title:c,legendHoverBehavior:u,legendClickBehavior:d,legendHighlightedCategory:h,legendIsolatedCategories:f,legendInteraction:g}=t;if(!o)return null;const p="top"===l||"bottom"===l,y=!!c,m=Math.max(1,p?null!==(n=null==a?void 0:a.maxWidth)&&void 0!==n?n:Math.max(0,i-r.left-r.right):100);let v,b;return"left"===l?(v=Math.max(4,r.left-m-10),b=r.top):"top"===l?(v=r.left,b=y?32:8):"bottom"===l?(v=r.left,b=s-r.bottom+38):(v=i-r.right+10,b=r.top),e.jsx("g",{transform:`translate(${v}, ${b})`,children:(x=o,"object"==typeof x&&null!==x&&"gradient"in x?e.jsx(Pt,{config:o.gradient,orientation:p?"horizontal":"vertical",width:m}):Nt(o)?e.jsx(Lt,{legendGroups:o.legendGroups,title:"",width:m,orientation:p?"horizontal":"vertical",legendLayout:a,customHoverBehavior:u,customClickBehavior:d,highlightedCategory:h,isolatedCategories:f,legendInteraction:g}):o)});var x}function Bt(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function Rt(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}function Tt(e){return"string"==typeof e?{type:e}:e}function Ht({orient:n,config:o,values:i,scale:s,size:r,length:a}){const c=function(e){var t,n,o,i,s;return{type:e.type,bins:null!==(t=e.bins)&&void 0!==t?t:20,fill:null!==(n=e.fill)&&void 0!==n?n:"#4e79a7",fillOpacity:null!==(o=e.fillOpacity)&&void 0!==o?o:.5,stroke:null!==(i=e.stroke)&&void 0!==i?i:"none",strokeWidth:null!==(s=e.strokeWidth)&&void 0!==s?s:1}}(o),u="top"===n||"bottom"===n,d=t.useMemo(()=>{if(0===i.length)return null;const t=s.domain(),o=r-8;if("boxplot"===c.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],i=t[Math.floor(.5*n)],s=t[Math.floor(.75*n)],r=s-o;return{q1:o,median:i,q3:s,whiskerLow:Math.max(t[0],o-1.5*r),whiskerHigh:Math.min(t[n-1],s+1.5*r)}}(i);if(!t)return null;const{q1:r,median:l,q3:a,whiskerLow:d,whiskerHigh:h}=t,f=Math.min(.5*o,20),g=(o-f)/2+4;if(u){const t=s(r),o=s(a),i=s(l),u=s(d),p=s(h),y="top"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:u,y1:m+y*(g+f/2),x2:p,y2:m+y*(g+f/2),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:u,y1:m+y*g,x2:u,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:p,y1:m+y*g,x2:p,y2:m+y*(g+f),stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:Math.min(t,o),y:"top"===n?m-g-f:m+g,width:Math.abs(o-t),height:f,fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:i,y1:"top"===n?m-g-f:m+g,x2:i,y2:"top"===n?m-g:m+g+f,stroke:c.fill,strokeWidth:2})]})}{const t=s(r),o=s(a),i=s(l),u=s(d),p=s(h),y="left"===n?-1:1,m=0;return e.jsxs("g",{"data-testid":"marginal-boxplot-"+n,children:[e.jsx("line",{x1:m+y*(g+f/2),y1:u,x2:m+y*(g+f/2),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:u,x2:m+y*(g+f),y2:u,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:m+y*g,y1:p,x2:m+y*(g+f),y2:p,stroke:c.fill,strokeWidth:c.strokeWidth}),e.jsx("rect",{x:"left"===n?m-g-f:m+g,y:Math.min(t,o),width:f,height:Math.abs(o-t),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth}),e.jsx("line",{x1:"left"===n?m-g-f:m+g,y1:i,x2:"left"===n?m-g:m+g+f,y2:i,stroke:c.fill,strokeWidth:2})]})}}const d=l.bin().domain(t).thresholds(c.bins)(i);if(0===d.length)return null;const h=Rt(d.map(e=>e.length));if(0===h)return null;if("histogram"===c.type)return e.jsx("g",{"data-testid":"marginal-histogram-"+n,children:d.map((t,i)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/h*o;if(u){const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:o,y:"top"===n?-4-r:4,width:Math.max(l,.5),height:r,fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}{const o=s(t.x0),l=s(t.x1)-s(t.x0);return e.jsx("rect",{x:"left"===n?-4-r:4,y:Math.min(o,o+l),width:r,height:Math.abs(l),fill:c.fill,fillOpacity:c.fillOpacity,stroke:c.stroke,strokeWidth:c.strokeWidth},i)}})});if("violin"===c.type){const t=o/2+4,i=[];for(const e of d){if(null==e.x0||null==e.x1)continue;const r=e.length/h*(o/2),l=s((e.x0+e.x1)/2);i.push(u?`${l},${"top"===n?-(t-r):t-r}`:`${"left"===n?-(t-r):t-r},${l}`)}for(let e=d.length-1;e>=0;e--){const r=d[e];if(null==r.x0||null==r.x1)continue;const l=r.length/h*(o/2),a=s((r.x0+r.x1)/2);i.push(u?`${a},${"top"===n?-(t+l):t+l}`:`${"left"===n?-(t+l):t+l},${a}`)}return e.jsx("g",{"data-testid":"marginal-violin-"+n,children:e.jsx("polygon",{points:i.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}if("ridgeline"===c.type){const t=[];if(u){const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${i},${e}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${r},${"top"===n?-i-4:i+4}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${r},${e}`),t.push("Z")}else{const e=0,i=null!=d[0].x0?s(d[0].x0):0;t.push(`M${e},${i}`);for(const e of d){if(null==e.x0||null==e.x1)continue;const i=e.length/h*o,r=s((e.x0+e.x1)/2);t.push(`L${"left"===n?-i-4:i+4},${r}`)}const r=null!=d[d.length-1].x1?s(d[d.length-1].x1):a;t.push(`L${e},${r}`),t.push("Z")}return e.jsx("g",{"data-testid":"marginal-ridgeline-"+n,children:e.jsx("path",{d:t.join(" "),fill:c.fill,fillOpacity:c.fillOpacity,stroke:"none"===c.stroke?c.fill:c.stroke,strokeWidth:c.strokeWidth})})}return null},[i,s,c,r,a,n,u,4]);return d?e.jsx("g",{className:"marginal-"+n,"data-testid":"marginal-"+n,children:d}):null}function It(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),i=e.split(/\s+/),s=[];let r="";for(const e of i)r&&r.length+1+e.length>o?(s.push(r),r=e):r=r?`${r} ${e}`:e;return r&&s.push(r),s}function Dt(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Wt(t,n,o,i){if(!t)return e.jsx("g",{className:"annotation-note"});const{label:s,title:r,orientation:l,align:a,wrap:c=120,noWrap:u}=t;if(!s&&!r)return e.jsx("g",{className:"annotation-note"});let d=l;d||(d=Math.abs(n)>Math.abs(o)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===d?0>n?"right":"left":0>o?"bottom":"top");let f="start";"topBottom"===d?"right"===h?f="end":"middle"===h&&(f="middle"):f=0>n?"end":"start";const g=16,p=r?u?[r]:It(r,c):[],y=s?u?[s]:It(s,c):[],m="leftRight"===d?"end"===f?-4:4:0;let v=0;const b=[],x=i||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";t.useHTML||t.html?(b.push(e.jsx("foreignObject",{className:"annotation-note-html",x:"end"===f?m-c:"middle"===f?m-c/2:m,y:-16,width:c,height:Math.max(g,(p.length+y.length)*g+(r&&s?2:0))+g,style:{overflow:"visible"},children:e.jsxs("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:x,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===f?"right":"middle"===f?"center":"left",whiteSpace:u?"nowrap":"normal",wordBreak:"break-word"},children:[r&&e.jsx("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:r}),s&&e.jsx("div",{className:"annotation-note-label",children:s})]})},"annotation-note-html")),v=p.length*g):(p.length>0&&(b.push(e.jsx("text",{className:"annotation-note-title",fill:x,textAnchor:f,fontWeight:"bold",children:p.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-title")),v=p.length*g),y.length>0&&b.push(e.jsx("text",{className:"annotation-note-label",fill:x,textAnchor:f,y:v,children:y.map((t,n)=>e.jsx("tspan",{x:m,dy:0===n?0:g,children:t},n))},"annotation-note-label")));let k=null;if((r||s)&&(0!==n||0!==o))if("topBottom"===d){const t=Math.min(c,120);let n=0,o=t;"end"===f?(n=-t,o=0):"middle"===f&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:n,x2:o,y1:0,y2:0,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}else{const t=(p.length+y.length)*g+(y.length>0?g:0);let n=0,o=t;"bottom"===h?(n=-t,o=0):"middle"===h&&(n=-t/2,o=t/2),k=e.jsx("line",{className:"note-line",x1:0,x2:0,y1:n,y2:o,stroke:i||"var(--semiotic-text-secondary, currentColor)"})}const w=Math.max(0,p.length+y.length-1)*g;let j=0;return"topBottom"===d?j=0>o?-(w+2):18:"leftRight"===d&&(j="middle"===h?-(w+g+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>o?-(w+2):18),e.jsxs("g",{className:"annotation-note",transform:`translate(${n},${o})`,children:[e.jsx("g",{className:"annotation-note-content",transform:0!==j?`translate(0,${j})`:void 0,children:b}),k]})}function Et(t,n,o,i,s){var r;const l=[];switch(t){case"callout-circle":{const t=((null==n?void 0:n.radius)||0)+((null==n?void 0:n.radiusPadding)||0);t>0&&l.push(e.jsx("circle",{r:t,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const t=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0;(t>0||i>0)&&l.push(e.jsx("rect",{width:t,height:i,fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":(null==n?void 0:n.custom)&&l.push(...Array.isArray(n.custom)?n.custom:[n.custom]);break;case"xy-threshold":{const t=i||0,r=s||0;if(void 0!==(null==n?void 0:n.x)){const i=(n.x||0)-t;l.push(e.jsx("line",{x1:i,y1:(n.y1||0)-r,x2:i,y2:(n.y2||0)-r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==(null==n?void 0:n.y)){const i=(n.y||0)-r;l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:i,x2:(n.x2||0)-t,y2:i,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==(null==n?void 0:n.x1)||void 0!==(null==n?void 0:n.x2)?l.push(e.jsx("line",{x1:(n.x1||0)-t,y1:0,x2:(n.x2||0)-t,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===(null==n?void 0:n.y1)&&void 0===(null==n?void 0:n.y2)||l.push(e.jsx("line",{x1:0,y1:(n.y1||0)-r,x2:0,y2:(n.y2||0)-r,stroke:o||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const t=null!==(r=null==n?void 0:n.width)&&void 0!==r?r:null==n?void 0:n.height;void 0!==t&&l.push(e.jsx("path",{d:Dt((null==n?void 0:n.type)||"curly",t,(null==n?void 0:n.depth)||30,void 0===(null==n?void 0:n.width)),fill:"none",stroke:o||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return e.jsx("g",{className:"annotation-subject",children:l})}function zt(t,n,o,i,s,r){var l;const a=[];let c=0,u=0;if("callout-circle"!==s&&"label"!==s||!(null==r?void 0:r.radius)){if("callout-rect"===s&&r){const e=r.width||0,o=r.height||0;if(e>0||o>0){const i=e/2,s=o/2,r=t-i,l=n-s;if(0!==r||0!==l){const t=Math.abs(r),n=Math.abs(l),a=e/2,d=o/2,h=t*d>n*a?a/t:d/n;c=i+r*h,u=s+l*h}}}else if("bracket"===s&&r){const e=r.width,t=r.height,n=r.depth||30;void 0!==e?(c=e/2,u=n):void 0!==t&&(c=n,u=t/2)}}else{const e=(r.radius||0)+(r.radiusPadding||0);if(e>0&&(0!==t||0!==n)){const o=Math.atan2(n,t);c=Math.cos(o)*e,u=Math.sin(o)*e}}const d=Math.sqrt(Math.pow(t-c,2)+Math.pow(n-u,2));if(d>.5){const s=i||"var(--semiotic-text-secondary, currentColor)",r="curve"===(null==o?void 0:o.type);let h=Math.atan2(n-u,t-c);if(r){const i=(null!==(l=null==o?void 0:o.curve)&&void 0!==l?l:.25)*d,r=(c+t)/2+-(n-u)/d*i,f=(u+n)/2+(t-c)/d*i;a.push(e.jsx("path",{className:"connector-curve",d:`M${c},${u}Q${r},${f} ${t},${n}`,fill:"none",stroke:s},"connector-line")),h=Math.atan2(f-u,r-c)}else a.push(e.jsx("line",{x1:c,y1:u,x2:t,y2:n,stroke:s},"connector-line"));if("arrow"===(null==o?void 0:o.end)){const t=10,n=16/180*Math.PI;a.push(e.jsx("path",{d:`M${c},${u}L${c+t*Math.cos(h+n)},${u+t*Math.sin(h+n)}L${c+t*Math.cos(h-n)},${u+t*Math.sin(h-n)}Z`,fill:s,stroke:"none"},"connector-arrow"))}}return e.jsx("g",{className:"annotation-connector",children:a})}function $t(t){var n,o;const{x:i=0,y:s=0,dx:r,dy:l,nx:a,ny:c,note:u,connector:d,subject:h,type:f,color:g,className:p,disable:y,opacity:m,strokeDasharray:v,events:b={},"data-testid":x}=t,k=Array.isArray(i)?null!==(n=i[0])&&void 0!==n?n:0:i,w=Array.isArray(s)?null!==(o=s[0])&&void 0!==o?o:0:s,j=new Set(Array.isArray(y)?y:[]);let A=r||0,O=l||0;null!=a&&(A=a-k),null!=c&&(O=c-w);const S="string"==typeof f?f:"label";if("bracket"===S&&h&&0===A&&0===O)if(void 0!==h.width){A=h.width/2;const e=h.depth||30;O=e+(0>e?-5:5)}else if(void 0!==h.height){const e=h.depth||30;A=e+(0>e?-5:5),O=h.height/2}return e.jsxs("g",Object.assign({className:("annotation "+(p||"")).trim(),transform:`translate(${k},${w})`,"data-testid":x},null!=m&&{opacity:m},v&&{strokeDasharray:v},b,{children:[!j.has("connector")&&zt(A,O,d,g,S,h),!j.has("subject")&&Et(S,h,g,k,w),!j.has("note")&&Wt(u,A,O,g)]}))}function Yt(t){var n,o;const{noteData:i}=t,{screenCoordinates:s}=i,r="string"==typeof i.type?i.type:"label",l=i.eventListeners||i.events||{};if(i.coordinates&&s){const t=i.nx||s[0][0]+(null!==(n=i.dx)&&void 0!==n?n:0),l=i.ny||s[0][1]+(null!==(o=i.dy)&&void 0!==o?o:0),a=s.map((n,o)=>{const s=Object.assign({},i,{note:0===o?i.note:{label:""},x:n[0],y:n[1],nx:t,ny:l});return e.jsx($t,Object.assign({"data-testid":"semiotic-annotation"},s,{type:r}),"multi-annotation-"+o)});return e.jsx("g",{children:a})}const a=i.note||{title:"none",label:i.label},c=`${a.label}-${a.title}-${i.i}`;return e.jsx($t,Object.assign({"data-testid":"semiotic-annotation",events:l},i,{type:r}),c)}function Gt(e,t){var n,o,i;const s=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.x)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.time;return s?null!=e.x?s(e.x):t.xAccessor&&null!=e[t.xAccessor]?s(e[t.xAccessor]):null:null}function Xt(e,t){var n,o,i;const s=null!==(o=null===(n=t.scales)||void 0===n?void 0:n.y)&&void 0!==o?o:null===(i=t.scales)||void 0===i?void 0:i.value;return s?null!=e.y?s(e.y):t.yAccessor&&null!=e[t.yAccessor]?s(e[t.yAccessor]):null:null}function Vt(e){return null==e?null:e+""}function qt(e,t,n){var o;return null===(o=t.stickyPositionCache)||void 0===o||o.set(e,n),n}function Ut(e,t,n){var o,i;const s=e.anchor||(null===(o=e.lifecycle)||void 0===o?void 0:o.anchor)||"fixed";if("latest"===s){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const i=n.pointNodes[o];if(i.pointId===e.pointId)return qt(t,n,{x:i.x,y:i.y})}const o=function(e){var t,n,o,i,s,r;const l=e.data;if(!l||0===l.length)return null;const a=l[l.length-1],c=null!==(n=null===(t=e.scales)||void 0===t?void 0:t.x)&&void 0!==n?n:null===(o=e.scales)||void 0===o?void 0:o.time,u=null!==(s=null===(i=e.scales)||void 0===i?void 0:i.y)&&void 0!==s?s:null===(r=e.scales)||void 0===r?void 0:r.value;if(!c||!u)return null;const d=a[e.xAccessor||"x"],h=a[e.yAccessor||"y"];return null==d||null==h?null:{x:c(d),y:u(h)}}(n);return o?qt(t,n,o):null}if("semantic"===s){const o=function(e,t,n){var o,i;const s=function(e){var t,n;return Vt(null!==(n=null===(t=e.provenance)||void 0===t?void 0:t.stableId)&&void 0!==n?n:e.stableId)}(e);if(!s)return null;const r=null===(o=n.pointNodes)||void 0===o?void 0:o.find(e=>Vt(e.pointId)===s);if(r)return qt(t,n,{x:r.x,y:r.y});const l=null===(i=n.data)||void 0===i?void 0:i.find(e=>function(e){var t,n,o;return Vt(null!==(n=null!==(t=e.stableId)&&void 0!==t?t:e.id)&&void 0!==n?n:null===(o=e.provenance)||void 0===o?void 0:o.stableId)}(e)===s);if(!l)return null;const a=Gt(l,n),c=Xt(l,n);return null==a||null==c?null:qt(t,n,{x:a,y:c})}(e,t,n);if(o)return o}let r=null,l=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,l=t.y)}if(null!=r&&null!=l||(r=Gt(e,n),l=Xt(e,n)),null!=r&&null!=l)return qt(t,n,{x:r,y:l});if("sticky"===s){const e=null===(i=n.stickyPositionCache)||void 0===i?void 0:i.get(t);if(e)return e}return null}function Kt(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}const Qt={secondary:0,primary:3};function Zt(e){return!0===(null==e?void 0:e._annotationDeferred)}function Jt(e){return"blended"===(null==e?void 0:e.cohesion)||"layer"===(null==e?void 0:e.cohesion)?e.cohesion:null}function en(e){var t;const n=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;return"number"==typeof n&&Number.isFinite(n)?Math.max(0,Math.min(1,n)):null}function tn(e){return Math.max(.72,.95-.06*e)}const nn={linear:r.curveLinear,monotoneX:r.curveMonotoneX,monotoneY:r.curveMonotoneY,step:r.curveStep,stepAfter:r.curveStepAfter,stepBefore:r.curveStepBefore,basis:r.curveBasis,cardinal:r.curveCardinal,catmullRom:r.curveCatmullRom};const on=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function sn(e){return!!e&&"object"==typeof e&&on.has(function(e){return"string"==typeof(null==e?void 0:e.type)?e.type:""}(e))}function rn(e){return"primary"===(null==e?void 0:e.emphasis)||!0===(null==e?void 0:e.defensive)}function ln(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function an(e){var t,n;let o;const i=null==e?void 0:e.emphasis;o="primary"===i?100:"secondary"===i?10:50;const s=null===(t=null==e?void 0:e.provenance)||void 0===t?void 0:t.confidence;switch("number"==typeof s&&Number.isFinite(s)&&(o+=15*Math.max(0,Math.min(1,s))),null===(n=null==e?void 0:e.lifecycle)||void 0===n?void 0:n.freshness){case"fresh":o+=8;break;case"aging":o+=4;break;case"stale":o+=1;break;case"expired":o-=200}return o}new Set(["label","callout","callout-circle","callout-rect"]);const cn=32,un=6,dn=4,hn=8,fn=72;const gn={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function pn(e){return sn(e)}function yn(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),i=[];let s="";for(const e of o)s&&s.length+e.length+1>n?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function mn(e,t,n,o,i){const s=e+n,r=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?s-i.width-4:s+4,y:0>o?r-i.height:r,width:i.width,height:i.height}:{x:0>n?s-i.width:s,y:0>o?r-i.height-4:r+4,width:i.width,height:i.height}}function vn(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function bn(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function xn(e,t,n,o,i,s,r,l){const a=vn(e,r);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const i=Math.max(0,o-e.x),s=Math.max(0,o-e.y);return(i+Math.max(0,e.x+e.width-(t-o)))*e.height+(s+Math.max(0,e.y+e.height-(n-o)))*e.width}(a,i,s,l);for(const e of n)c+=12*bn(a,e);for(const e of o)c+=4*bn(a,e);return c}function kn(e){var t;const{annotations:n,context:o,defaultOffset:i=cn,notePadding:s=un,markPadding:r=dn,edgePadding:l=hn,preserveManualOffsets:a=!0,routeLongConnectors:c=!0,connectorThreshold:u=fn,density:d,progressiveDisclosure:h=!1,redundantCues:f=!1,responsive:g,cohesion:p,audience:y}=e,m=o.width||0,v=o.height||0;if(0===n.length||0>=m||0>=v)return n.slice();const b=[],x=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(o,r);let k=!1;const w=n.map((e,t)=>{if(!pn(e))return e;const n=function(e,t,n){var o,i;if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const s=null!==(o=e.pointId)&&void 0!==o?o:e.nodeId;if(null!=s&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===s);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,l=null===(i=n.scales)||void 0===i?void 0:i.geoProjection;if(Array.isArray(r)&&r.length>=2&&l){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=l([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Ut(e,t,n):{x:e.x,y:e.y}}(e,t,o);if(!n)return e;const r=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[...yn("string"==typeof e.title?e.title:void 0,t),...yn("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(d=e).dx||"number"==typeof d.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return b.push(vn(mn(n.x,n.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,r),s)),e}var d;let h=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(i)){const t=xn(mn(n.x,n.y,e.dx,e.dy,r),e,b,x,m,v,s,l);f>t&&(h=e,f=t)}if(!h)return e;const g=vn(mn(n.x,n.y,h.dx,h.dy,r),s);b.push(g);const p=Math.hypot(h.dx,h.dy),y=c&&p>=u&&"text"!==e.type&&"widget"!==e.type?Object.assign(Object.assign({},e.connector||{end:"arrow"}),{type:"curve"}):e.connector;return k=!0,Object.assign(Object.assign(Object.assign({},e),{dx:h.dx,dy:h.dy}),y?{connector:y}:{})}),j=k?w:n.slice();let A=j;if(f){let e=!1;const t=j.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:Object.assign(Object.assign({},e),{_redundantConnector:!0})}(t);return n!==t&&(e=!0),n});A=e?t:j}{let e=!1;const t=A.map(t=>{if(!0!==(null==t?void 0:t.defensive))return t;const n=function(e){var t;const n=null==e?void 0:e.provenance;if(!n||"object"!=typeof n)return e;const o="string"==typeof n.source?null!==(t=gn[n.source])&&void 0!==t?t:n.source:null,i="number"==typeof n.confidence&&Number.isFinite(n.confidence)?Math.round(100*Math.max(0,Math.min(1,n.confidence)))+"%":null;if(!o&&!i)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const s=[o,i].filter(Boolean).join(" · "),r="string"==typeof e.label?e.label:"";return r.includes(`(${s})`)?e:Object.assign(Object.assign({},e),{label:r?`${r} (${s})`:`(${s})`})}(t);return n!==t&&(e=!0),n});A=e?t:A}const O=new Set;if(d){const e="object"==typeof d?d:{},n=function(e){if(!e)return 1;const t=function(e){const t=null==e?void 0:e.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(y),o=1===n?e:Object.assign(Object.assign({},e),{maxAnnotations:Math.max(0,Math.round((null!==(t=e.maxAnnotations)&&void 0!==t?t:ln(m,v,e))*n))}),{deferred:i}=function(e){var t;const{annotations:n,width:o,height:i}=e,s=Math.max(0,null!==(t=e.minVisible)&&void 0!==t?t:1),r=ln(o,i,e),l=n.map((e,t)=>{return{annotation:e,index:t,note:(n=e,sn(n))};var n}),a=l.filter(e=>e.note);if(0===a.length||r>=a.length)return{visible:n.slice(),deferred:[],budget:r};const c=a.filter(e=>rn(e.annotation)),u=a.filter(e=>!rn(e.annotation)).sort((e,t)=>an(t.annotation)-an(e.annotation)||e.index-t.index),d=Math.min(u.length,Math.max(Math.max(0,r-c.length),Math.max(0,s-c.length))),h=new Set([...c.map(e=>e.index),...u.slice(0,d).map(e=>e.index)]),f=[],g=[];for(const{annotation:e,index:t,note:n}of l)!n||h.has(t)?f.push(e):g.push(e);return{visible:f,deferred:g,budget:r}}(Object.assign({annotations:A,width:m,height:v},o));for(const e of i)O.add(e)}if(g&&("object"==typeof g&&"number"==typeof g.minWidth?g.minWidth:480)>=m)for(const e of A)pn(e)&&"secondary"===e.emphasis&&O.add(e);if(O.size>0)for(const e of A)!0===(null==e?void 0:e.defensive)&&O.delete(e);let S;return S=0===O.size?A:h?A.map(e=>O.has(e)?Object.assign(Object.assign({},e),{_annotationDeferred:!0}):e):A.filter(e=>!O.has(e)),p?function(e,t){let n=!1;const o=e.map(e=>pn(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,Object.assign(Object.assign({},e),{cohesion:t})):e);return n?o:e}(S,p):S}let wn={positions:new Map};const jn=new Set;function An(){for(const e of jn)e()}function On(e,t){const n=wn.positions.get(e);if(null==n?void 0:n.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(wn.positions);o.delete(e),wn={positions:o},An()}function Sn(e,t){const n=wn.positions.get(e);if(!(null==n?void 0:n.locked))return;if(t&&n.sourceId!==t)return;const o=new Map(wn.positions);o.delete(e),wn={positions:o},An()}function Mn(){return wn}function Cn(e){return jn.add(e),()=>jn.delete(e)}const _n={positions:new Map};function Pn(){return()=>{}}function Ln(){return _n}function Nn(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],i=n[n.length-1],s=o instanceof Date,r=o instanceof Date?o.getTime():o,l=i instanceof Date?i.getTime():i;if(2>t||r===l)return s?[new Date(r),new Date(l)]:[r,l];const a=(l-r)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?l:r+e*a;c[e]=s?new Date(n):n}return c}(e,t):e.ticks(t)}function Fn(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Bn(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function Rn(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Tn(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Hn(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,i="left"===e?-1:1,s=Math.ceil(t/8);let r="M0,"+o;for(let e=0;s>e;e++){const n=8*(e+1);r+=`L${Math.min(8*e+4,t)},${o+4*i}`,r+=`L${Math.min(n,t)},${o}`}return r}{const o="bottom"===e?0:t,i="bottom"===e?1:-1,s=Math.ceil(n/8);let r=`M${o},0`;for(let e=0;s>e;e++){const t=8*(e+1);r+=`L${o+4*i},${Math.min(8*e+4,n)}`,r+=`L${o},${Math.min(t,n)}`}return r}}function In(n){const{width:o,height:i,totalWidth:s,totalHeight:r,margin:l,scales:a,showAxes:c,axes:u,showGrid:d,xFormat:h,yFormat:f,axisExtent:g}=n,p=t.useMemo(()=>{var e,t;if(!a)return[];const n=null==u?void 0:u.find(e=>"bottom"===e.orient),i=(null==n?void 0:n.tickFormat)||h||Dn,s=Math.max(2,Math.floor(o/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Nn(a.x,"exact"===g?Math.max(2,r):Math.min(r,s),g),c=l.map(e=>e.valueOf()),d=l.map((e,t)=>({value:e,pixel:a.x(e),label:i(e,t,c)})),f=d.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return Wn(d,Math.max(55,f+8))},[a,u,h,o,g]),y=t.useMemo(()=>{var e,t;if(!a)return[];const n=null==u?void 0:u.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||f||Dn,s=Math.max(2,Math.floor(i/30)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;return Wn((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Nn(a.y,"exact"===g?Math.max(2,r):Math.min(r,s),g)).map(e=>({value:e,pixel:a.y(e),label:o(e)})),22)},[a,u,f,i,g]),m=d&&a,v=c&&a;if(!m&&!v)return null;const b=null==u?void 0:u.find(e=>"bottom"===e.orient),x=null==u?void 0:u.find(e=>"left"===e.orient),k=v&&(!b||!1!==b.baseline),w=v&&(!x||!1!==x.baseline),j=(null==b?void 0:b.jaggedBase)||!1,A=(null==x?void 0:x.jaggedBase)||!1,O="var(--semiotic-border, #ccc)";return e.jsx("svg",{width:s,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:e.jsxs("g",{transform:`translate(${l.left},${l.top})`,children:[m&&(()=>{var t,n;const s=Tn(null===(t=null==u?void 0:u.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),r=Tn(null===(n=null==u?void 0:u.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[p.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:i,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:s},"xgrid-"+n)),y.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:o,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:r},"ygrid-"+n))]})})(),k&&!j&&e.jsx("line",{x1:0,y1:i,x2:o,y2:i,stroke:O,strokeWidth:1}),j&&e.jsx("path",{d:Hn("bottom",o,i),fill:"none",stroke:O,strokeWidth:1}),w&&!A&&e.jsx("line",{x1:0,y1:0,x2:0,y2:i,stroke:O,strokeWidth:1}),A&&e.jsx("path",{d:Hn("left",o,i),fill:"none",stroke:O,strokeWidth:1})]})})}function Dn(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function Wn(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function En(n){var o,i;const{width:s,height:l,totalWidth:c,totalHeight:u,margin:d,scales:g,showAxes:p,axes:y,xLabel:m,yLabel:v,yLabelRight:b,xFormat:x,yFormat:k,axisExtent:w,showGrid:j,title:A,legend:O,legendHoverBehavior:S,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:_,legendPosition:P="right",legendLayout:L,foregroundGraphics:N,marginalGraphics:F,xValues:B,yValues:R,annotations:T,autoPlaceAnnotations:H,svgAnnotationRules:I,xAccessor:D,yAccessor:W,annotationData:E,pointNodes:z,curve:$,underlayRendered:Y,canvasObscuresUnderlay:G=!0,linkedCrosshairName:X,linkedCrosshairSourceId:V,children:q}=n,U=t.useMemo(()=>{var e,t;if(!p||!g)return[];const n=null==y?void 0:y.find(e=>"bottom"===e.orient),o=(null==n?void 0:n.tickFormat)||x||Dn,i=Math.max(2,Math.floor(s/70)),r=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5,l=null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Nn(g.x,"exact"===w?Math.max(2,r):Math.min(r,i),w),a=l.map(e=>e.valueOf()),c=l.map((e,t)=>({value:e,pixel:g.x(e),label:o(e,t,a)})),u=c.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),d=(null==n?void 0:n.autoRotate)?Math.max(20,Math.min(u+8,55)):Math.max(55,u+8);let h=Wn(c,d);if(h.length>1&&(h=h.filter((e,t)=>0===t||e.label+""!=h[t-1].label+"")),(null==n?void 0:n.includeMax)&&h.length>0&&"exact"!==w&&!(null==n?void 0:n.tickValues)){const e=g.x.domain()[1],t=g.x(e),n=h[h.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e,h.length,a);d>t-n&&h.length>1&&(h=h.slice(0,-1)),h.push({value:e,pixel:t,label:i})}}return h},[p,g,y,x,s,w]),K=t.useMemo(()=>{var e,t;if(!p||!g)return[];const n=null==y?void 0:y.find(e=>"left"===e.orient),o=(null==n?void 0:n.tickFormat)||k||Dn,i=Math.max(2,Math.floor(l/30)),s=null!==(e=null==n?void 0:n.ticks)&&void 0!==e?e:5;let r=Wn((null!==(t=null==n?void 0:n.tickValues)&&void 0!==t?t:Nn(g.y,"exact"===w?Math.max(2,s):Math.min(s,i),w)).map(e=>({value:e,pixel:g.y(e),label:o(e)})),22);if(r.length>1&&(r=r.filter((e,t)=>0===t||e.label+""!=r[t-1].label+"")),(null==n?void 0:n.includeMax)&&r.length>0&&"exact"!==w&&!(null==n?void 0:n.tickValues)){const e=g.y.domain()[1],t=g.y(e),n=r[r.length-1].pixel;if(Math.abs(t-n)>1){const i=o(e);22>Math.abs(t-n)&&r.length>1&&(r=r.slice(0,-1)),r.push({value:e,pixel:t,label:i})}}return r},[p,g,y,k,l,w]),Q=t.useMemo(()=>{var e,t;if(!p||!g)return[];const n=null==y?void 0:y.find(e=>"right"===e.orient);if(!n)return[];const o=n.tickFormat||k||Dn,i=Math.max(2,Math.floor(l/30)),s=null!==(e=n.ticks)&&void 0!==e?e:5;return Wn((null!==(t=n.tickValues)&&void 0!==t?t:Nn(g.y,"exact"===w?Math.max(2,s):Math.min(s,i),w)).map(e=>({value:e,pixel:g.y(e),label:o(e)})),22)},[p,g,y,k,l,w]),Z=t.useRef(new Map),J=t.useRef(null!==(o=null==T?void 0:T.length)&&void 0!==o?o:0),ee=null!==(i=null==T?void 0:T.length)&&void 0!==i?i:0;J.current!==ee&&(J.current=ee,Z.current=new Map);const te=t.useMemo(()=>{if(!T||0===T.length)return null;const t=function(t,n,o){var i,s,l,c,u,d,g,p,y,m,v,b,x,k,w,j,A,O,S,M,C,_,P,L,N,F,B,R,T,H,I,D,W,E,z,$,Y,G,X,V,q,U,K,Q,Z,J,ee,te,ne,oe,ie;switch(t.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const r=Ut(t,n,o);if(!r)return null;const{x:a,y:c}=r;if(!Kt(a,c,o))return null;const u="callout"===t.type?"callout-circle":t.type,d="callout-circle"===u?{radius:null!==(i=t.radius)&&void 0!==i?i:12,radiusPadding:t.radiusPadding}:"callout-rect"===u?{width:t.width,height:t.height}:void 0;return e.jsx(Yt,{noteData:Object.assign(Object.assign({x:a,y:c,dx:null!==(s=t.dx)&&void 0!==s?s:30,dy:null!==(l=t.dy)&&void 0!==l?l:-30,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:u},d?{subject:d}:{}),{connector:t.connector||{end:"arrow"},color:t.color,disable:t.disable,opacity:t.opacity,strokeDasharray:t.strokeDasharray,className:t.className})},"ann-"+n)}case"x-threshold":{const i=Gt(null!=t.value?Object.assign(Object.assign({},t),{x:t.value}):t,o);if(null==i)return null;const s=t.color||"#f97316",r=t.labelPosition||"top";let l;l="bottom"===r?(o.height||0)-4:"center"===r?(o.height||0)/2:12;const a=i>.6*(o.width||0),c=a?i-4:i+4,u=a?"end":"start";return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:i,y1:0,x2:i,y2:o.height||0,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:c,y:l,textAnchor:u,fill:s,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"y-threshold":{const i=Xt(null!=t.value?Object.assign(Object.assign({},t),{y:t.value}):t,o);if(null==i)return null;const s=t.color||"#f97316",r=t.labelPosition||"right";let l,a;return"left"===r?(l=4,a="start"):"center"===r?(l=(o.width||0)/2,a="middle"):(l=(o.width||0)-4,a="end"),e.jsxs("g",{opacity:t.opacity,children:[e.jsx("line",{x1:0,y1:i,x2:o.width||0,y2:i,stroke:s,strokeWidth:t.strokeWidth||1.5,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:l,y:i-4,textAnchor:a,fill:s,fontSize:12,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"enclose":{const i=(t.coordinates||[]).map(e=>({x:Gt(Object.assign(Object.assign({},e),{type:"point"}),o),y:Xt(Object.assign(Object.assign({},e),{type:"point"}),o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=a.packEnclose(i),r=t.padding||10;return e.jsxs("g",{children:[e.jsx("circle",{cx:s.x,cy:s.y,r:s.r+r,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:s.x,y:s.y-s.r-r-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"rect-enclose":{const i=(t.coordinates||[]).map(e=>({x:Gt(Object.assign(Object.assign({},e),{type:"point"}),o),y:Xt(Object.assign(Object.assign({},e),{type:"point"}),o)})).filter(e=>null!=e.x&&null!=e.y);if(2>i.length)return null;const s=t.padding||10,r=i.map(e=>e.x),l=i.map(e=>e.y),[a,c]=Bt(r),[u,d]=Bt(l),h=a-s,f=c+s,g=u-s;return e.jsxs("g",{children:[e.jsx("rect",{x:h,y:g,width:f-h,height:d+s-g,fill:t.fill||"none",fillOpacity:t.fillOpacity||.1,stroke:t.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),t.label&&e.jsx("text",{x:(h+f)/2,y:g-4,textAnchor:"middle",fill:t.color||"var(--semiotic-text-secondary, #666)",fontSize:12,children:t.label})]},"ann-"+n)}case"highlight":{const i=o.data||[],s="function"==typeof t.filter?i.filter(t.filter):t.field&&null!=t.value?i.filter(e=>e[t.field]===t.value):[],r={stroke:t.color||"#f97316",strokeWidth:2,fill:"none"};return e.jsx("g",{children:s.map((n,i)=>{const s=Gt(n,o),l=Xt(n,o);if(null==s||null==l)return null;const a="function"==typeof t.r?t.r(n):t.r||6,c="function"==typeof t.style?t.style(n):t.style||r;return e.jsx("circle",Object.assign({cx:s,cy:l,r:a},c),"hl-"+i)})},"ann-"+n)}case"bracket":{const i=Gt(t,o),s=Xt(t,o);return e.jsx(Yt,{noteData:{x:null!=i?i:0,y:null!=s?s:0,dx:t.dx||0,dy:t.dy||0,note:{label:t.label,title:t.title,wrap:t.wrap||120},type:"bracket",subject:{type:t.bracketType||"curly",width:t.width,height:t.height,depth:t.depth||30},color:t.color}},"ann-"+n)}case"trend":{const i=o.data||[];if(2>i.length)return null;const s=o.xAccessor||"x",r=o.yAccessor||"y",l="ordinal"===o.frameType,a="horizontal"===o.projection,h=l?s:null,v=l?r:null;let b;const x=[],k=new Map;if(l&&h&&v){for(const e of i){const t=e[h];if(null==t)continue;const n=t+"";k.has(n)||(k.set(n,x.length),x.push(n))}b=i.map(e=>{const t=e[h],n=e[v];if(null==t||null==n)return null;const o=k.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else b=i.map(e=>[e[s],e[r]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>b.length)return null;const w=null!==(u=null===(c=o.scales)||void 0===c?void 0:c.x)&&void 0!==u?u:null===(d=o.scales)||void 0===d?void 0:d.time,j=null!==(p=null===(g=o.scales)||void 0===g?void 0:g.y)&&void 0!==p?p:null===(y=o.scales)||void 0===y?void 0:y.value;if(!w||!j)return null;const A=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(x.length-1,n+1),i=t-n,s=e(x[n]);return s+(e(x[o])-s)*i},O=w,S=j;let M;if(l)if(a){const e=A(S);M=(t,n)=>[O(n),e(t)]}else{const e=A(O);M=(t,n)=>[e(t),S(n)]}else M=(e,t)=>[O(e),S(t)];const C=t.method||"linear";let _;_="loess"===C?function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),i=o.map(e=>e[0]),s=o.map(e=>e[1]),r=Math.max(2,Math.ceil(t*n)),l=[];for(let e=0;n>e;e++){const t=i[e],o=i.map(e=>Math.abs(e-t)),a=o.slice().sort((e,t)=>e-t)[Math.min(r-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===a?0:o[e]/a;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,d=0,h=0,f=0,g=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,d+=t*i[e],h+=t*s[e],f+=t*i[e]*i[e],g+=t*i[e]*s[e])}if(0===u){l.push([t,s[e]]);continue}const p=u*f-d*d;if(1e-12>Math.abs(p))l.push([t,h/u]);else{const e=(u*g-d*h)/p;l.push([t,(h-e*d)/u+e*t])}}return l}(b,null!==(m=t.bandwidth)&&void 0!==m?m:.3):("polynomial"===C?f.default.polynomial(b,{order:t.order||2}):f.default.linear(b)).points;const P=_.map(([e,t])=>{const[n,o]=M(e,t);return`${n},${o}`}).join(" "),L=t.color||"#6366f1",N=_[_.length-1],[F,B]=M(N[0],N[1]);return e.jsxs("g",{children:[e.jsx("polyline",{points:P,fill:"none",stroke:L,strokeWidth:t.strokeWidth||2,strokeDasharray:t.strokeDasharray||"6,3"}),t.label&&e.jsx("text",{x:F+4,y:B-4,fill:L,fontSize:11,children:t.label})]},"ann-"+n)}case"band":{const i=null!==(b=null===(v=o.scales)||void 0===v?void 0:v.y)&&void 0!==b?b:null===(x=o.scales)||void 0===x?void 0:x.value,s=null!==(k=null==i?void 0:i(t.y0))&&void 0!==k?k:0,r=null!==(w=null==i?void 0:i(t.y1))&&void 0!==w?w:o.height||0;return e.jsxs("g",{opacity:t.opacity,children:[e.jsx("rect",{x:0,y:Math.min(s,r),width:o.width||0,height:Math.abs(r-s),fill:t.fill||"var(--semiotic-primary, #6366f1)",fillOpacity:t.fillOpacity||.1}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.max(Math.min(s,r),0)+13,textAnchor:"end",fill:t.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",stroke:"var(--semiotic-bg, #ffffff)",strokeWidth:3,paintOrder:"stroke",children:t.label})]},"ann-"+n)}case"envelope":{const i=o.data||[];if(2>i.length)return null;const s=o.xAccessor||"x",l=null!==(A=null===(j=o.scales)||void 0===j?void 0:j.x)&&void 0!==A?A:null===(O=o.scales)||void 0===O?void 0:O.time,a=null!==(M=null===(S=o.scales)||void 0===S?void 0:S.y)&&void 0!==M?M:null===(C=o.scales)||void 0===C?void 0:C.value;if(!l||!a)return null;const c=t.upperAccessor||"upperBounds",u=t.lowerAccessor||"lowerBounds",d=t.filter,h=i.filter(e=>null!=e[c]&&null!=e[u]&&!(d&&!d(e))).sort((e,t)=>e[s]-t[s]);if(2>h.length)return null;const f=nn[o.curve||"linear"]||r.curveLinear,g=r.area().x(e=>l(e[s])).y0(e=>a(e[u])).y1(e=>a(e[c])).curve(f)(h);if(!g)return null;const p=t.fill||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:g,fill:p,fillOpacity:null!==(_=t.fillOpacity)&&void 0!==_?_:.15,stroke:"none"}),t.label&&h.length>0&&e.jsx("text",{x:l(h[h.length-1][s])+4,y:a(h[h.length-1][c])-4,fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"anomaly-band":{const i=o.data||[];if(2>i.length)return null;const s=o.yAccessor||"y",r=null!==(L=null===(P=o.scales)||void 0===P?void 0:P.x)&&void 0!==L?L:null===(N=o.scales)||void 0===N?void 0:N.time,l=null!==(B=null===(F=o.scales)||void 0===F?void 0:F.y)&&void 0!==B?B:null===(R=o.scales)||void 0===R?void 0:R.value;if(!r||!l)return null;const a=i.map(e=>e[s]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const c=a.reduce((e,t)=>e+t,0)/a.length,u=a.reduce((e,t)=>e+Math.pow(t-c,2),0)/a.length,d=Math.sqrt(u),h=null!==(T=t.threshold)&&void 0!==T?T:2,f=c-h*d,g=!1!==t.showBand,p=t.fill||"#6366f1",y=null!==(H=t.fillOpacity)&&void 0!==H?H:.1,m=t.anomalyColor||"#ef4444",v=null!==(I=t.anomalyRadius)&&void 0!==I?I:6,b=l(c+h*d),x=l(f),k=i.filter(e=>{const t=e[s];return null!=t&&Math.abs(t-c)>h*d});return e.jsxs("g",{children:[g&&e.jsx("rect",{x:0,y:Math.min(b,x),width:o.width||0,height:Math.abs(x-b),fill:p,fillOpacity:y}),k.map((t,n)=>{const i=Gt(t,o),s=Xt(t,o);return null==i||null==s?null:e.jsx("circle",{cx:i,cy:s,r:v,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+n)}),t.label&&e.jsx("text",{x:(o.width||0)-4,y:Math.min(b,x)-4,textAnchor:"end",fill:p,fontSize:11,children:t.label})]},"ann-"+n)}case"forecast":{const i=o.data||[];if(3>i.length)return null;const s=o.xAccessor||"x",r=o.yAccessor||"y",l=null!==(W=null===(D=o.scales)||void 0===D?void 0:D.x)&&void 0!==W?W:null===(E=o.scales)||void 0===E?void 0:E.time,a=null!==($=null===(z=o.scales)||void 0===z?void 0:z.y)&&void 0!==$?$:null===(Y=o.scales)||void 0===Y?void 0:Y.value;if(!l||!a)return null;const c=i.map(e=>[e[s],e[r]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>c.length)return null;let u;if("polynomial"===(t.method||"linear")){const e=f.default.polynomial(c,{order:t.order||2}).equation;u=t=>e.reduce((e,n,o)=>e+n*Math.pow(t,o),0)}else{const e=c.length;let t=0,n=0,o=0,i=0;for(const[e,s]of c)t+=e,n+=s,o+=e*e,i+=e*s;const s=e*o-t*t;if(1e-12>Math.abs(s))return null;const r=(e*i-t*n)/s,l=(n-r*t)/e;u=e=>l+r*e}const d=c.length,h=c.map(([e,t])=>t-u(e)).reduce((e,t)=>e+t*t,0),g=Math.sqrt(h/Math.max(d-2,1)),p=c.reduce((e,t)=>e+t[0],0)/d,y=c.reduce((e,t)=>e+Math.pow(t[0]-p,2),0),m=null!==(G=t.confidence)&&void 0!==G?G:.95,v=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,b=null!==(X=t.steps)&&void 0!==X?X:5,x=c[d-1][0],k=(x-c[0][0])/Math.max(d-1,1),w=[];for(let e=1;b>=e;e++)w.push(x+e*k);const j=[];for(const e of w){const t=u(e),n=g*Math.sqrt(1+1/d+(y>0?Math.pow(e-p,2)/y:0))*v;j.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${j.map(e=>`${l(e.x)},${a(e.yUpper)}`).join(" L")} L${j.slice().reverse().map(e=>`${l(e.x)},${a(e.yLower)}`).join(" L")} Z`,O=j.map(e=>`${l(e.x)},${a(e.yCenter)}`).join(" "),S=`${l(x)},${a(u(x))}`,M=t.strokeColor||"#6366f1";return e.jsxs("g",{children:[e.jsx("path",{d:A,fill:t.fill||"#6366f1",fillOpacity:null!==(V=t.fillOpacity)&&void 0!==V?V:.15,stroke:"none"}),e.jsx("polyline",{points:`${S} ${O}`,fill:"none",stroke:M,strokeWidth:null!==(q=t.strokeWidth)&&void 0!==q?q:2,strokeDasharray:null!==(U=t.strokeDasharray)&&void 0!==U?U:"6,3"}),t.label&&j.length>0&&e.jsx("text",{x:l(j[j.length-1].x)+4,y:a(j[j.length-1].yCenter)-4,fill:M,fontSize:11,children:t.label})]},"ann-"+n)}case"widget":{let i=null,s=null;if(null!=t.px&&null!=t.py)i=t.px,s=t.py;else{const e=Ut(t,n,o);if(!e)return null;i=e.x,s=e.y}if(null==i||null==s)return null;if(!Kt(i,s,o))return null;const r=null!==(K=t.dx)&&void 0!==K?K:0,l=null!==(Q=t.dy)&&void 0!==Q?Q:0,a=null!==(Z=t.width)&&void 0!==Z?Z:32,c=null!==(J=t.height)&&void 0!==J?J:32,u=null!==(ee=t.content)&&void 0!==ee?ee:e.jsx("span",{style:{fontSize:18,cursor:"default"},title:t.label||"Info",children:"ℹ️"});return e.jsx("foreignObject",{x:i+r-a/2,y:s+l-c/2,width:a,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:e.jsx("div",{style:{width:a,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const i=Ut(t,n,o);if(!i)return null;const{x:s,y:r}=i,l=s+(t.dx||0),a=r+(t.dy||0),c=t.color||"var(--semiotic-text, #333)",u=e.jsx("text",{x:l,y:a,fill:c,fontSize:t.fontSize||11,opacity:t.opacity,strokeDasharray:t.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:t.label});return!0!==t._redundantConnector?h.cloneElement(u,{key:"ann-text-"+n}):e.jsxs("g",{opacity:t.opacity,strokeDasharray:t.strokeDasharray,children:[e.jsx("line",{x1:s,y1:r,x2:l,y2:a,stroke:c,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),h.cloneElement(u,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const i=t.category;if(null==i)return null;const s=e=>"function"==typeof e&&"function"==typeof e.bandwidth,r=null===(te=o.scales)||void 0===te?void 0:te.o,l=null===(ne=o.scales)||void 0===ne?void 0:ne.x,a=null===(oe=o.scales)||void 0===oe?void 0:oe.y,c=s(r)?r:s(l)?l:s(a)?a:null;if(!c)return null;const u=c(i+"");if(null==u)return null;const d=c.bandwidth(),h=t.color||"var(--semiotic-primary, #4589ff)",f=null!==(ie=t.opacity)&&void 0!==ie?ie:.15,g=t.label;return e.jsxs("g",(o.projection?"vertical"===o.projection:c===l)?{children:[e.jsx("rect",{x:u,y:0,width:d,height:o.height||0,fill:h,fillOpacity:f}),g&&e.jsx("text",{x:u+d/2,y:12,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",children:g})]}:{children:[e.jsx("rect",{x:0,y:u,width:o.width||0,height:d,fill:h,fillOpacity:f}),g&&e.jsx("text",{x:12,y:u+d/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",children:g})]},"ann-"+n)}default:return null}},n={scales:g?{x:g.x,y:g.y,time:g.x,value:g.y}:null,timeAxis:"x",xAccessor:D,yAccessor:W,width:s,height:l,data:E,frameType:"xy",pointNodes:z,curve:$,stickyPositionCache:Z.current};return function(t,n,o,i){const s=[];return t.forEach((e,t)=>{let r;if(o){const s=o(e,t,i);r=null!=s?s:n(e,t,i)}else r=n(e,t,i);r&&s.push({node:r,annotation:e})}),function(t){const n=t.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===(null==n?void 0:n.emphasis)||"secondary"===(null==n?void 0:n.emphasis)?n.emphasis:null),confidence:en(e.annotation),readingOrder:null,rank:1};var n}),o=n.some(e=>null!=e.emphasis||null!=e.confidence),i=t.some(e=>Zt(e.annotation)),s=t.some(e=>null!=Jt(e.annotation)),r=t.some(e=>"layer"===Jt(e.annotation));if(!o&&!i&&!s)return t.map(e=>e.node);const l=n.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>{var n,o;return(null!==(n=t.confidence)&&void 0!==n?n:0)-(null!==(o=e.confidence)&&void 0!==o?o:0)||e.i-t.i});l.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,l.length)});for(const e of n)e.emphasis&&(e.rank=Qt[e.emphasis]);const a=n.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(t=>{const{p:n,i:o,emphasis:i,readingOrder:s}=t,r=Zt(n.annotation);let l=n.node;if("primary"===i||"secondary"===i||null!=s){const t=null==i&&null!=s;l=e.jsx("g",Object.assign({className:t?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+i},"secondary"===i?{opacity:.6,fontSize:"0.88em"}:{},t?{opacity:tn(s),"data-annotation-reading-order":s}:{},{children:n.node}),"annotation-emphasis-"+o)}const a=Jt(n.annotation);return a&&(l=e.jsx("g",{className:"annotation-cohesion--"+a,children:l},"annotation-cohesion-"+o)),r&&(l=e.jsx("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:l},"annotation-deferred-"+o)),l});return i&&a.unshift(e.jsx("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),r&&a.unshift(e.jsx("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(s)}(H?kn(Object.assign({annotations:T,context:n},"object"==typeof H?H:{})):T,t,I,n)},[T,H,I,s,l,D,W,E,g,z,$]),ne=function(e){var n;const o=t.useSyncExternalStore(e?Cn:Pn,e?Mn:Ln,e?Mn:Ln);return e&&null!==(n=o.positions.get(e))&&void 0!==n?n:null}(X);return t.useEffect(()=>{if(!(null==ne?void 0:ne.locked)||!X)return;const e=e=>{"Escape"===e.key&&Sn(X)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[null==ne?void 0:ne.locked,X]),p||A||O||N||F||te&&te.length>0||j||q||ne?e.jsxs("svg",{role:"img",width:c,height:u,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[e.jsx("title",{children:"string"==typeof A?A:"XY Chart"}),e.jsx("desc",{children:"string"==typeof A?A+" — XY data visualization":"XY data visualization"}),e.jsxs("g",{transform:`translate(${d.left},${d.top})`,children:[j&&g&&(!Y||G)&&(()=>{var t,n;const o=Tn(null===(t=null==y?void 0:y.find(e=>"bottom"===e.orient))||void 0===t?void 0:t.gridStyle),i=Tn(null===(n=null==y?void 0:y.find(e=>"left"===e.orient))||void 0===n?void 0:n.gridStyle);return e.jsxs("g",{className:"stream-grid",children:[U.map((t,n)=>e.jsx("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:l,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"xgrid-"+n)),K.map((t,n)=>e.jsx("line",{x1:0,y1:t.pixel,x2:s,y2:t.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:i},"ygrid-"+n))]})})(),p&&g&&(()=>{const t=null==y?void 0:y.find(e=>"left"===e.orient),n=null==y?void 0:y.find(e=>"bottom"===e.orient),o=!t||!1!==t.baseline,i=!n||!1!==n.baseline,r=(null==t?void 0:t.jaggedBase)||!1,a=(null==n?void 0:n.jaggedBase)||!1,c=null==n?void 0:n.landmarkTicks,u=null==t?void 0:t.landmarkTicks,h="var(--semiotic-border, #ccc)",f="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",p=!!(null==n?void 0:n.autoRotate)&&U.length>1&&(()=>{const e=s/Math.max(U.length-1,1);return U.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),x={fontSize:"var(--semiotic-tick-font-size, 12px)"},k={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},w={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},j=null==n?void 0:n.tickAnchor,A=null==t?void 0:t.tickAnchor,O=Rn(U),S=Rn(K);return e.jsxs("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[e.jsxs("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!Y||G)&&i&&!a&&e.jsx("line",{x1:0,y1:l,x2:s,y2:l,stroke:h,strokeWidth:1}),(!Y||G)&&a&&e.jsx("path",{d:Hn("bottom",s,l),fill:"none",stroke:h,strokeWidth:1}),U.map((t,n)=>{const o=!!c&&("function"==typeof c?c(t.value,n):Ve(t.value,n>0?U[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${t.pixel},${l})`,children:[e.jsx("line",{y2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{y:p?10:18,textAnchor:p?"end":Fn(j,t.pixel===O.min,t.pixel===O.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?k:x),transform:p?"rotate(-45)":void 0,children:t.label}):e.jsx("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"center",userSelect:"none"},x),children:t.label})})]},"xtick-"+n)}),m&&e.jsx("text",{x:s/2,y:l+40,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:m})]}),e.jsxs("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!Y||G)&&o&&!r&&e.jsx("line",{x1:0,y1:0,x2:0,y2:l,stroke:h,strokeWidth:1}),(!Y||G)&&r&&e.jsx("path",{d:Hn("left",s,l),fill:"none",stroke:h,strokeWidth:1}),K.map((t,n)=>{const o=!!u&&("function"==typeof u?u(t.value,n):Ve(t.value,n>0?K[n-1].value:void 0));return e.jsxs("g",{transform:`translate(0,${t.pixel})`,children:[e.jsx("line",{x2:-5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:-8,textAnchor:"end",dominantBaseline:Bn(A,t.pixel===S.min,t.pixel===S.max),fontWeight:o?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},o?k:x),children:t.label}):e.jsx("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"right",userSelect:"none"},x),children:t.label})})]},"ytick-"+n)}),(()=>{const n=(null==t?void 0:t.label)||v;return n?e.jsx("text",{x:15-d.left,y:l/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-d.left}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:n}):null})()]}),(()=>{const t=null==y?void 0:y.find(e=>"right"===e.orient);if(!t||0===Q.length)return null;const n=!1!==t.baseline,o=t.landmarkTicks,i=t.label||b,r=t.tickAnchor,a=Rn(Q);return e.jsxs("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[n&&e.jsx("line",{x1:s,y1:0,x2:s,y2:l,stroke:h,strokeWidth:1}),Q.map((t,n)=>{const i=!!o&&("function"==typeof o?o(t.value,n):Ve(t.value,n>0?Q[n-1].value:void 0));return e.jsxs("g",{transform:`translate(${s},${t.pixel})`,children:[e.jsx("line",{x2:5,stroke:h,strokeWidth:1}),"string"==typeof t.label||"number"==typeof t.label?e.jsx("text",{x:8,textAnchor:"start",dominantBaseline:Bn(r,t.pixel===a.min,t.pixel===a.max),fontWeight:i?600:400,fill:f,className:"semiotic-axis-tick",style:Object.assign({userSelect:"none"},i?k:x),children:t.label}):e.jsx("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:e.jsx("div",{style:Object.assign({textAlign:"left",userSelect:"none"},x),children:t.label})})]},"ytick-r-"+n)}),i&&e.jsx("text",{x:s+d.right-15,y:l/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${s+d.right-15}, ${l/2})`,className:"semiotic-axis-label",style:Object.assign({userSelect:"none"},w),children:i})]})})()]})})(),te,F&&g&&B&&R&&e.jsxs(e.Fragment,{children:[F.top&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Ht,{orient:"top",config:Tt(F.top),values:B,scale:g.x,size:d.top,length:s})}),F.bottom&&e.jsx("g",{transform:`translate(0, ${l})`,children:e.jsx(Ht,{orient:"bottom",config:Tt(F.bottom),values:B,scale:g.x,size:d.bottom,length:s})}),F.left&&e.jsx("g",{transform:"translate(0, 0)",children:e.jsx(Ht,{orient:"left",config:Tt(F.left),values:R,scale:g.y,size:d.left,length:l})}),F.right&&e.jsx("g",{transform:`translate(${s}, 0)`,children:e.jsx(Ht,{orient:"right",config:Tt(F.right),values:R,scale:g.y,size:d.right,length:l})})]}),N,ne&&ne.sourceId!==V&&(null==g?void 0:g.x)&&(()=>{const t=g.x(ne.xValue);if(null==t||0>t||t>s)return null;const n=ne.locked;return e.jsx("line",{x1:t,y1:0,x2:t,y2:l,stroke:n?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:n?1.5:1,strokeDasharray:n?"6,3":"4,4",pointerEvents:"none"})})(),q]}),A&&e.jsx("text",{x:c/2,y:20,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:"string"==typeof A?A:null}),Ft({legend:O,totalWidth:c,totalHeight:u,margin:d,legendPosition:P,title:A,legendLayout:L,legendHoverBehavior:S,legendClickBehavior:M,legendHighlightedCategory:C,legendIsolatedCategories:_})]}):null}function zn(e){var t,n,o,i;return(null!==(t=e.tl)&&void 0!==t?t:0)>0||(null!==(n=e.tr)&&void 0!==n?n:0)>0||(null!==(o=e.br)&&void 0!==o?o:0)>0||(null!==(i=e.bl)&&void 0!==i?i:0)>0}function $n(e,t="#4e79a7"){return e&&"string"==typeof e?e:t}const Yn="undefined"==typeof window||"undefined"==typeof document,Gn="undefined"!=typeof window?t.useLayoutEffect:t.useEffect,Xn=()=>()=>{},Vn=()=>!1,qn=()=>!0;function Un(e,t){const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function Kn(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function Qn(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}const Zn=h.createContext(null),Jn={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function eo(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===(null==t?void 0:t.datum))continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],i={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},s=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],r=Object.keys(n).sort((e,t)=>{const n=s.indexOf(e),o=s.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of r)o.push(`${n[e]} ${i[e]||e}`);return`${t}, ${o.join(", ")}`}const to=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""};function no(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}const oo="semiotic-accessible-data-table",io=oo+" semiotic-accessible-data-table-hidden",so=oo+" semiotic-accessible-data-table-visible",ro={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},lo={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},ao={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},co={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},uo={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},ho={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},fo={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},go={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function po({scene:t,chartType:n,tableId:o,chartTitle:i}){var s;const[r,l]=h.useState(!1),[a,c]=h.useState(5),u=h.useContext(Zn),d=null!==(s=null==u?void 0:u.visible)&&void 0!==s&&s,f=r||d,g=h.useRef(null),p=i?"Data summary for "+i:o?`Data summary for ${n} ${o}`:"Data summary for "+n;h.useEffect(()=>{f||c(5)},[f]);const y=h.useCallback(e=>{e.target===e.currentTarget&&(r||d||l(!0))},[r,d]),m=h.useCallback(e=>{var t;d||(null===(t=g.current)||void 0===t?void 0:t.contains(e.relatedTarget))||l(!1)},[d]);if(!t||0===t.length)return o?e.jsx("span",{id:o,tabIndex:-1,style:Jn}):null;if(!f)return e.jsx("div",{id:o,className:io,tabIndex:-1,onFocus:y,style:Jn,role:"region","aria-label":p,children:e.jsxs("button",{type:"button",onClick:()=>l(!0),children:["View data summary (",t.length," elements)"]})});const v=function(e){var t,n,o,i,s,r,l,a,c,u,d,h,f,g,p,y,m;const v=[];if(!Array.isArray(e))return v;const b=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const x of e)if(x&&"object"==typeof x&&null!==x.datum)try{switch(x.type){case"point":if(b)break;v.push({label:"Point",values:no(x.datum)});break;case"line":case"area":{const e=Array.isArray(x.datum)?x.datum:[],t="line"===x.type?"Line point":"Area point";for(const n of e)v.push({label:t,values:no(n)});break}case"rect":{const e=null!=x.datum&&"object"==typeof x.datum?x.datum:{},s=null!==(n=null!==(t=e.category)&&void 0!==t?t:x.group)&&void 0!==n?n:"",r=null!==(i=null!==(o=e.value)&&void 0!==o?o:e.__aggregateValue)&&void 0!==i?i:e.total;v.push({label:"Bar",values:{category:s,value:null!=r?r:""}});break}case"heatcell":{const e=no(x.datum);null==e.value&&"number"==typeof x.value&&Number.isFinite(x.value)&&(e.value=x.value),v.push({label:"Cell",values:e});break}case"wedge":v.push({label:"Wedge",values:{category:null!==(a=null!==(r=null===(s=x.datum)||void 0===s?void 0:s.category)&&void 0!==r?r:null===(l=x.datum)||void 0===l?void 0:l.label)&&void 0!==a?a:"",value:null!==(u=null===(c=x.datum)||void 0===c?void 0:c.value)&&void 0!==u?u:""}});break;case"circle":v.push({label:"Node",values:no(x.datum)});break;case"arc":v.push({label:"Arc",values:no(x.datum)});break;case"candlestick":v.push({label:"Candlestick",values:no(x.datum)});break;case"geoarea":v.push({label:"Region",values:{name:null!==(p=null!==(f=null===(h=null===(d=x.datum)||void 0===d?void 0:d.properties)||void 0===h?void 0:h.name)&&void 0!==f?f:null===(g=x.datum)||void 0===g?void 0:g.name)&&void 0!==p?p:"",value:null!==(m=null===(y=x.datum)||void 0===y?void 0:y.value)&&void 0!==m?m:""}})}}catch(e){}return v}(t),b=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],i=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&i.add(e+""))}if(t.length>0){let e=t[0],i=t[0],s=0;for(const n of t)e>n&&(e=n),n>i&&(i=n),s+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:i,mean:s/t.length})}else if(i.size>0){const e=Array.from(i);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(v),x=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${to(e.min)} to ${to(e.max)}, mean ${to(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(v.length,b),k=Math.min(a,v.length),w=v.slice(0,k),j=v.length-k,A=new Set;for(const e of w)for(const t of Object.keys(e.values))A.add(t);const O=Array.from(A);return e.jsxs("div",{ref:g,id:o,className:so,tabIndex:-1,onBlur:m,style:ro,role:"region","aria-label":p,children:[e.jsx("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{d&&u&&u.setVisible(!1),l(!1)},"aria-label":"Close data summary",style:ao,children:"×"}),e.jsx("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:lo,children:x}),e.jsxs("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+n,style:co,children:[e.jsx("caption",{className:"semiotic-accessible-data-table-caption",style:fo,children:j>0?`First ${k} of ${v.length} data points`:`All ${v.length} data points`}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:uo,children:"type"}),O.map(t=>e.jsx("th",{style:uo,children:t},t))]})}),e.jsx("tbody",{children:w.map((t,n)=>e.jsxs("tr",{children:[e.jsx("td",{style:ho,children:t.label}),O.map(n=>{return e.jsx("td",{style:ho,children:(o=t.values[n],null==o||""===o?"—":"number"==typeof o?Number.isNaN(o)?"—":to(o):"boolean"==typeof o?o?"true":"false":"object"==typeof o?"—":o+"")},n);var o})]},n))})]}),j>0&&e.jsxs("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>c(e=>e+25),style:go,children:["Show ",Math.min(25,j)," more"," ",1===j?"row":"rows"," (",j," remaining)"]})]})}function yo({summary:t}){return t?e.jsx("div",{role:"note",style:Jn,children:t}):null}function mo({tableId:t}){return e.jsx("a",{href:"#"+t,style:Jn,onClick:e=>{e.preventDefault();const n=document.getElementById(t);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,Jn)},children:"Skip to data table"})}function vo({hoverPoint:t}){let n="";if(t){const e=t.data||t;n="object"==typeof e?"Data point: "+Object.entries(e).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+e}return e.jsx("div",{"aria-live":"polite","aria-atomic":"true",style:Jn,children:n})}const bo="var(--semiotic-focus, #005fcc)";function xo({active:t,hoverPoint:n,margin:o,size:i,shape:s="circle",width:r,height:l}){if(!t||!n)return null;const a=n.x+o.left,c=n.y+o.top;let u;if("rect"===s&&null!=r&&null!=l){const t=Math.max(r,4),n=Math.max(l,4);u=e.jsx("rect",{x:a-t/2-3,y:c-n/2-3,width:t+6,height:n+6,rx:3,fill:"none",stroke:bo,strokeWidth:2,strokeDasharray:"4,2"})}else u=e.jsx("circle","wedge"===s?{cx:a,cy:c,r:12,fill:"none",stroke:bo,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:a,cy:c,r:8,fill:"none",stroke:bo,strokeWidth:2,strokeDasharray:"4,2"});return e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:i[0],height:i[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}function ko(e){return Array.isArray(e)?e[0]:e}function wo(e,t,n,o){return Object.assign({data:ko(e),x:t,y:n,__semioticHoverData:!0},o)}const jo={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function Ao(e,t){return"function"==typeof t?t(e):e[t]}function Oo(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function So(t={}){const{fields:n,title:o,format:i,style:s={},className:r=""}=t;return t=>{if(!t||"object"!=typeof t)return null;let l;const a=[];if(o){const e=Ao(t,o);l=Oo(e,i)}if(n&&n.length>0)n.forEach(e=>{let n,o,s;"string"==typeof e?(n=e,o=e,s=i):(n=e.label,o=e.accessor||e.key||"",s=e.format||i);const r=Ao(t,o);a.push({label:n,value:Oo(r,s)})});else if(!o){const e=["value","y","name","id","label"];for(const n of e)if(void 0!==t[n]){l=Oo(t[n],i);break}if(!l){const e=Object.keys(t).filter(e=>!e.startsWith("_"));e.length>0&&(l=Oo(t[e[0]],i))}}const c=Object.assign(Object.assign({},jo),s);return e.jsxs("div",{className:("semiotic-tooltip "+r).trim(),style:c,children:[l&&e.jsx("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:l}),a.map((t,n)=>e.jsxs("div",{style:{marginTop:0===n&&l?"4px":0},children:[t.label&&e.jsxs("span",{children:[t.label,": "]}),t.value]},n))]})}}function Mo(){return t=>{var n,o,i,s,r,l,a;const c=t.allSeries;if(!c||0===c.length){const s=null!==(o=null===(n=t.data)||void 0===n?void 0:n.value)&&void 0!==o?o:null===(i=t.data)||void 0===i?void 0:i.y;return e.jsx("div",{className:"semiotic-tooltip",style:jo,children:e.jsx("div",{children:Oo(s)})})}const u=null!==(l=null!==(s=t.xValue)&&void 0!==s?s:null===(r=t.data)||void 0===r?void 0:r.time)&&void 0!==l?l:null===(a=t.data)||void 0===a?void 0:a.x;return e.jsxs("div",{className:"semiotic-tooltip",style:jo,children:[null!=u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:Oo(u)}),c.map((t,n)=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[e.jsx("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:t.color,flexShrink:0}}),e.jsx("span",{style:{flex:1,fontSize:"0.85em"},children:t.group}),e.jsx("span",{style:{fontWeight:500,fontSize:"0.85em"},children:Oo(t.value)})]},n))]})}}function Co(t){if(!0!==t){if("function"==typeof t){const n=t;return t=>{var o;let i=ko(!0===(null==t?void 0:t.__semioticHoverData)||t&&void 0!==t.data&&"number"==typeof t.x&&"number"==typeof t.y&&t&&("node"===t.type||"edge"===t.type||void 0!==t.nodeOrEdge||void 0!==t.allSeries||void 0!==t.stats||void 0!==t.__chartType)?null!==(o=t.data)&&void 0!==o?o:{}:t);("node"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.x0)&&"number"==typeof(null==i?void 0:i.x1)||"edge"===(null==t?void 0:t.nodeOrEdge)&&"number"==typeof(null==i?void 0:i.sankeyWidth))&&i.data&&"object"==typeof i.data&&(i=i.data);const s=n(i);return null==s?null:e.jsx("div",{className:"semiotic-tooltip",style:jo,children:s})}}return!1!==t&&void 0!==t&&("object"==typeof t&&null!==t&&("fields"in t||"title"in t)?So(t):So())}}function _o({x:t,y:n,containerWidth:o,containerHeight:i,margin:s,children:r,className:l="stream-frame-tooltip",zIndex:a=1}){const c=Number.isFinite(t)&&Number.isFinite(n),u=h.useRef(null),[d,f]=h.useState(null);h.useLayoutEffect(()=>{const e=u.current;if(!e)return;const t=e.getBoundingClientRect();f(e=>e&&e.width===t.width&&e.height===t.height?e:{width:t.width,height:t.height})},[r,l,o,i]);let g;g=d?`translate(${d.width+12>o-t?"calc(-100% - 12px)":"12px"}, ${d.height+12>i-n?"calc(-100% - 4px)":"4px"})`:`translate(${t>.7*o?"calc(-100% - 12px)":"12px"}, ${.3*i>n?"4px":"calc(-100% - 4px)"})`;const p=function(e){if(!h.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if("string"==typeof n.className&&n.className.trim().length>0)return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor)return!0}return!1}(r),y=p?null:jo;return c?e.jsx("div",{ref:u,className:p?l:(l+" semiotic-tooltip").trim(),style:Object.assign(Object.assign({},y||{}),{position:"absolute",left:s.left+t,top:s.top+n,transform:g,pointerEvents:"none",zIndex:a,width:"max-content"}),children:r}):null}function Po(e,n,o){const i=t.useRef(null),[s,r]=t.useState(null);return t.useEffect(()=>{if(!n&&!o)return;const e=i.current;if(!e)return;const t=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;r(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return t.observe(e),()=>t.disconnect()},[n,o]),[i,[n&&s?s.w:e[0],o&&s?s.h:e[1]]]}const Lo="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function No(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function Fo(e){const n=function(){const[e,n]=t.useState(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return t.useEffect(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return n(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>n(e.matches))},[]),e}(),o=t.useRef(n);o.current=n;const[i,s]=Po(e.sizeProp,e.responsiveWidth,e.responsiveHeight),r=t.useMemo(()=>Object.assign(Object.assign({},e.marginDefault),e.userMargin),[e.marginDefault,e.userMargin]),l=s[0]-r.left-r.right,a=s[1]-r.top-r.bottom,c=No(e.foregroundGraphics,s,r),u=No(e.backgroundGraphics,s,r),d=P(e=>e.theme),{transition:f,introEnabled:g}=function(e,t){var n,o;if(!1===e)return{transition:void 0,introEnabled:!1};const i="undefined"!=typeof window&&(null===(n=window.matchMedia)||void 0===n?void 0:n.call(window,"(prefers-reduced-motion: reduce)").matches);return{transition:e?!0===e?{duration:300}:{duration:null!==(o=e.duration)&&void 0!==o?o:300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(i||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),p="semiotic-table-"+h.useId(),y=t.useRef(0),m=t.useRef(()=>{}),v=t.useCallback(()=>{y.current||(y.current=requestAnimationFrame(()=>m.current()))},[]);t.useEffect(()=>()=>{y.current&&(cancelAnimationFrame(y.current),y.current=0)},[]);const b=t.useRef(()=>{}),x=t.useRef(()=>{}),k=t.useRef(null),w=t.useRef(0),j=t.useCallback(()=>{w.current=0;const e=k.current;k.current=null,e&&b.current(e)},[]),A=t.useCallback(e=>{k.current={clientX:e.clientX,clientY:e.clientY},0===w.current&&(w.current=requestAnimationFrame(j))},[j]),O=t.useCallback(()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0),x.current()},[]);t.useEffect(()=>()=>{k.current=null,0!==w.current&&(cancelAnimationFrame(w.current),w.current=0)},[]);const S=e.themeDirtyRef;return Lo(()=>{S&&(Ke++,S.current=!0,v())},[d,v,S]),{reducedMotion:n,reducedMotionRef:o,responsiveRef:i,size:s,margin:r,adjustedWidth:l,adjustedHeight:a,resolvedForeground:c,resolvedBackground:u,currentTheme:d,transition:f,introEnabled:g,tableId:p,rafRef:y,renderFnRef:m,scheduleRender:v,hoverHandlerRef:b,hoverLeaveRef:x,onPointerMove:A,onPointerLeave:O}}function Bo(e,t,n,o){const i=e.getContext("2d");if(!i)return null;const s=t[0]*o,r=t[1]*o,l=t[0]+"px",a=t[1]+"px";return e.style.width!==l&&(e.style.width=l),e.style.height!==a&&(e.style.height=a),e.width===s&&e.height===r||(e.width=s,e.height=r),i.setTransform(o,0,0,o,0,0),i.translate(n.left,n.top),i}function Ro(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function To(e,t,n,o,i,s){if(2>t.length)return;const r=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];r.push(r[e-1]+Math.sqrt(n*n+o*o))}const l=r[r.length-1];if(0===l)return;const a=Math.min(.2*l,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=s;for(let n=0;t.length-1>n;n++){const o=(r[n]+r[n+1])/2;let s=i;a>o&&(s*=o/a),a>l-o&&(s*=(l-o)/a),e.globalAlpha=Math.max(0,s),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}const Ho=(e,t,n,o)=>{var i,s;const l=t.filter(e=>"line"===e.type);for(const a of l){if(2>a.path.length)continue;const c=a._introClipFraction;void 0!==c&&1>c&&(e.save(),e.beginPath(),e.rect(0,0,o.width*c,o.height),e.clip());const u=a.style.stroke||"#007bff",d=tt(e,u)||u,h=a.style.strokeWidth||2,f=a.colorThresholds,g=a.rawValues;if(e.setLineDash(a.style.strokeDasharray?a.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=a.style.opacity&&(e.globalAlpha=a.style.opacity),e.lineWidth=h,e.lineCap=a.style.strokeLinecap||"butt",a.style._edgeFade){const v=null!==(i=a.style.opacity)&&void 0!==i?i:1;To(e,a.path,d,h,v,a.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const p=nt(a.curve),y=f&&f.length>0&&g&&g.length===a.path.length,m=a._decayOpacities;if(m&&m.length===a.path.length&&!y){e.strokeStyle=d;const b=null!==(s=a.style.opacity)&&void 0!==s?s:1;for(let x=0;a.path.length-1>x;x++)e.globalAlpha=.5*(m[x]+m[x+1])*b,e.beginPath(),e.moveTo(a.path[x][0],a.path[x][1]),e.lineTo(a.path[x+1][0],a.path[x+1][1]),e.stroke()}else if(y){let k=null,w=null,j=null,A=null,O=!1;function S(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),O=!0}function M(){O&&(e.stroke(),O=!1)}for(let C=0;a.path.length>C;C++){const[_,P]=a.path[C],L=g[C],N=Ro(L,f,d);if(null!==k&&null!==A&&null!==j){if(N===A)e.lineTo(_,P);else{const F=[];for(const B of f){const R=B.value;(j>R||R>L)&&(R>j||L>R)||j===R||L===R||F.push({t:(R-j)/(L-j)})}F.sort((e,t)=>e.t-t.t);for(const T of F){const H=k+(_-k)*T.t,I=w+(P-w)*T.t,D=Ro(j+(L-j)*Math.min(T.t+1e-4,1),f,d);e.lineTo(H,I),M(),S(D,H,I)}e.lineTo(_,P)}k=_,w=P,j=L,A=N}else S(N,_,P),k=_,w=P,j=L,A=N}M()}else{e.beginPath();const W=a.strokeGradient&&a.path.length>=2?st(e,a.strokeGradient,a.path[0][0],0,a.path[a.path.length-1][0],0):null;if(e.strokeStyle=W||d,p)r.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[E,z]=a.path[0];e.moveTo(E,z);for(let $=1;a.path.length>$;$++)e.lineTo(a.path[$][0],a.path[$][1])}e.stroke()}if(a.style.fill&&a.style.fillOpacity&&a.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=a.style.fillOpacity,e.fillStyle=ot(e,a.style.fill,a.style.fill),p&&!y)r.line().x(e=>e[0]).y(e=>e[1]).curve(p).context(e)(a.path);else{const[G,X]=a.path[0];e.moveTo(G,X);for(let V=1;a.path.length>V;V++)e.lineTo(a.path[V][0],a.path[V][1])}const Y=a.path[0][0];e.lineTo(a.path[a.path.length-1][0],o.height),e.lineTo(Y,o.height),e.closePath(),e.fill()}void 0!==c&&1>c&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Io(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Do(e,t,n=.3){Io(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function Wo(e,t,n=.6){var o,i,s,r,l;if(!Io(t))return;const a=null!==(o=t._pulseGlowRadius)&&void 0!==o?o:4,c=t.r+a*t._pulseIntensity,u=null!==(s=null!==(i=t.cx)&&void 0!==i?i:t.x)&&void 0!==s?s:0,d=null!==(l=null!==(r=t.cy)&&void 0!==r?r:t.y)&&void 0!==l?l:0;e.beginPath(),e.arc(u,d,c,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Eo(e,t,n,o=.35){Io(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fill())}function zo(e,t){const n=nt(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=r.area().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}const $o=(e,t,n,o)=>{var i,s,l;const a=t.filter(e=>"area"===e.type);for(const t of a){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const a=t._introClipFraction;void 0!==a&&1>a&&(e.save(),e.beginPath(),e.rect(0,0,o.width*a,o.height),e.clip());const c=ot(e,t.style.fill,"#4e79a7"),u=t._decayOpacities;if(u&&u.length===t.topPath.length){const n=null!==(i=t.style.fillOpacity)&&void 0!==i?i:.7;e.fillStyle=c;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(u[o]+u[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=tt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(u[n]+u[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const d=null!==(s=t.style.opacity)&&void 0!==s?s:1;if(zo(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const i=it(e,t.fillGradient,"string"==typeof c?c:"#4e79a7",0,n,0,o);e.fillStyle=i||c,e.globalAlpha=d}else{const n=null!==(l=t.style.fillOpacity)&&void 0!==l?l:.7;e.globalAlpha=n*d,e.fillStyle=c}if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&(zo(e,t),Eo(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=d;const n=t.strokeGradient&&t.topPath.length>=2?st(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||tt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=nt(t.curve);if(e.beginPath(),o)r.line().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==a&&1>a&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Yo=(e,t,n,o)=>{var i,s;const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r){e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI);const o=null!==(s=null!==(i=n.style.opacity)&&void 0!==i?i:n.style.fillOpacity)&&void 0!==s?s:1;e.globalAlpha=t*o,e.fillStyle=ot(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=ot(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),Wo(e,n)}}finally{e.restore()}}},Go=new Map;function Xo(e){var t;try{if(e.path)return new Path2D(e.path);const n=`${null!==(t=e.symbolType)&&void 0!==t?t:"circle"}:${Math.round(e.size)}`;let o=Go.get(n);return o||(o=new Path2D(Le(e.symbolType,e.size)),Go.size>256&&Go.clear(),Go.set(n,o)),o}catch(e){return null}}const Vo=(e,t)=>{var n,o,i,s;const r=e.globalAlpha;for(const l of t){if("symbol"!==l.type)continue;const t=l;if(0>=t.size)continue;const a=Xo(t);if(!a)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const c=(null!==(n=t.style.opacity)&&void 0!==n?n:1)*(null!==(o=t._decayOpacity)&&void 0!==o?o:1);t.style.fill&&(e.globalAlpha=r*c*(null!==(i=t.style.fillOpacity)&&void 0!==i?i:1),e.fillStyle=ot(e,t.style.fill,"#4e79a7"),e.fill(a)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=r*c,e.strokeStyle=ot(e,t.style.stroke,t.style.stroke),e.lineWidth=null!==(s=t.style.strokeWidth)&&void 0!==s?s:1,e.stroke(a)),e.restore()}e.globalAlpha=r};function qo(e,t){const{x:n,y:o,w:i,h:s}=t,{tl:r,tr:l,br:a,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(null!=e?e:0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+r,o),e.lineTo(n+i-l,o),l>0&&e.arcTo(n+i,o,n+i,o+l,l),e.lineTo(n+i,o+s-a),a>0&&e.arcTo(n+i,o+s,n+i-a,o+s,a),e.lineTo(n+c,o+s),c>0&&e.arcTo(n,o+s,n,o+s-c,c),e.lineTo(n,o+r),r>0&&e.arcTo(n,o,n+r,o,r),e.closePath()}function Uo(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}const Ko=(e,t,n,o)=>{const i=t.filter(e=>"rect"===e.type);for(const t of i){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Qo(e,t);else if(t.cornerRadii&&zn(t.cornerRadii)){const n=ot(e,t.style.fill,tt(e,"var(--semiotic-primary, #007bff)")),o=Uo(t),i=t.fillGradient&&"string"==typeof n?it(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,qo(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=ot(e,t.style.fill,tt(e,"var(--semiotic-primary, #007bff)")),o=Uo(t),i=t.fillGradient&&"string"==typeof n?it(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n;const s=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:r,y:l,w:a,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(r,l),e.lineTo(r+a-s,l),e.arcTo(r+a,l,r+a,l+s,s),e.lineTo(r+a,l+c-s),e.arcTo(r+a,l+c,r+a-s,l+c,s),e.lineTo(r,l+c);break;case"left":e.moveTo(r+a,l),e.lineTo(r+s,l),e.arcTo(r,l,r,l+s,s),e.lineTo(r,l+c-s),e.arcTo(r,l+c,r+s,l+c,s),e.lineTo(r+a,l+c);break;case"bottom":e.moveTo(r,l),e.lineTo(r+a,l),e.lineTo(r+a,l+c-s),e.arcTo(r+a,l+c,r+a-s,l+c,s),e.lineTo(r+s,l+c),e.arcTo(r,l+c,r,l+c-s,s);break;default:e.moveTo(r,l+c),e.lineTo(r,l+s),e.arcTo(r,l,r+s,l,s),e.lineTo(r+a-s,l),e.arcTo(r+a,l,r+a,l+s,s),e.lineTo(r+a,l+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=ot(e,t.style.fill,tt(e,"var(--semiotic-primary, #007bff)")),o=Uo(t),i=t.fillGradient&&"string"==typeof n?it(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=i||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=tt(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Do(e,t),e.globalAlpha=1}};function Qo(e,t){const n=t.style.icon,o=t.style.iconPadding||2,i=Math.min(t.w,t.h)-o;if(0>=i)return;const s=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),s){const s=i+o,r=t.x+(t.w-i)/2;for(let o=t.y+t.h-i;o>=t.y-i;o-=s)e.drawImage(n,r,o,i,i)}else{const s=i+o,r=t.y+(t.h-i)/2;for(let o=t.x;t.x+t.w>o;o+=s)e.drawImage(n,o,r,i,i)}e.restore()}function Zo(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function Jo(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}const ei=(e,t,n,o)=>{const i=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of i){const n=t.style;if(null!=(null==n?void 0:n.opacity)&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=tt(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Do(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):Jo(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),i=t.x+t.w/2,s=t.y+t.h/2;e.fillStyle=Zo(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,i,s)}}}finally{e.restore()}},ti=(e,t,n,o)=>{var i,s,r;for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const l=(null!==(i=t._decayOpacity)&&void 0!==i?i:1)*(null!==(r=null===(s=t.style)||void 0===s?void 0:s.opacity)&&void 0!==r?r:1);1!==l&&(e.globalAlpha=l);const a=tt(e,t.wickColor)||t.wickColor,c=60>o.height,u=c?Math.max(t.wickWidth,2):t.wickWidth,d=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=a,e.lineWidth=u,e.stroke()};if(c||d(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=a,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),i=t.isUp?t.upColor:t.downColor,s=tt(e,i)||i;e.fillStyle=s,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=s,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}c&&d(),e.restore()}};function ni(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}const oi=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ii(e){const t=e[1]-e[0],n=3156e7;return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:n>t?e=>{const t=new Date(e);return`${oi[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*n>t?e=>{const t=new Date(e);return`${oi[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}const si={line:[$o,Ho,Yo],area:[$o,Yo],stackedarea:[$o,Yo],scatter:[Yo,Vo],bubble:[Yo,Vo],heatmap:[ei],bar:[Ko],swarm:[Yo],waterfall:[(e,t,n,o)=>{var i;Ko(e,t);const s=t.filter(e=>"rect"===e.type);if(2>s.length)return;const r=s[0].datum,l=null==r?void 0:r._connectorStroke;if(l){e.save(),e.strokeStyle=tt(e,l)||l,e.lineWidth=null!==(i=null==r?void 0:r._connectorWidth)&&void 0!==i?i:1,e.setLineDash([]);for(let t=0;s.length-1>t;t++){const o=s[t],i=s[t+1],r=o.datum,l=i.datum;if(null==(null==r?void 0:r.cumEnd)||null==(null==l?void 0:l.baseline))continue;const a=n.y(r.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,a),e.lineTo(u,a),e.stroke()}e.restore()}}],candlestick:[ti],mixed:[$o,Ho,Yo],custom:[$o,Ko,ei,Ho,Yo,Vo,ti]},ri={top:20,right:20,bottom:30,left:40},li={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff"};function ai(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],i=n[3];return`#${e}${e}${o}${o}${i}${i}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}const ci={background:"rgba(0, 0, 0, 0.85)",color:"white",padding:"6px 10px",borderRadius:4,fontSize:12,lineHeight:1.5,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)",pointerEvents:"none",whiteSpace:"nowrap"};function ui({hover:t}){var n,o,i;const s=e=>null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+"",r=null!==(n=t.data)&&void 0!==n?n:{},l=null!==(o=r.y)&&void 0!==o?o:r.value,a=null!==(i=r.x)&&void 0!==i?i:r.time;return e.jsxs("div",{className:"semiotic-tooltip",style:ci,children:[e.jsx("div",{style:{fontWeight:600,marginBottom:2},children:s(l)}),e.jsx("div",{style:{opacity:.7,fontSize:11},children:s(a)})]})}ui.ownsChrome=!0;const di=t.forwardRef(function(n,o){var i,s,r,l,a,c,u,d,f,g,p,m,x;const{chartType:k,runtimeMode:j,data:A,chunkThreshold:O,chunkSize:S,xAccessor:M,yAccessor:C,colorAccessor:_,sizeAccessor:P,symbolAccessor:L,symbolMap:N,groupAccessor:F,lineDataAccessor:B,curve:R,normalize:T,baseline:H,stackOrder:I,binSize:D,valueAccessor:W,arrowOfTime:E="right",windowMode:z="sliding",windowSize:$=200,timeAccessor:Y,xExtent:G,yExtent:X,extentPadding:V=.1,scalePadding:q,sizeRange:U,size:K=[500,300],responsiveWidth:Q,responsiveHeight:Z,margin:J,className:ee,background:te,lineStyle:ne,pointStyle:oe,areaStyle:ie,barStyle:se,waterfallStyle:re,swarmStyle:le,barColors:ae,colorScheme:ce,boundsAccessor:ue,boundsStyle:de,y0Accessor:he,band:fe,gradientFill:ge,lineGradient:pe,areaGroups:ye,openAccessor:me,highAccessor:ve,lowAccessor:be,closeAccessor:xe,candlestickStyle:ke,showAxes:we=!0,axes:je,xLabel:Ae,yLabel:Se,yLabelRight:Me,xFormat:Ce,yFormat:_e,axisExtent:Pe,tickFormatTime:Ne,tickFormatValue:Fe,hoverAnnotation:Be,tooltipContent:Re,customHoverBehavior:Te,customClickBehavior:He,enableHover:We,hoverRadius:Ee=30,tooltipMode:ze,annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:Xe,showGrid:Ve,legend:qe,legendHoverBehavior:Ue,legendClickBehavior:Ke,legendHighlightedCategory:Qe,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,legendCategoryAccessor:nt,onCategoriesChange:ot,backgroundGraphics:it,foregroundGraphics:st,canvasPreRenderers:rt,svgPreRenderers:ut,title:dt,categoryAccessor:ht,brush:ft,onBrush:gt,decay:pt,pulse:yt,transition:mt,animate:kt,staleness:wt,heatmapAggregation:Ot,heatmapXBins:St,heatmapYBins:Mt,showValues:Ct,heatmapValueFormat:_t,marginalGraphics:Pt,pointIdAccessor:Lt,xScaleType:Nt,yScaleType:Ft,accessibleTable:Bt=!0,description:Rt,summary:Tt,linkedCrosshairName:Ht,linkedCrosshairSourceId:It,customLayout:Dt,layoutConfig:Wt,layoutSelection:Et}=n,zt=t.useId().replace(/:/g,""),$t=t.useRef(!1),Yt=t.useRef({w:-1,h:-1}),Gt=Fo({sizeProp:K,responsiveWidth:Q,responsiveHeight:Z,userMargin:J,marginDefault:ri,animate:kt,transitionProp:mt,themeDirtyRef:$t}),Xt=function(){const[e,n]=t.useState(!1);return Gn(()=>{n(!0)},[]),e}(),Vt=function(){const e=t.useSyncExternalStore(Xn,Vn,qn);return t.useRef(e).current}(),{reducedMotionRef:qt,responsiveRef:Ut,size:Kt,currentTheme:Qt,transition:Zt,introEnabled:Jt,tableId:en,rafRef:tn,renderFnRef:nn,scheduleRender:on}=Gt;let sn=Gt.margin;if(Pt){const e=60,t=Object.assign({},Gt.margin);Pt.top&&e>t.top&&(t.top=e),Pt.bottom&&e>t.bottom&&(t.bottom=e),Pt.left&&e>t.left&&(t.left=e),Pt.right&&e>t.right&&(t.right=e),sn=t}const rn="function"==typeof st?st({size:Kt,margin:sn}):st,ln="function"==typeof it?it({size:Kt,margin:sn}):it,an=Kt[0]-sn.left-sn.right,cn=Kt[1]-sn.top-sn.bottom,un=t.useMemo(()=>v(A),[A]),dn=null!=Be?Be:We,hn=t.useRef(null),fn=t.useRef(null),[gn,pn]=t.useState(0),yn=t.useRef(0),[mn,vn]=t.useState(null),bn=t.useRef(null),xn=t.useRef(null),[kn,wn]=t.useState(null),jn=t.useRef(li.primary),An=t.useRef([]),On=t.useRef(nt),Sn=t.useRef(ot);On.current=nt,Sn.current=ot;const[Mn,Cn]=t.useState(!1),[_n,Pn]=t.useState([]),[Ln,Nn]=t.useState([]),Fn="streaming"===j||["bar","swarm","waterfall"].includes(k),Bn=t.useMemo(()=>{var e,t,n;return{chartType:k,runtimeMode:Fn?"streaming":"bounded",windowSize:$,windowMode:z,arrowOfTime:Fn?E:"right",extentPadding:V,scalePadding:q,axisExtent:Pe,xAccessor:M,yAccessor:C,timeAccessor:Fn?Y:void 0,valueAccessor:W,colorAccessor:_,sizeAccessor:P,symbolAccessor:L,symbolMap:N,groupAccessor:F||(B?"_lineGroup":void 0),categoryAccessor:ht,lineDataAccessor:B,xScaleType:Nt,yScaleType:Ft,xExtent:G,yExtent:X,sizeRange:U,binSize:D,normalize:T,baseline:H,stackOrder:I,boundsAccessor:ue,boundsStyle:de,y0Accessor:he,band:fe,gradientFill:!0===ge?{topOpacity:.8,bottomOpacity:.05}:!1===ge?void 0:ge,areaGroups:ye?new Set(ye):void 0,lineGradient:pe,openAccessor:me,highAccessor:ve,lowAccessor:be,closeAccessor:xe,candlestickStyle:ke,lineStyle:ne,pointStyle:oe,areaStyle:ie,swarmStyle:le,waterfallStyle:re,colorScheme:ce,barColors:ae,barStyle:se,annotations:Ye,decay:pt,pulse:yt,transition:Zt,introAnimation:Jt,staleness:wt,heatmapAggregation:Ot,heatmapXBins:St,heatmapYBins:Mt,showValues:Ct,heatmapValueFormat:_t,pointIdAccessor:Lt,curve:R,themeCategorical:null===(e=null==Qt?void 0:Qt.colors)||void 0===e?void 0:e.categorical,themeSemantic:w(Qt),themeSequential:null===(t=null==Qt?void 0:Qt.colors)||void 0===t?void 0:t.sequential,themeDiverging:null===(n=null==Qt?void 0:Qt.colors)||void 0===n?void 0:n.diverging,customLayout:Dt,layoutConfig:Wt,layoutMargin:sn}},[k,$,z,E,V,q,Pe,M,C,Y,W,Nt,Ft,_,P,L,N,F,ht,B,G,X,U,D,T,H,I,ue,de,he,fe,ge,pe,ye,me,ve,be,xe,ke,ne,oe,ie,le,re,se,ce,ae,Ye,pt,yt,null==Zt?void 0:Zt.duration,null==Zt?void 0:Zt.easing,Jt,wt,Ot,St,Mt,Ct,_t,Fn,Lt,R,Qt,Dt,Wt,sn]),Rn=function(e){const n=t.useRef(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return Kn(e,t);if(!Qn(e)||!Qn(t))return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],i=t[o];if(!Object.is(n,i))if(Array.isArray(n)&&Array.isArray(i)){if(!Kn(n,i))return!1}else{if(!Qn(n)||!Qn(i))return!1;if(!Un(n,i))return!1}}return!0}(n.current,e)||(n.current=e),n.current}(Bn),Tn=t.useRef(null);Tn.current||(Tn.current=new Ie(Rn));const Hn=t.useCallback(()=>{var e,t;const n=On.current,o=Sn.current;if(!o||!n)return;const i=function(e,t){if(!t)return[];const n=new Set,o=[];for(const i of e){if(!i||"object"!=typeof i)continue;const e="function"==typeof t?t(i):i[t];if(null==e)continue;const s=e+"";n.has(s)||(n.add(s),o.push(s))}return o}(null!==(t=null===(e=Tn.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[],n);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(i,An.current)||(An.current=i,o(i))},[]);t.useEffect(()=>{var e;null===(e=Tn.current)||void 0===e||e.updateConfig(Rn),$t.current=!0,on()},[Rn,on]);const Dn=t.useRef(null);t.useEffect(()=>{const e=Tn.current;if(!e)return;const t=null!=Et?Et:null;Dn.current!==t&&(Dn.current=t,e.setLayoutSelection(t),e.hasCustomRestyle?e.restyleScene(t):$t.current=!0,on())},[Et,on]);const Wn=t.useRef(null);Wn.current||(Wn.current=new b(e=>{const t=Tn.current;t&&t.ingest(e)&&($t.current=!0,on())},{chunkThreshold:O,chunkSize:S})),t.useEffect(()=>{var e;null===(e=Wn.current)||void 0===e||e.updateChunkOptions({chunkThreshold:O,chunkSize:S})},[O,S]);const zn=t.useCallback(e=>{var t;null===(t=Wn.current)||void 0===t||t.push(e)},[]),Zn=t.useCallback(e=>{var t;null===(t=Wn.current)||void 0===t||t.pushMany(e)},[]),Jn=t.useCallback(()=>{var e,t;null===(e=Wn.current)||void 0===e||e.clear(),null===(t=Tn.current)||void 0===t||t.clear(),$t.current=!0,on()},[on]);t.useImperativeHandle(o,()=>({push:zn,pushMany:Zn,remove:e=>{var t,n,o;null===(t=Wn.current)||void 0===t||t.flush();const i=null!==(o=null===(n=Tn.current)||void 0===n?void 0:n.remove(e))&&void 0!==o?o:[];return i.length>0&&(bn.current&&i.some(e=>{var t;return e===(null===(t=bn.current)||void 0===t?void 0:t.data)})&&(bn.current=null,wn(null)),$t.current=!0,on()),i},update:(e,t)=>{var n,o,i;null===(n=Wn.current)||void 0===n||n.flush();const s=null!==(i=null===(o=Tn.current)||void 0===o?void 0:o.update(e,t))&&void 0!==i?i:[];return s.length>0&&($t.current=!0,on()),s},clear:Jn,getData:()=>{var e,t,n;return null===(e=Wn.current)||void 0===e||e.flush(),null!==(n=null===(t=Tn.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var e,t;return null!==(t=null===(e=Tn.current)||void 0===e?void 0:e.scales)&&void 0!==t?t:null},getExtents:()=>{var e,t;return null!==(t=null===(e=Tn.current)||void 0===e?void 0:e.getExtents())&&void 0!==t?t:null}}),[zn,Zn,Jn,on]),t.useEffect(()=>{var e,t;if(A){if(B&&un.length>0&&"object"==typeof un[0]&&null!==un[0]){const t="string"==typeof B?B:"coordinates";if(Array.isArray(un[0][t])){const n=[];for(const e of un){const o=e[t];if(Array.isArray(o)){const t=e.label||e.id||e.key;if(null!=t)for(const e of o)n.push(Object.assign(Object.assign({},e),{_lineGroup:t}));else for(const e of o)n.push(e)}}return void(null===(e=Wn.current)||void 0===e||e.setBoundedData(n))}}null===(t=Wn.current)||void 0===t||t.setBoundedData(un)}},[A,un,B]);const{hoverHandlerRef:to,hoverLeaveRef:no,onPointerMove:oo,onPointerLeave:io}=Gt;to.current=e=>{var t,n,o,i;if(!dn)return;const s=hn.current;if(!s)return;const r=s.getBoundingClientRect(),l=e.clientX-r.left-sn.left,a=e.clientY-r.top-sn.top;if(0>l||l>an||0>a||a>cn)return void(bn.current&&(bn.current=null,xn.current=null,wn(null),Te&&(Te(null),$t.current=!0),on()));const c=Tn.current;if(!c||0===c.scene.length)return;const u=at(c.scene,l,a,Ee,c.quadtree,c.maxPointRadius),d="multi"===ze,h=()=>{bn.current&&(bn.current=null,xn.current=null,wn(null),Te&&Te(null),on())};if(!u&&!d)return void h();const f=d||!u?l:u.x,g=d||!u?a:u.y,p=(null==u?void 0:u.datum)?Oe(u.datum,c.resolvedRibbons):{},y=null===(n=null===(t=c.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,m="function"==typeof y?y(f):void 0;let v=wo(p,f,g,null!=m?{xValue:m,xPx:f}:void 0);if(d&&c.scene.length>0&&c.scales){const e=function(e,t,n=30){const o=[];for(const i of e)if("line"===i.type){const e=i;if(2>e.path.length)continue;const s=ct(lt(e.path,e.curve),t,n);if(null===s)continue;const r=vt(e.path,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:e.path[r][0],y:s,group:e.group,color:e.style.stroke})}else if("area"===i.type){const e=i;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const s=lt(e.topPath,e.curve),r=lt(e.bottomPath,e.curve),l=ct(s,t,n);if(null===l)continue;const a=ct(r,t,n),c=vt(e.topPath,t);o.push({node:i,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:l,y0:null!=a?a:void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(c.scene,f,Math.max(Ee,an));if(e.length>0){const t=c.scales.y.invert,n=jn.current,o=y?y(f):f;if(u)v.xValue=o,v.xPx=f;else{const e={xValue:o};"string"==typeof M&&(e[M]=o),v=wo(e,f,g,{xValue:o,xPx:f})}v.allSeries=e.map(e=>{const o=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===k&&null!=i?o-i:o,valuePx:e.y,color:e.color||n,datum:Oe(e.datum,c.resolvedRibbons)}})}}u||(null===(o=v.allSeries)||void 0===o?void 0:o.length)?(bn.current=v,xn.current=null!==(i=null==u?void 0:u.node)&&void 0!==i?i:null,wn(v),Te&&(Te(v),$t.current=!0),on()):h()},no.current=()=>{bn.current&&(bn.current=null,xn.current=null,wn(null),Te&&(Te(null),$t.current=!0),on())};const so=t.useRef(()=>{});so.current=e=>{var t,n;if(!He)return;const o=hn.current;if(!o)return;const i=o.getBoundingClientRect(),s=e.clientX-i.left-sn.left,r=e.clientY-i.top-sn.top;if(0>s||s>an||0>r||r>cn)return void He(null);const l=Tn.current;if(!l||0===l.scene.length)return void He(null);const a=at(l.scene,s,r,Ee,l.quadtree,l.maxPointRadius);if(!a)return void He(null);const c=a.datum||{},u=null===(n=null===(t=l.scales)||void 0===t?void 0:t.x)||void 0===n?void 0:n.invert,d="function"==typeof u?u(a.x):void 0;He(wo(c,a.x,a.y,null!=d?{xValue:d,xPx:a.x}:void 0))};const ro=t.useCallback(e=>so.current(e),[]),lo=t.useRef(-1),ao=t.useRef(null),co=t.useRef(null),uo=t.useCallback(e=>{const t=Tn.current;if(!t||0===t.scene.length)return;const n=t.version;let o;if(co.current&&co.current.version===n)o=co.current.graph;else{const e=function(e){var t,n,o;const i=[];for(const s of e)switch(s.type){case"point":i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=s.size)break;i.push({x:s.x,y:s.y,datum:s.datum,shape:"circle",group:"_default"});break;case"line":{const e=s,n=Array.isArray(e.datum)?e.datum:[],o=null!==(t=e.group)&&void 0!==t?t:"_default";for(let t=0;e.path.length>t&&n.length>t;t++)i.push({x:e.path[t][0],y:e.path[t][1],datum:n[t],shape:"circle",group:o});break}case"area":{const e=s,t=Array.isArray(e.datum)?e.datum:[],o=null!==(n=e.group)&&void 0!==n?n:"_default";for(let n=0;e.topPath.length>n&&t.length>n;n++)i.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:t[n],shape:"circle",group:o});break}case"rect":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:null!==(o=s.group)&&void 0!==o?o:"_default"});break;case"heatcell":i.push({x:s.x+s.w/2,y:s.y+s.h/2,datum:s.datum,shape:"rect",w:s.w,h:s.h,group:"_default"})}return i.sort((e,t)=>e.x-t.x||e.y-t.y),i}(t.scene);if(0===e.length)return;o=function(e){var t,n;const o=new Map;for(const n of e){const e=null!==(t=n.group)&&void 0!==t?t:"_default";let i=o.get(e);i||(i=[],o.set(e,i)),i.push(n)}for(const e of o.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const i=Array.from(o.keys()).sort((e,t)=>{const n=o.get(e),i=o.get(t);return(n.length>0?n[0].y:0)-(i.length>0?i[0].y:0)}),s=Array.from(o.values()).flat();s.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;s.length>e;e++){s[e]._flatIndex=e;const t=null===(n=s[e].datum)||void 0===n?void 0:n.id;null!=t&&r.set(t+"",e)}return{flat:s,groups:i,byGroup:o,idToIdx:r}}(e),co.current={version:n,graph:o}}const i=lo.current;if(0>i){if("Escape"===e.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(e.key))return;e.preventDefault(),lo.current=0;const n=o.flat[0];ao.current={shape:n.shape,w:n.w,h:n.h};const i=xt(Object.assign(Object.assign({},n),{datum:Oe(n.datum,t.resolvedRibbons)}));return bn.current=i,wn(i),Te&&Te(i),void on()}const s=function(e,t){var n,o;if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const i=Math.max(0,Math.min(t,e.flat.length-1)),s=e.flat[i];return{flatIndex:i,group:null!==(n=s.group)&&void 0!==n?n:"_default",indexInGroup:null!==(o=s._groupIndex)&&void 0!==o?o:0}}(o,i),r=function(e,t,n){const{group:o,indexInGroup:i}=t,s=n.byGroup.get(o);switch(e){case"ArrowRight":return s.length-1>i?s[i+1]._flatIndex:t.flatIndex;case"ArrowLeft":return i>0?s[i-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?bt(n,n.groups[e+1],s[i]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?bt(n,n.groups[e-1],s[i]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(e.key,s,o);if(null===r)return;if(e.preventDefault(),0>r)return lo.current=-1,ao.current=null,bn.current=null,xn.current=null,wn(null),Te&&Te(null),void on();lo.current=r;const l=o.flat[r];ao.current={shape:l.shape,w:l.w,h:l.h};const a=xt(Object.assign(Object.assign({},l),{datum:Oe(l.datum,t.resolvedRibbons)}));bn.current=a,wn(a),Te&&Te(a),on()},[Te,on]),ho=t.useCallback(e=>{lo.current=-1,ao.current=null,oo(e)},[oo]);nn.current=()=>{tn.current=0;const e=hn.current,t=fn.current;if(!e||!t)return;const n=Tn.current;if(!n)return;const o="undefined"!=typeof performance?performance.now():Date.now(),i=n.advanceTransition(qt.current?o+1e6:o),s=!qt.current&&i,r=Yt.current.w!==an||Yt.current.h!==cn,l=$t.current||i||r;let a=!1;!l||s&&!r||(n.computeScene({width:an,height:cn}),Yt.current={w:an,h:cn},a=!0,Hn());const c="undefined"!=typeof window&&window.devicePixelRatio||1,u=function(e){if(!e)return li;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),i=t.getPropertyValue("--semiotic-bg").trim(),s=t.getPropertyValue("--semiotic-primary").trim(),r=o||t.getPropertyValue("--text-secondary").trim(),l=t.getPropertyValue("--text-primary").trim(),a=n||t.getPropertyValue("--surface-3").trim(),c=i||t.getPropertyValue("--surface-0").trim();return r||l||n||s?{axisStroke:a||li.axisStroke,tickText:r||li.tickText,crosshair:r?ai(r,"66"):li.crosshair,hoverFill:c?ai(c,"4D"):li.hoverFill,hoverStroke:r?ai(r,"99"):li.hoverStroke,pointRing:c||li.pointRing,primary:s||li.primary}:li}(e);jn.current=u.primary;const d=jt(wt,n.lastIngestTime>0?o-n.lastIngestTime:0),h=wt&&d.isStale;if(l){const t=Bo(e,Kt,sn,c);if(t){if(t.clearRect(-sn.left,-sn.top,Kt[0],Kt[1]),wt&&1>d.alpha&&(t.globalAlpha=d.alpha),"transparent"!==te&&!it){const n=getComputedStyle(e).getPropertyValue("--semiotic-bg").trim(),o=te||(n&&"transparent"!==n?n:null),i=o?tt(t,o):null;i&&(t.fillStyle=i,t.fillRect(-sn.left,-sn.top,Kt[0],Kt[1]))}if(t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,an,cn),t.clip()),rt&&n.scales)for(const e of rt)t.save(),e(t,n.scene,n.scales,{width:an,height:cn}),t.restore();const o=Dt?si.custom:si[k];if(o&&n.scales)for(const e of o)e(t,n.scene,n.scales,{width:an,height:cn});t.restore(),wt&&1>d.alpha&&(t.globalAlpha=1)}}{const e=Bo(t,Kt,sn,c);if(e&&(e.clearRect(-sn.left,-sn.top,Kt[0],Kt[1]),dn&&bn.current&&n.scales&&function(e,t,n,o,i,s,r){var l;if(!1===i.crosshair)return;const a=t.allSeries,c=a&&a.length>0,u=null!==(l=t.xPx)&&void 0!==l?l:t.x;e.save();const d="object"==typeof i.crosshair?i.crosshair:{};if(e.strokeStyle=d.stroke||r.crosshair,e.lineWidth=d.strokeWidth||1,e.setLineDash(d.strokeDasharray?d.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(c?u:t.x,0),e.lineTo(c?u:t.x,o),e.stroke(),c||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),c){e.lineWidth=2,e.strokeStyle=r.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(u,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||r.primary,e.fill(),e.stroke())}else{const n=i.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(s)||r.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=r.pointRing,e.lineWidth=2,e.stroke()}}(e,bn.current,an,cn,"object"==typeof dn?dn:{},xn.current,u),xn.current&&Array.isArray(Be))){const t=Be.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,i){var s;if(!n)return;const r="group"in n?n.group:void 0;if(void 0!==r)for(const n of t){if("line"!==n.type)continue;if(n.group!==r)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||i.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=null!==(s=t.opacity)&&void 0!==s?s:1,e.stroke(),e.restore()}}(e,n.scene,xn.current,t,u)}}l&&e&&e.setAttribute("aria-label",eo(n.scene,k+" chart"));const f=$t.current;if($t.current=f&&s&&!a,f&&n.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!mn||e(mn.x.domain()[0])!==e(n.scales.x.domain()[0])||e(mn.x.domain()[1])!==e(n.scales.x.domain()[1])||e(mn.y.domain()[0])!==e(n.scales.y.domain()[0])||e(mn.y.domain()[1])!==e(n.scales.y.domain()[1])||mn.x.range()[0]!==n.scales.x.range()[0]||mn.x.range()[1]!==n.scales.x.range()[1]||mn.y.range()[0]!==n.scales.y.range()[0]||mn.y.range()[1]!==n.scales.y.range()[1])&&vn(n.scales),Pt){const e=n.getData(),t="function"==typeof M?M:e=>e[M||"x"],o="function"==typeof C?C:e=>e[C||"y"];Pn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Nn(e.map(e=>o(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Ye&&Ye.length>0||Dt)&&(a||s))||!a&&33>o-yn.current||(pn(e=>e+1),yn.current=o),(null==wt?void 0:wt.showBadge)&&Cn(!!h),(s||null!=n.activeTransition||n.hasActivePulses)&&(tn.current=requestAnimationFrame(()=>nn.current()))},function(e){const{hydrated:n,wasHydratingFromSSR:o,storeRef:i,dirtyRef:s,renderFnRef:r,cleanup:l}=e;Gn(()=>{var e,t;n&&o&&(null===(t=null===(e=i.current)||void 0===e?void 0:e.cancelIntroAnimation)||void 0===t||t.call(e)),s.current=!0,r.current()},[n,o]);const a=t.useRef(l);a.current=l,t.useEffect(()=>()=>{var e;return null===(e=a.current)||void 0===e?void 0:e.call(a)},[])}({hydrated:Xt,wasHydratingFromSSR:Vt,storeRef:Tn,dirtyRef:$t,renderFnRef:nn,cleanup:()=>{var e;return null===(e=Wn.current)||void 0===e?void 0:e.clear()}}),t.useEffect(()=>{$t.current=!0,on()},[k,an,cn,we,te,ne,rt,on]),function(e,n,o,i,s,r){const l=t.useRef("fresh");t.useEffect(()=>{if(!e)return;const t=setInterval(()=>{const t=n.current;if(!t||0===t.lastIngestTime)return;const a="undefined"!=typeof performance?performance.now():Date.now(),c=jt(e,a-t.lastIngestTime);c.band===l.current&&c.isStale===s||(l.current=c.band,c.isStale!==s&&r(c.isStale),o.current=!0,i())},1e3);return()=>clearInterval(t)},[e,s,i])}(wt,Tn,$t,on,Mn,Cn);const fo=t.useMemo(()=>{if(Ce||Ne)return;const e=Tn.current;return(null==e?void 0:e.xIsDate)&&mn?ii(mn.x.domain()):void 0},[Ce,Ne,mn]),go=Ce||Ne||fo,bo=dn&&kn?Re?Re(kn):e.jsx(ui,{hover:kn}):null,ko=bo?e.jsx(_o,{x:kn.x,y:kn.y,containerWidth:an,containerHeight:cn,margin:sn,className:"stream-frame-tooltip",children:bo}):null,jo=ao.current,Ao=e.jsx(xo,{active:lo.current>=0,hoverPoint:kn,margin:sn,size:Kt,shape:null==jo?void 0:jo.shape,width:null==jo?void 0:jo.w,height:null==jo?void 0:jo.h}),Oo=ni(M,Y,"__semiotic_resolvedX","__semiotic_resolvedTime"),So=ni(C,W,"__semiotic_resolvedY","__semiotic_resolvedValue"),Mo=Oo.key,Co=So.key,Po=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let i=!1;const s=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),s=t.fn&&t.key&&!(t.key in n);if(!o&&!s)return n;i=!0;const r=Object.assign({},n);return o&&(r[e.key]=e.fn(n)),s&&(r[t.key]=t.fn(n)),r});return i?s:o}}(Oo,So,Ye&&Ye.length>0||!1);if(Yn||!Xt&&Vt){const t=Tn.current;t&&A&&(t.ingest({inserts:un,bounded:!0}),t.computeScene({width:an,height:cn}));const n=null!==(i=null==t?void 0:t.scene)&&void 0!==i?i:[],o=null!==(s=null==t?void 0:t.scales)&&void 0!==s?s:null,l=go||(()=>{if((null==t?void 0:t.xIsDate)&&o)return ii(o.x.domain())})();return e.jsxs("div",{ref:Ut,className:"stream-xy-frame"+(ee?" "+ee:""),role:"img","aria-label":Rt||("string"==typeof dt?dt:"XY chart"),style:{position:"relative",width:Q?"100%":Kt[0],height:Z?"100%":Kt[1]},children:[e.jsx(yo,{summary:Tt}),e.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:Kt[0],height:Kt[1],style:{position:"absolute",left:0,top:0},children:[e.jsx("g",{transform:`translate(${sn.left},${sn.top})`,children:ln}),e.jsxs("g",{transform:`translate(${sn.left},${sn.top})`,children:[te&&e.jsx("rect",{x:0,y:0,width:an,height:cn,fill:te}),ut&&o&&ut.map((t,i)=>e.jsx(h.Fragment,{children:t(n,o,{width:an,height:cn})},"svgpre-"+i)),n.map((t,n)=>function(t,n,o){var i,s,r,l,a;switch(t.type){case"line":{const o=t;if(0===o.path.length)return null;const i="M"+o.path.map(([e,t])=>`${e},${t}`).join("L");return e.jsx("path",{d:i,fill:"none",stroke:o.style.stroke||"#4e79a7",strokeWidth:o.style.strokeWidth||2,strokeDasharray:o.style.strokeDasharray,opacity:o.style.opacity},"line-"+n)}case"area":{const a=t;if(0===a.topPath.length)return null;const c=`M${a.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...a.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`;if(a.clipRect){const t=`${o?o+"-":""}area-clip-${n}`;return e.jsxs("g",{children:[e.jsx("defs",{children:e.jsx("clipPath",{id:t,children:e.jsx("rect",{x:a.clipRect.x,y:a.clipRect.y,width:a.clipRect.width,height:a.clipRect.height})})}),e.jsx("path",{d:c,fill:$n(a.style.fill),fillOpacity:null!==(s=null!==(i=a.style.fillOpacity)&&void 0!==i?i:a.style.opacity)&&void 0!==s?s:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth,clipPath:`url(#${t})`})]},"area-"+n)}return e.jsx("path",{d:c,fill:$n(a.style.fill),fillOpacity:null!==(l=null!==(r=a.style.fillOpacity)&&void 0!==r?r:a.style.opacity)&&void 0!==l?l:.7,stroke:a.style.stroke,strokeWidth:a.style.strokeWidth},"area-"+n)}case"point":{const o=t;return e.jsx("circle",{cx:o.x,cy:o.y,r:o.r,fill:$n(o.style.fill),opacity:null!==(a=o.style.opacity)&&void 0!==a?a:.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"point-"+n)}case"symbol":return function(t,n){const o=Le(t.symbolType,t.size,t.path);return e.jsx("path",{d:o,transform:t.rotation?`translate(${t.x},${t.y}) rotate(${180*t.rotation/Math.PI})`:`translate(${t.x},${t.y})`,fill:t.style.fill?$n(t.style.fill):"none",opacity:t.style.opacity,stroke:t.style.stroke,strokeWidth:t.style.strokeWidth},"symbol-"+n)}(t,n);case"rect":{const o=t;return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:$n(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth},"rect-"+n)}case"heatcell":{const o=t;if(o.showValues&&null!=o.value&&o.w>=20&&o.h>=20){const t=o.valueFormat?o.valueFormat(o.value):Number.isInteger(o.value)?o.value+"":100>Math.abs(o.value)?1>Math.abs(o.value)?o.value.toPrecision(3):o.value.toFixed(1):o.value.toFixed(0),[i,s,r]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(o.fill),l=.299*i+.587*s+.114*r>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(o.w,o.h)));return e.jsxs("g",{children:[e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill}),e.jsx("text",{x:o.x+o.w/2,y:o.y+o.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:l,fontSize:a+"px",children:t})]},"heatcell-"+n)}return e.jsx("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:o.fill},"heatcell-"+n)}case"candlestick":{const o=t,i=Math.min(o.openY,o.closeY),s=Math.max(Math.abs(o.openY-o.closeY),1),r=o.isUp?o.upColor:o.downColor;return e.jsxs("g",{children:[e.jsx("line",{x1:o.x,y1:o.highY,x2:o.x,y2:o.lowY,stroke:o.wickColor,strokeWidth:o.wickWidth}),e.jsx("rect",{x:o.x-o.bodyWidth/2,y:i,width:o.bodyWidth,height:s,fill:r,stroke:r,strokeWidth:1})]},"candle-"+n)}default:return null}}(t,n,zt)).filter(Boolean)]})]}),e.jsx(En,{width:an,height:cn,totalWidth:Kt[0],totalHeight:Kt[1],margin:sn,scales:o,showAxes:we,axes:je,xLabel:Ae,yLabel:Se,yLabelRight:Me,xFormat:l,yFormat:_e||Fe,axisExtent:Pe,showGrid:Ve,title:dt,legend:qe,legendHoverBehavior:Ue,legendClickBehavior:Ke,legendHighlightedCategory:Qe,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,foregroundGraphics:De(rn,$e(null===(r=Tn.current)||void 0===r?void 0:r.customLayoutOverlays,null!=Et?Et:null)),marginalGraphics:Pt,xValues:[],yValues:[],annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:Xe,annotationFrame:0,xAccessor:Mo,yAccessor:Co,annotationData:Po(null==t?void 0:t.getData()),pointNodes:null==t?void 0:t.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,linkedCrosshairName:Ht,linkedCrosshairSourceId:It})]})}return e.jsxs("div",{ref:Ut,className:"stream-xy-frame"+(ee?" "+ee:""),role:"group","aria-label":Rt||("string"==typeof dt?dt:"XY chart"),tabIndex:0,style:{position:"relative",width:Q?"100%":Kt[0],height:Z?"100%":Kt[1],overflow:"visible"},onKeyDown:uo,children:[Bt&&e.jsx(mo,{tableId:en}),Bt&&e.jsx(po,{scene:null!==(a=null===(l=Tn.current)||void 0===l?void 0:l.scene)&&void 0!==a?a:[],chartType:k+" chart",tableId:en,chartTitle:"string"==typeof dt?dt:void 0}),e.jsx(yo,{summary:Tt}),e.jsx(vo,{hoverPoint:kn}),e.jsxs("div",{role:"img","aria-label":Rt||("string"==typeof dt?dt:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onMouseMove:dn?ho:void 0,onMouseLeave:dn?io:void 0,onClick:He?ro:void 0,children:[ln&&e.jsx("svg",{style:{position:"absolute",left:0,top:0,width:Kt[0],height:Kt[1],pointerEvents:"none"},children:e.jsx("g",{transform:`translate(${sn.left},${sn.top})`,children:ln})}),e.jsx(In,{width:an,height:cn,totalWidth:Kt[0],totalHeight:Kt[1],margin:sn,scales:mn,showAxes:we,axes:je,showGrid:Ve,xFormat:go,yFormat:_e||Fe,axisExtent:Pe}),e.jsx("canvas",{ref:hn,"aria-label":eo(null!==(u=null===(c=Tn.current)||void 0===c?void 0:c.scene)&&void 0!==u?u:[],k+" chart"),style:{position:"absolute",left:0,top:0}}),e.jsx("canvas",{ref:fn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),e.jsx(En,{width:an,height:cn,totalWidth:Kt[0],totalHeight:Kt[1],margin:sn,scales:mn,showAxes:we,axes:je,xLabel:Ae,yLabel:Se,yLabelRight:Me,xFormat:go,yFormat:_e||Fe,axisExtent:Pe,showGrid:Ve,title:dt,legend:qe,legendHoverBehavior:Ue,legendClickBehavior:Ke,legendHighlightedCategory:Qe,legendIsolatedCategories:Ze,legendPosition:Je,legendLayout:et,foregroundGraphics:De(rn,$e(null===(d=Tn.current)||void 0===d?void 0:d.customLayoutOverlays,null!=Et?Et:null)),marginalGraphics:Pt,xValues:_n,yValues:Ln,annotations:Ye,autoPlaceAnnotations:Ge,svgAnnotationRules:Xe,annotationFrame:gn,xAccessor:Mo,yAccessor:Co,annotationData:Po(null===(f=Tn.current)||void 0===f?void 0:f.getData()),pointNodes:null===(g=Tn.current)||void 0===g?void 0:g.scene.filter(e=>"point"===e.type),curve:"string"==typeof R?R:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==te&&!it,linkedCrosshairName:Ht,linkedCrosshairSourceId:It}),(ft||gt)&&e.jsx(y,{width:an,height:cn,totalWidth:Kt[0],totalHeight:Kt[1],margin:sn,dimension:null!==(p=null==ft?void 0:ft.dimension)&&void 0!==p?p:"xy",scales:mn,onBrush:null!=gt?gt:()=>{},binSize:D,snap:null==ft?void 0:ft.snap,binBoundaries:null!==(m=null==ft?void 0:ft.binBoundaries)&&void 0!==m?m:"bar"===k?null===(x=Tn.current)||void 0===x?void 0:x.getBinBoundaries():void 0,snapDuring:null==ft?void 0:ft.snapDuring,streaming:"streaming"===j}),(null==wt?void 0:wt.showBadge)&&e.jsx(At,{isStale:Mn,position:wt.badgePosition}),Ao,ko]})]})});di.displayName="StreamXYFrame";const hi=t.createContext(null);function fi({colors:n,categories:o,colorScheme:i="category10",children:s}){const r=t.useMemo(()=>{if(n)return n;if(o){const e=Array.isArray(i)?i:ce[i]||ue,t={};for(let n=0;o.length>n;n++)t[o[n]]=e[n%e.length];return t}return{}},[n,o,i]);return e.jsx(hi.Provider,{value:r,children:s})}function gi(){return t.useContext(hi)}function pi(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,i]=o.range;t.push(t=>{const o=t[n];return o>=e&&i>=o})}return e=>t.every(t=>t(e))}function yi(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function mi(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}fi.displayName="CategoryColorProvider";const[vi,bi]=x(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),i=null==o?void 0:o.clauses.get(n.clientId);if(i&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!mi(o,n))return!1}return!0}(i,n))return{};const s=new Map(e.selections),r=yi(s,t),l=new Map(r.clauses);return l.set(n.clientId,n),s.set(t,Object.assign(Object.assign({},r),{clauses:l})),{selections:s}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const i=new Map(e.selections),s=new Map(o.clauses);return s.delete(n),i.set(t,Object.assign(Object.assign({},o),{clauses:s})),{selections:i}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if((null==o?void 0:o.resolution)===n)return{};const i=new Map(e.selections),s=yi(i,t);return i.set(t,Object.assign(Object.assign({},s),{resolution:n})),{selections:i}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,Object.assign(Object.assign({},n),{clauses:new Map})),{selections:o}})}})),[xi,ki]=x(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function wi(e){const n=t.useId(),o=e.clientId||n,{name:i}=e,s=bi(e=>e.selections.get(i)),r=bi(e=>e.setClause),l=bi(e=>e.clearClause),a=t.useMemo(()=>!!s&&s.clauses.size>0,[s]);return{predicate:t.useMemo(()=>s&&0!==s.clauses.size?function(e,t){const n=[];for(const[o,i]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(pi(i));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(s,o):()=>!0,[s,o]),isActive:a,selectPoints:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"point",values:new Set(i)},n=!0;n&&r(i,{clientId:o,type:"point",fields:t})},[o,i,r]),selectInterval:t.useCallback(e=>{const t={};let n=!1;for(const[o,i]of Object.entries(e))t[o]={type:"interval",range:i},n=!0;n&&r(i,{clientId:o,type:"interval",fields:t})},[o,i,r]),clear:t.useCallback(()=>{l(i,o)},[l,i,o]),clientId:o}}function ji(e){const n=e.name||"hover",{fields:o}=e,{predicate:i,isActive:s,selectPoints:r,clear:l}=wi({name:n});return{onHover:t.useCallback(e=>{if(!e)return void l();const t={};for(const n of o){const o=e[n];void 0!==o&&(t[n]=[o])}Si(t)&&r(t)},[o,r,l,n]),predicate:i,isActive:s}}function Ai(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function Oi(e){const{name:n,xField:o,yField:i}=e,{predicate:s,isActive:r,selectInterval:l,clear:a}=wi({name:n}),c=o&&i?"xyBrush":o?"xBrush":"yBrush",u=t.useCallback(e=>{if(!e)return void a();const t={};"xyBrush"===c&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(o&&(t[o]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),i&&(t[i]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===c&&Ai(e)?o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===c&&Ai(e)&&i&&(t[i]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Si(t)&&l(t)},[c,o,i,l,a]);return{brushInteraction:t.useMemo(()=>({brush:c,during:u,end:u}),[c,u]),predicate:s,isActive:r,clear:a}}function Si(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}const Mi=t.createContext(!1),Ci=t.createContext(null),_i="undefined"==typeof window?t.useEffect:t.useLayoutEffect;function Pi(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function Li(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}function Ni({selections:e}){const n=bi(e=>e.setResolution);return t.useEffect(()=>{for(const[t,o]of Object.entries(e))o.resolution&&n(t,o.resolution)},[e,n]),null}function Fi({categoryColors:n,interaction:o,selectionName:i,field:s}){const r=Object.entries(n),l=r.map(([e])=>e),a=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],c=ji({name:i,fields:[s]}),u=wi({name:i,clientId:"__linked-legend-isolate__"}),[d,h]=t.useState(new Set),[f,g]=t.useState(null),p=t.useRef(u.selectPoints);p.current=u.selectPoints;const y=t.useRef(u.clear);y.current=u.clear,t.useEffect(()=>{"isolate"===o&&(d.size>0?p.current({[s]:Array.from(d)}):y.current())},[o,d,s]);const m=t.useCallback(e=>{"highlight"===o&&(e?(g(e.label),c.onHover({[s]:e.label})):(g(null),c.onHover(null)))},[o,s,c]),v=t.useCallback(e=>{"isolate"===o&&h(t=>{const n=new Set(t);return n.has(e.label)?n.delete(e.label):n.add(e.label),n.size===l.length?new Set:n})},[o,l.length]),[b,[x]]=Po([0,0],!0,!1),k=t.useMemo(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const i of e){const e=26+7*i.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),x),[r,x]);return 0===r.length?null:e.jsx("div",{ref:b,style:{width:"100%",display:"block"},children:e.jsx("svg",{width:"100%",height:Math.max(30,22*k+8),style:{display:"block",overflow:"visible"},children:e.jsx(Lt,{legendGroups:a,title:!1,orientation:"horizontal",width:x,height:20,customHoverBehavior:"highlight"===o?m:void 0,customClickBehavior:"isolate"===o?v:void 0,highlightedCategory:f,isolatedCategories:d})})})}function Bi({children:n,selections:o,showLegend:i,legendPosition:s="top",legendInteraction:r="none",legendSelectionName:l="legend",legendField:a="category"}){const c=gi(),[u,d]=t.useState({}),h=t.useRef({}),f=t.useMemo(()=>({registerCategories:(e,t)=>{const n=Pi(t);d(t=>{var o;return Li(null!==(o=t[e])&&void 0!==o?o:[],n)?t:Object.assign(Object.assign({},t),{[e]:n})})},unregisterCategories:e=>{d(t=>{if(!(e in t))return t;const n=Object.assign({},t);return delete n[e],n})}}),[]),g=t.useMemo(()=>{const e=[];for(const t of Object.values(u))for(const n of t)e.push(n);return Pi(e)},[u]),p=t.useMemo(()=>{var e;const t=null!=c?c:{},n=h.current;let o=Object.keys(t).length+Object.keys(n).length;for(const e of g)t[e]||n[e]||(n[e]=ue[o%ue.length],o++);const i=Object.assign({},t);for(const o of g)i[o]=null!==(e=t[o])&&void 0!==e?e:n[o];return i},[c,g]),y=void 0===i||i,m=y&&Object.keys(p).length>0;return e.jsx(vi,{children:e.jsxs(xi,{children:[o&&e.jsx(Ni,{selections:o}),e.jsx(Ci.Provider,{value:f,children:e.jsx(fi,{colors:p,children:e.jsxs(Mi.Provider,{value:m,children:[y&&"top"===s&&e.jsx(Fi,{categoryColors:p,interaction:r,selectionName:l,field:a}),n,y&&"bottom"===s&&e.jsx(Fi,{categoryColors:p,interaction:r,selectionName:l,field:a})]})})})]})})}function Ri(e){return e?"string"==typeof e?{name:e}:e:null}function Ti(e,t,n){return t?(o,...i)=>{var s;const r=Object.assign({},e(o,...i));if(t.isActive)if(t.predicate(o))(null==n?void 0:n.selectedStyle)&&Object.assign(r,n.selectedStyle);else{const e=null!==(s=null==n?void 0:n.unselectedOpacity)&&void 0!==s?s:.5;r.opacity=e,r.fillOpacity=e,r.strokeOpacity=e,(null==n?void 0:n.unselectedStyle)&&Object.assign(r,n.unselectedStyle)}return r}:e}function Hi(){return P(e=>e.theme)}h.createContext(void 0);const Ii="#007bff";function Di(e,t,n){var o;const i=null!==(o=e.xValue)&&void 0!==o?o:null==t?void 0:t[n];if(null==i)return null;const s=Number(i);return Number.isFinite(s)?s:null}function Wi(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?Object.assign(Object.assign({},t),{xValue:e.xValue}):t||{}}function Ei(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}function zi(){var e;const t=Hi(),n=null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.categorical;return n&&n.length>0?n:void 0}function $i(e,n,o){const i=gi(),s=zi();return t.useMemo(()=>{var t;if(!n)return;const r=null!=i?i:void 0,l=null!==(t=null!=o?o:s&&s.length>0?s:void 0)&&void 0!==t?t:"category10";if(0!==e.length){if("function"==typeof n){const t=Array.from(new Set(e.map(e=>n(e)+"")));if(r&&Ei(r)){const e=ge(t.map(e=>({_cat:e})),"_cat",l);return t=>r[t]||e(t)}return ge(t.map(e=>({_cat:e})),"_cat",l)}if(r&&Ei(r)){const t=ge(e,n,l);return e=>r[e]||t(e)}return ge(e,n,l)}if(r&&Ei(r)){const e=ge([{_:"a"}],"_",l);return t=>r[t]||e(t)}},[e,n,o,i,s])}function Yi({selection:e,linkedHover:n,fallbackFields:o=[],unwrapData:i=!1,onObservation:s,chartType:r,chartId:l,onClick:a,hoverHighlight:c,colorByField:u}){const d=t.useId(),h=function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(n,o),f="series"===(null==h?void 0:h.mode)?[h.seriesField||u||o[0]].filter(e=>!!e):(null==h?void 0:h.fields)||o||[],g=wi({name:(null==e?void 0:e.name)||"__unused__"}),p=ji({name:(null==h?void 0:h.name)||"hover",fields:f}),y=ki(e=>e.pushObservation),m=e?{isActive:g.isActive,predicate:g.predicate}:null,[v,b]=t.useState(null),x=u||o[0],k=t.useMemo(()=>{if(!c||null==v||!x)return null;const e=v,t=x;return{isActive:!0,predicate:n=>{var o;return("string"==typeof n[t]?n[t]:(null!==(o=n[t])&&void 0!==o?o:"")+"")===e}}},[c,v,x]),w=t.useCallback(e=>{var t,o;if(n)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===(null==h?void 0:h.mode)&&h.xField){const n=Di(e,t,h.xField);null!=n&&function(e,t,n){const o=wn.positions.get(e);(null==o?void 0:o.locked)||o&&o.xValue===t&&o.sourceId===n||(wn={positions:new Map(wn.positions).set(e,{xValue:t,sourceId:n})},An())}(h.name||"hover",n,d)}"x-position"!==(null==h?void 0:h.mode)&&p.onHover(t)}else"x-position"===(null==h?void 0:h.mode)&&On(h.name||"hover",d),"x-position"!==(null==h?void 0:h.mode)&&p.onHover(null);if(c&&x)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=null==t?void 0:t[x];b(null!=n?n+"":null)}else b(null);if(s||y){const n={timestamp:Date.now(),chartType:r||"unknown",chartId:l};if(e){const i=Wi(e),r=Object.assign(Object.assign({},n),{type:"hover",datum:i||{},x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(o=e.y)&&void 0!==o?o:0});s&&s(r),y&&y(r)}else{const e=Object.assign(Object.assign({},n),{type:"hover-end"});s&&s(e),y&&y(e)}}},[n,p,h,d,s,r,l,y,c,x]),j=t.useCallback(e=>{var t,n,o,i;if("x-position"===(null==h?void 0:h.mode)&&h.xField&&e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=Di(e,t,h.xField);null!=n&&function(e,t,n){const o=wn.positions.get(e);if(null==o?void 0:o.locked){const t=new Map(wn.positions);return t.delete(e),wn={positions:t},An(),!1}wn={positions:new Map(wn.positions).set(e,{xValue:t,sourceId:n,locked:!0})},An()}(h.name||"hover",n,d)}if(e&&a){let o=e.data||e.datum||e;Array.isArray(o)&&(o=o[0]),a(o,{x:null!==(t=e.x)&&void 0!==t?t:0,y:null!==(n=e.y)&&void 0!==n?n:0})}if(s||y){const t={timestamp:Date.now(),chartType:r||"unknown",chartId:l};if(e){const n=Wi(e),r=Object.assign(Object.assign({},t),{type:"click",datum:n||{},x:null!==(o=e.x)&&void 0!==o?o:0,y:null!==(i=e.y)&&void 0!==i?i:0});s&&s(r),y&&y(r)}else{const e=Object.assign(Object.assign({},t),{type:"click-end"});s&&s(e),y&&y(e)}}},[a,s,y,r,l,h,d]);return t.useEffect(()=>{if("x-position"!==(null==h?void 0:h.mode))return;const e=h.name||"hover";return()=>{Sn(e,d),On(e,d)}},[null==h?void 0:h.mode,null==h?void 0:h.name,d]),{activeSelectionHook:m,hoverSelectionHook:k,customHoverBehavior:w,customClickBehavior:j,crosshairSourceId:d}}function Gi(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===(null==n?void 0:n.mode))return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Xi({data:e,colorBy:n,colorScale:o,showLegend:i,legendPosition:s="right",userMargin:r,defaults:l={top:50,bottom:60,left:70,right:40},categories:a}){const c=t.useContext(Mi),u=null!==t.useContext(Ci),d=void 0!==i?i:!c&&!!n,h=!!n&&(d||u),f=t.useMemo(()=>{if(!h)return[];if(void 0!==a)return a;const t=new Set;for(const o of e){const e="function"==typeof n?n(o):o[n];null!=e&&t.add(e+"")}return Array.from(t)},[a,n,e,h]);!function(e){const n=t.useContext(Ci),o=t.useId(),i=Pi(e),s=t.useRef([]);Li(s.current,i)||(s.current=i);const r=s.current;_i(()=>{if(n)return()=>n.unregisterCategories(o)},[n,o]),_i(()=>{n&&n.registerCategories(o,r)},[n,o,r])}(u&&n?f:[]);const g=t.useMemo(()=>{if(!d||!n)return;const t=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:i,strokeWidth:s,categories:r}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==i&&(n.stroke=i),void 0!==s&&(n.strokeWidth=s),n},type:"fill",items:(r&&r.length>0?r:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((i,s)=>{const r=e.find("function"==typeof t?e=>t(e)===i:e=>e[t]===i),l=r?o(r,t,n):n?n(i):de[s%de.length];return{label:i+"",color:l}}),label:""}]}}({data:e,colorBy:n,colorScale:o,getColor:fe,categories:f});return 0!==t.legendGroups.reduce((e,t)=>e+t.items.length,0)?t:void 0},[d,n,e,o,f]),p=t.useMemo(()=>{const e="number"==typeof r?{top:r,bottom:r,left:r,right:r}:null!=r?r:{},t=t=>{const n=e[t];return"number"==typeof n?n:l[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return g&&("right"===s&&!o("right")&&110>n.right?n.right=110:"left"===s&&!o("left")&&110>n.left?n.left=110:"top"===s&&!o("top")&&50>n.top?n.top=50:"bottom"===s&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[l,r,g,s]);return{legend:g,margin:p,legendPosition:s}}function Vi(e,n,o){const[i,s]=t.useState(null),[r,l]=t.useState(new Set),a=t.useMemo(()=>new Set,[]),c=t.useCallback(t=>{"highlight"===e&&s(t?t.label:null)},[e]),u=t.useCallback(t=>{"isolate"===e&&l(e=>{const n=new Set(e);return n.has(t.label)?n.delete(t.label):n.add(t.label),n.size===o.length?new Set:n})},[e,o.length]),d=t.useMemo(()=>{if(!e||"none"===e||!n)return null;const t="string"==typeof n?n:null;return"highlight"===e&&null!=i?{isActive:!0,predicate:e=>(t?e[t]:"function"==typeof n?n(e):null)===i}:"isolate"===e&&r.size>0?{isActive:!0,predicate:e=>{const o=t?e[t]:"function"==typeof n?n(e):null;return r.has(o)}}:null},[e,n,i,r]);return{highlightedCategory:"highlight"===e?i:null,isolatedCategories:"isolate"===e?r:a,onLegendHover:c,onLegendClick:u,legendSelectionHook:d}}const qi={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}}};function Ui(e,t,n){var o,i,s,r,l,a,c;const u=qi[e||"primary"],d="context"===e||"sparkline"===e;return{width:null!==(o=t.width)&&void 0!==o?o:e&&"primary"!==e||!(null==n?void 0:n.width)?u.width:n.width,height:null!==(i=t.height)&&void 0!==i?i:e&&"primary"!==e||!(null==n?void 0:n.height)?u.height:n.height,showAxes:null!==(s=t.showAxes)&&void 0!==s?s:u.showAxes,showGrid:null!==(r=t.showGrid)&&void 0!==r?r:u.showGrid,enableHover:null!==(l=t.enableHover)&&void 0!==l?l:!!t.linkedHover||u.enableHover,showLegend:null!==(a=t.showLegend)&&void 0!==a?a:u.showLegend,showLabels:null!==(c=t.showLabels)&&void 0!==c?c:u.showLabels,title:d?void 0:t.title,description:t.description,summary:t.summary,accessibleTable:t.accessibleTable,xLabel:d?void 0:t.xLabel,yLabel:d?void 0:t.yLabel,categoryLabel:d?void 0:t.categoryLabel,valueLabel:d?void 0:t.valueLabel,marginDefaults:Ki(u.marginDefaults,t.showCategoryTicks,t.orientation),compactMode:d}}function Ki(e,t,n){if(!1!==t)return e;const o=Object.assign({},e);return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}function Qi(e){return"string"==typeof e?e:"value"}function Zi(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function Ji(e,t){if(!t)return Zi(e);try{const n=t(e);return null==n?Zi(e):n}catch(t){return Zi(e)}}function es(e,t){return"function"==typeof t?t(e):e[t]}function ts(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const i="string"==typeof(null==e?void 0:e.y1Accessor)?e.y1Accessor:"high";n.push({label:"string"==typeof(null==e?void 0:e.y0Accessor)?e.y0Accessor:"low",accessor:e=>{var t,n,i,s;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y0)&&void 0!==i?i:0===o?null===(s=null==e?void 0:e.band)||void 0===s?void 0:s.y0:void 0},format:t}),n.push({label:i,accessor:e=>{var t,n,i,s;return null!==(i=null===(n=null===(t=null==e?void 0:e.bands)||void 0===t?void 0:t[o])||void 0===n?void 0:n.y1)&&void 0!==i?i:0===o?null===(s=null==e?void 0:e.band)||void 0===s?void 0:s.y1:void 0},format:t})}),n}function ns(t){const n=t.find(e=>"title"===e.role),o=t.filter(e=>"title"!==e.role);return t=>{const i=t.data;if(!i)return null;const s=n?Ji(es(i,n.accessor),n.format):null;return e.jsxs("div",{className:"semiotic-tooltip",style:jo,children:[null!=s&&e.jsx("div",{style:{fontWeight:"bold",marginBottom:o.length>0?4:0},children:s}),o.map((t,n)=>{const o=Ji(es(i,t.accessor),t.format);return e.jsxs("div",{style:n>0?{marginTop:2}:void 0,children:[e.jsxs("span",{style:{opacity:.7},children:[t.label,": "]}),e.jsx("span",{children:o})]},n)})]})}}function os({componentName:t,message:n,diagnosticHint:o,width:i,height:s}){return e.jsx("div",{role:"alert",style:{width:i,height:Math.max(s,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:e.jsxs("div",{style:{textAlign:"center",maxWidth:400},children:[e.jsx("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:t}),e.jsx("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:n}),o&&e.jsx("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:o})]})})}class is extends h.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){var n,o;null===(o=(n=this.props).onError)||void 0===o||o.call(n,e,t)}render(){if(this.state.error){const{fallback:t}=this.props,n=this.state.error;return"function"==typeof t?t(n):void 0!==t?t:e.jsx(os,{componentName:"ChartErrorBoundary",message:n.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}}var ss;const rs="undefined"!=typeof process&&"production"!==(null===(ss=process.env)||void 0===ss?void 0:ss.NODE_ENV);function ls({componentName:t,width:n,height:o,children:i}){return e.jsx(is,{fallback:i=>e.jsx(os,{componentName:t,message:i.message,width:n,height:o}),children:i})}const as={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},cs={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function us(t,n,o,i){return!1===i||null==t||Array.isArray(t)&&t.length>0?null:Array.isArray(t)?e.jsx("div",{style:Object.assign(Object.assign({},as),{width:n,height:o}),children:i||"No data available"}):null}function ds(t,n,o,i){if(!t)return null;if(!1===i)return null;if(null!=i)return e.jsx("div",{style:{width:n,height:o,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:i});const s=Math.min(5,Math.floor(o/40)),r=Math.max(8,Math.floor(o/(3*s))),l=Math.max(6,Math.floor(o/(2.5*s))),a=Math.floor((o-(s*(r+l)-l))/2);return e.jsx("div",{style:{width:n,height:o,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:s},(t,o)=>e.jsx("div",{className:"semiotic-loading-bar",style:Object.assign(Object.assign({},cs),{position:"absolute",top:a+o*(r+l),left:Math.floor(.1*n),width:30+(37*o+13)%50+"%",height:r,opacity:.5+o%2*.2})},o))})}function hs(e,t,n,o){if(!rs)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const i=t[0];if(!i||"object"!=typeof i)return;if(o in i)return;const s=Object.keys(i).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${s}`)}function fs(e,t){const n=e.length,o=t.length,i=Array(o+1);for(let e=0;o>=e;e++)i[e]=e;for(let s=1;n>=s;s++){let n=i[0];i[0]=s;for(let r=1;o>=r;r++){const o=i[r];i[r]=e[s-1]===t[r-1]?n:1+Math.min(n,i[r],i[r-1]),n=o}}return i[o]}function gs(e,t){var n;if(0===t.length)return null;const o=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(o)||o.includes(e.toLowerCase()))||(null!==(n=function(e,t,n=3){let o,i=n+1;for(const n of t){const t=fs(e.toLowerCase(),n.toLowerCase());i>t&&(i=t,o=n)}return i>n?void 0:o}(e,t,3))&&void 0!==n?n:null)}function ps({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:e}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[i,s]of Object.entries(n))if(s&&"string"==typeof s&&!(s in o)){const n=gs(s,t),o=n?` Try ${i}="${n}".`:"";return`${e}: ${i} "${s}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}function ys(e){const n=P(e=>e.theme.colors.selectionOpacity);return t.useMemo(()=>{var t,o;if(void 0!==e||void 0!==n)return Object.assign(Object.assign({name:null!==(t=null==e?void 0:e.name)&&void 0!==t?t:""},e),{unselectedOpacity:null!==(o=null==e?void 0:e.unselectedOpacity)&&void 0!==o?o:n})},[e,n])}function ms(e){const{data:n,rawData:o,colorBy:i,colorScheme:s,legendInteraction:r,legendPosition:l,selection:a,linkedHover:c,fallbackFields:u,unwrapData:d=!1,onObservation:h,chartType:f,chartId:g,showLegend:p,userMargin:y,marginDefaults:m,onClick:b,hoverHighlight:x,loading:k,loadingContent:w,emptyContent:j,width:A,height:O}=e,S=void 0===o,M=t.useMemo(()=>v(n),[n]),[C,_]=t.useState([]),P=t.useCallback(e=>{_(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,{activeSelectionHook:N,hoverSelectionHook:F,customHoverBehavior:B,customClickBehavior:R,crosshairSourceId:T}=Yi({selection:a,linkedHover:c,fallbackFields:u,unwrapData:d,onObservation:h,chartType:f,chartId:g,onClick:b,hoverHighlight:x,colorByField:L}),H=Gi(c,T),I=$i(M,i,s),D=t.useMemo(()=>{if(!i)return[];const e=new Set;for(const t of M){const n="function"==typeof i?i(t):t[i];null!=n&&e.add(n+"")}return Array.from(e)},[M,i]),W=t.useMemo(()=>S&&C.length>0?C:D,[S,C,D]),E=Vi(r,i,W),z=t.useMemo(()=>F||(E.legendSelectionHook?E.legendSelectionHook:N),[F,E.legendSelectionHook,N]),$=ys(a),Y=zi(),G=gi(),X=t.useMemo(()=>{if(I)return I;if(!i||0===W.length)return;const e=Array.isArray(s)&&s.length>0||"string"==typeof s&&s.length>0?s:Y&&Y.length>0?Y:de,t="__streamCat",n=ge(W.map(e=>({[t]:e})),t,e);return e=>(null==G?void 0:G[e])||n(e)||"#999"},[I,i,W,s,Y,G]),{legend:V,margin:q,legendPosition:U}=Xi({data:M,colorBy:i,colorScale:X,showLegend:p,legendPosition:l,userMargin:y,defaults:m,categories:W}),K=t.useMemo(()=>{const e={};return V&&(e.legend=V,e.legendPosition=U),r&&"none"!==r&&(e.legendHoverBehavior=E.onLegendHover,e.legendClickBehavior=E.onLegendClick,e.legendHighlightedCategory=E.highlightedCategory,e.legendIsolatedCategories=E.isolatedCategories),S&&i&&(e.legendCategoryAccessor=i,e.onCategoriesChange=P),e},[V,U,r,E.onLegendHover,E.onLegendClick,E.highlightedCategory,E.isolatedCategories,S,i,P]),Q=Array.isArray(o)?v(o):o,Z=ds(k,A,O,w),J=Z?null:us(Q,A,O,j);return{data:M,colorScale:I,allCategories:W,legendState:E,effectiveSelectionHook:z,activeSelectionHook:N,customHoverBehavior:B,customClickBehavior:R,legend:V,margin:q,legendPosition:U,earlyReturn:Z||J||null,legendBehaviorProps:K,crosshairProps:H,resolvedSelection:$}}function vs(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return null!=e?e:()=>({});const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>{const o=e(...t)||{};return Object.assign(Object.assign({},o),n)}:(...e)=>Object.assign({},n)}function bs(e){const{lineWidth:n=2,colorBy:o,colorScale:i,color:s,resolveStroke:r,fillArea:l,areaOpacity:a=.3,stroke:c,strokeWidth:u,opacity:d,effectiveSelectionHook:h,resolvedSelection:f}=e,g=t.useMemo(()=>(e,t)=>{const c={strokeWidth:n},u=!0===l||Array.isArray(l)&&null!=t&&l.includes(t);let d;return r?d=r(e,t):o?i&&(d=fe(e,o,i)):d=s||Ii,void 0!==d&&(c.stroke=d,u&&(c.fill=d,c.fillOpacity=a)),c},[n,o,i,s,r,l,a]),p=t.useMemo(()=>vs(g,{stroke:c,strokeWidth:u,opacity:d}),[g,c,u,d]);return t.useMemo(()=>Ti(p,null!=h?h:null,f),[p,h,f])}function xs(e,n){const{variant:o,frameRef:i,overrides:s,deps:r}=n;t.useImperativeHandle(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.remove(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i;return null!==(i=null===(o=e.current)||void 0===o?void 0:o.update(t,n))&&void 0!==i?i:[]},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]},getScales:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getScales())&&void 0!==n?n:null}}}if("network"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o,i,s,r;const l=Array.isArray(t)?t:[t],a=null!==(i=null===(o=null===(n=e.current)||void 0===n?void 0:n.getTopology())||void 0===o?void 0:o.nodes)&&void 0!==i?i:[],c=[];for(const t of l){const n=a.find(e=>e.id===t);n&&c.push(Object.assign(Object.assign({},null!==(s=n.data)&&void 0!==s?s:{}),{id:t})),null===(r=e.current)||void 0===r||r.removeNode(t)}return c},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{var o;const i=null===(o=e.current)||void 0===o?void 0:o.updateNode(t,n);return i?[Object.assign(Object.assign({},i),{id:t})]:[]}),clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n,o,i;return null!==(i=null===(o=null===(n=null===(t=e.current)||void 0===t?void 0:t.getTopology())||void 0===n?void 0:n.nodes)||void 0===o?void 0:o.map(e=>e.data))&&void 0!==i?i:[]}}}if("geo-points"===e){const e=t;return{push:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.push(t)},pushMany:t=>{var n;return null===(n=e.current)||void 0===n?void 0:n.pushMany(t)},remove:t=>{var n,o;return null!==(o=null===(n=e.current)||void 0===n?void 0:n.removePoint(t))&&void 0!==o?o:[]},update:(t,n)=>{var o,i,s;const r=null!==(i=null===(o=e.current)||void 0===o?void 0:o.removePoint(t))&&void 0!==i?i:[];for(const t of r)null===(s=e.current)||void 0===s||s.push(n(t));return r},clear:()=>{var t;return null===(t=e.current)||void 0===t?void 0:t.clear()},getData:()=>{var t,n;return null!==(n=null===(t=e.current)||void 0===t?void 0:t.getData())&&void 0!==n?n:[]}}}const n=t;return{push:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushLine(e)},pushMany:e=>{var t;return null===(t=n.current)||void 0===t?void 0:t.pushManyLines(e)},remove:e=>{var t,o;return null!==(o=null===(t=n.current)||void 0===t?void 0:t.removeLine(e))&&void 0!==o?o:[]},update:(e,t)=>{var o,i,s;const r=null!==(i=null===(o=n.current)||void 0===o?void 0:o.removeLine(e))&&void 0!==i?i:[];for(const e of r)null===(s=n.current)||void 0===s||s.pushLine(t(e));return r},clear:()=>{var e;return null===(e=n.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=n.current)||void 0===e?void 0:e.getLines())&&void 0!==t?t:[]}}}(o,i);return Object.assign(Object.assign({},e),s)},null!=r?r:[])}function ks(e,t,n,o){return new(n||(n=Promise))(function(i,s){function r(e){try{a(o.next(e))}catch(e){s(e)}}function l(e){try{a(o.throw(e))}catch(e){s(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(r,l)}a((o=o.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const ws="__forecastSegment";let js=null;function As(){return ks(this,void 0,void 0,function*(){return js||(js=yield Promise.resolve().then(function(){return wr})),js})}const Os="__semiotic_resolvedX",Ss="__semiotic_resolvedY";function Ms(e){const{data:n,xAccessor:o,yAccessor:i,forecast:s,anomaly:r,groupBy:l}=e,a="string"==typeof o?o:Os,c="string"==typeof i?i:Ss,u=t.useMemo(()=>{if(!s&&!r)return n;const e="function"==typeof o,t="function"==typeof i;return e||t?n.map(n=>{const s=Object.assign({},n);return e&&(s[Os]=o(n)),t&&(s[Ss]=i(n)),s}):n},[n,s,r,o,i]),[d,h]=t.useState(null),[f,g]=t.useState([]),p=t.useRef(s),y=t.useRef(r);return t.useEffect(()=>{if(!s&&!r)return void((p.current||y.current)&&(h(null),g([]),p.current=s,y.current=r));let e=!1;const t=s!==p.current||r!==y.current;if(p.current=s,y.current=r,t&&(h(null),g([])),s){const t=l&&"string"==typeof l&&"object"==typeof s?Object.assign(Object.assign({},s),{_groupBy:l}):s;(function(...e){return ks(this,void 0,void 0,function*(){return(yield As()).buildForecast(...e)})})(u,a,c,t,r).then(t=>{e||(h(t),g(t.annotations))}).catch(()=>{e||(h(null),g([]))})}else r&&function(...e){return ks(this,void 0,void 0,function*(){return(yield As()).buildAnomalyAnnotations(...e)})}(r).then(t=>{e||(h(null),g(t))}).catch(()=>{e||g([])});return()=>{e=!0}},[u,s,r,a,c,l]),{effectiveData:d?d.processedData:n,statisticalAnnotations:f,hasForecast:!!d,xAccessorKey:a,yAccessorKey:c}}const Cs=t.forwardRef(function(n,o){var i,s;const r=t.useRef(null);xs(o,{variant:"xy",frameRef:r});const l=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:d,yFormat:h,axisExtent:f,xAccessor:g="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="linear",showPoints:w=!1,pointRadius:j=3,fillArea:A=!1,areaOpacity:O=.3,lineWidth:S=2,lineGradient:M,tooltip:C,pointIdAccessor:_,annotations:P,directLabel:L,gapStrategy:N="break",anomaly:F,forecast:B,band:R,xExtent:T,yExtent:H,frameProps:I={},selection:D,linkedHover:W,onObservation:E,onClick:z,hoverHighlight:$,hoverRadius:Y,chartId:G,loading:X,loadingContent:V,emptyContent:q,legendInteraction:U,legendPosition:K,xScaleType:Q,yScaleType:Z,color:J,stroke:ee,strokeWidth:te,opacity:ne}=n,{width:oe,height:ie,enableHover:se,showGrid:re,showLegend:le,title:ae,description:ce,summary:ue,accessibleTable:de,xLabel:he,yLabel:ge}=l,pe=t.useMemo(()=>v(a),[a]);hs("LineChart",pe,"xAccessor",g),hs("LineChart",pe,"yAccessor",p);const{effectiveData:ye,statisticalAnnotations:me}=Ms({data:pe,xAccessor:g,yAccessor:p,forecast:B,anomaly:F,groupBy:y}),ve="__compoundGroup",be=!(!B||!y),xe=be?ve:B?ws:y,ke=t.useMemo(()=>{if(!be)return ye;const e="function"==typeof y?y:e=>e[y];return ye.map(t=>{const n=Object.assign({},t);return n[ve]=`${e(t)}__${t[ws]||"observed"}`,n})},[ye,be,y]),we=be?ke:ye,je=b||y,Ae=t.useMemo(()=>{if(!B)return;const e=B.upperBounds,t=B.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let i=1/0,s=-1/0;const r=ye;for(const e of r){const t="function"==typeof p?p(e):+e[p];if(isFinite(t)&&(i>t&&(i=t),t>s&&(s=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>s&&(s=t),i>t&&(i=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(i>t&&(i=t),t>s&&(s=t))}}return isFinite(i)&&isFinite(s)?[i,s]:void 0},[B,ye,p]),Oe=t.useCallback(e=>{const t="function"==typeof g?g(e):e[g],n="function"==typeof p?p(e):e[p];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[g,p]),Se=void 0!==(null===(i=we[0])||void 0===i?void 0:i[m]),Me=t.useMemo(()=>{if(Se)return we;if(xe){const e=we.reduce((e,t)=>{const n="function"==typeof xe?xe(t):t[xe];if(!e[n]){const o={[m]:[]};"string"==typeof xe&&(o[xe]=n),be&&(o[ws]=t[ws],"string"==typeof y&&(o[y]=t[y])),e[n]=o}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:we}]},[we,xe,m,Se]),{gapProcessedLineData:Ce,hasGaps:_e}=t.useMemo(()=>{if("interpolate"===N){let e=!1;const t=[];for(const n of Me){const o=(n[m]||[]).filter(t=>!Oe(t)||(e=!0,!1));o.length>0&&t.push(Object.assign(Object.assign({},n),{[m]:o}))}return{gapProcessedLineData:t,hasGaps:e}}if("break"===N){let e=!1;const t=[];for(const n of Me){const o=n[m]||[];let i=[],s=0;const r=xe&&"string"==typeof xe?n[xe]:void 0;for(const l of o)if(Oe(l))e=!0,i.length>0&&(t.push(Object.assign(Object.assign({},n),{[m]:i})),i=[],s++);else{const e=null!=r?`${r}__seg${s}`:"__seg"+s;i.push(Object.assign(Object.assign({},l),{_gapSegment:e}))}i.length>0&&t.push(Object.assign(Object.assign({},n),{[m]:i}))}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===N){let e=!1;const t="string"==typeof p?p:"y",n=[];for(const o of Me){const i=o[m]||[],s=[];for(const n of i)Oe(n)?(e=!0,s.push(Object.assign(Object.assign({},n),{[t]:0}))):s.push(n);n.push(Object.assign(Object.assign({},o),{[m]:s}))}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Me,hasGaps:!1}},[Me,N,m,Oe,xe,p]),Pe="object"==typeof L?L:{},Le=Pe.position||"end",Ne=Pe.fontSize||11,Fe=t.useMemo(()=>{var e;if(!L||!je)return[];const t="function"==typeof je?je:e=>e[je],n=new Set;for(const o of Ce){const i=o[m]||[];if(0===i.length)continue;const s=null!==(e=t("end"===Le?i[i.length-1]:i[0]))&&void 0!==e?e:t(o);if(null==s)continue;const r=s+"";""!==r&&n.add(r)}return Array.from(n)},[L,je,Ce,m,Le]),Be=t.useMemo(()=>{if(!L)return l.marginDefaults;const e=Fe.reduce((e,t)=>Math.max(e,t.length*(.6*Ne)),0)+10,t="end"===Le?"right":"left";return Object.assign(Object.assign({},l.marginDefaults),{[t]:Math.max(l.marginDefaults[t]||0,e)})},[L,Fe,Ne,Le,l.marginDefaults]),Re=ms({data:ye,rawData:a,colorBy:je,colorScheme:x,legendInteraction:U,legendPosition:K,selection:D,linkedHover:W,fallbackFields:je?["string"==typeof je?je:""]:[],unwrapData:!1,onObservation:E,onClick:z,hoverHighlight:$,chartType:"LineChart",chartId:G,showLegend:(!L||void 0!==le)&&le,userMargin:c,marginDefaults:Be,loading:X,loadingContent:V,emptyContent:q,width:oe,height:ie}),Te=Re.colorScale,He=Re.customHoverBehavior,Ie=Re.customClickBehavior,De=Re.crosshairProps,We=bs({lineWidth:S,colorBy:je,colorScale:Te,color:J,fillArea:A,areaOpacity:O,stroke:ee,strokeWidth:te,opacity:ne,effectiveSelectionHook:Re.effectiveSelectionHook,resolvedSelection:Re.resolvedSelection}),[Ee,ze]=t.useState(null);t.useEffect(()=>{if(!B)return void ze(null);let e=!1;return function(...e){return ks(this,void 0,void 0,function*(){return(yield As()).createSegmentLineStyle(...e)})}(We,B).then(t=>{e||ze(()=>t)}).catch(()=>{e||ze(null)}),()=>{e=!0}},[We,B]);const $e=Ee||We,Ye=t.useMemo(()=>{if(w)return e=>{const t={r:j,fillOpacity:1};return je?Te&&(t.fill=fe(e.parentLine||e,je,Te)):t.fill=J||Ii,t}},[w,j,je,Te,J]),Ge=Array.isArray(A)?"mixed":A?"area":"line",Xe=t.useMemo(()=>{var e;if(!L||!je)return[];const t="function"==typeof g?g:e=>e[g],n="function"==typeof p?p:e=>e[p],o="function"==typeof je?je:e=>e[je],i=new Map;for(const t of Ce){const n=t[m]||[];if(0===n.length)continue;const s="end"===Le?n[n.length-1]:n[0],r=null!==(e=o(s))&&void 0!==e?e:o(t);if(null==r)continue;const l=r+"";""===l||i.has(l)||i.set(l,s)}const s=Array.from(i.entries()).map(([e,o])=>({type:"text",label:e,["string"==typeof g?g:"x"]:t(o),["string"==typeof p?p:"y"]:n(o),dx:"end"===Le?6:-6,dy:0,color:Te?Te(e):Ii,fontSize:Ne}));s.sort((e,t)=>{const n="string"==typeof p?p:"y";return e[n]-t[n]});for(let e=1;s.length>e;e++){const t="string"==typeof p?p:"y",n=s[e-1],o=s[e];Ne+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Ne+2)}return s},[L,je,Te,Ce,m,g,p,Le,Ne]),Ve=Re.margin,qe=y||b,Ue=t.useMemo(()=>ns([{label:he||Qi(g),accessor:g,role:"x",format:d},{label:ge||Qi(p),accessor:p,role:"y",format:h},...qe?[{label:Qi(qe),accessor:qe,role:"group"}]:[],...ts(R,h)]),[g,p,he,ge,qe,d,h,R]),Ke=ps({componentName:"LineChart",data:Se?(null===(s=ye[0])||void 0===s?void 0:s[m])||[]:a,accessors:{xAccessor:g,yAccessor:p}}),Qe=t.useMemo(()=>Se||xe||_e?Ce.flatMap(e=>{const t=e[m]||[];return xe&&"string"==typeof xe?t.map(t=>Object.assign(Object.assign({},t),{[xe]:e[xe]})):t}):we,[Ce,m,Se,xe,we,_e]),Ze=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:Ge},Array.isArray(A)&&{areaGroups:A}),M&&{lineGradient:M}),null!=Y&&{hoverRadius:Y}),null!=a&&{data:Qe}),{xAccessor:g,yAccessor:p,xScaleType:Q,yScaleType:Z}),T&&{xExtent:T}),!H||null==H[0]&&null==H[1]?Ae?{yExtent:Ae}:{}:{yExtent:H}),{groupAccessor:"break"===N&&_e?"_gapSegment":xe||void 0}),R&&{band:R}),{curve:k,lineStyle:$e}),w&&{pointStyle:Ye}),{size:[oe,ie],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:Ve,showAxes:l.showAxes,xLabel:he,yLabel:ge,xFormat:d,yFormat:h}),void 0!==f&&{axisExtent:f}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{enableHover:se,showGrid:re}),Re.legendBehaviorProps),ae&&{title:ae}),ce&&{description:ce}),ue&&{summary:ue}),void 0!==de&&{accessibleTable:de}),u&&{className:u}),null!=n.animate&&{animate:n.animate}),{tooltipContent:!1===C?()=>null:"multi"===C?Mo():Co(C)||Ue}),"multi"===C&&{tooltipMode:"multi"}),(W||E||z||$)&&{customHoverBehavior:He}),(E||z||W)&&{customClickBehavior:Ie}),_&&{pointIdAccessor:_}),((null==P?void 0:P.length)||me.length||Xe.length)&&{annotations:[...P||[],...me,...Xe]}),De),I);return Re.earlyReturn?Re.earlyReturn:Ke?e.jsx(os,{componentName:"LineChart",message:Ke,width:oe,height:ie}):e.jsx(ls,{componentName:"LineChart",width:oe,height:ie,children:e.jsx(di,Object.assign({ref:r},Ze))})});function _s(e){const{title:t,description:n,summary:o,accessibleTable:i,className:s,animate:r,axisExtent:l,autoPlaceAnnotations:a}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==i&&(c.accessibleTable=i),s&&(c.className=s),null!=r&&(c.animate=r),void 0!==l&&(c.axisExtent=l),void 0!==a&&(c.autoPlaceAnnotations=a),c}function Ps(e){const{linkedHover:t,onObservation:n,onClick:o,hoverHighlight:i,customHoverBehavior:s,customClickBehavior:r,linkedHoverInClickPredicate:l=!0}=e,a={};return(t||n||o||i)&&(a.customHoverBehavior=s),(l?n||o||t:n||o)&&(a.customClickBehavior=r),a}function Ls(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:Co(t)||n}}function Ns(e){var n;const{safeData:o,data:i,areaBy:s,lineDataAccessor:r,colorBy:l,colorScale:a,color:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,areaOpacity:p,showLine:y,lineWidth:m,showPoints:v,pointRadius:b,xAccessor:x,yAccessor:k,xLabel:w,yLabel:j,xFormat:A,yFormat:O,groupField:S}=e,M=void 0!==(null===(n=o[0])||void 0===n?void 0:n[r]),C=t.useMemo(()=>{if(null==i)return[];if(!M&&!s)return o;let e;if(M)e=o;else{const t=s,n=o.reduce((e,n)=>{const o="function"==typeof t?t(n):n[t];if(!e[o]){const n={[r]:[]};"string"==typeof t&&(n[t]=o),e[o]=n}return e[o][r].push(n),e},{});e=Object.values(n)}return e.flatMap(e=>{const t=e[r]||[];return s&&"string"==typeof s?t.map(t=>Object.assign(Object.assign({},t),{[s]:e[s]})):t})},[i,o,s,r,M]),_=t.useMemo(()=>e=>{const t={};if(l){if(a){const n=fe(e,l,a);t.fill=n,y?(t.stroke=n,t.strokeWidth=m):t.stroke="none"}}else{const e=c||Ii;t.fill=e,y?(t.stroke=e,t.strokeWidth=m):t.stroke="none"}return t.fillOpacity=p,t},[l,a,c,p,y,m]),P=t.useMemo(()=>vs(_,{stroke:u,strokeWidth:d,opacity:h}),[_,u,d,h]);return{flattenedData:C,lineStyle:t.useMemo(()=>Ti(P,null!=f?f:null,g),[P,f,g]),pointStyle:t.useMemo(()=>{if(v)return e=>{const t={r:b,fillOpacity:1};return l?a&&(t.fill=fe(e.parentLine||e,l,a)):t.fill=c||Ii,t}},[v,b,l,a,c]),defaultTooltipContent:t.useMemo(()=>ns([{label:w||Qi(x),accessor:x,role:"x",format:A},{label:j||Qi(k),accessor:k,role:"y",format:O},...S?[{label:Qi(S),accessor:S,role:"group"}]:[],...ts(e.band,O)]),[x,k,w,j,S,A,O,e.band])}}function Fs(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}Cs.displayName="LineChart";const Bs=t.forwardRef(function(n,o){const i=t.useRef(null);xs(o,{variant:"xy",frameRef:i});const s=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:f,y0Accessor:g,gradientFill:p=!1,semanticGradient:y,lineDataAccessor:m="coordinates",colorBy:b,colorScheme:x,curve:k="monotoneX",areaOpacity:w=.7,lineGradient:j,showLine:A=!0,lineWidth:O=2,showPoints:S=!1,pointRadius:M=3,tooltip:C,annotations:_,forecast:P,anomaly:L,band:N,xExtent:F,yExtent:B,frameProps:R={},selection:T,linkedHover:H,onObservation:I,onClick:D,hoverHighlight:W,chartId:E,loading:z,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:X,color:V,stroke:q,strokeWidth:U,opacity:K}=n,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:se,xLabel:re,yLabel:le}=s,ae=t.useMemo(()=>v(r),[r]),ce=b||f,ue=t.useMemo(()=>{return y&&y.length>0?{colorStops:(e=y,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Fs(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:p;var e},[y,p]);hs("AreaChart",ae,"xAccessor",d),hs("AreaChart",ae,"yAccessor",h);const de=ms({data:ae,rawData:r,colorBy:ce,colorScheme:x,legendInteraction:G,legendPosition:X,selection:T,linkedHover:H,fallbackFields:ce?["string"==typeof ce?ce:""]:[],unwrapData:!1,onObservation:I,onClick:D,hoverHighlight:W,chartType:"AreaChart",chartId:E,showLegend:te,userMargin:l,marginDefaults:s.marginDefaults,loading:z,loadingContent:$,emptyContent:Y,width:Q,height:Z}),{effectiveData:he,statisticalAnnotations:fe}=Ms({data:ae,xAccessor:d,yAccessor:h,forecast:P,anomaly:L,groupBy:f}),{flattenedData:ge,lineStyle:pe,pointStyle:ye,defaultTooltipContent:me}=Ns({safeData:he,data:r,areaBy:f,lineDataAccessor:m,colorBy:ce,colorScale:de.colorScale,color:V,stroke:q,strokeWidth:U,opacity:K,effectiveSelectionHook:de.effectiveSelectionHook,resolvedSelection:de.resolvedSelection,areaOpacity:w,showLine:A,lineWidth:O,showPoints:S,pointRadius:M,xAccessor:d,yAccessor:h,xLabel:re,yLabel:le,xFormat:c,yFormat:u,groupField:f||b,band:N}),ve=ps({componentName:"AreaChart",data:r,accessors:{xAccessor:d,yAccessor:h}}),be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"area"},null!=r&&{data:ge}),{xAccessor:d,yAccessor:h,groupAccessor:f||void 0}),g&&{y0Accessor:g}),N&&{band:N}),ue&&{gradientFill:ue}),j&&{lineGradient:j}),{curve:k,lineStyle:pe}),S&&ye&&{pointStyle:ye}),{size:[Q,Z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:de.margin,showAxes:s.showAxes,xLabel:re,yLabel:le,xFormat:c,yFormat:u,enableHover:J}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:ee}),de.legendBehaviorProps),_s({title:ne,description:oe,summary:ie,accessibleTable:se,className:a,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),"multi"===C?{tooltipContent:Mo(),tooltipMode:"multi"}:Ls({tooltip:C,defaultTooltipContent:me})),Ps({linkedHover:H,onObservation:I,onClick:D,hoverHighlight:W,customHoverBehavior:de.customHoverBehavior,customClickBehavior:de.customClickBehavior})),(_&&_.length>0||fe.length>0)&&{annotations:[..._||[],...fe]}),F&&{xExtent:F}),B&&{yExtent:B}),de.crosshairProps),R);return de.earlyReturn?de.earlyReturn:ve?e.jsx(os,{componentName:"AreaChart",message:ve,width:Q,height:Z}):e.jsx(ls,{componentName:"AreaChart",width:Q,height:Z,children:e.jsx(di,Object.assign({ref:i},be))})});function Rs(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}Bs.displayName="AreaChart";const Ts=t.forwardRef(function(n,o){const i=t.useRef(null),s=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:d="x",seriesAAccessor:h="a",seriesBAccessor:f="b",seriesALabel:g="A",seriesBLabel:p="B",seriesAColor:y="var(--semiotic-danger, #dc2626)",seriesBColor:m="var(--semiotic-info, #2563eb)",showLines:b=!0,lineWidth:x=1.5,showPoints:k=!1,pointRadius:w=3,curve:j="linear",areaOpacity:A=.6,gradientFill:O,tooltip:S,annotations:M,xExtent:C,yExtent:_,frameProps:P={},selection:L,linkedHover:N,onObservation:F,onClick:B,hoverHighlight:R,chartId:T,loading:H,loadingContent:I,emptyContent:D,legendInteraction:W,legendPosition:E,pointIdAccessor:z,windowSize:$}=n,{width:Y,height:G,enableHover:X,showGrid:V,showLegend:q,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=s,te=t.useMemo(()=>"function"==typeof d?e=>Rs(d(e)):e=>Rs(e[d]),[d]),ne=t.useMemo(()=>"function"==typeof h?e=>Rs(h(e)):e=>Rs(e[h]),[h]),oe=t.useMemo(()=>"function"==typeof f?e=>Rs(f(e)):e=>Rs(e[f]),[f]),[ie,se]=t.useState([]),re=t.useRef([]),le=null==r,ae=t.useMemo(()=>v(le?ie:r),[le,ie,r]),ce=t.useMemo(()=>function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),s=[];let r=0,l=null,a=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,d=e=>`seg-${r}-${e}`,h=e=>s.push(e),f=(e,t)=>{h({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:d(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;i.length>e;e++){const s=i[e],g=t(s),p=n(s),y=o(s);if(!Number.isFinite(g)||!Number.isFinite(p)||!Number.isFinite(y))continue;const m=u(p,y);if(null!==m)if(null!=l){if(a&&a.w!==m){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=p-a.a-(y-a.b);if(0!==n){const o=Math.max(0,Math.min(1,(a.b-a.a)/n));e=a.x+o*(g-a.x),t=a.a+o*(p-a.a)}else e=a.x,t=a.a}h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t}),r++,l=m,h({__x:e,__y:t,__y0:t,__diffSegment:d(l),__diffWinner:l,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],l)}else for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:s}),a={x:g,a:p,b:y,w:m}}else{l=m;for(const e of c)f(e,l);c=[],h({__x:g,__y:y>p?y:p,__y0:y>p?p:y,__diffSegment:d(l),__diffWinner:l,__valA:p,__valB:y,__sourceDatum:s}),a={x:g,a:p,b:y,w:m}}else c.push({x:g,y:p,datum:s})}for(const e of c)f(e,null!=l?l:"A");return s}(ae,te,ne,oe),[ae,te,ne,oe]),ue=t.useMemo(()=>b?function(e,t,n,o){if(!e.length)return[];const i=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),s=[];for(const e of i){const i=t(e),r=n(e),l=o(e);Number.isFinite(r)&&s.push({__x:i,__y:r,__diffSegment:"line-A"}),Number.isFinite(l)&&s.push({__x:i,__y:l,__diffSegment:"line-B"})}return s}(ae,te,ne,oe):[],[b,ae,te,ne,oe]),de=t.useMemo(()=>[...ce,...ue],[ce,ue]),he=t.useMemo(()=>{const e=new Set;for(const t of ce)e.add(t.__diffSegment);return Array.from(e)},[ce]);t.useImperativeHandle(o,()=>{const e=e=>{const t=$&&e.length>$?e.slice(e.length-$):e;re.current=t,se(t)},t=z?"function"==typeof z?z:e=>e[z]:null;return{push:t=>e([...re.current,t]),pushMany:t=>e([...re.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],i=[],s=[];for(const e of re.current)o.includes(t(e))?i.push(e):s.push(e);return e(s),i},update:(n,o)=>{if(!t)return[];const i=Array.isArray(n)?n:[n],s=[],r=re.current.map(e=>{if(i.includes(t(e))){const t=o(e);return s.push(t),t}return e});return e(r),s},clear:()=>e([]),getData:()=>le?re.current:ae,getScales:()=>{var e,t;return null!==(t=null===(e=i.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[le,ae,z,$]);const fe=ms({data:ae,rawData:r,colorBy:"__diffWinner",colorScheme:[y,m],legendInteraction:W,legendPosition:E,selection:L,linkedHover:N,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:F,onClick:B,hoverHighlight:R,chartType:"DifferenceChart",chartId:T,showLegend:q,userMargin:l,marginDefaults:s.marginDefaults,loading:H,loadingContent:I,emptyContent:D,width:Y,height:G}),ge=t.useMemo(()=>{if(!1!==q)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:g,color:y},{label:p,color:m}]}]}},[q,g,p,y,m]),pe=t.useCallback(e=>{const t=e.__diffSegment;return{fill:"A"==((null==t?void 0:t.endsWith("-A"))?"A":"B")?y:m,stroke:"none",fillOpacity:A}},[y,m,A]),ye=t.useCallback(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,strokeWidth:x,fill:"none"}),[y,m,x]),me=t.useCallback(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?y:m,r:w}),[y,m,w]),ve=t.useCallback(t=>{var n;const o=t.data,i=t.allSeries,s=null!==(n=t.xValue)&&void 0!==n?n:null==o?void 0:o.__x;let r=null==o?void 0:o.__valA,l=null==o?void 0:o.__valB;if(i&&i.length>0){const e=i.find(e=>"line-A"===e.group),t=i.find(e=>"line-B"===e.group);null!=(null==e?void 0:e.value)&&Number.isFinite(e.value)&&(r=e.value),null!=(null==t?void 0:t.value)&&Number.isFinite(t.value)&&(l=t.value)}if(null!=s&&(null==r||null==l)){const e=ae.find(e=>te(e)===s);e&&(null==r&&(r=ne(e)),null==l&&(l=oe(e)))}const a=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",u=c&&null!=s?c(s):null!=s?s+"":"";return e.jsxs("div",{className:"semiotic-tooltip",style:jo,children:[u&&e.jsx("div",{style:{fontWeight:600,marginBottom:4},children:u}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[g,": ",a(r)]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{width:10,height:10,background:m,display:"inline-block",borderRadius:2}}),e.jsxs("span",{children:[p,": ",a(l)]})]}),null!=r&&null!=l&&Number.isFinite(r)&&Number.isFinite(l)&&e.jsxs("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",a(r-l)]})]})},[ae,te,ne,oe,c,y,m,g,p]),be="multi"===S,xe=t.useMemo(()=>!1===S?()=>null:be?ve:Co(S)||ve,[S,be,ve]);if(fe.earlyReturn)return fe.earlyReturn;const ke=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"mixed",data:de,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:he,curve:j,areaStyle:pe,lineStyle:ye},k&&{pointStyle:me}),{size:[Y,G],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:fe.margin,showAxes:s.showAxes,xLabel:J,yLabel:ee,xFormat:c,yFormat:u,enableHover:X,showGrid:V}),O&&{gradientFill:!0===O?{topOpacity:.85,bottomOpacity:.15}:O}),ge&&{legend:ge,legendPosition:fe.legendPosition}),_s({title:U,description:K,summary:Q,accessibleTable:Z,className:a,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),{tooltipContent:xe}),be&&{tooltipMode:"multi"}),Ps({linkedHover:N,onObservation:F,onClick:B,hoverHighlight:R,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior})),M&&M.length>0&&{annotations:M}),C&&{xExtent:C}),_&&{yExtent:_}),fe.crosshairProps),P);return e.jsx(ls,{componentName:"DifferenceChart",width:Y,height:G,children:e.jsx(di,Object.assign({ref:i},ke))})});"function"==typeof Ts&&(Ts.displayName="DifferenceChart");const Hs=t.forwardRef(function(n,o){const i=t.useRef(null),s=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",areaBy:f,lineDataAccessor:g="coordinates",colorBy:p,colorScheme:y,curve:m="monotoneX",areaOpacity:b=.7,showLine:x=!0,lineWidth:k=2,showPoints:w=!1,pointRadius:j=3,normalize:A=!1,baseline:O="zero",stackOrder:S,tooltip:M,annotations:C,xExtent:_,yExtent:P,frameProps:L={},selection:N,linkedHover:F,onObservation:B,onClick:R,hoverHighlight:T,chartId:H,loading:I,loadingContent:D,emptyContent:W,legendInteraction:E,legendPosition:z,color:$,stroke:Y,strokeWidth:G,opacity:X}=n,{width:V,height:q,enableHover:U,showGrid:K,showLegend:Q,title:Z,description:J,summary:ee,accessibleTable:te,xLabel:ne,yLabel:oe}=s,ie=t.useMemo(()=>v(r),[r]),se=p||f;xs(o,{variant:"xy",frameRef:i});const re=ms({data:ie,rawData:r,colorBy:se,colorScheme:y,legendInteraction:E,legendPosition:z,selection:N,linkedHover:F,fallbackFields:se?["string"==typeof se?se:""]:[],unwrapData:!1,onObservation:B,onClick:R,hoverHighlight:T,chartType:"StackedAreaChart",chartId:H,showLegend:Q,userMargin:l,marginDefaults:s.marginDefaults,loading:I,loadingContent:D,emptyContent:W,width:V,height:q}),{flattenedData:le,lineStyle:ae,pointStyle:ce,defaultTooltipContent:ue}=Ns({safeData:ie,data:r,areaBy:f,lineDataAccessor:g,colorBy:se,colorScale:re.colorScale,color:$,stroke:Y,strokeWidth:G,opacity:X,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection,areaOpacity:b,showLine:x,lineWidth:k,showPoints:w,pointRadius:j,xAccessor:d,yAccessor:h,xLabel:ne,yLabel:oe,xFormat:c,yFormat:u,groupField:f||p}),de=ps({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:d,yAccessor:h}}),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"stackedarea"},null!=r&&{data:le}),{xAccessor:d,yAccessor:h,groupAccessor:f||void 0,curve:m,normalize:A,baseline:A?"zero":O,stackOrder:S,lineStyle:ae}),w&&ce&&{pointStyle:ce}),{size:[V,q],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:re.margin,showAxes:s.showAxes,xLabel:ne,yLabel:oe,xFormat:c,yFormat:u,enableHover:U}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:K}),re.legendBehaviorProps),_s({title:Z,description:J,summary:ee,accessibleTable:te,className:a,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),"multi"===M?{tooltipContent:Mo(),tooltipMode:"multi"}:Ls({tooltip:M,defaultTooltipContent:ue})),Ps({linkedHover:F,onObservation:B,onClick:R,hoverHighlight:T,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior})),C&&C.length>0&&{annotations:C}),_&&{xExtent:_}),P&&{yExtent:P}),re.crosshairProps),L);return re.earlyReturn?re.earlyReturn:de?e.jsx(os,{componentName:"StackedAreaChart",message:de,width:V,height:q}):e.jsx(ls,{componentName:"StackedAreaChart",width:V,height:q,children:e.jsx(di,Object.assign({ref:i},he))})});function Is(e){const{colorBy:n,colorScale:o,color:i,pointRadius:s=5,radiusFn:r,fillOpacity:l=1,fallbackFill:a,baseStyleExtras:c,stroke:u,strokeWidth:d,opacity:h,effectiveSelectionHook:f,resolvedSelection:g,colorDatumAccessor:p}=e,y=t.useMemo(()=>e=>{const t="function"==typeof c?c(e):c,u=t?Object.assign({},t):{};if(void 0===u.fillOpacity&&(u.fillOpacity=l),void 0===u.fill)if(n){if(o){const t=p?p(e):e;u.fill=fe(t,n,o)}}else u.fill=a?a(e):i||Ii;return void 0===u.r&&(u.r=r?r(e):s),u},[n,o,i,s,r,l,a,c,p]),m=t.useMemo(()=>vs(y,{stroke:u,strokeWidth:d,opacity:h}),[y,u,d,h]);return t.useMemo(()=>Ti(m,null!=f?f:null,g),[m,f,g])}function Ds(e){const{accessor:n,data:o,isPushMode:i}=e,s=t.useRef(null),[r,l]=t.useState(0),a=t.useCallback(e=>{if(!i||!n)return;let t=!1;for(const o of e){const e="function"==typeof n?n(o):o[n];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(s.current?(s.current[0]>i&&(s.current[0]=i,t=!0),i>s.current[1]&&(s.current[1]=i,t=!0)):(s.current=[i,i],t=!0))}t&&l(e=>e+1)},[i,n]),c=t.useCallback(()=>{i&&(s.current=null,l(e=>e+1))},[i]),u=t.useMemo(()=>{var e;if(i)return null!==(e=s.current)&&void 0!==e?e:void 0;if(!n||0===o.length)return;const t="function"==typeof n?n:e=>e[n];let r=1/0,l=-1/0;for(const e of o){const n=t(e);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(r>o&&(r=o),o>l&&(l=o))}return Number.isFinite(r)&&Number.isFinite(l)?[r,l]:void 0},[o,n,i,r]);return{domain:u,trackPushed:a,reset:c}}function Ws(e){var t;if(!e)return;const n="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({type:"trend",method:null!==(t=n.method)&&void 0!==t?t:"linear"},null!=n.bandwidth&&{bandwidth:n.bandwidth}),null!=n.order&&{order:n.order}),null!=n.color&&{color:n.color}),null!=n.strokeWidth&&{strokeWidth:n.strokeWidth}),null!=n.strokeDasharray&&{strokeDasharray:n.strokeDasharray}),null!=n.label&&{label:n.label})}Hs.displayName="StackedAreaChart";const Es=t.forwardRef(function(n,o){const i=t.useRef(null),s=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:f="y",xScaleType:g,yScaleType:p,colorBy:y,colorScheme:m,sizeBy:b,sizeRange:x=[3,15],symbolBy:k,symbolMap:w,pointRadius:j=5,pointOpacity:A=.8,tooltip:O,marginalGraphics:S,pointIdAccessor:M,annotations:C,regression:_,forecast:P,anomaly:L,xExtent:N,yExtent:F,frameProps:B={},selection:R,linkedHover:T,linkedBrush:H,onObservation:I,onClick:D,hoverHighlight:W,chartId:E,loading:z,loadingContent:$,emptyContent:Y,legendInteraction:G,legendPosition:X,color:V,stroke:q,strokeWidth:U,opacity:K}=n,{width:Q,height:Z,enableHover:J,showGrid:ee,showLegend:te,title:ne,description:oe,summary:ie,accessibleTable:se,xLabel:re,yLabel:le}=s,ae=t.useMemo(()=>v(r),[r]),ce=void 0===r,{domain:ue,trackPushed:de,reset:he}=Ds({accessor:b,data:ae,isPushMode:ce}),fe=t.useCallback(e=>{var t;de([e]),null===(t=i.current)||void 0===t||t.push(e)},[de]),ge=t.useCallback(e=>{var t;de(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[de]);xs(o,{variant:"xy",frameRef:i,overrides:{push:fe,pushMany:ge,clear:()=>{var e;he(),null===(e=i.current)||void 0===e||e.clear()}},deps:[fe,ge,he]});const ye=ms({data:ae,rawData:r,colorBy:y,colorScheme:m,legendInteraction:G,legendPosition:X,selection:R,linkedHover:T,fallbackFields:y?["string"==typeof y?y:""]:[],unwrapData:!1,onObservation:I,onClick:D,hoverHighlight:W,chartType:"Scatterplot",chartId:E,showLegend:te,userMargin:l,marginDefaults:s.marginDefaults,loading:z,loadingContent:$,emptyContent:Y,width:Q,height:Z}),me=Ri(H),ve=Oi({name:(null==me?void 0:me.name)||"__unused_brush__",xField:(null==me?void 0:me.xField)||("string"==typeof d?d:void 0),yField:(null==me?void 0:me.yField)||("string"==typeof f?f:void 0)}),be=me?"xyBrush"===ve.brushInteraction.brush?"xy":"xBrush"===ve.brushInteraction.brush?"x":"y":void 0,xe=h.useRef(ve.brushInteraction);xe.current=ve.brushInteraction;const ke=t.useCallback(e=>{const t=xe.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);hs("Scatterplot",ae,"xAccessor",d),hs("Scatterplot",ae,"yAccessor",f);const we=t.useMemo(()=>b?null!=ue?ue:[0,1]:void 0,[b,ue]),je=t.useMemo(()=>b?e=>pe(e,b,x,we):void 0,[b,x,we]),Ae=Is({colorBy:y,colorScale:ye.colorScale,color:V,pointRadius:j,fillOpacity:A,radiusFn:je,stroke:q,strokeWidth:U,opacity:K,effectiveSelectionHook:ye.effectiveSelectionHook,resolvedSelection:ye.resolvedSelection}),Oe=t.useMemo(()=>ns([{label:re||Qi(d),accessor:d,role:"x",format:c},{label:le||Qi(f),accessor:f,role:"y",format:u},...y?[{label:Qi(y),accessor:y,role:"color"}]:[],...b?[{label:Qi(b),accessor:b,role:"size"}]:[]]),[d,f,re,le,y,b,c,u]),{effectiveData:Se,statisticalAnnotations:Me}=Ms({data:ae,xAccessor:d,yAccessor:f,forecast:P,anomaly:L}),Ce=t.useMemo(()=>{const e=Ws(_);return e||0!==Me.length?[...e?[e]:[],...C||[],...Me]:C},[_,C,Me]);if(ye.earlyReturn)return ye.earlyReturn;const _e=ps({componentName:"Scatterplot",data:r,accessors:{xAccessor:d,yAccessor:f}});if(_e)return e.jsx(os,{componentName:"Scatterplot",message:_e,width:Q,height:Z});const Pe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=r&&{data:Se}),{xAccessor:d,yAccessor:f,xScaleType:g,yScaleType:p,colorAccessor:y||void 0,sizeAccessor:b||void 0}),k&&{symbolAccessor:k}),w&&{symbolMap:w}),{sizeRange:x,pointStyle:Ae,colorScheme:m,size:[Q,Z],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ye.margin,showAxes:s.showAxes,xLabel:re,yLabel:le,xFormat:c,yFormat:u,enableHover:J,showGrid:ee}),ye.legendBehaviorProps),_s({title:ne,description:oe,summary:ie,accessibleTable:se,className:a,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),Ls({tooltip:O,defaultTooltipContent:Oe})),Ps({linkedHover:T,onObservation:I,onClick:D,hoverHighlight:W,customHoverBehavior:ye.customHoverBehavior,customClickBehavior:ye.customClickBehavior})),S&&{marginalGraphics:S}),M&&{pointIdAccessor:M}),Ce&&Ce.length>0&&{annotations:Ce}),N&&{xExtent:N}),F&&{yExtent:F}),me&&{brush:{dimension:be},onBrush:ke}),ye.crosshairProps),B);return e.jsx(ls,{componentName:"Scatterplot",width:Q,height:Z,children:e.jsx(di,Object.assign({ref:i},Pe))})});function zs(e,t){return te(1===t?.5:e/(t-1))}Es.displayName="Scatterplot";const $s=t.forwardRef(function(n,o){var i,s;const r=t.useRef(null);xs(o,{variant:"xy",frameRef:r});const l=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xFormat:d,yFormat:h,xAccessor:f="x",yAccessor:g="y",orderAccessor:p,orderLabel:y,pointRadius:m=4,tooltip:v,pointIdAccessor:b,annotations:x,regression:k,forecast:w,anomaly:j,xExtent:A,yExtent:O,frameProps:S={},selection:M,linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,chartId:N,loading:F,loadingContent:B,emptyContent:R,legendInteraction:T,stroke:H,strokeWidth:I,opacity:D}=n,{width:W,height:E,enableHover:z,showGrid:$,title:Y,description:G,summary:X,accessibleTable:V,xLabel:q,yLabel:U}=l,K=a||[],{safeData:Q,orderMap:Z}=t.useMemo(()=>{const e="function"==typeof f?f:e=>e[f],t="function"==typeof g?g:e=>e[g];let n=K;if(p&&K.length>0){const e="function"==typeof p?p:e=>e[p];n=[...K].sort((t,n)=>{const o=e(t),i=e(n);return(o instanceof Date?o.getTime():+o)-(i instanceof Date?i.getTime():+i)})}const o=new WeakMap;let i=0;for(const o of n){const n=e(o),s=t(o);null!=n&&null!=s&&isFinite(n)&&isFinite(s)&&i++}let s=0;for(const r of n){const n=e(r),l=t(r);null!=n&&null!=l&&isFinite(n)&&isFinite(l)&&o.set(r,{idx:s++,total:i})}return{safeData:n,orderMap:o}},[K,p,f,g]);hs("ConnectedScatterplot",Q,"xAccessor",f),hs("ConnectedScatterplot",Q,"yAccessor",g);const J=ms({data:Q,rawData:a,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:M,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:_,onClick:P,hoverHighlight:L,chartType:"ConnectedScatterplot",chartId:N,showLegend:void 0,userMargin:c,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:F,loadingContent:B,emptyContent:R,width:W,height:E}),ee=null!==(s=null===(i=J.resolvedSelection)||void 0===i?void 0:i.unselectedOpacity)&&void 0!==s?s:.5,te=t.useMemo(()=>(e,t)=>{var n,o,i,s;const r=t.filter(e=>"point"===e.type);if(2>r.length)return;const l=null===(n=J.effectiveSelectionHook)||void 0===n?void 0:n.isActive,a=null===(o=J.effectiveSelectionHook)||void 0===o?void 0:o.predicate,c=100>r.length,u=r.length;e.lineCap="round";for(let t=0;u-1>t;t++){const n=r[t],o=r[t+1],d=zs(t,u),h=!l||!a||a(null!==(i=n.datum)&&void 0!==i?i:n)||a(null!==(s=o.datum)&&void 0!==s?s:o),f=l?h?1:ee:1;c&&(e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle="white",e.lineWidth=m+2,e.globalAlpha=.5*f,e.stroke()),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(o.x,o.y),e.strokeStyle=d,e.lineWidth=m,e.globalAlpha=f,e.stroke()}e.globalAlpha=1},[m,J.effectiveSelectionHook,ee]),ne=t.useMemo(()=>[te],[te]),oe=t.useMemo(()=>(t,n,o)=>{var i,s;const r=t.filter(e=>"point"===e.type);if(2>r.length)return null;const l=r.length,a=100>l,c=[];for(let t=0;l-1>t;t++){const n=r[t],o=r[t+1],u=zs(t,l),d="number"==typeof(null===(i=n.style)||void 0===i?void 0:i.opacity)?n.style.opacity:1,h="number"==typeof(null===(s=o.style)||void 0===s?void 0:s.opacity)?o.style.opacity:1,f=Math.min(d,h);a&&c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:"white",strokeWidth:m+2,strokeLinecap:"round",opacity:.5*f},"halo-"+t)),c.push(e.jsx("line",{x1:n.x,y1:n.y,x2:o.x,y2:o.y,stroke:u,strokeWidth:m,strokeLinecap:"round",opacity:f},"seg-"+t))}return e.jsx(e.Fragment,{children:c})},[m]),ie=t.useMemo(()=>[oe],[oe]),se=t.useMemo(()=>e=>{var t,n;const o=Z.get(e),i=null!==(t=null==o?void 0:o.idx)&&void 0!==t?t:0,s=null!==(n=null==o?void 0:o.total)&&void 0!==n?n:1;return{fill:s>0?zs(i,s):"#6366f1",stroke:"white",strokeWidth:1,r:m,fillOpacity:1}},[m,Z]),re=Is({colorScale:void 0,baseStyleExtras:se,stroke:H,strokeWidth:I,opacity:D,effectiveSelectionHook:J.effectiveSelectionHook,resolvedSelection:J.resolvedSelection}),le=y||("string"==typeof p?p:"Order"),ae=t.useMemo(()=>ns([{label:q||Qi(f),accessor:f,role:"x",format:d},{label:U||Qi(g),accessor:g,role:"y",format:h},...p?[{label:le,accessor:p,role:"group"}]:[]]),[f,g,q,U,p,le,d,h]),ce=ps({componentName:"ConnectedScatterplot",data:a,accessors:{xAccessor:f,yAccessor:g}}),{effectiveData:ue,statisticalAnnotations:de}=Ms({data:Q,xAccessor:f,yAccessor:g,forecast:w,anomaly:j});if(J.earlyReturn)return J.earlyReturn;const he=Ws(k),fe=he||de.length>0?[...he?[he]:[],...x||[],...de]:x,ge=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=a&&{data:ue}),{xAccessor:f,yAccessor:g,pointStyle:re,size:[W,E],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:J.margin,showAxes:l.showAxes,xLabel:q,yLabel:U,xFormat:d,yFormat:h,enableHover:z,showGrid:$}),_s({title:Y,description:G,summary:X,accessibleTable:V,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),Ls({tooltip:v,defaultTooltipContent:ae})),Ps({linkedHover:C,onObservation:_,onClick:P,hoverHighlight:L,customHoverBehavior:J.customHoverBehavior,customClickBehavior:J.customClickBehavior})),b&&{pointIdAccessor:b}),{canvasPreRenderers:ne,svgPreRenderers:ie}),fe&&fe.length>0&&{annotations:fe}),A&&{xExtent:A}),O&&{yExtent:O}),J.crosshairProps),S);return ce?e.jsx(os,{componentName:"ConnectedScatterplot",message:ce,width:W,height:E}):e.jsx(ls,{componentName:"ConnectedScatterplot",width:W,height:E,children:e.jsx(di,Object.assign({ref:r},ge))})});$s.displayName="ConnectedScatterplot";const Ys=t.forwardRef(function(n,o){const i=t.useRef(null),s=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",sizeBy:f,sizeRange:g=[5,40],colorBy:p,colorScheme:y,bubbleOpacity:m=.6,bubbleStrokeWidth:b=1,bubbleStrokeColor:x="white",tooltip:k,marginalGraphics:w,pointIdAccessor:j,annotations:A,regression:O,xExtent:S,yExtent:M,frameProps:C={},selection:_,linkedHover:P,linkedBrush:L,onObservation:N,onClick:F,hoverHighlight:B,chartId:R,loading:T,loadingContent:H,emptyContent:I,legendInteraction:D,legendPosition:W,color:E,stroke:z,strokeWidth:$,opacity:Y}=n,{width:G,height:X,enableHover:V,showGrid:q,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,ne=t.useMemo(()=>v(r),[r]),oe=void 0===r,ie=ms({data:ne,rawData:r,colorBy:p,colorScheme:y,legendInteraction:D,legendPosition:W,selection:_,linkedHover:P,fallbackFields:p?["string"==typeof p?p:""]:[],unwrapData:!1,onObservation:N,onClick:F,hoverHighlight:B,chartType:"BubbleChart",chartId:R,showLegend:U,userMargin:l,marginDefaults:s.marginDefaults,loading:T,loadingContent:H,emptyContent:I,width:G,height:X}),{domain:se,trackPushed:re,reset:le}=Ds({accessor:f,data:ne,isPushMode:oe}),ae=t.useCallback(e=>{var t;re([e]),null===(t=i.current)||void 0===t||t.push(e)},[re]),ce=t.useCallback(e=>{var t;re(e),null===(t=i.current)||void 0===t||t.pushMany(e)},[re]);xs(o,{variant:"xy",frameRef:i,overrides:{push:ae,pushMany:ce,clear:()=>{var e;le(),null===(e=i.current)||void 0===e||e.clear()}},deps:[ae,ce,le]});const ue=Ri(L);Oi({name:(null==ue?void 0:ue.name)||"__unused_brush__",xField:(null==ue?void 0:ue.xField)||("string"==typeof d?d:void 0),yField:(null==ue?void 0:ue.yField)||("string"==typeof h?h:void 0)});const de=t.useMemo(()=>({stroke:x,strokeWidth:b}),[x,b]),he=t.useMemo(()=>null!=se?se:[0,1],[se]),fe=t.useCallback(e=>pe(e,f,g,he),[f,g,he]),ge=Is({colorBy:p,colorScale:ie.colorScale,color:E,fillOpacity:m,radiusFn:fe,baseStyleExtras:de,stroke:z,strokeWidth:$,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),ye=t.useMemo(()=>ns([{label:ee||Qi(d),accessor:d,role:"x",format:c},{label:te||Qi(h),accessor:h,role:"y",format:u},{label:Qi(f),accessor:f,role:"size"},...p?[{label:Qi(p),accessor:p,role:"color"}]:[]]),[d,h,ee,te,f,p,c,u]);if(ie.earlyReturn)return ie.earlyReturn;const me=ps({componentName:"BubbleChart",data:r,accessors:{xAccessor:d,yAccessor:h},requiredProps:{sizeBy:f}});if(me)return e.jsx(os,{componentName:"BubbleChart",message:me,width:G,height:X});const ve=Ws(O),be=ve?[ve,...A||[]]:A,xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"bubble"},null!=r&&{data:ne}),{xAccessor:d,yAccessor:h,colorAccessor:p||void 0,sizeAccessor:f,sizeRange:g,pointStyle:ge,colorScheme:y,size:[G,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:V,showGrid:q}),ie.legendBehaviorProps),_s({title:K,description:Q,summary:Z,accessibleTable:J,className:a,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),Ls({tooltip:k,defaultTooltipContent:ye})),Ps({linkedHover:P,onObservation:N,onClick:F,hoverHighlight:B,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior})),w&&{marginalGraphics:w}),j&&{pointIdAccessor:j}),be&&be.length>0&&{annotations:be}),S&&{xExtent:S}),M&&{yExtent:M}),ie.crosshairProps),C);return e.jsx(ls,{componentName:"BubbleChart",width:G,height:X,children:e.jsx(di,Object.assign({ref:i},xe))})});Ys.displayName="BubbleChart";const Gs=t.forwardRef(function(n,o){var s;const r=t.useRef(null);xs(o,{variant:"xy",frameRef:r});const l=Ui(n.mode,{width:n.width,height:n.height,showGrid:void 0,enableHover:n.enableHover,showLegend:void 0,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:a,margin:c,className:u,xAccessor:d="x",yAccessor:h="y",valueAccessor:f="value",xFormat:g,yFormat:p,colorScheme:y,customColorScale:m,showValues:b=!1,valueFormat:x,tooltip:k,annotations:w,xExtent:j,yExtent:A,frameProps:O={},selection:S,linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,chartId:L,loading:N,loadingContent:F,emptyContent:B,showLegend:R,legendPosition:T,legendInteraction:H}=n,{width:I,height:D,enableHover:W,title:E,description:z,summary:$,accessibleTable:Y,xLabel:G,yLabel:X}=l,V=ds(N,I,D,F),q=V?null:us(a,I,D,B),U=t.useMemo(()=>v(a),[a]),K=function(){var e;const t=Hi();return(null===(e=null==t?void 0:t.colors)||void 0===e?void 0:e.sequential)||void 0}(),Q=null!==(s=null!=y?y:K)&&void 0!==s?s:"blues",Z=null!=R&&R,J=null!=T?T:"right",{margin:ee}=Xi({data:U,colorBy:Z?"value":void 0,colorScale:void 0,showLegend:Z,legendPosition:J,userMargin:c,defaults:l.marginDefaults}),{customHoverBehavior:te,customClickBehavior:ne,crosshairSourceId:oe}=Yi({selection:S,linkedHover:M,fallbackFields:[],onObservation:C,onClick:_,chartType:"Heatmap",chartId:L,hoverHighlight:P,colorByField:void 0});ys(S);const ie=Gi(M,oe);Vi(H,void 0,[]);const se=t.useMemo(()=>"function"==typeof f?e=>f(e):e=>e[f],[f]),re=t.useMemo(()=>Bt(U.map(se)),[U,se]),le=t.useMemo(()=>{if("custom"===Q&&m)return m;const e=ae(Q);return i.scaleSequential(e).domain(re)},[Q,m,re]),ce=t.useMemo(()=>ns([{label:G||Qi(d),accessor:d,role:"x",format:g},{label:X||Qi(h),accessor:h,role:"y",format:p},{label:Qi(f),accessor:f,role:"value",format:x}]),[d,h,G,X,f,g,p,x]),ue=ps({componentName:"Heatmap",data:a,accessors:{xAccessor:d,yAccessor:h,valueAccessor:f}}),de=t.useMemo(()=>{if(Z)return{gradient:{colorFn:e=>le(e),domain:re,label:"string"==typeof f?f:"value",format:x}}},[Z,le,re,f,x]),he=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"heatmap"},null!=a&&{data:U}),{xAccessor:d,yAccessor:h,valueAccessor:f,colorScheme:"custom"!==Q?Q:void 0,showValues:b,heatmapValueFormat:x,size:[I,D],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ee,showAxes:l.showAxes,xLabel:G,yLabel:X,xFormat:g,yFormat:p,enableHover:W}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),de&&{legend:de,legendPosition:J}),_s({title:E,description:z,summary:$,accessibleTable:Y,className:u,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),Ls({tooltip:k,defaultTooltipContent:ce})),Ps({linkedHover:M,onObservation:C,onClick:_,hoverHighlight:P,customHoverBehavior:te,customClickBehavior:ne})),w&&w.length>0&&{annotations:w}),j&&{xExtent:j}),A&&{yExtent:A}),ie),O);return V||q||(ue?e.jsx(os,{componentName:"Heatmap",message:ue,width:I,height:D}):e.jsx(ls,{componentName:"Heatmap",width:I,height:D,children:e.jsx(di,Object.assign({ref:r},he))}))});Gs.displayName="Heatmap";const Xs="__splomIdx",Vs={top:4,bottom:4,left:4,right:4};function qs({frameRef:i,cellSize:s,onBrush:r}){const l=t.useRef(null),a=s-Vs.left-Vs.right,c=s-Vs.top-Vs.bottom;return t.useEffect(()=>{if(!l.current)return;const e=n.select(l.current).select(".brush-g"),t=o.brush().extent([[0,0],[a,c]]).on("brush end",e=>{var t;const n=null===(t=i.current)||void 0===t?void 0:t.getScales();if(!n)return;if(!e.selection)return void r(null);const[[o,s],[l,a]]=e.selection,c=[[n.x.invert(o),n.y.invert(s)],[n.x.invert(l),n.y.invert(a)]];r(c)});return e.call(t),e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[a,c,i,r]),e.jsx("svg",{ref:l,width:s,height:s,style:{position:"absolute",top:0,left:0},children:e.jsx("g",{className:"brush-g",transform:`translate(${Vs.left},${Vs.top})`})})}function Us({data:n,xField:o,yField:i,cellSize:s,pointRadius:r,pointOpacity:l,colorBy:a,colorScale:c,brushSelectionName:u,hoverSelectionName:d,unselectedOpacity:h,mode:f,onPointHover:g}){const p=t.useRef(null),y=wi({name:u,clientId:`splom-${o}-${i}`}),m=Oi({name:u,xField:o,yField:i}),v=wi({name:d,clientId:"splom-hover-source"}),b=v.selectPoints,x=t.useCallback(e=>{e?m.brushInteraction.during(e):m.brushInteraction.end(null)},[m.brushInteraction]),k=t.useCallback(e=>{if(!e)return void(null==g||g(null));const t=e.data,n=null==t?void 0:t[Xs];void 0!==n&&(b({[Xs]:[n]}),null==g||g(t,e.x+Vs.left,e.y+Vs.top))},[b,g]),w=t.useCallback(e=>{const t={opacity:l,r:r};return t.fill=a?fe(e,a,c):Ii,"hover"===f?v.isActive&&v.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):v.isActive&&(t.opacity=.6*l):y.isActive&&!y.predicate(e)&&(t.opacity=h),t},[a,c,l,r,f,y.isActive,y.predicate,v.isActive,v.predicate,h]);return e.jsxs("div",{style:{position:"relative",width:s,height:s},children:[e.jsx(di,{ref:p,chartType:"scatter",data:n,size:[s,s],xAccessor:o,yAccessor:i,pointStyle:w,margin:Vs,showAxes:!1,enableHover:"hover"===f,customHoverBehavior:"hover"===f?k:void 0,tooltipContent:"hover"===f?()=>null:void 0}),"brush"===f&&e.jsx(qs,{frameRef:p,cellSize:s,xField:o,yField:i,onBrush:x})]})}function Ks({data:n,field:o,label:i,cellSize:s,bins:r,colorBy:l,colorScale:a,brushSelectionName:c,hoverSelectionName:u,mode:d}){const h=wi({name:c,clientId:"splom-diag-"+o}),f=wi({name:u,clientId:`splom-diag-${o}-hover`}),g="hover"===d?f:h,p=g.isActive,y=g.predicate,m=t.useMemo(()=>{const e="string"==typeof l?l:null,t=[],i=new Set;for(const s of n){const n=s[o];if(null==n||isNaN(n)||t.push(Number(n)),e){const t=s[e];null!=t&&i.add(t+"")}}if(0===t.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[a,c]=Bt(t),u=(c-a)/r||1,d=Array.from(i),h=new Map(d.map((e,t)=>[e,t])),f=Array(r).fill(0),g=Array(r).fill(0),m=Array.from({length:r},()=>Array(d.length).fill(0)),v=Array.from({length:r},()=>Array(d.length).fill(0));for(const t of n){const n=t[o];if(null==n||isNaN(n))continue;const i=Math.min(Math.floor((n-a)/u),r-1);if(f[i]++,p&&!y(t)||g[i]++,e){const n=h.get(t[e]+"");void 0!==n&&(m[i][n]++,p&&!y(t)||v[i][n]++)}}const b=Rt(f,1),x=m.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(s-24),l={x:t/r*s,w:s/r-1,h:i,y0:n,category:d[o]};return n+=i,l})}),k=v.map((e,t)=>{let n=0;return e.map((e,o)=>{const i=e/b*(s-24),l={x:t/r*s,w:s/r-1,h:i,y0:n,category:d[o]};return n+=i,l})});return{bars:f.map((e,t)=>({x:t/r*s,w:s/r-1,h:e/b*(s-24),count:e})),selectedBars:g.map((e,t)=>({x:t/r*s,w:s/r-1,h:e/b*(s-24),count:e})),categoryBars:x,selectedCategoryBars:k,max:b,categories:d}},[n,o,r,s,p,y,l]);return e.jsxs("svg",{width:s,height:s,style:{overflow:"hidden"},children:[e.jsx("text",{x:s/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:i}),m.categories.length>0?m.categoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):Ii,opacity:p?.3:.6},`bg-${n}-${o}`))):m.bars.map((t,n)=>e.jsx("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:Ii,opacity:p?.3:.6},"bg-"+n)),p&&(m.categories.length>0?m.selectedCategoryBars.map((t,n)=>t.map((t,o)=>e.jsx("rect",{x:t.x,y:s-t.y0-t.h,width:Math.max(t.w,1),height:t.h,fill:a?a(t.category):Ii,opacity:.7},`sel-${n}-${o}`))):m.selectedBars.map((t,n)=>e.jsx("rect",{x:t.x,y:s-t.h,width:Math.max(t.w,1),height:t.h,fill:Ii,opacity:.7},"sel-"+n)))]})}function Qs({label:t,cellSize:n}){return e.jsx("svg",{width:n,height:n,children:e.jsx("text",{x:n/2,y:n/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:t})})}function Zs(n){const{data:o,fields:i,fieldLabels:s={},colorBy:r,colorScheme:l,cellSize:a=150,cellGap:c=4,pointRadius:u=2,pointOpacity:d=.5,diagonal:f="histogram",histogramBins:g=20,brushMode:p="crossfilter",hoverMode:y=!0,unselectedOpacity:m=.1,showGrid:v=!1,tooltip:b,showLegend:x,idAccessor:k,className:w,onObservation:j,chartId:A}=n,O="splom",S="splom-hover",M=y?"hover":p?"brush":"hover",C=bi(e=>e.clearSelection),[_,P]=t.useState(null),L=t.useCallback(()=>{C(S),P(null)},[C,S]),N=t.useMemo(()=>(o||[]).map((e,t)=>void 0!==e[Xs]?e:Object.assign(Object.assign({},e),{[Xs]:t})),[o]),F=$i(N,r,l),B=void 0!==x?x:!!r,R=t.useMemo(()=>{if(!B||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(N.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:F?F(e+""):Ii})):null},[B,r,N,F]),T=t.useMemo(()=>({display:"grid",gridTemplateColumns:"40px "+i.map(()=>a+"px").join(" "),gridTemplateRows:i.map(()=>a+"px").join(" ")+" 40px",gap:c+"px",width:"fit-content"}),[i,a,c,40]);return e.jsxs("div",{className:w,style:{position:"relative"},children:[R&&e.jsx("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:R.map(t=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[e.jsx("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:t.color}}),e.jsx("span",{style:{fontSize:11},children:t.label})]},t.label))}),e.jsxs("div",{style:T,onMouseLeave:"hover"===M?L:void 0,children:[i.map((t,n)=>e.jsxs(h.Fragment,{children:[e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:s[t]||t}),i.map((o,i)=>n===i?"label"===f?e.jsx(Qs,{label:s[t]||t,cellSize:a},"diag-"+t):e.jsx(Ks,{data:N,field:t,label:s[t]||t,cellSize:a,bins:g,colorBy:r,colorScale:F,brushSelectionName:O,hoverSelectionName:S,unselectedOpacity:m,mode:M},"diag-"+t):e.jsx(Us,{data:N,xField:o,yField:t,fieldLabels:s,cellSize:a,pointRadius:u,pointOpacity:d,colorBy:r,colorScale:F,brushSelectionName:O,hoverSelectionName:S,unselectedOpacity:m,showGrid:v,tooltip:b,mode:M,onPointHover:"hover"===M?(e,s,r)=>{e?(P({datum:e,xField:o,yField:t,colIndex:i,rowIndex:n,px:null!=s?s:0,py:null!=r?r:0}),j&&j({type:"hover",datum:e,x:null!=s?s:0,y:null!=r?r:0,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})):(P(null),j&&j({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A}))}:void 0},`cell-${t}-${o}`))]},"row-"+t)),e.jsx("div",{})," ",i.map(t=>e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:s[t]||t},"col-label-"+t))]}),_&&"hover"===M&&(()=>{const t=_.datum,n=s[_.xField]||_.xField,o=s[_.yField]||_.yField,i=r?"function"==typeof r?r(t):t[r]:null,l=k?"function"==typeof k?k(t):t[k]:"Row "+t[Xs];return e.jsxs("div",{style:{position:"absolute",left:40+_.colIndex*(a+c)+_.px,top:_.rowIndex*(a+c)+_.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[e.jsx("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),e.jsxs("div",{children:[n,": ",null!=t[_.xField]?Number(t[_.xField]).toFixed(1):"–"]}),e.jsxs("div",{children:[o,": ",null!=t[_.yField]?Number(t[_.yField]).toFixed(1):"–"]}),null!=i&&e.jsxs("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function Js(t){const{brushMode:n="crossfilter",hoverMode:o=!0}=t,i={};return!o&&n&&(i.splom={resolution:n}),o&&(i["splom-hover"]={resolution:"union"}),e.jsx(Bi,{selections:i,children:e.jsx(Zs,Object.assign({},t))})}function er({width:i,height:s,margin:r,scales:l,brushDirection:a,extent:c,onBrush:u}){const d=t.useRef(null),h=t.useRef(null),f=t.useRef(!1),g=i+r.left+r.right,p=s+r.top+r.bottom;return t.useEffect(()=>{if(!d.current||!l)return;const e=n.select(d.current).select(".brush-group"),t="x"===a?o.brushX().extent([[0,0],[i,s]]):o.brushY().extent([[0,0],[i,s]]);return t.on("brush end",e=>{if(f.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void u(null);const n=("x"===a?l.x:l.y).invert;if(!n)return;const o=[n(t[0]),n(t[1])];u(o)}),e.call(t),h.current=t,e.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{t.on("brush end",null)}},[l,i,s,a,u]),t.useEffect(()=>{if(!h.current||!l||!d.current)return;const e=n.select(d.current).select(".brush-group"),t="x"===a?l.x:l.y;if(f.current=!0,c){const n=[t(c[0]),t(c[1])];e.call(h.current.move,n)}else e.call(h.current.move,null);f.current=!1},[c,l,a]),e.jsx("svg",{ref:d,width:g,height:p,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:e.jsx("g",{className:"brush-group",transform:`translate(${r.left},${r.top})`})})}function tr(n){var o,i;const{data:s,width:r=600,height:l=400,margin:a,className:c,title:u,description:d,summary:h,xLabel:f,yLabel:g,xFormat:p,yFormat:y,xAccessor:m="x",yAccessor:b="y",lineBy:x,lineDataAccessor:k="coordinates",colorBy:w,colorScheme:j,curve:A="linear",lineWidth:O=2,fillArea:S=!1,areaOpacity:M=.3,showPoints:C=!1,pointRadius:_=3,enableHover:P=!0,showGrid:L=!1,showLegend:N,legendPosition:F,tooltip:B,minimap:R={},renderBefore:T=!1,onBrush:H,brushExtent:I,yExtent:D,frameProps:W={},loading:E,loadingContent:z,emptyContent:$}=n,Y=ds(E,r,l,z),G=Y?null:us(s,r,l,$),X=t.useMemo(()=>v(s),[s]),[V,q]=t.useState(null),U=null!=I?I:V,K=t.useCallback(e=>{I||q(e),null==H||H(e)},[I,H]),Q=t.useRef(null),[Z,J]=t.useState(null);t.useEffect(()=>{let e=0,t=!1;const n=()=>{var o,i;if(t)return;const s=null===(i=null===(o=Q.current)||void 0===o?void 0:o.getScales)||void 0===i?void 0:i.call(o);s?J(s):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[s]);const ee=void 0!==(null===(o=X[0])||void 0===o?void 0:o[k]),te=t.useMemo(()=>{if(ee)return X;if(x){const e=X.reduce((e,t)=>{const n="function"==typeof x?x(t):t[x];if(!e[n]){const t={[k]:[]};"string"==typeof x&&(t[x]=n),e[n]=t}return e[n][k].push(t),e},{});return Object.values(e)}return[{[k]:X}]},[X,x,k,ee]),ne=t.useMemo(()=>ee||x?te.flatMap(e=>{const t=e[k]||[];return x&&"string"==typeof x?t.map(t=>Object.assign(Object.assign({},t),{[x]:e[x]})):t}):X,[te,k,ee,x,X]),oe=$i(X,w,j),ie=bs({lineWidth:O,colorBy:w,colorScale:oe,fillArea:S,areaOpacity:M}),se=t.useMemo(()=>{if(R.lineStyle)return R.lineStyle},[R.lineStyle]),re=bs({lineWidth:1,colorBy:w,colorScale:oe}),le=null!=se?se:re,ae=t.useMemo(()=>{if(C)return e=>{const t={r:_,fillOpacity:1};return t.fill=w?fe(e.parentLine||e,w,oe):Ii,t}},[C,_,w,oe]),{legend:ce,margin:ue,legendPosition:de}=Xi({data:te,colorBy:w,colorScale:oe,showLegend:N,legendPosition:F,userMargin:a}),he=R.height||60,ge=t.useMemo(()=>{var e,t,n,o,i,s,r,l;return{top:null!==(t=null===(e=R.margin)||void 0===e?void 0:e.top)&&void 0!==t?t:0,bottom:null!==(o=null===(n=R.margin)||void 0===n?void 0:n.bottom)&&void 0!==o?o:20,left:null!==(s=null===(i=R.margin)||void 0===i?void 0:i.left)&&void 0!==s?s:ue.left,right:null!==(l=null===(r=R.margin)||void 0===r?void 0:r.right)&&void 0!==l?l:ue.right}},[R.margin,ue]),pe=R.brushDirection||"x",ye=t.useMemo(()=>ns([{label:f||Qi(m),accessor:m,role:"x",format:p},{label:g||Qi(b),accessor:b,role:"y",format:y}]),[m,b,f,g,p,y]),me=ps({componentName:"MinimapChart",data:s,accessors:{xAccessor:m,yAccessor:b}});if(me)return e.jsx(os,{componentName:"MinimapChart",message:me,width:r,height:l});const ve=S?"area":"line",be=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:ve,data:ne,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:ie},C&&{pointStyle:ae}),{size:[r,l],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ue,showAxes:!0,xLabel:f,yLabel:g,xFormat:p,yFormat:y,enableHover:P,showGrid:L}),ce&&{legend:ce,legendPosition:de}),u&&{title:u}),d&&{description:d}),h&&{summary:h}),{tooltipContent:!1===B?()=>null:Co(B)||ye}),U&&{xExtent:U}),D&&{yExtent:D}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),W),xe=Object.assign({chartType:ve,data:ne,xAccessor:m,yAccessor:b,groupAccessor:x||void 0,curve:A,lineStyle:le,size:[r,he+ge.top+ge.bottom],margin:ge,showAxes:null!==(i=R.showAxes)&&void 0!==i&&i,background:R.background,enableHover:!1},D&&{yExtent:D}),ke=e.jsxs("div",{style:{position:"relative",width:r,overflow:"hidden"},children:[e.jsx(di,Object.assign({ref:Q},xe)),e.jsx(er,{width:r-ge.left-ge.right,height:he,margin:ge,scales:Z,brushDirection:pe,extent:U,onBrush:K})]},"minimap"),we=e.jsx("div",{style:{overflow:"hidden"},children:e.jsx(di,Object.assign({},be))},"main");return Y||G||e.jsx(ls,{componentName:"MinimapChart",width:r,height:l,children:e.jsxs("div",{className:"minimap-chart"+(c?" "+c:""),children:[T?ke:we,T?we:ke]})})}Js.displayName="ScatterplotMatrix",tr.displayName="MinimapChart";const nr={label:"Low / High",color:"#E9C46A",opacity:.08},or={label:"High / High",color:"#2A9D8F",opacity:.08},ir={label:"Low / Low",color:"#E76F51",opacity:.08},sr={label:"High / Low",color:"#86BBD8",opacity:.08};function rr(e,t){var n,o,i;return{label:null!==(n=null==t?void 0:t.label)&&void 0!==n?n:e.label,color:null!==(o=null==t?void 0:t.color)&&void 0!==o?o:e.color,opacity:null!==(i=null==t?void 0:t.opacity)&&void 0!==i?i:e.opacity}}const lr=t.forwardRef(function(n,o){const i=t.useRef(null);xs(o,{variant:"xy",frameRef:i});const s=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:d="x",yAccessor:h="y",xCenter:f,yCenter:g,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:b=12,colorBy:x,colorScheme:k,sizeBy:w,sizeRange:j=[3,15],pointRadius:A=5,pointOpacity:O=.8,tooltip:S,pointIdAccessor:M,annotations:C,frameProps:_={},selection:P,linkedHover:L,onObservation:N,onClick:F,hoverHighlight:B,chartId:R,loading:T,loadingContent:H,emptyContent:I,legendInteraction:D,legendPosition:W,color:E,stroke:z,strokeWidth:$,opacity:Y}=n,{width:G,height:X,enableHover:V,showGrid:q,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=s,ne=t.useMemo(()=>({topLeft:rr(nr,null==p?void 0:p.topLeft),topRight:rr(or,null==p?void 0:p.topRight),bottomLeft:rr(ir,null==p?void 0:p.bottomLeft),bottomRight:rr(sr,null==p?void 0:p.bottomRight)}),[p]),oe=t.useMemo(()=>v(r),[r]),ie=ms({data:oe,rawData:r,colorBy:x,colorScheme:k,legendInteraction:D,legendPosition:W,selection:P,linkedHover:L,fallbackFields:"string"==typeof x?[x]:[],unwrapData:!1,onObservation:N,onClick:F,hoverHighlight:B,chartType:"QuadrantChart",chartId:R,showLegend:U,userMargin:l,marginDefaults:s.marginDefaults,loading:T,loadingContent:H,emptyContent:I,width:G,height:X});hs("QuadrantChart",oe,"xAccessor",d),hs("QuadrantChart",oe,"yAccessor",h);const se=t.useMemo(()=>{if(!oe.length)return;const e="function"==typeof d?d:e=>+e[d],t="function"==typeof h?h:e=>+e[h];let n=1/0,o=-1/0,i=1/0,s=-1/0;for(const r of oe){const l=e(r),a=t(r);isFinite(l)&&(n>l&&(n=l),l>o&&(o=l)),isFinite(a)&&(i>a&&(i=a),a>s&&(s=a))}if(null!=f&&isFinite(f)&&(n>f&&(n=f),f>o&&(o=f)),null!=g&&isFinite(g)&&(i>g&&(i=g),g>s&&(s=g)),n===1/0)return;const r=.1*(o-n)||1,l=.1*(s-i)||1;return{xExtent:[n-r,o+r],yExtent:[i-l,s+l]}},[oe,d,h,f,g]),re=t.useMemo(()=>{if(!w||0===oe.length)return;const e=oe.map(e=>"function"==typeof w?w(e):e[w]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?Bt(e):void 0},[oe,w]),le=t.useMemo(()=>"function"==typeof d?d:e=>+e[d],[d]),ae=t.useMemo(()=>"function"==typeof h?h:e=>+e[h],[h]),ce=t.useMemo(()=>e=>{const t=le(e),n=ae(e),o=null!=f?t>=f:void 0,i=null!=g?n>=g:void 0;return void 0===i||void 0===o?E||Ii:i&&o?ne.topRight.color:i&&!o?ne.topLeft.color:!i&&o?ne.bottomRight.color:ne.bottomLeft.color},[le,ae,f,g,ne,E]),ue=t.useMemo(()=>w?e=>pe(e,w,j,re):void 0,[w,j,re]),de=Is({colorBy:x,colorScale:ie.colorScale,color:E,pointRadius:A,fillOpacity:O,radiusFn:ue,fallbackFill:ce,stroke:z,strokeWidth:$,opacity:Y,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection}),he=t.useMemo(()=>{if(!oe.length)return;const e=new Set;"string"==typeof d&&e.add(d),"string"==typeof h&&e.add(h),"string"==typeof x&&e.add(x),"string"==typeof w&&e.add(w);const t=oe[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[oe,d,h,x,w]),fe=t.useMemo(()=>ns([...he?[{label:he,accessor:he,role:"title"}]:[],{label:ee||Qi(d),accessor:d,role:"x",format:c},{label:te||Qi(h),accessor:h,role:"y",format:u},...x?[{label:Qi(x),accessor:x,role:"color"}]:[],...w?[{label:Qi(w),accessor:w,role:"size"}]:[]]),[he,d,h,ee,te,x,w,c,u]),ge=ps({componentName:"QuadrantChart",data:r,accessors:{xAccessor:d,yAccessor:h}}),ye=t.useMemo(()=>{var e;const t={stroke:y.stroke||"#999",strokeWidth:null!==(e=y.strokeWidth)&&void 0!==e?e:1,dashArray:y.strokeDasharray||[]};return[(e,n,o,i)=>{var s;if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return;const r=i.width,l=i.height,a=null!=f?o.x(f):r/2,c=null!=g?o.y(g):l/2;if(null!=f&&!isFinite(a))return;if(null!=g&&!isFinite(c))return;const u=Math.max(0,Math.min(r,a)),d=Math.max(0,Math.min(l,c)),h=[{config:ne.topLeft,x:0,y:0,w:u,h:d},{config:ne.topRight,x:u,y:0,w:r-u,h:d},{config:ne.bottomLeft,x:0,y:d,w:u,h:l-d},{config:ne.bottomRight,x:u,y:d,w:r-u,h:l-d}];for(const t of h)t.w>0&&t.h>0&&(e.fillStyle=t.config.color,e.globalAlpha=null!==(s=t.config.opacity)&&void 0!==s?s:.08,e.fillRect(t.x,t.y,t.w,t.h));e.globalAlpha=1,e.strokeStyle=t.stroke,e.lineWidth=t.strokeWidth,t.dashArray.length>0&&e.setLineDash(t.dashArray),e.beginPath(),e.moveTo(u,0),e.lineTo(u,l),e.stroke(),e.beginPath(),e.moveTo(0,d),e.lineTo(r,d),e.stroke(),e.setLineDash([])}]},[f,g,ne,y]),me=t.useMemo(()=>m?[...ye,(e,t,n,o)=>{if(!(null==n?void 0:n.x)||!(null==n?void 0:n.y))return;const i=o.width,s=o.height,r=null!=f?n.x(f):i/2,l=null!=g?n.y(g):s/2;(null==f||isFinite(r))&&(null==g||isFinite(l))&&(e.font=`600 ${b}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ne.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ne.topLeft.label,8,8),e.fillStyle=ne.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ne.topRight.label,i-8,8),e.fillStyle=ne.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ne.bottomLeft.label,8,s-8),e.fillStyle=ne.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ne.bottomRight.label,i-8,s-8),e.globalAlpha=1)}]:ye,[ye,m,b,ne,f,g]),ve=t.useMemo(()=>{const e=_.canvasPreRenderers||[];return[...me,...e]},[me,_.canvasPreRenderers]),be=t.useMemo(()=>{var t;const n={stroke:y.stroke||"#999",strokeWidth:null!==(t=y.strokeWidth)&&void 0!==t?t:1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,o,i)=>{if(!(null==o?void 0:o.x)||!(null==o?void 0:o.y))return null;const s=i.width,r=i.height,l=null!=f?o.x(f):s/2,a=null!=g?o.y(g):r/2;if(null!=f&&!isFinite(l))return null;if(null!=g&&!isFinite(a))return null;const c=Math.max(0,Math.min(s,l)),u=Math.max(0,Math.min(r,a));return e.jsxs(e.Fragment,{children:[[{config:ne.topLeft,x:0,y:0,w:c,h:u},{config:ne.topRight,x:c,y:0,w:s-c,h:u},{config:ne.bottomLeft,x:0,y:u,w:c,h:r-u},{config:ne.bottomRight,x:c,y:u,w:s-c,h:r-u}].map((t,n)=>{var o;return t.w>0&&t.h>0?e.jsx("rect",{x:t.x,y:t.y,width:t.w,height:t.h,fill:t.config.color,opacity:null!==(o=t.config.opacity)&&void 0!==o?o:.08},"qf-"+n):null}),e.jsx("line",{x1:c,y1:0,x2:c,y2:r,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),e.jsx("line",{x1:0,y1:u,x2:s,y2:u,stroke:n.stroke,strokeWidth:n.strokeWidth,strokeDasharray:n.dashArray}),m&&e.jsxs(e.Fragment,{children:[e.jsx("text",{x:8,y:8+b,fill:ne.topLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:ne.topLeft.label}),e.jsx("text",{x:s-8,y:8+b,fill:ne.topRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:ne.topRight.label}),e.jsx("text",{x:8,y:r-8,fill:ne.bottomLeft.color,fontWeight:600,fontSize:b,opacity:.5,children:ne.bottomLeft.label}),e.jsx("text",{x:s-8,y:r-8,fill:ne.bottomRight.color,fontWeight:600,fontSize:b,opacity:.5,textAnchor:"end",children:ne.bottomRight.label})]})]})}]},[f,g,ne,y,m,b]);if(ie.earlyReturn)return ie.earlyReturn;const xe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"scatter"},null!=r&&{data:oe}),{xAccessor:d,yAccessor:h,colorAccessor:x||void 0,sizeAccessor:w||void 0,sizeRange:j,pointStyle:de,colorScheme:k,size:[G,X],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:ie.margin,showAxes:s.showAxes,xLabel:ee,yLabel:te,xFormat:c,yFormat:u,enableHover:V,showGrid:q}),se&&{xExtent:se.xExtent,yExtent:se.yExtent}),ie.legendBehaviorProps),K&&{title:K}),Q&&{description:Q}),Z&&{summary:Z}),void 0!==J&&{accessibleTable:J}),a&&{className:a}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{tooltipContent:!1===S?()=>null:!0===S||void 0===S?fe:Co(S)||fe}),(L||N||F||B)&&{customHoverBehavior:ie.customHoverBehavior}),(N||F||L)&&{customClickBehavior:ie.customClickBehavior}),M&&{pointIdAccessor:M}),C&&C.length>0&&{annotations:C}),{canvasPreRenderers:ve}),ie.crosshairProps),_),ve.length>0&&{canvasPreRenderers:ve}),{svgPreRenderers:be});return ge?e.jsx(os,{componentName:"QuadrantChart",message:ge,width:G,height:X}):e.jsx(ls,{componentName:"QuadrantChart",width:G,height:X,children:e.jsx(di,Object.assign({ref:i},xe))})});lr.displayName="QuadrantChart";const ar="__ma_unitized",cr="__ma_series";function ur(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function dr(e,t){return t[0]+e*(t[1]-t[0])}const hr=t.forwardRef(function(n,o){var i;const s=t.useRef(null),r=t.useRef([]),l=t.useRef(n.series);l.current=n.series,t.useImperativeHandle(o,()=>{const e=()=>{var e;return(null!==(e=l.current)&&void 0!==e?e:[]).filter(e=>null!=e&&"object"==typeof e)};return{push:t=>{if(!s.current)return;const n=e(),o=t;for(let e=0;n.length>e&&2>e;e++){const t=n[e],i=t.extent||r.current[e];if(!i)continue;const l=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(o);null!=l&&isFinite(l)&&s.current.push(Object.assign(Object.assign({},o),{[ar]:ur(l,i),[cr]:t.label||"Series "+(e+1)}))}},pushMany:t=>{if(!s.current)return;const n=e(),o=[];for(const e of t)for(let t=0;n.length>t&&2>t;t++){const i=n[t],s=i.extent||r.current[t];if(!s)continue;const l=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(e);null!=l&&isFinite(l)&&o.push(Object.assign(Object.assign({},e),{[ar]:ur(l,s),[cr]:i.label||"Series "+(t+1)}))}s.current.pushMany(o)},remove:e=>{var t,n;return null!==(n=null===(t=s.current)||void 0===t?void 0:t.remove(e))&&void 0!==n?n:[]},update:(e,t)=>{var n,o;return null!==(o=null===(n=s.current)||void 0===n?void 0:n.update(e,t))&&void 0!==o?o:[]},clear:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.clear()},getData:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getData())&&void 0!==t?t:[]},getScales:()=>{var e,t;return null!==(t=null===(e=s.current)||void 0===e?void 0:e.getScales())&&void 0!==t?t:null}}},[]);const a=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,xLabel:n.xLabel,accessibleTable:n.accessibleTable},{width:800,height:400}),{data:c,margin:u,className:d,xFormat:f,xAccessor:g="x",series:p,colorScheme:y,curve:m="monotoneX",lineWidth:b=2,tooltip:x,annotations:k,frameProps:w={},selection:j,linkedHover:A,onObservation:O,onClick:S,hoverHighlight:M,chartId:C,loading:_,loadingContent:P,emptyContent:L,legendInteraction:N,legendPosition:F,stroke:B,strokeWidth:R,opacity:T}=n,{width:H,height:I,enableHover:D,showGrid:W,showLegend:E=!0,title:z,description:$,summary:Y,accessibleTable:G,xLabel:X}=a,V=t.useMemo(()=>v(c),[c]),q=t.useMemo(()=>v(p),[p]),U=q,K=2===q.length;"undefined"==typeof process||"production"===(null===(i=process.env)||void 0===i?void 0:i.NODE_ENV)||K||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${q.length}. Rendering as a standard multi-line chart.`);const Q=ds(_,H,I,P),Z=Q?null:us(c,H,I,L),J=zi(),ee=t.useMemo(()=>{let e;if(Array.isArray(y))e=y;else if(J&&J.length>0)e=J;else{const t=ce[y];e=Array.isArray(t)?t:ue}return U.map((t,n)=>t.color||e[n%e.length])},[U,y,J]),te=t.useMemo(()=>q.map((e,t)=>e.label||"Series "+(t+1)),[q]),{unitizedData:ne,extents:oe}=t.useMemo(()=>{if(0===V.length){const e=q.map(e=>e.extent||null).filter(Boolean);return e.length===q.length&&(r.current=e),{unitizedData:[],extents:e.length===q.length?e:[]}}const e=q.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const i="function"==typeof t?t:e=>e[t];for(const t of e){const e=i(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}(V,e.yAccessor));if(r.current=e,!K){const t=[];for(const e of V)for(let n=0;q.length>n;n++){const o=q[n],i=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=i&&t.push(Object.assign(Object.assign({},e),{[ar]:i,[cr]:te[n]}))}return{unitizedData:t,extents:e}}const t=[];for(const n of V)for(let o=0;2>o;o++){const i=q[o],s=("function"==typeof i.yAccessor?i.yAccessor:e=>e[i.yAccessor])(n);null!=s&&t.push(Object.assign(Object.assign({},n),{[ar]:ur(s,e[o]),[cr]:te[o]}))}return{unitizedData:t,extents:e}},[V,q,K,te]),ie=t.useMemo(()=>{if(K&&oe.length>=2)return[{orient:"left",label:te[0],tickFormat:q[0].format||(e=>{const t=dr(e,oe[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:te[1],tickFormat:q[1].format||(e=>{const t=dr(e,oe[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[K,oe,q,te]),se=ms({data:t.useMemo(()=>ne.length>0?ne:te.map(e=>({[cr]:e})),[ne,te]),rawData:c,colorBy:cr,colorScheme:ee,legendInteraction:N,legendPosition:F,selection:j,linkedHover:A,fallbackFields:[cr],unwrapData:!1,onObservation:O,onClick:S,hoverHighlight:M,chartType:"MultiAxisLineChart",chartId:C,showLegend:E,userMargin:u,marginDefaults:K?Object.assign(Object.assign({},a.marginDefaults),{left:70,right:70}):a.marginDefaults,loading:_,loadingContent:P,emptyContent:L,width:H,height:I}),re=t.useMemo(()=>{const e=new Map;return te.forEach((t,n)=>e.set(t,ee[n])),e},[te,ee]),le=bs({lineWidth:b,resolveStroke:t.useCallback(e=>re.get(e[cr])||ee[0],[re,ee]),stroke:B,strokeWidth:R,opacity:T,effectiveSelectionHook:se.effectiveSelectionHook,resolvedSelection:se.resolvedSelection}),ae=t.useMemo(()=>{if(!1===x)return()=>null;return Co(x)||(e=>{var t;const n=e.data||e,o=n[cr],i=te.indexOf(o),s=n[ar],r=K&&i>=0&&oe[i]?dr(s,oe[i]):s,l=i>=0&&(null===(t=q[i])||void 0===t?void 0:t.format)?q[i].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof g?g(n):n[g];return h.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},h.createElement("div",{style:{fontWeight:600,marginBottom:4,color:ee[i]||"inherit"}},o),h.createElement("div",null,`${"string"==typeof g?g:"x"}: ${a}`),h.createElement("div",null,`${o}: ${l(r)}`))})},[x,te,ee,oe,K,q,g]);if(se.earlyReturn)return se.earlyReturn;const de=ps({componentName:"MultiAxisLineChart",data:c,accessors:{xAccessor:g}}),he=K?[0,1]:void 0,fe=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"line"},null!=c&&{data:ne}),{xAccessor:g,yAccessor:ar,groupAccessor:cr,lineStyle:le,colorScheme:ee,size:[H,I],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:se.margin,showAxes:a.showAxes}),ie&&{axes:ie}),{xLabel:X}),K?{}:{yLabel:te[0]}),{xFormat:f}),K&&he&&{yExtent:he}),{enableHover:D}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),{showGrid:W,curve:m}),se.legendBehaviorProps),z&&{title:z}),$&&{description:$}),Y&&{summary:Y}),void 0!==G&&{accessibleTable:G}),d&&{className:d}),null!=n.animate&&{animate:n.animate}),void 0!==n.axisExtent&&{axisExtent:n.axisExtent}),void 0!==n.autoPlaceAnnotations&&{autoPlaceAnnotations:n.autoPlaceAnnotations}),{tooltipContent:ae}),k&&{annotations:k}),(A||O||S||M)&&{customHoverBehavior:se.customHoverBehavior}),(O||S||A)&&{customClickBehavior:se.customClickBehavior}),se.crosshairProps),w);return Q||Z||(de?e.jsx(os,{componentName:"MultiAxisLineChart",message:de,width:H,height:I}):e.jsx(ls,{componentName:"MultiAxisLineChart",width:H,height:I,children:e.jsx(di,Object.assign({ref:s},fe))}))});function fr(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}hr.displayName="MultiAxisLineChart";const gr=t.forwardRef(function(n,o){const i=t.useRef(null);xs(o,{variant:"xy",frameRef:i});const s=Ui(n.mode,{width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,title:n.title,xLabel:n.xLabel,yLabel:n.yLabel,description:n.description,summary:n.summary,accessibleTable:n.accessibleTable}),{data:r,margin:l,className:a,xFormat:c,yFormat:u,xAccessor:d="x",highAccessor:h="high",lowAccessor:f="low",openAccessor:g,closeAccessor:p,candlestickStyle:y,tooltip:m,annotations:b,xExtent:x,yExtent:k,frameProps:w={},selection:j,linkedHover:A,onObservation:O,onClick:S,chartId:M,loading:C,loadingContent:_,emptyContent:P}=n,{width:L,height:N,enableHover:F,showGrid:B,title:R,description:T,summary:H,accessibleTable:I,xLabel:D,yLabel:W}=s,E=ds(C,L,N,_),z=E?null:us(r,L,N,P),$=t.useMemo(()=>v(r),[r]),Y=null==g||null==p;hs("CandlestickChart",$,"xAccessor",d),hs("CandlestickChart",$,"highAccessor",h),hs("CandlestickChart",$,"lowAccessor",f),Y||(hs("CandlestickChart",$,"openAccessor",g),hs("CandlestickChart",$,"closeAccessor",p));const{customHoverBehavior:G,customClickBehavior:X,crosshairSourceId:V}=Yi({selection:j,linkedHover:A,onObservation:O,onClick:S,chartType:"CandlestickChart",chartId:M}),q=Gi(A,V),U=t.useMemo(()=>{const e=s.marginDefaults,t="sparkline"===n.mode?Object.assign(Object.assign({},e),{top:0,bottom:0}):e;return null==l?t:Object.assign(Object.assign({},t),fr(l))},[l,s.marginDefaults,n.mode]),K=t.useMemo(()=>{const e=[{label:D||Qi(d),accessor:d,role:"x",format:c}];return Y?(e.push({label:"High",accessor:h,role:"y",format:u}),e.push({label:"Low",accessor:f,format:u})):(e.push({label:"Open",accessor:g,format:u}),e.push({label:"High",accessor:h,format:u}),e.push({label:"Low",accessor:f,format:u}),e.push({label:"Close",accessor:p,format:u})),ns(e)},[d,D,c,u,h,f,g,p,Y]),Q=ps({componentName:"CandlestickChart",data:r,accessors:Object.assign({xAccessor:d,highAccessor:h,lowAccessor:f},!Y&&{openAccessor:g,closeAccessor:p})}),Z=Math.max(2,Math.min(12,Math.round(L/40))),J=L>200?.1:.02,ee=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"candlestick"},null!=r&&{data:$}),{xAccessor:d,yAccessor:h,highAccessor:h,lowAccessor:f}),!Y&&{openAccessor:g,closeAccessor:p}),y&&{candlestickStyle:y}),{scalePadding:Z,extentPadding:J,size:[L,N],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:U,showAxes:s.showAxes,xLabel:D,yLabel:W,xFormat:c,yFormat:u,enableHover:F,showGrid:B}),n.pointIdAccessor&&{pointIdAccessor:n.pointIdAccessor}),_s({title:R,description:T,summary:H,accessibleTable:I,className:a,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),Ls({tooltip:m,defaultTooltipContent:K})),Ps({linkedHover:A,onObservation:O,onClick:S,customHoverBehavior:G,customClickBehavior:X})),b&&b.length>0&&{annotations:b}),x&&{xExtent:x}),k&&{yExtent:k}),q),w);return E||z||(Q?e.jsx(os,{componentName:"CandlestickChart",message:Q,width:L,height:N}):e.jsx(ls,{componentName:"CandlestickChart",width:L,height:N,children:e.jsx(di,Object.assign({ref:i},ee))}))});gr.displayName="CandlestickChart";const pr=t.forwardRef(function(n,o){const{data:i,layout:s,layoutConfig:r,xExtent:l,yExtent:a,showAxes:c=!1,margin:u,className:d,annotations:h,onObservation:f,onClick:g,selection:p,linkedHover:y,chartId:m,loading:v,loadingContent:b,emptyContent:x,colorScheme:k,frameProps:w={}}=n,{frameRef:j,resolved:A,safeData:O,setup:S,earlyReturn:M}=function(e){var n;const o=function(e){const n=t.useRef(null);return xs(e.imperativeRef,{variant:e.imperativeVariant,frameRef:n}),{frameRef:n,resolved:Ui(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel}),normalizedMargin:t.useMemo(()=>fr(e.margin),[e.margin])}}(e),{resolved:i,normalizedMargin:s}=o,r=ms({data:null!==(n=e.data)&&void 0!==n?n:[],rawData:e.data,colorBy:void 0,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:i.showLegend,userMargin:s,marginDefaults:i.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:i.width,height:i.height});return Object.assign(Object.assign({},o),{safeData:r.data,setup:r,earlyReturn:r.earlyReturn})}({imperativeRef:o,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:i,colorScheme:k,selection:p,linkedHover:y,onObservation:f,onClick:g,chartId:m,loading:v,loadingContent:b,emptyContent:x,margin:u,width:n.width,height:n.height,showGrid:n.showGrid,enableHover:n.enableHover,showLegend:n.showLegend,title:n.title,mode:n.mode,xLabel:n.xLabel,yLabel:n.yLabel}),C=S.effectiveSelectionHook,_=t.useMemo(()=>(null==C?void 0:C.isActive)?{isActive:!0,predicate:C.predicate}:null,[null==C?void 0:C.isActive,null==C?void 0:C.predicate]);if(M)return M;const{width:P,height:L,enableHover:N,showGrid:F,title:B,description:R,summary:T,accessibleTable:H,xLabel:I,yLabel:D}=A,W=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({chartType:"custom"},null!=i&&{data:O}),{customLayout:s,layoutConfig:r}),_&&{layoutSelection:_}),{xExtent:l,yExtent:a,colorScheme:k,size:[P,L],responsiveWidth:n.responsiveWidth,responsiveHeight:n.responsiveHeight,margin:S.margin,showAxes:c,xLabel:I,yLabel:D,enableHover:N,showGrid:F}),S.legendBehaviorProps),_s({title:B,description:R,summary:T,accessibleTable:H,className:d,animate:n.animate,axisExtent:n.axisExtent,autoPlaceAnnotations:n.autoPlaceAnnotations})),null!=n.tooltip&&{tooltipContent:n.tooltip}),Ps({linkedHover:y,onObservation:f,onClick:g,hoverHighlight:!1,customHoverBehavior:S.customHoverBehavior,customClickBehavior:S.customClickBehavior})),h&&h.length>0&&{annotations:h}),S.crosshairProps),w);return e.jsx(ls,{componentName:"XYCustomChart",width:P,height:L,children:e.jsx(di,Object.assign({ref:j},W))})});function yr(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),i=Math.round(parseInt(n[2],16)*(1-t)),s=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`}function mr(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),i=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),s=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`}pr.displayName="XYCustomChart";const vr="__forecastSegment",br="__forecastOpacity";function xr(e,t,n,o){var i,s;const r=t.uncertaintyOpacity,l=t.confidenceAccessor;if(!r&&!l)return;const a="object"==typeof r?r:{},c=null!==(i=a.min)&&void 0!==i?i:.15,u=null!==(s=a.max)&&void 0!==s?s:1;if(l){const t="function"==typeof l?l:e=>e[l];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[br]=c+Math.max(0,Math.min(1,e))*(u-c))}return}const d=e.map(e=>{const t=n(e),i=o(e);return null!=t&&null!=i&&Number.isFinite(t)&&Number.isFinite(i)?Math.abs(t-i):NaN}),h=d.filter(e=>Number.isFinite(e));if(0===h.length)return;const[f,g]=Bt(h),p=g-f;e.forEach((e,t)=>{const n=d[t];Number.isFinite(n)&&(e[br]=u-(p>0?(n-f)/p:0)*(u-c))})}function kr(e,t){return"function"==typeof t?t(e):!!e[t]}const wr=Object.freeze({__proto__:null,FORECAST_OPACITY_FIELD:br,SEGMENT_FIELD:vr,buildAnomalyAnnotations:function(e){var t,n,o;return[{type:"anomaly-band",threshold:null!==(t=e.threshold)&&void 0!==t?t:2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:null!==(n=e.bandOpacity)&&void 0!==n?n:.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:null!==(o=e.anomalyRadius)&&void 0!==o?o:6,label:e.label}]},buildForecast:function(e,t,n,o,i){return(s=o).isTraining||s.isForecast||s.isAnomaly||s.upperBounds||s.lowerBounds?function(e,t,n,o,i){var s,r,l,a;const{isTraining:c,isForecast:u,isAnomaly:d,upperBounds:h,lowerBounds:f,color:g="#6366f1",bandOpacity:p=.15,anomalyColor:y="#ef4444",anomalyRadius:m=6,label:v}=o,b=e.map(e=>{let t="observed";return u&&kr(e,u)?t="forecast":c&&kr(e,c)&&(t="training"),Object.assign(Object.assign({},e),{[vr]:t})}),x=o._groupBy,k=[];if(x){const e=new Map;for(const t of b){const n=null!==(s=t[x])&&void 0!==s?s:"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][vr]!==n[e+1][vr]&&(t.push(Object.assign(Object.assign({},n[e+1]),{[vr]:n[e][vr]})),t.push(Object.assign(Object.assign({},n[e]),{[vr]:n[e+1][vr]})));k.push(...b,...t)}else for(let e=0;b.length>e;e++)k.push(b[e]),b.length-1>e&&b[e][vr]!==b[e+1][vr]&&(k.push(Object.assign(Object.assign({},b[e+1]),{[vr]:b[e][vr]})),k.push(Object.assign(Object.assign({},b[e]),{[vr]:b[e+1][vr]})));if(o.trainUnderline){const e=[];for(const t of k)"training"===t[vr]&&e.push(Object.assign(Object.assign({},t),{[vr]:"training-base"}));k.unshift(...e)}const w=[];if(h&&f){const e="string"==typeof h?h:"__envUpper",t="string"==typeof f?f:"__envLower";if("function"==typeof h||"function"==typeof f)for(const n of k)"function"==typeof h&&(n[e]=h(n)),"function"==typeof f&&(n[t]=f(n));w.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:g,fillOpacity:p,label:v})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=h?"function"==typeof h?h:e=>e[h]:()=>{},t=f?"function"==typeof f?f:e=>e[f]:()=>{};xr(k.filter(e=>"forecast"===e[vr]),o,e,t)}if(d){const e=o.anomalyStyle,t={type:"highlight",filter:e=>kr(e,d)};e?(t.style=e,t.r=m):"function"==typeof y?(t.style=e=>{const t=y(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=m):(t.color=y,t.r=m,t.style={stroke:y,strokeWidth:1.5,fill:y,fillOpacity:.7}),w.push(t)}return i&&w.push({type:"anomaly-band",threshold:null!==(r=i.threshold)&&void 0!==r?r:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(l=i.bandOpacity)&&void 0!==l?l:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(a=i.anomalyRadius)&&void 0!==a?a:6,label:i.label}),{processedData:k,annotations:w}}(e,0,0,o,i):function(e,t,n,o,i){var s,r,l;const{trainEnd:a,steps:c=10,confidence:u=.95,color:d="#6366f1",bandOpacity:h=.15,label:f}=o;if(null==a)return{processedData:e,annotations:[]};const g=[],p=[];for(const n of e)n[t]>a?p.push(Object.assign(Object.assign({},n),{[vr]:"observed"})):g.push(Object.assign(Object.assign({},n),{[vr]:"training"}));const y=g.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],v=[];if(y.length>=3){const i=y.length;let s=0,r=0,l=0,a=0;for(const[e,t]of y)s+=e,r+=t,l+=e*e,a+=e*t;const g=i*l-s*s;if(Math.abs(g)>1e-12){const l=(i*a-s*r)/g,p=(r-l*s)/i,b=e=>p+l*e,x=y.map(([e,t])=>t-b(e)).reduce((e,t)=>e+t*t,0),k=Math.sqrt(x/Math.max(i-2,1)),w=y.reduce((e,t)=>e+t[0],0)/i,j=y.reduce((e,t)=>e+Math.pow(t[0]-w,2),0),A=.99>u?.95>u?.9>u?1:1.645:1.96:2.576,O=Rt(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),S=y.length>1?(y[i-1][0]-y[0][0])/(i-1):1;for(let e=1;c>=e;e++){const o=O+e*S,s=b(o),r=k*Math.sqrt(1+1/i+(j>0?Math.pow(o-w,2)/j:0))*A;v.push({[t]:o,[n]:s,[vr]:"forecast",__forecastUpper:s+r,__forecastLower:s-r})}xr(v,o,e=>e.__forecastUpper,e=>e.__forecastLower),m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:d,fillOpacity:h,label:f})}}m.push({type:"x-threshold",x:a,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),i&&m.push({type:"anomaly-band",threshold:null!==(s=i.threshold)&&void 0!==s?s:2,showBand:!1!==i.showBand,fill:i.bandColor||"#6366f1",fillOpacity:null!==(r=i.bandOpacity)&&void 0!==r?r:.1,anomalyColor:i.anomalyColor||"#ef4444",anomalyRadius:null!==(l=i.anomalyRadius)&&void 0!==l?l:6,label:i.label});const b=[];if(b.push(...g),g.length>0&&p.length>0&&b.push(Object.assign(Object.assign({},g[g.length-1]),{[vr]:"observed"})),b.push(...p),v.length>0){const e=p.length>0?p[p.length-1]:g[g.length-1];e&&b.push(Object.assign(Object.assign({},e),{[vr]:"forecast"})),b.push(...v)}return{processedData:b,annotations:m}}(e,t,n,o,i);var s},createSegmentLineStyle:function(e,t){var n,o;const i=null!==(n=t.trainDasharray)&&void 0!==n?n:"8,4",s=null!==(o=t.forecastDasharray)&&void 0!==o?o:"4,4",r=t.color||"#6366f1",l=t.trainOpacity,a=t.forecastOpacity,c=t.trainStroke,u=t.trainLinecap,d=t.trainUnderline;return t=>{const n=e(t),o=t[vr];if("training"===o){let e=n.stroke;return"darken"===c?e=yr(n.stroke||"#666",.5):c&&(e=c),Object.assign(Object.assign(Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:i}),u&&{strokeLinecap:u}),null!=l&&{strokeOpacity:l})}if("training-base"===o){let e=n.stroke||"#666";return"lighten"===d&&(e=mr(e,.4)),Object.assign(Object.assign({},n),{stroke:e,strokeDasharray:void 0})}if("forecast"===o){const e=t[br],o=null!=e?e:a;return Object.assign(Object.assign(Object.assign({},n),{stroke:r,strokeDasharray:s}),null!=o&&{strokeOpacity:o})}return n}},darkenColor:yr,lightenColor:mr,stampForecastOpacity:xr});exports.AreaChart=Bs,exports.BubbleChart=Ys,exports.CandlestickChart=gr,exports.ConnectedScatterplot=$s,exports.DifferenceChart=Ts,exports.Heatmap=Gs,exports.LineChart=Cs,exports.MinimapChart=tr,exports.MultiAxisLineChart=hr,exports.QuadrantChart=lr,exports.Scatterplot=Es,exports.ScatterplotMatrix=Js,exports.StackedAreaChart=Hs,exports.StreamXYFrame=di,exports.XYCustomChart=pr,exports.useCustomLayoutSelection=function(){var e;return null!==(e=h.useContext(Ee))&&void 0!==e?e:We};
|
|
2
|
+
"use strict";var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,r=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,s=(e,t,n)=>function(){if(n)throw n[0];try{return e&&(t=(0,e[o(e)[0]])(e=0)),t}catch(e){throw n=[e],e}},a=(e,n)=>{for(var o in n)t(e,o,{get:n[o],enumerable:!0})},l=(e,r,s,a)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let l of o(r))i.call(e,l)||l===s||t(e,l,{get:()=>r[l],enumerable:!(a=n(r,l))||a.enumerable});return e},c=(n,o,i)=>(i=null!=n?e(r(n)):{},l(!o&&n&&n.__esModule?i:t(i,"default",{value:n,enumerable:!0}),n));function u(e){let t=1/0,n=-1/0;for(const o of e)t>o&&(t=o),o>n&&(n=o);return[t,n]}function h(e,t=-1/0){let n=t;for(const t of e)t>n&&(n=t);return n}var d=s({"src/components/charts/shared/minMax.ts"(){}});function f(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)*(1-t)),r=Math.round(parseInt(n[2],16)*(1-t)),i=Math.round(parseInt(n[3],16)*(1-t));return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}function p(e,t=.5){const n=/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(e);if(!n)return e;const o=Math.round(parseInt(n[1],16)+(255-parseInt(n[1],16))*t),r=Math.round(parseInt(n[2],16)+(255-parseInt(n[2],16))*t),i=Math.round(parseInt(n[3],16)+(255-parseInt(n[3],16))*t);return`#${o.toString(16).padStart(2,"0")}${r.toString(16).padStart(2,"0")}${i.toString(16).padStart(2,"0")}`}var y,m,g=s({"src/components/charts/shared/colorManipulation.ts"(){}}),x={};function b(e,t,n,o){const r=t.uncertaintyOpacity,i=t.confidenceAccessor;if(!r&&!i)return;const s="object"==typeof r?r:{},a=s.min??.15,l=s.max??1;if(i){const t="function"==typeof i?i:e=>e[i];for(const n of e){const e=t(n);null!=e&&Number.isFinite(e)&&(n[m]=a+Math.max(0,Math.min(1,e))*(l-a))}return}const c=e.map(e=>{const t=n(e),r=o(e);return null!=t&&null!=r&&Number.isFinite(t)&&Number.isFinite(r)?Math.abs(t-r):NaN}),h=c.filter(e=>Number.isFinite(e));if(0===h.length)return;const[d,f]=u(h),p=f-d;e.forEach((e,t)=>{const n=c[t];Number.isFinite(n)&&(e[m]=l-(p>0?(n-d)/p:0)*(l-a))})}function v(e,t){return"function"==typeof t?t(e):!!e[t]}function k(e){return[{type:"anomaly-band",threshold:e.threshold??2,showBand:!1!==e.showBand,fill:e.bandColor||"#6366f1",fillOpacity:e.bandOpacity??.1,anomalyColor:e.anomalyColor||"#ef4444",anomalyRadius:e.anomalyRadius??6,label:e.label}]}function w(e,t,n,o,r){return(i=o).isTraining||i.isForecast||i.isAnomaly||i.upperBounds||i.lowerBounds?function(e,t,n,o,r){const{isTraining:i,isForecast:s,isAnomaly:a,upperBounds:l,lowerBounds:c,color:u="#6366f1",bandOpacity:h=.15,anomalyColor:d="#ef4444",anomalyRadius:f=6,label:p}=o,m=e.map(e=>{let t="observed";return s&&v(e,s)?t="forecast":i&&v(e,i)&&(t="training"),{...e,[y]:t}}),g=o._groupBy,x=[];if(g){const e=new Map;for(const t of m){const n=t[g]??"__default";e.has(n)||e.set(n,[]),e.get(n).push(t)}const t=[];for(const[,n]of e)for(let e=0;n.length-1>e;e++)n[e][y]!==n[e+1][y]&&(t.push({...n[e+1],[y]:n[e][y]}),t.push({...n[e],[y]:n[e+1][y]}));x.push(...m,...t)}else for(let e=0;m.length>e;e++)x.push(m[e]),m.length-1>e&&m[e][y]!==m[e+1][y]&&(x.push({...m[e+1],[y]:m[e][y]}),x.push({...m[e],[y]:m[e+1][y]}));if(o.trainUnderline){const e=[];for(const t of x)"training"===t[y]&&e.push({...t,[y]:"training-base"});x.unshift(...e)}const k=[];if(l&&c){const e="string"==typeof l?l:"__envUpper",t="string"==typeof c?c:"__envLower";if("function"==typeof l||"function"==typeof c)for(const n of x)"function"==typeof l&&(n[e]=l(n)),"function"==typeof c&&(n[t]=c(n));k.push({type:"envelope",upperAccessor:e,lowerAccessor:t,fill:u,fillOpacity:h,label:p})}if(o.uncertaintyOpacity||o.confidenceAccessor){const e=l?"function"==typeof l?l:e=>e[l]:()=>{},t=c?"function"==typeof c?c:e=>e[c]:()=>{};b(x.filter(e=>"forecast"===e[y]),o,e,t)}if(a){const e=o.anomalyStyle,t={type:"highlight",filter:e=>v(e,a)};e?(t.style=e,t.r=f):"function"==typeof d?(t.style=e=>{const t=d(e);return{stroke:t,strokeWidth:1.5,fill:t,fillOpacity:.7}},t.r=f):(t.color=d,t.r=f,t.style={stroke:d,strokeWidth:1.5,fill:d,fillOpacity:.7}),k.push(t)}return r&&k.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label}),{processedData:x,annotations:k}}(e,0,0,o,r):function(e,t,n,o,r){const{trainEnd:i,steps:s=10,confidence:a=.95,color:l="#6366f1",bandOpacity:c=.15,label:u}=o;if(null==i)return{processedData:e,annotations:[]};const d=[],f=[];for(const n of e)n[t]>i?f.push({...n,[y]:"observed"}):d.push({...n,[y]:"training"});const p=d.map(e=>[e[t],e[n]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]),m=[],g=[];if(p.length>=3){const r=p.length;let i=0,d=0,f=0,x=0;for(const[e,t]of p)i+=e,d+=t,f+=e*e,x+=e*t;const v=r*f-i*i;if(Math.abs(v)>1e-12){const f=(r*x-i*d)/v,k=(d-f*i)/r,w=e=>k+f*e,A=p.map(([e,t])=>t-w(e)).reduce((e,t)=>e+t*t,0),S=Math.sqrt(A/Math.max(r-2,1)),C=p.reduce((e,t)=>e+t[0],0)/r,M=p.reduce((e,t)=>e+(t[0]-C)**2,0),j=.99>a?.95>a?.9>a?1:1.645:1.96:2.576,_=h(e.map(e=>e[t]).filter(e=>null!=e&&isFinite(e))),R=p.length>1?(p[r-1][0]-p[0][0])/(r-1):1;for(let e=1;s>=e;e++){const o=_+e*R,i=w(o),s=S*Math.sqrt(1+1/r+(M>0?(o-C)**2/M:0))*j;g.push({[t]:o,[n]:i,[y]:"forecast",__forecastUpper:i+s,__forecastLower:i-s})}b(g,o,e=>e.__forecastUpper,e=>e.__forecastLower),m.push({type:"envelope",upperAccessor:"__forecastUpper",lowerAccessor:"__forecastLower",fill:l,fillOpacity:c,label:u})}}m.push({type:"x-threshold",x:i,color:"#94a3b8",strokeWidth:1,strokeDasharray:"4,2",label:"Train / Forecast"}),r&&m.push({type:"anomaly-band",threshold:r.threshold??2,showBand:!1!==r.showBand,fill:r.bandColor||"#6366f1",fillOpacity:r.bandOpacity??.1,anomalyColor:r.anomalyColor||"#ef4444",anomalyRadius:r.anomalyRadius??6,label:r.label});const x=[];if(x.push(...d),d.length>0&&f.length>0&&x.push({...d[d.length-1],[y]:"observed"}),x.push(...f),g.length>0){const e=f.length>0?f[f.length-1]:d[d.length-1];e&&x.push({...e,[y]:"forecast"}),x.push(...g)}return{processedData:x,annotations:m}}(e,t,n,o,r);var i}function A(e,t){const n=t.trainDasharray??"8,4",o=t.forecastDasharray??"4,4",r=t.color||"#6366f1",i=t.trainOpacity,s=t.forecastOpacity,a=t.trainStroke,l=t.trainLinecap,c=t.trainUnderline;return t=>{const u=e(t),h=t[y];if("training"===h){let e=u.stroke;return"darken"===a?e=f(u.stroke||"#666",.5):a&&(e=a),{...u,stroke:e,strokeDasharray:n,...l&&{strokeLinecap:l},...null!=i&&{strokeOpacity:i}}}if("training-base"===h){let e=u.stroke||"#666";return"lighten"===c&&(e=p(e,.4)),{...u,stroke:e,strokeDasharray:void 0}}if("forecast"===h){const e=t[m],n=null!=e?e:s;return{...u,stroke:r,strokeDasharray:o,...null!=n&&{strokeOpacity:n}}}return u}}a(x,{FORECAST_OPACITY_FIELD:()=>m,SEGMENT_FIELD:()=>y,buildAnomalyAnnotations:()=>k,buildForecast:()=>w,createSegmentLineStyle:()=>A,darkenColor:()=>f,lightenColor:()=>p,stampForecastOpacity:()=>b});var S,C=s({"src/components/charts/shared/statisticalOverlays.ts"(){d(),g(),g(),y="__forecastSegment",m="__forecastOpacity"}}),M={};a(M,{AreaChart:()=>Mc,BubbleChart:()=>Uc,CandlestickChart:()=>Wu,ConnectedScatterplot:()=>qc,DEFAULT_HIT_RADIUS:()=>Gu,DifferenceChart:()=>Pc,Heatmap:()=>Jc,LineChart:()=>vc,MinimapChart:()=>bu,MultiAxisLineChart:()=>Fu,QuadrantChart:()=>ju,Scatterplot:()=>Ec,ScatterplotMatrix:()=>fu,StackedAreaChart:()=>Tc,StreamXYFrame:()=>Ra,XYCustomChart:()=>$u,composeStyleRules:()=>rc,glyphExtent:()=>mn,glyphPlacement:()=>yn,hatchFillId:()=>Nn,hatchPatternDef:()=>On,hitTargetPoint:()=>Vu,hitTargetRect:()=>Xu,isHatchFill:()=>In,makeRuleValueResolver:()=>Zl,makeXYRuleContext:()=>Jl,matchesThreshold:()=>tc,resolveResponsiveRules:()=>dl,resolveStyleRules:()=>oc,resolveSvgFill:()=>Bn,responsiveRuleMatches:()=>hl,ruleMatches:()=>nc,useCustomLayoutSelection:()=>sn}),module.exports=(S=M,l(t({},"__esModule",{value:!0}),S));var j=c(require("react")),_=require("react"),R=require("react"),P=require("d3-selection"),L=require("d3-brush"),I=c(require("react")),T=require("react/jsx-runtime");function N(e,t,n,o){const[r,i]=[Math.min(...t),Math.max(...t)],s=(i-r)/20;let[a,l]=e;if(o)0>n?a=Math.max(r,a-s):l=Math.min(i,l+s);else{const e=l-a;a=Math.max(r,Math.min(i-e,a+n*s)),l=a+e}return[a,l]}function F(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o+1>>1;t[r]>e?o=r-1:n=r}return t[n]}function O(e,t){let n=0,o=t.length-1;for(;o>n;){const r=n+o>>1;e>t[r]?n=r+1:o=r}return t[n]}function B({width:e,height:t,totalWidth:n,totalHeight:o,margin:r,dimension:i,scales:s,onBrush:a,binSize:l,snap:c,binBoundaries:u,snapDuring:h,streaming:d}){const f=(0,R.useRef)(null),p=(0,R.useRef)(null),y=(0,R.useRef)(a);y.current=a;const m=(0,R.useRef)(s);m.current=s;const g=(0,R.useMemo)(()=>u?[...u].sort((e,t)=>e-t):void 0,[u]),x=(0,R.useRef)(g);x.current=g;const b=(0,R.useRef)(!1),v=(0,R.useRef)(null),k=function({label:e="Data range brush",description:t="Use arrow keys to move the selected range, Shift plus an arrow key to resize it, and Escape to clear it.",onAction:n}={}){const o=I.useId().replace(/:/g,""),r=I.useRef(n);return r.current=n,{description:t,descriptionId:"semiotic-brush-description-"+o,svgProps:{role:"region",tabIndex:0,"aria-label":e,"aria-describedby":"semiotic-brush-description-"+o,onKeyDown:I.useCallback(e=>{const t=function(e){return"Escape"===e.key?{type:"clear"}:"ArrowLeft"===e.key?{type:"nudge",direction:"left",resize:e.shiftKey}:"ArrowRight"===e.key?{type:"nudge",direction:"right",resize:e.shiftKey}:"ArrowUp"===e.key?{type:"nudge",direction:"up",resize:e.shiftKey}:"ArrowDown"===e.key?{type:"nudge",direction:"down",resize:e.shiftKey}:null}(e);t&&(e.preventDefault(),r.current?.(t))},[])}}}({label:"xy"===i?"Two-dimensional data range brush":i.toUpperCase()+" data range brush",onAction:e=>{const t=m.current,n=p.current;if(!t||!n||!f.current)return;const o=(0,P.select)(f.current).select(".brush-g");if("clear"===e.type)return b.current=!0,o.call(n.move,null),b.current=!1,v.current=null,void y.current(null);const r=t.x.domain(),s=t.y.domain(),a=v.current;let l=a?.x??[r[0]+.4*(r[1]-r[0]),r[0]+.6*(r[1]-r[0])],c=a?.y??[s[0]+.4*(s[1]-s[0]),s[0]+.6*(s[1]-s[0])];const u="left"===e.direction||"right"===e.direction,h="left"===e.direction||"down"===e.direction?-1:1;if(u&&"y"!==i&&(l=N(l,r,h,e.resize)),u||"x"===i||(c=N(c,s,h,e.resize)),u&&"y"===i||!u&&"x"===i)return;const d={x:l,y:c};b.current=!0,o.call(n.move,"x"===i?[t.x(l[0]),t.x(l[1])]:"y"===i?[t.y(c[1]),t.y(c[0])]:[[t.x(l[0]),t.y(c[1])],[t.x(l[1]),t.y(c[0])]]),b.current=!1,v.current=d,y.current(d)}});return(0,R.useEffect)(()=>{if(!f.current)return;const n=(0,P.select)(f.current).select(".brush-g"),o="x"===i?(0,L.brushX)():"y"===i?(0,L.brushY)():(0,L.brush)();return o.extent([[0,0],[e,t]]),o.on("brush end",r=>{if(b.current)return;const s=m.current;if(!s)return;if(!r.selection)return v.current=null,void y.current(null);let a,u;if("x"===i){const[e,n]=r.selection;a=[s.x.invert(e),s.x.invert(n)],u=[s.y.invert(t),s.y.invert(0)]}else if("y"===i){const[t,n]=r.selection;a=[s.x.invert(0),s.x.invert(e)],u=[s.y.invert(n),s.y.invert(t)]}else{const[[e,t],[n,o]]=r.selection;a=[s.x.invert(e),s.x.invert(n)],u=[s.y.invert(o),s.y.invert(t)]}if("bin"===c&&"y"!==i&&("end"===r.type||"brush"===r.type&&h)){const e=x.current;e&&e.length>0?a=function(e,t){return 0===t.length?e:[F(e[0],t),O(e[1],t)]}(a,e):l&&l>0&&(a=[Math.floor(a[0]/l)*l,Math.ceil(a[1]/l)*l]);const t=s.x(a[0]),c=s.x(a[1]);if(b.current=!0,"x"===i)n.call(o.move,[t,c]);else if("xy"===i){const e=r.selection;n.call(o.move,[[t,e[0][1]],[c,e[1][1]]])}b.current=!1}const d={x:a,y:u};v.current=d,y.current(d)}),n.call(o),p.current=o,n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{o.on("brush end",null),p.current=null}},[e,t,i,c,l,h]),(0,R.useEffect)(()=>{if(!(d&&s&&p.current&&v.current))return;if(!f.current)return;if("y"===i)return;const e=v.current,t=s.x.domain()[0],n=(0,P.select)(f.current).select(".brush-g");if(t>=e.x[1])return b.current=!0,n.call(p.current.move,null),b.current=!1,v.current=null,void y.current(null);let o=e.x[0],r=!1;if(t>e.x[0]){if(o=t,"bin"===c){const e=x.current;e&&e.length>0?o=O(t,e):l&&l>0&&(o=Math.ceil(t/l)*l)}if(o>=e.x[1])return b.current=!0,n.call(p.current.move,null),b.current=!1,v.current=null,void y.current(null);r=!0}const a=s.x(o),u=s.x(e.x[1]);if(b.current=!0,"x"===i)n.call(p.current.move,[a,u]);else{const t=s.y(e.y[1]),o=s.y(e.y[0]);n.call(p.current.move,[[a,t],[u,o]])}if(b.current=!1,r){const t={x:[o,e.x[1]],y:e.y};v.current=t,y.current(t)}},[s,d,i,c,l]),(0,T.jsxs)("svg",{ref:f,width:n,height:o,...k.svgProps,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:[(0,T.jsx)("title",{children:k.svgProps["aria-label"]}),(0,T.jsx)("desc",{id:k.descriptionId,children:k.description}),(0,T.jsx)("g",{className:"brush-g",transform:`translate(${r.left},${r.top})`})]})}var D=Object.freeze([]);function W(e){if(!e)return D;let t=!1;for(let n=0;e.length>n;n++){const o=e[n];if(null==o||"object"!=typeof o){t=!0;break}}if(!t)return e;const n=[];for(const t of e)null!=t&&"object"==typeof t&&n.push(t);return n}var z=class{constructor(e,t){this.lastBoundedData=null,this.chunkTimer=0,this.pushBuffer=[],this.flushScheduled=!1,this.callback=e,this.chunkThreshold=t?.chunkThreshold??5e3,this.chunkSize=t?.chunkSize??5e3}updateChunkOptions(e){null!=e.chunkThreshold&&(this.chunkThreshold=e.chunkThreshold),null!=e.chunkSize&&(this.chunkSize=e.chunkSize)}clearLastData(){this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0)}setBoundedData(e){if(e=W(e),this.lastBoundedData===e)return;if(this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}setReplacementData(e){if(e=W(e),this.lastBoundedData=e,this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.pushBuffer=[],this.flushScheduled=!1,this.chunkThreshold>=e.length)return void this.callback({inserts:e,bounded:!0,preserveCategoryOrder:!0});this.callback({inserts:e.slice(0,this.chunkSize),bounded:!0,preserveCategoryOrder:!0,totalSize:e.length});let t=this.chunkSize;const n=()=>{if(t>=e.length)return void(this.chunkTimer=0);if(e!==this.lastBoundedData)return void(this.chunkTimer=0);const o=Math.min(t+this.chunkSize,e.length);this.callback({inserts:e.slice(t,o),bounded:!1}),t=o,this.chunkTimer=e.length>t?requestAnimationFrame(n):0};this.chunkTimer=requestAnimationFrame(n)}flushPushBuffer(){if(this.flushScheduled=!1,0===this.pushBuffer.length)return;const e=this.pushBuffer;this.pushBuffer=[],this.callback({inserts:e,bounded:!1})}scheduleFlush(){this.flushScheduled||(this.flushScheduled=!0,queueMicrotask(()=>this.flushPushBuffer()))}push(e){null!=e&&"object"==typeof e&&(this.pushBuffer.push(e),this.scheduleFlush())}pushMany(e){if(0===e.length)return;let t=0;for(let n=0;e.length>n;n++){const o=e[n];null!=o&&"object"==typeof o&&(this.pushBuffer.push(o),t++)}0!==t&&this.scheduleFlush()}flush(){this.flushPushBuffer()}clear(){this.chunkTimer&&(cancelAnimationFrame(this.chunkTimer),this.chunkTimer=0),this.lastBoundedData=null,this.pushBuffer=[],this.flushScheduled=!1}},H=require("react"),E=require("react/jsx-runtime");function $(e){let t=null;const n=()=>(t||(t=(0,H.createContext)(null)),t),o=Y(e);return[function({children:t,initialState:o}){const r=(0,H.useRef)(o),i=(0,H.useMemo)(()=>Y(e,r.current),[]),s=n();return(0,E.jsx)(s.Provider,{value:i,children:t})},(e,t)=>{const r=n(),i=(0,H.useContext)(r)??o,s=(0,H.useRef)(e);s.current=e;const a=(0,H.useRef)({hasValue:!1,value:void 0}),l=(0,H.useCallback)(()=>{const e=s.current(i.getState()),n=a.current;return n.hasValue&&t&&t(n.value,e)?n.value:(a.current={hasValue:!0,value:e},e)},[i,t]),c=(0,H.useCallback)(()=>s.current(i.getState()),[i]);return(0,H.useSyncExternalStore)(i.subscribe,l,c)}]}function Y(e,t){const n=new Set;let o={...e(function(e){const t=e(o);if(function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}(t)){o={...o,...t};for(const e of n)e()}}),...t??{}};return{getState:()=>o,subscribe:function(e){return n.add(e),()=>{n.delete(e)}}}}function G(e){if(!e?.colors)return;const t=e.colors;return{primary:t.primary,secondary:t.secondary||t.primary,surface:t.surface||t.background,success:t.success,danger:t.danger,warning:t.warning,error:t.error,info:t.info,text:t.text,textSecondary:t.textSecondary,border:t.border,grid:t.grid}}function q(e){if(!e.accessibility)return e;let t=e;if(e.accessibility.colorBlindSafe&&(t={...t,colors:{...t.colors,categorical:V}}),e.accessibility.highContrast){const e="dark"===t.mode;t={...t,colors:{...t.colors,text:e?"#ffffff":"#000000",textSecondary:e?"#cccccc":"#333333",grid:e?"#666666":"#999999",border:e?"#888888":"#000000"}}}return t}var V=["#0072B2","#E69F00","#009E73","#CC79A7","#56B4E9","#D55E00","#F0E442","#000000"],X={mode:"light",colors:{primary:"#00a2ce",secondary:"#6c757d",categorical:["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],sequential:"blues",diverging:"RdBu",background:"transparent",surface:"#ffffff",text:"#333",textSecondary:"#666",grid:"#e0e0e0",border:"#ccc",selection:"#00a2ce",selectionOpacity:.15,success:"#2ca02c",danger:"#d62728",warning:"#f0ad4e",error:"#b4181b",info:"#00a2ce"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},U={mode:"dark",colors:{primary:"#4fc3f7",secondary:"#90a4ae",categorical:["#4fc3f7","#ffb74d","#81c784","#ef5350","#ba68c8","#a1887f","#f06292","#90a4ae","#dce775","#4dd0e1"],sequential:"blues",diverging:"RdBu",background:"#1a1a2e",surface:"#252540",text:"#e0e0e0",textSecondary:"#aaa",grid:"#333",border:"#555",selection:"#4fc3f7",selectionOpacity:.15,success:"#81c784",danger:"#ef5350",warning:"#ffb74d",error:"#d84848",info:"#4fc3f7"},typography:{fontFamily:"sans-serif",titleSize:16,labelSize:12,tickSize:12}},K={mode:"light",colors:{primary:"#0000cc",secondary:"#333333",categorical:V,sequential:"blues",diverging:"RdBu",background:"#ffffff",surface:"#ffffff",text:"#000000",textSecondary:"#333333",grid:"#999999",border:"#000000",focus:"#0000cc",selection:"#0000cc",selectionOpacity:.1,success:"#006400",danger:"#cc0000",warning:"#b15a00",error:"#8b0000",info:"#0000cc"},typography:{fontFamily:"system-ui, sans-serif",titleSize:18,labelSize:14,tickSize:12},tooltip:{background:"#000000",text:"#ffffff",borderRadius:"4px",fontSize:"14px",shadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},borderRadius:"4px"};function Q(e,t){if("light"===t)return X;if("dark"===t)return U;if("high-contrast"===t)return K;if("string"==typeof t)return void 0!==console&&console.warn(`[ThemeStore] Unknown theme preset "${t}". Keeping current theme.`),e;if(t.mode&&"auto"!==t.mode){const e="dark"===t.mode?U:X;return q({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}return q({...e,...t,colors:{...e.colors,...t.colors||{}},typography:{...e.typography,...t.typography||{}}})}var[Z,J]=$(e=>({theme:X,setTheme(t){e(e=>({theme:Q(e.theme,t)}))}})),ee=class{constructor(e){if(this._capacity=e,this.head=0,this._size=0,1>e)throw Error("RingBuffer capacity must be at least 1");this.buffer=Array(e)}push(e){let t;return this._size===this._capacity?t=this.buffer[this.head]:this._size++,this.buffer[this.head]=e,this.head=(this.head+1)%this._capacity,t}pushMany(e){const t=[];for(const n of e){const e=this.push(n);void 0!==e&&t.push(e)}return t}get(e){if(e>=0&&this._size>e)return this.buffer[(this.head-this._size+e+this._capacity)%this._capacity]}peek(){if(0!==this._size)return this.buffer[(this.head-1+this._capacity)%this._capacity]}peekOldest(){if(0!==this._size)return this.buffer[(this.head-this._size+this._capacity)%this._capacity]}[Symbol.iterator](){let e=0;return{next:()=>this._size>e?{done:!1,value:this.get(e++)}:{done:!0,value:void 0}}}forEach(e){const t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e(this.buffer[(t+n)%this._capacity],n)}toArray(){const e=Array(this._size),t=(this.head-this._size+this._capacity)%this._capacity;for(let n=0;this._size>n;n++)e[n]=this.buffer[(t+n)%this._capacity];return e}resize(e){if(1>e)throw Error("RingBuffer capacity must be at least 1");const t=this.toArray();let n=0,o=[];t.length>e&&(n=t.length-e,o=t.slice(0,n)),this._capacity=e,this.buffer=Array(e),this.head=0,this._size=0;for(let e=n;t.length>e;e++)this.push(t[e]);return o}update(e,t){const n=[],o=(this.head-this._size+this._capacity)%this._capacity;for(let r=0;this._size>r;r++){const i=(o+r)%this._capacity,s=this.buffer[i];if(e(s)){let e;e="object"!=typeof s||null===s?s:Array.isArray(s)?[...s]:{...s},n.push(e),this.buffer[i]=t(s)}}return n}remove(e){const t=[],n=[];if(this.forEach(o=>{e(o)?n.push(o):t.push(o)}),0===n.length)return n;this.buffer=Array(this._capacity),this.head=0,this._size=0;for(const e of t)this.push(e);return n}clear(){this.buffer=Array(this._capacity),this.head=0,this._size=0}get size(){return this._size}get capacity(){return this._capacity}get full(){return this._size===this._capacity}},te=class{constructor(){this._min=1/0,this._max=-1/0,this._dirty=!1}push(e){Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}evict(e){e!==this._min&&e!==this._max||(this._dirty=!0)}recalculate(e,t){this._min=1/0,this._max=-1/0;for(const n of e){const e=t?t(n):n;Number.isFinite(e)&&(this._min>e&&(this._min=e),e>this._max&&(this._max=e))}this._dirty=!1}clear(){this._min=1/0,this._max=-1/0,this._dirty=!1}get extent(){return[this._min,this._max]}get min(){return this._min}get max(){return this._max}get dirty(){return this._dirty}};function ne(e,t){return e===t}function oe(e,t){if("function"==typeof e)return t=>+e(t);const n=e||t;return e=>+e[n]}function re(e,t){if("function"==typeof e)return e;const n=e||t;return e=>e[n]}function ie(e,t){return"function"==typeof e?e:e?t=>t[e]+"":t?e=>e[t]+"":void 0}var se=/^\d{4}-\d{1,2}$/;function ae(e){const t=e.trim();if(!t||!Number.isNaN(Number(t)))return NaN;const n=se.test(t)?t+"-01":t;if(n===t&&10>t.length)return NaN;const o=Date.parse(n);return Number.isFinite(o)?o:NaN}function le(e){return e instanceof Date?e.getTime():"string"==typeof e?ae(e):+e}function ce(e){return new Set(Array.isArray(e)?e:[e])}var ue=require("d3-scale");function he(e){return[parseInt(e.slice(1,3),16),parseInt(e.slice(3,5),16),parseInt(e.slice(5,7),16)]}function de(e,t,n){const o=e=>e.toString(16).padStart(2,"0");return`#${o(e)}${o(t)}${o(n)}`}function fe(e){const t=e.map(he),n=t.length-1;return e=>{if(0>=e){const[e,n,o]=t[0];return de(e,n,o)}if(e>=1){const[e,o,r]=t[n];return de(e,o,r)}const o=e*n,r=Math.floor(o),i=o-r,[s,a,l]=t[r],[c,u,h]=t[r+1];return de(Math.round(s+(c-s)*i),Math.round(a+(u-a)*i),Math.round(l+(h-l)*i))}}var pe=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],ye=fe(["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]),me=fe(["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]),ge=fe(["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]),xe=fe(["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]),be=fe(["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]),ve=fe(["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]),ke=fe(["#440154","#482878","#3e4989","#31688e","#26828e","#1f9e89","#35b779","#6ece58","#b5de2b","#fde725"]),we=fe(["#0d0887","#41049d","#6a00a8","#8f0da4","#b12a90","#cb4679","#e16462","#f1844b","#fca636","#fcce25","#f0f921"]),Ae=fe(["#000004","#160b39","#420a68","#6a176e","#932667","#bc3754","#dd513a","#f3771a","#fca50a","#f6d746","#fcffa4"]),Se=fe(["#000004","#140e36","#3b0f70","#641a80","#8c2981","#b73779","#de4968","#f7705c","#fe9f6d","#fecf92","#fcfdbf"]),Ce=fe(["#00224e","#123570","#3b496c","#575d6d","#707173","#8a8678","#a59c74","#c3b369","#e1cc55","#fee838","#ffea46"]),Me=fe(["#23171b","#4a58dd","#3f9ee9","#46c7af","#7eed5a","#cdf134","#fbb91f","#f56918","#c52f06","#7a0403"]),je={blues:ye,reds:me,greens:ge,viridis:ke,oranges:xe,purples:be,greys:ve,plasma:we,inferno:Ae,magma:Se,cividis:Ce,turbo:Me};function _e(e){return e&&je[e]||ye}fe(["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]),fe(["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]),fe(["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]),fe(["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]),fe(["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]),fe(["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]),fe(["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]);var Re={category10:pe,tableau10:["#4e79a7","#f28e2c","#e15759","#76b7b2","#59a14f","#edc949","#af7aa1","#ff9da7","#9c755f","#bab0ab"],set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],...je},Pe=pe,Le=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"],Ie=new Set(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","transparent","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"]);function Te(e,t,n){if("function"==typeof t){const o=t(e);return n&&o&&"string"==typeof o&&!function(e){const t=e.toLowerCase();return t.startsWith("#")||t.startsWith("rgb")||t.startsWith("hsl")||Ie.has(t)}(o)?n(o):o}const o=e?.[t]+"";return n?n(o):Pe[Math.abs(function(e){let t=0;for(let n=0;e.length>n;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}(o))%Pe.length]}function Ne(e,t){if(null==t||!Object.prototype.hasOwnProperty.call(e,t))return;const n=e[t];return"string"==typeof n&&n.length>0?n:void 0}function Fe(e,t,n="category10"){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n;return t=>Ne(e,t)??"#999"}const o=Array.from(new Set(e.map(e=>e?.[t]).filter(e=>null!=e).map(e=>e+""))),r=o.every(e=>!isNaN(Number(e)));if(Array.isArray(n))return(0,ue.scaleOrdinal)().domain(o).range(n).unknown("#999");const i=Re[n]||Re.category10;if(r&&"function"==typeof i){let e=-1/0;for(const t of o){const n=Number(t);n>e&&(e=n)}return t=>i(Number(t)/e)}{const e=Array.isArray(i)?i:Pe;return(0,ue.scaleOrdinal)().domain(o).range(e).unknown("#999")}}function Oe(e,t,n=[3,20],o){let r;if(r="function"==typeof t?t(e):e?.[t],!o)return r;const[i,s]=o,[a,l]=n;if(s===i)return(a+l)/2;let c=(r-i)/(s-i);return 0>c?c=0:c>1&&(c=1),a+c*(l-a)}function Be(e,t,n){return e+(t-e)*n}function De(){return"undefined"!=typeof performance?performance.now():Date.now()}function We(e,t,n){if(1>=n)return 1;const o=n-1;return function(e){const t=Math.max(0,Math.min(1,e.minOpacity??.1));if(Number.isNaN(e.age))return 1;if(e.age===1/0)return t;if(!Number.isFinite(e.extent)||0>=e.extent)return 1;const n=Math.max(0,e.age);if("step"===e.type)return(e.threshold??.5*e.extent)>n?1:t;if("exponential"===e.type){const o=e.halfLife??e.extent/2;return t+Math.pow(.5,n/(o>0?o:e.extent/2))*(1-t)}return t+Math.max(0,Math.min(1,1-n/e.extent))*(1-t)}({age:o-t,extent:o,type:e.type,halfLife:e.halfLife??n/2,threshold:e.stepThreshold??.5*n,minOpacity:e.minOpacity??.1})}function ze(e){const t=new Map;for(let n=0;e.length>n;n++)t.set(e[n],n);return t}function He(e,t,n){const o=e.duration??500,r=n-t;return o>r?1-r/o:0}function Ee(e,t,n,o){let r=!1;return t>0?(e._pulseIntensity!==t&&(e._pulseIntensity=t,r=!0),e._pulseColor!==n&&(e._pulseColor=n,r=!0),e._pulseGlowRadius!==o&&(e._pulseGlowRadius=o,r=!0),r):(0!==e._pulseIntensity&&(e._pulseIntensity=0,r=!0),void 0!==e._pulseColor&&(e._pulseColor=void 0,r=!0),void 0!==e._pulseGlowRadius&&(e._pulseGlowRadius=void 0,r=!0),r)}function $e(e,t,n){if(t._transitionKey)return t._transitionKey;switch(t.type){case"point":if(t.pointId)return"p:"+t.pointId;if("streaming"===e.runtimeMode&&t.datum){const n=e.getX(t.datum),o=e.getY(t.datum);if(e.getCategory)return`p:${e.getCategory(t.datum)}:${n}:${o}`;if(null!=n&&null!=o)return`p:${n}:${o}`}return"p:"+n;case"glyph":return t.pointId?"g:"+t.pointId:"g:"+n;case"rect":return`r:${t.group||""}:${t.datum?.binStart??t.datum?.category??n}`;case"heatcell":return`h:${t.x}_${t.y}`;case"candlestick":return null==t.datum?"c:"+n:"c:"+e.getX(t.datum);case"line":return"l:"+(t.group||"_default");case"area":return"a:"+(t.group||"_default");default:return null}}function Ye(e,t,n,o,r,i){const s=[];for(const r of e){const e=n(r),i=o(r);Number.isFinite(e)&&Number.isFinite(i)&&s.push({px:t.x(e),py:t.y(i),rawY:i,d:r})}s.sort((e,t)=>e.px-t.px);const a=Array(s.length),l=Array(s.length),c=Array(s.length);for(let e=0;s.length>e;e++){const t=s[e];a[e]=[t.px,t.py],l[e]=t.rawY,c[e]=t.d}return{type:"line",path:a,rawValues:l,style:r,datum:c,group:i}}function Ge(e,t,n,o,r,i,s,a){const l=[];for(const i of e){const e=n(i),s=o(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;const c=t.x(e),u=a?a(i):r;l.push({px:c,topY:t.y(s),botY:t.y(u)})}l.sort((e,t)=>e.px-t.px);const c=Array(l.length),u=Array(l.length);for(let e=0;l.length>e;e++){const t=l[e];c[e]=[t.px,t.topY],u[e]=[t.px,t.botY]}return{type:"area",topPath:c,bottomPath:u,style:i,datum:e,group:s}}function qe(e,t,n,o){const r=new Map;if("silhouette"===o)for(const o of e){let e=0;for(const r of t)e+=n(r,o)||0;r.set(o,-e/2)}else if("wiggle"===o){e.length>0&&r.set(e[0],0);for(let o=1;e.length>o;o++){const i=e[o-1],s=e[o];let a=0,l=0,c=0;for(const e of t){const t=n(e,s)||0;a+=(2*c+t)*(t-(n(e,i)||0)),l+=t,c+=t}const u=r.get(i)??0;r.set(s,u-(l>0?a/(2*l):0))}if(e.length>0){let o=0;for(const i of e){let e=0;for(const o of t)e+=n(o,i)||0;o+=(r.get(i)??0)+e/2}const i=o/e.length;for(const t of e)r.set(t,(r.get(t)??0)-i)}}else for(const t of e)r.set(t,0);return r}function Ve(e,t,n,o,r,i,s){const a=n(e),l=o(e);if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c={type:"point",x:t.x(a),y:t.y(l),r:r,style:i,datum:e};return void 0!==s&&(c.pointId=s),c}function Xe(e,t,n,o,r,i,s,a){const l=n(e),c=o(e);if(!Number.isFinite(l)||!Number.isFinite(c))return null;const u={type:"symbol",x:t.x(l),y:t.y(c),size:r,symbolType:i,style:s,datum:e};return void 0!==a&&(u.pointId=a),u}function Ue(e,t,n,o,r,i,s){return{type:"rect",x:e,y:t,w:n,h:o,style:r,datum:i,group:s}}function Ke(e,t,n,o,r,i,s){const a={type:"heatcell",x:e,y:t,w:n,h:o,fill:r,datum:i};return s?.showValues&&(a.showValues=!0,a.value=s.value,s.valueFormat&&(a.valueFormat=s.valueFormat)),a}function Qe(e,t,n,o){return"function"==typeof t.style?t.style(o||{},n):t.style&&"object"==typeof t.style?t.style:e.resolveBoundsStyle(n,o)}function Ze(e,t,n,o){if(!e.scales)return null;const r=[],i=[];for(const n of t){const t=e.getX(n);if(!Number.isFinite(t))continue;const s=o.getTop(n),a=o.getBottom(n);if(!Number.isFinite(s)||!Number.isFinite(a))continue;const l=e.scales.x(t),c=e.scales.y(s),u=e.scales.y(a);Number.isFinite(l)&&Number.isFinite(c)&&Number.isFinite(u)&&(r.push([l,c]),i.push([l,u]))}return 2>r.length?null:{type:"area",topPath:r,bottomPath:i,style:Qe(e,o,n,t[0]),datum:t,group:n,interactive:o.interactive}}function Je(e){const t=[],n=[];if(!e)return{perSeries:t,aggregate:n};for(const o of e)o.perSeries?t.push(o):n.push(o);return{perSeries:t,aggregate:n}}function et(e,t,n){const o=[];for(const r of n){const n=Ze(e,t,"__ribbon_aggregate",r);n&&o.push(n)}return o}function tt(e,t,n,o){const r=[];for(const i of o){const o=Ze(e,t,n,i);o&&r.push(o)}return r}function nt(e,t){if(!e)return{};if(!t||0===t.length)return e;const n=[];for(const o of t){if("band"!==o.kind)continue;const t=o.getTop(e),r=o.getBottom(e);Number.isFinite(r)&&Number.isFinite(t)&&n.push({y0:r,y1:t})}return 0===n.length?e:{...e,band:n[0],bands:n}}function ot(e,t,n,o){if(!e.config.pointStyle)return;const r=o??e.getY;for(const o of t){const t=e.resolveGroupColor(o.key);for(const i of o.data){let o=e.config.pointStyle(i);!o.fill&&t&&(o={...o,fill:t});const s=o.r??3,a=e.getPointId?e.getPointId(i)+"":void 0,l=Ve(i,e.scales,e.getX,r,s,o,a);l&&n.push(l)}}}function rt(e){return"threshold"===e.type&&"string"==typeof e.color&&"number"==typeof e.value}var it={topOpacity:.8,bottomOpacity:.05};function st(e){if(e)return!0===e?it:"colorStops"in e?e:{topOpacity:e.topOpacity??it.topOpacity,bottomOpacity:e.bottomOpacity??it.bottomOpacity}}var at=require("d3-shape"),lt={circle:at.symbolCircle,square:at.symbolSquare,triangle:at.symbolTriangle,diamond:at.symbolDiamond,star:at.symbolStar,cross:at.symbolCross,wye:at.symbolWye},ct=["circle","triangle","diamond","star","square","chevron","cross","wye"];function ut(e,t,n){if(n)return n;const o=e??"circle";return"chevron"===o?function(e){const t=1.5*ht(e),n=.92*t;return`M0,${-t}L${n},${(.78*t).toFixed(3)}L0,${(.28*t).toFixed(3)}L${-n},${(.78*t).toFixed(3)}Z`}(t):(0,at.symbol)(lt[o]??at.symbolCircle,Math.max(1,t))()??""}function ht(e){return Math.sqrt(Math.max(1,e)/Math.PI)}var dt=new Map;function ft(e,t,n,o,r){const i=new Map;for(const s of e){const e=t(s),a=n(s);if(null==e||null==a||Number.isNaN(e)||Number.isNaN(a))continue;const l=Math.floor(e/o)*o;let c=i.get(l);if(c||(c={start:l,end:l+o,total:0,categories:new Map},i.set(l,c)),c.total+=a,r){const e=r(s);c.categories.set(e,(c.categories.get(e)||0)+a)}}return i}function pt(e){return null!=e&&!1!==e&&""!==e&&(!Array.isArray(e)||e.some(pt))}function yt(e,t,n){e.has(t)||(e.add(t),console.warn(n))}function mt(e,t){const n="function"==typeof e?e:n=>n[e||t];return e=>{const t=n(e);return null==t?NaN:+t}}function gt(e){const t=[],n=["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode,o=mt(n&&e.valueAccessor||e.yAccessor,n?"value":"y");if(e.boundsAccessor){const n=oe(e.boundsAccessor,"bounds");t.push({kind:"bounds",getTop:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t+r:t},getBottom:e=>{const t=o(e);if(!Number.isFinite(t))return NaN;const r=n(e);return Number.isFinite(r)&&0!==r?t-r:t},style:e.boundsStyle,perSeries:!0,interactive:!1})}if(e.band){const n=Array.isArray(e.band)?e.band:[e.band];for(const e of n)t.push({kind:"band",getTop:mt(e.y1Accessor,"y1"),getBottom:mt(e.y0Accessor,"y0"),style:e.style,perSeries:!1!==e.perSeries,interactive:!0===e.interactive})}return t}var xt=require("d3-scale");function bt(e,t){return t?[t[0]??e[0],t[1]??e[1]]:e}function vt(e,t,n){if("log"===e){const e=[Math.max(t[0],1e-6),Math.max(t[1],1e-6)];return(0,xt.scaleLog)().domain(e).range(n).clamp(!0)}return"symlog"===e?(0,xt.scaleSymlog)().domain(t).range(n):"time"===e?(0,xt.scaleTime)().domain([new Date(t[0]),new Date(t[1])]).range(n):(0,xt.scaleLinear)().domain(t).range(n)}function kt(e,t,n,o){const r=e.push(t);return n&&n.push(o),r}var wt=new WeakMap;var At={data:"data",domain:"domain",layout:"layout","scene-geometry":"sceneGeometry","scene-style":"sceneStyle","data-paint":"dataPaint","interaction-paint":"interactionPaint",overlay:"overlay",accessibility:"accessibility",evidence:"evidence"};function St(e,t){const n={...e};for(const e of t)n[At[e]]++;return n}function Ct(e,t,n){const o=new Set(t);return{changeSet:{...e,...e.keys?{keys:[...e.keys]}:{}},changed:o,revisions:St(n,o)}}var Mt=class{constructor(){this.revisions={data:0,domain:0,layout:0,sceneGeometry:0,sceneStyle:0,dataPaint:0,interactionPaint:0,overlay:0,accessibility:0,evidence:0},this.latest=Ct({kind:"initialize"},[],this.revisions),this.listeners=new Set}get last(){return this.latest}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}record(e,t){const n=Ct(e,t,this.revisions);this.revisions=n.revisions,this.latest=n;for(const e of[...this.listeners])e();return n}},jt=["data","domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],_t=["scene-style","data-paint","accessibility","evidence"],Rt=(e,t)=>({retainedData:e,invalidations:t}),Pt=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Lt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],It=["domain","layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Tt=["layout","scene-geometry","data-paint","overlay","accessibility","evidence"],Nt=["scene-geometry","data-paint","accessibility","evidence"],Ft=["scene-style","data-paint","accessibility","evidence"],Ot=[],Bt={chartType:Rt("rebuild",Pt),runtimeMode:Rt("rebuild",Pt),xAccessor:Rt("rebuild",Pt),yAccessor:Rt("rebuild",Pt),timeAccessor:Rt("rebuild",Pt),valueAccessor:Rt("rebuild",Pt),y0Accessor:Rt("rebuild",Pt),boundsAccessor:Rt("rebuild",Pt),band:Rt("rebuild",Pt),openAccessor:Rt("rebuild",Pt),highAccessor:Rt("rebuild",Pt),lowAccessor:Rt("rebuild",Pt),closeAccessor:Rt("rebuild",Pt),candlestickRangeMode:Rt("rebuild",Pt),accessorRevision:Rt("rebuild",Pt),groupAccessor:Rt("rebuild",Lt),categoryAccessor:Rt("rebuild",Lt),lineDataAccessor:Rt("rebuild",Lt),colorAccessor:Rt("rebuild",Ft),sizeAccessor:Rt("rebuild",Nt),symbolAccessor:Rt("rebuild",Nt),pointIdAccessor:Rt("rebuild",Nt),xScaleType:Rt("preserve",It),yScaleType:Rt("preserve",It),xExtent:Rt("preserve",It),yExtent:Rt("preserve",It),extentPadding:Rt("preserve",It),scalePadding:Rt("preserve",It),axisExtent:Rt("preserve",It),binSize:Rt("preserve",It),normalize:Rt("preserve",It),heatmapAggregation:Rt("preserve",It),heatmapXBins:Rt("preserve",It),heatmapYBins:Rt("preserve",It),arrowOfTime:Rt("preserve",Tt),baseline:Rt("preserve",Tt),stackOrder:Rt("preserve",Tt),sizeRange:Rt("preserve",Tt),curve:Rt("preserve",Tt),areaGroups:Rt("preserve",Tt),customLayout:Rt("preserve",Tt),layoutConfig:Rt("preserve",Tt),layoutMargin:Rt("preserve",Tt),symbolMap:Rt("preserve",Nt),showValues:Rt("preserve",Nt),heatmapValueFormat:Rt("preserve",Nt),lineStyle:Rt("preserve",Ft),pointStyle:Rt("preserve",Ft),areaStyle:Rt("preserve",Ft),barStyle:Rt("preserve",Ft),swarmStyle:Rt("preserve",Ft),waterfallStyle:Rt("preserve",Ft),candlestickStyle:Rt("preserve",Ft),boundsStyle:Rt("preserve",Ft),gradientFill:Rt("preserve",Ft),lineGradient:Rt("preserve",Ft),colorScheme:Rt("preserve",Ft),themeCategorical:Rt("preserve",Ft),themeSemantic:Rt("preserve",Ft),themeSequential:Rt("preserve",Ft),themeDiverging:Rt("preserve",Ft),barColors:Rt("preserve",Ft),decay:Rt("preserve",Ft),pulse:Rt("preserve",Ft),staleness:Rt("preserve",Ft),layoutSelection:Rt("preserve",Ft),annotations:Rt("preserve",["overlay","accessibility","evidence"]),windowSize:Rt("preserve",Ot),windowMode:Rt("preserve",Ot),maxCapacity:Rt("preserve",Ot),clock:Rt("preserve",Ot),transition:Rt("preserve",Ot),introAnimation:Rt("preserve",Ot),onLayoutError:Rt("preserve",Ot)},Dt=Rt("preserve",Tt),Wt=class{constructor(){this.tracker=new Mt}get last(){return this.tracker.last}subscribe(e){return this.tracker.subscribe(e)}recordData(e,t){return this.tracker.record({kind:e,...void 0===t?{}:{count:t}},jt)}recordNoop(e){return this.tracker.record({kind:e,..."restyle"===e?{}:{count:0}},[])}recordRestyle(e){return e?this.tracker.record({kind:"restyle"},_t):this.recordNoop("restyle")}recordConfig(e){const t=function(e){let t="preserve";const n=new Set;for(const o of e){const e=Bt[o]??Dt;"rebuild"===e.retainedData&&(t="rebuild");for(const t of e.invalidations)n.add(t)}return{retainedData:t,invalidations:n}}(e);return this.tracker.record({kind:"config",keys:e},t.invalidations)}},zt=require("d3-quadtree"),Ht=class{constructor(){this.maxRadius=0,this.tree=null}get quadtree(){return this.tree}get maxPointRadius(){return this.maxRadius}clear(){this.tree=null,this.maxRadius=0}rebuild(e,t){if("scatter"!==e&&"bubble"!==e&&"custom"!==e)return void this.clear();let n=0,o=0;for(const e of t)"point"===e.type&&(n++,e.r>o&&(o=e.r));if(this.maxRadius=o,500>=n)return void(this.tree=null);const r=Array(n);let i=0;for(const e of t)"point"===e.type&&(r[i++]=e);this.tree=(0,zt.quadtree)().x(e=>e.x).y(e=>e.y).addAll(r)}},Et=class e{constructor(e){if(this.xExtent=new te,this.yExtent=new te,this.growingCapacityWarned=!1,this.windowSizeWarned=!1,this.resolvedRibbons=[],this.timestampBuffer=null,this.activeTransition=null,this._hasRenderedOnce=!1,this.prevPositionMap=new Map,this.prevPathMap=new Map,this.exitNodes=[],this.lastIngestTime=0,this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this._ingestVersion=0,this._datumIndexCache=null,this._bufferArrayCache=null,this._bufferDirty=!0,this.needsFullRebuild=!0,this.lastLayout=null,this.updateResults=new Wt,this.scales=null,this.scene=[],this.version=0,this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customLayoutFailedThisBuild=!1,this._customLayoutDiagnosticsWarned=new Set,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.xIsDate=!1,this.spatialIndex=new Ht,this._lastBoundedInsertsRef=null,this.applyPulse=(e,t,n)=>!(!this.config.pulse||!this.timestampBuffer)&&function(e,t,n,o,r,i=("undefined"!=typeof performance?performance.now():Date.now())){const s=e.color??"rgba(255,255,255,0.6)",a=e.glowRadius??4;let l=!1;const c=r??(()=>{const e=new Map;for(let t=0;n.length>t;t++)e.set(n[t],t);return e})();for(const n of t){if("line"===n.type)continue;if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[n.datum];let r=0,a=!1;for(const n of t){const t=c.get(n);if(null==t)continue;a=!0;const s=o.get(t);if(null==s)continue;const l=He(e,s,i);l>r&&(r=l)}a&&(l=Ee(n,r,s)||l);continue}const t=c.get(n.datum);if(null==t)continue;const r=o.get(t);l=Ee(n,null==r?0:He(e,r,i),s,a)||l}return l}(this.config.pulse,e,t,this.timestampBuffer,this.getDatumIndexMap(t),n),this.config=e,this.buffer=new ee(e.windowSize),this.growingCap=e.windowSize,["bar","swarm","waterfall"].includes(e.chartType)||"streaming"===e.runtimeMode?(this.getX=oe(e.timeAccessor||e.xAccessor,"time"),this.getY=oe(e.valueAccessor||e.yAccessor,"value")):(this.getX=oe(e.xAccessor,"x"),this.getY=oe(e.yAccessor,"y")),this.getGroup=ie(e.groupAccessor),this.getCategory=ie(e.categoryAccessor),this.getSize=e.sizeAccessor?oe(e.sizeAccessor,"size"):void 0,this.getColor=ie(e.colorAccessor),this.getSymbol=ie(e.symbolAccessor),this.getY0=e.y0Accessor?oe(e.y0Accessor,"y0"):void 0,this.resolvedRibbons=gt(e),this.getPointId=ie(e.pointIdAccessor),"candlestick"===e.chartType){const t=null!=e.openAccessor,n=null!=e.closeAccessor;this.getOpen=t?oe(e.openAccessor,"open"):void 0,this.getHigh=oe(e.highAccessor,"high"),this.getLow=oe(e.lowAccessor,"low"),this.getClose=n?oe(e.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!t&&!n}e.pulse&&(this.timestampBuffer=new ee(e.windowSize))}currentTime(){return this.config.clock?.()??De()}syncPulseTimestampBuffer(){this.config.pulse?null!=this.timestampBuffer&&this.timestampBuffer.capacity===this.buffer.capacity&&this.timestampBuffer.size===this.buffer.size||(this.timestampBuffer=function(e,t){const n=new ee(e.capacity);return e.forEach(()=>n.push(t)),n}(this.buffer,this.currentTime())):this.timestampBuffer=null}pushDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.push(this.getHigh(e)),void this.yExtent.push(this.getLow(e));this.yExtent.push(this.getY(e)),this.getY0&&this.yExtent.push(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.push(n),Number.isFinite(o)&&this.yExtent.push(o)}}evictDatumYExtent(e){if("candlestick"===this.config.chartType&&this.getHigh&&this.getLow)return this.yExtent.evict(this.getHigh(e)),void this.yExtent.evict(this.getLow(e));this.yExtent.evict(this.getY(e)),this.getY0&&this.yExtent.evict(this.getY0(e));for(const t of this.resolvedRibbons){const n=t.getTop(e),o=t.getBottom(e);Number.isFinite(n)&&this.yExtent.evict(n),Number.isFinite(o)&&this.yExtent.evict(o)}}rebuildYExtent(){this.yExtent.clear();for(const e of this.buffer)this.pushDatumYExtent(e)}rebuildExtents(){this.xExtent.clear(),this.yExtent.clear();for(const e of this.buffer)this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e)}ingest(e){if(e.bounded&&this._lastBoundedInsertsRef===e.inserts)return this.updateResults.recordNoop("replace"),!1;const t=this.currentTime();if(this.lastIngestTime=t,this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,e.bounded){this._lastBoundedInsertsRef=e.inserts,this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this.timestampBuffer&&this.timestampBuffer.clear();const i=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode;if(this.getX=i?oe(this.config.timeAccessor||this.config.xAccessor,"time"):oe(this.config.xAccessor,"x"),this.xIsDate=!1,e.inserts.length>0){const t=e.inserts[0],n=this.config.xAccessor,o="function"==typeof n?n(t):t[n||"x"],r=o instanceof Date,i="string"==typeof o&&Number.isFinite(ae(o));if(this.xIsDate=r||i,i){const e="string"==typeof n?n:void 0;this.getX=e?t=>le(t[e]):e=>le(n(e))}}r=this.timestampBuffer,(o=e.totalSize||e.inserts.length)>(n=this.buffer).capacity&&(n.resize(o),r&&o>r.capacity&&r.resize(o));for(const n of e.inserts)kt(this.buffer,n,this.timestampBuffer,t),this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n)}else for(const n of e.inserts){if("growing"===this.config.windowMode&&this.buffer.full){const e=this.config.maxCapacity??1e5;e>this.growingCap&&(this.growingCap=Math.min(2*this.growingCap,e),this.buffer.resize(this.growingCap),this.timestampBuffer&&this.timestampBuffer.resize(this.growingCap),"production"===process.env.NODE_ENV||this.growingCapacityWarned||5e4>this.growingCap||(this.growingCapacityWarned=!0,console.warn(`[Semiotic] Growing window buffer reached ${this.growingCap} points (cap ${e}). Large canvas scenes are expensive — prefer a sliding window, aggregation, or an explicit maxCapacity if this is intentional.`)))}const e=kt(this.buffer,n,this.timestampBuffer,t);this.xExtent.push(this.getX(n)),this.pushDatumYExtent(n),null!=e&&(this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e))}var n,o,r;return this.updateResults.recordData(e.bounded?"replace":"ingest",e.inserts.length),!0}ingestWithResult(e){return this.ingest(e),this.updateResults.last}computeScene(e){const{config:t,buffer:n}=this,o=this.scales,r=this.lastLayout;if(!this.needsFullRebuild&&!t.customLayout&&this.lastLayout&&this.scene.length>0&&this.scales&&0>=(this.config.scalePadding??0)&&(this.lastLayout.width!==e.width||this.lastLayout.height!==e.height))return void this.remapScene(e);this.xExtent.dirty&&this.xExtent.recalculate(n,this.getX),this.yExtent.dirty&&this.rebuildYExtent();const i=this.getBufferArray(),s=this.yExtent.extent;let a=bt(this.xExtent.extent,t.xExtent),l=bt(s,t.yExtent);const c=!(!(u=t.yExtent)||null==u[0]||null==u[1]);var u;const h="exact"===t.axisExtent;if("stackedarea"===t.chartType&&!c&&n.size>0){const e=function(e){const{config:t,groups:n,getX:o,getY:r}=e,i="exact"===t.axisExtent;if(t.normalize){const n=[0,i?1:1+t.extentPadding];return{yDomain:n,stackExtentCache:{key:`${e.bufferSize}:${e.ingestVersion}:norm`,yDomain:n}}}const s=`${e.bufferSize}:${e.ingestVersion}:${t.baseline??"zero"}:${t.stackOrder??"key"}`;if(e.stackExtentCache&&e.stackExtentCache.key===s)return{yDomain:e.stackExtentCache.yDomain,stackExtentCache:e.stackExtentCache};const a=new Map,l=new Set;let c=0;const u=new Map,h=new Map;for(const e of n){const t=new Map;let n=0;for(const i of e.data){const e=o(i),s=r(i);if(!Number.isFinite(e)||!Number.isFinite(s))continue;t.set(e,(t.get(e)||0)+s),l.add(e),n+=s;const a=(u.get(e)||0)+s;u.set(e,a),a>c&&(c=a)}a.set(e.key,t),h.set(e.key,n)}const d=t.stackOrder??"key",f=(e,t)=>t>e?-1:e>t?1:0;let p,y;if("input"===d)p=n.map(e=>e.key);else if("insideOut"===d){const e=[...n].map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}),t=[],o=[];let r=0,i=0;for(const n of e)i>r?(t.push(n),r+=h.get(n)??0):(o.push(n),i+=h.get(n)??0);p=[...o.reverse(),...t]}else p="asc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(e)??0)-(h.get(t)??0);return 0!==n?n:f(e,t)}):"desc"===d?n.map(e=>e.key).sort((e,t)=>{const n=(h.get(t)??0)-(h.get(e)??0);return 0!==n?n:f(e,t)}):n.map(e=>e.key).sort(f);if("wiggle"===t.baseline||"silhouette"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),n=qe(e,p,(e,t)=>a.get(e)?.get(t)||0,t.baseline);let o=1/0,r=-1/0;for(const t of e){const e=n.get(t)??0,i=u.get(t)??0;o>e&&(o=e),e+i>r&&(r=e+i)}Number.isFinite(o)&&Number.isFinite(r)||(o=0,r=0);const s=r-o,c=i?0:s>0?s*t.extentPadding:1;y=[o-c,r+c]}else if("diverging"===t.baseline){const e=Array.from(l).sort((e,t)=>e-t),[n,o]=function(e,t,n){let o=0,r=0;for(const i of e){let e=0,s=0;for(const o of t){const t=n(o,i)||0;0>t?s+=t:e+=t}o>s&&(o=s),e>r&&(r=e)}return[o,r]}(e,p,(e,t)=>a.get(e)?.get(t)||0),r=o-n,s=i?0:r>0?r*t.extentPadding:1;y=[n-s,o+s]}else y=[0,c+(i?0:c>0?c*t.extentPadding:1)];return{yDomain:y,stackExtentCache:{key:s,yDomain:y}}}({config:t,groups:this.groupData(i),getX:this.getX,getY:this.getY,bufferSize:n.size,ingestVersion:this._ingestVersion,stackExtentCache:this._stackExtentCache});l=e.yDomain,this._stackExtentCache=e.stackExtentCache}else"bar"===t.chartType&&t.binSize&&!c&&n.size>0?l=function(e,t,n,o,r,i,s){const[,a]=function(e,t,n,o,r){const i=ft(e,t,n,o,r);if(0===i.size)return[0,0];let s=0;for(const e of i.values())e.total>s&&(s=e.total);return[0,s]}(e,t,n,o,r);return[0,s?a:a+a*i]}(n,this.getX,this.getY,t.binSize,this.getCategory,t.extentPadding,h):"waterfall"===t.chartType&&!c&&n.size>0?l=function(e,t,n,o){const[r,i]=function(e,t){let n=0,o=0,r=0;for(const i of e){const e=t(i);null==e||Number.isNaN(e)||(r+=e,n>r&&(n=r),r>o&&(o=r))}return[n,o]}(e,t),s=i-r,a=o?0:s>0?s*n:1;return[Math.min(0,r-Math.abs(a)),Math.max(0,i+Math.abs(a))]}(n,this.getY,t.extentPadding,h):c||l[0]===1/0||(l=function(e,t,n){if(!n.length)return e;let[o,r]=e;for(const e of t)for(const t of n){const n=t.getTop(e),i=t.getBottom(e);Number.isFinite(n)&&(o>n&&(o=n),n>r&&(r=n)),Number.isFinite(i)&&(o>i&&(o=i),i>r&&(r=i))}return[o,r]}(l,i,this.resolvedRibbons),l=function(e,t){const n=e[1]-e[0],o=t.exactMode?0:n>0?n*t.extentPadding:1,r=[null!=t.userMin?e[0]:e[0]-o,null!=t.userMax?e[1]:e[1]+o];return"log"!==t.yScaleType||r[0]>0||0>=t.dataYDomain[0]||t.exactMode||null==t.userMin&&(r[0]=t.dataYDomain[0]/(1+t.extentPadding)),r}(l,{exactMode:h,extentPadding:t.extentPadding,userMin:t.yExtent?.[0],userMax:t.yExtent?.[1],yScaleType:t.yScaleType,dataYDomain:s}));l=function(e,t,n){if(!t||n)return e;const o=t[0],r=t[1];return null==o&&null==r?e:[null!=o?o:e[0],null!=r?r:e[1]]}(l,t.yExtent,!!c),({xDomain:a,yDomain:l}=function(e,t,n){let o=e,r=t;if(o[0]===1/0||o[1]===-1/0)if("time"===n){const e=Date.now();o=[e-864e5,e]}else o=[0,1];return r[0]!==1/0&&r[1]!==-1/0||(r=[0,1]),{xDomain:o,yDomain:r}}(a,l,t.xScaleType)),this.scales=function(e){const{config:t,layout:n,xDomain:o,yDomain:r}=e,i="streaming"===t.runtimeMode,s=Math.max(0,Math.min(t.scalePadding||0,Math.min(n.width,n.height)/2-1));if(i){if("x"==("up"===(a=t.arrowOfTime)||"down"===a?"y":"x")){const e="right"===t.arrowOfTime?[s,n.width-s]:[n.width-s,s];return{x:(0,xt.scaleLinear)().domain(o).range(e),y:vt(t.yScaleType,r,[n.height-s,s])}}const e="down"===t.arrowOfTime?[s,n.height-s]:[n.height-s,s];return{x:vt(t.yScaleType,r,[s,n.width-s]),y:(0,xt.scaleLinear)().domain(o).range(e)}}var a;return{x:vt(t.xScaleType,o,[s,n.width-s]),y:vt(t.yScaleType,r,[n.height-s,s])}}({config:t,layout:e,xDomain:a,yDomain:l}),this._customLayoutFailedThisBuild=!1;const d=this.buildSceneNodes(e,i);if(this._customLayoutFailedThisBuild)return!0===this.lastCustomLayoutFailure?.preservedLastGoodScene?(this.scales=o,this.lastLayout=r):(this.scene=[],this.spatialIndex.rebuild(this.config.chartType,this.scene)),void(this.needsFullRebuild=!0);this.config.transition&&this.scene.length>0&&this.snapshotPositions(),this.scene=d,this.config.decay&&this.applyDecay(this.scene,i),this.config.pulse&&this.applyPulse(this.scene,i,this.currentTime()),this.config.transition&&!this._hasRenderedOnce&&this.scene.length>0&&(this.config.introAnimation&&this.synthesizeIntroPositions(),this._hasRenderedOnce=!0),this.config.transition&&(this.prevPositionMap.size>0||this.prevPathMap.size>0)&&this.startTransition(),this.spatialIndex.rebuild(this.config.chartType,this.scene),this.needsFullRebuild=!1,this.lastLayout={width:e.width,height:e.height},this.version++}get quadtree(){return this.spatialIndex.quadtree}get maxPointRadius(){return this.spatialIndex.maxPointRadius}remapScene(e){const t=e.width/this.lastLayout.width,n=e.height/this.lastLayout.height;for(const e of this.scene)switch(e.type){case"line":for(const o of e.path)o[0]*=t,o[1]*=n;break;case"area":for(const o of e.topPath)o[0]*=t,o[1]*=n;for(const o of e.bottomPath)o[0]*=t,o[1]*=n;e.clipRect&&(e.clipRect={x:e.clipRect.x*t,y:e.clipRect.y*n,width:e.clipRect.width*t,height:e.clipRect.height*n});break;case"point":case"glyph":e.x*=t,e.y*=n;break;case"rect":case"heatcell":e.x*=t,e.y*=n,e.w*=t,e.h*=n;break;case"candlestick":e.x*=t,e.openY*=n,e.closeY*=n,e.highY*=n,e.lowY*=n}const o=this.scales.x.domain(),r=this.scales.y.domain(),i=this.scales.x.range(),s=this.scales.y.range(),a=vt,l=Math.max(0,Math.min(this.config.scalePadding||0,Math.min(e.width,e.height)/2-1)),c=s[1]>s[0];this.scales={x:a(this.config.xScaleType,o,i[0]>i[1]?[e.width-l,l]:[l,e.width-l]),y:a(this.config.yScaleType,r,c?[l,e.height-l]:[e.height-l,l])},this.lastLayout={width:e.width,height:e.height},this.spatialIndex.rebuild(this.config.chartType,this.scene),this.version++}buildSceneNodes(e,t){const{config:n,scales:o}=this;if(!o)return[];if(n.customLayout){const r={data:t,scales:o,dimensions:{width:e.width,height:e.height,margin:n.layoutMargin??{top:0,right:0,bottom:0,left:0},plot:{x:0,y:0,width:e.width,height:e.height}},theme:{semantic:n.themeSemantic??{},categorical:n.themeCategorical??Le},resolveColor:(e,t)=>{const o=this.resolveGroupColor(e);if(o)return o;const r=this.resolveLineStyle(e,t);return r.stroke?r.stroke:"string"==typeof r.fill?r.fill:n.themeSemantic?.primary??"#4e79a7"},config:n.layoutConfig??{},selection:n.layoutSelection??null};let i;try{i=n.customLayout(r)}catch(e){const t=null!==this.lastCustomLayoutResult,o=function(e,t,n,o){const r=function(e){if(e instanceof Error)return{name:e.name||"Error",message:e.message||"Custom layout threw."};if("string"==typeof e)return{name:"Error",message:e};if(null==e)return{name:"Error",message:"Custom layout threw a nullish value."};try{return{name:"Error",message:e+""}}catch{return{name:"Error",message:"Custom layout threw a non-stringifiable value."}}}(t),i="network"===e?"customNetworkLayout":"customLayout";return{code:"CUSTOM_LAYOUT_ERROR",severity:"error",phase:"layout",component:e,source:i,message:`Semiotic ${e} ${i} failed: ${r.message}`,error:r,recovery:n?"preserved-last-good-scene":"empty-scene",preservedLastGoodScene:n,affectedRevision:o}}("xy",e,t,this.version);this.lastCustomLayoutFailure=o,this._customLayoutFailedThisBuild=!0,"production"!==process.env.NODE_ENV&&console.error("[semiotic] customLayout threw:",e);try{n.onLayoutError?.(o)}catch(e){"production"!==process.env.NODE_ENV&&console.error("[semiotic] onLayoutError threw:",e)}return t?this.scene:(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,[])}this.customLayoutOverlays=i.overlays??null,this.lastCustomLayoutResult=i,this.lastCustomLayoutFailure=null;const s=i.nodes??[];if(this._customRestyle=i.restyle,this.hasCustomRestyle=!!i.restyle,this.hasCustomRestyle){this._baseStyles=new WeakMap;for(const e of s)e.style&&this._baseStyles.set(e,e.style);this.applyCustomRestyle(s,n.layoutSelection??null)}return function(e){if("production"===process.env.NODE_ENV)return;const{label:t,nodes:n,overlays:o,warned:r}=e;pt(o)&&0===n.length&&yt(r,"overlay-only",`[semiotic] ${t} returned overlays but no data-bearing scene nodes. Overlays do not participate in hover, selection, transitions, SSR evidence, or accessibility tables. Emit at least one scene node with a datum, or mark the overlay-only chart as intentionally decorative.`),n.length>0&&n.every(e=>null==e.datum)&&yt(r,"null-datums",`[semiotic] ${t} returned scene nodes, but every scene-node datum is null. Hover, callbacks, selection, and tooltip helpers need data-bearing nodes. Attach a user-facing datum to each interactive node, or set interactive overlays outside the chart.`)}({label:"customLayout",nodes:s,overlays:this.customLayoutOverlays,warned:this._customLayoutDiagnosticsWarned}),s}if(this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,0===t.length)return[];const r={scales:o,config:n,getX:this.getX,getY:this.getY,getY0:this.getY0,getSize:this.getSize,getColor:this.getColor,getSymbol:this.getSymbol,getGroup:this.getGroup,getCategory:this.getCategory,getPointId:this.getPointId,ribbons:this.resolvedRibbons,getOpen:this.getOpen,getHigh:this.getHigh,getLow:this.getLow,getClose:this.getClose,resolveLineStyle:(e,t)=>this.resolveLineStyle(e,t),resolveAreaStyle:(e,t)=>this.resolveAreaStyle(e,t),resolveBoundsStyle:(e,t)=>this.resolveBoundsStyle(e,t),resolveColorMap:e=>this.resolveColorMap(e),resolveGroupColor:e=>this.resolveGroupColor(e),groupData:e=>this.groupData(e),barCategoryCache:this._barCategoryCache};switch(n.chartType){case"line":return function(e,t){const n=e.groupData(t),o=[],r=e.config.annotations?.filter(rt).map(e=>({value:e.value,color:e.color,thresholdType:e.thresholdType||"greater"}));if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Je(e.ribbons);if(i.length>0&&o.push(...et(e,t,i)),r.length>0)for(const t of n)o.push(...tt(e,t.data,t.key,r))}for(const t of n){const n=e.resolveLineStyle(t.key,t.data[0]),i=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);r&&r.length>0&&(i.colorThresholds=r),e.config.curve&&"linear"!==e.config.curve&&(i.curve=e.config.curve),e.config.lineGradient&&(i.strokeGradient=e.config.lineGradient),o.push(i)}return ot(e,n,o),o}(r,t);case"area":return function(e,t){const n=e.groupData(t),o=[];if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Je(e.ribbons);if(i.length>0&&o.push(...et(e,t,i)),r.length>0)for(const t of n)o.push(...tt(e,t.data,t.key,r))}const r=e.scales.y.domain()[0],i=e.getY0?t=>{const n=e.getY0(t);return null==n?r:n}:void 0;for(const t of n){const n=e.resolveAreaStyle(t.key,t.data[0]),s=Ge(t.data,e.scales,e.getX,e.getY,r,n,t.key,i),a=st(e.config.gradientFill);a&&(s.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(s.curve=e.config.curve),e.config.lineGradient&&(s.strokeGradient=e.config.lineGradient),o.push(s)}return ot(e,n,o),o}(r,t);case"mixed":return function(e,t){const n=e.groupData(t),o=[],r=e.config.areaGroups||new Set;if(e.ribbons&&e.ribbons.length>0){const{perSeries:r,aggregate:i}=Je(e.ribbons);if(i.length>0&&o.push(...et(e,t,i)),r.length>0)for(const t of n)o.push(...tt(e,t.data,t.key,r))}const i=e.scales.y.domain()[0],s=e.getY0?t=>{const n=e.getY0(t);return null==n?i:n}:void 0;for(const t of n)if(r.has(t.key)){const n=e.resolveAreaStyle(t.key,t.data[0]),r=Ge(t.data,e.scales,e.getX,e.getY,i,n,t.key,s),a=st(e.config.gradientFill);a&&(r.fillGradient=a),e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}else{const n=e.resolveLineStyle(t.key,t.data[0]),r=Ye(t.data,e.scales,e.getX,e.getY,n,t.key);e.config.curve&&"linear"!==e.config.curve&&(r.curve=e.config.curve),e.config.lineGradient&&(r.strokeGradient=e.config.lineGradient),o.push(r)}return ot(e,n,o),o}(r,t);case"stackedarea":return function(e,t){const n=e.groupData(t),o=e.config.stackOrder??"key",r=()=>n.sort((e,t)=>t.key>e.key?-1:e.key>t.key?1:0);if("input"===o);else if("key"===o)r();else if("asc"===o||"desc"===o||"insideOut"===o){const t=new Map;for(const o of n){let n=0;for(const t of o.data){const o=e.getX(t),r=e.getY(t);Number.isFinite(o)&&Number.isFinite(r)&&(n+=r)}t.set(o.key,n)}const r=(e,t)=>t>e?-1:e>t?1:0;if("asc"===o)n.sort((e,n)=>{const o=(t.get(e.key)??0)-(t.get(n.key)??0);return 0!==o?o:r(e.key,n.key)});else if("desc"===o)n.sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)});else{const e=[...n].sort((e,n)=>{const o=(t.get(n.key)??0)-(t.get(e.key)??0);return 0!==o?o:r(e.key,n.key)}),o=[],i=[];let s=0,a=0;for(const n of e)a>s?(o.push(n),s+=t.get(n.key)??0):(i.push(n),a+=t.get(n.key)??0);n.length=0,n.push(...i.reverse(),...o)}}else r();const i=e.config.curve&&"linear"!==e.config.curve?e.config.curve:void 0,s=e.config.normalize?"zero":e.config.baseline??"zero",{nodes:a,stackedTops:l}=function(e,t,n,o,r,i,s,a="zero"){const l=new Set;for(const t of e)for(const e of t.data){const t=n(e);Number.isFinite(t)&&l.add(t)}const c=Array.from(l).sort((e,t)=>e-t),u=new Map;for(const t of e){const e=new Map;for(const r of t.data){const t=n(r),i=o(r);Number.isFinite(t)&&Number.isFinite(i)&&e.set(t,(e.get(t)||0)+i)}u.set(t.key,e)}let h;if(i){h=new Map;for(const t of c){let n=0;for(const o of e)n+=u.get(o.key)?.get(t)||0;h.set(t,n||1)}}const d=qe(c,e.map(e=>e.key),(e,t)=>u.get(e)?.get(t)||0,a),f="diverging"===a&&!i,p=[],y=new Map,m=new Map,g=new Map,x=new Map;for(const e of c)m.set(e,d.get(e)??0),g.set(e,0),x.set(e,0);for(const n of e){const e=u.get(n.key),o=new Map;let a=[],l=[];const d=()=>{if(a.length>=2){const e={type:"area",topPath:a,bottomPath:l,style:r(n.key,n.data[0]),datum:n.data,group:n.key};s&&(e.curve=s),p.push(e)}a=[],l=[]};for(const n of c){const r=e.has(n);let s,c,u=r?e.get(n):0;if(i&&r&&(u/=h.get(n)),!r||!Number.isFinite(u)||0===u){d();continue}f?u>0?(s=g.get(n),c=s+u,g.set(n,c)):(s=x.get(n),c=s+u,x.set(n,c)):(s=m.get(n),c=s+u,m.set(n,c));const p=t.x(n);l.push([p,t.y(s)]),a.push([p,t.y(c)]),o.set(n,c)}d(),y.set(n.key,o)}return{nodes:p,stackedTops:y}}(n,e.scales,e.getX,e.getY,(t,n)=>e.resolveAreaStyle(t,n),e.config.normalize,i,s),c=a;if(e.config.pointStyle){const t=new WeakMap;for(const o of n){const n=l.get(o.key);if(n)for(const r of o.data){const o=e.getX(r),i=e.getY(r);null==o||Number.isNaN(o)||null==i||Number.isNaN(i)||!n.has(o)||t.set(r,n.get(o))}}const o=n=>t.get(n)??e.getY(n);ot(e,n,c,o)}return c}(r,t);case"scatter":case"bubble":return function(e,t){const n=[],o="bubble"===e.config.chartType?10:5,r=e.config.sizeRange||[3,15];let i=null;if(e.getSize&&!e.config.pointStyle){const n=t.map(t=>e.getSize(t)).filter(e=>null!=e&&!Number.isNaN(e));if(n.length>0){let e=1/0,t=-1/0;for(const o of n)e>o&&(e=o),o>t&&(t=o);i=n=>e===t?(r[0]+r[1])/2:r[0]+(n-e)/(t-e)*(r[1]-r[0])}}const s=e.getColor?e.resolveColorMap(t):null,a=e.config.themeSemantic?.primary||"#4e79a7",l=e.getSymbol,c=e.config.symbolMap,u=new Map;let h=0;const d=e=>{const t=c?.[e];if(t)return t;let n=u.get(e);return n||(n=ct[h%ct.length],h++,u.set(e,n)),n};for(const r of t){let t=e.config.pointStyle?e.config.pointStyle(r):{fill:a,opacity:.8},c=t.r||o;if(i&&e.getSize){const t=e.getSize(r);null==t||Number.isNaN(t)||(c=i(t))}if(s&&e.getColor&&!t.fill){const n=e.getColor(r);n&&s.has(n)&&(t={...t,fill:s.get(n)})}const u=e.getPointId?e.getPointId(r)+"":void 0;if(l){const o=d(l(r)+""),i=Xe(r,e.scales,e.getX,e.getY,Math.PI*c*c,o,t,u);i&&n.push(i)}else{const o=Ve(r,e.scales,e.getX,e.getY,c,t,u);o&&n.push(o)}}return n}(r,t);case"heatmap":return function(e,t,n){if(e.config.heatmapAggregation)return function(e,t,n){const o=Math.max(1,Math.floor(e.config.heatmapXBins??20)),r=Math.max(1,Math.floor(e.config.heatmapYBins??20)),i=e.config.heatmapAggregation??"count",s=oe(e.config.valueAccessor,"value");if(!e.scales||0===t.length)return[];const[a,l]=e.scales.x.domain(),[c,u]=e.scales.y.domain(),h=(l-a||1)/o,d=(u-c||1)/r,f=o*r;if(f>1e6)return[];const p=new Int32Array(f),y=new Float64Array(f);for(let n=0;t.length>n;n++){const i=t[n],l=e.getX(i),u=e.getY(i);if(!isFinite(l)||!isFinite(u))continue;const f=Math.min(Math.floor((l-a)/h),o-1),m=Math.min(Math.floor((u-c)/d),r-1);if(0>f||0>m)continue;const g=m*o+f;p[g]++;const x=s(i);y[g]+=isFinite(x)?x:0}let m=1/0,g=-1/0;for(let e=0;f>e;e++){if(0===p[e])continue;let t;switch(i){case"sum":t=y[e];break;case"mean":t=y[e]/p[e];break;default:t=p[e]}m>t&&(m=t),t>g&&(g=t)}if(!isFinite(m))return[];const x=g-m||1,b=n.width/o,v=n.height/r,k=e.config.showValues,w=e.config.heatmapValueFormat,A=[];for(let e=0;r>e;e++){const t=e*o;for(let n=0;o>n;n++){const o=t+n;if(0===p[o])continue;let s;switch(i){case"sum":s=y[o];break;case"mean":s=y[o]/p[o];break;default:s=p[o]}const l=(s-m)/x;A.push(Ke(n*b,(r-1-e)*v,b,v,`rgb(${220-(180*l+.5)|0},${220-(100*l+.5)|0},${255-(50*l+.5)|0})`,{xi:n,yi:e,value:s,count:p[o],sum:y[o],xCenter:a+(n+.5)*h,yCenter:c+(e+.5)*d,agg:i},k?{value:s,showValues:!0,valueFormat:w}:void 0))}}return A}(e,t,n);if(0===t.length)return[];const o=oe(e.config.valueAccessor,"value"),r=re(e.config.xAccessor,"x"),i=re(e.config.yAccessor,"y"),s=new Map,a=new Map,l=Array(t.length),c=Array(t.length);for(let e=0;t.length>e;e++){const n=t[e],o=r(n),u=i(n);l[e]=o,c[e]=u,s.has(o)||s.set(o,s.size),a.has(u)||a.set(u,a.size)}const u=s.size,h=a.size;if(0===u||0===h)return[];const d=Array.from(s.keys()),f=Array.from(a.keys()),p=d.every(e=>"number"==typeof e&&!isNaN(e)),y=f.every(e=>"number"==typeof e&&!isNaN(e));if(p){d.sort((e,t)=>Number(e)-Number(t)),s.clear();for(let e=0;d.length>e;e++)s.set(d[e],e)}if(y){f.sort((e,t)=>Number(e)-Number(t)),a.clear();for(let e=0;f.length>e;e++)a.set(f[e],e)}const m=new Float64Array(t.length),g=new Float64Array(t.length),x=Array(t.length),b=new Map;let v=0;for(let e=0;t.length>e;e++){const n=t[e],r=s.get(l[e]),i=a.get(c[e]);if(void 0===r||void 0===i)continue;const h=o(n),d=i*u+r,f=b.get(d);let p;void 0!==f?p=f:(p=v++,b.set(d,p)),m[p]=d,g[p]=h,x[p]=n}let k=1/0,w=-1/0;for(let e=0;v>e;e++){const t=g[e];isFinite(t)&&(k>t&&(k=t),t>w&&(w=t))}if(!isFinite(k)||!isFinite(w))return[];const A=function(e){const t=e in je?e:"blues";let n=dt.get(t);if(n)return n;n=Array(256);const o=_e(t);for(let e=0;256>e;e++)n[e]=o(e/255);return dt.set(t,n),n}("string"==typeof e.config.colorScheme?e.config.colorScheme:e.config.themeSequential||"blues"),S=255/(w-k||1),C=n.width/u,M=n.height/h,j=e.config.showValues,_=e.config.heatmapValueFormat,R=[];for(let e=0;v>e;e++){const t=g[e];if(!isFinite(t))continue;const n=m[e],o=n%u;R.push(Ke(o*C,(h-1-(n-o)/u)*M,C,M,A[Math.min((t-k)*S+.5|0,255)],x[e],j?{value:t,showValues:!0,valueFormat:_}:void 0))}return R}(r,t,e);case"bar":{const e=function(e,t){if(!e.config.binSize)return{nodes:[],binBoundaries:[]};const n=ft(t,e.getX,e.getY,e.config.binSize,e.getCategory);if(0===n.size)return{nodes:[],binBoundaries:[]};let o=null;if(e.getCategory){const t=new Set;for(const e of n.values())for(const n of e.categories.keys())t.add(n);const r=e.config.barColors?Object.keys(e.config.barColors):[],i=new Set(r),s=Array.from(t).filter(e=>!i.has(e)).sort(),a=r.filter(e=>t.has(e)),l=a.join("\0")+""+s.join("\0");e.barCategoryCache&&e.barCategoryCache.key===l?o=e.barCategoryCache.order:(o=[...a,...s],e.barCategoryCache={key:l,order:o})}const r=[],i=e.scales,[s,a]=i.x.domain(),l=e.config.barStyle,c=e.config.themeSemantic?.primary,u=l?.gap,h="number"!=typeof u||0>u?1:u,d={};l?.stroke&&(d.stroke=l.stroke),"number"==typeof l?.strokeWidth&&(d.strokeWidth=l.strokeWidth),"number"==typeof l?.opacity&&(d.opacity=l.opacity);for(const t of n.values()){const n=Math.max(t.start,s),u=Math.min(t.end,a);if(n>=u)continue;const f=i.x(n),p=i.x(u),y=Math.abs(p-f),m=y>h+1?h:0,g=Math.min(f,p)+m/2,x=Math.max(y-m,1);if(x>0)if(o&&t.categories.size>0){let n=0;for(const s of o){const o=t.categories.get(s)||0;if(0===o)continue;const a=i.y(n),u=i.y(n+o);r.push(Ue(g,Math.min(a,u),x,Math.abs(a-u),{fill:e.config.barColors?.[s]||l?.fill||c||"#4e79a7",...d},{binStart:t.start,binEnd:t.end,total:t.total,category:s,categoryValue:o},s)),n+=o}}else{const e=i.y(0),n=i.y(t.total);r.push(Ue(g,Math.min(e,n),x,Math.abs(e-n),{fill:l?.fill||c||"#007bff",...d},{binStart:t.start,binEnd:t.end,total:t.total}))}}const f=new Set;for(const e of n.values())f.add(e.start),f.add(e.end);return{nodes:r,binBoundaries:Array.from(f).sort((e,t)=>e-t)}}(r,t);return this._barCategoryCache=r.barCategoryCache??null,this._binBoundaries=e.binBoundaries,e.nodes}case"swarm":return function(e,t){const n=[],o=e.config.swarmStyle||{},r=o.radius??3,i=o.fill??e.config.themeSemantic?.primary??"#007bff",s=o.opacity??.7,a=o.stroke,l=o.strokeWidth;for(const o of t){const t=e.getX(o),c=e.getY(o);if(null==c||Number.isNaN(c))continue;const u=e.scales.x(t),h=e.scales.y(c);let d=i;if(e.getCategory){const t=e.getCategory(o);d=e.config.barColors?.[t]||d}const{r:f,...p}=e.config.pointStyle?.(o)??{},y={type:"point",x:u,y:h,r:f??r,style:{fill:d,opacity:s,stroke:a,strokeWidth:l,...p},datum:o};e.getPointId&&(y.pointId=e.getPointId(o)+""),n.push(y)}return n}(r,t);case"waterfall":return function(e,t,n){const o=[],r=e.scales,i=e.config.waterfallStyle,s=t.filter(t=>{const n=e.getY(t),o=e.getX(t);return null!=n&&!Number.isNaN(n)&&null!=o&&isFinite(o)});if(0===s.length)return o;const a=i?.positiveColor??e.config.themeSemantic?.success??"#28a745",l=i?.negativeColor??e.config.themeSemantic?.danger??"#dc3545",c=i?.gap??1,u=i?.stroke,h=i?.strokeWidth,d=i?.opacity;let f=0;for(let t=0;s.length>t;t++){const p=s[t],y=e.getX(p),m=e.getY(p),g=f+m;let x;x=s.length-1>t?e.getX(s[t+1])-y:t>0?y-e.getX(s[t-1]):0;const b=r.x(y),v=0!==x?r.x(y+x):b+n.width/10,k=Math.min(b,v)+c/2,w=Math.max(b,v)-c/2-k;if(0>=w){f=g;continue}const A=r.y(f),S=r.y(g),C=Math.min(A,S),M=Math.abs(A-S),j={fill:0>m?l:a,stroke:u,strokeWidth:h};null!=d&&(j.opacity=d),o.push(Ue(k,C,w,M,j,{...p,baseline:f,cumEnd:g,delta:m,_connectorStroke:i?.connectorStroke,_connectorWidth:i?.connectorWidth})),f=g}return o}(r,t,e);case"candlestick":return function(e,t){if(!e.getHigh||!e.getLow||!e.scales)return[];const n=e.config.candlestickRangeMode??!1;if(!(n||e.getOpen&&e.getClose))return[];const o=[],r=e.config.candlestickStyle||{},i=r.rangeColor||"#6366f1",s=n?i:r.upColor||"#28a745",a=n?i:r.downColor||"#dc3545",l=n?i:r.wickColor||"#333",c=r.wickWidth||(n?2:1),u=t.map(t=>e.getX(t)).filter(e=>null!=e&&!Number.isNaN(e)).sort((e,t)=>e-t);let h=r.bodyWidth??0;if(null==r.bodyWidth)if(u.length>1){let t=1/0;for(let n=1;u.length>n;n++){const o=Math.abs(e.scales.x(u[n])-e.scales.x(u[n-1]));o>0&&t>o&&(t=o)}h=t!==1/0?Math.max(2,Math.min(.6*t,20)):6}else h=6;for(const r of t){const t=e.getX(r);if(null==t||Number.isNaN(t))continue;const i=e.getHigh(r),u=e.getLow(r);if(null==i||Number.isNaN(i)||null==u||Number.isNaN(u))continue;const d=n?i:e.getOpen(r),f=n?u:e.getClose(r);if(!n&&[d,f].some(e=>null==e||Number.isNaN(e)))continue;const p=f>=d,y={type:"candlestick",x:e.scales.x(t),openY:e.scales.y(d),closeY:e.scales.y(f),highY:e.scales.y(i),lowY:e.scales.y(u),bodyWidth:h,upColor:s,downColor:a,wickColor:l,wickWidth:c,isUp:p,datum:r};n&&(y.isRange=!0),o.push(y)}return o}(r,t);default:return[]}}resolveBoundsStyle(e,t){return function(e,t,n,o){const r=e.boundsStyle;return"function"==typeof r?r(n||{},t):r&&"object"==typeof r?r:{fill:o(t,n).stroke||e.themeSemantic?.primary||"#4e79a7",fillOpacity:.2,stroke:"none"}}(this.config,e,t,(e,t)=>this.resolveLineStyle(e,t))}computeDecayOpacity(e,t){const n=this.config.decay;return n&&t>1?We(n,e,t):1}getDatumIndexMap(e){if(this._datumIndexCache&&this._datumIndexCache.version===this._ingestVersion)return this._datumIndexCache.map;const t=ze(e);return this._datumIndexCache={version:this._ingestVersion,map:t},t}applyDecay(e,t){this.config.decay&&function(e,t,n,o=ze(n)){const r=n.length;if(r>1)for(const n of t){if("line"===n.type){const t=Array.isArray(n.datum)?n.datum:[];if(2>t.length)continue;const i=Array(t.length);let s=!1;for(let n=0;t.length>n;n++){const a=o.get(t[n]);null!=a?(i[n]=We(e,a,r),1>i[n]&&(s=!0)):i[n]=1}s&&(n._decayOpacities=i);continue}if("area"===n.type){const t=Array.isArray(n.datum)?n.datum:[],i=n.topPath?n.topPath.length:t.length;if(2>i)continue;if(t.length===i){const s=Array(i);let a=!1;for(let n=0;t.length>n;n++){const i=o.get(t[n]);null!=i?(s[n]=We(e,i,r),1>s[n]&&(a=!0)):s[n]=1}a&&(n._decayOpacities=s)}else{let s=1;for(const n of t){const t=o.get(n);if(null!=t){const n=We(e,t,r);s>n&&(s=n)}}if(1>s){const e=Array(i);e.fill(s),n._decayOpacities=e}}continue}const t=o.get(n.datum);if(null==t)continue;const i=We(e,t,r);"heatcell"===n.type?n.style={opacity:i}:"candlestick"===n.type?n._decayOpacity=i:n.style={...n.style,opacity:(n.style?.opacity??1)*i}}}(this.config.decay,e,t,this.getDatumIndexMap(t))}refreshPulse(e){return!0!==this.lastCustomLayoutFailure?.preservedLastGoodScene&&this.applyPulse(this.scene,this.getBufferArray(),e)}hasActivePulsesAt(e){return!!this.config.pulse&&function(e,t,n=("undefined"!=typeof performance?performance.now():Date.now())){if(!t||0===t.size)return!1;const o=e.duration??500,r=t.peek();return null!=r&&o>n-r}(this.config.pulse,this.timestampBuffer,e)}get hasActivePulses(){return this.hasActivePulsesAt(this.currentTime())}get transitionContext(){return{runtimeMode:this.config.runtimeMode,getX:this.getX,getY:this.getY,getCategory:this.getCategory}}snapshotPositions(){!function(e,t,n,o){n.clear(),o.clear();for(let r=0;t.length>r;r++){const i=t[r],s=$e(e,i,r);s&&("point"===i.type?n.set(s,{x:i.x,y:i.y,r:i.r,opacity:i.style.opacity}):"glyph"===i.type?n.set(s,{x:i.x,y:i.y,r:i.size,opacity:i.style.opacity,glyph:i.glyph}):"rect"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style.opacity}):"heatcell"===i.type?n.set(s,{x:i.x,y:i.y,w:i.w,h:i.h,opacity:i.style?.opacity}):"candlestick"===i.type?n.set(s,{x:i.x,y:i.openY,w:i.bodyWidth,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY,opacity:i.style?.opacity}):"line"===i.type?o.set(s,{path:i.path.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}):"area"===i.type&&o.set(s,{topPath:i.topPath.map(e=>[e[0],e[1]]),bottomPath:i.bottomPath.map(e=>[e[0],e[1]]),opacity:i.style?.opacity}))}}(this.transitionContext,this.scene,this.prevPositionMap,this.prevPathMap)}synthesizeIntroPositions(){this.prevPositionMap.clear(),this.prevPathMap.clear();const e=this.scales?.y(0)??0;for(let t=0;this.scene.length>t;t++){const n=this.scene[t],o=$e(this.transitionContext,n,t);o&&("point"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,r:0,opacity:0}):"rect"===n.type?this.prevPositionMap.set(o,{x:n.x,y:e,w:n.w,h:0,opacity:n.style.opacity??1}):"heatcell"===n.type?this.prevPositionMap.set(o,{x:n.x,y:n.y,w:n.w,h:n.h,opacity:0}):"line"===n.type?(n._introClipFraction=0,this.prevPathMap.set(o,{path:n.path.map(e=>[e[0],e[1]]),opacity:n.style.opacity})):"area"===n.type&&(n._introClipFraction=0,this.prevPathMap.set(o,{topPath:n.topPath.map(e=>[e[0],e[1]]),bottomPath:n.bottomPath.map(e=>[e[0],e[1]]),opacity:n.style.opacity})))}}startTransition(){if(!this.config.transition)return;const e=function(e,t,n,o,r,i=De()){if(0===o.size&&0===r.size)return n;const s=t.duration??300;if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}let a=!1;const l=new Set,c=new Set;for(let t=0;n.scene.length>t;t++){const i=n.scene[t],s=$e(e,i,t);if(!s)continue;if(i._transitionKey=s,"line"===i.type||"area"===i.type){const e=r.get(s);if(e){if(c.add(s),"line"===i.type&&e.path&&e.path.length===i.path.length){i._targetPath=i.path.map(e=>[e[0],e[1]]),i._prevPath=e.path;for(let t=0;i.path.length>t;t++)i.path[t]=[e.path[t][0],e.path[t][1]];a=!0}else if("area"===i.type&&e.topPath&&e.bottomPath&&e.topPath.length===i.topPath.length&&e.bottomPath.length===i.bottomPath.length){i._targetTopPath=i.topPath.map(e=>[e[0],e[1]]),i._targetBottomPath=i.bottomPath.map(e=>[e[0],e[1]]),i._prevTopPath=e.topPath,i._prevBottomPath=e.bottomPath;for(let t=0;i.topPath.length>t;t++)i.topPath[t]=[e.topPath[t][0],e.topPath[t][1]];for(let t=0;i.bottomPath.length>t;t++)i.bottomPath[t]=[e.bottomPath[t][0],e.bottomPath[t][1]];a=!0}i._targetOpacity=i.style.opacity??1,i._startOpacity=e.opacity??i.style.opacity??1}else i._targetOpacity=i.style.opacity??1,i._startOpacity=0,i.style={...i.style,opacity:0},a=!0;continue}const u=o.get(s);if("point"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,r:i.r};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.r||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.r,i.x=u.x,i.y=u.y,i.r=u.r??i.r,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("glyph"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,size:i.size};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.r===e.size||(i._targetX=e.x,i._targetY=e.y,i._targetR=e.size,i.x=u.x,i.y=u.y,i.size=u.r??i.size,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("rect"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style.opacity??1,i.style={...i.style,opacity:0},a=!0;else if("heatcell"===i.type)if(u){l.add(s);const e={x:i.x,y:i.y,w:i.w,h:i.h};i._targetOpacity=i.style?.opacity??1,u.x===e.x&&u.y===e.y&&u.w===e.w&&u.h===e.h||(i._targetX=e.x,i._targetY=e.y,i._targetW=e.w,i._targetH=e.h,i.x=u.x,i.y=u.y,i.w=u.w??i.w,i.h=u.h??i.h,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0;else if("candlestick"===i.type)if(u&&null!=u.openY){l.add(s);const e={x:i.x,openY:i.openY,closeY:i.closeY,highY:i.highY,lowY:i.lowY};i._targetOpacity=i.style?.opacity??1,(u.x!==e.x||u.openY!==e.openY||u.closeY!==e.closeY||u.highY!==e.highY||u.lowY!==e.lowY)&&(i._targetX=e.x,i._targetOpenY=e.openY,i._targetCloseY=e.closeY,i._targetHighY=e.highY,i._targetLowY=e.lowY,i.x=u.x,i.openY=u.openY,i.closeY=u.closeY??i.closeY,i.highY=u.highY??i.highY,i.lowY=u.lowY??i.lowY,a=!0)}else i._targetOpacity=i.style?.opacity??1,i.style={...i.style||{},opacity:0},a=!0}for(const[e,t]of r)if(!c.has(e))if(e.startsWith("l:")&&t.path){const o={type:"line",path:t.path.map(e=>[e[0],e[1]]),group:e.slice(2),style:{stroke:"#999",strokeWidth:1,opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}else if(e.startsWith("a:")&&t.topPath&&t.bottomPath){const o={type:"area",topPath:t.topPath.map(e=>[e[0],e[1]]),bottomPath:t.bottomPath.map(e=>[e[0],e[1]]),group:e.slice(2),style:{fill:"#999",opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e,datum:null};n.exitNodes.push(o),a=!0}for(const[e,t]of o)if(!l.has(e)){if(e.startsWith("p:"))n.exitNodes.push({type:"point",x:t.x,y:t.y,r:t.r??3,style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("g:")&&t.glyph)n.exitNodes.push({type:"glyph",x:t.x,y:t.y,size:t.r??12,glyph:t.glyph,color:"#999",accent:"#999",style:{opacity:t.opacity??1},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("r:"))n.exitNodes.push({type:"rect",x:t.x,y:t.y,w:t.w??0,h:t.h??0,style:{opacity:t.opacity??1,fill:"#999"},datum:null,_targetOpacity:0,_transitionKey:e});else if(e.startsWith("h:"))n.exitNodes.push({type:"heatcell",x:t.x,y:t.y,w:t.w??0,h:t.h??0,fill:"#999",datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e});else if(e.startsWith("c:")){const o=t.openY??t.y;n.exitNodes.push({type:"candlestick",x:t.x,openY:o,closeY:t.closeY??o,highY:t.highY??o,lowY:t.lowY??o,bodyWidth:t.w??6,upColor:"#999",downColor:"#999",wickColor:"#999",wickWidth:1,isUp:!0,datum:null,style:{opacity:t.opacity??1},_targetOpacity:0,_transitionKey:e})}a=!0}return n.exitNodes.length>0&&(n.scene=[...n.scene,...n.exitNodes]),a&&(n.activeTransition={startTime:i,duration:s}),n}(this.transitionContext,this.config.transition,{scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},this.prevPositionMap,this.prevPathMap,this.currentTime());this.scene=e.scene,this.exitNodes=e.exitNodes,this.activeTransition=e.activeTransition}advanceTransition(e){if(!this.activeTransition||!this.config.transition)return!1;const t={scene:this.scene,exitNodes:this.exitNodes,activeTransition:this.activeTransition},n=function(e,t,n,o){if(!n.activeTransition)return!1;const r=function(e,t){return Math.min((e-t.startTime)/t.duration,1)}(e,n.activeTransition),i=function(e,t="ease-out-cubic"){return"linear"===t?e:1-Math.pow(1-e,3)}(r,"linear"===t.easing?"linear":"ease-out-cubic");for(const e of n.scene){const t=e._transitionKey;if("point"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Be(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Be(n.x,e._targetX,i),e.y=Be(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.r=Be(n.r,e._targetR,i))}else if("glyph"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Be(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Be(n.x,e._targetX,i),e.y=Be(n.y,e._targetY,i),void 0!==e._targetR&&void 0!==n.r&&(e.size=Be(n.r,e._targetR,i))}else if("rect"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style.opacity=Be(n?n.opacity??1:0,e._targetOpacity,i)}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Be(n.x,e._targetX,i),e.y=Be(n.y,e._targetY,i),void 0!==n.w&&(e.w=Be(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Be(n.h,e._targetH,i))}else if("heatcell"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Be(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Be(n.x,e._targetX,i),e.y=Be(n.y,e._targetY,i),void 0!==n.w&&(e.w=Be(n.w,e._targetW,i)),void 0!==n.h&&(e.h=Be(n.h,e._targetH,i))}else if("candlestick"===e.type){if(void 0!==e._targetOpacity){const n=t?o.get(t):void 0;e.style={...e.style||{},opacity:Be(n?n.opacity??1:0,e._targetOpacity,i)}}if(void 0===e._targetX)continue;if(!t)continue;const n=o.get(t);if(!n)continue;e.x=Be(n.x,e._targetX,i),void 0!==n.openY&&(e.openY=Be(n.openY,e._targetOpenY,i)),void 0!==n.closeY&&(e.closeY=Be(n.closeY,e._targetCloseY,i)),void 0!==n.highY&&(e.highY=Be(n.highY,e._targetHighY,i)),void 0!==n.lowY&&(e.lowY=Be(n.lowY,e._targetLowY,i))}else if("line"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Be(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevPath,n=e._targetPath;if(t&&n&&t.length===e.path.length)for(let o=0;e.path.length>o;o++)e.path[o][0]=Be(t[o][0],n[o][0],i),e.path[o][1]=Be(t[o][1],n[o][1],i)}else if("area"===e.type){void 0!==e._targetOpacity&&(e.style={...e.style,opacity:Be(e._startOpacity??0,e._targetOpacity,i)}),void 0!==e._introClipFraction&&(e._introClipFraction=i);const t=e._prevTopPath,n=e._prevBottomPath,o=e._targetTopPath,r=e._targetBottomPath;if(t&&o&&t.length===e.topPath.length)for(let n=0;e.topPath.length>n;n++)e.topPath[n][0]=Be(t[n][0],o[n][0],i),e.topPath[n][1]=Be(t[n][1],o[n][1],i);if(n&&r&&n.length===e.bottomPath.length)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t][0]=Be(n[t][0],r[t][0],i),e.bottomPath[t][1]=Be(n[t][1],r[t][1],i)}}if(r>=1){for(const e of n.scene){if(void 0!==e._targetOpacity){const t=e._targetOpacity;e.style="line"===e.type||"area"===e.type?{...e.style,opacity:0===t?0:t}:{...e.style||{},opacity:0===t?0:t},e._targetOpacity=void 0}if("point"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.r=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("glyph"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,void 0!==e._targetR&&(e.size=e._targetR),e._targetX=void 0,e._targetY=void 0,e._targetR=void 0}else if("rect"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("heatcell"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,e.y=e._targetY,e.w=e._targetW,e.h=e._targetH,e._targetX=void 0,e._targetY=void 0,e._targetW=void 0,e._targetH=void 0}else if("candlestick"===e.type){if(void 0===e._targetX)continue;e.x=e._targetX,void 0!==e._targetOpenY&&(e.openY=e._targetOpenY),void 0!==e._targetCloseY&&(e.closeY=e._targetCloseY),void 0!==e._targetHighY&&(e.highY=e._targetHighY),void 0!==e._targetLowY&&(e.lowY=e._targetLowY),e._targetX=void 0,e._targetOpenY=void 0,e._targetCloseY=void 0,e._targetHighY=void 0,e._targetLowY=void 0}else if("line"===e.type){const t=e._targetPath;if(t)for(let n=0;e.path.length>n;n++)e.path[n]=t[n];e._prevPath=void 0,e._targetPath=void 0,e._introClipFraction=void 0}else if("area"===e.type){const t=e._targetTopPath,n=e._targetBottomPath;if(t)for(let n=0;e.topPath.length>n;n++)e.topPath[n]=t[n];if(n)for(let t=0;e.bottomPath.length>t;t++)e.bottomPath[t]=n[t];e._prevTopPath=void 0,e._prevBottomPath=void 0,e._targetTopPath=void 0,e._targetBottomPath=void 0,e._introClipFraction=void 0}}if(n.exitNodes.length>0){const e=new Set(n.exitNodes);n.scene=n.scene.filter(t=>!e.has(t)),n.exitNodes=[]}return n.activeTransition=null,!1}return!0}(e,this.config.transition,t,this.prevPositionMap);return this.scene=t.scene,this.exitNodes=t.exitNodes,this.activeTransition=t.activeTransition,n}cancelIntroAnimation(){this.prevPositionMap.clear(),this.prevPathMap.clear(),this.activeTransition=null;for(const e of this.scene)"line"!==e.type&&"area"!==e.type||(e._introClipFraction=void 0)}groupData(e){const{result:t,cache:n}=function(e,t,n,o){if(o&&o.version===n&&o.group===t&&o.data===e)return{result:o.result,cache:o};let r;if(t){const n=new Map;for(const o of e){const e=t(o);n.has(e)||n.set(e,[]),n.get(e).push(o)}r=Array.from(n.entries()).map(([e,t])=>({key:e,data:t}))}else r=[{key:"_default",data:e}];return{result:r,cache:{version:n,group:t,data:e,result:r}}}(e,this.getGroup,this._ingestVersion,this._groupDataCache);return this._groupDataCache=n,t}resolveColorMap(e){const{map:t,cache:n}=function(e,t,n,o,r){if(r&&r.version===o)return{map:r.map,cache:r};const i=new Set;if(t)for(const n of e){const e=t(n);e&&i.add(e)}const s=Array.from(i).sort(),a=s.join("\0");if(r&&r.key===a){const e={...r,version:o};return{map:e.map,cache:e}}const l=Array.isArray(n.colorScheme)?n.colorScheme:n.themeCategorical||Le,c=new Map;for(let e=0;s.length>e;e++)c.set(s[e],l[e%l.length]);return{map:c,cache:{key:a,map:c,version:o}}}(e,this.getColor,this.config,this._ingestVersion,this._colorMapCache);return this._colorMapCache=n,t}resolveLineStyle(e,t){return function(e,t,n,o){const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.stroke&&t){const n=o(t);if(n)return{...e,stroke:n}}return e}const i=e.themeSemantic?.primary;return r&&"object"==typeof r?{stroke:r.stroke||i||"#007bff",strokeWidth:r.strokeWidth||2,strokeDasharray:r.strokeDasharray,fill:r.fill,fillOpacity:r.fillOpacity,opacity:r.opacity}:{stroke:o(t)||i||"#007bff",strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveAreaStyle(e,t){return function(e,t,n,o){if(e.areaStyle){const r=e.areaStyle(n||{});if(r&&!r.fill&&t){const e=o(t);if(e)return{...r,fill:e,stroke:r.stroke||e}}return r}const r=e.lineStyle;if("function"==typeof r){const e=r(n||{},t);if(e&&!e.fill&&t){const n=o(t);if(n)return{...e,fill:n,stroke:e.stroke||n}}return e}const i=e.themeSemantic?.primary;if(r&&"object"==typeof r)return{fill:r.fill||r.stroke||i||"#4e79a7",fillOpacity:r.fillOpacity??.7,stroke:r.stroke||i||"#4e79a7",strokeWidth:r.strokeWidth||2};const s=o(t)||i||"#4e79a7";return{fill:s,fillOpacity:.7,stroke:s,strokeWidth:2}}(this.config,e,t,e=>this.resolveGroupColor(e))}resolveGroupColor(t){const{color:n,groupColorCounter:o}=function(e){const{group:t,colorMapCache:n,groupColorMap:o,groupColorMapCap:r,config:i}=e;let{groupColorCounter:s}=e;if(n){const e=n.map.get(t);if(e)return{color:e,groupColorCounter:s}}const a=o.get(t);if(a)return{color:a,groupColorCounter:s};const l=(Array.isArray(i.colorScheme)&&i.colorScheme.length>0?i.colorScheme:null)||(Array.isArray(i.themeCategorical)&&i.themeCategorical.length>0?i.themeCategorical:null)||Le;if(0===l.length)return{color:null,groupColorCounter:s};const c=l[s%l.length];if(s++,o.set(t,c),o.size>r){const e=o.keys().next().value;void 0!==e&&o.delete(e)}return{color:c,groupColorCounter:s}}({group:t,colorMapCache:this._colorMapCache,groupColorMap:this._groupColorMap,groupColorCounter:this._groupColorCounter,groupColorMapCap:e.GROUP_COLOR_MAP_CAP,config:this.config});return this._groupColorCounter=o,n}getBufferArray(){return!this._bufferDirty&&this._bufferArrayCache||(this._bufferArrayCache=this.buffer.toArray(),this._bufferDirty=!1),this._bufferArrayCache}getData(){return this.getBufferArray()}remove(e){if(!this.getPointId)throw Error("remove() requires pointIdAccessor to be configured");this.config.transition&&this.scene.length>0&&this.snapshotPositions();const t=ce(e),n=this.getPointId,o=e=>t.has(n(e));!function(e,t,n){if(!t||0===t.size)return;const o=new Set;if(e.forEach((e,t)=>{n(e)&&o.add(t)}),0===o.size)return;const r=t.toArray();t.clear();for(let e=0;r.length>e;e++)o.has(e)||t.push(r[e])}(this.buffer,this.timestampBuffer,o);const r=this.buffer.remove(o);if(0===r.length)return this.updateResults.recordNoop("remove"),r;for(const e of r)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("remove",r.length),r}update(e,t){if(!this.getPointId)throw Error("update() requires pointIdAccessor to be configured");const n=ce(e),o=this.getPointId,r=new Set;this.buffer.forEach((e,t)=>{n.has(o(e))&&r.add(t)});const i=this.buffer.update(e=>n.has(o(e)),t);if(0===i.length)return this.updateResults.recordNoop("update"),i;for(const e of i)this.xExtent.evict(this.getX(e)),this.evictDatumYExtent(e);return this.buffer.forEach((e,t)=>{r.has(t)&&(this.xExtent.push(this.getX(e)),this.pushDatumYExtent(e))}),this.needsFullRebuild=!0,this._bufferDirty=!0,this._ingestVersion++,this.lastIngestTime=this.currentTime(),this.updateResults.recordData("update",i.length),i}getBinBoundaries(){return this._binBoundaries}getExtents(){return this.xExtent.min===1/0?null:{x:this.xExtent.extent,y:this.yExtent.extent}}clear(){this.buffer.clear(),this.xExtent.clear(),this.yExtent.clear(),this._hasRenderedOnce=!1,this.timestampBuffer&&this.timestampBuffer.clear(),this.prevPositionMap.clear(),this.prevPathMap.clear(),this.exitNodes=[],this.activeTransition=null,this.lastIngestTime=0,this._lastBoundedInsertsRef=null,this.needsFullRebuild=!0,this._bufferDirty=!0,this._bufferArrayCache=null,this._datumIndexCache=null,this.lastLayout=null,this.scales=null,this.scene=[],this.customLayoutOverlays=null,this.lastCustomLayoutResult=null,this.lastCustomLayoutFailure=null,this._customRestyle=void 0,this.hasCustomRestyle=!1,this._baseStyles=new WeakMap,this.spatialIndex.clear(),this._colorMapCache=null,this._groupDataCache=null,this._groupColorMap=new Map,this._groupColorCounter=0,this._barCategoryCache=null,this._binBoundaries=[],this._stackExtentCache=null,this.version++,this.updateResults.recordData("clear")}get size(){return this.buffer.size}getBuffer(){return this.buffer}getXAccessor(){return this.getX}getYAccessor(){return this.getY}getCategoryAccessor(){return this.getCategory}applyCustomRestyle(e,t){const n=this._customRestyle;if(n)for(const o of e){const e=this._baseStyles.get(o)??o.style??{},r=n(o,t);o.style=r?{...e,...r}:e}}restyleScene(e){this._customRestyle?(this.applyCustomRestyle(this.scene,e),this.markStylePaintPending(),this.updateResults.recordRestyle(!0)):this.updateResults.recordRestyle(!1)}updateConfig(e){const t={...this.config},n=Object.keys(e).filter(n=>e[n]!==t[n]);"production"!==process.env.NODE_ENV&&!this.windowSizeWarned&&"windowSize"in e&&e.windowSize!==t.windowSize&&(this.windowSizeWarned=!0,console.warn(`[Semiotic] windowSize changed after mount (${t.windowSize} → ${e.windowSize}) but it is a mount-only setting — the ring buffer keeps its original capacity. Remount the chart (e.g. via a React key) to apply a new windowSize.`)),("colorScheme"in e||"themeCategorical"in e||"colorAccessor"in e)&&(this._colorMapCache=null,this._groupColorMap=new Map,this._groupColorCounter=0),("barColors"in e||"colorScheme"in e)&&(this._barCategoryCache=null),("normalize"in e||"extentPadding"in e||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e||"boundsAccessor"in e||"band"in e||"y0Accessor"in e||"openAccessor"in e||"highAccessor"in e||"lowAccessor"in e||"closeAccessor"in e||"groupAccessor"in e||"categoryAccessor"in e||"chartType"in e||"runtimeMode"in e)&&(this._stackExtentCache=null);let o=!1,r=!1;Object.assign(this.config,e),"pulse"in e&&this.syncPulseTimestampBuffer();const i="chartType"in e&&e.chartType!==t.chartType||"runtimeMode"in e&&e.runtimeMode!==t.runtimeMode;if(i||"xAccessor"in e||"yAccessor"in e||"timeAccessor"in e||"valueAccessor"in e){const e=["bar","swarm","waterfall"].includes(this.config.chartType)||"streaming"===this.config.runtimeMode,n=e&&this.config.valueAccessor||this.config.yAccessor,s=e&&t.valueAccessor||t.yAccessor,a=i||!ne(e&&this.config.timeAccessor||this.config.xAccessor,e&&t.timeAccessor||t.xAccessor),l=i||!ne(n,s);(a||l)&&(e?(this.getX=oe(this.config.timeAccessor||this.config.xAccessor,"time"),this.getY=oe(this.config.valueAccessor||this.config.yAccessor,"value")):(this.getX=oe(this.config.xAccessor,"x"),this.getY=oe(this.config.yAccessor,"y")),l&&this.resolvedRibbons.some(e=>"bounds"===e.kind)&&(this.resolvedRibbons=gt(this.config)),o=!0,r=!0)}if("groupAccessor"in e&&!ne(e.groupAccessor,t.groupAccessor)&&(this.getGroup=null!=this.config.groupAccessor?ie(this.config.groupAccessor):void 0,o=!0),"categoryAccessor"in e&&!ne(e.categoryAccessor,t.categoryAccessor)&&(this.getCategory=null!=this.config.categoryAccessor?ie(this.config.categoryAccessor):void 0,o=!0),"sizeAccessor"in e&&!ne(e.sizeAccessor,t.sizeAccessor)&&(this.getSize=this.config.sizeAccessor?oe(this.config.sizeAccessor,"size"):void 0,o=!0),"symbolAccessor"in e&&!ne(e.symbolAccessor,t.symbolAccessor)&&(this.getSymbol=null!=this.config.symbolAccessor?ie(this.config.symbolAccessor):void 0,o=!0),"colorAccessor"in e&&!ne(e.colorAccessor,t.colorAccessor)&&(this.getColor=null!=this.config.colorAccessor?ie(this.config.colorAccessor):void 0,o=!0),"y0Accessor"in e&&!ne(e.y0Accessor,t.y0Accessor)&&(this.getY0=this.config.y0Accessor?oe(this.config.y0Accessor,"y0"):void 0,o=!0,r=!0),("boundsAccessor"in e&&!ne(e.boundsAccessor,t.boundsAccessor)||"band"in e&&e.band!==t.band||"boundsStyle"in e&&e.boundsStyle!==t.boundsStyle)&&(this.resolvedRibbons=gt(this.config),o=!0,r=!0),"pointIdAccessor"in e&&!ne(e.pointIdAccessor,t.pointIdAccessor)&&(this.getPointId=null!=this.config.pointIdAccessor?ie(this.config.pointIdAccessor):void 0,o=!0),"candlestick"===this.config.chartType&&(i||"openAccessor"in e&&!ne(e.openAccessor,t.openAccessor)||"closeAccessor"in e&&!ne(e.closeAccessor,t.closeAccessor)||"highAccessor"in e&&!ne(e.highAccessor,t.highAccessor)||"lowAccessor"in e&&!ne(e.lowAccessor,t.lowAccessor))){const e=null!=this.config.openAccessor,t=null!=this.config.closeAccessor;this.getOpen=e?oe(this.config.openAccessor,"open"):void 0,this.getHigh=oe(this.config.highAccessor,"high"),this.getLow=oe(this.config.lowAccessor,"low"),this.getClose=t?oe(this.config.closeAccessor,"close"):void 0,this.config.candlestickRangeMode=!e&&!t,o=!0,r=!0}if("accessorRevision"in e&&e.accessorRevision!==t.accessorRevision&&(o=!0,r=!0),!o){const n=Object.keys(e).filter(e=>!e.endsWith("Accessor")&&"timeAccessor"!==e&&"valueAccessor"!==e);for(const r of n)if(e[r]!==t[r]){o=!0;break}}o&&(r&&this.rebuildExtents(),this.needsFullRebuild=!0),this.updateResults.recordConfig(n)}updateConfigWithResult(e){return this.updateConfig(e),this.updateResults.last}};Et.GROUP_COLOR_MAP_CAP=1e3;var $t=Et;Object.assign($t.prototype,{getLastUpdateResult:function(){return this.updateResults.last},getUpdateSnapshot:function(){return this.updateResults.last},subscribeUpdateResult:function(e){return this.updateResults.subscribe(e)},setLayoutSelection:function(e){this.config.layoutSelection=e},markStylePaintPending:function(){wt.set(this,!0)},consumeStylePaintPending:function(){const e=!0===wt.get(this);return wt.delete(this),e}});var Yt=require("react"),Gt={sceneGeometry:0,layout:0,domain:0};function qt(e){const{domain:t,layout:n,sceneGeometry:o}=e.revisions;return{domain:t,layout:n,sceneGeometry:o}}function Vt(e,t){return{sceneGeometry:Math.max(e.sceneGeometry,t.sceneGeometry),layout:Math.max(e.layout,t.layout),domain:Math.max(e.domain,t.domain)}}var Xt="production"!==process.env.NODE_ENV,Ut={revisions:Gt,signature:"",sawSignals:!1,wasUnconsumed:!1,warnUnconsumed:!1},Kt=class{constructor(e="scene host"){this.hostName=e,this.lastConsumed=Gt,this.lastObserved=Gt,this.lastDuplicateWarning="",this.lastUnconsumedWarning=""}observeUpdateResult(e){Xt&&(this.lastObserved=Vt(this.lastObserved,qt(e)))}beforeCompute(e,t){if(!Xt)return Ut;const n=Vt(qt(e),this.lastObserved),o=function(e){return`${e.sceneGeometry}|${e.layout}|${e.domain}`}(n),r=!((i=n).sceneGeometry===(s=this.lastConsumed).sceneGeometry&&i.layout===s.layout&&i.domain===s.domain);var i,s;return{revisions:n,signature:o,sawSignals:e.changed.has("scene-geometry")||e.changed.has("layout")||e.changed.has("domain"),wasUnconsumed:r,warnUnconsumed:!t&&r&&this.lastUnconsumedWarning!==o}}afterCompute(e,t,n){if(Xt){if(t&&e.wasUnconsumed&&(this.lastConsumed=e.revisions),e.warnUnconsumed&&!t)return console.warn(`[semiotic] ${this.hostName} observed scene-affecting revisions without a scene rebuild: ${e.signature}.`),void(this.lastUnconsumedWarning=e.signature);t&&e.sawSignals&&!e.wasUnconsumed&&!n&&this.lastDuplicateWarning!==e.signature?(console.warn(`[semiotic] ${this.hostName} performed scene rebuild with unchanged scene revisions: ${e.signature}.`),this.lastDuplicateWarning=e.signature):t&&!e.sawSignals&&(this.lastDuplicateWarning="")}}},Qt=(0,Yt.memo)(function({store:e,diagnostics:t}){return(0,Yt.useEffect)(()=>{const n=()=>t.observeUpdateResult(e.getUpdateSnapshot());return n(),e.subscribeUpdateResult(n)},[t,e]),null}),Zt=c(require("react"));function Jt(...e){const t=e.filter(e=>null!=e);return 0===t.length?null:1===t.length?t[0]:Zt.createElement(Zt.Fragment,null,...t)}var en=c(require("react")),tn=require("react/jsx-runtime"),nn={isActive:!1,predicate:()=>!0},on=en.createContext(null);function rn({value:e,children:t}){return(0,tn.jsx)(on.Provider,{value:e,children:t})}function sn(){return en.useContext(on)??nn}function an(e,t){return null!=e?(0,tn.jsx)(rn,{value:t,children:e}):e}var ln=require("react");function cn(e,t,n){return n.x>e||e>n.x+n.w||n.y>t||t>n.y+n.h?{hit:!1,cx:0,cy:0}:{hit:!0,cx:n.x+n.w/2,cy:n.y+n.h/2}}function un(e,t=30){return Math.max((e??4)+5,12,t)}function hn(e){return e instanceof Date?e:"number"==typeof e&&e>1e9?new Date(e):null}function dn(e,t){const n=hn(e);if(!n)return!1;const o=hn(t);return!o||n.getFullYear()!==o.getFullYear()||n.getMonth()!==o.getMonth()}var fn=[40,40],pn=[.5,.5];function yn(e,t){const[n,o]=e.viewBox??fn,[r,i]=e.anchor??pn,s=o>0?o:1,a=Math.max(0,t)/s,l=(n>0?n:s)*a,c=s*a;return{width:l,height:c,scale:a,offsetX:-r*l,offsetY:-i*c}}function mn(e,t){const n=yn(e,t),o=[[n.offsetX,n.offsetY],[n.offsetX+n.width,n.offsetY],[n.offsetX,n.offsetY+n.height],[n.offsetX+n.width,n.offsetY+n.height]];let r=0;for(const[e,t]of o){const n=Math.sqrt(e*e+t*t);n>r&&(r=n)}return r}function gn(e,t,n,o){if("none"!==e)return"color"===e||null==e?t??o:"accent"===e?n:e}var xn=null;function bn(e){if("undefined"==typeof Path2D)return null;xn||(xn=new Map);const t=xn.get(e);if(t)return t;const n=new Path2D(e);return xn.size>1024&&xn.clear(),xn.set(e,n),n}function vn(e,t,n=0,o="horizontal"){const[r,i]=e.viewBox??fn,s=Math.min(1,Math.max(0,n)),a=Math.min(1,Math.max(0,t));return a>s?s>0||1>a?"vertical"===o?{x:0,y:i*(1-a),width:r,height:i*(a-s)}:{x:r*s,y:0,width:r*(a-s),height:i}:null:{x:0,y:0,width:0,height:0}}function kn(e,t){const n=yn(e,t);return{centerDx:n.offsetX+n.width/2,centerDy:n.offsetY+n.height/2,halfWidth:n.width/2,halfHeight:n.height/2,radius:Math.hypot(n.width,n.height)/2}}function wn(e,t,n,o,r,i=e=>e){for(const s of t.parts){const t=bn(s.d);if(!t)continue;const a=s.opacity??1,l=e.globalAlpha;1!==a&&(e.globalAlpha=l*a);const c=r?"none"===s.fill?void 0:r:gn(s.fill,n,o);c&&(e.fillStyle=i(c),e.fill(t));const u=r?s.stroke&&"none"!==s.stroke?r:void 0:gn(s.stroke??"none",n,o);u&&(e.strokeStyle=i(u),e.lineWidth=s.strokeWidth??1,e.lineCap=s.strokeLinecap??"butt",e.lineJoin=s.strokeLinejoin??"miter",e.stroke(t)),1!==a&&(e.globalAlpha=l)}}var An=/^var\(\s*(--[^,)]+)(?:\s*,\s*([^)]+))?\s*\)$/,Sn=new WeakMap,Cn=0,Mn=!1,jn=null,_n=null;function Rn(e,t){if(!t)return t;const n=An.exec(t);if(!n)return t;const o=e.canvas;if(!o)return n[2]?.trim()||t;!function(){if(Mn)return;if("undefined"==typeof window||"undefined"==typeof document)return;Mn=!0;const e=()=>{Cn++};if("undefined"!=typeof MutationObserver&&document.documentElement&&new MutationObserver(e).observe(document.documentElement,{attributes:!0,attributeFilter:["class","style","data-theme","data-semiotic-theme"]}),"function"==typeof window.matchMedia)try{jn=window.matchMedia("(prefers-color-scheme: dark)"),_n=e,"function"==typeof jn.addEventListener?jn.addEventListener("change",_n):"function"==typeof jn.addListener&&jn.addListener(_n)}catch{}}();let r=Sn.get(o);r&&r.version===Cn||(r={version:Cn,map:new Map},Sn.set(o,r));const i=r.map.get(t);if(void 0!==i)return i;const s=getComputedStyle(o).getPropertyValue(n[1]).trim()||n[2]?.trim()||t;return r.map.set(t,s),s}var Pn=null;var Ln=require("react/jsx-runtime");function In(e){return"object"==typeof e&&null!==e&&"hatch"===e.type}function Tn(e){return["hatch",e.background??"transparent",e.stroke??"#000",e.lineWidth??1.5,e.spacing??6,e.angle??45,e.lineOpacity??1].join("|")}function Nn(e,t){let n=2166136261;const o=Tn(t);for(let e=0;o.length>e;e++)n^=o.charCodeAt(e),n=Math.imul(n,16777619);return`${e}-hatch-${(n>>>0).toString(36)}`}var Fn=new Map;function On(e,t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45,lineOpacity:a=1}=e,l=Math.max(8,Math.ceil(2*i));return(0,Ln.jsxs)("pattern",{id:t,width:l,height:l,patternUnits:"userSpaceOnUse",patternTransform:0!==s?`rotate(${s})`:void 0,children:[n&&"transparent"!==n&&(0,Ln.jsx)("rect",{width:l,height:l,fill:n}),(0,Ln.jsx)("line",{x1:0,y1:0,x2:0,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a}),(0,Ln.jsx)("line",{x1:i,y1:0,x2:i,y2:l,stroke:o,strokeWidth:r,strokeOpacity:a})]},t)}function Bn(e,t,n="#4e79a7"){if(In(e)){const n=Nn(t,e);return{fill:`url(#${n})`,def:On(e,n)}}return e&&"string"==typeof e?{fill:e}:{fill:n}}var Dn=require("d3-shape");function Wn(e){switch(e){case"monotoneX":return Dn.curveMonotoneX;case"monotoneY":return Dn.curveMonotoneY;case"cardinal":return Dn.curveCardinal;case"catmullRom":return Dn.curveCatmullRom;case"step":return Dn.curveStep;case"stepBefore":return Dn.curveStepBefore;case"stepAfter":return Dn.curveStepAfter;case"basis":return Dn.curveBasis;case"natural":return Dn.curveNatural;default:return null}}function zn(e,t,n){if(null==t)return n;if(In(t)){const o=function(e,t){const n="undefined"!=typeof window&&window.devicePixelRatio||1,o=`${Tn(e)}@${n}`,r=Fn.get(o);if(void 0!==r)return r;const i=function(e={},t){const{background:n="transparent",stroke:o="#000",lineWidth:r=1.5,spacing:i=6,angle:s=45}=e,a=Math.max(8,Math.ceil(2*i));let l;try{l=function(e){return"undefined"!=typeof OffscreenCanvas?new OffscreenCanvas(e,e):(Pn||(Pn=document.createElement("canvas")),Pn.width=e,Pn.height=e,Pn)}(a)}catch{return null}const c=l.getContext("2d");if(!c)return null;n&&"transparent"!==n?(c.fillStyle=n,c.fillRect(0,0,a,a)):c.clearRect(0,0,a,a),c.strokeStyle=o,c.lineWidth=r,c.lineCap="square";const u=s*Math.PI/180;if(45===s||-45===s){const e=s>0?1:-1;for(let t=-a;2*a>=t;t+=i)c.beginPath(),c.moveTo(t,0),c.lineTo(t+e*a,a),c.stroke()}else{c.save(),c.translate(a/2,a/2),c.rotate(u);const e=2*a;for(let t=-e;e>=t;t+=i)c.beginPath(),c.moveTo(-e,t),c.lineTo(e,t),c.stroke();c.restore()}return(t||c).createPattern(l,"repeat")}({background:e.background,stroke:e.stroke,lineWidth:e.lineWidth,spacing:e.spacing,angle:e.angle},t);return Fn.set(o,i),i}(t,e);return o||t.background&&Rn(e,t.background)||n}return"string"!=typeof t?t:Rn(e,t)||n}function Hn(e,t,n,o,r,i,s){if("colorStops"in t){const n=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>n.length)return null;const a=e.createLinearGradient(o,r,i,s);for(const e of n)a.addColorStop(e.offset,e.color);return a}const{topOpacity:a,bottomOpacity:l}=t;if(!Number.isFinite(a)||!Number.isFinite(l))return null;const c=Math.max(0,Math.min(1,a)),u=Math.max(0,Math.min(1,l)),h=e.createLinearGradient(o,r,i,s),[d,f,p]=function(e,t){const n=e.fillStyle,o="#010203";try{e.fillStyle=o,e.fillStyle=t}catch{return e.fillStyle=n,[78,121,167]}const r=e.fillStyle;if(e.fillStyle=n,"string"!=typeof r)return[78,121,167];if(r.toLowerCase()===o&&t.trim().toLowerCase()!==o)return[78,121,167];if(r.startsWith("#"))return[parseInt(r.slice(1,3),16),parseInt(r.slice(3,5),16),parseInt(r.slice(5,7),16)];const i=r.match(/(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return i?[+i[1],+i[2],+i[3]]:[78,121,167]}(e,n);return h.addColorStop(0,`rgba(${d},${f},${p},${c})`),h.addColorStop(1,`rgba(${d},${f},${p},${u})`),h}function En(e,t,n,o,r,i){const s=t.colorStops.filter(e=>Number.isFinite(e.offset)).map(e=>({offset:Math.max(0,Math.min(1,e.offset)),color:e.color}));if(2>s.length)return null;const a=e.createLinearGradient(n,o,r,i);for(const e of s)a.addColorStop(e.offset,e.color);return a}var $n=require("d3-shape"),Yn=new WeakMap;function Gn(e,t){const n=Wn(t);if(!n)return e;const o=Yn.get(e);if(o)return o;const r=function(e,t,n=8){if(!t||2>e.length)return e.map(([e,t])=>[e,t]);const o=[];let r=null;const i={moveTo(e,t){r=[e,t],o.push([e,t])},lineTo(e,t){r=[e,t],o.push([e,t])},bezierCurveTo(e,t,i,s,a,l){if(!r)return r=[a,l],void o.push([a,l]);const[c,u]=r;for(let r=1;n>=r;r++){const h=r/n,d=1-h;o.push([d*d*d*c+3*d*d*h*e+3*d*h*h*i+h*h*h*a,d*d*d*u+3*d*d*h*t+3*d*h*h*s+h*h*h*l])}r=[a,l]},closePath(){},arc(){},rect(){},arcTo(){},quadraticCurveTo(e,t,n,i){r=[n,i],o.push([n,i])}};return(0,$n.line)().x(e=>e[0]).y(e=>e[1]).curve(t).context(i)(e),o}(e,n);return Yn.set(e,r),r}function qn(e,t,n,o=30,r,i=0){let s=null;if(r){const e=function(e,t,n,o,r,i=e=>e.x,s=e=>e.y,a=e=>e.r){const l=Math.max(o,r+5,12),c=t-l,u=t+l,h=n-l,d=n+l;let f=null,p=1/0;return e.visit((e,r,l,y,m)=>{if(r>u||c>y||l>d||h>m)return!0;if(!e.length){let r=e;do{const e=r.data,l=i(e)-t,c=s(e)-n,u=Math.sqrt(l*l+c*c);un(a(e),o)>=u&&p>u&&(f=e,p=u),r=r.next}while(r)}return!1}),f?{node:f,distance:p}:null}(r,t,n,o,i);e&&(s={node:e.node,datum:e.node.datum,x:e.node.x,y:e.node.y,distance:e.distance})}for(const i of e){let e=null;switch(i.type){case"point":if(r)break;e=Xn(i,t,n,o);break;case"symbol":e=Un(i,t,n,o);break;case"glyph":e=Kn(i,t,n,o);break;case"line":e=Qn(i,t,n,o);break;case"rect":if(null==i.datum)break;e=Jn(i,t,n);break;case"heatcell":e=eo(i,t,n);break;case"area":if(!1===i.interactive)break;e=no(i,t,n);break;case"candlestick":e=to(i,t,n)}e&&o>e.distance&&(s&&e.distance>=s.distance||(s=e))}return s}function Vn(e,t,n){if(0===e.length)return null;if(e[0][0]>t||t>e[e.length-1][0])return null;const o=oo(e,t);if(0>o)return null;if(Math.abs(e[o][0]-t)>n)return null;let r=o,i=o;o>0&&e[o][0]>=t?(r=o-1,i=o):e.length-1>o&&(r=o,i=o+1);const[s,a]=e[r],[l,c]=e[i];return l===s?a:a+Math.max(0,Math.min(1,(t-s)/(l-s)))*(c-a)}function Xn(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>un(e.r,o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Un(e,t,n,o=30){const r=t-e.x,i=n-e.y,s=Math.sqrt(r*r+i*i);return s>un(ht(e.size),o)?null:{node:e,datum:e.datum,x:e.x,y:e.y,distance:s}}function Kn(e,t,n,o=30){if(null==e.datum)return null;const r=kn(e.glyph,e.size),i=e.x+r.centerDx,s=e.y+r.centerDy,a=t-i,l=n-s,c=Math.sqrt(a*a+l*l);return c>un(r.radius,o)?null:{node:e,datum:e.datum,x:i,y:s,distance:c}}function Qn(e,t,n,o=30){if(0===e.path.length)return null;const r=oo(e.path,t);if(0>r)return null;const[i,s]=e.path[r];let a;if(e.path.length>1){let o=1/0;const i=Math.max(0,r-1),s=Math.min(e.path.length-2,r);for(let r=i;s>=r;r++){const[i,s]=e.path[r],[a,l]=e.path[r+1],c=Zn(t,n,i,s,a,l);o>c&&(o=c)}a=o}else{const e=t-i,o=n-s;a=Math.sqrt(e*e+o*o)}const l=e.style;return a>Math.max(5,(l.strokeWidth??l.lineWidth??1)/2+2,o)?null:{node:e,datum:Array.isArray(e.datum)&&e.datum[r]?e.datum[r]:e.datum,x:i,y:s,distance:a}}function Zn(e,t,n,o,r,i){const s=r-n,a=i-o,l=s*s+a*a;if(0===l)return Math.sqrt((e-n)**2+(t-o)**2);let c=((e-n)*s+(t-o)*a)/l;return c=Math.max(0,Math.min(1,c)),Math.sqrt((e-(n+c*s))**2+(t-(o+c*a))**2)}function Jn(e,t,n){const o=cn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function eo(e,t,n){const o=cn(t,n,e);return o.hit?{node:e,datum:e.datum,x:o.cx,y:o.cy,distance:0}:null}function to(e,t,n){const o=e.bodyWidth/2,r=Math.min(e.openY,e.closeY);if(!(e.x-o-3>t||t>e.x+o+3||e.highY-3>n||n>e.lowY+3)){const o=r+Math.max(Math.max(e.openY,e.closeY)-r,1)/2,i=t-e.x,s=n-o;return{node:e,datum:e.datum,x:e.x,y:o,distance:Math.sqrt(i*i+s*s)}}return null}function no(e,t,n){if(0===e.topPath.length)return null;const o=oo(e.topPath,t);if(0>o)return null;const[r,i]=e.topPath[o],s=t-r,a=n-i,l=Math.sqrt(s*s+a*a);return{node:e,datum:Array.isArray(e.datum)&&e.datum[o]?e.datum[o]:e.datum,x:r,y:i,distance:l}}function oo(e,t){if(0===e.length)return-1;let n=0,o=e.length-1;for(;o>n;){const r=n+o>>1;t>e[r][0]?n=r+1:o=r}return n>0&&Math.abs(e[n][0]-t)>=Math.abs(e[n-1][0]-t)?n-1:n}var ro=require("react"),io={fresh:1,aging:.7,stale:.45,expired:.25},so={alpha:1,band:"fresh",isStale:!1};function ao(e,t){if(!e||0>=t)return so;const n=null!=e.threshold&&e.threshold>0?e.threshold:5e3,o=e.graded;if(o){const e="object"==typeof o?o:{},r=function(e,t,n={}){return Number.isFinite(t)&&t>0?Number.isNaN(e)?"fresh":e===1/0?"expired":0>e||t*(n.fresh??1)>e?"fresh":t*(n.aging??1.5)>e?"aging":t*(n.stale??3)>e?"stale":"expired":"fresh"}(t,n,e.thresholds);return{alpha:{...io,...e.opacities??{}}[r],band:r,isStale:"fresh"!==r}}return t>n?{alpha:e.dimOpacity??.5,band:"stale",isStale:!0}:so}var lo=require("react/jsx-runtime");function co({isStale:e,position:t}){return(0,lo.jsx)("div",{className:"stream-staleness-badge",style:{position:"absolute",..."top-left"===t?{top:4,left:4}:"bottom-left"===t?{bottom:4,left:4}:"bottom-right"===t?{bottom:4,right:4}:{top:4,right:4},padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,pointerEvents:"none",zIndex:3,background:e?"#dc3545":"#28a745",color:"white"},children:e?"STALE":"LIVE"})}var uo=require("react"),ho=c(require("react")),fo=require("react/jsx-runtime"),po=16,yo=6,mo=10,go=22,xo={fill:(e,t)=>(0,fo.jsx)("rect",{style:e,width:t,height:t}),line:(e,t)=>(0,fo.jsx)("line",{style:e,x1:0,y1:0,x2:t,y2:t})};function bo(e,t,n,o,r){let i;return i="function"==typeof n?n(e):(0,xo[n])(o(e,t),r),i}function vo({swatchSize:e}){return(0,fo.jsx)("path",{d:`M${.25*e},${.55*e} L${.45*e},${.75*e} L${.8*e},${.3*e}`,fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}function ko(e,t,n){return n&&n.size>0?n.has(e.label)?1:.3:null!=t?e.label===t?1:.3:1}var wo=(e,t,n,o,r,i,s,a,l,c,u)=>{const{type:h="fill",styleFn:d,items:f}=e,p=[];let y=0;const m=!(!t&&!n),g="isolate"===c||void 0===c&&null!=r,{swatchSize:x,labelGap:b,rowHeight:v}=u;return f.forEach((e,c)=>{const u=bo(e,c,h,d,x),k=ko(e,o,r),w=r&&r.size>0&&r.has(e.label);p.push((0,fo.jsxs)("g",{transform:`translate(0,${y})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:m?a===i&&c===s?0:-1:void 0,role:m?"option":void 0,"aria-selected":m&&g?w||!1:void 0,"aria-current":m&&!g&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:m?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowDown"===n.key||"ArrowUp"===n.key){n.preventDefault();const e=(c+("ArrowDown"===n.key?1:-1)+f.length)%f.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:m?t=>{l(a,c),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:m?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:m?"pointer":"default",opacity:k,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[m&&(0,fo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:x+b+2+7*e.label.length,height:x+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),u,w&&(0,fo.jsx)(vo,{swatchSize:x}),(0,fo.jsx)("text",{y:x/2,x:x+b,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+c)),y+=v}),p},Ao=({legendGroups:e,width:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:s,focusedItemIndex:a,onFocusedIndexChange:l,legendInteraction:c,metrics:u})=>{let h=24;const d=[];return e.forEach((e,f)=>{h+=5,d.push((0,fo.jsx)("line",{stroke:"gray",x1:0,y1:h,x2:t,y2:h},"legend-top-line legend-symbol-"+f)),h+=8,e.label&&(h+=16,d.push((0,fo.jsx)("text",{y:h,className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label},"legend-text-"+f)),h+=8),d.push((0,fo.jsx)("g",{className:"legend-item",transform:`translate(0,${h})`,children:wo(e,n,o,r,i,s,a,f,l,c,u)},"legend-group-"+f)),h+=e.items.length*u.rowHeight+8}),d},So=({legendGroups:e,height:t,width:n,customClickBehavior:o,customHoverBehavior:r,highlightedCategory:i,isolatedCategories:s,focusedGroupIndex:a,focusedItemIndex:l,onFocusedIndexChange:c,legendInteraction:u,metrics:h})=>{let d=0;const f=[];e.forEach((e,t)=>{let p=0;e.label&&(p+=16);const y=((e,t,n,o,r,i,s,a,l,c,u,h)=>{const{type:d="fill",styleFn:f,items:p}=e,y=[],{swatchSize:m,labelGap:g,itemGap:x,rowHeight:b,align:v}=u,k=!(!t&&!n),w="isolate"===c||void 0===c&&null!=r,A=p.map(e=>m+g+7*e.label.length),S=[];let C=0,M=0;A.forEach((e,t)=>{const n=0===M?e:M+x+e;h&&h>0&&M>0&&n>h?(S.push({start:C,end:t,width:M}),C=t,M=e):M=n}),p.length>0&&S.push({start:C,end:p.length,width:M}),S.forEach((e,c)=>{let u="center"===v?Math.max(0,((h??e.width)-e.width)/2):"end"===v?Math.max(0,(h??e.width)-e.width):0;for(let h=e.start;e.end>h;h++){const e=p[h],v=bo(e,h,d,f,m),S=ko(e,o,r),C=r&&r.size>0&&r.has(e.label);y.push((0,fo.jsxs)("g",{transform:`translate(${u},${c*b})`,onClick:t?()=>t(e):void 0,onMouseEnter:n?()=>n(e):void 0,onMouseLeave:n?()=>n(null):void 0,tabIndex:k?a===i&&h===s?0:-1:void 0,role:k?"option":void 0,"aria-selected":k&&w?C||!1:void 0,"aria-current":k&&!w&&null!=o&&e.label===o||void 0,"aria-label":e.label,onKeyDown:k?n=>{if("Enter"!==n.key&&" "!==n.key||(n.preventDefault(),t&&t(e)),"ArrowRight"===n.key||"ArrowLeft"===n.key){n.preventDefault();const e=(h+("ArrowRight"===n.key?1:-1)+p.length)%p.length;l(a,e);const t=n.currentTarget.parentElement?.children[e];t instanceof SVGElement&&t.focus()}}:void 0,onFocus:k?t=>{l(a,h),n&&n(e);const o=t.currentTarget.querySelector(".semiotic-legend-focus-ring");o&&o.setAttribute("visibility","visible")}:void 0,onBlur:k?e=>{n&&n(null);const t=e.currentTarget.querySelector(".semiotic-legend-focus-ring");t&&t.setAttribute("visibility","hidden")}:void 0,style:{cursor:k?"pointer":"default",opacity:S,transition:"opacity 150ms ease",pointerEvents:"all",outline:"none"},children:[k&&(0,fo.jsx)("rect",{className:"semiotic-legend-focus-ring",x:-2,y:-2,width:m+g+2+7*e.label.length,height:m+4,fill:"none",stroke:"var(--semiotic-focus, #005fcc)",strokeWidth:2,rx:3,visibility:"hidden"}),v,C&&(0,fo.jsx)(vo,{swatchSize:m}),(0,fo.jsx)("text",{y:m/2,x:m+g,dominantBaseline:"central",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:e.label})]},"legend-item-"+h)),u+=A[h]+x}});const j=Math.max(0,...S.map(e=>e.width)),_=S.length;return{items:y,offset:j,totalRows:_,totalHeight:_*b}})(e,o,r,i,s,a,l,t,c,u,h,h.maxWidth??n);p+=y.offset+5,f.push({label:e.label,...y,offset:p,totalRows:y.totalRows,totalHeight:y.totalHeight}),d+=p+12});const p=h.maxWidth??n;let y=d>p?0:"center"===h.align?Math.max(0,(p-d)/2):"end"===h.align?Math.max(0,p-d):0;const m=[];return f.forEach((n,o)=>{const r=e[o];r.label&&(m.push((0,fo.jsx)("text",{transform:`translate(${y},0) rotate(90)`,textAnchor:"start",className:"legend-group-label",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:r.label},"legend-text-"+o)),y+=16),m.push((0,fo.jsx)("g",{className:"legend-item",transform:`translate(${y},0)`,children:n.items},"legend-group-"+o)),y+=n.offset+5,e[o+1]&&m.push((0,fo.jsx)("line",{stroke:"gray",x1:y,y1:-8,x2:y,y2:(n.totalHeight||t)+0+8},"legend-top-line legend-symbol-"+o)),y+=12}),(0,fo.jsx)("g",{children:m})};function Co({config:e,orientation:t="vertical",width:n=100}){const{colorFn:o,domain:r,label:i,format:s}=e,a=s||(e=>Math.round(100*e)/100+""),l="grad-legend-"+ho.useId();if("horizontal"===t){const e=12,t=Math.min(n,200),s=Math.max(0,(n-t)/2),c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,fo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[0]+t*(r[1]-r[0]))},e))}return(0,fo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[(0,fo.jsx)("defs",{children:(0,fo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"100%",y2:"0%",children:c})}),i&&(0,fo.jsx)("text",{x:s+t/2,y:-4,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,fo.jsx)("rect",{x:s,y:0,width:t,height:e,fill:`url(#${l})`,rx:2}),(0,fo.jsx)("text",{x:s,y:e+12,textAnchor:"start",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])}),(0,fo.jsx)("text",{x:s+t,y:e+12,textAnchor:"end",fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])})]})}const c=[];for(let e=0;64>=e;e++){const t=e/64;c.push((0,fo.jsx)("stop",{offset:100*t+"%",stopColor:o(r[1]-t*(r[1]-r[0]))},e))}return(0,fo.jsxs)("g",{"aria-label":i||"Gradient legend",children:[i&&(0,fo.jsx)("text",{x:7,y:-6,textAnchor:"middle",fontSize:11,fill:"var(--semiotic-text, #333)",children:i}),(0,fo.jsx)("defs",{children:(0,fo.jsx)("linearGradient",{id:l,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:c})}),(0,fo.jsx)("rect",{x:0,y:0,width:14,height:100,fill:`url(#${l})`,rx:2}),(0,fo.jsx)("text",{x:19,y:10,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[1])}),(0,fo.jsx)("text",{x:19,y:100,fontSize:10,fill:"var(--semiotic-text-secondary, #666)",children:a(r[0])})]})}function Mo(e){const{legendGroups:t,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,legendInteraction:s,title:a="Legend",width:l=100,height:c=20,orientation:u="vertical",legendLayout:h}=e,d=function(e){const t=Math.max(1,e?.swatchSize??po),n=Math.max(t,e?.rowHeight??go);return{swatchSize:t,labelGap:Math.max(0,e?.labelGap??yo),itemGap:Math.max(0,e?.itemGap??mo),rowHeight:n,align:"left"===e?.align?"start":"right"===e?.align?"end":e?.align??"start",maxWidth:e?.maxWidth}}(h),[f,p]=ho.useState(0),[y,m]=ho.useState(0),g=ho.useCallback((e,t)=>{p(e),m(t)},[]),x="vertical"===u?Ao({legendGroups:t||[],width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}):So({legendGroups:t||[],title:a,height:c,width:l,customClickBehavior:n,customHoverBehavior:o,highlightedCategory:r,isolatedCategories:i,focusedGroupIndex:f,focusedItemIndex:y,onFocusedIndexChange:g,legendInteraction:s,metrics:d}),b=!(!n&&!o);return(0,fo.jsxs)("g",{role:b?"listbox":void 0,"aria-multiselectable":!(!b||"isolate"!==s&&(void 0!==s||null==i))||void 0,"aria-label":"Chart legend",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[void 0!==a&&""!==a&&"vertical"===u&&(0,fo.jsx)("text",{className:"legend-title",y:16,x:l/2,textAnchor:"middle",style:{fontSize:"var(--semiotic-legend-font-size, 12px)"},fill:"var(--semiotic-text, #333)",children:a}),x]})}function jo(e){return"object"==typeof e&&null!==e&&"legendGroups"in e}var _o=require("react/jsx-runtime");function Ro(e){const{legend:t,totalWidth:n,totalHeight:o,margin:r,legendPosition:i="right",legendLayout:s,title:a,legendHoverBehavior:l,legendClickBehavior:c,legendHighlightedCategory:u,legendIsolatedCategories:h,legendInteraction:d}=e;if(!t)return null;const f="top"===i||"bottom"===i,p=!!a,y=Math.max(0,n-r.left-r.right),m=Math.max(1,f?s?.maxWidth??y:100);let g,x;return"left"===i?(g=Math.max(4,r.left-m-10),x=r.top):"top"===i?(g=r.left,x=p?32:8):"bottom"===i?(g=r.left,x=o-r.bottom+38):(g=n-r.right+10,x=r.top),(0,_o.jsx)("g",{transform:`translate(${g}, ${x})`,children:(b=t,"object"==typeof b&&null!==b&&"gradient"in b?(0,_o.jsx)(Co,{config:t.gradient,orientation:f?"horizontal":"vertical",width:m}):jo(t)?(0,_o.jsx)(Mo,{legendGroups:t.legendGroups,title:"",width:m,orientation:f?"horizontal":"vertical",legendLayout:s,customHoverBehavior:l,customClickBehavior:c,highlightedCategory:u,isolatedCategories:h,legendInteraction:d}):t)});var b}var Po=require("react"),Lo=require("d3-array");d();var Io=require("react/jsx-runtime");function To(e){return"string"==typeof e?{type:e}:e}function No({orient:e,config:t,values:n,scale:o,size:r,length:i}){const s=function(e){return{type:e.type,bins:e.bins??20,fill:e.fill??"#4e79a7",fillOpacity:e.fillOpacity??.5,stroke:e.stroke??"none",strokeWidth:e.strokeWidth??1}}(t),a="top"===e||"bottom"===e,l=(0,Po.useMemo)(()=>{if(0===n.length)return null;const t=o.domain(),l=r-8;if("boxplot"===s.type){const t=function(e){const t=[...e].sort((e,t)=>e-t),n=t.length;if(0===n)return null;const o=t[Math.floor(.25*n)],r=t[Math.floor(.5*n)],i=t[Math.floor(.75*n)],s=i-o;return{q1:o,median:r,q3:i,whiskerLow:Math.max(t[0],o-1.5*s),whiskerHigh:Math.min(t[n-1],i+1.5*s)}}(n);if(!t)return null;const{q1:r,median:i,q3:c,whiskerLow:u,whiskerHigh:h}=t,d=Math.min(.5*l,20),f=(l-d)/2+4;if(a){const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="top"===e?-1:1,m=0;return(0,Io.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Io.jsx)("line",{x1:l,y1:m+y*(f+d/2),x2:p,y2:m+y*(f+d/2),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Io.jsx)("line",{x1:l,y1:m+y*f,x2:l,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Io.jsx)("line",{x1:p,y1:m+y*f,x2:p,y2:m+y*(f+d),stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Io.jsx)("rect",{x:Math.min(t,n),y:"top"===e?m-f-d:m+f,width:Math.abs(n-t),height:d,fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Io.jsx)("line",{x1:a,y1:"top"===e?m-f-d:m+f,x2:a,y2:"top"===e?m-f:m+f+d,stroke:s.fill,strokeWidth:2})]})}{const t=o(r),n=o(c),a=o(i),l=o(u),p=o(h),y="left"===e?-1:1,m=0;return(0,Io.jsxs)("g",{"data-testid":"marginal-boxplot-"+e,children:[(0,Io.jsx)("line",{x1:m+y*(f+d/2),y1:l,x2:m+y*(f+d/2),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Io.jsx)("line",{x1:m+y*f,y1:l,x2:m+y*(f+d),y2:l,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Io.jsx)("line",{x1:m+y*f,y1:p,x2:m+y*(f+d),y2:p,stroke:s.fill,strokeWidth:s.strokeWidth}),(0,Io.jsx)("rect",{x:"left"===e?m-f-d:m+f,y:Math.min(t,n),width:d,height:Math.abs(n-t),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth}),(0,Io.jsx)("line",{x1:"left"===e?m-f-d:m+f,y1:a,x2:"left"===e?m-f:m+f+d,y2:a,stroke:s.fill,strokeWidth:2})]})}}const c=(0,Lo.bin)().domain(t).thresholds(s.bins)(n);if(0===c.length)return null;const u=h(c.map(e=>e.length));if(0===u)return null;if("histogram"===s.type)return(0,Io.jsx)("g",{"data-testid":"marginal-histogram-"+e,children:c.map((t,n)=>{if(null==t.x0||null==t.x1)return null;const r=t.length/u*l;if(a){const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,Io.jsx)("rect",{x:i,y:"top"===e?-4-r:4,width:Math.max(a,.5),height:r,fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}{const i=o(t.x0),a=o(t.x1)-o(t.x0);return(0,Io.jsx)("rect",{x:"left"===e?-4-r:4,y:Math.min(i,i+a),width:r,height:Math.abs(a),fill:s.fill,fillOpacity:s.fillOpacity,stroke:s.stroke,strokeWidth:s.strokeWidth},n)}})});if("violin"===s.type){const t=l/2+4,n=[];for(const r of c){if(null==r.x0||null==r.x1)continue;const i=r.length/u*(l/2),s=o((r.x0+r.x1)/2);n.push(a?`${s},${"top"===e?-(t-i):t-i}`:`${"left"===e?-(t-i):t-i},${s}`)}for(let r=c.length-1;r>=0;r--){const i=c[r];if(null==i.x0||null==i.x1)continue;const s=i.length/u*(l/2),h=o((i.x0+i.x1)/2);n.push(a?`${h},${"top"===e?-(t+s):t+s}`:`${"left"===e?-(t+s):t+s},${h}`)}return(0,Io.jsx)("g",{"data-testid":"marginal-violin-"+e,children:(0,Io.jsx)("polygon",{points:n.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}if("ridgeline"===s.type){const t=[];if(a){const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${r},${n}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${i},${"top"===e?-r-4:r+4}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${s},${n}`),t.push("Z")}else{const n=0,r=null!=c[0].x0?o(c[0].x0):0;t.push(`M${n},${r}`);for(const n of c){if(null==n.x0||null==n.x1)continue;const r=n.length/u*l,i=o((n.x0+n.x1)/2);t.push(`L${"left"===e?-r-4:r+4},${i}`)}const s=null!=c[c.length-1].x1?o(c[c.length-1].x1):i;t.push(`L${n},${s}`),t.push("Z")}return(0,Io.jsx)("g",{"data-testid":"marginal-ridgeline-"+e,children:(0,Io.jsx)("path",{d:t.join(" "),fill:s.fill,fillOpacity:s.fillOpacity,stroke:"none"===s.stroke?s.fill:s.stroke,strokeWidth:s.strokeWidth})})}return null},[n,o,s,r,i,e,a,4]);return l?(0,Io.jsx)("g",{className:"marginal-"+e,"data-testid":"marginal-"+e,children:l}):null}var Fo=c(require("react")),Oo=require("react/jsx-runtime");function Bo(e,t=120,n=8){if(!e)return[];const o=Math.max(1,Math.floor(t/n)),r=e.split(/\s+/),i=[];let s="";for(const e of r)s&&s.length+1+e.length>o?(i.push(s),s=e):s=s?`${s} ${e}`:e;return s&&i.push(s),i}function Do(e,t,n,o){return"curly"===e?o?`M0,0 C${.6*n},0 ${.4*n},${t/2} ${n},${t/2} C${.4*n},${t/2} ${.6*n},${t} 0,${t}`:`M0,0 C0,${.6*n} ${t/2},${.4*n} ${t/2},${n} C${t/2},${.4*n} ${t},${.6*n} ${t},0`:o?`M0,0 L${n},0 L${n},${t} L0,${t}`:`M0,0 L0,${n} L${t},${n} L${t},0`}function Wo(e,t,n,o){if(!e)return(0,Oo.jsx)("g",{className:"annotation-note"});const{label:r,title:i,orientation:s,align:a,wrap:l=120,noWrap:c}=e;if(!r&&!i)return(0,Oo.jsx)("g",{className:"annotation-note"});let u=s;u||(u=Math.abs(t)>Math.abs(n)?"leftRight":"topBottom");let h=a;h&&"dynamic"!==h||(h="topBottom"===u?0>t?"right":"left":0>n?"bottom":"top");let d="start";"topBottom"===u?"right"===h?d="end":"middle"===h&&(d="middle"):d=0>t?"end":"start";const f=16,p=i?c?[i]:Bo(i,l):[],y=r?c?[r]:Bo(r,l):[],m="leftRight"===u?"end"===d?-4:4:0;let g=0;const x=[],b=o||"var(--semiotic-annotation-color, var(--semiotic-text, #333))";e.useHTML||e.html?x.push((0,Oo.jsx)("foreignObject",{className:"annotation-note-html",x:"end"===d?m-l:"middle"===d?m-l/2:m,y:-16,width:l,height:Math.max(f,(p.length+y.length)*f+(i&&r?2:0))+f,style:{overflow:"visible"},children:(0,Oo.jsxs)("div",{xmlns:"http://www.w3.org/1999/xhtml",style:{color:b,fontSize:"12px",lineHeight:"16px",overflow:"visible",textAlign:"end"===d?"right":"middle"===d?"center":"left",whiteSpace:c?"nowrap":"normal",wordBreak:"break-word"},children:[i&&(0,Oo.jsx)("div",{className:"annotation-note-title",style:{fontWeight:"bold"},children:i}),r&&(0,Oo.jsx)("div",{className:"annotation-note-label",children:r})]})},"annotation-note-html")):(p.length>0&&(x.push((0,Oo.jsx)("text",{className:"annotation-note-title",fill:b,textAnchor:d,fontWeight:"bold",children:p.map((e,t)=>(0,Oo.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-title")),g=p.length*f),y.length>0&&x.push((0,Oo.jsx)("text",{className:"annotation-note-label",fill:b,textAnchor:d,y:g,children:y.map((e,t)=>(0,Oo.jsx)("tspan",{x:m,dy:0===t?0:f,children:e},t))},"annotation-note-label")));let v=null;if((i||r)&&(0!==t||0!==n))if("topBottom"===u){const e=Math.min(l,120);let t=0,n=e;"end"===d?(t=-e,n=0):"middle"===d&&(t=-e/2,n=e/2),v=(0,Oo.jsx)("line",{className:"note-line",x1:t,x2:n,y1:0,y2:0,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}else{const e=(p.length+y.length)*f+(y.length>0?f:0);let t=0,n=e;"bottom"===h?(t=-e,n=0):"middle"===h&&(t=-e/2,n=e/2),v=(0,Oo.jsx)("line",{className:"note-line",x1:0,x2:0,y1:t,y2:n,stroke:o||"var(--semiotic-text-secondary, currentColor)"})}const k=Math.max(0,p.length+y.length-1)*f;let w=0;return"topBottom"===u?w=0>n?-(k+2):18:"leftRight"===u&&(w="middle"===h?-(k+f+(y.length>0&&p.length>0?2:0))/2+8:"bottom"===h||0>n?-(k+2):18),(0,Oo.jsxs)("g",{className:"annotation-note",transform:`translate(${t},${n})`,children:[(0,Oo.jsx)("g",{className:"annotation-note-content",transform:0!==w?`translate(0,${w})`:void 0,children:x}),v]})}function zo(e,t,n,o,r){const i=[];switch(e){case"callout-circle":{const e=(t?.radius||0)+(t?.radiusPadding||0);e>0&&i.push((0,Oo.jsx)("circle",{r:e,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-circle"));break}case"callout-rect":{const e=t?.width||0,o=t?.height||0;(e>0||o>0)&&i.push((0,Oo.jsx)("rect",{width:e,height:o,fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"subject-rect"));break}case"callout-custom":t?.custom&&i.push(...Array.isArray(t.custom)?t.custom:[t.custom]);break;case"xy-threshold":{const e=o||0,s=r||0;if(void 0!==t?.x){const o=(t.x||0)-e;i.push((0,Oo.jsx)("line",{x1:o,y1:(t.y1||0)-s,x2:o,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else if(void 0!==t?.y){const o=(t.y||0)-s;i.push((0,Oo.jsx)("line",{x1:(t.x1||0)-e,y1:o,x2:(t.x2||0)-e,y2:o,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"))}else void 0!==t?.x1||void 0!==t?.x2?i.push((0,Oo.jsx)("line",{x1:(t.x1||0)-e,y1:0,x2:(t.x2||0)-e,y2:0,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line")):void 0===t?.y1&&void 0===t?.y2||i.push((0,Oo.jsx)("line",{x1:0,y1:(t.y1||0)-s,x2:0,y2:(t.y2||0)-s,stroke:n||"var(--semiotic-text-secondary, currentColor)",strokeDasharray:"5,5"},"threshold-line"));break}case"bracket":{const e=t?.type||"curly",o=t?.width??t?.height;void 0!==o&&i.push((0,Oo.jsx)("path",{d:Do(e,o,t?.depth||30,void 0===t?.width),fill:"none",stroke:n||"var(--semiotic-text-secondary, currentColor)"},"bracket-path"));break}}return(0,Oo.jsx)("g",{className:"annotation-subject",children:i})}function Ho(e,t,n,o,r,i){const s=[];let a=0,l=0;if("callout-circle"!==r&&"label"!==r||!i?.radius){if("callout-rect"===r&&i){const n=i.width||0,o=i.height||0;if(n>0||o>0){const r=n/2,i=o/2,s=e-r,c=t-i;if(0!==s||0!==c){const e=Math.abs(s),t=Math.abs(c),u=n/2,h=o/2,d=e*h>t*u?u/e:h/t;a=r+s*d,l=i+c*d}}}else if("bracket"===r&&i){const e=i.width,t=i.height,n=i.depth||30;void 0!==e?(a=e/2,l=n):void 0!==t&&(a=n,l=t/2)}}else{const n=(i.radius||0)+(i.radiusPadding||0);if(n>0&&(0!==e||0!==t)){const o=Math.atan2(t,e);a=Math.cos(o)*n,l=Math.sin(o)*n}}const c=Math.sqrt((e-a)**2+(t-l)**2);if(c>.5){const r=o||"var(--semiotic-text-secondary, currentColor)",i="curve"===n?.type;let u=Math.atan2(t-l,e-a);if(i){const o=(a+e)/2,i=(l+t)/2,h=-(t-l)/c,d=(e-a)/c,f=(n?.curve??.25)*c,p=o+h*f,y=i+d*f;s.push((0,Oo.jsx)("path",{className:"connector-curve",d:`M${a},${l}Q${p},${y} ${e},${t}`,fill:"none",stroke:r},"connector-line")),u=Math.atan2(y-l,p-a)}else s.push((0,Oo.jsx)("line",{x1:a,y1:l,x2:e,y2:t,stroke:r},"connector-line"));if("arrow"===n?.end){const e=10,t=16/180*Math.PI;s.push((0,Oo.jsx)("path",{d:`M${a},${l}L${a+e*Math.cos(u+t)},${l+e*Math.sin(u+t)}L${a+e*Math.cos(u-t)},${l+e*Math.sin(u-t)}Z`,fill:r,stroke:"none"},"connector-arrow"))}}return(0,Oo.jsx)("g",{className:"annotation-connector",children:s})}function Eo(e){const{x:t=0,y:n=0,dx:o,dy:r,nx:i,ny:s,note:a,connector:l,subject:c,type:u,color:h,className:d,disable:f,opacity:p,strokeDasharray:y,events:m={},"data-testid":g}=e,x=Array.isArray(t)?t[0]??0:t,b=Array.isArray(n)?n[0]??0:n,v=new Set(Array.isArray(f)?f:[]);let k=o||0,w=r||0;null!=i&&(k=i-x),null!=s&&(w=s-b);const A="string"==typeof u?u:"label";if("bracket"===A&&c&&0===k&&0===w)if(void 0!==c.width){k=c.width/2;const e=c.depth||30;w=e+(0>e?-5:5)}else if(void 0!==c.height){const e=c.depth||30;k=e+(0>e?-5:5),w=c.height/2}return(0,Oo.jsxs)("g",{className:("annotation "+(d||"")).trim(),transform:`translate(${x},${b})`,"data-testid":g,...null!=p&&{opacity:p},...y&&{strokeDasharray:y},...m,children:[!v.has("connector")&&Ho(k,w,l,h,A,c),!v.has("subject")&&zo(A,c,h,x,b),!v.has("note")&&Wo(a,k,w,h)]})}function $o(e){const{noteData:t}=e,{screenCoordinates:n}=t,o="string"==typeof t.type?t.type:"label",r=t.eventListeners||t.events||{};if(t.coordinates&&n){const e=t.nx||n[0][0]+(t.dx??0),r=t.ny||n[0][1]+(t.dy??0),i=n.map((n,i)=>{const s=Object.assign({},t,{note:0===i?t.note:{label:""},x:n[0],y:n[1],nx:e,ny:r});return(0,Oo.jsx)(Eo,{"data-testid":"semiotic-annotation",...s,type:o},"multi-annotation-"+i)});return(0,Oo.jsx)("g",{children:i})}const i=t.note||{title:"none",label:t.label},s=`${i.label}-${i.title}-${t.i}`;return(0,Oo.jsx)(Eo,{"data-testid":"semiotic-annotation",events:r,...t,type:o},s)}var Yo=require("d3-hierarchy"),Go=require("d3-shape");function qo(e){return Math.round(100*e)/100}function Vo(e,t=2){const n=[],o=[],r=t+1;for(let t=0;r>t;t++){let i=0;for(const[n,o]of e)null!==o&&(i+=n**t*o);n.push(i);const s=[];for(let n=0;r>n;n++){let o=0;for(const[r,i]of e)null!==i&&(o+=r**(t+n));s.push(o)}o.push(s)}o.push(n);const i=function(e,t){const n=e,o=e.length-1,r=[t];for(let e=0;o>e;e++){let t=e;for(let r=e+1;o>r;r++)Math.abs(n[e][r])>Math.abs(n[e][t])&&(t=r);for(let r=e;o+1>r;r++){const o=n[r][e];n[r][e]=n[r][t],n[r][t]=o}for(let t=e+1;o>t;t++)for(let r=o;r>=e;r--)n[r][t]-=n[r][e]*n[e][t]/n[e][e]}for(let e=o-1;e>=0;e--){let t=0;for(let i=e+1;o>i;i++)t+=n[i][e]*r[i];r[e]=(n[o][e]-t)/n[e][e]}return r}(o,r).map(qo);return{points:e.map(([e])=>[qo(e),qo(i.reduce((t,n,o)=>t+n*e**o,0))]),equation:[...i].reverse()}}function Xo(e,t){const n=t.scales?.x??t.scales?.time;return n?null!=e.x?n(e.x):t.xAccessor&&null!=e[t.xAccessor]?n(e[t.xAccessor]):null:null}function Uo(e,t){const n=t.scales?.y??t.scales?.value;return n?null!=e.y?n(e.y):t.yAccessor&&null!=e[t.yAccessor]?n(e[t.yAccessor]):null:null}function Ko(e){return null==e?null:e+""}function Qo(e,t,n){return t.stickyPositionCache?.set(e,n),n}function Zo(e,t,n){const o=e.anchor||e.lifecycle?.anchor||"fixed";if("latest"===o){if(null!=e.pointId&&n.pointNodes&&n.pointNodes.length>0)for(let o=n.pointNodes.length-1;o>=0;o--){const r=n.pointNodes[o];if(r.pointId===e.pointId)return Qo(t,n,{x:r.x,y:r.y})}const o=function(e){const t=e.data;if(!t||0===t.length)return null;const n=t[t.length-1],o=e.scales?.x??e.scales?.time,r=e.scales?.y??e.scales?.value;if(!o||!r)return null;const i=n[e.xAccessor||"x"],s=n[e.yAccessor||"y"];return null==i||null==s?null:{x:o(i),y:r(s)}}(n);return o?Qo(t,n,o):null}if("semantic"===o){const o=function(e,t,n){const o=function(e){return Ko(e.provenance?.stableId??e.stableId)}(e);if(!o)return null;const r=n.pointNodes?.find(e=>Ko(e.pointId)===o);if(r)return Qo(t,n,{x:r.x,y:r.y});const i=n.data?.find(e=>function(e){return Ko(e.stableId??e.id??e.provenance?.stableId)}(e)===o);if(!i)return null;const s=Xo(i,n),a=Uo(i,n);return null==s||null==a?null:Qo(t,n,{x:s,y:a})}(e,t,n);if(o)return o}let r=null,i=null;if(null!=e.pointId&&n.pointNodes){const t=n.pointNodes.find(t=>t.pointId===e.pointId);t&&(r=t.x,i=t.y)}if(null!=r&&null!=i||(r=Xo(e,n),i=Uo(e,n)),null!=r&&null!=i)return Qo(t,n,{x:r,y:i});if("sticky"===o){const e=n.stickyPositionCache?.get(t);if(e)return e}return null}function Jo(e,t,n,o=50){return!(-o>e||e>(n.width||0)+o||-o>t||t>(n.height||0)+o)}var er=require("react/jsx-runtime"),tr={secondary:0,primary:3};function nr(e){return!0===e?._annotationDeferred}function or(e){return"blended"===e?.cohesion||"layer"===e?.cohesion?e.cohesion:null}function rr(e){const t=e?.provenance?.confidence;return"number"==typeof t&&Number.isFinite(t)?Math.max(0,Math.min(1,t)):null}function ir(e){return Math.max(.72,.95-.06*e)}d();var sr=c(require("react")),[ar,lr]=$(e=>({observations:[],maxObservations:100,version:0,pushObservation(t){e(e=>{const n=e.observations;return n.push(t),n.length>e.maxObservations&&n.shift(),{version:e.version+1}})},clearObservations(){e(()=>({observations:[],version:0}))}}));function cr(e,t={}){const n=function(e){const t=e.provenance,n=e.id??e.stableId??t?.stableId;return null==n||""===n?void 0:n+""}(e);return{"data-semiotic-annotation-widget":"",...n?{"data-semiotic-annotation-id":n}:{},onClickCapture(o){const r=function(e){const t=e.nativeEvent;return"touch"===t.pointerType?"touch":0===t.detail?"keyboard":"pointer"}(o);t.onAnnotationActivate?.({annotation:e,annotationId:n,chartId:t.chartId,inputType:r}),n&&t.onObservation&&t.onObservation({type:"annotation-activate",annotationId:n,inputType:r,timestamp:Date.now(),chartType:t.chartType??"unknown",chartId:t.chartId})}}}var ur=require("react/jsx-runtime"),hr="var(--semiotic-bg, #ffffff)";function dr(e){const{x:t,y:n,text:o,fill:r,fontSize:i=12,fontWeight:s,fontFamily:a,textAnchor:l="start",dominantBaseline:c,background:u,className:h}=e,d=function(e){return void 0===e||!0===e||"halo"===e?{type:"halo"}:!1===e||"none"===e?null:"box"===e?{type:"box"}:{type:e.type??"halo",...e}}(u),f=e=>(0,ur.jsx)("text",{x:t,y:n,textAnchor:l,dominantBaseline:c,fill:r,fontSize:i,fontWeight:s,fontFamily:a,className:h,...e?{stroke:e.stroke,strokeWidth:e.strokeWidth,paintOrder:"stroke"}:{},children:o});if(!d)return f();if("halo"===d.type)return f({stroke:d.fill??hr,strokeWidth:d.haloWidth??3});const p=d.padding??{x:6,y:3},y="number"==typeof p?p:p.x,m="number"==typeof p?p:p.y,g=function(e,t){return(e+"").length*t*.6}(o,i),x=i+2*m;let b,v;return b="middle"===l?t-g/2-y:"end"===l?t-g-y:t-y,v="middle"===c||"central"===c?n-x/2:"hanging"===c||"text-before-edge"===c?n-m:n-.8*i-m,(0,ur.jsxs)("g",{className:h,children:[(0,ur.jsx)("rect",{x:b,y:v,width:g+2*y,height:x,rx:d.radius??3,ry:d.radius??3,fill:d.fill??hr,fillOpacity:d.opacity??.85,stroke:d.stroke,strokeWidth:d.strokeWidth}),f()]})}var fr=require("react/jsx-runtime"),pr={linear:Go.curveLinear,monotoneX:Go.curveMonotoneX,monotoneY:Go.curveMonotoneY,step:Go.curveStep,stepAfter:Go.curveStepAfter,stepBefore:Go.curveStepBefore,basis:Go.curveBasis,cardinal:Go.curveCardinal,catmullRom:Go.curveCatmullRom};var yr=new Set(["label","callout","callout-circle","callout-rect","text","widget"]);function mr(e){return!!e&&"object"==typeof e&&yr.has(function(e){return"string"==typeof e?.type?e.type:""}(e))}function gr(e){return"primary"===e?.emphasis||!0===e?.defensive}function xr(e,t,n={}){return"number"==typeof n.maxAnnotations&&Number.isFinite(n.maxAnnotations)?Math.max(0,Math.floor(n.maxAnnotations)):e>0&&t>0?Math.max(1,Math.round(e*t/(n.areaPerAnnotation&&n.areaPerAnnotation>0?n.areaPerAnnotation:2e4))):1/0}function br(e){let t;const n=e?.emphasis;t="primary"===n?100:"secondary"===n?10:50;const o=e?.provenance?.confidence;switch("number"==typeof o&&Number.isFinite(o)&&(t+=15*Math.max(0,Math.min(1,o))),e?.lifecycle?.freshness){case"fresh":t+=8;break;case"aging":t+=4;break;case"stale":t+=1;break;case"expired":t-=200}return t}new Set(["label","callout","callout-circle","callout-rect"]);var vr=32,kr=6,wr=4,Ar=8,Sr=72;var Cr={ai:"AI",agent:"agent",watcher:"watcher",system:"system",import:"imported",computed:"computed",user:"you"};function Mr(e){if(!jr(e))return e;const t=("string"==typeof e.mobileText?e.mobileText:void 0)??("string"==typeof e.shortText?e.shortText:void 0);return!t||"string"!=typeof e.label&&null!=e.label?e:{...e,label:t}}function jr(e){return mr(e)}function _r(e,t){if(!e)return[];const n=Math.max(1,Math.floor(t/7)),o=e.split(/\s+/).filter(Boolean),r=[];let i="";for(const e of o)i&&i.length+e.length+1>n?(r.push(i),i=e):i=i?`${i} ${e}`:e;return i&&r.push(i),r}function Rr(e,t,n,o,r){const i=e+n,s=t+o;return Math.abs(n)>Math.abs(o)?{x:0>n?i-r.width-4:i+4,y:0>o?s-r.height:s,width:r.width,height:r.height}:{x:0>n?i-r.width:i,y:0>o?s-r.height-4:s+4,width:r.width,height:r.height}}function Pr(e,t){return{x:e.x-t,y:e.y-t,width:e.width+2*t,height:e.height+2*t}}function Lr(e,t){return Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x))*Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y))}function Ir(e,t,n,o,r,i,s,a){const l=Pr(e,s);let c=.4*Math.hypot(t.dx,t.dy)+80*function(e,t,n,o){const r=Math.max(0,o-e.x),i=Math.max(0,o-e.y);return(r+Math.max(0,e.x+e.width-(t-o)))*e.height+(i+Math.max(0,e.y+e.height-(n-o)))*e.width}(l,r,i,a);for(const e of n)c+=12*Lr(l,e);for(const e of o)c+=4*Lr(l,e);return c}function Tr(e){const{annotations:t,context:n,defaultOffset:o=vr,notePadding:r=kr,markPadding:i=wr,edgePadding:s=Ar,preserveManualOffsets:a=!0,routeLongConnectors:l=!0,connectorThreshold:c=Sr,density:u,progressiveDisclosure:h=!1,redundantCues:d=!1,responsive:f,mobile:p,cohesion:y,audience:m}=e,g=n.width||0,x=n.height||0,b="object"==typeof p?p:{},v=b.breakpoint??480,k=!!p&&v>=g,w=k&&!1!==b.preferShortText?t.map(Mr):t,A=k&&!u?{maxAnnotations:b.maxAnnotations??("callout-list"===b.strategy?1:2),minVisible:b.minVisible??1}:u,S=h||k&&(!1!==b.progressiveDisclosure||"callout-list"===b.strategy),C=k&&!f?b.responsive??{minWidth:v}:f,M=k&&!y?b.cohesion:y;if(0===w.length||0>=g||0>=x)return w.slice();const j=[],_=function(e,t){return(e.pointNodes||[]).map(e=>{const n=Math.max(1,e.r||1)+t;return{x:e.x-n,y:e.y-n,width:2*n,height:2*n}})}(n,i);let R=!1;const P=w.map((e,t)=>{if(!jr(e))return e;const i=function(e,t,n){if("widget"===e.type&&"number"==typeof e.px&&"number"==typeof e.py)return{x:e.px,y:e.py};const o=e.pointId??e.nodeId;if(null!=o&&n.pointNodes){const e=n.pointNodes.find(e=>e.pointId===o);if(e)return{x:e.x,y:e.y}}const r=e.coordinates,i=n.scales?.geoProjection;if(Array.isArray(r)&&r.length>=2&&i){const e=r[0],t=r[1];if("number"==typeof e&&"number"==typeof t){const n=i([e,t]);if(n&&"number"==typeof n[0]&&"number"==typeof n[1])return{x:n[0],y:n[1]}}}return n.scales||"number"!=typeof e.x||"number"!=typeof e.y?Zo(e,t,n):{x:e.x,y:e.y}}(e,t,n);if(!i)return e;const u=function(e){if("widget"===e.type)return{width:"number"==typeof e.width?e.width:32,height:"number"==typeof e.height?e.height:32};const t="number"==typeof e.wrap?e.wrap:120,n=[..._r("string"==typeof e.title?e.title:void 0,t),..._r("string"==typeof e.label?e.label:void 0,t)],o=n.reduce((e,t)=>Math.max(e,t.length),0);return{width:Math.max(24,Math.min(t,7*o)+10),height:Math.max(18,16*n.length+6)}}(e);if(a&&("number"==typeof(h=e).dx||"number"==typeof h.dy)){const t=function(e){return"text"===e.type||"widget"===e.type?{dx:0,dy:0}:{dx:30,dy:-30}}(e);return j.push(Pr(Rr(i.x,i.y,"number"==typeof e.dx?e.dx:t.dx,"number"==typeof e.dy?e.dy:t.dy,u),r)),e}var h;let d=null,f=1/0;for(const e of function(e){const t=1.6*e;return[{dx:e,dy:-e},{dx:-e,dy:-e},{dx:e,dy:e},{dx:-e,dy:e},{dx:e,dy:0},{dx:-e,dy:0},{dx:0,dy:-e},{dx:0,dy:e},{dx:t,dy:-t},{dx:-t,dy:-t},{dx:t,dy:t},{dx:-t,dy:t}]}(o)){const t=Ir(Rr(i.x,i.y,e.dx,e.dy,u),e,j,_,g,x,r,s);f>t&&(d=e,f=t)}if(!d)return e;const p=Pr(Rr(i.x,i.y,d.dx,d.dy,u),r);j.push(p);const y=Math.hypot(d.dx,d.dy),m=l&&y>=c&&"text"!==e.type&&"widget"!==e.type?{...e.connector||{end:"arrow"},type:"curve"}:e.connector;return R=!0,{...e,dx:d.dx,dy:d.dy,...m?{connector:m}:{}}}),L=R?P:w.slice();let I=L;if(d){let e=!1;const t=L.map(t=>{const n=function(e){return"text"!==e.type||"string"!=typeof e.color||8>Math.hypot("number"==typeof e.dx?e.dx:0,"number"==typeof e.dy?e.dy:0)?e:{...e,_redundantConnector:!0}}(t);return n!==t&&(e=!0),n});I=e?t:L}{let e=!1;const t=I.map(t=>{if(!0!==t?.defensive)return t;const n=function(e){const t=e?.provenance;if(!t||"object"!=typeof t)return e;const n="string"==typeof t.source?Cr[t.source]??t.source:null,o="number"==typeof t.confidence&&Number.isFinite(t.confidence)?Math.round(100*Math.max(0,Math.min(1,t.confidence)))+"%":null;if(!n&&!o)return e;if(null!=e.label&&"string"!=typeof e.label)return e;const r=[n,o].filter(Boolean).join(" · "),i="string"==typeof e.label?e.label:"";return i.includes(`(${r})`)?e:{...e,label:i?`${i} (${r})`:`(${r})`}}(t);return n!==t&&(e=!0),n});I=e?t:I}const T=new Set;if(A){const e="object"==typeof A?A:{},t=function(e){if(!e)return 1;const t=function(e){const t=e?.familiarity;if(!t)return 3;const n=Object.values(t).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===n.length?3:n.reduce((e,t)=>e+t,0)/n.length}(e);return t>2?4>t?1:.6:1.5}(m),n=1===t?e:{...e,maxAnnotations:Math.max(0,Math.round((e.maxAnnotations??xr(g,x,e))*t))},{deferred:o}=function(e){const{annotations:t,width:n,height:o}=e,r=Math.max(0,e.minVisible??1),i=xr(n,o,e),s=t.map((e,t)=>{return{annotation:e,index:t,note:(n=e,mr(n))};var n}),a=s.filter(e=>e.note);if(0===a.length||i>=a.length)return{visible:t.slice(),deferred:[],budget:i};const l=a.filter(e=>gr(e.annotation)),c=a.filter(e=>!gr(e.annotation)).sort((e,t)=>br(t.annotation)-br(e.annotation)||e.index-t.index),u=Math.min(c.length,Math.max(Math.max(0,i-l.length),Math.max(0,r-l.length))),h=new Set([...l.map(e=>e.index),...c.slice(0,u).map(e=>e.index)]),d=[],f=[];for(const{annotation:e,index:t,note:n}of s)!n||h.has(t)?d.push(e):f.push(e);return{visible:d,deferred:f,budget:i}}({annotations:I,width:g,height:x,...n});for(const e of o)T.add(e)}if(C&&("object"==typeof C&&"number"==typeof C.minWidth?C.minWidth:480)>=g)for(const e of I)jr(e)&&"secondary"===e.emphasis&&T.add(e);if(T.size>0)for(const e of I)!0===e?.defensive&&T.delete(e);let N;return N=0===T.size?I:S?I.map(e=>T.has(e)?{...e,_annotationDeferred:!0}:e):I.filter(e=>!T.has(e)),M?function(e,t){let n=!1;const o=e.map(e=>jr(e)?"blended"===e.cohesion||"layer"===e.cohesion?e:(n=!0,{...e,cohesion:t}):e);return n?o:e}(N,M):N}var Nr=require("react"),Fr={positions:new Map},Or=new Set;function Br(){for(const e of Or)e()}function Dr(e,t){const n=Fr.positions.get(e);if(n?.locked)return;if(!n||n.sourceId!==t)return;const o=new Map(Fr.positions);o.delete(e),Fr={positions:o},Br()}function Wr(e,t){const n=Fr.positions.get(e);if(!n?.locked)return;if(t&&n.sourceId!==t)return;const o=new Map(Fr.positions);o.delete(e),Fr={positions:o},Br()}function zr(){return Fr}function Hr(e){return Or.add(e),()=>Or.delete(e)}var Er={positions:new Map};function $r(){return()=>{}}function Yr(){return Er}function Gr(e,t,n){return"exact"===n?function(e,t){const n=e.domain(),o=n[0],r=n[n.length-1],i=o instanceof Date,s=o instanceof Date?o.getTime():o,a=r instanceof Date?r.getTime():r;if(2>t||s===a)return i?[new Date(s),new Date(a)]:[s,a];const l=(a-s)/(t-1),c=Array(t);for(let e=0;t>e;e++){const n=e===t-1?a:s+e*l;c[e]=i?new Date(n):n}return c}(e,t):e.ticks(t)}function qr(e,t,n){if("edges"===e){if(t)return"start";if(n)return"end"}return"middle"}function Vr(e,t,n){if("edges"===e){if(t)return"hanging";if(n)return"auto"}return"middle"}function Xr(e){if(0===e.length)return{min:null,max:null};let t=1/0,n=-1/0;for(const o of e)t>o.pixel&&(t=o.pixel),o.pixel>n&&(n=o.pixel);return{min:t,max:n}}function Ur(e){if(e)return"dashed"===e?"6,4":"dotted"===e?"2,4":e}function Kr(e,t,n){if("left"===e||"right"===e){const o="left"===e?n:0,r="left"===e?-1:1,i=Math.ceil(t/8);let s="M0,"+o;for(let e=0;i>e;e++){const n=8*(e+1);s+=`L${Math.min(8*e+4,t)},${o+4*r}`,s+=`L${Math.min(n,t)},${o}`}return s}const o="bottom"===e?0:t,r="bottom"===e?1:-1,i=Math.ceil(n/8);let s=`M${o},0`;for(let e=0;i>e;e++){const t=8*(e+1);s+=`L${o+4*r},${Math.min(8*e+4,n)}`,s+=`L${o},${Math.min(t,n)}`}return s}var Qr=require("react/jsx-runtime");function Zr(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,showGrid:c,xFormat:u,yFormat:h,axisExtent:d}=e,f=(0,uo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||u||Jr,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o),a=e?.tickValues??Gr(s.x,i,d),c=a.map(e=>e.valueOf()),h=a.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,c)})),f=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0);return ei(h,Math.max(55,f+8))},[s,l,u,t,d]),p=(0,uo.useMemo)(()=>{if(!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||h||Jr,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===d?Math.max(2,r):Math.min(r,o);return ei((e?.tickValues??Gr(s.y,i,d)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[s,l,h,n,d]),y=c&&s,m=a&&s;if(!y&&!m)return null;const g=l?.find(e=>"bottom"===e.orient),x=l?.find(e=>"left"===e.orient),b=m&&(!g||!1!==g.baseline),v=m&&(!x||!1!==x.baseline),k=g?.jaggedBase||!1,w=x?.jaggedBase||!1,A="var(--semiotic-border, #ccc)";return(0,Qr.jsx)("svg",{width:o,height:r,style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:(0,Qr.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[y&&(()=>{const e=Ur(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=Ur(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Qr.jsxs)("g",{className:"stream-grid",children:[f.map((t,o)=>(0,Qr.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),p.map((e,n)=>(0,Qr.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),b&&!k&&(0,Qr.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:A,strokeWidth:1}),k&&(0,Qr.jsx)("path",{d:Kr("bottom",t,n),fill:"none",stroke:A,strokeWidth:1}),v&&!w&&(0,Qr.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:A,strokeWidth:1}),w&&(0,Qr.jsx)("path",{d:Kr("left",t,n),fill:"none",stroke:A,strokeWidth:1})]})})}function Jr(e,t,n){return e instanceof Date?`${e.toLocaleString("en",{month:"short"})} ${e.getDate()}`:"number"==typeof e?Math.round(100*e)/100+"":e+""}function ei(e,t){if(2>=e.length)return e;const n=[e[0]];for(let o=1;e.length-1>o;o++)t>Math.abs(e[o].pixel-n[n.length-1].pixel)||n.push(e[o]);const o=e[e.length-1];return t>Math.abs(o.pixel-n[n.length-1].pixel)?n[n.length-1]=o:n.push(o),n}function ti(e){const{width:t,height:n,totalWidth:o,totalHeight:r,margin:i,scales:s,showAxes:a,axes:l,xLabel:c,yLabel:h,yLabelRight:d,xFormat:f,yFormat:p,axisExtent:y,showGrid:m,title:g,legend:x,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:k,legendIsolatedCategories:w,legendPosition:A="right",legendLayout:S,foregroundGraphics:C,marginalGraphics:M,xValues:j,yValues:_,annotations:R,onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T,autoPlaceAnnotations:N,svgAnnotationRules:F,xAccessor:O,yAccessor:B,annotationData:D,pointNodes:W,curve:z,underlayRendered:H,canvasObscuresUnderlay:E=!0,linkedCrosshairName:$,linkedCrosshairSourceId:Y,children:G}=e,q=function(e){const t=lr(e=>e.pushObservation),n=sr.useCallback(n=>{e.onObservation?.(n),t?.(n)},[e,t]);return sr.useMemo(()=>({...e,onObservation:n}),[n,e])}({onAnnotationActivate:P,onObservation:L,chartId:I,chartType:T}),V=(0,uo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"bottom"===e.orient),n=e?.tickFormat||f||Jr,o=Math.max(2,Math.floor(t/70)),r=e?.ticks??5,i="exact"===y?Math.max(2,r):Math.min(r,o),c=e?.tickValues??Gr(s.x,i,y),u=c.map(e=>e.valueOf()),h=c.map((e,t)=>({value:e,pixel:s.x(e),label:n(e,t,u)})),d=h.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:"number"==typeof t.label?6.5*(t.label+"").length:60),0),p=e?.autoRotate?Math.max(20,Math.min(d+8,55)):Math.max(55,d+8);let m=ei(h,p);if(m.length>1&&(m=m.filter((e,t)=>0===t||e.label+""!=m[t-1].label+"")),e?.includeMax&&m.length>0&&"exact"!==y&&!e?.tickValues){const e=s.x.domain()[1],t=s.x(e),o=m[m.length-1].pixel;if(Math.abs(t-o)>1){const r=n(e,m.length,u);p>t-o&&m.length>1&&(m=m.slice(0,-1)),m.push({value:e,pixel:t,label:r})}}return m},[a,s,l,f,t,y]),X=(0,uo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"left"===e.orient),t=e?.tickFormat||p||Jr,o=Math.max(2,Math.floor(n/30)),r=e?.ticks??5,i="exact"===y?Math.max(2,r):Math.min(r,o);let c=ei((e?.tickValues??Gr(s.y,i,y)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22);if(c.length>1&&(c=c.filter((e,t)=>0===t||e.label+""!=c[t-1].label+"")),e?.includeMax&&c.length>0&&"exact"!==y&&!e?.tickValues){const e=s.y.domain()[1],n=s.y(e),o=c[c.length-1].pixel;if(Math.abs(n-o)>1){const r=t(e);22>Math.abs(n-o)&&c.length>1&&(c=c.slice(0,-1)),c.push({value:e,pixel:n,label:r})}}return c},[a,s,l,p,n,y]),U=(0,uo.useMemo)(()=>{if(!a||!s)return[];const e=l?.find(e=>"right"===e.orient);if(!e)return[];const t=e.tickFormat||p||Jr,o=Math.max(2,Math.floor(n/30)),r=e.ticks??5;return ei((e.tickValues??Gr(s.y,"exact"===y?Math.max(2,r):Math.min(r,o),y)).map(e=>({value:e,pixel:s.y(e),label:t(e)})),22)},[a,s,l,p,n,y]),K=(0,uo.useRef)(new Map),Q=(0,uo.useRef)(R?.length??0),Z=R?.length??0;Q.current!==Z&&(Q.current=Z,K.current=new Map);const J=(0,uo.useMemo)(()=>{if(!R||0===R.length)return null;const e=function(e,t={}){return function(e,n,o){switch(e.type){case"label":case"callout":case"callout-circle":case"callout-rect":{const t=Zo(e,n,o);if(!t)return null;const{x:r,y:i}=t;if(!Jo(r,i,o))return null;const s="callout"===e.type?"callout-circle":e.type,a="callout-circle"===s?{radius:e.radius??12,radiusPadding:e.radiusPadding}:"callout-rect"===s?{width:e.width,height:e.height}:void 0;return(0,fr.jsx)($o,{noteData:{x:r,y:i,dx:e.dx??30,dy:e.dy??-30,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:s,...a?{subject:a}:{},connector:e.connector||{end:"arrow"},color:e.color,disable:e.disable,opacity:e.opacity,strokeDasharray:e.strokeDasharray,className:e.className}},"ann-"+n)}case"x-threshold":{const t=Xo(null!=e.value?{...e,x:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"top";let s;s="bottom"===i?(o.height||0)-4:"center"===i?(o.height||0)/2:16;const a=t>.6*(o.width||0),l=a?t-4:t+4,c=a?"end":"start";return(0,fr.jsxs)("g",{opacity:e.opacity,children:[(0,fr.jsx)("line",{x1:t,y1:0,x2:t,y2:o.height||0,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,fr.jsx)(dr,{x:l,y:s,text:e.label,textAnchor:c,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"y-threshold":{const t=Uo(null!=e.value?{...e,y:e.value}:e,o);if(null==t)return null;const r=e.color||"#f97316",i=e.labelPosition||"right";let a,l;"left"===i?(a=4,l="start"):"center"===i?(a=(o.width||0)/2,l="middle"):(a=(o.width||0)-4,l="end");const c=20>(s=t)?Math.min((o.height||0)-4,s+16):s-4;return(0,fr.jsxs)("g",{opacity:e.opacity,children:[(0,fr.jsx)("line",{x1:0,y1:t,x2:o.width||0,y2:t,stroke:r,strokeWidth:e.strokeWidth||1.5,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,fr.jsx)(dr,{x:a,y:c,text:e.label,textAnchor:l,fill:r,fontSize:12,fontWeight:"bold",background:e.labelBackground??"halo"})]},"ann-"+n)}case"enclose":{const t=(e.coordinates||[]).map(e=>({x:Xo({...e,type:"point"},o),y:Uo({...e,type:"point"},o),r:1})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=(0,Yo.packEnclose)(t),i=e.padding||10;return(0,fr.jsxs)("g",{children:[(0,fr.jsx)("circle",{cx:r.x,cy:r.y,r:r.r+i,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,fr.jsx)(dr,{x:r.x,y:r.y-r.r-i-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"rect-enclose":{const t=(e.coordinates||[]).map(e=>({x:Xo({...e,type:"point"},o),y:Uo({...e,type:"point"},o)})).filter(e=>null!=e.x&&null!=e.y);if(2>t.length)return null;const r=e.padding||10,i=t.map(e=>e.x),s=t.map(e=>e.y),[a,l]=u(i),[c,h]=u(s),d=a-r,f=l+r,p=c-r;return(0,fr.jsxs)("g",{children:[(0,fr.jsx)("rect",{x:d,y:p,width:f-d,height:h+r-p,fill:e.fill||"none",fillOpacity:e.fillOpacity||.1,stroke:e.color||"var(--semiotic-text-secondary, #666)",strokeWidth:1.5,strokeDasharray:"4,2"}),e.label&&(0,fr.jsx)(dr,{x:(d+f)/2,y:p-4,textAnchor:"middle",fill:e.color||"var(--semiotic-text-secondary, #666)",fontSize:12,text:e.label,background:e.labelBackground??"none"})]},"ann-"+n)}case"highlight":{const t=o.data||[],r="function"==typeof e.filter?t.filter(e.filter):e.field&&null!=e.value?t.filter(t=>t[e.field]===e.value):[],i={stroke:e.color||"#f97316",strokeWidth:2,fill:"none"};return(0,fr.jsx)("g",{children:r.map((t,n)=>{const r=Xo(t,o),s=Uo(t,o);if(null==r||null==s)return null;const a="function"==typeof e.r?e.r(t):e.r||6,l="function"==typeof e.style?e.style(t):e.style||i;return(0,fr.jsx)("circle",{cx:r,cy:s,r:a,...l},"hl-"+n)})},"ann-"+n)}case"bracket":{const t=Xo(e,o),r=Uo(e,o);return(0,fr.jsx)($o,{noteData:{x:t??0,y:r??0,dx:e.dx||0,dy:e.dy||0,note:{label:e.label,title:e.title,wrap:e.wrap||120},type:"bracket",subject:{type:e.bracketType||"curly",width:e.width,height:e.height,depth:e.depth||30},color:e.color}},"ann-"+n)}case"trend":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s="ordinal"===o.frameType,a="horizontal"===o.projection,l=s?r:null,c=s?i:null;let u;const h=[],d=new Map;if(s&&l&&c){for(const e of t){const t=e[l];if(null==t)continue;const n=t+"";d.has(n)||(d.set(n,h.length),h.push(n))}u=t.map(e=>{const t=e[l],n=e[c];if(null==t||null==n)return null;const o=d.get(t+"");return null!=o?[o,+n]:null}).filter(e=>null!==e)}else u=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]);if(2>u.length)return null;const f=o.scales?.x??o.scales?.time,p=o.scales?.y??o.scales?.value;if(!f||!p)return null;const y=e=>t=>{const n=Math.max(0,Math.floor(t)),o=Math.min(h.length-1,n+1),r=t-n,i=e(h[n]);return i+(e(h[o])-i)*r},m=f,g=p;let x;if(s)if(a){const e=y(g);x=(t,n)=>[m(n),e(t)]}else{const e=y(m);x=(t,n)=>[e(t),g(n)]}else x=(e,t)=>[m(e),g(t)];const b=e.method||"linear";let v;if("loess"===b)v=function(e,t=.3){const n=e.length;if(2>n)return e.slice();const o=e.slice().sort((e,t)=>e[0]-t[0]),r=o.map(e=>e[0]),i=o.map(e=>e[1]),s=Math.max(2,Math.ceil(t*n)),a=[];for(let e=0;n>e;e++){const t=r[e],o=r.map(e=>Math.abs(e-t)),l=o.slice().sort((e,t)=>e-t)[Math.min(s-1,n-1)]||1,c=[];for(let e=0;n>e;e++){const t=0===l?0:o[e]/l;c[e]=1>t?Math.pow(1-Math.pow(t,3),3):0}let u=0,h=0,d=0,f=0,p=0;for(let e=0;n>e;e++){const t=c[e];0!==t&&(u+=t,h+=t*r[e],d+=t*i[e],f+=t*r[e]*r[e],p+=t*r[e]*i[e])}if(0===u){a.push([t,i[e]]);continue}const y=u*f-h*h;if(1e-12>Math.abs(y))a.push([t,d/u]);else{const e=(u*p-h*d)/y;a.push([t,(d-e*h)/u+e*t])}}return a}(u,e.bandwidth??.3);else{const t="polynomial"===b?Vo(u,e.order||2):function(e){const t=[0,0,0,0];let n=0;for(const[o,r]of e)null!==r&&(n++,t[0]+=o,t[1]+=r,t[2]+=o*o,t[3]+=o*r);const o=n*t[2]-t[0]*t[0],r=0===o?0:qo((n*t[3]-t[0]*t[1])/o),i=qo(t[1]/n-r*t[0]/n);return{points:e.map(([e])=>[qo(e),qo(r*e+i)]),equation:[r,i]}}(u);v=t.points}const k=v.map(([e,t])=>{const[n,o]=x(e,t);return`${n},${o}`}).join(" "),w=e.color||"#6366f1",A=v[v.length-1],[S,C]=x(A[0],A[1]);return(0,fr.jsxs)("g",{children:[(0,fr.jsx)("polyline",{points:k,fill:"none",stroke:w,strokeWidth:e.strokeWidth||2,strokeDasharray:e.strokeDasharray||"6,3"}),e.label&&(0,fr.jsx)("text",{x:S+4,y:C-4,fill:w,fontSize:11,children:e.label})]},"ann-"+n)}case"band":{const t=o.scales?.y??o.scales?.value,s=t?.(e.y0)??0,a=t?.(e.y1)??(o.height||0),l=Bn(e.fill,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,fr.jsxs)("g",{opacity:e.opacity,children:[l.def&&(0,fr.jsx)("defs",{children:l.def}),(0,fr.jsx)("rect",{x:0,y:Math.min(s,a),width:o.width||0,height:Math.abs(a-s),fill:l.fill,fillOpacity:e.fillOpacity||.1}),e.label&&(0,fr.jsx)(dr,{x:(o.width||0)-4,y:(r=s,i=a,Math.max(Math.min(r,i),0)+16),textAnchor:"end",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"x-band":{const t=o.scales?.x??o.scales?.time,r=null!=e.x0&&t?t(e.x0):null,i=null!=e.x1&&t?t(e.x1):null;if(null==r||null==i)return null;const s=Bn(e.fill||e.color,"ann-"+n,"var(--semiotic-primary, #6366f1)");return(0,fr.jsxs)("g",{opacity:e.opacity,children:[s.def&&(0,fr.jsx)("defs",{children:s.def}),(0,fr.jsx)("rect",{x:Math.min(r,i),y:0,width:Math.abs(i-r),height:o.height||0,fill:s.fill,fillOpacity:e.fillOpacity??.1}),e.label&&(0,fr.jsx)(dr,{x:Math.min(r,i)+4,y:16,textAnchor:"start",fill:e.color||"var(--semiotic-primary, #6366f1)",fontSize:11,fontWeight:"bold",text:e.label,background:e.labelBackground??"halo"})]},"ann-"+n)}case"envelope":{const t=o.data||[];if(2>t.length)return null;const r=o.xAccessor||"x",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=e.upperAccessor||"upperBounds",l=e.lowerAccessor||"lowerBounds",c=e.filter,u=t.filter(e=>null!=e[a]&&null!=e[l]&&!(c&&!c(e))).sort((e,t)=>e[r]-t[r]);if(2>u.length)return null;const h=pr[o.curve||"linear"]||Go.curveLinear,d=(0,Go.area)().x(e=>i(e[r])).y0(e=>s(e[l])).y1(e=>s(e[a])).curve(h)(u);if(!d)return null;const f=e.fill||"#6366f1";return(0,fr.jsxs)("g",{children:[(0,fr.jsx)("path",{d:d,fill:f,fillOpacity:e.fillOpacity??.15,stroke:"none"}),e.label&&u.length>0&&(0,fr.jsx)("text",{x:i(u[u.length-1][r])+4,y:s(u[u.length-1][a])-4,fill:f,fontSize:11,children:e.label})]},"ann-"+n)}case"anomaly-band":{const t=o.data||[];if(2>t.length)return null;const r=o.yAccessor||"y",i=o.scales?.x??o.scales?.time,s=o.scales?.y??o.scales?.value;if(!i||!s)return null;const a=t.map(e=>e[r]).filter(e=>null!=e&&isFinite(e));if(2>a.length)return null;const l=a.reduce((e,t)=>e+t,0)/a.length,c=a.reduce((e,t)=>e+(t-l)**2,0)/a.length,u=Math.sqrt(c),h=e.threshold??2,d=l-h*u,f=!1!==e.showBand,p=e.fill||"#6366f1",y=e.fillOpacity??.1,m=e.anomalyColor||"#ef4444",g=e.anomalyRadius??6,x=s(l+h*u),b=s(d),v=t.filter(e=>{const t=e[r];return null!=t&&Math.abs(t-l)>h*u});return(0,fr.jsxs)("g",{children:[f&&(0,fr.jsx)("rect",{x:0,y:Math.min(x,b),width:o.width||0,height:Math.abs(b-x),fill:p,fillOpacity:y}),v.map((e,t)=>{const n=Xo(e,o),r=Uo(e,o);return null==n||null==r?null:(0,fr.jsx)("circle",{cx:n,cy:r,r:g,fill:m,fillOpacity:.7,stroke:m,strokeWidth:1.5},"anomaly-"+t)}),e.label&&(0,fr.jsx)("text",{x:(o.width||0)-4,y:Math.min(x,b)-4,textAnchor:"end",fill:p,fontSize:11,children:e.label})]},"ann-"+n)}case"forecast":{const t=o.data||[];if(3>t.length)return null;const r=o.xAccessor||"x",i=o.yAccessor||"y",s=o.scales?.x??o.scales?.time,a=o.scales?.y??o.scales?.value;if(!s||!a)return null;const l=t.map(e=>[e[r],e[i]]).filter(e=>null!=e[0]&&null!=e[1]&&isFinite(e[0])&&isFinite(e[1])).sort((e,t)=>e[0]-t[0]);if(3>l.length)return null;let c;if("polynomial"===(e.method||"linear")){const t=Vo(l,e.order||2).equation;c=e=>t.reduce((t,n,o)=>t+n*Math.pow(e,o),0)}else{const e=l.length;let t=0,n=0,o=0,r=0;for(const[e,i]of l)t+=e,n+=i,o+=e*e,r+=e*i;const i=e*o-t*t;if(1e-12>Math.abs(i))return null;const s=(e*r-t*n)/i,a=(n-s*t)/e;c=e=>a+s*e}const u=l.length,h=l.map(([e,t])=>t-c(e)),d=h.reduce((e,t)=>e+t*t,0),f=Math.sqrt(d/Math.max(u-2,1)),p=l.reduce((e,t)=>e+t[0],0)/u,y=l.reduce((e,t)=>e+(t[0]-p)**2,0),m=e.confidence??.95,g=.99>m?.95>m?.9>m?1:1.645:1.96:2.576,x=e.steps??5,b=l[u-1][0],v=(b-l[0][0])/Math.max(u-1,1),k=[];for(let e=1;x>=e;e++)k.push(b+e*v);const w=[];for(const e of k){const t=c(e),n=f*Math.sqrt(1+1/u+(y>0?(e-p)**2/y:0))*g;w.push({x:e,yCenter:t,yUpper:t+n,yLower:t-n})}const A=`M${w.map(e=>`${s(e.x)},${a(e.yUpper)}`).join(" L")} L${w.slice().reverse().map(e=>`${s(e.x)},${a(e.yLower)}`).join(" L")} Z`,S=w.map(e=>`${s(e.x)},${a(e.yCenter)}`).join(" "),C=`${s(b)},${a(c(b))}`,M=e.strokeColor||"#6366f1";return(0,fr.jsxs)("g",{children:[(0,fr.jsx)("path",{d:A,fill:e.fill||"#6366f1",fillOpacity:e.fillOpacity??.15,stroke:"none"}),(0,fr.jsx)("polyline",{points:`${C} ${S}`,fill:"none",stroke:M,strokeWidth:e.strokeWidth??2,strokeDasharray:e.strokeDasharray??"6,3"}),e.label&&w.length>0&&(0,fr.jsx)("text",{x:s(w[w.length-1].x)+4,y:a(w[w.length-1].yCenter)-4,fill:M,fontSize:11,children:e.label})]},"ann-"+n)}case"widget":{let r,i;if(null!=e.px&&null!=e.py)r=e.px,i=e.py;else{const t=Zo(e,n,o);if(!t)return null;r=t.x,i=t.y}if(!Jo(r,i,o))return null;const s=e.dx??0,a=e.dy??0,l=e.width??32,c=e.height??32,u=e.content??(0,fr.jsx)("span",{style:{fontSize:18,cursor:"default"},title:e.label||"Info",children:"ℹ️"});return(0,fr.jsx)("foreignObject",{x:r+s-l/2,y:i+a-c/2,width:l,height:c,style:{overflow:"visible",pointerEvents:"auto"},children:(0,fr.jsx)("div",{...cr(e,t),style:{width:l,height:c,display:"flex",alignItems:"center",justifyContent:"center"},children:u})},"ann-"+n)}case"text":{const t=Zo(e,n,o);if(!t)return null;const{x:r,y:i}=t,s=r+(e.dx||0),a=i+(e.dy||0),l=e.color||"var(--semiotic-text, #333)",c=(0,fr.jsx)("text",{x:s,y:a,fill:l,fontSize:e.fontSize||11,opacity:e.opacity,strokeDasharray:e.strokeDasharray,dominantBaseline:"middle",style:{fontFamily:"inherit"},children:e.label});return!0!==e._redundantConnector?Fo.cloneElement(c,{key:"ann-text-"+n}):(0,fr.jsxs)("g",{opacity:e.opacity,strokeDasharray:e.strokeDasharray,children:[(0,fr.jsx)("line",{x1:r,y1:i,x2:s,y2:a,stroke:l,strokeWidth:1,strokeOpacity:.5,style:{pointerEvents:"none"}}),Fo.cloneElement(c,{opacity:void 0,strokeDasharray:void 0})]},"ann-text-"+n)}case"category-highlight":{const t=e.category;if(null==t)return null;const r=e=>"function"==typeof e&&"function"==typeof e.bandwidth,i=o.scales?.o,s=o.scales?.x,a=o.scales?.y,l=r(i)?i:r(s)?s:r(a)?a:null;if(!l)return null;const c=l(t+"");if(null==c)return null;const u=l.bandwidth(),h=e.color||"var(--semiotic-primary, #4589ff)",d=e.opacity??.15,f=e.label;return(0,fr.jsxs)("g",(o.projection?"vertical"===o.projection:l===s)?{children:[(0,fr.jsx)("rect",{x:c,y:0,width:u,height:o.height||0,fill:h,fillOpacity:d}),f&&(0,fr.jsx)(dr,{x:c+u/2,y:16,textAnchor:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]}:{children:[(0,fr.jsx)("rect",{x:0,y:c,width:o.width||0,height:u,fill:h,fillOpacity:d}),f&&(0,fr.jsx)(dr,{x:12,y:c+u/2,dominantBaseline:"middle",fill:h,fontSize:12,fontWeight:"bold",text:f,background:e.labelBackground??"none"})]},"ann-"+n)}default:return null}var r,i,s}}(0,q),o={scales:s?{x:s.x,y:s.y,time:s.x,value:s.y}:null,timeAxis:"x",xAccessor:O,yAccessor:B,width:t,height:n,data:D,frameType:"xy",pointNodes:W,curve:z,stickyPositionCache:K.current};return function(e,t,n,o){const r=[];return e.forEach((e,i)=>{let s;if(n){const r=n(e,i,o);s=null!=r?r:t(e,i,o)}else s=t(e,i,o);s&&r.push({node:s,annotation:e})}),function(e){const t=e.map((e,t)=>{return{p:e,i:t,emphasis:(n=e.annotation,"primary"===n?.emphasis||"secondary"===n?.emphasis?n.emphasis:null),confidence:rr(e.annotation),readingOrder:null,rank:1};var n}),n=t.some(e=>null!=e.emphasis||null!=e.confidence),o=e.some(e=>nr(e.annotation)),r=e.some(e=>null!=or(e.annotation)),i=e.some(e=>"layer"===or(e.annotation));if(!n&&!o&&!r)return e.map(e=>e.node);const s=t.filter(e=>null==e.emphasis&&null!=e.confidence).slice().sort((e,t)=>(t.confidence??0)-(e.confidence??0)||e.i-t.i);s.forEach((e,t)=>{e.readingOrder=t,e.rank=2-t/Math.max(1,s.length)});for(const e of t)e.emphasis&&(e.rank=tr[e.emphasis]);const a=t.sort((e,t)=>e.rank-t.rank||e.i-t.i).map(e=>{const{p:t,i:n,emphasis:o,readingOrder:r}=e,i=nr(t.annotation);let s=t.node;if("primary"===o||"secondary"===o||null!=r){const e=null==o&&null!=r;s=(0,er.jsx)("g",{className:e?"annotation-emphasis annotation-emphasis--inferred":"annotation-emphasis annotation-emphasis--"+o,..."secondary"===o?{opacity:.6,fontSize:"0.88em"}:{},...e?{opacity:ir(r),"data-annotation-reading-order":r}:{},children:t.node},"annotation-emphasis-"+n)}const a=or(t.annotation);return a&&(s=(0,er.jsx)("g",{className:"annotation-cohesion--"+a,children:s},"annotation-cohesion-"+n)),i&&(s=(0,er.jsx)("g",{className:"annotation-deferred","data-annotation-disclosure":"deferred",children:s},"annotation-deferred-"+n)),s});return o&&a.unshift((0,er.jsx)("style",{children:".annotation-deferred{opacity:0;pointer-events:none;transition:opacity .12s ease}.stream-xy-frame:hover .annotation-deferred,.stream-ordinal-frame:hover .annotation-deferred,.stream-network-frame:hover .annotation-deferred,.stream-geo-frame:hover .annotation-deferred,.stream-xy-frame:focus-within .annotation-deferred,.stream-ordinal-frame:focus-within .annotation-deferred,.stream-network-frame:focus-within .annotation-deferred,.stream-geo-frame:focus-within .annotation-deferred{opacity:1;pointer-events:auto}@media (prefers-reduced-motion:reduce){.annotation-deferred{transition:none}}"},"annotation-disclosure-style")),i&&a.unshift((0,er.jsx)("style",{children:".annotation-cohesion--layer text,.annotation-cohesion--layer tspan{fill:var(--semiotic-annotation-color,var(--semiotic-text-secondary,#666));font-style:italic}"},"annotation-cohesion-style")),a}(r)}(N?Tr({annotations:R,context:o,..."object"==typeof N?N:{}}):R,e,F,o)},[R,N,F,t,n,O,B,D,s,W,z,q]),ee=function(e){const t=(0,Nr.useSyncExternalStore)(e?Hr:$r,e?zr:Yr,e?zr:Yr);return e?t.positions.get(e)??null:null}($);return(0,uo.useEffect)(()=>{if(!ee?.locked||!$)return;const e=e=>{"Escape"===e.key&&Wr($)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[ee?.locked,$]),a||g||x||C||M||J&&J.length>0||m||G||ee?(0,Qr.jsxs)("svg",{role:"img",width:o,height:r,overflow:"visible",style:{position:"absolute",top:0,left:0,pointerEvents:"none",overflow:"visible"},children:[(0,Qr.jsx)("title",{children:"string"==typeof g?g:"XY Chart"}),(0,Qr.jsx)("desc",{children:"string"==typeof g?g+" — XY data visualization":"XY data visualization"}),(0,Qr.jsxs)("g",{transform:`translate(${i.left},${i.top})`,children:[m&&s&&(!H||E)&&(()=>{const e=Ur(l?.find(e=>"bottom"===e.orient)?.gridStyle),o=Ur(l?.find(e=>"left"===e.orient)?.gridStyle);return(0,Qr.jsxs)("g",{className:"stream-grid",children:[V.map((t,o)=>(0,Qr.jsx)("line",{x1:t.pixel,y1:0,x2:t.pixel,y2:n,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:e},"xgrid-"+o)),X.map((e,n)=>(0,Qr.jsx)("line",{x1:0,y1:e.pixel,x2:t,y2:e.pixel,stroke:"var(--semiotic-grid, #e0e0e0)",strokeWidth:1,strokeDasharray:o},"ygrid-"+n))]})})(),a&&s&&(()=>{const e=l?.find(e=>"left"===e.orient),o=l?.find(e=>"bottom"===e.orient),r=!e||!1!==e.baseline,s=!o||!1!==o.baseline,a=e?.jaggedBase||!1,u=o?.jaggedBase||!1,f=o?.landmarkTicks,p=e?.landmarkTicks,y="var(--semiotic-border, #ccc)",m="var(--semiotic-text-secondary, var(--semiotic-text, #666))",g="var(--semiotic-text, #333)",x=!!o?.autoRotate&&V.length>1&&(()=>{const e=t/Math.max(V.length-1,1);return V.reduce((e,t)=>Math.max(e,"string"==typeof t.label?6.5*t.label.length:60),0)+8>e})(),b=x?12:18,v=n+(x?58:40),k={fontSize:"var(--semiotic-tick-font-size, 12px)"},w={fontSize:"calc(var(--semiotic-tick-font-size, 12px) + 1px)"},A={fontSize:"var(--semiotic-axis-label-font-size, 12px)"},S=o?.tickAnchor,C=e?.tickAnchor,M=Xr(V),j=Xr(X);return(0,Qr.jsxs)("g",{className:"stream-axes",style:{fontFamily:"var(--semiotic-font-family, sans-serif)"},children:[(0,Qr.jsxs)("g",{className:"semiotic-axis semiotic-axis-bottom","data-orient":"bottom",children:[(!H||E)&&s&&!u&&(0,Qr.jsx)("line",{x1:0,y1:n,x2:t,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&u&&(0,Qr.jsx)("path",{d:Kr("bottom",t,n),fill:"none",stroke:y,strokeWidth:1}),V.map((e,t)=>{const o=!!f&&("function"==typeof f?f(e.value,t):dn(e.value,t>0?V[t-1].value:void 0));return(0,Qr.jsxs)("g",{transform:`translate(${e.pixel},${n})`,children:[(0,Qr.jsx)("line",{y2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Qr.jsx)("text",{y:b,textAnchor:x?"end":qr(S,e.pixel===M.min,e.pixel===M.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},transform:x?"rotate(-45)":void 0,children:e.label}):(0,Qr.jsx)("foreignObject",{x:-30,y:6,width:60,height:24,style:{overflow:"visible"},children:(0,Qr.jsx)("div",{style:{textAlign:"center",userSelect:"none",...k},children:e.label})})]},"xtick-"+t)}),c&&(0,Qr.jsx)("text",{x:t/2,y:v,textAnchor:"middle",fill:g,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:c})]}),(0,Qr.jsxs)("g",{className:"semiotic-axis semiotic-axis-left","data-orient":"left",children:[(!H||E)&&r&&!a&&(0,Qr.jsx)("line",{x1:0,y1:0,x2:0,y2:n,stroke:y,strokeWidth:1}),(!H||E)&&a&&(0,Qr.jsx)("path",{d:Kr("left",t,n),fill:"none",stroke:y,strokeWidth:1}),X.map((e,t)=>{const n=!!p&&("function"==typeof p?p(e.value,t):dn(e.value,t>0?X[t-1].value:void 0));return(0,Qr.jsxs)("g",{transform:`translate(0,${e.pixel})`,children:[(0,Qr.jsx)("line",{x2:-5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Qr.jsx)("text",{x:-8,textAnchor:"end",dominantBaseline:Vr(C,e.pixel===j.min,e.pixel===j.max),fontWeight:n?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...n?w:k},children:e.label}):(0,Qr.jsx)("foreignObject",{x:-68,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Qr.jsx)("div",{style:{textAlign:"right",userSelect:"none",...k},children:e.label})})]},"ytick-"+t)}),(()=>{const t=e?.label||h;return t?(0,Qr.jsx)("text",{x:15-i.left,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(-90, ${15-i.left}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:t}):null})()]}),(()=>{const e=l?.find(e=>"right"===e.orient);if(!e||0===U.length)return null;const o=!1!==e.baseline,r=e.landmarkTicks,s=e.label||d,a=e.tickAnchor,c=Xr(U);return(0,Qr.jsxs)("g",{className:"semiotic-axis semiotic-axis-right","data-orient":"right",children:[o&&(0,Qr.jsx)("line",{x1:t,y1:0,x2:t,y2:n,stroke:y,strokeWidth:1}),U.map((e,n)=>{const o=!!r&&("function"==typeof r?r(e.value,n):dn(e.value,n>0?U[n-1].value:void 0));return(0,Qr.jsxs)("g",{transform:`translate(${t},${e.pixel})`,children:[(0,Qr.jsx)("line",{x2:5,stroke:y,strokeWidth:1}),"string"==typeof e.label||"number"==typeof e.label?(0,Qr.jsx)("text",{x:8,textAnchor:"start",dominantBaseline:Vr(a,e.pixel===c.min,e.pixel===c.max),fontWeight:o?600:400,fill:m,className:"semiotic-axis-tick",style:{userSelect:"none",...o?w:k},children:e.label}):(0,Qr.jsx)("foreignObject",{x:8,y:-12,width:60,height:24,style:{overflow:"visible"},children:(0,Qr.jsx)("div",{style:{textAlign:"left",userSelect:"none",...k},children:e.label})})]},"ytick-r-"+n)}),s&&(0,Qr.jsx)("text",{x:t+i.right-15,y:n/2,textAnchor:"middle",fill:g,transform:`rotate(90, ${t+i.right-15}, ${n/2})`,className:"semiotic-axis-label",style:{userSelect:"none",...A},children:s})]})})()]})})(),J,M&&s&&j&&_&&(0,Qr.jsxs)(Qr.Fragment,{children:[M.top&&(0,Qr.jsx)("g",{transform:"translate(0, 0)",children:(0,Qr.jsx)(No,{orient:"top",config:To(M.top),values:j,scale:s.x,size:i.top,length:t})}),M.bottom&&(0,Qr.jsx)("g",{transform:`translate(0, ${n})`,children:(0,Qr.jsx)(No,{orient:"bottom",config:To(M.bottom),values:j,scale:s.x,size:i.bottom,length:t})}),M.left&&(0,Qr.jsx)("g",{transform:"translate(0, 0)",children:(0,Qr.jsx)(No,{orient:"left",config:To(M.left),values:_,scale:s.y,size:i.left,length:n})}),M.right&&(0,Qr.jsx)("g",{transform:`translate(${t}, 0)`,children:(0,Qr.jsx)(No,{orient:"right",config:To(M.right),values:_,scale:s.y,size:i.right,length:n})})]}),C,ee&&ee.sourceId!==Y&&s?.x&&(()=>{const e=s.x(ee.xValue);if(null==e||0>e||e>t)return null;const o=ee.locked;return(0,Qr.jsx)("line",{x1:e,y1:0,x2:e,y2:n,stroke:o?"white":"var(--semiotic-text-secondary, rgba(0,0,0,0.25))",strokeWidth:o?1.5:1,strokeDasharray:o?"6,3":"4,4",pointerEvents:"none"})})(),G]}),g&&"string"==typeof g?(0,Qr.jsx)("text",{x:o/2,y:22,textAnchor:"middle",fontWeight:"bold",fill:"var(--semiotic-text, #333)",className:"semiotic-chart-title",style:{userSelect:"none",fontSize:"var(--semiotic-title-font-size, 14px)"},children:g}):g?(0,Qr.jsx)("foreignObject",{x:0,y:0,width:o,height:i.top,children:g}):null,Ro({legend:x,totalWidth:o,totalHeight:r,margin:i,legendPosition:A,title:g,legendLayout:S,legendHoverBehavior:b,legendClickBehavior:v,legendHighlightedCategory:k,legendIsolatedCategories:w})]}):null}var ni=c(require("react"));function oi(e){return(e.tl??0)>0||(e.tr??0)>0||(e.br??0)>0||(e.bl??0)>0}require("d3-shape");var ri=require("react/jsx-runtime");function ii(e,t="#4e79a7"){return In(e)?e.background&&"transparent"!==e.background?e.background:t:e&&"string"==typeof e?e:t}var si="undefined"==typeof window||"undefined"==typeof document,ai=require("react"),li="undefined"!=typeof window?ai.useLayoutEffect:ai.useEffect,ci=()=>()=>{},ui=()=>!1,hi=()=>!0,di=require("react");function fi(e,t){const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;if(!Object.is(e[o],t[o]))return!1}return!0}function pi(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(!Object.is(e[n],t[n]))return!1;return!0}function yi(e){if(null===e||"object"!=typeof e)return!1;if(Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}var mi={axisStroke:"#ccc",tickText:"#666",crosshair:"rgba(0, 0, 0, 0.25)",hoverFill:"rgba(255, 255, 255, 0.3)",hoverStroke:"rgba(0, 0, 0, 0.4)",pointRing:"white",primary:"#007bff",background:""};function gi(e,t){const n=e.trim();if(/^#[0-9a-f]{3}$/i.test(n)){const e=n[1],o=n[2],r=n[3];return`#${e}${e}${o}${o}${r}${r}${t}`}if(/^#[0-9a-f]{6}$/i.test(n))return`${n}${t}`;const o=n.match(/^rgb\s*\(\s*([^)]+?)\s*\)$/i);return o?`rgba(${o[1]}, ${(parseInt(t,16)/255).toFixed(3)})`:n}var xi=c(require("react")),bi=c(require("react")),vi=(require("react/jsx-runtime"),bi.createContext(null)),ki=require("react/jsx-runtime"),wi={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap",border:0};function Ai({hoverPoint:e}){let t="";if(e){const n=e.data||e;t="object"==typeof n?"Data point: "+Object.entries(n).filter(([,e])=>"object"!=typeof e&&"function"!=typeof e).map(([e,t])=>`${e}: ${t}`).join(", "):"Data point: "+n}return(0,ki.jsx)("div",{"aria-live":"polite","aria-atomic":"true",style:wi,children:t})}function Si(e){const t={};if(null==e||"object"!=typeof e)return t;for(const[n,o]of Object.entries(e))n.startsWith("_")||null!=o&&""!==o&&("number"==typeof o?Number.isFinite(o)&&(t[n]=o):"string"==typeof o?t[n]=o:"boolean"==typeof o?t[n]=o+"":o instanceof Date&&(t[n]=o.toISOString().slice(0,10)));return t}function Ci(e){return e&&"object"==typeof e?e:{}}function Mi(e){return Ci(e.accessibility).tableFields??e.accessibleDatum??e.datum}var ji=require("react/jsx-runtime");function _i(e,t){if(!e||0===e.length)return t+", empty";const n={};for(const t of e){if(null===t?.datum)continue;const e=t.type+"";n[e]=(n[e]||0)+1}if(0===Object.keys(n).length)return t+", empty";const o=[],r={point:"points",line:"lines",area:"areas",rect:"bars",heatcell:"cells",circle:"nodes",candlestick:"candlesticks",wedge:"wedges",arc:"arcs",geoarea:"regions"},i=["point","line","area","rect","heatcell","circle","candlestick","wedge","arc","geoarea"],s=Object.keys(n).sort((e,t)=>{const n=i.indexOf(e),o=i.indexOf(t);return(-1===n?999:n)-(-1===o?999:o)});for(const e of s)o.push(`${n[e]} ${r[e]||e}`);return`${t}, ${o.join(", ")}`}var Ri=e=>{if(null==e)return"";const t=Math.round(100*e)/100;return Number.isNaN(t)?"":t+""},Pi="semiotic-accessible-data-table",Li=Pi+" semiotic-accessible-data-table-hidden",Ii=Pi+" semiotic-accessible-data-table-visible",Ti={position:"absolute",top:0,left:0,right:0,zIndex:"var(--semiotic-data-table-z-index, var(--semiotic-overlay-z-index, 20))",padding:"14px 16px 12px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontFamily:"var(--semiotic-font-family, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif)",fontSize:13,lineHeight:1.5,color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",borderRadius:"var(--semiotic-border-radius, 0px) var(--semiotic-border-radius, 0px) 0 0"},Ni={marginBottom:8,paddingRight:28,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:12,letterSpacing:"0.01em"},Fi={position:"absolute",top:10,right:10,width:22,height:22,display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",cursor:"pointer",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",fontSize:13,lineHeight:1,padding:0,borderRadius:"var(--semiotic-border-radius, 4px)"},Oi={width:"100%",borderCollapse:"collapse",fontSize:12,marginTop:4,fontVariantNumeric:"tabular-nums"},Bi={textAlign:"left",padding:"5px 10px",borderBottom:"2px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))"},Di={padding:"4px 10px",borderBottom:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))"},Wi={textAlign:"left",fontSize:11,color:"var(--semiotic-data-table-muted-text, var(--semiotic-text-secondary, #666))",marginBottom:4,fontStyle:"italic"},zi={marginTop:8,padding:"4px 10px",fontSize:12,cursor:"pointer",border:"1px solid var(--semiotic-data-table-border, var(--semiotic-border, #e0e0e0))",borderRadius:"var(--semiotic-border-radius, 4px)",background:"var(--semiotic-data-table-bg, var(--semiotic-surface, var(--semiotic-bg, #fff)))",color:"var(--semiotic-data-table-text, var(--semiotic-text, #333))",fontFamily:"inherit"};function Hi({scene:e,chartType:t,tableId:n,chartTitle:o}){const[r,i]=xi.useState(!1),[s,a]=xi.useState(5),l=bi.useContext(vi),c=l?.visible??!1,u=r||c,h=xi.useRef(null),d=o?"Data summary for "+o:n?`Data summary for ${t} ${n}`:"Data summary for "+t;xi.useEffect(()=>{u||a(5)},[u]);const f=xi.useCallback(e=>{e.target===e.currentTarget&&(r||c||i(!0))},[r,c]),p=xi.useCallback(e=>{c||h.current?.contains(e.relatedTarget)||i(!1)},[c]);if(!e||0===e.length)return n?(0,ji.jsx)("span",{id:n,tabIndex:-1,style:wi}):null;if(!u)return(0,ji.jsx)("div",{id:n,className:Li,tabIndex:-1,onFocus:f,style:wi,role:"region","aria-label":d,children:(0,ji.jsxs)("button",{type:"button",onClick:()=>i(!0),children:["View data summary (",e.length," elements)"]})});const y=function(e){const t=[];if(!Array.isArray(e))return t;const n=e.some(e=>e&&("line"===e.type||"area"===e.type));for(const o of e)if(o&&"object"==typeof o&&null!==o.datum)try{switch(o.type){case"point":if(n)break;t.push({label:"Point",values:Si(Mi(o))});break;case"line":case"area":{const e=Mi(o),n=Array.isArray(e)?e:[],r="line"===o.type?"Line point":"Area point";for(const e of n)t.push({label:r,values:Si(e)});break}case"rect":{const e=Mi(o),n=null!=e&&"object"==typeof e?e:{},r=n.category??o.group??"",i=n.value??n.__aggregateValue??n.total,s=Si(n);null==s.category&&""!==r&&(s.category=r+""),null==s.value&&null!=i&&(s.value="number"==typeof i||"string"==typeof i?i:i+""),t.push({label:"Bar",values:s});break}case"heatcell":{const e=Si(Mi(o));null==e.value&&"number"==typeof o.value&&Number.isFinite(o.value)&&(e.value=o.value),t.push({label:"Cell",values:e});break}case"wedge":{const e=Mi(o),n=Si(e);if(null==n.category){const t=Ci(e),o=t.category??t.label;null!=o&&(n.category=o+"")}t.push({label:"Wedge",values:n});break}case"circle":t.push({label:"Node",values:Si(Mi(o))});break;case"arc":t.push({label:"Arc",values:Si(Mi(o))});break;case"candlestick":t.push({label:"Candlestick",values:Si(Mi(o))});break;case"geoarea":{const e=Ci(Mi(o)),n=Si(e);if(null==n.name){const t=Ci(e.properties).name??e.name;null!=t&&(n.name=t+"")}t.push({label:"Region",values:n});break}}}catch{}return t}(e),m=function(e){if(!e||0===e.length)return[];const t=new Set;for(const n of e)if(n&&n.values)for(const e of Object.keys(n.values))t.add(e);const n=[];for(const o of t){const t=[],r=new Set;for(const n of e){if(!n||!n.values)continue;const e=n.values[o];null!=e&&""!==e&&("number"==typeof e&&!Number.isNaN(e)&&Number.isFinite(e)?t.push(e):"number"==typeof e||"object"!=typeof e&&"function"!=typeof e&&r.add(e+""))}if(t.length>0){let e=t[0],r=t[0],i=0;for(const n of t)e>n&&(e=n),n>r&&(r=n),i+=n;n.push({name:o,count:t.length,numeric:!0,min:e,max:r,mean:i/t.length})}else if(r.size>0){const e=Array.from(r);n.push({name:o,count:e.length,numeric:!1,uniqueValues:e.slice(0,5)})}}return n}(y),g=function(e,t){const n=[e+" data points."];for(const e of t)if(e.numeric)n.push(`${e.name}: ${Ri(e.min)} to ${Ri(e.max)}, mean ${Ri(e.mean)}.`);else{const t=e.uniqueValues,o=t.length>3?`${t.slice(0,3).join(", ")}… (${e.count} unique)`:t.join(", ");n.push(`${e.name}: ${o}.`)}return n.join(" ")}(y.length,m),x=Math.min(s,y.length),b=y.slice(0,x),v=y.length-x,k=new Set;for(const e of b)for(const t of Object.keys(e.values))k.add(t);const w=Array.from(k);return(0,ji.jsxs)("div",{ref:h,id:n,className:Ii,tabIndex:-1,onBlur:p,style:Ti,role:"region","aria-label":d,children:[(0,ji.jsx)("button",{type:"button",className:"semiotic-accessible-data-table-close",onClick:()=>{c&&l&&l.setVisible(!1),i(!1)},"aria-label":"Close data summary",style:Fi,children:"×"}),(0,ji.jsx)("div",{className:"semiotic-accessible-data-table-summary",role:"note",style:Ni,children:g}),(0,ji.jsxs)("table",{className:"semiotic-accessible-data-table-table",role:"table","aria-label":"Sample data for "+t,style:Oi,children:[(0,ji.jsx)("caption",{className:"semiotic-accessible-data-table-caption",style:Wi,children:v>0?`First ${x} of ${y.length} data points`:`All ${y.length} data points`}),(0,ji.jsx)("thead",{children:(0,ji.jsxs)("tr",{children:[(0,ji.jsx)("th",{style:Bi,children:"type"}),w.map(e=>(0,ji.jsx)("th",{style:Bi,children:e},e))]})}),(0,ji.jsx)("tbody",{children:b.map((e,t)=>(0,ji.jsxs)("tr",{children:[(0,ji.jsx)("td",{style:Di,children:e.label}),w.map(t=>{return(0,ji.jsx)("td",{style:Di,children:(n=e.values[t],null==n||""===n?"—":"number"==typeof n?Number.isNaN(n)?"—":Ri(n):"boolean"==typeof n?n?"true":"false":"object"==typeof n?"—":n+"")},t);var n})]},t))})]}),v>0&&(0,ji.jsxs)("button",{type:"button",className:"semiotic-accessible-data-table-show-more",onClick:()=>a(e=>e+25),style:zi,children:["Show ",Math.min(25,v)," more"," ",1===v?"row":"rows"," (",v," remaining)"]})]})}function Ei({summary:e}){return e?(0,ji.jsx)("div",{role:"note",style:wi,children:e}):null}function $i({tableId:e}){return(0,ji.jsx)("a",{href:"#"+e,style:wi,onClick:t=>{t.preventDefault();const n=document.getElementById(e);n&&requestAnimationFrame(()=>n.focus())},onFocus:e=>{Object.assign(e.currentTarget.style,{position:"absolute",width:"auto",height:"auto",overflow:"visible",clip:"auto",whiteSpace:"normal",padding:"4px 8px",background:"var(--semiotic-bg, #fff)",color:"var(--semiotic-text, #000)",border:"2px solid var(--semiotic-focus, #005fcc)",borderRadius:"4px",zIndex:"10",fontSize:"12px",top:"4px",left:"4px"})},onBlur:e=>{const t=e.currentTarget;t.removeAttribute("style"),Object.assign(t.style,wi)},children:"Skip to data table"})}var Yi=require("react/jsx-runtime"),Gi="var(--semiotic-focus, #005fcc)";function qi({active:e,hoverPoint:t,margin:n,size:o,shape:r="circle",width:i,height:s,pathData:a}){if(!e||!t)return null;const l=t.x+n.left,c=t.y+n.top;let u;if("geoarea"!==r&&"path"!==r||!a)if("rect"===r&&null!=i&&null!=s){const e=Math.max(i,4),t=Math.max(s,4);u=(0,Yi.jsx)("rect",{x:l-e/2-3,y:c-t/2-3,width:e+6,height:t+6,rx:3,fill:"none",stroke:Gi,strokeWidth:2,strokeDasharray:"4,2"})}else u=(0,Yi.jsx)("circle","wedge"===r?{cx:l,cy:c,r:12,fill:"none",stroke:Gi,strokeWidth:2.5,strokeDasharray:"6,3"}:{cx:l,cy:c,r:8,fill:"none",stroke:Gi,strokeWidth:2,strokeDasharray:"4,2"});else u=(0,Yi.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:(0,Yi.jsx)("path",{d:a,fill:"none",stroke:Gi,strokeWidth:2.5,strokeDasharray:"6,3"})});return(0,Yi.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:o[0],height:o[1],pointerEvents:"none",zIndex:2},"aria-hidden":"true",children:u})}var Vi=c(require("react"));function Xi(e,t){return"touch"===t?Math.max(e,24):e}function Ui(e){return Array.isArray(e)?e[0]:e}function Ki(e,t,n,o){return{data:Ui(e),x:t,y:n,__semioticHoverData:!0,...o}}var Qi=["name","label","title"],Zi=["type","kind","category","group","class","status","role","shape"],Ji=["value","amount","total","count","weight","score"],es=new Set(["x","y","z","x0","x1","y0","y1","r","cx","cy","radius","layer","row","rowindex","col","column","depth","index","order","sankeywidth","coincidentpoints","sourcelinks","targetlinks","parent","children","fx","fy","vx","vy"]);function ts(e,t){for(const n of t){const t=e.find(e=>e.lower===n);if(t)return t}}var ns=require("react/jsx-runtime"),os={background:"var(--semiotic-tooltip-bg, rgba(0, 0, 0, 0.85))",color:"var(--semiotic-tooltip-text, white)",padding:"8px 12px",borderRadius:"var(--semiotic-tooltip-radius, 6px)",fontSize:"var(--semiotic-tooltip-font-size, 14px)",fontFamily:"var(--semiotic-font-family, inherit)",lineHeight:"1.5",boxShadow:"var(--semiotic-tooltip-shadow, 0 2px 8px rgba(0, 0, 0, 0.15))",pointerEvents:"none",maxWidth:"300px",wordWrap:"break-word"};function rs(e,t){return"function"==typeof t?t(e):e[t]}function is(e,t){if(t)return t(e);if(null==e)return"";if("number"==typeof e){if(!Number.isFinite(e))return e+"";const t=Number.isInteger(e)?e:parseFloat(e.toPrecision(6));return Math.abs(t)>9999?t.toLocaleString():t+""}return e instanceof Date?e.toLocaleDateString():"object"==typeof e&&null!==e?void 0!==e.id?e.id+"":void 0!==e.name?e.name+"":JSON.stringify(e):e+""}function ss(e={}){const{fields:t,title:n,format:o,style:r={},className:i=""}=e;return e=>{if(!e||"object"!=typeof e)return null;let s;const a=[];if(n){const t=rs(e,n);s=is(t,o)}if(t&&t.length>0)t.forEach(t=>{let n,r,i;"string"==typeof t?(n=t,r=t,i=o):(n=t.label,r=t.accessor||t.key||"",i=t.format||o);const s=rs(e,r);a.push({label:n,value:is(s,i)})});else if(!n){const t=["value","y","name","id","label"];for(const n of t)if(void 0!==e[n]){s=is(e[n],o);break}if(!s){const t=Object.keys(e).filter(e=>!e.startsWith("_"));t.length>0&&(s=is(e[t[0]],o))}}const l={...os,...r};return(0,ns.jsxs)("div",{className:("semiotic-tooltip "+i).trim(),style:l,children:[s&&(0,ns.jsx)("div",{style:{fontWeight:a.length>0?"bold":"normal"},children:s}),a.map((e,t)=>(0,ns.jsxs)("div",{style:{marginTop:0===t&&s?"4px":0},children:[e.label&&(0,ns.jsxs)("span",{children:[e.label,": "]}),e.value]},t))]})}}function as(){return e=>{const t=e.allSeries;if(!t||0===t.length)return(0,ns.jsx)("div",{className:"semiotic-tooltip",style:os,children:(0,ns.jsx)("div",{children:is(e.data?.value??e.data?.y)})});const n=e.xValue??e.data?.time??e.data?.x;return(0,ns.jsxs)("div",{className:"semiotic-tooltip",style:os,children:[null!=n&&(0,ns.jsx)("div",{style:{fontWeight:600,marginBottom:4,fontSize:"0.9em",borderBottom:"1px solid var(--semiotic-border, #eee)",paddingBottom:4},children:is(n)}),t.map((e,t)=>(0,ns.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"1px 0"},children:[(0,ns.jsx)("span",{style:{width:8,height:8,borderRadius:"50%",backgroundColor:e.color,flexShrink:0}}),(0,ns.jsx)("span",{style:{flex:1,fontSize:"0.85em"},children:e.group}),(0,ns.jsx)("span",{style:{fontWeight:500,fontSize:"0.85em"},children:is(e.value)})]},t))]})}}function ls(e){if(!0!==e){if("function"==typeof e){const t=e;return e=>{let n=Ui(!0===e?.__semioticHoverData||e&&void 0!==e.data&&"number"==typeof e.x&&"number"==typeof e.y&&e&&("node"===e.type||"edge"===e.type||void 0!==e.nodeOrEdge||void 0!==e.allSeries||void 0!==e.stats||void 0!==e.__chartType)?e.data??{}:e);if(!n)return null;if(("node"===e?.nodeOrEdge&&"number"==typeof n?.x0&&"number"==typeof n?.x1||"edge"===e?.nodeOrEdge&&"number"==typeof n?.sankeyWidth)&&n.data&&"object"==typeof n.data&&(n=n.data),!n)return null;const o=t(n);return null==o?null:(0,ns.jsx)("div",{className:"semiotic-tooltip",style:os,children:o})}}return!1!==e&&void 0!==e&&("object"==typeof e&&null!==e&&("fields"in e||"title"in e)?ss(e):ss())}}var cs=require("react/jsx-runtime");function us({x:e,y:t,containerWidth:n,containerHeight:o,margin:r,children:i,className:s="stream-frame-tooltip",zIndex:a=1}){const l=Number.isFinite(e)&&Number.isFinite(t),c=Vi.useRef(null),[u,h]=Vi.useState(null);Vi.useLayoutEffect(()=>{const e=c.current;if(!e)return;const t=()=>{const t=e.getBoundingClientRect();Number.isFinite(t.width)&&Number.isFinite(t.height)&&h(e=>e&&.5>Math.abs(e.width-t.width)&&.5>Math.abs(e.height-t.height)?e:{width:t.width,height:t.height})};if(t(),"undefined"==typeof ResizeObserver)return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[s,n,o,l]);let d;d=u?`translate(${u.width+12>n-e?"calc(-100% - 12px)":"12px"}, ${u.height+12>o-t?"calc(-100% - 4px)":"4px"})`:`translate(${e>.7*n?"calc(-100% - 12px)":"12px"}, ${.3*o>t?"4px":"calc(-100% - 4px)"})`;const f=function(e){if(!Vi.isValidElement(e))return!1;const t=e.type;if("string"!=typeof t&&t&&!0===t.ownsChrome)return!0;const n=e.props;if(!0===n["data-semiotic-tooltip-chrome"])return!0;if("true"===n["data-semiotic-tooltip-chrome"])return!0;const o=n.style;if(o&&"object"==typeof o){if(null!=o.background&&""!==o.background&&"transparent"!==o.background)return!0;if(null!=o.backgroundColor&&""!==o.backgroundColor&&"transparent"!==o.backgroundColor)return!0}return!1}(i),p=f?null:os;return l?(0,cs.jsx)("div",{ref:c,className:f?s:(s+" semiotic-tooltip").trim(),style:{...p||{},position:"absolute",left:r.left+e,top:r.top+t,transform:d,pointerEvents:"none",zIndex:a,width:"max-content"},children:i}):null}var hs=c(require("react")),ds=require("react"),fs=require("react");var ps=require("react");function ys(e,t,n){const o=(0,ps.useRef)(null),[r,i]=(0,ps.useState)(null);return(0,ps.useEffect)(()=>{if(!t&&!n)return;const e=o.current;if(!e)return;const r=new ResizeObserver(e=>{for(const t of e){const{width:e,height:n}=t.contentRect;i(t=>t&&t.w===e&&t.h===n?t:{w:e,h:n})}});return r.observe(e),()=>r.disconnect()},[t,n]),[o,[t&&r?r.w:e[0],n&&r?r.h:e[1]]]}var ms=()=>"undefined"!=typeof performance?performance.now():Date.now();function gs(e,t){const n=e();return Number.isFinite(n)?n:t}var xs=class{constructor(e={}){this.randomSource=Math.random,this.subscribers=new Set,this.now=()=>this.advance(),this.random=()=>this.randomSource(),this.clock=e.clock??ms,this.lastWallTime=gs(this.clock,0),this.logicalTime=this.lastWallTime,this.pausedValue=!0===e.paused,this.visibleValue=!1!==e.visible,this.setRandomSource(e.random,e.seed)}get isActive(){return!this.pausedValue&&this.visibleValue}get paused(){return this.pausedValue}get seed(){return this.seedValue}get visible(){return this.visibleValue}configure(e){this.setClock(e.clock),this.setRandomSource(e.random,e.seed)}setPaused(e){this.pausedValue!==e&&(this.advance(),this.pausedValue=e,this.emit())}setVisible(e){this.visibleValue!==e&&(this.advance(),this.visibleValue=e,this.emit())}snapshot(){return{now:this.now(),paused:this.pausedValue,seed:this.seedValue,visible:this.visibleValue}}subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}advance(){const e=gs(this.clock,this.lastWallTime),t=Math.max(0,e-this.lastWallTime);return this.lastWallTime=e,this.isActive&&(this.logicalTime+=t),this.logicalTime}emit(){for(const e of this.subscribers)e()}setClock(e){const t=e??ms;t!==this.clock&&(this.advance(),this.clock=t,this.lastWallTime=gs(t,this.lastWallTime))}setRandomSource(e,t){const n=function(e){return"number"==typeof e&&Number.isFinite(e)?Math.trunc(e):void 0}(t);e===this.randomInput&&n===this.seedValue||(this.randomInput=e,this.seedValue=n,this.randomSource=e??(void 0===n?Math.random:function(e){let t=e>>>0;return()=>{t+=1831565813;let e=t;return e=Math.imul(e^e>>>15,1|e),e^=e+Math.imul(e^e>>>7,61|e),((e^e>>>14)>>>0)/4294967296}}(n)))}},bs="undefined"==typeof window?ds.useEffect:ds.useLayoutEffect,vs={requestAnimationFrame:e=>("undefined"==typeof window?globalThis:window).requestAnimationFrame(e),cancelAnimationFrame:e=>("undefined"==typeof window?globalThis:window).cancelAnimationFrame(e)};function ks(e,t,n){return"function"==typeof e?e({size:t,margin:n}):e}function ws(e){const t=function(){const[e,t]=(0,fs.useState)(()=>!("undefined"==typeof window||!window.matchMedia)&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,fs.useEffect)(()=>{if("undefined"==typeof window||!window.matchMedia)return;const e=window.matchMedia("(prefers-reduced-motion: reduce)");return t(e.matches),function(e,t){if("function"==typeof e.addEventListener)return e.addEventListener("change",t),()=>e.removeEventListener("change",t);const n=e;return n.addListener(t),()=>n.removeListener(t)}(e,e=>t(e.matches))},[]),e}(),n=(0,ds.useRef)(t);n.current=t;const[o,r]=ys(e.sizeProp,e.responsiveWidth,e.responsiveHeight),i=!!e.title,s=!!e.legend&&"top"===e.legendPosition,a=(0,ds.useMemo)(()=>function(e,t,n=!1){const o=n?t?58:34:t?36:0;return o>e.top?{...e,top:o}:e}({...e.marginDefault,...e.userMargin},i,s),[e.marginDefault,e.userMargin,i,s]),l=r[0]-a.left-a.right,c=r[1]-a.top-a.bottom,u=ks(e.foregroundGraphics,r,a),h=ks(e.backgroundGraphics,r,a),d=J(e=>e.theme),{transition:f,introEnabled:p}=function(e,t){if(!1===e)return{transition:void 0,introEnabled:!1};const n="undefined"!=typeof window&&window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;return{transition:e?!0===e?{duration:300}:{duration:e.duration??300,easing:"linear"===e.easing?"linear":"ease-out"}:t,introEnabled:!(n||!e||!0!==e&&!1===e.intro)}}(e.animate,e.transitionProp),y="semiotic-table-"+hs.useId(),m=(0,ds.useRef)(null);if(!m.current){const t=!e.suspendWhenHidden||"undefined"==typeof document||!document.hidden;m.current=new xs({clock:e.clock,random:e.random,seed:e.seed,paused:e.paused,visible:t})}const g=m.current;g.configure({clock:e.clock,random:e.random,seed:e.seed});const x=(0,ds.useRef)(null),b=(0,ds.useRef)(e.frameScheduler??vs);b.current=e.frameScheduler??vs;const v=(0,ds.useRef)(null),k=(0,ds.useRef)(!1),w=(0,ds.useRef)(()=>{}),A=(0,ds.useCallback)(()=>{if(null!==x.current||k.current)return;const e=b.current;let t=!1,n=!1;const o=e.requestAnimationFrame(()=>{t=!0;const e=!n;e&&(k.current=!0),x.current=null,v.current=null;try{w.current()}finally{e&&(k.current=!1)}});n=!0,t||(x.current=o,v.current=e)},[]),S=(0,ds.useCallback)(()=>{null!==x.current&&((v.current??b.current).cancelAnimationFrame(x.current),x.current=null,v.current=null)},[]);bs(()=>{g.setPaused(!0===e.paused)},[g,e.paused]),(0,ds.useEffect)(()=>{if(!e.suspendWhenHidden||"undefined"==typeof document)return void g.setVisible(!0);const t=()=>g.setVisible(!document.hidden);return t(),document.addEventListener("visibilitychange",t),()=>document.removeEventListener("visibilitychange",t)},[g,e.suspendWhenHidden]),(0,ds.useEffect)(()=>()=>{S()},[S]);const C=(0,ds.useRef)(()=>{}),M=(0,ds.useRef)(()=>{}),j=(0,ds.useRef)(null),_=(0,ds.useRef)(null),R=(0,ds.useRef)(null),P=(0,ds.useCallback)(()=>{const e=j.current;j.current=null,e&&C.current(e)},[]),L=(0,ds.useCallback)(e=>{if(j.current={clientX:e.clientX,clientY:e.clientY,pointerType:e.pointerType},null===_.current){const e=b.current;let t=!1;const n=e.requestAnimationFrame(()=>{t=!0,_.current=null,R.current=null,P()});t||(_.current=n,R.current=e)}},[P]),I=(0,ds.useCallback)(()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null),M.current()},[]);(0,ds.useEffect)(()=>()=>{j.current=null,null!==_.current&&((R.current??b.current).cancelAnimationFrame(_.current),_.current=null,R.current=null)},[]);const T=e.themeDirtyRef;return bs(()=>{T&&(Cn++,T.current=!0,A())},[d,A,T]),{reducedMotion:t,reducedMotionRef:n,responsiveRef:o,size:r,margin:a,adjustedWidth:l,adjustedHeight:c,resolvedForeground:u,resolvedBackground:h,currentTheme:d,transition:f,introEnabled:p,tableId:y,frameRuntime:g,rafRef:x,renderFnRef:w,scheduleRender:A,cancelRender:S,hoverHandlerRef:C,hoverLeaveRef:M,onPointerMove:L,onPointerLeave:I}}var As=require("react"),Ss=require("react/jsx-runtime");function Cs({children:e,size:t,margin:n,overflowVisible:o=!1}){return e?(0,Ss.jsx)("svg",{style:{position:"absolute",left:0,top:0,width:t[0],height:t[1],pointerEvents:"none",overflow:o?"visible":void 0},children:(0,Ss.jsx)("g",{transform:`translate(${n.left},${n.top})`,children:e})}):null}function Ms(e,t,n,o){return"function"==typeof e?e({size:t,margin:n,scales:o}):e}function js(e,t,n,o){const r=e.getContext("2d");if(!r)return null;const i=Math.round(t[0]*o),s=Math.round(t[1]*o),a=i/t[0],l=s/t[1],c=t[0]+"px",u=t[1]+"px";return e.style.width!==c&&(e.style.width=c),e.style.height!==u&&(e.style.height=u),e.width===i&&e.height===s||(e.width=i,e.height=s),r.setTransform(a,0,0,l,0,0),r.translate(n.left,n.top),r}var _s=require("react");function Rs(e,t,n,o){return"string"==typeof e?{key:e,fn:null}:"function"==typeof e?{key:n,fn:e}:"string"==typeof t?{key:t,fn:null}:"function"==typeof t?{key:o,fn:t}:{key:void 0,fn:null}}var Ps=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Ls=3156e7;function Is(e){const t=e[1]-e[0];return 864e5>t?e=>{const t=new Date(e);return`${(t.getUTCHours()+"").padStart(2,"0")}:${(t.getUTCMinutes()+"").padStart(2,"0")}`}:Ls>t?e=>{const t=new Date(e);return`${Ps[t.getUTCMonth()]} ${t.getUTCDate()}`}:5*Ls>t?e=>{const t=new Date(e);return`${Ps[t.getUTCMonth()]} ${t.getUTCFullYear()}`}:e=>new Date(e).getUTCFullYear()+""}function Ts(e){if(!e)return;const t=[];for(const n of e)if("point"===n.type)t.push(n);else if("symbol"===n.type)t.push({pointId:n.pointId,x:n.x,y:n.y,r:ht(n.size)});else if("glyph"===n.type){const e=kn(n.glyph,n.size);t.push({pointId:n.pointId,x:n.x+e.centerDx,y:n.y+e.centerDy,r:e.radius})}return t}var Ns=require("d3-shape");function Fs(e,t,n){let o=n;for(const n of t)"lesser"===n.thresholdType?n.value>e&&(o=n.color):e>n.value&&(o=n.color);return o}function Os(e,t,n,o,r,i){if(2>t.length)return;const s=[0];for(let e=1;t.length>e;e++){const n=t[e][0]-t[e-1][0],o=t[e][1]-t[e-1][1];s.push(s[e-1]+Math.sqrt(n*n+o*o))}const a=s[s.length-1];if(0===a)return;const l=Math.min(.2*a,40);e.strokeStyle=n,e.lineWidth=o,e.lineCap=i;for(let n=0;t.length-1>n;n++){const o=(s[n]+s[n+1])/2;let i=r;l>o&&(i*=o/l),l>a-o&&(i*=(a-o)/l),e.globalAlpha=Math.max(0,i),e.beginPath(),e.moveTo(t[n][0],t[n][1]),e.lineTo(t[n+1][0],t[n+1][1]),e.stroke()}}var Bs=(e,t,n,o)=>{const r=t.filter(e=>"line"===e.type);for(const t of r){if(2>t.path.length)continue;const n=t._introClipFraction;void 0!==n&&1>n&&(e.save(),e.beginPath(),e.rect(0,0,o.width*n,o.height),e.clip());const r=t.style.stroke||"#007bff",i=Rn(e,r)||r,s=t.style.strokeWidth||2,a=t.colorThresholds,l=t.rawValues;if(e.setLineDash(t.style.strokeDasharray?t.style.strokeDasharray.split(/[\s,]+/).map(Number):[]),null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),e.lineWidth=s,e.lineCap=t.style.strokeLinecap||"butt",t.style._edgeFade){Os(e,t.path,i,s,t.style.opacity??1,t.style.strokeLinecap||"butt"),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt";continue}const c=Wn(t.curve),u=a&&a.length>0&&l&&l.length===t.path.length,h=t._decayOpacities;if(h&&h.length===t.path.length&&!u){e.strokeStyle=i;const n=t.style.opacity??1;for(let o=0;t.path.length-1>o;o++)e.globalAlpha=.5*(h[o]+h[o+1])*n,e.beginPath(),e.moveTo(t.path[o][0],t.path[o][1]),e.lineTo(t.path[o+1][0],t.path[o+1][1]),e.stroke()}else if(u){let n=function(t,n,o){e.beginPath(),e.strokeStyle=t,e.moveTo(n,o),h=!0},o=function(){h&&(e.stroke(),h=!1)},r=null,s=null,c=null,u=null,h=!1;for(let h=0;t.path.length>h;h++){const[d,f]=t.path[h],p=l[h],y=Fs(p,a,i);if(null!==r&&null!==u&&null!==c){if(y===u)e.lineTo(d,f);else{const t=[];for(const e of a){const n=e.value;(c>n||n>p)&&(n>c||p>n)||c===n||p===n||t.push({t:(n-c)/(p-c)})}t.sort((e,t)=>e.t-t.t);for(const l of t){const t=r+(d-r)*l.t,u=s+(f-s)*l.t,h=Fs(c+(p-c)*Math.min(l.t+1e-4,1),a,i);e.lineTo(t,u),o(),n(h,t,u)}e.lineTo(d,f)}r=d,s=f,c=p,u=y}else n(y,d,f),r=d,s=f,c=p,u=y}o()}else{e.beginPath();const n=t.strokeGradient&&t.path.length>=2?En(e,t.strokeGradient,t.path[0][0],0,t.path[t.path.length-1][0],0):null;if(e.strokeStyle=n||i,c)(0,Ns.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}e.stroke()}if(t.style.fill&&t.style.fillOpacity&&t.style.fillOpacity>0){if(e.beginPath(),e.globalAlpha=t.style.fillOpacity,e.fillStyle=zn(e,t.style.fill,t.style.fill),c&&!u)(0,Ns.line)().x(e=>e[0]).y(e=>e[1]).curve(c).context(e)(t.path);else{const[n,o]=t.path[0];e.moveTo(n,o);for(let n=1;t.path.length>n;n++)e.lineTo(t.path[n][0],t.path[n][1])}const n=t.path[0][0];e.lineTo(t.path[t.path.length-1][0],o.height),e.lineTo(n,o.height),e.closePath(),e.fill()}void 0!==n&&1>n&&e.restore(),e.globalAlpha=1,e.setLineDash([]),e.lineCap="butt"}};function Ds(e){return!(!e._pulseIntensity||0>=e._pulseIntensity)}function Ws(e,t,n=.3){Ds(t)&&(e.globalAlpha=t._pulseIntensity*n,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.fillRect(t.x,t.y,t.w,t.h))}function zs(e,t,n=.6){if(!Ds(t))return;const o=t.r+(t._pulseGlowRadius??4)*t._pulseIntensity,r=t.cx??t.x??0,i=t.cy??t.y??0;e.beginPath(),e.arc(r,i,o,0,2*Math.PI),e.strokeStyle=t._pulseColor||"rgba(255,255,255,0.6)",e.lineWidth=2*t._pulseIntensity,e.globalAlpha=t._pulseIntensity*n,e.stroke()}function Hs(e,t,n,o=.35){Ds(t)&&(e.globalAlpha=t._pulseIntensity*o,e.fillStyle=t._pulseColor||"rgba(255,255,255,0.6)",n?e.fill(n):e.fill())}var Es=require("d3-shape");function $s(e,t){const n=Wn(t.curve);if(!n||2>t.topPath.length||2>t.bottomPath.length){e.beginPath(),e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1]);for(let n=t.bottomPath.length-1;n>=0;n--)e.lineTo(t.bottomPath[n][0],t.bottomPath[n][1]);e.closePath()}else{const o=(0,Es.area)().x(e=>e[0]).y0((e,n)=>t.bottomPath[n][1]).y1(e=>e[1]).curve(n).context(e);e.beginPath(),o(t.topPath)}}var Ys=(e,t,n,o)=>{const r=t.filter(e=>"area"===e.type);for(const t of r){if(2>t.topPath.length)continue;let n=!1;t.clipRect&&(e.save(),e.beginPath(),e.rect(t.clipRect.x,t.clipRect.y,t.clipRect.width,t.clipRect.height),e.clip(),n=!0);const r=t._introClipFraction;void 0!==r&&1>r&&(e.save(),e.beginPath(),e.rect(0,0,o.width*r,o.height),e.clip());const i=zn(e,t.style.fill,"#4e79a7"),s=t._decayOpacities;if(s&&s.length===t.topPath.length){const n=t.style.fillOpacity??.7;e.fillStyle=i;for(let o=0;t.topPath.length-1>o;o++)e.globalAlpha=.5*(s[o]+s[o+1])*n,e.beginPath(),e.moveTo(t.topPath[o][0],t.topPath[o][1]),e.lineTo(t.topPath[o+1][0],t.topPath[o+1][1]),e.lineTo(t.bottomPath[o+1][0],t.bottomPath[o+1][1]),e.lineTo(t.bottomPath[o][0],t.bottomPath[o][1]),e.closePath(),e.fill();if(t.style.stroke&&"none"!==t.style.stroke){e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);for(let n=0;t.topPath.length-1>n;n++)e.globalAlpha=.5*(s[n]+s[n+1]),e.beginPath(),e.moveTo(t.topPath[n][0],t.topPath[n][1]),e.lineTo(t.topPath[n+1][0],t.topPath[n+1][1]),e.stroke()}e.globalAlpha=1;continue}const a=t.style.opacity??1;if($s(e,t),t.fillGradient&&("colorStops"in t.fillGradient&&t.fillGradient.colorStops.length>=2||"topOpacity"in t.fillGradient)&&t.fillGradient){let n=1/0;for(const e of t.topPath)n>e[1]&&(n=e[1]);let o=-1/0;for(const e of t.bottomPath)e[1]>o&&(o=e[1]);const r=Hn(e,t.fillGradient,"string"==typeof i?i:"#4e79a7",0,n,0,o);e.fillStyle=r||i,e.globalAlpha=a}else e.globalAlpha=(t.style.fillOpacity??.7)*a,e.fillStyle=i;if(e.fill(),t._pulseIntensity&&t._pulseIntensity>0&&($s(e,t),Hs(e,t)),t.style.stroke&&"none"!==t.style.stroke){e.globalAlpha=a;const n=t.strokeGradient&&t.topPath.length>=2?En(e,t.strokeGradient,t.topPath[0][0],0,t.topPath[t.topPath.length-1][0],0):null;e.strokeStyle=n||Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||2,e.setLineDash([]);const o=Wn(t.curve);if(e.beginPath(),o)(0,Es.line)().x(e=>e[0]).y(e=>e[1]).curve(o).context(e)(t.topPath);else{e.moveTo(t.topPath[0][0],t.topPath[0][1]);for(let n=1;t.topPath.length>n;n++)e.lineTo(t.topPath[n][0],t.topPath[n][1])}e.stroke()}void 0!==r&&1>r&&e.restore(),n&&e.restore(),e.globalAlpha=1}},Gs=(e,t,n,o)=>{const r=t.filter(e=>"point"===e.type);if(0!==r.length){e.save();try{const t=e.globalAlpha;for(const n of r)e.beginPath(),e.arc(n.x,n.y,n.r,0,2*Math.PI),e.globalAlpha=t*(n.style.opacity??n.style.fillOpacity??1),e.fillStyle=zn(e,n.style.fill,"#4e79a7"),e.fill(),n.style.stroke&&(e.strokeStyle=zn(e,n.style.stroke,n.style.stroke),e.lineWidth=n.style.strokeWidth||1,e.stroke()),zs(e,n)}finally{e.restore()}}},qs=new Map;function Vs(e){try{if(e.path)return new Path2D(e.path);const t=`${e.symbolType??"circle"}:${Math.round(e.size)}`;let n=qs.get(t);return n||(n=new Path2D(ut(e.symbolType,e.size)),qs.size>256&&qs.clear(),qs.set(t,n)),n}catch{return null}}var Xs=(e,t)=>{const n=e.globalAlpha;for(const o of t){if("symbol"!==o.type)continue;const t=o;if(0>=t.size)continue;const r=Vs(t);if(!r)continue;e.save(),e.translate(t.x,t.y),t.rotation&&e.rotate(t.rotation);const i=(t.style.opacity??1)*(t._decayOpacity??1);t.style.fill&&(e.globalAlpha=n*i*(t.style.fillOpacity??1),e.fillStyle=zn(e,t.style.fill,"#4e79a7"),e.fill(r)),t.style.stroke&&"none"!==t.style.stroke&&(e.globalAlpha=n*i,e.strokeStyle=zn(e,t.style.stroke,t.style.stroke),e.lineWidth=t.style.strokeWidth??1,e.stroke(r)),e.restore()}e.globalAlpha=n};function Us(e,t,n,o,r){if(0>=t.size)return;const i=t.glyph;if(!i||!i.parts?.length)return;const s=yn(i,t.size);if(0>=s.scale)return;const a=(t.style.opacity??1)*(t._decayOpacity??1);if(0>=a)return;const l=t=>{const n=zn(e,t,t);return"string"==typeof n?n:t},c=t.color??("string"==typeof t.style.fill?t.style.fill:void 0);e.save(),e.translate(n,o),t.rotation&&e.rotate(t.rotation),e.translate(s.offsetX,s.offsetY),e.scale(s.scale,s.scale),e.globalAlpha=r*a*(t.style.fillOpacity??1);const u=vn(i,t.fraction??1,t.fractionStart??0,t.fractionDirection??"horizontal");u&&t.ghostColor&&wn(e,i,c,t.accent,t.ghostColor,l),u&&(e.beginPath(),e.rect(u.x,u.y,u.width,u.height),e.clip()),wn(e,i,c,t.accent,void 0,l),e.restore()}function Ks(e,t){const{x:n,y:o,w:r,h:i}=t,{tl:s,tr:a,br:l,bl:c}=function(e){const t=e.cornerRadii;if(!t)return{tl:0,tr:0,br:0,bl:0};const n=Math.min(e.w,e.h)/2,o=e=>Math.max(0,Math.min(e??0,n));return{tl:o(t.tl),tr:o(t.tr),br:o(t.br),bl:o(t.bl)}}(t);e.beginPath(),e.moveTo(n+s,o),e.lineTo(n+r-a,o),a>0&&e.arcTo(n+r,o,n+r,o+a,a),e.lineTo(n+r,o+i-l),l>0&&e.arcTo(n+r,o+i,n+r-l,o+i,l),e.lineTo(n+c,o+i),c>0&&e.arcTo(n,o+i,n,o+i-c,c),e.lineTo(n,o+s),s>0&&e.arcTo(n,o,n+s,o,s),e.closePath()}function Qs(e){switch(e.roundedEdge){case"bottom":return{x0:e.x,y0:e.y+e.h,x1:e.x,y1:e.y};case"right":return{x0:e.x+e.w,y0:e.y,x1:e.x,y1:e.y};case"left":return{x0:e.x,y0:e.y,x1:e.x+e.w,y1:e.y};default:return{x0:e.x,y0:e.y,x1:e.x,y1:e.y+e.h}}}var Zs=(e,t,n,o)=>{const r=t.filter(e=>"rect"===e.type);for(const t of r){if(null!=t.style.opacity&&(e.globalAlpha=t.style.opacity),t.style.icon)Js(e,t);else if(t.cornerRadii&&oi(t.cornerRadii)){const n=zn(e,t.style.fill,Rn(e,"var(--semiotic-primary, #007bff)")),o=Qs(t),r=t.fillGradient&&"string"==typeof n?Hn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,Ks(e,t),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else if(t.roundedTop&&t.roundedTop>0){const n=zn(e,t.style.fill,Rn(e,"var(--semiotic-primary, #007bff)")),o=Qs(t),r=t.fillGradient&&"string"==typeof n?Hn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n;const i=Math.min(t.roundedTop,t.w/2,t.h/2);e.beginPath();const{x:s,y:a,w:l,h:c}=t;switch(t.roundedEdge){case"right":e.moveTo(s,a),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s,a+c);break;case"left":e.moveTo(s+l,a),e.lineTo(s+i,a),e.arcTo(s,a,s,a+i,i),e.lineTo(s,a+c-i),e.arcTo(s,a+c,s+i,a+c,i),e.lineTo(s+l,a+c);break;case"bottom":e.moveTo(s,a),e.lineTo(s+l,a),e.lineTo(s+l,a+c-i),e.arcTo(s+l,a+c,s+l-i,a+c,i),e.lineTo(s+i,a+c),e.arcTo(s,a+c,s,a+c-i,i);break;default:e.moveTo(s,a+c),e.lineTo(s,a+i),e.arcTo(s,a,s+i,a,i),e.lineTo(s+l-i,a),e.arcTo(s+l,a,s+l,a+i,i),e.lineTo(s+l,a+c)}e.closePath(),e.fill(),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.stroke())}else{const n=zn(e,t.style.fill,Rn(e,"var(--semiotic-primary, #007bff)")),o=Qs(t),r=t.fillGradient&&"string"==typeof n?Hn(e,t.fillGradient,n,o.x0,o.y0,o.x1,o.y1):null;e.fillStyle=r||n,e.fillRect(t.x,t.y,t.w,t.h),t.style.stroke&&"none"!==t.style.stroke&&(e.strokeStyle=Rn(e,t.style.stroke)||t.style.stroke,e.lineWidth=t.style.strokeWidth||1,e.strokeRect(t.x,t.y,t.w,t.h))}Ws(e,t),e.globalAlpha=1}};function Js(e,t){const n=t.style.icon,o=t.style.iconPadding||2,r=Math.min(t.w,t.h)-o;if(0>=r)return;const i=t.h>t.w;if(e.save(),e.beginPath(),e.rect(t.x,t.y,t.w,t.h),e.clip(),i){const i=r+o,s=t.x+(t.w-r)/2;for(let o=t.y+t.h-r;o>=t.y-r;o-=i)e.drawImage(n,s,o,r,r)}else{const i=r+o,s=t.y+(t.h-r)/2;for(let o=t.x;t.x+t.w>o;o+=i)e.drawImage(n,o,s,r,r)}e.restore()}function ea(e){const[t,n,o]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(e);return.299*t+.587*n+.114*o>128?"#000":"#fff"}function ta(e){return Number.isInteger(e)?e+"":100>Math.abs(e)?1>Math.abs(e)?e.toPrecision(3):e.toFixed(1):e.toFixed(0)}var na=(e,t,n,o)=>{const r=t.filter(e=>"heatcell"===e.type);e.save();try{for(const t of r){const n=t.style;if(null!=n?.opacity&&(e.globalAlpha=n.opacity),e.fillStyle=t.fill,e.fillRect(t.x,t.y,t.w,t.h),e.strokeStyle=Rn(e,"var(--semiotic-surface, #fff)"),e.lineWidth=1,e.strokeRect(t.x,t.y,t.w,t.h),Ws(e,t),e.globalAlpha=1,t.showValues&&null!=t.value){if(20>t.w||20>t.h)continue;const n=t.valueFormat?t.valueFormat(t.value):ta(t.value),o=Math.max(10,Math.min(16,.3*Math.min(t.w,t.h))),r=t.x+t.w/2,i=t.y+t.h/2;e.fillStyle=ea(t.fill),e.font=o+"px sans-serif",e.textAlign="center",e.textBaseline="middle",e.fillText(n,r,i)}}}finally{e.restore()}},oa=(e,t,n,o)=>{for(const n of t){if("candlestick"!==n.type)continue;const t=n;e.save();const r=(t._decayOpacity??1)*(t.style?.opacity??1);1!==r&&(e.globalAlpha=r);const i=Rn(e,t.wickColor)||t.wickColor,s=60>o.height,a=s?Math.max(t.wickWidth,2):t.wickWidth,l=()=>{e.beginPath(),e.moveTo(t.x,t.highY),e.lineTo(t.x,t.lowY),e.strokeStyle=i,e.lineWidth=a,e.stroke()};if(s||l(),t.isRange){const n=Math.max(2,Math.min(t.bodyWidth/2,.12*o.height));e.fillStyle=i,e.beginPath(),e.arc(t.x,t.highY,n,0,2*Math.PI),e.fill(),e.beginPath(),e.arc(t.x,t.lowY,n,0,2*Math.PI),e.fill()}else if(t.bodyWidth>0){const n=Math.min(t.openY,t.closeY),o=Math.abs(t.openY-t.closeY),r=t.isUp?t.upColor:t.downColor,i=Rn(e,r)||r;e.fillStyle=i,e.fillRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1)),e.strokeStyle=i,e.lineWidth=1,e.strokeRect(t.x-t.bodyWidth/2,n,t.bodyWidth,Math.max(o,1))}s&&l(),e.restore()}},ra={line:[Ys,Bs,Gs],area:[Ys,Gs],stackedarea:[Ys,Gs],scatter:[Gs,Xs],bubble:[Gs,Xs],heatmap:[na],bar:[Zs],swarm:[Gs],waterfall:[(e,t,n,o)=>{Zs(e,t);const r=t.filter(e=>"rect"===e.type);if(2>r.length)return;const i=r[0].datum,s=i?._connectorStroke;if(s){e.save(),e.strokeStyle=Rn(e,s)||s,e.lineWidth=i?._connectorWidth??1,e.setLineDash([]);for(let t=0;r.length-1>t;t++){const o=r[t],i=r[t+1],s=o.datum,a=i.datum;if(null==s?.cumEnd||null==a?.baseline)continue;const l=n.y(s.cumEnd),c=o.x+o.w,u=i.x;e.beginPath(),e.moveTo(c,l),e.lineTo(u,l),e.stroke()}e.restore()}}],candlestick:[oa],mixed:[Ys,Bs,Gs],custom:[Ys,Zs,na,Bs,Gs,Xs,(e,t)=>{const n=e.globalAlpha;for(const o of t)"glyph"===o.type&&Us(e,o,o.x,o.y,n);e.globalAlpha=n},oa]},ia=new Set;function sa(e,t){const n="function"==typeof e?e(t.datum??null,t):e;return(o=n)&&"object"==typeof o&&"string"==typeof o.id&&"function"==typeof o.cacheKey&&"function"==typeof o.drawCanvas&&"function"==typeof o.renderStaticSVG?n:void 0;var o}function aa(e,t){if("undefined"!=typeof process&&"production"===process.env?.NODE_ENV)return;const n=`${e}:${t}`;ia.has(n)||(ia.add(n),console.warn(`[Semiotic] Render backend "${e}" does not support scene node "${t}"; using the built-in renderer.`))}var la=require("react/jsx-runtime");function ca(e){return"string"==typeof e?e:"value"}function ua(e){return null==e?"–":"number"==typeof e?Math.abs(e)>9999?e.toLocaleString():e+"":e instanceof Date?e.toLocaleDateString():e+""}function ha(e,t){if(!t)return ua(e);try{const n=t(e);return null==n?ua(e):n}catch{return ua(e)}}function da(e,t){return"function"==typeof t?t(e):e[t]}function fa(e,t){if(!e)return[];const n=[];return(Array.isArray(e)?e:[e]).forEach((e,o)=>{const r="string"==typeof e?.y0Accessor?e.y0Accessor:"low",i="string"==typeof e?.y1Accessor?e.y1Accessor:"high";n.push({label:r,accessor:e=>e.bands?.[o]?.y0??(0===o?e.band?.y0:void 0),format:t}),n.push({label:i,accessor:e=>e.bands?.[o]?.y1??(0===o?e.band?.y1:void 0),format:t})}),n}function pa(e){const t=e.find(e=>"title"===e.role),n=e.filter(e=>"title"!==e.role);return e=>{const o=e.data;if(!o)return null;const r=t?ha(da(o,t.accessor),t.format):null;return(0,la.jsxs)("div",{className:"semiotic-tooltip",style:os,children:[null!=r&&(0,la.jsx)("div",{style:{fontWeight:"bold",marginBottom:n.length>0?4:0},children:r}),n.map((e,t)=>{const n=ha(da(o,e.accessor),e.format);return(0,la.jsxs)("div",{style:t>0?{marginTop:2}:void 0,children:[(0,la.jsxs)("span",{style:{opacity:.7},children:[e.label,": "]}),(0,la.jsx)("span",{children:n})]},t)})]})}}var ya=require("react/jsx-runtime");function ma(e){return null==e?"":"number"==typeof e?Number.isInteger(e)?e+"":e.toFixed(2):e instanceof Date?e.toLocaleString():e+""}function ga({hover:e}){const t=e.data??{},n=t.y??t.value,o=t.x??t.time;if(void 0===n&&void 0===o){const e=function(e,t={}){if(!e||"object"!=typeof e)return{entries:[]};const n=t.maxEntries??6,o=!1!==t.skipPositional,r=[];for(const[t,n]of Object.entries(e)){if(t.startsWith("_"))continue;if("data"===t)continue;if(o&&es.has(t.toLowerCase()))continue;if(null==n)continue;const e=typeof n;("string"===e||"number"===e||"boolean"===e||n instanceof Date)&&r.push({key:t,lower:t.toLowerCase(),value:n})}if(0===r.length)return{entries:[]};let i=r.findIndex(e=>Qi.includes(e.lower));const s=i>=0;0>i&&(i=r.findIndex(e=>"id"===e.lower)),0>i&&(i=r.findIndex(e=>"string"==typeof e.value));const a=0>i?void 0:r[i];let l=r.filter((e,t)=>t!==i);s&&(l=l.filter(e=>"id"!==e.lower));const c=ts(l,Zi),u=ts(l,Ji),h=new Set(Zi),d=new Set(Ji),f=[];c&&f.push({key:c.key,value:c.value}),u&&f.push({key:u.key,value:u.value});for(const e of l){if(f.length>=n)break;e!==c&&e!==u&&(h.has(e.lower)||d.has(e.lower)||f.push({key:e.key,value:e.value}))}return{titleKey:a?.key,title:a?.value,entries:f}}(t);if(null!=e.title||e.entries.length>0)return(0,ya.jsxs)("div",{className:"semiotic-tooltip",style:os,children:[null!=e.title&&(0,ya.jsx)("div",{style:{fontWeight:600,marginBottom:e.entries.length?2:0},children:e.title+""}),e.entries.map(e=>(0,ya.jsxs)("div",{style:{opacity:.7,fontSize:11},children:[e.key,":"," ",(0,ya.jsx)("span",{style:{fontWeight:600},children:ma(e.value)})]},e.key))]})}return(0,ya.jsxs)("div",{className:"semiotic-tooltip",style:os,children:[(0,ya.jsx)("div",{style:{fontWeight:600,marginBottom:2},children:ma(n)}),(0,ya.jsx)("div",{style:{opacity:.7,fontSize:11},children:ma(o)})]})}function xa(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"hover",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"focus"===a?.type&&t({type:"focus",datum:n,inputType:"touch"===a.inputType?"pointer":a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"hover-end",timestamp:l,chartType:i,chartId:s}))}function ba(e){const{onObservation:t,datum:n,x:o=0,y:r=0,chartType:i,chartId:s,context:a,timestamp:l=Date.now()}=e;t&&(n?(t({type:"click",datum:n,x:o,y:r,timestamp:l,chartType:i,chartId:s}),"activate"===a?.type&&t({type:"activate",datum:n,inputType:a.inputType,timestamp:l,chartType:i,chartId:s})):t({type:"click-end",timestamp:l,chartType:i,chartId:s}))}ga.ownsChrome=!0;var va=require("react"),ka=require("react");function wa(e,t,n){const o=e.byGroup.get(t);let r=0,i=Math.abs(o[0].x-n.x);for(let e=1;o.length>e;e++){const t=Math.abs(o[e].x-n.x);i>t&&(i=t,r=e)}return o[r]._flatIndex}function Aa(e){const t=[];for(const n of e)switch(n.type){case"point":t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"symbol":if(0>=n.size)break;t.push({x:n.x,y:n.y,datum:n.datum,shape:"circle",group:"_default"});break;case"glyph":{if(0>=n.size||null==n.datum)break;const e=kn(n.glyph,n.size);t.push({x:n.x+e.centerDx,y:n.y+e.centerDy,datum:n.datum,shape:"rect",w:2*e.halfWidth,h:2*e.halfHeight,group:"_default"});break}case"line":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.path.length>n&&o.length>n;n++)t.push({x:e.path[n][0],y:e.path[n][1],datum:o[n],shape:"circle",group:r});break}case"area":{const e=n,o=Array.isArray(e.datum)?e.datum:[],r=e.group??"_default";for(let n=0;e.topPath.length>n&&o.length>n;n++)t.push({x:e.topPath[n][0],y:e.topPath[n][1],datum:o[n],shape:"circle",group:r});break}case"rect":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:n.group??"_default"});break;case"heatcell":t.push({x:n.x+n.w/2,y:n.y+n.h/2,datum:n.datum,shape:"rect",w:n.w,h:n.h,group:"_default"})}return t.sort((e,t)=>e.x-t.x||e.y-t.y),t}var Sa=require("react/jsx-runtime"),Ca={top:20,right:20,bottom:30,left:40},Ma=mi;function ja(e){if(e)return"x"===e.dimension?"pan-y":"y"===e.dimension?"pan-x":"none"}var _a=(0,_.memo)((0,_.forwardRef)(function(e,t){const{chartType:n,runtimeMode:o,data:r,chunkThreshold:i,chunkSize:s,xAccessor:a,yAccessor:l,accessorRevision:c,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p,lineDataAccessor:y,curve:m,normalize:g,baseline:x,stackOrder:b,binSize:v,valueAccessor:k,arrowOfTime:w="right",windowMode:A="sliding",windowSize:S=200,timeAccessor:C,xExtent:M,yExtent:R,extentPadding:P=.1,scalePadding:L,sizeRange:I,size:T=[500,300],responsiveWidth:N,responsiveHeight:F,margin:O,className:D,background:H,renderMode:E,lineStyle:$,pointStyle:Y,areaStyle:q,barStyle:V,waterfallStyle:X,swarmStyle:U,barColors:K,colorScheme:Q,boundsAccessor:Z,boundsStyle:J,y0Accessor:ee,band:te,gradientFill:ne,lineGradient:oe,areaGroups:re,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,showAxes:ue=!0,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:ye,yFormat:me,axisExtent:ge,tickFormatTime:xe,tickFormatValue:be,hoverAnnotation:ve,tooltipContent:ke,customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,annotationObservationCallback:Ce,chartId:Me,enableHover:je,hoverRadius:_e=30,tooltipMode:Re,annotations:Pe,onAnnotationActivate:Le,autoPlaceAnnotations:Ie,svgAnnotationRules:Te,showGrid:Ne,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,legendCategoryAccessor:Ee,onCategoriesChange:$e,backgroundGraphics:Ye,foregroundGraphics:Ge,canvasPreRenderers:qe,svgPreRenderers:Ve,title:Xe,categoryAccessor:Ue,brush:Ke,onBrush:Qe,decay:Ze,pulse:Je,transition:et,animate:tt,staleness:ot,frameScheduler:rt,clock:it,random:st,seed:at,paused:lt=!1,suspendWhenHidden:ct=!0,heatmapAggregation:ht,heatmapXBins:dt,heatmapYBins:ft,showValues:pt,heatmapValueFormat:yt,marginalGraphics:mt,pointIdAccessor:gt,xScaleType:xt,yScaleType:bt,accessibleTable:vt=!0,description:kt,summary:wt,linkedCrosshairName:At,linkedCrosshairSourceId:St,customLayout:Ct,onLayoutError:Mt,layoutConfig:jt,layoutSelection:_t}=e,{customHoverBehavior:Rt,customClickBehavior:Pt,hasClickBehavior:Lt}=function({customHoverBehavior:e,customClickBehavior:t,onObservation:n,chartId:o,chartType:r}){return{customHoverBehavior:(0,va.useCallback)((t,i)=>{e?.(t,i),xa({onObservation:n,datum:t?t.data||t:null,x:t?.x,y:t?.y,chartType:r,chartId:o,context:i})},[o,r,e,n]),customClickBehavior:(0,va.useCallback)((e,i)=>{t?.(e,i),ba({onObservation:n,datum:e?e.data||e:null,x:e?.x,y:e?.y,chartType:r,chartId:o,context:i})},[o,r,t,n]),hasClickBehavior:!(!t&&!n)}}({customHoverBehavior:we,customClickBehavior:Ae,onObservation:Se,chartId:Me,chartType:"StreamXYFrame"}),It=(0,_.useId)().replace(/:/g,""),Tt=(0,_.useRef)(!1),Nt=(0,_.useRef)({w:-1,h:-1}),Ft=(0,_.useRef)(!1),Ot=ws({sizeProp:T,responsiveWidth:N,responsiveHeight:F,userMargin:O,marginDefault:Ca,title:Xe,legend:Fe,legendPosition:ze,animate:tt,transitionProp:et,frameScheduler:rt,clock:it,random:st,seed:at,paused:lt,suspendWhenHidden:ct,themeDirtyRef:Tt}),Bt=function(){const[e,t]=(0,ai.useState)(!1);return li(()=>{t(!0)},[]),e}(),Dt=function(){const e=(0,ai.useSyncExternalStore)(ci,ui,hi);return(0,ai.useRef)(e).current}(),{reducedMotionRef:Wt,responsiveRef:zt,size:Ht,currentTheme:Et,transition:Gt,introEnabled:qt,tableId:Vt,rafRef:Xt,renderFnRef:Ut,scheduleRender:Zt,frameRuntime:en}=Ot;let tn=Ot.margin;if(mt){const e=60,t={...Ot.margin};mt.top&&e>t.top&&(t.top=e),mt.bottom&&e>t.bottom&&(t.bottom=e),mt.left&&e>t.left&&(t.left=e),mt.right&&e>t.right&&(t.right=e),tn=t}const nn=Ht[0]-tn.left-tn.right,on=Ht[1]-tn.top-tn.bottom,rn=(0,_.useMemo)(()=>W(r),[r]),sn=ve??je,[cn,un]=(0,_.useState)(0),hn=(0,_.useRef)(0),[dn,fn]=(0,_.useState)(null),pn=Ms(Ge,Ht,tn,dn),mn=Ms(Ye,Ht,tn,dn),xn=(0,_.useRef)(null),bn=(0,_.useRef)(null),kn=(0,_.useRef)(void 0),[wn,An]=(0,_.useState)(null),Sn=(0,_.useRef)(Ma.primary),Mn=(0,_.useRef)(function(){let e=-1,t=mi;return{resolve(n){if(!n)return mi;const o=Cn;return o===e||(t=function(e){if(!e)return mi;const t=getComputedStyle(e),n=t.getPropertyValue("--semiotic-border").trim(),o=t.getPropertyValue("--semiotic-text-secondary").trim(),r=t.getPropertyValue("--semiotic-bg").trim(),i=t.getPropertyValue("--semiotic-primary").trim(),s=o||t.getPropertyValue("--text-secondary").trim(),a=t.getPropertyValue("--text-primary").trim(),l=n||t.getPropertyValue("--surface-3").trim(),c=r||t.getPropertyValue("--surface-0").trim();return s||a||n||i?{axisStroke:l||mi.axisStroke,tickText:s||mi.tickText,crosshair:s?gi(s,"66"):mi.crosshair,hoverFill:c?gi(c,"4D"):mi.hoverFill,hoverStroke:s?gi(s,"99"):mi.hoverStroke,pointRing:c||mi.pointRing,primary:i||mi.primary,background:c||mi.background}:mi}(n),e=o),t},invalidate(){e=-1}}}()),jn=(0,_.useRef)(!1),_n=(0,Yt.useRef)(new Kt("StreamXYFrame")),[Pn,Ln]=(0,_.useState)(!1),[Tn,Nn]=(0,_.useState)([]),[Fn,Bn]=(0,_.useState)([]),Dn="streaming"===o||["bar","swarm","waterfall"].includes(n),Wn=function(e){const t=(0,di.useRef)(e);return function(e,t){if(Object.is(e,t))return!0;if(Array.isArray(e)&&Array.isArray(t))return pi(e,t);if(!yi(e)||!yi(t))return!1;const n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;for(const o of n){if(!Object.prototype.hasOwnProperty.call(t,o))return!1;const n=e[o],r=t[o];if(!Object.is(n,r))if(Array.isArray(n)&&Array.isArray(r)){if(!pi(n,r))return!1}else{if(!yi(n)||!yi(r))return!1;if(!fi(n,r))return!1}}return!0}(t.current,e)||(t.current=e),t.current}((0,_.useMemo)(()=>({chartType:n,runtimeMode:Dn?"streaming":"bounded",windowSize:S,windowMode:A,arrowOfTime:Dn?w:"right",extentPadding:P,scalePadding:L,axisExtent:ge,xAccessor:a,yAccessor:l,accessorRevision:c,timeAccessor:Dn?C:void 0,valueAccessor:k,colorAccessor:u,sizeAccessor:h,symbolAccessor:d,symbolMap:f,groupAccessor:p||(y?"_lineGroup":void 0),categoryAccessor:Ue,lineDataAccessor:y,xScaleType:xt,yScaleType:bt,xExtent:M,yExtent:R,sizeRange:I,binSize:v,normalize:g,baseline:x,stackOrder:b,boundsAccessor:Z,boundsStyle:J,y0Accessor:ee,band:te,gradientFill:!0===ne?{topOpacity:.8,bottomOpacity:.05}:!1===ne?void 0:ne,areaGroups:re?new Set(re):void 0,lineGradient:oe,openAccessor:ie,highAccessor:se,lowAccessor:ae,closeAccessor:le,candlestickStyle:ce,lineStyle:$,pointStyle:Y,areaStyle:q,swarmStyle:U,waterfallStyle:X,colorScheme:Q,barColors:K,barStyle:V,annotations:Pe,decay:Ze,pulse:Je,transition:Gt,introAnimation:qt,staleness:ot,clock:en.now,heatmapAggregation:ht,heatmapXBins:dt,heatmapYBins:ft,showValues:pt,heatmapValueFormat:yt,pointIdAccessor:gt,curve:m,themeCategorical:Et?.colors?.categorical,themeSemantic:G(Et),themeSequential:Et?.colors?.sequential,themeDiverging:Et?.colors?.diverging,customLayout:Ct,onLayoutError:Mt,layoutConfig:jt,layoutMargin:tn}),[n,Dn,S,A,w,P,L,ge,a,l,c,C,k,u,h,d,f,p,y,Ue,xt,bt,M,R,I,v,g,x,b,Z,J,ee,te,ne,re,oe,ie,se,ae,le,ce,$,Y,q,U,X,Q,K,V,Pe,Ze,Je,Gt,qt,ot,en.now,ht,dt,ft,pt,yt,gt,m,Et,Ct,Mt,jt,tn])),zn=(0,_.useRef)(null);zn.current||(zn.current=new $t(Wn));const Hn=function(e,t,n,o){const r=(0,_s.useRef)({accessor:t,onChange:n,readData:o}),i=(0,_s.useRef)([]);return r.current={accessor:t,onChange:n,readData:o},(0,_s.useCallback)(()=>{const{accessor:t,onChange:n,readData:o}=r.current;if(!n||!t)return;const s=function(e,t){if(!t)return[];const n=new Set,o=[];for(const r of e){if(!r||"object"!=typeof r)continue;const e="function"==typeof t?t(r):r[t];if(null==e)continue;const i=e+"";n.has(i)||(n.add(i),o.push(i))}return o}(e.current?o(e.current):[],t);(function(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0})(s,i.current)||(i.current=s,n(s))},[e])}(zn,Ee,$e,e=>e.getData());!function(e,t,n,o){(0,ln.useEffect)(()=>{e.current?.updateConfig(t),n.current=!0,o()},[t,o,e,n])}(zn,Wn,Tt,Zt),function(e,t,n,o){const r=(0,ln.useRef)(null);(0,ln.useEffect)(()=>{const i=e.current;if(!i)return;const s=t??null;r.current!==s&&(r.current=s,i.setLayoutSelection(s),i.hasCustomRestyle?i.restyleScene(s):n.current=!0,o())},[t,o,e,n])}(zn,_t,Tt,Zt);const En=(0,_.useRef)(null);En.current||(En.current=new z(e=>{const t=zn.current;t&&t.ingest(e)&&(Tt.current=!0,Zt())},{chunkThreshold:i,chunkSize:s})),(0,_.useEffect)(()=>{En.current?.updateChunkOptions({chunkThreshold:i,chunkSize:s})},[i,s]);const $n=(0,_.useCallback)(e=>{En.current?.push(e)},[]),Yn=(0,_.useCallback)(e=>{En.current?.pushMany(e)},[]),Xn=(0,_.useCallback)(()=>{En.current?.clear(),zn.current?.clear(),Tt.current=!0,Zt()},[Zt]);(0,_.useImperativeHandle)(t,()=>({push:$n,pushMany:Yn,remove:e=>{En.current?.flush();const t=zn.current?.remove(e)??[];return t.length>0&&(xn.current&&t.some(e=>e===xn.current?.data)&&(xn.current=null,An(null)),Tt.current=!0,Zt()),t},update:(e,t)=>{En.current?.flush();const n=zn.current?.update(e,t)??[];return n.length>0&&(Tt.current=!0,Zt()),n},clear:Xn,getData:()=>(En.current?.flush(),zn.current?.getData()??[]),getScales:()=>zn.current?.scales??null,getExtents:()=>zn.current?.getExtents()??null,getCustomLayout:()=>zn.current?.lastCustomLayoutResult??null,getLayoutFailure:()=>zn.current?.lastCustomLayoutFailure??null}),[$n,Yn,Xn,Zt]),(0,_.useEffect)(()=>{if(r){if(y&&rn.length>0&&"object"==typeof rn[0]&&null!==rn[0]){const e="string"==typeof y?y:"coordinates";if(Array.isArray(rn[0][e])){const t=[];for(const n of rn){const o=n[e];if(Array.isArray(o)){const e=n.label||n.id||n.key;if(null!=e)for(const n of o)t.push({...n,_lineGroup:e});else for(const e of o)t.push(e)}}return void En.current?.setBoundedData(t)}}En.current?.setBoundedData(rn)}},[r,rn,y]);const{canvasRef:Un,interactionCanvasRef:Kn}=function(e,t){return function(e){const{cancelRender:t,dirtyRef:n,frameRuntime:o,manageFrameRuntime:r,scheduleRender:i}=e,s=(0,As.useRef)(null),a=(0,As.useRef)(null),l=(0,As.useRef)(!1);return function(e){const{hydrated:t,wasHydratingFromSSR:n,storeRef:o,dirtyRef:r,renderFnRef:i,cancelRender:s,cleanup:a}=e;li(()=>{t&&n&&o.current?.cancelIntroAnimation?.(),r.current=!0,s?.(),i.current()},[t,n]);const l=(0,ai.useRef)(a);l.current=a,(0,ai.useEffect)(()=>()=>l.current?.(),[])}({hydrated:e.hydrated,wasHydratingFromSSR:e.wasHydratingFromSSR,storeRef:e.storeRef,dirtyRef:e.dirtyRef,renderFnRef:e.renderFnRef,cancelRender:e.cancelRender,cleanup:e.cleanup}),(0,As.useEffect)(()=>{if(!1!==r)return o.subscribe(()=>{o.isActive?(n.current=!0,i()):t()})},[t,n,o,r,i]),(0,As.useEffect)(()=>{!l.current&&(l.current=!0,e.skipInitialCanvasPaintInvalidation)||(e.dirtyRef.current=!0,e.scheduleRender())},e.canvasPaintDependencies),{canvasRef:s,interactionCanvasRef:a}}({...t,renderFnRef:e.renderFnRef,scheduleRender:e.scheduleRender,cancelRender:e.cancelRender,frameRuntime:e.frameRuntime})}(Ot,{storeRef:zn,dirtyRef:Tt,hydrated:Bt,wasHydratingFromSSR:Dt,cleanup:()=>En.current?.clear(),canvasPaintDependencies:[n,nn,on,ue,H,Ye,$,E,qe,Zt]}),{hoverHandlerRef:Qn,hoverLeaveRef:Zn,onPointerMove:Jn,onPointerLeave:eo}=Ot;Qn.current=e=>{if(!sn)return;const t=Un.current;if(!t)return;const o=t.getBoundingClientRect(),r=e.clientX-o.left-tn.left,i=e.clientY-o.top-tn.top;if(0>r||r>nn||0>i||i>on)return void(xn.current&&(xn.current=null,bn.current=null,An(null),Rt&&(Rt(null),Tt.current=!0),Zt()));const s=zn.current;if(!s||0===s.scene.length)return;const l=Xi(_e,e.pointerType),c=qn(s.scene,r,i,l,s.quadtree,s.maxPointRadius),u="multi"===Re,h=()=>{xn.current&&(xn.current=null,bn.current=null,An(null),Rt&&Rt(null),Zt())};if(!c&&!u)return void h();const d=u||!c?r:c.x,f=u||!c?i:c.y,p=c?.datum?nt(c.datum,s.resolvedRibbons):{},y=s.scales?.x?.invert,m="function"==typeof y?y(d):void 0;let g=Ki(p,d,f,null!=m?{xValue:m,xPx:d}:void 0);if(u&&s.scene.length>0&&s.scales){const e=function(e,t,n=30){const o=[];for(const r of e)if("line"===r.type){const e=r;if(2>e.path.length)continue;const i=Vn(Gn(e.path,e.curve),t,n);if(null===i)continue;const s=oo(e.path,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[s]?e.datum[s]:e.datum,x:e.path[s][0],y:i,group:e.group,color:e.style.stroke})}else if("area"===r.type){const e=r;if(!1===e.interactive)continue;if(2>e.topPath.length)continue;const i=Gn(e.topPath,e.curve),s=Gn(e.bottomPath,e.curve),a=Vn(i,t,n);if(null===a)continue;const l=Vn(s,t,n),c=oo(e.topPath,t);o.push({node:r,datum:Array.isArray(e.datum)&&e.datum[c]?e.datum[c]:e.datum,x:e.topPath[c][0],y:a,y0:l??void 0,group:e.group,color:"string"==typeof e.style.stroke?e.style.stroke:"string"==typeof e.style.fill?e.style.fill:void 0})}return o}(s.scene,d,Math.max(l,nn));if(e.length>0){const t=s.scales.y.invert,o=Sn.current,r=y?y(d):d;if(c)g.xValue=r,g.xPx=d;else{const e={xValue:r};"string"==typeof a&&(e[a]=r),g=Ki(e,d,f,{xValue:r,xPx:d})}g.allSeries=e.map(e=>{const r=t?t(e.y):e.y,i=null!=e.y0?t?t(e.y0):e.y0:void 0;return{group:e.group||"",value:"stackedarea"===n&&null!=i?r-i:r,valuePx:e.y,color:e.color||o,datum:nt(e.datum,s.resolvedRibbons)}})}}c||g.allSeries?.length?(xn.current=g,bn.current=c?.node??null,An(g),Rt&&(Rt(g),Tt.current=!0),Zt()):h()},Zn.current=()=>{xn.current&&(xn.current=null,bn.current=null,An(null),Rt&&(Rt(null),Tt.current=!0),Zt())};const to=(0,_.useRef)(()=>{});to.current=e=>{if((t=e.target)instanceof Element&&null!=t.closest("[data-semiotic-annotation-widget]"))return;var t;if(!Pt)return;const n=Un.current;if(!n)return;const o=n.getBoundingClientRect(),r=e.clientX-o.left-tn.left,i=e.clientY-o.top-tn.top;if(0>r||r>nn||0>i||i>on)return void Pt(null);const s=zn.current;if(!s||0===s.scene.length)return void Pt(null);const a=Xi(_e,kn.current),l=qn(s.scene,r,i,a,s.quadtree,s.maxPointRadius);if(!l)return void Pt(null);const c=l.datum||{},u=s.scales?.x?.invert,h="function"==typeof u?u(l.x):void 0;var d;Pt(Ki(c,l.x,l.y,null!=h?{xValue:h,xPx:l.x}:void 0),{type:"activate",inputType:(d=kn.current,"touch"===d?"touch":"pointer")})};const no=(0,_.useCallback)(e=>to.current(e),[]),{kbFocusIndexRef:io,focusedNavPointRef:so,onKeyDown:lo}=(uo={storeRef:zn,hoverRef:xn,hoveredNodeRef:bn,setHoverPoint:An,customHoverBehavior:Rt,customClickBehavior:Pt,scheduleRender:Zt},function({storeRef:e,hoverRef:t,hoveredNodeRef:n,setHoverPoint:o,customHoverBehavior:r,customClickBehavior:i,scheduleRender:s,extractPoints:a,toHover:l}){const c=(0,ka.useRef)(-1),u=(0,ka.useRef)(null),h=(0,ka.useRef)(null),d=(0,ka.useCallback)(d=>{if(function(e){const t=e.target;return t instanceof Element&&t!==e.currentTarget&&null!=t.closest("button, a[href], input, select, textarea, summary, [contenteditable='true'], [role='button'], [role='link'], [role='checkbox'], [role='radio'], [role='switch']")}(d))return;const f=e.current;if(!f)return;const p=()=>{c.current=-1,u.current=null,t.current=null,n&&(n.current=null),o(null),r(null),s()};if(0===f.scene.length)return void(0>c.current||p());let y;if(h.current?.version===f.version)y=h.current.graph;else{const e=a(f.scene);if(0===e.length)return void(0>c.current||p());y=function(e){const t=new Map;for(const n of e){const e=n.group??"_default";let o=t.get(e);o||(o=[],t.set(e,o)),o.push(n)}for(const e of t.values()){e.sort((e,t)=>e.x-t.x||e.y-t.y);for(let t=0;e.length>t;t++)e[t]._groupIndex=t}const n=Array.from(t.keys()).sort((e,n)=>{const o=t.get(e),r=t.get(n);return(o.length>0?o[0].y:0)-(r.length>0?r[0].y:0)}),o=Array.from(t.values()).flat();o.sort((e,t)=>e.x-t.x||e.y-t.y);const r=new Map;for(let e=0;o.length>e;e++){o[e]._flatIndex=e;const t=o[e].datum?.id;null!=t&&r.set(t+"",e)}return{flat:o,groups:n,byGroup:t,idToIdx:r}}(e),h.current={version:f.version,graph:y}}let m=c.current;if(y.flat.length>m||(p(),m=-1),("Enter"===d.key||" "===d.key)&&m>=0)return d.preventDefault(),void i(l(y.flat[m],f),{type:"activate",inputType:"keyboard"});if(0>m){if("Escape"===d.key)return;if(!["ArrowRight","ArrowLeft","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(d.key))return;d.preventDefault(),c.current=0;const e=y.flat[0];u.current=e;const n=l(e,f);return t.current=n,o(n),r(n,{type:"focus",inputType:"keyboard"}),void s()}const g=function(e,t,n){const{group:o,indexInGroup:r}=t,i=n.byGroup.get(o);switch(e){case"ArrowRight":return i.length-1>r?i[r+1]._flatIndex:t.flatIndex;case"ArrowLeft":return r>0?i[r-1]._flatIndex:t.flatIndex;case"ArrowDown":{const e=n.groups.indexOf(o);return n.groups.length-1>e?wa(n,n.groups[e+1],i[r]):t.flatIndex}case"ArrowUp":{const e=n.groups.indexOf(o);return e>0?wa(n,n.groups[e-1],i[r]):t.flatIndex}case"PageDown":return Math.min(t.flatIndex+Math.max(1,Math.floor(.1*n.flat.length)),n.flat.length-1);case"PageUp":return Math.max(t.flatIndex-Math.max(1,Math.floor(.1*n.flat.length)),0);case"Home":return 0;case"End":return n.flat.length-1;case"Escape":return-1;default:return null}}(d.key,function(e,t){if(0===e.flat.length)return{flatIndex:-1,group:"_default",indexInGroup:-1};const n=Math.max(0,Math.min(t,e.flat.length-1)),o=e.flat[n];return{flatIndex:n,group:o.group??"_default",indexInGroup:o._groupIndex??0}}(y,m),y);if(null===g)return;if(d.preventDefault(),0>g)return void p();c.current=g;const x=y.flat[g];u.current=x;const b=l(x,f);t.current=b,o(b),r(b,{type:"focus",inputType:"keyboard"}),s()},[i,r,a,t,n,s,o,e,l]);return{kbFocusIndexRef:c,focusedNavPointRef:u,onKeyDown:d}}({...uo,extractPoints:Aa,toHover:(e,t)=>function(e){return{data:e.datum||{},x:e.x,y:e.y,__semioticHoverData:!0}}({...e,datum:nt(e.datum,t.resolvedRibbons)})}));var uo;const ho=(0,_.useCallback)(e=>{kn.current=e.pointerType,io.current=-1,so.current=null,Jn(e)},[so,io,Jn]),fo=(0,_.useCallback)(e=>{kn.current="mouse",io.current=-1,so.current=null,Jn({clientX:e.clientX,clientY:e.clientY,pointerType:"mouse"})},[so,io,Jn]),po=(0,_.useCallback)(e=>{kn.current=e.pointerType},[]);Ut.current=()=>{if(Xt.current=null,!en.isActive)return;const e=Un.current,t=Kn.current;if(!e||!t)return;const o=zn.current;if(!o)return;const r=en.now(),i=o.advanceTransition(Wt.current?r+1e6:r),s=!Wt.current&&i,c=Nt.current.w!==nn||Nt.current.h!==on,u=Tt.current||i||c,h=o.consumeStylePaintPending();let d=!1;const f=o.getLastUpdateResult(),p=_n.current.beforeCompute(f,s);!u||s&&!c||(o.computeScene({width:nn,height:on}),Nt.current={w:nn,h:on},d=!0,Hn()),_n.current.afterCompute(p,d,c);const y=function(e,t,n,o){const r=o.current,i=!0===e.lastCustomLayoutFailure?.preservedLastGoodScene,s=!i&&e.hasActivePulsesAt(t),a=!(n||i||!s&&!r)&&e.refreshPulse(t);return o.current=s,{changed:a,pending:s}}(o,r,d,Ft),m=function(){if("undefined"==typeof window)return 1;const e=window.devicePixelRatio||1,t=function(){if("undefined"==typeof window)return!1;const e="function"==typeof window.matchMedia&&window.matchMedia("(pointer: coarse)").matches,t=768>Math.min(window.innerWidth||1/0,window.innerHeight||1/0);return e||t}()?2:3;return Math.max(1,Math.min(e,t))}(),g=Mn.current.resolve(e);Sn.current=g.primary;const x=ao(ot,o.lastIngestTime>0?r-o.lastIngestTime:0),b=ot&&x.isStale;if(u||h||y.changed){const t=js(e,Ht,tn,m);if(t){if(t.clearRect(-tn.left,-tn.top,Ht[0],Ht[1]),ot&&1>x.alpha&&(t.globalAlpha=x.alpha),function(e,t){const{background:n,hasBackgroundGraphics:o=!1,themeBackground:r="",x:i=0,y:s=0,width:a,height:l}=t;if("transparent"===n)return!1;if(o)return!1;const c=n||(r&&"transparent"!==r?r:"")||null;if(!c)return!1;const u=Rn(e,c);u&&(e.fillStyle=u,e.fillRect(i,s,a,l))}(t,{background:H,hasBackgroundGraphics:!!Ye,themeBackground:g.background,x:-tn.left,y:-tn.top,width:Ht[0],height:Ht[1]}),t.save(),"function"==typeof t.rect&&(t.beginPath(),t.rect(0,0,nn,on),t.clip()),qe&&o.scales)for(const e of qe)t.save(),e(t,o.scene,o.scales,{width:nn,height:on}),t.restore();const e=Ct?ra.custom:ra[n];!function(e){const{context:t,nodes:n,renderMode:o,pixelRatio:r,paintBuiltIn:i}=e;if(!o||"sketchy"===o)return void i(n);let s=[];const a=()=>{s.length&&(i(s),s=[])};for(const e of n){const n=sa(o,e);if(!n){s.push(e);continue}let l;a(),t.save();try{l=n.drawCanvas({context:t,node:e,style:e.style??{},pixelRatio:r})}finally{t.restore()}l||(aa(n.id,e.type??"unknown"),i([e]))}a()}({context:t,nodes:o.scene,renderMode:E,pixelRatio:m,paintBuiltIn:n=>{if(e&&o.scales)for(const r of e)r(t,n,o.scales,{width:nn,height:on})}}),t.restore(),ot&&1>x.alpha&&(t.globalAlpha=1)}}const v=!!(sn&&xn.current&&o.scales),k=!!(bn.current&&Array.isArray(ve)&&ve.some(e=>e&&"object"==typeof e&&"highlight"===e.type)),w=v||k;if(w||jn.current){const e=js(t,Ht,tn,m);if(e&&(e.clearRect(-tn.left,-tn.top,Ht[0],Ht[1]),v&&xn.current&&function(e,t,n,o,r,i,s){if(!1===r.crosshair)return;const a=t.allSeries,l=a&&a.length>0,c=t.xPx??t.x;e.save();const u="object"==typeof r.crosshair?r.crosshair:{};if(e.strokeStyle=u.stroke||s.crosshair,e.lineWidth=u.strokeWidth||1,e.setLineDash(u.strokeDasharray?u.strokeDasharray.split(/[\s,]+/).map(Number):[4,4]),e.beginPath(),e.moveTo(l?c:t.x,0),e.lineTo(l?c:t.x,o),e.stroke(),l||(e.beginPath(),e.moveTo(0,t.y),e.lineTo(n,t.y),e.stroke()),e.restore(),l){e.lineWidth=2,e.strokeStyle=s.pointRing;for(const t of a)null!=t.valuePx&&(e.beginPath(),e.arc(c,t.valuePx,4,0,2*Math.PI),e.fillStyle=t.color||s.primary,e.fill(),e.stroke())}else{const n=r.pointColor||function(e){if(!e)return null;if("heatcell"===e.type)return e.fill||null;if("candlestick"===e.type)return e.isUp?e.upColor:e.downColor;const{style:t}=e;if(!t)return null;const n="string"==typeof t.fill?t.fill:null;return"line"===e.type||"area"===e.type?t.stroke||n||null:n||t.stroke||null}(i)||s.primary;e.beginPath(),e.arc(t.x,t.y,4,0,2*Math.PI),e.fillStyle=n,e.fill(),e.strokeStyle=s.pointRing,e.lineWidth=2,e.stroke()}}(e,xn.current,nn,on,"object"==typeof sn?sn:{},bn.current,g),k&&bn.current&&Array.isArray(ve))){const t=ve.find(e=>e&&"object"==typeof e&&"highlight"===e.type);t&&function(e,t,n,o,r){if(!n)return;const i="group"in n?n.group:void 0;if(void 0!==i)for(const n of t){if("line"!==n.type)continue;if(n.group!==i)continue;if(2>n.path.length)continue;const t="function"==typeof o.style?n.datum?o.style(n.datum):{}:o.style||{};e.save(),e.beginPath(),e.moveTo(n.path[0][0],n.path[0][1]);for(let t=1;n.path.length>t;t++)e.lineTo(n.path[t][0],n.path[t][1]);e.strokeStyle=t.stroke||n.style.stroke||r.primary,e.lineWidth=t.strokeWidth||(n.style.strokeWidth||2)+2,e.globalAlpha=t.opacity??1,e.stroke(),e.restore()}}(e,o.scene,bn.current,t,g)}jn.current=w}u&&e&&e.setAttribute("aria-label",_i(o.scene,n+" chart"));const A=Tt.current;if(Tt.current=A&&s&&!d,A&&o.scales){const e=e=>"object"==typeof e&&null!==e&&"function"==typeof e.valueOf?e.valueOf():e;if((!dn||e(dn.x.domain()[0])!==e(o.scales.x.domain()[0])||e(dn.x.domain()[1])!==e(o.scales.x.domain()[1])||e(dn.y.domain()[0])!==e(o.scales.y.domain()[0])||e(dn.y.domain()[1])!==e(o.scales.y.domain()[1])||dn.x.range()[0]!==o.scales.x.range()[0]||dn.x.range()[1]!==o.scales.x.range()[1]||dn.y.range()[0]!==o.scales.y.range()[0]||dn.y.range()[1]!==o.scales.y.range()[1])&&fn(o.scales),mt){const e=o.getData(),t="function"==typeof a?a:e=>e[a||"x"],n="function"==typeof l?l:e=>e[l||"y"];Nn(e.map(e=>t(e)).filter(e=>"number"==typeof e&&isFinite(e))),Bn(e.map(e=>n(e)).filter(e=>"number"==typeof e&&isFinite(e)))}}!((Pe&&Pe.length>0||Ct)&&(d||s))||!d&&33>r-hn.current||(un(e=>e+1),hn.current=r),ot?.showBadge&&Ln(!!b),(s||null!=o.activeTransition||y.pending)&&Zt()},function(e,t,n,o,r,i){const s=(0,ro.useRef)("fresh");(0,ro.useEffect)(()=>{if(!e)return;const a=setInterval(()=>{const a=t.current;if(!a||0===a.lastIngestTime)return;const l="undefined"!=typeof performance?performance.now():Date.now(),c=ao(e,l-a.lastIngestTime);c.band===s.current&&c.isStale===r||(s.current=c.band,c.isStale!==r&&i(c.isStale),n.current=!0,o())},1e3);return()=>clearInterval(a)},[e,r,o,t,i,n])}(ot,zn,Tt,Zt,Pn,Ln);const yo=(0,_.useMemo)(()=>{if(ye||xe)return;const e=zn.current;return e?.xIsDate&&dn?Is(dn.x.domain()):void 0},[ye,xe,dn]),mo=ye||xe||yo,go=sn&&wn?ke?ke(wn):(0,Sa.jsx)(ga,{hover:wn}):null,xo=go?(0,Sa.jsx)(us,{x:wn.x,y:wn.y,containerWidth:nn,containerHeight:on,margin:tn,className:"stream-frame-tooltip",children:go}):null,bo=so.current,vo=(0,Sa.jsx)(qi,{active:io.current>=0,hoverPoint:wn,margin:tn,size:Ht,shape:bo?.shape,width:bo?.w,height:bo?.h}),ko=Rs(a,C,"__semiotic_resolvedX","__semiotic_resolvedTime"),wo=Rs(l,k,"__semiotic_resolvedY","__semiotic_resolvedValue"),Ao=ko.key,So=wo.key,Co=function(e,t,n){return o=>{if(!o||!n||!e.fn&&!t.fn)return o;let r=!1;const i=o.map(n=>{const o=e.fn&&e.key&&!(e.key in n),i=t.fn&&t.key&&!(t.key in n);if(!o&&!i)return n;r=!0;const s={...n};return o&&(s[e.key]=e.fn(n)),i&&(s[t.key]=t.fn(n)),s});return r?i:o}}(ko,wo,Pe&&Pe.length>0||!1);if(si||!Bt&&Dt){const e=zn.current;e&&r&&(e.ingest({inserts:rn,bounded:!0}),e.computeScene({width:nn,height:on}));const t=e?.scene??[],n=e?.scales??null,o=Ms(Ge,Ht,tn,n),i=Ms(Ye,Ht,tn,n),s=mo||(()=>{if(e?.xIsDate&&n)return Is(n.x.domain())})();return(0,Sa.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(D?" "+D:""),role:"img","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:N?"100%":Ht[0],height:F?"100%":Ht[1]},children:[(0,Sa.jsx)(Ei,{summary:wt}),(0,Sa.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:Ht[0],height:Ht[1],style:{position:"absolute",left:0,top:0},children:[(0,Sa.jsx)("g",{transform:`translate(${tn.left},${tn.top})`,children:i}),(0,Sa.jsxs)("g",{transform:`translate(${tn.left},${tn.top})`,children:[H&&(0,Sa.jsx)("rect",{x:0,y:0,width:nn,height:on,fill:H}),Ve&&n&&Ve.map((e,o)=>(0,Sa.jsx)(j.Fragment,{children:e(t,n,{width:nn,height:on})},"svgpre-"+o)),t.map((e,t)=>function(e){const{node:t,index:n,renderMode:o,fallback:r}=e,i=sa(o,t);if(!i)return r();const s=i.renderStaticSVG({node:t,style:t.style??{},key:`${i.id}-${n}`});return null!=s?s:(aa(i.id,t.type??"unknown"),r())}({node:e,index:t,renderMode:E,fallback:()=>function(e,t,n){switch(e.type){case"line":{const n=e;if(0===n.path.length)return null;const o="M"+n.path.map(([e,t])=>`${e},${t}`).join("L");return(0,ri.jsx)("path",{d:o,fill:"none",stroke:n.style.stroke||"#4e79a7",strokeWidth:n.style.strokeWidth||2,strokeDasharray:n.style.strokeDasharray,opacity:n.style.opacity},"line-"+t)}case"area":{const o=e;if(0===o.topPath.length)return null;const r=`M${o.topPath.map(([e,t])=>`${e},${t}`).join("L")}L${[...o.bottomPath].reverse().map(([e,t])=>`${e},${t}`).join("L")}Z`,i=`${n?n+"-":""}area-${t}-hatch`,s=In(o.style.fill)?On(o.style.fill,i):void 0,a=s?`url(#${i})`:ii(o.style.fill);if(o.clipRect){const e=`${n?n+"-":""}area-clip-${t}`;return(0,ri.jsxs)("g",{children:[(0,ri.jsxs)("defs",{children:[s,(0,ri.jsx)("clipPath",{id:e,children:(0,ri.jsx)("rect",{x:o.clipRect.x,y:o.clipRect.y,width:o.clipRect.width,height:o.clipRect.height})})]}),(0,ri.jsx)("path",{d:r,fill:a,fillOpacity:o.style.fillOpacity??o.style.opacity??.7,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth,clipPath:`url(#${e})`})]},"area-"+t)}return(0,ri.jsxs)(ni.Fragment,{children:[s&&(0,ri.jsx)("defs",{children:s}),(0,ri.jsx)("path",{d:r,fill:a,fillOpacity:o.style.fillOpacity??o.style.opacity??.7,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"area-"+t)}case"point":{const o=e,r=`${n?n+"-":""}point-${t}-hatch`,i=In(o.style.fill)?On(o.style.fill,r):void 0;return(0,ri.jsxs)(ni.Fragment,{children:[i&&(0,ri.jsx)("defs",{children:i}),(0,ri.jsx)("circle",{cx:o.x,cy:o.y,r:o.r,fill:i?`url(#${r})`:ii(o.style.fill),opacity:o.style.opacity??.8,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"point-"+t)}case"symbol":return function(e,t){const n=ut(e.symbolType,e.size,e.path);return(0,ri.jsx)("path",{d:n,transform:e.rotation?`translate(${e.x},${e.y}) rotate(${180*e.rotation/Math.PI})`:`translate(${e.x},${e.y})`,fill:e.style.fill?ii(e.style.fill):"none",opacity:e.style.opacity,stroke:e.style.stroke,strokeWidth:e.style.strokeWidth},"symbol-"+t)}(e,t);case"glyph":return function(e,t,n,o){const r=e.glyph;if(!r?.parts?.length||0>=e.size)return null;const i=yn(r,e.size);if(0>=i.scale)return null;const s=`translate(${t},${n})${e.rotation?` rotate(${180*e.rotation/Math.PI})`:""} translate(${i.offsetX},${i.offsetY}) scale(${i.scale})`,a=e.color??("string"==typeof e.style.fill?e.style.fill:void 0),l=vn(r,e.fraction??1,e.fractionStart??0,e.fractionDirection??"horizontal"),c=l?function(e){const t=e.replace(/[^A-Za-z0-9_-]/g,"_");return!t||/^\d/.test(t)?"s_"+t:t}(o+"-clip"):void 0,u=(e.style.opacity??1)*(e._decayOpacity??1)*(e.style.fillOpacity??1),h=t=>r.parts.map((n,o)=>{const r=t?"none"===n.fill?void 0:t:gn(n.fill,a,e.accent),i=t?n.stroke&&"none"!==n.stroke?t:void 0:gn(n.stroke??"none",a,e.accent);return r||i?(0,ri.jsx)("path",{d:n.d,fill:r??"none",stroke:i,strokeWidth:i?n.strokeWidth??1:void 0,strokeLinecap:n.strokeLinecap,strokeLinejoin:n.strokeLinejoin,opacity:n.opacity},o):null});return(0,ri.jsxs)("g",{transform:s,opacity:1===u?void 0:u,children:[l&&c&&(0,ri.jsx)("clipPath",{id:c,children:(0,ri.jsx)("rect",{x:l.x,y:l.y,width:l.width,height:l.height})}),l&&e.ghostColor?(0,ri.jsx)("g",{children:h(e.ghostColor)}):null,l&&c?(0,ri.jsx)("g",{clipPath:`url(#${c})`,children:h()}):h()]},o)}(e,e.x,e.y,`${n??""}glyph-${e.pointId??t}`);case"rect":{const o=e,r=`${n?n+"-":""}xyrect-${t}-hatch`,i=In(o.style.fill)?On(o.style.fill,r):void 0;return(0,ri.jsxs)(ni.Fragment,{children:[i&&(0,ri.jsx)("defs",{children:i}),(0,ri.jsx)("rect",{x:o.x,y:o.y,width:o.w,height:o.h,fill:i?`url(#${r})`:ii(o.style.fill),opacity:o.style.opacity,stroke:o.style.stroke,strokeWidth:o.style.strokeWidth})]},"rect-"+t)}case"heatcell":{const n=e;if(n.showValues&&null!=n.value&&n.w>=20&&n.h>=20){const e=n.valueFormat?n.valueFormat(n.value):Number.isInteger(n.value)?n.value+"":100>Math.abs(n.value)?1>Math.abs(n.value)?n.value.toPrecision(3):n.value.toFixed(1):n.value.toFixed(0),[o,r,i]=function(e){if(e.startsWith("#")){let t=e.slice(1);if(3===t.length&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),6===t.length)return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}const t=e.match(/rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/);return t?[+t[1],+t[2],+t[3]]:[128,128,128]}(n.fill),s=.299*o+.587*r+.114*i>128?"#000":"#fff",a=Math.max(10,Math.min(16,.3*Math.min(n.w,n.h)));return(0,ri.jsxs)("g",{children:[(0,ri.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill}),(0,ri.jsx)("text",{x:n.x+n.w/2,y:n.y+n.h/2,textAnchor:"middle",dominantBaseline:"middle",fill:s,fontSize:a+"px",children:e})]},"heatcell-"+t)}return(0,ri.jsx)("rect",{x:n.x,y:n.y,width:n.w,height:n.h,fill:n.fill},"heatcell-"+t)}case"candlestick":{const n=e,o=Math.min(n.openY,n.closeY),r=Math.max(Math.abs(n.openY-n.closeY),1),i=n.isUp?n.upColor:n.downColor;return(0,ri.jsxs)("g",{children:[(0,ri.jsx)("line",{x1:n.x,y1:n.highY,x2:n.x,y2:n.lowY,stroke:n.wickColor,strokeWidth:n.wickWidth}),(0,ri.jsx)("rect",{x:n.x-n.bodyWidth/2,y:o,width:n.bodyWidth,height:r,fill:i,stroke:i,strokeWidth:1})]},"candle-"+t)}default:return null}}(e,t,It)})).filter(Boolean)]})]}),(0,Sa.jsx)(ti,{width:nn,height:on,totalWidth:Ht[0],totalHeight:Ht[1],margin:tn,scales:n,showAxes:ue,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:s,yFormat:me||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,foregroundGraphics:Jt(o,an(zn.current?.customLayoutOverlays,_t??null)),marginalGraphics:mt,xValues:[],yValues:[],annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Se,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:0,xAccessor:Ao,yAccessor:So,annotationData:Co(zn.current?.getData()),pointNodes:Ts(zn.current?.scene),curve:"string"==typeof m?m:void 0,linkedCrosshairName:At,linkedCrosshairSourceId:St})]})}return(0,Sa.jsxs)("div",{ref:zt,className:"stream-xy-frame"+(D?" "+D:""),role:"group","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),tabIndex:0,style:{position:"relative",width:N?"100%":Ht[0],height:F?"100%":Ht[1],overflow:"visible",touchAction:ja(Ke)},onKeyDown:lo,children:["production"!==process.env.NODE_ENV&&zn.current&&(0,Sa.jsx)(Qt,{store:zn.current,diagnostics:_n.current}),vt&&(0,Sa.jsx)($i,{tableId:Vt}),vt&&(0,Sa.jsx)(Hi,{scene:zn.current?.scene??[],chartType:n+" chart",tableId:Vt,chartTitle:"string"==typeof Xe?Xe:void 0}),(0,Sa.jsx)(Ei,{summary:wt}),(0,Sa.jsx)(Ai,{hoverPoint:wn}),(0,Sa.jsxs)("div",{role:"img","aria-label":kt||("string"==typeof Xe?Xe:"XY chart"),style:{position:"relative",width:"100%",height:"100%"},onPointerMove:sn?ho:void 0,onMouseMove:sn?fo:void 0,onPointerLeave:sn?eo:void 0,onMouseLeave:sn?eo:void 0,onPointerDown:sn||Lt?po:void 0,onClick:Lt?no:void 0,children:[(0,Sa.jsx)(Cs,{size:Ht,margin:tn,children:mn}),(0,Sa.jsx)(Zr,{width:nn,height:on,totalWidth:Ht[0],totalHeight:Ht[1],margin:tn,scales:dn,showAxes:ue,axes:he,showGrid:Ne,xFormat:mo,yFormat:me||be,axisExtent:ge}),(0,Sa.jsx)("canvas",{ref:Un,"aria-label":_i(zn.current?.scene??[],n+" chart"),style:{position:"absolute",left:0,top:0}}),(0,Sa.jsx)("canvas",{ref:Kn,style:{position:"absolute",left:0,top:0,pointerEvents:"none"}}),(0,Sa.jsx)(ti,{width:nn,height:on,totalWidth:Ht[0],totalHeight:Ht[1],margin:tn,scales:dn,showAxes:ue,axes:he,xLabel:de,yLabel:fe,yLabelRight:pe,xFormat:mo,yFormat:me||be,axisExtent:ge,showGrid:Ne,title:Xe,legend:Fe,legendHoverBehavior:Oe,legendClickBehavior:Be,legendHighlightedCategory:De,legendIsolatedCategories:We,legendPosition:ze,legendLayout:He,foregroundGraphics:Jt(pn,an(zn.current?.customLayoutOverlays,_t??null)),marginalGraphics:mt,xValues:Tn,yValues:Fn,annotations:Pe,onAnnotationActivate:Le,onObservation:Ce??Se,chartId:Me,chartType:"StreamXYFrame",autoPlaceAnnotations:Ie,svgAnnotationRules:Te,annotationFrame:cn,xAccessor:Ao,yAccessor:So,annotationData:Co(zn.current?.getData()),pointNodes:Ts(zn.current?.scene),curve:"string"==typeof m?m:void 0,underlayRendered:!0,canvasObscuresUnderlay:"transparent"!==H&&!Ye,linkedCrosshairName:At,linkedCrosshairSourceId:St}),(Ke||Qe)&&(0,Sa.jsx)(B,{width:nn,height:on,totalWidth:Ht[0],totalHeight:Ht[1],margin:tn,dimension:Ke?.dimension??"xy",scales:dn,onBrush:Qe??(()=>{}),binSize:v,snap:Ke?.snap,binBoundaries:Ke?.binBoundaries??("bar"===n?zn.current?.getBinBoundaries():void 0),snapDuring:Ke?.snapDuring,streaming:"streaming"===o}),ot?.showBadge&&(0,Sa.jsx)(co,{isStale:Pn,position:ot.badgePosition}),vo,xo]})]})}));_a.displayName="StreamXYFrame";var Ra=_a,Pa=require("react"),La=require("react"),Ia=require("react"),Ta=require("react/jsx-runtime"),Na=(0,Ia.createContext)(null);function Fa({colors:e,categories:t,colorScheme:n="category10",children:o}){const r=(0,Ia.useMemo)(()=>{if(e)return e;if(t){if(n&&"object"==typeof n&&!Array.isArray(n)){const e=n,o={};let r=0;for(const n of t)o[n]=Ne(e,n)??Pe[r++%Pe.length];return o}const e=Array.isArray(n)?n:Re[n]||Pe,o={};for(let n=0;t.length>n;n++)o[t[n]]=e[n%e.length];return o}return{}},[e,t,n]);return(0,Ta.jsx)(Na.Provider,{value:r,children:o})}function Oa(){return(0,Ia.useContext)(Na)}Fa.displayName="CategoryColorProvider";var Ba=require("react");function Da(e){const t=[];for(const[n,o]of Object.entries(e.fields))if("point"===o.type)t.push(e=>o.values.has(e[n]));else{const[e,r]=o.range;t.push(t=>{const o=t[n];return o>=e&&r>=o})}return e=>t.every(t=>t(e))}function Wa(e,t){let n=e.get(t);return n||(n={name:t,resolution:"union",clauses:new Map},e.set(t,n)),n}function za(e,t){if(e.type!==t.type)return!1;if("interval"===e.type&&"interval"===t.type)return e.range[0]===t.range[0]&&e.range[1]===t.range[1];if("point"===e.type&&"point"===t.type){if(e.values.size!==t.values.size)return!1;for(const n of e.values)if(!t.values.has(n))return!1;return!0}return!1}var[Ha,Ea]=$(e=>({selections:new Map,setClause(t,n){e(e=>{const o=e.selections.get(t),r=o?.clauses.get(n.clientId);if(r&&function(e,t){if(e.clientId!==t.clientId||e.type!==t.type)return!1;const n=Object.entries(e.fields);if(n.length!==function(e){let t=0;for(const n in e)t++;return t}(t.fields))return!1;for(const[e,o]of n){const n=t.fields[e];if(!n||!za(o,n))return!1}return!0}(r,n))return{};const i=new Map(e.selections),s=Wa(i,t),a=new Map(s.clauses);return a.set(n.clientId,n),i.set(t,{...s,clauses:a}),{selections:i}})},clearClause(t,n){e(e=>{const o=e.selections.get(t);if(!o||!o.clauses.has(n))return{};const r=new Map(e.selections),i=new Map(o.clauses);return i.delete(n),r.set(t,{...o,clauses:i}),{selections:r}})},setResolution(t,n){e(e=>{const o=e.selections.get(t);if(o?.resolution===n)return{};const r=new Map(e.selections),i=Wa(r,t);return r.set(t,{...i,resolution:n}),{selections:r}})},clearSelection(t){e(e=>{const n=e.selections.get(t);if(!n||0===n.clauses.size)return{};const o=new Map(e.selections);return o.set(t,{...n,clauses:new Map}),{selections:o}})}})),$a=require("react");function Ya(e){const t=(0,$a.useId)(),n=e.clientId||t,{name:o}=e,r=Ea(e=>e.selections.get(o)),i=Ea(e=>e.setClause),s=Ea(e=>e.clearClause),a=(0,$a.useMemo)(()=>!!r&&r.clauses.size>0,[r]);return{predicate:(0,$a.useMemo)(()=>r&&0!==r.clauses.size?function(e,t){const n=[];for(const[o,r]of e.clauses)"crossfilter"===e.resolution&&o===t||n.push(Da(r));return 0===n.length?()=>!0:"intersect"===e.resolution?e=>n.every(t=>t(e)):e=>n.some(t=>t(e))}(r,n):()=>!0,[r,n]),isActive:a,selectPoints:(0,$a.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"point",values:new Set(o)},r=!0;r&&i(o,{clientId:n,type:"point",fields:t})},[n,o,i]),selectInterval:(0,$a.useCallback)(e=>{const t={};let r=!1;for(const[n,o]of Object.entries(e))t[n]={type:"interval",range:o},r=!0;r&&i(o,{clientId:n,type:"interval",fields:t})},[n,o,i]),clear:(0,$a.useCallback)(()=>{s(o,n)},[s,o,n]),clientId:n}}function Ga(e){return 2===e.length&&"number"==typeof e[0]&&"number"==typeof e[1]}function qa(e){const{name:t,xField:n,yField:o}=e,{predicate:r,isActive:i,selectInterval:s,clear:a}=Ya({name:t,fields:[n,o].filter(Boolean)}),l=n&&o?"xyBrush":n?"xBrush":"yBrush",c=(0,$a.useCallback)(e=>{if(!e)return void a();const t={};"xyBrush"===l&&function(e){return 2===e.length&&Array.isArray(e[0])&&2===e[0].length&&Array.isArray(e[1])&&2===e[1].length}(e)?(n&&(t[n]=[Math.min(e[0][0],e[1][0]),Math.max(e[0][0],e[1][0])]),o&&(t[o]=[Math.min(e[0][1],e[1][1]),Math.max(e[0][1],e[1][1])])):"xBrush"===l&&Ga(e)?n&&(t[n]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]):"yBrush"===l&&Ga(e)&&o&&(t[o]=[Math.min(e[0],e[1]),Math.max(e[0],e[1])]),Va(t)&&s(t)},[l,n,o,s,a]);return{brushInteraction:(0,$a.useMemo)(()=>({brush:l,during:c,end:c}),[l,c]),predicate:r,isActive:i,clear:a}}function Va(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}var Xa=require("react/jsx-runtime"),Ua=(0,Ba.createContext)(!1),Ka=(0,Ba.createContext)(!1),Qa=(0,Ba.createContext)(null),Za="undefined"==typeof window?Ba.useEffect:Ba.useLayoutEffect;function Ja(e){const t=new Set,n=[];for(const o of e)t.has(o)||(t.add(o),n.push(o));return n}function el(e,t){if(e.length!==t.length)return!1;for(let n=0;e.length>n;n++)if(e[n]!==t[n])return!1;return!0}var tl="__linked-legend-isolate__",nl="__linked-legend-highlight__";function ol({categoryColors:e,interaction:t,selectionName:n,field:o}){const r=Object.entries(e),i=r.map(([e])=>e),s=[{styleFn:e=>({fill:e.color||"#333",stroke:e.color||"#333"}),type:"fill",items:r.map(([e,t])=>({label:e,color:t})),label:""}],{selectPoints:a,clear:l}=Ya({name:n,fields:[o],clientId:tl}),{selectPoints:c,clear:u}=Ya({name:n,fields:[o],clientId:nl}),h=Ea(e=>e.selections.get(n)),{isolatedCategories:d,highlightedCategory:f}=(0,Ba.useMemo)(()=>{const e=new Set;let t=null;const n=h?.clauses.get(tl)?.fields[o];if("point"===n?.type)for(const t of n.values)e.add(t+"");const r=h?.clauses.get(nl)?.fields[o];if("point"===r?.type){const e=r.values.values().next().value;null!=e&&(t=e+"")}return{isolatedCategories:e,highlightedCategory:t}},[h,o]),p=(0,Ba.useCallback)(e=>{"highlight"===t&&(e?c({[o]:[e.label]}):u())},[t,o,c,u]),y=(0,Ba.useCallback)(e=>{if("isolate"!==t)return;const n=new Set(d);n.has(e.label)?n.delete(e.label):n.add(e.label),0===n.size||n.size===i.length?l():a({[o]:Array.from(n)})},[t,o,d,i.length,a,l]),[m,[g]]=ys([0,0],!0,!1),x=(0,Ba.useMemo)(()=>function(e,t){if(!t||0===e.length)return 1;let n=0,o=1;for(const r of e){const e=26+7*r.length;n>0&&n+e>t&&(o++,n=0),n+=e}return o}(r.map(([e])=>e),g),[r,g]);return 0===r.length?null:(0,Xa.jsx)("div",{ref:m,style:{width:"100%",display:"block"},children:(0,Xa.jsx)("svg",{width:"100%",height:Math.max(30,22*x+8),style:{display:"block",overflow:"visible"},children:(0,Xa.jsx)(Mo,{legendGroups:s,title:!1,orientation:"horizontal",width:g,height:20,customHoverBehavior:"highlight"===t?p:void 0,customClickBehavior:"isolate"===t?y:void 0,highlightedCategory:f,isolatedCategories:d})})})}function rl({children:e,selections:t,showLegend:n,legendPosition:o="top",legendInteraction:r="none",legendSelectionName:i="legend",legendField:s="category"}){const a=(0,Ba.useMemo)(()=>{if(!t)return;const e=new Map;for(const[n,o]of Object.entries(t))o.resolution&&e.set(n,{name:n,resolution:o.resolution,clauses:new Map});return e.size>0?{selections:e}:void 0},[t]),l=Oa(),[c,u]=(0,Ba.useState)({}),h=(0,Ba.useRef)({}),d=(0,Ba.useMemo)(()=>({registerCategories:(e,t)=>{const n=Ja(t);u(t=>el(t[e]??[],n)?t:{...t,[e]:n})},unregisterCategories:e=>{u(t=>{if(!(e in t))return t;const n={...t};return delete n[e],n})}}),[]),f=(0,Ba.useMemo)(()=>{const e=[];for(const t of Object.values(c))for(const n of t)e.push(n);return Ja(e)},[c]),p=(0,Ba.useMemo)(()=>{const e=l??{},t=h.current;let n=Object.keys(e).length+Object.keys(t).length;for(const o of f)e[o]||t[o]||(t[o]=Pe[n%Pe.length],n++);const o={...e};for(const n of f)o[n]=e[n]??t[n];return o},[l,f]),y=void 0===n||n,m=Object.keys(p).length>0;return(0,Xa.jsx)(Ha,{initialState:a,children:(0,Xa.jsx)(ar,{children:(0,Xa.jsx)(Ka.Provider,{value:!0,children:(0,Xa.jsx)(Qa.Provider,{value:d,children:(0,Xa.jsx)(Fa,{colors:p,children:(0,Xa.jsxs)(Ua.Provider,{value:y&&m,children:[y&&"top"===o&&(0,Xa.jsx)(ol,{categoryColors:p,interaction:r,selectionName:i,field:s}),e,y&&"bottom"===o&&(0,Xa.jsx)(ol,{categoryColors:p,interaction:r,selectionName:i,field:s})]})})})})})})}function il(e){return e?"string"==typeof e?{name:e}:e:null}var sl=.5;function al(e,t,n){return t?(o,...r)=>{const i={...e(o,...r)};if(t.isActive)if(t.predicate(o))n?.selectedStyle&&Object.assign(i,n.selectedStyle);else{const e=n?.unselectedOpacity??sl;i.opacity=e,i.fillOpacity=e,i.strokeOpacity=e,n?.unselectedStyle&&Object.assign(i,n.unselectedStyle)}return i}:e}var ll=c(require("react"));function cl(){return J(e=>e.theme)}function ul(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function hl(e,t){const{when:n}=e,o=t.width,r=t.height,i=function(e){if("number"==typeof e.height&&e.height>0)return e.width/e.height}(t),s=function(e){if("number"==typeof e.height&&e.height>0)return e.height>e.width?"portrait":"landscape"}(t);return!("number"==typeof n.minWidth&&n.minWidth>o||"number"==typeof n.maxWidth&&o>n.maxWidth||"number"==typeof n.minHeight&&("number"!=typeof r||n.minHeight>r)||"number"==typeof n.maxHeight&&("number"!=typeof r||r>n.maxHeight)||"number"==typeof n.minAspectRatio&&("number"!=typeof i||n.minAspectRatio>i)||"number"==typeof n.maxAspectRatio&&("number"!=typeof i||i>n.maxAspectRatio)||n.orientation&&s!==n.orientation)}function dl(e,t,n=e.responsiveRules){if(!Array.isArray(n)||0===n.length)return{props:e,matches:[]};const o=n.map((e,t)=>({rule:e,index:t})).filter(e=>hl(e.rule,t)).sort((e,t)=>("number"==typeof e.rule.priority?e.rule.priority:e.index)-("number"==typeof t.rule.priority?t.rule.priority:t.index));return{props:o.reduce((e,t)=>function(e,t){const n={...e,...t};for(const o of["margin","frameProps","mobileSemantics","style"])ul(e[o])&&ul(t[o])&&(n[o]={...e[o],...t[o]});return"string"==typeof e.className&&"string"==typeof t.className&&(n.className=`${e.className} ${t.className}`),n}(e,t.rule.transform),e),matches:o}}function fl(e,t,n){const o=e.xValue??t?.[n];if(null==o)return null;const r=Number(o);return Number.isFinite(r)?r:null}function pl(e){let t=e.data||e.datum||e;return Array.isArray(t)&&(t=t[0]),null!=e.xValue&&t&&"object"==typeof t&&!Array.isArray(t)&&null==t.xValue?{...t,xValue:e.xValue}:t||{}}function yl(e){if(!e)return!1;for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!0;return!1}require("react/jsx-runtime"),ll.createContext(void 0);var ml="#007bff",gl=[],xl=44,bl={enabled:!0,tapToSelect:!0,tapToLockTooltip:!0,clearSelection:"backgroundTap",targetSize:xl,snap:"nearestDatum",brushHandleSize:xl,standardControls:!1,enabled:!1,tapToSelect:!1,tapToLockTooltip:!1};function vl(e,t={}){const n=t.mobileSemantics?.interaction,o="number"==typeof n?.targetSize?n.targetSize:"number"==typeof t.mobileSemantics?.minimumHitTarget?t.mobileSemantics.minimumHitTarget:void 0,r="mobile"===t.mode||"number"==typeof t.width&&480>=t.width,i=!!n||void 0!==o,s=e&&"object"==typeof e?e:void 0;if(!1===e||!1===s?.enabled||void 0===e&&!r&&!i)return bl;const a=s??{};return{enabled:!0,tapToSelect:a.tapToSelect??!0,tapToLockTooltip:a.tapToLockTooltip??!0,clearSelection:a.clearSelection??"backgroundTap",targetSize:a.targetSize??o??xl,snap:a.snap??"nearestDatum",brushHandleSize:a.brushHandleSize??xl,standardControls:a.standardControls??!1}}function kl(){const e=cl(),t=e?.colors?.categorical;return t&&t.length>0?t:void 0}function wl(e,t,n){const o=Oa(),r=kl();return(0,La.useMemo)(()=>{if(!t)return;const i=o??void 0,s=n??(r&&r.length>0?r:void 0)??"category10";if(0!==e.length){if("function"==typeof t){const n=Array.from(new Set(e.map(e=>t(e)+"")));if(i&&yl(i)){const e=Fe(n.map(e=>({_cat:e})),"_cat",s);return t=>i[t]||e(t)}return Fe(n.map(e=>({_cat:e})),"_cat",s)}if(i&&yl(i)){const n=Fe(e,t,s);return e=>i[e]||n(e)}return Fe(e,t,s)}if(i&&yl(i)){const e=Fe([{_:"a"}],"_",s);return t=>i[t]||e(t)}},[e,t,n,o,r])}function Al({selection:e,linkedHover:t,fallbackFields:n=gl,unwrapData:o=!1,onObservation:r,chartType:i,chartId:s,onClick:a,hoverHighlight:l,colorByField:c,mobileInteraction:u}){const h=(0,La.useId)(),d=(0,La.useMemo)(()=>function(e,t){return e?!0===e?{name:"hover",fields:t||[]}:"string"==typeof e?{name:e,fields:t||[]}:{name:e.name||"hover",fields:e.fields||t||[],mode:e.mode,xField:e.xField,seriesField:e.seriesField}:null}(t,n),[t,n]),f=(0,La.useMemo)(()=>"series"===d?.mode?[d.seriesField||c||n[0]].filter(e=>!!e):d?.fields||n,[d,c,n]),p=Ya({name:e?.name||"__unused__",fields:f}),y=function(e){const t=e.name||"hover",{fields:n}=e,{predicate:o,isActive:r,selectPoints:i,clear:s}=Ya({name:t,fields:n});return{onHover:(0,$a.useCallback)(e=>{if(!e)return void s();const t={};for(const o of n){const n=e[o];void 0!==n&&(t[o]=[n])}Va(t)&&i(t)},[n,i,s]),predicate:o,isActive:r}}({name:d?.name||"hover",fields:f}),m=lr(e=>e.pushObservation),g=(0,La.useCallback)(e=>{r?.(e),m?.(e)},[r,m]),x=e?{isActive:p.isActive,predicate:p.predicate}:null,[b,v]=(0,La.useState)(null),k=(0,La.useRef)(!1),w=c||n[0],A=(0,La.useMemo)(()=>{if(!l||null==b||!w)return null;const e=b,t=w;return{isActive:!0,predicate:n=>("string"==typeof n[t]?n[t]:(n[t]??"")+"")===e}},[l,b,w]),S=(0,La.useCallback)((e,n)=>{const o=!e&&k.current&&!!u?.enabled&&u.tapToLockTooltip;if(t)if(e){let t=e.data||e.datum||e;if(Array.isArray(t)&&(t=t[0]),"x-position"===d?.mode&&d.xField){const n=fl(e,t,d.xField);null!=n&&function(e,t,n){const o=Fr.positions.get(e);o?.locked||o&&o.xValue===t&&o.sourceId===n||(Fr={positions:new Map(Fr.positions).set(e,{xValue:t,sourceId:n})},Br())}(d.name||"hover",n,h)}"x-position"!==d?.mode&&y.onHover(t)}else"x-position"!==d?.mode||o||Dr(d.name||"hover",h),"x-position"===d?.mode||o||y.onHover(null);if(l&&w)if(e){let t=e.data||e.datum||e;Array.isArray(t)&&(t=t[0]);const n=t?.[w];v(null!=n?n+"":null)}else o||v(null);(r||m)&&xa({onObservation:g,datum:e?pl(e):null,x:e?.x,y:e?.y,chartType:i||"unknown",chartId:s,context:n})},[t,y,d,h,r,i,s,m,g,l,w,u]),C=(0,La.useCallback)((n=!0)=>{k.current=!1,t&&"x-position"!==d?.mode&&y.onHover(null),e&&u?.tapToSelect&&p.clear(),n&&l&&v(null),"x-position"===d?.mode&&(Wr(d.name||"hover",h),Dr(d.name||"hover",h))},[t,d,y,e,u,p,l,h]),M=(0,La.useCallback)((n,o)=>{const c=!!u?.enabled&&(u.tapToLockTooltip||u.tapToSelect),x=!!u?.enabled&&"backgroundTap"===u.clearSelection;if("x-position"===d?.mode&&d.xField&&n){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]);const t=fl(n,e,d.xField);null!=t&&function(e,t,n){const o=Fr.positions.get(e);if(o?.locked){const t=new Map(Fr.positions);return t.delete(e),Fr={positions:t},Br(),!1}Fr={positions:new Map(Fr.positions).set(e,{xValue:t,sourceId:n,locked:!0})},Br()}(d.name||"hover",t,h)}if(c)if(n){k.current=!0;const o=pl(n);if(t&&"x-position"!==d?.mode&&y.onHover(o),e&&u?.tapToSelect&&f.length>0){const e={};for(const t of f){const n=o[t];void 0!==n&&(e[t]=[n])}yl(e)&&p.selectPoints(e)}if(l&&w){const e=o?.[w];v(null!=e?e+"":null)}}else x&&C();if(n||x){if(n&&a){let e=n.data||n.datum||n;Array.isArray(e)&&(e=e[0]),a(e,{x:n.x??0,y:n.y??0})}(r||m)&&ba({onObservation:g,datum:n?pl(n):null,x:n?.x,y:n?.y,chartType:i||"unknown",chartId:s,context:o})}},[a,r,m,g,i,s,d,h,u,t,y,e,p,f,l,w,C]);return(0,La.useEffect)(()=>{if(!u?.enabled||"undefined"==typeof document)return;const e=e=>{"Escape"===e.key&&k.current&&C()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[u?.enabled,C]),(0,La.useEffect)(()=>()=>{k.current&&C(!1)},[C]),(0,La.useEffect)(()=>{if("x-position"!==d?.mode)return;const e=d.name||"hover";return()=>{Wr(e,h),Dr(e,h)}},[d?.mode,d?.name,h]),{activeSelectionHook:x,hoverSelectionHook:A,customHoverBehavior:S,customClickBehavior:M,crosshairSourceId:h}}function Sl(e,t){const n="object"==typeof e&&null!==e?e:void 0;if("x-position"===n?.mode)return{linkedCrosshairName:n.name||"hover",linkedCrosshairSourceId:t}}function Cl({data:e,colorBy:t,colorScale:n,showLegend:o,legendPosition:r="right",userMargin:i,defaults:s={top:50,bottom:60,left:70,right:40},categories:a}){const l=(0,Ba.useContext)(Ua),c=null!==(0,Ba.useContext)(Qa),u=void 0!==o?o:!l&&!!t,h=!!t&&(u||c),d=(0,La.useMemo)(()=>{if(!h)return[];if(void 0!==a)return a;const n=new Set;for(const o of e){const e="function"==typeof t?t(o):o[t];null!=e&&n.add(e+"")}return Array.from(n)},[a,t,e,h]);!function(e){const t=(0,Ba.useContext)(Qa),n=(0,Ba.useId)(),o=Ja(e),r=(0,Ba.useRef)([]);el(r.current,o)||(r.current=o);const i=r.current;Za(()=>{if(t)return()=>t.unregisterCategories(n)},[t,n]),Za(()=>{t&&t.registerCategories(n,i)},[t,n,i])}(c&&t?d:[]);const f=(0,La.useMemo)(()=>{if(!u||!t)return;const o=function({data:e,colorBy:t,colorScale:n,getColor:o,strokeColor:r,strokeWidth:i,categories:s}){return{legendGroups:[{styleFn:e=>{const t=e.color||"#333",n={fill:t,stroke:t};return void 0!==r&&(n.stroke=r),void 0!==i&&(n.strokeWidth=i),n},type:"fill",items:(s&&s.length>0?s:Array.from(new Set(e.map(e=>"function"==typeof t?t(e):e[t])))).map((r,i)=>{const s=e.find("function"==typeof t?e=>t(e)===r:e=>e[t]===r),a=s?o(s,t,n):n?n(r):Le[i%Le.length];return{label:r+"",color:a}}),label:""}]}}({data:e,colorBy:t,colorScale:n,getColor:Te,categories:d});return 0!==o.legendGroups.reduce((e,t)=>e+t.items.length,0)?o:void 0},[u,t,e,n,d]),p=(0,La.useMemo)(()=>{const e="number"==typeof i?{top:i,bottom:i,left:i,right:i}:i??{},t=t=>{const n=e[t];return"number"==typeof n?n:s[t]},n={top:t("top"),right:t("right"),bottom:t("bottom"),left:t("left")},o=t=>"number"==typeof e[t];return f&&("right"===r&&!o("right")&&110>n.right?n.right=110:"left"===r&&!o("left")&&110>n.left?n.left=110:"top"===r&&!o("top")&&50>n.top?n.top=50:"bottom"===r&&!o("bottom")&&80>n.bottom&&(n.bottom=80)),n},[s,i,f,r]);return{legend:f,margin:p,legendPosition:r}}function Ml(e,t,n){const[o,r]=(0,La.useState)(null),[i,s]=(0,La.useState)(new Set),a=(0,La.useMemo)(()=>new Set,[]),l=(0,La.useCallback)(t=>{"highlight"===e&&r(t?t.label:null)},[e]),c=(0,La.useCallback)(t=>{"isolate"===e&&s(e=>{const o=new Set(e);return o.has(t.label)?o.delete(t.label):o.add(t.label),o.size===n.length?new Set:o})},[e,n.length]),u=(0,La.useMemo)(()=>{if(!e||"none"===e||!t)return null;const n="string"==typeof t?t:null;return"highlight"===e&&null!=o?{isActive:!0,predicate:e=>(n?e[n]:"function"==typeof t?t(e):null)===o}:"isolate"===e&&i.size>0?{isActive:!0,predicate:e=>{const o=n?e[n]:"function"==typeof t?t(e):null;return i.has(o)}}:null},[e,t,o,i]);return{highlightedCategory:"highlight"===e?o:null,isolatedCategories:"isolate"===e?i:a,onLegendHover:l,onLegendClick:c,legendSelectionHook:u}}var jl={primary:{width:600,height:400,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:void 0,showLabels:void 0,marginDefaults:{top:50,bottom:60,left:70,right:40}},context:{width:400,height:250,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:10,bottom:10,left:10,right:10}},sparkline:{width:120,height:24,showAxes:!1,showGrid:!1,enableHover:!1,showLegend:!1,showLabels:!1,marginDefaults:{top:2,bottom:2,left:0,right:0}},mobile:{width:390,height:300,showAxes:!0,showGrid:!1,enableHover:!0,showLegend:!1,showLabels:!0,marginDefaults:{top:28,bottom:42,left:44,right:16}}};function _l(e,t,n){const o=jl[e||"primary"],r=e&&"primary"!==e||!n?.width?o.width:n.width,i=e&&"primary"!==e||!n?.height?o.height:n.height,s=dl({...t,mode:e},{width:t.width??r,height:t.height??i}).props,a=s.mode||e,l=jl[a||"primary"],c="context"===a||"sparkline"===a,u=a&&"primary"!==a||!n?.width?l.width:n.width;return{width:s.width??u,height:s.height??(a&&"primary"!==a||!n?.height?l.height:n.height),showAxes:s.showAxes??l.showAxes,showGrid:s.showGrid??l.showGrid,enableHover:s.enableHover??(!!s.linkedHover||l.enableHover),showLegend:s.showLegend??l.showLegend,showLabels:s.showLabels??l.showLabels,title:c?void 0:s.title,description:s.description,summary:s.summary,accessibleTable:s.accessibleTable,xLabel:c?void 0:s.xLabel,yLabel:c?void 0:s.yLabel,categoryLabel:c?void 0:s.categoryLabel,valueLabel:c?void 0:s.valueLabel,marginDefaults:Rl(l.marginDefaults,s.showCategoryTicks,s.orientation),compactMode:c,mobileInteraction:vl(s.mobileInteraction,{mode:a,width:s.width??u,mobileSemantics:s.mobileSemantics}),mobileSemantics:s.mobileSemantics}}function Rl(e,t,n){if(!1!==t)return e;const o={...e};return"horizontal"===n?o.left=Math.min(o.left,15):o.bottom=Math.min(o.bottom,15),o}var Pl=require("react/jsx-runtime");function Ll({componentName:e,message:t,diagnosticHint:n,width:o,height:r}){return(0,Pl.jsx)("div",{role:"alert",style:{width:o,height:Math.max(r,120),display:"flex",alignItems:"center",justifyContent:"center",border:"1px dashed rgba(128, 128, 128, 0.4)",borderRadius:8,background:"rgba(128, 128, 128, 0.04)",padding:24,boxSizing:"border-box"},children:(0,Pl.jsxs)("div",{style:{textAlign:"center",maxWidth:400},children:[(0,Pl.jsx)("div",{style:{fontSize:13,fontWeight:600,color:"rgba(128, 128, 128, 0.7)",marginBottom:6,fontFamily:"monospace"},children:e}),(0,Pl.jsx)("div",{style:{fontSize:14,color:"rgba(128, 128, 128, 0.9)",lineHeight:1.5},children:t}),n&&(0,Pl.jsx)("div",{"data-testid":"semiotic-diagnostic-hint",style:{marginTop:10,padding:"8px 12px",background:"rgba(128, 128, 128, 0.06)",borderRadius:4,fontSize:12,color:"rgba(128, 128, 128, 0.8)",fontFamily:"monospace",textAlign:"left",whiteSpace:"pre-wrap",lineHeight:1.6},children:n})]})})}var Il=c(require("react")),Tl=require("react/jsx-runtime"),Nl=class extends Il.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){this.props.onError?.(e,t)}render(){if(this.state.error){const{fallback:e}=this.props,t=this.state.error;return"function"==typeof e?e(t):void 0!==e?e:(0,Tl.jsx)(Ll,{componentName:"ChartErrorBoundary",message:t.message||"An unexpected error occurred while rendering this chart.",width:600,height:400})}return this.props.children}},Fl=require("react/jsx-runtime"),Ol="undefined"!=typeof process&&"production"!==process.env?.NODE_ENV;function Bl({componentName:e,width:t,height:n,children:o}){return(0,Fl.jsx)(Nl,{fallback:o=>(0,Fl.jsx)(Ll,{componentName:e,message:o.message,width:t,height:n}),children:o})}var Dl={display:"flex",alignItems:"center",justifyContent:"center",color:"var(--semiotic-text-secondary, #666)",fontSize:13,fontFamily:"inherit",border:"1px dashed var(--semiotic-border, #ddd)",borderRadius:4,boxSizing:"border-box"},Wl={background:"var(--semiotic-border, #e0e0e0)",borderRadius:2};function zl(e,t,n,o){return!1===o||null==e||Array.isArray(e)&&e.length>0?null:Array.isArray(e)?(0,Fl.jsx)("div",{style:{...Dl,width:t,height:n},children:o||"No data available"}):null}function Hl(e,t,n,o){if(!e)return null;if(!1===o)return null;if(null!=o)return(0,Fl.jsx)("div",{style:{width:t,height:n,display:"flex",alignItems:"center",justifyContent:"center",boxSizing:"border-box"},children:o});const r=Math.min(5,Math.floor(n/40)),i=Math.max(8,Math.floor(n/(3*r))),s=Math.max(6,Math.floor(n/(2.5*r))),a=Math.floor((n-(r*(i+s)-s))/2);return(0,Fl.jsx)("div",{style:{width:t,height:n,position:"relative",overflow:"hidden",border:"1px solid var(--semiotic-border, #e0e0e0)",borderRadius:4,boxSizing:"border-box"},children:Array.from({length:r},(e,n)=>(0,Fl.jsx)("div",{className:"semiotic-loading-bar",style:{...Wl,position:"absolute",top:a+n*(i+s),left:Math.floor(.1*t),width:30+(37*n+13)%50+"%",height:i,opacity:.5+n%2*.2}},n))})}function El(e,t,n,o){if(!Ol)return;if(!t||0===t.length)return;if("string"!=typeof o)return;const r=t[0];if(!r||"object"!=typeof r)return;if(o in r)return;const i=Object.keys(r).join(", ");console.warn(`[semiotic] ${e}: ${n} "${o}" not found in data. Available keys: ${i}`)}function $l(e,t){const n=e.length,o=t.length,r=Array(o+1);for(let e=0;o>=e;e++)r[e]=e;for(let i=1;n>=i;i++){let n=r[0];r[0]=i;for(let s=1;o>=s;s++){const o=r[s];r[s]=e[i-1]===t[s-1]?n:1+Math.min(n,r[s],r[s-1]),n=o}}return r[o]}function Yl(e,t){if(0===t.length)return null;const n=e.toLowerCase();return t.find(e=>e.toLowerCase().includes(n)||n.includes(e.toLowerCase()))||(function(e,t,n=3){let o,r=n+1;for(const n of t){const t=$l(e.toLowerCase(),n.toLowerCase());r>t&&(r=t,o=n)}return r>n?void 0:o}(e,t,3)??null)}function Gl({componentName:e,data:t,accessors:n,requiredProps:o}){if(o)for(const[t,n]of Object.entries(o))if(null==n)return`${e}: ${t} is required. Provide a field name or function.`;if(null==t)return null;if(!Array.isArray(t)&&"object"==typeof t)return e+": data should be an array, but received an object. If this is hierarchical data, use TreeDiagram, Treemap, or CirclePack instead.";if(!Array.isArray(t)||0===t.length)return e+": No data provided. Pass a non-empty array to the data prop.";if(n){const o=function(e){return e.length>3?[e[0],e[Math.floor(e.length/2)],e[e.length-1]]:[...e]}(t).find(e=>e&&"object"==typeof e);if(o){const t=Object.keys(o);for(const[r,i]of Object.entries(n))if(i&&"string"==typeof i&&!(i in o)){const n=Yl(i,t),o=n?` Try ${r}="${n}".`:"";return`${e}: ${r} "${i}" not found in data. Available fields: ${t.join(", ")}.${o}`}}}return null}var ql=require("react"),Vl=require("react");function Xl(e){const t=J(e=>e.theme.colors.selectionOpacity);return(0,Vl.useMemo)(()=>{if(void 0!==e||void 0!==t)return{name:e?.name??"",...e,unselectedOpacity:e?.unselectedOpacity??t}},[e,t])}function Ul(e){const{data:t,rawData:n,colorBy:o,colorScheme:r,legendInteraction:i,legendPosition:s,selection:a,linkedHover:l,fallbackFields:c,unwrapData:u=!1,onObservation:h,chartType:d,chartId:f,showLegend:p,userMargin:y,marginDefaults:m,onClick:g,hoverHighlight:x,mobileInteraction:b,mobileSemantics:v,loading:k,loadingContent:w,emptyContent:A,width:S,height:C}=e,M=void 0===n,j=(0,ql.useMemo)(()=>W(t),[t]),[_,R]=(0,ql.useState)([]),P=(0,ql.useCallback)(e=>{R(t=>t.length===e.length&&t.every((t,n)=>t===e[n])?t:e)},[]),L="string"==typeof e.colorBy?e.colorBy:void 0,I=(0,ql.useMemo)(()=>vl(b,{width:S,mobileSemantics:v}),[b,S,v]),{activeSelectionHook:T,hoverSelectionHook:N,customHoverBehavior:F,customClickBehavior:O,crosshairSourceId:B}=Al({selection:a,linkedHover:l,fallbackFields:c,unwrapData:u,onObservation:h,chartType:d,chartId:f,onClick:g,hoverHighlight:x,colorByField:L,mobileInteraction:I}),D=Sl(l,B),z=wl(j,o,r),H=(0,ql.useMemo)(()=>{if(!o)return[];const e=new Set;for(const t of j){const n="function"==typeof o?o(t):t[o];null!=n&&e.add(n+"")}return Array.from(e)},[j,o]),E=(0,ql.useMemo)(()=>M&&_.length>0?_:H,[M,_,H]),$=Ml(i,o,E),Y=(0,ql.useMemo)(()=>N||($.legendSelectionHook?$.legendSelectionHook:T),[N,$.legendSelectionHook,T]),G=Xl(a),q=kl(),V=Oa(),X=(0,ql.useMemo)(()=>{if(z)return z;if(!o||0===E.length)return;const e=Array.isArray(r)&&r.length>0||"string"==typeof r&&r.length>0?r:q&&q.length>0?q:Le,t="__streamCat",n=Fe(E.map(e=>({[t]:e})),t,e);return e=>V?.[e]||n(e)||"#999"},[z,o,E,r,q,V]),{legend:U,margin:K,legendPosition:Q}=Cl({data:j,colorBy:o,colorScale:X,showLegend:p,legendPosition:s,userMargin:y,defaults:m,categories:E}),Z=(0,ql.useMemo)(()=>{const e={};return U&&(e.legend=U,e.legendPosition=Q),i&&"none"!==i&&(e.legendHoverBehavior=$.onLegendHover,e.legendClickBehavior=$.onLegendClick,e.legendHighlightedCategory=$.highlightedCategory,e.legendIsolatedCategories=$.isolatedCategories),M&&o&&(e.legendCategoryAccessor=o,e.onCategoriesChange=P),e},[U,Q,i,$.onLegendHover,$.onLegendClick,$.highlightedCategory,$.isolatedCategories,M,o,P]),J=Array.isArray(n)?W(n):n,ee=Hl(k,S,C,w),te=ee?null:zl(J,S,C,A);return{data:j,colorScale:z,allCategories:E,legendState:$,effectiveSelectionHook:Y,activeSelectionHook:T,customHoverBehavior:F,customClickBehavior:O,mobileInteraction:I,legend:U,margin:K,legendPosition:Q,earlyReturn:ee||te||null,legendBehaviorProps:Z,crosshairProps:D,resolvedSelection:G}}var Kl=require("react");function Ql(e,t){if(!function(e){return void 0!==e.stroke||void 0!==e.strokeWidth||void 0!==e.opacity}(t))return e??((...e)=>({}));const n={};return void 0!==t.stroke&&(n.stroke=t.stroke),void 0!==t.strokeWidth&&(n.strokeWidth=t.strokeWidth),void 0!==t.opacity&&(n.opacity=t.opacity),e?(...t)=>({...e(...t)||{},...n}):(...e)=>({...n})}function Zl(e){if(null==e)return()=>{};const t="function"==typeof e?e:t=>t[e];return e=>ec(t(e))}function Jl(e,t){const n=Zl(e),o=Zl(t);return(e,t)=>{const r=o(e);return{value:r,x:n(e),y:r,category:t}}}function ec(e){if("number"==typeof e)return Number.isFinite(e)?e:void 0;if("string"==typeof e&&""!==e.trim()){const t=Number(e);return Number.isFinite(t)?t:void 0}}function tc(e,t,n){const o=null!=e.axis?n[e.axis]:null!=e.field?t[e.field]:n.value;if(void 0!==e.eq&&o!==e.eq)return!1;if(void 0!==e.ne&&o===e.ne)return!1;if(void 0!==e.in&&!e.in.includes(o))return!1;if(void 0===e.gt&&void 0===e.gte&&void 0===e.lt&&void 0===e.lte&&void 0===e.within&&void 0===e.outside)return!0;const r=ec(o);if(void 0===r)return!1;if(void 0!==e.gt&&e.gt>=r)return!1;if(void 0!==e.gte&&e.gte>r)return!1;if(void 0!==e.lt&&r>=e.lt)return!1;if(void 0!==e.lte&&r>e.lte)return!1;if(void 0!==e.within){const[t,n]=e.within;if(t>r||r>n)return!1}if(void 0!==e.outside){const[t,n]=e.outside;if(r>=t&&n>=r)return!1}return!0}function nc(e,t,n){const o=e.when;return void 0===o||!0===o||!1!==o&&("function"==typeof o?o(t,n):tc(o,t,n))}function oc(e,t,n){if(!t||0===t.length)return{};let o={};for(const r of t){if(!nc(r,e,n))continue;const t="function"==typeof r.style?r.style(e,n):r.style;t&&(o={...o,...t})}return o}function rc(e,t,n,o=e=>e){const r=e??(()=>({}));return t&&0!==t.length?(e,i)=>{const s=o(e),a={...r(e,i)};return Object.assign(a,oc(s,t,n(s,i))),a}:r}function ic(e){const{lineWidth:t=2,colorBy:n,colorScale:o,color:r,resolveStroke:i,fillArea:s,areaOpacity:a=.3,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,styleRules:f,ruleContext:p}=e,y=(0,Kl.useMemo)(()=>(e,l)=>{const c={strokeWidth:t},u=!0===s||Array.isArray(s)&&null!=l&&s.includes(l);let h;return i?h=i(e,l):n?o&&(h=Te(e,n,o)):h=r||ml,void 0!==h&&(c.stroke=h,u&&(c.fill=h,c.fillOpacity=a)),f&&f.length>0&&Object.assign(c,oc(e,f,p?p(e,l):{value:void 0,category:l})),c},[t,n,o,r,i,s,a,f,p]),m=(0,Kl.useMemo)(()=>Ql(y,{stroke:l,strokeWidth:c,opacity:u}),[y,l,c,u]);return(0,Kl.useMemo)(()=>al(m,h??null,d),[m,h,d])}var sc=require("react");function ac(e,t){const{variant:n,frameRef:o,overrides:r}=t;(0,sc.useImperativeHandle)(e,()=>{const e=function(e,t){if("xy"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.remove(t)??[],update:(t,n)=>e.current?.update(t,n)??[],clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getScales:()=>e.current?.getScales()??null,getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("network"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>{const n=Array.isArray(t)?t:[t],o=e.current?.getTopology()?.nodes??[],r=[];for(const t of n){const n=o.find(e=>e.id===t);n&&r.push({...n.data??{},id:t}),e.current?.removeNode(t)}return r},update:(t,n)=>(Array.isArray(t)?t:[t]).flatMap(t=>{const o=e.current?.updateNode(t,n);return o?[{...o,id:t}]:[]}),clear:()=>e.current?.clear(),getData:()=>e.current?.getTopology()?.nodes?.map(e=>e.data)??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}if("geo-points"===e){const e=t;return{push:t=>e.current?.push(t),pushMany:t=>e.current?.pushMany(t),remove:t=>e.current?.removePoint(t)??[],update:(t,n)=>{const o=e.current?.removePoint(t)??[];for(const t of o)e.current?.push(n(t));return o},clear:()=>e.current?.clear(),getData:()=>e.current?.getData()??[],getCustomLayout:()=>e.current?.getCustomLayout?.()??null,getLayoutFailure:()=>e.current?.getLayoutFailure?.()??null}}const n=t;return{push:e=>n.current?.pushLine(e),pushMany:e=>n.current?.pushManyLines(e),remove:e=>n.current?.removeLine(e)??[],update:(e,t)=>{const o=n.current?.removeLine(e)??[];for(const e of o)n.current?.pushLine(t(e));return o},clear:()=>n.current?.clear(),getData:()=>n.current?.getLines()??[],getCustomLayout:()=>n.current?.getCustomLayout?.()??null,getLayoutFailure:()=>n.current?.getLayoutFailure?.()??null}}(n,o);return{...e,...r}},[o,r,n])}function lc(e){const{title:t,description:n,summary:o,accessibleTable:r,className:i,animate:s,axisExtent:a,autoPlaceAnnotations:l}=e,c={};return t&&(c.title=t),n&&(c.description=n),o&&(c.summary=o),void 0!==r&&(c.accessibleTable=r),i&&(c.className=i),null!=s&&(c.animate=s),void 0!==a&&(c.axisExtent=a),void 0!==l&&(c.autoPlaceAnnotations=l),c}function cc(e){const{linkedHover:t,selection:n,onObservation:o,onClick:r,hoverRadius:i,hoverHighlight:s,forceHoverBehavior:a,forceClickBehavior:l,mobileInteraction:c,customHoverBehavior:u,customClickBehavior:h,linkedHoverInClickPredicate:d=!0}=e,f={};o&&(f.annotationObservationCallback=o);const p=c?.enabled?Math.max(i??30,Math.ceil((c.targetSize||44)/2),24):i;return(a||t||o||r||s)&&(f.customHoverBehavior=u),h&&(l||(d?o||r||t:o||r)||c?.enabled&&(c.tapToSelect||c.tapToLockTooltip)&&(t||s||n))&&(f.customClickBehavior=h),null!=p&&(f.hoverRadius=p),f}function uc(e){const{tooltip:t,defaultTooltipContent:n}=e;return{tooltipContent:!1===t?()=>null:ls(t)||n}}var hc="__forecastSegment",dc=null;async function fc(){return dc||(dc=await Promise.resolve().then(()=>(C(),x))),dc}var pc=require("react"),yc="__semiotic_resolvedX",mc="__semiotic_resolvedY";function gc(e){const{data:t,xAccessor:n,yAccessor:o,forecast:r,anomaly:i,groupBy:s}=e,a="string"==typeof n?n:yc,l="string"==typeof o?o:mc,c=(0,pc.useMemo)(()=>{if(!r&&!i)return t;const e="function"==typeof n,s="function"==typeof o;return e||s?t.map(t=>{const r={...t};return e&&(r[yc]=n(t)),s&&(r[mc]=o(t)),r}):t},[t,r,i,n,o]),[u,h]=(0,pc.useState)(null),[d,f]=(0,pc.useState)([]),p=(0,pc.useRef)(r),y=(0,pc.useRef)(i);return(0,pc.useEffect)(()=>{if(!r&&!i)return void((p.current||y.current)&&(h(null),f([]),p.current=r,y.current=i));let e=!1;const t=r!==p.current||i!==y.current;if(p.current=r,y.current=i,t&&(h(null),f([])),r){const t=s&&"string"==typeof s&&"object"==typeof r?{...r,_groupBy:s}:r;(async function(...e){return(await fc()).buildForecast(...e)})(c,a,l,t,i).then(t=>{e||(h(t),f(t.annotations))}).catch(()=>{e||(h(null),f([]))})}else i&&async function(...e){return(await fc()).buildAnomalyAnnotations(...e)}(i).then(t=>{e||(h(null),f(t))}).catch(()=>{e||f([])});return()=>{e=!0}},[c,r,i,a,l,s]),{effectiveData:u?u.processedData:t,statisticalAnnotations:d,hasForecast:!!u,xAccessorKey:a,yAccessorKey:l}}var xc=require("react/jsx-runtime"),bc="__lineObjectSeries",vc=(0,Pa.forwardRef)(function(e,t){const n=(0,Pa.useRef)(null);ac(t,{variant:"xy",frameRef:n});const o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,axisExtent:c,xAccessor:u="x",yAccessor:h="y",lineBy:d,lineDataAccessor:f="coordinates",colorBy:p,colorScheme:y,styleRules:m,curve:g="linear",showPoints:x=!1,pointRadius:b=3,fillArea:v=!1,areaOpacity:k=.3,lineWidth:w=2,lineGradient:A,tooltip:S,pointIdAccessor:C,annotations:M,directLabel:j,gapStrategy:_="break",anomaly:R,forecast:P,band:L,xExtent:I,yExtent:T,frameProps:N={},selection:F,linkedHover:O,onObservation:B,onClick:D,hoverHighlight:z,hoverRadius:H,chartId:E,loading:$,loadingContent:Y,emptyContent:G,legendInteraction:q,legendPosition:V,xScaleType:X,yScaleType:U,color:K,stroke:Q,strokeWidth:Z,opacity:J}=e,{width:ee,height:te,enableHover:ne,showGrid:oe,showLegend:re,title:ie,description:se,summary:ae,accessibleTable:le,xLabel:ce,yLabel:ue}=o,he=(0,Pa.useMemo)(()=>W(r),[r]),de=Array.isArray(he[0]?.[f])?he[0][f]:he;El("LineChart",de,"xAccessor",u),El("LineChart",de,"yAccessor",h);const{effectiveData:fe,statisticalAnnotations:pe}=gc({data:he,xAccessor:u,yAccessor:h,forecast:P,anomaly:R,groupBy:d}),ye="__compoundGroup",me=!(!P||!d),ge=me?ye:P?hc:d,xe=(0,Pa.useMemo)(()=>{if(!me)return fe;const e="function"==typeof d?d:e=>e[d];return fe.map(t=>{const n={...t};return n[ye]=`${e(t)}__${t[hc]||"observed"}`,n})},[fe,me,d]),be=me?xe:fe,ve=p||d,ke=(0,Pa.useMemo)(()=>{if(!P)return;const e=P.upperBounds,t=P.lowerBounds;if(!e&&!t)return;const n="function"==typeof e?e:"string"==typeof e?t=>t[e]:null,o="function"==typeof t?t:"string"==typeof t?e=>e[t]:null;let r=1/0,i=-1/0;const s=fe;for(const e of s){const t="function"==typeof h?h(e):+e[h];if(isFinite(t)&&(r>t&&(r=t),t>i&&(i=t)),n){const t=n(e);null!=t&&isFinite(t)&&(t>i&&(i=t),r>t&&(r=t))}if(o){const t=o(e);null!=t&&isFinite(t)&&(r>t&&(r=t),t>i&&(i=t))}}return isFinite(r)&&isFinite(i)?[r,i]:void 0},[P,fe,h]),we=(0,Pa.useCallback)(e=>{const t="function"==typeof u?u(e):e[u],n="function"==typeof h?h(e):e[h];return null==t||null==n||Number.isNaN(t)||Number.isNaN(n)},[u,h]),Ae=void 0!==be[0]?.[f],Se=Ae?bc:ge,Ce=(0,Pa.useMemo)(()=>{if(Ae)return be.map((e,t)=>{const n="function"==typeof d?d(e):"string"==typeof d?e[d]:void 0,o=null==n?"line-"+t:n+"",r=Array.isArray(e[f])?e[f]:[];return{...e,[bc]:o,[f]:r.map(t=>({...t,[bc]:o,parentLine:e,..."string"==typeof d&&void 0!==e[d]?{[d]:e[d]}:{}}))}});if(ge){const e=be.reduce((e,t)=>{const n="function"==typeof ge?ge(t):t[ge];if(!e[n]){const o={[f]:[]};"string"==typeof ge&&(o[ge]=n),me&&(o[hc]=t[hc],"string"==typeof d&&(o[d]=t[d])),e[n]=o}return e[n][f].push(t),e},{});return Object.values(e)}return[{[f]:be}]},[Ae,ge,f,be,d,me]),{gapProcessedLineData:Me,hasGaps:je}=(0,Pa.useMemo)(()=>{if("interpolate"===_){let e=!1;const t=[];for(const n of Ce){const o=(n[f]||[]).filter(t=>!we(t)||(e=!0,!1));o.length>0&&t.push({...n,[f]:o})}return{gapProcessedLineData:t,hasGaps:e}}if("break"===_){let e=!1;const t=[];for(const n of Ce){const o=n[f]||[];let r=[],i=0;const s=Se&&"string"==typeof Se?n[Se]:void 0;for(const a of o)if(we(a))e=!0,r.length>0&&(t.push({...n,[f]:r}),r=[],i++);else{const e=null!=s?`${s}__seg${i}`:"__seg"+i;r.push({...a,_gapSegment:e})}r.length>0&&t.push({...n,[f]:r})}return{gapProcessedLineData:t,hasGaps:e}}if("zero"===_){let e=!1;const t="string"==typeof h?h:"y",n=[];for(const o of Ce){const r=o[f]||[],i=[];for(const n of r)we(n)?(e=!0,i.push({...n,[t]:0})):i.push(n);n.push({...o,[f]:i})}return{gapProcessedLineData:n,hasGaps:e}}return{gapProcessedLineData:Ce,hasGaps:!1}},[Ce,_,f,we,Se,h]),_e="object"==typeof j?j:{},Re=_e.position||"end",Pe=_e.fontSize||11,Le=(0,Pa.useMemo)(()=>{if(!j||!ve)return[];const e="function"==typeof ve?ve:e=>e[ve],t=new Set;for(const n of Me){const o=n[f]||[];if(0===o.length)continue;const r=e("end"===Re?o[o.length-1]:o[0])??e(n);if(null==r)continue;const i=r+"";""!==i&&t.add(i)}return Array.from(t)},[j,ve,Me,f,Re]),Ie=(0,Pa.useMemo)(()=>{if(!j)return o.marginDefaults;const e=Le.reduce((e,t)=>Math.max(e,t.length*(.6*Pe)),0)+10,t="end"===Re?"right":"left";return{...o.marginDefaults,[t]:Math.max(o.marginDefaults[t]||0,e)}},[j,Le,Pe,Re,o.marginDefaults]),Ne=Ul({data:fe,rawData:r,colorBy:ve,colorScheme:y,legendInteraction:q,legendPosition:V,selection:F,linkedHover:O,fallbackFields:ve?["string"==typeof ve?ve:""]:[],unwrapData:!1,onObservation:B,onClick:D,hoverHighlight:z,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"LineChart",chartId:E,showLegend:(!j||void 0!==re)&&re,userMargin:i,marginDefaults:Ie,loading:$,loadingContent:Y,emptyContent:G,width:ee,height:te}),Fe=Ne.colorScale,Oe=Ne.effectiveSelectionHook,Be=Ne.resolvedSelection,De=Ne.customHoverBehavior,We=Ne.customClickBehavior,ze=Ne.crosshairProps,He=(0,Pa.useMemo)(()=>{if(ve)return Ae?e=>{const t=e.parentLine||e;return"function"==typeof ve?ve(t):t[ve]}:ve},[ve,Ae]),Ee=(0,Pa.useMemo)(()=>Jl(u,h),[u,h]),$e=ic({lineWidth:w,colorBy:He,colorScale:Fe,color:K,fillArea:v,areaOpacity:k,stroke:Q,strokeWidth:Z,opacity:J,effectiveSelectionHook:Oe,resolvedSelection:Be,styleRules:m,ruleContext:Ee}),[Ye,Ge]=(0,Pa.useState)(null);(0,Pa.useEffect)(()=>{if(!P)return void Ge(null);let e=!1;return async function(...e){return(await fc()).createSegmentLineStyle(...e)}($e,P).then(t=>{e||Ge(()=>t)}).catch(()=>{e||Ge(null)}),()=>{e=!0}},[$e,P]);const qe=Ye||$e,Ve=(0,Pa.useMemo)(()=>{if(x)return e=>{const t={r:b,fillOpacity:1};return ve?Fe&&(t.fill=Te(e.parentLine||e,ve,Fe)):t.fill=K||ml,t}},[x,b,ve,Fe,K]),Xe=Array.isArray(v)?"mixed":v?"area":"line",Ue=(0,Pa.useMemo)(()=>{if(!j||!ve)return[];const e="function"==typeof u?u:e=>e[u],t="function"==typeof h?h:e=>e[h],n="function"==typeof ve?ve:e=>e[ve],o=new Map;for(const e of Me){const t=e[f]||[];if(0===t.length)continue;const r="end"===Re?t[t.length-1]:t[0],i=n(r)??n(e);if(null==i)continue;const s=i+"";""===s||o.has(s)||o.set(s,r)}const r=Array.from(o.entries()).map(([n,o])=>({type:"text",label:n,["string"==typeof u?u:"x"]:e(o),["string"==typeof h?h:"y"]:t(o),dx:"end"===Re?6:-6,dy:0,color:Fe?Fe(n):ml,fontSize:Pe}));r.sort((e,t)=>{const n="string"==typeof h?h:"y";return e[n]-t[n]});for(let e=1;r.length>e;e++){const t="string"==typeof h?h:"y",n=r[e-1],o=r[e];Pe+2>Math.abs(o[t]+o.dy-(n[t]+n.dy))&&(o.dy+=Pe+2)}return r},[j,ve,Fe,Me,f,u,h,Re,Pe]),Ke=Ne.margin,Qe=d||p,Ze=(0,Pa.useMemo)(()=>pa([{label:ce||ca(u),accessor:u,role:"x",format:a},{label:ue||ca(h),accessor:h,role:"y",format:l},...Qe?[{label:ca(Qe),accessor:Qe,role:"group"}]:[],...fa(L,l)]),[u,h,ce,ue,Qe,a,l,L]),Je=Gl({componentName:"LineChart",data:Ae?fe[0]?.[f]||[]:r,accessors:{xAccessor:u,yAccessor:h}}),et=(0,Pa.useMemo)(()=>Ae||Se||je?Me.flatMap(e=>{const t=e[f]||[];return Se&&"string"==typeof Se?t.map(t=>({...t,[Se]:t[Se]??e[Se]})):t}):be,[Me,f,Ae,Se,be,je]),tt={chartType:Xe,...Array.isArray(v)&&{areaGroups:v},...A&&{lineGradient:A},...null!=r&&{data:et},xAccessor:u,yAccessor:h,xScaleType:X,yScaleType:U,...I&&{xExtent:I},...!T||null==T[0]&&null==T[1]?ke?{yExtent:ke}:{}:{yExtent:T},groupAccessor:"break"===_&&je?"_gapSegment":Se||void 0,...L&&{band:L},curve:g,lineStyle:qe,...x&&{pointStyle:Ve},size:[ee,te],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:Ke,showAxes:o.showAxes,xLabel:ce,yLabel:ue,xFormat:a,yFormat:l,...void 0!==c&&{axisExtent:c},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},enableHover:ne,showGrid:oe,...Ne.legendBehaviorProps,...ie&&{title:ie},...se&&{description:se},...ae&&{summary:ae},...void 0!==le&&{accessibleTable:le},...s&&{className:s},...null!=e.animate&&{animate:e.animate},tooltipContent:!1===S?()=>null:"multi"===S?as():ls(S)||Ze,..."multi"===S&&{tooltipMode:"multi"},...cc({linkedHover:O,selection:F,onObservation:B,onClick:D,hoverRadius:H,hoverHighlight:z,mobileInteraction:Ne.mobileInteraction,customHoverBehavior:De,customClickBehavior:We}),...C&&{pointIdAccessor:C},...(M?.length||pe.length||Ue.length)&&{annotations:[...M||[],...pe,...Ue]},...ze,...N};return Ne.earlyReturn?Ne.earlyReturn:Je?(0,xc.jsx)(Ll,{componentName:"LineChart",message:Je,width:ee,height:te}):(0,xc.jsx)(Bl,{componentName:"LineChart",width:ee,height:te,children:(0,xc.jsx)(Ra,{ref:n,...tt})})});vc.displayName="LineChart";var kc=require("react"),wc=require("react");function Ac(e){const{safeData:t,data:n,areaBy:o,lineDataAccessor:r,colorBy:i,colorScale:s,color:a,stroke:l,strokeWidth:c,opacity:u,effectiveSelectionHook:h,resolvedSelection:d,areaOpacity:f,showLine:p,lineWidth:y,showPoints:m,pointRadius:g,xAccessor:x,yAccessor:b,xLabel:v,yLabel:k,xFormat:w,yFormat:A,groupField:S,styleRules:C,ruleContext:M}=e,j=void 0!==t[0]?.[r],_=(0,wc.useMemo)(()=>{if(null==n)return[];if(!j&&!o)return t;let e;if(j)e=t;else{const n=o,i=t.reduce((e,t)=>{const o="function"==typeof n?n(t):t[n];if(!e[o]){const t={[r]:[]};"string"==typeof n&&(t[n]=o),e[o]=t}return e[o][r].push(t),e},{});e=Object.values(i)}return e.flatMap(e=>{const t=e[r]||[];return o&&"string"==typeof o?t.map(t=>({...t,[o]:e[o]})):t})},[n,t,o,r,j]),R=(0,wc.useMemo)(()=>e=>{const t={};if(i){if(s){const n=Te(e,i,s);t.fill=n,p?(t.stroke=n,t.strokeWidth=y):t.stroke="none"}}else{const e=a||ml;t.fill=e,p?(t.stroke=e,t.strokeWidth=y):t.stroke="none"}return t.fillOpacity=f,C&&C.length>0&&Object.assign(t,oc(e,C,M?M(e):{value:void 0})),t},[i,s,a,f,p,y,C,M]),P=(0,wc.useMemo)(()=>Ql(R,{stroke:l,strokeWidth:c,opacity:u}),[R,l,c,u]);return{flattenedData:_,lineStyle:(0,wc.useMemo)(()=>al(P,h??null,d),[P,h,d]),pointStyle:(0,wc.useMemo)(()=>{if(m)return e=>{const t={r:g,fillOpacity:1};return i?s&&(t.fill=Te(e.parentLine||e,i,s)):t.fill=a||ml,t}},[m,g,i,s,a]),defaultTooltipContent:(0,wc.useMemo)(()=>pa([{label:v||ca(x),accessor:x,role:"x",format:w},{label:k||ca(b),accessor:b,role:"y",format:A},...S?[{label:ca(S),accessor:S,role:"group"}]:[],...fa(e.band,A)]),[x,b,v,k,S,w,A,e.band])}}var Sc=require("react/jsx-runtime");function Cc(e,t){if(null==t)return e;const n=e.trim(),o=n.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(o){const e=o[1],n=3===e.length?e.split("").map(e=>e+e).join(""):e;return`rgba(${parseInt(n.slice(0,2),16)}, ${parseInt(n.slice(2,4),16)}, ${parseInt(n.slice(4,6),16)}, ${t})`}if(n.startsWith("rgba(")){const e=n.lastIndexOf(","),o=n.lastIndexOf(")");if(-1!==e&&o>e)return`${n.slice(0,e+1)} ${t})`}return n.startsWith("rgb(")?n.replace(/^rgb\(/,"rgba(").replace(/\)$/,`, ${t})`):e}var Mc=(0,kc.forwardRef)(function(e,t){const n=(0,kc.useRef)(null);ac(t,{variant:"xy",frameRef:n});const o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,y0Accessor:d,gradientFill:f=!1,semanticGradient:p,lineDataAccessor:y="coordinates",colorBy:m,colorScheme:g,styleRules:x,curve:b="monotoneX",areaOpacity:v=.7,lineGradient:k,showLine:w=!0,lineWidth:A=2,showPoints:S=!1,pointRadius:C=3,tooltip:M,annotations:j,forecast:_,anomaly:R,band:P,xExtent:L,yExtent:I,frameProps:T={},selection:N,linkedHover:F,onObservation:O,onClick:B,hoverHighlight:D,chartId:z,loading:H,loadingContent:E,emptyContent:$,legendInteraction:Y,legendPosition:G,color:q,stroke:V,strokeWidth:X,opacity:U}=e,{width:K,height:Q,enableHover:Z,showGrid:J,showLegend:ee,title:te,description:ne,summary:oe,accessibleTable:re,xLabel:ie,yLabel:se}=o,ae=(0,kc.useMemo)(()=>W(r),[r]),le=m||h,ce=(0,kc.useMemo)(()=>{return p&&p.length>0?{colorStops:(e=p,e.filter(e=>Number.isFinite(e.at)).map(e=>({offset:1-Math.max(0,Math.min(100,e.at))/100,color:Cc(e.color,e.opacity)})).sort((e,t)=>e.offset-t.offset))}:f;var e},[p,f]);El("AreaChart",ae,"xAccessor",c),El("AreaChart",ae,"yAccessor",u);const ue=Ul({data:ae,rawData:r,colorBy:le,colorScheme:g,legendInteraction:Y,legendPosition:G,selection:N,linkedHover:F,fallbackFields:le?["string"==typeof le?le:""]:[],unwrapData:!1,onObservation:O,onClick:B,hoverHighlight:D,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"AreaChart",chartId:z,showLegend:ee,userMargin:i,marginDefaults:o.marginDefaults,loading:H,loadingContent:E,emptyContent:$,width:K,height:Q}),{effectiveData:he,statisticalAnnotations:de}=gc({data:ae,xAccessor:c,yAccessor:u,forecast:_,anomaly:R,groupBy:h}),fe=(0,kc.useMemo)(()=>Jl(c,u),[c,u]),{flattenedData:pe,lineStyle:ye,pointStyle:me,defaultTooltipContent:ge}=Ac({safeData:he,data:r,areaBy:h,lineDataAccessor:y,colorBy:le,colorScale:ue.colorScale,color:q,stroke:V,strokeWidth:X,opacity:U,effectiveSelectionHook:ue.effectiveSelectionHook,resolvedSelection:ue.resolvedSelection,areaOpacity:v,showLine:w,lineWidth:A,showPoints:S,pointRadius:C,xAccessor:c,yAccessor:u,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,groupField:h||m,band:P,styleRules:x,ruleContext:fe}),xe=Gl({componentName:"AreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),be={chartType:"area",...null!=r&&{data:pe},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,...d&&{y0Accessor:d},...P&&{band:P},...ce&&{gradientFill:ce},...k&&{lineGradient:k},curve:b,lineStyle:ye,...S&&me&&{pointStyle:me},size:[K,Q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ue.margin,showAxes:o.showAxes,xLabel:ie,yLabel:se,xFormat:a,yFormat:l,enableHover:Z,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:J,...ue.legendBehaviorProps,...lc({title:te,description:ne,summary:oe,accessibleTable:re,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===M?{tooltipContent:as(),tooltipMode:"multi"}:uc({tooltip:M,defaultTooltipContent:ge}),...cc({linkedHover:F,selection:N,onObservation:O,onClick:B,hoverHighlight:D,mobileInteraction:ue.mobileInteraction,customHoverBehavior:ue.customHoverBehavior,customClickBehavior:ue.customClickBehavior}),...(j&&j.length>0||de.length>0)&&{annotations:[...j||[],...de]},...L&&{xExtent:L},...I&&{yExtent:I},...ue.crosshairProps,...T};return ue.earlyReturn?ue.earlyReturn:xe?(0,Sc.jsx)(Ll,{componentName:"AreaChart",message:xe,width:K,height:Q}):(0,Sc.jsx)(Bl,{componentName:"AreaChart",width:K,height:Q,children:(0,Sc.jsx)(Ra,{ref:n,...be})})});Mc.displayName="AreaChart";var jc=require("react"),_c=require("react/jsx-runtime");function Rc(e){if(null==e)return NaN;if("number"==typeof e)return e;if(e instanceof Date)return e.getTime();if("string"==typeof e){if(""===e.trim())return NaN;const t=+e;return Number.isFinite(t)?t:NaN}return NaN}var Pc=(0,jc.forwardRef)(function(e,t){const n=(0,jc.useRef)(null),o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",seriesAAccessor:u="a",seriesBAccessor:h="b",seriesALabel:d="A",seriesBLabel:f="B",seriesAColor:p="var(--semiotic-danger, #dc2626)",seriesBColor:y="var(--semiotic-info, #2563eb)",showLines:m=!0,lineWidth:g=1.5,showPoints:x=!1,pointRadius:b=3,curve:v="linear",areaOpacity:k=.6,gradientFill:w,tooltip:A,annotations:S,xExtent:C,yExtent:M,frameProps:j={},selection:_,linkedHover:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:D,pointIdAccessor:z,windowSize:H}=e,{width:E,height:$,enableHover:Y,showGrid:G,showLegend:q,title:V,description:X,summary:U,accessibleTable:K,xLabel:Q,yLabel:Z}=o,J=(0,jc.useMemo)(()=>"function"==typeof c?e=>Rc(c(e)):e=>Rc(e[c]),[c]),ee=(0,jc.useMemo)(()=>"function"==typeof u?e=>Rc(u(e)):e=>Rc(e[u]),[u]),te=(0,jc.useMemo)(()=>"function"==typeof h?e=>Rc(h(e)):e=>Rc(e[h]),[h]),[ne,oe]=(0,jc.useState)([]),re=(0,jc.useRef)([]),ie=null==r,se=(0,jc.useMemo)(()=>W(ie?ne:r),[ie,ne,r]),ae=(0,jc.useMemo)(()=>function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];let s=0,a=null,l=null,c=[];const u=(e,t)=>e>t?"A":t>e?"B":null,h=e=>`seg-${s}-${e}`,d=e=>i.push(e),f=(e,t)=>{d({__x:e.x,__y:e.y,__y0:e.y,__diffSegment:h(t),__diffWinner:t,__valA:e.y,__valB:e.y,__sourceDatum:e.datum})};for(let e=0;r.length>e;e++){const i=r[e],p=t(i),y=n(i),m=o(i);if(!Number.isFinite(p)||!Number.isFinite(y)||!Number.isFinite(m))continue;const g=u(y,m);if(null!==g)if(null!=a){if(l&&l.w!==g){let e,t;if(c.length>0)e=c[0].x,t=c[0].y;else{const n=y-l.a-(m-l.b);if(0!==n){const o=Math.max(0,Math.min(1,(l.b-l.a)/n));e=l.x+o*(p-l.x),t=l.a+o*(y-l.a)}else e=l.x,t=l.a}d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t}),s++,a=g,d({__x:e,__y:t,__y0:t,__diffSegment:h(a),__diffWinner:a,__valA:t,__valB:t});for(let e=1;c.length>e;e++)f(c[e],a)}else for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else{a=g;for(const e of c)f(e,a);c=[],d({__x:p,__y:m>y?m:y,__y0:m>y?y:m,__diffSegment:h(a),__diffWinner:a,__valA:y,__valB:m,__sourceDatum:i}),l={x:p,a:y,b:m,w:g}}else c.push({x:p,y:y,datum:i})}for(const e of c)f(e,a??"A");return i}(se,J,ee,te),[se,J,ee,te]),le=(0,jc.useMemo)(()=>m?function(e,t,n,o){if(!e.length)return[];const r=e.filter(e=>Number.isFinite(t(e))).sort((e,n)=>t(e)-t(n)),i=[];for(const e of r){const r=t(e),s=n(e),a=o(e);Number.isFinite(s)&&i.push({__x:r,__y:s,__diffSegment:"line-A"}),Number.isFinite(a)&&i.push({__x:r,__y:a,__diffSegment:"line-B"})}return i}(se,J,ee,te):[],[m,se,J,ee,te]),ce=(0,jc.useMemo)(()=>[...ae,...le],[ae,le]),ue=(0,jc.useMemo)(()=>{const e=new Set;for(const t of ae)e.add(t.__diffSegment);return Array.from(e)},[ae]);(0,jc.useImperativeHandle)(t,()=>{const e=e=>{const t=H&&e.length>H?e.slice(e.length-H):e;re.current=t,oe(t)},t=z?"function"==typeof z?z:e=>e[z]:null;return{push:t=>e([...re.current,t]),pushMany:t=>e([...re.current,...t]),remove:n=>{if(!t)return[];const o=Array.isArray(n)?n:[n],r=[],i=[];for(const e of re.current)o.includes(t(e))?r.push(e):i.push(e);return e(i),r},update:(n,o)=>{if(!t)return[];const r=Array.isArray(n)?n:[n],i=[],s=re.current.map(e=>{if(r.includes(t(e))){const t=o(e);return i.push(t),t}return e});return e(s),i},clear:()=>e([]),getData:()=>ie?re.current:se,getScales:()=>n.current?.getScales()??null}},[ie,se,z,H]);const he=Ul({data:se,rawData:r,colorBy:"__diffWinner",colorScheme:[p,y],legendInteraction:B,legendPosition:D,selection:_,linkedHover:R,fallbackFields:["__diffWinner"],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"DifferenceChart",chartId:T,showLegend:q,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:E,height:$}),de=(0,jc.useMemo)(()=>{if(!1!==q)return{legendGroups:[{label:"",type:"fill",styleFn:e=>({fill:e.color||"currentColor"}),items:[{label:d,color:p},{label:f,color:y}]}]}},[q,d,f,p,y]),fe=(0,jc.useCallback)(e=>{const t=e.__diffSegment;return{fill:"A"==(t?.endsWith("-A")?"A":"B")?p:y,stroke:"none",fillOpacity:k}},[p,y,k]),pe=(0,jc.useCallback)(e=>({stroke:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,strokeWidth:g,fill:"none"}),[p,y,g]),ye=(0,jc.useCallback)(e=>({fill:"A"==("line-A"===e.__diffSegment?"A":"B")?p:y,r:b}),[p,y,b]),me=(0,jc.useCallback)(e=>{const t=e.data,n=e.allSeries,o=e.xValue??t?.__x;let r=t?.__valA,i=t?.__valB;if(n&&n.length>0){const e=n.find(e=>"line-A"===e.group),t=n.find(e=>"line-B"===e.group);null!=e?.value&&Number.isFinite(e.value)&&(r=e.value),null!=t?.value&&Number.isFinite(t.value)&&(i=t.value)}if(null!=o&&(null==r||null==i)){const e=se.find(e=>J(e)===o);e&&(null==r&&(r=ee(e)),null==i&&(i=te(e)))}const s=e=>null!=e&&Number.isFinite(e)?""+Math.round(100*e)/100:"—",l=a&&null!=o?a(o):null!=o?o+"":"";return(0,_c.jsxs)("div",{className:"semiotic-tooltip",style:os,children:[l&&(0,_c.jsx)("div",{style:{fontWeight:600,marginBottom:4},children:l}),(0,_c.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,_c.jsx)("span",{style:{width:10,height:10,background:p,display:"inline-block",borderRadius:2}}),(0,_c.jsxs)("span",{children:[d,": ",s(r)]})]}),(0,_c.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:6},children:[(0,_c.jsx)("span",{style:{width:10,height:10,background:y,display:"inline-block",borderRadius:2}}),(0,_c.jsxs)("span",{children:[f,": ",s(i)]})]}),null!=r&&null!=i&&Number.isFinite(r)&&Number.isFinite(i)&&(0,_c.jsxs)("div",{style:{marginTop:4,opacity:.7},children:["Δ = ",s(r-i)]})]})},[se,J,ee,te,a,p,y,d,f]),ge="multi"===A,xe=(0,jc.useMemo)(()=>!1===A?()=>null:ge?me:ls(A)||me,[A,ge,me]);if(he.earlyReturn)return he.earlyReturn;const be={chartType:"mixed",data:ce,xAccessor:"__x",yAccessor:"__y",y0Accessor:"__y0",groupAccessor:"__diffSegment",areaGroups:ue,curve:v,areaStyle:fe,lineStyle:pe,...x&&{pointStyle:ye},size:[E,$],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:he.margin,showAxes:o.showAxes,xLabel:Q,yLabel:Z,xFormat:a,yFormat:l,enableHover:Y,showGrid:G,...w&&{gradientFill:!0===w?{topOpacity:.85,bottomOpacity:.15}:w},...de&&{legend:de,legendPosition:he.legendPosition},...lc({title:V,description:X,summary:U,accessibleTable:K,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),tooltipContent:xe,...ge&&{tooltipMode:"multi"},...cc({linkedHover:R,selection:_,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:he.mobileInteraction,customHoverBehavior:he.customHoverBehavior,customClickBehavior:he.customClickBehavior}),...S&&S.length>0&&{annotations:S},...C&&{xExtent:C},...M&&{yExtent:M},...he.crosshairProps,...j};return(0,_c.jsx)(Bl,{componentName:"DifferenceChart",width:E,height:$,children:(0,_c.jsx)(Ra,{ref:n,...be})})});"function"==typeof Pc&&(Pc.displayName="DifferenceChart");var Lc=require("react"),Ic=require("react/jsx-runtime"),Tc=(0,Lc.forwardRef)(function(e,t){const n=(0,Lc.useRef)(null),o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",areaBy:h,lineDataAccessor:d="coordinates",colorBy:f,colorScheme:p,styleRules:y,curve:m="monotoneX",areaOpacity:g=.7,showLine:x=!0,lineWidth:b=2,showPoints:v=!1,pointRadius:k=3,normalize:w=!1,baseline:A="zero",stackOrder:S,tooltip:C,annotations:M,xExtent:j,yExtent:_,frameProps:R={},selection:P,linkedHover:L,onObservation:I,onClick:T,hoverHighlight:N,chartId:F,loading:O,loadingContent:B,emptyContent:D,legendInteraction:z,legendPosition:H,color:E,stroke:$,strokeWidth:Y,opacity:G}=e,{width:q,height:V,enableHover:X,showGrid:U,showLegend:K,title:Q,description:Z,summary:J,accessibleTable:ee,xLabel:te,yLabel:ne}=o,oe=(0,Lc.useMemo)(()=>W(r),[r]),re=f||h;ac(t,{variant:"xy",frameRef:n});const ie=Ul({data:oe,rawData:r,colorBy:re,colorScheme:p,legendInteraction:z,legendPosition:H,selection:P,linkedHover:L,fallbackFields:re?["string"==typeof re?re:""]:[],unwrapData:!1,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"StackedAreaChart",chartId:F,showLegend:K,userMargin:i,marginDefaults:o.marginDefaults,loading:O,loadingContent:B,emptyContent:D,width:q,height:V}),se=(0,Lc.useMemo)(()=>Jl(c,u),[c,u]),{flattenedData:ae,lineStyle:le,pointStyle:ce,defaultTooltipContent:ue}=Ac({safeData:oe,data:r,areaBy:h,lineDataAccessor:d,colorBy:re,colorScale:ie.colorScale,color:E,stroke:$,strokeWidth:Y,opacity:G,effectiveSelectionHook:ie.effectiveSelectionHook,resolvedSelection:ie.resolvedSelection,areaOpacity:g,showLine:x,lineWidth:b,showPoints:v,pointRadius:k,xAccessor:c,yAccessor:u,xLabel:te,yLabel:ne,xFormat:a,yFormat:l,groupField:h||f,styleRules:y,ruleContext:se}),he=Gl({componentName:"StackedAreaChart",data:r,accessors:{xAccessor:c,yAccessor:u}}),de={chartType:"stackedarea",...null!=r&&{data:ae},xAccessor:c,yAccessor:u,groupAccessor:h||void 0,curve:m,normalize:w,baseline:w?"zero":A,stackOrder:S,lineStyle:le,...v&&ce&&{pointStyle:ce},size:[q,V],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:ie.margin,showAxes:o.showAxes,xLabel:te,yLabel:ne,xFormat:a,yFormat:l,enableHover:X,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:U,...ie.legendBehaviorProps,...lc({title:Q,description:Z,summary:J,accessibleTable:ee,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),..."multi"===C?{tooltipContent:as(),tooltipMode:"multi"}:uc({tooltip:C,defaultTooltipContent:ue}),...cc({linkedHover:L,selection:P,onObservation:I,onClick:T,hoverHighlight:N,mobileInteraction:ie.mobileInteraction,customHoverBehavior:ie.customHoverBehavior,customClickBehavior:ie.customClickBehavior}),...M&&M.length>0&&{annotations:M},...j&&{xExtent:j},..._&&{yExtent:_},...ie.crosshairProps,...R};return ie.earlyReturn?ie.earlyReturn:he?(0,Ic.jsx)(Ll,{componentName:"StackedAreaChart",message:he,width:q,height:V}):(0,Ic.jsx)(Bl,{componentName:"StackedAreaChart",width:q,height:V,children:(0,Ic.jsx)(Ra,{ref:n,...de})})});Tc.displayName="StackedAreaChart";var Nc=c(require("react")),Fc=require("react"),Oc=require("react");function Bc(e){const{colorBy:t,colorScale:n,color:o,pointRadius:r=5,radiusFn:i,fillOpacity:s=1,fallbackFill:a,baseStyleExtras:l,stroke:c,strokeWidth:u,opacity:h,effectiveSelectionHook:d,resolvedSelection:f,colorDatumAccessor:p,styleRules:y,ruleContext:m}=e,g=(0,Oc.useMemo)(()=>e=>{const c="function"==typeof l?l(e):l,u=c?{...c}:{};if(void 0===u.fillOpacity&&(u.fillOpacity=s),void 0===u.fill)if(t){if(n){const o=p?p(e):e;u.fill=Te(o,t,n)}}else u.fill=a?a(e):o||ml;return void 0===u.r&&(u.r=i?i(e):r),y&&y.length>0&&Object.assign(u,oc(e,y,m?m(e):{value:void 0})),u},[t,n,o,r,i,s,a,l,p,y,m]),x=(0,Oc.useMemo)(()=>Ql(g,{stroke:c,strokeWidth:u,opacity:h}),[g,c,u,h]);return(0,Oc.useMemo)(()=>al(x,d??null,f),[x,d,f])}var Dc=require("react");function Wc(e){const{accessor:t,data:n,isPushMode:o}=e,r=(0,Dc.useRef)(null),[i,s]=(0,Dc.useState)(0),a=(0,Dc.useCallback)(e=>{if(!o||!t)return;let n=!1;for(const o of e){const e="function"==typeof t?t(o):o[t];if(null==e)continue;const i="number"==typeof e?e:Number(e);Number.isFinite(i)&&(r.current?(r.current[0]>i&&(r.current[0]=i,n=!0),i>r.current[1]&&(r.current[1]=i,n=!0)):(r.current=[i,i],n=!0))}n&&s(e=>e+1)},[o,t]),l=(0,Dc.useCallback)(()=>{o&&(r.current=null,s(e=>e+1))},[o]);return{domain:(0,Dc.useMemo)(()=>{if(o)return r.current??void 0;if(!t||0===n.length)return;const e="function"==typeof t?t:e=>e[t];let i=1/0,s=-1/0;for(const t of n){const n=e(t);if(null==n)continue;const o="number"==typeof n?n:Number(n);Number.isFinite(o)&&(i>o&&(i=o),o>s&&(s=o))}return Number.isFinite(i)&&Number.isFinite(s)?[i,s]:void 0},[n,t,o,i]),trackPushed:a,reset:l}}function zc(e){if(!e)return;const t="boolean"==typeof e?{}:"string"==typeof e?{method:e}:e;return{type:"trend",method:t.method??"linear",...null!=t.bandwidth&&{bandwidth:t.bandwidth},...null!=t.order&&{order:t.order},...null!=t.color&&{color:t.color},...null!=t.strokeWidth&&{strokeWidth:t.strokeWidth},...null!=t.strokeDasharray&&{strokeDasharray:t.strokeDasharray},...null!=t.label&&{label:t.label}}}var Hc=require("react/jsx-runtime"),Ec=(0,Fc.forwardRef)(function(e,t){const n=(0,Fc.useRef)(null),o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",xScaleType:h,yScaleType:d,colorBy:f,colorScheme:p,styleRules:y,sizeBy:m,sizeRange:g=[3,15],symbolBy:x,symbolMap:b,pointRadius:v=5,pointOpacity:k=.8,tooltip:w,marginalGraphics:A,pointIdAccessor:S,annotations:C,regression:M,forecast:j,anomaly:_,xExtent:R,yExtent:P,frameProps:L={},selection:I,linkedHover:T,linkedBrush:N,onObservation:F,onClick:O,hoverHighlight:B,chartId:D,loading:z,loadingContent:H,emptyContent:E,legendInteraction:$,legendPosition:Y,color:G,stroke:q,strokeWidth:V,opacity:X}=e,{width:U,height:K,enableHover:Q,showGrid:Z,showLegend:J,title:ee,description:te,summary:ne,accessibleTable:oe,xLabel:re,yLabel:ie}=o,se=(0,Fc.useMemo)(()=>W(r),[r]),ae=void 0===r,{domain:le,trackPushed:ce,reset:ue}=Wc({accessor:m,data:se,isPushMode:ae}),he=(0,Fc.useCallback)(e=>{ce([e]),n.current?.push(e)},[ce]),de=(0,Fc.useCallback)(e=>{ce(e),n.current?.pushMany(e)},[ce]);ac(t,{variant:"xy",frameRef:n,overrides:{push:he,pushMany:de,clear:()=>{ue(),n.current?.clear()}}});const fe=Ul({data:se,rawData:r,colorBy:f,colorScheme:p,legendInteraction:$,legendPosition:Y,selection:I,linkedHover:T,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"Scatterplot",chartId:D,showLegend:J,userMargin:i,marginDefaults:o.marginDefaults,loading:z,loadingContent:H,emptyContent:E,width:U,height:K}),pe=il(N),ye=qa({name:pe?.name||"__unused_brush__",xField:pe?.xField||("string"==typeof c?c:void 0),yField:pe?.yField||("string"==typeof u?u:void 0)}),me=pe?"xyBrush"===ye.brushInteraction.brush?"xy":"xBrush"===ye.brushInteraction.brush?"x":"y":void 0,ge=Nc.useRef(ye.brushInteraction);ge.current=ye.brushInteraction;const xe=(0,Fc.useCallback)(e=>{const t=ge.current;t.end(e?"xyBrush"===t.brush?[[e.x[0],e.y[0]],[e.x[1],e.y[1]]]:"xBrush"===t.brush?e.x:e.y:null)},[]);El("Scatterplot",se,"xAccessor",c),El("Scatterplot",se,"yAccessor",u);const be=(0,Fc.useMemo)(()=>m?le??[0,1]:void 0,[m,le]),ve=(0,Fc.useMemo)(()=>m?e=>Oe(e,m,g,be):void 0,[m,g,be]),ke=(0,Fc.useMemo)(()=>Jl(c,u),[c,u]),we=Bc({colorBy:f,colorScale:fe.colorScale,color:G,pointRadius:v,fillOpacity:k,radiusFn:ve,stroke:q,strokeWidth:V,opacity:X,styleRules:y,ruleContext:ke,effectiveSelectionHook:fe.effectiveSelectionHook,resolvedSelection:fe.resolvedSelection}),Ae=(0,Fc.useMemo)(()=>pa([{label:re||ca(c),accessor:c,role:"x",format:a},{label:ie||ca(u),accessor:u,role:"y",format:l},...f?[{label:ca(f),accessor:f,role:"color"}]:[],...m?[{label:ca(m),accessor:m,role:"size"}]:[]]),[c,u,re,ie,f,m,a,l]),{effectiveData:Se,statisticalAnnotations:Ce}=gc({data:se,xAccessor:c,yAccessor:u,forecast:j,anomaly:_}),Me=(0,Fc.useMemo)(()=>{const e=zc(M);return e||0!==Ce.length?[...e?[e]:[],...C||[],...Ce]:C},[M,C,Ce]);if(fe.earlyReturn)return fe.earlyReturn;const je=Gl({componentName:"Scatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}});if(je)return(0,Hc.jsx)(Ll,{componentName:"Scatterplot",message:je,width:U,height:K});const _e={chartType:"scatter",...null!=r&&{data:Se},xAccessor:c,yAccessor:u,xScaleType:h,yScaleType:d,colorAccessor:f||void 0,sizeAccessor:m||void 0,...x&&{symbolAccessor:x},...b&&{symbolMap:b},sizeRange:g,pointStyle:we,colorScheme:p,size:[U,K],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:fe.margin,showAxes:o.showAxes,xLabel:re,yLabel:ie,xFormat:a,yFormat:l,enableHover:Q,showGrid:Z,...fe.legendBehaviorProps,...lc({title:ee,description:te,summary:ne,accessibleTable:oe,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...uc({tooltip:w,defaultTooltipContent:Ae}),...cc({linkedHover:T,selection:I,onObservation:F,onClick:O,hoverHighlight:B,mobileInteraction:fe.mobileInteraction,customHoverBehavior:fe.customHoverBehavior,customClickBehavior:fe.customClickBehavior}),...A&&{marginalGraphics:A},...S&&{pointIdAccessor:S},...Me&&Me.length>0&&{annotations:Me},...R&&{xExtent:R},...P&&{yExtent:P},...pe&&{brush:{dimension:me},onBrush:xe},...fe.crosshairProps,...L};return(0,Hc.jsx)(Bl,{componentName:"Scatterplot",width:U,height:K,children:(0,Hc.jsx)(Ra,{ref:n,..._e})})});Ec.displayName="Scatterplot";var $c=require("react"),Yc=require("react/jsx-runtime");function Gc(e,t){return ke(1===t?.5:e/(t-1))}var qc=(0,$c.forwardRef)(function(e,t){const n=(0,$c.useRef)(null);ac(t,{variant:"xy",frameRef:n});const o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",orderAccessor:h,orderLabel:d,styleRules:f,pointRadius:p=4,tooltip:y,pointIdAccessor:m,annotations:g,regression:x,forecast:b,anomaly:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,legendInteraction:T,stroke:N,strokeWidth:F,opacity:O}=e,{width:B,height:D,enableHover:W,showGrid:z,title:H,description:E,summary:$,accessibleTable:Y,xLabel:G,yLabel:q}=o,{safeData:V,orderMap:X}=(0,$c.useMemo)(()=>{const e=r||[],t="function"==typeof c?c:e=>e[c],n="function"==typeof u?u:e=>e[u];let o=e;if(h&&e.length>0){const t="function"==typeof h?h:e=>e[h];o=[...e].sort((e,n)=>{const o=t(e),r=t(n);return(o instanceof Date?o.getTime():+o)-(r instanceof Date?r.getTime():+r)})}const i=new WeakMap;let s=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&s++}let a=0;for(const e of o){const o=t(e),r=n(e);null!=o&&null!=r&&isFinite(o)&&isFinite(r)&&i.set(e,{idx:a++,total:s})}return{safeData:o,orderMap:i}},[r,h,c,u]);El("ConnectedScatterplot",V,"xAccessor",c),El("ConnectedScatterplot",V,"yAccessor",u);const U=Ul({data:V,rawData:r,colorBy:void 0,colorScheme:void 0,legendInteraction:T,selection:S,linkedHover:C,fallbackFields:[],unwrapData:!1,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"ConnectedScatterplot",chartId:R,showLegend:void 0,userMargin:i,marginDefaults:{top:50,right:40,bottom:60,left:70},loading:P,loadingContent:L,emptyContent:I,width:B,height:D}),K=U.resolvedSelection?.unselectedOpacity??sl,Q=(0,$c.useMemo)(()=>(e,t)=>{const n=t.filter(e=>"point"===e.type);if(2>n.length)return;const o=U.effectiveSelectionHook?.isActive,r=U.effectiveSelectionHook?.predicate,i=100>n.length,s=n.length;e.lineCap="round";for(let t=0;s-1>t;t++){const a=n[t],l=n[t+1],c=Gc(t,s),u=!o||!r||r(a.datum??a)||r(l.datum??l),h=o?u?1:K:1;i&&(e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle="white",e.lineWidth=p+2,e.globalAlpha=.5*h,e.stroke()),e.beginPath(),e.moveTo(a.x,a.y),e.lineTo(l.x,l.y),e.strokeStyle=c,e.lineWidth=p,e.globalAlpha=h,e.stroke()}e.globalAlpha=1},[p,U.effectiveSelectionHook,K]),Z=(0,$c.useMemo)(()=>[Q],[Q]),J=(0,$c.useMemo)(()=>(e,t,n)=>{const o=e.filter(e=>"point"===e.type);if(2>o.length)return null;const r=o.length,i=100>r,s=[];for(let e=0;r-1>e;e++){const t=o[e],n=o[e+1],a=Gc(e,r),l=Math.min("number"==typeof t.style?.opacity?t.style.opacity:1,"number"==typeof n.style?.opacity?n.style.opacity:1);i&&s.push((0,Yc.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:"white",strokeWidth:p+2,strokeLinecap:"round",opacity:.5*l},"halo-"+e)),s.push((0,Yc.jsx)("line",{x1:t.x,y1:t.y,x2:n.x,y2:n.y,stroke:a,strokeWidth:p,strokeLinecap:"round",opacity:l},"seg-"+e))}return(0,Yc.jsx)(Yc.Fragment,{children:s})},[p]),ee=(0,$c.useMemo)(()=>[J],[J]),te=Bc({colorScale:void 0,baseStyleExtras:(0,$c.useMemo)(()=>e=>{const t=X.get(e),n=t?.idx??0,o=t?.total??1;return{fill:o>0?Gc(n,o):"#6366f1",stroke:"white",strokeWidth:1,r:p,fillOpacity:1}},[p,X]),stroke:N,strokeWidth:F,opacity:O,styleRules:f,ruleContext:(0,$c.useMemo)(()=>Jl(c,u),[c,u]),effectiveSelectionHook:U.effectiveSelectionHook,resolvedSelection:U.resolvedSelection}),ne=d||("string"==typeof h?h:"Order"),oe=(0,$c.useMemo)(()=>pa([{label:G||ca(c),accessor:c,role:"x",format:a},{label:q||ca(u),accessor:u,role:"y",format:l},...h?[{label:ne,accessor:h,role:"group"}]:[]]),[c,u,G,q,h,ne,a,l]),re=Gl({componentName:"ConnectedScatterplot",data:r,accessors:{xAccessor:c,yAccessor:u}}),{effectiveData:ie,statisticalAnnotations:se}=gc({data:V,xAccessor:c,yAccessor:u,forecast:b,anomaly:v});if(U.earlyReturn)return U.earlyReturn;const ae=zc(x),le=ae||se.length>0?[...ae?[ae]:[],...g||[],...se]:g,ce={chartType:"scatter",...null!=r&&{data:ie},xAccessor:c,yAccessor:u,pointStyle:te,size:[B,D],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:U.margin,showAxes:o.showAxes,xLabel:G,yLabel:q,xFormat:a,yFormat:l,enableHover:W,showGrid:z,...lc({title:H,description:E,summary:$,accessibleTable:Y,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...uc({tooltip:y,defaultTooltipContent:oe}),...cc({linkedHover:C,selection:S,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:U.mobileInteraction,customHoverBehavior:U.customHoverBehavior,customClickBehavior:U.customClickBehavior}),...m&&{pointIdAccessor:m},canvasPreRenderers:Z,svgPreRenderers:ee,...le&&le.length>0&&{annotations:le},...k&&{xExtent:k},...w&&{yExtent:w},...U.crosshairProps,...A};return re?(0,Yc.jsx)(Ll,{componentName:"ConnectedScatterplot",message:re,width:B,height:D}):(0,Yc.jsx)(Bl,{componentName:"ConnectedScatterplot",width:B,height:D,children:(0,Yc.jsx)(Ra,{ref:n,...ce})})});qc.displayName="ConnectedScatterplot";var Vc=require("react"),Xc=require("react/jsx-runtime"),Uc=(0,Vc.forwardRef)(function(e,t){const n=(0,Vc.useRef)(null),o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:u="y",sizeBy:h,sizeRange:d=[5,40],colorBy:f,colorScheme:p,styleRules:y,bubbleOpacity:m=.6,bubbleStrokeWidth:g=1,bubbleStrokeColor:x="white",tooltip:b,marginalGraphics:v,pointIdAccessor:k,annotations:w,regression:A,xExtent:S,yExtent:C,frameProps:M={},selection:j,linkedHover:_,linkedBrush:R,onObservation:P,onClick:L,hoverHighlight:I,chartId:T,loading:N,loadingContent:F,emptyContent:O,legendInteraction:B,legendPosition:D,color:z,stroke:H,strokeWidth:E,opacity:$}=e,{width:Y,height:G,enableHover:q,showGrid:V,showLegend:X,title:U,description:K,summary:Q,accessibleTable:Z,xLabel:J,yLabel:ee}=o,te=(0,Vc.useMemo)(()=>W(r),[r]),ne=void 0===r,oe=Ul({data:te,rawData:r,colorBy:f,colorScheme:p,legendInteraction:B,legendPosition:D,selection:j,linkedHover:_,fallbackFields:f?["string"==typeof f?f:""]:[],unwrapData:!1,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"BubbleChart",chartId:T,showLegend:X,userMargin:i,marginDefaults:o.marginDefaults,loading:N,loadingContent:F,emptyContent:O,width:Y,height:G}),{domain:re,trackPushed:ie,reset:se}=Wc({accessor:h,data:te,isPushMode:ne}),ae=(0,Vc.useCallback)(e=>{ie([e]),n.current?.push(e)},[ie]),le=(0,Vc.useCallback)(e=>{ie(e),n.current?.pushMany(e)},[ie]);ac(t,{variant:"xy",frameRef:n,overrides:{push:ae,pushMany:le,clear:()=>{se(),n.current?.clear()}}});const ce=il(R),ue=(qa({name:ce?.name||"__unused_brush__",xField:ce?.xField||("string"==typeof c?c:void 0),yField:ce?.yField||("string"==typeof u?u:void 0)}),(0,Vc.useMemo)(()=>({stroke:x,strokeWidth:g}),[x,g])),he=(0,Vc.useMemo)(()=>re??[0,1],[re]),de=(0,Vc.useCallback)(e=>Oe(e,h,d,he),[h,d,he]),fe=(0,Vc.useMemo)(()=>Jl(c,u),[c,u]),pe=Bc({colorBy:f,colorScale:oe.colorScale,color:z,fillOpacity:m,radiusFn:de,baseStyleExtras:ue,stroke:H,strokeWidth:E,opacity:$,styleRules:y,ruleContext:fe,effectiveSelectionHook:oe.effectiveSelectionHook,resolvedSelection:oe.resolvedSelection}),ye=(0,Vc.useMemo)(()=>pa([{label:J||ca(c),accessor:c,role:"x",format:a},{label:ee||ca(u),accessor:u,role:"y",format:l},{label:ca(h),accessor:h,role:"size"},...f?[{label:ca(f),accessor:f,role:"color"}]:[]]),[c,u,J,ee,h,f,a,l]);if(oe.earlyReturn)return oe.earlyReturn;const me=Gl({componentName:"BubbleChart",data:r,accessors:{xAccessor:c,yAccessor:u},requiredProps:{sizeBy:h}});if(me)return(0,Xc.jsx)(Ll,{componentName:"BubbleChart",message:me,width:Y,height:G});const ge=zc(A),xe=ge?[ge,...w||[]]:w,be={chartType:"bubble",...null!=r&&{data:te},xAccessor:c,yAccessor:u,colorAccessor:f||void 0,sizeAccessor:h,sizeRange:d,pointStyle:pe,colorScheme:p,size:[Y,G],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:oe.margin,showAxes:o.showAxes,xLabel:J,yLabel:ee,xFormat:a,yFormat:l,enableHover:q,showGrid:V,...oe.legendBehaviorProps,...lc({title:U,description:K,summary:Q,accessibleTable:Z,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...uc({tooltip:b,defaultTooltipContent:ye}),...cc({linkedHover:_,selection:j,onObservation:P,onClick:L,hoverHighlight:I,mobileInteraction:oe.mobileInteraction,customHoverBehavior:oe.customHoverBehavior,customClickBehavior:oe.customClickBehavior}),...v&&{marginalGraphics:v},...k&&{pointIdAccessor:k},...xe&&xe.length>0&&{annotations:xe},...S&&{xExtent:S},...C&&{yExtent:C},...oe.crosshairProps,...M};return(0,Xc.jsx)(Bl,{componentName:"BubbleChart",width:Y,height:G,children:(0,Xc.jsx)(Ra,{ref:n,...be})})});Uc.displayName="BubbleChart";var Kc=require("react"),Qc=require("d3-scale");d();var Zc=require("react/jsx-runtime"),Jc=(0,Kc.forwardRef)(function(e,t){const n=(0,Kc.useRef)(null);ac(t,{variant:"xy",frameRef:n});const o=_l(e.mode,{width:e.width,height:e.height,showGrid:void 0,enableHover:e.enableHover,showLegend:void 0,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xAccessor:a="x",yAccessor:l="y",valueAccessor:c="value",xFormat:h,yFormat:d,colorScheme:f,customColorScale:p,showValues:y=!1,valueFormat:m,cellBorderColor:g="#fff",cellBorderWidth:x=1,tooltip:b,annotations:v,xExtent:k,yExtent:w,frameProps:A={},selection:S,linkedHover:C,onObservation:M,onClick:j,hoverHighlight:_,chartId:R,loading:P,loadingContent:L,emptyContent:I,showLegend:T,legendPosition:N,legendInteraction:F}=e,{width:O,height:B,enableHover:D,title:z,description:H,summary:E,accessibleTable:$,xLabel:Y,yLabel:G}=o,q=Hl(P,O,B,L),V=q?null:zl(r,O,B,I),X=(0,Kc.useMemo)(()=>W(r),[r]),U=function(){const e=cl();return e?.colors?.sequential||void 0}(),K=f??U??"blues",Q=T??!1,Z=N??"right",{margin:J}=Cl({data:X,colorBy:Q?"value":void 0,colorScale:void 0,showLegend:Q,legendPosition:Z,userMargin:i,defaults:o.marginDefaults}),{customHoverBehavior:ee,customClickBehavior:te,crosshairSourceId:ne}=Al({selection:S,linkedHover:C,fallbackFields:[],onObservation:M,onClick:j,chartType:"Heatmap",chartId:R,hoverHighlight:_,colorByField:void 0,mobileInteraction:o.mobileInteraction});Xl(S);const oe=Sl(C,ne);Ml(F,void 0,[]);const re=(0,Kc.useMemo)(()=>"function"==typeof c?e=>c(e):e=>e[c],[c]),ie=(0,Kc.useMemo)(()=>u(X.map(re)),[X,re]),se=(0,Kc.useMemo)(()=>{if("custom"===K&&p)return p;const e=_e(K);return(0,Qc.scaleSequential)(e).domain(ie)},[K,p,ie]),ae=(0,Kc.useMemo)(()=>pa([{label:Y||ca(a),accessor:a,role:"x",format:h},{label:G||ca(l),accessor:l,role:"y",format:d},{label:ca(c),accessor:c,role:"value",format:m}]),[a,l,Y,G,c,h,d,m]),le=Gl({componentName:"Heatmap",data:r,accessors:{xAccessor:a,yAccessor:l,valueAccessor:c}}),ce=(0,Kc.useMemo)(()=>{if(Q)return{gradient:{colorFn:e=>se(e),domain:ie,label:"string"==typeof c?c:"value",format:m}}},[Q,se,ie,c,m]),ue={chartType:"heatmap",...null!=r&&{data:X},xAccessor:a,yAccessor:l,valueAccessor:c,colorScheme:"custom"!==K?K:void 0,showValues:y,heatmapValueFormat:m,size:[O,B],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:J,showAxes:o.showAxes,xLabel:Y,yLabel:G,xFormat:h,yFormat:d,enableHover:D,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...ce&&{legend:ce,legendPosition:Z},...lc({title:z,description:H,summary:E,accessibleTable:$,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...uc({tooltip:b,defaultTooltipContent:ae}),...cc({linkedHover:C,selection:S,onObservation:M,onClick:j,hoverHighlight:_,mobileInteraction:o.mobileInteraction,customHoverBehavior:ee,customClickBehavior:te}),...v&&v.length>0&&{annotations:v},...k&&{xExtent:k},...w&&{yExtent:w},...oe,...A};return q||V||(le?(0,Zc.jsx)(Ll,{componentName:"Heatmap",message:le,width:O,height:B}):(0,Zc.jsx)(Bl,{componentName:"Heatmap",width:O,height:B,children:(0,Zc.jsx)(Ra,{ref:n,...ue})}))});Jc.displayName="Heatmap";var eu=c(require("react")),tu=require("react"),nu=require("d3-brush"),ou=require("d3-selection");d();var ru=require("react/jsx-runtime"),iu="__splomIdx",su="splom-hover-source",au={top:4,bottom:4,left:4,right:4};function lu({frameRef:e,cellSize:t,onBrush:n}){const o=(0,tu.useRef)(null),r=t-au.left-au.right,i=t-au.top-au.bottom;return(0,tu.useEffect)(()=>{if(!o.current)return;const t=(0,ou.select)(o.current).select(".brush-g"),s=(0,nu.brush)().extent([[0,0],[r,i]]).on("brush end",t=>{const o=e.current?.getScales();if(!o)return;if(!(r=t.selection)||!Array.isArray(r[0]))return void n(null);var r;const[[i,s],[a,l]]=t.selection,c=[[o.x.invert(i),o.y.invert(s)],[o.x.invert(a),o.y.invert(l)]];n(c)});return t.call(s),t.select(".selection").attr("fill","steelblue").attr("fill-opacity",.15).attr("stroke","steelblue").attr("stroke-width",1),()=>{s.on("brush end",null)}},[r,i,e,n]),(0,ru.jsx)("svg",{ref:o,width:t,height:t,style:{position:"absolute",top:0,left:0},children:(0,ru.jsx)("g",{className:"brush-g",transform:`translate(${au.left},${au.top})`})})}function cu({data:e,xField:t,yField:n,cellSize:o,pointRadius:r,pointOpacity:i,colorBy:s,colorScale:a,brushSelectionName:l,hoverSelectionName:c,unselectedOpacity:u,mobileInteraction:h,mode:d,onPointHover:f,onPointClick:p}){const y=(0,tu.useRef)(null),m=Ya({name:l,clientId:`splom-${t}-${n}`,fields:[t,n]}),g=qa({name:l,xField:t,yField:n}),x=Ya({name:c,clientId:su,fields:[iu]}),b=x.selectPoints,v=(0,tu.useCallback)(e=>{e?g.brushInteraction.during(e):g.brushInteraction.end(null)},[g.brushInteraction]),k=(0,tu.useCallback)(e=>{if(!e)return void f?.(null);const t=e.data,n=t?.[iu];void 0!==n&&(b({[iu]:[n]}),f?.(t,e.x+au.left,e.y+au.top))},[b,f]),w=(0,tu.useCallback)(e=>{if(!e)return void p?.(null);const t=e.data;t&&p?.(t,e.x+au.left,e.y+au.top)},[p]),A=(0,tu.useCallback)(e=>{const t={opacity:i,r:r};return t.fill=s?Te(e,s,a):ml,"hover"===d?x.isActive&&x.predicate(e)?(t.opacity=1,t.r=2.5*r,t.stroke="#333",t.strokeWidth=1.5):x.isActive&&(t.opacity=.6*i):m.isActive&&!m.predicate(e)&&(t.opacity=u),t},[i,r,s,d,a,x,m,u]);return(0,ru.jsxs)("div",{style:{position:"relative",width:o,height:o},children:[(0,ru.jsx)(Ra,{ref:y,chartType:"scatter",data:e,size:[o,o],xAccessor:t,yAccessor:n,pointStyle:A,margin:au,showAxes:!1,enableHover:"hover"===d,...cc({forceHoverBehavior:"hover"===d,forceClickBehavior:!!p,mobileInteraction:h,customHoverBehavior:k,customClickBehavior:w}),tooltipContent:"hover"===d?()=>null:void 0}),"brush"===d&&(0,ru.jsx)(lu,{frameRef:y,cellSize:o,xField:t,yField:n,onBrush:v})]})}function uu({data:e,field:t,label:n,cellSize:o,bins:r,colorBy:i,colorScale:s,brushSelectionName:a,hoverSelectionName:l,mode:c}){const d=Ya({name:a,clientId:"splom-diag-"+t,fields:[t]}),f=Ya({name:l,clientId:`splom-diag-${t}-hover`,fields:[iu]}),p="hover"===c?f:d,y=p.isActive,m=p.predicate,g=(0,tu.useMemo)(()=>{const n="string"==typeof i?i:null,s=[],a=new Set;for(const o of e){const e=o[t];if(null==e||isNaN(e)||s.push(Number(e)),n){const e=o[n];null!=e&&a.add(e+"")}}if(0===s.length)return{bars:[],selectedBars:[],categoryBars:[],selectedCategoryBars:[],max:0,categories:[]};const[l,c]=u(s),d=(c-l)/r||1,f=Array.from(a),p=new Map(f.map((e,t)=>[e,t])),g=Array(r).fill(0),x=Array(r).fill(0),b=Array.from({length:r},()=>Array(f.length).fill(0)),v=Array.from({length:r},()=>Array(f.length).fill(0));for(const o of e){const e=o[t];if(null==e||isNaN(e))continue;const i=Math.min(Math.floor((e-l)/d),r-1);if(g[i]++,y&&!m(o)||x[i]++,n){const e=p.get(o[n]+"");void 0!==e&&(b[i][e]++,y&&!m(o)||v[i][e]++)}}const k=h(g,1),w=b.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/k*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:f[i]};return n+=s,a})}),A=v.map((e,t)=>{let n=0;return e.map((e,i)=>{const s=e/k*(o-24),a={x:t/r*o,w:o/r-1,h:s,y0:n,category:f[i]};return n+=s,a})});return{bars:g.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/k*(o-24),count:e})),selectedBars:x.map((e,t)=>({x:t/r*o,w:o/r-1,h:e/k*(o-24),count:e})),categoryBars:w,selectedCategoryBars:A,max:k,categories:f}},[e,t,r,o,y,m,i]);return(0,ru.jsxs)("svg",{width:o,height:o,style:{overflow:"hidden"},children:[(0,ru.jsx)("text",{x:o/2,y:14,textAnchor:"middle",fontSize:11,fontWeight:"bold",fill:"#333",children:n}),g.categories.length>0?g.categoryBars.map((e,t)=>e.map((e,n)=>(0,ru.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):ml,opacity:y?.3:.6},`bg-${t}-${n}`))):g.bars.map((e,t)=>(0,ru.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:ml,opacity:y?.3:.6},"bg-"+t)),y&&(g.categories.length>0?g.selectedCategoryBars.map((e,t)=>e.map((e,n)=>(0,ru.jsx)("rect",{x:e.x,y:o-e.y0-e.h,width:Math.max(e.w,1),height:e.h,fill:s?s(e.category):ml,opacity:.7},`sel-${t}-${n}`))):g.selectedBars.map((e,t)=>(0,ru.jsx)("rect",{x:e.x,y:o-e.h,width:Math.max(e.w,1),height:e.h,fill:ml,opacity:.7},"sel-"+t)))]})}function hu({label:e,cellSize:t}){return(0,ru.jsx)("svg",{width:t,height:t,children:(0,ru.jsx)("text",{x:t/2,y:t/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:12,fontWeight:"bold",fill:"#333",children:e})})}function du(e){const{data:t,fields:n,fieldLabels:o={},colorBy:r,colorScheme:i,cellSize:s=150,cellGap:a=4,pointRadius:l=2,pointOpacity:c=.5,diagonal:u="histogram",histogramBins:h=20,brushMode:d="crossfilter",hoverMode:f=!0,unselectedOpacity:p=.1,showGrid:y=!1,tooltip:m,showLegend:g,idAccessor:x,width:b,className:v,onObservation:k,onClick:w,chartId:A}=e,S="splom",C="splom-hover",M=vl(e.mobileInteraction,{mode:e.mode,width:b??n.length*s,mobileSemantics:e.mobileSemantics}),j=f?"hover":d?"brush":"hover",_=Ea(e=>e.clearSelection),[R,P]=(0,tu.useState)(null),L=(0,tu.useCallback)(()=>{_(C),P(null)},[_,C]),I=(0,tu.useMemo)(()=>(t||[]).map((e,t)=>void 0!==e[iu]?e:{...e,[iu]:t}),[t]),T=wl(I,r,i),N=(0,tu.useCallback)((e,t,n,o)=>[40+e*(s+a)+(n??0),t*(s+a)+(o??0)],[40,s,a]),F=void 0!==g?g:!!r,O=(0,tu.useMemo)(()=>{if(!F||!r)return null;const e="string"==typeof r?r:null;return e?Array.from(new Set(I.map(t=>t[e]).filter(e=>null!=e))).map(e=>({label:e+"",color:T?T(e+""):ml})):null},[F,r,I,T]),B=(0,tu.useMemo)(()=>({display:"grid",gridTemplateColumns:"40px "+n.map(()=>s+"px").join(" "),gridTemplateRows:n.map(()=>s+"px").join(" ")+" 40px",gap:a+"px",width:"fit-content"}),[n,s,a,40]);return(0,ru.jsxs)("div",{className:v,style:{position:"relative"},children:[O&&(0,ru.jsx)("div",{style:{display:"flex",gap:12,marginBottom:8,flexWrap:"wrap"},children:O.map(e=>(0,ru.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,ru.jsx)("span",{style:{display:"inline-block",width:10,height:10,borderRadius:"50%",backgroundColor:e.color}}),(0,ru.jsx)("span",{style:{fontSize:11},children:e.label})]},e.label))}),(0,ru.jsxs)("div",{style:B,onMouseLeave:"hover"===j?L:void 0,children:[n.map((e,t)=>(0,ru.jsxs)(eu.Fragment,{children:[(0,ru.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",writingMode:"vertical-rl",transform:"rotate(180deg)",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e}),n.map((n,i)=>t===i?"label"===u?(0,ru.jsx)(hu,{label:o[e]||e,cellSize:s},"diag-"+e):(0,ru.jsx)(uu,{data:I,field:e,label:o[e]||e,cellSize:s,bins:h,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,mode:j},"diag-"+e):(0,ru.jsx)(cu,{data:I,xField:n,yField:e,fieldLabels:o,cellSize:s,pointRadius:l,pointOpacity:c,colorBy:r,colorScale:T,brushSelectionName:S,hoverSelectionName:C,unselectedOpacity:p,showGrid:y,tooltip:m,mobileInteraction:M,mode:j,onPointHover:"hover"===j?(o,r,s)=>{if(o){if(P({datum:o,xField:n,yField:e,colIndex:i,rowIndex:t,px:r??0,py:s??0}),k){const[e,n]=N(i,t,r,s);k({type:"hover",datum:o,x:e,y:n,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}}else P(null),k&&k({type:"hover-end",timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0,onPointClick:w||k?(e,n,o)=>{if(!e)return;const[r,s]=N(i,t,n,o);w&&w(e,{x:r,y:s}),k&&k({type:"click",datum:e,x:r,y:s,timestamp:Date.now(),chartType:"ScatterplotMatrix",chartId:A})}:void 0},`cell-${e}-${n}`))]},"row-"+e)),(0,ru.jsx)("div",{})," ",n.map(e=>(0,ru.jsx)("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:"bold",color:"#333"},children:o[e]||e},"col-label-"+e))]}),R&&"hover"===j&&(()=>{const e=R.datum,t=o[R.xField]||R.xField,n=o[R.yField]||R.yField,i=r?"function"==typeof r?r(e):e[r]:null,l=x?"function"==typeof x?x(e):e[x]:"Row "+e[iu];return(0,ru.jsxs)("div",{style:{position:"absolute",left:40+R.colIndex*(s+a)+R.px,top:R.rowIndex*(s+a)+R.py-8,transform:"translate(-50%, -100%)",color:"#333",background:"rgba(255,255,255,0.95)",border:"1px solid #ddd",borderRadius:3,padding:"4px 8px",fontSize:11,lineHeight:1.4,whiteSpace:"nowrap",pointerEvents:"none",zIndex:10},children:[(0,ru.jsx)("div",{style:{fontWeight:"bold",marginBottom:2},children:l+""}),(0,ru.jsxs)("div",{children:[t,": ",null!=e[R.xField]?Number(e[R.xField]).toFixed(1):"–"]}),(0,ru.jsxs)("div",{children:[n,": ",null!=e[R.yField]?Number(e[R.yField]).toFixed(1):"–"]}),null!=i&&(0,ru.jsxs)("div",{style:{opacity:.8},children:["string"==typeof r?r:"group",": ",i+""]})]})})()]})}function fu(e){const{brushMode:t="crossfilter",hoverMode:n=!0}=e,o={};return!n&&t&&(o.splom={resolution:t}),n&&(o["splom-hover"]={resolution:"union"}),(0,ru.jsx)(rl,{selections:o,children:(0,ru.jsx)(du,{...e})})}fu.displayName="ScatterplotMatrix";var pu=require("react"),yu=require("d3-brush"),mu=require("d3-selection"),gu=require("react/jsx-runtime");function xu({width:e,height:t,margin:n,scales:o,brushDirection:r,extent:i,onBrush:s}){const a=(0,pu.useRef)(null),l=(0,pu.useRef)(null),c=(0,pu.useRef)(!1),u=e+n.left+n.right,h=t+n.top+n.bottom;return(0,pu.useEffect)(()=>{if(!a.current||!o)return;const n=(0,mu.select)(a.current).select(".brush-group"),i="x"===r?(0,yu.brushX)().extent([[0,0],[e,t]]):(0,yu.brushY)().extent([[0,0],[e,t]]);return i.on("brush end",e=>{if(c.current)return;if(!e.sourceEvent)return;const t=e.selection;if(!t)return void s(null);const n=("x"===r?o.x:o.y).invert;if(!n)return;const i=[n(t[0]),n(t[1])];s(i)}),n.call(i),l.current=e=>{n.call(i.move,e)},n.select(".selection").attr("fill","steelblue").attr("fill-opacity",.2).attr("stroke","steelblue").attr("stroke-width",1),()=>{l.current=null,i.on("brush end",null)}},[o,e,t,r,s]),(0,pu.useEffect)(()=>{if(!l.current||!o||!a.current)return;const e="x"===r?o.x:o.y;if(c.current=!0,i){const t=[e(i[0]),e(i[1])];l.current(t)}else l.current(null);c.current=!1},[i,o,r]),(0,gu.jsx)("svg",{ref:a,width:u,height:h,style:{position:"absolute",top:0,left:0,pointerEvents:"all"},children:(0,gu.jsx)("g",{className:"brush-group",transform:`translate(${n.left},${n.top})`})})}function bu(e){const{data:t,width:n=600,height:o=400,margin:r,className:i,title:s,description:a,summary:l,xLabel:c,yLabel:u,xFormat:h,yFormat:d,xAccessor:f="x",yAccessor:p="y",lineBy:y,lineDataAccessor:m="coordinates",colorBy:g,colorScheme:x,curve:b="linear",lineWidth:v=2,fillArea:k=!1,areaOpacity:w=.3,showPoints:A=!1,pointRadius:S=3,enableHover:C=!0,showGrid:M=!1,showLegend:j,legendPosition:_,tooltip:R,minimap:P={},renderBefore:L=!1,onBrush:I,brushExtent:T,yExtent:N,frameProps:F={},loading:O,loadingContent:B,emptyContent:D}=e,z=Hl(O,n,o,B),H=z?null:zl(t,n,o,D),E=(0,pu.useMemo)(()=>W(t),[t]),[$,Y]=(0,pu.useState)(null),G=T??$,q=(0,pu.useCallback)(e=>{T||Y(e),I?.(e)},[T,I]),V=(0,pu.useRef)(null),[X,U]=(0,pu.useState)(null);(0,pu.useEffect)(()=>{let e=0,t=!1;const n=()=>{if(t)return;const o=V.current?.getScales?.();o?U(o):e=requestAnimationFrame(n)};return e=requestAnimationFrame(n),()=>{t=!0,e&&cancelAnimationFrame(e)}},[t]);const K=void 0!==E[0]?.[m],Q=(0,pu.useMemo)(()=>{if(K)return E;if(y){const e=E.reduce((e,t)=>{const n="function"==typeof y?y(t):t[y];if(!e[n]){const t={[m]:[]};"string"==typeof y&&(t[y]=n),e[n]=t}return e[n][m].push(t),e},{});return Object.values(e)}return[{[m]:E}]},[E,y,m,K]),Z=(0,pu.useMemo)(()=>K||y?Q.flatMap(e=>{const t=e[m]||[];return y&&"string"==typeof y?t.map(t=>({...t,[y]:e[y]})):t}):E,[Q,m,K,y,E]),J=wl(E,g,x),ee=ic({lineWidth:v,colorBy:g,colorScale:J,fillArea:k,areaOpacity:w}),te=(0,pu.useMemo)(()=>{if(P.lineStyle)return P.lineStyle},[P.lineStyle]),ne=ic({lineWidth:1,colorBy:g,colorScale:J}),oe=te??ne,re=(0,pu.useMemo)(()=>{if(A)return e=>{const t={r:S,fillOpacity:1};return t.fill=g?Te(e.parentLine||e,g,J):ml,t}},[A,S,g,J]),{legend:ie,margin:se,legendPosition:ae}=Cl({data:Q,colorBy:g,colorScale:J,showLegend:j,legendPosition:_,userMargin:r}),le=P.height||60,ce=(0,pu.useMemo)(()=>({top:P.margin?.top??0,bottom:P.margin?.bottom??20,left:P.margin?.left??se.left,right:P.margin?.right??se.right}),[P.margin,se]),ue=P.brushDirection||"x",he=(0,pu.useMemo)(()=>pa([{label:c||ca(f),accessor:f,role:"x",format:h},{label:u||ca(p),accessor:p,role:"y",format:d}]),[f,p,c,u,h,d]),de=Gl({componentName:"MinimapChart",data:t,accessors:{xAccessor:f,yAccessor:p}});if(de)return(0,gu.jsx)(Ll,{componentName:"MinimapChart",message:de,width:n,height:o});const fe=k?"area":"line",pe={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:ee,...A&&{pointStyle:re},size:[n,o],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:se,showAxes:!0,xLabel:c,yLabel:u,xFormat:h,yFormat:d,enableHover:C,showGrid:M,...ie&&{legend:ie,legendPosition:ae},...s&&{title:s},...a&&{description:a},...l&&{summary:l},tooltipContent:!1===R?()=>null:ls(R)||he,...G&&{xExtent:G},...N&&{yExtent:N},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},...F},ye={chartType:fe,data:Z,xAccessor:f,yAccessor:p,groupAccessor:y||void 0,curve:b,lineStyle:oe,size:[n,le+ce.top+ce.bottom],margin:ce,showAxes:P.showAxes??!1,background:P.background,enableHover:!1,...N&&{yExtent:N}},me=(0,gu.jsxs)("div",{style:{position:"relative",width:n,overflow:"hidden"},children:[(0,gu.jsx)(Ra,{ref:V,...ye}),(0,gu.jsx)(xu,{width:n-ce.left-ce.right,height:le,margin:ce,scales:X,brushDirection:ue,extent:G,onBrush:q})]},"minimap"),ge=(0,gu.jsx)("div",{style:{overflow:"hidden"},children:(0,gu.jsx)(Ra,{...pe})},"main");return z||H||(0,gu.jsx)(Bl,{componentName:"MinimapChart",width:n,height:o,children:(0,gu.jsxs)("div",{className:"minimap-chart"+(i?" "+i:""),children:[L?me:ge,L?ge:me]})})}bu.displayName="MinimapChart";var vu=require("react"),ku={label:"Low / High",color:"#E9C46A",opacity:.08},wu={label:"High / High",color:"#2A9D8F",opacity:.08},Au={label:"Low / Low",color:"#E76F51",opacity:.08},Su={label:"High / Low",color:"#86BBD8",opacity:.08};d();var Cu=require("react/jsx-runtime");function Mu(e,t){return{label:t?.label??e.label,color:t?.color??e.color,opacity:t?.opacity??e.opacity}}var ju=(0,vu.forwardRef)(function(e,t){const n=(0,vu.useRef)(null);ac(t,{variant:"xy",frameRef:n});const o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",yAccessor:h="y",xCenter:d,yCenter:f,quadrants:p,centerlineStyle:y={},showQuadrantLabels:m=!0,quadrantLabelSize:g=12,colorBy:x,colorScheme:b,styleRules:v,sizeBy:k,sizeRange:w=[3,15],pointRadius:A=5,pointOpacity:S=.8,tooltip:C,pointIdAccessor:M,annotations:j,frameProps:_={},selection:R,linkedHover:P,onObservation:L,onClick:I,hoverHighlight:T,chartId:N,loading:F,loadingContent:O,emptyContent:B,legendInteraction:D,legendPosition:z,color:H,stroke:E,strokeWidth:$,opacity:Y}=e,{width:G,height:q,enableHover:V,showGrid:X,showLegend:U,title:K,description:Q,summary:Z,accessibleTable:J,xLabel:ee,yLabel:te}=o,ne=(0,vu.useMemo)(()=>({topLeft:Mu(ku,p?.topLeft),topRight:Mu(wu,p?.topRight),bottomLeft:Mu(Au,p?.bottomLeft),bottomRight:Mu(Su,p?.bottomRight)}),[p]),oe=(0,vu.useMemo)(()=>W(r),[r]),re=Ul({data:oe,rawData:r,colorBy:x,colorScheme:b,legendInteraction:D,legendPosition:z,selection:R,linkedHover:P,fallbackFields:"string"==typeof x?[x]:[],unwrapData:!1,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:o.mobileInteraction,mobileSemantics:o.mobileSemantics,chartType:"QuadrantChart",chartId:N,showLegend:U,userMargin:i,marginDefaults:o.marginDefaults,loading:F,loadingContent:O,emptyContent:B,width:G,height:q});El("QuadrantChart",oe,"xAccessor",c),El("QuadrantChart",oe,"yAccessor",h);const ie=(0,vu.useMemo)(()=>{if(!oe.length)return;const e="function"==typeof c?c:e=>+e[c],t="function"==typeof h?h:e=>+e[h];let n=1/0,o=-1/0,r=1/0,i=-1/0;for(const s of oe){const a=e(s),l=t(s);isFinite(a)&&(n>a&&(n=a),a>o&&(o=a)),isFinite(l)&&(r>l&&(r=l),l>i&&(i=l))}if(null!=d&&isFinite(d)&&(n>d&&(n=d),d>o&&(o=d)),null!=f&&isFinite(f)&&(r>f&&(r=f),f>i&&(i=f)),n===1/0)return;const s=.1*(o-n)||1,a=.1*(i-r)||1;return{xExtent:[n-s,o+s],yExtent:[r-a,i+a]}},[oe,c,h,d,f]),se=(0,vu.useMemo)(()=>{if(!k||0===oe.length)return;const e=oe.map(e=>"function"==typeof k?k(e):e[k]).filter(e=>"number"==typeof e&&Number.isFinite(e));return 0!==e.length?u(e):void 0},[oe,k]),ae=(0,vu.useMemo)(()=>"function"==typeof c?c:e=>+e[c],[c]),le=(0,vu.useMemo)(()=>"function"==typeof h?h:e=>+e[h],[h]),ce=(0,vu.useMemo)(()=>e=>{const t=ae(e),n=le(e),o=null!=d?t>=d:void 0,r=null!=f?n>=f:void 0;return void 0===r||void 0===o?H||ml:r&&o?ne.topRight.color:r&&!o?ne.topLeft.color:!r&&o?ne.bottomRight.color:ne.bottomLeft.color},[ae,le,d,f,ne,H]),ue=(0,vu.useMemo)(()=>k?e=>Oe(e,k,w,se):void 0,[k,w,se]),he=(0,vu.useMemo)(()=>Jl(c,h),[c,h]),de=Bc({colorBy:x,colorScale:re.colorScale,color:H,pointRadius:A,fillOpacity:S,radiusFn:ue,fallbackFill:ce,stroke:E,strokeWidth:$,opacity:Y,styleRules:v,ruleContext:he,effectiveSelectionHook:re.effectiveSelectionHook,resolvedSelection:re.resolvedSelection}),fe=(0,vu.useMemo)(()=>{if(!oe.length)return;const e=new Set;"string"==typeof c&&e.add(c),"string"==typeof h&&e.add(h),"string"==typeof x&&e.add(x),"string"==typeof k&&e.add(k);const t=oe[0];for(const n of Object.keys(t))if(!n.startsWith("_")&&!e.has(n)&&"string"==typeof t[n])return n},[oe,c,h,x,k]),pe=(0,vu.useMemo)(()=>pa([...fe?[{label:fe,accessor:fe,role:"title"}]:[],{label:ee||ca(c),accessor:c,role:"x",format:a},{label:te||ca(h),accessor:h,role:"y",format:l},...x?[{label:ca(x),accessor:x,role:"color"}]:[],...k?[{label:ca(k),accessor:k,role:"size"}]:[]]),[fe,c,h,ee,te,x,k,a,l]),ye=Gl({componentName:"QuadrantChart",data:r,accessors:{xAccessor:c,yAccessor:h}}),me=(0,vu.useMemo)(()=>{const e={stroke:y.stroke||"#999",strokeWidth:y.strokeWidth??1,dashArray:y.strokeDasharray||[]};return[(t,n,o,r)=>{if(!o?.x||!o?.y)return;const i=r.width,s=r.height,a=null!=d?o.x(d):i/2,l=null!=f?o.y(f):s/2;if(null!=d&&!isFinite(a))return;if(null!=f&&!isFinite(l))return;const c=Math.max(0,Math.min(i,a)),u=Math.max(0,Math.min(s,l)),h=[{config:ne.topLeft,x:0,y:0,w:c,h:u},{config:ne.topRight,x:c,y:0,w:i-c,h:u},{config:ne.bottomLeft,x:0,y:u,w:c,h:s-u},{config:ne.bottomRight,x:c,y:u,w:i-c,h:s-u}];for(const e of h)e.w>0&&e.h>0&&(t.fillStyle=e.config.color,t.globalAlpha=e.config.opacity??.08,t.fillRect(e.x,e.y,e.w,e.h));t.globalAlpha=1,t.strokeStyle=e.stroke,t.lineWidth=e.strokeWidth,e.dashArray.length>0&&t.setLineDash(e.dashArray),t.beginPath(),t.moveTo(c,0),t.lineTo(c,s),t.stroke(),t.beginPath(),t.moveTo(0,u),t.lineTo(i,u),t.stroke(),t.setLineDash([])}]},[d,f,ne,y]),ge=(0,vu.useMemo)(()=>m?[...me,(e,t,n,o)=>{if(!n?.x||!n?.y)return;const r=o.width,i=o.height,s=null!=d?n.x(d):r/2,a=null!=f?n.y(f):i/2;(null==d||isFinite(s))&&(null==f||isFinite(a))&&(e.font=`600 ${g}px sans-serif`,e.globalAlpha=.5,e.fillStyle=ne.topLeft.color,e.textAlign="left",e.textBaseline="top",e.fillText(ne.topLeft.label,8,8),e.fillStyle=ne.topRight.color,e.textAlign="right",e.textBaseline="top",e.fillText(ne.topRight.label,r-8,8),e.fillStyle=ne.bottomLeft.color,e.textAlign="left",e.textBaseline="bottom",e.fillText(ne.bottomLeft.label,8,i-8),e.fillStyle=ne.bottomRight.color,e.textAlign="right",e.textBaseline="bottom",e.fillText(ne.bottomRight.label,r-8,i-8),e.globalAlpha=1)}]:me,[me,m,g,ne,d,f]),xe=(0,vu.useMemo)(()=>{const e=_.canvasPreRenderers||[];return[...ge,...e]},[ge,_.canvasPreRenderers]),be=(0,vu.useMemo)(()=>{const e={stroke:y.stroke||"#999",strokeWidth:y.strokeWidth??1,dashArray:y.strokeDasharray?Array.isArray(y.strokeDasharray)?y.strokeDasharray.join(","):y.strokeDasharray:void 0};return[(t,n,o)=>{if(!n?.x||!n?.y)return null;const r=o.width,i=o.height,s=null!=d?n.x(d):r/2,a=null!=f?n.y(f):i/2;if(null!=d&&!isFinite(s))return null;if(null!=f&&!isFinite(a))return null;const l=Math.max(0,Math.min(r,s)),c=Math.max(0,Math.min(i,a));return(0,Cu.jsxs)(Cu.Fragment,{children:[[{config:ne.topLeft,x:0,y:0,w:l,h:c},{config:ne.topRight,x:l,y:0,w:r-l,h:c},{config:ne.bottomLeft,x:0,y:c,w:l,h:i-c},{config:ne.bottomRight,x:l,y:c,w:r-l,h:i-c}].map((e,t)=>e.w>0&&e.h>0?(0,Cu.jsx)("rect",{x:e.x,y:e.y,width:e.w,height:e.h,fill:e.config.color,opacity:e.config.opacity??.08},"qf-"+t):null),(0,Cu.jsx)("line",{x1:l,y1:0,x2:l,y2:i,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),(0,Cu.jsx)("line",{x1:0,y1:c,x2:r,y2:c,stroke:e.stroke,strokeWidth:e.strokeWidth,strokeDasharray:e.dashArray}),m&&(0,Cu.jsxs)(Cu.Fragment,{children:[(0,Cu.jsx)("text",{x:8,y:8+g,fill:ne.topLeft.color,fontWeight:600,fontSize:g,opacity:.5,children:ne.topLeft.label}),(0,Cu.jsx)("text",{x:r-8,y:8+g,fill:ne.topRight.color,fontWeight:600,fontSize:g,opacity:.5,textAnchor:"end",children:ne.topRight.label}),(0,Cu.jsx)("text",{x:8,y:i-8,fill:ne.bottomLeft.color,fontWeight:600,fontSize:g,opacity:.5,children:ne.bottomLeft.label}),(0,Cu.jsx)("text",{x:r-8,y:i-8,fill:ne.bottomRight.color,fontWeight:600,fontSize:g,opacity:.5,textAnchor:"end",children:ne.bottomRight.label})]})]})}]},[d,f,ne,y,m,g]);if(re.earlyReturn)return re.earlyReturn;const ve={chartType:"scatter",...null!=r&&{data:oe},xAccessor:c,yAccessor:h,colorAccessor:x||void 0,sizeAccessor:k||void 0,sizeRange:w,pointStyle:de,colorScheme:b,size:[G,q],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:re.margin,showAxes:o.showAxes,xLabel:ee,yLabel:te,xFormat:a,yFormat:l,enableHover:V,showGrid:X,...ie&&{xExtent:ie.xExtent,yExtent:ie.yExtent},...re.legendBehaviorProps,...K&&{title:K},...Q&&{description:Q},...Z&&{summary:Z},...void 0!==J&&{accessibleTable:J},...s&&{className:s},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:!1===C?()=>null:!0===C||void 0===C?pe:ls(C)||pe,...cc({linkedHover:P,selection:R,onObservation:L,onClick:I,hoverHighlight:T,mobileInteraction:re.mobileInteraction,customHoverBehavior:re.customHoverBehavior,customClickBehavior:re.customClickBehavior}),...M&&{pointIdAccessor:M},...j&&j.length>0&&{annotations:j},canvasPreRenderers:xe,...re.crosshairProps,..._,...xe.length>0&&{canvasPreRenderers:xe},svgPreRenderers:be};return ye?(0,Cu.jsx)(Ll,{componentName:"QuadrantChart",message:ye,width:G,height:q}):(0,Cu.jsx)(Bl,{componentName:"QuadrantChart",width:G,height:q,children:(0,Cu.jsx)(Ra,{ref:n,...ve})})});ju.displayName="QuadrantChart";var _u=c(require("react")),Ru=require("react"),Pu=require("react/jsx-runtime"),Lu="__ma_unitized",Iu="__ma_series";function Tu(e,t){const n=t[1]-t[0];return 0===n?.5:(e-t[0])/n}function Nu(e,t){return t[0]+e*(t[1]-t[0])}var Fu=(0,Ru.forwardRef)(function(e,t){const n=(0,Ru.useRef)(null),o=(0,Ru.useRef)([]),r=(0,Ru.useRef)(e.series);r.current=e.series,(0,Ru.useImperativeHandle)(t,()=>{const e=()=>(r.current??[]).filter(e=>null!=e&&"object"==typeof e);return{push:t=>{if(!n.current)return;const r=e(),i=t;for(let e=0;r.length>e&&2>e;e++){const t=r[e],s=t.extent||o.current[e];if(!s)continue;const a=("function"==typeof t.yAccessor?t.yAccessor:e=>e[t.yAccessor])(i);null!=a&&isFinite(a)&&n.current.push({...i,[Lu]:Tu(a,s),[Iu]:t.label||"Series "+(e+1)})}},pushMany:t=>{if(!n.current)return;const r=e(),i=[];for(const e of t)for(let t=0;r.length>t&&2>t;t++){const n=r[t],s=n.extent||o.current[t];if(!s)continue;const a=("function"==typeof n.yAccessor?n.yAccessor:e=>e[n.yAccessor])(e);null!=a&&isFinite(a)&&i.push({...e,[Lu]:Tu(a,s),[Iu]:n.label||"Series "+(t+1)})}n.current.pushMany(i)},remove:e=>n.current?.remove(e)??[],update:(e,t)=>n.current?.update(e,t)??[],clear:()=>n.current?.clear(),getData:()=>n.current?.getData()??[],getScales:()=>n.current?.getScales()??null}},[]);const i=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,xLabel:e.xLabel,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules},{width:800,height:400}),{data:s,margin:a,className:l,xFormat:c,xAccessor:u="x",series:h,colorScheme:d,curve:f="monotoneX",lineWidth:p=2,tooltip:y,annotations:m,frameProps:g={},selection:x,linkedHover:b,onObservation:v,onClick:k,hoverHighlight:w,chartId:A,loading:S,loadingContent:C,emptyContent:M,legendInteraction:j,legendPosition:_,stroke:R,strokeWidth:P,opacity:L}=e,{width:I,height:T,enableHover:N,showGrid:F,showLegend:O=!0,title:B,description:D,summary:z,accessibleTable:H,xLabel:E}=i,$=(0,Ru.useMemo)(()=>W(s),[s]),Y=(0,Ru.useMemo)(()=>W(h),[h]),G=Y,q=2===Y.length;"undefined"==typeof process||"production"===process.env?.NODE_ENV||q||console.warn(`[MultiAxisLineChart] Expected exactly 2 series for dual-axis mode, got ${Y.length}. Rendering as a standard multi-line chart.`);const V=Hl(S,I,T,C),X=V?null:zl(s,I,T,M),U=kl(),K=(0,Ru.useMemo)(()=>{let e;if(Array.isArray(d))e=d;else if(U&&U.length>0)e=U;else{const t=Re[d];e=Array.isArray(t)?t:Pe}return G.map((t,n)=>t.color||e[n%e.length])},[G,d,U]),Q=(0,Ru.useMemo)(()=>Y.map((e,t)=>e.label||"Series "+(t+1)),[Y]),{unitizedData:Z,extents:J}=(0,Ru.useMemo)(()=>{if(0===$.length){const e=Y.map(e=>e.extent||null).filter(Boolean);return e.length===Y.length&&(o.current=e),{unitizedData:[],extents:e.length===Y.length?e:[]}}const e=Y.map(e=>e.extent||function(e,t){let n=1/0,o=-1/0;const r="function"==typeof t?t:e=>e[t];for(const t of e){const e=r(t);null!=e&&isFinite(e)&&(n>e&&(n=e),e>o&&(o=e))}if(!isFinite(n)||!isFinite(o))return[0,1];if(n===o){const e=0===n?1:.1*Math.abs(n);return[n-e,o+e]}return[n,o]}($,e.yAccessor));if(o.current=e,!q){const t=[];for(const e of $)for(let n=0;Y.length>n;n++){const o=Y[n],r=("function"==typeof o.yAccessor?o.yAccessor:e=>e[o.yAccessor])(e);null!=r&&t.push({...e,[Lu]:r,[Iu]:Q[n]})}return{unitizedData:t,extents:e}}const t=[];for(const n of $)for(let o=0;2>o;o++){const r=Y[o],i=("function"==typeof r.yAccessor?r.yAccessor:e=>e[r.yAccessor])(n);null!=i&&t.push({...n,[Lu]:Tu(i,e[o]),[Iu]:Q[o]})}return{unitizedData:t,extents:e}},[$,Y,q,Q]),ee=(0,Ru.useMemo)(()=>{if(q&&J.length>=2)return[{orient:"left",label:Q[0],tickFormat:Y[0].format||(e=>{const t=Nu(e,J[0]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"right",label:Q[1],tickFormat:Y[1].format||(e=>{const t=Nu(e,J[1]);return Number.isInteger(t)?t+"":t.toFixed(1)})},{orient:"bottom"}]},[q,J,Y,Q]),te=Ul({data:(0,Ru.useMemo)(()=>Z.length>0?Z:Q.map(e=>({[Iu]:e})),[Z,Q]),rawData:s,colorBy:Iu,colorScheme:K,legendInteraction:j,legendPosition:_,selection:x,linkedHover:b,fallbackFields:[Iu],unwrapData:!1,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:i.mobileInteraction,mobileSemantics:i.mobileSemantics,chartType:"MultiAxisLineChart",chartId:A,showLegend:O,userMargin:a,marginDefaults:q?{...i.marginDefaults,left:70,right:70}:i.marginDefaults,loading:S,loadingContent:C,emptyContent:M,width:I,height:T}),ne=(0,Ru.useMemo)(()=>{const e=new Map;return Q.forEach((t,n)=>e.set(t,K[n])),e},[Q,K]),oe=ic({lineWidth:p,resolveStroke:(0,Ru.useCallback)(e=>ne.get(e[Iu])||K[0],[ne,K]),stroke:R,strokeWidth:P,opacity:L,effectiveSelectionHook:te.effectiveSelectionHook,resolvedSelection:te.resolvedSelection}),re=(0,Ru.useMemo)(()=>{if(!1===y)return()=>null;return ls(y)||(e=>{const t=e.data||e,n=t[Iu],o=Q.indexOf(n),r=t[Lu],i=q&&o>=0&&J[o]?Nu(r,J[o]):r,s=o>=0&&Y[o]?.format?Y[o].format:e=>Number.isInteger(e)?e+"":e.toFixed(2),a="function"==typeof u?u(t):t[u];return _u.createElement("div",{style:{padding:"6px 10px",fontFamily:"var(--semiotic-font-family, sans-serif)",fontSize:"var(--semiotic-tooltip-font-size, 13px)"}},_u.createElement("div",{style:{fontWeight:600,marginBottom:4,color:K[o]||"inherit"}},n),_u.createElement("div",null,`${"string"==typeof u?u:"x"}: ${a}`),_u.createElement("div",null,`${n}: ${s(i)}`))})},[y,Q,K,J,q,Y,u]);if(te.earlyReturn)return te.earlyReturn;const ie=Gl({componentName:"MultiAxisLineChart",data:s,accessors:{xAccessor:u}}),se=q?[0,1]:void 0,ae={chartType:"line",...null!=s&&{data:Z},xAccessor:u,yAccessor:Lu,groupAccessor:Iu,lineStyle:oe,colorScheme:K,size:[I,T],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:te.margin,showAxes:i.showAxes,...ee&&{axes:ee},xLabel:E,...q?{}:{yLabel:Q[0]},xFormat:c,...q&&se&&{yExtent:se},enableHover:N,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},showGrid:F,curve:f,...te.legendBehaviorProps,...B&&{title:B},...D&&{description:D},...z&&{summary:z},...void 0!==H&&{accessibleTable:H},...l&&{className:l},...null!=e.animate&&{animate:e.animate},...void 0!==e.axisExtent&&{axisExtent:e.axisExtent},...void 0!==e.autoPlaceAnnotations&&{autoPlaceAnnotations:e.autoPlaceAnnotations},tooltipContent:re,...m&&{annotations:m},...cc({linkedHover:b,selection:x,onObservation:v,onClick:k,hoverHighlight:w,mobileInteraction:te.mobileInteraction,customHoverBehavior:te.customHoverBehavior,customClickBehavior:te.customClickBehavior}),...te.crosshairProps,...g};return V||X||(ie?(0,Pu.jsx)(Ll,{componentName:"MultiAxisLineChart",message:ie,width:I,height:T}):(0,Pu.jsx)(Bl,{componentName:"MultiAxisLineChart",width:I,height:T,children:(0,Pu.jsx)(Ra,{ref:n,...ae})}))});Fu.displayName="MultiAxisLineChart";var Ou=require("react");function Bu(e){if(null==e)return;if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const t={};return"number"==typeof e.top&&(t.top=e.top),"number"==typeof e.right&&(t.right=e.right),"number"==typeof e.bottom&&(t.bottom=e.bottom),"number"==typeof e.left&&(t.left=e.left),t}var Du=require("react/jsx-runtime"),Wu=(0,Ou.forwardRef)(function(e,t){const n=(0,Ou.useRef)(null);ac(t,{variant:"xy",frameRef:n});const o=_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,title:e.title,xLabel:e.xLabel,yLabel:e.yLabel,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),{data:r,margin:i,className:s,xFormat:a,yFormat:l,xAccessor:c="x",highAccessor:u="high",lowAccessor:h="low",openAccessor:d,closeAccessor:f,candlestickStyle:p,tooltip:y,annotations:m,xExtent:g,yExtent:x,frameProps:b={},selection:v,linkedHover:k,onObservation:w,onClick:A,chartId:S,loading:C,loadingContent:M,emptyContent:j}=e,{width:_,height:R,enableHover:P,showGrid:L,title:I,description:T,summary:N,accessibleTable:F,xLabel:O,yLabel:B}=o,D=Hl(C,_,R,M),z=D?null:zl(r,_,R,j),H=(0,Ou.useMemo)(()=>W(r),[r]),E=null==d||null==f;El("CandlestickChart",H,"xAccessor",c),El("CandlestickChart",H,"highAccessor",u),El("CandlestickChart",H,"lowAccessor",h),E||(El("CandlestickChart",H,"openAccessor",d),El("CandlestickChart",H,"closeAccessor",f));const{customHoverBehavior:$,customClickBehavior:Y,crosshairSourceId:G}=Al({selection:v,linkedHover:k,onObservation:w,onClick:A,chartType:"CandlestickChart",chartId:S,mobileInteraction:o.mobileInteraction}),q=Sl(k,G),V=(0,Ou.useMemo)(()=>{const t=o.marginDefaults,n="sparkline"===e.mode?{...t,top:0,bottom:0}:t;return null==i?n:{...n,...Bu(i)}},[i,o.marginDefaults,e.mode]),X=(0,Ou.useMemo)(()=>{const e=[{label:O||ca(c),accessor:c,role:"x",format:a}];return E?(e.push({label:"High",accessor:u,role:"y",format:l}),e.push({label:"Low",accessor:h,format:l})):(e.push({label:"Open",accessor:d,format:l}),e.push({label:"High",accessor:u,format:l}),e.push({label:"Low",accessor:h,format:l}),e.push({label:"Close",accessor:f,format:l})),pa(e)},[c,O,a,l,u,h,d,f,E]),U=Gl({componentName:"CandlestickChart",data:r,accessors:{xAccessor:c,highAccessor:u,lowAccessor:h,...!E&&{openAccessor:d,closeAccessor:f}}}),K={chartType:"candlestick",...null!=r&&{data:H},xAccessor:c,yAccessor:u,highAccessor:u,lowAccessor:h,...!E&&{openAccessor:d,closeAccessor:f},...p&&{candlestickStyle:p},scalePadding:Math.max(2,Math.min(12,Math.round(_/40))),extentPadding:_>200?.1:.02,size:[_,R],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:V,showAxes:o.showAxes,xLabel:O,yLabel:B,xFormat:a,yFormat:l,enableHover:P,showGrid:L,...e.pointIdAccessor&&{pointIdAccessor:e.pointIdAccessor},...lc({title:I,description:T,summary:N,accessibleTable:F,className:s,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...uc({tooltip:y,defaultTooltipContent:X}),...cc({linkedHover:k,selection:v,onObservation:w,onClick:A,mobileInteraction:o.mobileInteraction,customHoverBehavior:$,customClickBehavior:Y}),...m&&m.length>0&&{annotations:m},...g&&{xExtent:g},...x&&{yExtent:x},...q,...b};return D||z||(U?(0,Du.jsx)(Ll,{componentName:"CandlestickChart",message:U,width:_,height:R}):(0,Du.jsx)(Bl,{componentName:"CandlestickChart",width:_,height:R,children:(0,Du.jsx)(Ra,{ref:n,...K})}))});Wu.displayName="CandlestickChart";var zu=require("react"),Hu=require("react");var Eu=require("react/jsx-runtime"),$u=(0,zu.forwardRef)(function(e,t){const{data:n,layout:o,layoutConfig:r,onLayoutError:i,xExtent:s,yExtent:a,showAxes:l=!1,margin:c,className:u,annotations:h,onObservation:d,onClick:f,selection:p,linkedHover:y,chartId:m,loading:g,loadingContent:x,emptyContent:b,colorBy:v,colorScheme:k,frameProps:w={}}=e,{frameRef:A,resolved:S,safeData:C,setup:M,earlyReturn:j}=function(e){const t=function(e){const t=(0,Hu.useRef)(null);return ac(e.imperativeRef,{variant:e.imperativeVariant,frameRef:t}),{frameRef:t,resolved:_l(e.mode,{width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,xLabel:e.xLabel,yLabel:e.yLabel,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules}),normalizedMargin:(0,Hu.useMemo)(()=>Bu(e.margin),[e.margin])}}(e),{resolved:n,normalizedMargin:o}=t,r=Ul({data:e.data??[],rawData:e.data,colorBy:e.colorBy,colorScheme:e.colorScheme,legendInteraction:void 0,selection:e.selection,linkedHover:e.linkedHover,fallbackFields:"string"==typeof e.colorBy?[e.colorBy]:[],unwrapData:e.unwrapData,onObservation:e.onObservation,onClick:e.onClick,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,chartType:e.chartTypeLabel,chartId:e.chartId,showLegend:n.showLegend,userMargin:o,marginDefaults:n.marginDefaults,loading:e.loading,loadingContent:e.loadingContent,emptyContent:e.emptyContent,width:n.width,height:n.height});return{...t,safeData:r.data,setup:r,earlyReturn:r.earlyReturn}}({imperativeRef:t,imperativeVariant:"xy",chartTypeLabel:"XYCustomChart",unwrapData:!1,data:n,colorBy:v,colorScheme:k,selection:p,linkedHover:y,onObservation:d,onClick:f,chartId:m,loading:g,loadingContent:x,emptyContent:b,margin:c,width:e.width,height:e.height,showGrid:e.showGrid,enableHover:e.enableHover,showLegend:e.showLegend,title:e.title,description:e.description,summary:e.summary,accessibleTable:e.accessibleTable,mode:e.mode,mobileInteraction:e.mobileInteraction,mobileSemantics:e.mobileSemantics,responsiveRules:e.responsiveRules,xLabel:e.xLabel,yLabel:e.yLabel}),_=M.effectiveSelectionHook,R=(0,zu.useMemo)(()=>_?.isActive?{isActive:!0,predicate:_.predicate}:null,[_?.isActive,_?.predicate]);if(j)return j;const{width:P,height:L,enableHover:I,showGrid:T,title:N,description:F,summary:O,accessibleTable:B,xLabel:D,yLabel:W}=S,z={chartType:"custom",...null!=n&&{data:C},customLayout:o,layoutConfig:r,onLayoutError:i,...R&&{layoutSelection:R},xExtent:s,yExtent:a,colorAccessor:v,colorScheme:k,size:[P,L],responsiveWidth:e.responsiveWidth,responsiveHeight:e.responsiveHeight,margin:M.margin,showAxes:l,xLabel:D,yLabel:W,enableHover:I,showGrid:T,...M.legendBehaviorProps,...lc({title:N,description:F,summary:O,accessibleTable:B,className:u,animate:e.animate,axisExtent:e.axisExtent,autoPlaceAnnotations:e.autoPlaceAnnotations}),...null!=e.tooltip&&{tooltipContent:e.tooltip},...cc({linkedHover:y,selection:p,onObservation:d,onClick:f,hoverHighlight:!1,mobileInteraction:M.mobileInteraction,customHoverBehavior:M.customHoverBehavior,customClickBehavior:M.customClickBehavior}),...h&&h.length>0&&{annotations:h},...M.crosshairProps,...w};return(0,Eu.jsx)(Bl,{componentName:"XYCustomChart",width:P,height:L,children:(0,Eu.jsx)(Ra,{ref:A,...z})})});$u.displayName="XYCustomChart";var Yu={fill:"rgba(0,0,0,0)",stroke:"rgba(0,0,0,0)",opacity:0},Gu=8;function qu(e){return null==e?void 0:e+""}function Vu(e){const t=qu(e.id);return{type:"point",x:e.x,y:e.y,r:e.r??Gu,style:{...Yu},datum:e.datum,pointId:t,_transitionKey:t}}function Xu(e){return{type:"rect",x:e.x,y:e.y,w:e.width,h:e.height,style:{...Yu},datum:e.datum,group:e.group,_transitionKey:qu(e.id)}}
|